Example #1
0
    static internal IEnumerator ServerUpdateAllPILPositions()
    {
        int playerCount = 0;
        int limit       = LobbyManager.lobbyManager.connectedPlayers;

        for (int i = 0; i < MainMenu.lobbyPanel.childCount && playerCount < limit; i++)
        {
            PlayerInLobby player = MainMenu.lobbyPanel.GetChild(i).GetComponent <PlayerInLobby>();
            if (player != null)
            {
                if (CustomNetManager.singleton.isServerBusy)
                {
                    yield return(new WaitUntil(() => CustomNetManager.singleton.isServerBusy));
                }
                CustomNetManager.singleton.isServerBusy = true;

                player.playerManager.playerIndex = playerCount;
                player.RpcUpdatePILPosition(playerCount);

                yield return(new WaitForEndOfFrame());

                CustomNetManager.singleton.isServerBusy = false;

                playerCount++;
            }
        }
    }
Example #2
0
    public void OnEndDrag(PointerEventData eventData)
    {
        if (!GlobalVariables.IsHost)
        {
            return;
        }

        this.transform.SetParent(placeholder.transform.parent);
        this.transform.SetSiblingIndex(placeholder.transform.GetSiblingIndex());
        Destroy(placeholder);

        StartCoroutine(PlayerInLobby.ServerUpdateAllPILPositions());
    }
Example #3
0
        public override void Update(GameTime gameTime)
        {
            if (_game.player._id == "null" && _game.idchecker > 50)
            {
                _game.client.SendMessage("give_id " + _game.player._name);
                _game.idchecker = 0;
            }
            if (_game.player._id == "null" && _game.idchecker <= 50)
            {
                _game.idchecker++;
            }
            _game.client.SendMessage(_game.player._id + " " + "giveINFO");

            _game.backobjlist = new List <Object>();
            for (int i = -5; i < 5; i++)
            {
                for (int j = -6; j < 6; j++)
                {
                    Object tmp = new Object(_game.textures.Tile_1);
                    tmp._position = new Vector2(tmp._texture.Width * i, tmp._texture.Height * j);
                    _game.backobjlist.Add(tmp);
                }
            }

            int Counter = 0;

            _game.msgchecker.Suspend();
            _componentsPl.Clear();
            foreach (var player in _game.LobbyPlayersList)
            {
                PlayerInLobby tmp = new PlayerInLobby(buttonTexture, buttonFont)
                {
                    Position = new Vector2(_game.Window.ClientBounds.Width / 10,
                                           _game.Window.ClientBounds.Height / 5 + Counter * _game.Window.ClientBounds.Height / 10),
                    Text  = player,
                    _font = buttonFont,
                };
                Counter++;
                _componentsPl.Add(tmp);
            }
            _game.msgchecker.Resume();

            foreach (var component in _components)
            {
                component.Update(gameTime);
            }
        }