/// <summary> /// 解锁新的章节 /// </summary> /// <param name="chapterUUID"></param> /// <param name="chapterConfID"></param> public void UnLockChapter(long chapterUUID, long chapterConfID) { ChapterInfo unlockedChapterInfo = this.m_playerChapterSet.UnLockNewChapter(chapterUUID, chapterConfID); SyncChapterDetailInfo(chapterUUID); m_currentChapterInfo = unlockedChapterInfo; FindObjSceneDataManager.Instance.RefreshAllInfo(this.m_currentChapterInfo.ChapterID); GameEvents.ChapterEvents.OnUnlockChapter.SafeInvoke(unlockedChapterInfo); }
/// <summary> /// 获取章节最新信息 /// </summary> /// <param name="chapterID"></param> public ChapterInfo GetChapterLatestInfo(long chapterID) { ChapterInfo chapterInfo = this.m_playerChapterSet.GetChapterInfoByID(chapterID); if (chapterInfo.ChapterStatus == ChapterStatus.DONE) { if (chapterInfo.ChapterSyncStatus == SyncStatus.LOCAL) { SyncChapterDetailInfo(chapterInfo.PlayerChapterUUID); } } return(chapterInfo); }
/// <summary> /// 解锁新章节 /// </summary> /// <param name="chapterUUID"></param> /// <param name="chapterConfID"></param> public ChapterInfo UnLockNewChapter(long chapterUUID, long chapterConfID) { ChapterInfo newChapterInfo = GetChapterInfoByID(chapterConfID); if (newChapterInfo != null) { this.m_lockedChapterList.Remove(newChapterInfo); newChapterInfo.PlayerChapterUUID = chapterUUID; newChapterInfo.ChapterStatus = ChapterStatus.UNLOCK; this.m_unlockChapterList.Add(newChapterInfo); } return(newChapterInfo); }
public static void OpenEnterGameSceneUI(long scene_id_, ChapterInfo sceneChapterInfo = null, long taskID = -1) { if (scene_id_ < 10) { CSFindEnterReq req = new CSFindEnterReq() { FindId = scene_id_, }; GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(req); EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(new FrameMgr.OpenUIParams(UIDefine.UI_SCAN_GAME) { Param = new List <long> { scene_id_, taskID } }); return; } if (CommonData.C_JIGSAW_SCENE_START_ID == scene_id_ / CommonData.C_SCENE_TYPE_ID) { EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(new FrameMgr.OpenUIParams(UIDefine.UI_ENTER_JIGSAW) { Param = new List <long> { scene_id_, taskID } }); } else if (CommonData.C_CARTOON_SCENE_START_ID == scene_id_ / CommonData.C_SCENE_TYPE_ID) { StartCartoonManager.Instance.OpenStartCartoonForID(scene_id_); } else { EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(new FrameMgr.OpenUIParams(UIDefine.UI_FIND_OBJ_ENTER_UI) { Param = new EnterSceneData() { SceneID = scene_id_, SceneBelongChapterInfo = sceneChapterInfo, taskConfID = taskID } }); } }
public static void OpenEnterGameScanUI(long scan_id_, ChapterInfo sceneChapterInfo = null, long taskID = -1) { CSFindEnterReq req = new CSFindEnterReq() { FindId = scan_id_, }; GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(req); EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(new FrameMgr.OpenUIParams(UIDefine.UI_SCAN_GAME) { Param = new List <long> { scan_id_, taskID } }); return; }
/// <summary> /// 同步章节详细信息 /// </summary> /// <param name="msg"></param> private void OnSyncChapterDetailInfo(object msg) { SCChapterDetailResponse msgChapterDetail = msg as SCChapterDetailResponse; long chapterUUID = msgChapterDetail.PlayerChapterId; long chapterConfigID = msgChapterDetail.ChapterId; if (chapterUUID == 0 || chapterConfigID == 0) { Debug.LogWarning("Sync ChapterID is 0"); return; } ChapterInfo existChapterInfo = this.m_playerChapterSet.GetChapterInfoByID(chapterConfigID); existChapterInfo.SyncChapterInfo(msgChapterDetail.Scenes, msgChapterDetail.Tasks, msgChapterDetail.Npcs, msgChapterDetail.Clues); GameEvents.ChapterEvents.OnChapterInfoUpdated.SafeInvoke(existChapterInfo); }
public override void OnShow(object param) { base.OnShow(param); if (param is ChapterInfo) { m_displayChapterInfo = param as ChapterInfo; this.m_chapterListComponent.Parameter = m_displayChapterInfo.ChapterID; } if (param is int || param is long) { this.m_chapterListComponent.Parameter = param; } this.m_chapterListComponent.Visible = true; SetCloseBtnID("Panel_caselist:Panel_animation:Button_close"); }
/// <summary> /// 添加章节信息 /// </summary> /// <param name="chapterInfo"></param> public void AddChapterInfo(ChapterInfo chapterInfo) { if (this.m_chapterInfoDict.ContainsKey(chapterInfo.ChapterID)) { throw new Exception($"chapter uuid { chapterInfo.PlayerChapterUUID} exist"); } this.m_chapterInfoDict.Add(chapterInfo.ChapterID, chapterInfo); switch (chapterInfo.ChapterStatus) { case ChapterStatus.DONE: case ChapterStatus.UNLOCK: this.m_unlockChapterList.Add(chapterInfo); break; case ChapterStatus.LOCK: this.m_lockedChapterList.Add(chapterInfo); break; } }
/// <summary> /// GM注入命令-跳任务 /// </summary> /// <param name="param"></param> /// <returns></returns> private List <IMessage> GMjumpTask(Dictionary <string, string> param) { List <IMessage> messageList = new List <IMessage>(); if (!param.ContainsKey("taskid")) { return(null); } long chapterID = 0; if (!param.ContainsKey("chapterid")) { chapterID = long.Parse(param["chapterid"]); } long finishTaskID = long.Parse(param["taskid"]); if (chapterID == 0) { ChapterInfo chapterInfo = FindChapterByTaskID(finishTaskID); if (chapterInfo == null) { return(null); } chapterID = chapterInfo.ChapterID; } GmFinishTask finshTaskCmd = new GmFinishTask(); finshTaskCmd.PlayerId = GlobalInfo.MY_PLAYER_ID; finshTaskCmd.TaskId = finishTaskID; finshTaskCmd.ChapterId = chapterID; messageList.Add(finshTaskCmd); return(messageList); }
//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); } } }
/// <summary> /// 同步玩家解锁的章节列表 /// </summary> /// <param name="msg"></param> private void OnSyncPlayerChapterList(object msg) { SCChapterListResponse messageChapterList = msg as SCChapterListResponse; bool allChapterFinished = true; for (int i = 0; i < messageChapterList.Chapters.Count; ++i) { PlayerChapterInfo playerChapterInfo = messageChapterList.Chapters[i]; long chapterConfID = playerChapterInfo.ChapterId; long chapterUUID = playerChapterInfo.PlayerChapterId; //if (chapterConfID > this.m_openChapterCount) // continue; ChapterInfo chapterInfo = new ChapterInfo(chapterConfID); chapterInfo.ChapterStatus = (ChapterStatus)playerChapterInfo.Status; chapterInfo.PlayerChapterUUID = chapterUUID; if (chapterInfo.ChapterStatus == ChapterStatus.UNLOCK) { this.m_currentChapterInfo = chapterInfo; FindObjSceneDataManager.Instance.RefreshAllInfo(this.m_currentChapterInfo.ChapterID); allChapterFinished = false; //同步已解锁的章节 SyncCurrentChapterDetail(); } //下一章还没解锁 this.m_playerChapterSet.AddChapterInfo(chapterInfo); } //初始化玩家未解锁的章节 for (int i = 1; i <= this.m_openChapterCount; ++i) { ConfChapter confchapter = ConfChapter.Get(i); if (!this.m_playerChapterSet.IsExistChapterInfo(confchapter.id)) { ChapterInfo chapterInfo = new ChapterInfo(confchapter.id); this.m_playerChapterSet.AddChapterInfo(chapterInfo); allChapterFinished = false; } } //最后所有章节全部解锁 if (allChapterFinished) { this.m_currentChapterInfo = this.m_playerChapterSet.GetChapterInfoByID(this.m_openChapterCount); FindObjSceneDataManager.Instance.RefreshAllInfo(this.m_currentChapterInfo.ChapterID); SyncCurrentChapterDetail(); } if (this.m_currentChapterInfo == null) { this.m_currentChapterInfo = m_playerChapterSet.GetLastestChapterInfo(); FindObjSceneDataManager.Instance.RefreshAllInfo(this.m_currentChapterInfo.ChapterID); SyncCurrentChapterDetail(); } }
public void RemoveChapterInfo(ChapterInfo removeChapterInfo) { }