protected override void OnCreateManager(int capacity) { base.OnCreateManager(capacity); var worker = WorkerRegistry.GetWorkerForWorld(World); origin = worker.Origin; }
private bool IsRegisteredWorker() { if (!Context.Token.HasValue) { return(false); } return(WorkerRegistry.IsRegisteredWorker(Context.Token.Value)); }
public AcceptanceTest() { _registry = new WorkerRegistry(); MockDapper(); MockLogging(); MockMemoryCache(); }
public override void SetupTest() { base.SetupTest(); _mapper = AutoFixture.Freeze <Mock <IMappingEngine> >(); _mapper.DefaultValue = DefaultValue.Mock; _repository = AutoFixture.Freeze <Mock <IRepository> >(); _sut = AutoFixture.Create <WorkerRegistry>(); _mapper.Setup(s => s.Map <RegisterWorkerRequest, WorkerRegistration>(It.IsAny <RegisterWorkerRequest>())).Returns(AutoFixture.Create <WorkerRegistration>()); }
protected override void OnCreateManager(int capacity) { base.OnCreateManager(capacity); worker = WorkerRegistry.GetWorkerForWorld(World); view = worker.View; origin = worker.Origin; entityGameObjectCreator = new EntityGameObjectCreator(World); }
protected override void OnCreateManager(int capacity) { base.OnCreateManager(capacity); var worker = WorkerRegistry.GetWorkerForWorld(World); origin = worker.Origin; tickSystem = World.GetOrCreateManager <TickSystem>(); }
public void SetWorkerForWorld_sets_worker_for_world_twice() { using (var testWorker = new UnityTestWorker("someId", Vector3.zero)) { testWorker.RegisterSystems(); var exception = Assert.Throws <System.ArgumentException>(() => WorkerRegistry.SetWorkerForWorld(testWorker)); Assert.IsTrue(exception.Message.Contains("worker") && exception.Message.Contains("world")); } }
public void Setup() { _configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .Build(); var registry = new WorkerRegistry(); registry.AddSingleton(_configuration); _container = new Container(registry); }
protected override void OnCreateManager(int capacity) { base.OnCreateManager(capacity); var worker = WorkerRegistry.GetWorkerForWorld(World); view = worker.View; if (!(worker is UnityClient) && !(worker is UnityGameLogic)) { view.LogDispatcher.HandleLog(LogType.Error, new LogEvent(UnsupportedArchetype) .WithField(LoggingUtils.LoggerName, LoggerName) .WithField("WorldName", World.Name) .WithField("WorkerType", worker)); } workerType = worker.GetWorkerType; }
public Worker(F7Micro device) { // TODO: make this all configurable m_resultsStore = new ResultsStore(); Registry = Provider = new WorkerRegistry("/meadow0/test", device); Console.WriteLine(" Creating serial port..."); var port = device.CreateSerialPort( device.SerialPortNames.Com4, 9600, 8, Parity.None, StopBits.One); Serializer = new CommandJsonSerializer(JsonLibrary.SystemTextJson); Listener = new MeadowSerialListener(port, Serializer); Listener.CommandReceived += Listener_CommandReceived; }
public void Awake() { InitializeWorkerTypes(); // Taken from DefaultWorldInitalization.cs SetupInjectionHooks(); // Register hybrid injection hooks PlayerLoopManager.RegisterDomainUnload(DomainUnloadShutdown, 10000); // Clean up worlds and player loop Application.targetFrameRate = TargetFrameRate; if (Application.isEditor) { #if UNITY_EDITOR var workerConfigurations = AssetDatabase.LoadAssetAtPath <ScriptableWorkerConfiguration>(ScriptableWorkerConfiguration .AssetPath); foreach (var workerConfig in workerConfigurations.WorkerConfigurations) { if (!workerConfig.IsEnabled) { continue; } var worker = WorkerRegistry.CreateWorker(workerConfig.Type, $"{workerConfig.Type}-{Guid.NewGuid()}", workerConfig.Origin); Workers.Add(worker); } connectionConfig = new ReceptionistConfig(); connectionConfig.UseExternalIp = workerConfigurations.UseExternalIp; #endif } else { var commandLineArguments = System.Environment.GetCommandLineArgs(); Debug.LogFormat("Command line {0}", string.Join(" ", commandLineArguments.ToArray())); var commandLineArgs = CommandLineUtility.ParseCommandLineArgs(commandLineArguments); var workerType = CommandLineUtility.GetCommandLineValue(commandLineArgs, RuntimeConfigNames.WorkerType, string.Empty); var workerId = CommandLineUtility.GetCommandLineValue(commandLineArgs, RuntimeConfigNames.WorkerId, string.Empty); // because the launcher does not pass in the worker type as an argument var worker = workerType.Equals(string.Empty) ? WorkerRegistry.CreateWorker <UnityClient>( workerId: null, // The worker id for the UnityClient will be auto-generated. origin: new Vector3(0, 0, 0)) : WorkerRegistry.CreateWorker(workerType, workerId, new Vector3(0, 0, 0)); Workers.Add(worker); connectionConfig = ConnectionUtility.CreateConnectionConfigFromCommandLine(commandLineArgs); } if (World.AllWorlds.Count <= 0) { throw new InvalidConfigurationException( "No worlds have been created, due to invalid worker types being specified. Check the config in" + "Improbable -> Configure editor workers."); } var worlds = World.AllWorlds.ToArray(); ScriptBehaviourUpdateOrder.UpdatePlayerLoop(worlds); // Systems don't tick if World.Active isn't set World.Active = worlds[0]; }
public static void InitializeWorkerTypes() { WorkerRegistry.RegisterWorkerType <UnityClient>(); WorkerRegistry.RegisterWorkerType <UnityGameLogic>(); }
protected override void OnCreateManager(int capacity) { base.OnCreateManager(capacity); view = WorkerRegistry.GetWorkerForWorld(World).View; }
public void WorkerRegistryTest() { var r = new WorkerRegistry(null, null); var names = r.GetTestNames(); }