diff --git a/Tools/Miscellaneous/MiscellaneousUI.cs b/Tools/Miscellaneous/MiscellaneousUI.cs index 9d87ed0..eeb54e6 100644 --- a/Tools/Miscellaneous/MiscellaneousUI.cs +++ b/Tools/Miscellaneous/MiscellaneousUI.cs @@ -29,7 +29,7 @@ public override void OnInitialize() mainPanel = new UIPanel(); mainPanel.SetPadding(0); int width = 250; - int height = 180; + int height = 270; mainPanel.Left.Set(-40f - width, 1f); mainPanel.Top.Set(-110f - height, 1f); mainPanel.Width.Set(width, 0f); @@ -89,9 +89,50 @@ public override void OnInitialize() mainPanel.Append(logSoundsCheckbox); top += 20; + UITextPanel takeWorldSnapshot = new UITextPanel("Take World Snapshot (WIP)"); + takeWorldSnapshot.SetPadding(4); + takeWorldSnapshot.Width.Set(-10, 0.5f); + takeWorldSnapshot.Top.Set(top, 0f); + takeWorldSnapshot.OnClick += TakeWorldSnapshot_OnClick; ; + mainPanel.Append(takeWorldSnapshot); + top += 30; + + UITextPanel restoreWorldSnapshot = new UITextPanel("Restore World Snapshot (WIP)"); + restoreWorldSnapshot.SetPadding(4); + restoreWorldSnapshot.Width.Set(-10, 0.5f); + restoreWorldSnapshot.Top.Set(top, 0f); + restoreWorldSnapshot.OnClick += RestoreWorldSnapshot_OnClick; ; + mainPanel.Append(restoreWorldSnapshot); + top += 30; + Append(mainPanel); } + Tile[,] snapshot; + private void TakeWorldSnapshot_OnClick(UIMouseEvent evt, UIElement listeningElement) { + Main.NewText("Taking Snapshot"); + snapshot = new Tile[Main.maxTilesX, Main.maxTilesY]; + for (int i = 0; i < Main.maxTilesX; i++) { + for (int j = 0; j < Main.maxTilesY; j++) { + snapshot[i, j] = new Tile(Main.tile[i, j]); + } + } + Main.NewText("Taking Snapshot Complete"); + } + + private void RestoreWorldSnapshot_OnClick(UIMouseEvent evt, UIElement listeningElement) { + if (snapshot == null) { + Main.NewText("No snapshot available"); + return; + } + Main.NewText("Restoring Snapshot"); + for (int i = 0; i < Main.maxTilesX; i++) { + for (int j = 0; j < Main.maxTilesY; j++) { + Main.tile[i, j] = new Tile(snapshot[i, j]); + } + } + Main.NewText("Restoring Snapshot Complete"); + } static string folder = Path.Combine(Main.SavePath, "Mods", "Cache"); private void GenerateTownSprite_OnClick(UIMouseEvent evt, UIElement listeningElement) diff --git a/Tools/Shaders/ShaderPlayer.cs b/Tools/Shaders/ShaderPlayer.cs index 0cfc4ba..c4f6552 100644 --- a/Tools/Shaders/ShaderPlayer.cs +++ b/Tools/Shaders/ShaderPlayer.cs @@ -1,4 +1,5 @@ -using System; +using ReLogic.OS; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,8 +11,10 @@ namespace ModdersToolkit.Tools.Shaders class ShaderPlayer : ModPlayer { public override void UpdateBiomeVisuals() { - bool forcedShaderActive = ShaderTool.shaderUI.forceShaderCheckbox.Selected && ShaderTool.shaderUI.lastShaderIsScreenShader; - player.ManageSpecialBiomeVisuals("ModdersToolkit:TestScreenShader", forcedShaderActive); + if (Platform.IsWindows) { + bool forcedShaderActive = ShaderTool.shaderUI.forceShaderCheckbox.Selected && ShaderTool.shaderUI.lastShaderIsScreenShader; + player.ManageSpecialBiomeVisuals("ModdersToolkit:TestScreenShader", forcedShaderActive); + } } } } diff --git a/build.txt b/build.txt index b7a50e1..1c8f565 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = jopojelly -version = 0.15.0.1 +version = 0.15.1 versionScheme = major when done, minor when new tool, build when new item within tool, revision for bug fix quick release displayName = Modders Toolkit homepage = https://forums.terraria.org/index.php?threads/modders-toolkit-a-mod-for-modders-doing-modding.55738/