public static void Load() { Loder data = new Loder(Path, Starts, Ends); string[] temp; while (data.Next()) { if (data.Key == "Types") { Types = data.Value.Split('/'); } if (data.Key == "Counts") { temp = data.Value.Split('/'); Counts = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) Counts[i] = Convert.ToInt32(temp[i]); } if (data.Key == "TexureSizes") { temp = data.Value.Split('/'); TexSizes = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) TexSizes[i] = Convert.ToInt32(temp[i]); } if (data.Key == "RadSizes") { temp = data.Value.Split('/'); Rads = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) Rads[i] = Convert.ToInt32(temp[i]); } if (data.Key == "Explosions") { temp = data.Value.Split('/'); Explosions = new string[temp.Length]; for (int i = 0; i < temp.Length; i++) Explosions[i] = temp[i]; } if (data.Key == "HitPoints") { temp = data.Value.Split('/'); HitPoints = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) HitPoints[i] = Convert.ToInt32(temp[i]); } if (data.Key == "Mass") { temp = data.Value.Split('/'); Mass = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) Mass[i] = Convert.ToInt32(temp[i]); } if (data.Key == "MaxPowers") { temp = data.Value.Split('/'); MaxPowers = new float[temp.Length]; for (int i = 0; i < temp.Length; i++) MaxPowers[i] = (float)Convert.ToDouble(temp[i]); } if (data.Key == "Clashes") { temp = data.Value.Split('/'); Clashes = new string[temp.Length]; for (int i = 0; i < temp.Length; i++) Clashes[i] = temp[i]; } } data.EndReading(); }
public static void Load() { Loder data = new Loder(Path, Starts, Ends); string[] temp; int id = -1; while (data.Next()) { if (data.Key == "Types") { Types = data.Value.Split('/'); ChangeStages = new int[Types.Length][]; } if (data.Key == "Counts") { temp = data.Value.Split('/'); Counts = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) Counts[i] = Convert.ToInt32(temp[i]); } if (data.Key == "Stages") { temp = data.Value.Split('/'); Stages = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) Stages[i] = Convert.ToInt32(temp[i]); } if (data.Key == "TexureSizes") { temp = data.Value.Split('/'); TexSizes = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) TexSizes[i] = Convert.ToInt32(temp[i]); } if (data.Key == "RadSizes") { temp = data.Value.Split('/'); RadSizes = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) RadSizes[i] = Convert.ToInt32(temp[i]); } if (data.Key == "Explosions") { temp = data.Value.Split('/'); Explosions = new string[temp.Length]; for (int i = 0; i < temp.Length; i++) Explosions[i] = temp[i]; } if (data.Key == "ID") { int j = 0; while (data.Value != Types[j]) j++; id = j; } if (data.Key == "TextureCanges") { temp = data.Value.Split('/'); ChangeStages[id] = new int[temp.Length]; for (int i = 0; i < temp.Length; i++) ChangeStages[id][i] = Convert.ToInt32(temp[i]); } } data.EndReading(); Mineral.SetStages(ChangeStages); }
public static void LoadDataFromFile() { int id = 0, mass = 0, firer = 0, hp = 0, energy = 0, slots = 0, rad = 0, tbi = -1, tti = -1, ii = -1, explf = -1, rech = -1, fired = -1, firem = -1, price = -1, rr = -1; float shield = 0; bool connect = false; string type = "", name = "", explt = "", firet = "", targt = "", re = "", he = ""; Loder data = new Loder(Path); while (data.Next()) { if (data.Key == "Constructions") { InfoMas = new Body[Convert.ToInt32(data.Value)]; ConstrInfo = new ConstrOption[Convert.ToInt32(data.Value)]; } if (data.Key == "ID") id = Convert.ToInt32(data.Value); if (data.Key == "Type") type = data.Value; if (data.Key == "Name") name = data.Value; if (data.Key == "MaxHp") hp = Convert.ToInt32(data.Value); if (data.Key == "Mass") mass = Convert.ToInt32(data.Value); if (data.Key == "Price") price = Convert.ToInt32(data.Value); if (data.Key == "Energy") energy = Convert.ToInt32(data.Value); if (data.Key == "Connecting") connect = Convert.ToBoolean(data.Value); if (data.Key == "MaxSlots") slots = Convert.ToInt32(data.Value); if (data.Key == "RadSize") rad = Convert.ToInt32(data.Value); if (data.Key == "Shield") shield = (float)(Convert.ToDouble(data.Value)); if (data.Key == "ExplType") explt = data.Value; if (data.Key == "ExplForse") explf = Convert.ToInt32(data.Value); if (data.Key == "Recharge") rech = Convert.ToInt32(data.Value); if (data.Key == "FireRang") firer = Convert.ToInt32(data.Value); if (data.Key == "TargetType") targt = data.Value; if (data.Key == "FireType") firet = data.Value; if (data.Key == "FireDemage") fired = Convert.ToInt32(data.Value); if (data.Key == "FireMass") firem = Convert.ToInt32(data.Value); if (data.Key == "RodRadius") rr = Convert.ToInt32(data.Value); if (data.Key == "RodEffect") re = data.Value; if (data.Key == "HitEffect") he = data.Value; if (data.Key == "IconIndex") // индекс текстуры иконки ii = Convert.ToInt32(data.Value); if (data.Key == "TBI") // индекс основной текстуры tbi = Convert.ToInt32(data.Value); if (data.Key == "TTI") // индекс текстуры турели (если есть) tti = Convert.ToInt32(data.Value); if (data.Key == "End") { Body body = new Body(hp, energy, rad, shield, mass); ConstrInfo[id] = new ConstrOption(name, type, hp, rad, slots, connect, explt, explf, ii, firer, price); if (type == Building.ConstrType) InfoMas[id] = new Building(0, 0, 0, body, tbi); if (type == Tower.ConstrType) InfoMas[id] = new Tower(0, 0, 0, body, firer, firem, fired, firet, targt, rech, tbi, tti, rr, re, he); firer = 0; } } data.EndReading(); }