public void OnUSUALTASK_RES(ref CSPkg pkg)
        {
            SCDT_USUTASKLIST stUsualTaskList = pkg.stPkgData.stUsualTaskRes.stUpdateDetail.stUsualTaskList;

            for (int i = 0; i < (int)stUsualTaskList.bNewUsualTaskCnt; i++)
            {
                DT_USUTASKINFO dT_USUTASKINFO = stUsualTaskList.astNewUsualTask[i];
                if (dT_USUTASKINFO.bIsNew == 1)
                {
                    this.model.Remove(dT_USUTASKINFO.dwTaskID);
                    CTask cTask = TaskUT.Create_Task(dT_USUTASKINFO.dwTaskID);
                    if (cTask != null)
                    {
                        cTask.SetState(CTask.State.NewRefresh);
                        TaskUT.Add_Task(cTask);
                    }
                }
            }
            this.UpdateTaskState();
            Singleton <EventRouter> .instance.BroadCastEvent("TaskUpdated");

            if (this.m_taskView != null)
            {
                this.m_taskView.Refresh();
            }
        }
Beispiel #2
0
        public bool IsTaskIDAfterThisTask(uint after_taskid)
        {
            if (this.m_resTask.NextTaskID[0] == 0)
            {
                return(false);
            }
            if (this.m_resTask.NextTaskID[0] == after_taskid)
            {
                return(true);
            }
            CTask task = Singleton <CTaskSys> .instance.model.GetTask(this.m_resTask.NextTaskID[0]);

            if (task != null)
            {
                return(task.IsTaskIDAfterThisTask(after_taskid));
            }
            CTask task2 = TaskUT.Create_Task(this.m_resTask.NextTaskID[0]);

            return((task2 != null) && task2.IsTaskIDAfterThisTask(after_taskid));
        }
Beispiel #3
0
        public bool IsTaskIDAfterThisTask(uint after_taskid)
        {
            if (this.m_resTask.NextTaskID[0] == 0u)
            {
                return(false);
            }
            if (this.m_resTask.NextTaskID[0] == after_taskid)
            {
                return(true);
            }
            CTask task = Singleton <CTaskSys> .get_instance().model.GetTask(this.m_resTask.NextTaskID[0]);

            if (task != null)
            {
                return(task.IsTaskIDAfterThisTask(after_taskid));
            }
            CTask cTask = TaskUT.Create_Task(this.m_resTask.NextTaskID[0]);

            return(cTask != null && cTask.IsTaskIDAfterThisTask(after_taskid));
        }
Beispiel #4
0
        public void OnSCID_NEWTASKGET_NTF(ref CSPkg pkg)
        {
            SCPKG_NEWTASKGET_NTF stNewTaskGet = pkg.stPkgData.stNewTaskGet;

            for (int i = 0; i < stNewTaskGet.dwTaskCnt; i++)
            {
                SCDT_NEWTASKGET scdt_newtaskget = stNewTaskGet.astNewTask[i];
                CTask           task            = TaskUT.Create_Task(scdt_newtaskget.dwTaskID);
                DebugHelper.Assert(task.m_taskType == scdt_newtaskget.dwTaskType, "OnSCID_NEWTASKGET_NTF task.m_taskType == info.dwTaskType");
                if (task != null)
                {
                    this.model.AddTask(task);
                }
            }
            Singleton <EventRouter> .instance.BroadCastEvent("TaskUpdated");

            if (this.m_taskView != null)
            {
                this.m_taskView.Refresh();
            }
        }
        public void OnInitTask(CSPkg pkg)
        {
            SCPKG_CMD_GAMELOGINRSP stGameLoginRsp = pkg.stPkgData.stGameLoginRsp;
            int num = 0;

            while ((long)num < (long)((ulong)stGameLoginRsp.stLoginTaskInfo.dwCurtaskNum))
            {
                COMDT_ACNT_CURTASK cOMDT_ACNT_CURTASK = stGameLoginRsp.stLoginTaskInfo.astCurtask[num];
                CTask cTask = TaskUT.Create_Task(cOMDT_ACNT_CURTASK.dwBaseID);
                if (cTask != null)
                {
                    cTask.SetState(cOMDT_ACNT_CURTASK.bTaskState);
                    TaskUT.Add_Task(cTask);
                    for (int i = 0; i < (int)cOMDT_ACNT_CURTASK.bPrerequisiteNum; i++)
                    {
                        int  bPosInArray = (int)cOMDT_ACNT_CURTASK.astPrerequisiteInfo[i].bPosInArray;
                        bool flag        = cOMDT_ACNT_CURTASK.astPrerequisiteInfo[i].bIsReach > 0;
                        if (flag)
                        {
                            cTask.m_prerequisiteInfo[bPosInArray].m_value = cTask.m_prerequisiteInfo[bPosInArray].m_valueTarget;
                        }
                        else
                        {
                            cTask.m_prerequisiteInfo[bPosInArray].m_value = (int)cOMDT_ACNT_CURTASK.astPrerequisiteInfo[i].dwCnt;
                        }
                        cTask.m_prerequisiteInfo[bPosInArray].m_isReach = flag;
                    }
                    this.ParseMentorTask(cTask);
                }
                num++;
            }
            this.UpdateTaskState();
            this.model.ParseCltCalcCompletedTasks(ref stGameLoginRsp.stLoginTaskInfo.MainTaskIDs);
            Singleton <EventRouter> .instance.BroadCastEvent("TaskUpdated");

            if (this.m_taskView != null)
            {
                this.m_taskView.Refresh();
            }
        }
Beispiel #6
0
        public void OnInitTask(CSPkg pkg)
        {
            SCPKG_CMD_GAMELOGINRSP stGameLoginRsp = pkg.stPkgData.stGameLoginRsp;

            for (int i = 0; i < stGameLoginRsp.stLoginTaskInfo.dwCurtaskNum; i++)
            {
                COMDT_ACNT_CURTASK comdt_acnt_curtask = stGameLoginRsp.stLoginTaskInfo.astCurtask[i];
                CTask task = TaskUT.Create_Task(comdt_acnt_curtask.dwBaseID);
                if (task != null)
                {
                    task.SetState(comdt_acnt_curtask.bTaskState);
                    TaskUT.Add_Task(task);
                    for (int j = 0; j < comdt_acnt_curtask.bPrerequisiteNum; j++)
                    {
                        int  bPosInArray = comdt_acnt_curtask.astPrerequisiteInfo[j].bPosInArray;
                        bool flag        = comdt_acnt_curtask.astPrerequisiteInfo[j].bIsReach > 0;
                        if (flag)
                        {
                            task.m_prerequisiteInfo[bPosInArray].m_value = task.m_prerequisiteInfo[bPosInArray].m_valueTarget;
                        }
                        else
                        {
                            task.m_prerequisiteInfo[bPosInArray].m_value = (int)comdt_acnt_curtask.astPrerequisiteInfo[j].dwCnt;
                        }
                        task.m_prerequisiteInfo[bPosInArray].m_isReach = flag;
                    }
                }
            }
            this.UpdateTaskState();
            this.model.ParseCltCalcCompletedTasks(ref stGameLoginRsp.stLoginTaskInfo.MainTaskIDs);
            Singleton <EventRouter> .instance.BroadCastEvent("TaskUpdated");

            if (this.m_taskView != null)
            {
                this.m_taskView.Refresh();
            }
        }
        public void OnSCID_NEWTASKGET_NTF(ref CSPkg pkg)
        {
            SCPKG_NEWTASKGET_NTF stNewTaskGet = pkg.stPkgData.stNewTaskGet;
            int num = 0;

            while ((long)num < (long)((ulong)stNewTaskGet.dwTaskCnt))
            {
                SCDT_NEWTASKGET sCDT_NEWTASKGET = stNewTaskGet.astNewTask[num];
                CTask           cTask           = TaskUT.Create_Task(sCDT_NEWTASKGET.dwTaskID);
                DebugHelper.Assert(cTask.m_taskType == sCDT_NEWTASKGET.dwTaskType, "OnSCID_NEWTASKGET_NTF task.m_taskType == info.dwTaskType");
                if (cTask != null)
                {
                    this.model.AddTask(cTask);
                }
                this.ParseMentorTask(cTask);
                num++;
            }
            Singleton <EventRouter> .instance.BroadCastEvent("TaskUpdated");

            if (this.m_taskView != null)
            {
                this.m_taskView.Refresh();
            }
        }
        public void RefreshAwakeTaskForm()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_heroAwakeTaskFormPath);

            if (form != null)
            {
                Image      component  = form.transform.Find("Panel/PanelLeft/HeroCell/Hero").GetComponent <Image>();
                Text       text       = form.transform.Find("Panel/PanelLeft/lblTitle").GetComponent <Text>();
                Transform  transform  = form.transform.Find("Panel/PanelLeft/lblState");
                Text       text2      = form.transform.Find("Panel/PanelLeft/lblContent").GetComponent <Text>();
                Button     btn        = form.transform.Find("Panel/PanelLeft/btnReciveTask").GetComponent <Button>();
                Transform  transform2 = form.transform.Find("Panel/PanelLeft/panelType1");
                Text       text3      = transform2.Find("lblTaskDesc").GetComponent <Text>();
                Transform  transform3 = transform2.Find("itemInfo/itemCell");
                Text       text4      = transform2.Find("itemInfo/lblName").GetComponent <Text>();
                Text       text5      = transform2.Find("itemInfo/lblProce").GetComponent <Text>();
                Button     button2    = transform2.Find("itemInfo/btnReciveTask").GetComponent <Button>();
                Button     button3    = transform2.Find("getInfo/btnReciveTask").GetComponent <Button>();
                Transform  transform4 = form.transform.Find("Panel/PanelLeft/panelType2");
                Text       text6      = transform4.Find("taskInfo/lblTaskDesc").GetComponent <Text>();
                Text       text7      = transform4.Find("taskInfo/lblProce").GetComponent <Text>();
                GameObject prefab     = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_BustHero_Dir + StringHelper.UTF8BytesToString(ref this.m_heroInfo.cfgInfo.szImagePath), true, true);
                component.SetSprite(prefab);
                ResHeroWakeInfo dataByKey = GameDataMgr.heroAwakDatabin.GetDataByKey(GameDataMgr.GetDoubleKey(this.m_heroInfo.cfgInfo.dwCfgID, this.m_heroInfo.m_awakeStepID));
                if (dataByKey != null)
                {
                    text.text  = StringHelper.UTF8BytesToString(ref dataByKey.szWakeTitle);
                    text2.text = StringHelper.UTF8BytesToString(ref dataByKey.szWakeDesc);
                    CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (masterRoleInfo != null)
                    {
                        if (dataByKey.bOptType == 1)
                        {
                            transform2.gameObject.CustomSetActive(true);
                            transform4.gameObject.CustomSetActive(false);
                            CUseable        itemUseable       = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, (uint)dataByKey.OptParam[1], 0);
                            int             useableStackCount = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM).GetUseableStackCount(itemUseable.m_type, itemUseable.m_baseID);
                            stUIEventParams eventParams       = new stUIEventParams {
                                iconUseable = itemUseable
                            };
                            itemUseable.m_stackCount = dataByKey.OptParam[2];
                            string[] args = new string[] { itemUseable.m_stackCount.ToString(), itemUseable.m_name };
                            text3.text = Singleton <CTextManager> .instance.GetText("HeroAwake_Tips4", args);

                            text4.text = itemUseable.m_name;
                            CUICommonSystem.SetItemCell(form, transform3.gameObject, itemUseable, true, false);
                            if (useableStackCount >= itemUseable.m_stackCount)
                            {
                                button2.gameObject.CustomSetActive(false);
                                transform.gameObject.CustomSetActive(true);
                                CUICommonSystem.SetButtonEnable(btn, true, true, true);
                                text5.text = string.Format("{0}/{1}", useableStackCount, itemUseable.m_stackCount);
                            }
                            else
                            {
                                button2.gameObject.CustomSetActive(true);
                                transform.gameObject.CustomSetActive(false);
                                CUICommonSystem.SetButtonEnable(btn, false, false, true);
                                text5.text = string.Format("<color=red>{0}</color>/{1}", useableStackCount, itemUseable.m_stackCount);
                                CUIEventScript script2 = button2.GetComponent <CUIEventScript>();
                                if (script2 != null)
                                {
                                    script2.SetUIEvent(enUIEventType.Click, enUIEventID.HeroInfo_Material_Direct_Buy, eventParams);
                                }
                            }
                            CUIEventScript script3 = button3.GetComponent <CUIEventScript>();
                            if (script3 != null)
                            {
                                script3.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemSourceInfoOpen, eventParams);
                            }
                        }
                        else
                        {
                            transform2.gameObject.CustomSetActive(false);
                            transform4.gameObject.CustomSetActive(true);
                            int   num2 = dataByKey.OptParam[0];
                            CTask task = Singleton <CTaskSys> .instance.model.GetTask((uint)num2);

                            if (task == null)
                            {
                                task = TaskUT.Create_Task((uint)num2);
                                if (task == null)
                                {
                                    return;
                                }
                                task.SetState(CTask.State.None);
                            }
                            if (task != null)
                            {
                                text6.text = UT.Bytes2String(task.m_resTask.szTaskDesc);
                                string str = "    ";
                                for (int i = 0; i < task.m_prerequisiteInfo.Length; i++)
                                {
                                    if (task.m_prerequisiteInfo[i].m_valueTarget > 0)
                                    {
                                        string str2;
                                        if (!this.m_heroInfo.m_isStepFinish)
                                        {
                                            str2 = str;
                                            object[] objArray1 = new object[] { str2, task.m_prerequisiteInfo[i].m_value, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " };
                                            str = string.Concat(objArray1);
                                        }
                                        else
                                        {
                                            str2 = str;
                                            object[] objArray2 = new object[] { str2, task.m_prerequisiteInfo[i].m_valueTarget, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " };
                                            str = string.Concat(objArray2);
                                        }
                                        break;
                                    }
                                }
                                text7.text = str;
                            }
                            if (this.m_heroInfo.m_isStepFinish || (task.m_taskState == 3))
                            {
                                transform.gameObject.CustomSetActive(true);
                                CUICommonSystem.SetButtonEnable(btn, true, true, true);
                            }
                            else
                            {
                                transform.gameObject.CustomSetActive(false);
                                CUICommonSystem.SetButtonEnable(btn, false, false, true);
                            }
                        }
                    }
                }
            }
        }