initial commit based on sampleplugin
This commit is contained in:
25
MareSynchronos.sln
Normal file
25
MareSynchronos.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32328.378
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MareSynchronos", "MareSynchronos\MareSynchronos.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64
|
||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64
|
||||
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
29
MareSynchronos/Configuration.cs
Normal file
29
MareSynchronos/Configuration.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Plugin;
|
||||
using System;
|
||||
|
||||
namespace SamplePlugin
|
||||
{
|
||||
[Serializable]
|
||||
public class Configuration : IPluginConfiguration
|
||||
{
|
||||
public int Version { get; set; } = 0;
|
||||
|
||||
public bool SomePropertyToBeSavedAndWithADefault { get; set; } = true;
|
||||
|
||||
// the below exist just to make saving less cumbersome
|
||||
|
||||
[NonSerialized]
|
||||
private DalamudPluginInterface? pluginInterface;
|
||||
|
||||
public void Initialize(DalamudPluginInterface pluginInterface)
|
||||
{
|
||||
this.pluginInterface = pluginInterface;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
this.pluginInterface!.SavePluginConfig(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
64
MareSynchronos/MareSynchronos.csproj
Normal file
64
MareSynchronos/MareSynchronos.csproj
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.0.0.1</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0-windows7.0</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<CopyLocalLockfileAssemblies>true</CopyLocalLockfileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="2.0.0-preview1-final" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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>
|
||||
13
MareSynchronos/MareSynchronos.json
Normal file
13
MareSynchronos/MareSynchronos.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"Author": "your name here",
|
||||
"Name": "Mare Synchronos",
|
||||
"Punchline": "",
|
||||
"Description": "",
|
||||
"InternalName": "mareSynchronos",
|
||||
"ApplicableVersion": "any",
|
||||
"Tags": [
|
||||
"sample",
|
||||
"plugin",
|
||||
"goats"
|
||||
]
|
||||
}
|
||||
65
MareSynchronos/Plugin.cs
Normal file
65
MareSynchronos/Plugin.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
//using System.Data.SQLite;
|
||||
|
||||
namespace SamplePlugin
|
||||
{
|
||||
public sealed class Plugin : IDalamudPlugin
|
||||
{
|
||||
public string Name => "Mare Synchronos";
|
||||
|
||||
private const string commandName = "/pscan";
|
||||
|
||||
private DalamudPluginInterface PluginInterface { get; init; }
|
||||
private CommandManager CommandManager { get; init; }
|
||||
private Configuration Configuration { get; init; }
|
||||
private PluginUI PluginUi { get; init; }
|
||||
|
||||
public Plugin(
|
||||
[RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
|
||||
[RequiredVersion("1.0")] CommandManager commandManager)
|
||||
{
|
||||
this.PluginInterface = pluginInterface;
|
||||
this.CommandManager = commandManager;
|
||||
|
||||
this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
this.Configuration.Initialize(this.PluginInterface);
|
||||
|
||||
// you might normally want to embed resources and load them from the manifest stream
|
||||
this.PluginUi = new PluginUI(this.Configuration);
|
||||
|
||||
this.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand)
|
||||
{
|
||||
HelpMessage = "A useful message to display in /xlhelp"
|
||||
});
|
||||
|
||||
this.PluginInterface.UiBuilder.Draw += DrawUI;
|
||||
this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.PluginUi.Dispose();
|
||||
this.CommandManager.RemoveHandler(commandName);
|
||||
}
|
||||
|
||||
private void OnCommand(string command, string args)
|
||||
{
|
||||
//using var connection = new SQLiteConnection("Data Source=penumbracache.db");
|
||||
//connection.Open();
|
||||
}
|
||||
|
||||
private void DrawUI()
|
||||
{
|
||||
this.PluginUi.Draw();
|
||||
}
|
||||
|
||||
private void DrawConfigUI()
|
||||
{
|
||||
this.PluginUi.SettingsVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
97
MareSynchronos/PluginUI.cs
Normal file
97
MareSynchronos/PluginUI.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using ImGuiNET;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace SamplePlugin
|
||||
{
|
||||
// It is good to have this be disposable in general, in case you ever need it
|
||||
// to do any cleanup
|
||||
class PluginUI : IDisposable
|
||||
{
|
||||
private Configuration configuration;
|
||||
|
||||
// this extra bool exists for ImGui, since you can't ref a property
|
||||
private bool visible = false;
|
||||
public bool Visible
|
||||
{
|
||||
get { return this.visible; }
|
||||
set { this.visible = value; }
|
||||
}
|
||||
|
||||
private bool settingsVisible = false;
|
||||
public bool SettingsVisible
|
||||
{
|
||||
get { return this.settingsVisible; }
|
||||
set { this.settingsVisible = value; }
|
||||
}
|
||||
|
||||
// passing in the image here just for simplicity
|
||||
public PluginUI(Configuration configuration)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
// This is our only draw handler attached to UIBuilder, so it needs to be
|
||||
// able to draw any windows we might have open.
|
||||
// Each method checks its own visibility/state to ensure it only draws when
|
||||
// it actually makes sense.
|
||||
// There are other ways to do this, but it is generally best to keep the number of
|
||||
// draw delegates as low as possible.
|
||||
|
||||
DrawMainWindow();
|
||||
DrawSettingsWindow();
|
||||
}
|
||||
|
||||
public void DrawMainWindow()
|
||||
{
|
||||
if (!Visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(375, 330), ImGuiCond.FirstUseEver);
|
||||
ImGui.SetNextWindowSizeConstraints(new Vector2(375, 330), new Vector2(float.MaxValue, float.MaxValue));
|
||||
if (ImGui.Begin("My Amazing Window", ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
ImGui.Text($"The random config bool is {this.configuration.SomePropertyToBeSavedAndWithADefault}");
|
||||
|
||||
if (ImGui.Button("Show Settings"))
|
||||
{
|
||||
SettingsVisible = true;
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
|
||||
public void DrawSettingsWindow()
|
||||
{
|
||||
if (!SettingsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(232, 75), ImGuiCond.Always);
|
||||
if (ImGui.Begin("A Wonderful Configuration Window", ref this.settingsVisible,
|
||||
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
// can't ref a property, so use a local copy
|
||||
var configValue = this.configuration.SomePropertyToBeSavedAndWithADefault;
|
||||
if (ImGui.Checkbox("Random Config Bool", ref configValue))
|
||||
{
|
||||
this.configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
||||
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
||||
this.configuration.Save();
|
||||
}
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MareSynchronos/filecache.db
Normal file
BIN
MareSynchronos/filecache.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user