コード例 #1
0
    public override bool Init()
    {
        if (base.Init() == false)
        {
            return(false);
        }

        image_board = GetComponent <Image>();
        textbox     = GetComponentInChildren <UITextBox>();

        foreach (UIElement e in GetComponentsInChildren <UIElement>())
        {
            switch (e.GetUIType())
            {
            case UIType.IMAGE_BOX:
                image_box = e.GetComponent <Image>();
                break;

            case UIType.BUTTON_OK:
                button_yes = e.GetComponent <UIButton>();
                break;

            case UIType.BUTTON_NO:
                button_no = e.GetComponent <UIButton>();
                break;
            }
        }

        AddCallbackYes(OnYes);
        AddCallbackNo(OnNo);

        return(true);
    }
コード例 #2
0
ファイル: OptionsMenu.cs プロジェクト: Aryn/Mobile-Fortress
        public override void Initialize()
        {
            viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;

            Point loc = new Point(viewport.Width / 2 - 128, 32);
            OptionsTitle = new UIStandardButton(this, loc, "Options");
            OptionsTitle.customFont = Resources.Menus.BaroqueScript16;

            Texture2D tex = Resources.Menus.Title.TextBox;
            loc = new Point(32, 128);
            Server = new UIStandardButton(this, loc, "Server Address");
            Rectangle dim = new Rectangle(loc.X+Server.dimensions.Width+12,loc.Y+8,tex.Width,tex.Height);
            ServerAddress = new UITextBox(this, tex, dim, false);
            ServerAddress.Contents = Network.NetworkAddress;
            Manager.Elements.Add(ServerAddress);

            loc = new Point(32, 196);
            MouseSettings = new UIStandardButton(this, loc, "Mouse Sensitivity");

            dim = new Rectangle(loc.X + MouseSettings.dimensions.Width + 12, loc.Y + 8, tex.Width/6, tex.Height);
            Sensitivity = new UITextBox(this, tex, dim, false);
            Sensitivity.Contents = (Controls.Instance.mouseSensitivityX / 0.015f).ToString();
            Sensitivity.maxLength = 3;
            Manager.Elements.Add(Sensitivity);

            loc = new Point(32, viewport.Height - 64);
            Exit = new UIStandardButton(this, loc, "Exit");
            Exit.hasButton = true;
            Exit.customFont = Resources.Menus.BaroqueScript16;
            Exit.Clicked += new UIElement.ClickEvent(Exit_Clicked);
            Manager.Elements.Add(Exit);

            pointerTex = Resources.Menus.Title.Pointer;
            pointerDim = new Rectangle(0, 0, pointerTex.Width, pointerTex.Height);
        }
コード例 #3
0
        public static void Perform()
        {
            IUIControl objRoot = new UIPanel();

            objRoot.Name = "Panel1";
            IUIControl objChild1 = new UITextBox();

            objChild1.Name = "Textbox1.1";
            objRoot.CreateChild(objChild1);
            IUIControl objChild2 = new UIPanel();

            objChild2.Name = "Panel1.1";
            objRoot.CreateChild(objChild2);
            IUIControl objChild21 = new UITextBox();

            objChild21.Name = "Textbox1.1.1";
            objChild2.CreateChild(objChild21);
            IUIControl objChild22 = new UITextBox();

            objChild22.Name = "Textbox1.1.2";
            objChild2.CreateChild(objChild22);
            IUIControl objChild23 = new UITextBox();

            objChild23.Name = "Textbox1.1.3";
            objChild2.CreateChild(objChild23);
            objRoot.Render();


            Console.WriteLine();
        }
コード例 #4
0
        public NameCreation(CharacterCreation parent, CharacterCreationOutput output)
        {
            myParent = parent;
            myOutput = output;

            var label = new UILabel(Font.Large, new Vector2(4, 24))
            {
                Text = "Name:"
            };

            AddChild(label);

            myTextbox = new UITextBox(new Vector2(200 - 70 - 2, 20), new Vector2(70, 20))
            {
                Text = "Player"
            };
            AddChild(myTextbox);

            var button = new UIButton(new Vector2(100, 20), new Vector2(100 - 4, 80 - 4))
            {
                Text       = "Next",
                CentreText = true
            };

            button.Click += new MouseButtonEventHandler(button_Click);
            AddChild(button);

            CanResize = true;
            SetSize(200, 100);

            myTextbox.Focus();
        }
コード例 #5
0
        public UINominationSelectContainer(NhoodCandidateList candidates, bool nonPerson)
        {
            NonPerson = nonPerson;
            var ui     = RenderScript("fsodonatorlist.uis");
            var listBg = ui.Create <UIImage>("ListBoxBackground");

            AddAt(0, listBg);
            listBg.With9Slice(25, 25, 25, 25);
            listBg.Width  += 110;
            listBg.Height += 50;

            RoommateListSlider.AttachButtons(RoommateListScrollUpButton, RoommateScrollDownButton, 1);
            RoommateListBox.AttachSlider(RoommateListSlider);
            RoommateListBox.Columns[1].Alignment = Framework.TextAlignment.Left | Framework.TextAlignment.Middle;

            DonatorsLabel.Caption             = "Search";
            DonatorsLabel.CaptionStyle        = DonatorsLabel.CaptionStyle.Clone();
            DonatorsLabel.CaptionStyle.Shadow = true;
            DonatorsLabel.Y -= 26;

            foreach (var child in GetChildren())
            {
                child.Y -= 45;
            }

            SearchBox   = new UITextBox();
            SearchBox.X = RoommateListBox.X;
            SearchBox.Y = 20;
            SearchBox.SetSize(listBg.Width, 25);
            SearchBox.OnChange += SearchBox_OnChange;
            Add(SearchBox);

            Candidates = candidates;
            UpdateCandidateList(candidates);
        }
コード例 #6
0
    private void initDebug()
    {
        p_DebugLabel = (UILabel)addUI(new UILabel(this));
        p_DebugLabel.TextAlignment = TextAlign.Right;
        p_DebugLabel.ForeBrush     = Brushes.White;
        p_DebugLabel.Font          = new Font("Arial", 12, FontStyle.Bold);
        p_DebugLabel.Disable();

        p_DebugTextBox         = (UITextBox)addUI(new UITextBox(this));
        p_DebugTextBox.Visible = false;
        p_DebugTextBox.Text    = "";
        p_DebugTextBox.Font    = new Font("Arial", 20, FontStyle.Regular);
        p_DebugTextBox.Width   = 400;

        p_DebugTextBox.KeyDown += delegate(Game game, KeyEventArgs e) {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }

            p_DebugPrompt          = false;
            p_DebugTextBox.Visible = false;
            p_DebugTextBox.RemoveFocus();
            try { cmd(p_DebugTextBox.Text); }
            catch (Exception ex) {
                if (ex.Message == "Debug crash")
                {
                    throw ex;
                }
            }
            return;
        };
    }
コード例 #7
0
        public UIColorPicker()
        {
            ClickHandler =
                ListenForMouse(new Rectangle(0, 0, 206, 128), new UIMouseEvent(OnMouseEvent));

            RedText = new UITextBox();
            RedText.SetBackgroundTexture(null, 0, 0, 0, 0);
            RedText.SetSize(40, 22);
            RedText.Position  = new Vector2(232, 50);
            RedText.OnChange += RecalcColor;
            Add(RedText);

            var redLabel = new UILabel();

            redLabel.Position = RedText.Position - new Vector2(20, -4);
            redLabel.Caption  = "R:";
            Add(redLabel);

            GreenText = new UITextBox();
            GreenText.SetBackgroundTexture(null, 0, 0, 0, 0);
            GreenText.SetSize(40, 22);
            GreenText.Position  = new Vector2(232, 50 + 28);
            GreenText.OnChange += RecalcColor;
            Add(GreenText);

            var greenLabel = new UILabel();

            greenLabel.Position = GreenText.Position - new Vector2(20, -4);
            greenLabel.Caption  = "G:";
            Add(greenLabel);

            BlueText = new UITextBox();
            BlueText.SetBackgroundTexture(null, 0, 0, 0, 0);
            BlueText.SetSize(40, 22);
            BlueText.Position  = new Vector2(232, 50 + 28 * 2);
            BlueText.OnChange += RecalcColor;
            Add(BlueText);

            var blueLabel = new UILabel();

            blueLabel.Position = BlueText.Position - new Vector2(20, -4);
            blueLabel.Caption  = "B:";
            Add(blueLabel);

            HexText = new UITextBox();
            HexText.SetBackgroundTexture(null, 0, 0, 0, 0);
            HexText.SetSize(68, 45);
            HexText.Alignment        = TextAlignment.Center | TextAlignment.Middle;
            HexText.TextStyle        = HexText.TextStyle.Clone();
            HexText.TextStyle.Shadow = true;
            HexText.TextStyle.Size   = 8;
            HexText.Position         = new Vector2(208, 0);
            HexText.OnChange        += HexText_OnChange;
            Add(HexText);

            InternalChange = 1;
            RecalcColor(null);
            InternalChange = 0;
        }
コード例 #8
0
ファイル: UIPage.cs プロジェクト: akaAgar/one-bit-of-engine
        /// <summary>
        /// (Protected) Adds a new <see cref="UITextBox"/> control on the page.
        /// </summary>
        /// <param name="x">X coordinate</param>
        /// <param name="y">Y coordinate</param>
        /// <param name="width">Width of the textbox</param>
        /// <param name="height">Height of the textbox</param>
        /// <param name="text">Text</param>
        /// <param name="fontTile">The tile to use for this control's font. Font tiles must follow one another on the tilemap (but can be on multiple rows) and provide all the ASCII characters in the 32 (white space) to 126 (~) range.</param>
        /// <param name="color">Color</param>
        /// <param name="tilemap">Font tile tilemap</param>
        /// <returns>An UITextBox control</returns>
        protected UITextBox AddTextBox(int x, int y, int width, int height, string text, int fontTile, RGBColor color, int tilemap = 0)
        {
            UITextBox control = AddControl <UITextBox>(x, y, color, tilemap);

            control.Size     = new Dimension(width, height);
            control.FontTile = fontTile;
            control.Text     = text;
            return(control);
        }
コード例 #9
0
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm    = vm;
            this.Owner = owner;

            if (FSOEnvironment.SoftwareKeyboard)
            {
                //need a button to initiate chat history
                var btn = new UIButton();
                btn.Caption        = "Chat";
                btn.Position       = new Vector2(10, 10);
                btn.OnButtonClick += (state) =>
                {
                    HistoryDialog.Visible = !HistoryDialog.Visible;
                };
                Add(btn);
            }

            Style        = TextStyle.DefaultTitle.Clone();
            Style.Size   = 16;
            Style.Shadow = true;
            Labels       = new List <UIChatBalloon>();

            TextBox         = new UITextBox();
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            TextBox.OnEnterPress += SendMessageElem;

            SelectionFillColor = new Color(0, 25, 70);

            //-- populate invalid areas --
            //chat bubbles will be pushed out of these areas
            //when this happens, they will also begin displaying the name of the speaking avatar.

            InvalidAreas = new List <Rectangle>();
            InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight));                                   //left
            InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020));                                    //top
            InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230));                                       //ucp

            HistoryDialog                = new UIChatDialog();
            HistoryDialog.Position       = new Vector2(20, 20);
            HistoryDialog.Visible        = false;
            HistoryDialog.Opacity        = 0.75f;
            HistoryDialog.OnSendMessage += SendMessage;
            this.Add(HistoryDialog);

            PropertyLog          = new UIPropertyLog();
            PropertyLog.Position = new Vector2(400, 20);
            PropertyLog.Visible  = false;
            PropertyLog.Opacity  = 0.75f;
            this.Add(PropertyLog);
        }
コード例 #10
0
        public SelfCalibrationColorStandard(
            ref UITextBox textBox_CurrentL,
            ref UITextBox textBox_CurrentA,
            ref UITextBox textBox_CurrentB)
        {
            this.textBox_CurrentL = textBox_CurrentL;
            this.textBox_CurrentA = textBox_CurrentA;
            this.textBox_CurrentB = textBox_CurrentB;

            standardSrcMode = 3; // 标准值来源设为3
        }
コード例 #11
0
        private void uiTextBox2_Click(object sender, EventArgs e)
        {
            UITextBox uIIntegerUpDown = (UITextBox)sender;
            KeyBord   keyBord         = new KeyBord();

            keyBord.InputText = uIIntegerUpDown.Text;
            if (keyBord.ShowDialog(this) == DialogResult.OK)
            {
                uIIntegerUpDown.Text = keyBord.InputText;
            }
        }
コード例 #12
0
 /// <summary>
 /// 多线程访问控件委托,在textBox中显示数据
 /// </summary>
 public static void showDataInTextBox(ref UITextBox textBox, string data)
 {
     if (textBox.InvokeRequired)
     {
         showDataInTextBoxDelegate d = showDataInTextBox;
         textBox.Invoke(d, textBox, data);
     }
     else
     {
         textBox.Text = data;
     }
 }
コード例 #13
0
        public override void OnInitialize()
        {
            Field[0] = new UITextBox("Map Name", 1f, true)
            {
                TextColor = Color.White,
                HAlign    = 0.5f,
                VAlign    = 0.5f
            };
            Field[0].Width.Set(350f, 0f);
            Append(Field[0]);

            Recalculate();
        }
コード例 #14
0
        public IPPrompt(IPPromptResultHandler handler)
            : base(new Vector2(192, 128))
        {
            myHandler = handler;

            CanClose = false;

            UILabel label = new UILabel(Font.Large, new Vector2(4, 4))
            {
                Text = "Please enter the IP\naddress of the server\nyou wish to join"
            };

            AddChild(label);

            myTextBox = new UITextBox(new Vector2(InnerWidth - 8, 20), new Vector2(4, label.Bottom + 12))
            {
                Text = "127.0.0.1"
            };
            AddChild(myTextBox);

            float btnWidth = InnerWidth / 2.0f - 6.0f;

            UIButton joinBtn = new UIButton(new Vector2(btnWidth, 24), new Vector2(4, myTextBox.Bottom + 4))
            {
                Text = "Join"
            };

            AddChild(joinBtn);

            UIButton cancelBtn = new UIButton(new Vector2(btnWidth, 24), new Vector2(btnWidth + 8, myTextBox.Bottom + 4))
            {
                Text = "Cancel"
            };

            AddChild(cancelBtn);

            joinBtn.Click += delegate(object sender, MouseButtonEventArgs e)
            {
                if (Validate())
                {
                    Close();
                    SendToHandler();
                }
            };

            cancelBtn.Click += delegate(object sender, MouseButtonEventArgs e)
            {
                Close();
            };
        }
コード例 #15
0
ファイル: MenuManager.cs プロジェクト: Aryn/Mobile-Fortress
        public void Update(GameTime gameTime, MouseState mouse)
        {
            if (!Controls.Instance.leftMouse && mouse.LeftButton == ButtonState.Pressed)
            {
                Controls.Instance.acceptTextInput = false;
            }
            bool isOverButton = false;

            foreach (UIElement element in Elements)
            {
                if (element.canClick)
                {
                    if (element.dimensions.Contains(new Point(mouse.X, mouse.Y)))
                    {
                        if (!element.mouseOver)
                        {
                            element.DoMouseOver();
                        }
                        element.mouseOver = true;
                        if (!Controls.Instance.leftMouse && mouse.LeftButton == ButtonState.Pressed)
                        {
                            element.DoClick();
                        }
                        if (!Controls.Instance.rightMouse && mouse.RightButton == ButtonState.Pressed)
                        {
                            element.DoRightClick();
                        }
                        isOverButton = true;
                    }
                    else
                    {
                        if (element.mouseOver)
                        {
                            element.DoMouseOff();
                        }
                        element.mouseOver = false;
                    }
                }
                if (element is UITextBox)
                {
                    UITextBox textBox = (UITextBox)element;
                    textBox.UpdateBlink(gameTime);
                }
            }
            if (!isOverButton && !Controls.Instance.leftMouse && mouse.LeftButton == ButtonState.Pressed)
            {
                DoClickAway();
            }
        }
コード例 #16
0
        public ClientLobbyGameState(ShooterGame game)
            : base(game)
        {
            Game = game;
            UIButtonDynamic refreshButton   = new UIButtonDynamic(100, 100, 200, 20, Refresh, game.Data.DefaultButtonFrame, game.Data.DefaultFont, "Refresh");
            UIButtonDynamic connectButton   = new UIButtonDynamic(100, 130, 200, 20, Connect, game.Data.DefaultButtonFrame, game.Data.DefaultFont, "Connect");
            UIButtonDynamic backButton      = new UIButtonDynamic(100, 160, 200, 20, Back, game.Data.DefaultButtonFrame, game.Data.DefaultFont, "Back");
            UIText          playerNameLabel = new UITextBox(350, 100, 200, 20, game.Data.DefaultFont, Color.White, "Player Name: ");

            PlayerName = new UITextBox(550, 100, 1000, 20, game.Data.DefaultFont, Color.White, "Test Player", 32);
            PlayerName.TakesFocusOnMouseAction = true;
            ServerList        = new UIText(350, 130, 1000, 1000, game.Data.DefaultFont, Color.White);
            ServerList.String = "Server list: \n";
            UI.Add(refreshButton, connectButton, backButton, playerNameLabel, PlayerName, ServerList);
        }
コード例 #17
0
        public void AddText(TextPos textPos)
        {
            if (getFirstSelectedShape() == null)
            {
                typing = false;
                return;
            }

            Vector2 pos = new Vector2(getFirstSelectedShape().X, getFirstSelectedShape().Y);

            textBox = UIBasics.BasicTextbox((int)pos.X + 3, (int)pos.Y - 35, (s) => {
                typing = false;
                addText(s, textPos);
            });
        }
コード例 #18
0
        void addText(string text, TextPos textPos)
        {
            foreach (mCanvas c in playground.Canvases)
            {
                foreach (aShape shape in c.Shapes)
                {
                    if (shape.Selected)
                    {
                        playground.ExecuteCommand(new AddTextCommand(playground, shape, text, textPos));
                        break;
                    }
                }
            }

            textBox = null;
        }
コード例 #19
0
        public UINominationSelectContainer(NhoodCandidateList candidates)
        {
            var ui     = RenderScript("fsodonatorlist.uis");
            var listBg = ui.Create <UIImage>("ListBoxBackground");

            AddAt(0, listBg);
            listBg.With9Slice(25, 25, 25, 25);
            listBg.Width  += 110;
            listBg.Height += 50;

            /*
             * Dropdown = ui.Create<UIInboxDropdown>("PullDownMenuSetup");
             * Dropdown.OnSearch += (query) =>
             * {
             *  FindController<GenericSearchController>()?.Search(query, false, (results) =>
             *  {
             *      Dropdown.SetResults(results);
             *  });
             * };
             * Dropdown.OnSelect += AddDonator;
             * Add(Dropdown);*/

            RoommateListSlider.AttachButtons(RoommateListScrollUpButton, RoommateScrollDownButton, 1);
            RoommateListBox.AttachSlider(RoommateListSlider);
            RoommateListBox.Columns[1].Alignment = Framework.TextAlignment.Left | Framework.TextAlignment.Middle;

            DonatorsLabel.Caption             = "Search";
            DonatorsLabel.CaptionStyle        = DonatorsLabel.CaptionStyle.Clone();
            DonatorsLabel.CaptionStyle.Shadow = true;
            DonatorsLabel.Y -= 26;

            foreach (var child in GetChildren())
            {
                child.Y -= 45;
            }

            SearchBox   = new UITextBox();
            SearchBox.X = RoommateListBox.X;
            SearchBox.Y = 20;
            SearchBox.SetSize(listBg.Width, 25);
            SearchBox.OnChange += SearchBox_OnChange;
            Add(SearchBox);

            Candidates = candidates;
            UpdateCandidateList(candidates);
        }
コード例 #20
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="textBox_CurrentL">控件的引用 当前值L</param>
 /// <param name="textBox_CurrentA">当前值A</param>
 /// <param name="textBox_CurrentB">当前值B</param>
 public StripProductionInformationServiceImpl(
     ref UITextBox textBox_CurrentL,
     ref UITextBox textBox_CurrentA,
     ref UITextBox textBox_CurrentB,
     ref UITextBox text_Height,
     ref Label label_ConnectStatus,
     ref WebBrowser wb_leftchart,
     ref WebBrowser wb_fullchart
     )
 {
     this.textBox_CurrentA    = textBox_CurrentA;
     this.textBox_CurrentB    = textBox_CurrentB;
     this.textBox_CurrentL    = textBox_CurrentL;
     this.text_Height         = text_Height;
     this.label_ConnectStatus = label_ConnectStatus;
     this.wb_leftchart        = wb_leftchart;
     this.wb_fullchart        = wb_fullchart;
 }
コード例 #21
0
 /// <summary>
 /// A UICheatTextbox with text
 /// </summary>
 /// <param name="initialText"></param>
 public UICheatTextbox(FSO.SimAntics.VM vm, string initialText)
 {
     ts1VM       = vm;
     baseTextbox = new UITextBox()
     {
         CurrentText  = initialText,
         FlashOnEmpty = true,
         MaxLines     = 1,
         //Tooltip = "Cheaters never win",
         //FrameColor = Color.Transparent,
         ID = "UICheatTextboxBase",
     };
     baseTexture = new Texture2D(GameFacade.GraphicsDevice, 1, 1);
     baseTexture.SetData(new Color[] { new Color((byte)67, (byte)93, (byte)90, (byte)255) });
     baseTextbox.SetBackgroundTexture(baseTexture, 0, 0, 0, 0);
     Size = new Vector2(200, 23);
     baseTextbox.SetSize(200, 23);
     Add(baseTextbox);
 }
コード例 #22
0
        public override void Initialize(GraphicsDeviceManager graphics)
        {
            _lbl_login         = new UILabel(new Point((int)(graphics.PreferredBackBufferWidth * 0.5f - 250), (int)(graphics.PreferredBackBufferHeight * 0.5f + 100)), 100, 40, "Username :"******"Password :"******"Login");
            _btn_login.OnGainFocus += (sender, e) =>
            {
                var message = new LoginMessage()
                {
                    UserName = _txt_login.Text,
                    Password = _txt_pass.Text
                };

                ManagerNetwork.Instance.Login(message);
                _txt_login.Text = "";
                _txt_pass.Text  = "";
                _loginSended    = true;
            };
            _btn_login.TextCentered   = false;
            _btn_login.ButtonDisabled = true;

            _logo = new UIImage(new Point((int)(MyGame.Instance.Graphics.PreferredBackBufferWidth * 0.5f - 250), (int)(MyGame.Instance.Graphics.PreferredBackBufferHeight * 0.5f - 300)),
                                500, 250, "ff7-logo");

            _lbl_serverStatus = new UILabel(new Point(graphics.PreferredBackBufferWidth - 100, 10), 100, 40, "");

            _lastUpdateButton = DateTime.Now;

            ManagerUI.Instance.AddItem(_lbl_login);
            ManagerUI.Instance.AddItem(_txt_login);
            ManagerUI.Instance.AddItem(_lbl_pass);
            ManagerUI.Instance.AddItem(_txt_pass);
            ManagerUI.Instance.AddItem(_btn_login);
            ManagerUI.Instance.AddItem(_lbl_serverStatus);
            ManagerUI.Instance.AddItem(_logo);
        }
コード例 #23
0
        public override void Initialize(GraphicsDeviceManager graphics)
        {
            //_popup = new UIInfoPopup(500, 200);
            //_popup.Visible = false;
            //_popup.Text = "Le nom existe déjà";
            //_popup.Modal = true;
            //_popup.OnOk += (sender, e) =>
            //{
            //    _popup.Visible = false;
            //};

            _characterSelect = new CharacterSelect(
                new Point(
                    (int)((graphics.PreferredBackBufferWidth - (int)(graphics.PreferredBackBufferWidth * 0.5 - 100)) * 0.5),
                    100
                    ),
                (int)(graphics.PreferredBackBufferWidth * 0.5 - 100), (int)(graphics.PreferredBackBufferHeight * 0.5));
            _characterSelect.Initialize(graphics);

            _txt_name         = new UITextBox(new Point((int)(graphics.PreferredBackBufferWidth * 0.5 - 150), (int)(graphics.PreferredBackBufferHeight * 0.8)), 300, 40);
            _txt_name.MaxSize = 15;

            _btn_create              = new UIButton(new Point((int)(graphics.PreferredBackBufferWidth * 0.5 - 50), (int)(graphics.PreferredBackBufferHeight * 0.9)), 100, 40, "Create");
            _btn_create.OnGainFocus += (sender, e) =>
            {
                var character = new Character(_txt_name.Text, _characterSelect.Model);
                //var sended = ManagerNetwork.Instance.SendCharacterCreation(character);
                //_btn_create.ButtonDisabled = sended;
            };

            _btn_cancel              = new UIButton(new Point((int)(graphics.PreferredBackBufferWidth * 0.5 + 100), (int)(graphics.PreferredBackBufferHeight * 0.9)), 100, 40, "Cancel");
            _btn_cancel.OnGainFocus += (sender, e) =>
            {
                ManagerState.Instance.ChangeState(EnumState.CHARACTER_SELECT);
            };

            ManagerUI.Instance.AddItem(_characterSelect);
            ManagerUI.Instance.AddItem(_txt_name);
            ManagerUI.Instance.AddItem(_btn_create);
            ManagerUI.Instance.AddItem(_btn_cancel);
        }
コード例 #24
0
        public override void Initialize()
        {
            byte objects = 5;
            int  width   = 300;
            int  height  = 22;
            int  margin  = 10;
            int  y       = margin;
            int  x       = 10;

            pnl1 = new UIPanel(new Vector2(500, 500), new Vector2(width + (x * 2), (objects * height) + ((objects + 1) * y + 30)));

            y  += height + margin;
            tb  = new UITextBox(new Vector2(x, y), new Vector2(width, height), Main.fontItemStack, "Test text", parent: pnl1);
            y  += height + margin;
            bar = new UIProgressBar(new Vector2(x, y), new Vector2(width, height), parent: pnl1);
            y  += height + margin;
            chk = new UICheckBox(new Vector2(x, y), width, 20, Main.fontItemStack, "Check this", parent: pnl1);
            y  += height + margin;
            num = new UINumberBox(new Vector2(x, y), new Vector2(width, height), Main.fontItemStack, parent: pnl1);
            y  += height + margin;
            btn = new UIButton(new Vector2(x, y), new Vector2(width, height), Main.fontItemStack, "Click Here", parent: pnl1);

            tb.GotFocus  += tb_GotFocus;
            tb.LostFocus += tb_LostFocus;

            pnl1.MouseEnter += pnl1_MouseEnter;
            pnl1.MouseLeave += pnl1_MouseLeave;

            bar.Maximum    = 100;
            bar.BarMargin  = new Vector2(0, 5);
            bar.StepAmount = 10;

            chk.BoxColor  = Color.CornflowerBlue;
            chk.TickColor = Color.Crimson;

            btn.Click     += btn_Click;
            btn.MouseDown += btn_MouseDown;
            btn.MouseUp   += btn_MouseUp;

            base.Initialize();
        }
コード例 #25
0
        public override void Initialize()
        {
            viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;

            Point loc = new Point(viewport.Width / 2 - 128, 32);

            OptionsTitle            = new UIStandardButton(this, loc, "Options");
            OptionsTitle.customFont = Resources.Menus.BaroqueScript16;

            Texture2D tex = Resources.Menus.Title.TextBox;

            loc    = new Point(32, 128);
            Server = new UIStandardButton(this, loc, "Server Address");
            Rectangle dim = new Rectangle(loc.X + Server.dimensions.Width + 12, loc.Y + 8, tex.Width, tex.Height);

            ServerAddress          = new UITextBox(this, tex, dim, false);
            ServerAddress.Contents = Network.NetworkAddress;
            Manager.Elements.Add(ServerAddress);

            loc           = new Point(32, 196);
            MouseSettings = new UIStandardButton(this, loc, "Mouse Sensitivity");

            dim                   = new Rectangle(loc.X + MouseSettings.dimensions.Width + 12, loc.Y + 8, tex.Width / 6, tex.Height);
            Sensitivity           = new UITextBox(this, tex, dim, false);
            Sensitivity.Contents  = (Controls.Instance.mouseSensitivityX / 0.015f).ToString();
            Sensitivity.maxLength = 3;
            Manager.Elements.Add(Sensitivity);


            loc             = new Point(32, viewport.Height - 64);
            Exit            = new UIStandardButton(this, loc, "Exit");
            Exit.hasButton  = true;
            Exit.customFont = Resources.Menus.BaroqueScript16;
            Exit.Clicked   += new UIElement.ClickEvent(Exit_Clicked);
            Manager.Elements.Add(Exit);

            pointerTex = Resources.Menus.Title.Pointer;
            pointerDim = new Rectangle(0, 0, pointerTex.Width, pointerTex.Height);
        }
コード例 #26
0
ファイル: UIChatPanel.cs プロジェクト: pepster98/FreeSO
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm    = vm;
            this.Owner = owner;

            Style        = TextStyle.DefaultTitle.Clone();
            Style.Size   = 16;
            Style.Shadow = true;
            Labels       = new List <UIChatBalloon>();

            TextBox         = new UITextBox();
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            TextBox.OnEnterPress += SendMessageElem;

            SelectionFillColor = new Color(0, 25, 70);

            //-- populate invalid areas --
            //chat bubbles will be pushed out of these areas
            //when this happens, they will also begin displaying the name of the speaking avatar.

            InvalidAreas = new List <Rectangle>();
            InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight));                                   //left
            InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020));                                    //top
            InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230));                                       //ucp

            HistoryDialog                = new UIChatDialog();
            HistoryDialog.Position       = new Vector2(20, 20);
            HistoryDialog.Visible        = false;
            HistoryDialog.Opacity        = 0.75f;
            HistoryDialog.OnSendMessage += SendMessage;
            this.Add(HistoryDialog);
        }
コード例 #27
0
    public override bool Init()
    {
        if (base.Init() == false)
        {
            return(false);
        }

        image_screen = GetComponent <Image>();
        textbox      = GetComponentInChildren <UITextBox>();
        button_ok    = GetComponentInChildren <UIButton>();

        foreach (UIElement e in GetComponentsInChildren <UIElement>())
        {
            if (e.GetUIType() == UIType.IMAGE_BOX)
            {
                image_box = e.GetComponent <Image>();
            }
        }

        AddCallbackOk(OnOk);

        return(true);
    }
コード例 #28
0
        public UIFamilyCASPanel(List <VMAvatar> avatar)
        {
            Avatars = avatar;

            AvatarOptions = new UICategorySwitcher();
            AvatarOptions.InitCategories(AvatarCategories);
            AvatarOptions.MainButton.Visible = false;
            AvatarOptions.OnCategorySelect  += AvatarOptions_OnCategorySelect;
            Add(AvatarOptions);

            NameStripe          = new UIDiagonalStripe(new Point(0, 75), UIDiagonalStripeSide.LEFT, UIStyle.Current.Bg);
            NameStripe.Position = new Vector2(UIScreen.Current.ScreenWidth, 30);
            Add(NameStripe);

            SecondName            = new UITextBox();
            SecondName.TextMargin = new Rectangle();
            SecondName.SetSize(UIScreen.Current.ScreenWidth, 60);
            SecondName.Alignment       = TextAlignment.Center;
            SecondName.TextStyle       = SecondName.TextStyle.Clone();
            SecondName.TextStyle.Size  = 37;
            SecondName.TextStyle.Color = UIStyle.Current.SecondaryText;
            SecondName.Position        = new Vector2(0, 40);
            Add(SecondName);

            ListStripe          = new UIDiagonalStripe(new Point(0, 125), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg);
            ListStripe.Position = new Vector2(0, UIScreen.Current.ScreenHeight - 145);
            Add(ListStripe);

            AvatarList              = new UIAvatarListPanel(avatar);
            AvatarList.Y            = UIScreen.Current.ScreenHeight - 145;
            AvatarList.OnSelection += AvatarList_OnSelection;
            Add(AvatarList);

            Reset();
            ShowI = ShowI;
        }
コード例 #29
0
        public UIVirtualKeyboard(string labelText, string startingText, UIVirtualKeyboard.KeyboardSubmitEvent submitAction, Action cancelAction, int inputMode = 0, bool allowEmpty = false)
        {
            this._keyboardContext              = inputMode;
            this._allowEmpty                   = allowEmpty;
            UIVirtualKeyboard.OffsetDown       = 0;
            this._lastOffsetDown               = 0;
            this._edittingSign                 = this._keyboardContext == 1;
            this._edittingChest                = this._keyboardContext == 2;
            UIVirtualKeyboard._currentInstance = this;
            this._submitAction                 = submitAction;
            this._cancelAction                 = cancelAction;
            this._textureShift                 = TextureManager.Load("Images/UI/VK_Shift");
            this._textureBackspace             = TextureManager.Load("Images/UI/VK_Backspace");
            this.Top.Pixels = (float)this._lastOffsetDown;
            float     num1     = (float)(-5000 * this._edittingSign.ToInt());
            float     maxValue = (float)byte.MaxValue;
            float     num2     = 0.0f;
            float     num3     = 516f;
            UIElement element  = new UIElement();

            element.Width.Pixels  = (float)((double)num3 + 8.0 + 16.0);
            element.Top.Precent   = num2;
            element.Top.Pixels    = maxValue;
            element.Height.Pixels = 266f;
            element.HAlign        = 0.5f;
            element.SetPadding(0.0f);
            this.outerLayer1 = element;
            UIElement uiElement = new UIElement();

            uiElement.Width.Pixels  = (float)((double)num3 + 8.0 + 16.0);
            uiElement.Top.Precent   = num2;
            uiElement.Top.Pixels    = maxValue;
            uiElement.Height.Pixels = 266f;
            uiElement.HAlign        = 0.5f;
            uiElement.SetPadding(0.0f);
            this.outerLayer2 = uiElement;
            UIPanel mainPanel = new UIPanel();

            mainPanel.Width.Precent   = 1f;
            mainPanel.Height.Pixels   = 225f;
            mainPanel.BackgroundColor = new Color(23, 33, 69) * 0.7f;
            element.Append((UIElement)mainPanel);
            float num4 = -79f;

            this._textBox = new UITextBox("", 0.78f, true);
            this._textBox.BackgroundColor = Color.Transparent;
            this._textBox.BorderColor     = Color.Transparent;
            this._textBox.HAlign          = 0.5f;
            this._textBox.Width.Pixels    = num3;
            this._textBox.Top.Pixels      = (float)((double)num4 + (double)maxValue - 10.0) + num1;
            this._textBox.Top.Precent     = num2;
            this._textBox.Height.Pixels   = 37f;
            this.Append((UIElement)this._textBox);
            for (int x = 0; x < 10; ++x)
            {
                for (int y = 0; y < 4; ++y)
                {
                    UITextPanel <object> keyboardButton = this.CreateKeyboardButton((object)"1234567890qwertyuiopasdfghjkl'zxcvbnm,.?"[y * 10 + x].ToString(), x, y, 1, true);
                    keyboardButton.OnClick += new UIElement.MouseEvent(this.TypeText);
                    mainPanel.Append((UIElement)keyboardButton);
                }
            }
            this._shiftButton                 = this.CreateKeyboardButton((object)"", 0, 4, 1, false);
            this._shiftButton.PaddingLeft     = 0.0f;
            this._shiftButton.PaddingRight    = 0.0f;
            this._shiftButton.PaddingBottom   = this._shiftButton.PaddingTop = 0.0f;
            this._shiftButton.BackgroundColor = new Color(63, 82, 151) * 0.7f;
            this._shiftButton.BorderColor     = this._internalBorderColor * 0.7f;
            this._shiftButton.OnMouseOver    += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                this._shiftButton.BorderColor = this._internalBorderColorSelected;
                if (this._keyState == UIVirtualKeyboard.KeyState.Shift)
                {
                    return;
                }
                this._shiftButton.BackgroundColor = new Color(73, 94, 171);
            });
            this._shiftButton.OnMouseOut += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                this._shiftButton.BorderColor = this._internalBorderColor * 0.7f;
                if (this._keyState == UIVirtualKeyboard.KeyState.Shift)
                {
                    return;
                }
                this._shiftButton.BackgroundColor = new Color(63, 82, 151) * 0.7f;
            });
            this._shiftButton.OnClick += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                Main.PlaySound(12, -1, -1, 1, 1f, 0.0f);
                this.SetKeyState(this._keyState == UIVirtualKeyboard.KeyState.Shift ? UIVirtualKeyboard.KeyState.Default : UIVirtualKeyboard.KeyState.Shift);
            });
            UIImage uiImage1 = new UIImage(this._textureShift);

            uiImage1.HAlign     = 0.5f;
            uiImage1.VAlign     = 0.5f;
            uiImage1.ImageScale = 0.85f;
            this._shiftButton.Append((UIElement)uiImage1);
            mainPanel.Append((UIElement)this._shiftButton);
            this._symbolButton                 = this.CreateKeyboardButton((object)"@%", 1, 4, 1, false);
            this._symbolButton.PaddingLeft     = 0.0f;
            this._symbolButton.PaddingRight    = 0.0f;
            this._symbolButton.BackgroundColor = new Color(63, 82, 151) * 0.7f;
            this._symbolButton.BorderColor     = this._internalBorderColor * 0.7f;
            this._symbolButton.OnMouseOver    += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                this._symbolButton.BorderColor = this._internalBorderColorSelected;
                if (this._keyState == UIVirtualKeyboard.KeyState.Symbol)
                {
                    return;
                }
                this._symbolButton.BackgroundColor = new Color(73, 94, 171);
            });
            this._symbolButton.OnMouseOut += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                this._symbolButton.BorderColor = this._internalBorderColor * 0.7f;
                if (this._keyState == UIVirtualKeyboard.KeyState.Symbol)
                {
                    return;
                }
                this._symbolButton.BackgroundColor = new Color(63, 82, 151) * 0.7f;
            });
            this._symbolButton.OnClick += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                Main.PlaySound(12, -1, -1, 1, 1f, 0.0f);
                this.SetKeyState(this._keyState == UIVirtualKeyboard.KeyState.Symbol ? UIVirtualKeyboard.KeyState.Default : UIVirtualKeyboard.KeyState.Symbol);
            });
            mainPanel.Append((UIElement)this._symbolButton);
            this.BuildSpaceBarArea(mainPanel);
            this._submitButton = new UITextPanel <LocalizedText>(this._edittingSign || this._edittingChest ? Language.GetText("UI.Save") : Language.GetText("UI.Submit"), 0.4f, true);
            this._submitButton.Height.Pixels = 37f;
            this._submitButton.Width.Precent = 0.4f;
            this._submitButton.HAlign        = 1f;
            this._submitButton.VAlign        = 1f;
            this._submitButton.PaddingLeft   = 0.0f;
            this._submitButton.PaddingRight  = 0.0f;
            this.ValidateText();
            this._submitButton.OnMouseOver += (UIElement.MouseEvent)((evt, listeningElement) => this.ValidateText());
            this._submitButton.OnMouseOut  += (UIElement.MouseEvent)((evt, listeningElement) => this.ValidateText());
            this._submitButton.OnClick     += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                string text = this.Text.Trim();
                if (text.Length <= 0 && !this._edittingSign && (!this._edittingChest && !this._allowEmpty))
                {
                    return;
                }
                Main.PlaySound(10, -1, -1, 1, 1f, 0.0f);
                this._submitAction(text);
            });
            element.Append((UIElement)this._submitButton);
            this._cancelButton = new UITextPanel <LocalizedText>(Language.GetText("UI.Cancel"), 0.4f, true);
            this.StyleKey <LocalizedText>(this._cancelButton, true);
            this._cancelButton.Height.Pixels = 37f;
            this._cancelButton.Width.Precent = 0.4f;
            this._cancelButton.VAlign        = 1f;
            this._cancelButton.OnClick      += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                Main.PlaySound(11, -1, -1, 1, 1f, 0.0f);
                this._cancelAction();
            });
            element.Append((UIElement)this._cancelButton);
            this._submitButton2               = new UITextPanel <LocalizedText>(this._edittingSign || this._edittingChest ? Language.GetText("UI.Save") : Language.GetText("UI.Submit"), 0.72f, true);
            this._submitButton2.TextColor     = Color.Silver;
            this._submitButton2.DrawPanel     = false;
            this._submitButton2.Height.Pixels = 60f;
            this._submitButton2.Width.Precent = 0.4f;
            this._submitButton2.HAlign        = 0.5f;
            this._submitButton2.VAlign        = 0.0f;
            this._submitButton2.OnMouseOver  += (UIElement.MouseEvent)((a, b) =>
            {
                ((UITextPanel <LocalizedText>)b).TextScale = 0.85f;
                ((UITextPanel <LocalizedText>)b).TextColor = Color.White;
            });
            this._submitButton2.OnMouseOut += (UIElement.MouseEvent)((a, b) =>
            {
                ((UITextPanel <LocalizedText>)b).TextScale = 0.72f;
                ((UITextPanel <LocalizedText>)b).TextColor = Color.Silver;
            });
            this._submitButton2.Top.Pixels   = 50f;
            this._submitButton2.PaddingLeft  = 0.0f;
            this._submitButton2.PaddingRight = 0.0f;
            this.ValidateText();
            this._submitButton2.OnMouseOver += (UIElement.MouseEvent)((evt, listeningElement) => this.ValidateText());
            this._submitButton2.OnMouseOut  += (UIElement.MouseEvent)((evt, listeningElement) => this.ValidateText());
            this._submitButton2.OnClick     += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                string text = this.Text.Trim();
                if (text.Length <= 0 && !this._edittingSign && (!this._edittingChest && !this._allowEmpty))
                {
                    return;
                }
                Main.PlaySound(10, -1, -1, 1, 1f, 0.0f);
                this._submitAction(text);
            });
            this.outerLayer2.Append((UIElement)this._submitButton2);
            this._cancelButton2              = new UITextPanel <LocalizedText>(Language.GetText("UI.Cancel"), 0.72f, true);
            this._cancelButton2.TextColor    = Color.Silver;
            this._cancelButton2.DrawPanel    = false;
            this._cancelButton2.OnMouseOver += (UIElement.MouseEvent)((a, b) =>
            {
                ((UITextPanel <LocalizedText>)b).TextScale = 0.85f;
                ((UITextPanel <LocalizedText>)b).TextColor = Color.White;
            });
            this._cancelButton2.OnMouseOut += (UIElement.MouseEvent)((a, b) =>
            {
                ((UITextPanel <LocalizedText>)b).TextScale = 0.72f;
                ((UITextPanel <LocalizedText>)b).TextColor = Color.Silver;
            });
            this._cancelButton2.Height.Pixels = 60f;
            this._cancelButton2.Width.Precent = 0.4f;
            this._cancelButton2.Top.Pixels    = 114f;
            this._cancelButton2.VAlign        = 0.0f;
            this._cancelButton2.HAlign        = 0.5f;
            this._cancelButton2.OnClick      += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                Main.PlaySound(11, -1, -1, 1, 1f, 0.0f);
                this._cancelAction();
            });
            this.outerLayer2.Append((UIElement)this._cancelButton2);
            UITextPanel <object> keyboardButton1 = this.CreateKeyboardButton((object)"", 8, 4, 2, true);

            keyboardButton1.OnClick += (UIElement.MouseEvent)((evt, listeningElement) =>
            {
                Main.PlaySound(12, -1, -1, 1, 1f, 0.0f);
                this._textBox.Backspace();
                this.ValidateText();
            });
            keyboardButton1.PaddingLeft   = 0.0f;
            keyboardButton1.PaddingRight  = 0.0f;
            keyboardButton1.PaddingBottom = keyboardButton1.PaddingTop = 0.0f;
            UIImage uiImage2 = new UIImage(this._textureBackspace);

            uiImage2.HAlign     = 0.5f;
            uiImage2.VAlign     = 0.5f;
            uiImage2.ImageScale = 0.92f;
            keyboardButton1.Append((UIElement)uiImage2);
            mainPanel.Append((UIElement)keyboardButton1);
            UIText uiText = new UIText(labelText, 0.75f, true);

            uiText.HAlign        = 0.5f;
            uiText.Width.Pixels  = num3;
            uiText.Top.Pixels    = (float)((double)num4 - 37.0 - 4.0) + maxValue + num1;
            uiText.Top.Precent   = num2;
            uiText.Height.Pixels = 37f;
            this.Append((UIElement)uiText);
            this._label = uiText;
            this.Append(element);
            this._textBox.SetTextMaxLength(this._edittingSign ? 99999 : 20);
            this.Text = startingText;
            if (this.Text.Length == 0)
            {
                this.SetKeyState(UIVirtualKeyboard.KeyState.Shift);
            }
            UIVirtualKeyboard.OffsetDown = 9999;
            this.UpdateOffsetDown();
        }
コード例 #30
0
        public UIDebugMenu() : base(UIDialogStyle.Tall, true)
        {
            SetSize(500, 300);
            Caption = "Debug Tools";

            Position = new Microsoft.Xna.Framework.Vector2(
                (GlobalSettings.Default.GraphicsWidth / 2.0f) - 250,
                (GlobalSettings.Default.GraphicsHeight / 2.0f) - 150
                );

            Add(new UIImage()
            {
                Texture  = GetTexture(0x00000Cbfb00000001),
                Position = new Microsoft.Xna.Framework.Vector2(40, 95)
            });

            ContentBrowserBtn                = new UIButton();
            ContentBrowserBtn.Caption        = "Browse Content";
            ContentBrowserBtn.Position       = new Microsoft.Xna.Framework.Vector2(160, 50);
            ContentBrowserBtn.Width          = 300;
            ContentBrowserBtn.OnButtonClick += x =>
            {
                //ShowTool(new ContentBrowser());
            };
            Add(ContentBrowserBtn);

            var connectLocalBtn = new UIButton();

            connectLocalBtn.Caption        = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server";
            connectLocalBtn.Position       = new Microsoft.Xna.Framework.Vector2(160, 90);
            connectLocalBtn.Width          = 300;
            connectLocalBtn.OnButtonClick += x =>
            {
                GlobalSettings.Default.UseCustomServer = !GlobalSettings.Default.UseCustomServer;
                connectLocalBtn.Caption = (GlobalSettings.Default.UseCustomServer) ? "Use default server (TSO)" : "Use custom defined server";
                GlobalSettings.Default.Save();
            };
            Add(connectLocalBtn);

            var cityPainterBtn = new UIButton();

            cityPainterBtn.Caption        = "Toggle City Painter";
            cityPainterBtn.Position       = new Microsoft.Xna.Framework.Vector2(160, 130);
            cityPainterBtn.Width          = 300;
            cityPainterBtn.OnButtonClick += x =>
            {
                var core = (GameFacade.Screens.CurrentUIScreen as CoreGameScreen);
                if (core == null)
                {
                    return;
                }
                if (core.CityRenderer.Plugin == null)
                {
                    core.CityRenderer.Plugin = new Rendering.City.Plugins.MapPainterPlugin(core.CityRenderer);
                    cityPainterBtn.Caption   = "Disable City Painter";
                }
                else
                {
                    core.CityRenderer.Plugin = null;
                    cityPainterBtn.Caption   = "Enable City Painter";
                }
            };
            Add(cityPainterBtn);

            serverNameBox   = new UITextBox();
            serverNameBox.X = 50;
            serverNameBox.Y = 300 - 54;
            serverNameBox.SetSize(500 - 100, 25);
            serverNameBox.CurrentText = GlobalSettings.Default.GameEntryUrl;

            Add(serverNameBox);
        }
コード例 #31
0
ファイル: Controls.cs プロジェクト: Aryn/Mobile-Fortress
 public void SetActiveTextBox(UITextBox box)
 {
     acceptTextInput  = true;
     activeText       = box;
     textEditPosition = box.TrueContents.Length;
 }