예제 #1
0
        public void TriggerEvent(string eventType)
        {
            Delegate @delegate;

            if (Routers.TryGetValue(eventType, out @delegate))
            {
                Delegate[] invocationList = @delegate.GetInvocationList();
                for (int i = 0; i < invocationList.Length; i++)
                {
                    Action action = invocationList [i] as Action;
                    if (action == null)
                    {
                        throw new EventException(string.Format("TriggerEvent {0} error: types of parameters are not match.", eventType));
                    }
                    try
                    {
                        action();
                    }
                    catch (Exception ex)
                    {
                        UnuLogger.LogError(ex.StackTrace);
                    }
                }
            }
        }