NET 8
This commit is contained in:
parent
865a608031
commit
3792244261
1017
.editorconfig
Normal file
1017
.editorconfig
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,8 @@ public static class DataManagerExtensions
|
||||
public static SeString? GetSeString<T>(this IDataManager dataManager, string key)
|
||||
where T : QuestDialogueText
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(dataManager);
|
||||
|
||||
return dataManager.GetExcelSheet<T>()?
|
||||
.SingleOrDefault(x => x.Key == key)
|
||||
?.Value;
|
||||
@ -49,6 +51,9 @@ public static class DataManagerExtensions
|
||||
public static SeString? GetSeString<T>(this IDataManager dataManager, uint rowId, Func<T, SeString?> mapper)
|
||||
where T : ExcelRow
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(dataManager);
|
||||
ArgumentNullException.ThrowIfNull(mapper);
|
||||
|
||||
var row = dataManager.GetExcelSheet<T>()?.GetRow(rowId);
|
||||
if (row == null)
|
||||
return null;
|
||||
@ -56,7 +61,8 @@ public static class DataManagerExtensions
|
||||
return mapper(row);
|
||||
}
|
||||
|
||||
public static string? GetString<T>(this IDataManager dataManager, uint rowId, Func<T, SeString?> mapper, IPluginLog? pluginLog = null)
|
||||
public static string? GetString<T>(this IDataManager dataManager, uint rowId, Func<T, SeString?> mapper,
|
||||
IPluginLog? pluginLog = null)
|
||||
where T : ExcelRow
|
||||
{
|
||||
string? text = GetSeString(dataManager, rowId, mapper)?.ToString();
|
||||
@ -65,7 +71,8 @@ public static class DataManagerExtensions
|
||||
return text;
|
||||
}
|
||||
|
||||
public static Regex? GetRegex<T>(this IDataManager dataManager, uint rowId, Func<T, SeString?> mapper, IPluginLog? pluginLog = null)
|
||||
public static Regex? GetRegex<T>(this IDataManager dataManager, uint rowId, Func<T, SeString?> mapper,
|
||||
IPluginLog? pluginLog = null)
|
||||
where T : ExcelRow
|
||||
{
|
||||
SeString? text = GetSeString(dataManager, rowId, mapper);
|
||||
@ -83,9 +90,11 @@ public static class DataManagerExtensions
|
||||
return new Regex(regex);
|
||||
}
|
||||
|
||||
public static Regex? GetRegex<T>(this T excelRow, Func<T, SeString?> mapper, IPluginLog? pluginLog)
|
||||
public static Regex? GetRegex<T>(this T excelRow, Func<T, SeString?> mapper, IPluginLog? pluginLog)
|
||||
where T : ExcelRow
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(excelRow);
|
||||
ArgumentNullException.ThrowIfNull(mapper);
|
||||
SeString? text = mapper(excelRow);
|
||||
if (text == null)
|
||||
return null;
|
||||
|
@ -8,6 +8,7 @@ namespace LLib.GameUI;
|
||||
public static class LAddon
|
||||
{
|
||||
private const int UnitListCount = 18;
|
||||
|
||||
public static unsafe AtkUnitBase* GetAddonById(uint id)
|
||||
{
|
||||
var unitManagers = &AtkStage.GetSingleton()->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList;
|
||||
@ -30,6 +31,9 @@ public static class LAddon
|
||||
public static unsafe bool TryGetAddonByName<T>(this IGameGui gameGui, string addonName, out T* addonPtr)
|
||||
where T : unmanaged
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(gameGui);
|
||||
ArgumentException.ThrowIfNullOrEmpty(addonName);
|
||||
|
||||
var a = gameGui.GetAddonByName(addonName);
|
||||
if (a != IntPtr.Zero)
|
||||
{
|
||||
|
61
ImGui/LWindow.cs
Normal file
61
ImGui/LWindow.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using IG = ImGuiNET.ImGui;
|
||||
|
||||
namespace LLib.ImGui;
|
||||
|
||||
public abstract class LWindow : Window
|
||||
{
|
||||
protected bool ClickedHeaderLastFrame { get; private set; }
|
||||
protected bool ClickedHeaderCurrentFrame { get; private set; }
|
||||
|
||||
protected LWindow(string name, ImGuiWindowFlags flags = ImGuiWindowFlags.None, bool forceMainWindow = false)
|
||||
: base(name, flags, forceMainWindow)
|
||||
{
|
||||
TitleBarButtons.Add(new TitleBarButton
|
||||
{
|
||||
Icon = FontAwesomeIcon.Heart,
|
||||
ShowTooltip = () =>
|
||||
{
|
||||
IG.BeginTooltip();
|
||||
IG.Text("Go to patreon.com/lizac");
|
||||
IG.EndTooltip();
|
||||
},
|
||||
Priority = int.MinValue,
|
||||
IconOffset = new Vector2(1.5f, 1),
|
||||
Click = _ =>
|
||||
{
|
||||
// when you make a window click-through, `Click` is triggered on each individual frame the mouse button is held down.
|
||||
ClickedHeaderCurrentFrame = true;
|
||||
if (ClickedHeaderLastFrame)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://www.patreon.com/lizac",
|
||||
UseShellExecute = true,
|
||||
Verb = string.Empty,
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
// not sure what to do anyway
|
||||
}
|
||||
},
|
||||
AvailableClickthrough = true,
|
||||
});
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
base.PreDraw();
|
||||
|
||||
ClickedHeaderLastFrame = ClickedHeaderCurrentFrame;
|
||||
ClickedHeaderCurrentFrame = false;
|
||||
}
|
||||
}
|
63
LImGui.cs
63
LImGui.cs
@ -1,63 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace LLib;
|
||||
|
||||
public static class LImGui
|
||||
{
|
||||
public abstract class LWindow : Window
|
||||
{
|
||||
protected bool ClickedHeaderLastFrame;
|
||||
protected bool ClickedHeaderCurrentFrame;
|
||||
|
||||
protected LWindow(string name, ImGuiWindowFlags flags = ImGuiWindowFlags.None, bool forceMainWindow = false)
|
||||
: base(name, flags, forceMainWindow)
|
||||
{
|
||||
TitleBarButtons.Add(new TitleBarButton
|
||||
{
|
||||
Icon = FontAwesomeIcon.Heart,
|
||||
ShowTooltip = () =>
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.Text("Go to patreon.com/lizac");
|
||||
ImGui.EndTooltip();
|
||||
},
|
||||
Priority = int.MinValue,
|
||||
IconOffset = new Vector2(1.5f, 1),
|
||||
Click = _ =>
|
||||
{
|
||||
// when you make a window click-through, `Click` is triggered on each individual frame the mouse button is held down.
|
||||
ClickedHeaderCurrentFrame = true;
|
||||
if (ClickedHeaderLastFrame)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://www.patreon.com/lizac",
|
||||
UseShellExecute = true,
|
||||
Verb = string.Empty,
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
// not sure what to do anyway
|
||||
}
|
||||
},
|
||||
AvailableClickthrough = true,
|
||||
});
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
base.PreDraw();
|
||||
|
||||
ClickedHeaderLastFrame = ClickedHeaderCurrentFrame;
|
||||
ClickedHeaderCurrentFrame = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Version>1.0</Version>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<LangVersion>12</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "7.0.0",
|
||||
"version": "8.0.0",
|
||||
"rollForward": "latestMinor",
|
||||
"allowPrerelease": false
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net7.0-windows7.0": {}
|
||||
"net8.0-windows7.0": {}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user