예제 #1
0
 protected void Initialize(Rect bounds, MenuDigits digits, int min, int max, int defaultDigit)
 {
     Bounds        = bounds;
     Digits        = digits;
     Min           = min;
     Max           = max;
     CurrentChoice = defaultDigit;
     DigitLines    = new MenuDivider[digits.MinDigits];
     for (int ii = 0; ii < DigitLines.Length; ii++)
     {
         DigitLines[ii] = new MenuDivider(Digits.GetDigitLoc(ii) + new Loc(-1, 12), MenuDigits.DIGIT_SPACE - 1);
     }
 }
예제 #2
0
        public ItemAmountMenu(Loc start, int max, SingleStripMenu.OnChooseSlot chooseAction)
        {
            this.chooseAction = chooseAction;

            Loc size = new Loc(80, 64);

            int        length = max.ToString().Length;
            MenuDigits digits = new MenuDigits(1, length, start + new Loc(size.X / 2 - MenuDigits.DIGIT_SPACE * length / 2, GraphicsManager.MenuBG.TileHeight + LINE_SPACE * 2));

            Initialize(new Rect(start, size), digits, 1, max, length - 1);

            AskTitle = new MenuText(Text.FormatKey("MENU_ITEM_AMOUNT_TITLE"), start + new Loc(size.X / 2, GraphicsManager.MenuBG.TileHeight), DirH.None);
            NonChoices.Add(AskTitle);
        }
예제 #3
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));
        }