private void MessageBoxCallback(MyGuiScreenMessageBoxCallbackEnum callbackReturn)
 {
     // retry
     if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.YES)
     {
         var newSaveScreen = new MyGuiScreenEditorSaveProgress(m_sectorIdentifier, m_checkpoint, m_savePlayer, true, true);
         newSaveScreen.Saved      = this.Saved;
         newSaveScreen.SaveFailed = this.SaveFailed;
         MyGuiManager.AddScreen(newSaveScreen);
     }
     // continue without saving
     else if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.NO)
     {
         var handler = SaveFailed;
         if (handler != null)
         {
             handler(this);
         }
     }
 }
 private void MessageBoxCallback(MyGuiScreenMessageBoxCallbackEnum callbackReturn)
 {
     // retry
     if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.YES)
     {
         var newSaveScreen = new MyGuiScreenEditorSaveProgress(m_sectorIdentifier, m_checkpoint, m_savePlayer, true, true);
         newSaveScreen.Saved = this.Saved;
         newSaveScreen.SaveFailed = this.SaveFailed;
         MyGuiManager.AddScreen(newSaveScreen);
     }
     // continue without saving
     else if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.NO)
     {
         var handler = SaveFailed;
         if (handler != null)
         {
             handler(this);
         }
     }
 }
Пример #3
0
 private static void CheckErrors(StringBuilder errors, MyGuiScreenEditorSaveProgress screen)
 {
     if (errors != null)
     {
         var caption = new StringBuilder("Please check missing entities (full list in log). Really save?");
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.MESSAGE, errors, caption, MyTextsWrapperEnum.Yes, MyTextsWrapperEnum.No, (result) =>
         {
             if (result == MyGuiScreenMessageBoxCallbackEnum.YES)
             {
                 MyGuiManager.AddScreen(screen);
             }
             else
             {
                 screen.CloseScreenNow();
             }
         }));
     }
     else
     {
         MyGuiManager.AddScreen(screen);
     }
 }
Пример #4
0
        private MyGuiScreenEditorSaveProgress Save(bool saveSector, string checkpointName, bool asTemplate, bool visibleSave, bool pause)
        {
            MyMwcSectorIdentifier sectorId = MyGuiScreenGamePlay.Static.GetSectorIdentifier();
            bool isEditor = MyGuiScreenGamePlay.Static.IsEditorActive();

            if (CanBeSaved(asTemplate, sectorId, isEditor))
            {
                MyMwcObjectBuilder_Checkpoint checkpoint = GetCheckpointBuilder(saveSector);
                checkpoint.CheckpointName = checkpointName;

                // Need to store actual checkpoint...because when we travel, we receive only sector, not checkpoint
                MyGuiScreenGamePlay.Static.AddEnterSectorResponse(checkpoint, null);

                bool savePlayerShip = MyGuiScreenGamePlay.Static.GetGameType() == MyGuiScreenGamePlayType.EDITOR_STORY ? MyEditor.SavePlayerShip : true;

                if (savePlayerShip && saveSector)
                {
                    UpdatePlayerStartDummy(checkpoint);
                }

                MyHudNotification.MyNotification notification = null;
                if (!visibleSave)
                {
                    notification = new MyHudNotification.MyNotification(Localization.MyTextsWrapperEnum.SavingSectorToServer, 2500);
                    MyHudNotification.AddNotification(notification);
                }

                StringBuilder errors = null;
                if (isEditor)
                {
                    errors = CheckMissingObject(checkpoint);
                }

                MyGuiScreenEditorSaveProgress screen = new MyGuiScreenEditorSaveProgress(sectorId, checkpoint, savePlayerShip, visibleSave, pause);
                //screen.Closed += new MyGuiScreenBase.ScreenHandler((s) => { if (notification != null) notification.Disappear(); });

                CheckErrors(errors, screen);
                return screen;
            }

            return null;
        }