Skip to content

Plugin Settings #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ResoniteModLoader/Assets/RMLAssets.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ResoniteModLoader.Assets;

/// <summary>
/// Provides asset URIs for the mod loader.
/// </summary>
internal static class RMLAssets {
public static readonly Uri Icon = new Uri("resdb:///9cd4d9c990705620152bb6e7b7673079e5624bd422257f474bbad3ead5ac25b2.png");
}
7 changes: 1 addition & 6 deletions ResoniteModLoader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand All @@ -13,9 +12,5 @@

[assembly: ComVisible(false)]

// Prevent FrooxEngine.Weaver from modifying this assembly, as it doesn't need anything done to it
// This keeps Weaver from overwriting AssemblyVersionAttribute
[module: Description("FROOXENGINE_WEAVED")]

//Mark as DataModelAssembly for the Plugin loading system to load this assembly
[assembly: DataModelAssembly(DataModelAssemblyType.Optional)]
[assembly: DataModelAssembly(DataModelAssemblyType.UserspaceCore)]
16 changes: 13 additions & 3 deletions ResoniteModLoader/ResoniteModLoader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,23 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.3.3" />
<PackageReference Include="Lib.Harmony" Version="2.3.6" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.6" />
<!--For some reason, doesn't like the included copy, won't be needed in net9 anyway-->
<Reference Include="FrooxEngine">
<HintPath>$(ResonitePath)Resonite_Data\Managed\FrooxEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Elements.Assets">
<HintPath>$(ResonitePath)Resonite_Data\Managed\Elements.Assets.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Elements.Core">
<HintPath>$(ResonitePath)Resonite_Data\Managed\Elements.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="FrooxEngine">
<HintPath>$(ResonitePath)Resonite_Data\Managed\FrooxEngine.dll</HintPath>
<Reference Include="Elements.Quantity">
<HintPath>$(ResonitePath)Resonite_Data\Managed\Elements.Quantity.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
Expand Down
31 changes: 31 additions & 0 deletions ResoniteModLoader/Settings/ModLoaderSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using FrooxEngine;

namespace ResoniteModLoader;

[AutoRegisterSetting]
[SettingCategory("ResoniteModLoader")]
public sealed class ModLoaderSettings : SettingComponent<ModLoaderSettings> {
public override bool UserspaceOnly => true;

[SettingIndicatorProperty]
public readonly Sync<string> LoadedMods;
[SettingIndicatorProperty]
public readonly Sync<string> ModLoaderVersion;

[SettingProperty("Debug Mode")]
public readonly Sync<bool> DebugMode;

public override void ResetToDefault() {
DebugMode.Value = false;
}

protected override void OnChanges() {
base.OnChanges();
ModLoaderConfiguration.Get().Debug = DebugMode.Value;
}
protected override void OnStart() {
base.OnStart();
ModLoaderVersion.Value = ModLoader.VERSION;
LoadedMods.Value = ModLoader.Mods().Count().ToString();
}
}
9 changes: 9 additions & 0 deletions ResoniteModLoader/Settings/ModSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using FrooxEngine;

namespace ResoniteModLoader;

[AutoRegisterSetting]
[SettingCategory("ResoniteModLoader")]
public sealed class ModSettings : SettingComponent<ModSettings> {
public override bool UserspaceOnly => true;
}
10 changes: 10 additions & 0 deletions ResoniteModLoader/Settings/SettingCategoryDefinitions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Elements.Core;

using FrooxEngine;

using ResoniteModLoader.Assets;
[DataModelType]
public static class SettingCategoryDefinitions {
[SettingCategory("ResoniteModLoader")]
public static SettingCategoryInfo ResoniteModLoader => new SettingCategoryInfo(RMLAssets.Icon, 0L);
}