mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-30 20:33:44 +01:00
Starting rework.
This commit is contained in:
parent
0fc8992271
commit
7af38aa2ce
58 changed files with 8857 additions and 4923 deletions
|
|
@ -1,110 +1,139 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Glamourer.Designs;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.GameData.Enums;
|
||||
using OtterGui.Widgets;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface : IDisposable
|
||||
internal partial class Interface : Window, IDisposable
|
||||
{
|
||||
public const float SelectorWidth = 200;
|
||||
public const float MinWindowWidth = 675;
|
||||
public const int GPoseObjectId = 201;
|
||||
private const string PluginName = "Glamourer";
|
||||
private readonly string _glamourerHeader;
|
||||
|
||||
private readonly IReadOnlyDictionary<byte, Stain> _stains;
|
||||
private readonly IReadOnlyDictionary<uint, ModelChara> _models;
|
||||
private readonly IObjectIdentifier _identifier;
|
||||
private readonly Dictionary<EquipSlot, (ComboWithFilter<Item>, ComboWithFilter<Stain>)> _combos;
|
||||
private readonly ImGuiScene.TextureWrap? _legacyTattooIcon;
|
||||
private readonly Dictionary<EquipSlot, string> _equipSlotNames;
|
||||
private readonly DesignManager _designs;
|
||||
private readonly Glamourer _plugin;
|
||||
|
||||
private bool _visible;
|
||||
private bool _inGPose;
|
||||
private readonly Glamourer _plugin;
|
||||
|
||||
public Interface(Glamourer plugin)
|
||||
: base(GetLabel())
|
||||
{
|
||||
_plugin = plugin;
|
||||
_designs = plugin.Designs;
|
||||
_glamourerHeader = Glamourer.Version.Length > 0
|
||||
? $"{PluginName} v{Glamourer.Version}###{PluginName}Main"
|
||||
: $"{PluginName}###{PluginName}Main";
|
||||
_plugin = plugin;
|
||||
Dalamud.PluginInterface.UiBuilder.DisableGposeUiHide = true;
|
||||
Dalamud.PluginInterface.UiBuilder.Draw += Draw;
|
||||
Dalamud.PluginInterface.UiBuilder.OpenConfigUi += ToggleVisibility;
|
||||
|
||||
_equipSlotNames = GetEquipSlotNames();
|
||||
|
||||
_stains = GameData.Stains(Dalamud.GameData);
|
||||
_models = GameData.Models(Dalamud.GameData);
|
||||
_identifier = Penumbra.GameData.GameData.GetIdentifier(Dalamud.GameData, Dalamud.ClientState.ClientLanguage);
|
||||
|
||||
|
||||
var stainCombo = CreateDefaultStainCombo(_stains.Values.ToArray());
|
||||
|
||||
var equip = GameData.ItemsBySlot(Dalamud.GameData);
|
||||
_combos = equip.ToDictionary(kvp => kvp.Key, kvp => CreateCombos(kvp.Key, kvp.Value, stainCombo));
|
||||
_legacyTattooIcon = GetLegacyTattooIcon();
|
||||
Dalamud.PluginInterface.UiBuilder.OpenConfigUi += Toggle;
|
||||
SizeConstraints = new WindowSizeConstraints()
|
||||
{
|
||||
MinimumSize = new Vector2(675, 675),
|
||||
MaximumSize = ImGui.GetIO().DisplaySize,
|
||||
};
|
||||
}
|
||||
|
||||
public void ToggleVisibility()
|
||||
=> _visible = !_visible;
|
||||
public override void Draw()
|
||||
{
|
||||
using var tabBar = ImRaii.TabBar("##Tabs");
|
||||
if (!tabBar)
|
||||
return;
|
||||
|
||||
UpdateState();
|
||||
|
||||
_actorTab.Draw();
|
||||
DrawSettingsTab();
|
||||
// DrawSaves();
|
||||
// DrawFixedDesignsTab();
|
||||
// DrawRevertablesTab();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_legacyTattooIcon?.Dispose();
|
||||
Dalamud.PluginInterface.UiBuilder.Draw -= Draw;
|
||||
Dalamud.PluginInterface.UiBuilder.OpenConfigUi -= ToggleVisibility;
|
||||
Dalamud.PluginInterface.UiBuilder.OpenConfigUi -= Toggle;
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (!_visible)
|
||||
return;
|
||||
|
||||
ImGui.SetNextWindowSizeConstraints(Vector2.One * MinWindowWidth * ImGui.GetIO().FontGlobalScale,
|
||||
Vector2.One * 5000 * ImGui.GetIO().FontGlobalScale);
|
||||
if (!ImGui.Begin(_glamourerHeader, ref _visible))
|
||||
{
|
||||
ImGui.End();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using var tabBar = ImRaii.TabBar("##tabBar");
|
||||
if (!tabBar)
|
||||
return;
|
||||
|
||||
_inGPose = Dalamud.Objects[GPoseObjectId] != null;
|
||||
_iconSize = Vector2.One * ImGui.GetTextLineHeightWithSpacing() * 2;
|
||||
_actualIconSize = _iconSize + 2 * ImGui.GetStyle().FramePadding;
|
||||
_comboSelectorSize = 4 * _actualIconSize.X + 3 * ImGui.GetStyle().ItemSpacing.X;
|
||||
_percentageSize = _comboSelectorSize;
|
||||
_inputIntSize = 2 * _actualIconSize.X + ImGui.GetStyle().ItemSpacing.X;
|
||||
_raceSelectorWidth = _inputIntSize + _percentageSize - _actualIconSize.X;
|
||||
_itemComboWidth = 6 * _actualIconSize.X + 4 * ImGui.GetStyle().ItemSpacing.X - ColorButtonWidth + 1;
|
||||
|
||||
DrawPlayerTab();
|
||||
DrawSaves();
|
||||
DrawFixedDesignsTab();
|
||||
DrawConfigTab();
|
||||
DrawRevertablesTab();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
private static string GetLabel()
|
||||
=> Glamourer.Version.Length == 0
|
||||
? "Glamourer###GlamourerConfigWindow"
|
||||
: $"Glamourer v{Glamourer.Version}###GlamourerConfigWindow";
|
||||
}
|
||||
|
||||
//public const float SelectorWidth = 200;
|
||||
//public const float MinWindowWidth = 675;
|
||||
//public const int GPoseObjectId = 201;
|
||||
//private const string PluginName = "Glamourer";
|
||||
//private readonly string _glamourerHeader;
|
||||
//
|
||||
//private readonly IReadOnlyDictionary<byte, Stain> _stains;
|
||||
//private readonly IReadOnlyDictionary<uint, ModelCeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeehara> _models;
|
||||
//private readonly IObjectIdentifier _identifier;
|
||||
//private readonly Dictionary<EquipSlot, (ComboWithFilter<Item>, ComboWithFilter<Stain>)> _combos;
|
||||
//private readonly ImGuiScene.TextureWrap? _legacyTattooIcon;
|
||||
//private readonly Dictionary<EquipSlot, string> _equipSlotNames;
|
||||
//private readonly DesignManager _designs;
|
||||
//private readonly Glamourer _plugin;
|
||||
//
|
||||
//private bool _visible;
|
||||
//private bool _inGPose;
|
||||
//
|
||||
//public Interface(Glamourer plugin)
|
||||
//{
|
||||
// _plugin = plugin;
|
||||
// _designs = plugin.Designs;
|
||||
// _glamourerHeader = Glamourer.Version.Length > 0
|
||||
// ? $"{PluginName} v{Glamourer.Version}###{PluginName}Main"
|
||||
// : $"{PluginName}###{PluginName}Main";
|
||||
// Dalamud.PluginInterface.UiBuilder.DisableGposeUiHide = true;
|
||||
// Dalamud.PluginInterface.UiBuilder.Draw += Draw;
|
||||
// Dalamud.PluginInterface.UiBuilder.OpenConfigUi += ToggleVisibility;
|
||||
//
|
||||
// _equipSlotNames = GetEquipSlotNames();
|
||||
//
|
||||
// _stains = GameData.Stains(Dalamud.GameData);
|
||||
// _models = GameData.Models(Dalamud.GameData);
|
||||
// _identifier = Penumbra.GameData.GameData.GetIdentifier(Dalamud.GameData, Dalamud.ClientState.ClientLanguage);
|
||||
//
|
||||
//
|
||||
// var stainCombo = CreateDefaultStainCombo(_stains.Values.ToArray());
|
||||
//
|
||||
// var equip = GameData.ItemsBySlot(Dalamud.GameData);
|
||||
// _combos = equip.ToDictionary(kvp => kvp.Key, kvp => CreateCombos(kvp.Key, kvp.Value, stainCombo));
|
||||
// _legacyTattooIcon = GetLegacyTattooIcon();
|
||||
//}
|
||||
//
|
||||
//public void ToggleVisibility()
|
||||
// => _visible = !_visible;
|
||||
//
|
||||
//
|
||||
//private void Draw()
|
||||
//{
|
||||
// if (!_visible)
|
||||
// return;
|
||||
//
|
||||
// ImGui.SetNextWindowSizeConstraints(Vector2.One * MinWindowWidth * ImGui.GetIO().FontGlobalScale,
|
||||
// Vector2.One * 5000 * ImGui.GetIO().FontGlobalScale);
|
||||
// if (!ImGui.Begin(_glamourerHeader, ref _visible))
|
||||
// {
|
||||
// ImGui.End();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// using var tabBar = ImRaii.TabBar("##tabBar");
|
||||
// if (!tabBar)
|
||||
// return;
|
||||
//
|
||||
// _inGPose = Dalamud.Objects[GPoseObjectId] != null;
|
||||
// _iconSize = Vector2.One * ImGui.GetTextLineHeightWithSpacing() * 2;
|
||||
// _actualIconSize = _iconSize + 2 * ImGui.GetStyle().FramePadding;
|
||||
// _comboSelectorSize = 4 * _actualIconSize.X + 3 * ImGui.GetStyle().ItemSpacing.X;
|
||||
// _percentageSize = _comboSelectorSize;
|
||||
// _inputIntSize = 2 * _actualIconSize.X + ImGui.GetStyle().ItemSpacing.X;
|
||||
// _raceSelectorWidth = _inputIntSize + _percentageSize - _actualIconSize.X;
|
||||
// _itemComboWidth = 6 * _actualIconSize.X + 4 * ImGui.GetStyle().ItemSpacing.X - ColorButtonWidth + 1;
|
||||
//
|
||||
// DrawPlayerTab();
|
||||
// DrawSaves();
|
||||
// DrawFixedDesignsTab();
|
||||
// DrawConfigTab();
|
||||
// DrawRevertablesTab();
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// ImGui.End();
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue