protected override void Init()
        {
            labTitle          = FindInChild <UILabel>("common/title/label");
            labCurTitle       = FindInChild <UILabel>("center/title");
            btnClose          = FindInChild <Button>("top/btn_close");
            centerOnChild     = FindInChild <UICenterOnChild>("center/container/oncenter");
            gridCenterOnChild = FindInChild <UIGrid>("center/container/oncenter");
            gridList          = transform.GetComponentsInChildren <UIGrid>();

            try
            {
                centerOnChild.enabled = false;

                foreach (UIGrid grid in gridList)
                {
                    grid.repositionNow = true;
                }

                InitRewardItemList();
                InitLabel();

                maxPage   = gridCenterOnChild.maxPerLine;
                pageIndex = FindChild("center/fanye").AddMissingComponent <PageIndex>();
                pageIndex.RegisterOnCenter(centerOnChild);
                pageIndex.InitPage(1, maxPage);

                btnClose.onClick += CloseOnClick;
            }
            finally
            {
                centerOnChild.enabled = true;
            }
        }
Exemple #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的按钮,但是因为没有奖励,就不显示它了
        }