public void LoadEffectPersonFromString(Dictionary <int, Person> persons, EventEffectTable eventEffects, string data) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.EffectPersons.Clear(); for (int i = 0; i < strArray.Length; i += 2) { if (!persons.ContainsKey(int.Parse(strArray[i]))) { continue; } TroopEffectPerson item = new TroopEffectPerson(); item.EffectPerson = persons[int.Parse(strArray[i])]; item.Effect = eventEffects.GetEventEffect(int.Parse(strArray[i + 1])); this.EffectPersons.Add(item); } }
private void button1_Click(object sender, EventArgs e) { PersonList list = new PersonList(); if (this.EditingEvent.LaunchPerson != null) { list.Add(this.EditingEvent.LaunchPerson); } if (this.EditingEvent.TargetPersons.Count > 0) { foreach (PersonRelation relation in this.EditingEvent.TargetPersons) { list.Add(relation.SpeakingPerson); } } frmSelectPersonList list2 = new frmSelectPersonList(); list2.Persons = list; list2.SelectOne = true; list2.ShowDialog(); if (list2.IDList.Count == 1) { TroopEffectPerson item = new TroopEffectPerson(); item.EffectPerson = list.GetGameObject(list2.IDList[0]) as Person; item.Effect = this.cbPersonEffect.Items[0] as GameObjects.TroopDetail.EventEffect.EventEffect; this.EditingEvent.EffectPersons.Add(item); this.RefreshPersonEffects(); } }
public void LoadEffectPersonFromString(Dictionary<int, Person> persons, EventEffectTable eventEffects, string data) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.EffectPersons.Clear(); for (int i = 0; i < strArray.Length; i += 2) { if (!persons.ContainsKey(int.Parse(strArray[i]))) continue; TroopEffectPerson item = new TroopEffectPerson(); item.EffectPerson = persons[int.Parse(strArray[i])]; item.Effect = eventEffects.GetEventEffect(int.Parse(strArray[i + 1])); this.EffectPersons.Add(item); } }
private void btnAddPersonEffectFromAll_Click(object sender, EventArgs e) { frmSelectPersonList list = new frmSelectPersonList(); list.Persons = this.Scenario.Persons; list.SelectOne = true; list.ShowDialog(); if (list.IDList.Count == 1) { TroopEffectPerson item = new TroopEffectPerson(); item.EffectPerson = this.Scenario.Persons.GetGameObject(list.IDList[0]) as Person; item.Effect = this.cbPersonEffect.Items[0] as GameObjects.TroopDetail.EventEffect.EventEffect; this.EditingEvent.EffectPersons.Add(item); this.RefreshPersonEffects(); } }