string GetTranceDescByProcess(GameCmd.TaskProcess process) { if (!Received) { return(m_clienDB.strTaskReceive); } string strDesc = ""; if (process == GameCmd.TaskProcess.TaskProcess_Doing) { strDesc = m_clienDB.strTaskTraceBegin; } else { if (taskSubType == TaskSubType.SubmitLimit) { if (finishLevel > MainPlayerHelper.GetPlayerLevel()) { strDesc = m_clienDB.strTaskTraceBegin; } } else { strDesc = m_clienDB.strTaskTraceEnd; } } return(strDesc.Replace("\n", "")); }
//static uint nProcessTaskID = 0; public void ProcessTask(QuestTraceInfo taskInfo) { //nProcessTaskID = taskInfo.taskId; if (taskInfo == null) { Engine.Utility.Log.Error("taskInfo is null"); return; } GameCmd.TaskProcess process = taskInfo.GetTaskProcess(); if (process == GameCmd.TaskProcess.TaskProcess_None)//去接任务 { StopRobot(); DoAcceptTask(taskInfo); } else if (process == GameCmd.TaskProcess.TaskProcess_Doing) { StopRobot(); OnDoingTask(taskInfo); } else if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { StopRobot(); OnCommitTask(taskInfo); return; } }
void InitBtnIcon(GameObject btn, uint btnTaskId) { Transform iconTransf = btn.transform.Find("Icon"); if (iconTransf == null) { return; } if (btnTaskId == 0) { iconTransf.gameObject.SetActive(false); return; } else { iconTransf.gameObject.SetActive(true); } UISprite iconSp = iconTransf.GetComponent <UISprite>(); if (iconSp == null) { iconSp = iconTransf.gameObject.AddComponent <UISprite>(); } List <QuestTraceInfo> traceTask; DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask); if (traceTask != null) { QuestTraceInfo questTraceInfo = traceTask.Find((data) => { return(btnTaskId == data.taskId); }); if (questTraceInfo != null) { GameCmd.TaskProcess taskProcess = questTraceInfo.GetTaskProcess(); if (taskProcess == GameCmd.TaskProcess.TaskProcess_None) //可接 { iconSp.spriteName = "tubiao_renwu_1"; } else if (taskProcess == GameCmd.TaskProcess.TaskProcess_Doing)//执行中 { iconSp.spriteName = "tubiao_renwu_4"; } else if (taskProcess == GameCmd.TaskProcess.TaskProcess_CanDone)//可以交付 { iconSp.spriteName = "tubiao_renwu_3"; } } else { iconTransf.gameObject.SetActive(false); } } else { iconTransf.gameObject.SetActive(false); } }
/// <summary> /// 是否添加任务进度显示 /// </summary> /// <param name="process"></param> /// <returns></returns> public bool NeedProcess(GameCmd.TaskProcess process) { if (process != GameCmd.TaskProcess.TaskProcess_Doing && process != GameCmd.TaskProcess.TaskProcess_CanDone) { return(false); } if (taskSubType == TaskSubType.DeliverItem || taskSubType == TaskSubType.KillMonster || taskSubType == TaskSubType.KillMonsterCollect || taskSubType == TaskSubType.Collection) { return(true); } return(false); }
void AddNpcTip(Client.IEntity entity, uint effectId, uint nTaskId, GameCmd.TaskProcess process) { NpcTips tips; if (m_DictNpceffect.TryGetValue(entity.GetID(), out tips)) { if (tips.process == process) { return; } } table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(effectId); if (edb != null) { Client.AddLinkEffect node = new Client.AddLinkEffect(); table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath); if (resDB == null) { Engine.Utility.Log.Error("找不到特效资源路径配置{0}", edb.resPath); } node.strEffectName = resDB.strPath; node.strLinkName = edb.attachNode; node.nFollowType = (int)edb.flowType; node.rotate = new UnityEngine.Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]); node.vOffset = new UnityEngine.Vector3(edb.offset[0], edb.offset[1], edb.offset[2]); node.strEffectName = resDB.strPath; node.strLinkName = edb.attachNode; if (node.strEffectName.Length != 0) { int eId = (int)entity.SendMessage(Client.EntityMessage.EntityCommand_AddLinkEffect, node); if (m_DictNpceffect.ContainsKey(entity.GetID())) { entity.SendMessage(Client.EntityMessage.EntityCommand_RemoveLinkEffect, m_DictNpceffect[entity.GetID()].effectid); m_DictNpceffect[entity.GetID()].effectid = eId; m_DictNpceffect[entity.GetID()].process = process; } else { m_DictNpceffect.Add(entity.GetID(), new NpcTips() { effectid = eId, npcid = entity.GetID(), taskid = nTaskId, process = process }); } } } }
public static string GetQuestStatusIcon(GameCmd.TaskProcess process) { string icon = ""; if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { icon = "tubiao_wenhao_huang"; } else if (process == GameCmd.TaskProcess.TaskProcess_None)//可接 { icon = "tubiao_tanhao_huang"; } else if (process == GameCmd.TaskProcess.TaskProcess_Doing) { icon = "tubiao_wenhao_hui"; } return(icon); }
public bool IsDeleverItem(out uint nNpcId) { nNpcId = 0; if (taskSubType == TaskSubType.DeliverItem) { GameCmd.TaskProcess process = GetTaskProcess(); if (process == GameCmd.TaskProcess.TaskProcess_Doing) { nNpcId = m_clienDB.dwDoingNpc; } else if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { nNpcId = m_clienDB.dwEndNpc; } return(true); } return(false); }
/// <summary> //第一次接取 调用 可以提交调用下 /// </summary> public void UpdateDesc() { GameCmd.TaskProcess process = GetTaskProcess(); m_strDesc = GetTranceDescByProcess(process); m_strDesc = ReplaceTag(m_strDesc, process); //m_strDesc = string.Format("<br /><n><color value=\"#fff8dd\">{0}</color></n>", m_strDesc); m_strDesc = string.Format("[fff8dd]{0}[-]", m_strDesc); if (NeedProcess(process)) { m_strDesc = AddProcessFormat(m_strDesc); } if (NeedCd(process)) { m_strDesc = AddCdFormat(m_strDesc); } }
void SetNpcTipsByTraceInfo(QuestTraceInfo questInfo) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("实体系统为null"); return; } GameCmd.TaskProcess process = questInfo.GetTaskProcess(); uint npcid = 0; uint effectID = 0; if (process == GameCmd.TaskProcess.TaskProcess_None)//可接 { npcid = questInfo.beginNpc; effectID = EFFECT_CANACCEPT; } else if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { npcid = questInfo.endNpc; effectID = EFFECT_CANCOMMIT; } else if (process == GameCmd.TaskProcess.TaskProcess_Doing) { npcid = questInfo.endNpc; effectID = EFFECT_DOING; } Client.INPC npc = es.FindNPCByBaseId((int)npcid); if (npc == null) { Engine.Utility.Log.Info("查找不到npc{0}", npcid); return; } AddNpcTip(npc, effectID, questInfo.taskId, process); }
public GameCmd.TaskProcess GetTaskProcess() { if (!Received) { return(GameCmd.TaskProcess.TaskProcess_None); } GameCmd.TaskProcess process = GameCmd.TaskProcess.TaskProcess_None; if (state == 0 && operate != 0) { process = GameCmd.TaskProcess.TaskProcess_Done; } else if (state != 0 && state <= operate)//步骤总数 { process = GameCmd.TaskProcess.TaskProcess_CanDone; } else if (state != 0 && state > operate) { process = GameCmd.TaskProcess.TaskProcess_Doing; } return(process); }
bool IsNeedSetTip(Client.INPC en, ref List <QuestTraceInfo> traceTask, out int index) { index = -1; if (en == null) { return(false); } if (en.IsMonster()) { return(false); } QuestTraceInfo tranceInfo = null; GameCmd.TaskProcess process = GameCmd.TaskProcess.TaskProcess_Max; for (int i = 0; i < traceTask.Count; i++) { int npcid = en.GetProp((int)Client.EntityProp.BaseID); tranceInfo = traceTask[i]; process = tranceInfo.GetTaskProcess(); if (process == GameCmd.TaskProcess.TaskProcess_None) { if (tranceInfo.beginNpc == npcid) { index = i; return(true); } } else if (process == GameCmd.TaskProcess.TaskProcess_CanDone || process == GameCmd.TaskProcess.TaskProcess_Doing) { if (tranceInfo.endNpc == npcid) { index = i; return(true); } } } return(false); }
/// <summary> /// 尝试获取npc任务信息 /// </summary> /// <param name="entity"></param> /// <param name="info"></param> /// <returns></returns> public static bool TryGetNPCTraceInfo(IEntity entity, out QuestTraceInfo info) { info = null; if (null == entity || entity.GetEntityType() != EntityType.EntityType_NPC /* || !(entity is Client.INPC)*/) { return(false); } //INPC npc = (INPC)entity; //if (npc.IsMonster()) // return null; List <QuestTraceInfo> traceTask; DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask); int npcBaseID = entity.GetProp((int)Client.EntityProp.BaseID); GameCmd.TaskProcess process = GameCmd.TaskProcess.TaskProcess_Max; for (int i = 0; i < traceTask.Count; i++) { info = traceTask[i]; process = info.GetTaskProcess(); if (process == GameCmd.TaskProcess.TaskProcess_CanDone || process == GameCmd.TaskProcess.TaskProcess_Doing) { if (info.endNpc == npcBaseID) { return(true); } } else if (process == GameCmd.TaskProcess.TaskProcess_None) { if (info.beginNpc == npcBaseID) { return(true); } } } return(false); }
public static bool TryGetQuestStatusIcon(QuestTraceInfo info, out long uid, out string icon) { icon = string.Empty; uid = 0; if (null == info) { return(false); } GameCmd.TaskProcess process = info.GetTaskProcess(); uint npcid = 0; icon = GetQuestStatusIcon(process); if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { npcid = info.endNpc; } else if (process == GameCmd.TaskProcess.TaskProcess_None)//可接 { npcid = info.beginNpc; } else if (process == GameCmd.TaskProcess.TaskProcess_Doing) { npcid = info.endNpc; } Client.INPC npc = GetNPCByBaseID(npcid); if (npc == null) { Engine.Utility.Log.Info("查找不到npc{0}", npcid); return(false); } uid = npc.GetUID(); return(true); }
string ReplaceTag(string strDesc, GameCmd.TaskProcess process) { if (process == GameCmd.TaskProcess.TaskProcess_None) { strDesc = ReplaceNpc(strDesc, this.m_clienDB.dwBeginNpc, this.m_clienDB.acceptMapID); } else if (process == GameCmd.TaskProcess.TaskProcess_Doing) { switch (taskSubType) { case TaskSubType.Collection: { strDesc = ReplaceNpc(strDesc, this.m_clienDB.collect_npc, this.m_clienDB.destMapID); } break; case TaskSubType.CallMonster: case TaskSubType.KillMonster: { strDesc = ReplaceNpc(strDesc, this.m_clienDB.monster_npc, this.m_clienDB.destMapID); } break; case TaskSubType.KillMonsterCollect: { if (taskType == GameCmd.TaskType.TaskType_Loop) { strDesc = ReplaceItem(strDesc, this.m_clienDB.usecommitItemID, this.m_clienDB.destMapID); } else { strDesc = ReplaceNpc(strDesc, this.m_clienDB.monster_npc, this.m_clienDB.destMapID); } } break; case TaskSubType.DeliverItem: { strDesc = ReplaceItem(strDesc, this.m_clienDB.usecommitItemID); strDesc = ReplaceNpc(strDesc, this.m_clienDB.dwDoingNpc, this.m_clienDB.destMapID); } break; case TaskSubType.UseItem: { strDesc = ReplaceItem(strDesc, this.m_clienDB.usecommitItemID, this.m_clienDB.destMapID); } break; case TaskSubType.Talk: { strDesc = ReplaceNpc(strDesc, this.m_clienDB.dwEndNpc, this.m_clienDB.destMapID); } break; default: break; } } else if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { switch (taskSubType) { case TaskSubType.DeliverItem: { strDesc = ReplaceItem(strDesc, this.m_clienDB.usecommitItemID); strDesc = ReplaceNpc(strDesc, this.m_clienDB.dwEndNpc, this.m_clienDB.submitMapID); } break; default: strDesc = ReplaceNpc(strDesc, this.m_clienDB.dwEndNpc, this.m_clienDB.submitMapID); break; } } return(strDesc); }
/// <summary> /// 是否需要附加时间显示(悬赏任务) /// </summary> /// <returns></returns> public bool NeedCd(GameCmd.TaskProcess process) { return(this.taskType == GameCmd.TaskType.TaskType_Token && process == GameCmd.TaskProcess.TaskProcess_Doing); }