public bool hasInitAllData = false;// 初始化基础数据 private IEnumerator LoadEsscentialData() { //首先加载不可变更数据 LoadTroopType(); yield return(null); string filePath = PathTool.DataFileRootFold + "/save/save.csv"; saveFile = new CSVFile(); saveFile.ReadCsv(filePath); dic_Save.Clear(); foreach (string[] arr in saveFile.valueLines) { if (arr.Length != 12) { continue; } DSaveData savedata = new DSaveData(); savedata.id = int.Parse(arr[0]); savedata.alias = arr[1]; savedata.shortdesc = arr[2]; savedata.fulldesc = arr[3]; savedata.id_playerFaction = int.Parse(arr[4]); savedata.id_playerSection = int.Parse(arr[5]); savedata.year = int.Parse(arr[6]); savedata.month = int.Parse(arr[7]); savedata.day = int.Parse(arr[8]); savedata.season = int.Parse(arr[9]); savedata.savetime = arr[10]; savedata.subfold = arr[11]; dic_Save.Add(savedata.id, savedata); } yield return(null); filePath = PathTool.DataFileRootFold + "/scenerial/scenerial.csv"; scenerialFile = new CSVFile(); scenerialFile.ReadCsv(filePath); dic_Scenerial.Clear(); foreach (string[] arr in scenerialFile.valueLines) { if (arr.Length != 9) { continue; } DScenerialData scedata = new DScenerialData(); scedata.id = int.Parse(arr[0]); scedata.alias = arr[1]; scedata.shortdesc = arr[2]; scedata.fulldesc = arr[3]; scedata.year = int.Parse(arr[4]); scedata.month = int.Parse(arr[5]); scedata.day = int.Parse(arr[6]); scedata.season = int.Parse(arr[7]); scedata.subfold = arr[8]; dic_Scenerial.Add(scedata.id, scedata); } yield return(null); hasInitAllData = true; }
public bool LoadSaveData(int id) { dataPrepared = false; if (dic_Save.ContainsKey(id)) { selSaveData = dic_Save[id]; string fold = PathTool.DataFileRootFold + "/save/" + selSaveData.subfold; StartCoroutine(LoadSaveData(fold)); return(true); } else { loadPercent = 0; LogTool.LogError("can not find save id" + id); return(false); } }