public void HandleTableEvent(WEventType messageType, params object[] args) { if (messageType == WEventType.CLICK_BUTTON) { int rowIndex = (int)args[0]; var infos = dataTable.GetInfosByRowIndex(rowIndex); var prov = GMData.Inist.provinces.Find(infos["name"] as string); var provUI = ProvUI.NewInstance(infos); provUI.funcTaxBase = () => { return((double)prov.info["taxbase"]); }; provUI.funcTaxCurr = () => { return((double)prov.info["tax"]); }; provUI.funcTaxDetail = () => { string rslt = ""; foreach (var elem in prov.taxdetail) { rslt += elem.Item1 + ": " + elem.Item2.ToString() + "\n"; } return(rslt); }; } }
public static ProvUI NewInstance(IDictionary <string, object> infos) { if (Inst != null) { return(Inst); } GameObject gmobj = Instantiate(Resources.Load("Prefabs/ProvUI"), GameObject.Find("Canvas/Panel").transform) as GameObject; Inst = gmobj.GetComponent <ProvUI>(); Inst.name = infos["name"] as string; return(Inst); }