Exemplo n.º 1
0
    public static void SetActiveInvites(List <RoomManager.Invite> invites)
    {
        if (s_instance && s_instance.m_invitesList && s_instance.m_invitePrefab)
        {
            // first remove all existing Invites
            foreach (Transform child in s_instance.m_invitesList.transform)
            {
                Destroy(child.gameObject);
            }

            foreach (var invite in invites)
            {
                GameObject button = Instantiate(s_instance.m_invitePrefab) as GameObject;
                button.GetComponentInChildren <Text>().text = invite.OwnerID;
                button.name = invite.RoomID.ToString();
                button.GetComponent <Button>().onClick.AddListener(
                    () => PlatformManager.AnswerCallOnClick(invite.RoomID));
                button.transform.SetParent(s_instance.m_invitesList.transform, false);
            }
        }
    }