public ShopMenu(Map map) : base(new Vector2(18f, 10f), map) { int nmbrOfWeapons = Enum.GetNames(typeof(WeaponList)).Length; float padding = 0.2f; Vector2 buttonSize = new Vector2(1.25f, 1.25f); for (int i = 0; i < nmbrOfWeapons; i++) { float x = (i % 5) * (buttonSize.X + padding); float y = (i / 5) * (-buttonSize.Y - padding); AddButton(new WeaponButton( (WeaponList)(i % nmbrOfWeapons), (w) => { selectedWeapon = w; costBox.Text = WeaponStats.GetStats(w).scrapCost.ToString(); }, new Vector2(x, y), buttonSize, this, map)); } equipButtons[0] = new EquipButton(0, (id) => map.LocalPlayer.SendInventory(id, selectedWeapon.Value), previewWeaponPosition - new Vector2(4f, 2f), new Vector2(1.2f, 1.2f), this, map); equipButtons[1] = new EquipButton(1, (id) => map.LocalPlayer.SendInventory(id, selectedWeapon.Value), previewWeaponPosition - new Vector2(-4f, 2f), new Vector2(1.2f, 1.2f), this, map); buyButton = new BuyButton(() => map.LocalPlayer.SendBuyWeapon(selectedWeapon.Value), previewWeaponPosition + new Vector2(0, -4), new Vector2(3f, 1f), this, map); lockSprite.FillColor = true; lockSprite.Color = new Color(0f, 0f, 0f, 0.8f); costBox = new TextBox(new System.Drawing.Font("Adobe Song Std L", 200f)); costBox.VerticalAlign = TextBox.VerticalAlignment.Center; costBox.UpdateRate = 0; costBox.SetHeight = 3f; costBox.Color = SYScrap.HUDColor; }
public override void BuyWeapon(WeaponList weapon) { if (ownedWeapons.Contains(weapon) || scrap < WeaponStats.GetStats(weapon).scrapCost) { return; } base.BuyWeapon(weapon); SetScrap(scrap - WeaponStats.GetStats(weapon).scrapCost); }
public WeaponButton(WeaponList weapon, SelectWeapon selectWeapon, Vector2 position, Vector2 size, ShopMenu menu, Map map) : base("", position, size, menu, map) { this.weaponType = weapon; this.selectWeapon = selectWeapon; weaponSprite = new Sprite(Weapon.GetIcon(weapon)); lockSprite.FillColor = true; lockSprite.Color = new Color(0, 0, 0, 0.5f); costBox = new TextBox(120f); costBox.SetHeight = size.Y * 0.4f; costBox.Text = WeaponStats.GetStats(weapon).scrapCost.ToString(); costBox.VerticalAlign = TextBox.VerticalAlignment.Center; costBox.HorizontalAlign = TextBox.HorizontalAlignment.Left; }
public Weapon(WeaponList weapon, Player p, Map map) { owner = p; this.map = map; WeaponStats.Stats stats = WeaponStats.GetStats(weapon); type = stats.type; damage = stats.damage; fireType = stats.fireType; FireRate = stats.fireRate; maxCharge = stats.fireRate; ReloadTime = stats.reloadTime; maxAmmo = stats.ammo; ammo = maxAmmo; }
public Weapon(WeaponList weapon, Player p, Map map) { owner = p; this.map = map; WeaponStats.Stats stats = WeaponStats.GetStats(weapon); type = stats.type; maxAmmo = stats.ammo; fireType = stats.fireType; FireRate = stats.fireRate; maxCharge = stats.fireRate; ReloadTime = stats.reloadTime; ammo = maxAmmo; reloadTimer.IsDone = true; mouse.Perspective = Map.GameCamera; }