Пример #1
0
 public RotorBridge(
     RotorBridgeParameters parameters,
     ModuleConfigViewModel config,
     ColorRangeViewModel activeRange,
     ColorRangeViewModel inactiveRange,
     RotorPlayer hapticsPlayer)
 {
     _parameters    = parameters;
     _config        = config;
     _activeRange   = activeRange;
     _inactiveRange = inactiveRange;
     _player        = hapticsPlayer;
 }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            var vm = new MainViewModel();

            this.DataContext = vm;
            LoadSettings();

            _device       = Direct3D11Helper.CreateDevice();
            _player       = new HapticsPlayer();
            _rotor_player = new RotorPlayer();

            _headBridge = new HapticsBridge(
                new HapticsBridgeParameters(
                    6, 1, new HapticsPointSet[]
            {
                new HapticsPointSet(HapticsPosition.Head, new Point[]
                {
                    new Point(0, 0), new Point(1, 0), new Point(2, 0),
                    new Point(3, 0), new Point(4, 0), new Point(5, 0),
                })
            }),
                vm.Head,
                vm.ActiveColor,
                vm.InactiveColor,
                _player);
            _vestBridge = new HapticsBridge(
                new HapticsBridgeParameters(
                    8, 5, new HapticsPointSet[]
            {
                new HapticsPointSet(HapticsPosition.VestFront, new Point[]
                {
                    new Point(0, 0), new Point(1, 0), new Point(2, 0), new Point(3, 0),
                    new Point(0, 1), new Point(1, 1), new Point(2, 1), new Point(3, 1),
                    new Point(0, 2), new Point(1, 2), new Point(2, 2), new Point(3, 2),
                    new Point(0, 3), new Point(1, 3), new Point(2, 3), new Point(3, 3),
                    new Point(0, 4), new Point(1, 4), new Point(2, 4), new Point(3, 4),
                }),
                new HapticsPointSet(HapticsPosition.VestBack, new Point[]
                {
                    new Point(4, 0), new Point(5, 0), new Point(6, 0), new Point(7, 0),
                    new Point(4, 1), new Point(5, 1), new Point(6, 1), new Point(7, 1),
                    new Point(4, 2), new Point(5, 2), new Point(6, 2), new Point(7, 2),
                    new Point(4, 3), new Point(5, 3), new Point(6, 3), new Point(7, 3),
                    new Point(4, 4), new Point(5, 4), new Point(6, 4), new Point(7, 4),
                }),
            }),
                vm.Vest,
                vm.ActiveColor,
                vm.InactiveColor,
                _player);
            _leftArmBridge = new HapticsBridge(
                new HapticsBridgeParameters(
                    5, 4, new HapticsPointSet[]
            {
                new HapticsPointSet(HapticsPosition.Left, new Point[]
                {
                    new Point(0, 0), new Point(1, 0), new Point(2, 0), new Point(3, 0), new Point(4, 0),
                    new Point(0, 1), new Point(1, 1), new Point(2, 1), new Point(3, 1), new Point(4, 1),
                    new Point(0, 2), new Point(1, 2), new Point(2, 2), new Point(3, 2), new Point(4, 2),
                    new Point(0, 3), new Point(1, 3), new Point(2, 3), new Point(3, 3), new Point(4, 3),
                })
            }),
                vm.LeftArm,
                vm.ActiveColor,
                vm.InactiveColor,
                _player);
            _rightArmBridge = new HapticsBridge(
                new HapticsBridgeParameters(
                    5, 4, new HapticsPointSet[]
            {
                new HapticsPointSet(HapticsPosition.Right, new Point[]
                {
                    new Point(0, 0), new Point(1, 0), new Point(2, 0), new Point(3, 0), new Point(4, 0),
                    new Point(0, 1), new Point(1, 1), new Point(2, 1), new Point(3, 1), new Point(4, 1),
                    new Point(0, 2), new Point(1, 2), new Point(2, 2), new Point(3, 2), new Point(4, 2),
                    new Point(0, 3), new Point(1, 3), new Point(2, 3), new Point(3, 3), new Point(4, 3),
                })
            }),
                vm.RightArm,
                vm.ActiveColor,
                vm.InactiveColor,
                _player);
            _rotorBridge = new RotorBridge(
                new RotorBridgeParameters(
                    1, 2, new RotorPointSet[]
            {
                new RotorPointSet(RotorPosition.MainPosition, new Point[]
                {
                    new Point(0, 0),
                    new Point(0, 1),
                })
            }),
                vm.Rotor,
                vm.ActiveColor,
                vm.InactiveColor,
                _rotor_player);

            vm.Rotor.Enabled.Subscribe(state => { if (!state)
                                                  {
                                                      _rotorBridge.OnDisabled();
                                                  }
                                       });
        }