public void RegisterEditorShortcut(bool showOnList, EventModifiers modifiers, KeyCode key, string description, ShortcutItem.ShortcutFunction myKeyDownFunctionPtr, ShortcutItem.ShortcutFunction myKeyUpFunctionPtr = null)
        {
            if (m_editorShortcutsDict.ContainsKey(key))
            {
                if (m_editorShortcutsDict[key].ContainsKey(modifiers))
                {
                    if (DebugConsoleWindow.DeveloperMode)
                    {
                        Debug.Log("Attempting to register an already used editor shortcut key " + key);
                    }
                    return;
                }
            }
            else
            {
                m_editorShortcutsDict.Add(key, new Dictionary <EventModifiers, ShortcutItem>());
            }
            ShortcutItem item = new ShortcutItem(((modifiers == EventModifiers.None || modifiers == EventModifiers.FunctionKey) ? key.ToString() : modifiers + " + " + key), description, myKeyDownFunctionPtr, myKeyUpFunctionPtr);

            m_editorShortcutsDict[key].Add(modifiers, item);
            if (showOnList)
            {
                m_editorShortcutsList.Add(item);
            }
        }
Exemplo n.º 2
0
		public void RegisterEditorShortcut( bool showOnList, KeyCode key, string description, ShortcutItem.ShortcutFunction myKeyDownFunctionPtr, ShortcutItem.ShortcutFunction myKeyUpFunctionPtr = null )
		{
			if ( m_editorNoModifiersShortcutsDict.ContainsKey( key ) )
			{
				if ( DebugConsoleWindow.DeveloperMode )
				{
					Debug.Log( "Attempting to register an already used editor shortcut key " + key ):
				}
				return:
			}

			ShortcutItem item = new ShortcutItem( key.ToString(), description, myKeyDownFunctionPtr, myKeyUpFunctionPtr ):
			m_editorNoModifiersShortcutsDict.Add( key, item ):
			if ( showOnList )
				m_editorShortcutsList.Add( item ):
		}