public NumberSelectionMenu(string message, NumberSelectionMenu.behaviorOnNumberSelect behaviorOnSelection, int price = -1, int minValue = 0, int maxValue = 99, int defaultNumber = 0)
        {
            Vector2 expr_11 = Game1.dialogueFont.MeasureString(message);
            int     num     = Math.Max((int)expr_11.X, 600) + IClickableMenu.borderWidth * 2;
            int     num2    = (int)expr_11.Y + IClickableMenu.borderWidth * 2 + Game1.tileSize * 5 / 2;
            int     x       = Game1.viewport.Width / 2 - num / 2;
            int     y       = Game1.viewport.Height / 2 - num2 / 2;

            base.initialize(x, y, num, num2, false);
            this.message           = message;
            this.price             = price;
            this.minValue          = minValue;
            this.maxValue          = maxValue;
            this.currentValue      = defaultNumber;
            this.behaviorFunction  = behaviorOnSelection;
            this.numberSelectedBox = new TextBox(Game1.content.Load <Texture2D>("LooseSprites\\textBox"), null, Game1.smallFont, Game1.textColor)
            {
                X           = this.xPositionOnScreen + IClickableMenu.borderWidth + 14 * Game1.pixelZoom,
                Y           = this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2,
                Text        = string.Concat(this.currentValue),
                numbersOnly = true,
                textLimit   = string.Concat(maxValue).Length
            };
            this.numberSelectedBox.SelectMe();
            this.leftButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false)
            {
                myID            = 101,
                rightNeighborID = 102
            };
            this.rightButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth + 16 * Game1.pixelZoom + this.numberSelectedBox.Width, this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false)
            {
                myID            = 102,
                leftNeighborID  = 101,
                rightNeighborID = 103
            };
            this.okButton = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize * 2, this.yPositionOnScreen + this.height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + Game1.tileSize / 3, Game1.tileSize, Game1.tileSize), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false)
            {
                myID            = 103,
                leftNeighborID  = 102,
                rightNeighborID = 104
            };
            this.cancelButton = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize, this.yPositionOnScreen + this.height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + Game1.tileSize / 3, Game1.tileSize, Game1.tileSize), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false)
            {
                myID           = 104,
                leftNeighborID = 103
            };
            if (Game1.options.SnappyMenus)
            {
                base.populateClickableComponentList();
                this.snapToDefaultClickableComponent();
            }
        }
Example #2
0
 // Token: 0x06000F5C RID: 3932 RVA: 0x0013C068 File Offset: 0x0013A268
 public NumberSelectionMenu(string message, NumberSelectionMenu.behaviorOnNumberSelect behaviorOnSelection, int price = -1, int minValue = 0, int maxValue = 99, int defaultNumber = 0) : base(Game1.viewport.Width / 2 - (int)Game1.dialogueFont.MeasureString(message).X / 2 - IClickableMenu.borderWidth, Game1.viewport.Height / 2 - (int)Game1.dialogueFont.MeasureString(message).Y / 2, (int)Game1.dialogueFont.MeasureString(message).X + IClickableMenu.borderWidth * 2, (int)Game1.dialogueFont.MeasureString(message).Y + IClickableMenu.borderWidth * 2 + Game1.tileSize * 5 / 2, false)
 {
     this.message           = message;
     this.price             = price;
     this.minValue          = minValue;
     this.maxValue          = maxValue;
     this.currentValue      = defaultNumber;
     this.behaviorFunction  = behaviorOnSelection;
     this.numberSelectedBox = new TextBox(Game1.content.Load <Texture2D>("LooseSprites\\textBox"), null, Game1.smallFont, Game1.textColor)
     {
         X           = this.xPositionOnScreen + IClickableMenu.borderWidth + 14 * Game1.pixelZoom,
         Y           = this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2,
         Text        = string.Concat(this.currentValue),
         numbersOnly = true,
         textLimit   = string.Concat(maxValue).Length
     };
     this.numberSelectedBox.SelectMe();
     this.leftButton   = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
     this.rightButton  = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth + 16 * Game1.pixelZoom + this.numberSelectedBox.Width, this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
     this.okButton     = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize * 2, this.yPositionOnScreen + this.height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + Game1.tileSize / 3, Game1.tileSize, Game1.tileSize), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
     this.cancelButton = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize, this.yPositionOnScreen + this.height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + Game1.tileSize / 3, Game1.tileSize, Game1.tileSize), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
 }
Example #3
0
        public NumberSelectionMenu(string message, NumberSelectionMenu.behaviorOnNumberSelect behaviorOnSelection, int price = -1, int minValue = 0, int maxValue = 99, int defaultNumber = 0)
        {
            Vector2 vector2 = Game1.dialogueFont.MeasureString(message);
            int     width   = Math.Max((int)vector2.X, 600) + IClickableMenu.borderWidth * 2;
            int     height  = (int)vector2.Y + IClickableMenu.borderWidth * 2 + Game1.tileSize * 5 / 2;

            this.initialize(Game1.viewport.Width / 2 - width / 2, Game1.viewport.Height / 2 - height / 2, width, height, false);
            this.message          = message;
            this.price            = price;
            this.minValue         = minValue;
            this.maxValue         = maxValue;
            this.currentValue     = defaultNumber;
            this.behaviorFunction = behaviorOnSelection;
            TextBox textBox = new TextBox(Game1.content.Load <Texture2D>("LooseSprites\\textBox"), (Texture2D)null, Game1.smallFont, Game1.textColor);

            textBox.X    = this.xPositionOnScreen + IClickableMenu.borderWidth + 14 * Game1.pixelZoom;
            textBox.Y    = this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2;
            textBox.Text = string.Concat((object)this.currentValue);
            int num1 = 1;

            textBox.numbersOnly = num1 != 0;
            int length = string.Concat((object)maxValue).Length;

            textBox.textLimit      = length;
            this.numberSelectedBox = textBox;
            this.numberSelectedBox.SelectMe();
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num2 = 101;

            textureComponent1.myID = num2;
            int num3 = 102;

            textureComponent1.rightNeighborID = num3;
            this.leftButton = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth + 16 * Game1.pixelZoom + this.numberSelectedBox.Width, this.yPositionOnScreen + IClickableMenu.borderWidth + this.height / 2, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num4 = 102;

            textureComponent2.myID = num4;
            int num5 = 101;

            textureComponent2.leftNeighborID = num5;
            int num6 = 103;

            textureComponent2.rightNeighborID = num6;
            this.rightButton = textureComponent2;
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize * 2, this.yPositionOnScreen + this.height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + Game1.tileSize / 3, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            int num7 = 103;

            textureComponent3.myID = num7;
            int num8 = 102;

            textureComponent3.leftNeighborID = num8;
            int num9 = 104;

            textureComponent3.rightNeighborID = num9;
            this.okButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = new ClickableTextureComponent("OK", new Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize, this.yPositionOnScreen + this.height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + Game1.tileSize / 3, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
            int num10 = 104;

            textureComponent4.myID = num10;
            int num11 = 103;

            textureComponent4.leftNeighborID = num11;
            this.cancelButton = textureComponent4;
            if (!Game1.options.SnappyMenus)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
        }