Exemplo n.º 1
0
    IEnumerator _LoadListWaitingView()
    {
        if (GameModelChan.game == null || GameModelChan.ListWaitingPlayer.Count == 0)
        {
            yield break;
        }
        while (waitingViews.Count > 0)
        {
            GameObject.Destroy(waitingViews[0].gameObject);
            waitingViews.RemoveAt(0);
        }
        waitingViews.Clear();
        yield return(new WaitForEndOfFrame());

        foreach (PlayerControllerChan playerController in GameModelChan.ListWaitingPlayer)
        {
            PlayerWaitingView view    = PlayerWaitingView.Create(playerController, tableListWaiting);
            string            nameRow = "";
            if (playerController.isPriority)
            {
                nameRow = "00";
            }
            else
            {
                nameRow = waitingViews.Count + playerController.username;
            }
            view.gameObject.name = nameRow;
            waitingViews.Add(view);
        }
        tableListWaiting.Reposition();
    }
Exemplo n.º 2
0
    public void AddWaitingPlayer(PlayerControllerChan player)
    {
        PlayerWaitingView view = PlayerWaitingView.Create(player, tableListWaiting);

        view.gameObject.name = waitingViews.Count + " " + player.username;
        waitingViews.Add(view);
        tableListWaiting.Reposition();
        tableListWaiting.transform.parent.GetComponent <UIScrollView>().ResetPosition();
    }
Exemplo n.º 3
0
    public void RemoveWaitingPlayer(EPlayerController player)
    {
        PlayerWaitingView waitingView = waitingViews.Find(pl => pl.player.username == player.username);

        if (waitingView != null)
        {
            GameObject.Destroy(waitingView.gameObject);
            waitingViews.Remove(waitingView);
            GameManager.Instance.FunctionDelay(delegate() { tableListWaiting.Reposition(); tableListWaiting.transform.parent.GetComponent <UIScrollView>().ResetPosition(); }, 0.001f);
        }
    }
Exemplo n.º 4
0
    public static PlayerWaitingView Create(PlayerControllerChan player, UIGrid parent)
    {
        GameObject gobj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/PlayerWaiting/PlayerWaitingView"));

        gobj.transform.parent        = parent.transform;
        gobj.transform.localPosition = Vector3.zero;
        gobj.transform.localScale    = Vector3.one;
        PlayerWaitingView item = gobj.GetComponent <PlayerWaitingView>();

        item.SetData(player);
        return(item);
    }