public static void exchangeData(string fileName, string[,] data) { ExcelReverse.Instance.loadDataFromExcel(); List <Weapon> objList = new List <Weapon>(); Weapon obj; for (int i = 0; i < data.GetLength(0); i++) { obj = new Weapon(); obj.Id = int.Parse(data[i, 0]); obj.Name = data[i, 1]; obj.Type = (EquipmentManager.WeaponType)Enum.Parse(typeof(EquipmentManager.WeaponType), data[i, 2]); obj.ImagePath = data[i, 3]; obj.ItemPath = data[i, 4]; obj.ShadowPath = data[i, 5]; obj.Star = int.Parse(data[i, 6]); obj.Attack = float.Parse(data[i, 7]); obj.PeerTime = float.Parse(data[i, 8]); obj.StorehouseId = int.Parse(data[i, 9]); obj.Bullets = float.Parse(data[i, 10]); obj.BulletSpeed = float.Parse(data[i, 11]); obj.BulletPath = data[i, 12]; obj.BulletAngle = float.Parse(data[i, 13]); obj.ContinueShoot = bool.Parse(data[i, 14]); objList.Add(obj); } string path = Application.dataPath + "/" + "Resources/Data/Weapons.data"; DataFileManager.saveDataList <Weapon>(objList, path); }
public static void exchangeData(string fileName, string[,] data) { ExcelReverse.Instance.loadDataFromExcel(); List <Monster> objList = new List <Monster>(); Monster obj; for (int i = 0; i < data.GetLength(0); i++) { obj = new Monster(); obj.Id = int.Parse(data[i, 0]); obj.Name = data[i, 1]; obj.Type = data[i, 2]; obj.SkeletonPath = data[i, 3]; obj.Hp = float.Parse(data[i, 4]); obj.Attack = float.Parse(data[i, 5]); obj.Speed = float.Parse(data[i, 6]); obj.AiMode = int.Parse(data[i, 7]); obj.DependOnTime = bool.Parse(data[i, 8]); obj.Time = int.Parse(data[i, 9]); obj.DependOnPosition = bool.Parse(data[i, 10]); obj.PlayerArrive = int.Parse(data[i, 11]); obj.Position = new Vector3(float.Parse((data[i, 12].Split(','))[0]), float.Parse((data[i, 12].Split(','))[1]), float.Parse((data[i, 12].Split(','))[2])); objList.Add(obj); } string path = Application.dataPath + "/" + "Resources/Data/Monster.data"; DataFileManager.saveDataList <Monster>(objList, path); }