public LogicButton(int id) : base(id) { InitializeComponent(); anz_input = 0; anz_output = 1; Name = "ButtonUI"; On = false; l_button = new L_Button(id, this); LogicGates.gates_logic.Add(l_button); ChangeColorInOut(); }
private void updateBtn() { while (this.selects.Count != 0) { Destroy(this.selects[0].gameObject); this.selects.RemoveAt(0); } ; try { string str = this.readFile(); if (str == "") { return; } FightMain.ccccc = ""; Dictionary <string, object> dic = JsonMapper.ToObject <Dictionary <string, object> >(str); foreach (string key in dic.Keys) { L_Button btn = ResFactory.createObject <L_Button>(this.select_btn); ((RectTransform)btn.transform).sizeDelta = new Vector2(80, 50); btn.transform.SetParent(this.transform); btn.transform.localPosition = new Vector3(-52 + (this.selects.Count % 2) * 100, 69 + (int)(this.selects.Count / 2) * 100, 0); btn.SetText(key); this.selects.Add(btn); new TestSelecteItem(key, btn).addListener("change", (e) => { string uid = e.data.ToString().Split('_')[0]; int teamIndex = Convert.ToInt32(e.data.ToString().Split('_')[1]); FightMain.instance.autoRunClient.startFight((object[])dic[uid], uid, teamIndex, ConfigConstant.MODE_TEST_WATCH); }); } } catch (Exception e) { this.logDebug("解析错误"); } }
public TestSelecteItem(string uid, L_Button btn) { btn.onClick.AddListener(() => { dispatchEventWith("change", uid); }); }