public void SetWeapon(Weapon weapon) { if(weapon.Hauptteil != null) { hauptteilCraftingIcon = weapon.Hauptteil.CraftingItem; } if ( weapon.Antrieb != null ) { antriebCraftingIcon = weapon.Antrieb.CraftingItem; } if ( weapon.Stabilisator != null ) { stabilisatorCraftingIcon = weapon.Stabilisator.CraftingItem; } if ( weapon.Visier != null ) { visierCraftingIcon = weapon.Visier.CraftingItem; } }
private void SwitchWeapon( Weapon newWeapon, UIShortcutButton button ) { Weapon oldWeapon = button.Weapon; if ( oldWeapon != null ) { if ( oldWeapon.Munition != null && player.GetItemCountFromInventar( oldWeapon.Munition.TypeId) >0 ) { // munition ins Inventar player.AddItemToInventar( oldWeapon.Munition ); filteredInventarList.AddItem( oldWeapon.Munition ); } //Waffe ins inventar player.RemoveWeaponFromShortcutList( button.Key ); player.AddItemToInventar( oldWeapon ); filteredInventarList.AddItem( oldWeapon ); button.Weapon = null; } if ( newWeapon != null ) { //Waffe ändern player.AddWeaponToShortcutList( button.Key, newWeapon ); player.RemoveItemFromInventar( newWeapon ); button.Weapon = newWeapon; } }
private void DrawWeapon( Microsoft.Xna.Framework.Graphics.SpriteBatch sb, Weapon weapon ) { sb.DrawString( UIButton.FONT_DEFAULT, weapon.Name, new Vector2( TEXT_PADDING + textX, TEXT_PADDING + textY ), Color.Black ); sb.DrawString( UIButton.FONT_DEFAULT, "Schaden: " + weapon.Damage, new Vector2( TEXT_PADDING + textX, TEXT_PADDING + textY + TEXT_LINE_HEIGHT * 2 ), Color.Black ); sb.DrawString( UIButton.FONT_DEFAULT, "Feuerrate: " + weapon.RateOfFire, new Vector2( TEXT_PADDING + textX, TEXT_PADDING + textY + TEXT_LINE_HEIGHT * 3 ), Color.Black ); sb.DrawString( UIButton.FONT_DEFAULT, "Accuracy: " + weapon.Accuracy, new Vector2( TEXT_PADDING + textX, TEXT_PADDING + textY + TEXT_LINE_HEIGHT * 4 ), Color.Black ); sb.DrawString( UIButton.FONT_DEFAULT, "Gewicht: " + weapon.Weight, new Vector2( TEXT_PADDING + textX, TEXT_PADDING + textY + TEXT_LINE_HEIGHT * 5 ), Color.Black ); }
/// <summary> /// Waffe einem Shortcut hinzufügen /// </summary> /// <param name="key"> Shortcutplatz </param> /// <param name="weapon"> Waffe die hinzugefügt wird </param> public void AddWeaponToShortcutList(int key, Weapon weapon) { if (!Shortcuts.ContainsKey(key)) { Shortcuts[key] = weapon; } }
private void DrawWeapon(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, Weapon weapon) { int x = (int)(GetPosition().X); int y = (int)(GetPosition().Y); sb.DrawString(UIButton.FONT_DEFAULT, weapon.Name, new Vector2(padding + x, padding + y), Color.Black); sb.DrawString(UIButton.FONT_DEFAULT, "Schaden: " + weapon.Damage + " Feuerrate: " + weapon.RateOfFire, new Vector2(padding + x, padding + y + lineHeight), Color.Black); sb.DrawString(UIButton.FONT_DEFAULT, "Accuracy: " + weapon.Accuracy + " Gewicht: " + weapon.Weight, new Vector2(padding + x, padding + y + lineHeight * 2), Color.Black); }
// *************************************************************************** // Clone public Weapon Clone() { Weapon w = new Weapon( GetInner() ); w.Renderer = Renderer.Clone(); w.LocationBehavior = LocationBehavior.Clone(); return w; }
public void OnMouseDown(UIElement element) { if (element.GetType() == typeof(UIListButton)) { Item item = ((UIListButton) element).Item; if (item.GetType() == typeof (Visier)) { constructionPanel.SetVisier((Visier) item); } else if (item.GetType() == typeof (Antrieb)) { constructionPanel.SetAntrieb((Antrieb) item); } else if (item.GetType() == typeof (Stabilisator)) { constructionPanel.SetStabilisator((Stabilisator) item); } else if (item.GetType() == typeof (Hauptteil)) { constructionPanel.SetHauptteil((Hauptteil) item); } } else if(element.GetType() == typeof(UIButton)) { Visier v = constructionPanel.Visier; Antrieb a = constructionPanel.Antrieb; Stabilisator s = constructionPanel.Stabilisator; Hauptteil h = constructionPanel.Hauptteil; Weapon newWeapon = new Weapon(v, a, s, h, Item.StaticID, 0, constructionPanel.InputText, 0, "", new MapLocation(new Vector2(0,0))); player.RemoveItemFromInventar(v); player.RemoveItemFromInventar(a); player.RemoveItemFromInventar(s); player.RemoveItemFromInventar(h); Item.AllItems.Add(Item.StaticID++, newWeapon); player.AddItemToInventar(newWeapon); filteredConstructorList.RefreshItemList(); player.ReduceLiquid(newWeapon.GetTotalRequeredLiquids()); constructionPanel.ResetPanel(); } }