Exemplo n.º 1
0
 private void Joystick2_OnAreaStatusChanged(object sender, AreaJoystick <byte> .AreaStatusChangeEventArgs <byte> e)
 {
     //throw new NotImplementedException();
 }
Exemplo n.º 2
0
 private void Stick_OnAreaStatusChanged(object sender, AreaJoystick <VirtualKeyCode> .AreaStatusChangeEventArgs <VirtualKeyCode> e)
 {
     KeyboardServiceWrapper.UpdateKeyStatus(e.Area.AreaIdentifier, (KeyStatus)e.NewStatus);
 }
Exemplo n.º 3
0
        protected override void Setup()
        {
            var bluetoothManager        = DependencyService.Get <IManagerManager>().BluetoothManager;
            var deviceInfomationService = new DeviceInfomationServiceBuilder(bluetoothManager).Build();

            SensorSpeed speed = SensorSpeed.Game;

            Gyroscope.ReadingChanged += Gyroscope_ReadingChanged;
            Gyroscope.Start(speed);

            bluetoothManager.GattSever.AddService(new DeviceInfomationServiceBuilder(bluetoothManager).Build());
            bluetoothManager.GattSever.AddService(new RfcommServerServiceWrapper(bluetoothManager).GattServerService);
            KeyboardServiceWrapper = new KeyboardServiceWrapper(bluetoothManager);
            bluetoothManager.GattSever.AddService(KeyboardServiceWrapper.GattServerService);
            bluetoothManager.GattSever.StartAdvertising();

            var createServiceProviderTask = bluetoothManager.CreateRfcommServiceProviderAsync(MouseServiceWrapper.ServiceId);

            createServiceProviderTask.Wait();
            var mouseServiceProvider = createServiceProviderTask.Result;

            mouseServiceProvider.OnConnectionReceived += MouseServiceProvider_OnConnectionReceived;;
            mouseServiceProvider.StartAdvertising();

            var keyManager = DependencyService.Get <IManagerManager>().KeyManager;

            keyManager.VolumnDownKeyDown += KeyManager_VolumnDownKeyDown;
            keyManager.VolumnDownKeyUp   += KeyManager_VolumnDownKeyUp;
            keyManager.VolumnUpKeyDown   += KeyManager_VolumnUpKeyDown;
            keyManager.VolumnUpKeyUp     += KeyManager_VolumnUpKeyUp;
            ButtonStick = Sketch.SketchEngine.Instantiate <LineAreaJoystick <VirtualKeyCode> >();
            ButtonStick.OnAreaStatusChanged += Stick_OnAreaStatusChanged;
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.LSHIFT, -60, 60, 0, float.PositiveInfinity));
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_V, 30, 150, 0, float.PositiveInfinity));
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_R, 120, 240, 0, float.PositiveInfinity));
            ButtonStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.SPACE, 210, 330, 0, float.PositiveInfinity));
            ButtonStick.RectTransform.AnchorMax = new Vector2(0f, 1f);
            ButtonStick.RectTransform.AnchorMin = new Vector2(0f, 1f);
            ButtonStick.RectTransform.OffsetMin = new Vector2(1178.8f, -428f);
            ButtonStick.RectTransform.OffsetMax = new Vector2(1528.8f, -78f);


            LeftStick = Sketch.SketchEngine.Instantiate <LineAreaJoystick <VirtualKeyCode> >();
            LeftStick.OnAreaStatusChanged += Stick_OnAreaStatusChanged;
            LeftStick.MaxLength            = 120;
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_D, -60, 60, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_W, 30, 150, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_A, 120, 240, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_S, 210, 330, 0.3f, float.PositiveInfinity));
            LeftStick.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.LCONTROL, 0, 360, 1f, 1.2f));
            LeftStick.RectTransform.AnchorMax = new Vector2(0f, 1f);
            LeftStick.RectTransform.AnchorMin = new Vector2(0f, 1f);
            LeftStick.RectTransform.OffsetMin = new Vector2(26f, -457f);
            LeftStick.RectTransform.OffsetMax = new Vector2(376f, -107f);
            LeftStick.Level = 3;

            DirectionPad = Sketch.SketchEngine.Instantiate <LineAreaJoystick <VirtualKeyCode> >();
            DirectionPad.OnAreaStatusChanged += Stick_OnAreaStatusChanged;
            DirectionPad.MaxLength            = 100;
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_Z, -60, 60, 0, float.PositiveInfinity));
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_Q, 30, 150, 0, float.PositiveInfinity));
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_E, 120, 240, 0, float.PositiveInfinity));
            DirectionPad.AddArea(AreaJoystick <VirtualKeyCode> .Area <VirtualKeyCode> .CreateFromAngle(VirtualKeyCode.VK_N, 210, 330, 0, float.PositiveInfinity));
            DirectionPad.RectTransform.AnchorMax = new Vector2(0f, 1f);
            DirectionPad.RectTransform.AnchorMin = new Vector2(0f, 1f);
            DirectionPad.RectTransform.OffsetMin = new Vector2(26f, -807f);
            DirectionPad.RectTransform.OffsetMax = new Vector2(376f, -457f);

            RightStick         = Sketch.SketchEngine.Instantiate <TouchpadJoystick>();
            RightStick.OnMove += RightStick_OnMove;
            RightStick.RectTransform.AnchorMax = new Vector2(0f, 1f);
            RightStick.RectTransform.AnchorMin = new Vector2(0f, 1f);
            RightStick.RectTransform.OffsetMin = new Vector2(1178.8f, -778f);
            RightStick.RectTransform.OffsetMax = new Vector2(1528.8f, -428f);
            RightStick.Level = 3;
            Sketch.SketchEngine.Instantiate <SketchBorderRenderer>();
            Sketch.SketchEngine.Instantiate <RectTransformFrameRenderer>();
        }
Exemplo n.º 4
0
 private void Joystick2_OnAreaStatusChanged(object sender, AreaJoystick <byte> .AreaStatusChangeEventArgs <byte> e)
 {
     //KeyboardServiceWrapper.UpdateKeyStatus(e.Area.AreaIdentifier, (KeyStatus)e.NewStatus);
 }