Scriptum/Assets/Scripts/Chest/ChestPanelController.cs

56 lines
1.3 KiB
C#
Raw Normal View History

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