Files
ClubPenguinClient/MareSynchronos/UI/GposeUi.cs
rootdarkarchon b2276a1883 Client rework for API change and paradigm shift (#39)
* most of the groups refactoring on client

* register OnMethods for group stuff

* start implementing client (still pretty broken)

* finish implementing new api first iteration

* idk rework everything for pair shit (still WIP); goal is to remove PairedClients and GroupPairClients from ApiController

* move everything to PairManager, remove dictionaries from APiController

* remove admin stuff from client, cleanup

* adjust reconnection handling, add new settings, todo still to remove access from old stuff that's marked obsolete from config

* add back adding servers, fix intro ui

* fix obsolete calls

* adjust config namespace

* add UI for setting animation/sound permissions to syncshells

* add ConfigurationService to hot reload config on change from external

* move transient data cache to configuration

* add deleting service to ui

* fix saving of transient resources

* fix group pair user assignments

* halt scanner when penumbra inactive, add visible/online/offline split to individual pairs and tags

* add presence to syncshell ui

* move fullpause from config to server config

* fixes in code style

* more codestyle

* show info icon on player in shells, don't show icon when no changes from default state are made, add online notifs

* fixes to intro UI

---------

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
2023-01-29 15:13:53 +01:00

88 lines
3.4 KiB
C#

using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Windowing;
using ImGuiNET;
using MareSynchronos.Export;
using MareSynchronos.MareConfiguration;
using MareSynchronos.Utils;
namespace MareSynchronos.UI;
public class GposeUi : Window, IDisposable
{
private readonly WindowSystem _windowSystem;
private readonly MareCharaFileManager _mareCharaFileManager;
private readonly DalamudUtil _dalamudUtil;
private readonly FileDialogManager _fileDialogManager;
private readonly ConfigurationService _configService;
public GposeUi(WindowSystem windowSystem, MareCharaFileManager mareCharaFileManager,
DalamudUtil dalamudUtil, FileDialogManager fileDialogManager, ConfigurationService configService) : base("Mare Synchronos Gpose Import UI###MareSynchronosGposeUI")
{
_windowSystem = windowSystem;
_mareCharaFileManager = mareCharaFileManager;
_dalamudUtil = dalamudUtil;
_fileDialogManager = fileDialogManager;
_configService = configService;
_dalamudUtil.GposeStart += StartGpose;
_dalamudUtil.GposeEnd += EndGpose;
IsOpen = _dalamudUtil.IsInGpose;
Flags = ImGuiWindowFlags.AlwaysAutoResize;
_windowSystem.AddWindow(this);
}
private void EndGpose()
{
IsOpen = false;
_mareCharaFileManager.ClearMareCharaFile();
}
private void StartGpose()
{
IsOpen = _configService.Current.OpenGposeImportOnGposeStart;
}
public void Dispose()
{
_dalamudUtil.GposeStart -= StartGpose;
_dalamudUtil.GposeEnd -= EndGpose;
_windowSystem.RemoveWindow(this);
}
public override void Draw()
{
if (!_dalamudUtil.IsInGpose) IsOpen = false;
if (!_mareCharaFileManager.CurrentlyWorking)
{
if (UiShared.IconTextButton(FontAwesomeIcon.FolderOpen, "Load MCDF"))
{
_fileDialogManager.OpenFileDialog("Pick MCDF file", ".mcdf", (success, path) =>
{
if (!success) return;
Task.Run(() => _mareCharaFileManager.LoadMareCharaFile(path));
});
}
UiShared.AttachToolTip("Applies it to the currently selected GPose actor");
if (_mareCharaFileManager.LoadedCharaFile != null)
{
UiShared.TextWrapped("Loaded file: " + _mareCharaFileManager.LoadedCharaFile.FilePath);
UiShared.TextWrapped("File Description: " + _mareCharaFileManager.LoadedCharaFile.CharaFileData.Description);
if (UiShared.IconTextButton(FontAwesomeIcon.Check, "Apply loaded MCDF"))
{
Task.Run(async () => await _mareCharaFileManager.ApplyMareCharaFile(_dalamudUtil.GposeTargetGameObject).ConfigureAwait(false));
}
UiShared.AttachToolTip("Applies it to the currently selected GPose actor");
UiShared.ColorTextWrapped("Warning: redrawing or changing the character will revert all applied mods.", ImGuiColors.DalamudYellow);
}
}
else
{
UiShared.ColorTextWrapped("Loading Character...", ImGuiColors.DalamudYellow);
}
UiShared.TextWrapped("Hint: You can disable the automatic loading of this window in the Mare settings and open it manually with /mare gpose");
}
}