/// <summary> /// 获取追踪信息 /// </summary> /// <param name="taskVo"></param> /// <returns></returns> public static string GetTraceInfo(TaskVo taskVo) { string trace = ""; switch (taskVo.Statu) { case TaskStatu.StatuUnAccept: trace = taskVo.SysTaskVo.trace_accept; break; case TaskStatu.StatuAccepted: if (taskVo.CanCommit) { trace = taskVo.SysTaskVo.trace_com; } else { trace = taskVo.SysTaskVo.trace_uncom; } break; case TaskStatu.StatuFinished: trace = taskVo.SysTaskVo.trace_com; break; } return(trace); }
public void SetWantedTaskData() { _taskVo = null; _taskTitleLabel.text = "[支]悬赏任务"; _taskDescribeLabel.text = "完成悬赏任务可获得大量的经验和金币"; _taskReward.SetActive(false); _taskRewardLabel.text = "剩余悬赏次数:" + TaskModel.Instance.LeftWantedTaskCount; }
public void SetData(TaskVo taskVo) { _taskVo = taskVo; _taskReward.SetActive(true); _taskExpLabel.text = taskVo.SysTaskVo.exp + ""; _taskGoldLabel.text = taskVo.SysTaskVo.gold + ""; _taskTitleLabel.text = taskVo.SysTaskVo.name; _taskDescribeLabel.text = LanguageManager.GetWord("MainLeftView.mainTask") + TaskUtil.GetTaskDescribe(taskVo); _taskRewardLabel.text = "任务奖励:"; }
/// <summary> /// 获取任务的触发类型 /// </summary> /// <param name="taskVo"></param> /// <returns></returns> public static int GetTaskTriggerType(TaskVo taskVo) { int result = 0; if (taskVo.Statu == TaskStatu.StatuAccepted) { result = taskVo.CanCommit ? 2 : 1; } return(result); }
/// <summary> /// 接受任务返回 /// </summary> /// <param name="data"></param> private void Fun_6_2(INetData data) { _curTaskAccetpInfo = new TaskAcceptMsg_6_2(); _curTaskAccetpInfo.read(data.GetMemoryStream()); if (_curTaskAccetpInfo.code != 0) { ErrorCodeManager.ShowError(_curTaskAccetpInfo.code); return; } SysTask sysTaskVo = BaseDataMgr.instance.GetSysTaskVo(_curTaskAccetpInfo.taskId); if (_curTaskAccetpInfo.taskId == _taskMode.CurrentMainTaskVo.TaskId) //更新主线任务状态 { TaskVo taskVo = _taskMode.CurrentMainTaskVo; taskVo.Statu = TaskStatu.StatuAccepted; taskVo.CanCommit = _curTaskAccetpInfo.state == 1; _taskMode.CurrentMainTaskVo = taskVo; } else if (sysTaskVo.type == TaskModel.TypeSub) { if (_taskMode.CurrentSubTaskVo == null) { var taskVo = new TaskVo(); taskVo.TaskId = _curTaskAccetpInfo.taskId; taskVo.SysTaskVo = sysTaskVo; taskVo.Statu = TaskStatu.StatuAccepted; taskVo.CanCommit = _curTaskAccetpInfo.state == 1; _taskMode.CurrentSubTaskVo = taskVo; Singleton <WantedTaskView> .Instance.CloseView(); } else if (_curTaskAccetpInfo.taskId == _taskMode.CurrentSubTaskVo.TaskId) { TaskVo taskVo = _taskMode.CurrentSubTaskVo; taskVo.Statu = TaskStatu.StatuAccepted; taskVo.CanCommit = _curTaskAccetpInfo.state == 1; _taskMode.CurrentSubTaskVo = taskVo; } } Vector3 position = AppMap.Instance.me.GoBase.transform.position; position.y = position.y + 2.5f; EffectMgr.Instance.CreateMainEffect(EffectId.Main_TaskReceive, position); //播放接受任务音效 SoundMgr.Instance.PlayUIAudio(SoundId.Sound_ReceieTask); if (StoryControl.Instance.PlayReceiveTaskStory(_curTaskAccetpInfo.taskId, ReceiveTaskStoryCallback)) { _receiveTaskStoryPlaying = true; Singleton <MainView> .Instance.CloseView(); } else { GuideManager.Instance.TriggerGuide(_curTaskAccetpInfo.taskId, 1); //检查是否会触发指引 } }
/// <summary> /// 任务进度更新 /// </summary> /// <param name="data"></param> private void Fun_6_5(INetData data) { var taskTrackInfo = new TaskTrackInfoMsg_6_5(); taskTrackInfo.read(data.GetMemoryStream()); if (taskTrackInfo.taskId == _taskMode.CurrentMainTaskVo.TaskId) { TaskVo taskVo = _taskMode.CurrentMainTaskVo; taskVo.CanCommit = true; _taskMode.CurrentMainTaskVo = taskVo; } else if (taskTrackInfo.taskId == _taskMode.CurrentSubTaskVo.TaskId) { TaskVo taskVo = _taskMode.CurrentSubTaskVo; taskVo.CanCommit = true; _taskMode.CurrentSubTaskVo = taskVo; } }
/// <summary> /// 根据任务表字符串返回任务的说明 /// </summary> /// <returns>任务说明</returns> public static string GetTaskDescribe(TaskVo taskVo) { string trace = GetTraceInfo(taskVo); string result = ""; string[] items = trace.Split('.'); switch (items[0]) { case "n": result = GetFindNpcTaskDescribe(items); break; case "fb": result = GetFindCopyTaskDescribe(items); break; } return(result); }
/// <summary> /// 完成任务请求返回 /// </summary> /// <param name="data"></param> private void Fun_6_4(INetData data) { _curTaskCommitInfo = new TaskCommitMsg_6_4(); _curTaskCommitInfo.read(data.GetMemoryStream()); if (_curTaskCommitInfo.code != 0) { ErrorCodeManager.ShowError(_curTaskCommitInfo.code); return; } if (_curTaskCommitInfo.taskId == _taskMode.CurrentMainTaskVo.TaskId) { SysTask sysTaskVo = BaseDataMgr.instance.GetSysTaskVo(_curTaskCommitInfo.nextId); var taskVo = new TaskVo(); taskVo.TaskId = _curTaskCommitInfo.nextId; taskVo.SysTaskVo = sysTaskVo; taskVo.Statu = TaskStatu.StatuUnAccept; _taskMode.CurrentMainTaskVo = taskVo; } else if (_taskMode.CurrentSubTaskVo != null && _curTaskCommitInfo.taskId == _taskMode.CurrentSubTaskVo.TaskId) { _taskMode.CurrentSubTaskVo = null; } Vector3 position = AppMap.Instance.me.GoBase.transform.position; position.y = position.y + 2.5f; EffectMgr.Instance.CreateMainEffect(EffectId.Main_TaskFinish, position); //播放完成任务音效 SoundMgr.Instance.PlayUIAudio(SoundId.Sound_FinishTask); if (StoryControl.Instance.PlayFinishTaskStory(_curTaskCommitInfo.taskId, FinishTaskStoryCallback)) { _finishTaskStoryPlaying = true; Singleton <MainView> .Instance.CloseView(); } else { GuideManager.Instance.TriggerGuide(_curTaskCommitInfo.taskId, 2); //检查是否会触发指引 } }
public void SetData(SysTask taskVo, int color) { _color = color; _taskVo = taskVo; _titleLabel.text = taskVo.name; _taskExpRewardLabel.text = taskVo.exp.ToString(); _taskGoldRewardLabel.text = taskVo.gold.ToString(); var task = new TaskVo(); task.Statu = TaskStatu.StatuAccepted; task.TaskId = (uint)taskVo.taskId; task.SysTaskVo = taskVo; task.CanCommit = false; _taskDetail.text = TaskUtil.GetTaskDescribe(task); switch (_color) { case 1: _taskDetail.color = Color.white; break; case 2: _taskDetail.color = Color.green; break; case 3: _taskDetail.color = Color.blue; break; case 4: _taskDetail.color = Color.cyan; break; case 5: _taskDetail.color = Color.magenta; break; } }