-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
genie.sample
32 lines (22 loc) · 994 Bytes
/
genie.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[indent=4]
namespace Entitas
delegate OnEntityChanged(e : IEntity, index : int, component : IComponent)
class EntityChanged : Object
class Listener : Object
prop event : unowned OnEntityChanged
construct(event : OnEntityChanged)
_event = event
_listeners : list of Listener = new list of Listener
def add(event : OnEntityChanged)
_listeners.add(new Listener(event))
def remove(event : OnEntityChanged)
for var listener in _listeners
if listener.event == event
_listeners.remove(listener)
return
def clear()
_listeners = new list of Listener
def dispatch(e : IEntity, index : int, component : IComponent)
for var listener in _listeners
listener.event(e, index, component)
// From https://github.com/darkoverlordofdata/libentitas/blob/master/src/Events/EntityChanged.gs