示例#1
0
        private void refreshButtonState(int timeToBuy)
        {
            if (this.m_FormScript == null)
            {
                return;
            }
            GameObject      gameObject     = this.m_FormScript.transform.Find("Bg/Bg1/ButtonGroup/Button_BuyTen").gameObject;
            CUIEventScript  cUIEventScript = gameObject.GetComponent <CUIEventScript>();
            stUIEventParams eventParams    = default(stUIEventParams);

            if (cUIEventScript == null)
            {
                cUIEventScript = gameObject.AddComponent <CUIEventScript>();
                cUIEventScript.Initialize(this.m_FormScript);
            }
            if (base.IsHaveEnoughTimes(timeToBuy))
            {
                gameObject.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f);
                eventParams.tag = 1;
            }
            else
            {
                gameObject.GetComponent <Image>().color = new Color(0f, 1f, 1f, 1f);
                eventParams.tag = 0;
            }
            cUIEventScript.SetUIEvent(enUIEventType.Click, enUIEventID.Purchase_BuyCoinTen, eventParams);
        }
示例#2
0
        public void Draw()
        {
            CUIListScript component = this.m_cuiForm.GetWidget(0).GetComponent <CUIListScript>();

            int[] numArray = new int[] { 100, 200, 300, 400, 500, 600 };
            component.SetElementAmount(numArray.Length);
            for (byte i = 0; i < numArray.Length; i = (byte)(i + 1))
            {
                CUIListElementScript elemenet = component.GetElemenet(i);
                CUIEventScript       script3  = elemenet.gameObject.GetComponent <CUIEventScript>();
                if (script3 == null)
                {
                    script3 = elemenet.gameObject.AddComponent <CUIEventScript>();
                    script3.Initialize(elemenet.m_belongedFormScript);
                }
                stUIEventParams eventParams = new stUIEventParams();
                int             num2        = numArray[i] / 10;
                eventParams.tag = numArray[i];
                script3.SetUIEvent(enUIEventType.Click, enUIEventID.Purchase_BuyDiamond, eventParams);
                Text text  = elemenet.gameObject.transform.Find("pnlPrice/txtQuantity").GetComponent <Text>();
                Text text2 = elemenet.gameObject.transform.Find("pnlPrice/txtPrice").GetComponent <Text>();
                text.text  = numArray[i].ToString();
                text2.text = num2.ToString();
            }
        }
        private void CreateHeroPreview(uint heroId, int i)
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(HeroChooseLogic.s_heroInitChooseFormPath);

            if (form == null)
            {
                return;
            }
            string            name       = string.Format("RawImage{0}", i);
            GameObject        gameObject = form.transform.Find(name).gameObject;
            CUIRawImageScript component  = gameObject.GetComponent <CUIRawImageScript>();
            ObjData           hero3DObj  = CUICommonSystem.GetHero3DObj(heroId, true);

            if (hero3DObj.Object == null)
            {
                return;
            }
            component.AddGameObject(name, hero3DObj.Object, Vector3.zero, Quaternion.identity, hero3DObj.Object.transform.localScale);
            this.cacheObjList.Add(hero3DObj.Object);
            CUIEventScript cUIEventScript = gameObject.GetComponent <CUIEventScript>();

            if (cUIEventScript == null)
            {
                cUIEventScript = gameObject.AddComponent <CUIEventScript>();
                cUIEventScript.Initialize(form);
            }
            cUIEventScript.SetUIEvent(enUIEventType.Click, enUIEventID.Hero_Init_Select, new stUIEventParams
            {
                heroId = heroId
            });
        }
示例#4
0
        private void CreateHeroPreview(uint heroId, int i)
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_heroInitChooseFormPath);

            if (form != null)
            {
                string            name       = string.Format("RawImage{0}", i);
                GameObject        gameObject = form.transform.Find(name).gameObject;
                CUIRawImageScript component  = gameObject.GetComponent <CUIRawImageScript>();
                ObjData           data       = CUICommonSystem.GetHero3DObj(heroId, true);
                if (data.Object != null)
                {
                    component.AddGameObject(name, data.Object, Vector3.zero, Quaternion.identity, data.Object.transform.localScale);
                    this.cacheObjList.Add(data.Object);
                    CUIEventScript script3 = gameObject.GetComponent <CUIEventScript>();
                    if (script3 == null)
                    {
                        script3 = gameObject.AddComponent <CUIEventScript>();
                        script3.Initialize(form);
                    }
                    stUIEventParams eventParams = new stUIEventParams {
                        heroId = heroId
                    };
                    script3.SetUIEvent(enUIEventType.Click, enUIEventID.Hero_Init_Select, eventParams);
                }
            }
        }
示例#5
0
        public void Draw()
        {
            CUIListScript component = this.m_cuiForm.GetWidget(0).GetComponent <CUIListScript>();

            int[] array = new int[]
            {
                100,
                200,
                300,
                400,
                500,
                600
            };
            component.SetElementAmount(array.Length);
            byte b = 0;

            while ((int)b < array.Length)
            {
                CUIListElementScript elemenet       = component.GetElemenet((int)b);
                CUIEventScript       cUIEventScript = elemenet.gameObject.GetComponent <CUIEventScript>();
                if (cUIEventScript == null)
                {
                    cUIEventScript = elemenet.gameObject.AddComponent <CUIEventScript>();
                    cUIEventScript.Initialize(elemenet.m_belongedFormScript);
                }
                stUIEventParams eventParams = default(stUIEventParams);
                int             num         = array[(int)b] / 10;
                eventParams.tag = array[(int)b];
                cUIEventScript.SetUIEvent(enUIEventType.Click, enUIEventID.Purchase_BuyDiamond, eventParams);
                Text component2 = elemenet.gameObject.transform.Find("pnlPrice/txtQuantity").GetComponent <Text>();
                Text component3 = elemenet.gameObject.transform.Find("pnlPrice/txtPrice").GetComponent <Text>();
                component2.set_text(array[(int)b].ToString());
                component3.set_text(num.ToString());
                b += 1;
            }
        }
示例#6
0
        private void initForm(CUIFormScript form)
        {
            this.m_FormObj = form.gameObject;
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            this.m_lblGlodCoin      = this.m_FormObj.transform.Find("PlayerBtn/GoldCoin/Text").GetComponent <Text>();
            this.m_lblDianquan      = this.m_FormObj.transform.Find("PlayerBtn/Dianquan/Text").GetComponent <Text>();
            this.m_lblDiamond       = this.m_FormObj.transform.Find("PlayerBtn/Diamond/Text").GetComponent <Text>();
            this.m_wifiIcon         = form.GetWidget(0);
            this.m_wifiInfo         = form.GetWidget(1);
            this.m_ping             = form.GetWidget(2).GetComponent <Text>();
            this.m_lblGlodCoin.text = this.GetCoinString(masterRoleInfo.GoldCoin);
            this.m_lblDianquan.text = this.GetCoinString((uint)masterRoleInfo.DianQuan);
            this.m_lblDiamond.text  = this.GetCoinString(masterRoleInfo.Diamond);
            GameObject gameObject = this.m_FormObj.transform.Find("PlayerBtn/GoldCoin").gameObject;

            if (gameObject != null)
            {
                CUIEventScript component = gameObject.GetComponent <CUIEventScript>();
                if (component == null)
                {
                    component = gameObject.AddComponent <CUIEventScript>();
                    component.Initialize(form);
                }
                CUseable        useable     = CUseableManager.CreateCoinUseable(RES_SHOPBUY_COINTYPE.RES_SHOPBUY_TYPE_PVPCOIN, (int)masterRoleInfo.GoldCoin);
                stUIEventParams eventParams = new stUIEventParams {
                    iconUseable = useable,
                    tag         = 3
                };
                component.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
                component.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
                component.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
                component.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            }
            GameObject obj3 = this.m_FormObj.transform.Find("PlayerBtn/Diamond").gameObject;

            if (obj3 != null)
            {
                CUIEventScript script2 = obj3.GetComponent <CUIEventScript>();
                if (script2 == null)
                {
                    script2 = obj3.AddComponent <CUIEventScript>();
                    script2.Initialize(form);
                }
                CUseable        useable2 = CUseableManager.CreateCoinUseable(RES_SHOPBUY_COINTYPE.RES_SHOPBUY_TYPE_DIAMOND, (int)masterRoleInfo.Diamond);
                stUIEventParams params2  = new stUIEventParams {
                    iconUseable = useable2,
                    tag         = 3
                };
                script2.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, params2);
                script2.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, params2);
                script2.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, params2);
                script2.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, params2);
            }
            if (!ApolloConfig.payEnabled)
            {
                Transform transform = this.m_FormObj.transform.Find("PlayerBtn/Dianquan/Button");
                if (transform != null)
                {
                    transform.gameObject.CustomSetActive(false);
                }
            }
            CUIFormScript script3 = Singleton <CUIManager> .GetInstance().GetForm(LobbyForm.FORM_PATH);

            this.m_SysEntry = script3.gameObject.transform.Find("LobbyBottom/SysEntry").gameObject;
            this.m_Btns     = new DictionaryView <int, GameObject>();
            this.m_Btns.Add(0, this.m_SysEntry.transform.Find("HeroBtn").gameObject);
            this.m_Btns.Add(1, this.m_SysEntry.transform.Find("SymbolBtn").gameObject);
            this.m_Btns.Add(2, this.m_SysEntry.transform.Find("AchievementBtn").gameObject);
            this.m_Btns.Add(3, this.m_SysEntry.transform.Find("BagBtn").gameObject);
            this.m_Btns.Add(5, this.m_SysEntry.transform.Find("SocialBtn").gameObject);
            this.m_Btns.Add(6, form.transform.Find("PlayerBtn/FriendBtn").gameObject);
            this.m_Btns.Add(7, this.m_SysEntry.transform.Find("AddedSkillBtn").gameObject);
            this.m_Btns.Add(8, form.transform.Find("PlayerBtn/MailBtn").gameObject);
            this.m_Btns.Add(9, Utility.FindChild(script3.gameObject, "Popup/ActBtn"));
            this.m_Btns.Add(10, Utility.FindChild(script3.gameObject, "Popup/BoardBtn"));
            this.m_Btns.Add(4, script3.gameObject.transform.Find("LobbyBottom/Newbie/RedDotPanel").gameObject);
        }
示例#7
0
        public static void SetGetInfoToList(CUIFormScript formScript, CUIListScript list, CUseable itemUseable)
        {
            ResDT_ItemSrc_Info[] astSrcInfo = null;
            if (itemUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
            {
                astSrcInfo = ((CItem)itemUseable).m_itemData.astSrcInfo;
            }
            else if (itemUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP)
            {
                astSrcInfo = ((CEquip)itemUseable).m_equipData.astSrcInfo;
            }
            else if (itemUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)
            {
                astSrcInfo = ((CSymbolItem)itemUseable).m_SymbolData.astSrcInfo;
            }
            else
            {
                return;
            }
            int amount = 0;

            for (int i = 0; i < astSrcInfo.Length; i++)
            {
                if (astSrcInfo[i].bType == 0)
                {
                    break;
                }
                amount++;
            }
            if (list != null)
            {
                list.SetElementAmount(amount);
                for (int j = 0; j < amount; j++)
                {
                    Transform           transform   = list.GetElemenet(j).transform.Find("sourceCell");
                    Text                component   = transform.Find("lblName").GetComponent <Text>();
                    Text                text2       = transform.Find("lblLevel").GetComponent <Text>();
                    Button              button      = transform.Find("lblOpen").GetComponent <Button>();
                    Text                text3       = transform.Find("lblClose").GetComponent <Text>();
                    Text                text4       = transform.Find("Elite").GetComponent <Text>();
                    byte                bType       = astSrcInfo[j].bType;
                    int                 dwID        = (int)astSrcInfo[j].dwID;
                    bool                bActive     = false;
                    stUIEventParams     eventParams = new stUIEventParams();
                    stItemGetInfoParams params2     = new stItemGetInfoParams();
                    eventParams.itemGetInfoParams         = params2;
                    eventParams.itemGetInfoParams.getType = bType;
                    if (bType == 1)
                    {
                        ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey(dwID);
                        bActive = Singleton <CAdventureSys> .GetInstance().IsLevelOpen(dataByKey.iCfgID);

                        eventParams.itemGetInfoParams.levelInfo = dataByKey;
                        eventParams.itemGetInfoParams.isCanDo   = bActive;
                        if (!bActive)
                        {
                            eventParams.itemGetInfoParams.errorStr = Singleton <CTextManager> .instance.GetText("Hero_Level_Not_Open");
                        }
                        component.text = StringHelper.UTF8BytesToString(ref dataByKey.szName);
                        text2.text     = dataByKey.iChapterId + "-" + dataByKey.bLevelNo;
                        if (text4 != null)
                        {
                            text4.gameObject.CustomSetActive(dataByKey.bLevelDifficulty == 2);
                        }
                    }
                    button.gameObject.CustomSetActive(bActive);
                    text3.gameObject.CustomSetActive(!bActive);
                    CUIEventScript script = button.gameObject.GetComponent <CUIEventScript>();
                    if (script == null)
                    {
                        script = transform.gameObject.AddComponent <CUIEventScript>();
                        script.Initialize(formScript);
                    }
                    script.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemSourceElementClick, eventParams);
                }
                list.gameObject.CustomSetActive(true);
            }
        }
示例#8
0
        private void InitForm(CUIFormScript form)
        {
            this.m_FormObj        = form.gameObject;
            this.m_PlayerName     = this.m_FormObj.transform.Find("PlayerHead/NameGroup/PlayerName").GetComponent <Text>();
            this.m_PvpLevel       = this.m_FormObj.transform.Find("PlayerHead/pvpLevel").GetComponent <Text>();
            this.m_PlayerExp      = this.m_FormObj.transform.Find("PlayerHead/PlayerExp").GetComponent <Text>();
            this.m_PlayerVipLevel = this.m_FormObj.transform.Find("PlayerHead/imgVipBg/txtVipLevel").GetComponent <Text>();
            this.m_PvpExpImg      = this.m_FormObj.transform.Find("PlayerHead/pvpExp/expBg/imgExp").GetComponent <Image>();
            this.m_PvpExpTxt      = this.m_FormObj.transform.Find("PlayerHead/pvpExp/expBg/txtExp").GetComponent <Text>();
            this.animatorScript   = this.m_FormObj.GetComponent <CUIAnimatorScript>();
            this.hero_btn         = this.m_FormObj.transform.Find("LobbyBottom/SysEntry/HeroBtn").gameObject;
            this.symbol_btn       = this.m_FormObj.transform.Find("LobbyBottom/SysEntry/SymbolBtn").gameObject;
            this.bag_btn          = this.m_FormObj.transform.Find("LobbyBottom/SysEntry/BagBtn").gameObject;
            this.task_btn         = this.m_FormObj.transform.Find("LobbyBottom/Newbie").gameObject;
            this.social_btn       = this.m_FormObj.transform.Find("LobbyBottom/SysEntry/SocialBtn").gameObject;
            this.addSkill_btn     = this.m_FormObj.transform.Find("LobbyBottom/SysEntry/AddedSkillBtn").gameObject;
            this.Check_Enable(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_HERO);
            this.Check_Enable(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_SYMBOL);
            this.Check_Enable(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_BAG);
            this.Check_Enable(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_TASK);
            this.Check_Enable(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_UNION);
            this.Check_Enable(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_FRIEND);
            this.Check_Enable(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_ADDEDSKILL);
            if (CSysDynamicBlock.bLobbyEntryBlocked)
            {
                Transform transform = this.m_FormObj.transform.Find("Popup");
                if (transform != null)
                {
                    transform.gameObject.CustomSetActive(false);
                }
                Transform transform2 = this.m_FormObj.transform.Find("BtnCon/CompetitionBtn");
                if (transform2 != null)
                {
                    transform2.gameObject.CustomSetActive(false);
                }
                if (this.task_btn != null)
                {
                    this.task_btn.CustomSetActive(false);
                }
                Transform transform3 = this.m_FormObj.transform.Find("DiamondPayBtn");
                if (transform3 != null)
                {
                    transform3.gameObject.CustomSetActive(false);
                }
            }
            if (CSysDynamicBlock.bUnfinishBlock)
            {
                Transform transform4 = this.m_FormObj.transform.Find("BtnCon/WebBtn");
                if (transform4 != null)
                {
                    transform4.gameObject.CustomSetActive(false);
                }
            }
            Button component = this.m_FormObj.transform.Find("BtnCon/LadderBtn").GetComponent <Button>();

            if (component != null)
            {
                component.interactable = Singleton <CLadderSystem> .GetInstance().IsLevelQualified();

                Transform transform5 = component.transform.Find("Lock");
                if (transform5 != null)
                {
                    transform5.gameObject.CustomSetActive(!component.interactable);
                }
            }
            Button button2 = this.m_FormObj.transform.FindChild("BtnCon/UnionBtn").GetComponent <Button>();

            if (button2 != null)
            {
                bool bActive = Singleton <CUnionBattleEntrySystem> .GetInstance().IsUnionFuncLocked();

                button2.interactable = !bActive;
                button2.transform.FindChild("Lock").gameObject.CustomSetActive(bActive);
            }
            GameObject gameObject = this.m_FormObj.transform.Find("PlayerHead/pvpExp").gameObject;

            if (gameObject != null)
            {
                CUIEventScript script = gameObject.GetComponent <CUIEventScript>();
                if (script == null)
                {
                    script = gameObject.AddComponent <CUIEventScript>();
                    script.Initialize(form);
                }
                CUseable        useable     = CUseableManager.CreateVirtualUseable(enVirtualItemType.enExp, 0);
                stUIEventParams eventParams = new stUIEventParams {
                    iconUseable = useable,
                    tag         = 3
                };
                script.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
                script.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
                script.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
                script.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            }
            RefreshDianQuanPayButton(false);
            Transform transform6 = this.m_FormObj.transform.Find("BtnCon/PvpBtn");
            Transform transform7 = this.m_FormObj.transform.Find("BtnCon/PveBtn");

            if (transform6 != null)
            {
                Singleton <CMallSystem> .instance.LoadUIPrefab(Pvp_BtnRes_PATH, "PvpBtnDynamic", transform6.gameObject, form);
            }
            if (transform7 != null)
            {
                Singleton <CMallSystem> .instance.LoadUIPrefab(Pve_BtnRes_PATH, "PveBtnDynamic", transform7.gameObject, form);
            }
        }