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();
            }
        }
Esempio n. 2
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();
            }
        }