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

Commit

Permalink
fix: almost finished the About tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 30, 2023
1 parent 749a855 commit fc1cf06
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 10 deletions.
Binary file added Images/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,5 +433,9 @@
"ConfigWindow_About_Warning": "It is designed for GENERAL COMBAT, not for savage or ultimate. Use it carefully.",
"ConfigWindow_About_Macros": "Macros",
"ConfigWindow_About_Links": "Links",
"ConfigWindow_About_Compatibility": "Compatibility"
"ConfigWindow_About_Compatibility": "Compatibility",
"ConfigWindow_About_Compatibility_Description": "literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:",
"ConfigWindow_About_Compatibility_Mistake": "Can't properly execute the behavior that RS is going to do.",
"ConfigWindow_About_Compatibility_Mislead": "Misleading RS to make the right decision.",
"ConfigWindow_About_Compatibility_Crash": "Cause the game to crash"
}
6 changes: 6 additions & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,5 +629,11 @@ internal partial class Strings
public string ConfigWindow_About_Macros { get; set; } = "Macros";
public string ConfigWindow_About_Links { get; set; } = "Links";
public string ConfigWindow_About_Compatibility { get; set; } = "Compatibility";
public string ConfigWindow_About_Compatibility_Description { get; set; } = "literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:";

public string ConfigWindow_About_Compatibility_Mistake { get; set; } = "Can't properly execute the behavior that RS is going to do.";
public string ConfigWindow_About_Compatibility_Mislead { get; set; } = "Misleading RS to make the right decision.";
public string ConfigWindow_About_Compatibility_Crash { get; set; } = "Cause the game to crash.";


}
6 changes: 4 additions & 2 deletions RotationSolver/UI/CollapsingHeaderGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ internal class CollapsingHeaderGroup
private Dictionary<Func<string>, Action> _headers = new Dictionary<Func<string>, Action>();
private int _openedIndex = -1;

public float HeaderSize { get; set; } = 24;

public CollapsingHeaderGroup()
{

Expand Down Expand Up @@ -49,7 +51,7 @@ public void Draw()
{
ImGui.Separator();
var selected = index == _openedIndex;
ImGui.PushFont(ImGuiHelper.GetFont(24));
ImGui.PushFont(ImGuiHelper.GetFont(HeaderSize));
var changed = ImGui.Selectable(name, selected);
ImGui.PopFont();
if (ImGui.IsItemHovered())
Expand All @@ -64,12 +66,12 @@ public void Draw()
{
header.Value();
}
ImGui.Spacing();
}
catch (Exception ex)
{
PluginLog.Warning(ex, "Something wrong with header drawing.");
}

}
}
}
110 changes: 103 additions & 7 deletions RotationSolver/UI/RotationConfigWindowNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,24 @@ public class RotationConfigWindowNew : Window

private string _searchText = string.Empty;

public RotationConfigWindowNew()
[Flags]
public enum CompatibleType : byte
{
Mistake = 1 << 0,
Mislead = 1 << 1,
Crash = 1 << 2,
}

private static readonly (string name, string icon, string link, string features, CompatibleType type)[] _incompatiblePlugins = new[]
{
("XIV Combo", "https://raw.githubusercontent.com/daemitus/XIVComboPlugin/master/res/icon.png", "https://github.com/daemitus/XIVComboPlugin", string.Empty, CompatibleType.Mislead),
("XIV Sloth Combo", "https://raw.githubusercontent.com/Nik-Potokar/XIVSlothCombo/main/res/plugin/xivslothcombo.png", "https://github.com/Nik-Potokar/XIVSlothCombo", string.Empty, CompatibleType.Mislead | CompatibleType.Mistake),
("Redirect", "https://raw.githubusercontent.com/cairthenn/Redirect/main/Redirect/icon.png", "https://github.com/cairthenn/Redirect", string.Empty, CompatibleType.Mistake),
("ReAction", string.Empty, "https://github.com/UnknownX7/ReAction", string.Empty, CompatibleType.Mistake),
("Simple Tweaks", "https://raw.githubusercontent.com/Caraxi/SimpleTweaksPlugin/main/images/icon.png", "https://github.com/Caraxi/SimpleTweaksPlugin/blob/main/Tweaks/TreasureHuntTargets.cs", "Block Targeting Treasure Hunt Enemies", CompatibleType.Crash),
};

public RotationConfigWindowNew()
: base(nameof(RotationConfigWindowNew), ImGuiWindowFlags.NoScrollbar, false)
{
SizeCondition = ImGuiCond.FirstUseEver;
Expand Down Expand Up @@ -140,7 +157,7 @@ private void DrawHeader(float wholeWidth)
{
var size = MathF.Max(MathF.Min(wholeWidth, _scale * 120), _scale * MIN_COLUMN_WIDTH);

var logo = IconSet.GetTexture("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/docs/RotationSolverIcon_128.png");
var logo = IconSet.GetTexture("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Images/Logo.png");

if (logo != null)
{
Expand Down Expand Up @@ -244,6 +261,17 @@ private unsafe static bool SilenceImageButton(IntPtr handle, Vector2 size, bool
return result;
}

private unsafe static bool NoPaddingNoColorImageButton(IntPtr handle, Vector2 size)
{
ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0);
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0);
ImGui.PushStyleColor(ImGuiCol.Button, 0);
var result = NoPaddingImageButton(handle, size);
ImGui.PopStyleColor(3);

return result;
}

private static bool NoPaddingImageButton(IntPtr handle, Vector2 size)
{
var padding = ImGui.GetStyle().FramePadding;
Expand All @@ -268,11 +296,7 @@ private static bool TextureButton(TextureWrap texture, float wholeWidth)
var result = false;
DrawItemMiddle(() =>
{
ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0);
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0);
ImGui.PushStyleColor(ImGuiCol.Button, 0);
result = NoPaddingImageButton(texture.ImGuiHandle, size);
ImGui.PopStyleColor(3);
result = NoPaddingNoColorImageButton(texture.ImGuiHandle, size);
}, wholeWidth, size.X);
return result;
}
Expand Down Expand Up @@ -351,6 +375,78 @@ private void DrawBody()

{ () => LocalizationManager.RightLang.ConfigWindow_About_Compatibility, () =>
{
ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Description);
ImGui.Spacing();
var iconSize = 40 * _scale;
if (ImGui.BeginTable("Incompatible plugin", 4, ImGuiTableFlags.Borders
| ImGuiTableFlags.Resizable
| ImGuiTableFlags.SizingStretchProp))
{
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextRow(ImGuiTableRowFlags.Headers);
ImGui.TableNextColumn();
ImGui.TableHeader("Name");
ImGui.TableNextColumn();
ImGui.TableHeader("Icon/Link");
ImGui.TableNextColumn();
ImGui.TableHeader("Features");
ImGui.TableNextColumn();
ImGui.TableHeader("Type");
foreach (var item in _incompatiblePlugins)
{
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(item.name);
ImGui.TableNextColumn();
var icon = item.icon;
if(string.IsNullOrEmpty(icon)) icon = "https://raw.githubusercontent.com/goatcorp/DalamudAssets/master/UIRes/defaultIcon.png";
var texture = IconSet.GetTexture(icon);
if(texture != null)
{
if(NoPaddingNoColorImageButton(texture.ImGuiHandle, Vector2.One * iconSize))
{
Util.OpenLink(item.link);
}
}
ImGui.TableNextColumn();
ImGui.TextWrapped(item.features);
ImGui.TableNextColumn();
if (item.type.HasFlag(CompatibleType.Mistake))
{
ImGui.TextColored(ImGuiColors.DalamudYellow, CompatibleType.Mistake.ToString());
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Mistake);
}
if (item.type.HasFlag(CompatibleType.Mislead))
{
ImGui.TextColored(ImGuiColors.DalamudOrange, CompatibleType.Mislead.ToString());
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Mislead);
}
if (item.type.HasFlag(CompatibleType.Crash))
{
ImGui.TextColored(ImGuiColors.DalamudRed, CompatibleType.Crash.ToString());
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Crash);
}
}
ImGui.EndTable();
}
} },

{ () => LocalizationManager.RightLang.ConfigWindow_About_Links, () =>
Expand Down

0 comments on commit fc1cf06

Please sign in to comment.