Add MCDO (#80)
* update api * mcd online editor impl * most of chara data hub impl * some state of things * some refactoring * random bullshit go * more nearby impl * add uid to peformance msg * cleanup/homogenization * some split, update nuget packages * migrate to latest packages where possible, remove lz4net, do some split, idk * some polish and cleanup * more cleanup, beautification, etc. * fixes and cleanups --------- Co-authored-by: Stanley Dimant <root.darkarchon@outlook.com>
This commit is contained in:
@@ -78,6 +78,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
private bool _moodlesExists = false;
|
||||
private bool _penumbraExists = false;
|
||||
private bool _petNamesExists = false;
|
||||
private bool _brioExists = false;
|
||||
|
||||
private int _serverSelectionIndex = -1;
|
||||
|
||||
@@ -111,6 +112,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
_honorificExists = _ipcManager.Honorific.APIAvailable;
|
||||
_petNamesExists = _ipcManager.PetNames.APIAvailable;
|
||||
_moodlesExists = _ipcManager.Moodles.APIAvailable;
|
||||
_brioExists = _ipcManager.Brio.APIAvailable;
|
||||
});
|
||||
|
||||
UidFont = _pluginInterface.UiBuilder.FontAtlas.NewDelegateFontHandle(e =>
|
||||
@@ -133,7 +135,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
public bool HasValidPenumbraModPath => !(_ipcManager.Penumbra.ModDirectory ?? string.Empty).IsNullOrEmpty() && Directory.Exists(_ipcManager.Penumbra.ModDirectory);
|
||||
|
||||
public IFontHandle IconFont { get; init; }
|
||||
public bool IsInGpose => _dalamudUtil.IsInCutscene;
|
||||
public bool IsInGpose => _dalamudUtil.IsInGpose;
|
||||
|
||||
public string PlayerName => _dalamudUtil.GetPlayerName();
|
||||
|
||||
@@ -207,14 +209,46 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.TextUnformatted(text);
|
||||
}
|
||||
|
||||
public static void ColorTextWrapped(string text, Vector4 color)
|
||||
public static void ColorTextWrapped(string text, Vector4 color, float wrapPos = 0)
|
||||
{
|
||||
using var raiicolor = ImRaii.PushColor(ImGuiCol.Text, color);
|
||||
TextWrapped(text);
|
||||
TextWrapped(text, wrapPos);
|
||||
}
|
||||
|
||||
public static bool CtrlPressed() => (GetKeyState(0xA2) & 0x8000) != 0 || (GetKeyState(0xA3) & 0x8000) != 0;
|
||||
|
||||
public static void DrawGrouped(Action imguiDrawAction, float rounding = 5f, float? expectedWidth = null)
|
||||
{
|
||||
var cursorPos = ImGui.GetCursorPos();
|
||||
using (ImRaii.Group())
|
||||
{
|
||||
if (expectedWidth != null)
|
||||
{
|
||||
ImGui.Dummy(new(expectedWidth.Value, 0));
|
||||
ImGui.SetCursorPos(cursorPos);
|
||||
}
|
||||
|
||||
imguiDrawAction.Invoke();
|
||||
}
|
||||
|
||||
ImGui.GetWindowDrawList().AddRect(
|
||||
ImGui.GetItemRectMin() - ImGui.GetStyle().ItemInnerSpacing,
|
||||
ImGui.GetItemRectMax() + ImGui.GetStyle().ItemInnerSpacing,
|
||||
Color(ImGuiColors.DalamudGrey2), rounding);
|
||||
}
|
||||
|
||||
public static void DrawGroupedCenteredColorText(string text, Vector4 color, float? maxWidth = null)
|
||||
{
|
||||
var availWidth = ImGui.GetContentRegionAvail().X;
|
||||
var textWidth = ImGui.CalcTextSize(text, availWidth).X;
|
||||
if (maxWidth != null && textWidth > maxWidth * ImGuiHelpers.GlobalScale) textWidth = maxWidth.Value * ImGuiHelpers.GlobalScale;
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (availWidth / 2f) - (textWidth / 2f));
|
||||
DrawGrouped(() =>
|
||||
{
|
||||
ColorTextWrapped(text, color, ImGui.GetCursorPosX() + textWidth);
|
||||
}, expectedWidth: maxWidth == null ? null : maxWidth * ImGuiHelpers.GlobalScale);
|
||||
}
|
||||
|
||||
public static void DrawOutlinedFont(string text, Vector4 fontColor, Vector4 outlineColor, int thickness)
|
||||
{
|
||||
var original = ImGui.GetCursorPos();
|
||||
@@ -271,6 +305,15 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
drawList.AddText(textPos, fontColor, text);
|
||||
}
|
||||
|
||||
public static void DrawTree(string leafName, Action drawOnOpened, ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags.None)
|
||||
{
|
||||
using var tree = ImRaii.TreeNode(leafName, flags);
|
||||
if (tree)
|
||||
{
|
||||
drawOnOpened();
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector4 GetBoolColor(bool input) => input ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed;
|
||||
|
||||
public float GetIconTextButtonSize(FontAwesomeIcon icon, string text)
|
||||
@@ -428,9 +471,9 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
|
||||
public static bool ShiftPressed() => (GetKeyState(0xA1) & 0x8000) != 0 || (GetKeyState(0xA0) & 0x8000) != 0;
|
||||
|
||||
public static void TextWrapped(string text)
|
||||
public static void TextWrapped(string text, float wrapPos = 0)
|
||||
{
|
||||
ImGui.PushTextWrapPos(0);
|
||||
ImGui.PushTextWrapPos(wrapPos);
|
||||
ImGui.TextUnformatted(text);
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
@@ -739,15 +782,10 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
IconText(_penumbraExists ? check : cross, GetBoolColor(_penumbraExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"Penumbra is " + (_penumbraExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("Glamourer");
|
||||
ImGui.SameLine();
|
||||
IconText(_glamourerExists ? check : cross, GetBoolColor(_glamourerExists));
|
||||
ImGui.SameLine();
|
||||
ColorText("Glamourer", GetBoolColor(_glamourerExists));
|
||||
AttachToolTip($"Glamourer is " + (_glamourerExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
|
||||
if (intro)
|
||||
{
|
||||
@@ -803,6 +841,14 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
AttachToolTip($"Moodles is " + (_moodlesExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("Brio");
|
||||
ImGui.SameLine();
|
||||
IconText(_brioExists ? check : cross, GetBoolColor(_brioExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"Brio is " + (_moodlesExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
|
||||
if (!_penumbraExists || !_glamourerExists)
|
||||
{
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You need to install both Penumbra and Glamourer and keep them up to date to use Loporrit.");
|
||||
@@ -923,6 +969,13 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
Strings.ToS = new Strings.ToSStrings();
|
||||
}
|
||||
|
||||
internal static void DistanceSeparator()
|
||||
{
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
ImGui.Separator();
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
}
|
||||
|
||||
[LibraryImport("user32")]
|
||||
internal static partial short GetKeyState(int nVirtKey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user