public static void Init() { CsvLoader csvLoader = new CsvLoader(); csvLoader.LoadCsv("localization"); localizedEn = csvLoader.GetDictionaryValues("en"); localizedPt = csvLoader.GetDictionaryValues("pt"); language = DataHandler.instance.selectedLanguage; isInit = true; }
public static GameMap LoadMap(string path) { var data = CsvLoader.LoadCsv(path); var map = new GameMap(data.Rows.Count, data.Columns.Count) { Name = Path.GetFileNameWithoutExtension(path) }; var rowIndex = 0; foreach (DataRow row in data.Rows) { for (var colIndex = 0; colIndex < data.Columns.Count; ++colIndex) { map.Map[rowIndex, colIndex] = row[colIndex].ToString(); } rowIndex++; } return(map); }
public void Init() { if (_init) { return; } _init = true; PiecePrefabs = new Dictionary <int, List <GameObject> >(); MapLists = new List <GameMap>(); var data = CsvLoader.LoadCsv("Data/pieces"); foreach (DataRow row in data.Rows) { var name = row["name"].ToString(); var gameObject = Resources.Load <GameObject>(Path.Combine("Prefab/Pieces/", row["model"].ToString())); var pieceController = gameObject.GetComponent <PieceController>(); var star = int.Parse(row["star"].ToString()); Debug.Log(row["model"].ToString()); pieceController.CloneProperties(name, int.Parse(row["maxHealth"].ToString()), int.Parse(row["attack"].ToString()), float.Parse(row["attackDistance"].ToString()), float.Parse(row["attackInterval"].ToString()), star, float.Parse(row["moveSpeed"].ToString()), int.Parse(row["cost"].ToString())); if (!PiecePrefabs.ContainsKey(star)) { PiecePrefabs[star] = new List <GameObject>(); } PiecePrefabs[star].Add(gameObject); } var mapNameList = MapLoader.LoadMapPathList("Data/mapList"); foreach (var mapPath in mapNameList) { MapLists.Add(MapLoader.LoadMap(mapPath)); } // ±©Á¦¼ÓÔØ×ÊÔ´ AttackSource.Add("warrior", Resources.Load <AudioClip>("Audio/Warrior")); AttackSource.Add("Arrow-damage", Resources.Load <AudioClip>("Audio/Arrow-damage")); AttackSource.Add("Arrow-start", Resources.Load <AudioClip>("Audio/Arrow-start")); AttackSource.Add("duelist", Resources.Load <AudioClip>("Audio/duelist")); AttackSource.Add("duelistL", Resources.Load <AudioClip>("Audio/duelistL")); AttackSource.Add("boom", Resources.Load <AudioClip>("Audio/boom")); }
public static List <string> LoadMapPathList(string path) { var data = CsvLoader.LoadCsv(path); return((from DataRow row in data.Rows select row["path"].ToString()).ToList()); }