Esempio n. 1
0
 private void HandleSubscriptionRequests()
 {
     if (this.m_queuedSubscriptions.Count > 0)
     {
         long elapsedMilliseconds = this.m_stopWatch.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>();
         foreach (bnet.protocol.EntityId entityId in this.m_queuedSubscriptions)
         {
             if (this.m_presenceSubscriptionBalance - 1f < -100f)
             {
                 break;
             }
             PresenceAPI.PresenceRefCountObject presenceRefCountObject = this.m_presenceSubscriptions[entityId];
             SubscribeRequest subscribeRequest = new SubscribeRequest();
             subscribeRequest.SetObjectId(ChannelAPI.GetNextObjectId());
             subscribeRequest.SetEntityId(entityId);
             presenceRefCountObject.objectId = subscribeRequest.ObjectId;
             this.m_battleNet.Channel.AddActiveChannel(subscribeRequest.ObjectId, new ChannelAPI.ChannelReferenceObject(entityId, 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(entityId);
         }
         foreach (bnet.protocol.EntityId item in list)
         {
             this.m_queuedSubscriptions.Remove(item);
         }
     }
 }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
             }
         }
     }
 }