Merge pull request #5 from daemitus/api4

API 4
main
goaaats 2021-09-09 00:30:06 +02:00 committed by GitHub
commit 82f714f0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 180 additions and 338 deletions

View File

@ -1,11 +1,13 @@
{ {
"Author": "your name here", "Author": "your name here",
"Name": "Sample Plugin", "Name": "Sample Plugin",
"Description": "A simple description that shows up in /xlplugins. List any major slash-command(s).", "Punchline": "A short one-liner that shows up in /xlplugins.",
"Description": "A description that shows up in /xlplugins. List any major slash-command(s).",
"InternalName": "samplePlugin", "InternalName": "samplePlugin",
"AssemblyVersion": "1.0.0.0",
"RepoUrl": "https://github.com/yourName/yourRepo",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"Tags": ["sample", "plugin", "goats"], "Tags": [
"DalamudApiLevel": 3 "sample",
"plugin",
"goats"
]
} }

View File

@ -9,18 +9,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIDev", "UIDev\UIDev.csproj
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|Any CPU.Build.0 = Debug|Any CPU {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|Any CPU.ActiveCfg = Release|Any CPU {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|Any CPU.Build.0 = Release|Any CPU {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.ActiveCfg = Debug|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.Build.0 = Debug|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.ActiveCfg = Release|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|Any CPU.Build.0 = Release|Any CPU {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -14,7 +14,7 @@ namespace SamplePlugin
// the below exist just to make saving less cumbersome // the below exist just to make saving less cumbersome
[NonSerialized] [NonSerialized]
private DalamudPluginInterface pluginInterface; private DalamudPluginInterface? pluginInterface;
public void Initialize(DalamudPluginInterface pluginInterface) public void Initialize(DalamudPluginInterface pluginInterface)
{ {
@ -23,7 +23,7 @@ namespace SamplePlugin
public void Save() public void Save()
{ {
this.pluginInterface.SavePluginConfig(this); this.pluginInterface!.SavePluginConfig(this);
} }
} }
} }

View File

@ -1,70 +1,67 @@
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.IoC;
using Dalamud.Plugin; using Dalamud.Plugin;
using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
namespace SamplePlugin namespace SamplePlugin
{ {
public class Plugin : IDalamudPlugin public sealed class Plugin : IDalamudPlugin
{ {
public string Name => "Sample Plugin"; public string Name => "Sample Plugin";
private const string commandName = "/pmycommand"; private const string commandName = "/pmycommand";
private DalamudPluginInterface pi; private DalamudPluginInterface PluginInterface { get; init; }
private Configuration configuration; private CommandManager CommandManager { get; init; }
private PluginUI ui; private Configuration Configuration { get; init; }
private PluginUI PluginUi { get; init; }
// When loaded by LivePluginLoader, the executing assembly will be wrong. public Plugin(
// Supplying this property allows LivePluginLoader to supply the correct location, so that [RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
// you have full compatibility when loaded normally and through LPL. [RequiredVersion("1.0")] CommandManager commandManager)
public string AssemblyLocation { get => assemblyLocation; set => assemblyLocation = value; }
private string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
public void Initialize(DalamudPluginInterface pluginInterface)
{ {
this.pi = pluginInterface; this.PluginInterface = pluginInterface;
this.CommandManager = commandManager;
this.configuration = this.pi.GetPluginConfig() as Configuration ?? new Configuration(); this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
this.configuration.Initialize(this.pi); this.Configuration.Initialize(this.PluginInterface);
// you might normally want to embed resources and load them from the manifest stream // you might normally want to embed resources and load them from the manifest stream
var imagePath = Path.Combine(Path.GetDirectoryName(AssemblyLocation), @"goat.png"); var assemblyLocation = Assembly.GetExecutingAssembly().Location;
var goatImage = this.pi.UiBuilder.LoadImage(imagePath); var imagePath = Path.Combine(Path.GetDirectoryName(assemblyLocation)!, "goat.png");
this.ui = new PluginUI(this.configuration, goatImage); var goatImage = this.PluginInterface.UiBuilder.LoadImage(imagePath);
this.PluginUi = new PluginUI(this.Configuration, goatImage);
this.pi.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand) this.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand)
{ {
HelpMessage = "A useful message to display in /xlhelp" HelpMessage = "A useful message to display in /xlhelp"
}); });
this.pi.UiBuilder.OnBuildUi += DrawUI; this.PluginInterface.UiBuilder.Draw += DrawUI;
this.pi.UiBuilder.OnOpenConfigUi += (sender, args) => DrawConfigUI(); this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI;
} }
public void Dispose() public void Dispose()
{ {
this.ui.Dispose(); this.PluginUi.Dispose();
this.CommandManager.RemoveHandler(commandName);
this.pi.CommandManager.RemoveHandler(commandName);
this.pi.Dispose();
} }
private void OnCommand(string command, string args) private void OnCommand(string command, string args)
{ {
// in response to the slash command, just display our main ui // in response to the slash command, just display our main ui
this.ui.Visible = true; this.PluginUi.Visible = true;
} }
private void DrawUI() private void DrawUI()
{ {
this.ui.Draw(); this.PluginUi.Draw();
} }
private void DrawConfigUI() private void DrawConfigUI()
{ {
this.ui.SettingsVisible = true; this.PluginUi.SettingsVisible = true;
} }
} }
} }

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("samplePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SamplePlugin")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("13c812e9-0d42-4b95-8646-40eebf30636f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,64 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Authors></Authors>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Company></Company>
<ProjectGuid>{13C812E9-0D42-4B95-8646-40EEBF30636F}</ProjectGuid> <Version>0.0.0.1</Version>
<OutputType>Library</OutputType> <Description>A sample plugin.</Description>
<AppDesignerFolder>Properties</AppDesignerFolder> <Copyright></Copyright>
<RootNamespace>SamplePlugin</RootNamespace> <PackageProjectUrl>https://github.com/goatcorp/SamplePlugin</PackageProjectUrl>
<AssemblyName>samplePlugin</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <PropertyGroup>
<DebugType>full</DebugType> <TargetFramework>net5.0-windows</TargetFramework>
<Optimize>false</Optimize> <Platforms>x64</Platforms>
<OutputPath>bin\Debug\</OutputPath> <Nullable>enable</Nullable>
<DefineConstants>DEBUG;TRACE</DefineConstants> <LangVersion>latest</LangVersion>
<ErrorReport>prompt</ErrorReport> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningLevel>4</WarningLevel> <ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(AppData)\XIVLauncher\devPlugins\SamplePlugin\</OutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dalamud">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="PluginUI.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\Data\samplePlugin.json"> <Content Include="..\Data\samplePlugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -68,5 +29,41 @@
<Visible>false</Visible> <Visible>false</Visible>
</Content> </Content>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.2" />
<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>
</Project> </Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -1,6 +1,5 @@
using ImGuiNET; using ImGuiNET;
using ImGuiScene; using ImGuiScene;
using System;
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static SDL2.SDL; using static SDL2.SDL;
@ -14,13 +13,13 @@ namespace UIDev
// you can edit this if you want more control over things // you can edit this if you want more control over things
// mainly if you want a regular window instead of transparent overlay // mainly if you want a regular window instead of transparent overlay
// Typically you don't want to change any colors here if you keep the fullscreen overlay // Typically you don't want to change any colors here if you keep the fullscreen overlay
using (var scene = new SimpleImGuiScene(RendererFactory.RendererBackend.DirectX11, new WindowCreateInfo using var scene = new SimpleImGuiScene(RendererFactory.RendererBackend.DirectX11, new WindowCreateInfo
{ {
Title = "UI Test", Title = "UI Test",
Fullscreen = true, Fullscreen = true,
TransparentColor = new float[] { 0, 0, 0 }, TransparentColor = new float[] { 0, 0, 0 },
})) });
{
// the background color of your window - typically don't change this for fullscreen overlays // the background color of your window - typically don't change this for fullscreen overlays
scene.Renderer.ClearColor = new Vector4(0, 0, 0, 0); scene.Renderer.ClearColor = new Vector4(0, 0, 0, 0);
@ -39,19 +38,11 @@ namespace UIDev
fontConfig.MergeMode = true; fontConfig.MergeMode = true;
fontConfig.PixelSnapH = true; fontConfig.PixelSnapH = true;
var fontPathJp = @"NotoSansCJKjp-Medium.otf"; var fontPathJp = "NotoSansCJKjp-Medium.otf";
ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathJp, 17.0f, null, ImGui.GetIO().Fonts.GetGlyphRangesJapanese()); ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathJp, 17.0f, null, ImGui.GetIO().Fonts.GetGlyphRangesJapanese());
var fontPathGame = @"gamesym.ttf"; var fontPathGame = "gamesym.ttf";
var rangeHandle = GCHandle.Alloc(new ushort[] { 0xE020, 0xE0DB, 0 }, GCHandleType.Pinned);
var rangeHandle = GCHandle.Alloc(new ushort[]
{
0xE020,
0xE0DB,
0
}, GCHandleType.Pinned);
ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathGame, 17.0f, fontConfig, rangeHandle.AddrOfPinnedObject()); ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathGame, 17.0f, fontConfig, rangeHandle.AddrOfPinnedObject());
ImGui.GetIO().Fonts.Build(); ImGui.GetIO().Fonts.Build();
@ -96,5 +87,4 @@ namespace UIDev
pluginUI.Dispose(); pluginUI.Dispose();
} }
} }
}
} }

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UIDev")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UIDev")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4fec9558-eb25-419f-b86e-51b8cfda32b7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,85 +1,33 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <TargetFramework>net5.0-windows</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platforms>x64</Platforms>
<ProjectGuid>{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}</ProjectGuid> <Nullable>enable</Nullable>
<OutputType>Exe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>UIDev</RootNamespace> <LangVersion>latest</LangVersion>
<AssemblyName>UIDev</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PropertyGroup>
<DebugType>pdbonly</DebugType> <DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ImGui.NET"> <Reference Include="ImGui.NET">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath> <HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
</Reference> </Reference>
<Reference Include="ImGuiScene"> <Reference Include="ImGuiScene">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath> <HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
</Reference> </Reference>
<Reference Include="SDL2-CS"> <Reference Include="SDL2-CS">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\SDL2-CS.dll</HintPath> <HintPath>$(DalamudLibPath)SDL2-CS.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Framework\IPluginUIMock.cs" />
<Compile Include="Framework\UIBootstrap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UITest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\Data\gamesym.ttf"> <Content Include="..\Data\gamesym.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -94,17 +42,4 @@
<Visible>false</Visible> <Visible>false</Visible>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -1,6 +1,5 @@
using ImGuiNET; using ImGuiNET;
using ImGuiScene; using ImGuiScene;
using System;
using System.Numerics; using System.Numerics;
namespace UIDev namespace UIDev
@ -12,8 +11,8 @@ namespace UIDev
UIBootstrap.Inititalize(new UITest()); UIBootstrap.Inititalize(new UITest());
} }
private TextureWrap goatImage; private TextureWrap? goatImage;
private SimpleImGuiScene scene; private SimpleImGuiScene? scene;
public void Initialize(SimpleImGuiScene scene) public void Initialize(SimpleImGuiScene scene)
{ {
@ -21,7 +20,7 @@ namespace UIDev
// but it can accomplish the same things, and is really only used for initial setup here // but it can accomplish the same things, and is really only used for initial setup here
// eg, to load an image resource for use with ImGui // eg, to load an image resource for use with ImGui
this.goatImage = scene.LoadImage(@"goat.png"); this.goatImage = scene.LoadImage("goat.png");
scene.OnBuildUI += Draw; scene.OnBuildUI += Draw;
@ -34,7 +33,7 @@ namespace UIDev
public void Dispose() public void Dispose()
{ {
this.goatImage.Dispose(); this.goatImage?.Dispose();
} }
// You COULD go all out here and make your UI generic and work on interfaces etc, and then // You COULD go all out here and make your UI generic and work on interfaces etc, and then
@ -48,7 +47,7 @@ namespace UIDev
if (!Visible) if (!Visible)
{ {
this.scene.ShouldQuit = true; this.scene!.ShouldQuit = true;
} }
} }
@ -93,7 +92,7 @@ namespace UIDev
ImGui.Text("Have a goat:"); ImGui.Text("Have a goat:");
ImGui.Indent(55); ImGui.Indent(55);
ImGui.Image(this.goatImage.ImGuiHandle, new Vector2(this.goatImage.Width, this.goatImage.Height)); ImGui.Image(this.goatImage!.ImGuiHandle, new Vector2(this.goatImage.Width, this.goatImage.Height));
ImGui.Unindent(55); ImGui.Unindent(55);
} }
ImGui.End(); ImGui.End();