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

◆ AddAutomaticPlayerMigrationButtons()

void Terraria.GameContent.UI.States.UICharacterSelect.AddAutomaticPlayerMigrationButtons ( )
inlineprivate

Definition at line 539 of file UICharacterSelect.cs.

540 {
541 string vanillaPlayersPath = Path.Combine(Platform.Get<IPathService>().GetStoragePath("Terraria"), "Players");
542 if (!Directory.Exists(vanillaPlayersPath) || !Directory.GetFiles(vanillaPlayersPath, "*.plr").Any())
543 {
544 return;
545 }
547 autoMigrateButton.Width.Set(0f, 1f);
548 autoMigrateButton.Height.Set(50f, 0f);
549 UIText migrateText = new UIText((!_currentlyMigratingFiles) ? Language.GetText("tModLoader.MigratePlayersText") : Language.GetText("tModLoader.MigratingWorldsText"));
550 autoMigrateButton.OnLeftClick += delegate
551 {
553 {
555 migrateText.SetText(Language.GetText("tModLoader.MigratingWorldsText"));
556 Task.Factory.StartNew(delegate
557 {
559 }, TaskCreationOptions.PreferFairness);
560 }
561 };
564 UIText noPlayersMessage = new UIText(Language.GetTextValue("tModLoader.MigratePlayersMessage", Program.SaveFolderName));
565 noPlayersMessage.Width.Set(0f, 1f);
566 noPlayersMessage.Height.Set(300f, 0f);
567 noPlayersMessage.MarginTop = 20f;
568 noPlayersMessage.OnLeftClick += delegate
569 {
570 Utils.OpenFolder(Main.PlayerPath);
571 Utils.OpenFolder(vanillaPlayersPath);
572 };
574 }
virtual void Add(UIElement item)
Definition UIList.cs:106
static void ExecuteAutomaticPlayerMigration(string vanillaPlayersPath)
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.UICharacterSelect._currentlyMigratingFiles, Terraria.GameContent.UI.States.UICharacterSelect._playerList, Terraria.GameContent.UI.Elements.UIList.Add(), Terraria.GameContent.UI.States.UICharacterSelect.ExecuteAutomaticPlayerMigration(), Terraria.Localization.Language.GetText(), Terraria.Localization.Language.GetTextValue(), Terraria.Utils.OpenFolder(), Terraria.Main.PlayerPath, and Terraria.Program.SaveFolderName.

Referenced by Terraria.GameContent.UI.States.UICharacterSelect.UpdatePlayersList().

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