public static void PerformSaveFileLoad() { System.IO.File.WriteAllText(GenFilePaths.FilePathForSavedGame(m_sfd.partial_name), m_sfd.tcontext); ThingFilterPatch.avoidThingFilterUsage = true; GameDataSaveLoader.LoadGame(m_sfd.partial_name); ThingFilterPatch.avoidThingFilterUsage = false; }
private void ConvertWorld(string filePath) { normalClose = false; var prevGame = Current.Game; // Fix UIRoot_Entry error. var persistentWorld = new PersistentWorld(); Current.Game = prevGame; // Fix UIRoot_Entry error. persistentWorld.LoadSaver = new PersistentWorldLoadSaver(persistentWorld, filePath) { Status = PersistentWorldLoadSaver.PersistentWorldLoadStatus.Converting }; PersistentWorldManager.GetInstance().PersistentWorld = persistentWorld; GameDataSaveLoader.LoadGame(Path.GetFileNameWithoutExtension(filePath)); }
public static void Postfix(ref Rect __state, ref Page_CreateWorldParams __instance) { GUI.BeginGroup(__state); float y = 280f; Rect baseRect = new Rect(0f, y, 200f, 30f); Widgets.Label(baseRect, Translator.Translate("EditorLabel")); Rect EarthRect = new Rect(200f, y, 200f, 30f); if (Settings.FullyActiveEditor == false) { if (Widgets.RadioButtonLabeled(EarthRect, Translator.Translate("isEnableEditorLabel"), isEdit == true)) { isEdit = !isEdit; } } else { Widgets.Label(EarthRect, Translator.Translate("ActiveFullyMode")); isEdit = true; } GUI.EndGroup(); Widgets.Label(new Rect(440, 40, 200, 20), Translator.Translate("WorldTemplates")); int worldsSize = WorldTemplateManager.Templates.Count * 25; Rect scrollRect = new Rect(440, 70, 200, 400); Rect scrollVertRect = new Rect(0, 0, scrollRect.x, worldsSize); Widgets.BeginScrollView(scrollRect, ref scrollPositionWorlds, scrollVertRect); int x = 0; foreach (var world in WorldTemplateManager.Templates) { if (Widgets.ButtonText(new Rect(0, x, 180, 20), world.WorldName)) { selectedTemplate = world; StringBuilder builder = new StringBuilder(); builder.AppendLine($"{Translator.Translate("TemplateHead")}{world.WorldName}"); builder.AppendLine($"{Translator.Translate("TemplateAuthor")}{world.Author}"); builder.AppendLine($"{Translator.Translate("TemplateStoryteller")}{world.Storyteller}"); builder.AppendLine($"{Translator.Translate("TemplateScenario")}{world.Scenario}"); builder.AppendLine($"{Translator.Translate("TemplateDesc")}{world.Description}"); worldInfo = builder.ToString(); } x += 22; } Widgets.EndScrollView(); Widgets.LabelScrollable(new Rect(650, 70, 340, 400), worldInfo, ref scrollPositionInfo, false, false); if (selectedTemplate != null) { if (Widgets.ButtonText(new Rect(440, 500, 200, 20), Translator.Translate("LoadTemplate"))) { isWorldTemplate = true; LoadedTemplate = selectedTemplate; CustomStartingSite.OneWayToShow = false; GameDataSaveLoader.LoadGame(selectedTemplate.FilePath); } } }