migrate to API9

- also migrate to Dalamud.NET.Sdk
This commit is contained in:
2025-03-29 09:09:50 +01:00
parent 098d77bcc2
commit b55e3a2f14
4 changed files with 83 additions and 122 deletions

View File

@@ -1,91 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>r00telement;Pilzinsel64</Authors>
<Version>1.12.1.0</Version>
</PropertyGroup>
<Project Sdk="Dalamud.NET.Sdk/12.0.2">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<Nullable>annotations</Nullable>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup>
<Authors>r00telement;Pilzinsel64</Authors>
<Version>1.12.1.0</Version>
</PropertyGroup>
<PropertyGroup>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
</PropertyGroup>
<PropertyGroup>
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="11.0.0" />
<ProjectReference Include="..\Pilz.Dalamud\Pilz.Dalamud\Pilz.Dalamud.csproj" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Dalamud">
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Dalamud\Pilz.Dalamud\Pilz.Dalamud.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Paths.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Paths.resx</DependentUpon>
</Compile>
<Compile Update="Resources\Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Paths.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Paths.resx</DependentUpon>
</Compile>
<Compile Update="Resources\Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Paths.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Paths.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Paths.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Paths.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="Resources\Words\Adjectives.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\Words\Nouns.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="Resources\Words\Adjectives.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\Words\Nouns.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -1,4 +1,5 @@
using ImGuiNET;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using System;
using System.Collections.Generic;
@@ -13,12 +14,12 @@ public static class UIColorHelper
{
public bool Equals(UIColor left, UIColor right)
{
return left.UIForeground == right.UIForeground;
return left.Dark == right.Dark;
}
public int GetHashCode(UIColor obj)
{
return obj.UIForeground.GetHashCode();
return obj.Dark.GetHashCode();
}
}
@@ -36,7 +37,7 @@ public static class UIColorHelper
public static Vector4 ToColor(UIColor uiColor)
{
var uiColorBytes = BitConverter.GetBytes(uiColor.UIForeground);
var uiColorBytes = BitConverter.GetBytes(uiColor.Dark);
return
new Vector4((float)uiColorBytes[3] / 255,
(float)uiColorBytes[2] / 255,
@@ -59,42 +60,38 @@ public static class UIColorHelper
private static UIColor[] CreateUIColors()
{
var uiColors = PluginServices.DataManager.GetExcelSheet<UIColor>();
if (uiColors != null)
if (PluginServices.DataManager.GetExcelSheet<UIColor>() is not ExcelSheet<UIColor> uiColors)
return [];
var filteredUIColors = new List<UIColor>(uiColors.Distinct(new UIColorComparer()).Where(uiColor => uiColor.Dark != 0 && uiColor.Dark != 255));
filteredUIColors.Sort((left, right) =>
{
var filteredUIColors = new List<UIColor>(uiColors.Distinct(new UIColorComparer()).Where(uiColor => uiColor.UIForeground != 0 && uiColor.UIForeground != 255));
var leftColor = ToColor(left);
var rightColor = ToColor(right);
ImGui.ColorConvertRGBtoHSV(leftColor.X, leftColor.Y, leftColor.Z, out float leftHue, out float leftSaturation, out float leftValue);
ImGui.ColorConvertRGBtoHSV(rightColor.X, rightColor.Y, rightColor.Z, out float rightHue, out float rightSaturation, out float rightValue);
filteredUIColors.Sort((left, right) =>
var hueDifference = leftHue.CompareTo(rightHue);
if (hueDifference != 0)
{
var leftColor = ToColor(left);
var rightColor = ToColor(right);
ImGui.ColorConvertRGBtoHSV(leftColor.X, leftColor.Y, leftColor.Z, out float leftHue, out float leftSaturation, out float leftValue);
ImGui.ColorConvertRGBtoHSV(rightColor.X, rightColor.Y, rightColor.Z, out float rightHue, out float rightSaturation, out float rightValue);
return hueDifference;
}
var hueDifference = leftHue.CompareTo(rightHue);
if (hueDifference != 0)
{
return hueDifference;
}
var valueDifference = leftValue.CompareTo(rightValue);
if (valueDifference != 0)
{
return valueDifference;
}
var valueDifference = leftValue.CompareTo(rightValue);
if (valueDifference != 0)
{
return valueDifference;
}
var saturationDifference = leftSaturation.CompareTo(rightSaturation);
if (saturationDifference != 0)
{
return saturationDifference;
}
var saturationDifference = leftSaturation.CompareTo(rightSaturation);
if (saturationDifference != 0)
{
return saturationDifference;
}
return 0;
});
return 0;
});
return filteredUIColors.ToArray();
}
return new UIColor[] { };
return filteredUIColors.ToArray();
}
}

View File

@@ -1,12 +1,18 @@
{
"version": 1,
"dependencies": {
"net8.0-windows7.0": {
"net9.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[11.0.0, )",
"resolved": "11.0.0",
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
"requested": "[12.0.0, )",
"resolved": "12.0.0",
"contentHash": "J5TJLV3f16T/E2H2P17ClWjtfEBPpq3yxvqW46eN36JCm6wR+EaoaYkqG9Rm5sHqs3/nK/vKjWWyvEs/jhKoXw=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",
"requested": "[1.2.25, )",
"resolved": "1.2.25",
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
},
"pilz.dalamud": {
"type": "Project"