Esempio n. 1
0
        private void initShowArea()
        {
            vec = showArea.transform.position;
            for (int i = 2; i < 14; i++)
            {
                GameObject go = GameObject.Instantiate(showArea.gameObject, showArea.transform.position, showArea.transform.rotation) as GameObject;
                vec += new Vector3(3, 0, 0);
                go.transform.position   = vec;
                go.transform.parent     = showArea.parent;
                go.transform.localScale = showArea.transform.localScale;
                go.name                     = (i).ToString(); //修改对象的名字
                vipTitle1                   = FindInChild <UILabel>("center/" + i + "/left/title");
                vipGiftTitle                = FindInChild <UILabel>("center/" + i + "/right/gift");
                btnGetAward                 = FindInChild <Button>("center/" + i + "/right/btn_lq");
                btn_bg                      = FindInChild <UISprite>("center/" + i + "/right/btn_lq/background");
                awardWord                   = FindInChild <UILabel>("center/" + i + "/right/btn_lq/lk");
                desObj                      = FindInChild <Transform>("center/" + i + "/left/des").gameObject;
                ShowPannel[i - 1]           = new ITEM();
                ShowPannel[i - 1].pannel    = go.gameObject;
                ShowPannel[i - 1].vipTitle  = vipTitle1;                  //等级标题
                ShowPannel[i - 1].vipTequan = vipGiftTitle;               //特权标题
                ShowPannel[i - 1].btnAward  = btnGetAward;
                ShowPannel[i - 1].btnBg     = btn_bg;
                ShowPannel[i - 1].btnWord   = awardWord;                //按钮上的文字
                //为领取按钮添加事件
                btnGetAward.onClick = BtnbtnGetAward;
                btn_bg       = FindInChild <UISprite>("center/" + i + "/right/btn_lq/background");
                vipTitle1    = FindInChild <UILabel>("center/" + i + "/left/title");
                vipGiftTitle = FindInChild <UILabel>("center/" + i + "/right/gift");
                awardWord    = FindInChild <UILabel>("center/" + i + "/right/btn_lq/lk");
                showArea     = FindInChild <Transform>("center/" + i);
                desItem      = FindInChild <UILabel>("center/" + i + "/left/des/1").gameObject;
                ShowPannel[i - 1].desItem = desItem;
                ShowPannel[i - 1].desObj  = desObj;
                ShowPannel[i - 1].AwardList.Clear();

                Transform [] trans = ShowPannel[i - 1].desObj.GetComponentsInChildren <Transform>();
                foreach (Transform tran in trans)
                {
                    if (tran.name.Contains("1"))
                    {
                        ShowPannel[i - 1].DesList.Add(tran.gameObject.GetComponent <UILabel>());
                    }
                }
                for (int index2 = 1; index2 < 7; index2++)
                {
                    AwardItem item = new AwardItem();
                    item.obj     = FindInChild <Transform>("center/" + i + "/right/wp/" + index2.ToString()).gameObject;
                    item.ItemBtn = FindInChild <Button>("center/" + i + "/right/wp/" + index2.ToString());
                    item.name    = FindInChild <UILabel>("center/" + i + "/right/wp/" + index2.ToString() + "/mz");
                    item.count   = FindInChild <UILabel>("center/" + i + "/right/wp/" + index2.ToString() + "/geshu");
                    item.icon    = FindInChild <UISprite>("center/" + i + "/right/wp/" + index2.ToString() + "/icon");
                    item.icon.GetComponent <TweenPosition>().enabled = false;
                    ShowPannel[i - 1].AwardList.Add(item);
                }
            }
        }
Esempio n. 2
0
 private void initAwardItem()
 {
     for (int itemIndex = 1; itemIndex < 7; itemIndex++)
     {
         AwardItem item = new AwardItem();
         item.obj     = FindInChild <Transform>("center/" + "1" + "/right/wp/" + itemIndex.ToString()).gameObject;
         item.ItemBtn = FindInChild <Button>("center/" + "1" + "/right/wp/" + itemIndex.ToString());
         item.name    = FindInChild <UILabel>("center/" + "1" + "/right/wp/" + itemIndex.ToString() + "/mz");
         item.count   = FindInChild <UILabel>("center/" + "1" + "/right/wp/" + itemIndex.ToString() + "/geshu");
         item.icon    = FindInChild <UISprite>("center/" + "1" + "/right/wp/" + itemIndex.ToString() + "/icon");
         item.icon.GetComponent <TweenPosition>().enabled = false;
         ShowPannel[0].AwardList.Add(item);
     }
 }