using System.Linq;
|
|
using UnityEngine;
|
|
|
|
public class InventoryCatch : LogicElementHolder
|
|
{
|
|
[SerializeField]
|
|
private InventoryUI InventoryUI;
|
|
|
|
public override void OnAdd(LogicElementUI element)
|
|
{
|
|
foreach (LogicBlock block in element.logicElement.GetAllBlocks())
|
|
{
|
|
BagItem item = InventoryUI.content.FirstOrDefault(p => p.canHold(block));
|
|
|
|
if (item != default)
|
|
item.OnAdd(element);
|
|
|
|
Destroy(element.gameObject);
|
|
}
|
|
}
|
|
|
|
public override void OnDoubleClick(LogicElementUI element)
|
|
{
|
|
//DoNothing
|
|
}
|
|
|
|
public override void OnRemove(LogicElementUI element)
|
|
{
|
|
//DoNothing
|
|
}
|
|
}
|