Add customization options to favorites, currently only hairstyles and facepaints.

This commit is contained in:
Ottermandias 2024-01-12 00:02:27 +01:00
parent 47e222a9a9
commit ada0c6f479
5 changed files with 80 additions and 16 deletions

View file

@ -1,4 +1,5 @@
using Glamourer.GameData;
using Glamourer.Unlocks;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
@ -70,7 +71,10 @@ public partial class CustomizationDrawer
var icon = _service.Manager.GetIcon(custom.IconId);
using (var _ = ImRaii.Group())
{
using var frameColor = ImRaii.PushColor(ImGuiCol.Button, Colors.SelectedRed, current == i);
var isFavorite = _favorites.Contains(_set.Gender, _set.Clan, _currentIndex, custom.Value);
using var frameColor = current == i
? ImRaii.PushColor(ImGuiCol.Button, Colors.SelectedRed)
: ImRaii.PushColor(ImGuiCol.Button, ColorId.FavoriteStarOn.Value(), isFavorite);
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
{
@ -78,7 +82,14 @@ public partial class CustomizationDrawer
ImGui.CloseCurrentPopup();
}
ImGuiUtil.HoverIconTooltip(icon, _iconSize);
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
if (isFavorite)
_favorites.Remove(_set.Gender, _set.Clan, _currentIndex, custom.Value);
else
_favorites.TryAdd(_set.Gender, _set.Clan, _currentIndex, custom.Value);
ImGuiUtil.HoverIconTooltip(icon, _iconSize,
FavoriteManager.TypeAllowed(_currentIndex) ? "Right-Click to toggle favorite." : string.Empty);
var text = custom.Value.ToString();
var textWidth = ImGui.CalcTextSize(text).X;

View file

@ -3,6 +3,7 @@ using Dalamud.Interface.Utility;
using Dalamud.Plugin;
using Glamourer.GameData;
using Glamourer.Services;
using Glamourer.Unlocks;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
@ -11,7 +12,7 @@ using Penumbra.GameData.Structs;
namespace Glamourer.Gui.Customization;
public partial class CustomizationDrawer(DalamudPluginInterface pi, CustomizeService _service, CodeService _codes, Configuration _config)
public partial class CustomizationDrawer(DalamudPluginInterface pi, CustomizeService _service, CodeService _codes, Configuration _config, FavoriteManager _favorites)
: IDisposable
{
private readonly Vector4 _redTint = new(0.6f, 0.3f, 0.3f, 1f);

View file

@ -119,6 +119,11 @@ public class UnlockOverview
ImGui.Image(icon.ImGuiHandle, iconSize, Vector2.Zero, Vector2.One,
unlocked || _codes.Enabled(CodeService.CodeFlag.Shirts) ? Vector4.One : UnavailableTint);
if (_favorites.Contains(_selected3, _selected2, customize.Index, customize.Value))
ImGui.GetWindowDrawList().AddRect(ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), ColorId.FavoriteStarOn.Value(),
12 * ImGuiHelpers.GlobalScale, ImDrawFlags.RoundCornersAll, 6 * ImGuiHelpers.GlobalScale);
if (ImGui.IsItemHovered())
{
using var tt = ImRaii.Tooltip();