Class AchievementInterface
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
com.deco2800.game.ui.UIComponent
com.deco2800.game.components.achievements.AchievementInterface
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
Base achievement display class to be extended by achievement type screens
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Event string for opening the achievement screenFields inherited from class com.deco2800.game.ui.UIComponent
skin, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExitButtonEvent
(com.badlogic.gdx.scenes.scene2d.ui.ImageButton button) Add listener to provided ImageButton, will close achievement interfacecom.badlogic.gdx.scenes.scene2d.Group
buildAchievementCard
(Achievement achievement) Builds an achievement card actor read to be displayedstatic com.badlogic.gdx.scenes.scene2d.Group
buildAchievementMilestoneButtons
(com.badlogic.gdx.scenes.scene2d.Group milestoneButtons, Achievement achievement, com.badlogic.gdx.scenes.scene2d.ui.Label descriptionLabel) Constructs the achievement milestone buttons for a given achievementcom.badlogic.gdx.scenes.scene2d.Group
Creates an achievement summary card of the provided achievement typevoid
changeDisplay
(AchievementType type) Change displayed achievement badges to those of the provided type.void
Sets all achievement icons to be checked, used for highlighting the selected achievement icon from the navigation panelvoid
create()
Create the achievement base displayvoid
dispose()
Called when the component is disposed.void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.static com.badlogic.gdx.scenes.scene2d.ui.Image
getMilestoneImageButtonByNumber
(int milestoneNumber, boolean isComplete, Achievement achievement, com.badlogic.gdx.scenes.scene2d.ui.Label descriptionLabel) Creates the milestone button actor.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
-
EVENT_OPEN_ACHIEVEMENTS
Event string for opening the achievement screen- See Also:
-
-
Constructor Details
-
AchievementInterface
public AchievementInterface()
-
-
Method Details
-
create
public void create()Create the achievement base display- Overrides:
create
in classUIComponent
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponent
Draw the renderable. Should be called only by the renderer, not manually.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
dispose
public void dispose()Description copied from class:Component
Called when the component is disposed. Dispose of any internal resources here.- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-
getMilestoneImageButtonByNumber
public static com.badlogic.gdx.scenes.scene2d.ui.Image getMilestoneImageButtonByNumber(int milestoneNumber, boolean isComplete, Achievement achievement, com.badlogic.gdx.scenes.scene2d.ui.Label descriptionLabel) Creates the milestone button actor. listens on hover events to display milestone achievement in description- Parameters:
milestoneNumber
- milestoneNumberisComplete
- whether the milestone is completeachievement
- the achievement to create the image button fordescriptionLabel
- the description label for the achievement- Returns:
- an image or
-
buildAchievementMilestoneButtons
public static com.badlogic.gdx.scenes.scene2d.Group buildAchievementMilestoneButtons(com.badlogic.gdx.scenes.scene2d.Group milestoneButtons, Achievement achievement, com.badlogic.gdx.scenes.scene2d.ui.Label descriptionLabel) Constructs the achievement milestone buttons for a given achievement- Parameters:
achievement
- the achievement to create the buttons fordescriptionLabel
- the label to be changed on hover- Returns:
- Group of ImageButtons
-
buildAchievementCard
Builds an achievement card actor read to be displayed- Parameters:
achievement
- the achievement to create the card for- Returns:
- the actor (Table)
-
buildAchievementSummaryCard
Creates an achievement summary card of the provided achievement type- Parameters:
type
- AchievementType- Returns:
- Group
-
changeSelectedIcon
public void changeSelectedIcon()Sets all achievement icons to be checked, used for highlighting the selected achievement icon from the navigation panel -
changeDisplay
Change displayed achievement badges to those of the provided type. If type is SUMMARY a breakdown of completion of each achievement type will be displayed- Parameters:
type
- AchievementType
-
addExitButtonEvent
public void addExitButtonEvent(com.badlogic.gdx.scenes.scene2d.ui.ImageButton button) Add listener to provided ImageButton, will close achievement interface- Parameters:
button
- ImageButton
-