public void ChangeState(PAchieve info) { if (info.isDraw) { //已经领取 my_value.text = should_value.text; get_btn.gameObject.SetActive(false); alreadly_getimg.gameObject.SetActive(true); progress_value.fillAmount = 1.0f; } else { if (Module_Active.instance.CanGetList[info.id]) { //可领取未领取 get_btn.gameObject.SetActive(true); alreadly_getimg.gameObject.SetActive(false); } else { get_btn.gameObject.SetActive(false); alreadly_getimg.gameObject.SetActive(false); } } }
void _Packet(ScHistoryAchieveReward p)//成就奖励领取结果 { moduleGlobal.UnLockUI(); if (p.result == 0)//成功 { for (int i = 0; i < Achieveinfo.Count; i++) { if (p.id == Achieveinfo[i].id) { Achieveinfo[i].isDraw = true; //已领取状态 } } SortAchieve(); PAchieve pinfo = Achieveinfo.Find(a => a.id == p.id); DispatchModuleEvent(EventActiveAchieveGet, pinfo); } else if (p.result == 1) { moduleGlobal.ShowMessage(223, 28); } else if (p.result == 2) { moduleGlobal.ShowMessage(223, 29); } else if (p.result == 3) { moduleGlobal.ShowMessage(223, 30); } else { Logger.LogError("Get Achieve Award Error"); } }
private void AchieveInfoSet(RectTransform rt, PAchieve Dinfo) { AchievementInfo achieveInfo = rt.gameObject.GetComponentDefault <AchievementInfo>(); achieveInfo.Click(Achievementsend, Dinfo.id); achieveInfo.SetInfo(Dinfo); }
public void SetInfo(PAchieve info) { restrainId = info.id; Util.SetText(taskname, Util.Parse <int>(info.name)); Util.SetText(taskdetail, info.desc); Settype(info.achieveLv);//显示等级 progress.gameObject.SetActive(true); my_value.text = info.finishVal.ToString(); should_value.text = info.condition.ToString(); if (info.type == 17) { double a = info.finishVal / 3600; double b = info.condition / 3600; my_value.text = (Math.Floor(a)).ToString(); should_value.text = (Math.Floor(b)).ToString(); } else { should_value.text = info.condition.ToString(); } if (!info.hasBar) { should_value.text = "1"; if (!Module_Active.instance.CanGetList[info.id]) { my_value.text = "0"; } else { my_value.text = "1"; } } ChangeValue(Util.Parse <int>(my_value.text));//设置进度条 ChangeState(info); get_btn.onClick.RemoveAllListeners(); get_btn.onClick.AddListener(AwardGet); //奖励 AwardGetSucced succed = reward_group.GetComponentDefault <AwardGetSucced>(); succed.SetAward(info.reward, child); }
void _Packet(ScHistoryAchieveFinish p)//不可领取变为可领取 { ScHistoryAchieveFinish info = p.Clone(); for (int i = 0; i < Achieveinfo.Count; i++) { if (Achieveinfo[i].id == info.id) { CanGetList[info.id] = true;//这个id的成就现在已经可以领取 ShowAchieveHint = true; Achieveinfo[i].finishVal = info.finishVal; //满足了 改变状态 PAchieve infoa = Achieveinfo[i]; Achieveinfo.Remove(Achieveinfo[i]); Achieveinfo.Insert(0, infoa); DispatchModuleEvent(EventActiveAchieveCanGet, infoa); moduleHome.UpdateIconState(HomeIcons.Quest, true);//判断是否要有红点 } } }
void _ME(ModuleEvent <Module_Active> e) { switch (e.moduleEvent) { case Module_Active.EventActiveCoopInvate: //接到可邀请列表 OpenInvatePlane(); break; case Module_Active.EventActiveCoopInfo: //所有任务 SetCoolPlane(); SetHint(); break; case Module_Active.EventActiveCoopInvateSuc: //邀请成功 var invate = Util.Parse <int>(e.param1.ToString()); CoopAllInfo.UpdateItem(invate); break; case Module_Active.EventActiveCoopKiced: //踢出成功 var kiced = Util.Parse <int>(e.param1.ToString()); CoopAllInfo.UpdateItem(kiced); break; case Module_Active.EventActiveCoopBeKiced: //被踢出 CoopAllInfo.SetItems(moduleActive.CoopTaskList); break; case Module_Active.EventActiveCoopValue: //进度变化 var value = Util.Parse <int>(e.param1.ToString()); CoopAllInfo.UpdateItem(value); break; case Module_Active.EventActiveCoopCanGet: //可领取 var get = Util.Parse <int>(e.param1.ToString()); CoopAllInfo.UpdateItem(get); SetHint(); break; case Module_Active.EventActiveCoopGet: //领取成功 var succed = Util.Parse <int>(e.param1.ToString()); PItem2[] reward = e.param2 as PItem2[]; CoopAllInfo.UpdateItem(succed); if (actived && reward != null) { Window_ItemTip.Show(active_text[59], reward); } break; case Module_Active.EventActiveCoopApply: CoopAllInfo.SetItems(moduleActive.CoopTaskList); break; case Module_Active.EventActiveDayInfo: //上线接收日常详情 DailyAllInfo.SetItems(moduleActive.DailyOpenList); NoDailyTask(); SetHint(); break; case Module_Active.EventActiveDayValue: // 日常进度值有变化 PDailyInfo info = e.msg as PDailyInfo; int index = GetDIndex(info.taskId); if (index != -1) { DailyAllInfo.SetItem(info, index); } break; case Module_Active.EventActiveDayReach: //日常任务达成可以领取奖励 PDailyInfo cinfo = e.msg as PDailyInfo; DailyAllInfo.RemoveItem(cinfo); DailyAllInfo.AddItem(cinfo, 0); DailyAllInfo.UpdateItems(); SetHint(); break; case Module_Active.EventActiveDayGet: //日常任务奖励领取成功 PDailyInfo dinfo = e.param1 as PDailyInfo; PDailyTask tinfo = e.param2 as PDailyTask; DailyAllInfo.RemoveItem(dinfo); GetAwardShow(tinfo.reward); ActiveNum(); //更改今日活跃度进度值 NoDailyTask(); break; case Module_Active.EventActiveDayOpen: //日常任务开启类似早午餐那种 DailyAllInfo.UpdateItems(); NoDailyTask(); SetHint(); break; case Module_Active.EventActiveDayClose: //日常任务过期了 直接删掉 PDailyInfo overinfo = e.param1 as PDailyInfo; DailyAllInfo.RemoveItem(overinfo); NoDailyTask(); SetHint(); break; case Module_Active.EventActiveAchieveInfo: //上线接收成就详情每次都刷新 AchieveAllInfo.SetItems(moduleActive.Achieveinfo); SetHint(); break; case Module_Active.EventActiveAchieveValue: //进度值变化 PAchieve pinfo = e.msg as PAchieve; int pindex = GetPIndex(pinfo.id); if (pindex != -1) { AchieveAllInfo.SetItem(pinfo, pindex); } break; case Module_Active.EventActiveAchieveCanGet: //成就达成可领取奖励调用同一个方法 PAchieve ainfo = e.msg as PAchieve; AchieveAllInfo.RemoveItem(ainfo); AchieveAllInfo.AddItem(ainfo, 0); SetHint(); break; case Module_Active.EventActiveAchieveGet: //成就奖励领取完毕调用同一个方法 PAchieve ainfo1 = e.msg as PAchieve; GetAwardShow(ainfo1.reward, true); AchieveAllInfo.SetItems(moduleActive.Achieveinfo); break; case Module_Active.EventActiveAchieveOpen: //某些活动开启 删掉重新创建 AchieveAllInfo.UpdateItems(); SetHint(); break; case Module_Active.EventActiveDailyCanGet: // 日活跃度可以领取奖励 PActiveBox activeindo = e.msg as PActiveBox; ActiveShua(activeindo); //可领取 SetHint(); break; case Module_Active.EventActiveDailyGet: //日常活跃度奖励领取成功 award_plane.gameObject.SetActive(false); PActiveBox activeinfos = e.msg as PActiveBox; ActiveShua(activeinfos); //可领取 Activetask(); GetAwardShow(activeinfos.reward); break; case Module_Active.EventActiveWeekCanGet: //周活跃度达成可以领取奖励 PActiveBox WCanInfo = e.msg as PActiveBox; WhichShua(WCanInfo.id); SetHint(); break; case Module_Active.EventActiveWeekGet: //周活跃度奖励领取成功 PActiveBox WInfo = e.msg as PActiveBox; award_plane.gameObject.SetActive(false); WhichShua(WInfo.id); GetAwardShow(WInfo.reward); break; default: break; } }