Esempio n. 1
0
        static IEnumerable <Error> checkUnityEvent(
            IErrorFactory errorFactory, FieldHierarchyStr fieldHierarchy, UnityEventBase evt
            )
        {
            UnityEventReflector.rebuildPersistentCallsIfNeeded(evt);

            var persistentCalls       = evt.__persistentCalls();
            var listPersistentCallOpt = persistentCalls.calls;

            foreach (var listPersistentCall in listPersistentCallOpt)
            {
                var index = 0;
                foreach (var persistentCall in listPersistentCall)
                {
                    if (persistentCall.isValid)
                    {
                        if (evt.__findMethod(persistentCall).isNone)
                        {
                            yield return(errorFactory.unityEventInvalidMethod(fieldHierarchy, index));
                        }
                    }
                    else
                    {
                        yield return(errorFactory.unityEventInvalid(fieldHierarchy, index));
                    }

                    index++;
                }
            }
        }
Esempio n. 2
0
        static Option <Error> checkUnityEvent(
            UnityEventBase evt, Object component, string propertyName, CheckContext context
            )
        {
            UnityEventReflector.rebuildPersistentCallsIfNeeded(evt);

            var persistentCalls       = evt.__persistentCalls();
            var listPersistentCallOpt = persistentCalls.calls;

            if (listPersistentCallOpt.isNone)
            {
                return(Option <Error> .None);
            }
            var listPersistentCall = listPersistentCallOpt.get;

            var index = 0;

            foreach (var persistentCall in listPersistentCall)
            {
                index++;

                if (persistentCall.isValid)
                {
                    if (evt.__findMethod(persistentCall).isNone)
                    {
                        return(Error.unityEventInvalidMethod(component, propertyName, index, context).some());
                    }
                }
                else
                {
                    return(Error.unityEventInvalid(component, propertyName, index, context).some());
                }
            }

            return(Option <Error> .None);
        }