Example #1
0
        public override void Initialize()
        {
            Viewport  viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;
            Texture2D tex      = Resources.Menus.Title.LoginButton;
            Rectangle rect     = new Rectangle(0, 290, tex.Width, tex.Height);

            loginButton            = new UIElement(this, tex, rect);
            loginButton.Clicked   += LoginClick;
            loginButton.MouseOver += MouseOver;
            loginButton.MouseOff  += MouseOff;
            loginButton.color      = Color.Black;
            Manager.Elements.Add(loginButton);

            tex                      = Resources.Menus.Title.OptionsButton;
            rect                     = new Rectangle(0, 370, tex.Width, tex.Height);
            optionsButton            = new UIElement(this, tex, rect);
            optionsButton.Clicked   += OptionsClick;
            optionsButton.MouseOver += MouseOver;
            optionsButton.MouseOff  += MouseOff;
            optionsButton.color      = Color.Black;
            Manager.Elements.Add(optionsButton);

            tex                   = Resources.Menus.Title.ExitButton;
            rect                  = new Rectangle(0, 450, tex.Width, tex.Height);
            exitButton            = new UIElement(this, tex, rect);
            exitButton.Clicked   += ExitClick;
            exitButton.MouseOver += MouseOver;
            exitButton.MouseOff  += MouseOff;
            exitButton.color      = Color.Black;
            Manager.Elements.Add(exitButton);



            pointerTex        = Resources.Menus.Title.Pointer;
            pointerDimensions = new Rectangle(0, 0, pointerTex.Width, pointerTex.Height);

            loginMenu       = Resources.Menus.Title.LoginMenu;
            loginDimensions = new Rectangle(viewport.Width / 2 - loginMenu.Width / 2, viewport.Height, loginMenu.Width, loginMenu.Height);

            tex  = Resources.Menus.Title.LoginConfirmButton;
            rect = new Rectangle(25, 9, tex.Width, tex.Height);
            rect.Offset(loginDimensions.Location);

            loginConfirmButton          = new UIElement(this, tex, rect);
            loginConfirmButton.Clicked += ConfirmClick;

            Manager.Elements.Add(loginConfirmButton);

            tex  = Resources.Menus.Title.TextBox;
            rect = new Rectangle(186, 6, tex.Width, tex.Height);
            rect.Offset(loginDimensions.Location);
            usernameBar = new UITextBox(this, tex, rect, false);
            rect        = new Rectangle(186, 42, tex.Width, tex.Height);
            rect.Offset(loginDimensions.Location);
            passwordBar = new UITextBox(this, tex, rect, true);
            Manager.Elements.Add(usernameBar);
            Manager.Elements.Add(passwordBar);

            loginBackButton = new UIStandardButton(this, new Point(128, 128), "Back");
            loginBackButton.dimensions.Offset(loginDimensions.Location);
            loginBackButton.hasButton  = true;
            loginBackButton.customFont = Resources.Menus.BaroqueScript16;
            loginBackButton.Clicked   += LoginCancel;
            Manager.Elements.Add(loginBackButton);
        }
Example #2
0
        public override void Initialize()
        {
            Viewport viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;
            Texture2D tex = Resources.Menus.Title.LoginButton;
            Rectangle rect = new Rectangle(0, 290, tex.Width, tex.Height);
            loginButton = new UIElement(this, tex, rect);
            loginButton.Clicked += LoginClick;
            loginButton.MouseOver += MouseOver;
            loginButton.MouseOff += MouseOff;
            loginButton.color = Color.Black;
            Manager.Elements.Add(loginButton);

            tex = Resources.Menus.Title.OptionsButton;
            rect = new Rectangle(0, 370, tex.Width, tex.Height);
            optionsButton = new UIElement(this, tex, rect);
            optionsButton.Clicked += OptionsClick;
            optionsButton.MouseOver += MouseOver;
            optionsButton.MouseOff += MouseOff;
            optionsButton.color = Color.Black;
            Manager.Elements.Add(optionsButton);

            tex = Resources.Menus.Title.ExitButton;
            rect = new Rectangle(0, 450, tex.Width, tex.Height);
            exitButton = new UIElement(this, tex, rect);
            exitButton.Clicked += ExitClick;
            exitButton.MouseOver += MouseOver;
            exitButton.MouseOff += MouseOff;
            exitButton.color = Color.Black;
            Manager.Elements.Add(exitButton);

            pointerTex = Resources.Menus.Title.Pointer;
            pointerDimensions = new Rectangle(0, 0, pointerTex.Width, pointerTex.Height);

            loginMenu = Resources.Menus.Title.LoginMenu;
            loginDimensions = new Rectangle(viewport.Width / 2 - loginMenu.Width / 2, viewport.Height, loginMenu.Width, loginMenu.Height);

            tex = Resources.Menus.Title.LoginConfirmButton;
            rect = new Rectangle(25, 9, tex.Width, tex.Height);
            rect.Offset(loginDimensions.Location);

            loginConfirmButton = new UIElement(this, tex, rect);
            loginConfirmButton.Clicked += ConfirmClick;

            Manager.Elements.Add(loginConfirmButton);

            tex = Resources.Menus.Title.TextBox;
            rect = new Rectangle(186, 6, tex.Width,tex.Height);
            rect.Offset(loginDimensions.Location);
            usernameBar = new UITextBox(this, tex, rect, false);
            rect = new Rectangle(186, 42, tex.Width, tex.Height);
            rect.Offset(loginDimensions.Location);
            passwordBar = new UITextBox(this, tex, rect, true);
            Manager.Elements.Add(usernameBar);
            Manager.Elements.Add(passwordBar);

            loginBackButton = new UIStandardButton(this, new Point(128, 128), "Back");
            loginBackButton.dimensions.Offset(loginDimensions.Location);
            loginBackButton.hasButton = true;
            loginBackButton.customFont = Resources.Menus.BaroqueScript16;
            loginBackButton.Clicked += LoginCancel;
            Manager.Elements.Add(loginBackButton);
        }
Example #3
0
 public void SetActiveTextBox(UITextBox box)
 {
     acceptTextInput = true;
     activeText = box;
     textEditPosition = box.TrueContents.Length;
 }