kk
This commit is contained in:
parent
8a5ac82b1c
commit
5594d5769b
|
@ -1,9 +1,10 @@
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
|
using Dalamud.Interface.Style;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
namespace OrangeGuidanceTomestone.Helpers;
|
namespace OrangeGuidanceTomestone.Helpers;
|
||||||
|
|
||||||
internal static class ImGuiExt {
|
internal static class ImGuiHelper {
|
||||||
private static bool InternalIconButton(Func<string, bool> func, FontAwesomeIcon icon, string? id = null) {
|
private static bool InternalIconButton(Func<string, bool> func, FontAwesomeIcon icon, string? id = null) {
|
||||||
var label = icon.ToIconString();
|
var label = icon.ToIconString();
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
|
@ -31,16 +32,7 @@ internal static class ImGuiExt {
|
||||||
ImGui.TextUnformatted("(?)");
|
ImGui.TextUnformatted("(?)");
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
|
|
||||||
if (!ImGui.IsItemHovered()) {
|
TextTooltip(text);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var width = ImGui.CalcTextSize("m") * 40;
|
|
||||||
ImGui.BeginTooltip();
|
|
||||||
ImGui.PushTextWrapPos(width.X);
|
|
||||||
ImGui.TextUnformatted(text);
|
|
||||||
ImGui.PopTextWrapPos();
|
|
||||||
ImGui.EndTooltip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe ImGuiListClipperPtr Clipper(int itemsCount) {
|
internal static unsafe ImGuiListClipperPtr Clipper(int itemsCount) {
|
||||||
|
@ -49,4 +41,33 @@ internal static class ImGuiExt {
|
||||||
|
|
||||||
return clipper;
|
return clipper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void TextTooltip(string tooltip) {
|
||||||
|
if (!ImGui.IsItemHovered()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var width = ImGui.CalcTextSize("m") * 40;
|
||||||
|
ImGui.BeginTooltip();
|
||||||
|
ImGui.PushTextWrapPos(width.X);
|
||||||
|
ImGui.TextUnformatted(tooltip);
|
||||||
|
ImGui.PopTextWrapPos();
|
||||||
|
ImGui.EndTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void WarningText(string text) {
|
||||||
|
var style = StyleModel.GetConfiguredStyle() ?? StyleModel.GetFromCurrent();
|
||||||
|
var dalamudOrange = style.BuiltInColors?.DalamudOrange;
|
||||||
|
if (dalamudOrange != null) {
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.Text, dalamudOrange.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.PushTextWrapPos();
|
||||||
|
ImGui.TextUnformatted(text);
|
||||||
|
ImGui.PopTextWrapPos();
|
||||||
|
|
||||||
|
if (dalamudOrange != null) {
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ internal class MessageWithTerritory {
|
||||||
public int UserVote { get; set; }
|
public int UserVote { get; set; }
|
||||||
|
|
||||||
public int Glyph { get; set; }
|
public int Glyph { get; set; }
|
||||||
|
public bool IsHidden { get; set; }
|
||||||
|
|
||||||
internal Vector3 Position => new(this.X, this.Y, this.Z);
|
internal Vector3 Position => new(this.X, this.Y, this.Z);
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ internal class MessageWithTerritory {
|
||||||
NegativeVotes = message.NegativeVotes,
|
NegativeVotes = message.NegativeVotes,
|
||||||
UserVote = message.UserVote,
|
UserVote = message.UserVote,
|
||||||
Glyph = message.Glyph,
|
Glyph = message.Glyph,
|
||||||
|
IsHidden = false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ internal class MessageList : ITab {
|
||||||
ImGui.TextUnformatted($"Location: {territoryName}");
|
ImGui.TextUnformatted($"Location: {territoryName}");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGuiExt.SmallIconButton(FontAwesomeIcon.MapMarkerAlt, $"{message.Id}") && territory != null) {
|
if (ImGuiHelper.SmallIconButton(FontAwesomeIcon.MapMarkerAlt, $"{message.Id}") && territory != null) {
|
||||||
this.Plugin.GameGui.OpenMapWithMapLink(new MapLinkPayload(
|
this.Plugin.GameGui.OpenMapWithMapLink(new MapLinkPayload(
|
||||||
territory.RowId,
|
territory.RowId,
|
||||||
territory.Map.Row,
|
territory.Map.Row,
|
||||||
|
@ -81,6 +81,10 @@ internal class MessageList : ITab {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.IsHidden) {
|
||||||
|
ImGuiHelper.WarningText("This message's score is too low and will not be shown to other players.");
|
||||||
|
}
|
||||||
|
|
||||||
var ctrl = ImGui.GetIO().KeyCtrl;
|
var ctrl = ImGui.GetIO().KeyCtrl;
|
||||||
|
|
||||||
var appraisals = Math.Max(0, message.PositiveVotes - message.NegativeVotes);
|
var appraisals = Math.Max(0, message.PositiveVotes - message.NegativeVotes);
|
||||||
|
@ -99,7 +103,7 @@ internal class MessageList : ITab {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiExt.HelpIcon("Hold Ctrl to enable the delete button.");
|
ImGuiHelper.HelpIcon("Hold Ctrl to enable the delete button.");
|
||||||
|
|
||||||
ImGui.TreePop();
|
ImGui.TreePop();
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ internal class Settings : ITab {
|
||||||
var toAdd = -1L;
|
var toAdd = -1L;
|
||||||
var toRemove = -1L;
|
var toRemove = -1L;
|
||||||
|
|
||||||
var clipper = ImGuiExt.Clipper(this.FilteredTerritories.Count);
|
var clipper = ImGuiHelper.Clipper(this.FilteredTerritories.Count);
|
||||||
while (clipper.Step()) {
|
while (clipper.Step()) {
|
||||||
for (var i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
for (var i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||||
var (terrId, isBanned, name) = this.FilteredTerritories[i];
|
var (terrId, isBanned, name) = this.FilteredTerritories[i];
|
||||||
|
@ -275,7 +275,7 @@ internal class Settings : ITab {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiExt.HelpIcon("Hold Ctrl to enable delete button.");
|
ImGuiHelper.HelpIcon("Hold Ctrl to enable delete button.");
|
||||||
|
|
||||||
ImGui.TextUnformatted("This will delete all your messages and votes.");
|
ImGui.TextUnformatted("This will delete all your messages and votes.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ internal class Viewer {
|
||||||
ImGui.BeginDisabled();
|
ImGui.BeginDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGuiExt.IconButton(FontAwesomeIcon.AngleLeft)) {
|
if (ImGuiHelper.IconButton(FontAwesomeIcon.AngleLeft)) {
|
||||||
this._idx -= 1;
|
this._idx -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ internal class Viewer {
|
||||||
ImGui.BeginDisabled();
|
ImGui.BeginDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGuiExt.IconButton(FontAwesomeIcon.AngleRight)) {
|
if (ImGuiHelper.IconButton(FontAwesomeIcon.AngleRight)) {
|
||||||
this._idx += 1;
|
this._idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user