Ejemplo n.º 1
0
        private void btnController_Click(object sender, EventArgs e)
        {
            UserControl cc     = new ControllerControl();
            Form        window = new Form
            {
                Text            = "Controller Setup",
                TopLevel        = true,
                FormBorderStyle = FormBorderStyle.Fixed3D,
                MaximizeBox     = false,
                MinimizeBox     = false,
                ClientSize      = cc.Size,
                Icon            = nullDCNetplayLauncher.Properties.Resources.icons8_game_controller_26_ico
            };

            window.Controls.Add(cc);
            cc.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            window.ShowDialog();
        }
        private Form LaunchControllerSetup(bool ExitOnClose = false)
        {
            ControllerControl cc = new ControllerControl(controller);
            Form window          = new Form
            {
                Text            = "Controller Setup",
                TopLevel        = true,
                FormBorderStyle = FormBorderStyle.Fixed3D,
                MaximizeBox     = false,
                MinimizeBox     = false,
                ClientSize      = cc.Size,
                Icon            = nullDCNetplayLauncher.Properties.Resources.icons8_game_controller_26_ico
            };

            if (ExitOnClose)
            {
                window.FormClosing += (sender, e) =>
                {
                    Application.Exit();
                };
            }

            window.Controls.Add(cc);
            cc.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            window.ShowDialog();

            if (EnableMapper || cc.OldEnableMapper && cc.SetupUnfinished)
            {
                cc.SetupUnfinished = false;
                Launcher.mappings  = GamePadMapping.ReadMappingsFile();
                try
                {
                    Launcher.ActiveGamePadMapping = Launcher.mappings.GamePadMappings.Where(g => g.Default == true).ToList().First();
                }
                catch
                {
                    Launcher.ActiveGamePadMapping = Launcher.mappings.GamePadMappings.First();
                }
                StartMapper();
            }

            return(window);
        }