Inheritance: UIElement, IDisposable
Exemplo n.º 1
0
 public YesNoDialog(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, string question = "Quit?", string yes = "Yes", string no = "No")
     : base(parent, spriteBatch, content, displayRect)
 {
     AddChild(_yes = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Right - 85, _displayRect.Bottom - 35, 85, 30), yes, (int)Backend.Buttons.Yes));
     AddChild(_no = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Bottom - 35, 85, 30), no, (int)Backend.Buttons.No));
     AddChild(_question = new Statusbox(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 10, _displayRect.Top + 10, _displayRect.Width - 20, _displayRect.Height - 60), false, true));
     _question.AddLine(question);
     ChangeFocus();
 }
Exemplo n.º 2
0
 public FileDialog(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, bool save)
     : base(parent, spriteBatch, content, displayRect)
 {
     _save = save;
     _BuildList();
     AddChild(_filename = new TextInput(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 10, _displayRect.Top + 5, _displayRect.Width - 40, 20), "Name:", ((save) ? "Savegame" : _files[0].name), "Enter a name for your savegame", 20, save));
     AddChild(_ok = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Right - 115, _displayRect.Bottom - 40, 85, 30), ((save) ? "Save" : "Restore"), (int)Backend.Buttons.Close));
     AddChild(_cancel = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 10, _displayRect.Bottom - 40, 85, 30), "Cancel", (int)Backend.Buttons.Cancel));
     _background = _content.Load<Texture2D>("Minimap");
     _arrows = _content.Load<Texture2D>("Arrows");
     _font = _content.Load<SpriteFont>("SmallFont");
 }
Exemplo n.º 3
0
        public Lobby(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, NetPlayer netplayer = null)
            : base(parent, spriteBatch, content, displayRect)
        {
            string myGUID = "";
            if (Properties.Settings.Default.guid != "NONE")
            {
                myGUID = Properties.Settings.Default.guid;
            }
            else
            {
                myGUID = Guid.NewGuid().ToString();
                Properties.Settings.Default.guid = myGUID;
                Properties.Settings.Default.Save();
            }
            AddChild(_ipEntry = new TextInput(this, spriteBatch, content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 5, _displayRect.Width - 250, 30), "Server:", "localhost", "Enter a server to connect to or localhost to test locally", -1, true));
            AddChild(_playerName = new TextInput(this, spriteBatch, content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 50, _displayRect.Width - 250, 30), "Computer-ID:", myGUID, "Enter a unique ID for your computer", -1, true));
            AddChild(_listPlayers = new Statusbox(this, spriteBatch, content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 100, _displayRect.Width - 10, _displayRect.Height - 160), true, true));
            //_ok = new Button(this, spriteBatch, content, new Rectangle(_displayRect.Right - 90, _displayRect.Bottom - 50, 80, 40), "Ok", (int)Backend.Buttons.Close);
            AddChild(_launchServer = new Button(this, spriteBatch, content, new Rectangle(_displayRect.Right - 210, _displayRect.Top + 5, 200, 40), "Launch Server", (int)Backend.Buttons.StartServer));
            AddChild(_cancel = new Button(this, spriteBatch, content, new Rectangle(_displayRect.Left + 10, _displayRect.Bottom - 50, 80, 40), "Cancel", (int)Backend.Buttons.Cancel));
            AddChild(_connect = new Button(this, spriteBatch, content, new Rectangle(_displayRect.Right - 160, _displayRect.Top + 50, 150, 40), "Connect", (int)Backend.Buttons.Connect));
            if (netplayer == null)
            {
                _network = new NetPlayer(this);
                _network.playername = _playerName.text;
            }
            else
            {
                _launchServer.Hide();
                _network = netplayer;
                _network.parent = this;
                _ipEntry.text = _network.server;
                _playerName.text = _network.playername;
                if (netplayer.connected)
                {
                    _connect.label = "Disconnect";
                    _listPlayers.AddLine("Connected.", Color.Green);

                }
                else
                {
                    _connect.label = "Connect";
                    _listPlayers.AddLine("Disconnected.", Color.Red);
                }
            }
            // IP-Entry-Field (Dropdown?)
            // Button to launch server
            // Entry fField for player name
            // List of players
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Shop(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, Backend.Actor actor1, Backend.Actor actor2)
            : base(parent, spriteBatch, content, displayRect)
        {
            _buyer = actor1;
            _seller = actor2;

            _background = _content.Load<Texture2D>("Minimap");
            _arrows = _content.Load<Texture2D>("Arrows");
            _rows = (int)((_displayRect.Height - 65) / (_height + 3));
            _font = _content.Load<SpriteFont>("SmallFont");
            AddChild(_steal = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Bottom - 35, 80, 30), "Steal", (int)ShopButtons.Steal, false));
            AddChild(_buy = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 90, _displayRect.Bottom - 35, 80, 30), "Buy", (int)ShopButtons.Buy, false));
            AddChild(_sell = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Right - 170, _displayRect.Bottom - 35, 80, 30), "Sell", (int)ShopButtons.Sell, false));
            AddChild(_modify = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Right - 85, _displayRect.Bottom - 35, 80, 30), "Modify", (int)ShopButtons.Modify, false));
            AddChild(_sellergold = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + (_displayRect.Width - 80) / 2 - 70, _displayRect.Top + 12, 102, 20), "Gold", _seller.gold, "Seller's gold", 3, false));
            AddChild(_buyergold = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + (_displayRect.Width - 107), _displayRect.Top + 12, 102, 20), "Gold", _buyer.gold, "Buyer's gold", 3, false));
            AddChild(_leave = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + (_displayRect.Width - 80) / 2, _displayRect.Bottom - 35, 80, 30), "Leave", (int)ShopButtons.Leave, false));
            _buy.Hide();
            _sell.Hide();
            _modify.Hide();
            _steal.Hide();
        }