示例#1
0
        public bool TryHandleInput(IInputEvent args)
        {
            if (!(args is IKeyEvent kargs))
            {
                return(false);
            }
            if (kargs.ComplexEventType == KeyEventType.Down && kargs.EventKey == Key.Escape)
            {
                appModeService.SetMode(AppMode.Editing);
                return(true);
            }

            if (kargs.ComplexEventType == KeyEventType.Down && kargs.EventKey == Key.F)
            {
                var layoutInstance = storyService.RootLayoutInstance;
                var cameraProps    = mainLayer.Camera.GetProps();
                if (!hasFreeCamera)
                {
                    if (layoutInstance.AllowsFreeCamera)
                    {
                        mainLayer.Camera = layoutInstance.CreateFreeCamera(cameraProps);
                        hasFreeCamera    = true;
                        hasWarpCamera    = false;
                        return(true);
                    }
                }
                else
                {
                    var closestNode = layoutInstance.GetClosestNodeId(cameraProps);
                    navigationService.GoToSpecific(closestNode);
                    FocusOn(storyService.GlobalGraph.NodeObjects[closestNode].GetComponent <IFocusNodeComponent>());
                    hasFreeCamera = false;
                }
            }
            if (kargs.ComplexEventType == KeyEventType.Down && kargs.EventKey == Key.K)
            {
                var layoutInstance = storyService.RootLayoutInstance;
                var cameraProps    = mainLayer.Camera.GetProps();
                if (!hasWarpCamera)
                {
                    if (layoutInstance.AllowsFreeCamera)
                    {
                        mainLayer.Camera = layoutInstance.CreateWarpCamera(cameraProps);
                        hasWarpCamera    = true;
                        hasFreeCamera    = false;
                        return(true);
                    }
                }
                else
                {
                    var closestNode = layoutInstance.GetClosestNodeId(cameraProps);
                    navigationService.GoToSpecific(closestNode);
                    FocusOn(storyService.GlobalGraph.NodeObjects[closestNode].GetComponent <IFocusNodeComponent>());
                    hasWarpCamera = false;
                }
            }

            return(false);
        }
示例#2
0
 private void ExecStartPresentation(object sender, EventArgs eventArgs)
 {
     appModeService.SetMode(AppMode.Presentation);
 }