private void InstantiateButton() { List <int> funcs = GameEntry.DataNode.GetNowSite().FunctionList; if (funcs == null) { Log.Error("funcs is null!!"); } foreach (var func in funcs) { Button button = Instantiate(m_funcButton); if (button == null) { Log.Error("FuncButton is null!!!"); } button.transform.SetParent(m_Choose); Text buttonName = button.GetComponentInChildren <Text>(); IDataTable <DRFunction> dtFunction = GameEntry.DataTable.GetDataTable <DRFunction>(); DRFunction dRFunction = dtFunction.GetDataRow(func); buttonName.text = dRFunction.ButtonName; Log.Info(func); button.onClick.AddListener(delegate() { this.OnClick(dRFunction); }); } }
void OnClick(DRFunction dRFunction) { GameEntry.Event.Fire(this, new FunctionTriggerEventArgs(dRFunction)); }
public override void Clear() { // throw new System.NotImplementedException(); DRFunction = null; }
/// <summary> /// 初始化玩家生命值改变事件的新实例。 /// </summary> /// <param name="newHP">玩家新的生命值。</param> public FunctionTriggerEventArgs(DRFunction drFunction) { DRFunction = drFunction; }