private void button1_Click(object sender, EventArgs e) { string[] temp = textBox1.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); race = temp; ArrayList tmp = new ArrayList(); int j = -1; for (int i = 0; i < race.Length; i++) { MultiRace.raceinfo r; j=HasData(race[i]); if (j == -1) //若无对应,即时生成一个默认的 { if (Array.IndexOf(defaultrace, race[i]) != -1) { continue; } //已经在默认四族里面的 r = new MultiRace.raceinfo(); r.raceName = race[i]; r.peonID = "opeo"; r.baseID = "ogre"; r.aiPath = r.raceName.ToLower().Trim() + ".ai"; r.peonCount = 5; } else { r = (MultiRace.raceinfo)raceinfo_list[j]; } r.aiPath = r.aiPath.Trim(); r.baseID = r.baseID.Trim(); r.peonID = r.peonID.Trim(); tmp.Add(r); } raceinfo_list = tmp; this.Hide(); }
private void SaveData(string racename) { MultiRace.raceinfo tmp = new MultiRace.raceinfo(); tmp.aiPath = textBox4.Text; tmp.baseID = textBox3.Text; tmp.peonID = textBox2.Text; tmp.peonCount = (int)numericUpDown1.Value; tmp.raceName = racename; if (HasData(racename) != -1) { raceinfo_list[HasData(racename)] = tmp; } else { raceinfo_list.Add(tmp); } }
private void button1_Click(object sender, EventArgs e) { string[] temp = textBox1.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); race = temp; ArrayList tmp = new ArrayList(); int j = -1; for (int i = 0; i < race.Length; i++) { MultiRace.raceinfo r; j = HasData(race[i]); if (j == -1) //若无对应,即时生成一个默认的 { if (Array.IndexOf(defaultrace, race[i]) != -1) { continue; } //已经在默认四族里面的 r = new MultiRace.raceinfo(); r.raceName = race[i]; r.peonID = "opeo"; r.baseID = "ogre"; r.aiPath = r.raceName.ToLower().Trim() + ".ai"; r.peonCount = 5; } else { r = (MultiRace.raceinfo)raceinfo_list[j]; } r.aiPath = r.aiPath.Trim(); r.baseID = r.baseID.Trim(); r.peonID = r.peonID.Trim(); tmp.Add(r); } raceinfo_list = tmp; this.Hide(); }