public void after_setup() { string s_kill = ""; // prepare its kill and bekilled if (kill != null) { string[] ar_kill = new string[kill.Length]; //skill = string.Join (", ", kill); for (int i = 0; i < kill.Length; i++) { CharacterSetting cs = CentralController.load_charsetting(kill [i]); cs.setup(); Debug.Log("==>kill:" + cs.name); ar_kill [i] = cs.name; } s_kill = string.Join(" ", ar_kill); } desc = desc + "\n" + "克制: " + s_kill; }
// // main entry for test // FactionSetting loadFactionSettingFromUser(int userid) { //int char_number = 36; //CharacterSetting[] cs = new CharacterSetting[4]; /*cs[0] = new CharacterSetting("黄忠", "Ethan"); * string name = "Huangzhong"; * //UnityEditor.MonoScript go = Instantiate (Resources.Load<UnityEditor.MonoScript>("NPC/" + name )); * //CharacterSetting go = Instantiate (Resources.Load<CharacterSetting>("NPC/" + name )); * * //string someString = "huangzhong"; * //System.Type myType = someString.GetType(); * //dynamic go = myType.GetConstructor (System.Type.EmptyTypes).Invoke (null); * print("===>333"+ go.GetType()); */ /* * * cs [0].clonable = true; * cs [0].movability = 20; * cs [0].attack = 10; * cs [0].knowledge = 1; * cs [0].maxhp = 100; * cs [0].maxmp = 100; * * cs[1] = new CharacterSetting("RedSamurai"); * cs [1].clonable = true; * cs [1].movability = 10; * cs [1].attack = 10; * cs [1].knowledge = 10; * cs [1].maxhp = 60; * cs [1].maxmp = 60; * * cs[2] = new CharacterSetting("Kyle"); * cs [2].clonable = true; * cs [2].movability = 10; * cs [2].attack = 10; * cs [2].knowledge = 10; * cs [2].maxhp = 60; * cs [2].maxmp = 60; * * cs[3] = new CharacterSetting("Troll"); * cs [3].clonable = true; * cs [3].movability = 10; * cs [3].attack = 10; * cs [3].knowledge = 10; * cs [3].maxhp = 60; * cs [3].maxmp = 60; * * FactionSetting fs = new FactionSetting (); * fs.userid = userid; * for (int i = 0; i < char_number; i++) { * fs.add_character (cs[Random.Range(0, cs.Length)]); * }*/ string[] chars = { "Huangzhong", "Zhaoyun", "Lvbu", "Caocao", "Sunquan", "Liubei", "Zhugeliang" }; FactionSetting fs = new FactionSetting(); fs.userid = userid; for (int i = 0; i < chars.Length; i++) { CharacterSetting cs = CentralController.load_charsetting(chars [i]); cs.setup(); cs.after_setup(); print("==cs.name:" + cs.GetType()); fs.add_character(cs); } return(fs); }