public void RefreshAllInfo(long cur_chapter_id_) { HashSet <long> scene_group_ids = new HashSet <long>(); HashSet <long> one_chapter_scene_group_ids = new HashSet <long>(); for (int i = 1; i <= cur_chapter_id_; ++i) { one_chapter_scene_group_ids.Clear(); long[] scene_ids = ConfChapter.Get(i).scenceIds; for (int j = 0; j < scene_ids.Length; ++j) { long scene_id = scene_ids[j]; long scene_group_id = ConvertSceneIdToSceneGroupId(scene_id); one_chapter_scene_group_ids.Add(scene_group_id); } scene_group_ids.UnionWith(one_chapter_scene_group_ids); } CSSceneDifficultyReq req = new CSSceneDifficultyReq(); req.BigIds.AddRange(scene_group_ids); GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(req); }
public static bool GetConfig(string fieldName, object fieldValue, out ConfChapter config) { DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_Chapter", fieldName, fieldValue); if (sqReader != null) { try { sqReader.Read(); if (sqReader.HasRows) { config = GetConfByDic(sqReader); } else { config = null; return(false); } return(true); } catch (Exception ex) { SqliteDriver.SQLiteHelper.OnError(string.Format("Chapter 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex)); } config = null; return(false); } config = null; return(false); }
public float GetMainTaskProgress() { long chapter_id = AllCompleteTask.m_last_complete_main_task_id / 10000; List <long> tasks = new List <long>(ConfChapter.Get(chapter_id).taskIds); int rewarded_count = tasks.IndexOf(AllCompleteTask.m_last_complete_main_task_id) + 1; return((float)rewarded_count / (float)tasks.Count); }
/// <summary> /// 通过章节中场景ID获取 /// </summary> /// <param name="chapterSceneID"></param> /// <returns></returns> public ConfChapter FindChapterBySceneID(long chapterSceneID) { ConfChapter chapterConfig = ConfChapter.array.Find(confChapter => confChapter.scenceIds.Contains(chapterSceneID)); if (chapterConfig == null) { return(null); } return(chapterConfig); }
/// <summary> /// 通过任务ID找到章节配置 /// </summary> /// <param name="taskConfigID"></param> /// <returns></returns> public ChapterInfo FindChapterByTaskID(long taskConfigID) { ConfChapter chapterConfig = ConfChapter.array.Find(confChapter => confChapter.taskIds.Contains(taskConfigID)); if (chapterConfig == null) { return(null); } return(this.m_playerChapterSet.GetChapterInfoByID(chapterConfig.id)); }
public void SetChapterID(long chapterID, bool status) { this.m_chapterID = chapterID; ConfChapter chapterData = ConfChapter.Get(chapterID); if (chapterData != null) { this.m_chapterCover.TextureName = chapterData.cover; this.m_chapterCover.SetGray(!status); } }
private static void GetArrrayList() { if (cacheArray.Count <= 0) { DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_Chapter"); if (sqReader != null) { while (sqReader.Read()) { ConfChapter _conf = GetConfByDic(sqReader); cacheArray.Add(_conf); dic[_conf.id] = _conf; } resLoaded = true; } } }
public static bool GetConfig(long id, out ConfChapter config) { if (dic.TryGetValue(id, out config)) { return(config != null); } if (cacheLoaded) { config = null; return(false); } DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_Chapter", id); if (sqReader != null) { try { sqReader.Read(); if (sqReader.HasRows) { config = GetConfByDic(sqReader); } else { dic[id] = null; config = null; return(false); } dic[id] = config; return(true); } catch (Exception ex) { SqliteDriver.SQLiteHelper.OnError(string.Format("Chapter 表找不到SN={0} 的数据\n{1}", id, ex)); } config = null; return(false); } else { config = null; return(false); } }
private static ConfChapter GetConfByDic(DataTable reader) { long id = reader.GetInt64(0); long building = reader.GetInt64(1); long[] taskIds = (long[])reader.GetArrayData(2, 17); string document = reader.GetString(3); long[] clueUnlockTaskIds = (long[])reader.GetArrayData(4, 17); string[] clueIds = (string[])reader.GetArrayData(5, 12); long[] actorUnlockTaskIds = (long[])reader.GetArrayData(6, 17); long[] actorIds = (long[])reader.GetArrayData(7, 17); long endSceneId = reader.GetInt64(8); long startSceneId = reader.GetInt64(9); long[] sceneUnlockTaskIds = (long[])reader.GetArrayData(10, 17); long[] scenceIds = (long[])reader.GetArrayData(11, 17); string cover = reader.GetString(12); long nextChapterId = reader.GetInt64(13); string remarks = reader.GetString(14); string descs = reader.GetString(15); string name = reader.GetString(16); ConfChapter new_obj_ConfChapter = new ConfChapter(id, building, taskIds, document, clueUnlockTaskIds, clueIds, actorUnlockTaskIds, actorIds, endSceneId, startSceneId, sceneUnlockTaskIds, scenceIds, cover, nextChapterId, remarks, descs, name ); return(new_obj_ConfChapter); }
public void SetTaskList(IList <ChapterTaskInfo> taskInfos, long currentChapterId) { //只显示完成的及正在做的 List <ChapterTaskInfo> taskInfoList = new List <ChapterTaskInfo>(); for (int i = 0; i < taskInfos.Count; ++i) { ChapterTaskInfo taskInfo = taskInfos[i]; if (taskInfo.Status == 1 || taskInfo.Status == 2) { taskInfoList.Add(taskInfo); } } //排序 taskInfoList = taskInfoList.OrderByDescending(chapterTaskInfo => - chapterTaskInfo.Status).ToList(); this.m_taskContainer.EnsureSize <ChapterTaskIntroComponent>(taskInfoList.Count); for (int i = 0; i < taskInfoList.Count; ++i) { ChapterTaskIntroComponent introComponent = this.m_taskContainer.GetChild <ChapterTaskIntroComponent>(i); introComponent.SetTaskIntro(taskInfoList[i].TaskId, taskInfoList[i].Status == 2); introComponent.Visible = true; } //m_lastChapterId = currentChapterId; ConfChapter chapter = ConfChapter.Get(currentChapterId); List <long> deadBody = new List <long>(); List <long> suspect = new List <long>(); List <long> weapon = new List <long>(); for (int i = 0; i < chapter.actorIds.Length; i++) { ConfNpc confNpc = ConfNpc.Get(chapter.actorIds[i]); if (confNpc == null) { UnityEngine.Debug.LogError("chapter npc not exist : " + chapter.actorIds[i]); continue; } bool isTaskComplete = taskInfoList.Find(s => s.TaskId == confNpc.unlockTaskId && s.Status == 2) != null || confNpc.unlockTaskId == 0; if (confNpc.identityType == 4 && isTaskComplete) //凶手 { suspect.Add(chapter.actorIds[i]); } else if (confNpc.identityType == 2 && isTaskComplete) //死者 { deadBody.Add(chapter.actorIds[i]); } else if (confNpc.identityType == 3 && isTaskComplete) //凶器 { weapon.Add(chapter.actorIds[i]); } } if (this.m_taskDead.Visible) { this.m_taskDead.SetNpcData(deadBody, 0); } if (this.m_taskSuspect.Visible) { this.m_taskSuspect.SetNpcData(suspect, 1); } if (this.m_taskWeapon.Visible) { this.m_taskWeapon.SetNpcData(weapon, 2); } }
public static void Register() { ConfAchievement.Init(); ConfActiveDrop.Init(); ConfActivityBase.Init(); ConfAssetManifest.Init(); Confbranchtask.Init(); ConfBuilding.Init(); ConfCartoonScene.Init(); ConfChapter.Init(); ConfCharge.Init(); ConfChat.Init(); ConfChatItem.Init(); ConfCheckIn.Init(); ConfCombineFormula.Init(); ConfDemoScene.Init(); ConfDropOut.Init(); ConfPropGiftItem0.Init(); ConfPropGiftItem1.Init(); ConfPropGiftItem2.Init(); ConfDropOut2.Init(); Confetl.Init(); ConfEvent.Init(); ConfEventAttribute.Init(); ConfEventPhase.Init(); Confexhibit.Init(); ConfExpToLevel.Init(); Conffailtips.Init(); ConfFeedback.Init(); ConfFind.Init(); ConfFindClue.Init(); ConfFindTypeIcon.Init(); ConfGMCMD.Init(); ConfGuid.Init(); ConfGuidArt.Init(); ConfGuidNew.Init(); ConfGuidNewFunction.Init(); Confinapppurchase.Init(); ConfJigsawScene.Init(); ConfKeyWords.Init(); ConfLanguage.Init(); ConfMsgCode.Init(); ConfNode.Init(); ConfNpc.Init(); ConfOfficer.Init(); ConfPath.Init(); ConfPoliceRankIcon.Init(); ConfProp.Init(); ConfPropGift.Init(); ConfPropGiftItem0.Init(); ConfPropGiftItem1.Init(); ConfPropGiftItem2.Init(); ConfPush.Init(); ConfReasoning.Init(); ConfScene.Init(); ConfSceneDifficulty.Init(); ConfSceneSpecial.Init(); ConfServiceConfig.Init(); ConfSkill.Init(); ConfSkyEye.Init(); ConfSound.Init(); ConfTask.Init(); ConfTitle.Init(); }
/// <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(); } }