static public void UpdateMyAchieve(COM_Achievement hasProgress, bool isNew = false) { AchieveData data = AchieveData.GetData((int)hasProgress.achId_); if (data == null) { Debug.LogError(" Achievement ID: " + hasProgress.achId_ + " is not excist."); return; } if (achievementByTab.ContainsKey(data._Category)) { if (achievementByTab[data._Category].ContainsKey(data._AchieveType)) { for (int j = 0; j < achievementByTab[data._Category][data._AchieveType].Count; ++j) { if (achievementByTab[data._Category][data._AchieveType][j].data_._Id == hasProgress.achId_) { if (!achievementByTab[data._Category][data._AchieveType][j].isAch_ && hasProgress.isAch_) { if (isNew) { newAchieve.Enqueue(achievementByTab[data._Category][data._AchieveType][j]); ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("chengjiu").Replace("{n}", AchieveData.GetData((int)hasProgress.achId_)._AtName)); } finishCount++; } achievementByTab[data._Category][data._AchieveType][j].achValue_ = hasProgress.achValue_; achievementByTab[data._Category][data._AchieveType][j].isAward_ = hasProgress.isAward_; achievementByTab[data._Category][data._AchieveType][j].isAch_ = hasProgress.isAch_; } } } } isDirty = true; }
public static bool isReceived(int id) { AchieveData data = AchieveData.GetData(id); if (achievementByTab.ContainsKey(data._Category)) { if (achievementByTab[data._Category].ContainsKey(data._AchieveType)) { for (int j = 0; j < achievementByTab[data._Category][data._AchieveType].Count; ++j) { if (achievementByTab[data._Category][data._AchieveType][j].data_._Id == id) { return(achievementByTab[data._Category][data._AchieveType][j].isAward_); } } } } return(false); }
void UpdateUI() { CategoryType[] cTypes = new CategoryType[(int)CategoryType.ACH_Max]; if (index == (int)CategoryType.ACH_All) { for (int i = 0; i < (int)CategoryType.ACH_Max; ++i) { cTypes[i] = (CategoryType)i; } } else { cTypes[index] = (CategoryType)index; } int counter = 0; GameObject go = null; Dictionary <AchievementType, List <AchievementContent> > data = null; List <AchievementContent> finalList = new List <AchievementContent>(); for (int i = 0; i < cTypes.Length; ++i) { if (!SuccessSystem.achievementByTab.ContainsKey(cTypes[i])) { continue; } data = SuccessSystem.achievementByTab[cTypes[i]]; foreach (List <AchievementContent> seris in data.Values) { AchievementContent ac = null; for (int j = 0; j < seris.Count; ++j) { if (!seris[j].isAward_) { ac = seris[j]; break; } } if (ac == null) { ac = seris[seris.Count - 1]; } if (AchieveData.GetData(ac.data_._Id)._AchieveType == AchievementType.AT_Reward50) { continue; } finalList.Add(ac); } } finalList.Sort(Compare); for (int i = 0; i < finalList.Count; ++i) { if (counter >= objPool.Count) { go = GameObject.Instantiate(item) as GameObject; objPool.Add(go); } else { go = objPool[counter]; } go.SetActive(true); SuccessCell aCell = go.GetComponent <SuccessCell>(); aCell.Info = finalList[i]; UIManager.SetButtonEventHandler(aCell.receiveBtn.gameObject, EnumButtonEvent.OnClick, OnClickReceive, finalList[i].data_._Id, 0); go.transform.parent = grid.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; if (i == 0) { GuideManager.Instance.RegistGuideAim(aCell.receiveBtn.gameObject, GuideAimType.GAT_FirstAchievement); } counter++; } for (int i = counter; i < objPool.Count; ++i) { objPool[i].SetActive(false); } SpringPanel sp = contentPanel.GetComponent <SpringPanel>(); if (sp != null) { sp.enabled = false; } contentPanel.clipOffset = Vector2.zero; contentPanel.transform.localPosition = Vector3.zero; contentPanel.GetComponent <UIScrollView>().ResetPosition(); grid.Reposition(); objInfo.GetComponent <RewardInfo>().Percentage(SuccessSystem.FinishCount, SuccessSystem.Reward50(), AchieveData.metaData.Count - 1); // remove reward50 SuccessSystem.isDirty = false; }