Esempio n. 1
0
 public TextboxULong(TextboxULong g)
     : base(g)
 {
     g.font        = font;
     g.device      = device;
     g.spriteBatch = new SpriteBatch(g.device);
     g.text        = text;
     g.focused     = false;
     g.maxLength   = maxLength;
     g.render      = new RenderTarget2D(g.device, g.Image.Width - 5, g.Image.Height);
     g.Click      += new EventHandler <MouseElementEventArgs>(Textbox_Click);
 }
Esempio n. 2
0
        public MapInitPanel(Screen owner, Sprite sprite)
            : base(owner, sprite)
        {
            TextFont = content.Load <SpriteFont>(Fnames.TEXT_FONT);
            NumFont  = content.Load <SpriteFont>(Fnames.SEGOE_UI);

            #region Buttons

            Button Create = new Button(MultiSprite.CreateSprite(content, Fnames.CREATE_B, new Vector2(Bounds.Right - Bounds.Width / 1000f * 250, Bounds.Top + Bounds.Height / 1000f * 700), new Vector2(120, 41), Vector2.One));
            Create.AnimationMode = AnimationStates.Small;
            Create.Click        += new EventHandler <MouseElementEventArgs>(Create_Click);
            Create.MouseMove    += new EventHandler <MouseElementEventArgs>(Button_MouseMove);
            Create.MouseMoveOut += new EventHandler <MouseElementEventArgs>(Button_MouseMoveOut);

            Button Cancel = new Button(MultiSprite.CreateSprite(content, Fnames.CANCEL_B, new Vector2(Bounds.Right - Bounds.Width / 1000f * 250, Bounds.Top + Bounds.Height / 1000f * 800), new Vector2(120, 41), Vector2.One));
            Cancel.AnimationMode = AnimationStates.Small;
            Cancel.Click        += new EventHandler <MouseElementEventArgs>(Cancel_Click);
            Cancel.MouseMove    += new EventHandler <MouseElementEventArgs>(Button_MouseMove);
            Cancel.MouseMoveOut += new EventHandler <MouseElementEventArgs>(Button_MouseMoveOut);

            buttons.Add(Create);
            buttons.Add(Cancel);

            #endregion

            #region Textboxes

            TileWidthBox = new TextboxULong(MultiSprite.CreateSprite(content, Fnames.TEXTBOX1, new Vector2(Bounds.Left + Bounds.Width / 1000f * 125, Bounds.Top + Bounds.Height / 1000f * 150).Round(), new Vector2(160, 31), Vector2.One),
                                            NumFont,
                                            owner.GraphicsDevice);
            TileWidthBox.ValueChanged += new EventHandler <ValueChangedEventArgs <ulong> >(TileWidthBox_ValueChanged);
            TileWidthBox.MaxTextLength = 2;
            TileWidthBox.Value         = 64;

            FieldWidthBox = new TextboxULong(MultiSprite.CreateSprite(content, Fnames.TEXTBOX1, new Vector2(Bounds.Left + Bounds.Width / 1000f * 125, Bounds.Top + Bounds.Height / 1000f * 280).Round(), new Vector2(160, 31), Vector2.One),
                                             NumFont,
                                             owner.GraphicsDevice);
            FieldWidthBox.ValueChanged += new EventHandler <ValueChangedEventArgs <ulong> >(FieldWidthBox_ValueChanged);
            FieldWidthBox.MaxTextLength = 4;
            FieldWidthBox.Value         = 5000;

            FieldHeightBox = new TextboxULong(MultiSprite.CreateSprite(content, Fnames.TEXTBOX1, new Vector2(Bounds.Left + Bounds.Width / 1000f * 125, Bounds.Top + Bounds.Height / 1000f * 380).Round(), new Vector2(160, 31), Vector2.One),
                                              NumFont,
                                              owner.GraphicsDevice);
            FieldHeightBox.ValueChanged += new EventHandler <ValueChangedEventArgs <ulong> >(FieldHeightBox_ValueChanged);
            FieldHeightBox.MaxTextLength = 4;
            FieldHeightBox.Value         = 4000;

            textboxes.Add(TileWidthBox);
            textboxes.Add(FieldWidthBox);
            textboxes.Add(FieldHeightBox);

            #endregion

            msgPanel           = new MessagePanel(owner, Sprite.CreateSprite(content, Fnames.PANEL2, new Vector2(450, 350), new Vector2(350, 250)), " ", " ");
            msgPanel.Enabled  += new EventHandler <EventArgs>(msgPanel_Enabled);
            msgPanel.Disabled += new EventHandler <EventArgs>(msgPanel_Disabled);

            Components.AddRange(buttons);
            Components.AddRange(textboxes);
            Components.Add(msgPanel);
        }