[Draft] Update 0.8 (#46)
* move stuff out into file transfer manager * obnoxious unsupported version text, adjustments to filetransfermanager * add back file upload transfer progress * restructure code * cleanup some more stuff I guess * downloadids by playername * individual anim/sound bs * fix migration stuff, finalize impl of individual sound/anim pause * fixes with logging stuff * move download manager to transient * rework dl ui first iteration * some refactoring and cleanup * more code cleanup * refactoring * switch to hostbuilder * some more rework I guess * more refactoring * clean up mediator calls and disposal * fun code cleanup * push error message when log level is set to anything but information in non-debug builds * remove notificationservice * move message to after login * add download bars to gameworld * fixes download progress bar * set gpose ui min and max size * remove unnecessary usings * adjustments to reconnection logic * add options to set visible/offline groups visibility * add impl of uploading display, transfer list in settings ui * attempt to fix issues with server selection * add back download status to compact ui * make dl bar fixed size based * some fixes for upload/download handling * adjust text from Syncing back to Uploading --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com> Co-authored-by: Stanley Dimant <stanley.dimant@varian.com>
This commit is contained in:
66
MareSynchronos/Services/UiService.cs
Normal file
66
MareSynchronos/Services/UiService.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Interface.ImGuiFileDialog;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using MareSynchronos.UI;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
using MareSynchronos.Services.Mediator;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MareSynchronos.Services;
|
||||
|
||||
public sealed class UiService : IDisposable
|
||||
{
|
||||
private readonly DalamudPluginInterface _dalamudPluginInterface;
|
||||
private readonly FileDialogManager _fileDialogManager;
|
||||
private readonly ILogger<UiService> _logger;
|
||||
private readonly MareConfigService _mareConfigService;
|
||||
private readonly MareMediator _mareMediator;
|
||||
private readonly WindowSystem _windowSystem;
|
||||
|
||||
public UiService(ILogger<UiService> logger, DalamudPluginInterface dalamudPluginInterface,
|
||||
MareConfigService mareConfigService, WindowSystem windowSystem,
|
||||
IEnumerable<WindowMediatorSubscriberBase> windows,
|
||||
FileDialogManager fileDialogManager, MareMediator mareMediator)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger.LogTrace("Creating {type}", GetType().Name);
|
||||
_dalamudPluginInterface = dalamudPluginInterface;
|
||||
_mareConfigService = mareConfigService;
|
||||
_windowSystem = windowSystem;
|
||||
_fileDialogManager = fileDialogManager;
|
||||
_mareMediator = mareMediator;
|
||||
|
||||
_dalamudPluginInterface.UiBuilder.DisableGposeUiHide = true;
|
||||
_dalamudPluginInterface.UiBuilder.Draw += Draw;
|
||||
_dalamudPluginInterface.UiBuilder.OpenConfigUi += ToggleUi;
|
||||
|
||||
foreach (var window in windows)
|
||||
{
|
||||
_windowSystem.AddWindow(window);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_logger.LogTrace("Disposing {type}", GetType().Name);
|
||||
|
||||
_windowSystem.RemoveAllWindows();
|
||||
|
||||
_dalamudPluginInterface.UiBuilder.Draw -= Draw;
|
||||
_dalamudPluginInterface.UiBuilder.OpenConfigUi -= ToggleUi;
|
||||
}
|
||||
|
||||
public void ToggleUi()
|
||||
{
|
||||
if (_mareConfigService.Current.HasValidSetup())
|
||||
_mareMediator.Publish(new UiToggleMessage(typeof(CompactUi)));
|
||||
else
|
||||
_mareMediator.Publish(new UiToggleMessage(typeof(IntroUi)));
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
_windowSystem.Draw();
|
||||
_fileDialogManager.Draw();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user