protected override void OnRespond(respond_finish_quest respond, object userdata) { if (respond.result == (int)ERROR_CODE.ERR_QUEST_FINISH_OK) { FinishQuestEvent evt = new FinishQuestEvent(FinishQuestEvent.QUEST_FINISHED); if (respond.awards != null) { evt.mAwardInfo = respond.awards; } evt.mQuestId = Convert.ToInt32(userdata); PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); pdm.FinishQuest(evt.mQuestId); //GameDebug.Log("任务完成" + evt.mQuestId); if (!QuestHelper.IsInFightScene() && !QuestHelper.IsLoading()) { EventSystem.Instance.PushEvent(evt); } else { GameDebug.Log("完成任务缓存" + evt.mQuestId); QuestModule qm = ModuleManager.Instance.FindModule <QuestModule>(); qm.mEventCache.Enqueue(evt); } } else { // GameDebug.Log("任务完成失败"); } }
private bool FinishQuest(ObjectBase obj, respond_msg_gm respond) { if (!respond.rst) { return(false); } FinishQuestEvent evt = new FinishQuestEvent(FinishQuestEvent.QUEST_FINISHED); evt.mQuestId = Convert.ToInt32(respond.param1); PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); pdm.FinishQuest(evt.mQuestId); GameDebug.Log("gm 完成任务" + evt.mQuestId); if (!QuestHelper.IsInFightScene() && !QuestHelper.IsLoading()) { EventSystem.Instance.PushEvent(evt); } else { GameDebug.Log("gm任务缓存" + evt.mQuestId); QuestModule qm = ModuleManager.Instance.FindModule <QuestModule>(); qm.mEventCache.Enqueue(evt); } return(true); }