From ee3196b5a04c15d025d1a9eab825d5d14987758d Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 30 十月 2025 00:23:30 +0800
Subject: [PATCH] 286 【常规】坊市系统; 调整布阵界面对应引导
---
Main/System/UIBase/OneLevelWin.cs | 183 ++++++++-------------------------------------
1 files changed, 35 insertions(+), 148 deletions(-)
diff --git a/Main/System/UIBase/OneLevelWin.cs b/Main/System/UIBase/OneLevelWin.cs
index 2326bbb..c88f6cc 100644
--- a/Main/System/UIBase/OneLevelWin.cs
+++ b/Main/System/UIBase/OneLevelWin.cs
@@ -1,164 +1,51 @@
-using System.Collections;
-using System.Collections.Generic;
using UnityEngine;
-using DG.Tweening;
-using UnityEngine.UI; // DOTween 鎻掍欢寮曠敤
-using Cysharp.Threading.Tasks;
+using UnityEngine.UI;
using System;
-
-public class OneLevelWin : UIBase
+// 涓�绾х晫闈㈠甫棰勫埗浣擄紝搴曢儴鍔熻兘鎸夐挳鏍峰紡
+public class OneLevelWin : FunctionsBaseWin
{
- protected Image m_TitleIcon;
- protected FunctionButtonGroup m_Group;
- protected Button m_Left;
- protected Button m_Right;
- protected Button m_Close;
-
- protected Text m_Copper;
- protected Text m_Diamond;
- protected Text m_BindDiamond;
-
- protected RectTransform m_SubWindowContainer;
- public RectTransform subWindowContainer { get { return m_SubWindowContainer; } }
-
- private UIBase subWindow = null;
-
- // init once
+ [NonSerialized] GroupButtonEx tabBtn;
+ public FuncBtnData[] funcBtnDatas;
+ [NonSerialized] Button closeBtn;
protected override void InitComponent()
{
+ // 鍒涘缓
+ var instance = UIUtility.CreateWidget("OneLevelWin", "BottomTabs");
+ instance.transform.SetParentEx(_rectTransform, Vector3.zero, Quaternion.identity, Vector3.one);
+ closeBtn = _rectTransform.GetComponent<Button>("BottomTabs/bg/backbtn");
+ tabBtn = _rectTransform.GetComponent<GroupButtonEx>("BottomTabs/bg/btns/funcbtn");
+ var btnParent = _rectTransform.GetComponent<RectTransform>("BottomTabs/bg/btns");
+
+
+ tabButtons = new GroupButtonEx[funcBtnDatas.Length];
+ for (int i = 0; i < tabButtons.Length; i++)
+ {
+ GameObject go = Instantiate(tabBtn.gameObject, btnParent);
+ var data = funcBtnDatas[i];
+ tabButtons[i] = go.GetComponent<GroupButtonEx>();
+ tabButtons[i].selectIcon.SetSprite(data.iconName);
+ tabButtons[i].selectIcon.SetNativeSize();
+ tabButtons[i].title.text = Language.Get(data.name);
+ tabButtons[i].redpoint.redpointId = data.redpointID;
+ tabButtons[i].SetActive(true);
+ }
base.InitComponent();
-
- // // 璺熷師鐗堢殑宸埆
- Transform trans = transform;
-
- // if (_rectTransform != null)
- // {
- // trans = _rectTransform;
- // }
-
- m_TitleIcon = trans.GetComponent<Image>("Pivot/Container_BackGround/Img_Title");
- m_Group = trans.GetComponent<FunctionButtonGroup>("Pivot/Container_Functions");
- m_Left = trans.GetComponent<Button>("Pivot/Container_Buttons/Btn_Left");
- m_Right = trans.GetComponent<Button>("Pivot/Container_Buttons/Btn_Right");
- m_Close = trans.GetComponent<Button>("Pivot/Container_Buttons/Btn_Close");
-
- m_Copper = trans.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/SilverCountBG/CountText");
- if (m_Copper != null)
- m_Diamond = trans.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/GoldCountBG/CountText");
- m_BindDiamond = trans.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/GoldPaperCountBG/CountText");
-
- m_SubWindowContainer = trans.GetComponent<RectTransform>("Pivot/Container_SubWindow");
-
- var name = gameObject.name;
- var infos = WindowConfig.GetWindowFunctionInfos(name);
- foreach (var info in infos)
- {
- var title = Language.Get(info.titleKey);
- if (title.Length == 2)
- {
- title = title.Insert(1, " ");
- }
- m_Group.AddFunction("FunctionButton_Pattern_1", info.order, info.functionId, title, info.redPointId);
- }
-
- m_TitleIcon.SetSprite(WindowConfig.GetTitleIconKey(name));
- m_TitleIcon.SetNativeSize();
-
- m_Close.SetListener(CloseWindow);
- m_Left.SetListener(() => { m_Group.TriggerLast(); });
- m_Right.SetListener(() => { m_Group.TriggerNext(); });
+ closeBtn.AddListener(CloseWindow);
}
- protected override void OnPreOpen()
+ protected override void OpenSubUIByTabIndex()
{
- base.OnPreOpen();
-
- if (m_Copper == null)
- m_Copper = this.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/SilverCountBG/CountText");
- m_Diamond = this.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/GoldCountBG/CountText");
- m_BindDiamond = this.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/GoldPaperCountBG/CountText");
-
-
- UpdateMoney();
}
- protected override void OnPreClose()
- {
- base.OnPreClose();
- CloseSubWindows();
- }
- protected override void OnOpen()
- {
- base.OnOpen();
+}
- PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataUpdate;
-
- ExecuteNextFrame(() => {
- m_Group.TriggerByOrder(functionOrder);
- m_Group.GotoOrder(functionOrder);
- });
-
- m_Left.SetActive(m_Group.unLockedCount > 1);
- m_Right.SetActive(m_Group.unLockedCount > 1);
- }
-
- protected virtual void CloseSubWindows()
- {
- if (null != subWindow)
- {
- subWindow.CloseWindow();
- }
- subWindow = null;
- }
-
- public void SetFunctionListener(int order, Action callBack)
- {
- m_Group.SetFunctionListener(order, callBack);
- }
-
- public void SetFunctionButtonActive(int order, bool isShow)
- {
- m_Group.SetFunctionButtonActive(order, isShow);
- }
-
- public RedPointState GetFunctionButtonRedPointState(int order)
- {
- return m_Group.GetFunctionButtonRedPointState(order);
- }
-
- public void FunctionButtonInvoke(int order)
- {
- m_Group.TriggerByOrder(order);
- m_Group.GotoOrder(order);
- }
-
- private void OnPlayerDataUpdate(PlayerDataType type)
- {
- switch (type)
- {
- case PlayerDataType.Gold:
- case PlayerDataType.GoldPaper:
- case PlayerDataType.Silver:
- case PlayerDataType.ExAttr6:
- case PlayerDataType.default5:
- case PlayerDataType.default6:
- UpdateMoney();
- break;
- }
- }
-
- void UpdateMoney()
- {
- if (m_Copper == null)
- return;
- m_Copper.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.allCopper);
- m_Diamond.text = UIHelper.GetMoneyCntEx(1).ToString();
- if (PlayerDatas.Instance.baseData.bindDiamond > 0)
- m_BindDiamond.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.bindDiamond);
- else
- m_BindDiamond.text = UIHelper.GetMoneyCntEx(2).ToString();
- }
+[Serializable]
+public struct FuncBtnData
+{
+ public int redpointID;
+ public string name;
+ public string iconName; //榛樿鏄剧ず鐨勫浘鏍囷紙閫変腑锛�
}
\ No newline at end of file
--
Gitblit v1.8.0