Skip to content

Commit

Permalink
Add remaining build member events and default handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Banane9 committed Oct 2, 2024
1 parent 7b31cb2 commit 3b573d8
Show file tree
Hide file tree
Showing 9 changed files with 500 additions and 240 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MicroUtils.HarmonyAnalyzers" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MonkeyLoader" Version="0.23.0-beta" />
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
using FrooxEngine.UIX;
using FrooxEngine;
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;

namespace MonkeyLoader.Resonite.UI.Inspectors
{
/// <summary>
/// Represents the event fired during construction of a <see cref="MemberEditor"/> for an <see cref="ISyncArray"/>.
/// </summary>
public sealed class BuildArrayEditorEvent : BuildMemberEditorEvent
{
/// <summary>
/// Gets the sync array that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public new ISyncArray Member { get; }

internal BuildArrayEditorEvent(ISyncArray member, string name, FieldInfo fieldInfo, UIBuilder ui, float labelSize)
: base(member, name, fieldInfo, ui, labelSize)
{
Member = member;
}
}

/// <summary>
/// Represents the event fired during construction of a <see cref="MemberEditor"/> for an <see cref="ISyncBag"/>.
/// </summary>
public sealed class BuildBagEditorEvent : BuildMemberEditorEvent
{
/// <summary>
/// Gets the sync bag that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public new ISyncBag Member { get; }

internal BuildBagEditorEvent(ISyncBag member, string name, FieldInfo fieldInfo, UIBuilder ui)
: base(member, name, fieldInfo, ui)
{
Member = member;
}
}

/// <summary>
/// Represents the event fired during construction of a <see cref="MemberEditor"/> for an <see cref="IField"/>.
/// </summary>
public sealed class BuildFieldEditorEvent : BuildMemberEditorEvent
{
/// <summary>
/// Gets the field that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public new IField Member { get; }

internal BuildFieldEditorEvent(IField member, string name, FieldInfo fieldInfo, UIBuilder ui, float labelSize)
: base(member, name, fieldInfo, ui, labelSize)
{
Member = member;
}
}

/// <summary>
/// Represents the event fired during construction of a <see cref="MemberEditor"/> for an <see cref="ISyncList"/>.
/// </summary>
public sealed class BuildListEditorEvent : BuildMemberEditorEvent
{
/// <summary>
/// Gets the sync list that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public new ISyncList Member { get; }

internal BuildListEditorEvent(ISyncList member, string name, FieldInfo fieldInfo, UIBuilder ui)
: base(member, name, fieldInfo, ui)
{
Member = member;
}
}

/// <summary>
/// Represents the event fired during construction of a <see cref="MemberEditor"/> for an <see cref="SyncObject"/>.
/// </summary>
public sealed class BuildObjectEditorEvent : BuildMemberEditorEvent
{
/// <summary>
/// Gets the sync object that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public new SyncObject Member { get; }

internal BuildObjectEditorEvent(SyncObject member, string name, FieldInfo fieldInfo, UIBuilder ui, float labelSize)
: base(member, name, fieldInfo, ui, labelSize)
{
Member = member;
}
}

/// <summary>
/// Represents the event fired during construction of a <see cref="MemberEditor"/> for an <see cref="SyncPlayback"/>.
/// </summary>
public sealed class BuildPlaybackEditorEvent : BuildMemberEditorEvent
{
/// <summary>
/// Gets the sync playback that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public new SyncPlayback Member { get; }

internal BuildPlaybackEditorEvent(SyncPlayback member, string name, FieldInfo fieldInfo, UIBuilder ui, float labelSize)
: base(member, name, fieldInfo, ui, labelSize)
{
Member = member;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using FrooxEngine.UIX;
using FrooxEngine;
using MonkeyLoader.Resonite.Events;
using System.Reflection;
using MonkeyLoader.Events;

namespace MonkeyLoader.Resonite.UI.Inspectors
{
/// <summary>
/// Represents the base class for the events fired during construction of a <see cref="MemberEditor"/>
/// </summary>
[DispatchableBaseEvent]
public abstract class BuildMemberEditorEvent : CancelableBuildUIEvent
{
/// <summary>
/// Gets the reflection data for the field that stores the <see cref="Member">Member</see>
/// that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public FieldInfo FieldInfo { get; }

/// <summary>
/// Gets the size for the <see cref="Name">Name</see> label
/// that should be displayed for the <see cref="MemberEditor"/>.<br/>
/// Not all member editors get passed a label size.
/// </summary>
public float? LabelSize { get; }

/// <summary>
/// Gets the sync member that a <see cref="MemberEditor"/> is being constructed for.
/// </summary>
public ISyncMember Member { get; }

/// <summary>
/// Gets the name that should be used for the <see cref="MemberEditor"/> label.
/// </summary>
public string Name { get; }

internal BuildMemberEditorEvent(ISyncMember member, string name, FieldInfo fieldInfo, UIBuilder ui, float? labelSize = null)
: base(ui)
{
Member = member;
Name = name;
FieldInfo = fieldInfo;
LabelSize = labelSize;
}
}
}
Loading

0 comments on commit 3b573d8

Please sign in to comment.