Exemplo n.º 1
0
        /// <summary>
        /// Lets the user select a stat to increase.
        /// </summary>
        /// <param name="previous">The previous page.</param>
        /// <param name="current">The current page.</param>
        /// <param name="characterWhoIsBeingAllocated">The c.</param>
        private void LetUserSelectAStatToIncrease(Page previous, Page current, Character characterWhoIsBeingAllocated)
        {
            List <IButtonable> actions = new List <IButtonable>();

            actions.Add(PageUtil.GenerateBack(previous));

            foreach (StatType st in StatType.ASSIGNABLES)
            {
                if (characterWhoIsBeingAllocated.Stats.HasStat(st))
                {
                    actions.Add(
                        AddStatProcess(current, characterWhoIsBeingAllocated.Stats, st)
                        );
                }
            }

            if (characterWhoIsBeingAllocated.Stats.UnassignedStatPoints > 0)
            {
                current.AddText(string.Format("Select a stat to increase.\nPoints remaining: {0}.", characterWhoIsBeingAllocated.Stats.UnassignedStatPoints));
            }
            else
            {
                current.AddText(string.Format("{0} has no stat points to spend.", characterWhoIsBeingAllocated.Look.DisplayName));
            }
            current.Actions = actions.ToArray();
        }
Exemplo n.º 2
0
        private void CreditsPage(Page previous)
        {
            Page page = Root;

            Root.Actions = new IButtonable[] { PageUtil.GenerateBack(previous) };
            page.Icon    = Util.GetSprite("person");

            //// Characters
            //page.AddCharacters(Side.LEFT, new CreditsDummy(Breed.CREATOR, 5, "eternal", "spell-book", "programmer, design, and writing.\nlikes lowercase a little <i>too</i> much."));
            //page.AddCharacters(Side.LEFT, new CreditsDummy(Breed.TESTER, 5, "Duperman", "shiny-apple", "Explorer of nozama."));
            //page.AddCharacters(Side.LEFT, new CreditsDummy(Breed.TESTER, 99, "Rohan", "swap-bag", "Best hunter in the critically acclaimed game\n\'Ace Prunes 3\'"));
            //page.AddCharacters(Side.RIGHT, new CreditsDummy(Breed.TESTER, 5, "Vishal", "round-shield", "Hacked the save file to give himself 2,147,483,647 gold in an attempt to buy the tome."));
            //page.AddCharacters(Side.RIGHT, new CreditsDummy(Breed.TESTER, 5, "One of Vishal's friends", "hourglass", "Got Vitality nerfed to give 2 health, from 10."));
            //page.AddCharacters(Side.RIGHT, new CreditsDummy(Breed.TESTER, 5, "cjdudeman14", "round-shield", "Open beta tester. Bug slayer. Attempted to kill that which is unkillable."));
            //page.AddCharacters(Side.RIGHT, new CreditsDummy(Breed.COMMENTER, 5, "UnserZeitMrGlinko", "gladius", "\"more talking!\" ~UZMG"));

            //page.OnEnter += () => {
            //    page.AddText(
            //        "<Tools>\nMade with Unity and the NUnit testing framework.",
            //        "<Music>\nFrom OpenGameArt, Trevor Lentz, cynicmusic.com",
            //        "<Sound Effects>\nSourced from Freesound, SoundBible, and OpenGameArt.",
            //        "<Icons>\nSourced from http://Game-icons.net.",
            //        "<Fonts>\nMain: BPmono by George Triantafyllakos\nTextboxes: Anonymous Pro by Mark Simonson\nHitsplat: n04b by 04\nHotkey: PKMN-Mystery-Dungeon by David Fens"
            //        );
            //};
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Set up the root.
        /// </summary>
        /// <param name="previous">The previous.</param>
        private void SetupRoot(Page previous)
        {
            Page p = Get(ROOT_INDEX);

            p.Icon    = Util.GetSprite("load");
            p.OnEnter = () => {
                p.Left.Clear();
                p.Right.Clear();
                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(GetSpecificLoadPage(p, i));
                    }
                    else
                    {
                        buttons.Add(GetImportPage(p, i));
                    }
                }

                p.Actions = buttons;
            };
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the export page.
        /// </summary>
        /// <param name="previous">The previous page.</param>
        /// <param name="index">The save index to export from.</param>
        /// <returns></returns>
        private Page GetExportPage(Page previous, int index)
        {
            Page p = new Page("Export");

            p.HasInputField = true;
            p.Body          = "Type a key to associate with this save.";
            p.Actions       = new IButtonable[] {
                PageUtil.GenerateBack(previous).SetCondition(() => !isUploadingToGameJolt),
                GetExportProcess(p, SaveLoad.GetSaveValue(index))
            };
            return(p);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets the import page used for importing saves from the cloud.
        /// </summary>
        /// <param name="previous">The previous page.</param>
        /// <param name="index">The index we're importing a save to.</param>
        /// <returns></returns>
        private Page GetImportPage(Page previous, int index)
        {
            Page p = new Page(Util.ColorString("Import", Color.grey));

            p.Body = "Type a key associated with a save for this game."
                     + "\nImporting from saves created in a different version of the game may cause issues.";
            p.HasInputField = true;
            p.OnEnter       = () => {
                p.Actions = new IButtonable[] {
                    PageUtil.GenerateBack(previous),
                    GetImportProcess(previous, p, index)
                };
            };
            return(p);
        }
Exemplo n.º 7
0
        private void SetupRoot(Page previous, IEnumerable <Character> party)
        {
            Page p = Get(ROOT_INDEX);

            p.AddCharacters(Side.LEFT, party);
            p.Icon = Util.GetSprite("person");

            List <IButtonable> buttons = new List <IButtonable>();

            buttons.Add(PageUtil.GenerateBack(previous));
            foreach (Character partyMember in party)
            {
                buttons.Add(GetSpecificCharacterStats(partyMember, p));
            }
            p.Actions = buttons;
        }
Exemplo n.º 8
0
        private Grid SetupShopMenu <T>(IButtonable previous, string name, string spriteLoc, string tooltip, IEnumerable <T> items, Func <T, Action, Process> conversion)
        {
            Grid grid = new Grid(name);

            grid.Icon    = Util.GetSprite(spriteLoc);
            grid.Tooltip = tooltip;
            grid.OnEnter = () => {
                grid.List.Clear();
                grid.List.Add(PageUtil.GenerateBack(previous));
                foreach (T item in items)
                {
                    grid.List.Add(conversion(item, () => grid.Invoke()));
                }
                ;
            };
            return(grid);
        }
Exemplo n.º 9
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;
            };
        }
Exemplo n.º 10
0
        private void SetupRoot()
        {
            Page p = Root;

            p.Condition = PageUtil.GetVisitProcessCondition(flags, party);
            p.Icon      = Util.GetSprite("walking-boot");
            p.Body      = "Where would you like to go?";
            p.AddCharacters(Side.LEFT, party);
            var buttons = new List <IButtonable>();

            buttons.Add(PageUtil.GenerateBack(previous));

            foreach (PageGroup pg in GetCurrentArea(flags.CurrentArea).Places)
            {
                buttons.Add(GetPlaceProcess(pg));
            }

            p.Actions = buttons;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorldPages"/> class.
        /// </summary>
        /// <param name="previous">The previous.</param>
        /// <param name="flags">The flags.</param>
        /// <param name="party">The party.</param>
        public WorldPages(Page previous, Flags flags, Party party) : base(new Page("Areas"))
        {
            Root.Body = "Which area would you like to go to?";

            IList <IButtonable> buttons = new List <IButtonable>();

            buttons.Add(PageUtil.GenerateBack(previous));

            Root.AddCharacters(Side.LEFT, party.Collection);

            foreach (AreaType type in AreaList.ALL_AREAS.Keys)
            {
                if (flags.IsAreaUnlocked(type) && flags.CurrentArea != type)
                {
                    buttons.Add(GetAreaChangeProcess(type, flags, party, previous));
                }
            }

            Root.Actions = buttons;
        }
Exemplo n.º 12
0
        private void SetupMenus()
        {
            Page p    = Get(ROOT_INDEX);
            Grid main = new Grid("Shop Menu");

            main.OnEnter = () => {
                main.List.Clear();
                main.List.Add(SetupTalkMenu(main));
                main.List.Add(SetupSellMenu(main));
                main.List.Add(SetupBuyMenu(main));
                main.List.Add(null);
                main.List.Add(PageUtil.GenerateGroupItemsGrid(p, main, party, PageUtil.GetOutOfBattlePlayableHandler(p)));
                main.List.Add(PageUtil.GenerateGroupEquipmentGrid(main, p, party.Collection, PageUtil.GetOutOfBattlePlayableHandler(p)));
                main.List.Add(null);
                main.List.Add(PageUtil.GenerateBack(previous));
            };
            p.OnEnter += () => {
                main.Invoke();
            };
        }
Exemplo n.º 13
0
        /// <summary>
        /// Gets a specific character's stats.
        /// </summary>
        /// <param name="characterToViewStatsOf">The c.</param>
        /// <param name="previous">The previous.</param>
        /// <returns></returns>
        private Page GetSpecificCharacterStats(Character characterToViewStatsOf, Page previous)
        {
            Page p = new Page(string.Format("{0}", characterToViewStatsOf.Look.DisplayName));

            p.AddCharacters(Side.LEFT, characterToViewStatsOf);
            p.Icon    = characterToViewStatsOf.Look.Sprite;
            p.OnEnter = () => {
                List <IButtonable> actions = new List <IButtonable>();
                actions.Add(PageUtil.GenerateBack(previous));
                actions.Add(GetSendPlayerToPointAllocationPageProcess(characterToViewStatsOf, p));
                if (Util.IS_DEBUG)
                {
                    actions.Add(ExpHack(characterToViewStatsOf));
                }
                DisplayStats(p, characterToViewStatsOf);
                LevelUpPage(characterToViewStatsOf, p);
                p.Actions = actions.ToArray();
            };
            return(p);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PageGroup" /> class.
        /// </summary>
        /// <param name="party">The party to enter the dungeon.</param>
        /// <param name="defeat">The page to go to if the party is defeated.</param>
        /// <param name="previous">The previous page, used to back out of the dungeon.</param>
        /// <param name="destination">The destination, where finishing the dungeon will lead to.</param>
        /// <param name="name">The name of the dungeon.</param>
        /// <param name="description">The description of the dungeon.</param>
        /// <param name="encounterGenerator">The encounter generator, used to generate dungeon encounters.</param>
        /// <param name="onClear">The on clear.</param>
        public Dungeon(
            IEnumerable <Character> party,
            Page defeat,
            Page previous,
            Page destination,
            string name,
            string description,
            Func <Encounter[]> encounterGenerator,
            Action onClear) : base(new Page(name))
        {
            Root.Body = description;
            this.encounterGenerator = encounterGenerator;
            this.onClear            = onClear;
            Root.AddCharacters(Side.LEFT, party);

            Root.Actions = new IButtonable[] {
                PageUtil.GenerateBack(previous),
                GetDungeonEnterProcess(party, defeat, destination, onClear)
            };
        }
Exemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StagePages"/> class.
        /// </summary>
        /// <param name="previous">The previous page to back to.</param>
        /// <param name="party">The current party.</param>
        /// <param name="flags">The game's flags.</param>
        public StagePages(Page previous, Party party, Flags flags) : base(new Page("Quest"))
        {
            var buttons = new List <IButtonable>();

            this.party    = party;
            this.flags    = flags;
            this.previous = previous;

            Root.Icon = Util.GetSprite("dungeon-gate");
            Root.AddCharacters(Side.LEFT, party);
            Root.Condition = PageUtil.GetVisitProcessCondition(flags, party);

            buttons.Add(PageUtil.GenerateBack(previous));

            Area currentArea = GetCurrentArea(flags.CurrentArea);

            for (int i = 0; i < currentArea.Stages.Count; i++)
            {
                if (IsStagePlayable(i, currentArea))
                {
                    buttons.Add(GetPageEntryProcess(i, currentArea));
                }
                else
                {
                    buttons.Add(new Process("<color=grey>???</color>", "Complete the previous stage to unlock."));
                }
            }

            Get(ROOT_INDEX).Actions = buttons;
            Get(ROOT_INDEX).OnEnter = () => {
                Get(ROOT_INDEX)
                .AddText(
                    "Select a stage."
                    );
            };
        }