public class GameScreen
extends io.github.teamfractal.screens.AbstractAnimationScreen
implements com.badlogic.gdx.Screen
Modifier and Type | Field and Description |
---|---|
private com.badlogic.gdx.graphics.g2d.Batch |
batch |
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
cancelTradeButton |
private com.badlogic.gdx.graphics.Texture |
chancellorTexture
Image of the chancellor
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
claimTileButton
Button which allows players to claim selected tiles
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
closeEventMessageButton |
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
closePriceOverlayButton |
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
closeUpgradeOverlayButton
Button allowing players to escape from the upgrade overlay if they decide against upgrading roboticons
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
confirmTradeButton |
private com.badlogic.gdx.scenes.scene2d.ui.Image |
currentPlayerIcon
Icon representing the currently-active player's chosen college
|
private com.badlogic.gdx.scenes.scene2d.ui.Label |
currentPlayerLabel |
private com.badlogic.gdx.scenes.scene2d.ui.Label |
currentPlayerMainLabel |
private Trade |
currentTrade |
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
deployRoboticonButton
Button which allows players to deploy owned roboticons onto selected tiles
|
private Drawer |
drawer
Object defining QOL drawing functions for rectangles and on-screen tables
Used in this class to render tooltip regions
|
private boolean |
drawRoboticonIcon |
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
endTurnButton
Button that, when clicked, ends the current turn for the current player prematurely
|
private com.badlogic.gdx.scenes.scene2d.ui.Label |
energyCounter
Label counter providing a visual representation of the current player's energy stocks
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
energyUpgradeButton
Button allowing players to upgrade roboticons' energy-production capabilities
|
private GameEngine |
engine
Engine class that handles all of the game's logical processing
|
private com.badlogic.gdx.scenes.scene2d.ui.Label |
eventMessage |
private Overlay |
eventMessageOverlay |
private boolean |
eventMessageOverlayVisible |
private com.badlogic.gdx.scenes.scene2d.ui.Label |
foodCounter
Label counter providing a visual representation of the current player's food stocks
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
foodUpgradeButton
Button allowing players to upgrade roboticons' food-production capabilities
|
private com.badlogic.gdx.Game |
game
Stores current game-state, enabling transitions between screens and external QOL drawing functions
|
private static com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle |
gameButtonStyle
Establish visual parameters for in-game buttons
|
private static TTFont |
gameFont
Font which will be adopted by the game-screen's main interface
|
private com.badlogic.gdx.scenes.scene2d.Stage |
gameStage
On-screen stage which can be populated with actors
|
private int |
height |
(package private) io.github.teamfractal.animation.IAnimation |
lastTileClickedFlash |
private com.badlogic.gdx.scenes.scene2d.ui.Image |
map
Holds the image of the in-game map
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
miniGameButton
Button which can be clicked on to go to the mini game
|
private com.badlogic.gdx.scenes.scene2d.ui.Label |
moneyCounter
Label counter providing a visual representation of the current player's money
|
private com.badlogic.gdx.scenes.scene2d.ui.Label |
oreCounter
Label counter providing a visual representation of the current player's ore stocks
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
oreUpgradeButton
Button allowing players to upgrade roboticons' ore-production capabilities
|
private com.badlogic.gdx.scenes.scene2d.ui.TextButton |
pauseButton
Button which can be clicked on to pause the game
|
private com.badlogic.gdx.scenes.scene2d.Stage |
pauseStage
Establishes a secondary stage which will appear when the game is paused
|
private com.badlogic.gdx.scenes.scene2d.ui.Label |
phaseLabel
Label identifying the current phase number
|
(package private) io.github.teamfractal.animation.IAnimation |
playerWin |
private com.badlogic.gdx.scenes.scene2d.ui.Label |
roboticonCounter
Label counter providing a visual representation of the current player's roboticon stocks
|
private Tile |
selectedTile |
private com.badlogic.gdx.scenes.scene2d.ui.Label |
selectedTileLabel
Label stating the getID of the currently-selected tile
|
private com.badlogic.gdx.scenes.scene2d.ui.Image |
selectedTileOwnerIcon
Icon representing the player who owns the currently-selected tile
|
private com.badlogic.gdx.scenes.scene2d.ui.Image |
selectedTileRoboticonIcon
Icon representing the roboticon occupying the currently-selected tile
|
(package private) boolean |
shown |
private com.badlogic.gdx.scenes.scene2d.ui.Table |
tableRight |
private com.badlogic.gdx.scenes.scene2d.ui.Table |
tileGrid
Establishes the grid of tiles to be laid over the map
|
private static int |
tileXOffset |
private Overlay |
tooExpensiveOverlay |
private boolean |
tooExpensiveOverlayVisible |
private Overlay |
tradeOverlay |
private boolean |
tradeOverlayVisible |
private Overlay |
upgradeOverlay
Customised stage that shows up to offer roboticon upgrade choices
|
private boolean |
upgradeOverlayVisible
Determines whether the aforementioned roboticon upgrade overlay is to be drawn to the screen
|
private int |
width |
Constructor and Description |
---|
GameScreen(com.badlogic.gdx.Game game) |
GameScreen(com.badlogic.gdx.Game game,
boolean vsPlayer)
The game-screen's initial constructor
|
Modifier and Type | Method and Description |
---|---|
void |
activeTrade(Trade trade) |
void |
assignEngine(GameEngine engine) |
private void |
chancellor(Tile tile)
Draws the chancellor is it is set to visible
|
void |
closeTooExpensiveOverlay() |
void |
closeTradeOverlay() |
void |
closeUpgradeOverlay()
Closes the upgrade overlay and restores the functionality of the game's main stage
|
private void |
constructButtons()
Sets up the buttons to be placed onto the interface later by defining their visual representations and their
on-click functions together
|
private void |
constructEventMessageOverlay() |
private void |
constructLeftTable()
Set up the form and contents of the left-hand table so that they can be rendered later
Specifically defines the left-hand panel's spatial framework (in the form of a table) before populating it with
the game's timer, a phase label, a button for ending turns, the logo of the current player's associated college
and counters visualising the numbers of ore, energy, food and Roboticon stocks (and the money) that the
current player holds
|
private void |
constructPauseMenu()
Set up the pause menu to allow for the game to be successfully paused
|
private void |
constructRightTable()
Set up the form and contents of the right-hand table so that they can be rendered later
Specifically defines the right-hand panel's spatial framework (in the form of a table) before populating it with
the selected tile's name-label and college/roboticon icons, along with buttons to claim and deploy/upgrade
Roboticons on the selected tile and the whole interface for the game's market
|
private void |
constructTileGrid()
Set up the game-screen's central tile-grid so that it can be interacted with
The tiles on this grid take the form of invisible buttons that are directly laid over the map image at the
centre of this screen
|
private void |
constructTooExpensiveOverlay() |
private void |
constructTradeOverlay(Trade trade) |
private void |
constructUpgradeOverlay()
Set up an overlay which shows up when the current player opts to upgrade their roboticon
This will allow them to upgrade its food, energy or ore production stats
|
com.badlogic.gdx.scenes.scene2d.ui.Image |
currentPlayerIcon()
Returns the icon object used to visualise the logo of the current player's associated college
The GameEngine class uses this method to update said logo when it changes the active player
|
void |
deselectTile()
Run this to deselect the currently selected tile
Specifically resets the labels and icons that identify the selected tile and disables the buttons for
manipulating said tile (as no tile can be deemed as being "selected" after this is run)
|
void |
dispose()
Disposes of all visual data used to construct previous frames
This is called after each frame is rendered, and remains necessary to prevent memory leaks
|
private void |
drawRectangles()
Draw auxiliary rectangles to provide window-dressing for the interface
|
com.badlogic.gdx.scenes.scene2d.ui.TextButton |
endTurnButton()
Returns the button used to allow for players to prematurely end their turns
This method is required to allow for the GameEngine class to turn the button off during phase 1
|
protected com.badlogic.gdx.graphics.g2d.Batch |
getBatch() |
static com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle |
getGameButtonStyle() |
static TTFont |
getGameFont() |
io.github.teamfractal.screens.AbstractAnimationScreen.Size |
getScreenSize()
The screen size.
|
boolean |
getUpgradeOverlayVisible() |
void |
hide() |
void |
hideEventMessage() |
void |
openGameStage()
Prepares the renderer to render the main stage again (after pausing) by setting it up to accept inputs again
|
void |
openPauseStage()
Prepares the renderer to render the pause-screen stage again by setting it up to accept inputs again
|
void |
openTooExpensiveOverlay() |
void |
openTradeOverlay() |
void |
pause() |
void |
render(float delta)
Renders all visual elements (set up in the [show()] subroutine and all of its subsiduaries) to the window
This is called to prepare each and every frame that the game deploys
|
void |
resize(int width,
int height) |
void |
resume() |
void |
selectTile(Tile tile,
boolean showAnimation)
The code to be run whenever a particular tile is clicked on
Specifically updates the label identifying the selected tile, the college icon linked to the player who owns
it, the icon representing the Roboticon planted on it and the available options for the tile in the main
in-game interface
|
void |
setEnergyCounterValue(int value)
Sets the value represented by the energy-counter rendered within the main in-game interface
|
void |
setFoodCounterValue(int value)
Sets the value represented by the food-counter rendered within the main in-game interface
|
void |
setMoneyCounterValue(int value)
Sets the value represented by the money-counter rendered within the main in-game interface
|
void |
setOreCounterValue(int value)
Sets the value represented by the ore-counter rendered within the main in-game interface
|
void |
setRoboticonCounterValue(int value)
Sets the value represented by the Roboticon-counter rendered within the main in-game interface
|
void |
show()
Executes when the game-screen is loaded up, typically from the point of another screen
Serves as an extension of the screen's constructor that primarily builds visual elements
Currently instantiates Drawer object, the main stage, the font used to render on-screen text and the image of
the game's map before constructing the three primary tables that make up the in-game interface (along with the
auxiliary pause menu)
|
void |
showEventMessage(java.lang.String message) |
void |
showPlayerWin(Player player) |
boolean |
TradeOverlayVisible() |
void |
updateInventoryLabels()
Updates the on-screen counters for food, energy, ore, money and Roboticons
This is typically called when the active player switches or when a market transaction is made
|
void |
updatePhaseLabel() |
void |
updatePhaseLabel(java.lang.String description)
Updates the label on the left-hand side of the in-game interface to visualise and describe the game's current
phase
|
void |
updatePlayerName() |
private void |
updateSelectedTileLabel(int value)
Updates the label on the right-hand side of the in-game interface to visualise the identity of the selected tile
|
void |
updateSelectedTileLabel(Tile tile)
Updates the label on the right-hand side of the in-game interface to visualise the identity of the selected tile
Alternative method that takes an ID value from a provided tile rather than an ID value directly
|
private void |
updateUpgradeOptions()
Updates the options available to the current player on the roboticon upgrade screen based on their money count
|
private static final int tileXOffset
private com.badlogic.gdx.Game game
private GameEngine engine
private com.badlogic.gdx.scenes.scene2d.Stage gameStage
private com.badlogic.gdx.scenes.scene2d.Stage pauseStage
private com.badlogic.gdx.scenes.scene2d.ui.Image map
private com.badlogic.gdx.scenes.scene2d.ui.Table tileGrid
private com.badlogic.gdx.scenes.scene2d.ui.Label phaseLabel
private com.badlogic.gdx.scenes.scene2d.ui.Label foodCounter
private com.badlogic.gdx.scenes.scene2d.ui.Label energyCounter
private com.badlogic.gdx.scenes.scene2d.ui.Label oreCounter
private com.badlogic.gdx.scenes.scene2d.ui.Label roboticonCounter
private com.badlogic.gdx.scenes.scene2d.ui.Label moneyCounter
private com.badlogic.gdx.scenes.scene2d.ui.Label selectedTileLabel
private Drawer drawer
private com.badlogic.gdx.scenes.scene2d.ui.TextButton endTurnButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton pauseButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton miniGameButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton claimTileButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton deployRoboticonButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton foodUpgradeButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton oreUpgradeButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton energyUpgradeButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton closeUpgradeOverlayButton
private static TTFont gameFont
private com.badlogic.gdx.graphics.Texture chancellorTexture
private static com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle gameButtonStyle
private com.badlogic.gdx.scenes.scene2d.ui.Image currentPlayerIcon
private com.badlogic.gdx.scenes.scene2d.ui.Image selectedTileOwnerIcon
private com.badlogic.gdx.scenes.scene2d.ui.Image selectedTileRoboticonIcon
private Overlay upgradeOverlay
private Overlay tradeOverlay
private Overlay eventMessageOverlay
private com.badlogic.gdx.scenes.scene2d.ui.Label eventMessage
private com.badlogic.gdx.scenes.scene2d.ui.TextButton closeEventMessageButton
private boolean upgradeOverlayVisible
private boolean tradeOverlayVisible
private com.badlogic.gdx.graphics.g2d.Batch batch
private int height
private int width
private com.badlogic.gdx.scenes.scene2d.ui.Label currentPlayerLabel
private com.badlogic.gdx.scenes.scene2d.ui.Label currentPlayerMainLabel
private boolean drawRoboticonIcon
private Tile selectedTile
private com.badlogic.gdx.scenes.scene2d.ui.Table tableRight
private boolean eventMessageOverlayVisible
private com.badlogic.gdx.scenes.scene2d.ui.TextButton confirmTradeButton
private com.badlogic.gdx.scenes.scene2d.ui.TextButton cancelTradeButton
private Overlay tooExpensiveOverlay
private boolean tooExpensiveOverlayVisible
private com.badlogic.gdx.scenes.scene2d.ui.TextButton closePriceOverlayButton
boolean shown
io.github.teamfractal.animation.IAnimation lastTileClickedFlash
io.github.teamfractal.animation.IAnimation playerWin
private Trade currentTrade
public GameScreen(com.badlogic.gdx.Game game, boolean vsPlayer)
game
- Variable storing the game's state for rendering purposespublic GameScreen(com.badlogic.gdx.Game game)
public static com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle getGameButtonStyle()
public static TTFont getGameFont()
public void show()
show
in interface com.badlogic.gdx.Screen
public void render(float delta)
render
in interface com.badlogic.gdx.Screen
delta
- public void resize(int width, int height)
resize
in interface com.badlogic.gdx.Screen
public void pause()
pause
in interface com.badlogic.gdx.Screen
public void resume()
resume
in interface com.badlogic.gdx.Screen
public void hide()
hide
in interface com.badlogic.gdx.Screen
public void dispose()
dispose
in interface com.badlogic.gdx.Screen
private void constructButtons()
private void constructLeftTable()
private void constructRightTable()
private void constructTileGrid()
private void constructPauseMenu()
private void constructUpgradeOverlay()
public boolean getUpgradeOverlayVisible()
private void constructEventMessageOverlay()
public void showEventMessage(java.lang.String message)
public void hideEventMessage()
private void constructTradeOverlay(Trade trade)
private void constructTooExpensiveOverlay()
private void drawRectangles()
public void setFoodCounterValue(int value)
value
- The new value to be visualised by the in-game food counterpublic void setEnergyCounterValue(int value)
value
- The new value to be visualised by the in-game energy counterpublic void setOreCounterValue(int value)
value
- The new value to be visualised by the in-game ore counterpublic void setRoboticonCounterValue(int value)
value
- The new value to be visualised by the in-game Roboticon counterpublic void setMoneyCounterValue(int value)
value
- The new value to be visualised by the in-game money counterprivate void updateSelectedTileLabel(int value)
value
- The ID value of the tile to be described on the interfacepublic void updateSelectedTileLabel(Tile tile)
tile
- The tile to be described on the interfacepublic void updatePhaseLabel(java.lang.String description)
description
- The phase description to be displayed by the same labelpublic void updatePhaseLabel()
public com.badlogic.gdx.scenes.scene2d.ui.TextButton endTurnButton()
public com.badlogic.gdx.scenes.scene2d.ui.Image currentPlayerIcon()
public void openGameStage()
public void openPauseStage()
private void chancellor(Tile tile)
tile
- The tile it will be drawn onpublic void selectTile(Tile tile, boolean showAnimation)
tile
- The tile being clicked onpublic void deselectTile()
public void closeUpgradeOverlay()
public void updateInventoryLabels()
private void updateUpgradeOptions()
protected com.badlogic.gdx.graphics.g2d.Batch getBatch()
getBatch
in class io.github.teamfractal.screens.AbstractAnimationScreen
public io.github.teamfractal.screens.AbstractAnimationScreen.Size getScreenSize()
io.github.teamfractal.screens.AbstractAnimationScreen
getScreenSize
in class io.github.teamfractal.screens.AbstractAnimationScreen
public void showPlayerWin(Player player)
public void updatePlayerName()
public void openTradeOverlay()
public void closeTradeOverlay()
public boolean TradeOverlayVisible()
public void activeTrade(Trade trade)
public void openTooExpensiveOverlay()
public void closeTooExpensiveOverlay()
public void assignEngine(GameEngine engine)