public MoveResult Move(Move move, bool raiseEvent) { MoveResult validationResult = this.ValidateMove(move); bool canMove = true; if (validationResult != MoveResult.Valid) canMove = false; Logger.Instance.Log("MoveAttempt", string.Format("GameId:{1}|PlayerId:{2}|ValidationResult:{0}", validationResult.ToString(), move.GameId, move.PlayerId), JsonSerializer.SerializeToJSON(move)); if (!canMove) return validationResult; Match match; GameState currentState = TicTacToeHost.Instance.GetGameState(move.GameId, move.PlayerId); using (IGameDataService gameDataService = new GameDataService()) { match = gameDataService.GetMatch(null, move.GameId); gameDataService.Move(move.GameId, move.PlayerId, move.OriginX, move.OriginY, move.X, move.Y); gameDataService.Save(); } this.UpdateGame(move.GameId); if (validationResult == MoveResult.Valid && raiseEvent) { GameConfiguration config = GameConfigCache.Instance.GetConfig(match.MatchId); if (config.GameType == GameType.Network) this.PlayerMove(this, new MoveEventArgs() { MatchId = match.MatchId, PlayerId = move.PlayerId, Mode = currentState.Mode, OriginX = move.OriginX, OriginY = move.OriginY, X = move.X, Y = move.Y }); } return validationResult; }