Наследование: UIElement
Пример #1
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");
 }
Пример #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
        }
Пример #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ModifyWindow(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, Backend.Item item)
     : base(parent, spriteBatch, content, displayRect)
 {
     _item = item;
     AddChild(_name = new TextInput(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 5, _displayRect.Width - 15, 25), "Name:", _item.name, "This is the name used for the item.", 20, true));
     _properties = new List<NumberEntry>();
     int i = 0;
     foreach (Backend.ItemEffect effect in _item.effects)
     {
         AddChild(new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 35 + i * 30, (_displayRect.Width - 10) / 2 - 10, 25), effect.property.ToString(), effect.effect, "Click to remove ability", 2, false));
         ++i;
     }
     AddChild(new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + (_displayRect.Width - 100) / 2, _displayRect.Top + _displayRect.Height - 45, 100, 30), "Ok", (int)Backend.Buttons.Close, false));
 }
Пример #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public CharacterWindow(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, Backend.Actor actor)
            : base(parent, spriteBatch, content, displayRect)
        {
            _actor = actor;
            AddChild(_name = new TextInput(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 5, _displayRect.Width - 15, 25), "Name:", _actor.name, "This is the name used by the character.", 20, true));

            AddChild(_block = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 35, (_displayRect.Width - 10) / 2 - 10, 25), "Block:", _actor.block, "Blocking prevents damage, unless the attacks penetration rating is higher", 2, false));
            AddChild(_evade = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 35, (_displayRect.Width - 10) / 2 - 10, 25), "Evade:", _actor.evade, "Evasion determines whether an attack hits (i.e. attackers and defenders values are compared).", 2, false));

            AddChild(_penetrate = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 65, (_displayRect.Width - 10) / 2 - 10, 25), "Penetrate:", _actor.penetrate, "Penetration determines the chance to cut through a block.", 2, false));
            AddChild(_healthReg = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
              + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 65, (_displayRect.Width - 10) / 2 - 10, 25), "Regeneration:", _actor.healthReg, "This determines how long it takes for health to regenerate.", 2, false));

            AddChild(_stealHealth = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 95, (_displayRect.Width - 10) / 2 - 10, 25), "Health Drain:", _actor.stealHealth, "This determines how much a successful attack will steal.", 2, false));
            AddChild(_stealMana = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 95, (_displayRect.Width - 10) / 2 - 10, 25), "Mana Drain:", _actor.stealMana, "This determines how much mana a successful attack will steal.", 2, false));

            AddChild(_fireDamage = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 125, (_displayRect.Width - 10) / 2 - 10, 25), "Fire Damage:", _actor.fireDamage, "This determines how much fire damage a successful attack does.", 2, false));
            AddChild(_iceDamage = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 125, (_displayRect.Width - 10) / 2 - 10, 25), "Ice Damage:", _actor.iceDamage, "This determines how much ice damage a successful attack does.", 2, false));

            AddChild(_fireDefense = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 155, (_displayRect.Width - 10) / 2 - 10, 25), "Fire Defense:", _actor.fireDefense, "This determines resistance against a successful fire attack.", 2, false));
            AddChild(_iceDefense = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 155, (_displayRect.Width - 10) / 2 - 10, 25), "Ice Defense:", _actor.iceDefense, "This determines resistance against a successful ice attack.", 2, false));

            AddChild(_destroyWeapon = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 185, (_displayRect.Width - 10) / 2 - 10, 25), "Destroy Weapon:", _actor.destroyWeapon, "This determines the chance to destroy an opponents' weapon.", 2, false));
            AddChild(_destroyArmor = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 185, (_displayRect.Width - 10) / 2 - 10, 25), "Destroy Armor:", _actor.destroyArmor, "This determines the chance to destroy an opponents' armor.", 2, false));

            AddChild(_maxMana = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 215, (_displayRect.Width - 10) / 2 - 10, 25), "Max. Mana:", _actor.maxMana, "This determines the maximum mana available .", 2, false));
            AddChild(_manaReg = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 215, (_displayRect.Width - 10) / 2 - 10, 25), "Mana Regeneration:", _actor.manaReg, "This determines how long it takes for mana to regenate.", 2, false));

            AddChild(_gold = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 245, (_displayRect.Width - 10) / 2 - 10, 25), "Gold:", _actor.gold, "This is the current amount of gold available to you.", 2, false));
            AddChild(_damage = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 245, (_displayRect.Width - 10) / 2 - 10, 25), "Damage:", _actor.damage, "This determines physical damage done to an opponent", 2, false));

            AddChild(_resist = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 275, (_displayRect.Width - 10) / 2 - 10, 25), "Resistance:", _actor.resist, "This determines resistance against adverse effects.", 2, false));
            AddChild(_exp = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 275, (_displayRect.Width - 10) / 2 - 10, 25), "Experience:", _actor.exp, "This determines your current amount of experience.", 2, false));

            AddChild(_expNeeded = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 305, (_displayRect.Width - 10) / 2 - 10, 25), "Exp needed:", _actor.expNeeded, "This is the amount of experience needed for the next level.", 2, false));
            AddChild(_maxhealth = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 305, (_displayRect.Width - 10) / 2 - 10, 25), "Max. Health:", _actor.maxHealth, "This is the maximum amount of health achievable by healing.", 2, false));

            AddChild(_health = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 335, (_displayRect.Width - 10) / 2 - 10, 25), "Health:", _actor.health, "This is your current health (reduced when taking damage).", 2, false));
            AddChild(_mana = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 335, (_displayRect.Width - 10) / 2 - 10, 25), "Mana:", _actor.mana, "Mana is used for casting spells.", 2, false));

            AddChild(_armor = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 365, (_displayRect.Width - 10) / 2 - 10, 25), "Armor:", _actor.armor, "Armor is used to reduce damage.", 2, false));
            AddChild(_abilityPoints = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 365, (_displayRect.Width - 10) / 2 - 10, 25), "Abilitypoints:", _actor.abilityPoints, "Abilitypoints are used to improve your statistics.", 2, false));

            AddChild(_skills = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 395, (_displayRect.Width - 10) / 2 - 10, 25), "New Skills:", _actor.skills, "Skills represent abilities and spells used in combat.", 2, false));
            AddChild(_level = new NumberEntry(this, _spriteBatch, _content, new Rectangle(_displayRect.Left
                + (_displayRect.Width - 10) / 2 + 10, _displayRect.Top + 395, (_displayRect.Width - 10) / 2 - 10, 25), "Level:", _actor.level, "Your level determines your general character state.", 2, false));

            AddChild(_abilities = new Abilities(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 5, _displayRect.Width - 10, _displayRect.Height - 360), _actor));
            AddChild(_abilitychoice = new AbilityChoice(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Bottom - 340, _displayRect.Width - 10, 250), _actor));

            AddChild(_inventory = new Inventory(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Top + 5, _displayRect.Width - 10, _displayRect.Height - 40), _actor));
                        AddChild(new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + (_displayRect.Width - 100) / 2, _displayRect.Top + _displayRect.Height - 45, 100, 30), "Ok", (int)Backend.Buttons.Close, false));
            _focusID = _children.Count - 1;

            _inventory.Update();
                       _font = _content.Load<SpriteFont>("font");
            page = 0;
            _RefreshSkills();
        }
Пример #5
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);
 }