public void DropItem() { _item = null; icon.sprite = null; icon.enabled = false; //check on itemtype and intantiate obj S }
public override bool CanGetItem(MainItems item) { if (item = null) { return(true); } EquipableItem equipableItem = item as EquipableItem; return(equipableItem != null && equipableItem.EquipmentType == EquipmentType); }
public void AddItem(Item item, bool main = true) { if (main) { MainItems.Add(item); } else { InfoItems.Add(item); } }
private void GenerateData() { MainItems.Add(new ItemVm("My Lego", new BitmapImage(new Uri("Images/lego1.jpg", UriKind.Relative)), "5-10")); MainItems.Add(new ItemVm("My Playmobil", new BitmapImage(new Uri("Images/playmobil1.jpg", UriKind.Relative)), "6+")); MainItems[0].AddItem(new ItemVm("Helicopter", new BitmapImage(new Uri("Images/lego1.jpg", UriKind.Relative)), "5-10")); MainItems[0].AddItem(new ItemVm("Machine", new BitmapImage(new Uri("Images/lego2.jpg", UriKind.Relative)), "1-3")); MainItems[0].AddItem(new ItemVm("New Machine", new BitmapImage(new Uri("Images/lego3.jpg", UriKind.Relative)), "3-7")); MainItems[0].AddItem(new ItemVm("Digger", new BitmapImage(new Uri("Images/lego4.jpg", UriKind.Relative)), "10+")); MainItems[1].AddItem(new ItemVm("House", new BitmapImage(new Uri("Images/playmobil1.jpg", UriKind.Relative)), "6+")); MainItems[1].AddItem(new ItemVm("Package", new BitmapImage(new Uri("Images/playmobil2.jpg", UriKind.Relative)), "2-7")); MainItems[1].AddItem(new ItemVm("Warriors", new BitmapImage(new Uri("Images/playmobil3.jpg", UriKind.Relative)), "3-6")); }
public bool AddItem(MainItems item) //method that check inventory for free slot where we will put picking item { for (int i = 0; i < itemSlots.Length; i++) { if (itemSlots[i].Item == null) { itemSlots[i].Item = item; return(true); } } if (onIvnentoryChangeCallback != null) { onIvnentoryChangeCallback.Invoke(); //calling update of inventory //cases* } return(false); }
public bool RemoveItem(MainItems item) //method that check inventory slot have an item that we need to remove { for (int i = 0; i < itemSlots.Length; i++) { if (itemSlots[i].Item == item) { itemSlots[i].Item = null; return(true); } } //add method that updating an inventory //if (items.Remove(item)) { // UpdateInvUI(); // return true; //} return(false); }
private void AddSomethingNew() { Source.AddOrUpdate(new ProjectDto(1, 3, "3rd")); Source.AddOrUpdate(new ProjectDto(2, 4, "4th")); Source.AddOrUpdate(new ProjectDto(1, 5, "5th")); Source.AddOrUpdate(new ProjectDto(2, 6, "6th")); Source.AddOrUpdate(new ProjectDto(3, 7, "7th")); Source.AddOrUpdate(new ProjectDto(4, 8, "8th")); Source.AddOrUpdate(new ProjectDto(5, 9, "9th")); Source.AddOrUpdate(new ProjectDto(1, 1, "New Name!")); Source.AddOrUpdate(new QuotationDto(2, 5)); Source.AddOrUpdate(new QuotationDto(1, 6)); Source.AddOrUpdate(new QuotationDto(2, 7)); var toRemove = MainItems.Where(i => !(i.Item is AddressDto)).ToList(); toRemove.ForEach(i => Source.Remove(i.Item)); }
public Inventory(BasePlayer player) { var playerInv = player?.inventory?.containerBelt?.itemList; if (playerInv != null) { foreach (Item item in playerInv) { if (item == null) { continue; } BeltItems.Add(new SavedItem(item)); } } playerInv = player?.inventory?.containerMain?.itemList; if (playerInv != null) { foreach (Item item in playerInv) { if (item == null) { continue; } MainItems.Add(new SavedItem(item)); } } playerInv = player?.inventory?.containerWear?.itemList; if (playerInv != null) { foreach (Item item in playerInv) { if (item == null) { continue; } WearItems.Add(new SavedItem(item)); } } }
public void Prompt() { while (true) { Logger.Write("> "); var choice = Console.ReadLine()?.ToLower(); Logger.ClearLast(); var chosenItem = MainItems.Find(i => i.HotKey == choice) ?? ExtraItems.Find(i => i.HotKey == choice); if (chosenItem == null) { continue; } chosenItem.Action(); if (chosenItem.PostAction != MenuItem.PostActionMode.START) { continue; } Logger.Clear(); break; } }
private void ItemDrop(ItemSlot itemSlot) { Debug.Log("trying"); if (itemSlot.CanGetItem(draggedSlot.Item) && draggedSlot.CanGetItem(itemSlot.Item)) { } EquipableItem dragItem = draggedSlot.Item as EquipableItem; EquipableItem dropItem = itemSlot.Item as EquipableItem; if (itemSlot is EquipmentSlot) { if (dragItem != null) { dragItem.Unequip(this); } if (dropItem != null) { dropItem.Equip(this); } } if (draggedSlot is EquipmentSlot) { if (dragItem != null) { dragItem.Equip(this); } if (dropItem != null) { dropItem.Unequip(this); } } MainItems draggedItem = draggedSlot.Item; draggedSlot.Item = itemSlot.Item; itemSlot.Item = draggedItem; }
public void AddItem(MainItems newItem) { _item = newItem; icon.sprite = _item.icon; icon.enabled = true; }
public virtual bool CanGetItem(MainItems item) { return(true); }