Button Prefabs

This page is to summarize UI button prefabs that had been created.

The referencing description

1) The name of the UI button prefab

2) Image of the UI button

3) Description : What this UI button do.

4) Subscribers : Which GUI classes subscribed to the event, and the button will worked only if the scene do have the GUI component.

5) Component : The inherited BaseUI script component that attached to the UI prefab.

6) Invoking : The line of code when being executed will function the same as clicking the button.

7) Invoking Return Type : The returning value that can be retrieved from the Invoke event call. Most of the time when return type is bool is used for creating button feedback, true = tick, false = cross on button clicked.


Description : Ask AI to make a move.

Subscribers : (Click to see) classes with AI.

Component : ChessAIMoveButton

Invoking : ChessEventManager.InvokeRequestAIMoveEvent();

Invoking Return Type : void


Description : Switch the pieces model on the board from 2D to 3D if it's currently 2D. Otherwise, 3D to 2D if it's 3D.

Subscribers : classes.

Component : ChessChangeModelButton

Invoking : ChessEventManager.InvokeChangePieceModelEvent();

Invoking Return Type : string. String value is 3D if pieces become 3D after invoking, 2D otherwise.


Description : Check if there's any pieces currently checking the king. Tile color of checking piece and king will change when there's one.

Subscribers : classes.

Component : ChessCheckKingButton

Invoking : ChessEventManager.InvokeIndicateCheckingKingEvent();

Invoking Return Type : void


Description : Continue game from last saved.

Subscribers : classes.

Component : ChessContinueGameButton

Invoking : ChessEventManager.InvokeContinueGameEvent(bool isUI);

If isUI = true, the UIs as accordance to ChessBaseUIs prefab in list Show On Start will be shown and UIs in list Hide On Start will be set inactive.

If isUI = false, the ContinueGame(bool) function in the GUI class will be executed.

Invoking Return Type : void


Description : Delete current displaying saved moves variant data, if there's any.

Subscribers : classes.

Component : ChessDeleteMoveVariantButton

Invoking : ChessEventManager.InvokeDeletePGNMovesVariantDataEvent();

Invoking Return Type : bool. true if there's saved move variant to be deleted.


Description : Check if condition for optional draw such as fifty-moves rule and threefolds repetition has been fulfilled and draw the game if so. Otherwise, ask if AI wanted to draw the game.

Subscribers : classes.

Component : ChessDrawRequestButton

Invoking : ChessEventManager.InvokeDrawRequestEvent();

Invoking Return Type : bool. The true or false value if the draw function has been successfully executed. When game has finished or when AI is thinking will prevent the draw function from executing, resulting in false return value. The button will provide feedback accordance to true or false.


Description : Flip the board

Subscribers : classes.

Component : ChessFlipBoardButton

Invoking : ChessEventManager.InvokeFlipBoardEvent();

Invoking Return Type : bool. This boolean value is always true.


Description : Invert the color that should be the first to move when game first started

Subscribers : classes.

Component : ChessInvertTurnColorButton

Invoking : ChessEventManager.InvokeInvertTurnColorEvent();

Invoking Return Type : void


Description : Show the answer of the puzzle move for the current board position.

Subscribers : classes.

Component : ChessPuzzleHintButton

Invoking : ChessEventManager.InvokeShowPuzzleHintEvent();

Invoking Return Type : bool. The value indicate if there is any hint available.


Description : Quit game and clear all game state.

Subscribers : classes.

Component : ChessQuitGameButton

Invoking : ChessEventManager.InvokeQuitGameEvent(bool isUI);

Invoking Return Type : void


Description : Redo the last undone move, can only do once and move cannot be redo when a move have been made. With the exception of some GUI classes where their redo move logic has been overriden to be able to redo all undone moves, such as ChessPuzzleGUI.

Subscribers : classes.

Component : ChessRedoMoveButton

Invoking : ChessEventManager.InvokeRedoMoveEvent();

Invoking Return Type : ChessUndoHistory?. Return null if there's nothing to redo with.


Description : Restart game state to for when the game first started.

Subscribers : classes.

Component : ChessRestartGameButton

Invoking : ChessEventManager.InvokeRestartGameEvent();

Invoking Return Type : bool. true if game state restarted.


Description : Save game as file to persistent data path unique to each platform.

On ChessPGN scene and ChessPuzzleEditor scene, the text of this prefab has been changed to "Save Variant". For those scene, instead of saving game, they save move variants data.

Subscribers : classes.

Component : ChessSaveGameButton

Invoking : ChessEventManager.InvokeSaveGameEvent();

Invoking Return Type : bool. true if game has been saved.


Description : Show game as full PGN on scroll view UI.

Subscribers : classes.

Component : ChessShowPGNButton

Invoking : ChessEventManager.InvokeShowPGNEvent();

Invoking Return Type : bool. Always true.


Description : For scene that pieces only spawn and game only started when start button is pressed.

Subscribers : classes.

Component : ChessStartGameButton

Invoking : ChessEventManager.InvokeStartGameEvent(bool isUI);

If isUI = true, the UIs as accordance to ChessBaseUIs prefab in list Show On Start will be shown and UIs in list Hide On Start will be set inactive.

If isUI = false, the StartGame(bool) function in the GUI class will be executed.

Invoking Return Type : void


Description : Undo previous move made.

Subscribers : classes.

Component : ChessUndoMoveButton

Invoking : ChessEventManager.InvokeUndoMoveEvent();

Invoking Return Type : ChessMove?. Return null if there's nothing to undo with.


Description : Undo previous move made, with the restriction of allowing further move made. In order to lift the restriction, moves needed to be redo to the state when it's first undo view with.

The text of UndoMovebutton prefab in ChessPGN and ChessPuzzleEditor scene has been changed to < which is similar to this button but it's actually UndoMoveButton.

Subscribers : classes.

Component : ChessUndoViewButton

Invoking : ChessEventManager.InvokeUndoViewEvent();

Invoking Return Type : ChessMove?. Return null if there's nothing to undo with.

Last updated