public static void InitExloreList(CUIFormScript form)
        {
            if (form == null)
            {
                return;
            }
            int num = CExploreView.s_eventIDs.Length;
            CUIStepListScript component = form.transform.Find("ExploreList").gameObject.GetComponent <CUIStepListScript>();

            component.SetElementAmount(num);
            for (int i = 0; i < num; i++)
            {
                CUIListElementScript elemenet   = component.GetElemenet(i);
                CUIEventScript       component2 = elemenet.GetComponent <CUIEventScript>();
                component2.m_onClickEventID = CExploreView.s_eventIDs[i];
                Text component3 = elemenet.gameObject.transform.Find("TitleBg/ExlporeNameText").GetComponent <Text>();
                component3.set_text(Singleton <CTextManager> .instance.GetText(CExploreView.s_exploreTypes[i]));
                Image component4 = elemenet.gameObject.transform.Find("TitleBg/Image").GetComponent <Image>();
                component4.set_color(CExploreView.s_exploreColors[i]);
                Image      component5   = elemenet.gameObject.transform.Find("Icon").gameObject.GetComponent <Image>();
                GameObject spritePrefeb = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_Adventure_Dir + (i + 1), false, false);
                if (spritePrefeb != null)
                {
                    component5.SetSprite(spritePrefeb, false);
                }
                GameObject gameObject  = elemenet.transform.FindChild("Lock").gameObject;
                GameObject gameObject2 = elemenet.transform.FindChild("Unlock").gameObject;
                RES_SPECIALFUNCUNLOCK_TYPE rES_SPECIALFUNCUNLOCK_TYPE = CExploreView.s_unlockTypes[i];
                if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(rES_SPECIALFUNCUNLOCK_TYPE))
                {
                    component5.set_color(CUIUtility.s_Color_White);
                    gameObject.CustomSetActive(false);
                }
                else
                {
                    component5.set_color(CUIUtility.s_Color_GrayShader);
                    gameObject.CustomSetActive(true);
                    ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)rES_SPECIALFUNCUNLOCK_TYPE);
                    if (dataByKey != null)
                    {
                        gameObject.GetComponentInChildren <Text>().set_text(Utility.UTF8Convert(dataByKey.szLockedTip));
                    }
                }
                if (CExploreView.s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_NONE)
                {
                    int            lastChapter = CAdventureSys.GetLastChapter(1);
                    ResChapterInfo dataByKey2  = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)lastChapter);
                    if (dataByKey2 != null)
                    {
                        gameObject2.CustomSetActive(true);
                        gameObject2.GetComponentInChildren <Text>().set_text(string.Format(Singleton <CTextManager> .instance.GetText("Adventure_Chapter_Max_Tips"), Utility.UTF8Convert(dataByKey2.szChapterName)));
                    }
                }
                else if (CExploreView.s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_ARENA)
                {
                    if (Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList == null || Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank == 0u)
                    {
                        gameObject2.CustomSetActive(false);
                    }
                    else
                    {
                        string text = string.Empty;
                        text = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreArenaRankText"), Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank);
                        gameObject2.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().set_text(text);
                        gameObject2.CustomSetActive(true);
                    }
                }
                else if (CExploreView.s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_LIUGUOYUANZHENG)
                {
                    BurnExpeditionModel model = Singleton <BurnExpeditionController> .GetInstance().model;

                    if (model._data == null)
                    {
                        gameObject2.CustomSetActive(false);
                    }
                    else
                    {
                        string text2 = string.Empty;
                        if (model.IsAllCompelte())
                        {
                            text2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnFinishText"), new object[0]);
                        }
                        else
                        {
                            text2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnText"), Math.Max(1, model.Get_LastUnlockLevelIndex(model.curDifficultyType) + 1));
                        }
                        gameObject2.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().set_text(text2);
                        gameObject2.CustomSetActive(true);
                    }
                }
            }
            component.SelectElementImmediately(1);
            Text  component6 = form.gameObject.transform.FindChild("AwardGroup/Name1").gameObject.GetComponent <Text>();
            Text  component7 = form.gameObject.transform.FindChild("AwardGroup/Name2").gameObject.GetComponent <Text>();
            Image component8 = form.gameObject.transform.FindChild("AwardGroup/Icon1").gameObject.GetComponent <Image>();
            Image component9 = form.gameObject.transform.FindChild("AwardGroup/Icon2").gameObject.GetComponent <Image>();

            component6.gameObject.CustomSetActive(false);
            component7.gameObject.CustomSetActive(false);
            component8.gameObject.CustomSetActive(false);
            component9.gameObject.CustomSetActive(false);
            uint   num2  = 0u;
            string empty = string.Empty;

            try
            {
                num2 = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHeroId"));
            }
            catch (Exception)
            {
            }
            if (num2 != 0u)
            {
                ResHeroCfgInfo dataByKey3 = GameDataMgr.heroDatabin.GetDataByKey(num2);
                if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(num2, false) && dataByKey3 != null)
                {
                    component6.gameObject.CustomSetActive(true);
                    component6.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHero"), dataByKey3.szName));
                    component8.gameObject.CustomSetActive(true);
                    component8.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(num2, 0u)), form, true, false, false, false);
                }
            }
            num2 = 0u;
            try
            {
                num2 = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHeroId"));
            }
            catch (Exception)
            {
            }
            if (num2 != 0u)
            {
                ResHeroCfgInfo dataByKey4 = GameDataMgr.heroDatabin.GetDataByKey(num2);
                if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(num2, false) && dataByKey4 != null)
                {
                    component7.gameObject.CustomSetActive(true);
                    component7.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHero"), dataByKey4.szName));
                    component9.gameObject.CustomSetActive(true);
                    component9.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(num2, 0u)), form, true, false, false, false);
                }
            }
            if (CSysDynamicBlock.bLobbyEntryBlocked)
            {
                Transform transform = form.transform.FindChild("AwardGroup");
                if (transform)
                {
                    transform.gameObject.CustomSetActive(false);
                }
            }
        }
Exemple #2
0
        public static void InitExloreList(CUIFormScript form)
        {
            if (form != null)
            {
                int length = s_eventIDs.Length;
                CUIListElementScript elemenet  = null;
                CUIStepListScript    component = form.transform.Find("ExploreList").gameObject.GetComponent <CUIStepListScript>();
                component.SetElementAmount(length);
                for (int i = 0; i < length; i++)
                {
                    elemenet = component.GetElemenet(i);
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventID = s_eventIDs[i];
                    elemenet.gameObject.transform.Find("TitleBg/ExlporeNameText").GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(s_exploreTypes[i]);

                    elemenet.gameObject.transform.Find("TitleBg/Image").GetComponent <Image>().color = s_exploreColors[i];
                    Image      image2 = elemenet.gameObject.transform.Find("Icon").gameObject.GetComponent <Image>();
                    GameObject prefab = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_Adventure_Dir + (i + 1), false, false);
                    if (prefab != null)
                    {
                        image2.SetSprite(prefab);
                    }
                    GameObject gameObject           = elemenet.transform.FindChild("Lock").gameObject;
                    GameObject obj4                 = elemenet.transform.FindChild("Unlock").gameObject;
                    RES_SPECIALFUNCUNLOCK_TYPE type = s_unlockTypes[i];
                    if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(type))
                    {
                        image2.color = CUIUtility.s_Color_White;
                        gameObject.CustomSetActive(false);
                    }
                    else
                    {
                        image2.color = CUIUtility.s_Color_GrayShader;
                        gameObject.CustomSetActive(true);
                        ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)type);
                        if (dataByKey != null)
                        {
                            gameObject.GetComponentInChildren <Text>().text = Utility.UTF8Convert(dataByKey.szLockedTip);
                        }
                    }
                    if (s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_NONE)
                    {
                        int            lastChapter = CAdventureSys.GetLastChapter(1);
                        ResChapterInfo info        = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)lastChapter);
                        if (info != null)
                        {
                            obj4.CustomSetActive(true);
                            obj4.GetComponentInChildren <Text>().text = string.Format(Singleton <CTextManager> .instance.GetText("Adventure_Chapter_Max_Tips"), Utility.UTF8Convert(info.szChapterName));
                        }
                    }
                    else if (s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_ARENA)
                    {
                        if ((Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList == null) || (Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank == 0))
                        {
                            obj4.CustomSetActive(false);
                        }
                        else
                        {
                            string str = string.Empty;
                            str = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreArenaRankText"), Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank);
                            obj4.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().text = str;
                            obj4.CustomSetActive(true);
                        }
                    }
                    else if (s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_LIUGUOYUANZHENG)
                    {
                        BurnExpeditionModel model = Singleton <BurnExpeditionController> .GetInstance().model;

                        if (model._data == null)
                        {
                            obj4.CustomSetActive(false);
                        }
                        else
                        {
                            string str2 = string.Empty;
                            if (model.IsAllCompelte())
                            {
                                str2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnFinishText"), new object[0]);
                            }
                            else
                            {
                                str2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnText"), Math.Max(1, model.Get_LastUnlockLevelIndex(model.curDifficultyType) + 1));
                            }
                            obj4.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().text = str2;
                            obj4.CustomSetActive(true);
                        }
                    }
                }
                component.SelectElementImmediately(1);
                Text  text2  = form.gameObject.transform.FindChild("AwardGroup/Name1").gameObject.GetComponent <Text>();
                Text  text3  = form.gameObject.transform.FindChild("AwardGroup/Name2").gameObject.GetComponent <Text>();
                Image image  = form.gameObject.transform.FindChild("AwardGroup/Icon1").gameObject.GetComponent <Image>();
                Image image4 = form.gameObject.transform.FindChild("AwardGroup/Icon2").gameObject.GetComponent <Image>();
                text2.gameObject.CustomSetActive(false);
                text3.gameObject.CustomSetActive(false);
                image.gameObject.CustomSetActive(false);
                image4.gameObject.CustomSetActive(false);
                uint key = 0;
                try
                {
                    key = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHeroId"));
                }
                catch (Exception)
                {
                }
                if (key != 0)
                {
                    ResHeroCfgInfo info2 = GameDataMgr.heroDatabin.GetDataByKey(key);
                    if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(key, false) && (info2 != null))
                    {
                        text2.gameObject.CustomSetActive(true);
                        text2.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHero"), info2.szName);
                        image.gameObject.CustomSetActive(true);
                        image.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(key, 0)), form, true, false, false);
                    }
                }
                key = 0;
                try
                {
                    key = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHeroId"));
                }
                catch (Exception)
                {
                }
                if (key != 0)
                {
                    ResHeroCfgInfo info3 = GameDataMgr.heroDatabin.GetDataByKey(key);
                    if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(key, false) && (info3 != null))
                    {
                        text3.gameObject.CustomSetActive(true);
                        text3.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHero"), info3.szName);
                        image4.gameObject.CustomSetActive(true);
                        image4.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(key, 0)), form, true, false, false);
                    }
                }
            }
        }