예제 #1
0
        private void Main_Aborted(object sender, EventArgs e)
        {
            // Unsub NativeUI events
            if (BenchMain != null)
            {
                BenchMain.OnItemSelect -= BenchMain_OnItemSelect;
            }

            if (BenchList != null)
            {
                BenchList.OnItemSelect -= BenchList_OnItemSelect;
            }

            if (AmountItem != null)
            {
                AmountItem.Activated -= AmountItem_Activated;
            }

            if (ConfirmItem != null)
            {
                ConfirmItem.Activated -= ConfirmItem_Activated;
            }

            // Clear managers
            AmmoTypeManager.Clear();
            MaterialManager.Clear();
            ConversionManager.Clear();

            // Unsub area events before nuking benches
            foreach (Bench bench in BenchManager.Benches)
            {
                if (bench.Area != null)
                {
                    bench.Area.PlayerEnter -= PlayerEnterBenchArea;
                    bench.Area.PlayerLeave -= PlayerLeaveBenchArea;
                }
            }

            BenchManager.Clear();

            // Other clean-up
            CurCraftingAmounts.Clear();
            MaterialMenuItems.Clear();

            CurCraftingAmounts = null;
            MaterialMenuItems  = null;
        }