Ejemplo n.º 1
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (m_selectedSessionSettings == null)
            {
                return;
            }

            if (MyFakes.ENABLE_BATTLE_SYSTEM && battleButton.Checked && m_selectedSessionSettings != null)
            {
                MyBattleHelper.FillDefaultBattleServerSettings(m_selectedSessionSettings, true);
            }

            saveConfigButton_Click(sender, e);

            if (m_isService) // Service
            {
                RefreshWorldsList();
                if (startGameButton.Checked)
                {
                    // fix for new game selected - new game will be started and not last saved game instead
                    MyLocalCache.SaveLastSessionInfo("");
                }
                startService();
            }
            else // Local / Console
            {
                // When running without host process, console is not properly attached on debug (no console output)
                string[] cmdLine = Environment.GetCommandLineArgs();
                Process.Start(cmdLine[0].Replace(".vshost.exe", ".exe"), ((cmdLine.Length > 1) ? cmdLine[1] : "") + " -console -ignorelastsession");
                Close();
            }
        }
Ejemplo n.º 2
0
        private void gamesListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (gamesListBox.SelectedIndex != -1)
            {
                ulong sizeInBytes;

                WorldItem worldItem = (WorldItem)gamesListBox.Items[gamesListBox.SelectedIndex];
                ((MyConfigDedicated <T>)MySandboxGame.ConfigDedicated).LoadWorld = worldItem.SessionPath;

                var loadPath = worldItem.SessionPath;
                MyObjectBuilder_Checkpoint checkpoint = MyLocalCache.LoadCheckpoint(loadPath, out sizeInBytes);

                m_selectedSessionSettings = checkpoint.Settings;

                if (m_selectedSessionSettings != null && battleButton.Checked)
                {
                    MyBattleHelper.FillDefaultBattleServerSettings(m_selectedSessionSettings, true);
                }

                MySandboxGame.ConfigDedicated.Mods.Clear();
                foreach (var mod in checkpoint.Mods)
                {
                    if (mod.PublishedFileId != 0)
                    {
                        MySandboxGame.ConfigDedicated.Mods.Add(mod.PublishedFileId);
                    }
                }

                modIdsTextBox.Text = string.Join(Environment.NewLine, MySandboxGame.ConfigDedicated.Mods.ToArray());

                FillSessionSettingsItems();
            }
        }
Ejemplo n.º 3
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (MyFakes.ENABLE_BATTLE_SYSTEM && battleButton.Checked && m_selectedSessionSettings != null)
            {
                MyBattleHelper.FillDefaultBattleServerSettings(m_selectedSessionSettings);
            }

            saveConfigButton_Click(sender, e);

            if (m_isService) // Service
            {
                startService();
            }
            else // Local / Console
            {
                string[] cmdLine = Environment.GetCommandLineArgs();
                Process.Start(cmdLine[0], ((cmdLine.Length > 1) ? cmdLine[1] : "") + " -console -ignorelastsession");
                Close();
            }
        }
Ejemplo n.º 4
0
        private void startButton_Click(object sender, EventArgs e)
        {
            if (MyFakes.ENABLE_BATTLE_SYSTEM && battleButton.Checked && m_selectedSessionSettings != null)
            {
                MyBattleHelper.FillDefaultBattleServerSettings(m_selectedSessionSettings, true);
            }

            saveConfigButton_Click(sender, e);

            if (m_isService) // Service
            {
                startService();
            }
            else // Local / Console
            {
                // When running without host process, console is not properly attached on debug (no console output)
                string[] cmdLine = Environment.GetCommandLineArgs();
                Process.Start(cmdLine[0].Replace(".vshost.exe", ".exe"), ((cmdLine.Length > 1) ? cmdLine[1] : "") + " -console -ignorelastsession");
                Close();
            }
        }
Ejemplo n.º 5
0
        private void startTypeRadio_CheckedChanged(object sender, EventArgs e)
        {
            if (!m_canChangeStartType)
            {
                return;
            }

            startGameButton.Enabled = true;

            tableLayoutPanel1.Show();
            newGameSettingsPanel.Show();

            if (loadGameButton.Checked)
            {
                if (MyFakes.ENABLE_BATTLE_SYSTEM)
                {
                    FillWorldsList();
                }

                if (gamesListBox.Items.Count > 0)
                {
                    gamesListBox.Enabled = true;
                    //tableLayoutPanel1.Enabled = false;
                    newGameSettingsPanel.Enabled = false;
                    if (gamesListBox.SelectedIndex == -1)
                    {
                        gamesListBox.SelectedIndex = 0;
                    }
                }
                else
                {
                    startGameButton.Checked = true;
                    gamesListBox.Enabled    = false;
                    //tableLayoutPanel1.Enabled = true;
                    newGameSettingsPanel.Enabled = true;

                    MySandboxGame.ConfigDedicated.Load();
                    m_selectedSessionSettings = MySandboxGame.ConfigDedicated.SessionSettings;
                }

                if (m_selectedSessionSettings != null)
                {
                    m_selectedSessionSettings.Battle = false;
                }
            }
            else
            {
                if (MyFakes.ENABLE_BATTLE_SYSTEM && battleButton.Checked)
                {
                    FillBattlesList();

                    tableLayoutPanel1.Hide();
                    newGameSettingsPanel.Hide();

                    if (gamesListBox.Items.Count > 0)
                    {
                        gamesListBox.Enabled = true;
                        if (gamesListBox.SelectedIndex == -1)
                        {
                            gamesListBox.SelectedIndex = 0;
                        }
                    }
                    else
                    {
                        startGameButton.Enabled      = false;
                        gamesListBox.Enabled         = false;
                        newGameSettingsPanel.Enabled = true;

                        MySandboxGame.ConfigDedicated.Load();
                        m_selectedSessionSettings = MySandboxGame.ConfigDedicated.SessionSettings;
                    }

                    if (m_selectedSessionSettings != null)
                    {
                        MyBattleHelper.FillDefaultBattleServerSettings(m_selectedSessionSettings, true);
                    }
                }
                else
                {
                    gamesListBox.SelectedIndex = -1;
                    gamesListBox.Enabled       = false;
                    //tableLayoutPanel1.Enabled = true;
                    newGameSettingsPanel.Enabled = true;

                    MySandboxGame.ConfigDedicated.Load();
                    m_selectedSessionSettings = MySandboxGame.ConfigDedicated.SessionSettings;

                    //enable tool shake needs to be true for new world, but false for old saved worlds.
                    m_selectedSessionSettings.EnableToolShake = true;

                    m_selectedSessionSettings.EnableFlora       = (MyPerGameSettings.Game == GameEnum.SE_GAME) && MyFakes.ENABLE_PLANETS;
                    m_selectedSessionSettings.EnableSunRotation = MyPerGameSettings.Game == GameEnum.SE_GAME;
                    m_selectedSessionSettings.CargoShipsEnabled = !MyFakes.ENABLE_PLANETS;
                    m_selectedSessionSettings.EnableCyberhounds = false;
                    m_selectedSessionSettings.EnableSpiders     = true;

                    m_selectedSessionSettings.Battle = false;
                }
            }

            FillSessionSettingsItems();
        }