//월드로드 private void JsonWorldInfoLoad() { ////테이블 명은 분리해주세요 FilePath = Application.dataPath + "/StreamingAssets/DataTable/WorldInfo.json"; string jdata = File.ReadAllText(FilePath); List <WorldInfo> a_WorldList; a_WorldList = JsonUtility.FromJson <Serialization <WorldInfo> >(jdata).Sheet1; //여기서 데이터 처리 for (int i = 0; i < a_WorldList.Count; i++) { string[] datas = a_WorldList[i].Wolrd_RandomChapter.Split(','); a_WorldList[i].World_RandomChapterList = new List <PercentInfo>(); for (int j = 0; j < datas.Length; j++) { string[] Splits = datas[j].Split(':'); PercentInfo InsertData = new PercentInfo(); InsertData.ID = int.Parse(Splits[0]); //InsertData.Percent = float.Parse(Splits[1]); InsertData.Percent = int.Parse(Splits[1]); a_WorldList[i].World_RandomChapterList.Add(InsertData); } } //여기서 게임매니저의 인스턴스의 월드매니저의 SetWorldList(a_LoadItemList)호출 GameManager.instance.WdManager.SetWorldList(a_WorldList); }// private void JsonWorldInfoLoad()
}// private void JsonWorldInfoLoad() //챕터로드 private void JsonChapterInfoLoad() { FilePath = Application.dataPath + "/StreamingAssets/DataTable/ChapterInfo.json"; string jdata = File.ReadAllText(FilePath); List <ChapterInfo> a_ChapterList; a_ChapterList = JsonUtility.FromJson <Serialization <ChapterInfo> >(jdata).Sheet1; //로드부분 for (int i = 0; i < a_ChapterList.Count; i++) { string[] datas = a_ChapterList[i].ChapterName.Split(','); a_ChapterList[i].Chapter_MapList = new List <PercentInfo>(); for (int j = 0; j < datas.Length; j++) { string[] Splits = datas[j].Split(':'); PercentInfo InsertData = new PercentInfo(); InsertData.ID = int.Parse(Splits[0]); InsertData.Percent = int.Parse(Splits[1]); a_ChapterList[i].Chapter_MapList.Add(InsertData); } // for(int j=0; j<datas.Length; j++) } //for(int i=0; i<a_ChapterList.Count; i++) GameManager.instance.ChaptManager.SetChapterList(a_ChapterList); }// private void JsonChapterInfoLoad()
public void RandomSetting() { int ChapterId = PercentInfo.RandomSelcet(GameManager.instance.WdManager.NowPlayWorld.World_RandomChapterList); //랜덤챕터리스트 //Debug.Log(ChapterId); for (int j = 0; j < GameManager.instance.ChaptManager.ChapterList.Count; j++) { if (ChapterId == GameManager.instance.ChaptManager.ChapterList[j].Chapterid) //랜덤챕터리스트 와 챕터리스트 아이디 비교 { GameManager.instance.WdManager.NowPlayWorld.World_ChapterList.Add(GameManager.instance.ChaptManager.ChapterList[j]); break; } } //for (int j = 0; j < World_RandomChapterList.Count; j++) }
public void RandomSetting() { GameManager.instance.ChaptManager.NowChapter.IsClear = false; for (int i = 0; i < 10; i++) { int ChapterId = PercentInfo.StageRandomSelect(m_ChapterInfo.Chapter_MapList); //랜덤챕터리스트 Debug.Log("Chapter ID" + ChapterId); //Debug.Log(ChapterId); for (int j = 0; j < GameManager.instance.StManager.StageList.Count; j++) { if (ChapterId == GameManager.instance.StManager.StageList[j].Stageid) //랜덤챕터리스트 와 챕터리스트 아이디 비교 { GameManager.instance.ChaptManager.NowChapter.Chapter_StageList.Add(GameManager.instance.StManager.StageList[j]); } }//for (int j = 0; j < World_RandomChapterList.Count; j++) } }
}// private void JsonStageInfoLoad() #region PlayerPrefsLoad public void PlayerPrefs_ChapterListLoad() { if (PlayerPrefs.HasKey("WorldID")) { Debug.Log("로드중입니다"); GameManager.instance.WdManager.SelectedWorldID = PlayerPrefs.GetInt("WorldID"); GameManager.instance.WdManager.NowPlayWorld.ChapterProgress = PlayerPrefs.GetInt("ChpaterProgress"); if (PlayerPrefs.GetString("WorldSelect") == "true") { Debug.Log("해당월드가 존재합니다"); GameManager.instance.WdManager.NowPlayWorld.isChapter = true; } else if (PlayerPrefs.GetString("WorldSelect") == "false") //다시챕터초기화시작 { Debug.Log("flase로 들어왔습니다"); GameManager.instance.WdManager.NowPlayWorld.isChapter = false; return; } else { Debug.Log("해당월드 셀렉이 존재하지않습니다"); return; } if (PlayerPrefs.GetString("ExitChapter") == "true") { Debug.Log("ExitTrue"); GameManager.instance.WdManager.NowPlayWorld.ExitChapter = true; } else { Debug.Log("ExitFalse"); GameManager.instance.WdManager.NowPlayWorld.ExitChapter = false; } if (PlayerPrefs.GetString("WorldClear") == "true") { GameManager.instance.WdManager.NowPlayWorld.isWorldClear = true; } else { GameManager.instance.WdManager.NowPlayWorld.isWorldClear = false; } if (PlayerPrefs.GetString("ChapterClear") == "true") { GameManager.instance.WdManager.NowPlayWorld.isChapterClear = true; } else { GameManager.instance.WdManager.NowPlayWorld.isChapterClear = false; } //PlayerHP PlayerCtrl.PlayerHp = PlayerPrefs.GetInt("PlayerHP"); GameManager.instance.WdManager.NowPlayWorld.Worldid = PlayerPrefs.GetInt("WorldID"); int Count = PlayerPrefs.GetInt("ChapterCount"); for (int i = 0; i < Count; i++) { ChapterInfo newNode = new ChapterInfo(); newNode.Chapterid = PlayerPrefs.GetInt("ChpaterID " + (i + 1)); newNode.ChapterName = PlayerPrefs.GetString("ChapterName " + (i + 1)); GameManager.instance.WdManager.NowPlayWorld.World_ChapterList.Add(newNode); } int Count2 = PlayerPrefs.GetInt("ChapterRandomCount"); for (int i = 0; i < Count2; i++) { PercentInfo newNode = new PercentInfo(); newNode.ID = PlayerPrefs.GetInt("ChapterRandomName " + (i + 1)); newNode.Percent = PlayerPrefs.GetFloat("ChpaterRandomPercent " + (i + 1)); GameManager.instance.WdManager.NowPlayWorld.World_RandomChapterList.Add(newNode); } //일단은랜덥챕터리스트저장 } //if (PlayerPrefs.HasKey("WorldID")) } // void PlayerPrefs_ChapterListLoad()