protected List <ToolBox.Stage> ReadStageList(string folderPath) { if (!Directory.Exists(folderPath)) { return(null); } //読み込み var list = new List <ToolBox.Stage>(); string[] fileList; //folderPath以下にあるファイルリスト(メタデータは抜く) string fileName; fileList = Directory.GetFiles(folderPath); for (int i = 0; i < fileList.Length; i++) { fileName = Path.GetFileName(fileList[i]); //拡張子が3つ = メタデータ if (fileName.Split('.').Length != 3) { fileList[i] = folderPath + "/" + fileName; Debug.Log(folderPath + "/" + fileName); list.Add(ToolBox.Stage.Read(FuncBox.GetTextReader(fileList[i]))); } } return(list); }
/// <summary> /// パスを指定してウェーブエネミー情報を読み込み /// </summary> public void ReadWaveInfo(string filePath) { waveInfoList = new List <List <WaveEnemyInfo> >(); if (!File.Exists(filePath)) { return; } //読み込み using (TextReader r = FuncBox.GetTextReader(filePath)) { string line = ""; string[] split; List <WaveEnemyInfo> enemyInfoList = new List <WaveEnemyInfo>(); //ファイル走査 while ((line = r.ReadLine()) != null) { split = line.Split(','); if (split[0] == "<Wave>") { enemyInfoList = new List <WaveEnemyInfo>(); waveInfoList.Add(enemyInfoList); } else { Debug.Log(split[0]); enemyInfoList.Add(WaveEnemyInfo.ReadString(split)); } } } }
/// <summary> /// 設定ファイル読み込み /// </summary> protected void ReadSettingFile() { string path = Application.streamingAssetsPath + "/" + settingFile; //ファイル確認 if (!File.Exists(path)) { return; } string line; using (TextReader r = FuncBox.GetTextReader(path)) { while ((line = r.ReadLine()) != null) { switch (line) { case "<BGMVolume>": bgmVolume = float.Parse(r.ReadLine()); break; case "<SEVolume>": seVolume = float.Parse(r.ReadLine()); break; case "<End>": return; } } } }
/// <summary> /// コンフィグファイルを読み込む /// </summary> public void ReadConfig(string filePath) { if (!File.Exists(filePath)) { return; } //読み込み using (TextReader r = FuncBox.GetTextReader(filePath)) { string line = ""; while ((line = r.ReadLine()) != null) { switch (line) { case "<BattleTime>": line = r.ReadLine(); battleTime = int.Parse(line); break; case "<StageScale>": line = r.ReadLine(); stageScale = float.Parse(line); break; case "<GameSpeed>": line = r.ReadLine(); gameSpeed = float.Parse(line); break; case "<PlayerHPScale>": line = r.ReadLine(); playerHPScale = float.Parse(line); break; case "<MaxEnergy>": line = r.ReadLine(); maxEnergy = int.Parse(line); break; case "<EnergyOutput>": line = r.ReadLine(); energyOutput = int.Parse(line); break; } } } }
/// <summary> /// ランキングレコードを読み込み /// </summary> public void ReadRankingRecords(string filePath) { _rankingRecords = new List <ToolBox.RankingRecord>(); if (!File.Exists(filePath)) { return; } //読み込み using (TextReader r = FuncBox.GetTextReader(filePath)) { string line = ""; string[] split; while ((line = r.ReadLine()) != null) { split = line.Split(','); _rankingRecords.Add(ToolBox.RankingRecord.ReadString(split)); } } }
public string rankingFilePath; //ランキングファイル #region MonoBehaviourイベント protected override void Awake() { base.Awake(); //初期設定 DontDestroyOnLoad(gameObject); //初期化 bulletDic = new Dictionary <string, Dictionary <string, ToolBox.Bullet> >(); shipDataDic = new Dictionary <string, Dictionary <string, ToolBox.ShipData> >(); //管理クラス生成 fade = (Instantiate(Resources.Load(fadeManagerPath)) as GameObject).GetComponent <FadeManager>(); audio = (Instantiate(Resources.Load(audioManagerPath)) as GameObject).GetComponent <AudioManager>(); //シーン管理 sceneStack = new Stack <string>(); //弾情報 bulletFilePath = "/Bullet/Bullet.txt"; bulletFilePath = Application.streamingAssetsPath + bulletFilePath; bulletDic = ReadBullet(FuncBox.GetTextReader(bulletFilePath)); //ステージ情報 stageFolderPath = "/Stage"; stageFolderPath = Application.streamingAssetsPath + stageFolderPath; stageDic = ReadStageDic(stageFolderPath); //機体情報 shipFolderPath = "/Ship"; shipFolderPath = Application.streamingAssetsPath + shipFolderPath; shipDataDic = ReadShipDic(shipFolderPath); //コンフィグ configFilePath = "/Config.txt"; configFilePath = Application.streamingAssetsPath + configFilePath; ReadConfig(configFilePath); //ランキング rankingFilePath = "/Ranking.txt"; rankingFilePath = Application.streamingAssetsPath + rankingFilePath; ReadRankingRecords(rankingFilePath); //エフェクト effectDic = ReadResourcesDic(effectPrefabPaths); //デフォルト編集機体サイズ editShipSize = shipSizeList[0]; //プレイヤー選択機体 playerSelectShips = new ToolBox.ShipData[4]; for (int i = 0; i < playerSelectShips.Length; i++) { playerSelectShips[i] = null; } }
/// <summary> /// folderPath以下から読み込み /// </summary> public static Figure Read(string folderPath) { TextReader r; Figure f = new Figure(); //頂点情報 using (r = FuncBox.GetTextReader(folderPath + "/Vertex.txt")) { f.vertices = ReadVertex(r).ToArray(); } //三角形インデックス using (r = FuncBox.GetTextReader(folderPath + "/Index.txt")) { f.triangles = ReadIndex(r).ToArray(); } //主情報 using (r = FuncBox.GetTextReader(folderPath + "/Main.txt")) { ReadMain(r, f); } return(f); }