예제 #1
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);
            }
        }
예제 #2
0
        public static void InitDifficultList(CUIFormScript form, int currentChapter, int levelNo, int difficulty)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return;
            }
            CUIListScript component              = form.transform.FindChild("DifficultList").GetComponent <CUIListScript>();
            string        text                   = string.Empty;
            string        prefabPath             = string.Empty;
            int           lEVEL_DIFFICULT_OPENED = CAdventureSys.LEVEL_DIFFICULT_OPENED;

            component.SetElementAmount(lEVEL_DIFFICULT_OPENED);
            for (int i = 0; i < lEVEL_DIFFICULT_OPENED; i++)
            {
                bool flag = CAdventureSys.IsDifOpen(currentChapter, i + 1);
                prefabPath = CAdventureView.GetDifficultIcon(i + 1);
                CUIListElementScript elemenet = component.GetElemenet(i);
                Image component2 = elemenet.transform.FindChild("DifficultImg").GetComponent <Image>();
                component2.SetSprite(prefabPath, form, true, false, false, false);
                component2.color = ((!flag) ? CAdventureView.s_Adv_Difficulty_Gray_Color : Color.white);
                elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().SetSprite(prefabPath, form, true, false, false, false);
                text = Singleton <CTextManager> .get_instance().GetText(string.Format("Adventure_Level_{0}", i + 1));

                elemenet.transform.FindChild("DifficultImg/DifficultText").GetComponent <Text>().text  = text;
                elemenet.transform.FindChild("SelectedFrame/DifficultText").GetComponent <Text>().text = text;
                elemenet.GetComponent <CUIEventScript>().m_onClickEventID         = enUIEventID.Adv_SelectDifficult;
                elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1;
                elemenet.transform.FindChild("SelectedFrame/Frame_circle").GetComponent <Image>().color = CAdventureView.s_Adv_Difficult_Circle_Color[i];
                PVE_ADV_COMPLETE_INFO     pVE_ADV_COMPLETE_INFO     = masterRoleInfo.pveLevelDetail[i];
                PVE_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = pVE_ADV_COMPLETE_INFO.ChapterDetailList[currentChapter - 1];
                int chapterTotalStar = CAdventureSys.GetChapterTotalStar(pVE_CHAPTER_COMPLETE_INFO);
                elemenet.transform.FindChild("SelectedFrame/RewardBox").gameObject.CustomSetActive(chapterTotalStar == CAdventureSys.LEVEL_PER_CHAPTER * CAdventureSys.STAR_PER_LEVEL && pVE_CHAPTER_COMPLETE_INFO.bIsGetBonus == 0);
                elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(!flag);
            }
            component.SelectElement(difficulty - 1, true);
        }