Package com.csse3200.game.services
Class ToggleableMap
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.services.ToggleableMap
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,com.badlogic.gdx.utils.Json.Serializable
,Renderable
,Comparable<Renderable>
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Creates reusable ui styles and adds actors to the stage.void
Creates assets usedvoid
Dim the screen when the map is open (Thang: should I pause the game too?)void
dispose()
Destroys the UI objectsvoid
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the actors to the game.boolean
inPlayerPos
(ArrayList<com.badlogic.gdx.math.GridPoint2> listPlayerPos, com.badlogic.gdx.math.GridPoint2 gpPos) Check if the given position is in the list of player's positionvoid
void
Recovers the UI components that were removed back onto the screenvoid
Removes the UI components on the screen so that cutscene is not so clutteredvoid
toggleOpen
(Boolean isOpen) Toggles the map open or closed and updates the display.void
Unpauses the gameMethods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, render
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, write
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.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
ToggleableMap
public ToggleableMap()
-
-
Method Details
-
create
public void create()Creates reusable ui styles and adds actors to the stage.- Overrides:
create
in classUIComponent
-
dimScreen
public void dimScreen()Dim the screen when the map is open (Thang: should I pause the game too?) -
toggleOpen
Toggles the map open or closed and updates the display.- Parameters:
isOpen
- Whether the map is open or not.
-
inPlayerPos
public boolean inPlayerPos(ArrayList<com.badlogic.gdx.math.GridPoint2> listPlayerPos, com.badlogic.gdx.math.GridPoint2 gpPos) Check if the given position is in the list of player's position- Parameters:
listPlayerPos
- list of player's positiongpPos
- position to check- Returns:
- true if the given position is in the list of player's position
-
createAssets
public void createAssets()Creates assets used -
draw
public void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the actors to the game.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
pauseGame
public void pauseGame() -
unPauseGame
public void unPauseGame()Unpauses the game -
dispose
public void dispose()Destroys the UI objects- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classRenderComponent
-
removeExternalUI
public void removeExternalUI()Removes the UI components on the screen so that cutscene is not so cluttered -
recoverExternalUI
public void recoverExternalUI()Recovers the UI components that were removed back onto the screen
-