Пример #1
0
 public void SendNoticeData(System.Action <JToken[]> callback, bool isProcessed = true)
 {
     if (!callback.IsNull() && isNotice)
     {
         callback.Invoke(notice.Results);
     }
     IsProcessed = isProcessed;
 }
 public static bool SafeInvoke <T1, T2, T3, T4>(this System.Action <T1, T2, T3, T4> h, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
 {
     if (!h.IsNull())
     {
         h.Invoke(arg1, arg2, arg3, arg4);
         return(true);
     }
     return(false);
 }
 public static bool SafeInvoke <T1, T2>(this System.Action <T1, T2> h, T1 arg1, T2 arg2)
 {
     if (!h.IsNull())
     {
         h.Invoke(arg1, arg2);
         return(true);
     }
     return(false);
 }
 public static bool SafeInvoke(this System.Action h)
 {
     if (!h.IsNull())
     {
         h.Invoke();
         return(true);
     }
     return(false);
 }
 public static bool SafeInvoke <T>(this System.Action <T> h, T arg)
 {
     if (!h.IsNull())
     {
         h.Invoke(arg);
         return(true);
     }
     return(false);
 }
Пример #6
0
 public void DoForAll(System.Action <T> action)
 {
     if (!action.IsNull())
     {
         for (var i = 0; i < array.Length; i++)
         {
             action.Invoke(array[i]);
         }
     }
 }
Пример #7
0
 public static void DoForOnlyChilds(this UnityEngine.Transform root, System.Action <UnityEngine.Transform> action)
 {
     if (!action.IsNull())
     {
         foreach (UnityEngine.Transform child in root)
         {
             action(child);
             child.DoForOnlyChilds(action);
         }
     }
 }
Пример #8
0
 public static void DoForAllHierarchy(this UnityEngine.Transform root, System.Action <UnityEngine.Transform> action)
 {
     if (!action.IsNull())
     {
         action(root);
         foreach (UnityEngine.Transform child in root)
         {
             child.DoForAllHierarchy(action);
         }
     }
 }
 public static void DoForAll <T>(this T[] a, System.Action <T> action, bool forwardOrder = true)
 {
     if (!a.IsNull() && !action.IsNull())
     {
         var start  = forwardOrder ? 0 : (a.Length - 1);
         var offset = forwardOrder ? 1 : -1;
         for (var i = start; (i >= 0) && (i < a.Length); i += offset)
         {
             action.Invoke(a[i]);
         }
     }
 }
Пример #10
0
 public static void DoTimes(System.Func <int> times, System.Action <int> action, bool forwardOrder = true)
 {
     if (!times.IsNull() && !action.IsNull())
     {
         var start  = forwardOrder ? 0 : (times.Invoke() - 1);
         var offset = forwardOrder ? 1 : -1;
         for (var i = start; (i >= 0) && (i < times.Invoke()); i += offset)
         {
             action.Invoke(i);
         }
     }
 }
Пример #11
0
 public void SendResultData <T>(System.Action <T> resolve, System.Action <System.Exception> reject, bool isProcessed = true)
 {
     if (!resolve.IsNull() && isResult)
     {
         resolve.Invoke(result.GetData <T>());
     }
     else
     if (!reject.IsNull() && isError)
     {
         reject.Invoke(error.ToException());
     }
     IsProcessed = isProcessed;
 }
Пример #12
0
 public static void DrawEditListDialogInLine(int count, Action addCallback, Action removeLastCallback = null, Action removeAllCallbacl = null)
 {
     DrawInLine(() => {
         DrawButton("Add", addCallback, EditorStyles.miniButton, true, Color.green);
         if ((count > 1) && !removeLastCallback.IsNull())
         {
             DrawButton("Remove Last", removeLastCallback, EditorStyles.miniButton, true, Color.red);
         }
         if ((count > 0) && !removeAllCallbacl.IsNull())
         {
             DrawButton("Remove All", removeAllCallbacl, EditorStyles.miniButton, true, Color.red);
         }
     });
 }