public void AddWeapons(IReadOnlyCollection <RangedWeapon> rangedWeapons, IReadOnlyCollection <MeleeWeapon> meleeWeapons) { if (rangedWeapons?.Count > 0) { RangedWeapons.AddRange(rangedWeapons); } if (meleeWeapons?.Count > 0) { MeleeWeapons.AddRange(meleeWeapons); } if (RangedWeapons.Count > 0) { if (RangedWeapons.Count == 1) { EquippedRangedWeapons.AddRange(RangedWeapons); } else if (RangedWeapons[0].Template.Location == EquipLocation.OneHand && RangedWeapons[1].Template.Location == EquipLocation.OneHand) { EquippedRangedWeapons.Add(RangedWeapons[0]); EquippedRangedWeapons.Add(RangedWeapons[1]); } else { EquippedRangedWeapons.Add(RangedWeapons[0]); } } if (MeleeWeapons.Count > 0) { if (EquippedRangedWeapons.Count == 0) { // we have two hands free for close combat weapons if (MeleeWeapons.Count == 1) { EquippedMeleeWeapons.AddRange(MeleeWeapons); } else if (MeleeWeapons[0].Template.Location == EquipLocation.OneHand && MeleeWeapons[1].Template.Location == EquipLocation.OneHand) { EquippedMeleeWeapons.Add(MeleeWeapons[0]); EquippedMeleeWeapons.Add(MeleeWeapons[1]); } else { EquippedMeleeWeapons.Add(MeleeWeapons[0]); } } else if (EquippedRangedWeapons.Count == 1 && EquippedRangedWeapons[0].Template.Location == EquipLocation.OneHand) { if (MeleeWeapons[0].Template.Location == EquipLocation.OneHand) { EquippedMeleeWeapons.Add(MeleeWeapons[0]); } else if (MeleeWeapons.Count > 1 && MeleeWeapons[1].Template.Location == EquipLocation.OneHand) { EquippedMeleeWeapons.Add(MeleeWeapons[1]); } } } }
public static string GetIconBaseName(RangedWeapons weapon) { if (weapon == RangedWeapons.Fire) { return(GetIconBaseName(RangedWeapons.Rifle)); } return(weapon.ToString()); }
private void RemoveRangedWeapon(RangedWeapon item) { RangedWeapons.Remove(item); //foreach (WeaponCombinationHolder holder in OwnedWeaponCombinations) //{ // if (holder.WeaponGuid1 == item.Guid) // OwnedWeaponCombinations.Remove(holder); //} RemoveWeaponCombination(item.Guid); }
public static string GetDescription(RangedWeapons weapon) { switch (weapon) { case RangedWeapons.Rifle: return Locale.Resource.MenuShotgunDesc; case RangedWeapons.Blaster: return Locale.Resource.MenuBlasterDesc; case RangedWeapons.GatlingGun: return Locale.Resource.MenuGatlingDesc; case RangedWeapons.HandCannon: return Locale.Resource.MenuCannonDesc; default: throw new ArgumentException(); } }
public static string GetDescription(RangedWeapons weapon) { switch (weapon) { case RangedWeapons.Rifle: return(Locale.Resource.MenuShotgunDesc); case RangedWeapons.Blaster: return(Locale.Resource.MenuBlasterDesc); case RangedWeapons.GatlingGun: return(Locale.Resource.MenuGatlingDesc); case RangedWeapons.HandCannon: return(Locale.Resource.MenuCannonDesc); default: throw new ArgumentException(); } }
public StartScreenControl() { Size = new Vector2(600, 420); LargeWindow = true; objectives.Dock = System.Windows.Forms.DockStyle.Left; objectives.Size = new Vector2(300, 0); options.AddChild(weaponsControl); weaponsControl.AddChild(new Label { Text = Locale.Resource.MapSelectedWeapons, Size = new Vector2(0, 30), TextAnchor = global::Graphics.Orientation.TopLeft, Dock = System.Windows.Forms.DockStyle.Top, Font = new Font { SystemFont = Fonts.LargeSystemFont, Color = System.Drawing.Color.Gold }, Background = null, Clickable = false }); weaponsControl.AddChild(meleeWeaponsContainer); weaponsControl.AddChild(rangedWeaponsContainer); var meleeWeapons = Enum.GetValues(typeof(MeleeWeapons)); for (int i = 1; i < meleeWeapons.Length; i++) { MeleeWeapons wp = (MeleeWeapons)meleeWeapons.GetValue(i); var w = new Checkbox { Text = "", Background = null, UnCheckedGraphic = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/" + WeaponsInfo.GetIconBaseName(wp) + "GameIconOff1.png") { DontScale = true }, SizeMode = SizeMode.AutoAdjust, Position = new Vector3(-12, -11, 0) }, CheckedGraphic = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/" + WeaponsInfo.GetIconBaseName(wp) + "GameIconOn1.png") { DontScale = true }, SizeMode = SizeMode.AutoAdjust, Position = new Vector3(-12, -11, 0) }, UnCheckedHoverGraphic = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/" + WeaponsInfo.GetIconBaseName(wp) + "GameIconSelected1.png") { DontScale = true }, SizeMode = SizeMode.AutoAdjust, Position = new Vector3(-12, -11, 0) }, Size = new Vector2(100, 25), Margin = new System.Windows.Forms.Padding(5) }; Program.Instance.Tooltip.SetToolTip(w, Util.GetLocaleResourceString(wp) + "\n\n" + WeaponsInfo.GetDescription(wp)); w.Click += new EventHandler((e, o) => { SelectedMeleeWeapon = wp; }); meleeWeaponsContainer.AddChild(w); meleeCheckboxes.Add(wp, w); } var bullets = Enum.GetValues(typeof(RangedWeapons)); for (int i = 1; i < bullets.Length; i++) { RangedWeapons wp = (RangedWeapons)bullets.GetValue(i); if (wp == RangedWeapons.Fire) { continue; } var w = new Checkbox { Text = "", Background = null, UnCheckedGraphic = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/" + WeaponsInfo.GetIconBaseName(wp) + "GameIconOff1.png") { DontScale = true }, SizeMode = SizeMode.AutoAdjust, Position = new Vector3(-12, -11, 0) }, CheckedGraphic = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/" + WeaponsInfo.GetIconBaseName(wp) + "GameIconOn1.png") { DontScale = true }, SizeMode = SizeMode.AutoAdjust, Position = new Vector3(-12, -11, 0) }, UnCheckedHoverGraphic = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/" + WeaponsInfo.GetIconBaseName(wp) + "GameIconSelected1.png") { DontScale = true }, SizeMode = SizeMode.AutoAdjust, Position = new Vector3(-12, -11, 0) }, Size = new Vector2(100, 25), Margin = new System.Windows.Forms.Padding(5) }; Program.Instance.Tooltip.SetToolTip(w, Util.GetLocaleResourceString(wp) + "\n\n" + WeaponsInfo.GetDescription(wp)); w.Click += new EventHandler((e, o) => { SelectedRangedWeapon = wp; }); rangedWeaponsContainer.AddChild(w); bulletCheckboxes.Add(wp, w); } //innerControl.AddChild(new Control //{ // Background = new StretchingImageGraphic // { // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 255, 255)) // }, // SizeMode = SizeMode.AutoAdjust, // }, // Dock = System.Windows.Forms.DockStyle.Left, // Size = new Vector2(1, 1) //}); innerControl.AddChild(options); bottomBar.AddChild(startButton); startButton.Click += new EventHandler(startButton_Click); bottomBar.AddChild(quitButton); quitButton.Click += new EventHandler(quitButton_Click); ButtonBase optionsButton = new StoneButton { Anchor = Graphics.Orientation.Left, Position = new Vector2(20 + quitButton.Size.X, 0), Text = Locale.Resource.GenOptions }; optionsButton.Click += new EventHandler(optionsButton_Click); bottomBar.AddChild(optionsButton); }
public static string GetIconBaseName(RangedWeapons weapon) { if (weapon == RangedWeapons.Fire) return GetIconBaseName(RangedWeapons.Rifle); return weapon.ToString(); }
private void AddRangedWeapon(RangedWeapon item) { RangedWeapons.Add(item); OwnedWeaponCombinations.Add(new WeaponCombinationHolder(item.Name, item.Guid, null)); }