public TargetTaskInfo GetTargetTaskInfo(int type, int taskID) { TargetTaskInfo result = null; if (this.activityTargetTaskDic != null && this.activityTargetTaskDic.ContainsKey(type)) { List <TargetTaskInfo> list = this.activityTargetTaskDic.get_Item(type); if (list != null) { int num = list.FindIndex((TargetTaskInfo a) => a.targetID == taskID); if (num >= 0) { return(list.get_Item(num)); } } } return(result); }
public void UpdateData(TargetTaskInfo taskInfo) { if (taskInfo == null) { return; } if (this.activityTaskCfg == null) { this.activityTaskCfg = DataReader <KaiFuPaiMing> .Get(taskInfo.targetID); } this.roleNameText.set_text(string.Empty); List <RankingRoleInfo> roleRankingInfoListByTargetID = AcOpenServerManager.Instance.GetRoleRankingInfoListByTargetID(taskInfo.targetID); if (roleRankingInfoListByTargetID != null && roleRankingInfoListByTargetID.get_Count() > 0 && this.activityTaskCfg.objective != 1) { this.roleNameBtn.set_enabled(true); if (roleRankingInfoListByTargetID.get_Count() > 1) { this.roleNameText.set_text("点击查看名单\n____________"); } else if (roleRankingInfoListByTargetID.get_Count() == 1) { this.roleNameText.set_text(roleRankingInfoListByTargetID.get_Item(0).name); int num = Mathf.FloorToInt(this.roleNameText.get_preferredWidth()) / 10; num = ((num > 0) ? num : 1); string text = new string('_', num); this.roleNameText.set_text(roleRankingInfoListByTargetID.get_Item(0).name + "\n" + text); } } else if (this.activityTaskCfg.objective != 1 && roleRankingInfoListByTargetID != null && roleRankingInfoListByTargetID.get_Count() <= 0) { this.roleNameText.set_text("暂无"); } if (taskInfo.status == TargetTaskInfo.GetRewardStatus.HadGet) { this.hadGetRewardImg.set_enabled(true); this.notAttainImg.set_enabled(false); this.notGetRewardImg.set_enabled(false); this.hadEndImg.set_enabled(false); this.btnGet.get_gameObject().SetActive(false); } else if (taskInfo.status == TargetTaskInfo.GetRewardStatus.Unavailable) { int num2 = 0; if (DataReader <KaiFuHuoDong> .Contains(this.activityTaskCfg.Type)) { List <int> openDay = DataReader <KaiFuHuoDong> .Get(this.activityTaskCfg.Type).openDay; if (openDay != null && openDay.get_Count() > 0) { num2 = openDay.get_Item(openDay.get_Count() - 1); } } if (num2 < AcOpenServerManager.Instance.OpenServerDay) { this.btnGet.get_gameObject().SetActive(false); this.hadGetRewardImg.set_enabled(false); this.notGetRewardImg.set_enabled(false); this.notAttainImg.set_enabled(false); this.hadEndImg.set_enabled(true); } else { this.btnGet.get_gameObject().SetActive(false); this.hadGetRewardImg.set_enabled(false); this.notGetRewardImg.set_enabled(false); this.hadEndImg.set_enabled(false); this.notAttainImg.set_enabled(true); } } else if (taskInfo.status == TargetTaskInfo.GetRewardStatus.Available) { this.notAttainImg.set_enabled(false); this.hadGetRewardImg.set_enabled(false); this.notGetRewardImg.set_enabled(false); this.hadEndImg.set_enabled(false); this.btnGet.get_gameObject().SetActive(true); } else { this.btnGet.get_gameObject().SetActive(false); this.hadGetRewardImg.set_enabled(false); this.notAttainImg.set_enabled(false); this.hadEndImg.set_enabled(false); this.notGetRewardImg.set_enabled(true); } }