Content re-read through SceneManager.ReloadContent
This commit is contained in:
1 parent
92d78d07cd
commit
164194ef50
3 files changed
+5
-14
No files matched your search
@@ -62,7 +62,7 @@ namespace Cthangover.Mods.ScenarioStudio
|
||||
Directory.CreateDirectory(Path.Combine(RootPath, "scenes"));
|
||||
Directory.CreateDirectory(Path.Combine(RootPath, "backgrounds"));
|
||||
ModOverlays.Mount(Id, new FolderModFileProvider(RootPath, Id));
|
||||
RefreshContent();
|
||||
SceneManager.ReloadContent();
|
||||
GameLogger.Log("UI", $"Scenario studio: layer '{Id}' mounted at {RootPath}");
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Cthangover.Mods.ScenarioStudio
|
||||
name = $"{scene}_studio_{n}";
|
||||
|
||||
Write($"scenarios/{name}.scenario", $"scene: {scene}\npriority: 50\n---\n{firstLine}\nend\n");
|
||||
RefreshContent();
|
||||
SceneManager.ReloadContent();
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -141,15 +141,6 @@ namespace Cthangover.Mods.ScenarioStudio
|
||||
return target;
|
||||
}
|
||||
|
||||
/// <summary>Makes the next scene composition and the scene table see changed scenario and scene files.</summary>
|
||||
public static void RefreshContent()
|
||||
{
|
||||
ScenarioDefs.Invalidate();
|
||||
ModManager.Instance.GetResolver<SceneDefinitionResolver>()?.ClearCache();
|
||||
AppServices.Current.SceneDefs.Clear();
|
||||
SceneManager.RescanScenes();
|
||||
}
|
||||
|
||||
private string ScenarioFile(string name) => Path.Combine(RootPath, "scenarios", name + ".scenario");
|
||||
|
||||
private static void CopyTree(string from, string to)
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Cthangover.Mods.ScenarioStudio
|
||||
File.WriteAllText(ModManager.Instance.GetFileSystemPath(evt.SourceModId, evt.SourcePath), copy.Text);
|
||||
|
||||
_copies.Remove(evt.ID);
|
||||
StudioLayer.RefreshContent();
|
||||
SceneManager.ReloadContent();
|
||||
Journal.Add(StudioLogCategory.Edit, new StudioText("studio/log_text_applied", evt.ID, pending, target.ModId));
|
||||
GameLogger.Log("UI", $"Scenario studio: applied {pending} change(s) of '{evt.ID}' to '{target.ModId}'");
|
||||
Restart(StudioRestartMode.Rollback);
|
||||
@@ -484,7 +484,7 @@ namespace Cthangover.Mods.ScenarioStudio
|
||||
}
|
||||
|
||||
var scenario = Layer.CreateScene(name, backgrounds, StudioScriptEdits.NewLine());
|
||||
StudioLayer.RefreshContent();
|
||||
SceneManager.ReloadContent();
|
||||
Journal.Add(StudioLogCategory.Edit, new StudioText("studio/log_text_scene_created", name, scenario));
|
||||
Touch();
|
||||
return true;
|
||||
|
||||
@@ -582,7 +582,7 @@ namespace Cthangover.Mods.ScenarioStudio.Tests.Live
|
||||
if (string.IsNullOrEmpty(root) || !Directory.Exists(root))
|
||||
return;
|
||||
ModOverlays.Unmount(StudioLayer.Id);
|
||||
StudioLayer.RefreshContent();
|
||||
SceneManager.ReloadContent();
|
||||
Directory.Delete(root, true);
|
||||
var parent = Path.GetDirectoryName(root);
|
||||
if (parent != null && Directory.GetFileSystemEntries(parent).Length == 0)
|
||||
|
||||
Reference in new issue
Block a user