This commit is contained in:
2025-06-13 20:14:28 +08:00
18 changed files with 561 additions and 221 deletions

View File

@@ -22,6 +22,16 @@ namespace FairyGUI
/// </summary> /// </summary>
public object data; public object data;
/// <summary>
/// 多语言key
/// </summary>
public string lang;
/// <summary>
/// 多语言参数
/// </summary>
public object[] langArgs;
/// <summary> /// <summary>
/// The source width of the object. /// The source width of the object.
/// </summary> /// </summary>
@@ -325,10 +335,7 @@ namespace FairyGUI
public float x public float x
{ {
get { return _x; } get { return _x; }
set set { SetPosition(value, _y, _z); }
{
SetPosition(value, _y, _z);
}
} }
/// <summary> /// <summary>
@@ -337,10 +344,7 @@ namespace FairyGUI
public float y public float y
{ {
get { return _y; } get { return _y; }
set set { SetPosition(_x, value, _z); }
{
SetPosition(_x, value, _z);
}
} }
/// <summary> /// <summary>
@@ -349,10 +353,7 @@ namespace FairyGUI
public float z public float z
{ {
get { return _z; } get { return _z; }
set set { SetPosition(_x, _y, value); }
{
SetPosition(_x, _y, value);
}
} }
/// <summary> /// <summary>
@@ -481,14 +482,8 @@ namespace FairyGUI
/// </summary> /// </summary>
public float width public float width
{ {
get get { return _width; }
{ set { SetSize(value, _rawHeight); }
return _width;
}
set
{
SetSize(value, _rawHeight);
}
} }
/// <summary> /// <summary>
@@ -496,14 +491,8 @@ namespace FairyGUI
/// </summary> /// </summary>
public float height public float height
{ {
get get { return _height; }
{ set { SetSize(_rawWidth, value); }
return _height;
}
set
{
SetSize(_rawWidth, value);
}
} }
/// <summary> /// <summary>
@@ -615,10 +604,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public float xMin public float xMin
{ {
get get { return _pivotAsAnchor ? (_x - _width * _pivotX) : _x; }
{
return _pivotAsAnchor ? (_x - _width * _pivotX) : _x;
}
set set
{ {
if (_pivotAsAnchor) if (_pivotAsAnchor)
@@ -633,10 +619,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public float yMin public float yMin
{ {
get get { return _pivotAsAnchor ? (_y - _height * _pivotY) : _y; }
{
return _pivotAsAnchor ? (_y - _height * _pivotY) : _y;
}
set set
{ {
if (_pivotAsAnchor) if (_pivotAsAnchor)
@@ -652,10 +635,7 @@ namespace FairyGUI
public float scaleX public float scaleX
{ {
get { return _scaleX; } get { return _scaleX; }
set set { SetScale(value, _scaleY); }
{
SetScale(value, _scaleY);
}
} }
/// <summary> /// <summary>
@@ -664,10 +644,7 @@ namespace FairyGUI
public float scaleY public float scaleY
{ {
get { return _scaleY; } get { return _scaleY; }
set set { SetScale(_scaleX, value); }
{
SetScale(_scaleX, value);
}
} }
/// <summary> /// <summary>
@@ -722,10 +699,7 @@ namespace FairyGUI
public float pivotX public float pivotX
{ {
get { return _pivotX; } get { return _pivotX; }
set set { SetPivot(value, _pivotY, _pivotAsAnchor); }
{
SetPivot(value, _pivotY, _pivotAsAnchor);
}
} }
/// <summary> /// <summary>
@@ -734,10 +708,7 @@ namespace FairyGUI
public float pivotY public float pivotY
{ {
get { return _pivotY; } get { return _pivotY; }
set set { SetPivot(_pivotX, value, _pivotAsAnchor); }
{
SetPivot(_pivotX, value, _pivotAsAnchor);
}
} }
/// <summary> /// <summary>
@@ -752,10 +723,7 @@ namespace FairyGUI
public bool pivotAsAnchor public bool pivotAsAnchor
{ {
get { return _pivotAsAnchor; } get { return _pivotAsAnchor; }
set set { SetPivot(_pivotX, _pivotY, value); }
{
SetPivot(_pivotX, _pivotY, value);
}
} }
/// <summary> /// <summary>
@@ -792,10 +760,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public bool touchable public bool touchable
{ {
get get { return _touchable; }
{
return _touchable;
}
set set
{ {
if (_touchable != value) if (_touchable != value)
@@ -814,10 +779,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public bool grayed public bool grayed
{ {
get get { return _grayed; }
{
return _grayed;
}
set set
{ {
if (_grayed != value) if (_grayed != value)
@@ -834,10 +796,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public bool enabled public bool enabled
{ {
get get { return !_grayed && _touchable; }
{
return !_grayed && _touchable;
}
set set
{ {
this.grayed = !value; this.grayed = !value;
@@ -850,10 +809,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public float rotation public float rotation
{ {
get get { return _rotation; }
{
return _rotation;
}
set set
{ {
_rotation = value; _rotation = value;
@@ -868,10 +824,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public float rotationX public float rotationX
{ {
get get { return _rotationX; }
{
return _rotationX;
}
set set
{ {
_rotationX = value; _rotationX = value;
@@ -885,10 +838,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public float rotationY public float rotationY
{ {
get get { return _rotationY; }
{
return _rotationY;
}
set set
{ {
_rotationY = value; _rotationY = value;
@@ -902,11 +852,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public float alpha public float alpha
{ {
get { return _alpha; }
get
{
return _alpha;
}
set set
{ {
@@ -921,10 +867,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public bool visible public bool visible
{ {
get get { return _visible; }
{
return _visible;
}
set set
{ {
@@ -942,26 +885,17 @@ namespace FairyGUI
internal bool internalVisible internal bool internalVisible
{ {
get get { return _internalVisible && (group == null || group.internalVisible); }
{
return _internalVisible && (group == null || group.internalVisible);
}
} }
internal bool internalVisible2 internal bool internalVisible2
{ {
get get { return _visible && (group == null || group.internalVisible2); }
{
return _visible && (group == null || group.internalVisible2);
}
} }
internal bool internalVisible3 internal bool internalVisible3
{ {
get get { return _visible && _internalVisible; }
{
return _visible && _internalVisible;
}
} }
/// <summary> /// <summary>
@@ -991,7 +925,10 @@ namespace FairyGUI
public bool focusable public bool focusable
{ {
get { return displayObject != null && displayObject.focusable; } get { return displayObject != null && displayObject.focusable; }
set { if (displayObject != null) displayObject.focusable = value; } set
{
if (displayObject != null) displayObject.focusable = value;
}
} }
/// <summary> /// <summary>
@@ -1000,7 +937,10 @@ namespace FairyGUI
public bool tabStop public bool tabStop
{ {
get { return displayObject != null && displayObject.tabStop; } get { return displayObject != null && displayObject.tabStop; }
set { if (displayObject != null) displayObject.tabStop = value; } set
{
if (displayObject != null) displayObject.tabStop = value;
}
} }
/// <summary> /// <summary>
@@ -1083,7 +1023,10 @@ namespace FairyGUI
virtual public IFilter filter virtual public IFilter filter
{ {
get { return displayObject != null ? displayObject.filter : null; } get { return displayObject != null ? displayObject.filter : null; }
set { if (displayObject != null) displayObject.filter = value; } set
{
if (displayObject != null) displayObject.filter = value;
}
} }
/// <summary> /// <summary>
@@ -1092,7 +1035,10 @@ namespace FairyGUI
virtual public BlendMode blendMode virtual public BlendMode blendMode
{ {
get { return displayObject != null ? displayObject.blendMode : BlendMode.None; } get { return displayObject != null ? displayObject.blendMode : BlendMode.None; }
set { if (displayObject != null) displayObject.blendMode = value; } set
{
if (displayObject != null) displayObject.blendMode = value;
}
} }
/// <summary> /// <summary>
@@ -1130,10 +1076,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public bool inContainer public bool inContainer
{ {
get get { return displayObject != null && displayObject.parent != null; }
{
return displayObject != null && displayObject.parent != null;
}
} }
/// <summary> /// <summary>
@@ -1141,10 +1084,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public bool onStage public bool onStage
{ {
get get { return displayObject != null && displayObject.stage != null; }
{
return displayObject != null && displayObject.stage != null;
}
} }
/// <summary> /// <summary>
@@ -1166,10 +1106,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public GearXY gearXY public GearXY gearXY
{ {
get get { return (GearXY)GetGear(1); }
{
return (GearXY)GetGear(1);
}
} }
/// <summary> /// <summary>
@@ -1177,10 +1114,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public GearSize gearSize public GearSize gearSize
{ {
get get { return (GearSize)GetGear(2); }
{
return (GearSize)GetGear(2);
}
} }
/// <summary> /// <summary>
@@ -1188,10 +1122,7 @@ namespace FairyGUI
/// </summary> /// </summary>
public GearLook gearLook public GearLook gearLook
{ {
get get { return (GearLook)GetGear(3); }
{
return (GearLook)GetGear(3);
}
} }
public GearBase GetGear(int index) public GearBase GetGear(int index)
@@ -1234,8 +1165,10 @@ namespace FairyGUI
default: default:
throw new System.Exception("FairyGUI: invalid gear index!"); throw new System.Exception("FairyGUI: invalid gear index!");
} }
_gears[index] = gear; _gears[index] = gear;
} }
return gear; return gear;
} }
@@ -1323,6 +1256,7 @@ namespace FairyGUI
if (gear != null && gear.controller == c) if (gear != null && gear.controller == c)
gear.Apply(); gear.Apply();
} }
_handlingController = false; _handlingController = false;
CheckGearDisplay(); CheckGearDisplay();
@@ -1421,7 +1355,10 @@ namespace FairyGUI
virtual public string text virtual public string text
{ {
get { return null; } get { return null; }
set { /*override in child*/} set
{
/*override in child*/
}
} }
/// <summary> /// <summary>
@@ -1430,7 +1367,10 @@ namespace FairyGUI
virtual public string icon virtual public string icon
{ {
get { return null; } get { return null; }
set { /*override in child*/} set
{
/*override in child*/
}
} }
/// <summary> /// <summary>
@@ -1505,6 +1445,7 @@ namespace FairyGUI
pt.x += _width * _pivotX; pt.x += _width * _pivotX;
pt.y += _height * _pivotY; pt.y += _height * _pivotY;
} }
return displayObject.LocalToGlobal(pt); return displayObject.LocalToGlobal(pt);
} }
@@ -1521,6 +1462,7 @@ namespace FairyGUI
pt.x -= _width * _pivotX; pt.x -= _width * _pivotX;
pt.y -= _height * _pivotY; pt.y -= _height * _pivotY;
} }
return pt; return pt;
} }
@@ -1594,6 +1536,7 @@ namespace FairyGUI
} }
else else
pt = r.LocalToGlobal(pt); pt = r.LocalToGlobal(pt);
return GlobalToLocal(pt); return GlobalToLocal(pt);
} }
@@ -1634,6 +1577,7 @@ namespace FairyGUI
pt.x += _width * _pivotX; pt.x += _width * _pivotX;
pt.y += _height * _pivotY; pt.y += _height * _pivotY;
} }
return this.displayObject.TransformPoint(pt, targetSpace != null ? targetSpace.displayObject : Stage.inst); return this.displayObject.TransformPoint(pt, targetSpace != null ? targetSpace.displayObject : Stage.inst);
} }
@@ -1650,6 +1594,7 @@ namespace FairyGUI
rect.x += _width * _pivotX; rect.x += _width * _pivotX;
rect.y += _height * _pivotY; rect.y += _height * _pivotY;
} }
return this.displayObject.TransformRect(rect, targetSpace != null ? targetSpace.displayObject : Stage.inst); return this.displayObject.TransformRect(rect, targetSpace != null ? targetSpace.displayObject : Stage.inst);
} }
@@ -1681,11 +1626,13 @@ namespace FairyGUI
if (gear != null) if (gear != null)
gear.Dispose(); gear.Dispose();
} }
if (displayObject != null) if (displayObject != null)
{ {
displayObject.gOwner = null; displayObject.gOwner = null;
displayObject.Dispose(); displayObject.Dispose();
} }
data = null; data = null;
} }
@@ -1853,6 +1800,7 @@ namespace FairyGUI
xv += _width * _pivotX; xv += _width * _pivotX;
yv += _height * _pivotY; yv += _height * _pivotY;
} }
displayObject.location = new Vector3(xv, yv, _z); displayObject.location = new Vector3(xv, yv, _z);
} }
} }
@@ -1999,6 +1947,7 @@ namespace FairyGUI
} }
#region Drag support #region Drag support
Vector2 _dragTouchStartPos; Vector2 _dragTouchStartPos;
bool _dragTesting; bool _dragTesting;
@@ -2135,9 +2084,11 @@ namespace FairyGUI
DispatchEvent("onDragEnd", null); DispatchEvent("onDragEnd", null);
} }
} }
#endregion #endregion
#region Tween Helpers #region Tween Helpers
public GTweener TweenMove(Vector2 endValue, float duration) public GTweener TweenMove(Vector2 endValue, float duration)
{ {
return GTween.To(this.xy, endValue, duration).SetTarget(this, TweenPropType.XY); 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); return GTween.To(_rotation, endValue, duration).SetTarget(this, TweenPropType.Rotation);
} }
#endregion #endregion
} }
} }

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a1729cbcb20e4c74f8072e75f4d9276b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,48 +1,382 @@
{ {
"language": [ "language": [
{ {
"key": "HOME_ICON_GROCERY", "key": "TEXT_EXIT",
"en": "Store", "zh-CN": "退出",
"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", "key": "Text_Settings",
"en": "Mission", "zh-CN": "设置",
"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", "key": "TEXT_Backpack",
"en": "Start", "zh-CN": "背包",
"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", "key": "TEXT_KEEPNET",
"en": "Clan", "zh-CN": "鱼护",
"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": [ "languageFont": [
{ {
"key": "AlibabaPuHuiTi-3-Bold", "key": "AlibabaPuHuiTi-3-Bold",
"en": "1,AlibabaPuHuiTi-3-Bold,AlibabaSansEN-Bold", "en": "1,AlibabaSansEN-Bold",
"zh-CN": "1,AlibabaPuHuiTi-3-Bold,AlibabaPuHuiTi-3-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", "key": "AlibabaPuHuiTi-3-Medium",
"en": "1,AlibabaPuHuiTi-3-Medium,AlibabaSansEN-Medium", "en": "1,AlibabaSansEN-Medium",
"zh-CN": "1,AlibabaPuHuiTi-3-Medium,AlibabaPuHuiTi-3-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", "key": "AlibabaPuHuiTi-3-Regular",
"en": "1,AlibabaPuHuiTi-3-Regular,AlibabaSansEN-Regular", "en": "1,AlibabaSansEN-Regular",
"zh-CN": "1,AlibabaPuHuiTi-3-Regular,AlibabaPuHuiTi-3-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": [ "languageImage": []
{
"key": "LoadingTitle",
"en": "en/login_logo_fengbao.png",
"zh-CN": "chs/login_logo.png"
}
]
} }

View File

@@ -7,6 +7,7 @@ namespace NBF
public class TabItemData public class TabItemData
{ {
public string Name; public string Name;
public string Key;
public string Icon; public string Icon;
} }

View File

@@ -15,28 +15,33 @@ namespace NBC
public const string LanguageSaveKey = "LanguageSaveKey"; public const string LanguageSaveKey = "LanguageSaveKey";
//简体中文、繁体中文、英语、日语、韩语、泰语、越南语、法语、德语、葡萄牙与、西班牙语、俄语、波兰语、荷兰语、 //简体中文、繁体中文、英语、日语、韩语、泰语、越南语、法语、德语、葡萄牙与、西班牙语、俄语、波兰语、荷兰语、
//土耳其语、意大利语、印度尼西亚语
//简体中文、繁体中文、英语、日语、德语、俄语、法语、西班牙语、韩语、葡萄牙
//土耳其语、意大利语、印度尼西亚语,阿拉伯语,泰语、越南语、波兰语、荷兰语
public static readonly List<LanguageInfo> LanguageList = new List<LanguageInfo>() public static readonly List<LanguageInfo> LanguageList = new List<LanguageInfo>()
{ {
new LanguageInfo() { Language = SystemLanguage.English, Name = "English", Code = "en" }, new LanguageInfo() { Language = SystemLanguage.English, Name = "English", Code = "en" },
new LanguageInfo() { Language = SystemLanguage.ChineseSimplified, Name = "简体中文", Code = "zh-CN" }, 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.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.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.Russian, Name = "Русский", Code = "ru" },
// new LanguageInfo() { Language = SystemLanguage.Spanish, Name = "Español", Code = "es" }, // new LanguageInfo() { Language = SystemLanguage.Spanish, Name = "Español", Code = "es" },
// new LanguageInfo() { Language = SystemLanguage.Portuguese, Name = "Português", Code = "pt" }, // new LanguageInfo() { Language = SystemLanguage.Portuguese, Name = "Português", Code = "pt" },
// new LanguageInfo() { Language = SystemLanguage.Polish, Name = "Polski", Code = "pl" }, // new LanguageInfo() { Language = SystemLanguage.Polish, Name = "Polski", Code = "pl" },
// new LanguageInfo() { Language = SystemLanguage.Dutch, Name = "Nederlands", Code = "nl" }, // new LanguageInfo() { Language = SystemLanguage.Dutch, Name = "Nederlands", Code = "nl" },
// new LanguageInfo() { Language = SystemLanguage.Turkish, Name = "Türkçe", Code = "tr" }, // 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.Indonesian, Name = "Bahasa Indonesia", Code = "id" },
// new LanguageInfo() { Language = SystemLanguage.Italian, Name = "Italiano", Code = "it" }
}; };
/// <summary> /// <summary>

View File

@@ -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; private static LanguageManager _inst;
@@ -19,18 +22,59 @@
public static ILanguage Text => Inst.GetLanguageModule((int)LanguageModuleType.Text); 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; if (Text == null) return;
return Text.Get(key); 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) public static string GetLanImagePath(string key)
{ {
return Inst.GetLanguageModule((int)LanguageModuleType.Image).Get(key); return Inst.GetLanguageModule((int)LanguageModuleType.Image).Get(key);

View File

@@ -39,7 +39,6 @@ namespace NBC
{ {
DynamicFont font = new DynamicFont(); DynamicFont font = new DynamicFont();
font.name = config.Name; font.name = config.Name;
var nmsl = Resources.Load<Font>(fontLocation + config.RelativePath);
font.nativeFont = Resources.Load<Font>(fontLocation + config.RelativePath); font.nativeFont = Resources.Load<Font>(fontLocation + config.RelativePath);
FontManager.RegisterFont(font); FontManager.RegisterFont(font);
} }

View File

@@ -157,8 +157,8 @@ namespace NBC
var result2 = new LanguageFontConfig() var result2 = new LanguageFontConfig()
{ {
Type = strs[0], Type = strs[0],
Name = strs[1], Name = key,
RelativePath = strs[2], RelativePath = strs[1],
}; };
dic[key] = result2; dic[key] = result2;
} }

View File

@@ -62,37 +62,41 @@ namespace NBC
if (componentLangeage.TryGetValue(id, out var key)) if (componentLangeage.TryGetValue(id, out var key))
{ {
if (child is GLoader gLoader) if (child is GLoader gLoader)
gLoader.icon = Lan.GetLanImagePath(key); {
gLoader.SetLanguageImage(key);
}
else else
SetChildLanguage(child, Lan.Get(key)); {
child.SetLanguage(key);
}
} }
} }
} }
} }
private void SetChildLanguage(object child, string value) // private void SetChildLanguage(object child, string value)
{ // {
if (child is TextField textField) // if (child is TextField textField)
{ // {
textField.text = value; // textField.text = value;
} // }
else if (child is GRichTextField richTextField) // else if (child is GRichTextField richTextField)
{ // {
richTextField.text = value; // richTextField.text = value;
} // }
else if (child is GButton button) // else if (child is GButton button)
{ // {
button.title = value; // button.title = value;
} // }
else if (child is GLabel label) // else if (child is GLabel label)
{ // {
label.title = value; // label.title = value;
} // }
else if (child is GTextField gtextField) // else if (child is GTextField gtextField)
{ // {
gtextField.text = value; // gtextField.text = value;
} // }
} // }
void SetComponentFont(GComponent component) void SetComponentFont(GComponent component)
{ {

View File

@@ -47,7 +47,15 @@ namespace NBF
{ {
var tabData = tabList[i]; var tabData = tabList[i];
var tabItem = List.AddItemFromPool().asButton; 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; listWidth += tabItem.width;
if (i > 0) if (i > 0)
{ {

View File

@@ -47,7 +47,7 @@ namespace NBF
{ {
var tabData = subItems[i]; var tabData = subItems[i];
var tabItem = List.AddItemFromPool().asButton; var tabItem = List.AddItemFromPool().asButton;
tabItem.title = Lan.Get(tabData.Name); tabItem.SetLanguage(tabData.Name);
width += tabItem.width; width += tabItem.width;
if (i > 0) if (i > 0)
{ {

View File

@@ -25,17 +25,17 @@ namespace NBF
{ {
if (string.IsNullOrEmpty(title)) if (string.IsNullOrEmpty(title))
{ {
title = Lan.Get("TEXT_NOTE"); title = "TEXT_NOTE";
} }
if (string.IsNullOrEmpty(confirm)) if (string.IsNullOrEmpty(confirm))
{ {
confirm = Lan.Get("TEXT_CONFIRM"); confirm = "TEXT_CONFIRM";
} }
if (string.IsNullOrEmpty(cancel)) if (string.IsNullOrEmpty(cancel))
{ {
cancel = Lan.Get("TEXT_CANCEL"); cancel = "TEXT_CANCEL";
} }
_confirmText = confirm; _confirmText = confirm;
@@ -59,10 +59,10 @@ namespace NBF
protected override void OnShow() protected override void OnShow()
{ {
TextTitle.text = _title; TextTitle.SetLanguage(_title);
BtnConfirm.title = _confirmText; BtnConfirm.SetLanguage(_confirmText);
BtnCancel.title = _cancelText; BtnCancel.SetLanguage(_cancelText);
TextContent.text = _content; TextContent.SetLanguage(_content);
MessageStyle.selectedIndex = _style; MessageStyle.selectedIndex = _style;
} }

View File

@@ -34,7 +34,7 @@ namespace NBF
Slider.wholeNumbers = true; Slider.wholeNumbers = true;
} }
TextName.text = Lan.Get(Option.Name); TextName.SetLanguage(Option.Name);
SetShow(); SetShow();
} }

View File

@@ -31,7 +31,8 @@ namespace NBF
{ {
var tab = new TabListData var tab = new TabListData
{ {
Name = group Name = group,
Key = $"TEXT_SETTINGS_{group}"
}; };
tabList.Add(tab); tabList.Add(tab);
} }
@@ -85,7 +86,7 @@ namespace NBF
var value = groupOptions[key]; var value = groupOptions[key];
if (List.AddItemFromPool(url) is GLabel label) if (List.AddItemFromPool(url) is GLabel label)
{ {
label.title = Lan.Get(key); label.SetLanguage(key);
} }
foreach (var option in value) foreach (var option in value)
@@ -199,8 +200,8 @@ namespace NBF
var settingItem = List.GetChildAt(index); var settingItem = List.GetChildAt(index);
if (settingItem is SettingItem item) if (settingItem is SettingItem item)
{ {
Introduce.TextName.text = Lan.Get(item.Option.Name); Introduce.TextName.SetLanguage(item.Option.Name);
Introduce.TextIntroduce.text = Lan.Get(item.Option.Name); Introduce.TextIntroduce.SetLanguage(item.Option.Name);
// Introduce. // Introduce.
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -130,7 +130,7 @@ QualitySettings:
globalTextureMipmapLimit: 0 globalTextureMipmapLimit: 0
textureMipmapLimitSettings: [] textureMipmapLimitSettings: []
anisotropicTextures: 2 anisotropicTextures: 2
antiAliasing: 8 antiAliasing: 2
softParticles: 0 softParticles: 0
softVegetation: 1 softVegetation: 1
realtimeReflectionProbes: 1 realtimeReflectionProbes: 1