コード例 #1
0
        void RegisterKeys()
        {
            formController.UnregisterAllKeys();

            formController.RegisterKey(_config.KeyMapping.A, NintendoSwitch.Button.A);
            formController.RegisterKey(_config.KeyMapping.B, NintendoSwitch.Button.B);
            formController.RegisterKey(_config.KeyMapping.X, NintendoSwitch.Button.X);
            formController.RegisterKey(_config.KeyMapping.Y, NintendoSwitch.Button.Y);
            formController.RegisterKey(_config.KeyMapping.L, NintendoSwitch.Button.L);
            formController.RegisterKey(_config.KeyMapping.R, NintendoSwitch.Button.R);
            formController.RegisterKey(_config.KeyMapping.ZL, NintendoSwitch.Button.ZL);
            formController.RegisterKey(_config.KeyMapping.ZR, NintendoSwitch.Button.ZR);
            formController.RegisterKey(_config.KeyMapping.Plus, NintendoSwitch.Button.PLUS);
            formController.RegisterKey(_config.KeyMapping.Minus, NintendoSwitch.Button.MINUS);
            formController.RegisterKey(_config.KeyMapping.Capture, NintendoSwitch.Button.CAPTURE);
            formController.RegisterKey(_config.KeyMapping.Home, NintendoSwitch.Button.HOME);
            formController.RegisterKey(_config.KeyMapping.LClick, NintendoSwitch.Button.LCLICK);
            formController.RegisterKey(_config.KeyMapping.RClick, NintendoSwitch.Button.RCLICK);
            formController.RegisterKey(_config.KeyMapping.Up, NintendoSwitch.HAT.TOP);
            formController.RegisterKey(_config.KeyMapping.Down, NintendoSwitch.HAT.BOTTOM);
            formController.RegisterKey(_config.KeyMapping.Left, NintendoSwitch.HAT.LEFT);
            formController.RegisterKey(_config.KeyMapping.Right, NintendoSwitch.HAT.RIGHT);
            formController.RegisterKey(_config.KeyMapping.LSUp, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Up, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Up, false));
            formController.RegisterKey(_config.KeyMapping.LSDown, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Down, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Down, false));
            formController.RegisterKey(_config.KeyMapping.LSLeft, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Left, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Left, false));
            formController.RegisterKey(_config.KeyMapping.LSRight, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Right, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Right, false));
            formController.RegisterKey(_config.KeyMapping.RSUp, () => NS.RightDirection(NintendoSwitch.DirectionKey.Up, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Up, false));
            formController.RegisterKey(_config.KeyMapping.RSDown, () => NS.RightDirection(NintendoSwitch.DirectionKey.Down, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Down, false));
            formController.RegisterKey(_config.KeyMapping.RSLeft, () => NS.RightDirection(NintendoSwitch.DirectionKey.Left, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Left, false));
            formController.RegisterKey(_config.KeyMapping.RSRight, () => NS.RightDirection(NintendoSwitch.DirectionKey.Right, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Right, false));
        }
コード例 #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // initialize modules
            NS.Connect("COM5");
            CaptureScreen(1);

            // initialize tab modules
            _tabModule.Values.ToList().ForEach(m => m.Init());

            // register keys
            for (int i = 0; i < 4; i++)
            {
                var _i = i;
                RegisterKeyEvent(Keys.F1 + i, false, null, null, () => Test(_i + 1));
            }
            Func <bool> sampleCond = () => checkBoxGraphicSampling.Checked;

            RegisterKeyEvent(Keys.LMenu, false, tabPageSampling, sampleCond, null, sampleCond, tabSampling.SamplePoint);
            RegisterKeyEvent(Keys.RMenu, false, tabPageSampling, sampleCond, null, sampleCond, tabSampling.SamplePoint);
            RegisterKeyEvent(Keys.LControlKey, false, tabPageSampling, sampleCond, tabSampling.SampleImageDown, sampleCond, tabSampling.SampleImageUp);
            RegisterKeyEvent(Keys.RControlKey, false, tabPageSampling, sampleCond, tabSampling.SampleImageDown, sampleCond, tabSampling.SampleImageUp);
            formController.RegisterKey(Keys.Y, NintendoSwitch.Button.A);
            formController.RegisterKey(Keys.U, NintendoSwitch.Button.B);
            formController.RegisterKey(Keys.I, NintendoSwitch.Button.X);
            formController.RegisterKey(Keys.H, NintendoSwitch.Button.Y);
            formController.RegisterKey(Keys.T, NintendoSwitch.Button.R);
            formController.RegisterKey(Keys.G, NintendoSwitch.Button.L);
            formController.RegisterKey(Keys.R, NintendoSwitch.Button.ZR);
            formController.RegisterKey(Keys.F, NintendoSwitch.Button.ZL);
            formController.RegisterKey(Keys.J, NintendoSwitch.Button.MINUS);
            formController.RegisterKey(Keys.K, NintendoSwitch.Button.PLUS);
            formController.RegisterKey(Keys.Q, NintendoSwitch.Button.LCLICK);
            formController.RegisterKey(Keys.E, NintendoSwitch.Button.RCLICK);
            formController.RegisterKey(Keys.Z, NintendoSwitch.Button.CAPTURE);
            formController.RegisterKey(Keys.C, NintendoSwitch.Button.HOME);
            formController.RegisterKey(Keys.NumPad1, NintendoSwitch.HAT.BOTTOM_LEFT);
            formController.RegisterKey(Keys.NumPad2, NintendoSwitch.HAT.BOTTOM);
            formController.RegisterKey(Keys.NumPad3, NintendoSwitch.HAT.BOTTOM_RIGHT);
            formController.RegisterKey(Keys.NumPad4, NintendoSwitch.HAT.LEFT);
            formController.RegisterKey(Keys.NumPad5, NintendoSwitch.HAT.CENTER);
            formController.RegisterKey(Keys.NumPad6, NintendoSwitch.HAT.RIGHT);
            formController.RegisterKey(Keys.NumPad7, NintendoSwitch.HAT.TOP_LEFT);
            formController.RegisterKey(Keys.NumPad8, NintendoSwitch.HAT.TOP);
            formController.RegisterKey(Keys.NumPad9, NintendoSwitch.HAT.TOP_RIGHT);
            formController.RegisterKey(Keys.W, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Up, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Up, false));
            formController.RegisterKey(Keys.S, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Down, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Down, false));
            formController.RegisterKey(Keys.A, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Left, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Left, false));
            formController.RegisterKey(Keys.D, () => NS.LeftDirection(NintendoSwitch.DirectionKey.Right, true), () => NS.LeftDirection(NintendoSwitch.DirectionKey.Right, false));
            formController.RegisterKey(Keys.Up, () => NS.RightDirection(NintendoSwitch.DirectionKey.Up, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Up, false));
            formController.RegisterKey(Keys.Down, () => NS.RightDirection(NintendoSwitch.DirectionKey.Down, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Down, false));
            formController.RegisterKey(Keys.Left, () => NS.RightDirection(NintendoSwitch.DirectionKey.Left, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Left, false));
            formController.RegisterKey(Keys.Right, () => NS.RightDirection(NintendoSwitch.DirectionKey.Right, true), () => NS.RightDirection(NintendoSwitch.DirectionKey.Right, false));
            formController.RegisterKey(Keys.X, () => tabScripting.Try(tabScripting.Turbo));

            ActivateTab();

            // UI updating timer
            Thread t = new Thread(UpdateUI);

            t.IsBackground = true;
            t.Start();

            formController.ControllerEnabledLevel = 1;
        }