Пример #1
0
        private void StartNewSandbox()
        {
            MyLog.Default.WriteLine("StartNewSandbox - Start");

            GetSettingsFromControls();
            if (!MySteamWorkshop.CheckLocalModsAllowed(m_mods, m_settings.OnlineMode == MyOnlineModeEnum.OFFLINE))
            {
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError),
                                           messageText: MyTexts.Get(MySpaceTexts.DialogTextLocalModsDisabledInMultiplayer),
                                           buttonType: MyMessageBoxButtonsType.OK));
                MyLog.Default.WriteLine("LoadSession() - End");
                return;
            }

            MySteamWorkshop.DownloadModsAsync(m_mods, delegate(bool success)
            {
                if (success || (m_settings.OnlineMode == MyOnlineModeEnum.OFFLINE) && MySteamWorkshop.CanRunOffline(m_mods))
                {
                    MyScreenManager.RemoveAllScreensExcept(null);

                    if (AsteroidAmount < 0)
                    {
                        MyWorldGenerator.SetProceduralSettings(AsteroidAmount, m_settings);
                        m_asteroidAmount = 0;
                    }

                    MyAnalyticsHelper.SetEntry(MyGameEntryEnum.Custom);

                    MyGuiScreenGamePlay.StartLoading(delegate
                    {
                        MySession.Start(
                            m_nameTextbox.Text,
                            GetDescription(),
                            GetPassword(),
                            m_settings,
                            m_mods,
                            new MyWorldGenerator.Args()
                        {
                            AsteroidAmount = this.AsteroidAmount,
                            Scenario       = (m_scenarioTypesGroup.SelectedButton as MyGuiControlScenarioButton).Scenario
                        }
                            );
                    });
                }
                else
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                               messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError),
                                               messageText: MyTexts.Get(MySpaceTexts.DialogTextDownloadModsFailed),
                                               buttonType: MyMessageBoxButtonsType.OK));
                }
                MyLog.Default.WriteLine("StartNewSandbox - End");
            });
        }
Пример #2
0
        // Start game with some default values
        public static void QuickstartSandbox(MyObjectBuilder_SessionSettings quickstartSettings, MyWorldGenerator.Args?quickstartArgs)
        {
            MyLog.Default.WriteLine("QuickstartSandbox - START");

            MyScreenManager.RemoveAllScreensExcept(null);

            MyGuiScreenGamePlay.StartLoading(delegate
            {
                var settings = (quickstartSettings != null) ? quickstartSettings : CreateBasicQuickStartSettings();
                var args     = (quickstartArgs != null) ? quickstartArgs.Value : CreateBasicQuickstartArgs();
                var mods     = new List <MyObjectBuilder_Checkpoint.ModItem>(0);
                MySession.Start("Created " + DateTime.Now.ToString("yyyy-MM-dd HH:mm"), "", "", settings, mods, args);
            });

            MyLog.Default.WriteLine("QuickstartSandbox - END");
        }
Пример #3
0
 protected virtual void StartQuickstart()
 {
     // TODO: Move to derived screen in SpaceEngineers.Game
     if (MySandboxGame.IsDirectX11) // Running DirectX11, start planet quickstart
     {
         QuickstartSandbox(GetQuickstartSettings(), CreatePlanetQuickstartArgs());
     }
     else if (MyDirectXHelper.IsDx11Supported()) // DirectX11 not enabled, messagebox
     {
         MyScreenManager.RemoveAllScreensExcept(null);
         var text = MyTexts.Get(MySpaceTexts.QuickstartDX11SwitchQuestion);
         MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), buttonType: MyMessageBoxButtonsType.YES_NO, callback: MessageBoxSwitchCallback);
         MyGuiSandbox.AddScreen(mb);
     }
     else // DirectX11 not supported, show message, start easy start 1
     {
         MyScreenManager.RemoveAllScreensExcept(null);
         var text = MyTexts.Get(MySpaceTexts.QuickstartDX11NotAvailable);
         MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), callback: StartNoPlanetsOK);
         MyGuiSandbox.AddScreen(mb);
     }
 }
Пример #4
0
        /// <summary>
        /// Starts new session and unloads outdated if theres any.
        /// </summary>
        /// <param name="sessionName">Created session name.</param>
        /// <param name="settings">Session settings OB.</param>
        /// <param name="mods">Mod selection.</param>
        /// <param name="scenarioDefinition">World generator argument.</param>
        /// <param name="asteroidAmount">Hostility settings.</param>
        /// <param name="description">Session description.</param>
        /// <param name="passwd">Session password.</param>
        public static void StartNewSession(string sessionName,
                                           MyObjectBuilder_SessionSettings settings,
                                           List <MyObjectBuilder_Checkpoint.ModItem> mods,
                                           MyScenarioDefinition scenarioDefinition = null,
                                           int asteroidAmount = 0,
                                           string description = "",
                                           string passwd      = "")
        {
            MyLog.Default.WriteLine("StartNewSandbox - Start");

            if (!MySteamWorkshop.CheckLocalModsAllowed(mods, settings.OnlineMode == MyOnlineModeEnum.OFFLINE))
            {
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                           messageText: MyTexts.Get(MyCommonTexts.DialogTextLocalModsDisabledInMultiplayer),
                                           buttonType: MyMessageBoxButtonsType.OK));
                MyLog.Default.WriteLine("LoadSession() - End");
                return;
            }

            MySteamWorkshop.DownloadModsAsync(mods, delegate(bool success, string mismatchMods)
            {
                if (success || (settings.OnlineMode == MyOnlineModeEnum.OFFLINE) && MySteamWorkshop.CanRunOffline(mods))
                {
                    CheckMismatchmods(mismatchMods, callback : delegate(ResultEnum val)
                    {
                        MyScreenManager.RemoveAllScreensExcept(null);

                        if (asteroidAmount < 0)
                        {
                            MyWorldGenerator.SetProceduralSettings(asteroidAmount, settings);
                            asteroidAmount = 0;
                        }

                        MyAnalyticsHelper.SetEntry(MyGameEntryEnum.Custom);

                        StartLoading(delegate
                        {
                            MyAnalyticsHelper.SetEntry(MyGameEntryEnum.Custom);

                            MySession.Start(
                                sessionName,
                                description,
                                passwd,
                                settings,
                                mods,
                                new MyWorldGenerator.Args()
                            {
                                AsteroidAmount = asteroidAmount,
                                Scenario       = scenarioDefinition
                            }
                                );
                        });
                    });
                }
                else
                {
                    if (MySteam.IsOnline)
                    {
                        MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                                   messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                                   messageText: MyTexts.Get(MyCommonTexts.DialogTextDownloadModsFailed),
                                                   buttonType: MyMessageBoxButtonsType.OK));
                    }
                    else
                    {
                        MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                                   messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                                   messageText: MyTexts.Get(MyCommonTexts.DialogTextDownloadModsFailedSteamOffline),
                                                   buttonType: MyMessageBoxButtonsType.OK));
                    }
                }
                MyLog.Default.WriteLine("StartNewSandbox - End");
            });
        }