mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-19 06:17:43 +01:00
Merge branch 'master' into api11
# Conflicts: # Dalamud/Game/ClientState/Fates/Fate.cs # Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs # Dalamud/Interface/Internal/DalamudInterface.cs # Dalamud/Interface/Windowing/Window.cs # Dalamud/Utility/StringExtensions.cs # lib/FFXIVClientStructs
This commit is contained in:
commit
720b1676e5
49 changed files with 4573 additions and 93 deletions
|
|
@ -21,6 +21,7 @@ internal class DataWindow : Window, IDisposable
|
|||
private readonly IDataWindowWidget[] modules =
|
||||
{
|
||||
new AddonInspectorWidget(),
|
||||
new AddonInspectorWidget2(),
|
||||
new AddonLifecycleWidget(),
|
||||
new AddonWidget(),
|
||||
new AddressesWidget(),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
||||
/// <summary>
|
||||
/// Widget for displaying addon inspector.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
||||
/// <summary>
|
||||
/// Widget for displaying addon inspector.
|
||||
/// </summary>
|
||||
internal class AddonInspectorWidget2 : IDataWindowWidget
|
||||
{
|
||||
private UiDebug2.UiDebug2? addonInspector2;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string[]? CommandShortcuts { get; init; } = ["ai2", "addoninspector2"];
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string DisplayName { get; init; } = "Addon Inspector v2 (Testing)";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Ready { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Load()
|
||||
{
|
||||
this.addonInspector2 = new UiDebug2.UiDebug2();
|
||||
|
||||
if (this.addonInspector2 is not null)
|
||||
{
|
||||
this.Ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Draw()
|
||||
{
|
||||
this.addonInspector2?.Draw();
|
||||
}
|
||||
}
|
||||
|
|
@ -98,6 +98,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
private bool deletePluginConfigWarningModalDrawing = true;
|
||||
private bool deletePluginConfigWarningModalOnNextFrame = false;
|
||||
private bool deletePluginConfigWarningModalExplainTesting = false;
|
||||
private string deletePluginConfigWarningModalPluginName = string.Empty;
|
||||
private TaskCompletionSource<bool>? deletePluginConfigWarningModalTaskCompletionSource;
|
||||
|
||||
|
|
@ -732,7 +733,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawFooter()
|
||||
{
|
||||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
|
|
@ -972,10 +973,11 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private Task<bool> ShowDeletePluginConfigWarningModal(string pluginName)
|
||||
private Task<bool> ShowDeletePluginConfigWarningModal(string pluginName, bool explainTesting = false)
|
||||
{
|
||||
this.deletePluginConfigWarningModalOnNextFrame = true;
|
||||
this.deletePluginConfigWarningModalPluginName = pluginName;
|
||||
this.deletePluginConfigWarningModalExplainTesting = explainTesting;
|
||||
this.deletePluginConfigWarningModalTaskCompletionSource = new TaskCompletionSource<bool>();
|
||||
return this.deletePluginConfigWarningModalTaskCompletionSource.Task;
|
||||
}
|
||||
|
|
@ -986,6 +988,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
if (ImGui.BeginPopupModal(modalTitle, ref this.deletePluginConfigWarningModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar))
|
||||
{
|
||||
if (this.deletePluginConfigWarningModalExplainTesting)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange);
|
||||
ImGui.Text(Locs.DeletePluginConfigWarningModal_ExplainTesting());
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
|
||||
ImGui.Text(Locs.DeletePluginConfigWarningModal_Body(this.deletePluginConfigWarningModalPluginName));
|
||||
ImGui.Spacing();
|
||||
|
||||
|
|
@ -2898,7 +2907,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
if (ImGui.MenuItem(Locs.PluginContext_DeletePluginConfigReload))
|
||||
{
|
||||
this.ShowDeletePluginConfigWarningModal(plugin.Manifest.Name).ContinueWith(t =>
|
||||
this.ShowDeletePluginConfigWarningModal(plugin.Manifest.Name, optIn != null).ContinueWith(t =>
|
||||
{
|
||||
var shouldDelete = t.Result;
|
||||
|
||||
|
|
@ -4263,7 +4272,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
public static string DeletePluginConfigWarningModal_Title => Loc.Localize("InstallerDeletePluginConfigWarning", "Warning###InstallerDeletePluginConfigWarning");
|
||||
|
||||
public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for {0}?").Format(pluginName);
|
||||
public static string DeletePluginConfigWarningModal_ExplainTesting() => Loc.Localize("InstallerDeletePluginConfigWarningExplainTesting", "Do not select this option if you are only trying to disable testing!");
|
||||
|
||||
public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for {0}?\nYou will lose all of your settings for this plugin.").Format(pluginName);
|
||||
|
||||
public static string DeletePluginConfirmWarningModal_Yes => Loc.Localize("InstallerDeletePluginConfigWarningYes", "Yes");
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ Dale
|
|||
Arcane Disgea
|
||||
Risu
|
||||
Tom
|
||||
Blyoom
|
||||
Blooym
|
||||
Valk
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public class SettingsTabLook : SettingsTab
|
|||
|
||||
new SettingsEntry<bool>(
|
||||
Loc.Localize("DalamudSettingToggleTsm", "Show title screen menu"),
|
||||
Loc.Localize("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen."),
|
||||
Loc.Localize("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen.\nDisabling this will also hide the Dalamud version text on the title screen."),
|
||||
c => c.ShowTsm,
|
||||
(v, c) => c.ShowTsm = v),
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,12 @@ using System.Numerics;
|
|||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Console;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.Addon.Lifecycle;
|
||||
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Interface.Animation.EasingFunctions;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
||||
|
|
@ -14,10 +18,15 @@ using Dalamud.Interface.Textures.TextureWraps;
|
|||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Storage.Assets;
|
||||
using Dalamud.Support;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows;
|
||||
|
|
@ -39,7 +48,8 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
private readonly IFontAtlas privateAtlas;
|
||||
private readonly Lazy<IFontHandle> myFontHandle;
|
||||
private readonly Lazy<IDalamudTextureWrap> shadeTexture;
|
||||
|
||||
private readonly AddonLifecycleEventListener versionStringListener;
|
||||
|
||||
private readonly Dictionary<Guid, InOutCubic> shadeEasings = new();
|
||||
private readonly Dictionary<Guid, InOutQuint> moveEasings = new();
|
||||
private readonly Dictionary<Guid, InOutCubic> logoEasings = new();
|
||||
|
|
@ -49,7 +59,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
private InOutCubic? fadeOutEasing;
|
||||
|
||||
private State state = State.Hide;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TitleScreenMenuWindow"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -61,6 +71,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
/// <param name="titleScreenMenu">An instance of <see cref="TitleScreenMenu"/>.</param>
|
||||
/// <param name="gameGui">An instance of <see cref="GameGui"/>.</param>
|
||||
/// <param name="consoleManager">An instance of <see cref="ConsoleManager"/>.</param>
|
||||
/// <param name="addonLifecycle">An instance of <see cref="AddonLifecycle"/>.</param>
|
||||
public TitleScreenMenuWindow(
|
||||
ClientState clientState,
|
||||
DalamudConfiguration configuration,
|
||||
|
|
@ -69,7 +80,8 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
Framework framework,
|
||||
GameGui gameGui,
|
||||
TitleScreenMenu titleScreenMenu,
|
||||
ConsoleManager consoleManager)
|
||||
ConsoleManager consoleManager,
|
||||
AddonLifecycle addonLifecycle)
|
||||
: base(
|
||||
"TitleScreenMenuOverlay",
|
||||
ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar |
|
||||
|
|
@ -109,6 +121,10 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
|
||||
framework.Update += this.FrameworkOnUpdate;
|
||||
this.scopedFinalizer.Add(() => framework.Update -= this.FrameworkOnUpdate);
|
||||
|
||||
this.versionStringListener = new AddonLifecycleEventListener(AddonEvent.PreDraw, "_TitleRevision", this.OnVersionStringDraw);
|
||||
addonLifecycle.RegisterListener(this.versionStringListener);
|
||||
this.scopedFinalizer.Add(() => addonLifecycle.UnregisterListener(this.versionStringListener));
|
||||
}
|
||||
|
||||
private enum State
|
||||
|
|
@ -414,5 +430,41 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
this.IsOpen = false;
|
||||
}
|
||||
|
||||
private unsafe void OnVersionStringDraw(AddonEvent ev, AddonArgs args)
|
||||
{
|
||||
if (args is not AddonDrawArgs setupArgs) return;
|
||||
|
||||
var addon = (AtkUnitBase*)setupArgs.Addon;
|
||||
var textNode = addon->GetTextNodeById(3);
|
||||
|
||||
// look and feel init. should be harmless to set.
|
||||
textNode->TextFlags |= (byte)TextFlags.MultiLine;
|
||||
textNode->AlignmentType = AlignmentType.TopLeft;
|
||||
|
||||
if (!this.configuration.ShowTsm || !this.showTsm.Value)
|
||||
{
|
||||
textNode->NodeText.SetString(addon->AtkValues[1].String);
|
||||
return;
|
||||
}
|
||||
|
||||
var pm = Service<PluginManager>.GetNullable();
|
||||
|
||||
var pluginCount = pm?.InstalledPlugins.Count(c => c.State == PluginState.Loaded) ?? 0;
|
||||
|
||||
var titleVersionText = new SeStringBuilder()
|
||||
.AddText(addon->AtkValues[1].GetValueAsString())
|
||||
.AddText("\n\n")
|
||||
.AddUiGlow(701)
|
||||
.AddUiForeground(SeIconChar.BoxedLetterD.ToIconString(), 539)
|
||||
.AddUiGlowOff()
|
||||
.AddText($" Dalamud: {Util.GetScmVersion()}")
|
||||
.AddText($" - {pluginCount} {(pluginCount != 1 ? "plugins" : "plugin")} loaded");
|
||||
|
||||
if (pm?.SafeMode ?? false)
|
||||
titleVersionText.AddUiForeground(" [SAFE MODE]", 17);
|
||||
|
||||
textNode->NodeText.SetString(titleVersionText.Build().EncodeWithNullTerminator());
|
||||
}
|
||||
|
||||
private void TitleScreenMenuEntryListChange() => this.privateAtlas.BuildFontsAsync();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue