From b0ce53afc8346e1391807618e64bdb225e83fd64 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 28 十月 2025 18:54:54 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/ChallengeTab/ChallengeTabButton.cs | 88 ++++++++++++++++++++++++++++++++-----------
1 files changed, 65 insertions(+), 23 deletions(-)
diff --git a/Main/System/ChallengeTab/ChallengeTabButton.cs b/Main/System/ChallengeTab/ChallengeTabButton.cs
index 38ac43f..d309c3d 100644
--- a/Main/System/ChallengeTab/ChallengeTabButton.cs
+++ b/Main/System/ChallengeTab/ChallengeTabButton.cs
@@ -11,31 +11,73 @@
[SerializeField] TextEx txtLockInfo;
[SerializeField] Transform transUnlock;
[SerializeField] RedpointBehaviour redpointBehaviour;
- Action action;
- void Awake()
+
+ private Action _onClickAction;
+
+ public struct DisplayData
{
- btnTab.SetListener(() =>
- {
- UIManager.Instance.CloseWindow<ChallengeTabWin>();
- string activeBattleName = BattleManager.Instance.GetActiveBattleName();
- if (activeBattleName != "" && activeBattleName != "StoryBattleField")
- {
- UIManager.Instance.GetUI<MainWin>().ClickFunc(0);
- }
- action?.Invoke();
- });
+ public int Index;
+ public int RedpointId;
+ public int OpenState;//0 FuncID 1 娲诲姩
+ public int FuncId;
+ public string CountInfo;
+ public Action OnClickAction; // 鎸夐挳鐐瑰嚮鏃惰Е鍙戠殑鍏蜂綋閫昏緫
}
- public void Display(int index, int redpointId, bool isLock, string countInfo, string lockInfo, Action action)
+ void Awake()
{
- redpointBehaviour.redpointId = redpointId;
- transUnlock.SetActive(!isLock);
- txtCount.SetActive(isLock);
- txtLockInfo.SetActive(!isLock);
- imgIcon.SetSprite(StringUtility.Contact("ChallengeTab", index));
- txtName.text = Language.Get(StringUtility.Contact("ChallengeTab", index));
- txtCount.text = countInfo;
- txtLockInfo.text = lockInfo;
- this.action = action;
+ btnTab.SetListener(OnTabClicked);
}
-}
+
+ /// <summary>
+ /// 澶勭悊鎸夐挳鐐瑰嚮浜嬩欢
+ /// </summary>
+ private void OnTabClicked()
+ {
+ // --- 閫氱敤鐐瑰嚮閫昏緫 ---
+ UIManager.Instance.CloseWindow<ChallengeTabWin>();
+ string activeBattleName = BattleManager.Instance.GetActiveBattleName();
+ if (activeBattleName != "" && activeBattleName != "StoryBattleField")
+ {
+ UIManager.Instance.GetUI<MainWin>().ClickFunc(0);
+ }
+ // 鎵ц浼犲叆鐨勫叿浣撲笟鍔¢�昏緫
+ _onClickAction?.Invoke();
+ }
+
+ /// <summary>
+ /// 浣跨敤 DisplayData 缁撴瀯浣撴潵鏇存柊鎸夐挳鏄剧ず
+ /// </summary>
+ /// <param name="data">鍖呭惈鎵�鏈夋樉绀哄拰琛屼负閰嶇疆鐨勬暟鎹�</param>
+ public void Display(DisplayData data)
+ {
+ redpointBehaviour.redpointId = data.RedpointId;
+
+ bool isOpen;
+ if (data.OpenState == 0)
+ {
+ isOpen = FuncOpen.Instance.IsFuncOpen(data.FuncId);
+ }
+ else
+ {
+ isOpen = false;
+ }
+
+ // 鏍规嵁閿佸畾鐘舵�佽缃樉闅�
+ transUnlock.SetActive(!isOpen);
+ txtCount.SetActive(isOpen);
+ txtLockInfo.SetActive(!isOpen);
+
+ // 璁剧疆鍥炬爣鍜屽悕绉�
+ string spriteAndLangKey = StringUtility.Contact("ChallengeTab", data.Index);
+ imgIcon.SetSprite(spriteAndLangKey);
+ txtName.text = Language.Get(spriteAndLangKey);
+
+ // 璁剧疆TIPS鏂囨湰
+ txtCount.text = data.CountInfo;
+ txtLockInfo.text = !isOpen ? Language.Get("Challenge02") : string.Empty;
+
+ // 瀛樺偍鐐瑰嚮鍥炶皟
+ this._onClickAction = data.OnClickAction;
+ }
+}
\ No newline at end of file
--
Gitblit v1.8.0