using GadgetCore.API;
using UnityEngine;

namespace AncientReassembler
{
  public class MenuOpenCloseEventScript : MonoBehaviour
  {
    void OnEnable()
    {
      Core.itemStore.Clear();
      Core.itemStore.UpdateUI(gameObject);
    }

    void OnDisable()
    {
      foreach (Item item in Core.itemStore.Items)
        if (item != null && item.id > 0)
          GadgetCoreAPI.DropItem(MenuScript.player.transform.position, item);
      Core.itemStore.Clear();
    }
  }
}
