public static bool NeedOpenTalkUI(NormalTask taskInfo) { if (taskInfo.TaskData.dialogBegin > 0) { return(true); } return(false); }
public void SetTaskInfo(NormalTask taskInfo, GameObject canvas_obj_) { //if (null != this.m_taskInfo && this.m_taskInfo.TaskConfID == taskInfo.TaskConfID && this.m_taskInfo.TaskCurrentStatus == taskInfo.TaskCurrentStatus) // return; this.m_taskInfo = taskInfo; m_canvas_root = canvas_obj_; m_canvas_rt = GetComponent <RectTransform>(); RefreshTaskItemUI(); }
public static void OnTaskItemClick(NormalTask taskInfo, Action Close_Myself_UI) { EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.task_button.ToString()); if (taskInfo.TaskCurrentStatus == TaskStatus.PROGRESSING) { AcceptTask(taskInfo); } else if (taskInfo.TaskCurrentStatus == TaskStatus.COMPLETED) { GetReward(taskInfo, Close_Myself_UI); } }
/// <summary> /// 恢复玩家任务数据(基本数据) /// </summary> /// <param name="message"></param> private void OnSyncPlayerTaskList(object message) { SCTaskIdListResponse retrievedPlayerTaskList = message as SCTaskIdListResponse; for (int i = 0; i < retrievedPlayerTaskList.TaskIdInfos.Count; ++i) { TaskIdInfo retrieveTaskInfo = retrievedPlayerTaskList.TaskIdInfos[i]; NormalTask task = CreateNormalTaskInstance(retrieveTaskInfo.TaskId); task.TaskUUID = retrieveTaskInfo.PlayerTaskId; this.m_playerTaskSet.AddTask(retrieveTaskInfo.PlayerTaskId, task); } List <long> taskIdList = retrievedPlayerTaskList.TaskIdInfos.Select(x => x.PlayerTaskId).ToList(); SyncTaskDetailInfo(0, taskIdList.ToArray()); }
public static void GetReward(NormalTask taskInfo, Action Close_Myself_UI, bool delay_show_reward_view_ = false) { if (taskInfo.TaskCurrentStatus != TaskStatus.COMPLETED) { return; } if (delay_show_reward_view_) { GameEvents.UIEvents.UI_Bonus_Pop_View_Event.Tell_OnCache.SafeInvoke(EUNM_BONUS_POP_VIEW_TYPE.E_TASK_REWARD); GameEvents.UIEvents.UI_Bonus_Pop_View_Event.Tell_OnShow.SafeInvoke(); } else { GameEvents.TaskEvents.OnCollectTaskReward.SafeInvoke(taskInfo); Close_Myself_UI(); } }
public long GetCurrentMainTask() { TaskSystem taskSystem = GlobalInfo.MY_PLAYER_INFO.PlayerTaskSystem; if (taskSystem == null) { return(ERRORID); } for (int i = 0; i < taskSystem.CurrentTaskList.Count; i++) { NormalTask normalTask = taskSystem.CurrentTaskList[i] as NormalTask; if (normalTask.TaskData.type == 1) { return(normalTask.TaskConfID); } } return(ERRORID); }
public static void AcceptTask(NormalTask taskInfo) { Dictionary <UBSParamKeyName, object> _param = new Dictionary <UBSParamKeyName, object>(); _param.Add(UBSParamKeyName.ContentID, taskInfo.TaskConfID); UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.touch_task, null, _param); if (taskInfo.CompleteConditionList.Count > 0) { if (taskInfo.TaskData.type == 1) { OnCheckMainTaskCanStart(taskInfo); } else { OnCheckTaskCanStart(taskInfo); } } }
/// <summary> /// 创建任务实体 /// </summary> /// <param name="taskId"></param> /// <returns></returns> private NormalTask CreateNormalTaskInstance(long taskId) { ConfTask confTask = ConfTask.Get(taskId); if (confTask == null) { Debug.LogError($"create task error, no task config :{taskId}"); return(null); } List <TaskCreaterParams> taskTriggerConditionParams = ParseTaskTriggerConditions(confTask); List <TaskCreaterParams> taskCompleteConditionParams = ParseTaskCompleteConditions(confTask); List <TaskCreaterParams> taskRewardParams = ParseTaskRewardInfo(confTask); NormalTask task = TaskFactory.Instance.CreateTask <NormalTask>(confTask.id, taskTriggerConditionParams, taskCompleteConditionParams, taskRewardParams); task.TaskData = confTask; return(task); }
private void OnClick(GameObject objs) { CheckCurrentTask(); if (this.m_buildState == 1) { CommonHelper.OpenEnterGameSceneUI(this.m_enterdata.m_sceneID); } else if (this.m_buildState == 2) { NormalTask taskInfo = TaskQueryManager.Instance.GetCurrentMainTaskInfo(); TaskHelper.AcceptTask(taskInfo); //CSCanTaskRequest req = new CSCanTaskRequest(); //req.TaskId = taskInfo.TaskConfID; //GameEvents.NetWorkEvents.SendMsg.SafeInvoke(req); } else { WaveTipHelper.LoadWaveContent("scene_locked", Widget.position); } }
public long CheckBuildIsInTask(long sceneID) { TaskSystem taskSystem = GlobalInfo.MY_PLAYER_INFO.PlayerTaskSystem; if (taskSystem == null) { return(ERRORID); } for (int i = 0; i < taskSystem.CurrentTaskList.Count; i++) { NormalTask normalTask = taskSystem.CurrentTaskList[i] as NormalTask; if (normalTask.TaskData.type == 1) { //目前只有场景寻物 if (normalTask.TaskData.conditionSceneId / 1000 == sceneID) { return(normalTask.TaskData.conditionSceneId); } } } return(ERRORID); }
public override void OnShow(object param) { base.OnShow(param); GameEvents.UIEvents.UI_GameEntry_Event.OnMaskBGVisible.SafeInvoke(true); //GameEvents.UIEvents.UI_Common_Event.OnCommonUIVisible.SafeInvoke(false); BgHideAlpha(false); PanelTurnToOne(false); m_btn.AddClickCallBack(OnClicked); m_tips_btn.AddClickCallBack(OnClicked); m_close_btn.AddClickCallBack(OnCloseClicked); if (null != param) { var input_param = param as AcceptTaskParam; m_taskInfo = input_param.m_taskInfo; m_btn_act = input_param.m_close_act; m_isAcceptTask = input_param.isAcceptTask; } this.m_completeTaskTipsLabel.Visible = !m_isAcceptTask; this.m_tips_txt.Visible = m_isAcceptTask; if (m_isAcceptTask) { this.m_btnLable.Text = "Action !"; } else { this.m_btnLable.Text = "Complete !"; } ConfTask confTask = ConfTask.Get(this.m_taskInfo.TaskConfID); this.m_desc_txt.Text = LocalizeModule.Instance.GetString(confTask.descs); this.m_name_txt.Text = LocalizeModule.Instance.GetString(confTask.name); this.m_tips_txt.Text = LocalizeModule.Instance.GetString("activity_drop_taskdec_1"); List <RewardWrapper> task_rewards = new List <RewardWrapper>(); if (m_isAcceptTask) { task_rewards = GetAcceptTaskDropItem(confTask); } else { task_rewards = GetCompleteTaskDropItem(); } if (task_rewards.Count > 0) { m_reward_grid.EnsureSize <DropItemIcon>(task_rewards.Count); for (int i = 0; i < m_reward_grid.ChildCount; ++i) { var view = m_reward_grid.GetChild <DropItemIcon>(i); view.InitSprite(task_rewards[i].m_icon, task_rewards[i].m_num, task_rewards[i].m_id); view.Visible = true; } } else { m_reward_grid.Clear(); } List <iconAndName> conditions = new List <iconAndName>(); if (m_taskInfo.CompleteConditionList.Count > 0) { foreach (var complete_condition in m_taskInfo.CompleteConditionList) { if (complete_condition.GetType() == typeof(TaskCompleteItems)) { //收集物品 TaskCompleteItems collectDataInfo = complete_condition as TaskCompleteItems; List <ItemWrapper> collectItemList = collectDataInfo.TaskCompleteData; string collect_icon, collect_name; int collect_type; foreach (var collect in collectItemList) { GetIconAndName(collect.ItemID, out collect_icon, out collect_name, out collect_type); conditions.Add(new iconAndName() { m_icon = collect_icon, m_name = collect_name, m_type = collect_type, }); } } else if (complete_condition.GetType() == typeof(TaskCompleteByScan)) { //尸检 TaskCompleteByScan collectDataInfo = complete_condition as TaskCompleteByScan; long scan_id = (long)collectDataInfo.TaskCompleteData; var all_types_clues = ScanDataManager.Instance.Examin_clue_datas(scan_id); var all_clues = new HashSet <long>(); foreach (var kvp in all_types_clues) { all_clues.UnionWith(kvp.Value); } var scan_clues = from i in all_clues select new iconAndName() { m_icon = ConfFindClue.Get(i).icon, m_name = LocalizeModule.Instance.GetString(ConfFindClue.Get(i).name), }; foreach (var item in scan_clues) { conditions.Add(item); } } } } m_aim_grid.EnsureSize <AimItemView>(conditions.Count); for (int i = 0; i < m_aim_grid.ChildCount; ++i) { m_aim_grid.GetChild <AimItemView>(i).Refresh(conditions[i].m_icon, conditions[i].m_name); m_aim_grid.GetChild <AimItemView>(i).Visible = true; } if (m_isAcceptTask) { m_titleGet.Visible = false; ShowAcceptTaskTips(); ShowTaskTitle(confTask.rewardTitleId); } }
//private static void OnExcuteTask(NormalTask taskInfo) //{ // if (taskInfo.CompleteConditionList.Count <= 1) // { //目录没有组合条件 // TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; // TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; // switch (taskCompleteAttribute.CompleteMode) // { // case TaskCompleteMode.CompletedByDialog: // TalkUIHelper.OnStartTalk((long)taskCompleteCondition.TaskCompleteData); // break; // case TaskCompleteMode.CompletedBySceneID: // long sceneID = (long)taskCompleteCondition.TaskCompleteData; // ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID); // CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID); // break; // //case TaskCompleteMode.CompletedByEvents: // // EventGameUIAssist.BeginEventGame((long)taskCompleteCondition.TaskCompleteData); // // break; // case TaskCompleteMode.CompletedByItem: // GameEvents.TaskEvents.OnShowCollectionTaskDetail.SafeInvoke(taskInfo, ShowSceneInBigWorld); // break; // case TaskCompleteMode.CompleteByReasonID: // ReasoningUILogic.ShowReasonUIById((long)taskCompleteCondition.TaskCompleteData); // break; // case TaskCompleteMode.CompleteByScanID: // long scanID = (long)taskCompleteCondition.TaskCompleteData; // ChapterInfo scanTaskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID); // CommonHelper.OpenEnterGameSceneUI(scanID, scanTaskBelongChapterInfo, taskInfo.TaskConfID); // break; // default: // break; // } // } // else // { // TaskCompleteCondition c_items = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteItems)); // if (null != c_items) // { // TaskCompleteCondition c_scene = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteByScene)); // Action<long> close_act = null; // if (null != c_scene) // { // close_act = (task_conf_id) => // { // long task_config_id = task_conf_id; // long sceneID = (long)c_scene.TaskCompleteData; // ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID); // CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID); // }; // } // GameEvents.TaskEvents.OnShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act); // } // } //} private static void OnExcuteTask(NormalTask taskInfo) { if (taskInfo.CompleteConditionList.Count <= 1) { //目录没有组合条件 TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; switch (taskCompleteAttribute.CompleteMode) { case TaskCompleteMode.CompletedByDialog: { TalkUIHelper.OnStartTalk((long)taskCompleteCondition.TaskCompleteData); } break; case TaskCompleteMode.CompletedBySceneID: { Action <long> close_act = null; close_act = (task_conf_id) => { long sceneID = (long)taskCompleteCondition.TaskCompleteData; ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID); CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID); }; GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act); } break; //case TaskCompleteMode.CompletedByEvents: // EventGameUIAssist.BeginEventGame((long)taskCompleteCondition.TaskCompleteData); // break; case TaskCompleteMode.CompletedByItem: { GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, ShowSceneInBigWorld); } break; case TaskCompleteMode.CompleteByReasonID: { Action <long> close_act = null; close_act = (task_conf_id) => { ReasoningUILogic.ShowReasonUIById((long)taskCompleteCondition.TaskCompleteData); }; GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act); } break; case TaskCompleteMode.CompleteByCombinePropID: { Action <long> close_act = null; close_act = (task_conf_id) => { long[] ids = ConfTask.Get(task_conf_id).conditionPropExIds; if (ids.Length > 0) { FrameMgr.OpenUIParams uiParams = new FrameMgr.OpenUIParams(UIDefine.UI_COMBINE); uiParams.Param = ids[0]; EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(uiParams); } else { EngineCoreEvents.UIEvent.ShowUIEvent.SafeInvoke(UIDefine.UI_COMBINE); } }; GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act); } break; case TaskCompleteMode.CompleteByScanID: { Action <long> close_act = null; close_act = (task_conf_id) => { long scanID = (long)taskCompleteCondition.TaskCompleteData; ChapterInfo scanTaskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID); CommonHelper.OpenEnterGameScanUI(scanID, scanTaskBelongChapterInfo, taskInfo.TaskConfID); }; GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act); } break; default: break; } } else { TaskCompleteCondition c_items = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteItems)); if (null != c_items) { TaskCompleteCondition c_scene = taskInfo.CompleteConditionList.Find((item) => item.GetType() == typeof(TaskCompleteByScene)); Action <long> close_act = null; if (null != c_scene) { close_act = (task_conf_id) => { long task_config_id = task_conf_id; long sceneID = (long)c_scene.TaskCompleteData; ChapterInfo taskBelongChapterInfo = GetTaskBelongChapter(taskInfo.TaskConfID); CommonHelper.OpenEnterGameSceneUI(sceneID, taskBelongChapterInfo, taskInfo.TaskConfID); }; } GameEvents.TaskEvents.OnTryShowCollectionTaskDetail.SafeInvoke(taskInfo, close_act); } } }
private void OnRes(object obj) { if (obj is SCChatFinishResponse) { SCChatFinishResponse res = (SCChatFinishResponse)obj; if (res.Status == null) { var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); CSChatFinishRequest req_msg = req as CSChatFinishRequest; long chat_id = req_msg.ChatId; foreach (var task in m_currentTaskList) { NormalTask taskInfo = task as NormalTask; if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count) { continue; } TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; if (TaskCompleteMode.CompletedByDialog != taskCompleteAttribute.CompleteMode) { continue; } long task_dialog_id = (long)taskCompleteCondition.TaskCompleteData; if (chat_id != task_dialog_id) { continue; } taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED; } GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count); } } else if (obj is SCCombineResponse) { SCCombineResponse res = (SCCombineResponse)obj; if (res.Success) { var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); CSCombineRequest req_msg = req as CSCombineRequest; long combine_id = req_msg.CombineId; long prop_id = ConfCombineFormula.Get(combine_id).outputId; bool tsk_finished = false; foreach (var task in m_currentTaskList) { NormalTask taskInfo = task as NormalTask; if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count) { continue; } TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; if (TaskCompleteMode.CompleteByCombinePropID != taskCompleteAttribute.CompleteMode) { continue; } long[] all_tsk_combine_prop_id = (long[])taskCompleteCondition.TaskCompleteData; if (0 == all_tsk_combine_prop_id.Length) { Debug.LogError($"合成任务{taskInfo.TaskConfID}没有配置完成物件"); continue; } long task_combine_prop_id = all_tsk_combine_prop_id[0]; if (prop_id != task_combine_prop_id) { continue; } tsk_finished = true; taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED; } if (tsk_finished) { GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count); EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_COMBINE); } } } else if (obj is SCCartoonEnterResponse) { SCCartoonEnterResponse res = obj as SCCartoonEnterResponse; if (!MsgStatusCodeUtil.OnError(res.Result)) { var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); CSCartoonEnterRequest req_msg = req as CSCartoonEnterRequest; long cur_scene_id = req_msg.SceneId; foreach (var task in m_currentTaskList) { NormalTask taskInfo = task as NormalTask; if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count) { continue; } TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; if (TaskCompleteMode.CompletedBySceneID != taskCompleteAttribute.CompleteMode) { continue; } long scene_id = (long)taskCompleteCondition.TaskCompleteData; if (CommonData.C_CARTOON_SCENE_START_ID != scene_id / CommonData.C_SCENE_TYPE_ID) { continue; } if (cur_scene_id != scene_id) { continue; } taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED; } } } else if (obj is SCCartoonRewardReqsponse) { GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count); } }
/// <summary> /// 交任务相应 /// </summary> /// <param name="message"></param> private void OnCommitTask(object message) { SCTaskCommitResponse msg = message as SCTaskCommitResponse; if (!MsgStatusCodeUtil.OnError(msg.Result)) { TaskBase commitTaskInfo = this.m_playerTaskSet.GetTaskById(msg.TaskId); if (commitTaskInfo == null) { Debug.LogError($"commit task :{msg.TaskId} not found"); } GameEvents.TaskEvents.OnReceiveTask.SafeInvoke(commitTaskInfo); GameEvents.PlayerEvents.OnExpChanged.SafeInvoke(null, msg.Exp); commitTaskInfo.TaskCurrentStatus = TaskStatus.REWARDED; commitTaskInfo.TaskSyncStatus = TaskSyncStatus.SYNCED; if (this.m_currentTaskList.Contains(commitTaskInfo)) { this.m_currentTaskList.Remove(commitTaskInfo); } //同步玩家最新信息 GameEvents.PlayerEvents.RequestLatestPlayerInfo.SafeInvoke(); //同步背包 //GlobalInfo.MY_PLAYER_INFO.SyncPlayerBag(); NormalTask taskInfo = commitTaskInfo as NormalTask; for (int i = 0; i < taskInfo.RewardList.Count; ++i) { TaskRewardBase taskReward = taskInfo.RewardList[i]; TaskRewardMode taskRewardType = (taskReward.GetType().GetCustomAttributes(typeof(TaskRewardAttribute), true)[0] as TaskRewardAttribute).RewardMode; if (TaskRewardMode.ITEM == taskRewardType) { TaskRewardItem rewardItem = taskReward as TaskRewardItem; RewardItemDataWrap rewardItemData = rewardItem.RewardData; if (RewardItemType.ITEM == rewardItemData.ItemType) { GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(rewardItemData.ItemID, rewardItemData.ItemNum); } } } GameEvents.UIEvents.UI_GameEntry_Event.Listen_OnCombinePropCollected.SafeInvoke(); //> BigWorldManager.Instance.EnterBigWorld(); GameEvents.TaskEvents.OnCompletedTask.SafeInvoke(msg.Result, commitTaskInfo); HttpPingModule.Instance.SendPing(); //TODO : 放在主界面onshow //if (C_FIRST_TASK_ID == commitTaskInfo.TaskConfID) //{ // SignInManager sm = new SignInManager(); //} } else { GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(1); } }