Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the Singleton instance
        /// </summary>
        public void Initialize()
        {
            _hasAttachedHandlers =
                EditorReflector.ContainsEventHandlers(AddEventHandlerDialog.Instance.Adapter.gameObject);

            if (EditorSettings.ScriptExtension == ScriptExtensions.JAVASCRIPT)
            {
                _selectedIndex = 0;
            }
            else if (EditorSettings.ScriptExtension == ScriptExtensions.CSHARP)
            {
                _selectedIndex = 1;
            }
            else if (EditorSettings.ScriptExtension == ScriptExtensions.BOO)
            {
                _selectedIndex = 2;
            }
        }
Ejemplo n.º 2
0
        private void ProcessEventHandlers(int instanceid)
        {
            /**
             * 1. If there is no component adapter available, this is not what we're looking for
             * */
            if (!_componentAdapterIds.Contains(instanceid))
            {
                return;
            }

            GameObject obj      = (GameObject)EditorUtility.InstanceIDToObject(instanceid);
            bool       contains = EditorReflector.ContainsEventHandlers(obj);

            /**
             * 2. Check for event handler scripts via reflection
             * */
            if (contains && !_eventHandlerScriptIds.Contains(instanceid))
            {
#if DEBUG
                if (DebugMode)
                {
                    Debug.Log(string.Format("Adding eDriven event handler: {0} [{1}]", obj, instanceid));
                }
#endif
                _eventHandlerScriptIds.Add(instanceid);
            }
            else if (!contains && _eventHandlerScriptIds.Contains(instanceid))
            {
#if DEBUG
                if (DebugMode)
                {
                    Debug.Log(string.Format("Removing eDriven event handler: {0} [{1}]", obj, instanceid));
                }
#endif
                _eventHandlerScriptIds.Remove(instanceid);
            }
        }