예제 #1
0
        public MTBTaskCacheData()
        {
            firstInitMark = false;
            EventManager.RegisterEvent(EventMacro.FIRST_INIT_TASK, onFirstInitTask);
            initMark = false;
            if (!checkCanInitTask())
            {
                canConductTaskList = new Dictionary <int, MTBTaskData>();
                initMark           = true;
                return;
            }
            taskCacheData data = MTBTaskCacheDataLoader.loadData();

            if (data.taskId <= 1 && data.stepId == 0)
            {
                int[]     picIds    = { 1, 2 };
                ComicInfo comicinfo = new ComicInfo(picIds, 7);
                MTBComicController.Instance.playComicByTime(comicinfo);
            }
            canConductTaskList = data.canConductTaskList;
            PrepareInitNpcMap  = data.PrepareInitNpcMap;
            curStep            = data.stepId;
            if (data.taskId != 0)
            {
                curConDuctTaskData = canConductTaskList[data.taskId];
            }
            initMark = true;
            if (firstInitMark)
            {
                initNpc();
            }
        }
예제 #2
0
        public void addPrepareInitNpc(NPCInfo info)
        {
            if (!MTBTaskController.Instance.taskCacherData.PrepareInitNpcMap.ContainsKey(info.position))
            {
                MTBTaskController.Instance.taskCacherData.PrepareInitNpcMap.Add(info.position, info);
            }
            else
            {
                MTBTaskController.Instance.taskCacherData.PrepareInitNpcMap[info.position] = info;
            }
            taskCacheData data = MTBTaskCacheDataLoader.loadData();

            data.PrepareInitNpcMap = PrepareInitNpcMap;
            MTBTaskCacheDataLoader.saveData(data);
        }
예제 #3
0
 public bool finishStep(int taskId, int stepId)
 {
     if (taskId == 0 || stepId == 0)
     {
         return(false);
     }
     if (canConductTaskList.ContainsKey(taskId))
     {
         taskCacheData data = MTBTaskCacheDataLoader.loadData();
         data.canConductTaskList = canConductTaskList;
         data.taskId             = taskId;
         data.stepId             = stepId + 1;
         MTBTaskCacheDataLoader.saveData(data);
         return(true);
     }
     return(false);
 }
예제 #4
0
        /***
         * 附带刷每个任务接取npc
         * ***/
        private void checkAndInitTask(int taskId)
        {
            if (taskId == 0)
            {
                return;
            }
            if (!canConductTaskList.ContainsKey(taskId))
            {
                canConductTaskList.Add(taskId, MTBTaskDataManager.Instance.getData(taskId));
            }
            taskCacheData data = MTBTaskCacheDataLoader.loadData();

            data.canConductTaskList = canConductTaskList;
            data.taskId             = taskId;
            data.stepId             = 0;
            MTBTaskCacheDataLoader.saveData(data);
            HasActionObjectManager.Instance.npcManager.InitNPC(taskId, 1);
        }