Esempio n. 1
0
        private void ReloadList()
        {
            Clear();

            foreach (string preset in DeloreanModsCopy.ListPresets())
            {
                AddItem(new UIMenuItem(preset));
            }

            RefreshIndex();
        }
        private static void MainMenu_OnMenuOpen(UIMenu sender)
        {
            if (DeloreanModsCopy.ListPresets().Count > 0)
            {
                MainMenu.ReleaseMenuFromItem(spawnPresetDelorean);
                MainMenu.BindMenuToItem(InteractionMenuManager.PresetsMenu, spawnPresetDelorean);
            }
            else
            {
                MainMenu.ReleaseMenuFromItem(spawnPresetDelorean);
                MainMenu.BindMenuToItem(InteractionMenuManager.SpawnMenu, spawnPresetDelorean);
            }

            rcMenu.Enabled = Main.PlayerVehicle == null;
        }
        private static void MainMenu_OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
        {
            if (selectedItem == spawnPresetDelorean && DeloreanModsCopy.ListPresets().Count == 0)
            {
                Notification.Show(Game.GetLocalizedString("BTTFV_Menu_Presets_Not_Found"));
            }

            if (selectedItem == spawnCustomDelorean || selectedItem == spawnPresetDelorean)
            {
                return;
            }

            if (selectedItem == spawnDelorean)
            {
                DeloreanHandler.Spawn(DeloreanType.DMC12);
                Main.MenuPool.CloseAllMenus();
            }

            if (selectedItem == spawnDelorean1)
            {
                if (ModSettings.CinematicSpawn)
                {
                    DeloreanHandler.SpawnWithReentry(DeloreanType.BTTF1);
                }
                else
                {
                    DeloreanHandler.Spawn(DeloreanType.BTTF1);
                }
                Main.MenuPool.CloseAllMenus();
            }

            if (selectedItem == spawnDelorean2)
            {
                if (ModSettings.CinematicSpawn)
                {
                    DeloreanHandler.SpawnWithReentry(DeloreanType.BTTF2);
                }
                else
                {
                    DeloreanHandler.Spawn(DeloreanType.BTTF2);
                }
                Main.MenuPool.CloseAllMenus();
            }

            if (selectedItem == spawnDelorean3)
            {
                if (ModSettings.CinematicSpawn)
                {
                    DeloreanHandler.SpawnWithReentry(DeloreanType.BTTF3);
                }
                else
                {
                    DeloreanHandler.Spawn(DeloreanType.BTTF3);
                }
                Main.MenuPool.CloseAllMenus();
            }

            if (selectedItem == removeOtherDeloreans)
            {
                DeloreanHandler.RemoveAllDeloreans(true);
                RemoteDeloreansHandler.DeleteAll();
                Notification.Show(Game.GetLocalizedString("BTTFV_RemovedOtherTimeMachines"));
            }

            if (selectedItem == removeAllDeloreans)
            {
                DeloreanHandler.RemoveAllDeloreans();
                RemoteDeloreansHandler.DeleteAll();
                Notification.Show(Game.GetLocalizedString("BTTFV_RemovedAllTimeMachines"));
            }

            if (selectedItem == removeDelorean)
            {
                var delorean = DeloreanHandler.GetDeloreanFromVehicle(Main.PlayerVehicle);

                if (delorean == null)
                {
                    Notification.Show(Game.GetLocalizedString("BTTFV_NotSeatedInTimeMachine"));
                    return;
                }

                DeloreanHandler.RemoveDelorean(delorean);
            }
        }