示例#1
0
        public GameController(Controller controller, ControllerSettings settings, InputSimulator simulator)
        {
            _controller     = controller;
            _settings       = settings;
            _inputSimulator = simulator;

            // DEFINE VKCs
            VKC_ForceMove  = StringToVKC(_settings.VKC_ForceMove);
            VKC_ForceStop  = StringToVKC(_settings.VKC_ForceStop);
            VKC_Skill3     = StringToVKC(_settings.VKC_Skill3);
            VKC_Skill4     = StringToVKC(_settings.VKC_Skill4);
            VKC_Skill5     = StringToVKC(_settings.VKC_Skill5);
            VKC_Skill6     = StringToVKC(_settings.VKC_Skill6);
            VKC_Potion     = StringToVKC(_settings.VKC_Potion);
            VKC_Character  = StringToVKC(_settings.VKC_Character);
            VKC_TownPortal = StringToVKC(_settings.VKC_TownPortal);
            VKC_Skill      = StringToVKC(_settings.VKC_Skill);

            VKC_Start     = StringToVKC(_settings.VKC_Start);
            VKC_Inventory = StringToVKC(_settings.VKC_Inventory);
            VKC_MAP       = StringToVKC(_settings.VKC_MAP);

            VKC_SKIP  = StringToVKC(_settings.VKC_SKIP);
            VKC_HINTS = StringToVKC(_settings.VKC_HINTS);
        }
示例#2
0
        public GameController(Controller controller, ControllerSettings settings, InputSimulator simulator)
        {
            _controller     = controller;
            _settings       = settings;
            _inputSimulator = simulator;

            // VIBRATION SETTINGS
            vb_stick.RightMotorSpeed = 0;
            vb_stick.LeftMotorSpeed  = Convert.ToUInt16(_settings.vb_stick_value);
        }
示例#3
0
        public MainWindow()
        {
            InitializeComponent();

            // READ SETTINGS

            _settings = new ControllerSettings();
            _settings.UpdateScreenValues();

            SetCurrentSettings();

            TouchInjector.InitializeTouchInjection();

            _inputSimulator = new InputSimulator();

            _gameController = new GameController(new Controller(UserIndex.One), _settings, _inputSimulator);


            if (_gameController.IsConnected())
            {
                double msPerSecond       = 1000;
                var    msPerFrameRefresh = msPerSecond / _settings.refresh_rate;
                var    timer             = Observable.Interval(TimeSpan.FromMilliseconds(msPerFrameRefresh));

                timer
//                    .DoWhile(_gameController.IsConnected)
                .Subscribe(_ => {
                    if (_gameController.IsConnected())
                    {
                        _gameController.Poll();
                    }
                });
            }
            else
            {
                MessageBox.Show("No controller detected, closing...");
                Close();
            }

//            CompositionTarget.Rendering += _gameController.CompositionTarget_Rendering;

            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
        }
示例#4
0
        public MainWindow()
        {
            InitializeComponent();
            IsAlive = true;

            // TOUCH SETTINGS
            TouchInjector.InitializeTouchInjection();
            _inputSimulator = new InputSimulator();

            // CONTROLLER SETTINGS
            _settings       = new ControllerSettings();
            _gameController = new GameController(new Controller(UserIndex.One), _settings, _inputSimulator);

            // STATICS
            myForm    = Form1;
            myCanvas  = Canvas1;
            myGamepad = GamepadIco;

            string ico = "Menu";

            for (int i = 0; i < 7; i++)
            {
                switch (i)
                {
                case 0: ico = "B"; break;

                case 1: ico = "Y"; break;

                case 2: ico = "RB"; break;

                case 3: ico = "RT"; break;

                case 4: ico = "X"; break;

                case 5: ico = "A"; break;

                case 6: ico = "LB"; break;
                }

                System.Windows.Shapes.Rectangle rect = new System.Windows.Shapes.Rectangle
                {
                    Fill = new ImageBrush
                    {
                        ImageSource = ImageSourceFromBitmap(GetImageByName("XBOne_" + ico))
                    },
                    Stretch = Stretch.Uniform,
                };

                myCanvas.Children.Add(rect);
            }

            Thread myThread = new Thread(new ThreadStart(ThreadHealth));

            myThread.Start();

            Thread myThread2 = new Thread(new ThreadStart(ThreadGamepad));

            myThread2.Start();

            Thread myThread3 = new Thread(new ThreadStart(ThreadUI));

            myThread3.Start();
        }