MenuOpenCloseEventScript.cs 617 B

12345678910111213141516171819202122232425262728
  1. using GadgetCore.API;
  2. using GadgetCore.Util;
  3. using HarmonyLib;
  4. using System;
  5. using System.Collections;
  6. using System.Threading;
  7. using System.Windows.Threading;
  8. using UnityEngine;
  9. namespace AncientReassembler
  10. {
  11. public class MenuOpenCloseEventScript : MonoBehaviour
  12. {
  13. void OnEnable()
  14. {
  15. Core.itemStore.Clear();
  16. Core.itemStore.UpdateUI(gameObject);
  17. }
  18. void OnDisable()
  19. {
  20. foreach (Item item in Core.itemStore.Items)
  21. if (item != null && item.id > 0)
  22. GadgetCoreAPI.DropItem(MenuScript.player.transform.position, item);
  23. Core.itemStore.Clear();
  24. }
  25. }
  26. }