Bandidos
Public Member Functions | List of all members
com.mygdx.game.engine.events.EventDispatcher Class Referenceabstract
Inheritance diagram for com.mygdx.game.engine.events.EventDispatcher:
com.mygdx.game.engine.entities.BaseEntity com.mygdx.game.engine.entities.components.BaseEntityComponent com.mygdx.game.engine.events.GlobalDispatcher com.mygdx.game.engine.tweening.EngineTween com.mygdx.game.hitRegistration.HitRegistrationPoint com.mygdx.game.level.Playfield com.mygdx.game.touchinput.TouchInputHandler com.mygdx.game.waves.WaveSystem

Public Member Functions

void addEventListener (String type, IEventReceiver listeningClass)
 
void dispatchEvent (Event event)
 
void removeEventListener (String type, IEventReceiver listener)
 
boolean hasEventListener (String type)
 
ArrayList< ListenerItemgetAllListeners ()
 
void destroyAllListeners ()
 
void clean ()
 

Detailed Description

Every class which inherits from the EventDispatcher class has the ability to dispatch and listen to events. When the class dispatches an event, every EventDispatcher listening to this class will receive that event.

Author
Ramses Di Perna

Member Function Documentation

◆ addEventListener()

void com.mygdx.game.engine.events.EventDispatcher.addEventListener ( String  type,
IEventReceiver  listeningClass 
)

Adds an event listener to this EventDispatcher. NOTE: You must call the method 'removeEventListener' to remove the listen from the EventDispatcher

Parameters
typeof message to listen to.
listeningClassis the one which should be triggered on the event.

◆ clean()

void com.mygdx.game.engine.events.EventDispatcher.clean ( )

◆ destroyAllListeners()

void com.mygdx.game.engine.events.EventDispatcher.destroyAllListeners ( )

Destroys all the listeners which where added to this EventDispatcher

◆ dispatchEvent()

void com.mygdx.game.engine.events.EventDispatcher.dispatchEvent ( Event  event)

This dispatches an event which will trigger the effect for all who listen to the type.

Parameters
eventto dispatch

◆ getAllListeners()

ArrayList<ListenerItem> com.mygdx.game.engine.events.EventDispatcher.getAllListeners ( )

Returns all who listen to this dispatcher.

Returns
list of listeners.

◆ hasEventListener()

boolean com.mygdx.game.engine.events.EventDispatcher.hasEventListener ( String  type)

This method returns whether the given type of message already has a listener.

Parameters
typeof message to check.
Returns
whether the message is being listened to. 'True' if so else 'False'.

◆ removeEventListener()

void com.mygdx.game.engine.events.EventDispatcher.removeEventListener ( String  type,
IEventReceiver  listener 
)

Removes the event which the was being listened to by the caller.

Parameters
typeof message to remove the listener from
listeneris the given class at the listening request which should be triggered on the event.

The documentation for this class was generated from the following file: