整合SLSUtilities
This commit is contained in:
145
Assets/Scripts/SLSUtilities/SLSFramework/General/GameEvent.cs
Normal file
145
Assets/Scripts/SLSUtilities/SLSFramework/General/GameEvent.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using SLSFramework.General;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
|
||||
namespace SLSFramework.General
|
||||
{
|
||||
public class PrioritizedAction : IPrioritized
|
||||
{
|
||||
private readonly Action action;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedAction(Action action, int priority = 0)
|
||||
{
|
||||
this.action = action;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public void Invoke()
|
||||
{
|
||||
action.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public class PrioritizedAction<T> : IPrioritized
|
||||
{
|
||||
private readonly Action<T> action;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedAction(Action<T> action, int priority = 0)
|
||||
{
|
||||
this.action = action;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public void Invoke(T arg)
|
||||
{
|
||||
action.Invoke(arg);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrioritizedAction<T0, T1> : IPrioritized
|
||||
{
|
||||
private readonly Action<T0, T1> action;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedAction(Action<T0, T1> action, int priority = 0)
|
||||
{
|
||||
this.action = action;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public void Invoke(T0 arg0, T1 arg1)
|
||||
{
|
||||
action.Invoke(arg0, arg1);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrioritizedAction<T0, T1, T2> : IPrioritized
|
||||
{
|
||||
private readonly Action<T0, T1, T2> action;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedAction(Action<T0, T1, T2> action, int priority = 0)
|
||||
{
|
||||
this.action = action;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public void Invoke(T0 arg0, T1 arg1, T2 arg2)
|
||||
{
|
||||
action.Invoke(arg0, arg1, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrioritizedFunc<TR> : IPrioritized
|
||||
{
|
||||
private readonly Func<TR> func;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedFunc(Func<TR> func, int priority = 0)
|
||||
{
|
||||
this.func = func;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public TR Invoke()
|
||||
{
|
||||
return func.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public class PrioritizedFunc<T, TR> : IPrioritized
|
||||
{
|
||||
private readonly Func<T, TR> func;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedFunc(Func<T, TR> func, int priority = 0)
|
||||
{
|
||||
this.func = func;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public TR Invoke(T arg)
|
||||
{
|
||||
return func.Invoke(arg);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrioritizedFunc<T0, T1, TR> : IPrioritized
|
||||
{
|
||||
private readonly Func<T0, T1, TR> func;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedFunc(Func<T0, T1, TR> func, int priority = 0)
|
||||
{
|
||||
this.func = func;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public TR Invoke(T0 arg0, T1 arg1)
|
||||
{
|
||||
return func.Invoke(arg0, arg1);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrioritizedFunc<T0, T1, T2, TR> : IPrioritized
|
||||
{
|
||||
private readonly Func<T0, T1, T2, TR> func;
|
||||
public int Priority { get; set; }
|
||||
|
||||
public PrioritizedFunc(Func<T0, T1, T2, TR> func, int priority = 0)
|
||||
{
|
||||
this.func = func;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
public TR Invoke(T0 arg0, T1 arg1, T2 arg2)
|
||||
{
|
||||
return func.Invoke(arg0, arg1, arg2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user