除了充盈都做完了
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SoftCircuits.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -7,7 +8,7 @@ namespace SLSFramework.General
|
||||
{
|
||||
public static class DictionaryExtension
|
||||
{
|
||||
public static void Invoke(this IDictionary<string, EventUnit> dictionary)
|
||||
public static void Invoke(this IDictionary<string, PrioritizedAction> dictionary)
|
||||
{
|
||||
foreach (var action in dictionary.Values)
|
||||
{
|
||||
@@ -15,7 +16,7 @@ namespace SLSFramework.General
|
||||
}
|
||||
}
|
||||
|
||||
public static void Invoke<T>(this IDictionary<string, EventUnit<T>> dictionary, T arg)
|
||||
public static void Invoke<T>(this IDictionary<string, PrioritizedAction<T>> dictionary, T arg)
|
||||
{
|
||||
foreach (var action in dictionary.Values)
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace SLSFramework.General
|
||||
}
|
||||
}
|
||||
|
||||
public static void Invoke<T1, T2>(this IDictionary<string, EventUnit<T1, T2>> dictionary, T1 arg1, T2 arg2)
|
||||
public static void Invoke<T1, T2>(this IDictionary<string, PrioritizedAction<T1, T2>> dictionary, T1 arg1, T2 arg2)
|
||||
{
|
||||
foreach (var action in dictionary.Values)
|
||||
{
|
||||
@@ -82,6 +83,29 @@ namespace SLSFramework.General
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckAndEffectDictionaryExtension
|
||||
{
|
||||
public static List<Func<bool>> GetChecks(this IDictionary<string, PrioritizedCheckAndEffect> dictionary)
|
||||
{
|
||||
return dictionary.Values.Select(checkAndEffect => checkAndEffect.check).ToList();
|
||||
}
|
||||
|
||||
public static List<Action> GetEffects(this IDictionary<string, PrioritizedCheckAndEffect> dictionary)
|
||||
{
|
||||
return dictionary.Values.Select(checkAndEffect => checkAndEffect.effect).ToList();
|
||||
}
|
||||
|
||||
public static void InvokeIfAnyConditionChecked(this IDictionary<string, PrioritizedCheckAndEffect> dictionary)
|
||||
{
|
||||
List<Func<bool>> checks = dictionary.Values.Select(checkAndEffect => checkAndEffect.check).ToList();
|
||||
List<Action> effects = dictionary.Values.Select(checkAndEffect => checkAndEffect.effect).ToList();
|
||||
if (checks.Any())
|
||||
{
|
||||
effects.ForEach(effect => effect.Invoke());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class OrderedDictionaryExtension
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user