Author Topic: Event Declarations  (Read 2706 times)

Don_Megga

  • Guest
Event Declarations
« on: August 31, 2012, 11:17:32 PM »
I have gone through UIEventListener and UICamera and I could not find the actual event declarations.

In UIEventListener I see all of the declarations for the delegates. For example:

public delegate void BoolDelegate (GameObject go, bool state);

But where are the actual event declarations that use the delegates: For example:

public event BoolDelegate EventName

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Event Declarations
« Reply #1 on: September 01, 2012, 06:19:08 AM »
o_O? Right below that:

  1.         public VoidDelegate onSubmit;
  2.         public VoidDelegate onClick;
  3.         public VoidDelegate onDoubleClick;
  4.         public BoolDelegate onHover;
  5.         public BoolDelegate onPress;
  6.         public BoolDelegate onSelect;
  7.         public FloatDelegate onScroll;
  8.         public VectorDelegate onDrag;
  9.         public ObjectDelegate onDrop;
  10.         public StringDelegate onInput;

Don_Megga

  • Guest
Re: Event Declarations
« Reply #2 on: September 01, 2012, 07:42:56 AM »
Thanks.. for the response Aren

But where is the key word event in these statements? If you declare an event member in C# the
keyword event is required...

Edit: Maybe I should be asking or confirming that you are not using field like events... and hence the the keyword is not included. ... So you are using some multicast delegate system???
« Last Edit: September 01, 2012, 11:56:19 AM by Don_Megga »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Event Declarations
« Reply #3 on: September 01, 2012, 05:02:08 PM »
There is no "event" keyword. These are delegates, and they are multicast delegates. They're not events. You can add as many listeners as you want using += syntax, and remove then using -=.

Don_Megga

  • Guest
Re: Event Declarations
« Reply #4 on: September 01, 2012, 06:45:39 PM »
Good... That's what I suspected... the  multicast delegates that I referenced in my response.

Quote
Edit: Maybe I should be asking or confirming that you are not using field like events... and hence the the keyword is not included. ... So you are using some multicast delegate system???

What confused me a little was your response to my original question-->
Quote
But where are the actual event declarations that use the delegates:
Your response -->

Quote
o_O? Right below that:
    public VoidDelegate onSubmit;
    public VoidDelegate onClick;
    public VoidDelegate onDoubleClick;
    public BoolDelegate onHover;
    public BoolDelegate onPress;
    public BoolDelegate onSelect;
    public FloatDelegate onScroll;
    public VectorDelegate onDrag;
    public ObjectDelegate onDrop;
    public StringDelegate onInput;

Your response confused me as you did not negate the use of events and confirm the use of multidelegates...but I appreciate you confirming it now!!

thanks for clearing this up.

This is an awesome product :)