public void LoadTargetPersonFromString(Dictionary <int, Person> persons, string data) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.TargetPersons.Clear(); for (int i = 0; i < strArray.Length; i += 2) { if (!persons.ContainsKey(int.Parse(strArray[i + 1]))) { continue; } PersonRelation item = new PersonRelation(); item.Relation = (PersonRelationKind)int.Parse(strArray[i]); item.SpeakingPerson = persons[int.Parse(strArray[i + 1])]; this.TargetPersons.Add(item); } }
public void LoadTargetPersonFromString(Dictionary<int, Person> persons, string data) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.TargetPersons.Clear(); for (int i = 0; i < strArray.Length; i += 2) { if (!persons.ContainsKey(int.Parse(strArray[i + 1]))) continue; PersonRelation item = new PersonRelation(); item.Relation = (PersonRelationKind) int.Parse(strArray[i]); item.SpeakingPerson = persons[int.Parse(strArray[i + 1])]; this.TargetPersons.Add(item); } }
private void btnAddTargetPerson_Click(object sender, EventArgs e) { frmSelectPersonList list = new frmSelectPersonList(); list.Persons = this.Scenario.Persons; list.ShowDialog(); if (list.IDList.Count > 0) { foreach (int num in list.IDList) { PersonRelation item = new PersonRelation(); item.SpeakingPerson = this.Scenario.Persons.GetGameObject(num) as Person; if (this.clbTargetPersons.Items.IndexOf(item.SpeakingPerson) < 0) { this.EditingEvent.TargetPersons.Add(item); } } this.RefreshTargetPersons(); } }