Example #1
0
 public static String SafeFormat <T1, T2, T3, T4, T5>(String format, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
 {
     if (format != null)
     {
         try {
             return(String.Format(format, arg1, arg2, arg3, arg4, arg5));
         } catch (Exception e) {
             UDebug.LogException(e);
         }
     }
     return(String.Empty);
 }
Example #2
0
 public static String SafeFormat(String format, params object[] args)
 {
     if (format != null && args != null)
     {
         try {
             return(String.Format(format, args));
         } catch (Exception e) {
             UDebug.LogException(e);
         }
     }
     return(String.Empty);
 }
Example #3
0
 public static String SafeFormat <T1, T2>(String format, T1 arg1, T2 arg2)
 {
     if (format != null)
     {
         try {
             return(String.Format(format, arg1, arg2));
         } catch (Exception e) {
             UDebug.LogException(e);
         }
     }
     return(String.Empty);
 }
Example #4
0
        public void Invoke()
        {
            var list_ = m_calleeList;

            if (list_ != null)
            {
                try {
                    ++m_depth;
                    for (int i = 0; i < list_.Count; ++i)
                    {
                        if (list_[i] != null)
                        {
                            try {
                                list_[i]();
                            } catch (Exception e) {
                                UDebug.LogException(e);
                            }
                        }
                    }
                } finally {
                    --m_depth;
                    if (m_sparseIndex > 0 && m_depth == 0 && list_.Count > 0)
                    {
                        var count       = list_.Count;
                        var removeCount = 0;
                        for (var i = m_sparseIndex - 1; i < count; ++i)
                        {
                            if (list_[i] == null)
                            {
                                var newCount = i++;
                                for ( ; i < count; ++i)
                                {
                                    if (list_[i] != null)
                                    {
                                        list_[newCount++] = list_[i];
                                    }
                                }
                                removeCount = count - newCount;
                                list_.RemoveRange(newCount, removeCount);
                                break;
                            }
                        }
                        m_sparseIndex = 0;
                    }
                }
            }
        }