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. } }
public MoveToTargetPositionAction(GameObject toMove, StatefulActor charSelected, MovementStyle movementStyle, List <Vector2> positionsToMoveTo) { this.toMove = toMove; this.charSelected = charSelected; this.movementStyle = movementStyle; this.positionsToMoveTo = positionsToMoveTo; }
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; }
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); }
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); } }
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(); } } } } }
public void PrepareMovementForObject(GameObject toMove, StatefulActor charSelected, float timeToMove) { queuedToMove = toMove; this.charSelected = charSelected; this.timeToMove = timeToMove; }
public void CancelPreparedMovement() { queuedToMove = null; charSelected = null; timeToMove = float.MinValue; }
public void ActorDeactivatedStop <T>(StatefulActor <T> a) where T : class { this.ActorActivatedStop(a.GetType().ToString(), a.Id.ToString(), a.ActorService.ServicePartition.PartitionInfo.Id); }