The Coolest Chess
  • The Chess Documentation
    • Chess Game Introduction
    • Essential Prefabs
    • Components
  • Importing Stockfish AI
  • Controller
    • Base Controller
    • Two Player Controller
  • The UIs
    • Button Prefabs
    • UI Events
    • Enquiry
    • Replacing UI
    • Others
  • Scenes Details
    • ChessPGN
    • ChessPuzzleEditor
    • ChessPuzzle
    • ChessAI
  • Honorable Mentioned
    • ChessBoard class
    • GUI Classes
    • Game Logic Classes
    • The Architecture Notice
  • Customization
    • Time AI
    • AI Draw Game
    • TypeI AI
    • TypeII AI
    • Event Based Functions
    • Chess Game Finishing Rule
  • Unit Tests
Powered by GitBook
On this page
  • Scene Description
  • How to load PGN text file
  • How to add new PGN header record type for PGN file text format?
  1. Scenes Details

ChessPGN

Some Important information for this scene

PreviousScenes DetailsNextChessPuzzleEditor

Last updated 3 months ago

Scene Description

The dropdown bar at the top side of the scene act as a navigator for all processed PGN text file data, as shown in image above.

Descriptions of numbered UI in image above :

1) Puzzle Editor Button - This button not only load Puzzle Editor scene but leaving the ChessPGN scene undestroyed, things can be continued when moving back from ChessPuzzleEditor scene. On top of that, currently viewing game match data from this scene will be carry over to ChessPuzzleEditor scene for editing. However, there are two options while picking type of data to be transferred.

i) Move Variant - Transfer only current move variant data that are displaying in the 2) Move Variant Scroll View and any other saved move variant data that will not cause illegal moves. Fixed moves data, those converted from algebraic notations of text file, will be carried over partially if not fully, up to the bridging point(as displayed by grey button in the 2) Move Variant Scroll View).

ii) Fixed Move - All move variant data will be ignored while all of the displaying fixed moves data, will be carried over.

How to load PGN text file

The PGN text folder is located at path Resources/PGN/TextFiles, any newly imported PGN text files have to be in this location.

To be able to select a new imported PGN text file :

1) The exact file name has to be registed in ChessPGNGameFilesName scriptable object located in Resources/ScriptableObjects/ChessPGN folder.

2) The PGN text file selection dropdown will automatic refer to the file name in the list of ChessPGNGameFilesName scriptable object according to index of itself(without counting in Custom dropdown option), add as many dropdown options as the number of text file name in the scriptable object list, the dropdown name isn't necessary to match the text file name, but the index does.

How to add new PGN header record type for PGN file text format?

The example format for PGN text file

Step 1

In ChessPGNRecord.cs file located at path Scripts/Mechanism/Structs, add new property to ChessPGNRecord struct, the name of the property will be used in step 3.

Step 2

Note that each of the values contained in ChessPGNType enum are the exact name as circled in red in below image. If there are different or additional name in the PGN header section in your own format, just modify or add those value to ChessPGNType enum, then move on to the next step.

Step 3

In HelperGUI.cs file located at path Scripts/Main/Others, in the ConvertToPGNRecords(TextAsset) function, add an else if statement for the new property added from 2nd Steps like the example image below.

2) Move Variant Scroll View - It is exactly the same as the Move Variant Scroll View in .

The scroll view on the right side of this scene is exactly same as the Fixed Move Variant Scroll View in . The difference is that making a move by the controller is possible when green button is in this scroll view.

ChessPuzzleEditor scene
ChessPuzzleEditor scene
PGN text file selection dropdown