From fd72c1d2c0c8c668087db0d253123ebefdeb9356 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 06 十一月 2019 19:45:57 +0800
Subject: [PATCH] 0312 调整一级界面的货币位置,生成新的lua文件
---
System/WindowBase/OneLevelWin.cs | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/System/WindowBase/OneLevelWin.cs b/System/WindowBase/OneLevelWin.cs
index bb981c7..cd1b0c1 100644
--- a/System/WindowBase/OneLevelWin.cs
+++ b/System/WindowBase/OneLevelWin.cs
@@ -22,6 +22,10 @@
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; } }
@@ -47,6 +51,11 @@
m_Left = this.GetComponent<Button>("Pivot/Container_Buttons/Btn_Left");
m_Right = this.GetComponent<Button>("Pivot/Container_Buttons/Btn_Right");
m_Close = this.GetComponent<Button>("Pivot/Container_Buttons/Btn_Close");
+
+ m_Copper = this.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/SilverCountBG/CountText");
+ if (m_Copper != null)
+ m_Diamond = this.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/GoldCountBG/CountText");
+ m_BindDiamond = this.GetComponent<Text>("Pivot/Container_BackGround/FollowStoreBottom/GoldPaperCountBG/CountText");
m_SubWindowContainer = this.GetComponent<RectTransform>("Pivot/Container_SubWindow");
@@ -75,6 +84,13 @@
protected override void 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");
+
+ PlayerDatas.Instance.playerDataRefreshEvent += OnPlayerDataUpdate;
+ UpdateMoney();
}
protected override void OnAfterOpen()
@@ -83,6 +99,7 @@
protected override void OnPreClose()
{
+ PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataUpdate;
CloseSubWindows();
}
@@ -116,6 +133,27 @@
m_Group.SetFunctionListener(order, callBack);
}
+ private void OnPlayerDataUpdate(PlayerDataType type)
+ {
+ switch (type)
+ {
+ case PlayerDataType.Gold:
+ case PlayerDataType.GoldPaper:
+ case PlayerDataType.Silver:
+ case PlayerDataType.ExAttr6:
+ UpdateMoney();
+ break;
+ }
+ }
+
+ void UpdateMoney()
+ {
+ if (m_Copper == null)
+ return;
+ m_Copper.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.allCopper);
+ m_Diamond.text = PlayerDatas.Instance.baseData.diamond.ToString();
+ m_BindDiamond.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.bindDiamond);
+ }
}
}
--
Gitblit v1.8.0