public Fixture(IServiceProvider services = null) { var proxifier = new Func <AbstractKey, IGrain>( key => (IGrain)GrainProxy.Proxify(this, key)); //just needs dispatcher and serializer Exceptions = new ExceptionSink(); Scheduler = new FixtureScheduler(Exceptions); Serializer = new FakeSerializer(proxifier); Types = new TypeMap(); GrainFactory = new FakeGrainFactory(Types, proxifier); Requests = new RequestRunner(Scheduler, Exceptions); Services = new ServiceRegistry(services); Stores = new StorageRegistry(Serializer); Providers = new ProviderRegistry(() => new ProviderRuntimeAdaptor(GrainFactory, Services, null)); Reminders = new ReminderRegistry(this); Placer = new Placer(Types.GetConcreteType); Activations = null; var activationHub = new ActivationHub(place => { var actSite = new ActivationSite(p => new Activation_New(this, p).Dispatcher); //!!! actSite.Init(place); return(actSite); }); Placer = new Placer(Types.GetConcreteType); Dispatcher = new Dispatcher(Placer.Place, activationHub); Streams = new StreamRegistry(activationHub, Exceptions, Types); }
public static void StopPlacing(IPlacer obj) { canceled = true; Instance.GridHighlighter.SetActive(false); Instance.CurrentlyPlacing.Value = false; Callback.Trigger(false); Instance.Placer?.CancelPlacement(); Instance.Placer = null; }
public void SetUp() { _keys = Enumerable.Range(0, 100) .Select(i => new AbstractKey(_normGrainTypes[i % _normGrainTypes.Length], Guid.NewGuid())) .ToArray(); var typeMapper = Substitute.For <Func <Type, Type> >(); typeMapper(Arg.Any <Type>()).Returns(c => c.Arg <Type>()); //no mapping - just pass input back out _placer = new Placer(typeMapper); }
public static void StartPlacing(IPlacer obj, Action <bool> cancelCallback = null) { canceled = false; Instance.Placer?.CancelPlacement(); Instance.GridHighlighter.SetActive(true); Instance.CurrentlyPlacing.Value = true; Callback = cancelCallback; Instance.Placer = obj; var wp = Instance.Camera.Reference.ScreenPointToRay(Instance.MousePosition.Value).GetPosOnY(); var gp = wp.GetGridPosition(); Instance.Placer.StartPlacing(Instance.Player.Reference, gp, wp); }
private void PlaceWorldObject(GridBlock block) { if (block == null || canceled) { return; } if (block.HasWorldObject || block.TileType == TileType.Wall) { return; } Instance.GridHighlighter.SetActive(false); Instance.CurrentlyPlacing.Value = false; Placer.ApplyPlacement(Player.Reference, block, Camera.Reference.ScreenPointToRay(MousePosition.Value).GetPosOnY()); Placer.OnApplyPlacement.Trigger(); Callback.Trigger(true); if (RemovePlacingOnPlace.Value) { Placer = null; } }
public EdgePlacer(IPlacer placer) { _placer = placer; }