public void OnGM(GMInfoVO vo, string argstr) { Debug.Log(vo.ToString() + "\t arg=" + argstr); switch (vo.enPart) { /** 设置开放关卡 */ case "set_dungeon_level": Debug.Log("GM 设置开放关卡"); break; case "item": string[] args = argstr.Split(' '); int itemId = args.GetInt32(0); int itemNum = args.GetInt32(1); break; } }
void Start() { TextAsset ta = Resources.Load <TextAsset>("Config/gm") as TextAsset; string text = ta.text; StringReader reader = new StringReader(text); reader.ReadLine(); reader.ReadLine(); while (true) { string str = reader.ReadLine(); if (str == null) { break; } string[] csv = str.Split(';'); GMInfoVO vo = new GMInfoVO(); vo.name = csv [0]; vo.enPart = csv [1]; vo.numPart = csv [2]; vos.Add(vo); } foreach (GMInfoVO vo in vos) { GameObject cellObj = GameObject.Instantiate(gmCell.gameObject) as GameObject; cellObj.SetActive(true); list.Add(cellObj.GetComponent <RectTransform>()); GMInfoCell cell = cellObj.GetComponent <GMInfoCell>(); cell.Vo = vo; cell.updateView(); } }