コード例 #1
0
ファイル: MainForm.cs プロジェクト: Challak/nucleuscoop
        public MainForm()
        {
            InitializeComponent();

            sideInfoLbl.Text = "Modded by ZeroFox" + "\n" + version;

            positionsControl = new PositionsControl();
            Form settingsForm = new Form(this, positionsControl);

            positionsControl.Paint += PositionsControl_Paint;

            settingsForm.RegHotkeys(this);

            controls    = new Dictionary <UserGameInfo, GameControl>();
            gameManager = new GameManager();

            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;
            //int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;
            //list_Games.Padding = new Padding(0, 0, vertScrollWidth, 0);
        }
コード例 #2
0
        public Form(MainForm mf, PositionsControl pc)
        {
            InitializeComponent();

            controllerGuids = new TextBox[] { controllerOneGuid, controllerTwoGuid, controllerThreeGuid, controllerFourGuid, controllerFiveGuid, controllerSixGuid, controllerSevenGuid, controllerEightGuid, controllerNineGuid, controllerTenGuid, controllerElevenGuid, controllerTwelveGuid, controllerThirteenGuid, controllerFourteenGuid, controllerFifteenGuid, controllerSixteenGuid };
            controllerNicks = new TextBox[] { controllerOneNick, controllerTwoNick, controllerThreeNick, controllerFourNick, controllerFiveNick, controllerSixNick, controllerSevenNick, controllerEightNick, controllerNineNick, controllerTenNick, controllerElevenNick, controllerTwelveNick, controllerThirteenNick, controllerFourteenNick, controllerFifteenNick, controllerSixteenNick };

            mainForm         = mf as MainForm;
            positionsControl = pc;

            if (ini.IniReadValue("Hotkeys", "Close").Contains('+'))
            {
                string[] closeHk = ini.IniReadValue("Hotkeys", "Close").Split('+');
                if ((closeHk[0] == "Ctrl" || closeHk[0] == "Alt" || closeHk[0] == "Shift") && closeHk[1].Length == 1 && Regex.IsMatch(closeHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsCloseCmb.SelectedItem = closeHk[0];
                    settingsCloseHKTxt.Text       = closeHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Close", "");
            }

            if (ini.IniReadValue("Hotkeys", "Stop").Contains('+'))
            {
                string[] stopHk = ini.IniReadValue("Hotkeys", "Stop").Split('+');
                if ((stopHk[0] == "Ctrl" || stopHk[0] == "Alt" || stopHk[0] == "Shift") && stopHk[1].Length == 1 && Regex.IsMatch(stopHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsStopCmb.SelectedItem = stopHk[0];
                    settingsStopTxt.Text         = stopHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Stop", "");
            }

            if (ini.IniReadValue("Hotkeys", "TopMost").Contains('+'))
            {
                string[] topHk = ini.IniReadValue("Hotkeys", "TopMost").Split('+');
                if ((topHk[0] == "Ctrl" || topHk[0] == "Alt" || topHk[0] == "Shift") && topHk[1].Length == 1 && Regex.IsMatch(topHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsTopCmb.SelectedItem = topHk[0];
                    settingsTopTxt.Text         = topHk[1];
                }
            }

            GetControllers();

            if (ini.IniReadValue("Misc", "UseNicksInGame") != "")
            {
                useNicksCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "UseNicksInGame"));
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: Sphaxtoast/nucleuscoop
        public MainForm()
        {
            InitializeComponent();

            controls    = new Dictionary <UserGameInfo, GameControl>();
            gameManager = new GameManager();

            countControl     = new PlayerCountControl();
            positionsControl = new PositionsControl();
            optionsControl   = new PlayerOptionsControl();

            countControl.OnCanPlay     += StepCanPlay;
            positionsControl.OnCanPlay += StepCanPlay;
            optionsControl.OnCanPlay   += StepCanPlay;
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: mitcheesta/nucleuscoop
        public MainForm(string[] args)
        {
            InitializeComponent();

            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
                        gameManager.RepoManager.InstallPackage(argument);
                    }
                }
            }
        }
コード例 #5
0
        public MainForm()
        {
            InitializeComponent();

            controls    = new Dictionary <UserGameInfo, GameControl>();
            gameManager = new GameManager();

            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();
        }
コード例 #6
0
        public MainForm()
        {
            InitializeComponent();

            controls = new Dictionary <UserGameInfo, GameControl>();

            configFile  = new CoopConfig("config.js");
            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;
            //int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;
            //list_Games.Padding = new Padding(0, 0, vertScrollWidth, 0);
        }
コード例 #7
0
        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();
            }
        }
コード例 #8
0
        public Settings(MainForm mf, PositionsControl pc)
        {
            InitializeComponent();

            DPIManager.AddForm(this);
            DPIManager.ForceUpdate();

            Invalidate();

            controllerGuids = new TextBox[] { controllerOneGuid, controllerTwoGuid, controllerThreeGuid, controllerFourGuid, controllerFiveGuid, controllerSixGuid, controllerSevenGuid, controllerEightGuid, controllerNineGuid, controllerTenGuid, controllerElevenGuid, controllerTwelveGuid, controllerThirteenGuid, controllerFourteenGuid, controllerFifteenGuid, controllerSixteenGuid };
            controllerNicks = new TextBox[] { controllerOneNick, controllerTwoNick, controllerThreeNick, controllerFourNick, controllerFiveNick, controllerSixNick, controllerSevenNick, controllerEightNick, controllerNineNick, controllerTenNick, controllerElevenNick, controllerTwelveNick, controllerThirteenNick, controllerFourteenNick, controllerFifteenNick, controllerSixteenNick };

            mainForm         = mf as MainForm;
            positionsControl = pc;

            RefreshCmbNetwork();
            if (ini.IniReadValue("Misc", "Network") != "")
            {
                cmb_Network.Text = ini.IniReadValue("Misc", "Network");
            }
            else
            {
                cmb_Network.SelectedIndex = 0;
            }

            if (ini.IniReadValue("Misc", "SteamLang") != "")
            {
                cmb_Lang.Text = ini.IniReadValue("Misc", "SteamLang");
            }
            else
            {
                cmb_Lang.SelectedIndex = 0;
            }

            //Hotkeys
            if (ini.IniReadValue("Hotkeys", "Close").Contains('+'))
            {
                string[] closeHk = ini.IniReadValue("Hotkeys", "Close").Split('+');
                if ((closeHk[0] == "Ctrl" || closeHk[0] == "Alt" || closeHk[0] == "Shift") && closeHk[1].Length == 1 && Regex.IsMatch(closeHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsCloseCmb.SelectedItem = closeHk[0];
                    settingsCloseHKTxt.Text       = closeHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Close", "");
            }

            if (ini.IniReadValue("Hotkeys", "Stop").Contains('+'))
            {
                string[] stopHk = ini.IniReadValue("Hotkeys", "Stop").Split('+');
                if ((stopHk[0] == "Ctrl" || stopHk[0] == "Alt" || stopHk[0] == "Shift") && stopHk[1].Length == 1 && Regex.IsMatch(stopHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsStopCmb.SelectedItem = stopHk[0];
                    settingsStopTxt.Text         = stopHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Stop", "");
            }

            if (ini.IniReadValue("Hotkeys", "TopMost").Contains('+'))
            {
                string[] topHk = ini.IniReadValue("Hotkeys", "TopMost").Split('+');
                if ((topHk[0] == "Ctrl" || topHk[0] == "Alt" || topHk[0] == "Shift") && topHk[1].Length == 1 && Regex.IsMatch(topHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsTopCmb.SelectedItem = topHk[0];
                    settingsTopTxt.Text         = topHk[1];
                }
            }

            //Controll
            GetControllers();

            if (ini.IniReadValue("ControllerMapping", "Keyboard") != "")
            {
                keyboardNick.Text = ini.IniReadValue("ControllerMapping", "Keyboard");
            }

            //Custom Layout
            //if (ini.IniReadValue("CustomLayout", "Enabled") != "")
            //{
            //    mutexLogCheck.Checked = Boolean.Parse(ini.IniReadValue("CustomLayout", "Enabled"));
            //}
            if (ini.IniReadValue("CustomLayout", "HorizontalLines") != "")
            {
                numHorDiv.Value = int.Parse(ini.IniReadValue("CustomLayout", "HorizontalLines"));
            }
            if (ini.IniReadValue("CustomLayout", "VerticalLines") != "")
            {
                numVerDiv.Value = int.Parse(ini.IniReadValue("CustomLayout", "VerticalLines"));
            }
            if (ini.IniReadValue("CustomLayout", "MaxPlayers") != "")
            {
                numMaxPlyrs.Value = int.Parse(ini.IniReadValue("CustomLayout", "MaxPlayers"));
            }

            //Misc
            if (ini.IniReadValue("Misc", "UseNicksInGame") != "")
            {
                useNicksCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "UseNicksInGame"));
            }

            if (ini.IniReadValue("Misc", "DebugLog") != "")
            {
                debugLogCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "DebugLog"));
            }

            if (ini.IniReadValue("Misc", "ShowStatus") != "")
            {
                statusCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "ShowStatus"));
            }

            if (ini.IniReadValue("Misc", "KeepAccounts") != "")
            {
                keepAccountsCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "KeepAccounts"));
            }

            if (ini.IniReadValue("Misc", "NucleusAccountPassword") != "")
            {
                nucUserPassTxt.Text = ini.IniReadValue("Misc", "NucleusAccountPassword");
            }

            if (ini.IniReadValue("Audio", "Custom") == "0")
            {
                audioDefaultSettingsRadio.Checked = true;
                audioCustomSettingsBox.Enabled    = false;
            }
            else
            {
                audioCustomSettingsRadio.Checked = true;
            }

            //if (ini.IniReadValue("Misc", "VibrateOpen") != "")
            //{
            //    check_Vibrate.Checked = Boolean.Parse(ini.IniReadValue("Misc", "VibrateOpen"));
            //}

            RefreshAudioList();
        }
コード例 #9
0
        public Form(MainForm mf, PositionsControl pc)
        {
            InitializeComponent();

            Invalidate();

            controllerGuids = new TextBox[] { controllerOneGuid, controllerTwoGuid, controllerThreeGuid, controllerFourGuid, controllerFiveGuid, controllerSixGuid, controllerSevenGuid, controllerEightGuid, controllerNineGuid, controllerTenGuid, controllerElevenGuid, controllerTwelveGuid, controllerThirteenGuid, controllerFourteenGuid, controllerFifteenGuid, controllerSixteenGuid };
            controllerNicks = new TextBox[] { controllerOneNick, controllerTwoNick, controllerThreeNick, controllerFourNick, controllerFiveNick, controllerSixNick, controllerSevenNick, controllerEightNick, controllerNineNick, controllerTenNick, controllerElevenNick, controllerTwelveNick, controllerThirteenNick, controllerFourteenNick, controllerFifteenNick, controllerSixteenNick };

            mainForm         = mf as MainForm;
            positionsControl = pc;

            //Hotkeys
            if (ini.IniReadValue("Hotkeys", "Close").Contains('+'))
            {
                string[] closeHk = ini.IniReadValue("Hotkeys", "Close").Split('+');
                if ((closeHk[0] == "Ctrl" || closeHk[0] == "Alt" || closeHk[0] == "Shift") && closeHk[1].Length == 1 && Regex.IsMatch(closeHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsCloseCmb.SelectedItem = closeHk[0];
                    settingsCloseHKTxt.Text       = closeHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Close", "");
            }

            if (ini.IniReadValue("Hotkeys", "Stop").Contains('+'))
            {
                string[] stopHk = ini.IniReadValue("Hotkeys", "Stop").Split('+');
                if ((stopHk[0] == "Ctrl" || stopHk[0] == "Alt" || stopHk[0] == "Shift") && stopHk[1].Length == 1 && Regex.IsMatch(stopHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsStopCmb.SelectedItem = stopHk[0];
                    settingsStopTxt.Text         = stopHk[1];
                }
            }
            else
            {
                ini.IniWriteValue("Hotkeys", "Stop", "");
            }

            if (ini.IniReadValue("Hotkeys", "TopMost").Contains('+'))
            {
                string[] topHk = ini.IniReadValue("Hotkeys", "TopMost").Split('+');
                if ((topHk[0] == "Ctrl" || topHk[0] == "Alt" || topHk[0] == "Shift") && topHk[1].Length == 1 && Regex.IsMatch(topHk[1], @"^[a-zA-Z0-9]+$"))
                {
                    settingsTopCmb.SelectedItem = topHk[0];
                    settingsTopTxt.Text         = topHk[1];
                }
            }

            //Controll
            GetControllers();

            //Custom Layout
            //if (ini.IniReadValue("CustomLayout", "Enabled") != "")
            //{
            //    mutexLogCheck.Checked = Boolean.Parse(ini.IniReadValue("CustomLayout", "Enabled"));
            //}
            if (ini.IniReadValue("CustomLayout", "HorizontalLines") != "")
            {
                numHorDiv.Value = int.Parse(ini.IniReadValue("CustomLayout", "HorizontalLines"));
            }
            if (ini.IniReadValue("CustomLayout", "VerticalLines") != "")
            {
                numVerDiv.Value = int.Parse(ini.IniReadValue("CustomLayout", "VerticalLines"));
            }
            if (ini.IniReadValue("CustomLayout", "MaxPlayers") != "")
            {
                numMaxPlyrs.Value = int.Parse(ini.IniReadValue("CustomLayout", "MaxPlayers"));
            }

            //Misc
            if (ini.IniReadValue("Misc", "UseNicksInGame") != "")
            {
                useNicksCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "UseNicksInGame"));
            }

            if (ini.IniReadValue("Misc", "DebugLog") != "")
            {
                debugLogCheck.Checked = Boolean.Parse(ini.IniReadValue("Misc", "DebugLog"));
            }
        }