mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 12:23:39 +01:00
Add window that opens on login
This commit is contained in:
parent
88a665cb58
commit
c60bb99e77
5 changed files with 541 additions and 200 deletions
|
|
@ -371,6 +371,8 @@ internal sealed class DalamudConfiguration : IServiceType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double UiBuilderHitch { get; set; } = 100;
|
public double UiBuilderHitch { get; set; } = 100;
|
||||||
|
|
||||||
|
public bool HasSeenFools23 { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load a configuration from the provided path.
|
/// Load a configuration from the provided path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Fools.Plugins;
|
using Dalamud.Fools.Plugins;
|
||||||
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
|
using Dalamud.Interface.Internal;
|
||||||
using Dalamud.Logging.Internal;
|
using Dalamud.Logging.Internal;
|
||||||
|
|
||||||
namespace Dalamud.Fools;
|
namespace Dalamud.Fools;
|
||||||
|
|
@ -58,22 +61,28 @@ internal class FoolsManager : IDisposable, IServiceType
|
||||||
private static readonly ModuleLog Log = new("FOOLS");
|
private static readonly ModuleLog Log = new("FOOLS");
|
||||||
|
|
||||||
private UiBuilder uiBuilder;
|
private UiBuilder uiBuilder;
|
||||||
|
private ClientState clientState;
|
||||||
|
|
||||||
[ServiceManager.ServiceConstructor]
|
[ServiceManager.ServiceConstructor]
|
||||||
private FoolsManager()
|
private FoolsManager()
|
||||||
{
|
{
|
||||||
this.uiBuilder = new UiBuilder("fools");
|
this.uiBuilder = new UiBuilder("fools");
|
||||||
this.uiBuilder.Draw += this.DrawUI;
|
this.uiBuilder.Draw += this.DrawUi;
|
||||||
|
|
||||||
|
this.clientState = Service<ClientState>.Get();
|
||||||
|
this.clientState.Login += this.ClientStateOnLogin;
|
||||||
|
|
||||||
// reflect over all IFoolsPlugin implementations sometime(?)
|
// reflect over all IFoolsPlugin implementations sometime(?)
|
||||||
this.FoolsPlugins = new List<FoolsPluginMetadata>
|
this.FoolsPlugins = new List<FoolsPluginMetadata>
|
||||||
{
|
{
|
||||||
new("Pixel Imperfect", "PixelImperfectPlugin", "Whoops... we messed up the math on that one.", "Halpo",
|
new("Pixel Imperfect", "PixelImperfectPlugin", "Whoops... we messed up the math on that one.", "Halpo",
|
||||||
typeof(PixelImperfectPlugin)),
|
typeof(PixelImperfectPlugin)),
|
||||||
new("DailyLifeDuty", "DailyLifeDutyPlugin", "Easily Track Daily and Weekly tasks... in real life", "MidoriKami", typeof(DailyLifeDutyPlugin)),
|
new("DailyLifeDuty", "DailyLifeDutyPlugin", "Easily Track Daily and Weekly tasks... in real life",
|
||||||
|
"MidoriKami", typeof(DailyLifeDutyPlugin)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ActivatePlugin(string plugin)
|
public void ActivatePlugin(string plugin)
|
||||||
{
|
{
|
||||||
if (this.ActivatedPlugins.ContainsKey(plugin))
|
if (this.ActivatedPlugins.ContainsKey(plugin))
|
||||||
|
|
@ -101,8 +110,8 @@ internal class FoolsManager : IDisposable, IServiceType
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ActivatedPlugins.Clear();
|
this.ActivatedPlugins.Clear();
|
||||||
|
|
||||||
((IDisposable)this.uiBuilder).Dispose();
|
((IDisposable)this.uiBuilder).Dispose();
|
||||||
|
this.clientState.Login -= this.ClientStateOnLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPluginActivated(string plugin)
|
public bool IsPluginActivated(string plugin)
|
||||||
|
|
@ -123,11 +132,34 @@ internal class FoolsManager : IDisposable, IServiceType
|
||||||
this.ActivatedPlugins.Remove(plugin);
|
this.ActivatedPlugins.Remove(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawUI()
|
private void DrawUi()
|
||||||
{
|
{
|
||||||
foreach (var plugin in this.ActivatedPlugins.Values)
|
foreach (var plugin in this.ActivatedPlugins.Values)
|
||||||
{
|
{
|
||||||
plugin.DrawUi();
|
plugin.DrawUi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClientStateOnLogin(object? o, EventArgs e)
|
||||||
|
{
|
||||||
|
var dalamudConfig = Service<DalamudConfiguration>.Get();
|
||||||
|
|
||||||
|
#if !DEBUG
|
||||||
|
if (DateTime.Now is not { Month: 4, Day: 1 })
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (dalamudConfig.HasSeenFools23)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var di = Service<DalamudInterface>.Get();
|
||||||
|
di.OpenFoolsWindow();
|
||||||
|
|
||||||
|
dalamudConfig.HasSeenFools23 = true;
|
||||||
|
dalamudConfig.QueueSave();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
61
Dalamud/Fools/FoolsWindow.cs
Normal file
61
Dalamud/Fools/FoolsWindow.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Numerics;
|
||||||
|
using Dalamud.Interface;
|
||||||
|
using Dalamud.Interface.Internal;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
|
using ImGuiNET;
|
||||||
|
using ImGuiScene;
|
||||||
|
|
||||||
|
namespace Dalamud.Fools;
|
||||||
|
|
||||||
|
// Stolen from ChangelogWindow
|
||||||
|
public class FoolsWindow : Window, IDisposable {
|
||||||
|
private readonly TextureWrap logoTexture;
|
||||||
|
|
||||||
|
public FoolsWindow()
|
||||||
|
: base("Introducing Alternate Reality Dalamud", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize)
|
||||||
|
{
|
||||||
|
this.Namespace = "FoolsWindow";
|
||||||
|
|
||||||
|
this.Size = new Vector2(885, 463);
|
||||||
|
this.SizeCondition = ImGuiCond.Appearing;
|
||||||
|
|
||||||
|
var interfaceManager = Service<InterfaceManager>.Get();
|
||||||
|
var dalamud = Service<Dalamud>.Get();
|
||||||
|
|
||||||
|
this.logoTexture =
|
||||||
|
interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "logo.png"))!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Draw()
|
||||||
|
{
|
||||||
|
var imgCursor = ImGui.GetCursorPos();
|
||||||
|
ImGui.TextWrapped(@"
|
||||||
|
A team of scientists and plugin developers have collaborated to create a new
|
||||||
|
version of Dalamud that includes plugins from other realities.
|
||||||
|
|
||||||
|
With our high tech systems, the plugin installer will now offer new, unique
|
||||||
|
plugins with endless possibilities. Open the ""Alternate Reality"" tab in the
|
||||||
|
plugin installer to see what's available.
|
||||||
|
|
||||||
|
We hope you enjoy this new version of Dalamud, and we look forward to your feedback.
|
||||||
|
".Trim());
|
||||||
|
|
||||||
|
if (ImGui.Button("Open the plugin installer"))
|
||||||
|
{
|
||||||
|
var di = Service<DalamudInterface>.Get();
|
||||||
|
di.OpenPluginInstallerFools();
|
||||||
|
}
|
||||||
|
|
||||||
|
imgCursor.X += 500;
|
||||||
|
ImGui.SetCursorPos(imgCursor);
|
||||||
|
|
||||||
|
ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(100));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.logoTexture.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
using CheapLoc;
|
using CheapLoc;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
|
using Dalamud.Fools;
|
||||||
using Dalamud.Game.ClientState.Conditions;
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Game.Internal;
|
using Dalamud.Game.Internal;
|
||||||
|
|
@ -62,6 +63,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
private readonly ProfilerWindow profilerWindow;
|
private readonly ProfilerWindow profilerWindow;
|
||||||
private readonly BranchSwitcherWindow branchSwitcherWindow;
|
private readonly BranchSwitcherWindow branchSwitcherWindow;
|
||||||
private readonly HitchSettingsWindow hitchSettingsWindow;
|
private readonly HitchSettingsWindow hitchSettingsWindow;
|
||||||
|
private readonly FoolsWindow foolsWindow;
|
||||||
|
|
||||||
private readonly TextureWrap logoTexture;
|
private readonly TextureWrap logoTexture;
|
||||||
private readonly TextureWrap tsmLogoTexture;
|
private readonly TextureWrap tsmLogoTexture;
|
||||||
|
|
@ -110,6 +112,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
this.profilerWindow = new ProfilerWindow() { IsOpen = false };
|
this.profilerWindow = new ProfilerWindow() { IsOpen = false };
|
||||||
this.branchSwitcherWindow = new BranchSwitcherWindow() { IsOpen = false };
|
this.branchSwitcherWindow = new BranchSwitcherWindow() { IsOpen = false };
|
||||||
this.hitchSettingsWindow = new HitchSettingsWindow() { IsOpen = false };
|
this.hitchSettingsWindow = new HitchSettingsWindow() { IsOpen = false };
|
||||||
|
this.foolsWindow = new FoolsWindow() { IsOpen = false };
|
||||||
|
|
||||||
this.WindowSystem.AddWindow(this.changelogWindow);
|
this.WindowSystem.AddWindow(this.changelogWindow);
|
||||||
this.WindowSystem.AddWindow(this.colorDemoWindow);
|
this.WindowSystem.AddWindow(this.colorDemoWindow);
|
||||||
|
|
@ -127,6 +130,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
this.WindowSystem.AddWindow(this.profilerWindow);
|
this.WindowSystem.AddWindow(this.profilerWindow);
|
||||||
this.WindowSystem.AddWindow(this.branchSwitcherWindow);
|
this.WindowSystem.AddWindow(this.branchSwitcherWindow);
|
||||||
this.WindowSystem.AddWindow(this.hitchSettingsWindow);
|
this.WindowSystem.AddWindow(this.hitchSettingsWindow);
|
||||||
|
this.WindowSystem.AddWindow(this.foolsWindow);
|
||||||
|
|
||||||
ImGuiManagedAsserts.AssertsEnabled = configuration.AssertsEnabledAtStartup;
|
ImGuiManagedAsserts.AssertsEnabled = configuration.AssertsEnabledAtStartup;
|
||||||
this.isImGuiDrawDevMenu = this.isImGuiDrawDevMenu || configuration.DevBarOpenAtStartup;
|
this.isImGuiDrawDevMenu = this.isImGuiDrawDevMenu || configuration.DevBarOpenAtStartup;
|
||||||
|
|
@ -338,6 +342,18 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
this.branchSwitcherWindow.BringToFront();
|
this.branchSwitcherWindow.BringToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OpenFoolsWindow()
|
||||||
|
{
|
||||||
|
this.foolsWindow.IsOpen = true;
|
||||||
|
this.foolsWindow.BringToFront();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenPluginInstallerFools()
|
||||||
|
{
|
||||||
|
this.pluginWindow.OpenFools();
|
||||||
|
this.pluginWindow.BringToFront();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Close
|
#region Close
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue