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);
                    }
                });
            }
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
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();
        }
Ejemplo n.º 9
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(MySpaceTexts.SomeWorldFilesCouldNotBeLoaded),
                    messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError));
                MyGuiSandbox.AddScreen(messageBox);
            }

            if (m_availableSaves.Count != 0)
            {
                RefreshGameList();
            }
            screen.CloseScreen();
            m_state = StateEnum.ListLoaded;
        }
Ejemplo n.º 10
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();
        }
        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;
        }
        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);
                    }
                });
            }
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        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 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();
 }
        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 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();
        }
Ejemplo n.º 20
0
        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();
        }
        // 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(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;
        }