Skip to content

Commit

Permalink
Script changelogs and update notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Limiana committed Dec 25, 2024
1 parent ed08433 commit 68db09d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Splatoon/Gui/CGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal static float WidthElement
public bool Open = false;
bool WasOpen = false;
float RightWidth = 0;
internal string TabRequest = null;

public CGui(Splatoon p)
{
Expand Down Expand Up @@ -115,7 +116,7 @@ void Draw()
}, false);
ImGui.SetCursorPos(curCursor);

ImGuiEx.EzTabBar("SplatoonSettings",
ImGuiEx.EzTabBar("SplatoonSettings", null, TabRequest,
("General".Loc() + "###tab1", DisplayGeneralSettings, null, true),
("Render".Loc() + "###tab2", DisplayRenderers, null, true),
("Layouts".Loc(), DislayLayouts, Colors.Green.ToVector4(), true),
Expand Down
45 changes: 41 additions & 4 deletions Splatoon/Gui/Scripting/ScriptUpdateWindow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing;
using ECommons;
using ECommons.ChatMethods;
using ECommons.ExcelServices;
using ECommons.GameHelpers;
Expand Down Expand Up @@ -31,8 +32,10 @@ public override void Draw()
{
ImGui.TableSetupColumn("1", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("2");

foreach(var x in UpdatedScripts)
{
ImGui.PushID(x.InternalData.FullName);
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
Expand All @@ -41,20 +44,54 @@ public override void Draw()
if(change != null)
{
ImGui.Indent();
ImGuiEx.Text(ImGuiColors.DalamudGrey, change);
ImGuiEx.TextWrapped(ImGuiColors.DalamudGrey, change);
ImGui.Unindent();
}
ImGui.TableNextColumn();
if(ImGuiEx.IconButton(FontAwesomeIcon.Cog))
{
P.ConfigGui.Open = true;
P.ConfigGui.TabRequest = "Scripts".Loc();
Svc.Framework.RunOnTick(() =>
{
TabScripting.RequestOpen = x.InternalData.FullName;
}, delayTicks:2);
}
ImGui.PopID();
}
ImGui.EndTable();
}

}
if(FailedScripts.Count > 0)
{
ImGuiEx.TextWrapped($"The following scripts have failed to load.");
foreach(var x in FailedScripts)
ImGuiEx.TextWrapped($"The following scripts have failed to load. ");
if(ImGui.BeginTable("##table1", 2, ImGuiTableFlags.NoSavedSettings | ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit))
{
ImGuiEx.Text($"{x}");
ImGui.TableSetupColumn("1", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("2");

var rep = Path.Combine(Svc.PluginInterface.ConfigDirectory.FullName, "Scripts");
foreach(var x in FailedScripts)
{
ImGui.PushID(x);
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.AlignTextToFramePadding();
ImGuiEx.TextWrapped($"{x.Replace(rep, "..")}");
ImGui.TableNextColumn();
if(ImGuiEx.IconButton(FontAwesomeIcon.Trash))
{
new TickScheduler(() =>
{
FailedScripts.Remove(x);
GenericHelpers.DeleteFileToRecycleBin(x);
});
}
ImGuiEx.Tooltip("Delete this script");
ImGui.PopID();
}
ImGui.EndTable();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Splatoon/Splatoon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>NightmareXIV</Authors>
<Version>3.7.4.1</Version>
<Version>3.7.4.2</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions Splatoon/SplatoonScripting/ScriptingProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ internal static void CompileAndLoad(string sourceCode, string fpath)
if (previousVersion > 0)
{
instance.OnScriptUpdated(previousVersion);
P.ScriptUpdateWindow.UpdatedScripts.RemoveAll(x => x.InternalData.FullName == instance.InternalData.FullName);
P.ScriptUpdateWindow.UpdatedScripts.Add(instance);
PluginLog.Debug($"Detected version update for {instance}");
}
Expand Down
4 changes: 2 additions & 2 deletions SplatoonScripts/Tests/GenericTest4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#pragma warning disable
namespace SplatoonScriptsOfficial.Tests;
public unsafe class GenericTest4 : SplatoonScript
{
{
public override HashSet<uint>? ValidTerritories => new();
public override Metadata? Metadata { get; } = new(3, "NightmareXIV");
public override Metadata? Metadata { get; } = new(1, "NightmareXIV");
int a1;
string Filter = "";

Expand Down

0 comments on commit 68db09d

Please sign in to comment.