예제 #1
0
 protected void ProcessTextInput(string inputChars)
 {
     if (inputChars != "")
     {
         //characters will be appended one by one until finished or full
         int ii;
         for (ii = 0; ii < inputChars.Length; ii++)
         {
             Text.SetText(Text.Text + inputChars[ii]);
             if (MaxCharLength > 0 && Text.Text.Length > MaxCharLength || Text.GetTextLength() > MaxLength)
             {
                 Text.SetText(Text.Text.Substring(0, Text.Text.Length - 1));
                 break;
             }
         }
         if (ii > 0)
         {
             GameManager.Instance.SE("Menu/Confirm");
         }
         else
         {
             GameManager.Instance.SE("Menu/Cancel");
         }
         UpdatePickerPos();
     }
     else
     {
         //forbid any other button pressing
     }
 }
예제 #2
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));
        }