Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: change the ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed May 12, 2024
1 parent e6adfd8 commit 8c61c6b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
1 change: 0 additions & 1 deletion ActionTimelineEx/Configurations/UiString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ internal enum UiString

[Description("Don't record these statuses")]
NotStatues,
Help,

[Description("Please wait for a second.")]
Wait,
Expand Down
5 changes: 3 additions & 2 deletions ActionTimelineEx/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"ActionTimelineEx.Configurations.UiString.Setting": "Setting",
"ActionTimelineEx.Configurations.UiString.ShowedStatuses": "Showed Statuses",
"ActionTimelineEx.Configurations.UiString.NotStatues": "Don't record these statuses",
"ActionTimelineEx.Configurations.UiString.Help": "Help",
"ActionTimelineEx.Configurations.UiString.Wait": "Please wait for a second.",
"ActionTimelineEx.Configurations.UiString.Confirm": "Are you sure to remove this timeline?",
"ActionTimelineEx.Configurations.UiString.Remove": "Click to remove this timeline.",
Expand All @@ -100,5 +99,7 @@
"ActionTimeline.Windows.SettingsWindow+TimelineItem": "ActionTimeline.Windows.SettingsWindow+TimelineItem",
"ActionTimelineEx.Description": "Configurable timeline display of all the actions you use.",
"ActionTimelineEx.Configurations.UiString.AddOne": "Add One Timeline",
"ActionTimelineEx.Configurations.UiString.RemoveDesc": "Remove this Item:"
"ActionTimelineEx.Configurations.UiString.RemoveDesc": "Remove this Item:",
"ActionTimeline.Windows.SettingsWindow+AddOne": "AddOne",
"ActionTimeline.Windows.SettingsWindow+ChangeLog": "ChangeLog"
}
2 changes: 1 addition & 1 deletion ActionTimelineEx/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class Plugin : IDalamudPlugin
public Plugin(DalamudPluginInterface pluginInterface)
{
ECommonsMain.Init(pluginInterface, this);
XIVConfigUIMain.Init(pluginInterface, "/atlConfig", "Opens the ActionTimeline configuration window.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString));
XIVConfigUIMain.Init(pluginInterface, "/atl", "Opens the ActionTimeline configuration window.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString));

Svc.PluginInterface.UiBuilder.Draw += Draw;
Svc.PluginInterface.UiBuilder.OpenConfigUi += OpenConfigUi;
Expand Down
49 changes: 37 additions & 12 deletions ActionTimelineEx/Windows/SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using ECommons.DalamudServices;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
using System.ComponentModel;
using System.Numerics;
using XIVConfigUI;
using XIVConfigUI.SearchableConfigs;
Expand Down Expand Up @@ -106,6 +107,36 @@ private bool RemoveValue(string name)
return result;
}
}

[Description("AddOne")]
public class AddOne(System.Action action) : ConfigWindowItem
{
public override string Description => UiString.AddOne.Local();

public override bool GetIcon(out IDalamudTextureWrap texture)
{
return ImageLoader.GetTexture(51, out texture);
}
public override bool OnClick()
{
Settings.TimelineSettings.Add(new DrawingSettings()
{
Name = (Settings.TimelineSettings.Count + 1).ToString(),
});
action();
return true;
}
}

[Description("ChangeLog")]
public class ChangeLog : ConfigWindowItem
{
public override bool GetIcon(out IDalamudTextureWrap texture)
{
return ImageLoader.GetTexture(80, out texture);
}
public override string Link => $"https://github.com/{XIVConfigUIMain.UserName}/{XIVConfigUIMain.RepoName}/blob/main/CHANGELOG.md";
}
private static float _scale => ImGuiHelpers.GlobalScale;
public override SearchableCollection Collection { get; } = new(Settings);
protected override string Kofi => "B0B0IN5DX";
Expand Down Expand Up @@ -141,32 +172,26 @@ protected override void DrawAbout()
{ () => UiString.Setting.Local(),DrawSetting},
{ () => UiString.ShowedStatuses.Local(), DrawShowedStatues},
{ () => UiString.NotStatues.Local(), DrawGeneralSetting},
{ () => UiString.Help.Local(), () => CmdManager.DrawHelp() },
});


base.DrawAbout();

_aboutHeaders.Draw();
}

private void DrawSetting()
{
if (ImGui.Button(UiString.AddOne.Local()))
{
Settings.TimelineSettings.Add(new DrawingSettings()
{
Name = (Settings.TimelineSettings.Count + 1).ToString(),
});
ClearItems();
}

Collection.DrawItems(0);
}

protected override ConfigWindowItem[] GetItems()
{
return [..Settings.TimelineSettings.Select(i => new TimelineItem(i, ClearItems))];
return
[
..Settings.TimelineSettings.Select(i => new TimelineItem(i, ClearItems)),
new AddOne(ClearItems),
new ChangeLog(),
];
}

private void DrawShowedStatues()
Expand Down
2 changes: 1 addition & 1 deletion XIVConfigUI

0 comments on commit 8c61c6b

Please sign in to comment.