diff --git a/Assets/Plugins/FairyGUI/Scripts/UI/GObject.cs b/Assets/Plugins/FairyGUI/Scripts/UI/GObject.cs index 288a8524c..1f8af9dba 100644 --- a/Assets/Plugins/FairyGUI/Scripts/UI/GObject.cs +++ b/Assets/Plugins/FairyGUI/Scripts/UI/GObject.cs @@ -22,6 +22,16 @@ namespace FairyGUI /// public object data; + /// + /// 多语言key + /// + public string lang; + + /// + /// 多语言参数 + /// + public object[] langArgs; + /// /// The source width of the object. /// @@ -325,10 +335,7 @@ namespace FairyGUI public float x { get { return _x; } - set - { - SetPosition(value, _y, _z); - } + set { SetPosition(value, _y, _z); } } /// @@ -337,10 +344,7 @@ namespace FairyGUI public float y { get { return _y; } - set - { - SetPosition(_x, value, _z); - } + set { SetPosition(_x, value, _z); } } /// @@ -349,10 +353,7 @@ namespace FairyGUI public float z { get { return _z; } - set - { - SetPosition(_x, _y, value); - } + set { SetPosition(_x, _y, value); } } /// @@ -481,14 +482,8 @@ namespace FairyGUI /// public float width { - get - { - return _width; - } - set - { - SetSize(value, _rawHeight); - } + get { return _width; } + set { SetSize(value, _rawHeight); } } /// @@ -496,14 +491,8 @@ namespace FairyGUI /// public float height { - get - { - return _height; - } - set - { - SetSize(_rawWidth, value); - } + get { return _height; } + set { SetSize(_rawWidth, value); } } /// @@ -615,10 +604,7 @@ namespace FairyGUI /// public float xMin { - get - { - return _pivotAsAnchor ? (_x - _width * _pivotX) : _x; - } + get { return _pivotAsAnchor ? (_x - _width * _pivotX) : _x; } set { if (_pivotAsAnchor) @@ -633,10 +619,7 @@ namespace FairyGUI /// public float yMin { - get - { - return _pivotAsAnchor ? (_y - _height * _pivotY) : _y; - } + get { return _pivotAsAnchor ? (_y - _height * _pivotY) : _y; } set { if (_pivotAsAnchor) @@ -652,10 +635,7 @@ namespace FairyGUI public float scaleX { get { return _scaleX; } - set - { - SetScale(value, _scaleY); - } + set { SetScale(value, _scaleY); } } /// @@ -664,10 +644,7 @@ namespace FairyGUI public float scaleY { get { return _scaleY; } - set - { - SetScale(_scaleX, value); - } + set { SetScale(_scaleX, value); } } /// @@ -722,10 +699,7 @@ namespace FairyGUI public float pivotX { get { return _pivotX; } - set - { - SetPivot(value, _pivotY, _pivotAsAnchor); - } + set { SetPivot(value, _pivotY, _pivotAsAnchor); } } /// @@ -734,10 +708,7 @@ namespace FairyGUI public float pivotY { get { return _pivotY; } - set - { - SetPivot(_pivotX, value, _pivotAsAnchor); - } + set { SetPivot(_pivotX, value, _pivotAsAnchor); } } /// @@ -752,10 +723,7 @@ namespace FairyGUI public bool pivotAsAnchor { get { return _pivotAsAnchor; } - set - { - SetPivot(_pivotX, _pivotY, value); - } + set { SetPivot(_pivotX, _pivotY, value); } } /// @@ -792,10 +760,7 @@ namespace FairyGUI /// public bool touchable { - get - { - return _touchable; - } + get { return _touchable; } set { if (_touchable != value) @@ -814,10 +779,7 @@ namespace FairyGUI /// public bool grayed { - get - { - return _grayed; - } + get { return _grayed; } set { if (_grayed != value) @@ -834,10 +796,7 @@ namespace FairyGUI /// public bool enabled { - get - { - return !_grayed && _touchable; - } + get { return !_grayed && _touchable; } set { this.grayed = !value; @@ -850,10 +809,7 @@ namespace FairyGUI /// public float rotation { - get - { - return _rotation; - } + get { return _rotation; } set { _rotation = value; @@ -868,10 +824,7 @@ namespace FairyGUI /// public float rotationX { - get - { - return _rotationX; - } + get { return _rotationX; } set { _rotationX = value; @@ -885,10 +838,7 @@ namespace FairyGUI /// public float rotationY { - get - { - return _rotationY; - } + get { return _rotationY; } set { _rotationY = value; @@ -902,11 +852,7 @@ namespace FairyGUI /// public float alpha { - - get - { - return _alpha; - } + get { return _alpha; } set { @@ -921,10 +867,7 @@ namespace FairyGUI /// public bool visible { - get - { - return _visible; - } + get { return _visible; } set { @@ -942,26 +885,17 @@ namespace FairyGUI internal bool internalVisible { - get - { - return _internalVisible && (group == null || group.internalVisible); - } + get { return _internalVisible && (group == null || group.internalVisible); } } internal bool internalVisible2 { - get - { - return _visible && (group == null || group.internalVisible2); - } + get { return _visible && (group == null || group.internalVisible2); } } internal bool internalVisible3 { - get - { - return _visible && _internalVisible; - } + get { return _visible && _internalVisible; } } /// @@ -991,7 +925,10 @@ namespace FairyGUI public bool focusable { get { return displayObject != null && displayObject.focusable; } - set { if (displayObject != null) displayObject.focusable = value; } + set + { + if (displayObject != null) displayObject.focusable = value; + } } /// @@ -1000,7 +937,10 @@ namespace FairyGUI public bool tabStop { get { return displayObject != null && displayObject.tabStop; } - set { if (displayObject != null) displayObject.tabStop = value; } + set + { + if (displayObject != null) displayObject.tabStop = value; + } } /// @@ -1083,7 +1023,10 @@ namespace FairyGUI virtual public IFilter filter { get { return displayObject != null ? displayObject.filter : null; } - set { if (displayObject != null) displayObject.filter = value; } + set + { + if (displayObject != null) displayObject.filter = value; + } } /// @@ -1092,7 +1035,10 @@ namespace FairyGUI virtual public BlendMode blendMode { get { return displayObject != null ? displayObject.blendMode : BlendMode.None; } - set { if (displayObject != null) displayObject.blendMode = value; } + set + { + if (displayObject != null) displayObject.blendMode = value; + } } /// @@ -1130,10 +1076,7 @@ namespace FairyGUI /// public bool inContainer { - get - { - return displayObject != null && displayObject.parent != null; - } + get { return displayObject != null && displayObject.parent != null; } } /// @@ -1141,10 +1084,7 @@ namespace FairyGUI /// public bool onStage { - get - { - return displayObject != null && displayObject.stage != null; - } + get { return displayObject != null && displayObject.stage != null; } } /// @@ -1166,10 +1106,7 @@ namespace FairyGUI /// public GearXY gearXY { - get - { - return (GearXY)GetGear(1); - } + get { return (GearXY)GetGear(1); } } /// @@ -1177,10 +1114,7 @@ namespace FairyGUI /// public GearSize gearSize { - get - { - return (GearSize)GetGear(2); - } + get { return (GearSize)GetGear(2); } } /// @@ -1188,10 +1122,7 @@ namespace FairyGUI /// public GearLook gearLook { - get - { - return (GearLook)GetGear(3); - } + get { return (GearLook)GetGear(3); } } public GearBase GetGear(int index) @@ -1234,8 +1165,10 @@ namespace FairyGUI default: throw new System.Exception("FairyGUI: invalid gear index!"); } + _gears[index] = gear; } + return gear; } @@ -1323,6 +1256,7 @@ namespace FairyGUI if (gear != null && gear.controller == c) gear.Apply(); } + _handlingController = false; CheckGearDisplay(); @@ -1421,7 +1355,10 @@ namespace FairyGUI virtual public string text { get { return null; } - set { /*override in child*/} + set + { + /*override in child*/ + } } /// @@ -1430,7 +1367,10 @@ namespace FairyGUI virtual public string icon { get { return null; } - set { /*override in child*/} + set + { + /*override in child*/ + } } /// @@ -1505,6 +1445,7 @@ namespace FairyGUI pt.x += _width * _pivotX; pt.y += _height * _pivotY; } + return displayObject.LocalToGlobal(pt); } @@ -1521,6 +1462,7 @@ namespace FairyGUI pt.x -= _width * _pivotX; pt.y -= _height * _pivotY; } + return pt; } @@ -1594,6 +1536,7 @@ namespace FairyGUI } else pt = r.LocalToGlobal(pt); + return GlobalToLocal(pt); } @@ -1634,6 +1577,7 @@ namespace FairyGUI pt.x += _width * _pivotX; pt.y += _height * _pivotY; } + return this.displayObject.TransformPoint(pt, targetSpace != null ? targetSpace.displayObject : Stage.inst); } @@ -1650,6 +1594,7 @@ namespace FairyGUI rect.x += _width * _pivotX; rect.y += _height * _pivotY; } + return this.displayObject.TransformRect(rect, targetSpace != null ? targetSpace.displayObject : Stage.inst); } @@ -1681,11 +1626,13 @@ namespace FairyGUI if (gear != null) gear.Dispose(); } + if (displayObject != null) { displayObject.gOwner = null; displayObject.Dispose(); } + data = null; } @@ -1853,6 +1800,7 @@ namespace FairyGUI xv += _width * _pivotX; yv += _height * _pivotY; } + displayObject.location = new Vector3(xv, yv, _z); } } @@ -1999,6 +1947,7 @@ namespace FairyGUI } #region Drag support + Vector2 _dragTouchStartPos; bool _dragTesting; @@ -2135,9 +2084,11 @@ namespace FairyGUI DispatchEvent("onDragEnd", null); } } + #endregion #region Tween Helpers + public GTweener TweenMove(Vector2 endValue, float duration) { return GTween.To(this.xy, endValue, duration).SetTarget(this, TweenPropType.XY); @@ -2182,6 +2133,7 @@ namespace FairyGUI { return GTween.To(_rotation, endValue, duration).SetTarget(this, TweenPropType.Rotation); } + #endregion } -} +} \ No newline at end of file diff --git a/Assets/Resources/Fonts/chs.meta b/Assets/Resources/Fonts/chs.meta deleted file mode 100644 index e34bc69f5..000000000 --- a/Assets/Resources/Fonts/chs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a1729cbcb20e4c74f8072e75f4d9276b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Resources/config/language.json b/Assets/Resources/config/language.json index 81dbc2e52..32f5858f8 100644 --- a/Assets/Resources/config/language.json +++ b/Assets/Resources/config/language.json @@ -1,48 +1,382 @@ { "language": [ { - "key": "HOME_ICON_GROCERY", - "en": "Store", - "zh-CN": "杂货店" + "key": "TEXT_EXIT", + "zh-CN": "退出", + "zh-TW": "退出", + "en": "Exit", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" }, { - "key": "HOME_ICON_QUEST", - "en": "Mission", - "zh-CN": "任务" + "key": "Text_Settings", + "zh-CN": "设置", + "zh-TW": "设置", + "en": "Settings", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" }, { - "key": "HOME_BUTTON_START", - "en": "Start", - "zh-CN": "开始旅程" + "key": "TEXT_Backpack", + "zh-CN": "背包", + "zh-TW": "背包", + "en": "Backpack", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" }, { - "key": "HOME_PAGE_ALLIANCE", - "en": "Clan", - "zh-CN": "公会" + "key": "TEXT_KEEPNET", + "zh-CN": "鱼护", + "zh-TW": "魚護", + "en": "Keepnet", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "Text_MAP", + "zh-CN": "地图", + "zh-TW": "地圖", + "en": "Maps", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "Text_Make", + "zh-CN": "制作", + "zh-TW": "製作", + "en": "Make", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_SUPPORT", + "zh-CN": "帮助", + "zh-TW": "幫助", + "en": "Support", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_CONFIRM", + "zh-CN": "确认", + "zh-TW": "確認", + "en": "Confirm", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_CANCEL", + "zh-CN": "取消", + "zh-TW": "取消", + "en": "Cancel", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_COMPLETED", + "zh-CN": "已完成", + "zh-TW": "已完成", + "en": "Completed", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_CONTINUE", + "zh-CN": "继续", + "zh-TW": "繼續", + "en": "Continue", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_NOTE", + "zh-CN": "提示", + "zh-TW": "提示", + "en": "Note", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_SETTINGS_Graphic", + "zh-CN": "图形", + "zh-TW": "圖形", + "en": "Graphics", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_SETTINGS_SoundAndLanguage", + "zh-CN": "声音&语言", + "zh-TW": "聲音&語言", + "en": "Sound & Language", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_SETTINGS_Keyboard", + "zh-CN": "键盘", + "zh-TW": "鍵盤", + "en": "Keyboard", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" + }, + { + "key": "TEXT_SETTINGS_Controller", + "zh-CN": "手柄", + "zh-TW": "手柄", + "en": "Controller", + "ja": "", + "ko": "", + "fr": "", + "de": "", + "ru": "", + "es": "", + "pt": "", + "pl": "", + "nl": "", + "tr": "", + "id": "", + "it": "", + "ar": "", + "vi": "", + "th": "" } ], "languageFont": [ { "key": "AlibabaPuHuiTi-3-Bold", - "en": "1,AlibabaPuHuiTi-3-Bold,AlibabaSansEN-Bold", - "zh-CN": "1,AlibabaPuHuiTi-3-Bold,AlibabaPuHuiTi-3-Bold" + "en": "1,AlibabaSansEN-Bold", + "zh-CN": "1,AlibabaPuHuiTi-3-Bold", + "zh-TW": "1,AlibabaSansTC-Bold", + "ja": "1,AlibabaSansJP-Bold", + "ko": "1,AlibabaSansKR-Bold", + "fr": "1,AlibabaSansEN-Bold", + "de": "1,AlibabaSansEN-Bold", + "ru": "1,AlibabaSansEN-Bold", + "es": "1,AlibabaSansEN-Bold", + "pt": "1,AlibabaSansEN-Bold" }, { "key": "AlibabaPuHuiTi-3-Medium", - "en": "1,AlibabaPuHuiTi-3-Medium,AlibabaSansEN-Medium", - "zh-CN": "1,AlibabaPuHuiTi-3-Medium,AlibabaPuHuiTi-3-Medium" + "en": "1,AlibabaSansEN-Medium", + "zh-CN": "1,AlibabaPuHuiTi-3-Medium", + "zh-TW": "1,AlibabaSansTC-Medium", + "ja": "1,AlibabaSansJP-Medium", + "ko": "1,AlibabaSansKR-Medium", + "fr": "1,AlibabaSansEN-Medium", + "de": "1,AlibabaSansEN-Medium", + "ru": "1,AlibabaSansEN-Medium", + "es": "1,AlibabaSansEN-Medium", + "pt": "1,AlibabaSansEN-Medium" }, { "key": "AlibabaPuHuiTi-3-Regular", - "en": "1,AlibabaPuHuiTi-3-Regular,AlibabaSansEN-Regular", - "zh-CN": "1,AlibabaPuHuiTi-3-Regular,AlibabaPuHuiTi-3-Regular" + "en": "1,AlibabaSansEN-Regular", + "zh-CN": "1,AlibabaPuHuiTi-3-Regular", + "zh-TW": "1,AlibabaSansTC-Regular", + "ja": "1,AlibabaSansJP-Regular", + "ko": "1,AlibabaSansKR-Regular", + "fr": "1,AlibabaSansEN-Regular", + "de": "1,AlibabaSansEN-Regular", + "ru": "1,AlibabaSansEN-Regular", + "es": "1,AlibabaSansEN-Regular", + "pt": "1,AlibabaSansEN-Regular" } ], - "languageImage": [ - { - "key": "LoadingTitle", - "en": "en/login_logo_fengbao.png", - "zh-CN": "chs/login_logo.png" - } - ] + "languageImage": [] } \ No newline at end of file diff --git a/Assets/Scripts/Data/TabListData.cs b/Assets/Scripts/Data/TabListData.cs index ca2112fdd..816a75bcf 100644 --- a/Assets/Scripts/Data/TabListData.cs +++ b/Assets/Scripts/Data/TabListData.cs @@ -7,6 +7,7 @@ namespace NBF public class TabItemData { public string Name; + public string Key; public string Icon; } diff --git a/Assets/Scripts/NBC/Language/Runtime/Const/LanguageConst.cs b/Assets/Scripts/NBC/Language/Runtime/Const/LanguageConst.cs index d10611217..ce799b8dc 100644 --- a/Assets/Scripts/NBC/Language/Runtime/Const/LanguageConst.cs +++ b/Assets/Scripts/NBC/Language/Runtime/Const/LanguageConst.cs @@ -15,28 +15,33 @@ namespace NBC public const string LanguageSaveKey = "LanguageSaveKey"; //简体中文、繁体中文、英语、日语、韩语、泰语、越南语、法语、德语、葡萄牙与、西班牙语、俄语、波兰语、荷兰语、 - - //土耳其语、意大利语、印度尼西亚语 - + + + //简体中文、繁体中文、英语、日语、德语、俄语、法语、西班牙语、韩语、葡萄牙 + + //土耳其语、意大利语、印度尼西亚语,阿拉伯语,泰语、越南语、波兰语、荷兰语 + public static readonly List LanguageList = new List() { new LanguageInfo() { Language = SystemLanguage.English, Name = "English", Code = "en" }, new LanguageInfo() { Language = SystemLanguage.ChineseSimplified, Name = "简体中文", Code = "zh-CN" }, - // new LanguageInfo() { Language = SystemLanguage.ChineseTraditional, Name = "繁體中文", Code = "zh-TW" }, + new LanguageInfo() { Language = SystemLanguage.ChineseTraditional, Name = "繁體中文", Code = "zh-TW" }, // new LanguageInfo() { Language = SystemLanguage.Japanese, Name = "日本語", Code = "ja" }, - // new LanguageInfo() { Language = SystemLanguage.Korean, Name = "한국어", Code = "ko" }, - // new LanguageInfo() { Language = SystemLanguage.Thai, Name = "ไทย", Code = "th" }, - // new LanguageInfo() { Language = SystemLanguage.Vietnamese, Name = "Tiếng Việt", Code = "vi" }, - // new LanguageInfo() { Language = SystemLanguage.German, Name = "Deutsch", Code = "de" }, // new LanguageInfo() { Language = SystemLanguage.French, Name = "Français", Code = "fr" }, + // new LanguageInfo() { Language = SystemLanguage.German, Name = "Deutsch", Code = "de" }, + // new LanguageInfo() { Language = SystemLanguage.Korean, Name = "한국어", Code = "ko" }, // new LanguageInfo() { Language = SystemLanguage.Russian, Name = "Русский", Code = "ru" }, // new LanguageInfo() { Language = SystemLanguage.Spanish, Name = "Español", Code = "es" }, // new LanguageInfo() { Language = SystemLanguage.Portuguese, Name = "Português", Code = "pt" }, + // new LanguageInfo() { Language = SystemLanguage.Polish, Name = "Polski", Code = "pl" }, // new LanguageInfo() { Language = SystemLanguage.Dutch, Name = "Nederlands", Code = "nl" }, // new LanguageInfo() { Language = SystemLanguage.Turkish, Name = "Türkçe", Code = "tr" }, + // new LanguageInfo() { Language = SystemLanguage.Italian, Name = "Italiano", Code = "it" }, + // new LanguageInfo() { Language = SystemLanguage.Arabic, Name = "العربية", Code = "ar" } + // new LanguageInfo() { Language = SystemLanguage.Vietnamese, Name = "Tiếng Việt", Code = "vi" }, + // new LanguageInfo() { Language = SystemLanguage.Thai, Name = "ไทย", Code = "th" }, // new LanguageInfo() { Language = SystemLanguage.Indonesian, Name = "Bahasa Indonesia", Code = "id" }, - // new LanguageInfo() { Language = SystemLanguage.Italian, Name = "Italiano", Code = "it" } }; /// diff --git a/Assets/Scripts/NBC/Language/Runtime/Lan.cs b/Assets/Scripts/NBC/Language/Runtime/Lan.cs index 80b8fdbb6..6845050a4 100644 --- a/Assets/Scripts/NBC/Language/Runtime/Lan.cs +++ b/Assets/Scripts/NBC/Language/Runtime/Lan.cs @@ -1,6 +1,9 @@ -namespace NBC +using System.Collections.Generic; +using FairyGUI; + +namespace NBC { - public class Lan + public static class Lan { private static LanguageManager _inst; @@ -19,18 +22,59 @@ public static ILanguage Text => Inst.GetLanguageModule((int)LanguageModuleType.Text); - public static string Get(string key) + public static void SetLanguage(this GObject child, string key, params object[] args) { - if(Text == null) return key; - return Text.Get(key); + if (Text == null) return; + child.lang = key; + + var value = Text.Get(key); + + if (args != null && args.Length > 0) + { + value = string.Format(value, args); + child.langArgs = args; + } + else + { + child.langArgs = null; + } + + + if (child is GRichTextField richTextField) + { + richTextField.text = value; + } + else if (child is GButton button) + { + button.title = value; + } + else if (child is GLabel label) + { + label.title = value; + } + else if (child is GTextField gtextField) + { + gtextField.text = value; + } } - public static string Get(string key, params object[] args) + public static void SetLanguageImage(this GObject obj, string key) { - var format = string.Format(Text.Get(key), args); - return format; } + // public static string Get(string key) + // { + // if(Text == null) return key; + // return Text.Get(key); + // } + // + // public static string Get(string key, params object[] args) + // { + // var format = string.Format(Text.Get(key), args); + // return format; + // } + + public static string GetLanImagePath(string key) { return Inst.GetLanguageModule((int)LanguageModuleType.Image).Get(key); diff --git a/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs b/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs index 4ca8cf205..8cf5e579a 100644 --- a/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs +++ b/Assets/Scripts/NBC/Language/Runtime/LanguageConcrete/LanguageFont.cs @@ -39,7 +39,6 @@ namespace NBC { DynamicFont font = new DynamicFont(); font.name = config.Name; - var nmsl = Resources.Load(fontLocation + config.RelativePath); font.nativeFont = Resources.Load(fontLocation + config.RelativePath); FontManager.RegisterFont(font); } diff --git a/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs b/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs index 81d46cb78..f0cdc028a 100644 --- a/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs +++ b/Assets/Scripts/NBC/Language/Runtime/LanguageManager.cs @@ -157,8 +157,8 @@ namespace NBC var result2 = new LanguageFontConfig() { Type = strs[0], - Name = strs[1], - RelativePath = strs[2], + Name = key, + RelativePath = strs[1], }; dic[key] = result2; } diff --git a/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs b/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs index 30b385f8c..fe1cf9d9a 100644 --- a/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs +++ b/Assets/Scripts/NBC/UI/Runtime/UILanguage/UIComponentLanguagePack.cs @@ -62,37 +62,41 @@ namespace NBC if (componentLangeage.TryGetValue(id, out var key)) { if (child is GLoader gLoader) - gLoader.icon = Lan.GetLanImagePath(key); + { + gLoader.SetLanguageImage(key); + } else - SetChildLanguage(child, Lan.Get(key)); + { + child.SetLanguage(key); + } } } } } - private void SetChildLanguage(object child, string value) - { - if (child is TextField textField) - { - textField.text = value; - } - else if (child is GRichTextField richTextField) - { - richTextField.text = value; - } - else if (child is GButton button) - { - button.title = value; - } - else if (child is GLabel label) - { - label.title = value; - } - else if (child is GTextField gtextField) - { - gtextField.text = value; - } - } + // private void SetChildLanguage(object child, string value) + // { + // if (child is TextField textField) + // { + // textField.text = value; + // } + // else if (child is GRichTextField richTextField) + // { + // richTextField.text = value; + // } + // else if (child is GButton button) + // { + // button.title = value; + // } + // else if (child is GLabel label) + // { + // label.title = value; + // } + // else if (child is GTextField gtextField) + // { + // gtextField.text = value; + // } + // } void SetComponentFont(GComponent component) { diff --git a/Assets/Scripts/UI/Common/Menu/CommonMenu.cs b/Assets/Scripts/UI/Common/Menu/CommonMenu.cs index 88803b0f9..7a409a937 100644 --- a/Assets/Scripts/UI/Common/Menu/CommonMenu.cs +++ b/Assets/Scripts/UI/Common/Menu/CommonMenu.cs @@ -47,7 +47,15 @@ namespace NBF { var tabData = tabList[i]; var tabItem = List.AddItemFromPool().asButton; - tabItem.title = Lan.Get(tabData.Name); + if (!string.IsNullOrEmpty(tabData.Key)) + { + tabItem.SetLanguage(tabData.Key); + } + else + { + tabItem.SetLanguage(tabData.Name); + } + listWidth += tabItem.width; if (i > 0) { diff --git a/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs index 11c20f2ef..f946d4dc5 100644 --- a/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs +++ b/Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs @@ -47,7 +47,7 @@ namespace NBF { var tabData = subItems[i]; var tabItem = List.AddItemFromPool().asButton; - tabItem.title = Lan.Get(tabData.Name); + tabItem.SetLanguage(tabData.Name); width += tabItem.width; if (i > 0) { diff --git a/Assets/Scripts/UI/Common/Panel/MessageBox.cs b/Assets/Scripts/UI/Common/Panel/MessageBox.cs index f94cb3591..54610f47a 100644 --- a/Assets/Scripts/UI/Common/Panel/MessageBox.cs +++ b/Assets/Scripts/UI/Common/Panel/MessageBox.cs @@ -25,17 +25,17 @@ namespace NBF { if (string.IsNullOrEmpty(title)) { - title = Lan.Get("TEXT_NOTE"); + title = "TEXT_NOTE"; } if (string.IsNullOrEmpty(confirm)) { - confirm = Lan.Get("TEXT_CONFIRM"); + confirm = "TEXT_CONFIRM"; } if (string.IsNullOrEmpty(cancel)) { - cancel = Lan.Get("TEXT_CANCEL"); + cancel = "TEXT_CANCEL"; } _confirmText = confirm; @@ -59,10 +59,10 @@ namespace NBF protected override void OnShow() { - TextTitle.text = _title; - BtnConfirm.title = _confirmText; - BtnCancel.title = _cancelText; - TextContent.text = _content; + TextTitle.SetLanguage(_title); + BtnConfirm.SetLanguage(_confirmText); + BtnCancel.SetLanguage(_cancelText); + TextContent.SetLanguage(_content); MessageStyle.selectedIndex = _style; } diff --git a/Assets/Scripts/UI/Settings/SettingItem.cs b/Assets/Scripts/UI/Settings/SettingItem.cs index 041355010..7f949b073 100644 --- a/Assets/Scripts/UI/Settings/SettingItem.cs +++ b/Assets/Scripts/UI/Settings/SettingItem.cs @@ -34,7 +34,7 @@ namespace NBF Slider.wholeNumbers = true; } - TextName.text = Lan.Get(Option.Name); + TextName.SetLanguage(Option.Name); SetShow(); } diff --git a/Assets/Scripts/UI/Settings/SettingPanel.cs b/Assets/Scripts/UI/Settings/SettingPanel.cs index 41e412241..aa34428c7 100644 --- a/Assets/Scripts/UI/Settings/SettingPanel.cs +++ b/Assets/Scripts/UI/Settings/SettingPanel.cs @@ -31,7 +31,8 @@ namespace NBF { var tab = new TabListData { - Name = group + Name = group, + Key = $"TEXT_SETTINGS_{group}" }; tabList.Add(tab); } @@ -85,7 +86,7 @@ namespace NBF var value = groupOptions[key]; if (List.AddItemFromPool(url) is GLabel label) { - label.title = Lan.Get(key); + label.SetLanguage(key); } foreach (var option in value) @@ -199,8 +200,8 @@ namespace NBF var settingItem = List.GetChildAt(index); if (settingItem is SettingItem item) { - Introduce.TextName.text = Lan.Get(item.Option.Name); - Introduce.TextIntroduce.text = Lan.Get(item.Option.Name); + Introduce.TextName.SetLanguage(item.Option.Name); + Introduce.TextIntroduce.SetLanguage(item.Option.Name); // Introduce. } } diff --git a/Config/language/Language.xlsx b/Config/language/Language.xlsx index 58b327008..9051766c8 100644 Binary files a/Config/language/Language.xlsx and b/Config/language/Language.xlsx differ diff --git a/Config/language/LanguageFont.xlsx b/Config/language/LanguageFont.xlsx index 6592ca8c3..b5d1e455a 100644 Binary files a/Config/language/LanguageFont.xlsx and b/Config/language/LanguageFont.xlsx differ diff --git a/Config/language/LanguageImage.xlsx b/Config/language/LanguageImage.xlsx index 273f61ccc..00f0a6af6 100644 Binary files a/Config/language/LanguageImage.xlsx and b/Config/language/LanguageImage.xlsx differ diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset index ec06e9532..26993cad6 100644 --- a/ProjectSettings/QualitySettings.asset +++ b/ProjectSettings/QualitySettings.asset @@ -130,7 +130,7 @@ QualitySettings: globalTextureMipmapLimit: 0 textureMipmapLimitSettings: [] anisotropicTextures: 2 - antiAliasing: 8 + antiAliasing: 2 softParticles: 0 softVegetation: 1 realtimeReflectionProbes: 1