Пример #1
0
 /// <summary>
 /// Adds a client subscriber to object, which will eventually be notified whenever the object changes state.
 /// </summary>
 /// <param name="client">The client to add as a subscriber.</param>
 /// <param name="remoteObjectId">The client's dynamic ID.</param>
 public void AddSubscriber(BNetClient client, ulong remoteObjectId)
 {
     // Map the subscriber's dynamic ID to to our dynamic ID so we know how to translate later on when the object makes a notify call
     client.MapLocalObjectID(this.DynamicId, remoteObjectId);
     this.Subscribers.Add(client);
     // Since the client wasn't previously subscribed, it should not be aware of the object's state -- let's notify it
     this.NotifySubscriptionAdded(client);
 }
Пример #2
0
        public Channel(BNetClient client, ulong remoteObjectId)
        {
            this.BnetEntityId = bnet.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetLow(this.DynamicId).Build();
            this.D3EntityId = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetIdLow(this.DynamicId).Build();

            // This is an object creator, so we have to map the remote object ID
            client.MapLocalObjectID(this.DynamicId, remoteObjectId);
            
            var builder = bnet.protocol.channel.ChannelState.CreateBuilder()
                .SetPrivacyLevel(bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN_INVITATION)
                .SetMaxMembers(8)
                .SetMinMembers(1)
                .SetMaxInvitations(12);
            //.SetName("d3sharp test channel"); // NOTE: cap log doesn't set this optional field
            this.State = builder.Build();
        }
Пример #3
0
        public Channel(BNetClient client, ulong remoteObjectId)
        {
            this.BnetEntityId = bnet.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetLow(this.DynamicId).Build();
            this.D3EntityId = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetIdLow(this.DynamicId).Build();
            this.PrivacyLevel = bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN_INVITATION;
            this.MinMembers = 1;
            this.MaxMembers = 8;
            this.MaxInvitations = 12;

            // This is an object creator, so we have to map the remote object ID
            client.MapLocalObjectID(this.DynamicId, remoteObjectId);

            // The client can't be set as the owner (or added as a member) here because the server must first make a response
            // to the client before using a mapped ID (presuming that this was called from a service).
            // We'll just let the caller do that for us.
        }
Пример #4
0
 public void AddSubscriber(BNetClient client, ulong remoteObjectId)
 {
     client.MapLocalObjectID(this.LocalObjectId, remoteObjectId);
     this.Subscribers.Add(client);
     this.NotifySubscriber(client);
 }
Пример #5
0
 /// <summary>
 /// Adds a client subscriber to object, which will eventually be notified on any object updates.
 /// </summary>
 /// <param name="client">The observer.</param>
 /// <param name="remoteObjectId">The mapped remoteId</param>
 public void AddSubscriber(BNetClient client, ulong remoteObjectId)
 {
     client.MapLocalObjectID(this.DynamicId, remoteObjectId); // map observer's Id to to our dynamic Id so any further rpc-conversation over object, can benefit it.
     this.Subscribers.Add(client); // add client to subscribers list.
     this.NotifySubscriber(client); // when we add a new subscriber, he should get an initial notification on objects present state.
 }