Class AchievementPopupComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
com.deco2800.game.ui.UIComponent
com.deco2800.game.components.achievements.AchievementPopupComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
Builds and displays an achievement widget that is displayed momentarily when a player
makes a new achievement in the game.
The widget is displayed for 5 seconds
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Milliseconds to wait before displaying popupsstatic final long
Fields inherited from class com.deco2800.game.ui.UIComponent
skin, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListeners
(EventHandler events) Connects the listeners when invoked from handlervoid
create()
Initialises component.void
dispose()
Clean upprotected void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) When the draw method is called we check if the popup queue is not empty and then display the one first in the list.boolean
Methods inherited from class com.deco2800.game.ui.UIComponent
getLayer, getSkin, getZIndex
Methods inherited from class com.deco2800.game.rendering.RenderComponent
compareTo, render
Methods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.deco2800.game.rendering.Renderable
render
-
Field Details
-
POPUP_TIMEOUT
public static final long POPUP_TIMEOUT- See Also:
-
COOL_OFF
public static final long COOL_OFFMilliseconds to wait before displaying popups- See Also:
-
-
Constructor Details
-
AchievementPopupComponent
public AchievementPopupComponent()
-
-
Method Details
-
addListeners
Connects the listeners when invoked from handler- Parameters:
events
- AchievementHandler's service handler
-
create
public void create()Initialises component. Connects to the player achievements event- Overrides:
create
in classUIComponent
-
dispose
public void dispose()Clean up- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) When the draw method is called we check if the popup queue is not empty and then display the one first in the list. Other popups will get their turn when the ones to be shown timeout- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to. (not used) actors added to stage instead
-
isPopupActive
public boolean isPopupActive()
-