Ejemplo n.º 1
0
    public void PlayerAddStep(GameTrace gameTrace)
    {
        if ((_gameDataHandler.GameState != GameState.WhitePlay && gameTrace.player == "white") ||
            (_gameDataHandler.GameState != GameState.BlackPlay && gameTrace.player == "black"))
        {
            return;
        }
        //Debug.Log("in PlayerAddStep:" + " GameState = " + _gameDataHandler.GameState + ", _isBlack = " + _isBlack +
        //    ", order = " + gameTrace.order + ", x = " + gameTrace.x + ", y = " + gameTrace.y + ", player = " + gameTrace.player);
        try {
            _gameDataHandler.AddStep(gameTrace);
            _gameSceneTool.AddGameObj(gameTrace);
            _gameDataHandler.UpdateGameState();

            if (_isDoublePlayer)
            {
                _isBlack = !_isBlack;
            }
            _gameSceneTool.LimitText.text = "";
        }
        catch (ArgumentException) {
            Debug.Log("already have a step on this position");
            // already have a step on this position
        }
        catch (PlayerLimitException) {
            _gameSceneTool.LimitText.text = "黑棋禁手触发" + Environment.NewLine + "x = " + gameTrace.x + ", y = " + (14 - gameTrace.y);
        }
    }