Beispiel #1
0
        //窗口控件初始化
        protected override void InitWidget()
        {
            ClearWindowData();
            mChildren.Clear();
            {//EPT_Hero
                OneUIData one = new OneUIData();
                one.ChildRoot = mRoot.Find("Position/Hero").gameObject;
                one.NameLabel = one.ChildRoot.transform.Find("NameLabel").GetComponent <UILabel>();
                //one.NumLabel = one.ChildRoot.transform.FindChild("NumLabel").GetComponent<UILabel>();
                one.IconSprite = one.ChildRoot.transform.GetComponent <UISprite>();
                mChildren.Add(EPurchaseType.EPT_Hero, one);
            }
            {//EPT_Rune
                OneUIData one = new OneUIData();
                one.ChildRoot  = mRoot.Find("Position/Rune").gameObject;
                one.NameLabel  = one.ChildRoot.transform.Find("NameLabel").GetComponent <UILabel>();
                one.NumLabel   = one.ChildRoot.transform.Find("NumLabel").GetComponent <UILabel>();
                one.IconSprite = one.ChildRoot.transform.GetComponent <UISprite>();
                mChildren.Add(EPurchaseType.EPT_Rune, one);
            }
            {//EPT_Card
                OneUIData one = new OneUIData();
                one.ChildRoot = mRoot.Find("Position/Card").gameObject;
                one.NameLabel = one.ChildRoot.transform.Find("NameLabel").GetComponent <UILabel>();
                //one.NumLabel = one.ChildRoot.transform.FindChild("NumLabel").GetComponent<UILabel>();
                mChildren.Add(EPurchaseType.EPT_Card, one);
            }
            {//EPT_Scroll
                OneUIData one = new OneUIData();
                one.ChildRoot = mRoot.Find("Position/Scroll").gameObject;
                one.NameLabel = one.ChildRoot.transform.Find("NameLabel").GetComponent <UILabel>();
                //one.NumLabel = one.ChildRoot.transform.FindChild("NumLabel").GetComponent<UILabel>();
                mChildren.Add(EPurchaseType.EPT_Scroll, one);
            }
            {//EPT_TrialCard
                OneUIData one = new OneUIData();
                one.ChildRoot = mRoot.Find("Position/TrialCard").gameObject;
                one.NameLabel = one.ChildRoot.transform.Find("NameLabel").GetComponent <UILabel>();
                //one.NumLabel = one.ChildRoot.transform.FindChild("NumLabel").GetComponent<UILabel>();
                mChildren.Add(EPurchaseType.EPT_TrialCard, one);
            }
            {//EPT_Gold
                OneUIData one = new OneUIData();
                one.ChildRoot = mRoot.Find("Position/Gold").gameObject;
                one.NameLabel = one.ChildRoot.transform.Find("NameLabel").GetComponent <UILabel>();
                one.NumLabel  = one.ChildRoot.transform.Find("NumLabel").GetComponent <UILabel>();
                mChildren.Add(EPurchaseType.EPT_Gold, one);
            }
            {//EPT_Crystal
                OneUIData one = new OneUIData();
                one.ChildRoot = mRoot.Find("Position/Crystal").gameObject;
                one.NameLabel = one.ChildRoot.transform.Find("NameLabel").GetComponent <UILabel>();
                one.NumLabel  = one.ChildRoot.transform.Find("NumLabel").GetComponent <UILabel>();
                mChildren.Add(EPurchaseType.EPT_Crystal, one);
            }

            m_CloseGO = mRoot.Find("Black").gameObject;
            UIEventListener.Get(m_CloseGO).onClick += onClickClose;
        }
Beispiel #2
0
        public void UpdatePurchase(EPurchaseType type, string name, string icon, int count)
        {
            foreach (KeyValuePair <EPurchaseType, OneUIData> one in mChildren)
            {
                one.Value.ChildRoot.SetActive(false);
            }

            OneUIData current = mChildren[type];

            current.ChildRoot.SetActive(true);
            current.NameLabel.text = name;
            if (current.IconSprite != null)
            {
                current.IconSprite.spriteName = icon;
            }
            if (current.NumLabel != null)
            {
                current.NumLabel.text = "x" + count.ToString();
            }
        }