38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using gay.lilyy.DeleteEarly;
|
|
using nadena.dev.ndmf;
|
|
using UnityEngine;
|
|
|
|
[assembly: ExportsPlugin(typeof(DeleteEarlyPlugin))]
|
|
|
|
namespace gay.lilyy.DeleteEarly
|
|
{
|
|
public class DeleteEarlyPlugin : Plugin<DeleteEarlyPlugin>
|
|
{
|
|
public override string DisplayName => "Delete Early";
|
|
public override string QualifiedName => "gay.lilyy.DeleteEarly";
|
|
|
|
protected override void Configure()
|
|
{
|
|
InPhase(BuildPhase.FirstChance).Run("DeleteEarly", ctx =>
|
|
{
|
|
var configs = ctx.AvatarRootObject.GetComponentsInChildren<DeleteEarlyConfig>(true);
|
|
if (configs == null || configs.Length == 0)
|
|
return;
|
|
|
|
foreach (var config in configs)
|
|
{
|
|
if (config == null)
|
|
continue;
|
|
|
|
GameObject targetToDelete = config.targetObject != null ? config.targetObject : config.gameObject;
|
|
|
|
if (targetToDelete != null)
|
|
{
|
|
Object.DestroyImmediate(targetToDelete);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|