Ejemplo n.º 1
0
        public void RefreshBuyDianQuanPanel()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_buyDianQuanFormPath);

            if (form != null)
            {
                DatabinTable <ResCouponsBuyInfo, uint> androidDianQuanBuyInfo = null;
                androidDianQuanBuyInfo = GameDataMgr.androidDianQuanBuyInfo;
                int index = 0;
                this.dianQuanBuyInfoList.Clear();
                androidDianQuanBuyInfo.Accept(x => this.dianQuanBuyInfoList.Add(x));
                this.SortDianQuanInfoList();
                CUIListScript component = form.transform.Find("pnlBg/pnlBody/List").GetComponent <CUIListScript>();
                component.SetElementAmount(this.dianQuanBuyInfoList.Count);
                for (index = 0; index < this.dianQuanBuyInfoList.Count; index++)
                {
                    ResCouponsBuyInfo    info     = this.dianQuanBuyInfoList[index];
                    CUIListElementScript elemenet = component.GetElemenet(index);
                    Image  image      = elemenet.transform.Find("imgIcon").GetComponent <Image>();
                    string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Purchase_Dir, StringHelper.UTF8BytesToString(ref info.szImgPath));
                    image.SetSprite(prefabPath, form, true, false, false);
                    elemenet.transform.Find("diamondCntText").GetComponent <Text>().text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Pay_DianQuan_Cnt"), info.dwBuyCount);
                    GameObject gameObject = elemenet.transform.Find("buyPanel/buyBtn").gameObject;
                    gameObject.transform.Find("Text").GetComponent <Text>().text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Pay_DianQuan_Price"), info.dwBuyPrice);
                    GameObject obj3 = elemenet.transform.Find("additionPanel").gameObject;
                    obj3.CustomSetActive(false);
                    GameObject obj4 = elemenet.transform.Find("pnlRecommend").gameObject;
                    if ((info.bFirstGift > 0) && !this.IsDianQuanHaveFirstPay(info.dwID))
                    {
                        obj4.CustomSetActive(true);
                        obj4.transform.Find("txtDiscount").GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Pay_First_Pay_Double");
                    }
                    else
                    {
                        if (info.dwExtraGiftCnt > 0)
                        {
                            obj3.CustomSetActive(true);
                            obj3.transform.Find("Text").GetComponent <Text>().text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Pay_Gift_Diamond_Cnt"), info.dwExtraGiftCnt);
                        }
                        obj4.CustomSetActive(false);
                    }
                    CUIEventScript  script4     = gameObject.GetComponent <CUIEventScript>();
                    stUIEventParams eventParams = new stUIEventParams();
                    eventParams.dianQuanBuyPar.giftId      = (int)info.dwID;
                    eventParams.dianQuanBuyPar.dianQuanCnt = (int)info.dwBuyCount;
                    script4.SetUIEvent(enUIEventType.Click, enUIEventID.Pay_ClickDianQuanGift, eventParams);
                }
            }
        }
Ejemplo n.º 2
0
        public void RefreshBuyDianQuanPanel()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CPaySystem.s_buyDianQuanFormPath);

            if (form == null)
            {
                return;
            }
            DatabinTable <ResCouponsBuyInfo, uint> androidDianQuanBuyInfo = GameDataMgr.androidDianQuanBuyInfo;

            this.dianQuanBuyInfoList.Clear();
            androidDianQuanBuyInfo.Accept(delegate(ResCouponsBuyInfo x)
            {
                this.dianQuanBuyInfoList.Add(x);
            });
            this.SortDianQuanInfoList();
            CUIListScript component = form.transform.Find("pnlBg/pnlBody/List").GetComponent <CUIListScript>();

            component.SetElementAmount(this.dianQuanBuyInfoList.Count);
            for (int i = 0; i < this.dianQuanBuyInfoList.Count; i++)
            {
                ResCouponsBuyInfo    resCouponsBuyInfo = this.dianQuanBuyInfoList[i];
                CUIListElementScript elemenet          = component.GetElemenet(i);
                Image  component2 = elemenet.transform.Find("imgIcon").GetComponent <Image>();
                string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Purchase_Dir, StringHelper.UTF8BytesToString(ref resCouponsBuyInfo.szImgPath));
                component2.SetSprite(prefabPath, form, true, false, false, false);
                Text component3 = elemenet.transform.Find("diamondCntText").GetComponent <Text>();
                component3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Pay_DianQuan_Cnt"), resCouponsBuyInfo.dwBuyCount));
                GameObject gameObject = elemenet.transform.Find("buyPanel/buyBtn").gameObject;
                Text       component4 = gameObject.transform.Find("Text").GetComponent <Text>();
                component4.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Pay_DianQuan_Price"), resCouponsBuyInfo.dwBuyPrice));
                GameObject gameObject2 = elemenet.transform.Find("additionPanel").gameObject;
                gameObject2.CustomSetActive(false);
                GameObject gameObject3 = elemenet.transform.Find("pnlRecommend").gameObject;
                if (resCouponsBuyInfo.bFirstGift > 0 && !this.IsDianQuanHaveFirstPay(resCouponsBuyInfo.dwID))
                {
                    gameObject3.CustomSetActive(true);
                    Text component5 = gameObject3.transform.Find("txtDiscount").GetComponent <Text>();
                    component5.set_text(Singleton <CTextManager> .GetInstance().GetText("Pay_First_Pay_Double"));
                }
                else
                {
                    if (resCouponsBuyInfo.dwExtraGiftCnt > 0u)
                    {
                        gameObject2.CustomSetActive(true);
                        Text component6 = gameObject2.transform.Find("Text").GetComponent <Text>();
                        component6.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Pay_Gift_Diamond_Cnt"), resCouponsBuyInfo.dwExtraGiftCnt));
                    }
                    gameObject3.CustomSetActive(false);
                }
                CUIEventScript  component7  = gameObject.GetComponent <CUIEventScript>();
                stUIEventParams eventParams = default(stUIEventParams);
                eventParams.dianQuanBuyPar.giftId      = (int)resCouponsBuyInfo.dwID;
                eventParams.dianQuanBuyPar.dianQuanCnt = (int)resCouponsBuyInfo.dwBuyCount;
                component7.SetUIEvent(enUIEventType.Click, enUIEventID.Pay_ClickDianQuanGift, eventParams);
            }
            if (CSysDynamicBlock.bLobbyEntryBlocked)
            {
                Transform transform  = form.transform.FindChild("Button_OpenNobe");
                Transform transform2 = form.transform.FindChild("Button_HelpMe");
                Transform transform3 = form.transform.FindChild("Button_TongCai");
                Transform transform4 = form.transform.FindChild("Button_Partner");
                if (transform)
                {
                    transform.gameObject.CustomSetActive(false);
                }
                if (transform2)
                {
                    transform2.gameObject.CustomSetActive(false);
                }
                if (transform3)
                {
                    transform3.gameObject.CustomSetActive(false);
                }
                if (transform4)
                {
                    transform4.gameObject.CustomSetActive(false);
                }
            }
        }