Beispiel #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);
                }
            }
        }
Beispiel #2
0
        private void initViewLayout()
        {
            btnClose = FindInChild <Button>("btn_guanbi");
            leftVIP  = FindInChild <Button>("jiantou/left");
            rightVIP = FindInChild <Button>("jiantou/right");
            btnPay   = FindInChild <Button>("sm/btn_zz");
            btnPay.SetActive(false);
            vipLevel1 = FindInChild <UILabel>("sm/1/1/level");
            vipLevel2 = FindInChild <UILabel>("sm/2/2/level");
            payTip    = FindInChild <UILabel>("sm/2/cz");
            payTotal  = FindInChild <UILabel>("sm/total_money");
            payTotal.SetActive(false);

            processDes = FindInChild <UILabel>("sm/1/process/shuzi");
            payProcess = FindInChild <UISlider>("sm/1/process");
            sliderBg   = FindInChild <UISprite>("sm/1/process/Foreground");
            objNextVIP = FindInChild <Transform>("sm/2").gameObject;
            //第一个面板的信息
            btnGetAward  = FindInChild <Button>("center/" + "1" + "/right/btn_lq");
            btn_bg       = FindInChild <UISprite>("center/" + "1" + "/right/btn_lq/background");
            awardWord    = FindInChild <UILabel>("center/" + "1" + "/right/btn_lq/lk");
            vipTitle1    = FindInChild <UILabel>("center/" + "1" + "/left/title");
            vipGiftTitle = FindInChild <UILabel>("center/" + "1" + "/right/gift");
            showArea     = FindInChild <Transform>("center/" + "1");

            scrollView    = FindInChild <UIScrollView>("center");          //滚动的组件
            centerOnChild = FindInChild <UICenterOnChild>("center");
            pageIndex     = FindChild("fanye").AddMissingComponent <PageIndex>();
            pageIndex.RegisterOnCenter(centerOnChild);
            pageIndex.InitPage(1, 13);

            desItem = FindInChild <UILabel>("center/" + "1" + "/left/des/1").gameObject;
            desObj  = FindInChild <Transform>("center/" + "1" + "/left/des").gameObject;
            desItemLocalPosition = desItem.transform.localPosition;

            ShowPannel[0] = new ITEM();
            ShowPannel[0].DesList.Add(desItem.GetComponent <UILabel>());
            ShowPannel[0].vipTitle  = vipTitle1;              //等级标题
            ShowPannel[0].vipTequan = vipGiftTitle;           //特权标题
            ShowPannel[0].btnAward  = btnGetAward;
            ShowPannel[0].btnBg     = btn_bg;
            ShowPannel[0].btnWord   = awardWord;            //按钮上的文字
            ShowPannel[0].desItem   = desItem;
            ShowPannel[0].desObj    = desObj;
            ShowPannel[0].pannel    = showArea.gameObject;

            btnGetAward.gameObject.SetActive(false);              //这是VIP的按钮,但是因为没有奖励,就不显示它了
        }