Example #1
0
        public void InitializeWithReplay(GameMoveHistory replayHistory)
        {
            ReplayHistory = replayHistory;
            GameBoard     = GameBoardData.GetGameBoard(replayHistory.GameBoardData);
            GameBoard.UpdateAvailableMoves();

            CurrentStepIndex = 0;
            notifyPropertiesChangedForMove();
        }
Example #2
0
        public static void SaveReplay(GameMoveHistory moveHistory, string saveName)
        {
            var filePath = saveNameToFilePath(saveName);
            var json     = JsonUtility.ToJson(moveHistory, prettyPrint: true);

            Directory.CreateDirectory(Path.GetDirectoryName(filePath));
            File.WriteAllText(filePath, json);
            Debug.Log("File written to " + filePath);
        }
Example #3
0
        public void LoadReplay(Text saveButtonText)
        {
            string          saveName = saveButtonText.text;
            GameMoveHistory replay   = ReplayManager.LoadReplay(saveName);

            GameBoardSceneParameters.SetParameters(new GameBoardSceneParameters()
            {
                GameBoard     = GameBoardData.GetGameBoard(replay.GameBoardData),
                TimeLimit     = replay.TimeLimit,
                ReplayHistory = replay,
            });
            SceneManager.LoadScene("GameBoard");
        }