Пример #1
0
        private static void GeneratePopUpForType(GenericMenu menu, UnityEngine.Object target, bool useFullTargetName, SerializedProperty listener, Type[] delegateArgumentsTypes)
        {
            List <TesityEventDrawer.ValidMethodMap> list = new List <TesityEventDrawer.ValidMethodMap>();
            string text = (!useFullTargetName) ? target.GetType().Name : target.GetType().FullName;
            bool   flag = false;

            if (delegateArgumentsTypes.Length != 0)
            {
                TesityEventDrawer.GetMethodsForTargetAndMode(target, delegateArgumentsTypes, list, TestityPersistentListenerMode.EventDefined);
                if (list.Count > 0)
                {
                    menu.AddDisabledItem(new GUIContent(text + "/Dynamic " + string.Join(", ", (
                                                                                             from e in delegateArgumentsTypes
                                                                                             select TesityEventDrawer.GetTypeName(e)).ToArray <string>())));
                    TesityEventDrawer.AddMethodsToMenu(menu, listener, list, text);
                    flag = true;
                }
            }
            list.Clear();
            TesityEventDrawer.GetMethodsForTargetAndMode(target, new Type[]
            {
                typeof(float)
            }, list, TestityPersistentListenerMode.Float);
            TesityEventDrawer.GetMethodsForTargetAndMode(target, new Type[]
            {
                typeof(int)
            }, list, TestityPersistentListenerMode.Int);
            TesityEventDrawer.GetMethodsForTargetAndMode(target, new Type[]
            {
                typeof(string)
            }, list, TestityPersistentListenerMode.String);
            TesityEventDrawer.GetMethodsForTargetAndMode(target, new Type[]
            {
                typeof(bool)
            }, list, TestityPersistentListenerMode.Bool);
            TesityEventDrawer.GetMethodsForTargetAndMode(target, new Type[]
            {
                typeof(UnityEngine.Object)
            }, list, TestityPersistentListenerMode.Object);
            TesityEventDrawer.GetMethodsForTargetAndMode(target, new Type[0], list, TestityPersistentListenerMode.Void);
            if (list.Count > 0)
            {
                if (flag)
                {
                    menu.AddItem(new GUIContent(text + "/ "), false, null);
                }
                if (delegateArgumentsTypes.Length != 0)
                {
                    menu.AddDisabledItem(new GUIContent(text + "/Static Parameters"));
                }
                TesityEventDrawer.AddMethodsToMenu(menu, listener, list, text);
            }
        }