Beispiel #1
0
        public static string GetLastSessionPath()
        {
            if (MyFinalBuildConstants.IS_OFFICIAL)
            {
                return(null);
            }

            if (!File.Exists(LastSessionPath))
            {
                return(null);
            }

            MyObjectBuilder_LastSession lastSession = null;

            Sandbox.Common.ObjectBuilders.Serializer.MyObjectBuilderSerializer.DeserializeXML(LastSessionPath, out lastSession);
            if (lastSession == null)
            {
                return(null);
            }

            if (!String.IsNullOrEmpty(lastSession.Path))
            {
                string path = Path.Combine(lastSession.IsContentWorlds ? MyFileSystem.ContentPath : MyFileSystem.SavesPath, lastSession.Path);
                if (Directory.Exists(path))
                {
                    return(path);
                }
            }

            return(null);
        }
Beispiel #2
0
 private void JoinServer(MyObjectBuilder_LastSession mySession)
 {
     try
     {
         MyGuiScreenProgress prog = new MyGuiScreenProgress(MyTexts.Get(MyCommonTexts.DialogTextCheckServerStatus));
         MyGuiSandbox.AddScreen(prog);
         MyGameService.OnPingServerResponded       += OnPingSuccess;
         MyGameService.OnPingServerFailedToRespond += OnPingFailure;
         MyGameService.PingServer(mySession.GetConnectionString());
         void OnPingFailure(object sender, object data)
         {
             MyGuiSandbox.RemoveScreen(prog);
             MySandboxGame.Static.ServerFailedToRespond(sender, data);
             MyGameService.OnPingServerResponded       -= OnPingSuccess;
             MyGameService.OnPingServerFailedToRespond -= OnPingFailure;
         }
         void OnPingSuccess(object sender, MyGameServerItem item)
         {
             MyGuiSandbox.RemoveScreen(prog);
             MySandboxGame.Static.ServerResponded(sender, item);
             MyGameService.OnPingServerResponded       -= OnPingSuccess;
             MyGameService.OnPingServerFailedToRespond -= OnPingFailure;
         }
     }
     catch (Exception ex)
     {
         MyLog.Default.WriteLine(ex);
         MyGuiSandbox.Show(MyTexts.Get(MyCommonTexts.MultiplayerJoinIPError), MyCommonTexts.MessageBoxCaptionError);
     }
 }
Beispiel #3
0
        public static bool SaveLastSessionInfo(string sessionPath, bool isOnline, bool isLobby, string gameName, string serverIP, int serverPort)
        {
            ulong num;
            MyObjectBuilder_LastSession objectBuilder = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_LastSession>();

            objectBuilder.IsOnline = isOnline;
            objectBuilder.IsLobby  = isLobby;
            if (!isOnline)
            {
                if (sessionPath != null)
                {
                    objectBuilder.Path            = sessionPath;
                    objectBuilder.GameName        = gameName;
                    objectBuilder.IsContentWorlds = sessionPath.StartsWith(MyFileSystem.ContentPath, StringComparison.InvariantCultureIgnoreCase);
                }
            }
            else if (isLobby)
            {
                objectBuilder.GameName = gameName;
                objectBuilder.ServerIP = serverIP;
            }
            else
            {
                objectBuilder.GameName   = gameName;
                objectBuilder.ServerIP   = serverIP;
                objectBuilder.ServerPort = serverPort;
            }
            return(MyObjectBuilderSerializer.SerializeXML(LastSessionPath, false, objectBuilder, out num, null));
        }
Beispiel #4
0
 private void CheckContinueButtonVisibility()
 {
     if (m_continueButton != null)
     {
         MyObjectBuilder_LastSession lastSession = MyLocalCache.GetLastSession();
         bool visible = lastSession != null && (lastSession.Path == null || Directory.Exists(lastSession.Path)) && (!lastSession.IsLobby || MyGameService.LobbyDiscovery.ContinueToLobbySupported);
         m_continueButton.Visible = visible;
     }
 }
Beispiel #5
0
    private void CreateMainMenu(Vector2 leftButtonPositionOrigin, out Vector2 lastButtonPosition)
    {
        base.GamepadHelpTextId     = MySpaceTexts.MainMenuScreen_Help_Screen;
        base.EnabledBackgroundFade = false;
        MyGuiControlButton myGuiControlButton = null;
        int num = (MyPerGameSettings.MultiplayerEnabled ? 7 : 6);
        MyObjectBuilder_LastSession lastSession = MyLocalCache.GetLastSession();

        if (lastSession != null && (lastSession.Path == null || MyPlatformGameSettings.GAME_SAVES_TO_CLOUD || Directory.Exists(lastSession.Path)) && (!lastSession.IsLobby || MyGameService.LobbyDiscovery.ContinueToLobbySupported))
        {
            m_continueButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA - MyGuiConstants.MENU_BUTTONS_POSITION_DELTA / 2f, MyCommonTexts.ScreenMenuButtonContinueGame, OnContinueGameClicked);
            Controls.Add(m_continueButton);
            m_elementGroup.Add(m_continueButton);
            GenerateContinueTooltip(lastSession, m_continueButton, new Vector2(0.003f, -0.0025f));
            m_continueButton.FocusChanged += FocusChangedContinue;
        }
        else
        {
            num--;
        }
        myGuiControlButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonCampaign, OnClickNewGame);
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        myGuiControlButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonLoadGame, OnClickLoad);
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        if (MyPerGameSettings.MultiplayerEnabled)
        {
            myGuiControlButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonJoinGame, OnJoinWorld);
            Controls.Add(myGuiControlButton);
            m_elementGroup.Add(myGuiControlButton);
        }
        myGuiControlButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonOptions, OnClickOptions);
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        lastButtonPosition = myGuiControlButton.Position;

        myGuiControlButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonOptions, OnClickMenuPacks);
        Controls.Add(myGuiControlButton);
        m_elementGroup.Add(myGuiControlButton);
        lastButtonPosition = myGuiControlButton.Position;

        if (MyFakes.ENABLE_MAIN_MENU_INVENTORY_SCENE)
        {
            myGuiControlButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonInventory, OnClickInventory);
            Controls.Add(myGuiControlButton);
            m_elementGroup.Add(myGuiControlButton);
            lastButtonPosition = myGuiControlButton.Position;
        }
        if (!MyPlatformGameSettings.LIMITED_MAIN_MENU)
        {
            m_exitGameButton = MakeButton(leftButtonPositionOrigin - num-- *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyCommonTexts.ScreenMenuButtonExitToWindows, OnClickExitToWindows);
            Controls.Add(m_exitGameButton);
            m_elementGroup.Add(m_exitGameButton);
            lastButtonPosition = m_exitGameButton.Position;
        }
    }
Beispiel #6
0
 private static string CheckLastSession(MyObjectBuilder_LastSession lastSession)
 {
     if ((lastSession != null) && !string.IsNullOrEmpty(lastSession.Path))
     {
         string path = Path.Combine(lastSession.IsContentWorlds ? MyFileSystem.ContentPath : MyFileSystem.SavesPath, lastSession.Path);
         if (Directory.Exists(path))
         {
             return(path);
         }
     }
     return(null);
 }
Beispiel #7
0
        public static MyObjectBuilder_LastSession GetLastSession()
        {
            if ((LastSessionOverride != null) && (CheckLastSession(LastSessionOverride) != null))
            {
                return(LastSessionOverride);
            }
            if (!File.Exists(LastSessionPath))
            {
                return(null);
            }
            MyObjectBuilder_LastSession objectBuilder = null;

            MyObjectBuilderSerializer.DeserializeXML <MyObjectBuilder_LastSession>(LastSessionPath, out objectBuilder);
            return(objectBuilder);
        }
Beispiel #8
0
        public static bool SaveLastSessionInfo(string sessionPath)
        {
            //if (MyFinalBuildConstants.IS_OFFICIAL)
            //    return true;

            MyObjectBuilder_LastSession lastSession = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_LastSession>();

            if (sessionPath != null)
            {
                lastSession.Path            = sessionPath;
                lastSession.IsContentWorlds = sessionPath.StartsWith(MyFileSystem.ContentPath, StringComparison.InvariantCultureIgnoreCase);
            }

            ulong sizeInBytes;

            return(MyObjectBuilderSerializer.SerializeXML(LastSessionPath, false, lastSession, out sizeInBytes));
        }
Beispiel #9
0
    private string GetThumbnail(MyObjectBuilder_LastSession session)
    {
        string text = session?.Path;

        if (text == null)
        {
            return(null);
        }
        if (Directory.Exists(text + MyGuiScreenLoadSandbox.CONST_BACKUP))
        {
            string[] directories = Directory.GetDirectories(text + MyGuiScreenLoadSandbox.CONST_BACKUP);
            if (Enumerable.Any(directories))
            {
                string text2 = Path.Combine(Enumerable.Last(directories), MyTextConstants.SESSION_THUMB_NAME_AND_EXTENSION);
                if (File.Exists(text2) && new FileInfo(text2).Length > 0)
                {
                    return(text2);
                }
            }
        }
        string text3 = Path.Combine(text, MyTextConstants.SESSION_THUMB_NAME_AND_EXTENSION);

        if (File.Exists(text3) && new FileInfo(text3).Length > 0)
        {
            return(text3);
        }
        if (MyPlatformGameSettings.GAME_SAVES_TO_CLOUD)
        {
            byte[] array = MyGameService.LoadFromCloud(MyCloudHelper.Combine(MyCloudHelper.LocalToCloudWorldPath(text + "/"), MyTextConstants.SESSION_THUMB_NAME_AND_EXTENSION));
            if (array != null)
            {
                try
                {
                    string text4 = Path.Combine(text, MyTextConstants.SESSION_THUMB_NAME_AND_EXTENSION);
                    Directory.CreateDirectory(text);
                    File.WriteAllBytes(text4, array);
                    MyRenderProxy.UnloadTexture(text4);
                    return(text4);
                }
                catch
                {
                }
            }
        }
        return(null);
    }
Beispiel #10
0
    private void GenerateContinueTooltip(MyObjectBuilder_LastSession lastSession, MyGuiControlButton button, Vector2 correction)
    {
        string           thumbnail        = GetThumbnail(lastSession);
        string           text             = ((!lastSession.IsOnline) ? $"{MyTexts.GetString(MyCommonTexts.ToolTipContinueGame)}{Environment.NewLine}{lastSession.GameName}" : $"{MyTexts.GetString(MyCommonTexts.ToolTipContinueGame)}{Environment.NewLine}{lastSession.GameName} - {lastSession.GetConnectionString()}");
        MyGuiControlBase myGuiControlBase = null;

        if (thumbnail != null)
        {
            MyRenderProxy.PreloadTextures(new List <string> {
                thumbnail
            }, TextureType.GUIWithoutPremultiplyAlpha);
        }
        myGuiControlBase          = CreateImageTooltip(thumbnail, text);
        myGuiControlBase.Visible  = false;
        myGuiControlBase.Position = button.Position + new Vector2(0.5f * button.Size.X, -1f * button.Size.Y) + correction;
        m_continueTooltipcontrol  = myGuiControlBase;
        Controls.Add(m_continueTooltipcontrol);
    }
    private void CreateMainMenuControls()
    {
        MyStringId optionsScreen_Help_Menu = MySpaceTexts.OptionsScreen_Help_Menu;
        Vector2    vector = new Vector2(0.001f, (0f - m_size.Value.Y) / 2f + 0.126f);
        int        num    = 0;
        MyObjectBuilder_LastSession lastSession = MyLocalCache.GetLastSession();

        if (lastSession != null && (lastSession.Path == null || MyPlatformGameSettings.GAME_SAVES_TO_CLOUD || Directory.Exists(lastSession.Path)) && (!lastSession.IsLobby || MyGameService.LobbyDiscovery.ContinueToLobbySupported))
        {
            MyGuiControlButton myGuiControlButton = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonContinueGame), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
            {
                MyObjectBuilder_LastSession mySession = MyLocalCache.GetLastSession();
                if (mySession == null)
                {
                    return;
                }
                if (mySession.IsOnline)
                {
                    if (mySession.IsLobby)
                    {
                        MyJoinGameHelper.JoinGame(ulong.Parse(mySession.ServerIP));
                        return;
                    }
                    MyGameService.Service.RequestPermissions(Permissions.Multiplayer, attemptResolution : true, delegate(PermissionResult granted)
                    {
                        switch (granted)
                        {
                        case PermissionResult.Granted:
                            MyGameService.Service.RequestPermissions(Permissions.CrossMultiplayer, attemptResolution : true, delegate(PermissionResult crossGranted)
                            {
                                switch (crossGranted)
                                {
                                case PermissionResult.Granted:
                                    MyGameService.Service.RequestPermissions(Permissions.UGC, attemptResolution : true, delegate(PermissionResult ugcGranted)
                                    {
                                        switch (ugcGranted)
                                        {
                                        case PermissionResult.Granted:
                                            JoinServer(mySession);
                                            break;

                                        case PermissionResult.Error:
                                            MySandboxGame.Static.Invoke(delegate
                                            {
                                                MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                                            }, "New Game screen");
                                            break;
                                        }
                                    });
                                    break;

                                case PermissionResult.Error:
                                    MySandboxGame.Static.Invoke(delegate
                                    {
                                        MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                                    }, "New Game screen");
                                    break;
                                }
                            });
                            break;

                        case PermissionResult.Error:
                            MySandboxGame.Static.Invoke(delegate
                            {
                                MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                            }, "New Game screen");
                            break;
                        }
                    });
                }
                else if (!m_parallelLoadIsRunning)
                {
                    m_parallelLoadIsRunning            = true;
                    MyGuiScreenProgress progressScreen = new MyGuiScreenProgress(MyTexts.Get(MySpaceTexts.ProgressScreen_LoadingWorld));
                    MyScreenManager.AddScreen(progressScreen);
                    Parallel.StartBackground(delegate
                    {
                        MySessionLoader.LoadLastSession();
                    }, delegate
                    {
                        progressScreen.CloseScreen();
                        m_parallelLoadIsRunning = false;
                    });
                }
            });

            myGuiControlButton.GamepadHelpTextId = optionsScreen_Help_Menu;
            Controls.Add(myGuiControlButton);
            m_elementGroup.Add(myGuiControlButton);
        }
        else
        {
            num--;
        }

        MyGuiControlButton myGuiControlButton2 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonCampaign), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
        {
            MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen <MyGuiScreenNewGame>(new object[3] {
                true, true, true
            }));
        });

        myGuiControlButton2.GamepadHelpTextId = optionsScreen_Help_Menu;
        Controls.Add(myGuiControlButton2);
        m_elementGroup.Add(myGuiControlButton2);



        MyGuiControlButton myGuiControlButton3 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonLoadGame), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
        {
            MyGuiSandbox.AddScreen(new MyGuiScreenLoadSandbox());
        });

        myGuiControlButton3.GamepadHelpTextId = optionsScreen_Help_Menu;
        Controls.Add(myGuiControlButton3);
        m_elementGroup.Add(myGuiControlButton3);


        if (MyPerGameSettings.MultiplayerEnabled)
        {
            MyGuiControlButton myGuiControlButton4 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonJoinGame), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
            {
                if (MyGameService.IsOnline)
                {
                    MyGameService.Service.RequestPermissions(Permissions.Multiplayer, attemptResolution : true, delegate(PermissionResult granted)
                    {
                        switch (granted)
                        {
                        case PermissionResult.Granted:
                            MyGameService.Service.RequestPermissions(Permissions.UGC, attemptResolution : true, delegate(PermissionResult ugcGranted)
                            {
                                switch (ugcGranted)
                                {
                                case PermissionResult.Granted:
                                    MyGameService.Service.RequestPermissions(Permissions.CrossMultiplayer, attemptResolution : true, delegate(PermissionResult crossGranted)
                                    {
                                        MyGuiScreenJoinGame myGuiScreenJoinGame = new MyGuiScreenJoinGame(crossGranted == PermissionResult.Granted);
                                        myGuiScreenJoinGame.Closed += joinGameScreen_Closed;
                                        MyGuiSandbox.AddScreen(myGuiScreenJoinGame);
                                    });
                                    break;

                                case PermissionResult.Error:
                                    MySandboxGame.Static.Invoke(delegate
                                    {
                                        MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                                    }, "New Game screen");
                                    break;
                                }
                            });
                            break;

                        case PermissionResult.Error:
                            MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                            break;
                        }
                    });
                }
                else
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.OK, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), messageText: new StringBuilder().AppendFormat(MyTexts.GetString(MyGameService.IsActive ? MyCommonTexts.SteamIsOfflinePleaseRestart : MyCommonTexts.ErrorJoinSessionNoUser), MySession.GameServiceName)));
                }
            });
            myGuiControlButton4.GamepadHelpTextId = optionsScreen_Help_Menu;
            Controls.Add(myGuiControlButton4);
            m_elementGroup.Add(myGuiControlButton4);
        }

        MyGuiControlButton myGuiControlButton5 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonOptions), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
        {
            bool flag = !MyPlatformGameSettings.LIMITED_MAIN_MENU;

            MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen <MyOldOptionsAccessMenu>(new object[1] {
                !flag
            }));
        });

        myGuiControlButton5.GamepadHelpTextId = optionsScreen_Help_Menu;
        Controls.Add(myGuiControlButton5);
        m_elementGroup.Add(myGuiControlButton5);

        if (MyFakes.ENABLE_MAIN_MENU_INVENTORY_SCENE)
        {
            MyGuiControlButton myGuiControlButton6 = new MyGuiControlButton(vector + num++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiControlButtonStyleEnum.Default, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, MyTexts.Get(MyCommonTexts.ScreenMenuButtonInventory), 0.8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_CURSOR_OVER, delegate
            {
                if (MyGameService.IsActive)
                {
                    if (MyGameService.Service.GetInstallStatus(out var _))
                    {
                        if (MySession.Static == null)
                        {
                            MyGuiScreenLoadInventory inventory = MyGuiSandbox.CreateScreen <MyGuiScreenLoadInventory>(Array.Empty <object>());
                            MyGuiScreenLoading screen          = new MyGuiScreenLoading(inventory, null);
                            MyGuiScreenLoadInventory myGuiScreenLoadInventory = inventory;
                            myGuiScreenLoadInventory.OnLoadingAction          = (Action)Delegate.Combine(myGuiScreenLoadInventory.OnLoadingAction, (Action) delegate
                            {
                                MySessionLoader.LoadInventoryScene();
                                MySandboxGame.IsUpdateReady = true;
                                inventory.Initialize(inGame: false, null);
                            });
                            MyGuiSandbox.AddScreen(screen);
                        }
                        else
                        {
                            MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen <MyGuiScreenLoadInventory>(new object[2] {
                                false, null
                            }));
                        }
                    }
                    else
                    {
                        MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.OK, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionInfo), messageText: MyTexts.Get(MyCommonTexts.InventoryScreen_InstallInProgress)));
                    }
                }
                else
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.OK, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), messageText: MyTexts.Get(MyCommonTexts.SteamIsOfflinePleaseRestart)));
                }
            });
Beispiel #12
0
    private void ContinueGameInternal()
    {
        MyObjectBuilder_LastSession mySession = MyLocalCache.GetLastSession();

        if (mySession == null)
        {
            return;
        }
        if (mySession.IsOnline)
        {
            if (mySession.IsLobby)
            {
                MyJoinGameHelper.JoinGame(ulong.Parse(mySession.ServerIP));
                return;
            }
            MyGameService.Service.RequestPermissions(Permissions.Multiplayer, attemptResolution : true, delegate(PermissionResult granted)
            {
                switch (granted)
                {
                case PermissionResult.Granted:
                    MyGameService.Service.RequestPermissions(Permissions.CrossMultiplayer, attemptResolution : true, delegate(PermissionResult crossGranted)
                    {
                        switch (crossGranted)
                        {
                        case PermissionResult.Granted:
                            MyGameService.Service.RequestPermissions(Permissions.UGC, attemptResolution : true, delegate(PermissionResult ugcGranted)
                            {
                                switch (ugcGranted)
                                {
                                case PermissionResult.Granted:
                                    JoinServer(mySession);
                                    break;

                                case PermissionResult.Error:
                                    MySandboxGame.Static.Invoke(delegate
                                    {
                                        MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                                    }, "New Game screen");
                                    break;
                                }
                            });
                            break;

                        case PermissionResult.Error:
                            MySandboxGame.Static.Invoke(delegate
                            {
                                MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                            }, "New Game screen");
                            break;
                        }
                    });
                    break;

                case PermissionResult.Error:
                    MySandboxGame.Static.Invoke(delegate
                    {
                        MyGuiSandbox.Show(MyCommonTexts.XBoxPermission_MultiplayerError, default(MyStringId), MyMessageBoxStyleEnum.Info);
                    }, "New Game screen");
                    break;
                }
            });
        }
        else if (!m_parallelLoadIsRunning)
        {
            m_parallelLoadIsRunning = true;
            MyGuiScreenProgress progressScreen = new MyGuiScreenProgress(MyTexts.Get(MySpaceTexts.ProgressScreen_LoadingWorld));
            MyScreenManager.AddScreen(progressScreen);
            Parallel.StartBackground(delegate
            {
                MySessionLoader.LoadLastSession();
            }, delegate
            {
                progressScreen.CloseScreen();
                m_parallelLoadIsRunning = false;
            });
        }
    }