public MainForm(string[] args, GameManager gameManager) { this.gameManager = gameManager; MainForm.Instance = this; InitializeComponent(); this.SetupBaseForm(this.panel_formContent); // control that shows over the entire application while the game is running overlay = new GameRunningOverlay(); overlay.OnStop += Overlay_OnStop; this.titleBarControl.Text = $"Nucleus Coop v{Globals.Version}"; controls = new Dictionary <string, GameControl>(); // Selects the list of games, so the buttons look equal list_games.Select(); list_games.AutoScroll = false; // check for arguments SplitScreenEngineUtil.HandleArguments(args); // update register if needed SplitScreenEngineUtil.HandleRegisterUpdates(); }
public MainForm(string[] args, GameManager gameManager) { this.gameManager = gameManager; MainForm.Instance = this; InitializeComponent(); this.SetupBaseForm(this.panel_formContent); overlay = new GameRunningOverlay(); overlay.OnStop += Overlay_OnStop; this.titleBarControl.Text = string.Format("Nucleus Coop v{0}", Globals.Version); controls = new Dictionary <string, GameControl>(); // selects the list of games, so the buttons look equal list_games.Select(); list_games.AutoScroll = false; if (args != null) { for (int i = 0; i < args.Length; i++) { string argument = args[i]; if (string.IsNullOrEmpty(argument)) { continue; } string extension = Path.GetExtension(argument); if (extension.ToLower().EndsWith("nc")) { // try installing the package in the arguments if user allows it if (MessageBox.Show("Would you like to install " + argument + "?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes) { gameManager.RepoManager.InstallPackage(argument); } } } } if (!gameManager.User.Options.RequestedToAssociateFormat) { gameManager.User.Options.RequestedToAssociateFormat = true; //if (MessageBox.Show("Would you like to associate Nucleus Package Files (*.nc) and nuke:// links to the application?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes) { string startLocation = Process.GetCurrentProcess().MainModule.FileName; if (!RegistryUtil.SetAssociation(".nc", "NucleusCoop", "Nucleus Package Files", startLocation)) { //MessageBox.Show("Failed to set association"); //gameManager.User.Options.RequestedToAssociateFormat = false; } RegistryUtil.RegisterUriScheme(); gameManager.User.Save(); } }
public MainForm(string[] args) { InitializeComponent(); overlay = new GameRunningOverlay(); overlay.OnStop += Overlay_OnStop; this.Text = string.Format("Nucleus Coop v{0}", Globals.Version); controls = new Dictionary <UserGameInfo, GameControl>(); configFile = new CoopConfigInfo("config.json"); gameManager = new GameManager(configFile); positionsControl = new PositionsControl(); optionsControl = new PlayerOptionsControl(); jsControl = new JSUserInputControl(); positionsControl.OnCanPlayUpdated += StepCanPlay; optionsControl.OnCanPlayUpdated += StepCanPlay; jsControl.OnCanPlayUpdated += StepCanPlay; // selects the list of games, so the buttons look equal list_Games.Select(); list_Games.AutoScroll = false; list_Games.SelectedChanged += list_Games_SelectedChanged; //int vertScrollWidth = SystemInformation.VerticalScrollBarWidth; //list_Games.Padding = new Padding(0, 0, vertScrollWidth, 0); if (args != null) { for (int i = 0; i < args.Length; i++) { string argument = args[i]; if (string.IsNullOrEmpty(argument)) { continue; } string extension = Path.GetExtension(argument); if (extension.ToLower().EndsWith("nc")) { // try installing if user allows it if (MessageBox.Show("Would you like to install " + argument + "?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes) { gameManager.RepoManager.InstallPackage(argument); } } } } if (!gameManager.User.Options.RequestedToAssociateFormat) { gameManager.User.Options.RequestedToAssociateFormat = true; if (MessageBox.Show("Would you like to associate Nucleus Package Files (*.nc) to the application?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes) { string startLocation = Process.GetCurrentProcess().MainModule.FileName; if (!FileAssociations.SetAssociation(".nc", "NucleusCoop", "Nucleus Package Files", startLocation)) { MessageBox.Show("Failed to set association"); gameManager.User.Options.RequestedToAssociateFormat = false; } } gameManager.User.Save(); } }