public void ActorMessage <TState>(StatefulActor <TState> actor, string message, params object[] args) where TState : class
 {
     try
     {
         if (this.IsEnabled())
         {
             string finalMessage = string.Format(message, args);
             this.ActorMessage(
                 actor.GetType().ToString(),
                 actor.Id.ToString(),
                 actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationTypeName,
                 actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationName,
                 actor.ActorService.ServiceInitializationParameters.ServiceTypeName,
                 actor.ActorService.ActorTypeInformation.ServiceName,
                 actor.ActorService.ServiceInitializationParameters.PartitionId,
                 actor.ActorService.ServiceInitializationParameters.ReplicaId,
                 FabricRuntime.GetNodeContext().NodeName,
                 finalMessage);
         }
     }
     catch
     {
         // We don't want a failure to trace to crash the process. We can improve this handling later.
     }
 }
コード例 #2
0
 public MoveToTargetPositionAction(GameObject toMove, StatefulActor charSelected, MovementStyle movementStyle, List <Vector2> positionsToMoveTo)
 {
     this.toMove            = toMove;
     this.charSelected      = charSelected;
     this.movementStyle     = movementStyle;
     this.positionsToMoveTo = positionsToMoveTo;
 }
コード例 #3
0
 public ShowMovementAvailableAction(MovementStyle movementStyle, Vector3 startPosition, StatefulActor charSelected, GameObject toMove, List <GridTile> tiles)
 {
     this.movementStyle = movementStyle;
     this.startPosition = startPosition;
     this.charSelected  = charSelected;
     this.toMove        = toMove;
     this.tiles         = tiles;
 }
コード例 #4
0
        object SetState(object instance)
        {
            StatefulActor <S> actor = instance as StatefulActor <S>;

            if (actor != null)
            {
                actor.GetType().InvokeMember("State", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetProperty, null, actor, new object[] { State });
            }
            return(instance);
        }
コード例 #5
0
 public void Message <TState>(StatefulActor <TState> actor, string message, params object[] args) where TState : class
 {
     if (this.IsEnabled())
     {
         string finalMessage = string.Format(message, args);
         this.ActorMessage(
             actor.GetType().ToString(),
             actor.Id.ToString(),
             actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationTypeName,
             actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationName,
             actor.ActorService.ServiceInitializationParameters.ServiceTypeName,
             actor.ActorService.ServiceInitializationParameters.ServiceName.ToString(),
             actor.ActorService.ServiceInitializationParameters.PartitionId,
             actor.ActorService.ServiceInitializationParameters.ReplicaId,
             finalMessage);
     }
 }
コード例 #6
0
        void MockEnvironment <I, S>(I callee, Action <I> callerMock, S state, params object[] mocks) where I : class
            where S : class, new()
        {
            try
            {
                IClientChannel channel = callee as IClientChannel;
                if ((state != null) && (channel == null) && (callee is IActor))
                {
                    StatefulActor <S> actor = callee as StatefulActor <S>;
                    actor.GetType().InvokeMember("State", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetProperty, null, actor, new object[] { state });
                }

                RegisterMocks(mocks);
                using (callee as IDisposable)
                {
                    callerMock(callee);
                }
                UnregisterMocks();
            }
            finally
            {
                IClientChannel channel = callee as IClientChannel;
                if (channel != null)
                {
                    if (channel.State != CommunicationState.Closed && channel.State != CommunicationState.Faulted)
                    {
                        try
                        {
                            channel.Close();
                        }
                        catch
                        {
                            channel.Abort();
                        }
                    }
                }
            }
        }
コード例 #7
0
 public void PrepareMovementForObject(GameObject toMove, StatefulActor charSelected, float timeToMove)
 {
     queuedToMove      = toMove;
     this.charSelected = charSelected;
     this.timeToMove   = timeToMove;
 }
コード例 #8
0
 public void CancelPreparedMovement()
 {
     queuedToMove = null;
     charSelected = null;
     timeToMove   = float.MinValue;
 }
コード例 #9
0
 public void ActorDeactivatedStop <T>(StatefulActor <T> a) where T : class
 {
     this.ActorActivatedStop(a.GetType().ToString(), a.Id.ToString(), a.ActorService.ServicePartition.PartitionInfo.Id);
 }