public override void OnRefresh()
 {
     if (!Available)
     {
         return;
     }
     OnReceive();
     peer.OnRefresh();
     if (awaitHandle.Count > 0)
     {
         UdpReceiveResult data;
         if (awaitHandle.TryDequeue(out data))
         {
             UdpNetworkMessage netMsg = Facade.SpawnReference <UdpNetworkMessage>();
             netMsg.CacheDecodeBuffer(data.Buffer);
             if (Conv == 0)
             {
                 Conv      = netMsg.Conv;
                 peer.Conv = Conv;
                 peer.AllocateConv(Conv);
             }
             if (netMsg.IsFull)
             {
                 peer.MessageHandler(netMsg);
             }
         }
     }
 }
Example #2
0
        /// <summary>
        /// 生成 Actor
        /// </summary>
        /// <param name="actorType">Actor枚举约束的类型;</param>
        /// <param name="actorID">系统分配的ID</param>
        /// <param name="owner">Actor的拥有者</param>
        /// <returns>生成后的Actor</returns>
        public static Actor <T> Create(byte actorType, int actorID, T owner)
        {
            Actor <T> actor = Facade.SpawnReference <Actor <T> >();

            actor.Owner     = owner;
            actor.ActorID   = actorID;
            actor.ActorType = actorType;
            return(actor);
        }