コード例 #1
0
ファイル: BoardUI.cs プロジェクト: rebuilder17/ConnectFour
    void ShowStatus(GameState.IMove move)
    {
        m_statusPanel.SetActive(true);

        var player = move.who == GameState.PlayerTurn.One? BoardStone.ColorPreset.Player1 : BoardStone.ColorPreset.Player2;

        m_statusStone.color   = BoardStone.GetColorFromPreset(player);
        m_statusPosition.text = string.Format("({0},{1})", move.x + 1, move.y + 1);
        m_statusComment.text  = move.comment;
    }
コード例 #2
0
    public void Setup(GameState state, System.Action delHuman, System.Action delSearch, System.Action delRule)
    {
        var color = state.nextPlayer == GameState.PlayerTurn.One ? BoardStone.ColorPreset.Player1 : BoardStone.ColorPreset.Player2;

        m_stone.color = BoardStone.GetColorFromPreset(color);

        m_delHuman  = delHuman;
        m_delSearch = delSearch;
        m_delRule   = delRule;
    }
コード例 #3
0
    public override void SetupData(GameState.IBoardSnapshot parameter)
    {
        m_boardSnapshot = parameter;

        var lastmove = parameter.lastMove;

        m_text.text = string.Format("턴 : {0} ({1},{2})", lastmove.turn + 1, lastmove.x + 1, lastmove.y + 1);

        var colorPreset = lastmove.who == GameState.PlayerTurn.One? BoardStone.ColorPreset.Player1 : BoardStone.ColorPreset.Player2;

        m_stone.color = BoardStone.GetColorFromPreset(colorPreset);
    }
コード例 #4
0
    public void Setup(Result result, System.Action callback)
    {
        m_callback = callback;

        bool   showImage;
        Color  imageColor = Color.white;
        string message;

        switch (result)
        {
        case Result.Player1Win:
            showImage  = true;
            imageColor = BoardStone.GetColorFromPreset(BoardStone.ColorPreset.Player1);
            message    = "플레이어 1 승리!";
            break;

        case Result.Player2Win:
            showImage  = true;
            imageColor = BoardStone.GetColorFromPreset(BoardStone.ColorPreset.Player2);
            message    = "플레이어 2 승리!";
            break;

        case Result.Player1Error:
            showImage  = true;
            imageColor = BoardStone.GetColorFromPreset(BoardStone.ColorPreset.Player1);
            message    = "착수 에러 발생 (플레이어 1)";
            break;

        case Result.Player2Error:
            showImage  = true;
            imageColor = BoardStone.GetColorFromPreset(BoardStone.ColorPreset.Player2);
            message    = "착수 에러 발생 (플레이어 2)";
            break;

        case Result.Draw:
        default:
            showImage = false;
            message   = "무승부!";
            break;
        }

        m_stoneImage.gameObject.SetActive(showImage);
        m_stoneImage.color = imageColor;
        m_text.text        = message;
    }
コード例 #5
0
    public void ShowInfo(GameState curstate)
    {
        int playerNum;

        BoardStone.ColorPreset playerColor;

        switch (curstate.nextPlayer)
        {
        case GameState.PlayerTurn.One:
            playerNum   = 1;
            playerColor = BoardStone.ColorPreset.Player1;
            break;

        case GameState.PlayerTurn.Two:
        default:
            playerNum   = 2;
            playerColor = BoardStone.ColorPreset.Player2;
            break;
        }

        m_stoneImage.color = BoardStone.GetColorFromPreset(playerColor);
        m_player.text      = string.Format("플레이어 {0} 차례", playerNum);
        m_turn.text        = string.Format("현재 턴 : {0}", curstate.turnCount + 1);
    }
コード例 #6
0
 public void SetPlayerMark(BoardStone.ColorPreset color)
 {
     m_stone.color = BoardStone.GetColorFromPreset(color);
 }