|
Eile Mit Weile
|
Responsible for sending ClientRequests to the server and updating the local game state. from the server. More...
#include <GameController.hpp>
Static Public Member Functions | |
| static void | Init (GameWindow *game_window) |
| static void | ConnectToServer () |
| static void | UpdateGameState (GameState *new_game_state) |
| static void | StartGame () |
| static void | MoveFigure (Figure *, Space *) |
| static void | SkipTurn () |
| static void | ThrowDice () |
| static wxEvtHandler * | GetMainThreadEventHandler () |
| static void | ShowError (const std::string &title, const std::string &message) |
| static void | ShowStatus (const std::string &message) |
| static void | ShowGameOverMessage () |
Static Private Attributes | |
| static GameWindow * | _game_window = nullptr |
| static ConnectionPanel * | _connection_panel = nullptr |
| static MainGamePanel * | _main_game_panel = nullptr |
| static Player * | _me = nullptr |
| static GameState * | _current_game_state = nullptr |
Responsible for sending ClientRequests to the server and updating the local game state. from the server.
This class is unable to update the game state on its own; it can only copy the game state from the server. It also updates the UI to reflect the current game state or the connection panel before the game starts. Note: This class design is taken from https://gitlab.ethz.ch/hraymond/cse-lama-example-project. As a result, this class only contains static methods and members. This means that is not instsntiated anywhere and all methods can be called without an instance of this class. We consider this bad design (i.e. just fake Object-Oriented programming), but changing it would require a lot of refactoring so we decided to leave it as it is.
|
static |
Connects to the server using addresses inputted by player in ConnectionPanel.
|
static |
Wrapped wxFrame::GetEventHandler (see wxWidgets doc).
|
static |
Initializes the game controller. Creates the ConnectionPanel and MainGamePanel and shows the ConnectionPanel.
Sends a move_figure_request to the server.
Shows an error message to the user as a popup window.
|
static |
Shows a popup window with the game over message (incl. the winner).
Updates the status bar of the GameWindow.
|
static |
Sends a skip_turn_request to the server.
|
static |
Sends a start_game_request to the server.
|
static |
Sends a throw_dice_request to the server.
Updates the _current_game_state with the given game state.
|
staticprivate |
The panel that is shown before the game starts. Here players input the host address and their name.
|
staticprivate |
The main window of the game client.
|
staticprivate |
The panel that is shown during the game. Here players can see the game board and their figures.