Example #1
0
    public override void OnPlayerListChanged(EPlayerController p, bool isRemove)
    {
        if (isRemove)
        {
            if (p.mSide == ESide.None)
            {
                PlayerWaitingInManager playerView = waitingPlayers.Find(plc => plc.player.username == p.username);
                if (playerView != null)
                {
                    GameObject.Destroy(playerView.gameObject);
                    waitingPlayers.Remove(playerView);
                }
                GameManager.Instance.FunctionDelay(delegate() { gridWaitingPlayer.Reposition(); }, 0.01f);
            }
            else
            {
                if (GameModelChan.CurrentState == GameModelChan.EGameState.waitingForPlayer || GameModelChan.CurrentState == GameModelChan.EGameState.waitingForReady)
                {
                    int i = ((int)p.mSide - 1);
                    kickAvatar[i].mainTexture = swappedAvatar[i].mainTexture = null;
                    kickAvatar[i].color       = swappedAvatar[i].color = Color.black;
                    kickUsername[i].text      = swappedUsername[i].text = "";
                    kickButton[i].gameObject.SetActive(false);
                }
            }
        }
        else
        {
            if (p.mSide == ESide.None)
            {
                waitingPlayers.Add(PlayerWaitingInManager.Create(p, gridWaitingPlayer, this));
                gridWaitingPlayer.Reposition();
            }
            else
            {
                int i = 0;
                if (p.mSide != ESide.Slot_0)
                {
                    i = ((int)p.mSide - 1);
                }

                SetDataPlayer(p, i);
            }
        }
    }
Example #2
0
    IEnumerator _DrawListWaitingPlayer()
    {
        while (waitingPlayers.Count > 0)
        {
            GameObject.Destroy(waitingPlayers[0].gameObject);
            waitingPlayers.RemoveAt(0);
        }
        yield return(new WaitForEndOfFrame());

        int i = 0;

        foreach (PlayerControllerChan player in GameModelChan.ListWaitingPlayer)
        {
            PlayerWaitingInManager playerWaiting = PlayerWaitingInManager.Create(player, gridWaitingPlayer, this);
            playerWaiting.gameObject.name = i + " " + player.username;
            waitingPlayers.Add(playerWaiting);
            i++;
        }
        gridWaitingPlayer.Reposition();
    }