继续搞点新机制

This commit is contained in:
SoulliesOfficial
2025-10-25 07:49:39 -04:00
parent 76157e3cb1
commit bb9aea5f43
118 changed files with 1521 additions and 6760 deletions

View File

@@ -1,3 +1,4 @@
using System;
using SLSFramework.General;
using UnityEngine;
using UnityEngine.Events;
@@ -55,5 +56,39 @@ namespace SLSFramework.General
action.Invoke(arg1, arg2);
}
}
public class EventUnit<T1, T2, T3> : IPrioritized
{
private readonly UnityAction<T1, T2, T3> action;
public int Priority { get; set; }
public EventUnit(UnityAction<T1, T2, T3> action, int priority = 0)
{
this.action = action;
this.Priority = priority;
}
public void Invoke(T1 arg1, T2 arg2, T3 arg3)
{
action.Invoke(arg1, arg2, arg3);
}
}
public class PrioritizedFunc<T1, T2, T3, TR> : IPrioritized
{
private readonly Func<T1, T2, T3, TR> func;
public int Priority { get; set; }
public PrioritizedFunc(Func<T1, T2, T3, TR> func, int priority = 0)
{
this.func = func;
this.Priority = priority;
}
public TR Invoke(T1 arg1, T2 arg2, T3 arg3)
{
return func.Invoke(arg1, arg2, arg3);
}
}
}