// todo: make DefaultSceneInitializer / WorldTreeService / AssetService react to events? public void New() { FileName = null; assetService.DeleteAll(); DefaultStateInitializer.InitializeAll(); eventRoutingService.FireEvent <ISaveLoadEvent>(new SaveLoadEvent(SaveLoadEventType.New, worldTreeService.World, assetService.Assets)); }
private void SetupLoop(IEventSender eventSender) { var renderLoopDispatcher = di.Get <IRenderLoopDispatcher>(); var inputProviders = di.GetMulti <IUcInputProvider>(); eventSender.OnGUIEvent += () => { foreach (var inputProvider in inputProviders) { inputProvider.OnGui(); } }; eventSender.UpdateEvent += () => { renderControl.OnUpdate(); foreach (var inputProvider in inputProviders) { inputProvider.OnUpdate(); } var frameTime = new FrameTime(Time.realtimeSinceStartup, Time.deltaTime); eventRoutingService.FireEvent <INewFrameEvent>(new NewFrameEvent(frameTime)); // todo: remove this renderLoopDispatcher.OnLoop(frameTime); }; eventSender.LateUpdateEvent += () => { var frameTime = new FrameTime(Time.realtimeSinceStartup, Time.deltaTime); eventRoutingService.FireEvent <ILateUpdateEvent>(new LateUpdateEvent(frameTime)); }; eventSender.FixedUpdateEvent += () => { eventRoutingService.FireEvent <IFixedUpdateEvent>(new FixedUpdateEvent()); }; }
public async Task <int?> QueryOptions(IReadOnlyList <string> options) { var query = new OptionsUserQuery(this, options); queries.Add(query); eventRoutingService.FireEvent <IUserQueryEvent>(new UserQueryEvent()); await coroutineService.WaitCondition(() => query.IsComplete); return(query.Result); }
private void FireEvent(NavigationEventType type, int id, bool causedByFocusing) { var moveInstantly = type == NavigationEventType.Reset || appMode.NavigationMode == AppNavigationMode.Vr || type == NavigationEventType.MoveToSpecific && sg.Aspects[id].InstantTransition; eventRoutingService.FireEvent <INavigationEvent>(new NavigationEvent(type, moveInstantly, causedByFocusing)); }
private void NewFrame() { var frameTime = frameTimeMeasurer.MeasureTime(); eventRoutingService.FireEvent <INewFrameEvent>(new NewFrameEvent(frameTime)); // todo: remove renderLoopDispatcher.OnLoop(frameTime); }
public void OnInputEvent(IInputEvent args) { if (args is IKeyEvent keyArgs) { CurrentKeyboardState = keyArgs.State; CurrentKeyModifiers = keyArgs.KeyModifiers; } else if (args is IMouseEvent margs && margs.IsOfType(MouseEventType.Down)) { FocusedViewport = args.Viewport; } eventRoutingService.FireEvent <IInteractionEvent>(args); }
public void SetMode(AppMode mode) { Mode = mode; eventRoutingService.FireEvent <IAppModeChangedEvent>(new AppModeChangedEvent(mode)); }