예제 #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            BaseEvent <T1> myTarget = (BaseEvent <T1>)target;

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Invoke value:");
                DrawInvokeValue(ref m_editorInvokeValue);
            }
            EditorGUILayout.EndHorizontal();
            if (GUILayout.Button("Invoke"))
            {
                myTarget.Invoke(m_editorInvokeValue);
            }

            FieldInfo field = typeof(BaseEvent <T1>).GetField("m_actions", BindingFlags.NonPublic | BindingFlags.Instance);

            if (field == null)
            {
                return;
            }

            object actions = field.GetValue(myTarget);

            if (actions != null)
            {
                CustomScriptableEventDrawerUtils.DrawInvocationList(((Action <T1>)actions).GetInvocationList());
            }
        }
예제 #2
0
        private void DrawOnValueUpdated()
        {
            EditorGUILayout.Separator();
            FieldInfo field = target.GetType().GetField("m_onValueUpdated", BindingFlags.NonPublic | BindingFlags.Instance);

            if (field == null)
            {
                return;
            }

            object actions = field.GetValue(target);

            if (actions != null)
            {
                object delegateObjects = actions.GetType().GetMethod("GetInvocationList").Invoke(actions, null);
                CustomScriptableEventDrawerUtils.DrawInvocationList(delegateObjects as Delegate[]);
            }
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            Core.Events.BaseEvent myTarget = (Core.Events.BaseEvent)target;
            if (GUILayout.Button("Invoke"))
            {
                myTarget.Invoke();
            }

            FieldInfo field = typeof(Core.Events.BaseEvent).GetField("m_actions", BindingFlags.NonPublic | BindingFlags.Instance);

            if (field == null)
            {
                return;
            }

            object actions = field.GetValue(myTarget);

            if (actions != null)
            {
                CustomScriptableEventDrawerUtils.DrawInvocationList(((Action)actions).GetInvocationList());
            }
        }