Exemple #1
0
        /// <summary>
        /// Gets the specific load page associated with a save index.
        /// </summary>
        /// <param name="previous">The previous.</param>
        /// <param name="index">The save index.</param>
        /// <returns></returns>
        private Page GetSpecificLoadPage(Page previous, int index)
        {
            Party  party;
            Camp   camp;
            string saveName;

            try {
                RestoreCamp(SaveLoad.Load(index, index.ToString()), out camp, out party, out saveName);
            } catch (Exception e) {
                previous.AddText(string.Format("Save {0} is corrupted, deleting...\n{1}", index, e.Message));
                SaveLoad.DeleteSave(index);
                return(GetImportPage(previous, index));
            }
            Page page = new Page(saveName);

            page.Body    = string.Format("What would you like to do with file {0}?", index);
            page.Actions = new IButtonable[] {
                PageUtil.GenerateBack(previous).SetCondition(() => !isUploadingToGameJolt),
                GetLoadProcess(camp, index).SetCondition(() => !isUploadingToGameJolt),
                PageUtil.GetConfirmationGrid(
                    previous,
                    previous,
                    GetDeleteProcess(previous, index),
                    "Delete",
                    string.Format("Delete file {0}.", index),
                    string.Format("Are you sure you want to delete file {0}?\n{1}", index, saveName)
                    ).SetCondition(() => !isUploadingToGameJolt),
                GetExportPage(previous, index),
            };
            page.AddCharacters(Side.RIGHT, party.Collection);
            return(page);
        }
Exemple #2
0
        private void Setup(Page previous, Party party, Flags flags)
        {
            Page p = Get(ROOT_INDEX);

            p.Icon    = Util.GetSprite("save");
            p.OnEnter = () => {
                WorldSave currentGame = new WorldSave(party.GetSaveObject(), flags.GetSaveObject());
                p.Right.Clear();
                p.AddCharacters(Side.LEFT, party.Collection);
                p.HasInputField = false;
                List <IButtonable> buttons = new List <IButtonable>();
                buttons.Add(PageUtil.GenerateBack(previous));
                for (int i = 0; i < SaveLoad.MAX_SAVE_FILES; i++)
                {
                    if (SaveLoad.IsSaveUsed(i))
                    {
                        buttons.Add(GetOverrideSavePage(p, i, currentGame)); // oink
                    }
                    else
                    {
                        buttons.Add(
                            GetSaveProcess(
                                p,
                                string.Format("<color=grey>FILE {0}</color>", i),
                                i,
                                currentGame,
                                string.Format("Save to file {0}.", i),
                                string.Format("Saved to file {0}.", i)
                                )
                            );
                    }
                }
                buttons.Add(
                    PageUtil.GetConfirmationGrid(
                        p,
                        p,
                        GetExitProcess(),
                        "Exit",
                        "Return to the main menu",
                        "Are you sure you want to return to the main menu?\n<color=red>Any unsaved progress will be lost.</color>"
                        )
                    );
                p.Actions = buttons;
            };
        }