Esempio n. 1
0
    public void SeatPlayer(NetworkPlayerBase networkPlayer, int seat)
    {
        if (networkPlayer.GetPlayersSeat() != -1)
        {
            networkPlayers[networkPlayer.GetPlayersSeat()] = null;
            GameTable.gameTable.LeaveTable(networkPlayer);
        }
        if (networkPlayers[seat] != null)
        {
            GameTable.gameTable.LeaveTable(seat);
        }

        networkPlayers[seat] = networkPlayer;
        GameTable.AddPlayer(networkPlayers[seat] as Player, seat);
    }
Esempio n. 2
0
    void OnGUI()
    {
        GUI.depth = 100;

        GUI.skin = buttonSkin;
        if (GUI.Button(new Rect(Screen.width / 80, Screen.height / 40, Screen.width / 9, Screen.width / 9), Properties.MenuButton))
        {
            InGameMenu.Show();
        }

        NetworkPlayerBase mainPlayer = player.GetInternalPlayer() as NetworkPlayerBase;

        Player[] multiplayerPlayers = new Player[4];

        int mainPlayersSeat = mainPlayer.GetPlayersSeat();

        if (mainPlayersSeat != -1)
        {
            //  PLAYER IS SEATED
            multiplayerPlayers[0] = (NetworkPlayerBase)mainPlayer;
            int nextSeat = NextSeat(mainPlayersSeat);
            multiplayerPlayers[1] = MultiplayerGamers.GetPlayerBySeat(nextSeat);
            nextSeat = NextSeat(nextSeat);
            multiplayerPlayers[2] = MultiplayerGamers.GetPlayerBySeat(nextSeat);
            nextSeat = NextSeat(nextSeat);
            multiplayerPlayers[3] = MultiplayerGamers.GetPlayerBySeat(nextSeat);
        }
        else
        {
            //  PLAYER HAS NOT SIT DOWN
            for (int i = 0; i < 4; i++)
            {
                multiplayerPlayers[i] = MultiplayerGamers.GetPlayerBySeat(i);
            }
        }

        GUI.skin = playerStatsGUISkin;
        //  PLAYER 1
        GUI.BeginGroup(playerStatPositions[0]);
        if (multiplayerPlayers[0] != null)
        {
            GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), multiplayerPlayers[0].PlayerName);
        }
        else if (GUI.Button(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), LanguageManager.getString("SIT")))
        {
            //  SIT TO FIRST POSITION
            ((LocalNetworkPlayer)mainPlayer).SitToTable(0, MultiplayerGamers);
        }
        GUI.EndGroup();
        GUI.matrix = Matrix4x4.identity;

        //  PLAYER 2
        Matrix4x4 m = Matrix4x4.identity;

        m.SetTRS(new Vector3(playerStatPositions[1].x, playerStatPositions[1].y + playerStatPositions[1].height, 1), Quaternion.Euler(0, 0, -90), Vector3.one);
        GUI.matrix = m;
        if (multiplayerPlayers[1] != null)
        {
            GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), multiplayerPlayers[1].PlayerName);
        }
        else if (GUI.Button(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), LanguageManager.getString("SIT")))
        {
            //  SIT TO SECOND POSITION
            ((LocalNetworkPlayer)mainPlayer).SitToTable(1, MultiplayerGamers);
        }
        GUI.matrix = Matrix4x4.identity;

        //  PLAYER 3
        m = Matrix4x4.identity;
        m.SetTRS(new Vector3(playerStatPositions[2].x + playerStatPositions[2].width, playerStatPositions[2].y + playerStatPositions[2].height, 1), Quaternion.Euler(0, 0, -180), Vector3.one);
        GUI.matrix = m;
        if (multiplayerPlayers[2] != null)
        {
            GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), multiplayerPlayers[2].PlayerName);
        }
        else if (GUI.Button(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), LanguageManager.getString("SIT")))
        {
            //  SIT TO THIRD POSITION
            ((LocalNetworkPlayer)mainPlayer).SitToTable(2, MultiplayerGamers);
        }
        GUI.matrix = Matrix4x4.identity;

        //  PLAYER 4
        m = Matrix4x4.identity;
        m.SetTRS(new Vector3(playerStatPositions[3].x + playerStatPositions[3].width, playerStatPositions[3].y, 1), Quaternion.Euler(0, 0, 90), Vector3.one);
        GUI.matrix = m;
        if (multiplayerPlayers[3] != null)
        {
            GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), multiplayerPlayers[3].PlayerName);
        }
        else if (GUI.Button(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), LanguageManager.getString("SIT")))
        {
            //  SIT TO FOURTH POSITION
            ((LocalNetworkPlayer)mainPlayer).SitToTable(3, MultiplayerGamers);
        }
        GUI.matrix = Matrix4x4.identity;
    }