private OperationResponse ItemOperationAttachInterestArea(
            Item item, AttachInterestArea operation, InterestArea interestArea, SendParameters sendParameters)
        {
            if (item.Disposed)
            {
                return(operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound"));
            }

            lock (interestArea.SyncRoot)
            {
                interestArea.Detach();
                interestArea.AttachToItem(item);
                interestArea.UpdateInterestManagement();
            }

            // use item channel to ensure that this event arrives before any move or subscribe events
            OperationResponse response = operation.GetOperationResponse(MethodReturnValue.Ok);

            sendParameters.ChannelId = Settings.ItemEventChannel;
            this.Peer.SendOperationResponse(response, sendParameters);

            operation.OnComplete();
            return(null);
        }
        private static OperationResponse ItemOperationAddInterestArea(Item item, AddInterestArea operation, InterestArea interestArea)
        {
            if (item.Disposed)
            {
                return(operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound"));
            }

            lock (interestArea.SyncRoot)
            {
                interestArea.AttachToItem(item);
                interestArea.ViewDistanceEnter = operation.ViewDistanceEnter;
                interestArea.ViewDistanceExit  = operation.ViewDistanceExit;
                interestArea.UpdateInterestManagement();
            }

            operation.OnComplete();
            return(operation.GetOperationResponse(MethodReturnValue.Ok));
        }
 public MmoActorOperationHandler(PeerBase peer, World world, InterestArea interestArea)
     : base(peer, world)
 {
     this.AddInterestArea(interestArea);
 }
Example #4
0
 public RequestItemExitMessage(InterestArea interestArea)
 {
     this.InterestArea = interestArea;
 }
Example #5
0
 public bool TryGetInterestArea(byte interestAreaId, out InterestArea interestArea)
 {
     return(this.interestAreas.TryGetValue(interestAreaId, out interestArea));
 }
Example #6
0
 public void AddInterestArea(InterestArea interestArea)
 {
     this.interestAreas.Add(interestArea.Id, interestArea);
 }
Example #7
0
 public void AddInterestArea(InterestArea interestArea)
 {
     log.InfoFormat("interest area add");
     this.interestAreas.Add(interestArea.Id, interestArea);
 }