當前位置: 首頁>>代碼示例>>C#>>正文


C# MooNetClient.MapLocalObjectID方法代碼示例

本文整理匯總了C#中Mooege.Net.MooNet.MooNetClient.MapLocalObjectID方法的典型用法代碼示例。如果您正苦於以下問題:C# MooNetClient.MapLocalObjectID方法的具體用法?C# MooNetClient.MapLocalObjectID怎麽用?C# MooNetClient.MapLocalObjectID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mooege.Net.MooNet.MooNetClient的用法示例。


在下文中一共展示了MooNetClient.MapLocalObjectID方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddSubscriber

 /// <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(MooNetClient 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);
 }
開發者ID:wow4all,項目名稱:mooege,代碼行數:13,代碼來源:RPCObject.cs

示例2: Channel

        /// <summary>
        /// Creates a new channel for given client with supplied remote object-id.
        /// </summary>
        /// <param name="client">The client channels is created for</param>
        /// <param name="remoteObjectId">The remove object-id of the client.</param>
        public Channel(MooNetClient client, ulong remoteObjectId = 0)
        {
            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;

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

            // 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.
        }
開發者ID:wow4all,項目名稱:mooege,代碼行數:21,代碼來源:Channel.cs

示例3: AddSubscriber

        /// <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(MooNetClient client, ulong remoteObjectId)
        {
            // [D3Inferno]
            // Remove Subscribers that have been disconnected.
            // Apparently the RPCObject is not being cleaned up properly.
            // See the comment at the top for more info.
            // Conver to an Array so we can remove as we iterate.
            foreach (var subscriber in this.Subscribers.ToArray())
            {
                if (!subscriber.Connection.IsConnected)
                {
                    Logger.Warn("Removing disconnected subscriber {0}", subscriber);
                    this.Subscribers.Remove(subscriber);
                }
            }

            // 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
            foreach (var subscriber in this.Subscribers)
                this.NotifySubscriptionAdded(subscriber);
            //this.NotifySubscriptionAdded(client);
        }
開發者ID:professorylchen,項目名稱:mooege,代碼行數:29,代碼來源:RPCObject.cs

示例4: Join

 public void Join(MooNetClient client, ulong remoteObjectId)
 {
     client.MapLocalObjectID(this.DynamicId, remoteObjectId);
     this.AddMember(client);
 }
開發者ID:God601,項目名稱:mooege,代碼行數:5,代碼來源:Channel.cs


注:本文中的Mooege.Net.MooNet.MooNetClient.MapLocalObjectID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。