Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Christopher

Pages: [1]
1
NGUI 3 Support / Re: Assistance with UIEventListener
« on: December 04, 2014, 01:29:41 PM »
Thanks - I was able to pass it by explicitly stating it was a UIEventListener.VoidDelegate instead of the string;
I was creating the extra functions to pass a lot of parameters to the gameobject and make it reusable in multiple scenes.


2
NGUI 3 Support / Assistance with UIEventListener
« on: December 03, 2014, 09:22:24 PM »
Hello,

I was hoping someone could help me with what I want to do with UIEventListener. I've created a "Dialogue" Prefab in my game and it has images/text/buttons associated with it. I can change all those at will, but I want to be able to dynamically change the function pointed to by the UIEventListner so I can make it generic and call a function in the script which created the dialogue window. Something like this...

In Town.CS
>inn.transform.GetComponent<dialogue_class>().active_listen_button1(inn_function);
> void inn_function(GameObject button)
> {
> inn.transform.GetComponent<dialogue_class>().close_listen_button1(inn_function);
> // Do Stuff - Button was Clicked and Listener is now off
> }

In dialogue_class.CS
>public void active_listen_button1(string target_function)
> { UIEventListener.Get(inn.transform.FindChild("Button - Action 1").gameObject).onClick    += target_function; }
>public void close_listen_button1(string target_function)
> { UIEventListener.Get(inn.transform.FindChild("Button - Action 1").gameObject).onClick    -= target_function; }

If anyone could help, I'd appreciate it. Been struggling with this issue for a couple hours and I can't seem to make it work.

Pages: [1]