using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using System; public class InventoryPanelController : BasePanelController { public override void CloseOnClick() { Destroy(gameObject); // destroy panel InventoryManager.Instance.GetComponent().ClosePanel(); } public void Setup(GameObject _inventory, Dictionary _items) { _instance = _inventory; base.Setup(_items); } void Update() { if (Input.GetKeyDown("i")) { Destroy(gameObject); // destroy panel InventoryManager.Instance.GetComponent().ClosePanel(); } } protected override ISlot SetupSlot(int key, GameObject _parent) { InventorySlot _tmpSlot = Instantiate(_blankSlot, _parent.transform.position, Quaternion.identity).GetComponent(); _tmpSlot.transform.SetParent(_parent.transform); _tmpSlot.SetupSlot(key, null, this); return _tmpSlot; } // public void Drop(ItemSlot dropItemSlot) // { // if(dropItemSlot.CanReceiveItem(draggedSlot.Item) && draggedSlot.CanReceiveItem(dropItemSlot.Item)) // { // EquippableItem dragItem = draggedSlot.Item as EquippableItem; // EquippableItem dropItem = dropItemSlot.Item as EquippableItem; // // for changing chest to evuuipment or onventory panel !!!! // if(draggedSlot is EquipmentSlot) // { // if(dragItem != null) dragItem.Unequip(this); // if(dropItem != null) dropItem.Equip(this); // } // if(dropItemSlot is EquipmentSlot) // { // if(dragItem != null) dragItem.Equip(this); // if(dropItem != null) dropItem.Unequip(this); // } // Item draggedItem = draggedSlot.Item; // remember temporary currently dragged item // draggedSlot.Item = dropItemSlot.Item; // dropItemSlot.Item = draggedItem; // // update items position in chest slots // // - after close paned - items dont reset its positions // _inventory.GetComponent().SetItemOnPosition(draggedSlot.Number, draggedSlot.Item); // _inventory.GetComponent().SetItemOnPosition(dropItemSlot.Number, dropItemSlot.Item); // } // } }