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 longMilliseconds to wait before displaying popupsstatic final longFields inherited from class com.deco2800.game.ui.UIComponent
skin, stage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListeners(EventHandler events) Connects the listeners when invoked from handlervoidcreate()Initialises component.voiddispose()Clean upprotected voiddraw(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.booleanMethods inherited from class com.deco2800.game.ui.UIComponent
getLayer, getSkin, getZIndexMethods inherited from class com.deco2800.game.rendering.RenderComponent
compareTo, renderMethods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods 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:
createin classUIComponent
-
dispose
public void dispose()Clean up- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein 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:
drawin classRenderComponent- Parameters:
batch- Batch to render to. (not used) actors added to stage instead
-
isPopupActive
public boolean isPopupActive()
-