Ejemplo n.º 1
0
        public static void OpenChapterRewardPanel(CUIFormScript formScript, GameObject root, int ChapterId, int difficulty, bool bCanGet)
        {
            GameObject gameObject = root.transform.Find("ChapterRewardPanel").gameObject;

            gameObject.CustomSetActive(true);
            ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey((uint)ChapterId);

            object[] inParameters = new object[] { ChapterId };
            DebugHelper.Assert(dataByKey != null, "Can't find chapter config with ID: {0}", inParameters);
            ResDT_ChapterRewardInfo[] astNormalRewardDetail = null;
            astNormalRewardDetail = dataByKey.astNormalRewardDetail;
            if (difficulty == 1)
            {
                astNormalRewardDetail = dataByKey.astNormalRewardDetail;
            }
            else if (difficulty == 2)
            {
                astNormalRewardDetail = dataByKey.astEliteRewardDetail;
            }
            else if (difficulty == 3)
            {
                astNormalRewardDetail = dataByKey.astMasterRewardDetail;
            }
            else if (difficulty == 4)
            {
                astNormalRewardDetail = dataByKey.astAbyssRewardDetail;
            }
            object[] objArray2 = new object[] { ChapterId, difficulty };
            DebugHelper.Assert(astNormalRewardDetail != null, "Chapter RewardArr is NULL! -- ID: {0}, Difficulty: {1}", objArray2);
            for (int i = 0; i < astNormalRewardDetail.Length; i++)
            {
                ResDT_ChapterRewardInfo info2 = astNormalRewardDetail[i];
                GameObject obj3 = gameObject.transform.Find(string.Format("RewardCon/itemCell{0}", i + 1)).gameObject;
                if (info2.bType != 0)
                {
                    obj3.CustomSetActive(true);
                    CUseable itemUseable = CUseableManager.CreateUsableByServerType((RES_REWARDS_TYPE)info2.bType, (int)info2.dwNum, info2.dwID);
                    CUICommonSystem.SetItemCell(formScript, obj3, itemUseable, true, false);
                }
                else
                {
                    obj3.CustomSetActive(false);
                }
            }
            GameObject obj4 = gameObject.transform.Find("BtnGetReward").gameObject;

            if (bCanGet)
            {
                obj4.GetComponentInChildren <Text>().text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Can_Get_The_Box");

                obj4.GetComponent <Button>().interactable = true;
            }
            else
            {
                obj4.GetComponentInChildren <Text>().text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Not_Enough_Starts");

                obj4.GetComponent <Button>().interactable = false;
            }
        }
Ejemplo n.º 2
0
        public static void InitLevelList(CUIFormScript form, int currentChapter, int levelNo, int difficulty)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey(currentChapter);
                DebugHelper.Assert(dataByKey != null);
                bool flag = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByKey.dwChapterId);

                PVE_ADV_COMPLETE_INFO     pve_adv_complete_info     = masterRoleInfo.pveLevelDetail[difficulty - 1];
                PVE_CHAPTER_COMPLETE_INFO pve_chapter_complete_info = pve_adv_complete_info.ChapterDetailList[currentChapter - 1];
                PVE_LEVEL_COMPLETE_INFO[] levelDetailList           = pve_chapter_complete_info.LevelDetailList;
                CUIListScript             component = form.transform.FindChild("LevelList").GetComponent <CUIListScript>();
                component.SetElementAmount(levelDetailList.Length);
                CUIListElementScript elemenet = null;
                Sprite     sprite             = CUIUtility.GetSpritePrefeb(GetLevelFramePath(difficulty), false, false).GetComponent <SpriteRenderer>().sprite;
                GameObject prefab             = CUIUtility.GetSpritePrefeb(GetLevelSelectFramePath(difficulty), false, false);
                for (int i = 0; i < levelDetailList.Length; i++)
                {
                    elemenet = component.GetElemenet(i);
                    ResLevelCfgInfo info3        = GameDataMgr.levelDatabin.GetDataByKey(levelDetailList[i].iLevelID);
                    object[]        inParameters = new object[] { levelDetailList[i].iLevelID };
                    DebugHelper.Assert(info3 != null, "Can't find LevelConfig = {0}", inParameters);
                    bool bActive = (levelDetailList[i].levelStatus == 0) || !flag;
                    bool flag3   = (levelDetailList[i].levelStatus == 1) && flag;
                    int  starNum = CAdventureSys.GetStarNum(levelDetailList[i].bStarBits);
                    elemenet.transform.FindChild("Unlock/star1").GetComponent <Image>().color   = (starNum < 1) ? CUIUtility.s_Color_GrayShader : Color.white;
                    elemenet.transform.FindChild("Unlock/star2").GetComponent <Image>().color   = (starNum < 2) ? CUIUtility.s_Color_GrayShader : Color.white;
                    elemenet.transform.FindChild("Unlock/star3").GetComponent <Image>().color   = (starNum < 3) ? CUIUtility.s_Color_GrayShader : Color.white;
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().text = Utility.UTF8Convert(info3.szName);
                    if ((levelNo == (i + 1)) && !bActive)
                    {
                        elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[0];
                    }
                    else if (!bActive)
                    {
                        elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[1];
                    }
                    else
                    {
                        elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[2];
                    }
                    elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().color        = s_Adv_Difficult_Color[difficulty - 1];
                    elemenet.transform.FindChild("SelectedFrame/Image1").GetComponent <Image>().color = s_Adv_Difficult_Color[((s_Adv_Difficult_Color.Length / 2) + difficulty) - 1];
                    elemenet.transform.FindChild("SelectedFrame/Image2").GetComponent <Image>().color = s_Adv_Difficult_Color[((s_Adv_Difficult_Color.Length / 2) + difficulty) - 1];
                    elemenet.transform.FindChild("SelectedFrame/SelectedFrame").GetComponent <Image>().SetSprite(prefab);
                    elemenet.transform.FindChild("New").gameObject.CustomSetActive(flag3);
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventID         = enUIEventID.Adv_SelectLevel;
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1;
                    elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(!bActive);
                    elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(bActive);
                    elemenet.m_selectedSprite = sprite;
                    elemenet.GetComponent <Image>().SetSprite(((levelNo - 1) != i) ? elemenet.m_defaultSprite : sprite, elemenet.m_selectedLayout);
                }
                component.SelectElement(levelNo - 1, true);
            }
        }
Ejemplo n.º 3
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      image  = 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)
                    {
                        image.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))
                    {
                        image.color = CUIUtility.s_Color_White;
                        gameObject.CustomSetActive(false);
                    }
                    else
                    {
                        image.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(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
                    {
                        obj4.CustomSetActive(false);
                    }
                }
                component.SelectElementImmediately(1);
            }
        }
Ejemplo n.º 4
0
        public static string GetChapterName(int ChapterId)
        {
            ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey((uint)ChapterId);

            if (dataByKey != null)
            {
                return(StringHelper.UTF8BytesToString(ref dataByKey.szChapterName));
            }
            return(string.Empty);
        }
Ejemplo n.º 5
0
        public static void InitChapterList(CUIFormScript formScript, int currentChapter, int levelNo, int difficulty)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                CUIListScript             component             = formScript.transform.FindChild("ChapterList").GetComponent <CUIListScript>();
                PVE_ADV_COMPLETE_INFO     pve_adv_complete_info = masterRoleInfo.pveLevelDetail[difficulty - 1];
                PVE_CHAPTER_COMPLETE_INFO chapterInfo           = null;
                CUIListElementScript      elemenet = null;
                int    stars       = 0;
                string prefabPath  = string.Empty;
                string chapterName = string.Empty;
                component.SetElementAmount(CAdventureSys.CHAPTER_NUM);
                for (int i = 0; i < CAdventureSys.CHAPTER_NUM; i++)
                {
                    ResChapterInfo dataByIndex = GameDataMgr.chapterInfoDatabin.GetDataByIndex(i);
                    DebugHelper.Assert(dataByIndex != null);
                    bool bActive = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByIndex.dwChapterId);

                    bool flag2 = i == (Singleton <CAdventureSys> .instance.bNewChapterId - 1);
                    chapterInfo = pve_adv_complete_info.ChapterDetailList[i];
                    elemenet    = component.GetElemenet(i);
                    stars       = CAdventureSys.GetChapterTotalStar(chapterInfo);
                    SetRewardItem(elemenet.gameObject, chapterInfo, stars, i);
                    chapterName = GetChapterName(i + 1);
                    elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().text = chapterName;
                    if ((currentChapter == (i + 1)) && bActive)
                    {
                        elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = s_Adv_Chaptper_Colors[0];
                    }
                    else if (bActive)
                    {
                        elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = s_Adv_Chaptper_Colors[1];
                    }
                    else
                    {
                        elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = s_Adv_Chaptper_Colors[2];
                    }
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventID         = enUIEventID.Adv_SelectChapter;
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1;
                    elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(!bActive);
                    elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(bActive);
                    prefabPath = GetChapterBgPath(i + 1);
                    elemenet.transform.FindChild("BackgroundImg").GetComponent <Image>().SetSprite(prefabPath, component.m_belongedFormScript, true, false, false);
                    elemenet.transform.FindChild("Lock/SelectedImg").GetComponent <Image>().SetSprite(prefabPath, component.m_belongedFormScript, true, false, false);
                    elemenet.transform.FindChild("Lock/LockText").GetComponent <Text>().text = Utility.UTF8Convert(dataByIndex.szLockedTip);
                    elemenet.transform.FindChild("New").gameObject.CustomSetActive(flag2);
                }
                component.SelectElement(currentChapter - 1, true);
                component.MoveElementInScrollArea(currentChapter - 1, true);
            }
        }
        public bool ChapterIsUnlock(uint ChapterId)
        {
            ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey(ChapterId);

            DebugHelper.Assert(dataByKey != null, "ChapterIsUnlock : ChapterId[{0}] can not be find.", new object[]
            {
                ChapterId
            });
            if (dataByKey != null)
            {
                uint dwUnlockLevel = dataByKey.dwUnlockLevel;
                return(dwUnlockLevel <= 0u || this.CheckUnlock(dwUnlockLevel));
            }
            return(false);
        }
Ejemplo n.º 7
0
        public bool ChapterIsUnlock(uint ChapterId)
        {
            ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey(ChapterId);

            object[] inParameters = new object[] { ChapterId };
            DebugHelper.Assert(dataByKey != null, "ChapterIsUnlock : ChapterId[{0}] can not be find.", inParameters);
            if (dataByKey == null)
            {
                return(false);
            }
            uint dwUnlockLevel = dataByKey.dwUnlockLevel;

            if ((dwUnlockLevel > 0) && !this.CheckUnlock(dwUnlockLevel))
            {
                return(false);
            }
            return(true);
        }
        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);
                }
            }
        }
Ejemplo n.º 9
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);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public static void InitLevelList(CUIFormScript form, int currentChapter, int levelNo, int difficulty)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return;
            }
            ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)currentChapter);

            DebugHelper.Assert(dataByKey != null);
            bool flag = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByKey.dwChapterId);

            PVE_ADV_COMPLETE_INFO     pVE_ADV_COMPLETE_INFO     = masterRoleInfo.pveLevelDetail[difficulty - 1];
            PVE_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = pVE_ADV_COMPLETE_INFO.ChapterDetailList[currentChapter - 1];

            PVE_LEVEL_COMPLETE_INFO[] levelDetailList = pVE_CHAPTER_COMPLETE_INFO.LevelDetailList;
            CUIListScript             component       = form.transform.FindChild("LevelList").GetComponent <CUIListScript>();

            component.SetElementAmount(levelDetailList.Length);
            Sprite     sprite       = CUIUtility.GetSpritePrefeb(CAdventureView.GetLevelFramePath(difficulty), false, false).GetComponent <SpriteRenderer>().sprite;
            GameObject spritePrefeb = CUIUtility.GetSpritePrefeb(CAdventureView.GetLevelSelectFramePath(difficulty), false, false);

            for (int i = 0; i < levelDetailList.Length; i++)
            {
                CUIListElementScript elemenet   = component.GetElemenet(i);
                ResLevelCfgInfo      dataByKey2 = GameDataMgr.levelDatabin.GetDataByKey((long)levelDetailList[i].iLevelID);
                DebugHelper.Assert(dataByKey2 != null, "Can't find LevelConfig = {0}", new object[]
                {
                    levelDetailList[i].iLevelID
                });
                bool flag2   = levelDetailList[i].levelStatus == 0 || !flag;
                bool bActive = levelDetailList[i].levelStatus == 1 && flag;
                int  starNum = CAdventureSys.GetStarNum(levelDetailList[i].bStarBits);
                elemenet.transform.FindChild("Unlock/star1").GetComponent <Image>().set_color((starNum >= 1) ? Color.white : CUIUtility.s_Color_GrayShader);
                elemenet.transform.FindChild("Unlock/star2").GetComponent <Image>().set_color((starNum >= 2) ? Color.white : CUIUtility.s_Color_GrayShader);
                elemenet.transform.FindChild("Unlock/star3").GetComponent <Image>().set_color((starNum >= 3) ? Color.white : CUIUtility.s_Color_GrayShader);
                elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_text(Utility.UTF8Convert(dataByKey2.szName));
                if (levelNo == i + 1 && !flag2)
                {
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[0]);
                }
                else if (!flag2)
                {
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[1]);
                }
                else
                {
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[2]);
                }
                elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[difficulty - 1]);
                elemenet.transform.FindChild("SelectedFrame/Image1").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[CAdventureView.s_Adv_Difficult_Color.Length / 2 + difficulty - 1]);
                elemenet.transform.FindChild("SelectedFrame/Image2").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[CAdventureView.s_Adv_Difficult_Color.Length / 2 + difficulty - 1]);
                elemenet.transform.FindChild("SelectedFrame/SelectedFrame").GetComponent <Image>().SetSprite(spritePrefeb, false);
                elemenet.transform.FindChild("New").gameObject.CustomSetActive(bActive);
                elemenet.GetComponent <CUIEventScript>().m_onClickEventID         = enUIEventID.Adv_SelectLevel;
                elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1;
                elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(!flag2);
                elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(flag2);
                elemenet.m_selectedSprite = sprite;
                elemenet.GetComponent <Image>().SetSprite((levelNo - 1 == i) ? sprite : elemenet.m_defaultSprite, elemenet.m_selectedLayout);
            }
            component.SelectElement(levelNo - 1, true);
        }