generated from ResoniteModdingGroup/MonkeyLoader.ModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish porting from the Resonite integration
- Loading branch information
Showing
6 changed files
with
128 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using FrooxEngine.UIX; | ||
using FrooxEngine; | ||
using HarmonyLib; | ||
using MonkeyLoader.Patching; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using MonkeyLoader.Resonite; | ||
|
||
namespace ArrayEditing | ||
{ | ||
[HarmonyPatch] | ||
[HarmonyPatchCategory(nameof(ListUIImprovements))] | ||
internal sealed class ListUIImprovements : ResoniteMonkey<ListUIImprovements> | ||
{ | ||
public override bool CanBeDisabled => true; | ||
|
||
protected override IEnumerable<IFeaturePatch> GetFeaturePatches() => []; | ||
|
||
[HarmonyPatch(typeof(ListEditor), "BuildListElement")] | ||
private static bool Prefix(UIBuilder ui) | ||
{ | ||
if (Enabled) | ||
ui.Style.MinHeight = 24f; | ||
|
||
return true; | ||
} | ||
|
||
[HarmonyPatch(typeof(SyncMemberEditorBuilder), "GenerateMemberField")] | ||
private static bool Prefix(ISyncMember member, UIBuilder ui) | ||
{ | ||
if (!Enabled || member.Parent is not ISyncList || member is not SyncObject) | ||
return true; | ||
|
||
ui.CurrentRect.Slot.AttachComponent<HorizontalLayout>(); | ||
if (ui.CurrentRect.Slot.GetComponent<LayoutElement>() is LayoutElement layoutElement) | ||
{ | ||
layoutElement.MinWidth.Value = 48f; | ||
layoutElement.FlexibleWidth.Value = -1f; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.