Scriptum/Assets/Scripts/Chest/ChestPanelController.cs
kabix09 9fa400f9a7 Add inventory Drag & Drop
Simple code refaactor
2022-06-05 10:30:52 +02:00

56 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System;
public class ChestPanelController : BasePanelController
{
public override void CloseOnClick()
{
Destroy(gameObject); // destroy panel
if(_instance)
{
_instance.GetComponent<ChestController>().ClosePanel();
}
}
public void Setup(GameObject _chest, Dictionary<int, Item> _chestItems)
{
_instance = _chest;
base.Setup(_chestItems);
}
protected override ISlot SetupSlot(int key, GameObject _parent)
{
ChestSlot _tmpSlot = Instantiate(_blankSlot, _parent.transform.position, Quaternion.identity).GetComponent<ChestSlot>();
_tmpSlot.transform.SetParent(_parent.transform);
_tmpSlot.SetupSlot(key, null, this);
return _tmpSlot;
}
// Islot - > Aslot
// - > B slots
// Ipanel -> Apanel
// -> B panel
// ---------------------------
// will work differently depending if its chest, inventory or equipment panel
// public void Equip(EquippableItem item)
// {
// if(RemoveItem(item))
// {
// EquippableItem previousItem;
// }
// }
}