public List <string> LoadStatesFromString(StateList states, string dataString) { List <string> errorMsg = new List <string>(); char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = dataString.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.States.Clear(); try { foreach (string str in strArray) { State gameObject = states.GetGameObject(int.Parse(str)) as State; if (gameObject != null) { this.States.Add(gameObject); gameObject.LinkedRegion = this; } else { errorMsg.Add("州域ID" + str + "不存在"); } } } catch { errorMsg.Add("州域一栏应为半型空格分隔的州域ID"); } return(errorMsg); }
public List<string> LoadContactStatesFromString(StateList contactStates, string dataString) { List<string> errorMsg = new List<string>(); char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = dataString.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.ContactStates.Clear(); try { foreach (string str in strArray) { State gameObject = contactStates.GetGameObject(int.Parse(str)) as State; if (gameObject != null) { this.ContactStates.Add(gameObject); } else { errorMsg.Add("州域ID" + str + "不存在"); } } } catch { errorMsg.Add("连接州域一栏应为半型空格分隔的州域ID"); } return errorMsg; }
public void LoadContactStatesFromString(StateList contactStates, string dataString) { char[] separator = new char[] { ' ', '\n', '\r' }; string[] strArray = dataString.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.ContactStates.Clear(); foreach (string str in strArray) { State gameObject = contactStates.GetGameObject(int.Parse(str)) as State; if (gameObject != null) { this.ContactStates.Add(gameObject); } } }
public void LoadStatesFromString(StateList states, string dataString) { char[] separator = new char[] { ' ', '\n', '\r' }; string[] strArray = dataString.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.States.Clear(); foreach (string str in strArray) { State gameObject = states.GetGameObject(int.Parse(str)) as State; if (gameObject != null) { this.States.Add(gameObject); gameObject.LinkedRegion = this; } } }