Exemplo n.º 1
0
        /// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor    = this.DataContext as ProjectEditor;
            _containerControl = this.Find <ContainerViewControl>("containerControl");
            _zoomBorder       = this.Find <ZoomBorder>("zoomBorder");

            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate  = () => _containerControl.InvalidateVisual();
                _projectEditor.ResetZoom   = () => _zoomBorder.Reset();
                _projectEditor.AutoFitZoom = () => _zoomBorder.AutoFit();
                _projectEditor.LoadLayout  = () => { };
                _projectEditor.SaveLayout  = () => { };
                _projectEditor.ResetLayout = () => { };

                _zoomBorder.InvalidatedChild = InvalidateChild;

                _inputProcessor = new InputProcessor(
                    new AvaloniaInputSource(
                        _zoomBorder,
                        _containerControl,
                        _zoomBorder.FixInvalidPointPosition),
                    _projectEditor);
            }
        }
Exemplo n.º 2
0
        private void HandleInput(InputProcessor ip)
        {
            int scrollAmount = 20;

            //scroll down
            if (ip.currentScrollWheel < ip.previousScrollWheel)
            {
                if (!(tileButtons[tileButtons.Count - 1].rect.Bottom < (960 - 20)))
                {
                    foreach (Button b in tileButtons)
                    {
                        b.ChangeRect(new Rectangle(b.rect.X, b.rect.Y - scrollAmount, b.rect.Width, b.rect.Height));
                    }
                }
            }
            //scroll up
            else if (ip.currentScrollWheel > ip.previousScrollWheel)
            {
                if (!(tileButtons[0].rect.Top > 20))
                {
                    foreach (Button b in tileButtons)
                    {
                        b.ChangeRect(new Rectangle(b.rect.X, b.rect.Y + scrollAmount, b.rect.Width, b.rect.Height));
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void GivenUserInputShouldReturnFormattedGuess(IEnumerable <string> userInput, IEnumerable <Colours> expected)
        {
            var inputProcessor = new InputProcessor();
            var actual         = inputProcessor.ProcessInput(userInput);

            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
        private static int Main(string[] args)
        {
            var inputParam = DummyValue();

            if (args.Length != 0)
            {
                inputParam = args[0];
            }

            var inputCommandProcessor = new InputProcessor();

            if (!inputCommandProcessor.TryReadInput(inputParam, out IWorld world, out IEnumerable <IRobot> robots))
            {
                return(1);
            }

            var robotAutomaton = new RobotAutomaton(world, new ConsoleWorldRenderer());

            robotAutomaton.StartImitation(robots);

            var output = new OutputProcessor();

            Console.WriteLine(output.GetReports(robots));
            Console.ReadKey();

            return(0);
        }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        // Find a Kinect sensor
        KinectSensorCollection kinectSensors = KinectSensor.KinectSensors;

        if (kinectSensors.Count == 0)
        {
            this.sensor = null;
            throw new UnityException("Could not find a Kinect sensor.");
        }

        // Enable the skeleton stream
        this.sensor = kinectSensors[0];
        this.sensor.SkeletonStream.Enable();
        if (!this.sensor.SkeletonStream.IsEnabled)
        {
            throw new UnityException("Sensor could not be enabled.");
        }

        // Create the input processor
        inputProcessor = new InputProcessor(this.sensor.CoordinateMapper, DepthImageFormat.Resolution320x240Fps30);
        this.InputInfo = inputProcessor.GameInputInfo;

        Debug.Log("Hello");
        return;
    }
Exemplo n.º 6
0
        public void Attach()
        {
            if (!(_control.DataContext is IProjectEditor projectEditor))
            {
                return;
            }

            var presenterControlData     = _control.Find <Control>("presenterControlData");
            var presenterControlTemplate = _control.Find <Control>("presenterControlTemplate");
            var presenterControlEditor   = _control.Find <Control>("presenterControlEditor");
            var zoomBorder = _control.Find <ZoomBorder>("zoomBorder");

            if (projectEditor.CanvasPlatform is IEditorCanvasPlatform canvasPlatform)
            {
                canvasPlatform.Invalidate = () =>
                {
                    presenterControlData?.InvalidateVisual();
                    presenterControlTemplate?.InvalidateVisual();
                    presenterControlEditor?.InvalidateVisual();
                };
                canvasPlatform.ResetZoom   = () => zoomBorder?.Reset();
                canvasPlatform.AutoFitZoom = () => zoomBorder?.AutoFit();
                canvasPlatform.Zoom        = zoomBorder;
            }

            if (zoomBorder != null)
            {
                zoomBorder.InvalidatedChild = InvalidateChild;
            }

            _inputSource    = new AvaloniaInputSource(zoomBorder, presenterControlEditor, p => p);
            _inputTarget    = new ProjectEditorInputTarget(projectEditor);
            _inputProcessor = new InputProcessor();
            _inputProcessor.Connect(_inputSource, _inputTarget);
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            InputProcessor processor = new InputProcessor();

            while (true)
            {
                Console.WriteLine("Enter one of the following options:");
                Console.WriteLine("1) Insert a new vehicle");
                Console.WriteLine("2) Edit an existing vehicle");
                Console.WriteLine("3) Delete an existing vehicle");
                Console.WriteLine("4) List all vehicles");
                Console.WriteLine("5) Find a vehicle by chassisID");
                Console.WriteLine("6) Exit");

                string input = Console.ReadLine();

                int  result  = 0;
                bool success = Int32.TryParse(input, out result);

                if (!success)
                {
                    Console.WriteLine("Invalid input");
                }
                else if (result == 6)
                {
                    break;
                }
                else
                {
                    processor.ProcessInput(result);
                }
            }
        }
Exemplo n.º 8
0
        public void ValidateDataTypeForCommandInput()
        {
            List <String> str = InputProcessor.BuildInputList();

            Assert.AreEqual(str.GetType(), typeof(List <String>));
            Assert.False(typeof(int) == typeof(List <String>));
        }
Exemplo n.º 9
0
        public override void Activate()
        {
            SafeAreaOuterLimits = new Rectangle(0, 0, Definitions.IsWideScreen ? Wide_Buffer_Width : Standard_Buffer_Width, Buffer_Height);

            _raceStarted = false;
            _levelData   = new Data.RaceLevelData();

            RaceAreaName = NextSceneParameters.Get <string>(Race.RaceGameplayScene.Course_Area_Parameter);

            base.Activate();

            ((PlayerMotionEngine)_player.MotionEngine).DifficultySpeedBoosterUnit = NextSceneParameters.Get <int>(Race.RaceGameplayScene.Course_Speed_Parameter);

            _player.ClearSkin();
            _player.SkinBones(AvatarComponentManager.SideFacingAvatarSkin(PlayerSkinSlotIndex));
            _player.CustomSkinSlotIndex = PlayerSkinSlotIndex;

            if (InputProcessor != null)
            {
                ((PlayerMotionEngine)_player.MotionEngine).InputProcessor = InputProcessor;
                InputProcessor.AddButtonArea(PowerUpButton.In_Game_Button_Name, _powerUpButton.Center, _powerUpButton.Radius, false);
            }

            SetCoordinatorsForRace();
            SetUpOpponentAttackEffects();

            ReadyToRace = false;
            Paused      = false;
        }
Exemplo n.º 10
0
        public override void OnInit()
        {
            base.OnInit();

            InputProcessor.UpdateActionBinding("Left", Key.D, Key.Left);
            InputProcessor.UpdateActionBinding("Right", Key.A, Key.Right);
            InputProcessor.UpdateActionBinding("Up", Key.W, Key.Up);
            InputProcessor.UpdateActionBinding("Down", Key.S, Key.Down);

            ResourcePtr Font = new ResourcePtr("font:Fonts/Work_Sans/WorkSans-Regular.ttf");

            Text = new Text("Hello World", Font.Get <Font>());
            Text.CharacterSize = 24;
            Text.FillColor     = Color.Red;


            World newWorld = LoadWorld(World.Get <WorldScript>());

            var actor = newWorld.CreateActor <Actor>(TestActor.Get <ActorScript>());

            actor.Location = new Vector3(100, 100, 0);

            Actor secondACtor = newWorld.CreateActor <Actor>(SecondActor.Get <ActorScript>());

            secondACtor.Location = new Vector3(500, 100, 0);
        }
Exemplo n.º 11
0
    public void close(bool byInputProcessor)
    {
        hideItemInfo();
        //		perksView.hideInfo();
        perksView.gameObject.SetActive(false);
        inventory.gameObject.SetActive(false);
        playerData.gameObject.SetActive(false);
        shipData.gameObject.SetActive(false);
        gameObject.SetActive(false);

        if (onPlanetSurface)
        {
            PlanetSurface.topHideable.setVisible(true);
        }
        else
        {
            StarSystem.setGamePause(false);
        }

        UserInterface.showInterface = true;
        itemDescriptor.setDisabled();

        if (!byInputProcessor)
        {
            InputProcessor.removeLast();
        }
    }
Exemplo n.º 12
0
    private void Update_Hold()
    {
        for (var i = 0; i < holdActions.Length; i++)
        {
            var action = holdActions[i];
            switch (action.GetDCLAction())
            {
            case DCLAction_Hold.Sprint:
                InputProcessor.FromKey(action, KeyCode.LeftShift, InputProcessor.Modifier.NeedsPointerLocked);
                break;

            case DCLAction_Hold.Jump:
                InputProcessor.FromKey(action, KeyCode.Space, InputProcessor.Modifier.NeedsPointerLocked);
                break;

            case DCLAction_Hold.FreeCameraMode:
                //Disable until the fine-tuning is ready
                if (ENABLE_THIRD_PERSON_CAMERA)
                {
                    InputProcessor.FromKey(action, KeyCode.T, InputProcessor.Modifier.NeedsPointerLocked);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
    }
Exemplo n.º 13
0
        public void GetUniqueBytes_ValidInput_Binary()
        {
            //Arrange
            byte[] buffer = new[] { Convert.ToByte(0x1f),
                                    Convert.ToByte(0x1a),
                                    Convert.ToByte(0x5f),
                                    Convert.ToByte(0x40) };
            var stream = new MemoryStream(buffer);

            //Act
            var processor = new InputProcessor(stream);
            var dict      = processor.GetUniqueBytes();

            //Assert
            Assert.AreEqual(dict.Count, 4);

            foreach (var b in dict)
            {
                Assert.AreEqual(b.Value, 1);
            }

            Assert.IsTrue(dict.ContainsKey(Convert.ToByte(0x1f)));
            Assert.IsTrue(dict.ContainsKey(Convert.ToByte(0x1a)));
            Assert.IsTrue(dict.ContainsKey(Convert.ToByte(0x5f)));
            Assert.IsTrue(dict.ContainsKey(Convert.ToByte(0x40)));
        }
Exemplo n.º 14
0
        public void Detach()
        {
            if (!(_control.DataContext is IProjectEditor projectEditor))
            {
                return;
            }

            var zoomBorder = _control.Find <ZoomBorder>("zoomBorder");

            if (projectEditor.CanvasPlatform is IEditorCanvasPlatform canvasPlatform)
            {
                canvasPlatform.Invalidate  = null;
                canvasPlatform.ResetZoom   = null;
                canvasPlatform.AutoFitZoom = null;
                canvasPlatform.Zoom        = null;
            }

            if (zoomBorder != null)
            {
                zoomBorder.InvalidatedChild = null;
            }

            _inputProcessor?.Dispose();
            _inputProcessor = null;
            _inputTarget    = null;
            _inputSource    = null;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Detach project editor from container control.
        /// </summary>
        public void DetachEditor()
        {
            if (_projectEditor != null)
            {
                _projectEditor.CanvasPlatform.Invalidate  = null;
                _projectEditor.CanvasPlatform.ResetZoom   = null;
                _projectEditor.CanvasPlatform.AutoFitZoom = null;

                _projectEditor.LayoutPlatform.LoadLayout  = null;
                _projectEditor.LayoutPlatform.SaveLayout  = null;
                _projectEditor.LayoutPlatform.ResetLayout = null;

                zoomBorder.InvalidatedChild = null;

                _inputProcessor.Dispose();
                _inputProcessor = null;
                _inputSource    = null;

                zoomBorder.AllowDrop  = false;
                zoomBorder.DragEnter -= ZoomBorder_DragEnter;
                zoomBorder.Drop      -= ZoomBorder_Drop;
            }

            _projectEditor = null;
        }
Exemplo n.º 16
0
        public void TestMethodProcess(int scheduleIndex, int bookingIndex, string expected)
        {
            Schedule[] actual;

            String[] Inputs = new string[] { "0900 1730"
                                             , "2011-03-17 10:17:06"
                                             , "EMP001"
                                             , "2011-03-21 09:00 2"
                                             , "2011-03-16 12:34:56"
                                             , "EMP002"
                                             , "2011-03-21 09:00 2"
                                             , "2011-03-16 09:28:23"
                                             , "EMP003"
                                             , "2011-03-22 14:00 2"
                                             , "2011-03-17 11:23:45"
                                             , "EMP004"
                                             , "2011-03-22 16:00 1"
                                             , "2011-03-15 17:29:12"
                                             , "EMP005"
                                             , "2011-03-21 16:00 3" };

            actual = InputProcessor.Process(Inputs);

            Schedule Schedule = actual[scheduleIndex];
            Booking  Booking  = Schedule.Bookings[bookingIndex];

            Assert.That(Converter.GetDateFormat(Schedule.Date) + " " + Converter.GetTimeFormat(Booking.StartTime) +
                        " " + Converter.GetTimeFormat(Booking.EndTime) + " " + Booking.Employee.ID
                        , Is.EqualTo(expected));
        }
Exemplo n.º 17
0
        public void Process_WithValidArguments_DoesNotSetException()
        {
            var args    = new[] { "/colour:FFFFFF" };
            var subject = InputProcessor.GetArgs(args);

            Assert.IsNull(subject.Exception);
        }
Exemplo n.º 18
0
        protected Game(string title)
        {
            Properties.Reload();

            glfwInit();
            glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
            glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4);
            glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

            IntPtr address = glfwCreateWindow(Resolution.WindowWidth, Resolution.WindowHeight, title, IntPtr.Zero,
                                              IntPtr.Zero);

            if (address == IntPtr.Zero)
            {
                glfwTerminate();

                return;
            }

            window         = new Window(title, 800, 600, address);
            inputProcessor = new InputProcessor();

            glfwMakeContextCurrent(address);
            glfwSetKeyCallback(address, keyCallback);
            glfwSetCursorPosCallback(address, cursorPositionCallback);
            glfwSetMouseButtonCallback(address, mouseButtonCallback);

            MessageSystem.Subscribe(this, CoreMessageTypes.Exit, (messageType, data, dt) =>
            {
                OnExit();
            });
        }
Exemplo n.º 19
0
        protected override void CreateWindow_Internal()
        {
            TickFunction WindowTick = new TickFunction
            {
                TickFunc     = (DeltaTime) => { Window.DispatchEvents(); },
                TickPriority = TickFunction.HighPriority,
                CanTick      = true,
            };

            IEngine.Instance.GameThreadTickManager.AddTick(WindowTick);


            Window         = new RenderWindow(new VideoMode((uint)ScreenSize.X, (uint)ScreenSize.Y), IEngine.Instance.Name);
            Window.Closed += (s, e) => IEngine.Instance.Shutdown();

            Window.Resized += Window_Resized;

            Window.KeyPressed  += KeyboardInput.Window_KeyPressed;
            Window.KeyReleased += KeyboardInput.Window_KeyReleased;

            Window.MouseButtonPressed  += MouseInput.Window_KeyPressed;
            Window.MouseButtonReleased += MouseInput.Window_KeyReleased;

            Window.MouseWheelScrolled += MouseInput.Window_MouseWheelScrolled;

            Window.SetKeyRepeatEnabled(false);

            InputProcessor.RegisterInputSource(KeyboardInput);
            InputProcessor.RegisterInputSource(MouseInput);

            ClearScreenCommand = CreateRenderCommand()
                                 .WithClearColor(System.Drawing.Color.CornflowerBlue);
        }
Exemplo n.º 20
0
    private void Update_Measurable()
    {
        for (var i = 0; i < measurableActions.Length; i++)
        {
            var action = measurableActions[i];
            switch (action.GetDCLAction())
            {
            case DCLAction_Measurable.CharacterXAxis:
                InputProcessor.FromAxis(action, "Horizontal", InputProcessor.Modifier.NeedsPointerLocked);
                break;

            case DCLAction_Measurable.CharacterYAxis:
                InputProcessor.FromAxis(action, "Vertical", InputProcessor.Modifier.NeedsPointerLocked);
                break;

            case DCLAction_Measurable.CameraXAxis:
                InputProcessor.FromAxis(action, "Mouse X", InputProcessor.Modifier.NeedsPointerLocked);
                break;

            case DCLAction_Measurable.CameraYAxis:
                InputProcessor.FromAxis(action, "Mouse Y", InputProcessor.Modifier.NeedsPointerLocked);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
    }
Exemplo n.º 21
0
        public void Process_WithNoParametersButFileFound_DoesNotSetException()
        {
            var args    = new[] { "" };
            var subject = InputProcessor.GetArgsFromFile(args);

            Assert.IsNull(subject.Exception);
        }
Exemplo n.º 22
0
        public void Process_WithInvalidFile_SetsException()
        {
            var args    = new[] { "/config:blah.config" };
            var subject = InputProcessor.GetArgsFromFile(args);

            Assert.IsNotNull(subject.Exception);
        }
Exemplo n.º 23
0
        public Entity BindToNewEntity(UnityModel model)
        {
            var entity = new Entity(model.transform.position, 0.1f);

            if (model.gameObject.tag == "Player")
            {
                inputProcessor = new InputProcessor(
                    this,
                    camera,
                    entity,
                    interactables,
                    entityConfig);
                player = entity;
            }
            //else
            //{
            //    entity.Add(new MoveToDestination(entity, new Vector3(35.13f, 1.13f, -31.63f)));
            //}
            entities.Add(entity);
            models.Add(model);
            Debug.Log(
                "Registered pre-existing entity '"
                + model.gameObject.name
                + "'"
                + " at location "
                + entity.Location);
            return(entity);
        }
Exemplo n.º 24
0
        public void GetUniqueBytes_ValidInput_AllChars()
        {
            //Arrange
            string s      = "aabbccddee";
            var    stream = new MemoryStream();
            var    writer = new StreamWriter(stream);

            writer.Write(s);
            writer.Flush();
            stream.Position = 0;
            var processor = new InputProcessor(stream);

            //Act
            var dict = processor.GetUniqueBytes();

            //Assert
            Assert.AreEqual(dict.Count, 5);

            foreach (var b in dict)
            {
                Assert.AreEqual(b.Value, 2);
            }

            Assert.IsTrue(dict.ContainsKey((byte)'a'));
            Assert.IsTrue(dict.ContainsKey((byte)'b'));
            Assert.IsTrue(dict.ContainsKey((byte)'c'));
            Assert.IsTrue(dict.ContainsKey((byte)'d'));
            Assert.IsTrue(dict.ContainsKey((byte)'e'));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor = DataContext as ProjectEditor;

            if (_projectEditor != null)
            {
                _projectEditor.CanvasPlatform.Invalidate  = () => { };
                _projectEditor.CanvasPlatform.ResetZoom   = () => zoomBorder.Reset();
                _projectEditor.CanvasPlatform.AutoFitZoom = () => zoomBorder.AutoFit();

                _projectEditor.LayoutPlatform.LoadLayout  = () => OnLoadLayout();
                _projectEditor.LayoutPlatform.SaveLayout  = () => OnSaveLayout();
                _projectEditor.LayoutPlatform.ResetLayout = () => OnResetLayout();

                zoomBorder.InvalidatedChild = InvalidateChild;

                _inputProcessor = new InputProcessor(
                    new WpfInputSource(
                        zoomBorder,
                        drawableControl,
                        (point) => point),
                    _projectEditor);

                zoomBorder.AllowDrop  = true;
                zoomBorder.DragEnter += ZoomBorder_DragEnter;
                zoomBorder.Drop      += ZoomBorder_Drop;
            }
        }
Exemplo n.º 26
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the toy robot simulator!");
            Console.WriteLine($"To get started, please place the robot on the {BoardWidth}x{BoardHeight} board using PLACE x-positon,y-position,direction.");
            Console.WriteLine($"Please use the HELP option at any time to see the valid inputs or EXIT to close the application.");
            Console.WriteLine();

            Board          board          = new Board(BoardWidth, BoardHeight);
            Robot          robot          = null;
            InputProcessor inputProcessor = new InputProcessor(robot, board);

            bool exitApplication = false;

            while (!exitApplication)
            {
                var userInput = Console.ReadLine().Trim();

                var output = inputProcessor.ProcessInput(userInput);

                if (!string.IsNullOrWhiteSpace(output))
                {
                    if (output == ValidInputs.Exit)
                    {
                        exitApplication = true;
                    }

                    Console.WriteLine(output);
                }
            }
        }
Exemplo n.º 27
0
        public void Process_WithInvalidArguments_ReturnsException()
        {
            var args    = new[] { "" };
            var subject = InputProcessor.GetArgs(args);

            Assert.IsNotNull(subject.Exception);
        }
Exemplo n.º 28
0
        public void CreateOutputTest()
        {
            List <string> Outputs = new List <string> {
            };
            List <Track> Tracks   = new List <Track> {
            };
            int NumberOfTracks    = 2;

            InputProcessor inputProcessor = new InputProcessor(Inputs, NumberOfTracks);

            Tracks = inputProcessor.Process();
            OutputProcessor outputProcessor = new OutputProcessor(Tracks);

            Outputs = outputProcessor.Process();

            bool expected = true;
            bool actual;

            actual = Outputs.Any(x => x.Contains("Track 1:"));
            Assert.AreEqual(expected, actual);

            actual = Outputs.Count(x => x.Contains("12:00PM Lunch")) == 2;
            Assert.AreEqual(expected, actual);

            actual = Outputs.Any(x => x.Contains("Track 2:"));
            Assert.AreEqual(expected, actual);

            actual = Outputs.Count(x => x.Contains("Networking Event")) == 2;
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 29
0
        public void Process_WithValidFile_DoesNotSetException()
        {
            var args    = new[] { "/config:hammer.config" };
            var subject = InputProcessor.GetArgsFromFile(args);

            Assert.IsNull(subject.Exception);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Detach project editor from container control.
        /// </summary>
        public void DetachEditor()
        {
            if (DataContext is IProjectEditor projectEditor)
            {
                if (!_isLoaded)
                {
                    return;
                }

                if (projectEditor.CanvasPlatform is IEditorCanvasPlatform canvasPlatform)
                {
                    canvasPlatform.Invalidate  = null;
                    canvasPlatform.ResetZoom   = null;
                    canvasPlatform.AutoFitZoom = null;
                    canvasPlatform.Zoom        = null;
                }

                if (_zoomBorder != null)
                {
                    _zoomBorder.InvalidatedChild = null;
                }

                _inputProcessor.Dispose();
                _inputTarget    = null;
                _inputProcessor = null;
                _inputSource    = null;

                _isLoaded = false;
            }
        }
Exemplo n.º 31
0
        public InputManager(Game game, IViewManager viewManager, PhysicsManager physics)
		{
            this._game = game;
            this._viewManager = viewManager;
            this._physics = physics;
            //_inputProcessor = new DefaultProcessor(game, viewManager, physics);
            _inputProcessor = new ImprovedProcessor(game, viewManager, physics);
		}
Exemplo n.º 32
0
        public InputSurfaceWindow()
        {
            InitializeComponent();

            _proc = new InputProcessor(this, this);
            _proc.PointerDown += ProcPointerDown;
            _proc.PointerMove += ProcPointerMove;
            _proc.PointerUp += ProcPointerUp;
        }
Exemplo n.º 33
0
    // Use this for initialization
    void Start()
    {
        // Find a Kinect sensor
        KinectSensorCollection kinectSensors = KinectSensor.KinectSensors;
        if(kinectSensors.Count == 0)
        {
            this.sensor = null;
            throw new UnityException("Could not find a Kinect sensor.");
        }

        // Enable the skeleton stream
        this.sensor = kinectSensors[0];
        this.sensor.SkeletonStream.Enable();
        if(!this.sensor.SkeletonStream.IsEnabled)
            throw new UnityException("Sensor could not be enabled.");

        // Create the input processor
        inputProcessor = new InputProcessor(this.sensor.CoordinateMapper, DepthImageFormat.Resolution320x240Fps30);
        this.InputInfo = inputProcessor.GameInputInfo;
        this.seatedInputProcessor = new SeatedInfoProcessor ();

        Debug.Log("Hello");
        return;
    }
Exemplo n.º 34
0
    void HandleActionTrigger()
    {
        string actionName = null;

        if (enableLeftAction && leftActionView.hasTriggered) {
          ResetHorizontalSwipe();
          actionName = leftActionView.actionName;
        }

        if (enableRightAction && rightActionView.hasTriggered) {
          ResetHorizontalSwipe();
          actionName = rightActionView.actionName;
        }

        if (actionName != null) {
          triggeredThisSession = true;
          if (playerEvent == null) {
        return;
          }

          var inputProcessor = new InputProcessor(sim);

          if (playerEvent.hasActions) {
        inputProcessor.TriggerAction(playerEvent, actionName);
          }

          if (playerEvent.hasChoices) {
        inputProcessor.TriggerChoice(playerEvent, actionName);
          }
        }
    }
Exemplo n.º 35
0
 public ClearScreenCommand(InputProcessor processor)
 {
     this.processor = processor;
 }
Exemplo n.º 36
0
    void DetectVisibleTrigger()
    {
        if (hasTriggered) {
          return;
        } else {

          if (playerEvent == null || playerEvent.Triggers.Count < 1) {
        hasTriggered = true;
        return;
          }
        }

        Vector3[] corners = new Vector3[4];

        this.GetComponent<RectTransform>().GetWorldCorners(corners);

        foreach (Vector3 corner in corners) {
          if (!screenRect.Contains(corner)) {
        return;
          }
        }

        hasTriggered = true;
        var inputProcessor = new InputProcessor(sim);
        inputProcessor.TriggerEvent(playerEvent);
    }
Exemplo n.º 37
0
 public void AddInputProcessor(InputProcessor newInputProcessor)
 {
     if (inputProcessors.Count == 0)
     {
         inputProcessors.Add(newInputProcessor);
     }
     else {
         for (int i = 0; i < inputProcessors.Count; i++)
         {
             if (inputProcessors[i].Level > newInputProcessor.Level)
             {
                 inputProcessors.Insert(i, newInputProcessor);
                 break;
             }
         }
     }
 }
Exemplo n.º 38
0
 void ProcessGame()
 {
     var inputProcessor = new InputProcessor(sim);
     inputProcessor.TriggerContinue();
 }