Esempio n. 1
0
        private bool DeleteSave(GUIButton button, object obj)
        {
            string saveFile = obj as string;

            if (obj == null)
            {
                return(false);
            }

            SaveUtil.DeleteSave(saveFile);
            prevSaveFiles?.Remove(saveFile);
            UpdateLoadMenu(prevSaveFiles);

            return(true);
        }
Esempio n. 2
0
        private bool DeleteSave(GUIButton button, object obj)
        {
            string saveFile = obj as string;

            if (obj == null)
            {
                return(false);
            }

            SaveUtil.DeleteSave(saveFile);

            UpdateLoadScreen();

            return(true);
        }
        private bool DeleteSave(GUIButton button, object obj)
        {
            string saveFile = obj as string;

            if (obj == null)
            {
                return(false);
            }

            string header = TextManager.Get("deletedialoglabel");
            string body   = TextManager.GetWithVariable("deletedialogquestion", "[file]", Path.GetFileNameWithoutExtension(saveFile));

            EventEditorScreen.AskForConfirmation(header, body, () =>
            {
                SaveUtil.DeleteSave(saveFile);
                prevSaveFiles?.RemoveAll(s => s.StartsWith(saveFile));
                UpdateLoadMenu(prevSaveFiles.ToList());
                return(true);
            });

            return(true);
        }
        private IEnumerable <object> ResetCampaignMode()
        {
            float waittime = 0f;

            GameMain.NetLobbyScreen.SelectedModeIndex = 0;
#if Client
            GameMain.NetLobbyScreen.modeList.Select(0, true);
#endif

            GameMain.NetLobbyScreen.ToggleCampaignMode(false);
            SaveUtil.DeleteSave(GameMain.GameSession.SavePath);

            GameMain.NilMod.CampaignStart = true;

            if (GameMain.Server.AutoRestart)
            {
                GameMain.Server.AutoRestartTimer += 11f;
            }

            while (waittime < 11f)
            {
                waittime += CoroutineManager.DeltaTime;
                yield return(CoroutineStatus.Running);
            }

            StartCampaignSetup(true);
            GameMain.NetLobbyScreen.SelectedModeIndex = 2;
            SetDelegates();

            if (GameMain.Server.AutoRestart)
            {
                GameMain.Server.AutoRestartTimer = GameMain.Server.AutoRestartInterval;
            }

            yield return(CoroutineStatus.Success);
        }