Inheritance: TextOutput
Esempio 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();
 }
Esempio n. 2
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
        }
Esempio n. 3
0
 public Chat(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, bool hasBorder = true, bool center = false)
     : base(parent, spriteBatch, content, displayRect)
 {
     _output = new Statusbox(this, spriteBatch, content, new Rectangle(_displayRect.Left, _displayRect.Top, _displayRect.Width, _displayRect.Height - 22), true, false);
     _input = new TextInput(this, spriteBatch, content, new Rectangle(_displayRect.Left, _displayRect.Bottom - 20, _displayRect.Width, 20), "Say:", "", "Enter text to distribute to other players", -1, true);
 }
Esempio n. 4
0
        /// <summary>
        /// Setup and display a window containing credits
        /// </summary>
        private void _ShowAbout()
        {
            if (_focus is Window)
            {
                _focus.Dispose();
                _interfaceElements.Remove(_focus);
                _toolbar.HandleEvent(true, Backend.Events.ContinueGame, 13);
                _status = Backend.GameStatus.Running;
            }
            _status = Backend.GameStatus.Paused;
            Rectangle rect = center(GraphicsDevice.Viewport.Bounds, 600, 300);
            Window _about = new Window(this, _spriteBatch, Content, rect);
            rect = inner(rect);
            _about.AddChild(new Button(_about, _spriteBatch, Content, new Rectangle(rect.Left + 45, rect.Bottom - 42, rect.Width - 90, 32), "Ok", (int)Backend.Buttons.Close));

            //  _mainMenu.AddChild(new ProgressBar(this, _spriteBatch, Content, new Rectangle((int)((GraphicsDevice.Viewport.Width - 160) / 2.0f), (int)(GraphicsDevice.Viewport.Height / 2.0f) + 80, 300, 30), ProgressStyle.Block,100,2));
            Statusbox stat;
            _about.AddChild(stat = new Statusbox(_about, _spriteBatch, Content, new Rectangle(rect.Left, rect.Top, rect.Width, rect.Height - 50), false, true));
            stat.AddLine("Dungeon Crawler 2013\n\n Developed by Group 22\n\n" +
                "*********************************\n\n" +
                "Music: Video Dungeon Crawl by Kevin MacLeod is licensed under a CC Attribution 3.0\n\n" +
                "http://incompetech.com/music/royalty-free/index.html?collection=029\n\n" +
                "Graphics: Tile Graphics by Reiner Prokein\n\n" +
                "http://www.reinerstilesets.de/de/lizenz/ ");
            _interfaceElements.Add(_about);
            _focus = _interfaceElements[_interfaceElements.Count - 1];

        }
Esempio n. 5
0
        /// <summary>
        /// A text displayed if the player died
        /// </summary>
        /// <param name="message"></param>
        /// <param name="title"></param>
        private void _ShowEndGame(string message = "You have failed in your mission. Better luck next time.", string title = "Game over!")
        {
            if (_focus is Window)
            {
                _focus.Dispose();
                _interfaceElements.Remove(_focus);
                _toolbar.HandleEvent(true, Backend.Events.ContinueGame, 13);
                _status = Backend.GameStatus.Running;
            }
            _status = Backend.GameStatus.GameOver;
            //            _logic.map.Save("savedroom" + _logic.map.id + ".xml");
            Rectangle rect = center(GraphicsDevice.Viewport.Bounds, 500, 150);
            Window _gameOver = new Window(this, _spriteBatch, Content, rect);
            Statusbox stat;
            rect = inner(rect);
            if (_logic is PureLogic)
            {
                _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Left, rect.Bottom - 40, 80, 32), "New Maps", (int)Backend.Buttons.NewMap));

                if (_logic.map.actors[_playerID].lives > 0)
                {
                    _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Left + 90, rect.Bottom - 40, 150, 32), "Respawn (" + _logic.map.actors[_playerID].lives.ToString() + " left)", (int)Backend.Buttons.Load));
                }
                bool hasSave = false;
                foreach (string dir in Directory.GetDirectories(".\\save"))
                {
                    string tmp = dir.ToLower().Trim();
                    if (tmp.Substring(tmp.LastIndexOf('\\') + 1) != "auto")
                    {
                        hasSave = true;
                        break;
                    }
                }
                if (hasSave)
                    _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 215, rect.Bottom - 40, 65, 32), "Restore", (int)Backend.Buttons.Restore));
                _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 140, rect.Bottom - 40, 65, 32), "Restart", (int)Backend.Buttons.Restart));
                _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 65, rect.Bottom - 40, 65, 32), "Quit", (int)Backend.Buttons.Quit));
            }
            else
            {
                _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Left, rect.Bottom - 40, 80, 32), "Resurrect", (int)Backend.Buttons.Load));
                _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 170, rect.Bottom - 40, 80, 32), "Disconnect", (int)Backend.Buttons.Connect));
                _gameOver.AddChild(new Button(_gameOver, _spriteBatch, Content, new Rectangle(rect.Right - 80, rect.Bottom - 40, 80, 32), "Quit", (int)Backend.Buttons.Quit));
            }
            _gameOver.AddChild(stat = new Statusbox(_gameOver, _spriteBatch, Content, center(rect, 450, 200, 0), false, true));
            stat.AddLine(title + "\n \n" + message);

            _interfaceElements.Add(_gameOver);
            _focus = _interfaceElements[_interfaceElements.Count - 1];
        }