Exemplo n.º 1
0
        void HandleGlobalEventInvoke(object sender, GlobalEventEventArgs args)
        {
            GlobalEvent globalEvent = args.globalEvent;

            if (m_globalEventMap.ContainsKey(globalEvent))
            {
                m_globalEventMap[globalEvent].Invoke(globalEvent);

                if (OnEventInvoke != null)
                {
                    OnEventInvoke.Invoke(this, new GlobalEventEventArgs()
                    {
                        globalEvent = globalEvent
                    });
                }
            }
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GlobalEvent globalEvent = (GlobalEvent)serializedObject.targetObject;

            Rect rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight);

            EditorGUI.BeginDisabledGroup(true);
            EditorGUI.ObjectField(new Rect(rect.x, rect.y, rect.width - 60, rect.height), globalEvent, typeof(GlobalEvent), false);
            EditorGUI.EndDisabledGroup();

            if (GUI.Button(new Rect(rect.xMax - 80, rect.y, 80, rect.height), "Invoke", EditorStyles.miniButtonRight))
            {
                globalEvent.Invoke();
            }

            EditorGUILayout.Space();

            RenderDescription();

            serializedObject.ApplyModifiedProperties();
        }