|
@@ -398,5 +398,44 @@ namespace KairoEngine.Core
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region String_Bool_Event
|
|
|
+
|
|
|
+ public static Dictionary<string, System.Action<string, bool>> listStringBool = new Dictionary<string, System.Action<string, bool>>();
|
|
|
+
|
|
|
+ public static void StartListening(string title, System.Action<string, bool> listener)
|
|
|
+ {
|
|
|
+ System.Action<string, bool> action = null;
|
|
|
+ if (listStringBool.TryGetValue(title, out action))
|
|
|
+ {
|
|
|
+ action += listener;
|
|
|
+ listStringBool[title] = action;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ action += listener;
|
|
|
+ listStringBool.Add(title, action);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void StopListening(string title, System.Action<string, bool> listener)
|
|
|
+ {
|
|
|
+ System.Action<string, bool> action = null;
|
|
|
+ if (listStringBool.TryGetValue(title, out action))
|
|
|
+ {
|
|
|
+ action -= listener;
|
|
|
+ listStringBool[title] = action;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Trigger(string title, string text, bool value)
|
|
|
+ {
|
|
|
+ System.Action<string, bool> action = null;
|
|
|
+ if (listStringBool.TryGetValue(title, out action))
|
|
|
+ {
|
|
|
+ if(action != null) action(text, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|