public void ShowTask(CTask task, CUIFormScript fromScript) { if (task == null || fromScript == null) { return; } this.taskID = task.m_baseId; if (this.taskTitle != null) { this.taskTitle.text = task.m_taskTitle; } if (this.taskDesc != null) { this.taskDesc.text = task.m_taskDesc; } this.taskIcon_back.CustomSetActive(true); this.taskIcon_front.CustomSetActive(true); if (task.m_resTask.bTaskIconShowType == 0) { this.taskIcon_front.GetComponent <Image>().enabled = false; this.taskIcon_back.GetComponent <Image>().enabled = true; this.taskIcon_back.GetComponent <Image>().SetSprite(task.m_resTask.szTaskBgIcon, fromScript, true, false, false, false); } else if (task.m_resTask.bTaskIconShowType == 1) { this.taskIcon_back.GetComponent <Image>().enabled = false; this.taskIcon_front.GetComponent <Image>().enabled = true; this.taskIcon_front.GetComponent <Image>().SetSprite(task.m_resTask.szTaskIcon, fromScript, true, false, false, false); } else { this.taskIcon_back.GetComponent <Image>().enabled = true; this.taskIcon_front.GetComponent <Image>().enabled = true; this.taskIcon_back.GetComponent <Image>().SetSprite(task.m_resTask.szTaskBgIcon, fromScript, true, false, false, false); this.taskIcon_front.GetComponent <Image>().SetSprite(task.m_resTask.szTaskIcon, fromScript, true, false, false, false); } this.award_obj.GetComponent <CUIEventScript>().m_onClickEventParams.tagUInt = this.taskID; this.award_obj.CustomSetActive(false); bool flag = this.taskID == Singleton <CTaskSys> .get_instance().monthCardTaskID || this.taskID == Singleton <CTaskSys> .get_instance().weekCardTaskID; if (task.m_taskState == 0 || task.m_taskState == 4) { CUIEventScript component = this.goto_obj.GetComponent <CUIEventScript>(); if (flag) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Mall_Open_Factory_Shop_Tab; } else { string text = string.Empty; for (int i = 0; i < task.m_prerequisiteInfo.Length; i++) { RES_PERREQUISITE_TYPE conditionType = task.m_prerequisiteInfo[i].m_conditionType; if (task.m_prerequisiteInfo[i].m_valueTarget > 0) { if (conditionType != 3 && conditionType != 13) { string text2 = text; text = string.Concat(new object[] { text2, task.m_prerequisiteInfo[i].m_value, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " }); this.progressObj.CustomSetActive(true); this.progress.gameObject.CustomSetActive(true); } else { this.progressObj.CustomSetActive(false); this.progress.gameObject.CustomSetActive(false); } if (!task.m_prerequisiteInfo[i].m_isReach) { if (conditionType == 2) { int iParam = task.m_resTask.astPrerequisiteArray[i].astPrerequisiteParam[3].iParam; if ((float)iParam == Mathf.Pow(2f, 0f)) { this.goto_obj.CustomSetActive(true); component.m_onClickEventParams.taskId = task.m_baseId; component.m_onClickEventParams.tag = task.m_resTask.astPrerequisiteArray[i].astPrerequisiteParam[4].iParam; component.m_onClickEventID = enUIEventID.Task_LinkPve; } else if ((float)iParam == Mathf.Pow(2f, 7f)) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Burn_OpenForm; } else if ((float)iParam == Mathf.Pow(2f, 8f)) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Arena_OpenForm; } } else if (conditionType == 1 || conditionType == 16) { this.goto_obj.CustomSetActive(true); if (task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[3].iParam == 16) { component.m_onClickEventID = enUIEventID.Matching_OpenLadder; } else { component.m_onClickEventID = enUIEventID.Matching_OpenEntry; component.m_onClickEventParams = new stUIEventParams { tag = 0 }; } } else if (conditionType == 6) { this.goto_obj.CustomSetActive(false); component.m_onClickEventID = enUIEventID.Friend_OpenForm; } else if (conditionType == 13) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Matching_OpenEntry; component.m_onClickEventParams = new stUIEventParams { tag = 0 }; } else if (conditionType == 17) { if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 2L) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Matching_OpenEntry; component.m_onClickEventParams = new stUIEventParams { tag = 3 }; } else { this.goto_obj.CustomSetActive(false); } } else if (conditionType == 20) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Arena_OpenForm; } else if (conditionType == 12) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Symbol_OpenForm; } else if (conditionType == 18) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Mall_Open_Factory_Shop_Tab; if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 1L) { component.m_onClickEventID = enUIEventID.HeroInfo_GotoMall; } if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 2L) { component.m_onClickEventID = enUIEventID.Mall_GoToSkinTab; } } else if (conditionType == 8) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Lottery_Open_Form; } else if (conditionType == 26) { this.goto_obj.CustomSetActive(true); if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 1L) { component.m_onClickEventID = enUIEventID.Mall_GotoDianmondTreasureTab; } else if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 2L) { component.m_onClickEventID = enUIEventID.Mall_GotoCouponsTreasureTab; } } else if (conditionType == 27) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Friend_OpenForm; } else { this.goto_obj.CustomSetActive(false); } } else { this.goto_obj.CustomSetActive(false); } } } if (this.progress != null) { this.progress.text = text; } } } else if (task.m_taskState == 1) { this.award_obj.CustomSetActive(true); this.goto_obj.CustomSetActive(false); } if (task.m_taskState == 1 || task.m_taskState == 3) { this.goto_obj.CustomSetActive(false); this.progressObj.CustomSetActive(false); this.progress.gameObject.CustomSetActive(false); } if (flag) { this.progress.gameObject.CustomSetActive(true); this.progressObj.CustomSetActive(true); this.progressObj.GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("RemainDays"); uint num = (this.taskID != Singleton <CTaskSys> .get_instance().monthCardTaskID) ? Singleton <CTaskSys> .get_instance().weekCardExpireTime : Singleton <CTaskSys> .get_instance().monthCardExpireTime; uint currentUTCTime = (uint)CRoleInfo.GetCurrentUTCTime(); int num2 = Mathf.CeilToInt(((num <= currentUTCTime) ? 0f : (num - currentUTCTime)) / 86400f); if (task.m_taskState == 3 && num2 > 0) { num2--; } this.progress.text = num2.ToString(); } else { this.progressObj.GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Progress"); } this.has_finish.CustomSetActive(task.m_taskState == 3); CTaskView.CTaskUT.ShowTaskAward(fromScript, task, this.m_awardContainer, 2); }
public List <CFriendMentorTaskView.TaskViewConditionData> CalcParam(CTask task, GameObject goto_obj, bool isMonthWeekCard = false) { if (task == null) { return(null); } for (int i = 0; i < this.taskViewConditionDataList.get_Count(); i++) { this.taskViewConditionDataList.get_Item(i).Clear(); } this.taskViewConditionDataList.Clear(); if (isMonthWeekCard) { goto_obj.CustomSetActive(true); CFriendMentorTaskView.TaskViewConditionData taskViewConditionData = default(CFriendMentorTaskView.TaskViewConditionData); taskViewConditionData.bValid = true; taskViewConditionData.m_onClickEventID = enUIEventID.Mall_Open_Factory_Shop_Tab; this.taskViewConditionDataList.Add(taskViewConditionData); taskViewConditionData.bShowGoToBtn = true; } else { for (int j = 0; j < task.m_prerequisiteInfo.Length; j++) { CFriendMentorTaskView.TaskViewConditionData taskViewConditionData2 = default(CFriendMentorTaskView.TaskViewConditionData); taskViewConditionData2.bValid = false; taskViewConditionData2.bFinish = task.m_prerequisiteInfo[j].m_isReach; ResDT_PrerequisiteInTask resDT_PrerequisiteInTask = task.m_resTask.astPrerequisiteArray[j]; taskViewConditionData2.condition = resDT_PrerequisiteInTask.szPrerequisiteDesc; RES_PERREQUISITE_TYPE conditionType = task.m_prerequisiteInfo[j].m_conditionType; if (task.m_prerequisiteInfo[j].m_valueTarget > 0) { taskViewConditionData2.bValid = true; if (conditionType != 3 && conditionType != 13) { taskViewConditionData2.progress = string.Concat(new object[] { task.m_prerequisiteInfo[j].m_value, "/", task.m_prerequisiteInfo[j].m_valueTarget, " " }); } if (!task.m_prerequisiteInfo[j].m_isReach) { if (conditionType == 2) { int iParam = task.m_resTask.astPrerequisiteArray[j].astPrerequisiteParam[3].iParam; if ((float)iParam == Mathf.Pow(2f, 0f)) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.taskId = task.m_baseId; taskViewConditionData2.tag = task.m_resTask.astPrerequisiteArray[j].astPrerequisiteParam[4].iParam; taskViewConditionData2.m_onClickEventID = enUIEventID.Task_LinkPve; } else if ((float)iParam == Mathf.Pow(2f, 7f)) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Burn_OpenForm; } else if ((float)iParam == Mathf.Pow(2f, 8f)) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Arena_OpenForm; } } else if (conditionType == 1 || conditionType == 16) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Matching_OpenEntry; taskViewConditionData2.tag = 0; } else if (conditionType == 6) { goto_obj.CustomSetActive(false); taskViewConditionData2.bShowGoToBtn = false; taskViewConditionData2.m_onClickEventID = enUIEventID.Friend_OpenForm; } else if (conditionType == 13) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Matching_OpenEntry; taskViewConditionData2.tag = 0; } else if (conditionType == 17) { if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 2L) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Matching_OpenEntry; taskViewConditionData2.tag = 3; } else { goto_obj.CustomSetActive(false); taskViewConditionData2.bShowGoToBtn = false; } } else if (conditionType == 20) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Arena_OpenForm; } else if (conditionType == 12) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Symbol_OpenForm; } else if (conditionType == 18) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Mall_Open_Factory_Shop_Tab; } else if (conditionType == 8) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Lottery_Open_Form; } else if (conditionType == 26) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 1L) { taskViewConditionData2.m_onClickEventID = enUIEventID.Mall_GotoDianmondTreasureTab; } else if ((long)task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 2L) { taskViewConditionData2.m_onClickEventID = enUIEventID.Mall_GotoCouponsTreasureTab; } } else if (conditionType == 27) { goto_obj.CustomSetActive(true); taskViewConditionData2.bShowGoToBtn = true; taskViewConditionData2.m_onClickEventID = enUIEventID.Friend_OpenForm; } else { goto_obj.CustomSetActive(false); taskViewConditionData2.bShowGoToBtn = false; } } else { goto_obj.CustomSetActive(false); taskViewConditionData2.bShowGoToBtn = false; } } this.taskViewConditionDataList.Add(taskViewConditionData2); } } return(this.taskViewConditionDataList); }
public void ShowTask(CTask task, CUIFormScript fromScript) { if ((task != null) && (fromScript != null)) { this.taskID = task.m_baseId; if (this.taskTitle != null) { this.taskTitle.text = task.m_taskTitle; } if (this.taskDesc != null) { this.taskDesc.text = task.m_taskDesc; } this.taskIcon_back.CustomSetActive(true); this.taskIcon_front.CustomSetActive(true); if (task.m_resTask.bTaskIconShowType == 0) { this.taskIcon_front.GetComponent <Image>().enabled = false; this.taskIcon_back.GetComponent <Image>().enabled = true; this.taskIcon_back.GetComponent <Image>().SetSprite(task.m_resTask.szTaskBgIcon, fromScript, true, false, false); } else if (task.m_resTask.bTaskIconShowType == 1) { this.taskIcon_back.GetComponent <Image>().enabled = false; this.taskIcon_front.GetComponent <Image>().enabled = true; this.taskIcon_front.GetComponent <Image>().SetSprite(task.m_resTask.szTaskIcon, fromScript, true, false, false); } else { this.taskIcon_back.GetComponent <Image>().enabled = true; this.taskIcon_front.GetComponent <Image>().enabled = true; this.taskIcon_back.GetComponent <Image>().SetSprite(task.m_resTask.szTaskBgIcon, fromScript, true, false, false); this.taskIcon_front.GetComponent <Image>().SetSprite(task.m_resTask.szTaskIcon, fromScript, true, false, false); } this.award_obj.GetComponent <CUIEventScript>().m_onClickEventParams.tagUInt = this.taskID; this.award_obj.CustomSetActive(false); bool flag = (this.taskID == Singleton <CTaskSys> .instance.monthCardTaskID) || (this.taskID == Singleton <CTaskSys> .instance.weekCardTaskID); if ((task.m_taskState == 0) || (task.m_taskState == 4)) { CUIEventScript component = this.goto_obj.GetComponent <CUIEventScript>(); if (flag) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Mall_Open_Factory_Shop_Tab; } else { string str = string.Empty; for (int i = 0; i < task.m_prerequisiteInfo.Length; i++) { RES_PERREQUISITE_TYPE conditionType = (RES_PERREQUISITE_TYPE)task.m_prerequisiteInfo[i].m_conditionType; if (task.m_prerequisiteInfo[i].m_valueTarget > 0) { if ((conditionType != RES_PERREQUISITE_TYPE.RES_PERREQUISITE_ACNTLVL) && (conditionType != RES_PERREQUISITE_TYPE.RES_PERREQUISITE_PVPLVL)) { string str2 = str; object[] objArray1 = new object[] { str2, task.m_prerequisiteInfo[i].m_value, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " }; str = string.Concat(objArray1); this.progressObj.CustomSetActive(true); } else { this.progressObj.CustomSetActive(false); } if (!task.m_prerequisiteInfo[i].m_isReach) { switch (conditionType) { case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_STAGECLEARPVP: case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_PVPKILLCNT: { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Matching_OpenEntry; stUIEventParams @params = new stUIEventParams { tag = 0 }; component.m_onClickEventParams = @params; continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_STAGECLEARPVE: { int iParam = task.m_resTask.astPrerequisiteArray[i].astPrerequisiteParam[3].iParam; if (iParam == Mathf.Pow(2f, 0f)) { this.goto_obj.CustomSetActive(true); component.m_onClickEventParams.taskId = task.m_baseId; component.m_onClickEventParams.tag = task.m_resTask.astPrerequisiteArray[i].astPrerequisiteParam[4].iParam; component.m_onClickEventID = enUIEventID.Task_LinkPve; } else if (iParam == Mathf.Pow(2f, 7f)) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Burn_OpenForm; } else if (iParam == Mathf.Pow(2f, 8f)) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Arena_OpenForm; } continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_FRIENDCNT: { this.goto_obj.CustomSetActive(false); component.m_onClickEventID = enUIEventID.Friend_OpenForm; continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_PVPLVL: { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Matching_OpenEntry; stUIEventParams params2 = new stUIEventParams { tag = 0 }; component.m_onClickEventParams = params2; continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_GUILDOPT: { if (task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 2L) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Matching_OpenEntry; stUIEventParams params3 = new stUIEventParams { tag = 3 }; component.m_onClickEventParams = params3; } else { this.goto_obj.CustomSetActive(false); } continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_ARENAOPT: { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Arena_OpenForm; continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_SYMBOLCOMP: { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Symbol_OpenForm; continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_BUYOPT: { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Mall_Open_Factory_Shop_Tab; continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_OPENBOXCNT: { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Mall_GoToSymbolTab; continue; } case RES_PERREQUISITE_TYPE.RES_PERREQUISITE_DUOBAO: { this.goto_obj.CustomSetActive(true); if (task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 1L) { component.m_onClickEventID = enUIEventID.Mall_GotoDianmondTreasureTab; } else if (task.m_resTask.astPrerequisiteArray[0].astPrerequisiteParam[1].iParam == 2L) { component.m_onClickEventID = enUIEventID.Mall_GotoCouponsTreasureTab; } continue; } } if (conditionType == RES_PERREQUISITE_TYPE.RES_PERREQUISITE_RECALLFRIEND) { this.goto_obj.CustomSetActive(true); component.m_onClickEventID = enUIEventID.Friend_OpenForm; } else { this.goto_obj.CustomSetActive(false); } } else { this.goto_obj.CustomSetActive(false); } } } if (this.progress != null) { this.progress.text = str; } } } else if (task.m_taskState == 1) { this.award_obj.CustomSetActive(true); this.goto_obj.CustomSetActive(false); } if ((task.m_taskState == 1) || (task.m_taskState == 3)) { this.goto_obj.CustomSetActive(false); this.progressObj.CustomSetActive(false); } if (flag) { this.progressObj.CustomSetActive(true); this.progressObj.GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("RemainDays"); uint num3 = (this.taskID != Singleton <CTaskSys> .instance.monthCardTaskID) ? Singleton <CTaskSys> .instance.weekCardExpireTime : Singleton <CTaskSys> .instance.monthCardExpireTime; uint currentUTCTime = (uint)CRoleInfo.GetCurrentUTCTime(); int num5 = Mathf.CeilToInt(((num3 <= currentUTCTime) ? 0f : ((float)(num3 - currentUTCTime))) / 86400f); if ((task.m_taskState == 3) && (num5 > 0)) { num5--; } this.progress.text = num5.ToString(); } else { this.progressObj.GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Progress"); } this.has_finish.CustomSetActive(task.m_taskState == 3); CTaskView.CTaskUT.ShowTaskAward(fromScript, task, this.m_awardContainer); } }