public MultiplayerScreen() : base() { background = new UiImage(this, Point.Zero, Point.Zero, "textures/ui/ui_background"); AddComponent(background); serverIP = new UiTextbox(this, Point.Zero, new Point(264, 20), "multiplayer.add.ip"); serverIP.maxCharacters = 256; serverIP.isLanguageText = true; AddComponent(serverIP); serverPort = new UiTextbox(this, Point.Zero, new Point(164, 20), "multiplayer.server.port"); serverPort.maxCharacters = 5; serverPort.isLanguageText = true; AddComponent(serverPort); cancelBtn = new UiButton(this, "multiplayer.add.cancel", Point.Zero, new Point(164, 20)); AddComponent(cancelBtn); cancelBtn.OnClicked += OnCancelClicked; joinBtn = new UiButton(this, "multiplayer.add.join", Point.Zero, new Point(164, 20)); AddComponent(joinBtn); joinBtn.OnClicked += OnJoinClicked; serverJoinHeader = new UiLangText(this, Point.Zero, "multiplayer.add.title"); AddComponent(serverJoinHeader); visible = false; Reset(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); SpriteFont font = Content.Load <SpriteFont>("file"); UiProgressBar progressbar = new UiProgressBar(this, new Vector2(0, 200), 51, font); UiTextbox textbox = new UiTextbox(this, new Vector2(0, -100), font); UiRadio radio = new UiRadio(this, new Vector2(0, -200), "hejsan", font); UiCheckBox box = new UiCheckBox(this, new Vector2(0, 0), "textbox visible", font); UiButton btn = new UiButton(this, new Vector2(0, 100), "Hej", font, delegate(object sender, EventArgs args) { progressbar.Procent += (MoveUp ? 2 : -3); switch (progressbar.Procent) { case 100: MoveUp = false; break; case 0: MoveUp = true; break; } if (box.IsChecked) { textbox.IsVisible = false; } else { textbox.IsVisible = true; } }); Menu1 = new Menu(); Menu1.Add(btn); Menu1.Add(textbox); Menu1.Add(radio); Menu1.Add(box); Menu1.Add(progressbar); }