private void SaveGame(BoardResponse result) { Debug.Log("SaveGame"); if (string.IsNullOrEmpty(result.SaveFileName)) { return; } Task.RunInMainThread(() => { var gameData = new GameData(); //var datetime = DateTime.Now.ToLocalTime().ToString(CultureInfo.CurrentCulture); Debug.Log("SaveGame clicked"); //Debug.Log(datetime); gameData.gameSetup = pieceManager.gameSetup; gameData.timeFromStartGame = Playtime; gameData.fen = pieceManager.engine.FEN; gameData.whoIsMove = pieceManager.engine.WhoseMove; gameData.logs = SaveGameData.LogList; foreach (var cell in board.AllCells) { if (cell.currentPiece == null) { continue; } var pieceData = new PieceData { Type = cell.currentPiece.GetType().ToString(), Color = cell.currentPiece.mainColor, X = cell.boardPosition.x, Y = cell.boardPosition.y }; gameData.cells.Add(pieceData); } Debug.Log("json"); var json = JsonUtility.ToJson(gameData, true); Debug.Log(json); if (!IsSaveGameDirExist()) { CreateSaveGameDir(); } SaveFile(result.SaveFileName, json); }); }
public BoardResponse MapModelToResponse(Board board) { if (board == null) { return(null); } var boardResponse = new BoardResponse { Id = board.Id, Name = board.Name, Image = board.Image, Description = board.Description, TeamId = board.TeamId }; return(boardResponse); }
private void OnBoardSuccess(BoardResponse response) { Debug.Log("Board success"); _currentSelection = new SelectedNothing(); }