Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         InGameMenu.Show();
     }
 }
Exemplo n.º 2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            InGameMenu.Show();
        }

        if (dataNewlyBound)
        {
            dataNewlyBound = false;

            MultiplayerGamers.ResetPlayers();
            UIGameTable.CleanTable();

            //  GET CURRENT PLAYER SEATS
            object seat0, seat1, seat2, seat3;
            if (RoomProperties.TryGetValue("SEAT0", out seat0))
            {
                MultiplayerGamers.UserJoined(seat0.ToString(), 0, seat0.ToString().Equals(player.GetInternalPlayer().PlayerName));
            }

            if (RoomProperties.TryGetValue("SEAT1", out seat1))
            {
                MultiplayerGamers.UserJoined(seat1.ToString(), 1, seat1.ToString().Equals(player.GetInternalPlayer().PlayerName));
            }

            if (RoomProperties.TryGetValue("SEAT2", out seat2))
            {
                MultiplayerGamers.UserJoined(seat2.ToString(), 2, seat2.ToString().Equals(player.GetInternalPlayer().PlayerName));
            }

            if (RoomProperties.TryGetValue("SEAT3", out seat3))
            {
                MultiplayerGamers.UserJoined(seat3.ToString(), 3, seat3.ToString().Equals(player.GetInternalPlayer().PlayerName));
            }

            object gameType, gameGoal;

            if (RoomProperties.TryGetValue("TYPE", out gameType))
            {
                if (gameType.ToString() == "0")
                {
                    MultiplayerManager.CurrentEndCondition = Common.Enums.GameMode.RoundCount;
                }
                else
                {
                    MultiplayerManager.CurrentEndCondition = Common.Enums.GameMode.TargetScore;
                }
            }
            if (RoomProperties.TryGetValue("GOAL", out gameGoal))
            {
                MultiplayerManager.CurrentEndConditionGoal = gameGoal;
            }
        }
    }
Exemplo n.º 3
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;
    }
Exemplo n.º 4
0
    void OnGUI()
    {
        if (gameTable.gameTable.GetGameState() != Common.Enums.GameState.PLAYING)
        {
            return;
        }

        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();
        }

        var internalPlayer = player.getInternalPlayer();
        var player2        = internalPlayer.GetNextPlayer();
        var player3        = player2.GetNextPlayer();
        var player4        = player3.GetNextPlayer();

        var roundScores = gameTable.gameTable.GetGameInstance().GetCurrentRound().GetRoundScores();

        string player1Text = internalPlayer.PlayerName;
        string player2Text = player2.PlayerName;
        string player3Text = player3.PlayerName;
        string player4Text = player4.PlayerName;

        if (roundScores != null && roundScores.Length == 4)
        {
            var player1Said = roundScores[internalPlayer.GetPlayersSeat()].GetSaid().ToString();
            var player2Said = roundScores[player2.GetPlayersSeat()].GetSaid().ToString();
            var player3Said = roundScores[player3.GetPlayersSeat()].GetSaid().ToString();
            var player4Said = roundScores[player4.GetPlayersSeat()].GetSaid().ToString();

            if (player1Said == "-2")
            {
                player1Said = "-";
            }
            else if (player1Said == "-1")
            {
                player1Said = LanguageManager.getString("PASS");
            }

            if (player2Said == "-2")
            {
                player2Said = "-";
            }
            else if (player2Said == "-1")
            {
                player2Said = LanguageManager.getString("PASS");
            }

            if (player3Said == "-2")
            {
                player3Said = "-";
            }
            else if (player3Said == "-1")
            {
                player3Said = LanguageManager.getString("PASS");
            }

            if (player4Said == "-2")
            {
                player4Said = "-";
            }
            else if (player4Said == "-1")
            {
                player4Said = LanguageManager.getString("PASS");
            }

            player1Text += "\n" + roundScores[internalPlayer.GetPlayersSeat()].GetGot() + " \\ " + player1Said;
            player2Text += "\n" + roundScores[player2.GetPlayersSeat()].GetGot() + " \\ " + player2Said;
            player3Text += "\n" + roundScores[player3.GetPlayersSeat()].GetGot() + " \\ " + player3Said;
            player4Text += "\n" + roundScores[player4.GetPlayersSeat()].GetGot() + " \\ " + player4Said;
        }
        GUI.skin = playerStatsGUISkin;
        //  PLAYER 1
        GUI.BeginGroup(playerStatPositions[0]);
        GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), player1Text);
        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;
        GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), player2Text);
        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;
        GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), player3Text);
        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;
        GUI.Box(new Rect(0, 0, playerStatPositions[0].width, playerStatPositions[0].height), player4Text);
        GUI.matrix = Matrix4x4.identity;
    }