ChessPuzzle
Last updated
Last updated
Puzzle level data are created from ChessPuzzleEditor scene and being saved into ChessPuzzleLevel scriptable object, a PuzzleButton Prefab has been prepared for convenience, with the ChessLoadPuzzleLevelButton script component attached, loading a puzzle level is just a matter of click on the button.
Descriptions of numbered UI in image above :
1) Fixed Move Scroll View - The data and concept is exact the same from the scroll view in ChessPuzzleEditor scene.
2) Puzzle Move Scroll View - The answer provided by the controller will be validated by the underlying game logic while being displayed as buttons with algebraic notation text on the right side of the scroll view, to check if any of the sequence has the potential to match the exact same move variant histories data, as provided by the Move Variant Scroll View in ChessPuzzleEditor scene.
To show or hide the left side of the scroll view, click the Show/Hide Answer button. The scroll view display the exact answer for the puzzle level in visual format(white row for white color and black row for black, it will turn green when correct, red for failure), any content within the scroll view are unclickable. The dropdown above the scroll view is the exact same dropdown when saving move variant in ChessPuzzleEditor scene. When controller made a move without matching any available answer sequence will cause a failure in the validation and thus failed the puzzle level. The content in the scroll view will regenerate to potential answer that has the potential to match the exact sequence of moves made by controller, if only if there are more than one set of saved move variant. The level is successful as soon as the validator found an exact match of move sequence made by the controller and from the answer.
3) Show Hint Button - Show answer for the next move by highlighting the tiles as well as the associated row in the 2) Left Side of Puzzle Move Scroll View.
4) Undo View/Redo View Button - Forward or backward the state of board position without triggering the puzzle level validation logic. When clicking the button on the scroll view of 1) or 2), it's using this function to reach the desirable state.
5) Restart Button - Restart the puzzle level by clearing all of the historical puzzle move made by controller and reset validation record.
6) Undo Button - This will undo the validation record and remove the last move history made by controller.