Пример #1
0
        public override void OnLobbyServerDisconnect(NetworkConnection conn)
        {
            for (int i = 0; i < lobbySlots.Length; ++i)
            {
                ShitLobbyPlayer p = lobbySlots[i] as ShitLobbyPlayer;

                if (p != null)
                {
                    p.RpcUpdateRemoveButton();
                    p.ToggleJoinButton(numPlayers >= minPlayers);
                }
            }
        }
Пример #2
0
        public override void OnLobbyServerPlayerRemoved(NetworkConnection conn, short playerControllerId)
        {
            for (int i = 0; i < lobbySlots.Length; ++i)
            {
                ShitLobbyPlayer p = lobbySlots[i] as ShitLobbyPlayer;

                if (p != null)
                {
                    p.RpcUpdateRemoveButton();
                    p.ToggleJoinButton(numPlayers + 1 >= minPlayers);
                }
            }
        }
Пример #3
0
        public void AddPlayer(ShitLobbyPlayer player)
        {
            if (_players.Contains(player))
            {
                return;
            }

            _players.Add(player);

            player.transform.SetParent(playerListContentTransform, false);
            addButtonRow.transform.SetAsLastSibling();

            PlayerListModified();
        }
Пример #4
0
        // ----------------- Server callbacks ------------------

        //we want to disable the button JOIN if we don't have enough player
        //But OnLobbyClientConnect isn't called on hosting player. So we override the lobbyPlayer creation
        public override GameObject OnLobbyServerCreateLobbyPlayer(NetworkConnection conn, short playerControllerId)
        {
            GameObject obj = Instantiate(lobbyPlayerPrefab.gameObject) as GameObject;

            ShitLobbyPlayer newPlayer = obj.GetComponent <ShitLobbyPlayer>();

            newPlayer.ToggleJoinButton(numPlayers + 1 >= minPlayers);


            for (int i = 0; i < lobbySlots.Length; ++i)
            {
                ShitLobbyPlayer p = lobbySlots[i] as ShitLobbyPlayer;

                if (p != null)
                {
                    p.RpcUpdateRemoveButton();
                    p.ToggleJoinButton(numPlayers + 1 >= minPlayers);
                }
            }

            return(obj);
        }
Пример #5
0
 public void RemovePlayer(ShitLobbyPlayer player)
 {
     player.RemovePlayer();
 }
Пример #6
0
 public void RemovePlayer(ShitLobbyPlayer player)
 {
     _players.Remove(player);
     PlayerListModified();
 }