public InventoryItem(InventoryItem item, int amount) { this.itemID = item.itemID; this.amount = amount; this.stackSize = item.stackSize; this.toolType = item.toolType; this.placeable = item.placeable; this.placingOffset = item.placingOffset; this.tileable = item.tileable; }
public InventoryItem(int itemID, int amount = 1, int stackSize = 64, ToolTypeEnum toolType = ToolTypeEnum.NONE, bool placeable = false, float placingOffsetX = 0, float placingOffsetY = 0, bool tileable = false) { this.itemID = itemID; this.amount = amount; this.stackSize = stackSize; this.toolType = toolType; this.placeable = placeable; this.placingOffset = new Vector2(placingOffsetX, placingOffsetY); this.tileable = tileable; }
public bool HasItemType(ToolTypeEnum type) { for (int i = 0; i < inventory.Length; i++) { if (inventory[i] != null && inventory[i].toolType == type) { return(true); } } return(false); }
/// <summary> /// Salva modifiche database /// </summary> private void AddTool(ToolTypeEnum toolType) { Utensile tool = null; switch (toolType) { case ToolTypeEnum.Punta: { tool = new Punta(_measureUnit); } break; case ToolTypeEnum.Centrino: { tool = new Centrino(_measureUnit); } break; case ToolTypeEnum.Svasatore: { tool = new Svasatore(_measureUnit); } break; case ToolTypeEnum.Lamatore: { tool = new Lamatore(_measureUnit); } break; case ToolTypeEnum.Bareno: { tool = new Bareno(_measureUnit); } break; case ToolTypeEnum.Maschio: { tool = new Maschio(_measureUnit); } break; case ToolTypeEnum.FresaCandela: { tool = new FresaCandela(_measureUnit); } break; case ToolTypeEnum.Alesatore: { tool = new Alesatore(_measureUnit); } break; case ToolTypeEnum.FresaSpianare: { tool = new FresaSpianare(_measureUnit); } break; default: throw new NotImplementedException("UtViewModel.AddTool"); } var guid = tool.ToolGuid; _magazzinoUtensile.SaveTool(tool); UpdateTreeView(); foreach (var treeViewItemViewModel in _treeView) { foreach (var viewItemViewModel in treeViewItemViewModel.Children) { var tvm = viewItemViewModel as ToolTreeViewItemViewModel; if (tvm != null) { if (tvm.ToolGuid == guid) { tvm.IsSelected = true; break; } } } } }