少年修仙传客户端代码仓库
hch
2019-11-06 fd72c1d2c0c8c668087db0d253123ebefdeb9356
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);
        }
    }
}