Exemple #1
0
        public void JoinChannel(EntityId channelId, ChannelAPI.ChannelType channelType)
        {
            JoinChannelRequest joinChannelRequest = new JoinChannelRequest();

            joinChannelRequest.SetChannelId(channelId);
            joinChannelRequest.SetObjectId(ChannelAPI.GetNextObjectId());
            ChannelAPI.ChannelData channelData = new ChannelAPI.ChannelData(this, channelId, 0uL, channelType);
            channelData.SetSubscriberObjectId(joinChannelRequest.ObjectId);
            this.m_rpcConnection.QueueRequest(this.m_channelOwnerService.Id, 3u, joinChannelRequest, new RPCContextDelegate(channelData.JoinChannelCallback), (uint)channelType);
        }
Exemple #2
0
        public void AcceptInvitation(ulong invitationId, EntityId channelId, ChannelAPI.ChannelType channelType, RPCContextDelegate callback = null)
        {
            AcceptInvitationRequest acceptInvitationRequest = new AcceptInvitationRequest();

            acceptInvitationRequest.SetInvitationId(invitationId);
            acceptInvitationRequest.SetObjectId(ChannelAPI.GetNextObjectId());
            ChannelAPI.ChannelData channelData = new ChannelAPI.ChannelData(this, channelId, 0uL, channelType);
            channelData.SetSubscriberObjectId(acceptInvitationRequest.ObjectId);
            this.m_rpcConnection.QueueRequest(ChannelAPI.m_channelInvitationService.Id, 4u, acceptInvitationRequest, delegate(RPCContext ctx)
            {
                channelData.AcceptInvitationCallback(ctx, callback);
            }, 0u);
        }
Exemple #3
0
 private void HandleSubscriptionRequests()
 {
     if (this.m_queuedSubscriptions.get_Count() > 0)
     {
         long elapsedMilliseconds = this.m_stopWatch.get_ElapsedMilliseconds();
         this.m_presenceSubscriptionBalance  = Math.Min(0f, this.m_presenceSubscriptionBalance + (float)(elapsedMilliseconds - this.m_lastPresenceSubscriptionSent) * 0.00333333341f);
         this.m_lastPresenceSubscriptionSent = elapsedMilliseconds;
         List <bnet.protocol.EntityId> list = new List <bnet.protocol.EntityId>();
         using (HashSet <bnet.protocol.EntityId> .Enumerator enumerator = this.m_queuedSubscriptions.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 bnet.protocol.EntityId current = enumerator.get_Current();
                 if (this.m_presenceSubscriptionBalance - 1f < -100f)
                 {
                     break;
                 }
                 PresenceAPI.PresenceRefCountObject presenceRefCountObject = this.m_presenceSubscriptions[current];
                 SubscribeRequest subscribeRequest = new SubscribeRequest();
                 subscribeRequest.SetObjectId(ChannelAPI.GetNextObjectId());
                 subscribeRequest.SetEntityId(current);
                 presenceRefCountObject.objectId = subscribeRequest.ObjectId;
                 this.m_battleNet.Channel.AddActiveChannel(subscribeRequest.ObjectId, new ChannelAPI.ChannelReferenceObject(current, ChannelAPI.ChannelType.PRESENCE_CHANNEL));
                 this.m_rpcConnection.QueueRequest(this.m_presenceService.Id, 1u, subscribeRequest, new RPCContextDelegate(this.PresenceSubscribeCallback), 0u);
                 this.m_presenceSubscriptionBalance -= 1f;
                 list.Add(current);
             }
         }
         using (List <bnet.protocol.EntityId> .Enumerator enumerator2 = list.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 bnet.protocol.EntityId current2 = enumerator2.get_Current();
                 this.m_queuedSubscriptions.Remove(current2);
             }
         }
     }
 }
Exemple #4
0
 public ChannelData(ChannelAPI channelAPI, EntityId entityId, ulong objectId, ChannelAPI.ChannelType channelType) : base(entityId, objectId, channelType)
 {
     this.m_channelState = new bnet.protocol.channel.ChannelState();
     this.m_members      = new Map <EntityId, Member>();
     this.m_channelAPI   = channelAPI;
 }