Exemplo n.º 1
0
        public IntrinsicForgetMenu(Character player, OnChooseSlot action, Action refuseAction)
        {
            this.player           = player;
            this.chooseSlotAction = action;
            this.refuseAction     = refuseAction;

            List <MenuTextChoice> intrinsics = new List <MenuTextChoice>();

            for (int ii = 0; ii < CharData.MAX_INTRINSIC_SLOTS; ii++)
            {
                if (player.BaseIntrinsics[ii] > -1)
                {
                    intrinsics.Add(new MenuTextChoice(Data.DataManager.Instance.GetIntrinsic(player.BaseIntrinsics[ii]).Name.ToLocal(), () => { choose(ii); }));
                }
            }

            summaryMenu = new SummaryMenu(Rect.FromPoints(new Loc(16,
                                                                  GraphicsManager.ScreenHeight - 8 - GraphicsManager.MenuBG.TileHeight * 2 - LINE_SPACE * 3),
                                                          new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));

            Description = new DialogueText("", summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight),
                                           summaryMenu.Bounds.End.X - GraphicsManager.MenuBG.TileWidth * 4 - summaryMenu.Bounds.X, LINE_SPACE, false);
            summaryMenu.Elements.Add(Description);

            Initialize(new Loc(16, 16), 144, Text.FormatKey("MENU_INTRINSIC_TITLE", player.BaseName), intrinsics.ToArray(), 0);
        }
        public IntrinsicRecallMenu(Character player, int[] intrinsicChoices, OnChooseSlot action, Action refuseAction)
        {
            this.player           = player;
            this.intrinsicChoices = intrinsicChoices;
            this.chooseSlotAction = action;
            this.refuseAction     = refuseAction;


            List <MenuChoice> flatChoices = new List <MenuChoice>();

            for (int ii = 0; ii < intrinsicChoices.Length; ii++)
            {
                int index = ii;
                flatChoices.Add(new MenuTextChoice(Data.DataManager.Instance.GetIntrinsic(intrinsicChoices[index]).GetColoredName(), () => { choose(index); }));
            }
            List <MenuChoice[]> intrinsics = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            summaryMenu = new SummaryMenu(Rect.FromPoints(new Loc(16,
                                                                  GraphicsManager.ScreenHeight - 8 - GraphicsManager.MenuBG.TileHeight * 2 - LINE_SPACE * 3),
                                                          new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));

            Description = new DialogueText("", summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight),
                                           summaryMenu.Bounds.End.X - GraphicsManager.MenuBG.TileWidth * 4 - summaryMenu.Bounds.X, LINE_SPACE, false);
            summaryMenu.Elements.Add(Description);

            Initialize(new Loc(16, 16), 144, Text.FormatKey("MENU_INTRINSIC_RECALL"), intrinsics.ToArray(), 0, 0, SLOTS_PER_PAGE);
        }
Exemplo n.º 3
0
        public TeachMenu(int slot, bool held)
        {
            this.slot = slot;
            this.held = held;

            List <MenuTextChoice> team = new List <MenuTextChoice>();

            foreach (Character character in DataManager.Instance.Save.ActiveTeam.Players)
            {
                bool canLearn  = CanLearnSkill(character, DataManager.Instance.Save.ActiveTeam.Leader, slot, held) && !character.Dead;
                int  teamIndex = team.Count;
                team.Add(new MenuTextChoice(character.GetDisplayName(true), () => { choose(teamIndex); }, canLearn, canLearn ? Color.White : Color.Red));
            }

            Loc summaryStart = new Loc(16, 16 + team.Count * VERT_SPACE + GraphicsManager.MenuBG.TileHeight * 2 + ContentOffset);

            summaryMenu = new SummaryMenu(new Rect(summaryStart, new Loc(144, CharData.MAX_SKILL_SLOTS * VERT_SPACE + GraphicsManager.MenuBG.TileHeight * 2 + ContentOffset)));

            SummaryTitle = new MenuText("", summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth + 8, GraphicsManager.MenuBG.TileHeight));
            summaryMenu.Elements.Add(SummaryTitle);
            summaryMenu.Elements.Add(new MenuDivider(summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + LINE_SPACE), 144 - GraphicsManager.MenuBG.TileWidth * 2));
            Skills       = new MenuText[CharData.MAX_SKILL_SLOTS];
            SkillCharges = new MenuText[CharData.MAX_SKILL_SLOTS];
            for (int ii = 0; ii < Skills.Length; ii++)
            {
                Skills[ii] = new MenuText("", summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth + 8, GraphicsManager.MenuBG.TileHeight + ContentOffset + VERT_SPACE * ii));
                summaryMenu.Elements.Add(Skills[ii]);
                SkillCharges[ii] = new MenuText("", new Loc(summaryMenu.Bounds.End.X - GraphicsManager.MenuBG.TileWidth, summaryMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight + ContentOffset + VERT_SPACE * ii), DirH.Right);
                summaryMenu.Elements.Add(SkillCharges[ii]);
            }

            Initialize(new Loc(16, 16), 144, Text.FormatKey("MENU_TEACH_TITLE"), team.ToArray(), 0);
        }
Exemplo n.º 4
0
        public TopMenu()
        {
            bool inMod = PathMod.Mod != "";
            List <MenuTextChoice> choices = new List <MenuTextChoice>();

            if (DataManager.Instance.Save != null)
            {
                if (DataManager.Instance.Save.Rescue != null)
                {
                    if (DataManager.Instance.Save.Rescue.SOS.RescuingTeam == null)
                    {
                        choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_RESCUE_AWAIT"), () => { MenuManager.Instance.AddMenu(new RescueMenu(), false); }));
                    }
                    else
                    {
                        choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_CONTINUE"), () => { Continue(DataManager.Instance.Save.Rescue.SOS); }));
                    }
                }
                else
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_CONTINUE"), () => { Continue(null); }));
                }
                if (DataManager.Instance.Save.ActiveTeam.Name != "" && !inMod)
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_ROGUE"), () => { MenuManager.Instance.AddMenu(new RogueMenu(), false); }));
                }
            }
            else
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_NEW"), () => { MainStartingMenu.StartFlow(new MonsterID(-1, -1, -1, Gender.Unknown), null, -1); }));
            }


            if (DataManager.Instance.FoundRecords(PathMod.ModSavePath(DataManager.REPLAY_PATH)) || DataManager.Instance.Save != null || RecordHeaderData.LoadHighScores().Count > 0)
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_RECORD"), () => { MenuManager.Instance.AddMenu(new RecordsMenu(), false); }));
            }
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_OPTIONS_TITLE"), () => { MenuManager.Instance.AddMenu(new OptionsMenu(), false); }));

            if (!inMod)
            {
                string[] modsPath = Directory.GetDirectories(PathMod.MODS_PATH);
                if (DataManager.Instance.Save != null && modsPath.Length > 0)
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_MODS_TITLE"), () => { MenuManager.Instance.AddMenu(new ModsMenu(), false); }));
                }
            }
            else
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_MODS_EXIT"), exitMod));
            }
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_QUIT_GAME"), exitGame));

            Initialize(new Loc(16, 16), CalculateChoiceLength(choices, 72), choices.ToArray(), 0);

            titleMenu = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.End.X + 16, 16), new Loc(GraphicsManager.ScreenWidth - 16, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            MenuText title = new MenuText(Path.GetFileName(PathMod.Mod), new Loc((titleMenu.Bounds.X + titleMenu.Bounds.End.X) / 2, titleMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            titleMenu.Elements.Add(title);
        }
Exemplo n.º 5
0
        public DexMenu()
        {
            int lastEntry  = -1;
            int seen       = 0;
            int befriended = 0;

            for (int ii = 1; ii < DataManager.Instance.Save.Dex.Length; ii++)
            {
                if (DataManager.Instance.Save.Dex[ii] > 0)
                {
                    lastEntry = ii;
                    seen++;
                    if (DataManager.Instance.Save.Dex[ii] == GameProgress.UnlockState.Completed)
                    {
                        befriended++;
                    }
                }
            }

            List <MenuChoice> flatChoices = new List <MenuChoice>();

            for (int ii = 1; ii <= lastEntry; ii++)
            {
                if (DataManager.Instance.Save.Dex[ii] > 0)
                {
                    Color color = (DataManager.Instance.Save.Dex[ii] == GameProgress.UnlockState.Completed) ? Color.White : Color.Gray;

                    //name
                    MenuText dexNum  = new MenuText(ii.ToString("D3"), new Loc(2, 1), color);
                    MenuText dexName = new MenuText(DataManager.Instance.DataIndices[DataManager.DataType.Monster].Entries[ii].Name.ToLocal(), new Loc(24, 1), color);
                    flatChoices.Add(new MenuElementChoice(() => { choose(ii); }, true, dexNum, dexName));
                }
                else
                {
                    //???
                    MenuText dexNum  = new MenuText(ii.ToString("D3"), new Loc(2, 1), Color.Gray);
                    MenuText dexName = new MenuText("???", new Loc(24, 1), Color.Gray);
                    flatChoices.Add(new MenuElementChoice(() => { choose(ii); }, true, dexNum, dexName));
                }
            }
            List <MenuChoice[]> choices = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            summaryMenu = new SummaryMenu(new Rect(new Loc(208, 16), new Loc(96, LINE_SPACE * 2 + GraphicsManager.MenuBG.TileHeight * 2)));
            MenuText seenText = new MenuText(Text.FormatKey("MENU_DEX_SEEN", seen), summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight));

            summaryMenu.Elements.Add(seenText);
            MenuText befriendedText = new MenuText(Text.FormatKey("MENU_DEX_CAUGHT", befriended), summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + LINE_SPACE));

            summaryMenu.Elements.Add(befriendedText);

            portrait = new SpeakerPortrait(new MonsterID(), new EmoteStyle(0), new Loc(232, 72), true);

            Initialize(new Loc(0, 0), 208, Text.FormatKey("MENU_DEX_TITLE"), choices.ToArray(), 0, 0, SLOTS_PER_PAGE);
        }
Exemplo n.º 6
0
        public CharaChoiceMenu(string teamName, int chosenDungeon, ulong?seed)
        {
            GenderSetting    = Gender.Unknown;
            SkinSetting      = 0;
            IntrinsicSetting = -1;
            FormSetting      = -1;

            startChars = new List <int>();
            for (int ii = 0; ii < DataManager.Instance.DataIndices[DataManager.DataType.Monster].Count; ii++)
            {
                if (DataManager.Instance.Save.Dex[ii] == GameProgress.UnlockState.Completed && DataManager.Instance.DataIndices[DataManager.DataType.Monster].Entries[ii].Released)
                {
                    startChars.Add(ii);
                }
                else if (DataManager.Instance.StartChars.Contains(ii))
                {
                    startChars.Add(ii);
                }
            }


            List <MenuChoice> flatChoices = new List <MenuChoice>();

            flatChoices.Add(new MenuTextChoice(Text.FormatKey("MENU_START_RANDOM"), () => { choose(startChars[MathUtils.Rand.Next(startChars.Count)]); }));
            for (int ii = 0; ii < startChars.Count; ii++)
            {
                int startChar = startChars[ii];
                flatChoices.Add(new MenuTextChoice(DataManager.Instance.DataIndices[DataManager.DataType.Monster].Entries[startChar].Name.ToLocal(), () => { choose(startChar); }));
            }
            List <MenuChoice[]> box = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            int totalSlots = SLOTS_PER_PAGE;

            if (box.Count == 1)
            {
                totalSlots = box[0].Length;
            }

            team       = teamName;
            chosenDest = chosenDungeon;
            this.seed  = seed;

            Portrait = new SpeakerPortrait(new MonsterID(), new EmoteStyle(0), new Loc(200, 64), true);

            infoMenu = new CharaSummary(new Rect(new Loc(152, 128), new Loc(136, LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));

            Initialize(new Loc(16, 16), 112, Text.FormatKey("MENU_CHARA_CHOICE_TITLE"), box.ToArray(), 0, 0, totalSlots, false, -1);

            titleMenu = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.End.X + 8, 16), new Loc(GraphicsManager.ScreenWidth - 8, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            MenuText title = new MenuText(Text.FormatKey("MENU_START_TEAM", team), new Loc((titleMenu.Bounds.X + titleMenu.Bounds.End.X) / 2, titleMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            title.Color = TextTan;
            titleMenu.Elements.Add(title);
        }
Exemplo n.º 7
0
        public SendHelpMenu()
            : base()
        {
            yourSummary = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.Start.X, Bounds.End.Y),
                                                          new Loc(Bounds.End.X, Bounds.End.Y + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            yourStatus = new MenuText("",
                                      new Loc((yourSummary.Bounds.X + yourSummary.Bounds.End.X) / 2, yourSummary.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);
            yourStatus.Color = TextTan;
            yourSummary.Elements.Add(yourStatus);

            CurrentState = ExchangeRescueState.Communicating;
        }
Exemplo n.º 8
0
        protected void Initialize(Loc start, int width, MenuTextChoice[] choices, int defaultChoice, string name)
        {
            Loc summaryStart = new Loc(16, 16);

            summaryMenu = new SummaryMenu(new Rect(summaryStart, new Loc(144, VERT_SPACE + GraphicsManager.MenuBG.TileHeight * 2 + TitledStripMenu.TITLE_OFFSET)));


            summaryMenu.Elements.Add(new MenuText(Text.FormatKey("MENU_GROUND_TITLE"), summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth + 8, GraphicsManager.MenuBG.TileHeight)));
            summaryMenu.Elements.Add(new MenuDivider(summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + LINE_SPACE), 144 - GraphicsManager.MenuBG.TileWidth * 2));
            summaryMenu.Elements.Add(new MenuText(name, summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth + 8, GraphicsManager.MenuBG.TileHeight + TitledStripMenu.TITLE_OFFSET)));

            Initialize(start, width, choices, defaultChoice);
        }
Exemplo n.º 9
0
        public ItemTargetMenu(int invSlot, bool useItem)
        {
            this.invSlot = invSlot;
            this.useItem = useItem;

            List <MenuTextChoice> team = new List <MenuTextChoice>();

            foreach (Character character in DataManager.Instance.Save.ActiveTeam.Players)
            {
                int  teamIndex   = team.Count;
                bool validTarget = !character.Dead || !useItem;
                team.Add(new MenuTextChoice(character.BaseName, () => { choose(teamIndex); }, validTarget, !validTarget ? Color.Red : Color.White));
            }

            summaryMenu = new SummaryMenu(new Rect(new Loc(16, 16 + team.Count * VERT_SPACE + GraphicsManager.MenuBG.TileHeight * 2 + ContentOffset),
                                                   new Loc(128, VERT_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            Text = new MenuText("", summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight));
            summaryMenu.Elements.Add(Text);

            Initialize(new Loc(16, 16), 144, RogueEssence.Text.FormatKey("MENU_ITEM_TARGET_TITLE"), team.ToArray(), 0);
        }
Exemplo n.º 10
0
        public BankMenu(int onHand, OnChooseAmount chooseAmount)
        {
            this.onHand       = onHand;
            this.chooseAmount = chooseAmount;
            long total     = (long)DataManager.Instance.Save.ActiveTeam.Bank + (long)onHand;
            int  maxVal    = (int)Math.Min(Int32.MaxValue, total);
            int  maxLength = maxVal.ToString().Length;

            MenuDigits digits = new MenuDigits(onHand, maxLength, new Loc(GraphicsManager.ScreenWidth / 2 - MenuDigits.DIGIT_SPACE * maxLength / 2,
                                                                          128 + TitledStripMenu.TITLE_OFFSET + 8 + GraphicsManager.MenuBG.TileHeight));

            MenuText notes = new MenuText(Text.FormatKey("MENU_BANK_TITLE"), new Loc(GraphicsManager.ScreenWidth / 2,
                                                                                     128 + TitledStripMenu.TITLE_OFFSET + LINE_SPACE * 3 + GraphicsManager.MenuBG.TileHeight), DirH.None);

            int minSize = (Math.Max(MenuDigits.DIGIT_SPACE * maxLength, notes.GetTextLength()) / 16 + 1) * 16;

            Initialize(new Rect(new Loc(GraphicsManager.ScreenWidth / 2 - (minSize + 16) / 2, 128),
                                new Loc(minSize + 16, TitledStripMenu.TITLE_OFFSET + GraphicsManager.MenuBG.TileHeight * 2 + LINE_SPACE * 5)),
                       digits, Math.Max(0, (int)(total - Int32.MaxValue)), maxVal, maxLength - onHand.ToString().Length);

            MenuText moneyTitle = new MenuText(Text.FormatKey("MENU_BANK_MONEY"), Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth + 8, GraphicsManager.MenuBG.TileHeight));

            NonChoices.Add(moneyTitle);
            NonChoices.Add(new MenuDivider(Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + LINE_SPACE), Bounds.End.X - Bounds.X - GraphicsManager.MenuBG.TileWidth * 2));
            NonChoices.Add(notes);

            bankMenu = new SummaryMenu(new Rect(new Loc(GraphicsManager.ScreenWidth / 2 - minSize / 2, 24),
                                                new Loc(minSize, TitledStripMenu.TITLE_OFFSET + GraphicsManager.MenuBG.TileHeight * 2 + LINE_SPACE * 2)));
            BankDigits = new MenuDigits(DataManager.Instance.Save.ActiveTeam.Bank, maxLength, new Loc(GraphicsManager.ScreenWidth / 2 - MenuDigits.DIGIT_SPACE * maxLength / 2,
                                                                                                      24 + TitledStripMenu.TITLE_OFFSET + 8 + GraphicsManager.MenuBG.TileHeight));
            bankMenu.Elements.Add(BankDigits);

            MenuText bankTitle = new MenuText(Text.FormatKey("MENU_BANK_BANK"), bankMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth + 8, GraphicsManager.MenuBG.TileHeight));

            bankMenu.Elements.Add(bankTitle);
            bankMenu.Elements.Add(new MenuDivider(bankMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + LINE_SPACE), bankMenu.Bounds.End.X - bankMenu.Bounds.X - GraphicsManager.MenuBG.TileWidth * 2));
        }
Exemplo n.º 11
0
        public TradeItemMenu(int defaultChoice)
        {
            int menuWidth = 152;

            AllowedGoods = new List <int>();

            int[] itemPresence = new int[DataManager.Instance.DataIndices[DataManager.DataType.Item].Count];
            for (int ii = 0; ii < itemPresence.Length; ii++)
            {
                itemPresence[ii] += DataManager.Instance.Save.ActiveTeam.Storage[ii];
            }

            List <MenuChoice> flatChoices = new List <MenuChoice>();

            for (int ii = 0; ii < itemPresence.Length; ii++)
            {
                int index = ii;
                if (itemPresence[index] > 0)
                {
                    ItemEntrySummary itemEntry = DataManager.Instance.DataIndices[DataManager.DataType.Item].Entries[index] as ItemEntrySummary;
                    if (itemEntry.ContainsState <MaterialState>())
                    {
                        AllowedGoods.Add(index);
                        int slot = flatChoices.Count;

                        MenuText menuText  = new MenuText(DataManager.Instance.GetItem(ii).GetIconName(), new Loc(2, 1));
                        MenuText menuCount = new MenuText("(" + itemPresence[index] + ")", new Loc(menuWidth - 8 * 4, 1), DirV.Up, DirH.Right, Color.White);
                        flatChoices.Add(new MenuElementChoice(() => { choose(slot); }, true, menuText, menuCount));
                    }
                }
            }

            defaultChoice = Math.Min(defaultChoice, flatChoices.Count - 1);
            int startChoice         = defaultChoice % SLOTS_PER_PAGE;
            int startPage           = defaultChoice / SLOTS_PER_PAGE;
            List <MenuChoice[]> inv = SortIntoPages(flatChoices, SLOTS_PER_PAGE);


            Initialize(new Loc(0, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2), menuWidth, Text.FormatKey("MENU_STORAGE_TITLE"), inv.ToArray(), startChoice, startPage, SLOTS_PER_PAGE, false, 8);

            theirInfo = new OfferItemsMenu(new Rect(GraphicsManager.ScreenWidth - 0 - menuWidth, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2, Bounds.Width, Bounds.Height), null);

            yourTitle = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.Start.X, Bounds.Start.Y - LINE_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(Bounds.End.X, Bounds.Start.Y)));
            MenuText yourText = new MenuText(DataManager.Instance.Save.ActiveTeam.GetDisplayName(),
                                             new Loc((yourTitle.Bounds.X + yourTitle.Bounds.End.X) / 2, yourTitle.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            yourText.Color = TextTan;
            yourTitle.Elements.Add(yourText);

            yourSummary = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.Start.X, Bounds.End.Y),
                                                          new Loc(Bounds.End.X, Bounds.End.Y + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            yourStatus = new MenuText("",
                                      new Loc((yourSummary.Bounds.X + yourSummary.Bounds.End.X) / 2, yourSummary.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);
            yourStatus.Color = TextTan;
            yourSummary.Elements.Add(yourStatus);



            theirTitle = new SummaryMenu(Rect.FromPoints(new Loc(theirInfo.Bounds.Start.X, theirInfo.Bounds.Start.Y - LINE_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(theirInfo.Bounds.End.X, theirInfo.Bounds.Start.Y)));
            MenuText theirText = new MenuText("",
                                              new Loc((theirTitle.Bounds.X + theirTitle.Bounds.End.X) / 2, theirTitle.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            theirText.Color = TextTan;
            theirTitle.Elements.Add(theirText);

            theirSummary = new SummaryMenu(Rect.FromPoints(new Loc(theirInfo.Bounds.Start.X, theirInfo.Bounds.End.Y),
                                                           new Loc(theirInfo.Bounds.End.X, theirInfo.Bounds.End.Y + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            theirStatus = new MenuText("",
                                       new Loc((theirSummary.Bounds.X + theirSummary.Bounds.End.X) / 2, theirSummary.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);
            theirStatus.Color = TextTan;
            theirSummary.Elements.Add(theirStatus);

            theirText.SetText(NetworkManager.Instance.Activity.TargetInfo.Data.TeamName);

            CurrentState = ExchangeState.Selecting;
        }
Exemplo n.º 12
0
        public TradeTeamMenu(int defaultChoice)
        {
            int menuWidth = 152;

            List <MenuChoice> flatChoices = new List <MenuChoice>();

            for (int ii = 0; ii < DataManager.Instance.Save.ActiveTeam.Assembly.Count; ii++)
            {
                int       index      = ii;
                Character character  = DataManager.Instance.Save.ActiveTeam.Assembly[index];
                bool      tradeable  = !character.IsFounder && !character.IsFavorite;
                MenuText  memberName = new MenuText(character.GetDisplayName(true), new Loc(2, 1), tradeable ? Color.White : Color.Red);
                MenuText  memberLv   = new MenuText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level), new Loc(menuWidth - 8 * 4, 1),
                                                    DirV.Up, DirH.Right, tradeable ? Color.White : Color.Red);
                flatChoices.Add(new MenuElementChoice(() => { choose(index); }, tradeable, memberName, memberLv));
            }
            List <MenuChoice[]> box = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            int page   = defaultChoice / SLOTS_PER_PAGE;
            int choice = defaultChoice % SLOTS_PER_PAGE;

            Initialize(new Loc(0, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2), menuWidth, Text.FormatKey("MENU_ASSEMBLY_TITLE"), box.ToArray(), choice, page, SLOTS_PER_PAGE);

            theirInfo = new OfferFeaturesMenu(new Rect(GraphicsManager.ScreenWidth - 0 - menuWidth, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2, Bounds.Width, Bounds.Height), null);

            yourTitle = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.Start.X, Bounds.Start.Y - LINE_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(Bounds.End.X, Bounds.Start.Y)));
            MenuText yourText = new MenuText(DataManager.Instance.Save.ActiveTeam.GetDisplayName(),
                                             new Loc((yourTitle.Bounds.X + yourTitle.Bounds.End.X) / 2, yourTitle.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            yourText.Color = TextTan;
            yourTitle.Elements.Add(yourText);

            yourSummary = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.Start.X, Bounds.End.Y),
                                                          new Loc(Bounds.End.X, Bounds.End.Y + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            yourStatus = new MenuText("",
                                      new Loc((yourSummary.Bounds.X + yourSummary.Bounds.End.X) / 2, yourSummary.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);
            yourStatus.Color = TextTan;
            yourSummary.Elements.Add(yourStatus);



            theirTitle = new SummaryMenu(Rect.FromPoints(new Loc(theirInfo.Bounds.Start.X, theirInfo.Bounds.Start.Y - LINE_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(theirInfo.Bounds.End.X, theirInfo.Bounds.Start.Y)));
            MenuText theirText = new MenuText("",
                                              new Loc((theirTitle.Bounds.X + theirTitle.Bounds.End.X) / 2, theirTitle.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            theirText.Color = TextTan;
            theirTitle.Elements.Add(theirText);

            theirSummary = new SummaryMenu(Rect.FromPoints(new Loc(theirInfo.Bounds.Start.X, theirInfo.Bounds.End.Y),
                                                           new Loc(theirInfo.Bounds.End.X, theirInfo.Bounds.End.Y + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            theirStatus = new MenuText("",
                                       new Loc((theirSummary.Bounds.X + theirSummary.Bounds.End.X) / 2, theirSummary.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);
            theirStatus.Color = TextTan;
            theirSummary.Elements.Add(theirStatus);

            ActivityTradeTeam tradeTeam = NetworkManager.Instance.Activity as ActivityTradeTeam;

            theirText.SetText(tradeTeam.TargetInfo.Data.TeamName);

            CurrentState = ExchangeState.Selecting;
        }
Exemplo n.º 13
0
        public MainMenu()
        {
            bool equippedItems = false;

            foreach (Character character in DataManager.Instance.Save.ActiveTeam.Players)
            {
                if (!character.Dead && character.EquippedItem.ID > -1)
                {
                    equippedItems = true;
                    break;
                }
            }
            bool invEnabled = !(DataManager.Instance.Save.ActiveTeam.GetInvCount() == 0 && !equippedItems);

            List <MenuTextChoice> choices = new List <MenuTextChoice>();

            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_MAIN_SKILLS"), () =>
            {
                int mainIndex = DataManager.Instance.Save.ActiveTeam.LeaderIndex;
                if (GameManager.Instance.CurrentScene == DungeonScene.Instance)
                {
                    CharIndex turnChar = ZoneManager.Instance.CurrentMap.CurrentTurnMap.GetCurrentTurnChar();
                    if (turnChar.Team == -1)
                    {
                        mainIndex = turnChar.Char;
                    }
                }
                MenuManager.Instance.AddMenu(new SkillMenu(mainIndex), false);
            }));
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_MAIN_INVENTORY"), () => { MenuManager.Instance.AddMenu(new ItemMenu(), false); }, invEnabled, invEnabled ? Color.White : Color.Red));

            bool hasTactics = (DataManager.Instance.Save.ActiveTeam.Players.Count > 1);
            bool inReplay   = (DataManager.Instance.CurrentReplay != null);

            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TACTICS_TITLE"), () => { MenuManager.Instance.AddMenu(new TacticsMenu(), false); }, (hasTactics && !inReplay), (hasTactics && !inReplay) ? Color.White : Color.Red));
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TEAM_TITLE"), () => { MenuManager.Instance.AddMenu(new TeamMenu(false), false); }));

            if (GameManager.Instance.CurrentScene == DungeonScene.Instance)
            {
                bool hasGround = DungeonScene.Instance.CanCheckGround();
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_GROUND_TITLE"), checkGround, (hasGround && !inReplay), (hasGround && !inReplay) ? Color.White : Color.Red));
            }

            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_OTHERS_TITLE"), () => { MenuManager.Instance.AddMenu(new OthersMenu(), false); }));
            if (!inReplay)
            {
                if (((GameManager.Instance.CurrentScene == DungeonScene.Instance)) || DataManager.Instance.Save is RogueProgress)
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_REST_TITLE"), () => { MenuManager.Instance.AddMenu(new RestMenu(), false); }));
                }
                else
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_MAIN_SAVE"), SaveAction));
                }
            }
            else
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_REPLAY_TITLE"), () => { MenuManager.Instance.AddMenu(new ReplayMenu(), false); }));
            }
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_EXIT"), MenuManager.Instance.RemoveMenu));

            Initialize(new Loc(16, 16), CalculateChoiceLength(choices, 72), choices.ToArray(), Math.Min(Math.Max(0, defaultChoice), choices.Count - 1));

            titleMenu = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.End.X + 16, 32), new Loc(GraphicsManager.ScreenWidth - 16, 32 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            MenuText title = new MenuText((GameManager.Instance.CurrentScene == DungeonScene.Instance) ? ZoneManager.Instance.CurrentMap.GetSingleLineName() : ZoneManager.Instance.CurrentGround.GetSingleLineName(),
                                          new Loc((titleMenu.Bounds.X + titleMenu.Bounds.End.X) / 2, titleMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            title.Color = TextTan;
            titleMenu.Elements.Add(title);

            summaryMenu = new SummaryMenu(Rect.FromPoints(new Loc(16, 32 + choices.Count * VERT_SPACE + GraphicsManager.MenuBG.TileHeight * 2),
                                                          new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));
            summaryMenu.Elements.Add(new MenuText(Text.FormatKey("MENU_BAG_MONEY", Text.FormatKey("MONEY_AMOUNT", DataManager.Instance.Save.ActiveTeam.Money)),
                                                  new Loc(summaryMenu.Bounds.X + GraphicsManager.MenuBG.TileWidth + 8, summaryMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight)));

            if (GameManager.Instance.CurrentScene == DungeonScene.Instance)
            {
                string weather = DataManager.Instance.GetMapStatus(0).Name.ToLocal();
                foreach (MapStatus status in ZoneManager.Instance.CurrentMap.Status.Values)
                {
                    if (status.StatusStates.Contains <MapWeatherState>())
                    {
                        MapStatusData entry = (MapStatusData)status.GetData();
                        weather = entry.Name.ToLocal();
                        break;
                    }
                }
                summaryMenu.Elements.Add(new MenuText(Text.FormatKey("MENU_MAP_CONDITION", weather),
                                                      new Loc(GraphicsManager.ScreenWidth / 2, summaryMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight)));
            }

            int level_length  = GraphicsManager.TextFont.SubstringWidth(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", DataManager.Instance.MaxLevel));
            int hp_length     = GraphicsManager.TextFont.SubstringWidth(Text.FormatKey("MENU_TEAM_HP", 999, 999));
            int hunger_length = GraphicsManager.TextFont.SubstringWidth(Text.FormatKey("MENU_TEAM_HUNGER", Character.MAX_FULLNESS, Character.MAX_FULLNESS));

            int remaining_width = summaryMenu.Bounds.End.X - summaryMenu.Bounds.X - (GraphicsManager.MenuBG.TileWidth + 4) * 2 - level_length - hp_length - hunger_length - NicknameMenu.MAX_LENGTH;

            for (int ii = 0; ii < DataManager.Instance.Save.ActiveTeam.Players.Count; ii++)
            {
                Character character  = DataManager.Instance.Save.ActiveTeam.Players[ii];
                int       text_start = summaryMenu.Bounds.X + GraphicsManager.MenuBG.TileWidth + 4;
                summaryMenu.Elements.Add(new MenuText(character.BaseName,
                                                      new Loc(text_start, summaryMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight + (ii + 1) * LINE_SPACE)));
                text_start += NicknameMenu.MAX_LENGTH + remaining_width / 3;
                summaryMenu.Elements.Add(new MenuText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level),
                                                      new Loc(text_start + level_length / 2, summaryMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight + (ii + 1) * LINE_SPACE), DirH.None));
                text_start += level_length + remaining_width / 3;
                summaryMenu.Elements.Add(new MenuText(Text.FormatKey("MENU_TEAM_HP", character.HP, character.MaxHP),
                                                      new Loc(text_start + hp_length / 2, summaryMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight + (ii + 1) * LINE_SPACE), DirH.None));
                text_start += hp_length + remaining_width / 3;
                summaryMenu.Elements.Add(new MenuText(Text.FormatKey("MENU_TEAM_HUNGER", character.Fullness, character.MaxFullness),
                                                      new Loc(text_start + hunger_length / 2, summaryMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight + (ii + 1) * LINE_SPACE), DirH.None));
            }
        }
Exemplo n.º 14
0
        public StatusMenu(int teamSlot)
        {
            int menuWidth = 168;
            List <MenuChoice> flatChoices = new List <MenuChoice>();

            mapIndices = new List <int>();
            foreach (int status in ZoneManager.Instance.CurrentMap.Status.Keys)
            {
                MapStatus statusInstance = ZoneManager.Instance.CurrentMap.Status[status];
                if (!statusInstance.Hidden)
                {
                    Data.MapStatusData statusData = Data.DataManager.Instance.GetMapStatus(status);
                    mapIndices.Add(status);
                    MenuText          statusName = statusName = new MenuText(statusData.GetColoredName(), new Loc(2, 1));
                    MapCountDownState countDown  = statusInstance.StatusStates.GetWithDefault <MapCountDownState>();
                    if (countDown != null && countDown.Counter > 0)
                    {
                        flatChoices.Add(new MenuElementChoice(() => { }, true, statusName, new MenuText("[" + countDown.Counter + "]", new Loc(menuWidth - 8 * 4, 1), DirH.Right)));
                    }
                    else
                    {
                        flatChoices.Add(new MenuElementChoice(() => { }, true, statusName));
                    }
                }
            }
            indices = new List <int>();
            foreach (int status in DungeonScene.Instance.ActiveTeam.Players[teamSlot].StatusEffects.Keys)
            {
                if (Data.DataManager.Instance.GetStatus(status).MenuName)
                {
                    indices.Add(status);
                    MenuText   statusName = null;
                    StackState stack      = DungeonScene.Instance.ActiveTeam.Players[teamSlot].StatusEffects[status].StatusStates.GetWithDefault <StackState>();
                    if (stack != null)
                    {
                        statusName = new MenuText(Data.DataManager.Instance.GetStatus(status).GetColoredName() + (stack.Stack < 0 ? " " : " +") + stack.Stack, new Loc(2, 1));
                    }
                    else
                    {
                        statusName = new MenuText(Data.DataManager.Instance.GetStatus(status).GetColoredName(), new Loc(2, 1));
                    }

                    CountDownState countDown = DungeonScene.Instance.ActiveTeam.Players[teamSlot].StatusEffects[status].StatusStates.GetWithDefault <CountDownState>();
                    if (countDown != null && countDown.Counter > 0)
                    {
                        flatChoices.Add(new MenuElementChoice(() => { }, true, statusName, new MenuText("[" + countDown.Counter + "]", new Loc(menuWidth - 8 * 4, 1), DirH.Right)));
                    }
                    else
                    {
                        flatChoices.Add(new MenuElementChoice(() => { }, true, statusName));
                    }
                }
            }
            List <MenuChoice[]> statuses = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            summaryMenu = new SummaryMenu(Rect.FromPoints(new Loc(16, GraphicsManager.ScreenHeight - 8 - 4 * VERT_SPACE - GraphicsManager.MenuBG.TileHeight * 2),
                                                          new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));

            Description = new DialogueText("", summaryMenu.Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight),
                                           summaryMenu.Bounds.End.X - GraphicsManager.MenuBG.TileWidth * 4 - summaryMenu.Bounds.X, LINE_SPACE, false);
            summaryMenu.Elements.Add(Description);

            Initialize(new Loc(16, 16), menuWidth, Text.FormatKey("MENU_TEAM_STATUS_TITLE"), statuses.ToArray(), 0, 0, SLOTS_PER_PAGE);
        }