Inheritance: TextInput, Backend.IHandleEvent
Beispiel #1
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();
        }
        /// <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();
        }