示例#1
0
    public void Invite(string inviteeId, NetworkedClient client)
    {
        if (
            string.IsNullOrEmpty(this._name) ||
            !_joined.Contains((string)PhotonNetwork.player.CustomProperties["UniqueId"]) ||
            client.Channels.Contains(_name) ||
            (this._isInviteOnly && (this._leaderId != (string)PhotonNetwork.player.CustomProperties["UniqueId"]))
            )
        {
            Debug.LogError("There was a problem while sending the party invitation");
            return;
        }

        object[] partyInvitation = new object[] { client.UserName, inviteeId, UserStatusCode.PartyInvitationRequest };

        // Send invite to inviteeId, and update channel invitedIds lists
        client.chatClient.SendPrivateMessage(inviteeId, partyInvitation);

        client.Subscribe(_name);
        client.Channels.Add(_name);

        client.chatClient.PublishMessage(_name, partyInvitation);
    }