public NpcMissState GetNpcMissState(int npcId, out _DBC_MISSION_DEMAND_LIST currMiss) { currMiss = null; if (npcId == MacroDefine.INVALID_ID) { return(NpcMissState.None); } CDetailAttrib_Player myData = CDetailAttrib_Player.Instance; NpcMissState state = NpcMissState.None; foreach (_DBC_MISSION_DEMAND_LIST miss in sceneMissions) { bool alreadyHave = myData.GetMissionIndexByID(miss.n_MissionID) != MacroDefine.INVALID_ID; if (miss.n_AcceptNpcID == npcId && state == NpcMissState.None && !alreadyHave) { state = NpcMissState.AcceptNormal; currMiss = miss; } else if (miss.n_FinishNpcID == npcId) { if (myData.IsMissionCanCommit(miss.n_MissionID)) { state = NpcMissState.FinishNormal; currMiss = miss; break; } else if (alreadyHave) { state = NpcMissState.ContinueNormal; currMiss = miss; } } } return(state); }
public void UpdateFuncEnable() { if (funcList.Count == 0) { UnRegistConditions(); return; } CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf(); CDetailAttrib_Player myData = CDetailAttrib_Player.Instance; if (mySelf == null || myData == null) { return; } ////////////////////////////////////////////////////////////////////////// // 由于界面表现要有特殊标示,所以特殊对待 int x1Pos = 0; int y2Pos = 45; int index = -1; ////////////////////////////////////////////////////////////////////////// foreach (_DBC_FUNC_OPEN_LIST enumerator in funcList) { index++; bool showEnable = true; _DBC_FUNC_OPEN_LIST func = enumerator; if (func.needLevel != MacroDefine.INVALID_ID && mySelf.GetCharacterData().Get_Level() < func.needLevel) { showEnable = false; } else if (func.receiveMission != MacroDefine.INVALID_ID) { if ((myData.GetMissionIndexByID(func.receiveMission) == MacroDefine.INVALID_ID) && !myData.IsMissionHaveDone((uint)func.receiveMission)) { showEnable = false; } } else if (func.finishMission != MacroDefine.INVALID_ID) { if (!myData.IsMissionHaveDone((uint)func.finishMission)) { showEnable = false; } } if (uiGoList[index] == null) { uiGoList[index] = GameObject.Find(enumerator.uiName); } if (uiGoList[index] != null) { if (showEnable) { if (uiGoList[index].layer != LayerManager.UILayer) { uiGoList[index].layer = LayerManager.UILayer; } ////////////////////////////////////////////////////////////////////////// Vector3 pos = uiGoList[index].transform.localPosition; switch (enumerator.specialTag) { case 1: pos.x = x1Pos; x1Pos -= 45; break; case 2: pos.y = y2Pos; y2Pos += 45; break; default: break; } uiGoList[index].transform.localPosition = pos; ////////////////////////////////////////////////////////////////////////// // funcList.Remove(enumerator.Current.Key); // enumerator = funcList.GetEnumerator(); } else { if (uiGoList[index].layer == LayerManager.UILayer) { uiGoList[index].layer = LayerManager.DefaultLayer; } } } } }
/// <summary> /// 过滤任务 /// </summary> public void Sort() { oldNpcIds.Clear(); foreach (_DBC_MISSION_DEMAND_LIST miss in sceneMissions) { if (!oldNpcIds.Contains(miss.n_AcceptNpcID)) { oldNpcIds.Add(miss.n_AcceptNpcID); } if (!oldNpcIds.Contains(miss.n_FinishNpcID)) { oldNpcIds.Add(miss.n_FinishNpcID); } } sortMissions.Clear(); sceneMissions.Clear(); CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf(); CDetailAttrib_Player myData = CDetailAttrib_Player.Instance; // 没有玩家数据无法过滤 [6/14/2011 ivan edit] if (mySelf == null || myData == null) { return; } int currentScene = GameProcedure.s_pWorldManager.GetActiveSceneID(); foreach (_DBC_MISSION_DEMAND_LIST miss in allMissions) { // 是否已经接了该任务 // if (myData.GetMissionIndexByID(miss.n_MissionID) != MacroDefine.INVALID_ID) // continue; // 是否已经完成 if (myData.IsMissionHaveDone((uint)miss.n_MissionID)) { continue; } // 最低等级 if (miss.n_MinLevel != MacroDefine.INVALID_ID && !(mySelf.GetCharacterData().Get_Level() >= miss.n_MinLevel)) { continue; } // 最高等级 if (miss.n_MaxLevel != MacroDefine.INVALID_ID && !(mySelf.GetCharacterData().Get_Level() < miss.n_MaxLevel)) { continue; } // 前置任务 if (miss.n_PreMissionID != MacroDefine.INVALID_ID && !myData.IsMissionHaveDone((uint)miss.n_PreMissionID)) { continue; } sortMissions.Add(miss); // 整理出当前场景相关的任务 [4/6/2012 Ivan] if (miss.n_AcceptSceneId == currentScene || miss.n_FinishSceneId == currentScene) { sceneMissions.Add(miss); } } UpdateNpcState(); oldNpcIds.Clear(); // 刷新地图和可接任务列表 [4/6/2012 Ivan] CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UI_INFOS, "SortMission"); }