private void OnSceneLoadCancelled(ModScene scene) { if (SceneLoadCancelled != null) { SceneLoadCancelled.Invoke(scene); } }
private void OnSceneUnloaded(ModScene scene) { if (SceneUnloaded != null) { SceneUnloaded.Invoke(scene); } }
private void Initialize() { allInstances = new Dictionary <Type, object>(); assemblies = new List <Assembly>(); _prefabs = new List <GameObject>(); _scenes = new List <ModScene>(); _conflictingMods = new List <Mod>(); _assemblyNames = new List <string>(); prefabs = _prefabs.AsReadOnly(); scenes = _scenes.AsReadOnly(); conflictingMods = _conflictingMods.AsReadOnly(); assemblyNames = _assemblyNames.AsReadOnly(); assetPaths = assetsResource.assetPaths; sceneNames = scenesResource.assetPaths; assetsResource.Loaded += OnAssetsResourceLoaded; scenesResource.Loaded += OnScenesResourceLoaded; foreach (string sceneName in sceneNames) { ModScene modScene = new ModScene(sceneName, this); modScene.Loaded += OnSceneLoaded; modScene.Unloaded += OnSceneUnloaded; modScene.LoadCancelled += OnSceneLoadCancelled; _scenes.Add(modScene); } foreach (string assembly in assemblyFiles) { _assemblyNames.Add(Path.GetFileName(assembly)); } contentHandler = new ContentHandler(this, _scenes.Cast <IResource>().ToList().AsReadOnly(), prefabs); }