Hi there,
I have a generic function that I want to hook to multiple UIButtons. But I can't do so using following API call due to the fact I don't know to tell which button called the method.
EventDelegate.Add(btn.onClick, onClickBtn)
I've looked into UIButton class and found out that adding a generic parameter(like a Hashtable) to onClick event is not that hard. (Modifying onClick it self takes quite a bit of effort, but creating new delegate, or a list of delegates like following is not that difficult)
public delegate void CallbackWithParam(Hashtable hash);
public CallbackWithParam onClickWithParam;
public Hashtable onClickParam;
and then call onClickWithParam at the place where onClick is executed.
Would you, NGUI developers, consider updating UIButton so that we can add a generic parameter to the onClick event? Or is there another way to do so other than modifying UIButton class?