Decompiled source of WKorean v1.0.4

WKorean.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using BepInEx;
using BepInEx.Logging;
using Febucci.UI;
using Febucci.UI.Core;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Users;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RadiationIsCool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadiationIsCool")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class TextureReplacer : MonoBehaviour
{
	public class SelectTexture
	{
		public string SelectName;

		public Dictionary<string, string> items;

		public SelectTexture(string name = "")
		{
			SelectName = name;
			items = new Dictionary<string, string>();
		}

		public bool IsExistItemKey(string itemkey)
		{
			return items.ContainsKey(itemkey);
		}
	}

	public static Dictionary<string, string> images = new Dictionary<string, string>();

	public static Dictionary<string, string> unique_keys = new Dictionary<string, string>();

	public static List<string> doCheckMD5_keys = new List<string>();

	public static List<int> checked_instanceID = new List<int>();

	public static bool need_clear_checked_instanceID = false;

	public static Dictionary<string, string> changed = new Dictionary<string, string>();

	public static int select_textures_index = -1;

	public static int? OldSceneId = null;

	public static int lastTextureCount = 0;

	public static bool DoDump = false;

	public static bool IsDoingDump = false;

	public TimeSpan LoopTimeLimit = new TimeSpan(0, 0, 0, 0, 1);

	public static DateTime? next_check = null;

	public static TimeSpan check_span = new TimeSpan(0, 0, 0, 2);

	public static List<SelectTexture> select_textures = new List<SelectTexture>();

	public static string imagesPath_str = "";

	public static string imagesDumpPath_str = "LCKR_Tex_Dump";

	public static string select_folder = "select";

	public static Texture2D[] Textures = (Texture2D[])(object)new Texture2D[0];

	public static int TextureIndex = -1;

	public static int TextureCount = -1;

	public static bool bOnDumping = false;

	public static char[] invalid = Path.GetInvalidFileNameChars();

	public static bool CanUseThread = true;

	public static bool DoingReplace = false;

	public static string toast_txt = "";

	public static DateTime? dtStartToast = null;

	internal static TextureReplacer Instance { get; private set; }

	public static string imagesPath { get; set; } = "";


	public static string imagesDumpPath { get; set; } = "";


	public static void Setup()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		GameObject val = new GameObject("TextureReplacer");
		Object.DontDestroyOnLoad((Object)(object)val);
		((Object)val).hideFlags = (HideFlags)61;
		Instance = val.AddComponent<TextureReplacer>();
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		imagesPath = Path.Combine(directoryName, imagesPath_str);
		imagesDumpPath = Path.Combine(directoryName, imagesDumpPath_str);
		getImages();
		Textures = (Texture2D[])(object)new Texture2D[0];
	}

	private static void getImages()
	{
		if (!Directory.Exists(imagesPath))
		{
			Directory.CreateDirectory(imagesPath);
		}
		try
		{
			images = new Dictionary<string, string>();
			unique_keys = new Dictionary<string, string>();
			doCheckMD5_keys = new List<string>();
			string[] files = Directory.GetFiles(imagesPath, "*.png", SearchOption.AllDirectories);
			Array.Sort(files);
			string[] array = files;
			foreach (string text in array)
			{
				string[] array2 = text.Split(new char[1] { Path.DirectorySeparatorChar });
				string select_str = string.Empty;
				if (array2.Count() > 5)
				{
					for (int j = 1; j < array2.Count(); j++)
					{
						if (array2[j - 1] == imagesPath_str && array2[j].ToLower() == select_folder && j + 2 < array2.Count())
						{
							select_str = array2[j + 1];
							break;
						}
					}
				}
				bool flag = false;
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
				string text2 = fileNameWithoutExtension;
				if (!images.ContainsKey(fileNameWithoutExtension))
				{
					images.Add(fileNameWithoutExtension, text);
				}
				else
				{
					flag = true;
				}
				int num = fileNameWithoutExtension.LastIndexOf('_');
				if (num > 0)
				{
					text2 = fileNameWithoutExtension.Substring(0, num);
					bool flag2 = true;
					if (fileNameWithoutExtension.Length > num + 1 && fileNameWithoutExtension.Substring(num + 1).Length == 32)
					{
						flag2 = false;
						if (!doCheckMD5_keys.Contains(text2))
						{
							doCheckMD5_keys.Add(text2);
						}
					}
					if (flag2)
					{
						if (select_str == string.Empty)
						{
							if (!doCheckMD5_keys.Contains(text2))
							{
								if (unique_keys.ContainsKey(text2))
								{
									unique_keys.Remove(text2);
									doCheckMD5_keys.Add(text2);
								}
								else
								{
									unique_keys.Add(text2, text);
								}
							}
						}
						else if (!unique_keys.ContainsKey(text2))
						{
							unique_keys.Add(text2, text);
						}
					}
				}
				else if (select_str == string.Empty)
				{
					if (!doCheckMD5_keys.Contains(text2))
					{
						if (unique_keys.ContainsKey(text2))
						{
							unique_keys.Remove(text2);
							doCheckMD5_keys.Add(text2);
						}
						else
						{
							unique_keys.Add(text2, text);
						}
					}
				}
				else if (!unique_keys.ContainsKey(text2))
				{
					unique_keys.Add(text2, text);
				}
				if (!(select_str != string.Empty))
				{
					continue;
				}
				if (fileNameWithoutExtension.Length > num + 1 && fileNameWithoutExtension.Substring(num + 1).Length == 32)
				{
					text2 = fileNameWithoutExtension;
				}
				SelectTexture selectTexture = select_textures.Find((SelectTexture x) => x.SelectName == select_str);
				if (selectTexture == null)
				{
					select_textures.Add(new SelectTexture(select_str));
					selectTexture = select_textures.Find((SelectTexture x) => x.SelectName == select_str);
				}
				if (selectTexture != null && !selectTexture.IsExistItemKey(text2))
				{
					selectTexture.items[text2] = text;
					flag = false;
				}
			}
			if (select_textures.Count() > 0)
			{
				select_textures_index = 0;
				ChangeTextures(select_textures_index);
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)ex);
		}
	}

	public static Texture2D duplicateTexture(Texture2D source)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)0, 1);
		RenderTexture active = RenderTexture.active;
		Graphics.Blit((Texture)(object)source, temporary);
		RenderTexture.active = temporary;
		Texture2D val = new Texture2D(((Texture)source).width, ((Texture)source).height, (TextureFormat)5, true);
		val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
		val.Apply();
		RenderTexture.active = active;
		RenderTexture.ReleaseTemporary(temporary);
		return val;
	}

	private bool DumpFile(Texture2D tex, string tex_name)
	{
		bool result = false;
		string text = Path.Combine(imagesDumpPath, Application.loadedLevel.ToString());
		if (!Directory.Exists(text))
		{
			Directory.CreateDirectory(text);
		}
		bool flag = IsReadable(tex);
		string path = Path.Combine(text, tex_name + "_" + MakeCheckSum(tex, flag) + ".png");
		if (!File.Exists(path))
		{
			byte[] bytes;
			if (flag)
			{
				bytes = ImageConversion.EncodeToPNG(tex);
			}
			else
			{
				Texture2D val = duplicateTexture(tex);
				bytes = ImageConversion.EncodeToPNG(val);
				Object.DestroyImmediate((Object)(object)val);
			}
			File.WriteAllBytes(path, bytes);
			result = true;
		}
		return result;
	}

	private static string MakeCheckSum(Texture2D source, bool? Readable = null)
	{
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Expected O, but got Unknown
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		MD5 mD = MD5.Create();
		if (!Readable.HasValue)
		{
			Readable = IsReadable(source);
		}
		if (Readable == true)
		{
			byte[] rawTextureData = source.GetRawTextureData();
			if (rawTextureData != null)
			{
				byte[] array = new byte[4];
				for (int i = 0; i < rawTextureData.Length; i += 16)
				{
					mD.TransformBlock(rawTextureData, i, 4, array, 0);
				}
				mD.TransformFinalBlock(array, 0, 0);
			}
		}
		if (Readable == false)
		{
			RenderTexture temporary = RenderTexture.GetTemporary(64, 64, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)2);
			temporary.DiscardContents();
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			((Texture)temporary).filterMode = (FilterMode)0;
			Graphics.Blit((Texture)(object)source, temporary);
			Texture2D val = new Texture2D(64, 64, (TextureFormat)5, false, false);
			((Texture)val).filterMode = (FilterMode)0;
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
			val.Apply(true);
			RenderTexture.active = active;
			float[] array2 = new float[4];
			int[,] array3 = new int[3, 4096];
			float num = 6f;
			float[] array4 = new float[3];
			for (int j = 0; j < 64; j++)
			{
				for (int k = 0; k < 64; k++)
				{
					array4[0] = num * val.GetPixel(k, j).r;
					array4[1] = num * val.GetPixel(k, j).g;
					array4[2] = num * val.GetPixel(k, j).b;
					for (int l = 0; l < 3; l++)
					{
						array3[l, k * j] = (int)Math.Round(array4[l]);
						array2[l] += array4[l];
					}
				}
			}
			for (int m = 0; m < 3; m++)
			{
				if (array2[m] > 0f)
				{
					array2[m] /= 4096f;
				}
			}
			byte[] array5 = new byte[4096];
			for (int n = 0; n < 64; n++)
			{
				for (int num2 = 0; num2 < 64; num2++)
				{
					byte b = 0;
					if (array2[0] < (float)array3[0, num2 * n])
					{
						b = (byte)(b | 1u);
					}
					if (array2[1] < (float)array3[1, num2 * n])
					{
						b = (byte)(b | 2u);
					}
					if (array2[2] < (float)array3[2, num2 * n])
					{
						b = (byte)(b | 4u);
					}
					array5[num2 * n] = b;
				}
			}
			mD.ComputeHash(array5);
			Object.Destroy((Object)(object)val);
			RenderTexture.ReleaseTemporary(temporary);
		}
		string result = "";
		if (mD.Hash != null)
		{
			result = BitConverter.ToString(mD.Hash).Replace("-", "").ToLower();
		}
		return result;
	}

	private static bool IsReadable(Texture2D tex)
	{
		return false;
	}

	private static void ReplaceFile(Texture2D tex, string path)
	{
		ImageConversion.LoadImage(tex, File.ReadAllBytes(path));
	}

	private static string toValidFilename(string fileName)
	{
		char[] array = invalid;
		foreach (char oldChar in array)
		{
			fileName = fileName.Replace(oldChar, '_');
		}
		return fileName;
	}

	private static void ChangeTextures(int index)
	{
		foreach (KeyValuePair<string, string> item in select_textures[index].items)
		{
			if (images.ContainsKey(item.Key))
			{
				images[item.Key] = item.Value;
			}
			else if (unique_keys.ContainsKey(item.Key))
			{
				unique_keys[item.Key] = item.Value;
			}
		}
		TextureIndex = -1;
		need_clear_checked_instanceID = true;
	}

	private static byte[] ObjectToByteArray(object obj)
	{
		if (obj == null)
		{
			return null;
		}
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		byte[] result;
		using (MemoryStream memoryStream = new MemoryStream())
		{
			binaryFormatter.Serialize(memoryStream, obj);
			result = memoryStream.ToArray();
		}
		return result;
	}

	public void OnGUI()
	{
		if (DoingReplace)
		{
			return;
		}
		if (((ButtonControl)Keyboard.current.upArrowKey).wasPressedThisFrame)
		{
			if (((ButtonControl)Keyboard.current.f11Key).wasPressedThisFrame && Keyboard.current.altKey.wasPressedThisFrame)
			{
				bOnDumping = !bOnDumping;
				toast_txt = "Dumping mode " + (bOnDumping ? "ON" : "OFF");
				dtStartToast = DateTime.Now;
				lastTextureCount = 0;
				TextureIndex = -1;
			}
			else if (select_textures_index > -1 && ((ButtonControl)Keyboard.current.f12Key).wasPressedThisFrame)
			{
				if (DoingReplace)
				{
					toast_txt = "In changing textures. please try later.";
				}
				else
				{
					select_textures_index = ((select_textures_index < select_textures.Count() - 1) ? (select_textures_index + 1) : 0);
					ChangeTextures(select_textures_index);
					toast_txt = "Change texture set to " + select_textures[select_textures_index].SelectName;
				}
				dtStartToast = DateTime.Now;
			}
		}
		if (dtStartToast.HasValue)
		{
			DateTime now = DateTime.Now;
			DateTime? dateTime = dtStartToast;
			if (now - dateTime > new TimeSpan(0, 0, 0, 2))
			{
				dtStartToast = null;
			}
		}
		int num = TextureIndex + 1;
		if (need_clear_checked_instanceID)
		{
			checked_instanceID.Clear();
			need_clear_checked_instanceID = false;
		}
		if (OldSceneId.HasValue && OldSceneId == Application.loadedLevel)
		{
			if (next_check.HasValue && TextureCount > 0 && TextureIndex >= 0 && TextureCount > TextureIndex)
			{
				DateTime now2 = DateTime.Now;
				if (TextureIndex >= TextureCount)
				{
					TextureIndex = TextureCount;
				}
				else if (!bOnDumping)
				{
					do
					{
						try
						{
							string text = toValidFilename(((Object)Textures[TextureIndex]).name);
							if (text.Length > 0 && ((Texture)Textures[TextureIndex]).width > 16 && ((Texture)Textures[TextureIndex]).height > 16)
							{
								int instanceID = ((Object)Textures[TextureIndex]).GetInstanceID();
								if (text.Length > 0 && checked_instanceID.IndexOf(instanceID) < 0)
								{
									checked_instanceID.Add(instanceID);
									if (unique_keys.ContainsKey(text))
									{
										ReplaceFile(Textures[TextureIndex], unique_keys[text]);
									}
									else if (doCheckMD5_keys.Contains(text))
									{
										string text2 = text + "_" + MakeCheckSum(Textures[TextureIndex]);
										if (select_textures_index > -1)
										{
											while (changed.ContainsKey(text2) && !(text2 == changed[text2]))
											{
												text2 = changed[text2];
											}
										}
										if (images.ContainsKey(text2))
										{
											ReplaceFile(Textures[TextureIndex], images[text2]);
											if (select_textures_index > -1)
											{
												changed.Add(text + "_" + MakeCheckSum(Textures[TextureIndex]), text2);
											}
										}
									}
								}
							}
						}
						catch (NullReferenceException)
						{
							TextureIndex = -2;
						}
						catch (Exception)
						{
						}
						TextureIndex++;
					}
					while (TextureIndex > -1 && TextureIndex < TextureCount && DateTime.Now - now2 < LoopTimeLimit);
				}
				else
				{
					if (IsDoingDump)
					{
						return;
					}
					if (lastTextureCount != TextureCount)
					{
						lastTextureCount = TextureCount;
						DoDump = true;
					}
					if (!DoDump)
					{
						return;
					}
					IsDoingDump = true;
					do
					{
						try
						{
							string text3 = toValidFilename(((Object)Textures[TextureIndex]).name);
							if (TextureIndex < TextureCount && text3.Length > 0 && ((Texture)Textures[TextureIndex]).width > 16 && ((Texture)Textures[TextureIndex]).height > 16)
							{
								int num2 = num * 100 / TextureCount;
								toast_txt = $"Checking {num} / {TextureCount} {text3} [{num2}%]";
								dtStartToast = DateTime.Now;
								if (DumpFile(Textures[TextureIndex], text3))
								{
									toast_txt = $"Dumped: {text3} [{num2}%]";
									dtStartToast = DateTime.Now;
								}
								else
								{
									toast_txt = $"Passed: {text3} [{num2}%]";
									dtStartToast = DateTime.Now;
								}
							}
						}
						catch (NullReferenceException)
						{
							TextureIndex = -2;
						}
						catch (Exception ex4)
						{
							Debug.LogError((object)ex4);
						}
						TextureIndex++;
						num = TextureIndex + 1;
					}
					while (TextureIndex > -1 && TextureIndex < TextureCount && DateTime.Now - now2 < LoopTimeLimit);
					if (TextureIndex >= TextureCount)
					{
						DoDump = false;
						toast_txt = "Scene dumping completed.";
						dtStartToast = DateTime.Now;
					}
					IsDoingDump = false;
				}
			}
			else if (!next_check.HasValue || next_check < DateTime.Now)
			{
				Textures = Resources.FindObjectsOfTypeAll<Texture2D>();
				if (Textures == null)
				{
					Textures = (Texture2D[])(object)new Texture2D[0];
				}
				TextureCount = Textures.Count();
				if (TextureCount > 0)
				{
					TextureIndex = 0;
				}
				next_check = DateTime.Now + check_span;
			}
		}
		else
		{
			lastTextureCount = 0;
			need_clear_checked_instanceID = true;
			next_check = null;
			OldSceneId = Application.loadedLevel;
		}
	}
}
public static class Const
{
	public const int ImageDiv = 16;

	public const int ImageCompareSize = 64;
}
namespace WKorean
{
	[BepInPlugin("Piggy.WKorean", "WKorean", "1.0.4")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Piggy.WKorean";

		private const string modName = "WKorean";

		private const string modVersion = "1.0.4";

		private readonly Harmony harmony = new Harmony("Piggy.WKorean");

		private static Plugin Instance;

		public static ManualLogSource mls;

		public static AssetBundle Bundle;

		public static TMP_FontAsset generalTMPFont;

		public static Font generalFont;

		public static TMP_FontAsset generalPixelTMPFont;

		public static Font generalPixelFont;

		public static TMP_FontAsset galmuri7TMPFont;

		public static TMP_FontAsset galmuri7PageFont;

		public static Font galmuri7Font;

		public static TMP_FontAsset galmuri9TMPFont;

		public static Font galmuri9Font;

		public static TMP_FontAsset morris9TMPFont;

		public static Font morris9Font;

		public static TMP_FontAsset dunggeunmoTMPFont;

		public static Font dunggeunmoFont;

		public static TextAsset koreanSubtitle;

		public static TextAsset sbmailsave_a_abc;

		public static TextAsset logdata_abc;

		public static Sprite osSave05;

		public static Sprite osSave15;

		public static Sprite osSave16;

		public static Sprite osSave17;

		public static Sprite osSave18;

		public static Sprite osSave19;

		public static Sprite osSave20;

		public static Sprite osSave21;

		public static Sprite osSave25;

		public static string PluginDirectory;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			PluginDirectory = ((BaseUnityPlugin)this).Info.Location;
			LoadAssets();
			TextureReplacer.Setup();
			mls = Logger.CreateLogSource("Piggy.WKorean");
			mls.LogInfo((object)"WKorean is loaded");
			TMP_Settings.useModernHangulLineBreakingRules = true;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}

		private void LoadAssets()
		{
			try
			{
				Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "wkorean"));
			}
			catch (Exception ex)
			{
				mls.LogError((object)("Couldn't load asset bundle: " + ex.Message));
				return;
			}
			try
			{
				generalTMPFont = Bundle.LoadAsset<TMP_FontAsset>("NotoSansCJKkr-Bold.asset");
				generalFont = Bundle.LoadAsset<Font>("NotoSansCJKkr-Bold.ttf");
				generalPixelTMPFont = Bundle.LoadAsset<TMP_FontAsset>("SLEIGothicTTF.asset");
				generalPixelFont = Bundle.LoadAsset<Font>("SLEIGothicTTF.ttf");
				galmuri7TMPFont = Bundle.LoadAsset<TMP_FontAsset>("Galmuri7.asset");
				galmuri7PageFont = Bundle.LoadAsset<TMP_FontAsset>("Galmuri7Page.asset");
				galmuri7Font = Bundle.LoadAsset<Font>("Galmuri7.ttf");
				galmuri9TMPFont = Bundle.LoadAsset<TMP_FontAsset>("Galmuri9.asset");
				galmuri9Font = Bundle.LoadAsset<Font>("Galmuri9.ttf");
				morris9Font = Bundle.LoadAsset<Font>("Morris9.ttf");
				dunggeunmoTMPFont = Bundle.LoadAsset<TMP_FontAsset>("NeoDunggeunmoPro.asset");
				dunggeunmoFont = Bundle.LoadAsset<Font>("NeoDunggeunmoPro.ttf");
				koreanSubtitle = Bundle.LoadAsset<TextAsset>("ko.txt");
				sbmailsave_a_abc = Bundle.LoadAsset<TextAsset>("sbmailsave-a.abc.txt");
				logdata_abc = Bundle.LoadAsset<TextAsset>("logdata.abc.txt");
				osSave05 = Bundle.LoadAsset<Sprite>("OS_Save_MS_05.png");
				osSave15 = Bundle.LoadAsset<Sprite>("OS_Save_MS_15.png");
				osSave16 = Bundle.LoadAsset<Sprite>("OS_Save_MS_16.png");
				osSave17 = Bundle.LoadAsset<Sprite>("OS_Save_MS_17.png");
				osSave18 = Bundle.LoadAsset<Sprite>("OS_Save_MS_18.png");
				osSave19 = Bundle.LoadAsset<Sprite>("OS_Save_MS_19.png");
				osSave20 = Bundle.LoadAsset<Sprite>("OS_Save_MS_20.png");
				osSave21 = Bundle.LoadAsset<Sprite>("OS_Save_MS_21.png");
				osSave25 = Bundle.LoadAsset<Sprite>("OS_Save_MS_25.png");
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!");
			}
			catch (Exception ex2)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load assets: " + ex2.Message));
			}
		}

		public static void TranslateText(Text text)
		{
			if (!((Object)(object)text == (Object)null) && !((Object)(object)text.font == (Object)null))
			{
				switch (text.text)
				{
				case "Buy":
					text.supportRichText = true;
					text.text = "<size=12>구매</size>";
					break;
				case "Current":
					text.supportRichText = true;
					text.text = "<size=12>보유 중</size>";
					break;
				case "Exit":
					text.supportRichText = true;
					text.text = "<size=8>나가기</size>";
					break;
				case "OK":
					text.supportRichText = true;
					text.text = "<size=10>확인</size>";
					break;
				case "Ok":
					text.supportRichText = true;
					text.text = "<size=10>확인</size>";
					break;
				case "Proceed":
					text.supportRichText = true;
					text.text = "<size=10>계속하기</size>";
					break;
				case "Cancel":
					text.supportRichText = true;
					text.text = "<size=10>취소</size>";
					break;
				case "Experimental Perks":
					text.supportRichText = true;
					text.text = "<size=10>실험적 특전</size>";
					break;
				case "Caution!":
					text.text = "경고!";
					break;
				case "Forward":
					text.text = "앞으로 이동";
					break;
				case "Backwards":
					text.text = "뒤로 이동";
					break;
				case "Left":
					text.text = "왼쪽으로 이동";
					break;
				case "Right":
					text.text = "오른쪽으로 이동";
					break;
				case "Hand-Left":
					text.text = "왼손";
					break;
				case "Hand-Right":
					text.text = "오른손";
					break;
				case "Jump":
					text.text = "점프";
					break;
				case "Sprint":
					text.text = "달리기";
					break;
				case "Crouch":
					text.text = "웅크리기";
					break;
				case "Inventory":
					text.text = "인벤토리";
					break;
				case "Drop-Left":
					text.text = "왼손 떨어뜨리기";
					break;
				case "Drop-Right":
					text.text = "오른손 떨어뜨리기";
					break;
				case "Pocket-Left":
					text.text = "왼쪽 주머니";
					break;
				case "Pocket-Right":
					text.text = "오른쪽 주머니";
					break;
				case "Hand-Swap":
					text.text = "양 손 아이템 변경";
					break;
				case "Rotate":
					text.text = "회전";
					break;
				case "Reset Bindings":
					text.text = "조작 초기화";
					break;
				case "Alt":
					text.text = "보조";
					break;
				case "Swap (Alt)":
					text.text = "변경 (보조)";
					break;
				}
				if (((Object)text.font).name == "Oswald-VariableFont_wght SDF")
				{
					text.font = generalFont;
				}
				else if (((Object)text.font).name == "monoclefixed")
				{
					text.font = galmuri9Font;
				}
				else if (((Object)text.font).name == "ChicagoFLF")
				{
					text.font = dunggeunmoFont;
				}
				else
				{
					text.font = generalPixelFont;
				}
			}
		}
	}
}
namespace WKorean.Patches
{
	[HarmonyPatch(typeof(Message))]
	internal class MessagePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(Message __instance)
		{
			if (__instance.textObject.text == "This will erase all data on these disks. Proceed?")
			{
				__instance.textObject.text = "<size=10>이 작업은 이 디스크에 저장된 모든 데이터를 삭제합니다. 계속하시겠습니까?</size>";
				__instance.closeText.text = "<size=10>계속하기</size>";
				__instance.optionAText.text = "<size=10>닫기</size>";
			}
		}
	}
	[HarmonyPatch(typeof(App_SavePage_Scan))]
	internal class App_SavePage_ScanPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(App_SavePage_Scan __instance)
		{
			__instance.sprites[4] = Plugin.osSave05;
			__instance.sprites[14] = Plugin.osSave15;
			__instance.sprites[15] = Plugin.osSave16;
			__instance.sprites[16] = Plugin.osSave17;
			__instance.sprites[17] = Plugin.osSave18;
			__instance.sprites[18] = Plugin.osSave19;
			__instance.sprites[19] = Plugin.osSave20;
			__instance.sprites[20] = Plugin.osSave21;
			__instance.sprites[24] = Plugin.osSave25;
		}
	}
	[HarmonyPatch(typeof(App_SavePage_DiskCard))]
	internal class App_SavePage_DiskCardPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Initialize")]
		private static void Initialize_Postfix(App_SavePage_DiskCard __instance, ref string diskName, ref int capacity)
		{
			if (diskName == "Untitled Disk")
			{
				diskName = "이름없는 디스크";
			}
			__instance.text.text = $"<size=10>{diskName}\nCapacity: {capacity}x";
		}
	}
	[HarmonyPatch(typeof(ENV_Vendor_Disk))]
	internal class ENV_Vendor_DiskPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(ref TMP_Text ___costText)
		{
			___costText.text = ___costText.text.Replace("Cost", "<size=0.7>가격");
			___costText.text = ___costText.text.Replace("Bank", "잔액");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Purchase")]
		private static void Purchase_Postfix(ref TMP_Text ___costText)
		{
			if (___costText.text == "THANK YOU FOR YOUR PURCHASE")
			{
				___costText.text = "<size=1>구매해 주셔서 감사합니다</size>";
				return;
			}
			___costText.text = ___costText.text.Replace("Cost", "<size=0.7>가격");
			___costText.text = ___costText.text.Replace("Bank", "잔액");
		}

		[HarmonyPostfix]
		[HarmonyPatch("CheckRoaches")]
		private static void CheckRoaches_Postfix(ref TMP_Text ___costText)
		{
			if (___costText.text == "THANK YOU FOR YOUR PURCHASE")
			{
				___costText.text = "<size=1>구매해 주셔서 감사합니다</size>";
			}
			___costText.text = ___costText.text.Replace("Cost", "<size=0.7>가격");
			___costText.text = ___costText.text.Replace("Bank", "잔액");
		}
	}
	[HarmonyPatch(typeof(HandItem_Note))]
	internal class HandItem_NotePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Initialize")]
		private static void Initialize_Postfix(ref TMP_Text ___text, ref Item ___item)
		{
			if (___item != null && ___item.data != null && ___item.data.Count > 0)
			{
				___text.text = TranslateHandNoteText(___item.data[0]);
			}
		}

		private static string TranslateHandNoteText(string text)
		{
			if (string.IsNullOrEmpty(text))
			{
				return "";
			}
			if (text.Contains("Research Record [07/22/2015]"))
			{
				return "연구 기록 [07/22/2015]\n장 박사 - SB17-A\n\n여기 온 지.. 벌써 두 달째라고? 여긴 최악이다.. 항상 감시당하는 기분이 들고, 지치거든.\n\n이렇게 오래 머무르게 될 줄은 전혀 몰랐는데.. 벌써 네 명이 사라졌다.\n사이먼이 날 다시 복귀시킬 거라고 했다. 이 사다리가 날 절대 밖으로 내보내주지 않을까 봐 걱정되기 시작했거든.\n";
			}
			if (text.Contains("Research Record [05/11/2015]"))
			{
				return "연구 기록 [05/11/2015]\n장 박사 - SB17-A\n\n또 다른 드론을 위로 보냈는데, 신호가 끊긴 건 대략 1킬로미터쯤 올라갔을 때였다.\n축을 따라 움직이는 구조는 확실히 아니야. 하지만 그게 § 때문인지, 아니면... 글쎄, 뭔가 물체를 발견하기 전까진 알 수 없을 것 같다.\n\n누군가가 환풍구를 지켜보고 있어서 다행이야. 이 곳이 다음에 움직일 땐 우리가 어디로 가게 될 지 아무도 모를 테니까.\n";
			}
			if (text.Contains("If anyone is reading this"))
			{
				return "이걸 읽는 사람에게. 들어온 길이 보인다면, 당장 돌아가.\n\n   그렇지 않다면.. 유감이야. 이제 당신이 이곳에서 나갈 수 있을지 확신할 수 없어.\n\n난 이제 등반을 시도할 거야. 어디로 가는 지는 모르겠어. 아무도 모르지. 지난 12년 동안 이곳에 대한 악몽을 꿨어. 다시 돌아오고 싶지 않았거든.\n-바오";
			}
			if (text.Contains("sirens started going off"))
			{
				return "방금 사이렌이 울리기 시작했어\n\n     컴퓨터도 멈춰버렸고.. 대체 주거 지역에서 뭔 일이 일어난 거야?\n데릭, 이걸 본다면 난 보안실로 가고 있어. 심층 시설 모니터의 밀폐 상태에는 딱히 문제는 안 보여, 그래서 다른 사건일까봐 더 걱정돼\n\n  제발 청색과 자색 구역에서 있었던 일처럼 되진 않았으면 좋겠어";
			}
			if (text.Contains("\n\nclimber!"))
			{
				return "등반가님!\n\n    잘 하고 있어요\n거기서 만나요\n       제가 다 보고 있어요\n\n   여긴 나쁜 곳이에요\n       난 여기 있어요\n  하늘이 찢어지고 우리의 바벨이 흔들렸어요\n흔들렸어요\n\n     흔들렸어요";
			}
			if (text.Contains("     canon"))
			{
				return ".\n\n\n     캐넌\n\n\n     응";
			}
			if (text.Contains("it gives me what I think"))
			{
				return "<i>\n내 생각을 하게 해줘\n내가 원하는 것 같아\n\n이젠.. 생각하는 것도 힘들어. 난 들려.\n모두가 죽었어\n그게 모두를 훔쳤어\n\n52는.. 3주 동안, 거의 남은 기간 동안 나를 살려줬어\n이제 더 이상 정상적이게 느껴지지 않아\n네가 말하는 거잖아. 날 내버려 둬\n\n  내 손이 희미해지고 있어";
			}
			if (text.Contains("you came in here"))
			{
				return "<i>\n너는 여기 들어왔고\n  나를 볼 수 없었어\n      너를 만질 수 없어어\n  너는 페인트를 가져왔고\n     분필을 가져왔어\n   얼마나 오래되었는지는 모르겠지만\n  완전히 여기 있었어\n 곧 사라질 거야\n그녀는 너를 도울 수 없어\n      그녀는 너를 도울 수 없어\n\n도와줘";
			}
			if (text.Contains("I think it's over for me. Not much food left,"))
			{
				return "아무래도 난 끝인 것 같다. 식량이 바닥나고 있고, 이틀 전에 물도 다 떨어졌다. 머리가 띵하다.\n\n거주 구역 전역이 크리스마스 트리처럼 환하게 빛나고, 사이렌이 울리기 시작했다.\n내 라디오에선 2주 동안 대피 명령만을 반복하고 있다.\n\n누군가 이 쪽지를 발견한다면, 절대로 황색 구역에 들어가지 마라. 하역장에서 계속 비명 소리가 들리고 있어.\n\n곧 만나지, V.\n";
			}
			if (text.Contains("Remove as many €-0331"))
			{
				return ".\n\n   격리 조치가 시작되기 전에 가능한 한 많은 €-0331 유충을 제거하십시오.\n\n만약 이 일을 망치고 협정이 깨진다면 신의 가호가 있기를 비세요. 우리는 또 다른 거주 구역이 무너지는 것을 원하지 않습니다.\n\n지금은 아니에요. 이미 남은 게 너무 적으니까요..";
			}
			if (text.Contains("Robert Brown - SB17-DP MAINT"))
			{
				return "검사 기록\n로버트 브라운 - SB17-DP MAINT\r\nSB17-DP 자판기: 작동 중\nSilo 65-72 팬: 작동 중\n저장고 크레인 A6: 붐 균열\n\n개인 노트: 여긴 점점 조용해지고... 외로워져. 거주 구역에 마지막으로 다녀온 지 한 달이 넘었어. 제스가 무사하길 바래. 블루 쪽은 상황이 완전히 엉망이라는 얘기를 들었거든. 제발... 그쪽에 안 있어서 다행이야.";
			}
			if (text.Contains("why is this box nailed to the floor"))
			{
				return ".\n    이 상자는 왜 바닥에 못으로 고정되어 있나요?\n                                                         -J";
			}
			if (text.Contains("What the hell is this place?"))
			{
				return "\n여기 대체 뭐 하는 데야?\n이거.. 살아있는 건가?";
			}
			return text;
		}
	}
	[HarmonyPatch(typeof(M_Level))]
	internal class M_LevelPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(M_Level __instance, ref M_Region ___region, ref M_Subregion ___subRegion)
		{
			InitializeTranslatedText(__instance, ___region, ___subRegion);
		}

		private static void InitializeTranslatedText(M_Level __instance, M_Region region, M_Subregion subRegion)
		{
			if ((Object)(object)region != (Object)null)
			{
				region.introText = region.introText.Replace("Silos", "저장고");
				region.introText = region.introText.Replace("Pipeworks", "파이프 구역");
				region.introText = region.introText.Replace("Habitation", "주거 구역");
				region.introText = region.introText.Replace("Interlude", "막간");
				region.introText = region.introText.Replace("Cheatrooms", "치트룸");
				region.introText = region.introText.Replace("The Chimney", "굴뚝");
			}
			if ((Object)(object)subRegion != (Object)null)
			{
				subRegion.introText = subRegion.introText.Replace("Deep Storage", "심층 저장 시설");
				subRegion.introText = subRegion.introText.Replace("Air Exchange", "공기 교환 시설");
				subRegion.introText = subRegion.introText.Replace("Shattered Chambers", "부서진 방");
				subRegion.introText = subRegion.introText.Replace("Drainage System", "배수 시설");
				subRegion.introText = subRegion.introText.Replace("Pipe Organ", "파이프 오르간");
				subRegion.introText = subRegion.introText.Replace("Service Shaft", "서비스 섀프트");
				subRegion.introText = subRegion.introText.Replace("Delta Labs", "델타 연구소");
				subRegion.introText = subRegion.introText.Replace("Haunted Pier", "유령 부두");
				subRegion.introText = subRegion.introText.Replace("Lost Pier", "잃어버린 부두");
				subRegion.introText = subRegion.introText.Replace("Waste Heap", "쓰레기 더미");
				subRegion.introText = subRegion.introText.Replace("Lockdown", "봉쇄");
				subRegion.introText = subRegion.introText.Replace("Break Room", "휴게실");
				subRegion.introText = subRegion.introText.Replace("Ladder?", "사다리?");
				subRegion.introText = subRegion.introText.Replace("La dd errr", "사 다 리리이");
				subRegion.introText = subRegion.introText.Replace("L.. AAADD.. ERRLLAD..AER", "사.. 다아아.. 리이..이");
				subRegion.introText = subRegion.introText.Replace("LLL L LL L L L LL ", "사사 사 사 사사 사 사");
				subRegion.introText = subRegion.introText.Replace("His Domain", "그의 영역");
				subRegion.introText = subRegion.introText.Replace("Her Domain", "그녀의 영역");
				subRegion.introText = subRegion.introText.Replace("Crystal Throat", "수정 목구멍");
				subRegion.introText = subRegion.introText.Replace("Frigid Facility", "냉동 시설");
				subRegion.introText = subRegion.introText.Replace("Glacial Breach", "빙하 침해");
			}
		}
	}
	[HarmonyPatch(typeof(DiskController), "DiskLoadSequence")]
	public class DiskLoadSequencePatch
	{
		private static bool Prefix(DiskController __instance, ref IEnumerator __result)
		{
			__result = NewDiskLoadSequence(__instance);
			return false;
		}

		private static IEnumerator NewDiskLoadSequence(DiskController __instance)
		{
			FieldInfo isLoadingDisksField = typeof(DiskController).GetField("isLoadingDisks", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo osField = typeof(DiskController).GetField("os", BindingFlags.Instance | BindingFlags.NonPublic);
			MethodInfo method = typeof(DiskController).GetMethod("CreateDiskContents", BindingFlags.Instance | BindingFlags.NonPublic);
			bool isLoadingDisks = (bool)isLoadingDisksField.GetValue(__instance);
			object? value = osField.GetValue(__instance);
			OS_Manager os = (OS_Manager)((value is OS_Manager) ? value : null);
			if (!isLoadingDisks)
			{
				os.SetInteractable(false);
				yield return (object)new WaitForSeconds(0.5f);
				__instance.newDiskLoaded = false;
				Message_Packet message_Packet2 = new Message_Packet();
				message_Packet2.type = "loading";
				message_Packet2.closeText = "OK";
				message_Packet2.message = "<size=10>새 디스크를 찾았습니다. 불러오는 중..</size>";
				message_Packet2.screenPos = new Vector2(0f, 0f);
				message_Packet2.data = new List<string> { "1" };
				Message message = os.messageManager.CreateMessage(message_Packet2);
				OS_Manager.soundPlayer.PlaySound("os:floppy-load");
				while ((Object)(object)message != (Object)null)
				{
					yield return null;
				}
				os.SetInteractable(true);
				message_Packet2 = new Message_Packet();
				message_Packet2.type = "default";
				message_Packet2.closeText = "OK";
				message_Packet2.message = "<size=10>데스크톱에 디스크가 연결되었습니다.</size>";
				message_Packet2.screenPos = new Vector2(0f, 0f);
				os.messageManager.CreateMessage(message_Packet2);
				method.Invoke(__instance, null);
			}
		}
	}
	[HarmonyPatch(typeof(UI_GamemodeText))]
	internal class UI_GamemodeTextPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Awake")]
		private static void Awake_Prefix(UI_GamemodeText __instance)
		{
			TranslateAppend(__instance);
			InitializeTranslatedText(((Component)__instance).GetComponent<TMP_Text>());
		}

		[HarmonyPostfix]
		[HarmonyPatch("Refresh")]
		private static void Refresh_Postfix(UI_GamemodeText __instance)
		{
			InitializeTranslatedText(((Component)__instance).GetComponent<TMP_Text>());
		}

		private static void TranslateAppend(UI_GamemodeText __instance)
		{
			string append = __instance.append;
			string text = append;
			if (text == "Mode:")
			{
				__instance.append = "모드:";
			}
		}

		private static void InitializeTranslatedText(TMP_Text text)
		{
			text.text = text.text.Replace("Campaign", "캠페인");
			text.text = text.text.Replace("Endless Substructure", "끝없는 하부 구조");
			text.text = text.text.Replace("Endless Underworks", "끝없는 지하 시설");
			text.text = text.text.Replace("Endless Silos", "끝없는 저장고");
			text.text = text.text.Replace("Endless Pipeworks", "끝없는 파이프 구역");
			text.text = text.text.Replace("Endless Habitation", "끝없는 거주 구역");
		}
	}
	[HarmonyPatch(typeof(UI_ProgressionPopup))]
	internal class UI_ProgressionPopupPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("UpdateInformation")]
		private static void UpdateInformation_Postfix(UI_ProgressionPopup __instance, ref Sprite i, ref string title, ref string desc)
		{
			__instance.text.text = __instance.text.text.Replace("Unlocked", "잠금 해제됨");
		}
	}
	[HarmonyPatch(typeof(UI_PageHolder))]
	internal class UI_PageHolderPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(UI_PageHolder __instance)
		{
			InitializeTranslatedText(__instance);
		}

		private static void InitializeTranslatedText(UI_PageHolder __instance)
		{
			foreach (UI_Page page in __instance.pages)
			{
				switch (page.title)
				{
				case "Regions":
					page.title = "지역";
					break;
				case "Items":
					page.title = "아이템";
					break;
				case "Perks":
					page.title = "특전";
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CL_ProgressionManager))]
	internal class UI_CL_ProgressionManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Initialize")]
		private static void Initialize_Prefix(CL_ProgressionManager __instance)
		{
			foreach (ProgressionUnlock unlock in __instance.unlockList)
			{
				InitializeTranslatedText(unlock);
			}
		}

		private static void InitializeTranslatedText(ProgressionUnlock unlock)
		{
			if (unlock.unlockLogDescription.Contains("Deep Storage Tier"))
			{
				unlock.unlockTitle = "시설이 자라고 있어...";
				unlock.unlockLogDescription = unlock.unlockLogDescription.Replace("Deep Storage Tier", "심층 저장고 티어");
				unlock.unlockDescription = "새로운 심층 저장고 콘텐츠가 잠금 해제됩니다";
			}
			else if (unlock.unlockLogDescription.Contains("Silos Tier"))
			{
				unlock.unlockTitle = "시설이 자라고 있어...";
				unlock.unlockLogDescription = unlock.unlockLogDescription.Replace("Silos Tier", "저장고 티어");
				unlock.unlockDescription = "새로운 저장고 콘텐츠가 잠금 해제됩니다";
			}
			else if (unlock.unlockLogDescription.Contains("Pipeworks Tier"))
			{
				unlock.unlockTitle = "시설이 자라고 있어...";
				unlock.unlockLogDescription = unlock.unlockLogDescription.Replace("Pipeworks Tier", "파이프 구역 티어");
				unlock.unlockDescription = "새로운 파이프 구역 콘텐츠가 잠금 해제됩니다";
			}
			else if (unlock.unlockLogDescription.Contains("Pipeworks Tier"))
			{
				unlock.unlockTitle = "시설이 자라고 있어...";
				unlock.unlockLogDescription = unlock.unlockLogDescription.Replace("Pipeworks Tier", "파이프 구역 티어");
				unlock.unlockDescription = "새로운 파이프 구역 콘텐츠가 잠금 해제됩니다";
			}
			else if (unlock.unlockLogDescription == "Unstable Delta Perks")
			{
				unlock.unlockTitle = "새로운 연구 발견";
				unlock.unlockLogDescription = "불안정한 델타 특전";
				unlock.unlockDescription = "실험적 특전이 잠금 해제됩니다";
			}
			else if (unlock.unlockLogDescription.Contains("Tier") && unlock.unlockLogDescription.Contains("Perks"))
			{
				unlock.unlockTitle = "새로운 연구 발견";
				unlock.unlockLogDescription = unlock.unlockLogDescription.Replace("Tier", "티어");
				unlock.unlockLogDescription = unlock.unlockLogDescription.Replace("Perks", "특전");
				unlock.unlockLogDescription = unlock.unlockLogDescription.Replace("Experimental", "실험적");
				unlock.unlockDescription = "특전이 잠금 해제됩니다";
			}
			string unlockLogDescription = unlock.unlockLogDescription;
			string text = unlockLogDescription;
			if (text == null)
			{
				return;
			}
			switch (text.Length)
			{
			case 18:
				switch (text[8])
				{
				case 'A':
					if (text == "Restock Autopitons")
					{
						unlock.unlockTitle = "자판기 입고";
						unlock.unlockLogDescription = "자동 피톤 입고";
						unlock.unlockDescription = "자판기에 자동 피톤이 추가됩니다";
					}
					break;
				case 'B':
					if (text == "Restock Blink Eyes")
					{
						unlock.unlockTitle = "자판기 입고";
						unlock.unlockLogDescription = "블링크 아이 입고";
						unlock.unlockDescription = "자판기에 블링크 아이가 추가됩니다";
					}
					break;
				}
				break;
			case 17:
				switch (text[8])
				{
				case 'F':
					if (text == "Restock Food Bars")
					{
						unlock.unlockTitle = "자판기 입고";
						unlock.unlockLogDescription = "음식 바 입고";
						unlock.unlockDescription = "자판기에 음식 바가 추가됩니다";
					}
					break;
				case 'I':
					if (text == "Restock Injectors")
					{
						unlock.unlockTitle = "자판기 입고";
						unlock.unlockLogDescription = "주사기 입고";
						unlock.unlockDescription = "자판기에 주사기가 추가됩니다";
					}
					break;
				}
				break;
			case 13:
				switch (text[8])
				{
				case 'G':
					if (text == "Restock Grubs")
					{
						unlock.unlockTitle = "자판기 입고";
						unlock.unlockLogDescription = "그럽 입고";
						unlock.unlockDescription = "자판기에 그럽이 추가됩니다";
					}
					break;
				case 'P':
					if (text == "Restock Pills")
					{
						unlock.unlockTitle = "약 입고";
						unlock.unlockLogDescription = "약 입고";
						unlock.unlockDescription = "자판기에 약이 추가됩니다";
					}
					break;
				}
				break;
			case 8:
				if (text == "Hardmode")
				{
					unlock.unlockTitle = "새로운 옵션이 잠금 해제됩니다";
					unlock.unlockLogDescription = "하드 모드";
					unlock.unlockDescription = "하드 모드 & 아이언 너클";
				}
				break;
			case 14:
				if (text == "Restock Flares")
				{
					unlock.unlockTitle = "자판기 입고";
					unlock.unlockLogDescription = "플레어 입고";
					unlock.unlockDescription = "자판기에 플레어가 추가됩니다";
				}
				break;
			case 23:
				if (text == "Restock Explosive Rebar")
				{
					unlock.unlockTitle = "자판기 입고";
					unlock.unlockLogDescription = "폭발성 철근 입고";
					unlock.unlockDescription = "자판기에 폭발성 철근이 추가됩니다";
				}
				break;
			}
		}
	}
	[HarmonyPatch(typeof(TextMeshPro))]
	internal class TextMeshProPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(TextMeshPro __instance)
		{
			if ((Object)(object)((TMP_Text)__instance).font == (Object)null)
			{
				return;
			}
			switch (((Object)((TMP_Text)__instance).font).name)
			{
			case "Oswald-VariableFont_wght SDF":
				((TMP_Text)__instance).font = Plugin.generalTMPFont;
				break;
			case "monoclefixed":
				((TMP_Text)__instance).font = Plugin.galmuri9TMPFont;
				break;
			case "m3x6":
				((TMP_Text)__instance).font = Plugin.galmuri7TMPFont;
				break;
			case "ChicagoFLF":
				((TMP_Text)__instance).font = Plugin.dunggeunmoTMPFont;
				break;
			case "m3x6wk Pagetext":
				((TMP_Text)__instance).font = Plugin.galmuri7PageFont;
				break;
			default:
				((TMP_Text)__instance).font = Plugin.generalPixelTMPFont;
				break;
			}
			try
			{
				Translate(__instance);
			}
			catch (Exception ex)
			{
				Plugin.mls.LogError((object)("TMP 텍스트를 번역하는 과정에서 오류가 발생했습니다!\n" + ex));
			}
		}

		private static void Translate(TextMeshPro __instance)
		{
			if (((TMP_Text)__instance).text.Contains("EXIT TRAINING AREA"))
			{
				((TMP_Text)__instance).text = "훈련 구역 떠나기";
			}
			if (((TMP_Text)__instance).text.Contains("Climbing challenges often require traversing from point to point, handhold to handhold."))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">지점에서 지점으로</color></size>\n등반의 어려움은 종종 지점에서 지점으로, 손잡이에서 손잡이로 이동해야 한다는 것입니다.\n이 손잡이를 따라가세요. 그리고 모서리를 잡을 수 있다는 것도 잊지 마세요!";
			}
			if (((TMP_Text)__instance).text.Contains("Don't forget you can mantle!"))
			{
				((TMP_Text)__instance).text = "모서리를 잡고 올라탈 수 있다는 걸 잊지 마세요!";
			}
			if (((TMP_Text)__instance).text.Contains("Notice that your hands will gradually turn red as you climb."))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">기력</color></size>\n등반할수록 손이 점점 빨갛게 변하는 것을 보셨을 겁니다.\n\n표면을 붙잡고 있으면 기력이 소모되며, 체력이 다 떨어지면 손을 놓게 됩니다.\n\n손잡이를 잡지 않은 손은 점점 기력이 회복됩니다.";
			}
			if (((TMP_Text)__instance).text.Contains("Pitons let you create handholds, though until hammered in fully they are not permanent and secure."))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">피톤</color></size>\n피톤은 손잡이를 만들 수 있게 해주지만, 완전히 박히기 전까지는 고정되지 않고 불안정합니다.\n\n벽에 설치한 후에는 망치를 사용해 단단히 박으세요.\n\n등반 중에도 피톤을 설치할 수 있지만, 기력 관리를 잘 해야 합니다.\n";
			}
			if (((TMP_Text)__instance).text.Contains("Don't forget to toss the empty can after using it."))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">음식 통조림</color></size>을 사용하면 기력을 회복합니다.\n사용하고 남은 빈 캔을 버리는 걸 잊지 마세요.";
			}
			if (((TMP_Text)__instance).text.Contains("If you're carrying too many items, your inventory will start turning"))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">하중</color></size>\n너무 많은 아이템을 들고 있으면 인벤토리가 <color=\"red\">붉게</color> 변하기 시작합니다. 짐이 무거운 상태에서 아이템을 더 집으면, 추가된 아이템마다 이동 속도가 느려집니다.";
			}
			if (((TMP_Text)__instance).text.Contains("Tip: use your inventory while hanging and pull out a piton while climbing."))
			{
				((TMP_Text)__instance).text = "팁: 매달려 있을 때 인벤토리를 열고, 등반 중에 피톤을 꺼내세요.\n\n한 손이 피곤해지면 손을 바꾸고, 피곤한 손으로 다음 피톤을 망치로 박으세요.\n\n계속 매달리는 걸 잊지 마세요!";
			}
			if (((TMP_Text)__instance).text.Contains("You have two pockets in your inventory,"))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">주머니</color></size>\n인벤토리에는 양쪽에 원 모양으로 표시된 두 개의 주머니가 있으며, 각 손마다 아이템을 하나씩 보관할 수 있습니다.\n\n왼손은 Q, 오른손은 E 키를 눌러 주머니에 아이템을 넣거나 주머니에서 아이템을 꺼낼 수 있습니다.\n\n인벤토리 화면을 통해서도 주머니에 아이템을 넣거나 꺼낼 수 있습니다, 평소처럼요!\n\n주의하세요, <color=\"red\">큰 아이템은 주머니에 들어가지 않으니</color> 인벤토리에서 직접 꺼내야 합니다.\r\n";
			}
			if (((TMP_Text)__instance).text.Contains("Your hammer can be used to break certain obstacles or objects."))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">망치질</color></size>\n망치는 특정 장애물이나 물체를 부수는 데 사용할 수 있습니다. 위급할 때는 자기 방어용 무기로도 사용할 수도 있습니다.\n\n이 판자를 망치로 부수고 계속 진행하세요.\n";
			}
			if (((TMP_Text)__instance).text.Contains("Hammer") && ((TMP_Text)__instance).text.Contains("This!"))
			{
				((TMP_Text)__instance).text = "이걸\n망치질해보세요!";
			}
			if (((TMP_Text)__instance).text.Contains("Rebar can be thrown to make a handhold at a distance."))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\"><size=\"2.3\">철근</color></size>\n철근은 멀리 던져서 손잡이로 만들 수 있습니다.\n\n너무 완만한 각도로 던지면 표면에 튕겨 나가니, 조준을 신중히 하세요!\n\n단단한 바닥에 서 있지 않을 때 철근을 던지면 손잡이를 놓치고 뒤로 밀려날 수 있으니 조심하세요!";
			}
			if (((TMP_Text)__instance).text.Contains("YOU DID IT!"))
			{
				((TMP_Text)__instance).text = "해냈군요";
			}
			if (((TMP_Text)__instance).text.Contains("ACCESS DEV PLAYGROUND"))
			{
				((TMP_Text)__instance).text = "<color=\"yellow\">개발자 놀이터 접근하기</color>\n참 멋진 곳이죠!\n\n경고: 게임을 충분히 진행하지 않았다면, 스포일러가 될 수 있으니 조심하세요. 경고했습니다!\n";
			}
		}
	}
	[HarmonyPatch(typeof(UI_TextHints))]
	internal class UI_TextHintsPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ReloadText")]
		private static void ReloadText_Postfix(UI_TextHints __instance)
		{
			TranslateText(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("RefreshText")]
		private static void RefreshText_Postfix(UI_TextHints __instance)
		{
			TranslateText(__instance);
		}

		private static void TranslateText(UI_TextHints __instance)
		{
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo field = typeof(UI_TextHints).GetField("originalText", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field2 = typeof(UI_TextHints).GetField("text", BindingFlags.Instance | BindingFlags.NonPublic);
			object? value = field2.GetValue(__instance);
			TMP_Text val = (TMP_Text)((value is TMP_Text) ? value : null);
			string text = field.GetValue(__instance) as string;
			switch (((Object)__instance).name)
			{
			case "Tut-Basic":
				val.text = "<color=\"yellow\"><size=\"2.3\">기본 움직임</color></size>\n{Move}로 이동합니다\n{Jump}로 점프합니다\n{Sprint}로 달립니다\n\n장애물을 뛰어넘어 계속 진행하세요!";
				break;
			case "Tut-Mantling":
				val.text = "<color=\"yellow\"><size=\"2.3\">모서리 잡기</color></size>\n{Hand-Left}와 {Hand-Right} 키를 눌러 오를 수 있는 표면을 잡을 준비를 하세요.\n\n벽을 잡았다면 나면 벽을 향해 ({Move})로 이동하여 올라갑니다.\n\n마우스 버튼을 누른 채로 조준하면 근처에 있는 등반 가능한 표면을 자동으로 잡습니다.\n\n양손 버튼을 누른 상태에서 점프하여 위의 높은 난간을 조준해보세요.\n";
				break;
			case "Tut-IntroToClimbing":
				val.text = "<color=\"yellow\"><size=\"2\">클라이밍 입문</color></size>\n{Hand-Left}와 {Hand-Right} 키를 눌러 오를 수 있는 표면을 잡을 준비를 하세요.\n\n이동 키 ({Move})을(를) 사용하여 오를 수 있는 표면 사이를 이동해 위에 있는 발판까지 올라가세요.\n\n손잡이와 다른 오를 수 있는 표면은 보통 이렇게 <color=\"red\">빨간색</color>으로 표시되지만, 대부분의 모서리는 잡을 수 있다는 걸 기억하세요! \n";
				break;
			case "Tut-Crouch":
				val.text = "<color=\"yellow\"><size=\"2.3\">웅크리기</color></size>\n웅크리기 버튼을 눌러 웅크릴 수 있습니다! ({Crouch})\n웅크린 상태로 이 장애물 아래를 지나가세요.";
				break;
			case "Tut-Momentum":
				val.text = "<color=\"yellow\"><size=\"2.3\">관성</color></size>\n<color=red>관성</color>을 잘 활용하는 것이 중요합니다.\n\n<color=red>손을 준비한 상태</color>로 ({Hand-Left} 및 {Hand-Right}) 이 매달린 기둥으로 점프하세요.\n\n기둥에 매달린 후, 먼저 뒤로 흔들었다가 앞으로 흔들면서 점프와 함께 손을 놓아 멀리 날아가세요.";
				break;
			case "Tut-Momentum.01":
				val.text = "손을 준비하면 기둥을 <color=red>자동</color>으로 잡는다는 점을 기억하세요.\n떨어질 것 같다면 손을 준비해서 제때 무언가를 잡을 수 있기를 바래요!";
				break;
			}
			if (val.text.Contains("ITEMS & YOUR INVENTORY"))
			{
				val.text = "<color=\"yellow\"><size=\"2.3\">아이템 및 당신의 인벤토리</color></size>\n아이템은 손으로 집을 수 있습니다.\n\n아이템을 <color=red>사용</color>하려면 아이템을 든 손 버튼을 누르세요. ({Hand-Left}/{Hand-Right})\n\n{Inventory}을 눌러 인벤토리를 열고 아이템을 놓을 위치를 클릭하면 <color=red><size=2>아이템을 보관할 수 있습니다.</size></color>.\n\n인벤토리를 열고 아이템을 잡으면 다시 손으로 들 수 있습니다.\n\n들고 있는 아이템을 <color=red>떨어뜨리려면</color> 왼손은 {Drop-Left}, 오른손은 {Drop-Right}을 누르세요.\n";
			}
			InputUser user = InputManager.GetPlayerInput().user;
			foreach (InputAction item in (IEnumerable<InputAction>)((InputUser)(ref user)).actions)
			{
				string bindingDisplayStringOrCompositeName = InputManager.GetBindingDisplayStringOrCompositeName((__instance.forceSchemeName == "") ? InputManager.GetPlayerInput().currentControlScheme : __instance.forceSchemeName, item);
				val.text = val.text.Replace("{" + item.name + "}", bindingDisplayStringOrCompositeName);
			}
		}
	}
	[HarmonyPatch(typeof(UT_TextScrawl))]
	internal class UT_TextScrawlPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(UT_TextScrawl __instance)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.typewriter != (Object)null && (Object)(object)__instance.typewriter.TextAnimator != (Object)null && ((Object)((Component)__instance.typewriter.TextAnimator).gameObject).name == "High Score")
			{
				((Component)__instance.typewriter.TextAnimator).gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(550f, ((Component)__instance.typewriter.TextAnimator).gameObject.GetComponent<RectTransform>().sizeDelta.y);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("ShowText")]
		private static void ShowText_Prefix(UT_TextScrawl __instance, ref string s)
		{
			FieldInfo field = typeof(UT_TextScrawl).GetField("typing", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				bool flag = (bool)field.GetValue(__instance);
				switch (s)
				{
				case "ASCEND":
					s = "오르세요";
					break;
				case "<color=red>ASCEND":
					s = "<color=red>오르세요";
					break;
				case "ESCAPE":
					s = "탈출하세요";
					break;
				case "<color=red>ESCAPE":
					s = "<color=red>탈출하세요";
					break;
				case "LEARN":
					s = "훈련하세요";
					break;
				case "PLAY":
					s = "노세요";
					break;
				case "HO HO HO":
					s = "호 호 호";
					break;
				case "LADDER":
					s = "사다리";
					break;
				case "FLEE":
					s = "도망치세요";
					break;
				case "<color=red>FLEE":
					s = "<color=red>도망치세요";
					break;
				case "ONLY SILOS":
					s = "오직 저장고만";
					break;
				case "<color=red>ONLY SILOS":
					s = "<color=red>오직 저장고만";
					break;
				case "ONLY PIPEWORKS":
					s = "오직 파이프만";
					break;
				case "<color=red>ONLY PIPEWORKS":
					s = "<color=red>오직 파이프만";
					break;
				case "ONLY HABITATION":
					s = "오직 주거지만";
					break;
				case "<color=red>ONLY HABITATION":
					s = "<color=red>오직 주거지만";
					break;
				}
				s = s.Replace("BEST ASCENT - ", "최고의 등반 - ");
				s = s.Replace("BEST ASCENT LOST.", "최고의 등반에 실패했습니다.");
				s = s.Replace("ASCENDED ", "");
				s = s.Replace(" METERS AT ", " 미터를 초당 ");
				s = s.Replace("M/S", "미터의 속도로 올랐습니다");
				s = s.Replace(" METERS", " 미터 등반");
				s = s.Replace("Resumed Save.", "저장된 부분에서 다시 시작합니다.");
				s = s.Replace("No Lives Remaining.", "남은 목숨이 없습니다.");
				s = s.Replace(" Lives Remaining.", "번 남았습니다.");
				s = s.Replace("Life Lost.", "목숨을 잃었습니다.");
				s = s.Replace("Good Luck.", "행운을 빕니다.");
				s = UI_TextHints.GetHintText(s);
				__instance.typewriter.StopDisappearingText();
				__instance.typewriter.ShowText(s);
				flag = true;
				((MonoBehaviour)__instance).StopAllCoroutines();
			}
		}
	}
	[HarmonyPatch(typeof(UI_Gamemode_Button))]
	internal class UI_Gamemode_ButtonPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Initialize")]
		private static void Initialize_Postfix(UI_Gamemode_Button __instance)
		{
			InitializeTranslatedText(__instance.title);
		}

		private static void InitializeTranslatedText(TMP_Text text)
		{
			switch (text.text)
			{
			case "Campaign":
				text.text = text.text.Replace("Campaign", "캠페인");
				break;
			case "Endless Substructure":
				text.text = text.text.Replace("Endless Substructure", "끝없는 하부 구조");
				break;
			case "Endless Underworks":
				text.text = text.text.Replace("Endless Underworks", "끝없는 지하 시설");
				break;
			case "Endless Silos":
				text.text = text.text.Replace("Endless Silos", "끝없는 저장고");
				break;
			case "Endless Pipeworks":
				text.text = text.text.Replace("Endless Pipeworks", "끝없는 파이프 구역");
				break;
			case "Endless Habitation":
				text.text = text.text.Replace("Endless Habitation", "끝없는 거주 구역");
				break;
			}
		}
	}
	[HarmonyPatch(typeof(App_PerkPage_Card))]
	internal class App_PerkPage_CardPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("CheckCost")]
		private static void CheckCost_Postfix(App_PerkPage_Card __instance)
		{
			__instance.costText.text = "<size=10>" + __instance.costText.text + "</size>";
		}

		[HarmonyPostfix]
		[HarmonyPatch("Initialize")]
		private static void Initialize_Postfix(App_PerkPage_Card __instance, ref TMP_Text ___titleText, ref Tooltip ___tooltip, ref Perk ___perk)
		{
			InitializeTranslatedText(___titleText, ___tooltip, ___perk);
		}

		private static void InitializeTranslatedText(TMP_Text ___titleText, Tooltip ___tooltip, Perk ___perk)
		{
			Plugin.mls.LogInfo((object)(((Object)___perk).name ?? ""));
			___titleText.text = "<size=10>" + ___perk.title + "</size>";
			___tooltip.tip = "<size=10>" + ___perk.title + "\n<color=\"grey\">" + ___perk.description + "</color></size>";
		}
	}
	[HarmonyPatch(typeof(UT_StatText))]
	internal class UT_StatTextPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("RefreshText")]
		private static void RefreshText_Postfix(UT_StatText __instance)
		{
			TranslateText(__instance);
		}

		private static void TranslateText(UT_StatText __instance)
		{
			FieldInfo field = typeof(UT_StatText).GetField("text", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				object? value = field.GetValue(__instance);
				TMP_Text val = (TMP_Text)((value is TMP_Text) ? value : null);
				val.text = val.text.Replace("Best Score:", "최고 점수:");
				val.text = val.text.Replace("Distance Climbed:", "등반한 거리:");
				val.text = val.text.Replace("Run Time:", "게임 시간:");
				val.text = val.text.Replace("Score:", "점수:");
				val.text = val.text.Replace("Highest Ascent:", "최고 고도:");
				val.text = val.text.Replace(" Meters", "미터");
				val.text = val.text.Replace("Best Time:", "최고 시간 기록:");
				val.text = val.text.Replace("Average Ascent Rate:", "평균 등반 속도:");
				val.text = val.text.Replace("Runs:", "플레이한 횟수:");
				val.text = val.text.Replace("Deaths:", "사망한 횟수:");
				val.text = val.text.Replace("Wins:", "승리한 횟수:");
				val.text = val.text.Replace("Total Climbed:", "지금까지 등반한 거리:");
				val.text = val.text.Replace("Total Playtime:", "플레이 시간:");
				val.text = val.text.Replace("D:", "일:");
				val.text = val.text.Replace("H:", "시:");
				val.text = val.text.Replace("M:", "분:");
				val.text = val.text.Replace("S:", "초:");
				val.text = val.text.Replace("Total Items Used:", "사용한 아이템의 수:");
				val.text = val.text.Replace("Rebar Thrown:", "투척한 철근의 수:");
				val.text = val.text.Replace("Pitons Placed:", "설치한 피톤의 수:");
				val.text = val.text.Replace("Rope Placed:", "설치한 로프의 수:");
				val.text = val.text.Replace("Food Eaten:", "섭취한 음식의 수:");
				val.text = val.text.Replace("Pills Taken:", "사용한 약의 수:");
				val.text = val.text.Replace("Injectors Used:", "사용한 주사기의 수:");
				val.text = val.text.Replace("Explosives Detonated:", "폭발물을 터뜨린 횟수:");
				val.text = val.text.Replace("Flares Shot:", "격발한 플레어의 수:");
				val.text = val.text.Replace("Eyes Squished:", "짓누른 눈알의 수:");
				val.text = val.text.Replace("Crimes Committed:", "저지른 범죄의 횟수:");
				val.text = val.text.Replace("Roaches Crushed:", "짓밟은 바퀴벌레의 수:");
				val.text = val.text.Replace("Current Roaches Stored:", "현재 저축된 바퀴벌레의 수:");
				val.text = val.text.Replace("Lifetime Roaches Stored:", "지금까지 저축한 바퀴벌레의 수:");
			}
		}
	}
	[HarmonyPatch(typeof(Leaderboard_Panel))]
	internal class Leaderboard_PanelPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Refresh")]
		private static void Refresh_Postfix(Leaderboard_Panel __instance)
		{
			__instance.scoreTypeText.text = __instance.scoreTypeText.text.Replace("Score", "점수");
			__instance.scoreTypeText.text = __instance.scoreTypeText.text.Replace("Time", "시간");
		}
	}
	[HarmonyPatch(typeof(CL_GameManager))]
	internal class CL_GameManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Die")]
		private static void Die_Prefix(CL_GameManager __instance)
		{
			TranslateGeneralTips(__instance.generalTips);
			foreach (DeathType deathType in __instance.deathTypes)
			{
				TranslateDeathType(deathType);
			}
		}

		private static void TranslateGeneralTips(TipList tipList)
		{
			for (int i = 0; i < tipList.tips.Count; i++)
			{
				switch (tipList.tips[i])
				{
				case "Tip: Death is as natural as life.":
					tipList.tips[i] = "팁: 죽음은 삶만큼 자연스러운 것입니다.";
					break;
				case "Tip: Items all weigh the same amount, take only what you like!":
					tipList.tips[i] = "팁: 모든 아이템은 동일한 무게를 가지고 있습니다. 원하는 것만 가져가세요!";
					break;
				case "Tip: Items can be used to make any area substantially easier.":
					tipList.tips[i] = "팁: 아이템을 사용하면 어떤 지역이라도 훨씬 더 쉽게 만들 수 있습니다.";
					break;
				case "Tip: Don't Panic":
					tipList.tips[i] = "팁: 당황하지 마세요";
					break;
				case "Tip: If you find something new, experiment!":
					tipList.tips[i] = "팁: 새로운 것을 발견하면 실험해 보세요!";
					break;
				case "Tip: Don't be afraid to try new routes through familiar areas!":
					tipList.tips[i] = "팁: 익숙한 지역에서도 새로운 길을 이용해 보는 것을 두려워하지 마세요!";
					break;
				case "Tip: Encumberance can kill a run. If you feel too heavy, drop some items!":
					tipList.tips[i] = "팁: 너무 많은 짐은 게임을 망칠 수 있습니다. 너무 무겁다고 느껴지면 일부 아이템을 버리세요!";
					break;
				case "Tip: The Substructure hosts a variety of hazards. Be cautious!":
					tipList.tips[i] = "팁: 하부 구조에는 다양한 위험 요소가 존재합니다. 주의하세요!";
					break;
				case "Tip: Don't get eaten.":
					tipList.tips[i] = "팁: 먹히지 마세요.";
					break;
				case "Tip: Don't get fused.":
					tipList.tips[i] = "팁: 융합되지 마세요.";
					break;
				case "Abandon Hope":
					tipList.tips[i] = "희망을 버려라";
					break;
				case "Tip: Listen to your environment, subtle noises can hint at larger dangers.":
					tipList.tips[i] = "팁: 주변 환경에 귀를 기울이세요. 작은 소리가 더 큰 위험을 암시할 수도 있습니다.";
					break;
				case "Tip: Jumping while climing drains your stamina faster.":
					tipList.tips[i] = "팁: 등반 중 점프를 하면 기력이 더 빨리 소모됩니다.";
					break;
				case "Tip: Your stamina drains slower when holding on with two hands.":
					tipList.tips[i] = "팁: 벽을 두 손으로 잡으면 기력이 덜 소모됩니다.";
					break;
				case "Tip: You are at the whim of a cold uncaring universe. Good luck!":
					tipList.tips[i] = "팁: 당신은 차갑고 무정한 우주에 휘둘리고 있습니다. 행운을 빕니다!";
					break;
				case "Tip: Some items have more uses than might be initially obvious.":
					tipList.tips[i] = "팁: 어떤 아이템은 처음에 생각했던 것보다 더 다양한 용도로 쓰일 수 있습니다.";
					break;
				case "Tip: Recoil from throwing rebar can be dangerous.. Or useful?":
					tipList.tips[i] = "팁: 철근을 던질 때 발생하는 반동은 위험할 수 있습니다.. 어쩌면 유용할 수도?";
					break;
				case "Tip: Momentum is key!":
					tipList.tips[i] = "팁: 관성이 핵심입니다!";
					break;
				case "Tip: You climb faster on rope when you aren't trying to swing it.":
					tipList.tips[i] = "팁: 로프를 흔들지 않으면 로프를 타고 더 빨리 오를 수 있습니다.";
					break;
				case "Tip: Sometimes the less obvious route is faster.":
					tipList.tips[i] = "팁: 때로는 덜 눈에 띄는 경로가 더 빠를 수 있습니다.";
					break;
				case "Tip: [REDACTED]":
					tipList.tips[i] = "팁: [편집됨]";
					break;
				case "Tip: Keep an eye out for anything out of the ordinary!":
					tipList.tips[i] = "팁: 이상한 점이 있는지 주의 깊게 살펴보세요!";
					break;
				case "Tip: You can break boxes with your Hammer.":
					tipList.tips[i] = "팁: 망치로 상자를 부술 수 있습니다.";
					break;
				case "Tip: Your pockets are incredibly important. Don't forget them!":
					tipList.tips[i] = "팁: 주머니는 매우 중요합니다. 절대 잊지 마세요!";
					break;
				case "Tip: Items can allow you to bypass even the most treacherous paths.":
					tipList.tips[i] = "팁: 아이템을 사용하면 가장 위험한 길을 피할 수도 있습니다.";
					break;
				case "Tip: Your Hammer is a weapon as much as it is a tool.":
					tipList.tips[i] = "팁: 망치는 도구이면서 동시에 무기이기도 합니다.";
					break;
				case "Tip: Most Denizens don't like being Hammered.":
					tipList.tips[i] = "팁: 대부분의 주민들은 망치질당하는 것을 좋아하지 않습니다.";
					break;
				case "Tip: Find a disk? Maybe it will come in handy later!":
					tipList.tips[i] = "팁: 디스크를 찾았나요? 나중에 유용하게 쓸 수 있을지도 모릅니다!";
					break;
				}
			}
		}

		private static void TranslateDeathType(DeathType deathType)
		{
			string name = deathType.name;
			string text = name;
			if (text == null)
			{
				return;
			}
			switch (text.Length)
			{
			case 5:
				switch (text[0])
				{
				case 'b':
					if (text == "basic")
					{
						deathType.deathText = "의문사했습니다";
					}
					break;
				case 's':
					if (text == "steam")
					{
						deathType.deathText = "산 채로 삶아졌습니다";
					}
					break;
				case 't':
					if (text == "teeth")
					{
						deathType.deathText = "산 채로 먹혔습니다";
					}
					break;
				}
				break;
			case 10:
				switch (text[0])
				{
				case 'd':
					if (text == "deathfloor")
					{
						deathType.deathText = "매스에 융합되었습니다";
					}
					break;
				case 'n':
					if (text == "nastywater")
					{
						deathType.deathText = "오염되었습니다";
					}
					break;
				case 'l':
					if (text == "laserfield")
					{
						deathType.deathText = "원자로 돌아갔습니다";
					}
					break;
				}
				break;
			case 8:
				switch (text[1])
				{
				case 'a':
					if (text == "barnacle")
					{
						deathType.deathText = "끔찍하게 잡아먹혔습니다";
					}
					break;
				case 'l':
					if (text == "bloodbug")
					{
						deathType.deathText = "죽음 속으로 튕겨나갔습니다";
					}
					break;
				case 'i':
					if (text == "silodoor")
					{
						deathType.deathText = "부끄럽게도 파쇄되었습니다";
					}
					break;
				}
				break;
			case 7:
				switch (text[0])
				{
				case 'c':
					if (text == "crushed")
					{
						deathType.deathText = "섬유질로 돌아갔습니다";
					}
					break;
				case 'f':
					if (text == "falling")
					{
						deathType.deathText = "추락사했습니다";
					}
					break;
				}
				break;
			case 6:
				if (text == "gasbag")
				{
					deathType.deathText = "고운 입자로 변했습니다";
				}
				break;
			case 3:
				if (text == "fan")
				{
					deathType.deathText = "갈리고 다져졌습니다";
				}
				break;
			case 12:
				if (text == "deathcoolant")
				{
					deathType.deathText = "얼어 죽었습니다";
				}
				break;
			case 9:
				if (text == "ventthing")
				{
					deathType.deathText = "갈기갈기 찢겼습니다";
				}
				break;
			case 15:
				if (text == "laddernightmare")
				{
					deathType.deathText = "사아..다 리이. 다. 다리";
				}
				break;
			case 4:
				if (text == "jack")
				{
					deathType.deathText = "수치심으로 사망했습니다";
				}
				break;
			case 11:
			case 13:
			case 14:
				break;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Update_Postfix(CL_GameManager __instance)
		{
			FieldInfo field = typeof(CL_GameManager).GetField("previousHighScore", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field2 = typeof(CL_GameManager).GetField("playerAscent", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field3 = typeof(CL_GameManager).GetField("ascentRate", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field != null) || !(field2 != null) || !(field3 != null))
			{
				return;
			}
			float num = (float)field.GetValue(__instance);
			float num2 = (float)field2.GetValue(__instance);
			float num3 = (float)field3.GetValue(__instance);
			float num4 = num2 * num3;
			if ((Object)(object)__instance.uiMan != (Object)null && (Object)(object)__instance.uiMan.scoreTracker != (Object)null)
			{
				__instance.uiMan.scoreTracker.text = $"점수: {Mathf.RoundToInt(num4)}";
				__instance.uiMan.ascentTracker.text = $"등반 고도: {Math.Round(num2, 2)}";
				__instance.uiMan.ascentRateTracker.text = $"등반 속도: {Math.Round(num3, 2)}";
				if (num > num4)
				{
					__instance.uiMan.highScoreTracker.text = $"최고 점수: {Mathf.RoundToInt(num)}";
				}
				else
				{
					__instance.uiMan.highScoreTracker.text = $"최고 점수: {Mathf.RoundToInt(num4)}";
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("EndGameStatUpdate")]
		private static void EndGameStatUpdate_Postfix(CL_GameManager __instance)
		{
			if (__instance.uiMan.scoreTitle.text == "HIGH SCORE")
			{
				__instance.uiMan.scoreTitle.text = "최고 점수 달성";
			}
		}
	}
	[HarmonyPatch(typeof(OS_File))]
	[HarmonyPatch("Initialize")]
	internal class OS_FilePatch
	{
		[HarmonyPrefix]
		private static void Initialize_Prefix(OS_File __instance)
		{
			__instance.nameText.textComponent.supportRichText = true;
			if (__instance.itemName == "Biological Backup")
			{
				__instance.itemName = "<size=10>생체 백업</size>";
			}
			else if (__instance.itemName == "Perks & Upgrades")
			{
				__instance.itemName = "<size=10>특전 및 업그레이드</size>";
			}
		}

		[HarmonyPostfix]
		private static void Initialize_Postfix(OS_File __instance, FileInfo info, OS_Folder folder, OS_Manager osMan)
		{
			if (__instance.itemName == "Untitled Disk")
			{
				__instance.itemName = "이름없는 디스크";
				__instance.nameText.text = "<size=10>이름없는 디스크</size>";
			}
		}
	}
	[HarmonyPatch(typeof(CL_AssetManager))]
	internal class CL_AssetManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Initialize")]
		private static void Initialize_Prefix(ref WKAssetDatabase ___assetDatabase)
		{
			for (int i = 0; i < ___assetDatabase.perkAssets.Count; i++)
			{
				TranslatePerk(___assetDatabase.perkAssets[i]);
			}
			for (int j = 0; j < ___assetDatabase.diskData.Count; j++)
			{
				TranslateOSFile(___assetDatabase.diskData[j]);
			}
		}

		private static void TranslateOSFile(OS_DiskData diskData)
		{
			switch (diskData.diskName)
			{
			case "Biological Backup":
				diskData.diskName = "생체 백업";
				break;
			case "Perks & Upgrades":
				diskData.diskName = "특전 및 업그레이드";
				break;
			case "Untitled File":
				diskData.diskName = "이름없는 디스크";
				break;
			case "Granger Logs":
				diskData.diskName = "그랜저 로그";
				break;
			case "ERROR":
				diskData.diskName = "오류";
				break;
			case "RECOVERY":
				diskData.diskName = "복구됨";
				break;
			}
			if (diskData.files.Count <= 0)
			{
				return;
			}
			foreach (FileInfo file in diskData.files)
			{
				TranslateFileInfo(file);
			}
		}

		private static void TranslateFileInfo(FileInfo fileInfo)
		{
			switch (fileInfo.name)
			{
			case "DISK_GrangerNotes-01":
				fileInfo.name = "그레인저 일지";
				fileInfo.textAssetData = Plugin.sbmailsave_a_abc;
				break;
			case "DISK_Interlude2-AccessLog":
				fileInfo.textAssetData = Plugin.logdata_abc;
				break;
			case "DISK_Interlude2-CraneLog":
				fileInfo.textAssetData = Plugin.logdata_abc;
				break;
			}
		}

		private static void TranslatePerk(Perk perk)
		{
			string name = ((Object)perk).name;
			string text = name;
			if (text == null)
			{
				return;
			}
			switch (text.Length)
			{
			case 22:
				switch (text[10])
				{
				case 'm':
					if (text == "Perk_T1_ArmoredPlating")
					{
						perk.title = "장갑판";
						perk.description = "위험 요소에게 공격당했을 때 손을 덜 놓치게 합니다.\n받는 피해를 절반으로 줄입니다.";
					}
					break;
				case 'o':
					if (text == "Perk_T2_AnomalousBonds")
					{
						perk.title = "이상 결합";
						perk.description = "디스크를 통해 부활할 때 소지한 모든 아이템이 유지됩니다.\n<i>경고: 추출된 델타 물질은 아직 실험 중에 있습니다.</i>";
					}
					break;
				case 'M':
					if (text == "Perk_U_T1_MartialPatch")
					{
						perk.title = "무술 패치";
						perk.description = "<color=green>+ 망치의 피해량이 증가합니다.\n+ 피톤을 한 번에 박을 수 있게 됩니다.</color>\n<color=red>10분 동안 지속됩니다";
					}
					break;
				case 'O':
					if (text == "Perk_U_T1_OnlyClimbing")
					{
						perk.title = "오직 오르기만";
						perk.description = "<color=green>+200% 등반 속도\n<color=red>-60% 걷기 속도";
					}
					break;
				case 'P':
					if (text == "Perk_U_T2_PulseBladder")
					{
						perk.title = "맥박 방광";
						perk.description = "<color=green>공중 점프 횟수가 1회 증가합니다.</color>\n<color=red>공중 점프는 기력을 소모합니다.</color>\n<color=red>일반 점프는 기력을 약간 소모합니다.</color>\n<i>경고: 실험용 LDNA.</i>";
					}
					break;
				}
				break;
			case 25:
				switch (text[8])
				{
				case 'B':
					if (text == "Perk_T1_BackStrengtheners")
					{
						perk.title = "등 근력 강화";
						perk.description = "아이템 수용량이 3 증가합니다.";
					}
					break;
				case '1':
					if (text == "Perk_U_T1_FriendsUpstairs")
					{
						perk.title = "위층의 친구들";
						perk.description = "이곳이 어디인지는 중요하지 않습니다. 진짜 등반가는 어디서든 변화를 만들죠.\n<color=red>10분 동안 지속됩니다";
					}
					break;
				case '2':
					if (text == "Perk_U_T2_PitonEnthusiast")
					{
						perk.title = "피톤 애호가";
						perk.description = "피톤 하나면 충분하지. 철근이 왜 필요하겠어?\n<color=green>피톤을 설치하면 즉시 고정됩니다.</color>\n<color=red>철근? 그게 뭐지?";
					}
					break;
				case '3':
					if (text == "Perk_U_T3_PhysicsGraduate")
					{
						perk.title = "물리학 석사";
						perk.description = "모든 행동에는 크고 작은 반작용이 따른다";
					}
					break;
				}
				break;
			case 27:
				switch (text[18])
				{
				case 's':
					if (text == "Perk_T1_LigamentRestructure")
					{
						perk.title = "인대 재건";
						perk.description = "점프 높이가 30% 증가합니다.";
					}
					break;
				case 'M':
					if (text == "Perk_U_T1_EmployeeMotivator")
					{
						perk.title = "직원용 동기 부여 도구";
						perk.description = "<color=green>+75% 등반 속도</color>\n<color=red>+25% 매스 속도</color>";
					}
					break;
				case 'R':
					if (text == "Perk_U_T1_EmployeeRetention")
					{
						perk.title = "직원 유지";
						perk.description = "<color=green>-50% 매스 속도</color>\r\n<color=red>-20% 등반 속도</color>";
					}
					break;
				case 'a':
					if (text == "Perk_U_TX_PeripheralBinding")
					{
						perk.title = "주변 결합";
						perk.description = "<color=green>-50% 플레이어 중력</color>\n<color=red>-70% 플레이어 기력</color>\n<color=red>+50% 받는 피해량</color>";
					}
					break;
				}
				break;
			case 23:
				switch (text[6])
				{
				case '1':
					if (text == "Perk_T1_MetabolicStasis")
					{
						perk.title = "신진대사 정체";
						perk.description = "아이템의 효과 지속 시간이 증가합니다.";
					}
					break;
				case '2':
					if (text == "Perk_T2_PheromoneGlands")
					{
						perk.title = "페로몬 선";
						perk.description = "바퀴벌레가 당신을 사랑합니다\n<i>경고: 람다 유기체 LDNA는 아직 실험 중에 있습니다.</i>";
					}
					break;
				case '_':
					if (text == "Perk_U_T1_SlowAndSteady")
					{
						perk.title = "느리지만 꾸준히";
						perk.description = "<color=green>+200% 기력</color>\n<color=red>-25% 속도";
					}
					break;
				}
				break;
			case 24:
				switch (text[8])
				{
				case 'R':
					if (text == "Perk_T1_RegenerativePads")
					{
						perk.title = "재생 패드";
						perk.description = "지면에 있을 때 기력을 50% 더 빨리 회복합니다.";
					}
					break;
				case 'V':
					if (text == "Perk_T1_VelocityAugments")
					{
						perk.title = "속도 증강";
						perk.description = "걷기/달리기 속도가 25% 증가합니다.\n등반 속도가 10% 증가합니다.";
					}
					break;
				}
				break;
			case 26:
				switch (text[8])
				{
				case 'S':
					if (text == "Perk_T1_SomaticPainkillers")
					{
						perk.title = "체세포 진통제";
						perk.description = "최대 기력이 30% 증가합니다.";
					}
					break;
				case 'T':
					if (text == "Perk_T1_TissueRestoratives")
					{
						perk.title = "조직 복원제";
						perk.description = "기력 재생량이 25% 증가합니다.";
					}
					break;
				}
				break;
			case 20:
				switch (text[5])
				{
				case 'T':
					if (text == "Perk_T2_ElasticLimbs")
					{
						perk.title = "신축성 사지";
						perk.description = "사거리가 50% 증가합니다.\n<i>경고: 람다 유기체 LDNA는 아직 실험 중에 있습니다.</i>";
					}
					break;
				case 'U':
					if (text == "Perk_U_T2_DiskJockey")
					{
						perk.title = "디스크 조키";
						perk.description = "도움이 좀 필요할 것 같더라고.";
					}
					break;
				}
				break;
			case 19:
				switch (text[8])
				{
				case 'H':
					if (text == "Perk_T2_HeavyStrike")
					{
						perk.title = "강력한 타격";
						perk.description = "망치의 피해량이 증가합니다.\n피톤을 한 번에 박을 수 있게 됩니다.";
					}
					break;
				case '1':
					if (text == "Perk_U_T1_HangTight")
					{
						perk.title = "꽉 잡아!";
						perk.description = "넌 할 수 있어!";
					}
					break;
				case '2':
					if (text == "Perk_U_T2_BadParent")
					{
						perk.title = "나쁜 부모";
						perk.description = "우린 네게 실망했다.";
					}
					break;
				}
				break;
			case 28:
				switch (text[10])
				{
				case 's':
					if (text == "Perk_T2_SystemReorganization")
					{
						perk.title = "시스템 개편";
						perk.description = "이동 속도, 점프력, 등반 속도 및 기력 재생이 15% 향상됩니다.\n<i>경고: 람다 유기체 LDNA는 아직 실험 중에 있습니다.</i>";
					}
					break;
				case 'M':
					if (text == "Perk_U_T1_MetabolicOverdrive")
					{
						perk.title = "신진대사 과부하";
						perk.description = "<color=green>+30% 점프 높이\n+30% 등반 속도</color>\n<color=red>8분 동안 지속됩니다";
					}
					break;
				case 'R':
					if (text == "Perk_U_T1_RegularPainkillers")
					{
						perk.title = "일반 진통제";
						perk.description = "<color=green>기력이 2배로 증가합니다</color>\n<color=red>10분 동안 지속됩니다";
					}
					break;
				}
				break;
			case 21:
				switch (text[8])
				{
				case '2':
					if (text == "Perk_U_T2_Bulletproof")
					{
						perk.title = "방탄";
						perk.description = "<color=green>위험 요소에게 공격당했을 때 손을 놓치지 않게 합니다.\n받는 피해를 절반으로 줄입니다.</color>\n<color=red>15분 동안 지속됩니다";
					}
					break;
				case 'X':
					if (text == "Perk_U_TX_AdoptionDay")
					{
						perk.title = "입양된 날";
						perk.description = "세계 최고의 엄마";
					}
					break;
				}
				break;
			case 31:
				switch (text[8])
				{
				case '3':
					if (text == "Perk_U_T3_UnstoppableConviction")
					{
						perk.title = "불굴의 신념";
						perk.description = "<color=green>+3 공중 점프</color>\n<color=red>6분 동안 지속됩니다";
					}
					break;
				case 'X':
					if (text == "Perk_U_TX_TeleporterMalfunction")
					{
						perk.title = "순간이동기 오작동";
						perk.description = "삶과 죽음의 경계에 갇힌 순간";
					}
					break;
				}
				break;
			case 30:
				if (text == "Perk_T1_LatissimusOptimization")
				{
					perk.title = "광배근 최적화";
					perk.description = "등반 속도가 30% 증가합니다.";
				}
				break;
			case 18:
				if (text == "Perk_T2_PulseOrgan")
				{
					perk.title = "맥박 기관";
					perk.description = "공중 점프 횟수가 1회 증가합니다.\n<i>경고: 람다 유기체 LDNA는 아직 실험 중에 있습니다.</i>";
				}
				break;
			case 17:
				if (text == "Perk_T2_RabbitDNA")
				{
					perk.title = "토끼 DNA";
					perk.description = "<color=white>웅크린 상태에서 점프하면 멀리 점프할 수 있게 됩니다</color>";
				}
				break;
			case 29:
				break;
			}
		}
	}
	[HarmonyPatch(typeof(Changeable_Text))]
	internal class Changeable_TextPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void StartPostfix(Changeable_Text __instance)
		{
			TranslateText(__instance);
		}

		private static void TranslateText(Changeable_Text __instance)
		{
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("inputField", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field == null)
			{
				return;
			}
			object? value = field.GetValue(__instance);
			InputField val = (InputField)((value is InputField) ? value : null);
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			val.characterLimit = 0;
			string text = val.text;
			string text2 = text;
			if (!(text2 == "Perks & Upgrades"))
			{
				if (text2 == "Biological Backup")
				{
					val.textComponent.supportRichText = true;
					val.text = "<size=8>생체 백업</size>";
					val.textComponent.text = "<size=8>생체 백업</size>";
				}
			}
			else
			{
				val.textComponent.supportRichText = true;
				val.text = "<size=8>특전 및 업그레이드</size>";
				val.textComponent.text = "<size=8>특전 및 업그레이드</size>";
			}
		}
	}
	[HarmonyPatch(typeof(Tooltip_Manager))]
	internal class Tooltip_ManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(Tooltip_Manager __instance)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			__instance.tipText.margin = new Vector4(1f, 0f, 1f, 1f);
		}
	}
	[HarmonyPatch]
	internal class FontLoader
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(TextMeshProUGUI), "Awake")]
		private static void PatchTextAwake(TextMeshProUGUI __instance)
		{
			if (!((Object)(object)((TMP_Text)__instance).font == (Object)null))
			{
				switch (((Object)((TMP_Text)__instance).font).name)
				{
				case "Oswald-VariableFont_wght SDF":
					((TMP_Text)__instance).font = Plugin.generalTMPFont;
					break;
				case "monoclefixed":
					((TMP_Text)__instance).font = Plugin.galmuri9TMPFont;
					break;
				case "m3x6":
					((TMP_Text)__instance).font = Plugin.galmuri7TMPFont;
					break;
				case "ChicagoFLF":
					((TMP_Text)__instance).font = Plugin.dunggeunmoTMPFont;
					break;
				default:
					((TMP_Text)__instance).font = Plugin.generalPixelTMPFont;
					break;
				}
			}
		}

		private static void DisableFont(TMP_FontAsset font)
		{
			font.characterLookupTable.Clear();
			font.atlasPopulationMode = (AtlasPopulationMode)0;
		}
	}
	[HarmonyPatch(typeof(App_SavePage))]
	internal class App_SavePagePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(App_SavePage __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = ((Component)__instance.floppyText).GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(1700f, component.sizeDelta.y);
			TextMeshProUGUI component2 = ((Component)__instance.floppyText).GetComponent<TextMeshProUGUI>();
			((TMP_Text)component2).enableWordWrapping = false;
			((TMP_Text)component2).overflowMode = (TextOverflowModes)0;
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateSaveText")]
		private static void UpdateSaveText_Postfix(App_SavePage __instance)
		{
			__instance.floppyText.text = __instance.floppyText.text.Replace("NO BACKUP DATA FOUND", "백업 데이터가 발견되지 않음");
			__instance.floppyText.text = __instance.floppyText.text.Replace("<mspace=5>", "<mspace=11>");
			FieldInfo field = typeof(App_SavePage).GetField("diskCards", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				List<App_SavePage_DiskCard> list = field.GetValue(__instance) as List<App_SavePage_DiskCard>;
				for (int i = 0; i < list.Count; i++)
				{
					list[i].text.text = list[i].text.text.Replace("Capacity", "<size=10>용량");
				}
			}
			__instance.floppyText.text = __instance.floppyText.text.Replace("SAVES", "저장");
		}

		[HarmonyPrefix]
		[HarmonyPatch("CheckIronKnuckle")]
		private static void CheckIronKnuckle_Prefix(App_SavePage __instance)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			FieldInfo field = typeof(App_SavePage).GetField("window", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field != null))
			{
				return;
			}
			object? value = field.GetValue(__instance);
			OS_Window val = (OS_Window)((value is OS_Window) ? value : null);
			if ((Object)(object)val == (Object)null || !SettingsManager.settings.g_competitive)
			{
				return;
			}
			Message_Packet val2 = new Message_Packet
			{
				type = "default",
				closeText = "나가기",
				closeFunction = val.CloseApp,
				message = "현재 아이언 너클 모드로 플레이하고 있습니다. 저장 기능이 비활성화됩니다.",
				screenPos = new Vector2(0f, 0f)
			};
			FieldInfo field2 = typeof(OS_Window).GetField("os", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field2 != null)
			{
				object? value2 = field2.GetValue(val);
				OS_Manager val3 = (OS_Manager)((value2 is OS_Manager) ? value2 : null);
				if ((Object)(object)val3 != (Object)null)
				{
					val3.messageManager.CreateMessage(val2);
				}
			}
		}
	}
	[HarmonyPatch(typeof(FontUpdateTracker))]
	internal class FontUpdateTrackerPatch
	{
		private static List<Text> cachedTexts = new List<Text>();

		[HarmonyPrefix]
		[HarmonyPatch("TrackText")]
		private static void TrackTextPrefix(Text t)
		{
			if (!cachedTexts.Contains(t))
			{
				cachedTexts.Add(t);
				Plugin.TranslateText(t);
			}
		}
	}
	[HarmonyPatch(typeof(TextAnimator_TMP))]
	internal class TextAnimator_TMPPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetTextToSource")]
		private static void SetTextToSource_Postfix(TextAnimator_TMP __instance)
		{
			try
			{
				Translate(__instance);
			}
			catch (Exception ex)
			{
				Plugin.mls.LogError((object)("TMP 애니메이터를 번역하는 과정에서 오류가 발생했습니다!\n" + ex));
			}
		}

		private static void Translate(TextAnimator_TMP __instance)
		{
			if ((Object)(object)__instance.TMProComponent != (Object)null)
			{
				if (((TAnimCore)__instance).textFull == "PREPARE NEW BACKUP")
				{
					__instance.TMProComponent.text = "새로운 백업을 준비하세요";
					((TAnimCore)__instance).textFull = "새로운 백업을 준비하세요";
				}
				else if (((TAnimCore)__instance).textFull == "CONTINUE")
				{
					__instance.TMProComponent.text = "계속하기";
					((TAnimCore)__instance).textFull = "계속하기";
				}
				else if (((TAnimCore)__instance).textFull == "REFORMAT DISKS")
				{
					__instance.TMProComponent.text = "디스크 재포맷하기";
					((TAnimCore)__instance).textFull = "디스크 재포맷하기";
				}
				else if (((TAnimCore)__instance).textFull == "CONGRATULATIONS!")
				{
					__instance.TMProComponent.text = "축하합니다!";
					((TAnimCore)__instance).textFull = "축하합니다!";
				}
				else if (((TAnimCore)__instance).textFull == "PURCHASE")
				{
					__instance.TMProComponent.text = "구매";
					((TAnimCore)__instance).textFull = "구매";
				}
				else if (((TAnimCore)__instance).textFull == "PURCHASE")
				{
					__instance.TMProComponent.text = "구매";
					((TAnimCore)__instance).textFull = "구매";
				}
				else if (((TAnimCore)__instance).textFull == "Campaign")
				{
					__instance.TMProComponent.text = "캠페인";
					((TAnimCore)__instance).textFull = "캠페인";
				}
				else if (((TAnimCore)__instance).textFull == "Endless Substructure")
				{
					__instance.TMProComponent.text = "끝없는 하부 구조";
					((TAnimCore)__instance).textFull = "끝없는 하부 구조";
				}
				else if (((TAnimCore)__instance).textFull == "Endless Underworks")
				{
					__instance.TMProComponent.text = "끝없는 지하 시설";
					((TAnimCore)__instance).textFull = "끝없는 지하 시설";
				}
				else if (((TAnimCore)__instance).textFull == "Endless Silos")
				{
					__instance.TMProComponent.text = "끝없는 저장고";
					((TAnimCore)__instance).textFull = "끝없는 저장고";
				}
				else if (((TAnimCore)__instance).textFull == "Endless Pipeworks")
				{
					__instance.TMProComponent.text = "끝없는 파이프 구역";
					((TAnimCore)__instance).textFull = "끝없는 파이프 구역";
				}
				else if (((TAnimCore)__instance).textFull == "Endless Habitation")
				{
					__instance.TMProComponent.text = "끝없는 거주 구역";
					((TAnimCore)__instance).textFull = "끝없는 거주 구역";
				}
				else if (((TAnimCore)__instance).textFull == "PAUSED")
				{
					__instance.TMProComponent.text = "일시정지됨";
					((TAnimCore)__instance).textFull = "일시정지됨";
				}
				else if (((TAnimCore)__instance).textFull == "CAUTION!")
				{
					__instance.TMProComponent.text = "경고!";
					((TAnimCore)__instance).textFull = "경고!";
				}
				else if (((TAnimCore)__instance).textFull == "Iron Knuckle: No Saves, Perks, or Banked Roaches")
				{
					__instance.TMProComponent.text = "아이언 너클: 저장, 특전과 저축한 바퀴벌레가 비활성화됩니다";
					((TAnimCore)__instance).textFull = "아이언 너클: 저장, 특전과 저축한 바퀴벌레가 비활성화됩니다";
				}
				else if (((TAnimCore)__instance).textFull == "Hard Mode: Good Luck")
				{
					__instance.TMProComponent.text = "하드 모드: 행운을 빕니다";
					((TAnimCore)__instance).textFull = "하드 모드: 행운을 빕니다";
				}
				else if (((TAnimCore)__instance).textFull == "<noparse></noparse>YOU DIED")
				{
					__instance.TMProComponent.text = "<noparse></noparse>사망했습니다";
					((TAnimCore)__instance).textFull = "<noparse></noparse>사망했습니다";
				}
				else if (((TAnimCore)__instance).textFull == "<noparse></noparse>HARD MODE")
				{
					__instance.TMProComponent.text = "<noparse></noparse>하드 모드";
					((TAnimCore)__instance).textFull = "<noparse></noparse>하드 모드";
				}
				else if (((TAnimCore)__instance).textFull == "<noparse></noparse>IRON KNUCKLE")
				{
					__instance.TMProComponent.text = "<noparse></noparse>아이언 너클";
					((TAnimCore)__instance).textFull = "<noparse></noparse>아이언 너클";
				}
			}
		}
	}
	[HarmonyPatch(typeof(CL_LocalizationManager))]
	internal class CL_LocalizationManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(CL_LocalizationManager __instance)
		{
			CL_LocalizationManager.currentLocalization = JsonConvert.DeserializeObject<Localization>(Plugin.koreanSubtitle.text);
		}
	}
	[HarmonyPatch(typeof(Text))]
	internal class TextPatch
	{
	}
	[HarmonyPatch(typeof(TextMeshProUGUI))]
	internal class TextMeshProUGUIPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(TextMeshProUGUI __instance)
		{
			try
			{
				Translate(__instance);
			}
			catch (Exception ex)
			{
				Plugin.mls.LogError((object)("TMP 텍스트를 번역하는 과정에서 오류가 발생했습니다!\n" + ex));
			}
		}

		private static void Translate(TextMeshProUGUI __instance)
		{
			switch (((TMP_Text)__instance).text)
			{
			case "PLAY":
				((TMP_Text)__instance).text = "플레이";
				break;
			case "Play":
				((TMP_Text)__instance).text = "플레이";
				break;
			case "LOGBOOK":
				((TMP_Text)__instance).text = "로그북";
				break;
			case "RESUME":
				((TMP_Text)__instance).text = "계속하기";
				break;
			case "RESTART":
				((TMP_Text)__instance).text = "재시작";
				break;
			case "Restart":
				((TMP_Text)__instance).text = "재시작";
				break;
			case "Main Menu":
				((TMP_Text)__instance).text = "메인 메뉴";
				break;
			case "Session":
				((TMP_Text)__instance).text = "세션";
				break;
			case "Details":
				((TMP_Text)__instance).text = "세부 사항";
				break;
			case "END RUN":
				((TMP_Text)__instance).text = "게임 나가기";
				break;
			case "SETTINGS":
				((TMP_Text)__instance).text = "설정";
				break;
			case "QUIT":
				((TMP_Text)__instance).text = "종료";
				break;
			case "Report Bug":
				((TMP_Text)__instance).text = "버그 신고하기";
				break;
			case "Report":
				((TMP_Text)__instance).text = "신고하기";
				break;
			case "Cancel":
				((TMP_Text)__instance).text = "취소";
				break;
			case "Exit":
				((TMP_Text)__instance).text = "나가기";
				break;
			case "ARE YOU SURE?":
				((TMP_Text)__instance).text = "확실한가요?";
				break;
			case "LOADING":
				((TMP_Text)__instance).text = "불러오는 중";
				break;
			case "CLOSE":
				((TMP_Text)__instance).text = "닫기";
				break;
			case "Options":
				((TMP_Text)__instance).text = "옵션";
				break;
			case "Video/Audio":
				((TMP_Text)__instance).text = "비디오/오디오";
				break;
			case "VIDEO/AUDIO":
				((TMP_Text)__instance).text = "비디오/오디오";
				break;
			case "Video":
				((TMP_Text)__instance).text = "비디오";
				break;
			case "Fullscreen":
				((TMP_Text)__instance).text = "전체 화면";
				break;
			case "Screen Resolution":
				((TMP_Text)__instance).text = "화면 해상도";
				break;
			case "V-Sync":
				((TMP_Text)__instance).text = "수직 동기화";
				break;
			case "Brightness":
				((TMP_Text)__instance).text = "밝기";
				break;
			case "Field of View":
				((TMP_Text)__instance).text = "시야각";
				break;
			case "Graphics":
				((TMP_Text)__instance).text = "그래픽";
				break;
			case "Dither Effect":
				((TMP_Text)__instance).text = "디더링 효과";
				break;
			case "CRT Effect":
				((TMP_Text)__instance).text = "CRT 효과";
				break;
			case "Vertex Jitter":
				((TMP_Text)__instance).text = "정점 떨림";
				break;
			case "Audio":
				((TMP_Text)__instance).text = "오디오";
				break;
			case "Master Volume":
				((TMP_Text)__instance).text = "주 음량";
				break;
			case "Music Volume":
				((TMP_Text)__instance).text = "음악 음량";
				break;
			case "Announcer Subtitles":
				((TMP_Text)__instance).text = "아나운서 자막";
				break;
			case "Subtitle Background":
				((TMP_Text)__instance).text = "자막 배경";
				break;
			cas