Exemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         RoomSelectionMenu.Show();
         Hide();
     }
 }
Exemplo n.º 2
0
 public void onUserLeft(string user)
 {
     if (LobbyPlayerStats.RoomData != null && LobbyPlayerStats.RoomData.getRoomOwner() == user && user != StaticPlayer.GetInternalPlayer().PlayerName)
     {
         WarpClient.GetInstance().LeaveRoom(LobbyPlayerStats.RoomData.getId());
         LobbyPlayerStats.Hide();
         string roomDeleteCommand = "ROOMDLT";
         RoomSelectionMenu.Show(roomDeleteCommand);
         RoomSelectionMenu.Activate();
     }
     else if (LobbyPlayerStats.RoomData != null && StaticPlayer.GetInternalPlayer().PlayerName == LobbyPlayerStats.RoomData.getRoomOwner())
     {
         int i        = 0;
         int userSeat = -1;
         while (userSeat != -1 && i < 4)
         {
             if (LobbyPlayerStats.RoomProperties["SEAT" + i.ToString()].ToString() == user)
             {
                 userSeat = i;
             }
             i++;
         }
         if (userSeat != -1)
         {
             List <string> removeProperties = new List <string>();
             removeProperties.Add("SEAT" + userSeat.ToString());
             WarpClient.GetInstance().UpdateRoomProperties(LobbyPlayerStats.RoomData.getId(), null, removeProperties);
         }
     }
 }
Exemplo n.º 3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Hide();
            RoomSelectionMenu.Show();
        }

        if (tryAgainControl)
        {
            tryAgainControl = false;
            StartCoroutine(TryAgain());
        }
    }
Exemplo n.º 4
0
    void OnGUI()
    {
        if (JoinResult != -1)
        {
            GUI.depth = 10;
            GUI.skin  = JoinRoomGuiSkin;
            GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height));
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), background);

            if (GUI.Button(new Rect(Screen.width / 25, Screen.height / 25, Properties.BackButtonSize, Properties.BackButtonSize), Properties.BackButton))
            {
                Hide();
                RoomSelectionMenu.Show();
            }

            float offset = Screen.height / 10;
            GUI.DrawTexture(new Rect(Screen.width / 2 - LOGO_SIZE, offset, LOGO_SIZE * 2, LOGO_SIZE), logo);

            offset += LOGO_SIZE + offset;

            float button_size = Screen.width / 3;
            switch (JoinResult)
            {
            case -2:

                GUI.Box(new Rect(Screen.width / 4, offset, Screen.width / 2, Properties.TEXT_HEIGHT * 2), LanguageManager.getString("WAIT"));

                break;

            default:

                GUI.Box(new Rect(Screen.width / 20, offset, Screen.width - Screen.width / 10, Properties.TEXT_HEIGHT * 4), LanguageManager.getString("JOINERR"));
                offset += Properties.TEXT_HEIGHT * 5;

                if (GUI.Button(new Rect(Screen.width / 2 - button_size / 2, offset, button_size, Properties.TEXT_HEIGHT * 2), LanguageManager.getString("REGAGAIN")))
                {
                    StartCoroutine(TryAgain());
                }

                break;
            }

            GUI.EndGroup();
        }
    }
Exemplo n.º 5
0
 public void DialogBoxCallback(bool answer)
 {
     if (Properties.ActiveGameType == GameType.SinglePlayer)
     {
         if (answer)
         {
             Hide();
             PlayerStats.Hide();
             LobbyPlayerStats.Hide();
             MainMenu.Show();
         }
         else
         {
             Hide();
         }
     }
     else
     {
         if (answer)
         {
             WarpClient.GetInstance().LeaveRoom(LobbyPlayerStats.RoomData.getId());
             if (LobbyPlayerStats.RoomData.getRoomOwner() == Player.GetInternalPlayer().PlayerName)
             {
                 string roomDeleteCommand = "ROOMDLT";
                 MultiplayerManager.SendBytes(ByteHelper.GetBytes(roomDeleteCommand));
                 WarpClient.GetInstance().DeleteRoom(LobbyPlayerStats.RoomData.getId());
                 RoomSelectionMenu.Show(roomDeleteCommand);
             }
             else
             {
                 RoomSelectionMenu.Renew();
             }
             LobbyPlayerStats.RoomData = null;
             PlayerStats.Hide();
             LobbyPlayerStats.Hide();
             Hide();
         }
     }
 }
Exemplo n.º 6
0
    void OnGUI()
    {
        if (reg_result != -1)
        {
            GUI.depth = 10;
            GUI.skin  = login_gui_skin;
            GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height));
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), background);

            if (GUI.Button(new Rect(Screen.width / 25, Screen.height / 25, Properties.BackButtonSize, Properties.BackButtonSize), Properties.BackButton))
            {
                gameObject.SetActive(false);
                reg_screen.gameObject.SetActive(true);
            }

            float offset = Screen.height / 10;
            GUI.DrawTexture(new Rect(Screen.width / 2 - LOGO_SIZE, offset, LOGO_SIZE * 2, LOGO_SIZE), logo);

            offset += LOGO_SIZE + offset;

            float button_size = Screen.width / 3;
            switch (reg_result)
            {
            case -2:

                GUI.Box(new Rect(Screen.width / 4, offset, Screen.width / 2, Properties.TEXT_HEIGHT * 2), LanguageManager.getString("WAIT"));

                break;

            case 0:

                GUI.Box(new Rect(Screen.width / 4, offset, Screen.width / 2, Properties.TEXT_HEIGHT * 2), LanguageManager.getString("LOGINSCS"));
                offset += Properties.TEXT_HEIGHT * 3;

                if (GUI.Button(new Rect(Screen.width / 2 - button_size / 2, offset, button_size, Properties.TEXT_HEIGHT * 2), LanguageManager.getString("OK")))
                {
                    this.gameObject.SetActive(false);
                    RoomSelectionMenu.Show();
                }
                break;

            case 1:

                GUI.Box(new Rect(Screen.width / 20, offset, Screen.width - Screen.width / 10, Properties.TEXT_HEIGHT * 4), LanguageManager.getString("ALRDYEXSTS"));
                offset += Properties.TEXT_HEIGHT * 5;

                if (GUI.Button(new Rect(Screen.width / 2 - button_size / 2, offset, button_size, Properties.TEXT_HEIGHT * 2), LanguageManager.getString("REGAGAIN")))
                {
                    reg_result = -1;
                    reg_screen.gameObject.SetActive(true);
                    Hide();
                }

                break;

            case 2:
                GUI.Box(new Rect(Screen.width / 20, offset, Screen.width - Screen.width / 10, Properties.TEXT_HEIGHT * 4), LanguageManager.getString("EMLINVLD"));
                offset += Properties.TEXT_HEIGHT * 5;

                if (GUI.Button(new Rect(Screen.width / 2 - button_size / 2, offset, button_size, Properties.TEXT_HEIGHT * 2), LanguageManager.getString("REGAGAIN")))
                {
                    reg_result = -1;
                    reg_screen.gameObject.SetActive(true);
                    Hide();
                }
                break;
            }

            GUI.EndGroup();
        }
    }
Exemplo n.º 7
0
    public void onBytes(byte[] msg)
    {
        string networkMessage = ByteHelper.GetString(msg);

        LogManager.Log("Received Update: " + networkMessage);

        string[] messageArgs = networkMessage.Split('-');

        string messageCommand;

        if (messageArgs.Length == 0)
        {
            messageCommand = networkMessage;
        }
        else
        {
            messageCommand = messageArgs[0];
        }

        switch (messageCommand)
        {
        case "SIT":
            if (LobbyPlayerStats.RoomData.getRoomOwner() == NonStaticPlayer.GetInternalPlayer().PlayerName)
            {
                int seat = -1;
                if (int.TryParse(messageArgs[1], out seat))
                {
                    string playerName = messageArgs[2];

                    //  SET ROOM PROPERTY
                    Dictionary <string, object> tableProperties = new Dictionary <string, object>();
                    tableProperties.Add("SEAT" + seat.ToString(), playerName);
                    List <string> removeProperties = new List <string>();

                    object seat0, seat1, seat2, seat3;
                    if (LobbyPlayerStats.RoomProperties.TryGetValue("SEAT0", out seat0) && seat0.ToString() == playerName)
                    {
                        removeProperties.Add("SEAT0");
                        NonStaticPlayer.gameTable.gameTable.LeaveTable(0);
                    }

                    if (LobbyPlayerStats.RoomProperties.TryGetValue("SEAT1", out seat1) && seat1.ToString() == playerName)
                    {
                        removeProperties.Add("SEAT1");
                        NonStaticPlayer.gameTable.gameTable.LeaveTable(1);
                    }

                    if (LobbyPlayerStats.RoomProperties.TryGetValue("SEAT2", out seat2) && seat2.ToString() == playerName)
                    {
                        removeProperties.Add("SEAT2");
                        NonStaticPlayer.gameTable.gameTable.LeaveTable(2);
                    }

                    if (LobbyPlayerStats.RoomProperties.TryGetValue("SEAT3", out seat3) && seat3.ToString() == playerName)
                    {
                        removeProperties.Add("SEAT3");
                        NonStaticPlayer.gameTable.gameTable.LeaveTable(3);
                    }

                    if (removeProperties.Count == 0)
                    {
                        removeProperties = null;
                    }

                    WarpClient.GetInstance().UpdateRoomProperties(LobbyPlayerStats.RoomData.getId(), tableProperties, removeProperties);
                }
            }

            break;

        case "ROOMDLT":

            WarpClient.GetInstance().LeaveRoom(LobbyPlayerStats.RoomData.getId());
            LobbyPlayerStats.Hide();
            RoomSelectionMenu.Show("ROOMDLT");
            break;

        case "PLAY":
            int playerSeat, cardType, cardValue;
            if (int.TryParse(messageArgs[1], out playerSeat))
            {
                if (playerSeat != NonStaticPlayer.GetInternalPlayer().GetPlayersSeat())
                {
                    if (int.TryParse(messageArgs[2], out cardType))
                    {
                        if (int.TryParse(messageArgs[3], out cardValue))
                        {
                            RemoteNetworkPlayer networkPlayer = MultiplayerGamers.GetPlayerBySeat(playerSeat) as RemoteNetworkPlayer;
                            Card cardToPlay = new Card(cardValue, cardType);
                            networkPlayer.PlayCard(cardToPlay);
                        }
                    }
                }
            }

            break;

        case "BID":
            int bidPlayerSeat, bid;
            if (int.TryParse(messageArgs[1], out bidPlayerSeat))
            {
                if (bidPlayerSeat != NonStaticPlayer.GetInternalPlayer().GetPlayersSeat())
                {
                    if (int.TryParse(messageArgs[2], out bid))
                    {
                        NetworkPlayerBase networkPlayer = MultiplayerGamers.GetPlayerBySeat(bidPlayerSeat);
                        if (bid == 999)
                        {
                            networkPlayer.Bid(-1);
                        }
                        else
                        {
                            networkPlayer.Bid(bid);
                        }
                    }
                }
            }
            break;

        case "SETTRMP":
            int trumpPlayerSeat, trumpType;
            if (int.TryParse(messageArgs[1], out trumpPlayerSeat))
            {
                if (trumpPlayerSeat != NonStaticPlayer.GetInternalPlayer().GetPlayersSeat())
                {
                    if (int.TryParse(messageArgs[2], out trumpType))
                    {
                        NetworkPlayerBase networkPlayer = MultiplayerGamers.GetPlayerBySeat(trumpPlayerSeat);
                        networkPlayer.SetTrumpType(CardHelper.GetCardTypeFromValue(trumpType));
                    }
                }
            }
            break;

        case "DEALCALLBACK":
            IncreaseDealCallback();
            break;

        case "START":
            if (LobbyPlayerStats.RoomData.getRoomOwner() != NonStaticPlayer.GetInternalPlayer().PlayerName)
            {
                MultiplayerGamers.GameTable.gameTable.PlayersReadyCallback();
            }
            break;
        }

        LogManager.Log(networkMessage);
    }
Exemplo n.º 8
0
 public static void Activate()
 {
     LoginResultScreen.Hide();
     LoadingScreen.Hide();
     RoomSelectionMenu.Show();
 }