private void endActionLoadSaves(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            screen.CloseScreen();

            var selectedRow = m_worldsTable.SelectedRow;
            var world       = (MySteamWorkshop.SubscribedItem)selectedRow.UserData;



            string safeName        = MyUtils.StripInvalidChars(world.Title);
            var    tempSessionPath = MyLocalCache.GetSessionSavesPath(safeName, false, false);

            if (Directory.Exists(tempSessionPath))
            {
                OverwriteWorldDialog();
            }
            else
            {
                MySteamWorkshop.CreateWorldInstanceAsync(world, MySteamWorkshop.MyWorkshopPathInfo.CreateWorldInfo(), false, delegate(bool success, string sessionPath)
                {
                    if (success)
                    {
                        OnSuccess(sessionPath);
                    }
                });
            }
        }
Beispiel #2
0
        private void ConfigForm_Load(object sender, EventArgs e)
        {
            // hide everything related to service
            HasToExit = false;
            serviceStatusLabel.Hide();
            serviceStatusValueLabel.Hide();
            restartServiceButton.Hide();
            stopServiceButton.Hide();

            Text = MyPerServerSettings.GameName + " - Dedicated server configurator";

            if (m_isService)
            {
                // show everything that is related to service
                restartServiceButton.Show();
                stopServiceButton.Show();
                serviceStatusLabel.Show();
                serviceStatusValueLabel.Show();
                serviceStatusValueLabel.Text = "";

                // update service label
                updateServiceStatus();
            }

            MyLoadListResult worldList = new MyLoadListResult();

            m_loadWorldsAsync      = new MyLoadListResult();
            worldListTimer.Enabled = true;
            MySandboxGame.ConfigDedicated.Load();

            UpdateLoadedData();
        }
        private void worldListTimer_Tick(object sender, EventArgs e)
        {
            if (m_loadWorldsAsync.IsCompleted)
            {
                worldListTimer.Enabled = false;

                FillWorldsList();

                loadGameButton.Checked  = !string.IsNullOrEmpty(MySandboxGame.ConfigDedicated.LoadWorld);
                startGameButton.Checked = !loadGameButton.Checked;

                m_canChangeStartType = true;
                startTypeRadio_CheckedChanged(null, null);

                if (MyFakes.ENABLE_BATTLE_SYSTEM && MyPerGameSettings.Game == GameEnum.ME_GAME)
                {
                    string officialBattleMaps = Path.Combine(MyFileSystem.ContentPath, "CastleSiege");
                    m_loadBattlesAsync      = new MyBattleLoadListResult(officialBattleMaps, null);
                    battleListTimer.Enabled = true;
                }

                // Selects the value for EnvironmentHostility combobox according to the setting of the selected scenario
                if (MyPerGameSettings.Game == GameEnum.SE_GAME && startGameButton.Checked)
                {
                    // Assigns the variable m_cbbEnvironmentHostility
                    m_cbbEnvironmentHostility = tableLayoutPanel1.Controls.Find("EnvironmentHostility", true)[0] as ComboBox;
                    m_cbbEnvironmentHostility.SelectedItem = ((ScenarioItem)scenarioCB.SelectedItem).Definition.DefaultEnvironment;
                    scenarioCB.SelectedIndexChanged       += scenarioCB_SelectedIndexChanged;
                    // this variable was changed to true with the code above
                    m_isEnvironmentHostilityChanged = false;
                }
            }
        }
        private static void endActionPublishUGC(IMyAsyncResult iResult, MyGuiScreenProgressAsync screen)
        {
            screen.CloseScreenNow();
            PublishUGCResult result = (PublishUGCResult)iResult;

            result.CallbackOnFinished(result.PublishedFileId.HasValue, result.PublishedFileId);
        }
        // Checks for corrupted worlds and refreshes the table cells.
        private void OnLoadingFinished(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            m_loadedDirectories.Add(CurrentDirectory);
            foreach (var saveTuple in loadListRes.AvailableSaves)
            {
                if (!m_loadedWorldsByFilePaths.ContainsKey(saveTuple.Item1))
                {
                    // add if new
                    m_loadedWorldsByFilePaths.Add(saveTuple.Item1, saveTuple.Item2);
                }
                else
                {
                    // Rewrite if forced
                    m_loadedWorldsByFilePaths[saveTuple.Item1] = saveTuple.Item2;
                }
            }

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MyCommonTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            RefreshAfterLoaded();

            // Close the loading miniscreen
            screen.CloseScreen();
        }
Beispiel #6
0
        private void endAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            m_availableSaves = loadListRes.AvailableSaves;

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MyCommonTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            if (m_availableSaves.Count != 0)
            {
                RefreshGameList();
                m_continueLastSave.Enabled = true;
            }
            else
            {
                m_continueLastSave.Enabled = false;
                CloseScreenNow(); // close right away to avoid seeing the screen at all
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(messageText: MyTexts.Get(MyCommonTexts.MessageBoxTextNoSavedWorlds)));
            }
            screen.CloseScreen();
            m_state = StateEnum.ListLoaded;
        }
        private void endLocal(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            loadListRes.AvailableSaves.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));
            m_availableSavesLocal = loadListRes.AvailableSaves;
            AfterPartLoaded();
            screen.CloseScreen();
        }
Beispiel #8
0
        private void endAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            m_listNeedsReload = false;

            var loadResult = (LoadListResult)result;

            m_subscribedWorlds = loadResult.SubscribedWorlds;
            RefreshGameList();
            screen.CloseScreen();
        }
        private void EndTutorialLoading(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MyCommonTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            m_tutorials = new Dictionary <int, List <Tuple <string, MyWorldInfo> > >();

            Dictionary <string, int> trainingLevels = new Dictionary <string, int>();

            trainingLevels["Basic"] = (int)TrainingLevel.BASIC;
            //trainingLevels["Intermediate"] = (int)TrainingLevel.INTERMEDIATE;
            //trainingLevels["Advanced"] = (int)TrainingLevel.ADVANCED;
            trainingLevels["Planetary"] = (int)TrainingLevel.PLANETARY;

            loadListRes.AvailableSaves.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));
            foreach (var loadedRes in loadListRes.AvailableSaves)
            {
                var splitted      = loadedRes.Item1.Split('\\');
                var trainingLevel = splitted[splitted.Length - 2];
                if (!MyFakes.ENABLE_XMAS15_CONTENT && splitted[splitted.Length - 1].Contains("Tutorial 08 - Climbing on Planets"))
                {
                    continue;
                }
                if (!MyFakes.ENABLE_XMAS15_CONTENT && splitted[splitted.Length - 1].Contains("Tutorial 11 - Mining Planets and Ship Recovery"))
                {
                    continue;
                }
                if (trainingLevels.ContainsKey(trainingLevel))
                {
                    int id = trainingLevels[trainingLevel];
                    if (!m_tutorials.ContainsKey(id))
                    {
                        m_tutorials[id] = new List <Tuple <string, MyWorldInfo> >();
                    }
                    m_tutorials[id].Add(loadedRes);
                }
            }

            SelectTutorials();

            m_state = StateEnum.ListLoaded;

            screen.CloseScreen();
        }
        private void endWorkshop(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadResult = (LoadWorkshopResult)result;

            m_subscribedScenarios = loadResult.SubscribedScenarios;
            foreach (var item in loadResult.SubscribedScenarios)
            {
                MyWorldInfo wi = new MyWorldInfo();
                wi.SessionName = item.Title;
                wi.Briefing    = item.Description;
                wi.WorkshopId  = item.PublishedFileId;
                m_availableSavesWorkshop.Add(new Tuple <string, MyWorldInfo>(WORKSHOP_PATH_TAG, wi));
            }
            m_availableSavesWorkshop.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));
            AfterPartLoaded();
            screen.CloseScreen();
        }
        private void endKeens(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            m_availableSavesKeens = loadListRes.AvailableSaves;
            m_availableSavesKeens.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MySpaceTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }
            AfterPartLoaded();
            screen.CloseScreen();
        }
Beispiel #12
0
        private void ConfigForm_Load(object sender, EventArgs e)
        {
            // hide everything related to service
            HasToExit = false;
            serviceStatusLabel.Hide();
            serviceStatusValueLabel.Hide();
            restartServiceButton.Hide();
            stopServiceButton.Hide();

            Text = MyPerServerSettings.GameName + " - Dedicated server configurator";

            if (m_isService)
            {
                // show everything that is related to service
                restartServiceButton.Show();
                stopServiceButton.Show();
                serviceStatusLabel.Show();
                serviceStatusValueLabel.Show();
                serviceStatusValueLabel.Text = "";

                // update service label
                updateServiceStatus();
            }

            m_loadWorldsAsync      = new MyLoadListResult();
            worldListTimer.Enabled = true;

            if (MyFakes.ENABLE_BATTLE_SYSTEM && MyPerGameSettings.Game == GameEnum.ME_GAME)
            {
                battleButton.Show();
                battleButton.Enabled = false;

                string officialBattleMaps = Path.Combine(MyFileSystem.ContentPath, "CastleSiege");
                m_loadBattlesAsync      = new MyBattleLoadListResult(officialBattleMaps, null);
                battleListTimer.Enabled = true;
            }
            else
            {
                battleButton.Hide();
                battleListTimer.Enabled = false;
            }

            MySandboxGame.ConfigDedicated.Load();

            UpdateLoadedData();
        }
Beispiel #13
0
        private void endPublicLobbiesAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadResult = (LoadLobbyListResult)result;

            m_lobbies.Clear();

            if (m_showOnlyFriends.IsChecked)
            {
                LobbySearch.AddFriendLobbies(m_lobbies);
            }
            else
            {
                LobbySearch.AddFriendLobbies(m_lobbies);
                LobbySearch.AddPublicLobbies(m_lobbies);
            }

            RefreshGameList();
            screen.CloseScreen();
        }
        private void endAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            m_availableSaves = loadListRes.AvailableSaves;

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MySpaceTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            if (m_availableSaves.Count != 0)
            {
                RefreshGameList();
            }
            screen.CloseScreen();
            m_state = StateEnum.ListLoaded;
        }
Beispiel #15
0
        private void worldListTimer_Tick(object sender, EventArgs e)
        {
            if (m_loadWorldsAsync.IsCompleted)
            {
                worldListTimer.Enabled = false;

                FillWorldsList();

                loadGameButton.Checked  = !string.IsNullOrEmpty(MySandboxGame.ConfigDedicated.LoadWorld);
                startGameButton.Checked = !loadGameButton.Checked;

                m_canChangeStartType = true;
                startTypeRadio_CheckedChanged(null, null);

                if (MyFakes.ENABLE_BATTLE_SYSTEM && MyPerGameSettings.Game == GameEnum.ME_GAME)
                {
                    string officialBattleMaps = Path.Combine(MyFileSystem.ContentPath, "CastleSiege");
                    m_loadBattlesAsync      = new MyBattleLoadListResult(officialBattleMaps, null);
                    battleListTimer.Enabled = true;
                }
            }
        }
Beispiel #16
0
        // Checks for corrupted worlds and refreshes the table cells.
        private void OnLoadingFinished(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            m_scenarioTypesGroup.Clear();
            m_scenarioTypesList.Clear();

            foreach (var saveTuple in loadListRes.AvailableSaves)
            {
                var button = new MyGuiControlContentButton(saveTuple.Item2.SessionName,
                                                           Path.Combine(saveTuple.Item1, "thumb.jpg"))
                {
                    UserData = saveTuple.Item1
                };

                m_scenarioTypesGroup.Add(button);
                m_scenarioTypesList.Controls.Add(button);
            }

            SetDefaultValues();

            // Close the loading miniscreen
            screen.CloseScreen();
        }
 protected override void ProgressStart()
 {
     m_asyncResult = m_beginAction();
 }
        private void endAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            m_listNeedsReload = false;

            var loadResult = (LoadListResult)result;
            m_subscribedMods = loadResult.SubscribedMods;
            m_worldMods = loadResult.WorldMods;
            RefreshGameList();
            screen.CloseScreen();
        }
 private void endWorkshop(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
 {
     var loadResult = (LoadWorkshopResult)result;
     m_subscribedScenarios = loadResult.SubscribedScenarios;
     foreach(var item in loadResult.SubscribedScenarios)
     {
         MyWorldInfo wi = new MyWorldInfo();
         wi.SessionName = item.Title;
         wi.Briefing = item.Description;
         wi.WorkshopId = item.PublishedFileId;
         m_availableSavesWorkshop.Add(new Tuple<string, MyWorldInfo>(WORKSHOP_PATH_TAG, wi));
     }
     m_availableSavesWorkshop.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));
     AfterPartLoaded();
     screen.CloseScreen();
 }
        private void ConfigForm_Load(object sender, EventArgs e)
        {
            // hide everything related to service
            HasToExit = false;
            serviceStatusLabel.Hide();
            serviceStatusValueLabel.Hide();
            restartServiceButton.Hide();
            stopServiceButton.Hide();

            if (m_isService)
            {
                // show everything that is related to service
                restartServiceButton.Show();
                stopServiceButton.Show();
                serviceStatusLabel.Show();
                serviceStatusValueLabel.Show();
                serviceStatusValueLabel.Text = "";

                // update service label
                updateServiceStatusLabel();
            }

            MyLoadListResult worldList = new MyLoadListResult();

            m_loadWorldsAsync = new MyLoadListResult();
            timer1.Enabled    = true;

            MySandboxGame.ConfigDedicated.Load();

            IPTextBox.Text               = MySandboxGame.ConfigDedicated.IP;
            QueryPortUD.Value            = MySandboxGame.ConfigDedicated.ServerPort;
            serverNameTextBox.Text       = MySandboxGame.ConfigDedicated.ServerName;
            worldNameTextBox.Text        = MySandboxGame.ConfigDedicated.WorldName;
            SteamGroupID.Text            = MySandboxGame.ConfigDedicated.GroupID.ToString();
            adminIDs.Text                = string.Join(Environment.NewLine, MySandboxGame.ConfigDedicated.Administrators.ToArray());
            bannedIDs.Text               = string.Join(Environment.NewLine, MySandboxGame.ConfigDedicated.Banned.ToArray());
            modIdsTextBox.Text           = string.Join(Environment.NewLine, MySandboxGame.ConfigDedicated.Mods.ToArray());
            pauseWhenEmptyCHB.Checked    = MySandboxGame.ConfigDedicated.PauseGameWhenEmpty;
            ignoreLastSessionCHB.Checked = MySandboxGame.ConfigDedicated.IgnoreLastSession;

            scenarioCB.Items.Clear();

            var scenarioId = MySandboxGame.ConfigDedicated.Scenario;

            MyDefinitionManager.Static.LoadScenarios();

            foreach (var scenario in MyDefinitionManager.Static.GetScenarioDefinitions())
            {
                ScenarioItem item = new ScenarioItem()
                {
                    Definition = scenario
                };
                scenarioCB.Items.Add(item);
                if (scenario.Id == scenarioId)
                {
                    scenarioCB.SelectedItem = item;
                }
            }
            if (scenarioCB.Items.Count > 0 && scenarioCB.SelectedIndex == -1)
            {
                scenarioCB.SelectedIndex = 0;
            }

            asteroidAmountUD.Value = MySandboxGame.ConfigDedicated.AsteroidAmount;
        }
        private void endKeens(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;
            m_availableSavesKeens = loadListRes.AvailableSaves;
            m_availableSavesKeens.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MyCommonTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }
            AfterPartLoaded();
            screen.CloseScreen();
        }
 private void endLocal(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
 {
     var loadListRes = (MyLoadListResult)result;
     loadListRes.AvailableSaves.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));
     m_availableSavesLocal = loadListRes.AvailableSaves;
     AfterPartLoaded();
     screen.CloseScreen();
 }
Beispiel #23
0
 public void RefreshWorldsList()
 {
     m_loadWorldsAsync      = new MyLoadWorldInfoListResult();
     m_customWorldsAsync    = new MyLoadWorldInfoListResult(Path.Combine(MyFileSystem.ContentPath, "CustomWorlds"));
     worldListTimer.Enabled = true;
 }
        // Checks for corrupted worlds and refreshes the table cells.
        private void OnLoadingFinished(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            m_loadedDirectories.Add(CurrentDirectory);
            foreach (var saveTuple in loadListRes.AvailableSaves)
            {
                if(!m_loadedWorldsByFilePaths.ContainsKey(saveTuple.Item1))
                {
                    // add if new
                    m_loadedWorldsByFilePaths.Add(saveTuple.Item1, saveTuple.Item2);
                }
                else
                {
                    // Rewrite if forced
                    m_loadedWorldsByFilePaths[saveTuple.Item1] = saveTuple.Item2;
                }
            }

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MyCommonTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            RefreshAfterLoaded();

            // Close the loading miniscreen
            screen.CloseScreen();
        }
        private void endAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;
            m_availableSaves = loadListRes.AvailableSaves;

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MySpaceTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            if (m_availableSaves.Count != 0)
            {
                RefreshGameList();
            }
            screen.CloseScreen();
            m_state = StateEnum.ListLoaded;
        }
        static void endActionDownloadMods(IMyAsyncResult iResult, MyGuiScreenProgressAsync screen)
        {
            screen.CloseScreen();

            var result = (DownloadModsResult)iResult;

            if (!result.Success)
            {
                MySandboxGame.Log.WriteLine(string.Format("Error downloading mods"));
            }
            result.callback(result.Success);
        }
        private void endActionLoadSaves(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            screen.CloseScreen();

            var selectedRow = m_worldsTable.SelectedRow;
            var world = (MySteamWorkshop.SubscribedItem)selectedRow.UserData;



            string safeName = MyUtils.StripInvalidChars(world.Title);
            var tempSessionPath = MyLocalCache.GetSessionSavesPath(safeName, false, false);
            if (Directory.Exists(tempSessionPath))
            {
                OverwriteWorldDialog();
            }
            else
            {
                MySteamWorkshop.CreateWorldInstanceAsync(world, MySteamWorkshop.MyWorkshopPathInfo.CreateWorldInfo(), false, delegate(bool success, string sessionPath)
                {
                    if (success)
                    {
                        OnSuccess(sessionPath);
                    }
                });
            }
        }
Beispiel #28
0
 private static void endAction(IMyAsyncResult arg1, MyGuiScreenProgressAsync arg2)
 {
     Logger.WriteLine("closing download screen");
     arg2.CloseScreen();
     _instance.Dispose();
 }
Beispiel #29
0
 protected override void ProgressStart()
 {
     m_asyncResult = m_beginAction();
 }
        static void endActionCreateWorldInstance(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            screen.CloseScreen();

            var createdWorldResult = (CreateWorldResult)result;

            var callback = createdWorldResult.Callback;

            if (callback != null)
                callback(createdWorldResult.Success, createdWorldResult.m_createdSessionPath);
        }
        private void EndTutorialLoading(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MyCommonTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            m_tutorials = new Dictionary<int, List<Tuple<string, MyWorldInfo>>>();

            Dictionary<string, int> trainingLevels = new Dictionary<string, int>();
            trainingLevels["Basic"] = (int)TrainingLevel.BASIC;
            //trainingLevels["Intermediate"] = (int)TrainingLevel.INTERMEDIATE;
            //trainingLevels["Advanced"] = (int)TrainingLevel.ADVANCED;
            trainingLevels["Planetary"] = (int)TrainingLevel.PLANETARY;

            loadListRes.AvailableSaves.Sort((x, y) => x.Item2.SessionName.CompareTo(y.Item2.SessionName));
            foreach (var loadedRes in loadListRes.AvailableSaves)
            {
                var splitted = loadedRes.Item1.Split('\\');
                var trainingLevel = splitted[splitted.Length - 2];
                if (!MyFakes.ENABLE_XMAS15_CONTENT && splitted[splitted.Length - 1].Contains("Tutorial 08 - Climbing on Planets"))
                    continue;
                if (!MyFakes.ENABLE_XMAS15_CONTENT && splitted[splitted.Length - 1].Contains("Tutorial 11 - Mining Planets and Ship Recovery"))
                    continue;
                if (trainingLevels.ContainsKey(trainingLevel))
                {
                    int id = trainingLevels[trainingLevel];
                    if (!m_tutorials.ContainsKey(id))
                        m_tutorials[id] = new List<Tuple<string, MyWorldInfo>>();
                    m_tutorials[id].Add(loadedRes);
                }
            }

            SelectTutorials();

            m_state = StateEnum.ListLoaded;

            screen.CloseScreen();
        }
 private static void endActionPublish(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
 {
     screen.CloseScreenNow();
     if (m_onPublishingFinished != null)
         m_onPublishingFinished(m_publishSuccess, m_publishResult, m_publishedFileId);
     m_publishSuccess = false;
     m_publishResult = Result.Fail;
     m_onPublishingFinished = null;
     m_asyncPublishScreen = null;
 }
        private void endAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadListRes = (MyLoadListResult)result;
            m_availableSaves = loadListRes.AvailableSaves;

            if (loadListRes.ContainsCorruptedWorlds)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                    messageText: MyTexts.Get(MyCommonTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            if (m_availableSaves.Count != 0)
            {
                RefreshGameList();
                m_continueLastSave.Enabled = true;
            }
            else
            {
                m_continueLastSave.Enabled = false;
                CloseScreenNow(); // close right away to avoid seeing the screen at all
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(messageText: MyTexts.Get(MyCommonTexts.MessageBoxTextNoSavedWorlds)));
            }
            screen.CloseScreen();
            m_state = StateEnum.ListLoaded;
        }
        private void endPublicLobbiesAction(IMyAsyncResult result, MyGuiScreenProgressAsync screen)
        {
            var loadResult = (LoadLobbyListResult)result;
            m_lobbies.Clear();

            if (m_showOnlyFriends.IsChecked)
            {
                LobbySearch.AddFriendLobbies(m_lobbies);
            }
            else
            {
                LobbySearch.AddFriendLobbies(m_lobbies);
                LobbySearch.AddPublicLobbies(m_lobbies);
            }

            RefreshGameList();
            screen.CloseScreen();
        }
Beispiel #35
0
 private static void endActionPublishUGC(IMyAsyncResult iResult, MyGuiScreenProgressAsync screen)
 {
     screen.CloseScreenNow();
     PublishUGCResult result = (PublishUGCResult)iResult;
     result.CallbackOnFinished(result.PublishedFileId.HasValue, result.PublishedFileId);
 }
Beispiel #36
0
 public void RefreshWorldsList()
 {
     m_loadWorldsAsync      = new MyLoadWorldInfoListResult();
     worldListTimer.Enabled = true;
 }
        private void ConfigForm_Load(object sender, EventArgs e)
        {
            // hide everything related to service
            HasToExit = false;
            serviceStatusLabel.Hide();
            serviceStatusValueLabel.Hide();
            restartServiceButton.Hide();
            stopServiceButton.Hide();

            if (m_isService)
            {
                // show everything that is related to service
                restartServiceButton.Show();
                stopServiceButton.Show();
                serviceStatusLabel.Show();
                serviceStatusValueLabel.Show();
                serviceStatusValueLabel.Text = "";

                // update service label
                updateServiceStatusLabel();
            }

            MyLoadListResult worldList = new MyLoadListResult();

            m_loadWorldsAsync = new MyLoadListResult();
            timer1.Enabled = true;

            MySandboxGame.ConfigDedicated.Load();

            IPTextBox.Text = MySandboxGame.ConfigDedicated.IP;
            QueryPortUD.Value = MySandboxGame.ConfigDedicated.ServerPort;
            serverNameTextBox.Text = MySandboxGame.ConfigDedicated.ServerName;
            worldNameTextBox.Text = MySandboxGame.ConfigDedicated.WorldName;
            SteamGroupID.Text = MySandboxGame.ConfigDedicated.GroupID.ToString();
            adminIDs.Text = string.Join(Environment.NewLine, MySandboxGame.ConfigDedicated.Administrators.ToArray());
            bannedIDs.Text = string.Join(Environment.NewLine, MySandboxGame.ConfigDedicated.Banned.ToArray());
            modIdsTextBox.Text = string.Join(Environment.NewLine, MySandboxGame.ConfigDedicated.Mods.ToArray());
            pauseWhenEmptyCHB.Checked = MySandboxGame.ConfigDedicated.PauseGameWhenEmpty;
            ignoreLastSessionCHB.Checked = MySandboxGame.ConfigDedicated.IgnoreLastSession;

            scenarioCB.Items.Clear();

            var scenarioId = MySandboxGame.ConfigDedicated.Scenario;
            
            MyDefinitionManager.Static.LoadScenarios();

            foreach (var scenario in MyDefinitionManager.Static.GetScenarioDefinitions())
            {
                ScenarioItem item = new ScenarioItem() { Definition = scenario };
                scenarioCB.Items.Add(item);
                if (scenario.Id == scenarioId)
                    scenarioCB.SelectedItem = item;

            }
            if (scenarioCB.Items.Count > 0 && scenarioCB.SelectedIndex == -1)
                scenarioCB.SelectedIndex = 0;

            asteroidAmountUD.Value = MySandboxGame.ConfigDedicated.AsteroidAmount;
        }