void Start() { id = GuiFrameID.ChapterFrame; Init(); chapterItemList = chapterWin.GetComponentsInChildren <ChapterItem>(); chapterRect = chapterWin.GetComponent <RectTransform>(); achievementDict = new Dictionary <DifficultyID, List <AchievementInstance> > { { DifficultyID.Junior, AchievementController.Instance.GetAchievementByDifficulty((int)DifficultyID.Junior) }, { DifficultyID.Medium, AchievementController.Instance.GetAchievementByDifficulty((int)DifficultyID.Medium) }, { DifficultyID.Senior, AchievementController.Instance.GetAchievementByDifficulty((int)DifficultyID.Senior) }, { DifficultyID.Ultimate, AchievementController.Instance.GetAchievementByDifficulty((int)DifficultyID.Ultimate) }, }; chapterStarStatisticsImg_Text.text = string.Format(chapterStarStatisticsImg_Text.text, AchievementController.Instance.CalculateAllStar()); List <GameObject> lockList = CommonTool.GetGameObjectsContainName(gameObject, "Lock"); List <Image> classList = CommonTool.GetComponentsContainName <Image>(gameObject, "ClassBtn"); //lockList[0].SetActive(false); for (int i = 1; i < lockList.Count; i++) { int star = CommonTool.CalculateStar(achievementDict[(DifficultyID)(i - 1)]); lockList[i].SetActive(star < 8); classList[i].color = star < 8 ? Color.clear : Color.white; } List <Text> starCountTextList = CommonTool.GetComponentsContainName <Text>(gameObject, "StarCount_Text"); for (int i = 0; i < starCountTextList.Count; i++) { int star = CommonTool.CalculateStar(achievementDict[(DifficultyID)i]); starCountTextList[i].text = string.Format(starCountTextList[i].text, star); } }
private void RefreshAchievementStatistics() { for (int i = 0; i < rawAchievementTextList.Count; i++) { string data = LanguageController.Instance.GetLanguage(rawAchievementTextList[i].index); rawAchievementTextList[i].text = string.Format(data, CommonTool.CalculateStar(achievementDict[(DifficultyID)i])); } }