コード例 #1
0
ファイル: MovePanel.cs プロジェクト: spherous/HexChess
    public void SetMove(BoardState state, Move move, NotationType notationType)
    {
        if (move.lastTeam == Team.White && !whiteSet)
        {
            whiteSet   = true;
            whiteState = state;
            whiteMove  = move;
        }
        else if (move.lastTeam == Team.Black && !blackSet)
        {
            blackSet   = true;
            blackState = state;
            blackMove  = move;
        }

        TextMeshProUGUI toChange = move.lastTeam == Team.White ? whiteText : blackText;
        string          notation = Notation.Get(state, move, board.currentGame.promotions, notationType);

        toChange.text = notation;

        if (move.lastTeam == Team.White)
        {
            blackText.text = "";
        }

        TextMeshProUGUI deltaTimeToChange = move.lastTeam == Team.White ? whiteDeltaTime : blackDeltaTime;

        if (deltaTimeToChange != null)
        {
            deltaTimeToChange.text = $"+{TimeSpan.FromSeconds(move.duration).ToString(move.duration.GetStringFromSeconds())}";
        }
    }
コード例 #2
0
ファイル: MovePanel.cs プロジェクト: spherous/HexChess
    public void SetNotation(NotationType type)
    {
        if (whiteSet)
        {
            whiteText.text = Notation.Get(whiteState, whiteMove, board.currentGame.promotions, type);
        }

        if (blackSet)
        {
            blackText.text = Notation.Get(blackState, blackMove, board.currentGame.promotions, type);
        }
    }