RFC: Panel Events #363
Replies: 7 comments 2 replies
-
After careful rethinking, I think A is nicer for things like user created events, and makes more sense overall. |
Beta Was this translation helpful? Give feedback.
-
For me, the benefit of having the |
Beta Was this translation helpful? Give feedback.
-
I like method A as it matches the Event system etc. as well :) Anyways, C would help making code looking more uniformly. |
Beta Was this translation helpful? Give feedback.
-
I would actually favor method A, the reason being I can document with the function name what the click event is about. [PanelEvent( "onclick" )]
public void PlayerReadyClicked()
{
} C is also a nice option since we can have both. |
Beta Was this translation helpful? Give feedback.
-
Method C would fit perfectly, having the name option is good for everyone. (I just don't like typing the event name twice, one for the attribute and one for the method) |
Beta Was this translation helpful? Give feedback.
-
Method A I think is the most explicit and easily understood; that gets my vote |
Beta Was this translation helpful? Give feedback.
-
Alright here's what I decided.. for built in stuff, we'll do the event system as normal, "onclick" etc, but also have built in virtual methods. This means you'll still be able to bind to other controls like Error.Button.AddEvent( "onclick", () => { Error.Toggle(); OnFilter(); } ); but also means you don't have panels using the event system on themselves if they don't need to. For custom binding events you'll have to explicitly define them with the attribute. This will stop you accidentally binding stuff because you added Event at the end of a method name. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So I'm looking at the panel event system we have. Right now we're doing things like this.
This is obviously a bit dumb. So what do you favour here?
Method A:
Method B:
Method C:
Beta Was this translation helpful? Give feedback.
All reactions