TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ AddAutomaticWorldMigrationButtons()

void Terraria.GameContent.UI.States.UIWorldSelect.AddAutomaticWorldMigrationButtons ( )
inlineprivate

Definition at line 538 of file UIWorldSelect.cs.

539 {
540 string vanillaWorldsPath = Path.Combine(Platform.Get<IPathService>().GetStoragePath("Terraria"), "Worlds");
541 if (!Directory.Exists(vanillaWorldsPath) || !Directory.GetFiles(vanillaWorldsPath, "*.wld").Any())
542 {
543 return;
544 }
546 autoMigrateButton.Width.Set(0f, 1f);
547 autoMigrateButton.Height.Set(50f, 0f);
548 UIText migrateText = new UIText((!_currentlyMigratingFiles) ? Language.GetText("tModLoader.MigrateWorldsText") : Language.GetText("tModLoader.MigratingWorldsText"));
549 autoMigrateButton.OnLeftClick += delegate
550 {
552 {
554 migrateText.SetText(Language.GetText("tModLoader.MigratingWorldsText"));
555 Task.Factory.StartNew(delegate
556 {
558 }, TaskCreationOptions.PreferFairness);
559 }
560 };
563 UIText noWorldsMessage = new UIText(Language.GetTextValue("tModLoader.MigrateWorldsMessage", Program.SaveFolderName));
564 noWorldsMessage.Width.Set(0f, 1f);
565 noWorldsMessage.Height.Set(300f, 0f);
566 noWorldsMessage.MarginTop = 20f;
567 noWorldsMessage.OnLeftClick += delegate
568 {
569 Utils.OpenFolder(Main.WorldPath);
570 Utils.OpenFolder(vanillaWorldsPath);
571 };
573 }
virtual void Add(UIElement item)
Definition UIList.cs:106
static void ExecuteAutomaticWorldMigration(string vanillaWorldsPath)
static LocalizedText GetText(string key)
Retrieves a LocalizedText object for a specified localization key. The actual text value can be retri...
Definition Language.cs:25
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12

References Terraria.GameContent.UI.States.UIWorldSelect._currentlyMigratingFiles, Terraria.GameContent.UI.States.UIWorldSelect._worldList, Terraria.GameContent.UI.Elements.UIList.Add(), Terraria.GameContent.UI.States.UIWorldSelect.ExecuteAutomaticWorldMigration(), Terraria.Localization.Language.GetText(), Terraria.Localization.Language.GetTextValue(), Terraria.Utils.OpenFolder(), Terraria.Program.SaveFolderName, and Terraria.Main.WorldPath.

Referenced by Terraria.GameContent.UI.States.UIWorldSelect.UpdateWorldsList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: