示例#1
0
    public async Task PopUpRoomInvite(string friendUID)
    {
        string userPath = "users/" + friendUID;

        DataSnapshot friendSnapshot = await FirebaseData.Instance.reference.Child(userPath).GetValueAsync();

        string friendName = friendSnapshot.Child("username").Value.ToString();

        PopUpWindow roomInvitePopup = PopUpsManager.Instance.GetPopUp("RoomInvitePopUp");

        TextMeshProUGUI friendUsernameText = roomInvitePopup.transform.Find("FriendUsernameText").GetComponent <TextMeshProUGUI>();

        friendUsernameText.text = friendName;

        roomInvitePopup.OpenPopUp();

        Button acceptButton = roomInvitePopup.FindButton("AcceptButton");

        if (joinFriendsLatestRoomListener != null)
        {
            roomInvitePopup.RemoveListener("AcceptButton", joinFriendsLatestRoomListener);
        }

        joinFriendsLatestRoomListener = async() => {
            await PhotonRooms.Instance.JoinFriendsLatestRoom(friendUID);
        };

        roomInvitePopup.AddListener("AcceptButton", joinFriendsLatestRoomListener);
    }