多语言迭代

This commit is contained in:
kawagiri 2026-01-28 18:23:01 +08:00
parent 4a6e11e106
commit b298cd74ed
10 changed files with 128 additions and 501 deletions

View File

@ -480,7 +480,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -644,7 +644,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -808,7 +808,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -875,7 +875,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 1359
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -1136,7 +1136,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 280
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -1644,7 +1644,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -1810,7 +1810,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 884
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -2180,7 +2180,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 558
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -2247,7 +2247,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 282
FontID: 2
FontID: 0
TextCfg:
- Type: 0
FontSize: 60
@ -2765,7 +2765,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -3012,7 +3012,7 @@ MonoBehaviour:
m_Calls: []
m_text: "\u8FD9\u91CC\u662F\u63D0\u793A\u6587\u5B57\n\u63D0\u793A\u73A9\u5BB6\u5E94\u8BE5\u600E\u4E48\u64CD\u4F5C\n\u8FD9\u91CC\u662F\u63D0\u793A\u6587\u5B57\n\u63D0\u793A\u73A9\u5BB6\u5E94\u8BE5\u600E\u4E48\u64CD\u4F5C\n\u8FD9\u91CC\u662F\u63D0\u793A\u6587\u5B57\n\u63D0\u793A\u73A9\u5BB6\u5E94\u8BE5\u600E\u4E48\u64CD\u4F5C"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: f74d73acde897024090a352531df919f, type: 2}
m_fontAsset: {fileID: 11400000, guid: 8e119f168f1a6b745be02ef19f51610f, type: 2}
m_sharedMaterial: {fileID: -5194638153132371293, guid: f74d73acde897024090a352531df919f, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
@ -3076,7 +3076,7 @@ MonoBehaviour:
m_margin: {x: -2.6958923, y: -0.89852893, z: 0, w: -1.5570221}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_hasFontAssetChanged: 1
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &312323613
@ -3102,7 +3102,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 1541
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 30
@ -3286,7 +3286,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 559
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -3625,7 +3625,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 554
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -4019,7 +4019,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 283
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 45
@ -4214,7 +4214,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 555
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -4475,7 +4475,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -4735,7 +4735,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 879
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -5036,7 +5036,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 355
FontID: 2
FontID: 0
TextCfg:
- Type: 0
FontSize: 60
@ -5297,7 +5297,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -5364,7 +5364,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -5919,7 +5919,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -6204,7 +6204,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -6716,7 +6716,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -6880,7 +6880,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 277
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -7288,7 +7288,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 556
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -7751,7 +7751,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -7990,7 +7990,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -8154,7 +8154,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -8721,7 +8721,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -8996,7 +8996,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 560
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -9317,7 +9317,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -9691,7 +9691,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 17017
FontID: 0
FontID: 1
TextCfg:
- Type: 1
FontSize: 20
@ -10119,7 +10119,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -10261,7 +10261,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 356
FontID: 2
FontID: 0
TextCfg:
- Type: 0
FontSize: 60
@ -10885,7 +10885,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 283
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 45
@ -11550,7 +11550,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 284
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 45
@ -12058,7 +12058,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 274
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -12397,7 +12397,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 279
FontID: 1
FontID: 0
TextCfg:
- Type: 1
FontSize: 24
@ -12555,7 +12555,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 281
FontID: 2
FontID: 0
TextCfg:
- Type: 0
FontSize: 60
@ -12719,7 +12719,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 276
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -12937,7 +12937,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 880
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -13440,7 +13440,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 881
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -13604,7 +13604,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -14284,7 +14284,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 554
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -14426,7 +14426,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 101
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -15055,7 +15055,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 16968
FontID: 1
FontID: 0
TextCfg:
- Type: 1
FontSize: 24
@ -15083,7 +15083,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 278
FontID: 1
FontID: 0
TextCfg:
- Type: 1
FontSize: 24
@ -15241,7 +15241,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 561
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -15405,7 +15405,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -15569,7 +15569,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -15637,7 +15637,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 1400
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -15819,7 +15819,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -16224,7 +16224,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -16626,7 +16626,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -17632,7 +17632,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 885
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -17837,7 +17837,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 275
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -18229,7 +18229,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 556
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -18492,7 +18492,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -18731,7 +18731,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 882
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -19253,7 +19253,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -19512,7 +19512,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 553
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -19822,7 +19822,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 555
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -20086,7 +20086,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 557
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -20325,7 +20325,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -20642,7 +20642,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 1108
FontID: 1
FontID: 2
TextCfg:
- Type: 1
FontSize: 140
@ -20897,7 +20897,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 27
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 50
@ -21603,7 +21603,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -21875,7 +21875,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -22686,7 +22686,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 883
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -23034,7 +23034,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -23554,7 +23554,7 @@ MonoBehaviour:
Ban: 1
NoExport: 0
ID: 525
FontID: 4
FontID: 0
TextCfg:
- Type: 0
FontSize: 24
@ -23718,7 +23718,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 5
FontID: 1
FontID: 0
TextCfg:
- Type: 0
FontSize: 36
@ -23871,7 +23871,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 1048
FontID: 1
FontID: 2
TextCfg:
- Type: 0
FontSize: 36
@ -24156,7 +24156,7 @@ MonoBehaviour:
Ban: 0
NoExport: 0
ID: 301
FontID: 2
FontID: 0
TextCfg:
- Type: 0
FontSize: 54

View File

@ -53,7 +53,6 @@ namespace TH1_Core.Managers
public GameObject ROHintWindow;
public SettingUI SettingUI;
public WinUI WinUI;
public DebugUI DebugUI;
public GameObject AIPlayingHint;
@ -103,7 +102,6 @@ namespace TH1_Core.Managers
//step #3 设置其他
AIPlayingHint = ROUIManager.transform.Find("AIPlayingHint").gameObject;
SettingUI = new SettingUI();
//GameUI = new GameUI(_main,_mapData);
ROHintWindow = ROUIManager.transform.Find("HintWindow").gameObject;
HintUI = new HintUI(ROUIManager.transform.Find("HintWindow").gameObject);
@ -202,7 +200,6 @@ namespace TH1_Core.Managers
}
//BoardingUI?.Update();
SettingUI?.Update();
//GameUI?.Update();
//UIInfoManager?.Update();

View File

@ -144,5 +144,11 @@ namespace Logic.Multilingual
return _multilingualData.GetSystemLanguageTargetMultilingual(systemType);
}
public MultilingualType GetCurLanguage()
{
return ConfigManager.Instance.Config.MultilingualType;
}
}
}

View File

@ -1,251 +0,0 @@
using UnityEngine;
using RuntimeData;
using Animancer;
using TMPro;
using UnityEngine.UI;
using Logic.Audio;
using Logic.Config;
using TH1_Core.Events;
using TH1_Core.Managers;
using TH1_Logic.Config;
using TH1_Logic.Core;
using TH1Resource;
using ConfigManager = TH1_Logic.Config.ConfigManager;
public class MainUI
{
private Main _main;
private MapData _mapData;
public GameObject ROMainUI;
public Button NewGameButton;
public Button ResumeGameButton;
public Button StoryModeButton;
public Button LibraryButton;
public Button SettingButton;
public Button HistoryButton;
public Button AboutButton;
public Button BoardingButton;
public Button MultiplayButton;
public TextMeshProUGUI QQHintVersion;
public TextMeshProUGUI QQHintVersion2;
public bool NeedShow = false;
private bool _quickAnim;
private bool _isShowing = false;
private bool _isAnimating = false;
private float _fadeDuration = 0.2f;
private bool _languageHint;
public MainUI(Main main, MapData mapData)
{
_main = main;
_mapData = mapData;
ROMainUI = UIManager.Instance.ROUIManager.transform.Find("GameUI/MainUI").gameObject;
ROMainUI.gameObject.SetActive(false);
_languageHint = Application.systemLanguage != SystemLanguage.ChineseSimplified;
if(_languageHint)
ROMainUI.transform.Find("LanguageHint").gameObject.SetActive(true);
// step #1 绑定所有按钮
NewGameButton = ROMainUI.transform.Find("ButtonRow/NewGameButton/MainUIButton").GetComponent<Button>();
ResumeGameButton = ROMainUI.transform.Find("ButtonRow/ResumeGameButton/MainUIButton").GetComponent<Button>();
StoryModeButton = ROMainUI.transform.Find("ButtonRow/StoryModeButton/MainUIButton").GetComponent<Button>();
LibraryButton = ROMainUI.transform.Find("ButtonRow/LibraryButton/MainUIButton").GetComponent<Button>();
HistoryButton = ROMainUI.transform.Find("ButtonRow/HistoryButton/MainUIButton").GetComponent<Button>();
MultiplayButton = ROMainUI.transform.Find("ButtonRow/MultiplayButton/MainUIButton").GetComponent<Button>();
SettingButton = ROMainUI.transform.Find("ButtonRow2/SettingButton").GetComponent<Button>();
AboutButton = ROMainUI.transform.Find("ButtonRow2/AboutButton").GetComponent<Button>();
BoardingButton = ROMainUI.transform.Find("ButtonRow2/BoardingButton").GetComponent<Button>();
NewGameButton.onClick.AddListener(OnNewGameClicked);
MultiplayButton.onClick.AddListener(OnMultiplayClicked);
ResumeGameButton.onClick.AddListener(OnResumeGameClicked);
StoryModeButton.onClick.AddListener(OnStoryModeClicked);
LibraryButton.onClick.AddListener(OnLibraryClicked);
SettingButton.onClick.AddListener(OnSettingClicked);
HistoryButton.onClick.AddListener(OnHistoryClicked);
AboutButton.onClick.AddListener(OnAboutClicked);
BoardingButton?.onClick.AddListener(OnBoardingClicked);
// step #2 设置主界面的版本号
QQHintVersion = ROMainUI.transform.Find("QQHint/Version")?.GetComponent<TextMeshProUGUI>();
//QQHintVersion.text = ConfigManager.Instance.VersionCfg.CurVersionId.ToString();
QQHintVersion2 = ROMainUI.transform.Find("QQHint/Version2")?.GetComponent<TextMeshProUGUI>();
//QQHintVersion2.text = ConfigManager.Instance.VersionCfg.CurVersionId.ToString();
if (QQHintVersion != null)
{
var version = ConfigManager.Instance.VersionCfg;
QQHintVersion.text = "[Demo V" + version.CurVersionMajorId + "." + version.CurVersionMinorId + "." + version.CurVersionPatchId + "]";
}
if (QQHintVersion2 != null)
{
var version = ConfigManager.Instance.VersionCfg;
QQHintVersion2.text = "[V" + version.CurVersionMajorId + "." + version.CurVersionMinorId + "." + version.CurVersionPatchId + "]";
}
// step #3 如果有存当,显示"继续"这个按钮
ROMainUI.transform.Find("ButtonRow").Find("ResumeGameButton").gameObject.SetActive(_main.HasArchive());
}
public void Update()
{
if (_isAnimating) return;
if (NeedShow && !ROMainUI.activeSelf)
Show();
else if (!NeedShow && ROMainUI.activeSelf)
Hide();
}
public void UpdateMainUI()
{
UIManager.Instance.ROHintWindow.SetActive(false);
ROMainUI.transform.Find("ButtonRow").Find("ResumeGameButton").gameObject.SetActive(_main.HasArchive());
}
public void Show()
{
UpdateMainUI();
if (_isShowing || _isAnimating) return;
AudioManager.Instance.PlayMusic("Main",0.3f,0.3f,true);
_isShowing = true;
ROMainUI.SetActive(true);
if (_quickAnim)
{
var canvas = ROMainUI.GetComponent<CanvasGroup>();
if(canvas != null)
canvas.alpha = 1f;
_quickAnim = false;
}
else
{
_isAnimating = true;
AnimancerComponent animancer = ROMainUI.GetComponent<AnimancerComponent>();
animancer.Play(ResourceCache.Instance.AnimCache.UICommonPanelFadeIn);
Timer.Instance.TimerRegister(ROMainUI, () => { _isAnimating = false; }, _fadeDuration,"MainUI_Show");
}
}
private void Hide()
{
if (!_isShowing || _isAnimating) return;
_isShowing = false;
if (_quickAnim)
{
ROMainUI.SetActive(false);
_isAnimating = false;
_quickAnim = false;
}
else
{
_isAnimating = true;
AnimancerComponent animancer = ROMainUI.GetComponent<AnimancerComponent>();
animancer.Play(ResourceCache.Instance.AnimCache.UICommonPanelFadeOut);
Timer.Instance.TimerRegister(ROMainUI, () =>
{
ROMainUI.SetActive(false);
_isAnimating = false;
}, _fadeDuration,"MainUI_Hide");
}
}
private void OnNewGameClicked()
{
NeedShow = false;
//UIManager.Instance.GameUI.ChooseUI.Show();
EventManager.Publish(new ShowUIOutsideSelect(){});
}
private void OnResumeGameClicked()
{
//Debug.Log("Resume Game Clicked");
if (_main.HasArchive())
{
ShowLoadingAndResumeGame(true);
}
//NeedShow = false;
}
//很脏的传入bool TODO要迭代
public void ShowLoadingAndResumeGame(bool QuickAnim = false)
{
float startTime = ResourceCache.Instance.AnimCache.UICommonPanelFadeIn.length;
float prepareTime = 0.2f + (QuickAnim ? 0.1f : ResourceCache.Instance.AnimCache.UICommonPanelFadeOut.length);
var loading = UIManager.Instance.ROUIManager.transform.Find("LoadingUI");
var loadingAnim = loading.GetComponent<AnimancerComponent>();
if (loadingAnim == null)
{
_main.ResumeMatch();
return;
}
//先播放loading界面然后加载游戏再关掉loading界面
loading.gameObject.SetActive(true);
loadingAnim.Play(ResourceCache.Instance.AnimCache.UICommonPanelFadeIn);
Timer.Instance.TimerRegister(this,() => {
_main.ResumeMatch();
NeedShow = false;
_quickAnim = QuickAnim;
//ROMainUI.SetActive(false);
},startTime,"MainUI_ShowLoadingAndRusume");
//播放loading消失的动画
Timer.Instance.TimerRegister(loading,()=> { loadingAnim.Play(ResourceCache.Instance.AnimCache.UICommonPanelFadeOut); },prepareTime + startTime,"MainUI_ShowLoadingAndRusume2");
//将loading设置为false
Timer.Instance.TimerRegister(loading,()=> { loading.gameObject.SetActive(false); },startTime + prepareTime + ResourceCache.Instance.AnimCache.UICommonPanelFadeOut.length,"MainUI_ShowLoadingAndRusume3");
}
private void OnStoryModeClicked()
{
Debug.Log("Story Mode Clicked");
}
private void OnLibraryClicked()
{
NeedShow = false;
//UIManager.Instance.GameUI.LibraryUI.NeedShow = true;
}
private void OnSettingClicked()
{
UIManager.Instance.SettingUI.NeedShow = true;
}
private void OnBoardingClicked()
{
//UIManager.Instance.BoardingUI.SetShow();
}
private void OnHistoryClicked()
{
//UIManager.Instance.GameUI.HistoryUI.NeedShow = true;
}
private void OnAboutClicked()
{
//UIManager.Instance.GameUI.AboutUI.NeedShow = true;
}
private void OnMultiplayClicked()
{
Debug.Log("Multiplay Clicked");
NeedShow = false;
EventManager.Publish(new ShowUIOutsideMultiplay(){});
//EventManager.Publish(new HideUIInfoDiplomacy());
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1c220abf3dcd1fe419c351d4896a7e63
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,133 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
using Logic;
using RuntimeData;
using Animancer;
using Logic.Config;
using UnityEngine.UI;
using Logic.Multilingual;
using TH1_Core.Managers;
using TH1_Logic.Config;
using UI;
using ConfigManager = TH1_Logic.Config.ConfigManager;
public class SettingUI
{
public GameObject ROSettingUI;
private bool _isShowing = false;
private bool _isAnimating = false;
private float _fadeDuration = 0.2f;
public bool NeedShow = false;
private Dictionary<string, GameObject> _languageButtons = new();
public SettingUI()
{
ROSettingUI = UIManager.Instance.ROUIManager.transform.Find("SettingPanel").gameObject;
// 绑定按钮事件
Transform settingList = ROSettingUI.transform.Find("SettingList");
settingList.Find("ButtonRow/CloseButton").GetComponent<Button>().onClick.AddListener(() => { NeedShow = false; });
// 获取语言按钮
Transform row5 = settingList.Find("Row5");
string[] langs = { "CN", "EN", "JP", "KR" };
foreach (var lang in langs)
{
GameObject langObj = row5.Find(lang).gameObject;
_languageButtons[lang] = langObj;
langObj.GetComponent<Button>().onClick.AddListener(() => OnLanguageClicked(lang));
}
GameStartInit();
}
public void GameStartInit()
{
ROSettingUI.SetActive(false);
NeedShow = false;
_isShowing = false;
_isAnimating = false;
}
private void OnLanguageClicked(string langName)
{
foreach (var kv in _languageButtons)
{
Image img = kv.Value.GetComponent<Image>();
Color c = img.color;
c.a = kv.Key == langName ? 100f / 255f : 0f;
img.color = c;
}
// 触发语言切换
switch (langName)
{
case "CN":
MultilingualManager.Instance.ChangedMultilingual(MultilingualType.ZH);
break;
case "EN":
MultilingualManager.Instance.ChangedMultilingual(MultilingualType.EN);
break;
case "JP":
MultilingualManager.Instance.ChangedMultilingual(MultilingualType.JP);
break;
case "KR":
MultilingualManager.Instance.ChangedMultilingual(MultilingualType.KR);
break;
}
}
public void Update()
{
if (_isAnimating) return;
if (NeedShow && !ROSettingUI.activeSelf)
{
Show();
}
else if (!NeedShow && ROSettingUI.activeSelf)
{
Hide();
}
}
public void Show()
{
if (_isShowing || _isAnimating) return;
_isShowing = true;
_isAnimating = true;
ROSettingUI.SetActive(true);
AnimancerComponent animancer = ROSettingUI.GetComponent<AnimancerComponent>();
AnimationClip fadeInClip = Resources.Load<AnimationClip>("Animations/UI/SettingPanelFadeIn");
if (fadeInClip != null)
animancer.Play(fadeInClip);
Timer.Instance.TimerRegister(ROSettingUI, () => { _isAnimating = false; }, _fadeDuration,"SettingUI_Show");
}
public void Hide()
{
if (!_isShowing || _isAnimating) return;
_isShowing = false;
_isAnimating = true;
AnimancerComponent animancer = ROSettingUI.GetComponent<AnimancerComponent>();
AnimationClip fadeOutClip = Resources.Load<AnimationClip>("Animations/UI/SettingPanelFadeOut");
if (fadeOutClip != null)
animancer.Play(fadeOutClip);
Timer.Instance.TimerRegister(ROSettingUI, () =>
{
ROSettingUI.SetActive(false);
_isAnimating = false;
}, _fadeDuration,"SettingUI_Hide");
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f2ac5d9e51ba29941a4a72e729030991
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -50,8 +50,11 @@ namespace TH1_UI.View.Outside
BlockButton.onClick.RemoveAllListeners();
BlockButton.onClick.AddListener(OnClose);
gameObject.SetActive(false);
}
var lan = MultilingualManager.Instance.GetSystemLanguage();
public void RefreshLanguageOption()
{
var lan = MultilingualManager.Instance.GetCurLanguage();
uint idx = lan switch
{
MultilingualType.ZH => 0,
@ -62,12 +65,14 @@ namespace TH1_UI.View.Outside
_ => 3 //默认英文
};
LanguageOptionGroup.Init(idx);
LanguageOptionGroup.OnOptionClicked = OnLanguageClicked;
}
public void Open()
{
gameObject.SetActive(true);
RefreshLanguageOption();
Animancer.Play(ResourceCache.Instance.AnimCache.UICommonPanelFadeIn);
}

View File

@ -34,11 +34,9 @@ namespace TH1_UI.View.Outside
Select(index);
OnOptionClicked?.Invoke((uint)index);
});
else
{
if (i == defaultIndex)
Select((uint)i);
}
if (i == defaultIndex)
Select((uint)i);
}