private static void OnToggle(bool enabled)
 {
     if (enabled)
     {
         if (AccessTools.TypeByName(nameof(XLObjectDropper.Settings)) != null)
         {
             SpawnableManager.DeleteSpawnedObjects();
         }
         else
         {
             HandleFailure();
         }
     }
 }
Пример #2
0
        private void ClearAllClicked()
        {
            if (SpawnableManager.SpawnedObjects == null || !SpawnableManager.SpawnedObjects.Any())
            {
                return;
            }

            // Should we maybe show an 'are you sure?' dialog
            var gameObjects             = SpawnableManager.SpawnedObjects.Select(x => x.SpawnedInstance).ToList();
            var batchObjectDeletedEvent = new BatchObjectDeletedEvent(gameObjects);

            batchObjectDeletedEvent.AddToUndoStack();

            SpawnableManager.DeleteSpawnedObjects();
        }
            static void Prefix(LevelManager __instance, LevelInfo level)
            {
                if (level.Equals(LevelManager.Instance.currentLevel) || GameStateMachine.Instance.IsLoading)
                {
                    return;
                }

                // Display Dialog here
                // If yes, save out objects
                //var test = UnityEngine.Object.Instantiate(original: AssetBundleHelper.UnsavedChangesDialogPrefab);
                //test.SetActive(true);


                //Utilities.SaveManager.Instance.SaveCurrentSpawnables();

                SpawnableManager.DeleteSpawnedObjects();

                return;
            }
        public void LoadSave(LevelSaveData levelSave)
        {
            if (string.IsNullOrEmpty(levelSave.filePath) || !File.Exists(levelSave.filePath))
            {
                return;
            }
            if (levelSave.gameObjects == null || !levelSave.gameObjects.Any())
            {
                return;
            }

            SpawnableManager.DeleteSpawnedObjects();

            foreach (var savedGameObject in levelSave.gameObjects)
            {
                savedGameObject.Instantiate();
            }

            SaveLoaded?.Invoke();
        }