示例#1
0
        // 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));
        }
示例#2
0
        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());
            };
        }
示例#3
0
        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);
        }
示例#4
0
        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));
        }
示例#5
0
        private void NewFrame()
        {
            var frameTime = frameTimeMeasurer.MeasureTime();

            eventRoutingService.FireEvent <INewFrameEvent>(new NewFrameEvent(frameTime));
            // todo: remove
            renderLoopDispatcher.OnLoop(frameTime);
        }
示例#6
0
 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);
 }
示例#7
0
 public void SetMode(AppMode mode)
 {
     Mode = mode;
     eventRoutingService.FireEvent <IAppModeChangedEvent>(new AppModeChangedEvent(mode));
 }