using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using Cute; using UnityEngine; using Wizard; public static class Global { public enum CHAR_TYPE { PLAYER, ENEMY, NONE, MAX } public enum CardRarity { MIN = 1, BRONZE = 1, SILVER = 2, GOLD = 3, LEGEND = 4, MAX = 5 } public enum LANG_TYPE { Jpn, Eng, Kor, Chs, Cht, Fre, Ita, Ger, Spa, Max } public struct LanguageProps { public string LangType; public string Name; public string Font; public string DisplayName; public LanguageProps(string langType, string name, string font, string display) { LangType = langType; Name = name; Font = font; DisplayName = display; } } public const int NONE = -1; public const string NONE_TEXT = "NONE"; public const int GOBLIN_CARD_ID = 100011010; public const int FIGHTER_CARD_ID = 100011020; public const int EVOLVE_TO_OTHER_CARD_INITIAL_ID = 910; public const int CHOICE_BRAVE_CARD_INITIAL_ID = 930; public const int RITE_OF_THE_IGNORANT_ID = 900344060; public const int GHIOS_SPARKLING_PRISM_ID = 120341020; public const int ARAMIS_ID = 900241110; public const int WIELDER_OF_THE_COSMOS_ID = 123841020; public const int SLAUGHTERING_SAMURAI_ID = 130241030; public const int GOBLIN_MAGE_ID = 125021010; public const int ARCHANGEL_OF_EVOCATION_ID = 117031020; public const int PEERLESS_WARRIOR_ID = 129241020; public const int ELEANOR_TECHNIQUE_ID = 930344070; public const int VAIDI_SECRET_ART_ID = 930444050; public const int BRIARMAIDEN_ID = 132141010; public const int THUNDER_GOD_OF_THE_TEMPEST_ID = 123031020; public const int REAPER_CARD_IDX = -99; public const long ONE_SECOND = 10000000L; public const float BASE_SCREEN_WIDTH_SIZE = 1280f; public const float BASE_SCREEN_HEIGHT_SIZE = 640f; public const int STANDARD_DECK_CARD_NUM_MAX = 40; public const int TWO_PICK_DECK_MAX_NUM = 30; public const int WIND_FALL_DECK_MAX_NUM = 35; public const int STANDARD_DECK_SAVABLE_CARD_NUM_MAX = 50; public const int SAME_KIND_NUM_MAX_BASE = 3; public const int CARD_RARITY_MIN = 1; public const int CARD_RARITY_BRONZE = 1; public const int CARD_RARITY_SILVER = 2; public const int CARD_RARITY_GOLD = 3; public const int CARD_RARITY_LEGEND = 4; public const int CARD_RARITY_MAX = 5; public const int DAMAGE_EFFECT_MAX_NUM = 12; public const float MULLIGAN_TIME_LIMIT = 60f; public const float TURN_TIME_LIMIT = 90f; public const float TURN_TIME_EXTEND_ONPLAY = 3f; public const float TURN_TIME_EXTEND_MAX = 15f; public const float DRAG_DISTANCE = 40f; public static Color CARD_SELECT_COLOR; public static Color CARD_PASSIVE_COLOR; public static Color CARD_DEFAULT_COLOR; public static Color CARD_INACTIVE_COLOR; public static Color CARD_BLESS_EFFECT_COLOR; public static Color CARD_POWERDOWN_EFFECT_COLOR; public static Color CARD_LABEL_FRAME_TEXT_COLOR; public static Color CARD_LABEL_FRAME_TEXT_RED_COLOR; public static Color CARD_LABEL_FRAME_COST_COLOR; public static Color CARD_HBP_LABEL_COST_COLOR; public static Color CARD_LABEL_FRAME_ATTACK_COLOR; public static Color CARD_LABEL_FRAME_HEALTH_COLOR; public static Color CARD_LABEL_FRAME_LESS_THAN_MAX_COLOR; public static Color CARD_LABEL_FRAME_LESS_THAN_BASE_COLOR; public static readonly Color FRAME_COLOR_CAN_ACT; public static readonly Color FRAME_COLOR_CAN_ACT_RESTRICTED; public static readonly Color FRAME_COLOR_SKILL_YELLOW; public static readonly Color FRAME_COLOR_SKILL_PURPLE; public static readonly Color FRAME_COLOR_SKILL_LIGHT_BLUE; public static readonly Color FRAME_COLOR_SELECTABLE; public static readonly Color FRAME_COLOR_FUSION_METAMORPHOSE; public static readonly Color PROTECTION_COLOR_DAMAGE_CUT; public static readonly Color PROTECTION_COLOR_INDESTRUCTIBLE; public static readonly Color PROTECTION_COLOR_MULTI_INVALID; public static readonly Color PROTECTION_COLOR_DAMAGE_REFLECTION; public static readonly Color EVOLVE_TRAIL_COLOR_NORMAL; public static readonly Color EVOLVE_TRAIL_COLOR_SKILL; public static readonly Color32 EFFECT_COLOR_ELF; public static readonly Color32 EFFECT_COLOR_ROYAL; public static readonly Color32 EFFECT_COLOR_WITCH_1; public static readonly Color32 EFFECT_COLOR_WITCH_2; public static readonly Color32 EFFECT_COLOR_DRAGON; public static readonly Color32 EFFECT_COLOR_NECROMANCER; public static readonly Color32 EFFECT_COLOR_VANPIRE; public static readonly Color32 EFFECT_COLOR_BISHOP; public static readonly Color32 EFFECT_COLOR_NEMESIS; public static readonly Rect CARD_2D_UV_RECT; public static readonly Vector3 CARD_BASE_POS; public static readonly Vector3 CARD_BASE_ROT; public static readonly Vector3 CARD_BASE_SCALE; public static readonly Vector3 CARD_BASE_STAY_SCALE; public static readonly Vector3 CARD_BASE_SELECT_SCALE; public static readonly Vector3 CARD_LIST_SCALE; public static readonly Vector3 CARD_BATTLE_SCALE; public static readonly Vector3 CARD_BATTLE_ROTATION; public static readonly Vector3 CLASS_BATTLE_SCALE; public static readonly Vector3 CLASS_BATTLE_POSITION_PLAYER; public static readonly Vector3 CLASS_BATTLE_POSITION_ENEMY; public const int BATTLE_LAYER = 10; public const int SUB_PARTICLES_LAYER = 12; public const int HIGH_RANK_EVOLVE_LAYER = 13; public const int BATTLE_UNDER_LAYER = 15; public const int FRONT_UI_LAYER = 24; public const int SYSTEM_UI_LAYER = 22; public const int CUT_IN_LAYER = 31; public const int EMPTY_DECK_ID = -1; public static readonly Vector3 EP_PANEL_POSITION_PLAYER; public static readonly Vector3 PLAYER_CHOICE_BRAVE_BUTTON_POSITION; public static readonly Vector3 ENEMY_CHOICE_BRAVE_BUTTON_POSITION; public static readonly Vector3 PLAYER_CHOICE_BRAVE_BUTTON_POSITION_ZOOM; public const int DEFAULT_EMBLEM_ID = 100000000; public const int DEFAULT_DEGREE_ID = 300003; public static Vector2 WEBVIEW_NORMAL_SIZE; public static Vector3 POSITION_COST_ICON; public static Vector3 POSITION_ATK_ICON; public static Vector3 POSITION_LIFE_ICON; public static Vector3 POSITION_NAME_TEXT; public static Vector3 POSITION_SKILL_TEXT; public static Vector3 SCALE_CARD_ICON; public static Vector3 SCALE_NAME_TEXT; public static Vector3 SCALE_SKILL_TEXT; public static bool IS_LOAD_ALLDONE; public static int NormalFieldOfView; public static int WideFieldOfView; public const float WideFieldOfViewAspectRatioThreshold = 1.5f; public const float ASPECT_RATIO_OVER_16_9 = 1.8f; public const string BASE_GAME_FONT_NAME = "A-OTF-KaiminTuStd-Bold"; public const string BASE_BITMAP_FONT_NAME = "FOT-TsukuAOldMinPr6-E"; public static string GAME_FONT_NAME; public static string[] fontFileNames; public static List PreLoadSkinId; public static List SeSysSummonLandingDuplicateCheckId; public const int ROTATION_SEASON_CHANGE_ERROR_FOR_BUY = 110; public const int ROTATION_SEASON_CHANGE_ERROR = 109; private const int CHINESE_TAIWAN_ID = 1028; private const int CHINESE_HONGKONG_ID = 3076; private const int CHINESE_MAKAO_ID = 5124; private const int CHINESE_SINGAPORE_ID = 4100; private const int CHINESE_CHINA_ID = 2052; public const int LANG_MAX = 9; public static string jpn_font; public const string CHS_FONT = "DFGBWB7-900"; public static LanguageProps[] LanguagePropList; public static UnityEngine.Font GAME_FONT; public const string CLONE_SUFFIX = "(Clone)"; private const string BBCodePattern = "(\\[[a-z0-9\\/\\-]*\\])"; public const string BBCodePatternName = "(\\[[a-z0-9\\/\\-]*(rub\\<[^\\>]*\\>)*\\])"; private static Vector2 CARD_NAME_POS_SHORT; private static Vector2 CARD_NAME_POS_NORMAL; private static Vector3 CARD_NAME_POSTION_ADD; private static Vector2 CARD_NAME_POS_SHORT_2D; private static Vector2 CARD_NAME_POS_NORMAL_2D; private static float CARD_NAME_Z_ALPHABET_LANGUAGE; private static int CARD_NAME_SIZE_ALPHABET_LANGUAGE; public const int CARD_NAME_LIMIT_LENGTH_ENG = 11; public const int CARD_NAME_LIMIT_LENGTH_JPN = 5; private const char ZERO_WIDTH_MARKER = '\u200b'; private static readonly LANG_TYPE[] WordBreakLanguages; private static readonly LANG_TYPE[] AlphabetLanguages; private static readonly string[] WordBreakLanguageNames; private static readonly string[] AlphabetLanguageNames; public static bool IsSnCollabSkin(int skinId) { if (4300 <= skinId) { return skinId <= 4399; } return false; } [DllImport("__Internal")] private static extern int GetUserDefaultLangID(); static Global() { CARD_SELECT_COLOR = Color.cyan; CARD_PASSIVE_COLOR = Color.red; CARD_DEFAULT_COLOR = Color.white; CARD_INACTIVE_COLOR = new Color(0.2f, 0.2f, 0.2f); CARD_BLESS_EFFECT_COLOR = new Color(0.7f, 1f, 0f, 1f); CARD_POWERDOWN_EFFECT_COLOR = new Color(1f, 0.8f, 0.4f); CARD_LABEL_FRAME_TEXT_COLOR = new Color(1f, 0.992f, 0.922f); CARD_LABEL_FRAME_TEXT_RED_COLOR = new Color(1f, 0.7f, 0.7f); CARD_LABEL_FRAME_COST_COLOR = new Color(0f, 0.2f, 0f); CARD_HBP_LABEL_COST_COLOR = new Color(0.27f, 0.207f, 0.176f, 1f); CARD_LABEL_FRAME_ATTACK_COLOR = new Color(0.2f, 0.2f, 0.4f); CARD_LABEL_FRAME_HEALTH_COLOR = new Color(0.4f, 0.2f, 0.2f); CARD_LABEL_FRAME_LESS_THAN_MAX_COLOR = new Color(0.9f, 0.75f, 0.7f); CARD_LABEL_FRAME_LESS_THAN_BASE_COLOR = new Color(32f / 51f, 26f / 51f, 14f / 51f); FRAME_COLOR_CAN_ACT = new Color(0f, 1f, 32f / 51f); FRAME_COLOR_CAN_ACT_RESTRICTED = new Color(1f, 1f, 0f); FRAME_COLOR_SKILL_YELLOW = new Color(64f / 85f, 1f, 0f); FRAME_COLOR_SKILL_PURPLE = new Color(0.5019608f, 0.4392157f, 1f); FRAME_COLOR_SKILL_LIGHT_BLUE = new Color(0f, 0.7921569f, 1f, 1f); FRAME_COLOR_SELECTABLE = new Color(1f, 32f / 51f, 0f); FRAME_COLOR_FUSION_METAMORPHOSE = new Color(64f / 85f, 1f, 0f); PROTECTION_COLOR_DAMAGE_CUT = new Color(0f, 0.2509804f, 1f); PROTECTION_COLOR_INDESTRUCTIBLE = new Color(1f, 0.5019608f, 0f); PROTECTION_COLOR_MULTI_INVALID = new Color(0f, 1f, 0.6901961f); PROTECTION_COLOR_DAMAGE_REFLECTION = new Color(1f, 0.1254902f, 0.1254902f); EVOLVE_TRAIL_COLOR_NORMAL = new Color(1f, 0.8f, 0.2f, 1f); EVOLVE_TRAIL_COLOR_SKILL = new Color(0f, 0.2f, 0.4f, 1f); EFFECT_COLOR_ELF = new Color32(64, byte.MaxValue, 128, byte.MaxValue); EFFECT_COLOR_ROYAL = new Color32(byte.MaxValue, 224, 64, byte.MaxValue); EFFECT_COLOR_WITCH_1 = new Color32(224, 64, byte.MaxValue, byte.MaxValue); EFFECT_COLOR_WITCH_2 = new Color32(67, 82, 155, byte.MaxValue); EFFECT_COLOR_DRAGON = new Color32(byte.MaxValue, 128, 32, byte.MaxValue); EFFECT_COLOR_NECROMANCER = new Color32(128, 64, byte.MaxValue, byte.MaxValue); EFFECT_COLOR_VANPIRE = new Color32(byte.MaxValue, 64, 64, byte.MaxValue); EFFECT_COLOR_BISHOP = new Color32(byte.MaxValue, 240, 160, byte.MaxValue); EFFECT_COLOR_NEMESIS = new Color32(64, 128, byte.MaxValue, byte.MaxValue); CARD_2D_UV_RECT = new Rect(0f, 0f, 1f, 1.1f); CARD_BASE_POS = new Vector3(0f, 0f, 0f); CARD_BASE_ROT = new Vector3(0f, -180f, 0f); CARD_BASE_SCALE = new Vector3(1f, 1f, 1f); CARD_BASE_STAY_SCALE = new Vector3(18f, 18f, 18f); CARD_BASE_SELECT_SCALE = new Vector3(2.42f, 1f, 3.2f); CARD_LIST_SCALE = new Vector3(170f, 226f, 1f); CARD_BATTLE_SCALE = Vector3.one; CARD_BATTLE_ROTATION = new Vector3(-10f, 0f, 0f); CLASS_BATTLE_SCALE = Vector3.one; CLASS_BATTLE_POSITION_PLAYER = new Vector3(0f, 0f, 0f); CLASS_BATTLE_POSITION_ENEMY = new Vector3(0f, 0f, 0f); EP_PANEL_POSITION_PLAYER = new Vector3(-229f, -11.29f, 0f); PLAYER_CHOICE_BRAVE_BUTTON_POSITION = new Vector3(-440f, 200f, 15f); ENEMY_CHOICE_BRAVE_BUTTON_POSITION = new Vector3(390f, -126f, 10f); PLAYER_CHOICE_BRAVE_BUTTON_POSITION_ZOOM = new Vector3(PLAYER_CHOICE_BRAVE_BUTTON_POSITION.x, PLAYER_CHOICE_BRAVE_BUTTON_POSITION.y + 25f, PLAYER_CHOICE_BRAVE_BUTTON_POSITION.z); WEBVIEW_NORMAL_SIZE = new Vector2(1100f, 440f); POSITION_COST_ICON = new Vector3(-1.68f, 2.1f, -0.2f); POSITION_ATK_ICON = new Vector3(-1.6f, -2.2f, -0.2f); POSITION_LIFE_ICON = new Vector3(1.6f, -2.2f, -0.2f); POSITION_NAME_TEXT = new Vector3(0f, 2f, -0.2f); POSITION_SKILL_TEXT = new Vector3(0f, -28f, -0.03f); SCALE_CARD_ICON = new Vector3(0.4f, 0.4f, 1f); SCALE_NAME_TEXT = new Vector3(0.0024f, 0.0024f, 1f); SCALE_SKILL_TEXT = new Vector3(1.25f, 1.25f, 0f); IS_LOAD_ALLDONE = false; NormalFieldOfView = 60; WideFieldOfView = 70; GAME_FONT_NAME = "A-OTF-KaiminTuStd-Bold"; fontFileNames = new string[5] { "A-OTF-KaiminTuStd-Bold.otf", "TT0818M.TTF", "2002L.otf", "DFPT_W7_0.ttf", "DFGBWB7-900.ttf" }; PreLoadSkinId = new List { 3918, 3904 }; SeSysSummonLandingDuplicateCheckId = new List { 116024010, 130324010, 130514010 }; jpn_font = "A-OTF-KaiminTuStd-Bold"; LanguagePropList = new LanguageProps[8] { new LanguageProps(LANG_TYPE.Eng.ToString(), "English", "TT0818M", "English"), new LanguageProps(LANG_TYPE.Kor.ToString(), "Korean", "2002L", "한국어"), new LanguageProps(LANG_TYPE.Cht.ToString(), "ChineseTraditional", "DFPT_W7_0", "繁體中文"), new LanguageProps(LANG_TYPE.Fre.ToString(), "French", "TT0818M", "Français"), new LanguageProps(LANG_TYPE.Ita.ToString(), "Italian", "TT0818M", "Italiano"), new LanguageProps(LANG_TYPE.Ger.ToString(), "German", "TT0818M", "Deutsch"), new LanguageProps(LANG_TYPE.Spa.ToString(), "Spanish", "TT0818M", "Español"), new LanguageProps(LANG_TYPE.Chs.ToString(), "ChineseSimplified", "DFGBWB7-900", "简体中文") }; GAME_FONT = null; CARD_NAME_POS_SHORT = new Vector2(0f, 0f); CARD_NAME_POS_NORMAL = new Vector2(75f, 0f); CARD_NAME_POSTION_ADD = new Vector3(0f, 10f, 0f); CARD_NAME_POS_SHORT_2D = new Vector2(0f, 109f); CARD_NAME_POS_NORMAL_2D = new Vector2(10f, 109f); CARD_NAME_Z_ALPHABET_LANGUAGE = -0.1f; CARD_NAME_SIZE_ALPHABET_LANGUAGE = 32; WordBreakLanguages = new LANG_TYPE[6] { LANG_TYPE.Eng, LANG_TYPE.Fre, LANG_TYPE.Ita, LANG_TYPE.Ger, LANG_TYPE.Spa, LANG_TYPE.Kor }; AlphabetLanguages = new LANG_TYPE[5] { LANG_TYPE.Eng, LANG_TYPE.Fre, LANG_TYPE.Ita, LANG_TYPE.Ger, LANG_TYPE.Spa }; WordBreakLanguageNames = null; AlphabetLanguageNames = null; WordBreakLanguageNames = new string[WordBreakLanguages.Length]; for (int i = 0; i < WordBreakLanguageNames.Length; i++) { WordBreakLanguageNames[i] = WordBreakLanguages[i].ToString(); } AlphabetLanguageNames = new string[AlphabetLanguages.Length]; for (int j = 0; j < AlphabetLanguageNames.Length; j++) { AlphabetLanguageNames[j] = AlphabetLanguages[j].ToString(); } } public static string GetConvertWrapText(UILabel label, string orgText) { try { if (label.bitmapFont == null && label.trueTypeFont != GAME_FONT) { label.trueTypeFont = GAME_FONT; } SystemText systemText = Data.SystemText; string text = systemText.Get("System_LineHeadWrap", enableDebugReturn: false); string text2 = systemText.Get("System_LineEndWrap", enableDebugReturn: false); label.text = orgText; string text3 = orgText; if (!string.IsNullOrEmpty(text3)) { text3 = text3.Replace("\n", "\n\u200b"); } string final = ""; if (!label.Wrap(text3, out final)) { final = label.text; } if (final.Equals(text3)) { return final; } if (text == string.Empty && text2 == string.Empty) { return final; } string text4 = Regex.Escape(text); string text5 = Regex.Escape(text2); string pattern = "[" + text5 + "]+(\\[[a-z0-9\\/\\-]*\\])*$"; string pattern2 = "^(\\[[a-z0-9\\/\\-]*\\])*[" + text4 + "]"; string pattern3 = "[" + text5 + "]*.[" + text4 + "]*(\\[[a-z0-9\\/\\-]*\\])*$"; List list = new List(final.Split('\n')); string text6 = string.Empty; for (int i = 0; i < list.Count && i <= final.Length; i++) { string text7 = list[i]; string text8 = ((i + 1 < list.Count) ? list[i + 1] : string.Empty); Match match = Regex.Match(text7, pattern); if (match.Success && match.ToString() != text7) { string value = text7.Substring(match.Index, match.Length); if (text8 == string.Empty) { list.Add(text8 = ""); } text8 = text8.Insert(0, value); text7 = text7.Substring(0, match.Index); } if (text6 != string.Empty) { if (Regex.Match(text7, pattern2).Success) { Match match2 = Regex.Match(text6, pattern3); if (match2.Success && match2.Index > 0) { text7 = text7.Insert(0, text6.Substring(match2.Index, match2.Length)); text6 = text6.Substring(0, match2.Index); } } if (text7.Length > 1) { string text9 = text7.Replace('\u200b', '\n'); if (!label.Wrap(text9, out var final2)) { final2 = text9; } if (final2.Contains('\n')) { int num = final2.LastIndexOf('\n'); if (num > 0) { if (text8 == string.Empty) { list.Add(text8 = ""); } text8 = text8.Insert(0, final2.Substring(num + 1)); text7 = final2.Substring(0, num); } } } } if (text6 != string.Empty) { list[i - 1] = text6; } if (text8 != string.Empty) { list[i + 1] = text8; } text6 = (list[i] = text7); } string text11 = ""; int count = list.Count; for (int j = 0; j < count; j++) { text11 += list[j]; if (j < count - 1) { text11 += "\n"; } } return text11; } catch (Exception ex) { label.text = orgText; throw new Exception(ex.Message); } } public static int GetTextLineCount(string text) { int num = 1; for (int i = 0; i < text.Length; i++) { if (text[i] == '\n') { num++; } } return num; } public static string ConvertToWithoutBBCode(string text) { return Regex.Replace(text, "(\\[[a-z0-9\\/\\-]*(rub\\<[^\\>]*\\>)*\\])", ""); } public static void SetRepositionNameLabel(UILabel label, string orgText, bool is2D) { if (IsAlphabetLanguage()) { if (orgText.Length <= 11) { label.transform.localPosition = (is2D ? CARD_NAME_POS_SHORT_2D : CARD_NAME_POS_SHORT); } else { label.transform.localPosition = (is2D ? CARD_NAME_POS_NORMAL_2D : CARD_NAME_POS_NORMAL); } } else if (ConvertToWithoutBBCode(orgText).Length <= 5) { label.transform.localPosition = (is2D ? CARD_NAME_POS_SHORT_2D : CARD_NAME_POS_SHORT); } else { label.transform.localPosition = (is2D ? CARD_NAME_POS_NORMAL_2D : CARD_NAME_POS_NORMAL); } if (!is2D && IsAlphabetLanguage()) { Vector3 localPosition = label.transform.parent.localPosition; float num = CARD_NAME_Z_ALPHABET_LANGUAGE; if (label.transform.parent.localPosition.z > 0f) { num *= -1f; } localPosition.z = num; label.transform.localPosition += CARD_NAME_POSTION_ADD; label.transform.parent.localPosition = localPosition; label.fontSize = CARD_NAME_SIZE_ALPHABET_LANGUAGE; } } public static List GetParentList(Transform t, bool isOwnContains) { List list = new List(); if (isOwnContains) { list.Add(t.name); } Transform transform = null; Transform transform2 = t; while ((transform = transform2.parent) != null) { list.Insert(0, transform.name); transform2 = transform; } return list; } public static string GetParentListToString(Transform t, bool isOwnContains) { List parentList = GetParentList(t, isOwnContains); string text = string.Empty; for (int i = 0; i < parentList.Count; i++) { if (i != 0) { text += ":"; } text += parentList[i]; } return text; } public static bool IsAlphabetLanguage() { string textLanguage = CustomPreference.GetTextLanguage(); return AlphabetLanguageNames.Contains(textLanguage); } public static bool IsWordBreakLanguage() { string textLanguage = CustomPreference.GetTextLanguage(); return WordBreakLanguageNames.Contains(textLanguage); } public static LANG_TYPE CastToLangType(string type) { foreach (LANG_TYPE item in Enum.GetValues(typeof(LANG_TYPE)).Cast()) { if (type == item.ToString()) { return item; } } return LANG_TYPE.Max; } public static bool IsSupportedLanguageType(string langType) { for (int i = 0; i < LanguagePropList.Count(); i++) { if (LanguagePropList[i].LangType == langType) { return true; } } return false; } public static bool IsSupportedSystemLanguage(string sysLang) { for (int i = 0; i < LanguagePropList.Count(); i++) { if (LanguagePropList[i].Name == sysLang) { return true; } } return false; } public static string GetDisplayLanguage(string type) { for (int i = 0; i < LanguagePropList.Count(); i++) { if (LanguagePropList[i].LangType == type) { return LanguagePropList[i].DisplayName; } } return LanguagePropList[0].DisplayName; } public static string GetLanguageType(string sysLang) { for (int i = 0; i < LanguagePropList.Count(); i++) { if (LanguagePropList[i].Name == sysLang) { return LanguagePropList[i].LangType; } } return LanguagePropList[0].LangType; } public static string GetFontLangType(string type) { for (int i = 0; i < LanguagePropList.Count(); i++) { if (LanguagePropList[i].LangType == type) { return LanguagePropList[i].Font; } } return LanguagePropList[0].Font; } public static string GetSystemLanguage() { if (Application.systemLanguage == SystemLanguage.Chinese) { switch (GetUserDefaultLangID()) { case 2052: case 4100: return SystemLanguage.ChineseSimplified.ToString(); case 1028: case 3076: case 5124: return SystemLanguage.ChineseTraditional.ToString(); } } return Application.systemLanguage.ToString(); } }