public void Refresh() { _CanEnter = true; MarkSprite.gameObject.SetActive(false); Btn_Drop.enabled = true; DungeonsManager dm = Core.Data.dungeonsManager; int lastfloorid = dm.lastFloorId; int currchapter = System.Convert.ToInt32(gameObject.name); ChapterData chapter = dm.reverseToChapterMore(lastfloorid); if (chapter != null) { //Debug.Log(" chapter ="+chapter.ID.ToString() +" currchapter ="+ currchapter.ToString()); if (currchapter - chapter.ID == 100) { uinew.enabled = true; } else { uinew.enabled = false; } } }
//-------------------------------------------------------------------------------------- // Methods (General): //-------------------------------------------------------------------------------------- #region void Initialize() /// <summary> /// Initialize the manager. /// </summary> public void Initialize() { // Initialize this manager only once: if (initialized) { return; } // Create all the chapters data of the game: var chaptersDescriptor = LoadXmlFromResources <ChaptersXml>(CHAPTERS_PATH); if (chaptersDescriptor != null) { Chapters = ChapterData.Create(chaptersDescriptor); } else { throw new Exception("Can't load the chapters descriptor."); } // Load the font of the game: TextFont = Resources.Load <Font>(FONT_NAME); // Load the profiles & options of the game: LoadCurrentProfiles(); LoadOptions(); // Set the initial state of the game: State = new MenuState(); State.Initialize(); // Change the initialized flag: initialized = true; }
public void Debug_ChangeChapterURL(Chapter a_chapter) { SerieData serie_data = m_series.First(sd => sd.Title == a_chapter.Serie.Title); ChapterData chapter_data = serie_data.Chapters.First(c => c.Title == a_chapter.Title); chapter_data.URL += " " + m_random.Next(); }
private void LoadDungeonData() { string dataPath = "datas/Dungeons.xml"; var asset = XmlHelper.LoadXml(dataPath); if (asset != null) { for (int i = 0; i < asset.Children.Count; i++) { var chapterNode = asset.Children[i] as SecurityElement; var chapterData = new ChapterData(); chapterData.id = chapterNode.Attribute("id").ToUint(); chapterData.name = chapterNode.Attribute("name"); chapterData.dungeonDatas = new Dictionary <uint, DungeonData>(); for (int j = 0; j < chapterNode.Children.Count; j++) { var dungeonNode = chapterNode.Children[j] as SecurityElement; var dungeonData = new DungeonData(); dungeonData.id = dungeonNode.Attribute("id").ToUint(); dungeonData.name = dungeonNode.Attribute("name"); dungeonData.eventid = dungeonNode.Attribute("eventid").ToUint(); dungeonData.atlas = dungeonNode.Attribute("atlas"); dungeonData.star = dungeonNode.Attribute("star").ToUint(); dungeonData.drop = dungeonNode.Attribute("drop").ToList <uint>(','); dungeonData.events = LoadSceneEvent(dungeonData.eventid); chapterData.dungeonDatas.Add(dungeonData.id, dungeonData); } chapterDatas.Add(chapterData.id, chapterData); } } }
public void InitChapterAndLevelData(C2sSprotoType.checkpoint_chapter.response resp) { if (resp.errorcode == 1) { UserManager.Instance.CpChapter = (Int32)resp.chapter; UserManager.Instance.CpType = (Int32)resp.type; UserManager.Instance.CpCheckpoint = (Int32)resp.checkpoint; UserManager.Instance.CpDropId1 = (Int32)resp.drop_id1; UserManager.Instance.CpDropId2 = (Int32)resp.drop_id2; UserManager.Instance.CpDropId3 = (Int32)resp.drop_id3; if (resp.l != null) { for (int i = 0; i < resp.l.Count; i++) { //Debug.Log("chapter" + "关" + (i + 1) + ":" + resp.l[i].chapter + " chapter_type0 :" + resp.l[i].chapter_type0 + " chapter_type1:" + resp.l[i].chapter_type1); ChapterData d = GameShared.Instance.GetChapterById((int)resp.l[i].chapter); d.curLevel[(int)Def.levelType.Normal] = (int)resp.l[i].chapter_type0; d.curLevel[(int)Def.levelType.Hard] = (int)resp.l[i].chapter_type1; d.curLevel[(int)Def.levelType.Hell] = (int)resp.l[i].chapter_type2; } } } else { Debug.LogFormat("errorcode : %d", resp.errorcode); } }
public int GetTotalStarCountOfChapterOfDungeonType(DungeonType dungeonType, int chapterID) { ChapterData chapterData = ChapterData.GetChapterDataById(chapterID); List <int> dungeonIDList = chapterData.GetChapterDungeonIDListOfDungeonType(dungeonType); return(dungeonIDList.Count * 3); }
public void SetSelectDungeon(int dungeonID) { DungeonType dungeonType = DungeonData.GetDungeonDataByID(dungeonID).dungeonType; if (_currentSelectDungeonType != dungeonType) { ResetDifficulty(dungeonType); } DungeonButton dungeonButton = null; if (_easyDungeonButtonDic.ContainsKey(dungeonID)) { _easyDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton); } else if (_normalDungeonButtonDic.ContainsKey(dungeonID)) { _normalDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton); } else if (_hardDungeonButtonDic.ContainsKey(dungeonID)) { _hardDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton); } ChapterData chapterData = ChapterData.GetChapterDataContainsDungeon(dungeonID); MoveTo(chapterData); }
public int[] getCityIds(int curCityId) { ChapterData chapter = reverseToChapter(curCityId); Utils.Assert(chapter == null, "Chapter Or City Config file is wrong. CityId = " + curCityId); return(chapter.cityID); }
public void ResetPlayerData() { playerData = new PlayerData(); playerData.totalChapterUnlocked = 1; //playerData.currentChapter = GameManager.Instance.allChapterList[0].chapterName; playerData.currentChapter = GameManager.Instance.sortedChapterList[0].chapterName; playerData.currentSubchapter = GameManager.Instance.allSubchapterList[0].subchapterName; playerData.totalChapter = GameManager.Instance.allChapterData.Count; playerData.chapterUnlocked.Add(playerData.currentChapter, true); chapterData = new ChapterData(0, playerData.currentChapter, true, GameManager.Instance.allChapterData[playerData.currentChapter].subchapterList.Count, 1); //Debug.Log("subchapter count " + playerData.allChapterUnlocked[playerData.currentChapter].subchapterNameList); for (int i = 0; i < GameManager.Instance.allChapterData[playerData.currentChapter].subchapterList.Count; i++) { string subchapterName = GameManager.Instance.allChapterData[playerData.currentChapter].subchapterList[i].subchapterName; chapterData.subchapterNameList.Add(subchapterName); } //playerData.allChapterUnlocked.Add(GameManager.Instance.allChapterList[0].chapterName, chapterData); playerData.allChapterUnlocked.Add(GameManager.Instance.sortedChapterList[0].chapterName, chapterData); //string firstChapterName = GameManager.Instance.allChapterList[0].chapterName; string firstChapterName = GameManager.Instance.sortedChapterList[0].chapterName; string subchapterKey = firstChapterName + "|" + GameManager.Instance.allChapterData[firstChapterName].subchapterList[0].subchapterName; playerData.subchapterUnlocked.Add(subchapterKey, true); Debug.Log("current chapter unlocked data " + subchapterKey + " status " + playerData.subchapterUnlocked[subchapterKey]); SaveData(); }
public void Init() { advEntity = new AdvEntity(); catsPurse = new CatsPurse(); gamesRecords = new GamesRecords(); buster_entity = new BusterEntity(); push_entity = new PushEntity(); cat_rang = new CatRang(); minigames_screen_data = new MinigamesScreenData(); world_state_data = new WorldStateDataStorage(); other_storage = new Dictionary <string, object>(); tasks_storage = new StorableData <Dictionary <string, object> >("tasks_storage_help"); chapter_data = new ChapterData(); if (!tasks_storage.content.ContainsKey("all_done")) { tasks_storage.content["all_done"] = false; tasks_storage.Store(); } Analytics.CustomEvent("catsPurse", new Dictionary <string, object> { { "coins", catsPurse.Coins }, }); Analytics.CustomEvent("gamesRecords", new Dictionary <string, object> { { "taptap_best_value", gamesRecords.Record(GameName.taptap.ToString()).best_value }, { "zigzag_best_value", gamesRecords.Record(GameName.zigzag.ToString()).best_value }, }); }
private void Awake() { _chapterData = FindObjectOfType <ChapterData>(); nameInput.placeholder.GetComponent <TextMeshProUGUI>().text = Localization.Localization.Get("loginUI.Account"); passwordInput.placeholder.GetComponent <TextMeshProUGUI>().text = Localization.Localization.Get("loginUI.Password"); successText.text = Localization.Localization.Get("loginUI.Success"); loginButtonText.text = Localization.Localization.Get("loginUI.Login"); }
private IEnumerable <ChapterData> GenerateChapters(int a_count = -1) { if (Seed == 0) { yield break; } Random random = new Random(Seed); int maxc = (int)Math.Pow(random.Next(4, 15), 2); if (a_count != -1) { maxc = a_count; } for (int c = 1; c <= maxc; c++) { ChapterData chapter = new ChapterData(); chapter.SetTitleURL(Title + " - Chapter " + c.ToString()); chapter.Seed = random.Next(); yield return(chapter); } { ChapterData chapter = new ChapterData(); chapter.SetTitleURL(Title + " - empty pages"); yield return(chapter); } { ChapterData chapter = new ChapterData(); chapter.SetTitleURL(Title + " - error pages none"); chapter.Seed = random.Next(); yield return(chapter); } { ChapterData chapter = new ChapterData(); chapter.SetTitleURL(Title + " - error page getimageurl"); chapter.Seed = random.Next(); yield return(chapter); } { ChapterData chapter = new ChapterData(); chapter.SetTitleURL(Title + " - error page getimagestream"); chapter.Seed = random.Next(); yield return(chapter); } { ChapterData chapter = new ChapterData(); chapter.SetTitleURL(Title + " - out of order pages"); chapter.Seed = random.Next(); yield return(chapter); } }
internal void InitDefault(string excelPath) { CreateScenariosIfMissing(); ChapterData chapter = new ChapterData(); chapter.InitDefault(excelPath); chapterDataList.Insert(0, chapter); EditorUtility.SetDirty(this); }
private void OnLevelEnd(PlayerReachedEndSignal signalData) { if (signalData.hasWon) { ChapterData currentChapter = _chapterDataManager.GetCurrentChapter(); _chapterDataManager.SetChapterLevelAsCompelte(currentChapter.chaper_id, currentLevelData.level_number); } _player.gameObject.SetActive(false); }
public void Debug_InsertChapter(Serie a_serie, int a_index) { SerieData serie_data = m_series.First(sd => sd.Title == a_serie.Title); var cd = new ChapterData(); cd.Seed = m_random.Next(); cd.SetTitleURL(">>> added chapter " + m_random.Next()); serie_data.Chapters.Insert(a_index, cd); }
//根据Floor Id来获取当前大关卡之前的 大关卡 public int[] getChapterIds_LessMore(int curFloorId) { ChapterData curChapter = reverseToChapterMore(curFloorId); Utils.Assert(curChapter == null, "Can't find Chapter Data from FloorId. ID = " + curFloorId); int curChapterId = curChapter.ID; return(getChapterIds_less(curChapterId)); }
private void GenerateData() { ChapterDatas = new Dictionary <int, ChapterData>(); foreach (var chapterExcelData in ChapterExcelDatas) { ChapterData chapterData = new ChapterData(chapterExcelData); ChapterDatas.Add(chapterData.Id, chapterData); } }
public bool TryGetChapterData(int chapterId, out ChapterData Data) { if (ChapterDatas.TryGetValue(chapterId, out Data)) { return(true); } Debug.LogError($"Error TryGetChapterData chapterId:{chapterId}"); return(false); }
private IEnumerable<ChapterData> GenerateChapters(int a_count = -1) { if (Seed == 0) yield break; var random = new Random(Seed); var maxc = (int)Math.Pow(random.Next(4, 15), 2); if (a_count != -1) maxc = a_count; for (var c = 1; c <= maxc; c++) { var chapter = new ChapterData(); chapter.SetTitleURL(Title + " - Chapter " + c.ToString()); chapter.Seed = random.Next(); yield return chapter; } { var chapter = new ChapterData(); chapter.SetTitleURL(Title + " - empty pages"); yield return chapter; } { var chapter = new ChapterData(); chapter.SetTitleURL(Title + " - error pages none"); chapter.Seed = random.Next(); yield return chapter; } { var chapter = new ChapterData(); chapter.SetTitleURL(Title + " - error page getimageurl"); chapter.Seed = random.Next(); yield return chapter; } { var chapter = new ChapterData(); chapter.SetTitleURL(Title + " - error page getimagestream"); chapter.Seed = random.Next(); yield return chapter; } { var chapter = new ChapterData(); chapter.SetTitleURL(Title + " - out of order pages"); chapter.Seed = random.Next(); yield return chapter; } }
//Sets Chapter Data and adds to ChapterDataList private static void UpdateChapterList(ChapterState _chapterState, int _pageCount) { //Create new ChapterData object and set stuff. ChapterData _chapterData = new ChapterData(); _chapterData.State = _chapterState; _chapterData.PageCount = _pageCount; _chapterData.ID = (int)_chapterState.GetHashCode();//Get ID from enum HashCode 0-9 //Update dictionary with ChapterState and ChapterData ChapterDataList.Add(_chapterData); }
void UpdateOldVersion() { if (excelList.Count > 0) { ChapterData chapter = new ChapterData(); chapter.InitDefault(this.excelList); this.chapterDataList.Insert(0, chapter); this.excelList.Clear(); EditorUtility.SetDirty(this); Debug.Log("Update Old Project"); } }
void Start() { dataController = FindObjectOfType <DataController>(); // Store a reference to the DataController so we can request the data we need for this chapter currentChapterData = dataController.GetCurrentChapterData(); // Ask the DataController for the data for the current chapter. At the moment, we only have one chapter - but we could extend this //init player progress dataController.playerProgress.currentSequenceId = 0; dataController.SavePlayerProgress(); ShowNextSequence(); }
//Sets Chapter Data and adds to ChapterDataList private static void UpdateChapterList(ChapterState _chapterState, int _pageCount) { //Create new ChapterData object and set stuff. ChapterData _chapterData = new ChapterData(); _chapterData.State = _chapterState; _chapterData.PageCount = _pageCount; _chapterData.ID = (int)_chapterState.GetHashCode(); //Get ID from enum HashCode 0-9 //Update dictionary with ChapterState and ChapterData ChapterDataList.Add(_chapterData); }
// Use this for initialization void Start() { roleGo = GameObject.Find("Role"); var userInfo = DataManager.GetInstance().GetUserInfo(); var characterTable = CharacterTableData.CreateFromJson(); // 加载英雄数据 for (int i = 0; i < userInfo.heroList.Count; i++) { var heroInfo = userInfo.heroList[i]; var characterData = characterTable.GetCharacterInfoById(heroInfo.characterId); var heroPrefab = (GameObject)Resources.Load(characterData.heroPath); GameObject go = Instantiate(heroPrefab, new Vector3(-12, -i, 0), Quaternion.identity, roleGo.transform); Role role = go.GetComponent <Role>(); role.Atk = characterData.atk; role.Hp = heroInfo.lastHp; // 英雄剩下的血量 role.MaxHp = characterData.hp; role.HeroInfoId = heroInfo.id; // 战斗模型跟英雄数据的关系 role.AtkDis = characterData.atkDis; role.AtkSpeed = characterData.atkSpeed; role.RoleType1 = Role.RoleType.HERO; role.MoveSpeed = characterData.moveSpeed; Instantiate(hpBar, go.transform); // 创建血条 } var chapterTable = ChapterTableData.CreateFromJson(); currentChapterData = chapterTable.GetChapterInfoById(userInfo.fightChapterId); // 加载副本怪物数据 for (int i = 0; i < currentChapterData.enemy.Length; i++) { var characterData = characterTable.GetCharacterInfoById(currentChapterData.enemy[i]); var heroPrefab = (GameObject)Resources.Load(characterData.heroPath); GameObject go = Instantiate(heroPrefab, new Vector3(12, -i, 0), Quaternion.identity, roleGo.transform); Role role = go.GetComponent <Role>(); role.Atk = characterData.atk; role.Hp = characterData.hp; role.MaxHp = characterData.hp; role.AtkDis = characterData.atkDis; role.AtkSpeed = characterData.atkSpeed; role.RoleType1 = Role.RoleType.ENEMY; role.MoveSpeed = characterData.moveSpeed; Instantiate(hpBar, go.transform); // 创建血条 } }
public void RenderCurrentChapter() { ChapterData chapter = _chapterDataManager.GetCurrentChapter(); if (chapter != null) { RenderChaperLevels(chapter.levels); } else { Debug.LogError("Cannot find chapter "); } }
/// <summary> /// 根据ChapterID找到第后一个中关卡ID /// </summary> /// <returns>The max city identifier.</returns> /// <param name="chapter">Chapter.</param> private int getMaxCityId(int chapter) { ChapterData cd = null; if (ChapterConfigList.TryGetValue(chapter, out cd)) { return(cd.cityID[cd.cityID.Length - 1]); } else { throw new DragonException("Can't Chatper Data according to Chapter Id = " + chapter); } }
public int GetPlayerGainStarCountOfChapterOfDungeonType(DungeonType dungeonType, int chapterID) { int playerGainStarCountOfChpaterOfDungeonType = 0; ChapterData chapterData = ChapterData.GetChapterDataById(chapterID); List <int> dungeonIDList = chapterData.GetChapterDungeonIDListOfDungeonType(dungeonType); DungeonInfo dungeonInfo = null; for (int i = 0; i < dungeonIDList.Count; i++) { playerGainStarCountOfChpaterOfDungeonType += GetDungeonInfo(dungeonIDList[i]).star; } return(playerGainStarCountOfChpaterOfDungeonType); }
public void levelsClick(ChapterData d) { if (isShow[(int)PopType.Level] != true) { GameObject obj = Instantiate(levelPop); obj.SetActive(true); LevelsPop pop = obj.GetComponent <LevelsPop>(); pop.InitData(d); pop.transform.parent = this.transform; pop.transform.localScale = Vector3.one; isShow[(int)PopType.Level] = true; } }
internal void Debug_DuplicateChapterURL(Chapter a_chapter) { SerieData serie_data = m_series.First(sd => sd.Title == a_chapter.Serie.Title); var cd = new ChapterData(); cd.Seed = m_random.Next(); cd.Title = ">>> duplicated name chapter " + a_chapter.Title; cd.URL = a_chapter.URL; var chapter = serie_data.Chapters.First(s => s.Title == a_chapter.Title); serie_data.Chapters.Insert(serie_data.Chapters.IndexOf(chapter) + 1, cd); }
public void SetActive(bool doActivate, ChapterData chapterData = null) { // activate/deactivate button transform.root.Find("MiscUI/BottomControlPanel/MiddleControls/PrologBeginGameButton").gameObject.SetActive(doActivate); // activate/deactivate background transform.root.Find("MiscUI").GetComponentInChildren <BackgroundUI>(true).SetActive(doActivate); // activate animation if we are activating prolog if (doActivate) { GetComponentInChildren <PrologAnimation>(true).SetActive(chapterData); } // activate/deactivate this menu gameObject.SetActive(doActivate); }
public void SetData() { data.chapterData = new List <ChapterData>(); for (int i = 0; i < chapter.dataArray.Count; i++) { ChapterData temp = new ChapterData(); temp.Scene = chapter.dataArray[i].Scene; temp.Character1 = chapter.dataArray[i].Character1; temp.Character2 = chapter.dataArray[i].Character2; temp.Highlight = chapter.dataArray[i].Highlight; temp.Dialogue = chapter.dataArray[i].Dialogue; data.chapterData.Add(temp); } }
public void InitChapter(ChapterData cur) { if (cur.csv_id > UserManager.Instance.curUnLockChapter) { ToastManager.Instance.Show("未解锁"); } else { name.text = cur.name; bg.spriteName = cur.bg; index = cur.csv_id; data = cur; } }
public void ShowChapterInfo() { string chapterName = stageSelect.chapterName; if (isShowing) { return; } else { isShowing = true; gameObject.SetActive(true); tipUI.gameObject.SetActive(false); selectedChapterData = JsonManager.instance.GetChapterData(chapterName); princessIllust.sprite = SpriteManager.instance.GetSprite(PackingType.Princess, chapterName + "_L"); princessIllust.SetNativeSize(); chapterNameText.text = selectedChapterData.chapterName; chapterDescriptionText.text = selectedChapterData.chapterDescription; skillNameText.text = selectedChapterData.skillName; skillDescriptionText.text = selectedChapterData.skillDescription; } }
internal void Debug_DuplicateChapterURL(Chapter a_chapter) { var serie_data = m_series.First(sd => sd.Title == a_chapter.Serie.Title); var cd = new ChapterData { Seed = m_random.Next(), Title = ">>> duplicated name chapter " + a_chapter.Title, URL = a_chapter.URL }; var chapter = serie_data.Chapters.First(s => s.Title == a_chapter.Title); serie_data.Chapters.Insert(serie_data.Chapters.IndexOf(chapter) + 1, cd); }
public void Debug_InsertChapter(Serie a_serie, int a_index) { var serie_data = m_series.First(sd => sd.Title == a_serie.Title); var cd = new ChapterData {Seed = m_random.Next()}; cd.SetTitleURL(">>> added chapter " + m_random.Next()); serie_data.Chapters.Insert(a_index, cd); }
public void Debug_DuplicateChapterName(Chapter a_chapter) { SerieData serie_data = m_series.First(sd => sd.Title == a_chapter.Serie.Title); var cd = new ChapterData(); cd.Seed = m_random.Next(); cd.Title = a_chapter.Title; cd.URL = ">>> duplicated name chapter " + a_chapter.URL; var chapter = serie_data.Chapters.First(s => s.Title == a_chapter.Title); serie_data.Chapters.Insert(serie_data.Chapters.IndexOf(chapter) + 1, cd); }
public ChapterData GetChapterData(string chapterName) { chapterData = JsonMapper.ToObject(chapterDataJson.text)[chapterName]; ChapterData returnData = new ChapterData(); returnData.chapterName = chapterData["Chapter Name"].ToString(); returnData.chapterDescription = chapterData["Chapter Description"].ToString(); returnData.skillName = chapterData["Skill Name"].ToString(); returnData.skillDescription = chapterData["Skill Description"].ToString(); return returnData; }