public void OnSyncFinishQuestRespond(int missionID, int resultCode) { if (resultCode == (int)KQuestResultCode.qrcSuccess) { bool bAutoContinue = false; MissionInfo vo = GetMissionByID(missionID); if (vo != null && vo.type == (int)MissionInfo.MissionType.MainMission) { bAutoContinue = true; } hasCompleteIDs.Add(missionID); unCompleteIDs.Remove(missionID); RemoveFromCurrentList(missionID); CheckPreMissionIsComplete(); PlayEffect("effect_ui_renwu_wanchengrenwu"); if (bAutoContinue) { EventDispatcher.GameWorld.Dispath(ControllerCommand.CONTINUE_MISSION); } } else { //错误提示. } }
public void OnSyncAcceptQuestRespond(int missionID, int resultCode) { if (resultCode == (int)KQuestResultCode.qrcSuccess) { PlayEffect("effect_ui_renwu_xinrenwu"); MissionInfo vo = GetMissionByID(missionID); canAccpetIDs.Remove(missionID); RemoveFromCanAcceptList(missionID); if (vo == null) { vo = WrapperMission(missionID); } vo.curStatus = MissionInfo.MisssionStatus.BeenAccepted; vo.tips = GetMissionLocalInfoByID(vo.id).QuestName + "(进行中)"; UpdateCurrentMissionList(vo); if (vo.nPlotID != 0) { EventDispatcher.GameWorld.Dispath(ControllerCommand.OPEN_PLOT_PANEL, vo.nPlotID); } else if (vo.type == (int)MissionInfo.MissionType.MainMission) { EventDispatcher.GameWorld.Dispath(ControllerCommand.CONTINUE_MISSION); } } else { //错误提示. } }
public void OnSyncQuestValue(int questID, int valueIndex, int newValue) { KMissionLoaclInfo localInfo = baseInfoList[questID.ToString()]; MissionInfo vo = GetMissionByID(questID); vo.condition = localInfo.Condition.Replace("V" + valueIndex, newValue.ToString()); vo.curConditionNums[valueIndex] = newValue; if (CheckMissionFinish(vo)) { vo.curStatus = MissionInfo.MisssionStatus.Finish; vo.tips = GetMissionLocalInfoByID(vo.id).QuestName + "<FFA200>(可提交)<->"; UpdateCurrentMissionList(vo); SceneLogic.GetInstance().MainHero.property.CmdAutoAttack = false; if (vo.nPlotID == 0 && vo.type == (int)MissionInfo.MissionType.MainMission) { EventDispatcher.GameWorld.Dispath(ControllerCommand.CONTINUE_MISSION); } if (vo.subType == (int)MissionInfo.MissionSubType.Monster || vo.subType == (int)MissionInfo.MissionSubType.Collect) { PlayEffect("effect_ui_renwu_wanchengmubiao"); } } else { vo.curStatus = MissionInfo.MisssionStatus.BeenAccepted; vo.tips = GetMissionLocalInfoByID(vo.id).QuestName + "<FF0000>(进行中)<->"; UpdateCurrentMissionList(vo); } }
public void RemoveFromCanAcceptList(int delMissionID) { if (canAcceptMissionList.ContainsKey(delMissionID)) { MissionInfo vo = GetMissionByID(delMissionID); if (vo != null) { canAcceptMissionList.Remove(delMissionID); RemoveNpcMission(vo.npcID, delMissionID); } } }
public void UpdateCanAcceptList(MissionInfo vo) { if (!canAcceptMissionList.ContainsKey(vo.id)) { canAcceptMissionList.Add(vo.id, vo); } else { canAcceptMissionList[vo.id] = vo; } UpdateNpcMission(vo); }
public bool CheckMissionFinish(MissionInfo vo) { if (vo.curConditionNums.Length != vo.conditionNums.Length) { return(false); } for (int i = 0; i < vo.curConditionNums.Length; i++) { if (vo.curConditionNums[i] < vo.conditionNums[i]) { return(false); } } return(true); }
public void RemoveFromCurrentList(int delMissionID) { if (currentMissionList.ContainsKey(delMissionID)) { MissionInfo vo = GetMissionByID(delMissionID); if (vo != null) { if (vo.curStatus == MissionInfo.MisssionStatus.Finish) { RemoveNpcMission(vo.submitNpcID, delMissionID); } } currentMissionList.Remove(delMissionID); } }
public void UpdateNpcMission(MissionInfo vo) { if (vo.curStatus == MissionInfo.MisssionStatus.Accept) { if (!npcMissionList.ContainsKey(vo.npcID)) { npcMissionList[vo.npcID] = new Dictionary <int, MissionInfo>(); } npcMissionList[vo.npcID][vo.id] = vo; UpdateNpcSign(vo.npcID); EventDispatcher.GameWorld.Dispath(ControllerCommand.UPDATE_MISSION, new object()); } else if (vo.curStatus == MissionInfo.MisssionStatus.Finish || vo.curStatus == MissionInfo.MisssionStatus.BeenAccepted) { if (!npcMissionList.ContainsKey(vo.submitNpcID)) { npcMissionList[vo.submitNpcID] = new Dictionary <int, MissionInfo>(); } npcMissionList[vo.submitNpcID][vo.id] = vo; UpdateNpcSign(vo.submitNpcID); EventDispatcher.GameWorld.Dispath(ControllerCommand.UPDATE_MISSION, new object()); } }
public MissionInfo WrapperMission(int missionID) { KMissionLoaclInfo localInfo = baseInfoList[missionID.ToString()]; if (localInfo == null) { return(null); } MissionInfo vo = new MissionInfo(); vo.curTimes = 1; vo.id = missionID; vo.levelLimt = localInfo.nLevelLimt; vo.submitLv = localInfo.nSubmitLv; vo.preID = localInfo.nPreID; vo.type = localInfo.nType; vo.subType = localInfo.nSubType; vo.nPlotID = localInfo.nPlotID; vo.questName = localInfo.QuestName; vo.bScript = localInfo.bScript; if (localInfo.ConditionNums != null && localInfo.ConditionNums != "") { string[] nums = localInfo.ConditionNums.Split(','); int len = nums.Length; int[] conditionNums = new int[len]; for (int i = 0; i < len; ++i) { conditionNums[i] = int.Parse(nums[i]); vo.condition = localInfo.Condition.Replace("V" + i, "0"); } vo.conditionNums = conditionNums; vo.curConditionNums = new int[conditionNums.Length]; } vo.curStatus = MissionInfo.MisssionStatus.Accept; if (localInfo.NeedItemIDs != null && localInfo.NeedItemIDs != "") { string[] ids = localInfo.NeedItemIDs.Split(','); int len = ids.Length; int[] needItemIDs = new int[len]; for (int i = 0; i < len; ++i) { needItemIDs[i] = int.Parse(ids[i]); } vo.needItemIDs = needItemIDs; } if (localInfo.NeedItemNums != null && localInfo.NeedItemNums != "") { string[] nums = localInfo.NeedItemNums.Split(','); int len = nums.Length; int[] needItemNums = new int[len]; for (int i = 0; i < len; ++i) { needItemNums[i] = int.Parse(nums[i]); } vo.needItemNums = needItemNums; } vo.exp = localInfo.nRewardExp; vo.money = localInfo.nRewardMoney; vo.gold = localInfo.nRewardGold; if (localInfo.RewardItemTypes != null && localInfo.RewardItemTypes != "" && localInfo.RewardItemTypes != "0") { string[] ids = localInfo.RewardItemTypes.Split(','); int len = ids.Length; int[] types = new int[len]; for (int i = 0; i < len; ++i) { types[i] = int.Parse(ids[i]); } vo.rewardTypes = types; } if (localInfo.RewardItemIDs != null && localInfo.RewardItemIDs != "" && localInfo.RewardItemIDs != "0") { string[] ids = localInfo.RewardItemIDs.Split(','); int len = ids.Length; int[] rewardItemIDs = new int[len]; for (int i = 0; i < len; ++i) { rewardItemIDs[i] = int.Parse(ids[i]); } vo.rewardItemIDs = rewardItemIDs; } if (localInfo.RewardItemNums != null && localInfo.RewardItemNums != "" && localInfo.RewardItemNums != "0") { string[] nums = localInfo.RewardItemNums.Split(','); int len = nums.Length; int[] rewardItemNums = new int[len]; for (int i = 0; i < len; ++i) { rewardItemNums[i] = int.Parse(nums[i]); } vo.rewardItemNums = rewardItemNums; } if (localInfo.Dialogue1 != null && localInfo.Dialogue1 != "") { string[] ids = localInfo.Dialogue1.Split(','); int len = ids.Length; int[] dialogueIDs = new int[len]; for (int i = 0; i < len; ++i) { dialogueIDs[i] = int.Parse(ids[i]); } vo.dialogue1 = dialogueIDs; } vo.dialogue2 = localInfo.nDialogue2; vo.dialogue3 = localInfo.nDialogue3; vo.npcID = localInfo.nNpcID; vo.submitNpcID = localInfo.nSubmitNpcID; vo.desc = localInfo.Describe; vo.tips = localInfo.QuestName + "<78FF00>(可接)<->"; if (localInfo.Position != null && localInfo.Position != "0") { string[] pos = localInfo.Position.Split(';'); int len = pos.Length; int[] position = new int[len]; for (int i = 0; i < len; ++i) { position[i] = int.Parse(pos[i]); } vo.position = position; } vo.pathAiType = localInfo.PathAIType; vo.pathType = localInfo.PathType; vo.isAutoComplete = localInfo.bAutoComplete; vo.totalTimes = localInfo.nTimes; UpdateCanAcceptList(vo); return(vo); }
public MissionInfo WrapperMission(RemoteTable pvo) { int index = pvo["QuestID"]; string indexString = index.ToString(); KMissionLoaclInfo localInfo = baseInfoList[indexString]; if (localInfo == null) { return(null); } MissionInfo vo = new MissionInfo(); vo.curTimes = 1; vo.id = (int)pvo["QuestID"]; vo.levelLimt = localInfo.nLevelLimt; vo.submitLv = localInfo.nSubmitLv; vo.preID = localInfo.nPreID; vo.type = localInfo.nType; vo.subType = localInfo.nSubType; vo.nPlotID = localInfo.nPlotID; vo.questName = localInfo.QuestName; vo.bScript = localInfo.bScript; RemoteTable questValueTable = (RemoteTable)pvo["QuestValue"]; vo.curConditionNums = new int[questValueTable.Count]; for (int i = 0; i < questValueTable.Count; i++) { int questValue = questValueTable[i + 1]; //lua那边table表默认是1开始的. vo.condition = localInfo.Condition.Replace("V" + i, questValue.ToString()); vo.curConditionNums[i] = questValue; } bool hasCompeled = true; if (localInfo.ConditionNums != null && localInfo.ConditionNums != "") { string[] nums = localInfo.ConditionNums.Split(','); int len = nums.Length; if (len != questValueTable.Count) { Debug.Log("任务数据前端Condition和后端事件数不一致"); } int[] conditionNums = new int[len]; for (int i = 0; i < len; ++i) { conditionNums[i] = int.Parse(nums[i]); if (conditionNums[i] != questValueTable[i + 1])//lua那边table表默认是1开始的. { hasCompeled = false; } } vo.conditionNums = conditionNums; } if (hasCompeled) { vo.curStatus = MissionInfo.MisssionStatus.Finish; } else { vo.curStatus = MissionInfo.MisssionStatus.BeenAccepted; } if (localInfo.NeedItemIDs != null && localInfo.NeedItemIDs != "") { string[] ids = localInfo.NeedItemIDs.Split(','); int len = ids.Length; int[] needItemIDs = new int[len]; for (int i = 0; i < len; ++i) { needItemIDs[i] = int.Parse(ids[i]); } vo.needItemIDs = needItemIDs; } if (localInfo.NeedItemNums != null && localInfo.NeedItemNums != "") { string[] nums = localInfo.NeedItemNums.Split(','); int len = nums.Length; int[] needItemNums = new int[len]; for (int i = 0; i < len; ++i) { needItemNums[i] = int.Parse(nums[i]); } vo.needItemNums = needItemNums; } vo.exp = localInfo.nRewardExp; vo.money = localInfo.nRewardMoney; vo.gold = localInfo.nRewardGold; if (localInfo.RewardItemIDs != null && localInfo.RewardItemIDs != "") { string[] ids = localInfo.RewardItemIDs.Split(','); int len = ids.Length; int[] rewardItemIDs = new int[len]; for (int i = 0; i < len; ++i) { rewardItemIDs[i] = int.Parse(ids[i]); } vo.rewardItemIDs = rewardItemIDs; } if (localInfo.Dialogue1 != null && localInfo.Dialogue1 != "") { string[] ids = localInfo.Dialogue1.Split(';'); int len = ids.Length; int[] dialogueIDs = new int[len]; for (int i = 0; i < len; ++i) { dialogueIDs[i] = int.Parse(ids[i]); } vo.dialogue1 = dialogueIDs; } vo.dialogue2 = localInfo.nDialogue2; vo.dialogue3 = localInfo.nDialogue3; vo.npcID = localInfo.nNpcID; vo.submitNpcID = localInfo.nSubmitNpcID; vo.desc = localInfo.Describe; if (vo.curStatus == MissionInfo.MisssionStatus.Accept) { vo.tips = localInfo.QuestName + "<78FF00>(可接)<->"; } else if (vo.curStatus == MissionInfo.MisssionStatus.BeenAccepted) { vo.tips = localInfo.QuestName + "<FF0000>(未完成)<->"; } else if (vo.curStatus == MissionInfo.MisssionStatus.Finish) { vo.tips = localInfo.QuestName + "<FFA2000>(可提交)<->"; } if (localInfo.Position != null && localInfo.Position != "0") { string[] pos = localInfo.Position.Split(';'); int len = pos.Length; int[] position = new int[len]; for (int i = 0; i < len; ++i) { position[i] = int.Parse(pos[i]); } vo.position = position; } vo.pathAiType = localInfo.PathAIType; vo.pathType = localInfo.PathType; vo.isAutoComplete = localInfo.bAutoComplete;// == 0 ? false : true; vo.totalTimes = localInfo.nTimes; UpdateCurrentMissionList(vo); return(vo); }