Esempio n. 1
0
 public ItemIcon(UIElement parent, Vector2 position, Logic.ICollectible item)
     : base(parent, position, new Vector2(32, 32), item != null ? item.Texture : null)
 {
     oldPos = position;
     _item = item;
     backgroundPanel = new Panel(this, new Vector2(-2, -2), new Vector2(40, 40), Content.ContentInterface.LoadTexture("UITest"));
 }
Esempio n. 2
0
 public override void Initialize(GraphicsDevice Device, ScreenManager manager)
 {
     base.Initialize(Device, manager);
     Settings.LoadSettings();
     Panel panel = new Panel(this, new Vector2(300, 160), new Vector2(200, 280), Content.ContentInterface.LoadTexture("UITest"));
     Button button = new Button(this, new Vector2(60, 30), new Vector2(80, 40), Content.ContentInterface.LoadTexture("UITest"),
         delegate { Settings.ServerAddress = "localhost";
             _manager.RemoveScreen(this); GameScreen screen = new GameScreen();
             screen.SetupLocalServer(); _manager.AddScreen(screen); },
         "Local");
     AddChild(panel);
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 90), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { _manager.RemoveScreen(this); _manager.AddScreen(new GameScreen()); },
     "Online");
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 150), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { Console.WriteLine("Test2"); },
     "Testbutton2");
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 210), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { Console.WriteLine("Test3"); },
     "Testbutton3");
     panel.AddChild(button);
 }
Esempio n. 3
0
 public UIWindow(Vector2 offset, Vector2 size, Texture2D top, Texture2D main)
     : base(null, offset)
 {
     _size = size;
     _topElement = new Panel(this, new Vector2(0, -topSize), new Vector2(size.X, topSize), top);
     _mainWindow = new Panel(this, Vector2.Zero, new Vector2(size.X, size.Y), top);
     AddChild(_topElement);
     AddChild(_mainWindow);
     AddChild(new Button(this, new Vector2(_size.X - topSize, -topSize), new Vector2(topSize, topSize), top, delegate { _parent.RemoveChild(this); }, "X"));
 }
Esempio n. 4
0
 public Button(UIElement parent, Vector2 position, Vector2 size, Texture2D buttonTex, Action action, string text="")
     : base(parent, position)
 {
     buttonBorder = new Panel(this, Vector2.Zero, size, buttonTex);
     this.AddChild(buttonBorder);
     _action=action;
     _size = size;
     if (_font == null)
         _font = ContentInterface.LoadFont("font2");
     Text = text;
     _state = UIButtonState.Nothing;
 }