Skip to content

Commit

Permalink
port to resonite
Browse files Browse the repository at this point in the history
  • Loading branch information
art0007i committed Sep 27, 2023
1 parent 89772cc commit 981f870
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 36 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ShowComponentSlot

A [NeosModLoader](https://github.com/zkxs/NeosModLoader) mod for [Neos VR](https://neos.com/) that allows you to open the slot that a component is attached to in component inspectors.
A [ResoniteModLoader](https://github.com/resonite-modding-group/ResoniteModLoader) mod for [Resonite](https://resonite.com/) that allows you to open the slot that a component is attached to in component inspectors.

## Installation
1. Install [NeosModLoader](https://github.com/zkxs/NeosModLoader).
1. Place [ShowComponentSlot.dll](https://github.com/art0007i/ShowComponentSlot/releases/latest/download/ShowComponentSlot.dll) into your `nml_mods` folder. This folder should be at `C:\Program Files (x86)\Steam\steamapps\common\NeosVR\nml_mods` for a default install. You can create it if it's missing, or if you launch the game once with NeosModLoader installed it will create the folder for you.
1. Start the game. If you want to verify that the mod is working you can check your Neos logs.
1. Install [ResoniteModLoader](https://github.com/resonite-modding-group/ResoniteModLoader).
1. Place [ShowComponentSlot.dll](https://github.com/art0007i/ShowComponentSlot/releases/latest/download/ShowComponentSlot.dll) into your `rml_mods` folder. This folder should be at `C:\Program Files (x86)\Steam\steamapps\common\Resonite\rml_mods` for a default install. You can create it if it's missing, or if you launch the game once with ResoniteModLoader installed it will create the folder for you.
1. Start the game. If you want to verify that the mod is working you can check your Resonite logs.
6 changes: 3 additions & 3 deletions ShowComponentSlot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShowComponentSlot")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,5 +31,5 @@
// 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")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
26 changes: 11 additions & 15 deletions ShowComponentSlot/ShowComponentSlot.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
using HarmonyLib;
using NeosModLoader;
using System;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Collections.Generic;
using ResoniteModLoader;
using FrooxEngine;
using FrooxEngine.LogiX;
using FrooxEngine.UIX;
using BaseX;
using Elements.Core;
using System;

namespace ShowComponentSlot
{
public class ShowComponentSlot : NeosMod
public class ShowComponentSlot : ResoniteMod
{
public override string Name => "ShowComponentSlot";
public override string Author => "art0007i";
public override string Version => "1.0.0";
public override string Version => "2.0.0";
public override string Link => "https://github.com/art0007i/ShowComponentSlot/";
public override void OnEngineInit()
{
Expand All @@ -33,14 +28,15 @@ public static void Postfix(Worker worker, bool allowRemove, bool allowDuplicate,
if (allowRemove && !allowDuplicate)
{
UIBuilder ui = new UIBuilder(__instance.Slot[0][0]);
RadiantUI_Constants.SetupEditorStyle(ui);
ui.Style.MinHeight = 24f;
ui.Style.FlexibleWidth = 0f;
ui.Style.MinWidth = 32f;
ui.Style.MinWidth = 40f;

color color = color.Yellow;
color white = color.White;
color color2 = MathX.Lerp(color, white, 0.7f);
var button = ui.Button("", color2);
var color = colorX.Yellow;
var b = colorX.Black;
var color2 = MathX.Lerp(color, b, 0.7f);
var button = ui.Button(OfficialAssets.Graphics.Icons.Inspector.RootUp, color2);
var edit = button.Slot[0].AttachComponent<RefEditor>();
(AccessTools.Field(edit.GetType(), "_targetRef").GetValue(edit) as RelayRef<ISyncRef>).Target = (ISyncRef)AccessTools.Field(__instance.GetType(), "_targetWorker").GetValue(__instance);
button.Pressed.Target = (ButtonEventHandler)AccessTools.Method(edit.GetType(), "OpenInspectorButton").CreateDelegate(typeof(ButtonEventHandler), edit);
Expand Down
28 changes: 14 additions & 14 deletions ShowComponentSlot/ShowComponentSlot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<TargetFramework>net472</TargetFramework>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NeosPath>$(MSBuildThisFileDirectory)NeosVR</NeosPath>
<NeosPath Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\NeosVR\')">C:\Program Files (x86)\Steam\steamapps\common\NeosVR\</NeosPath>
<NeosPath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/NeosVR/')">$(HOME)/.steam/steam/steamapps/common/NeosVR/</NeosPath>
<NeosPath Condition="Exists('E:\Programs\Steam\steamapps\common\NeosVR')">E:\Programs\Steam\steamapps\common\NeosVR\</NeosPath>
<GamePath>$(MSBuildThisFileDirectory)Resonite</GamePath>
<GamePath Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\Resonite\')">C:\Program Files (x86)\Steam\steamapps\common\Resonite\</GamePath>
<GamePath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/Resonite/')">$(HOME)/.steam/steam/steamapps/common/Resonite/</GamePath>
<GamePath Condition="Exists('E:\Programs\Steam\steamapps\common\Resonite\')">E:\Programs\Steam\steamapps\common\Resonite\</GamePath>
<CopyLocal>false</CopyLocal>
<CopyToMods Condition="'$(CopyToMods)'==''">true</CopyToMods>
<DebugSymbols Condition="'$(Configuration)'=='Release'">false</DebugSymbols>
Expand All @@ -21,23 +21,23 @@

<ItemGroup>
<Reference Include="HarmonyLib">
<HintPath>$(NeosPath)nml_libs\0Harmony.dll</HintPath>
<HintPath Condition="Exists('$(NeosPath)0Harmony.dll')">$(NeosPath)0Harmony.dll</HintPath>
<HintPath>$(GamePath)rml_libs\0Harmony.dll</HintPath>
<HintPath Condition="Exists('$(GamePath)0Harmony.dll')">$(GamePath)0Harmony.dll</HintPath>
</Reference>
<Reference Include="BaseX">
<HintPath>$(NeosPath)Neos_Data\Managed\BaseX.dll</HintPath>
<Reference Include="Elements.Core">
<HintPath>$(GamePath)Resonite_Data\Managed\Elements.Core.dll</HintPath>
</Reference>
<Reference Include="FrooxEngine">
<HintPath>$(NeosPath)Neos_Data\Managed\FrooxEngine.dll</HintPath>
<HintPath>$(GamePath)Resonite_Data\Managed\FrooxEngine.dll</HintPath>
</Reference>
<Reference Include="NeosModLoader">
<HintPath>$(NeosPath)NeosModLoader.dll</HintPath>
<HintPath>$(NeosPath)Libraries\NeosModLoader.dll</HintPath>
<Reference Include="ResoniteModLoader">
<HintPath>$(GamePath)ResoniteModLoader.dll</HintPath>
<HintPath>$(GamePath)Libraries\ResoniteModLoader.dll</HintPath>
</Reference>
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(CopyToMods)'=='true'">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(NeosPath)nml_mods" />
<Message Text="Copied $(TargetFileName) to $(NeosPath)nml_mods" Importance="high" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(GamePath)rml_mods" />
<Message Text="Copied $(TargetFileName) to $(GamePath)rml_mods" Importance="high" />
</Target>
</Project>

0 comments on commit 981f870

Please sign in to comment.