예제 #1
0
	void DisplayDisplayOptionsButton()
	{
		if( GUILayout.Button( "Display Options", EditorStyles.toolbarPopup ) )
		{
			List<string> items = new List<string>();
			List<int> selected = new List<int>();

			for( int i = 0; i < (int)TodoListDisplayOptions.Count; ++i )
			{
				if( i == (int)TodoListDisplayOptions.Count - 1 )
				{
					items.Add( "" );
				}

				items.Add( TodoList.InsertSpaceForCamelCase( ( (TodoListDisplayOptions)i ).ToString() ) );

				if( GetDisplayOption( (TodoListDisplayOptions)i ) )
				{
					if( i == (int)TodoListDisplayOptions.Count - 1 )
					{
						i++;
					}

					selected.Add( i );
				}
			}

			object[] param = new object[ 5 ];
			param[ 0 ] = new Rect( 100, 0, 1, 1 );
			param[ 1 ] = items.ToArray();
			param[ 2 ] = selected.ToArray();
			param[ 3 ] = new EditorUtility.SelectMenuItemFunction( ToggleDisplayOptionsDelegate );
			param[ 4 ] = null;

			typeof( EditorUtility ).InvokeMember( "DisplayCustomMenu", BindingFlags.InvokeMethod | BindingFlags.NonPublic, null, typeof( EditorUtility ), param );
		}
	}
    public override void OnPreviewSettings()
    {
        if(SelectedTemplate != null)
        {
            GUIStyle SettingsLabel = new GUIStyle(EditorStyles.miniLabel);
            SettingsLabel.alignment = TextAnchor.UpperRight;
            SettingsLabel.margin.top = 2;

            GUILayout.Label("Preview:",SettingsLabel);
            view = EditorGUILayout.Popup(view,views,PreviewPopup);

            if(GUILayout.Button("Display Options",PreviewPopup))
            {
                List<string> items = new List<string>(DisplayOptions.Keys);
                List<int> selected = new List<int>();
                for(int i = 0; i < DisplayOptions.Count; i++)
                {
                    if(DisplayOptions[items[i]])
                        selected.Add(i);
                }

                object[] param = new object[ 5 ];
                param[ 0 ] = new Rect( Screen.width - 100, PreviewBounds.y, 1, 1 ); //PreviewBounds
                param[ 1 ] = items.ToArray();
                param[ 2 ] = selected.ToArray();
                param[ 3 ] = new EditorUtility.SelectMenuItemFunction( SetDisplayOptionsDelegate );
                param[ 4 ] = null;

                typeof( EditorUtility ).InvokeMember( "DisplayCustomMenu", BindingFlags.InvokeMethod | BindingFlags.NonPublic, null, typeof( EditorUtility ), param );
            }
            GUILayout.Space (2);
        }
    }
예제 #3
0
 public static void DisplayCustomMenu(Rect position, GUIContent[] options, int selected, EditorUtility.SelectMenuItemFunction callback, object userData, bool showHotkey)
 {
     int[] selected2 = new int[]
     {
         selected
     };
     string[] array = new string[options.Length];
     for (int i = 0; i < options.Length; i++)
     {
         array[i] = options[i].text;
     }
     EditorUtility.DisplayCustomMenu(position, array, selected2, callback, userData, showHotkey);
 }
예제 #4
0
 internal static void DisplayCustomMenu(Rect position, string[] options, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData)
 {
     EditorUtility.DisplayCustomMenu(position, options, selected, callback, userData, false);
 }
예제 #5
0
 private static extern void INTERNAL_CALL_Private_DisplayCustomMenu(ref Rect screenPosition, string[] options, int[] enabled, int[] separator, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData, bool showHotkey);
예제 #6
0
 static void DisplayCustomMenu(Rect r, string[] menuNames, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData)
 {
     displayCustomMenu.Invoke(null, new object[] { r, menuNames, selected, callback, userData });
 }
예제 #7
0
 private static void Internal_DisplayCustomMenu(Rect screenPosition, string[] options, int[] enabled, int[] separator, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData, bool showHotkey)
 {
     EditorUtility.Private_DisplayCustomMenu(screenPosition, options, enabled, separator, selected, callback, userData, showHotkey);
 }
예제 #8
0
        internal static void DisplayCustomMenuWithSeparators(Rect position, string[] options, bool[] enabled, bool[] separator, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData, bool showHotkey)
        {
            Vector2 vector = GUIUtility.GUIToScreenPoint(new Vector2(position.x, position.y));

            position.x = vector.x;
            position.y = vector.y;
            int[] array  = new int[options.Length];
            int[] array2 = new int[options.Length];
            for (int i = 0; i < options.Length; i++)
            {
                array[i]  = ((!enabled[i]) ? 0 : 1);
                array2[i] = ((!separator[i]) ? 0 : 1);
            }
            EditorUtility.Internal_DisplayCustomMenu(position, options, array, array2, selected, callback, userData, showHotkey);
            EditorUtility.ResetMouseDown();
        }
예제 #9
0
 internal static void DisplayCustomMenuWithSeparators(Rect position, string[] options, bool[] enabled, bool[] separator, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData)
 {
     EditorUtility.DisplayCustomMenuWithSeparators(position, options, enabled, separator, selected, callback, userData, false);
 }
예제 #10
0
 internal static void DisplayCustomMenu(Rect position, string[] options, bool[] enabled, int[] selected, EditorUtility.SelectMenuItemFunction callback, object userData, bool showHotkey)
 {
     bool[] separator = new bool[options.Length];
     EditorUtility.DisplayCustomMenuWithSeparators(position, options, enabled, separator, selected, callback, userData, showHotkey);
 }
예제 #11
0
	public void MultipleChoicePopup( string desc, string[] NameValues, ref bool[] SelectedValues, int width, bool addHr = true )
	{
		List<string> layers = new List<string>();
		List<int> selectedIndices = new List<int>();

		/*if( Event.current.type != EventType.MouseDown && Event.current.type != EventType.ExecuteCommand )
		{
			layers.Add( desc );
		}*/

		for( int i = 0; i < NameValues.Length; ++i )
		{
			//string prefix = "[  ] ";
			if( SelectedValues[ i ] == true )
			{
				//prefix = "[X] ";

				int a = i;

				if( addHr )
				{
					if( i >= 1 )
					{
						a++;
					}
				}

				selectedIndices.Add( a );
			}

			layers.Add( /*prefix + */NameValues[ i ] );
		}

		if( addHr )
		{
			layers.Insert( 1, "" );
		}

		bool preChange = GUI.changed;

		GUI.changed = false;

		GUIStyle dropdownStyle = new GUIStyle( EditorStyles.toolbarPopup );
		dropdownStyle.alignment = TextAnchor.MiddleLeft;

		//newSelected = EditorGUILayout.Popup( newSelected, layers.ToArray(), dropdownStyle, GUILayout.Width( width ) );
		if( GUILayout.Button( desc, dropdownStyle, GUILayout.Width( width ) ) )
		{
			int left = Screen.width - 185 - GetFieldSize( TodoListFieldTypes.DueDate ) - GetFieldSize( TodoListFieldTypes.DueTime );

			if( desc == "Developer" )
			{
				left += 50;
			}
			else if( desc == "Category" )
			{
				left -= GetFieldSize( TodoListFieldTypes.Developer );
				left += 50;
			}
			else if( desc == "Sprint" )
			{
				left -= GetFieldSize( TodoListFieldTypes.Category );
				left -= GetFieldSize( TodoListFieldTypes.Developer );
				left += 50;
			}

			else if( desc == "Priority" )
			{
				left -= GetFieldSize( TodoListFieldTypes.Category );
				left -= GetFieldSize( TodoListFieldTypes.Developer );
				left -= GetFieldSize( TodoListFieldTypes.Sprint );
				left += 50;
			}
			else if( desc == "Status" )
			{
				left -= GetFieldSize( TodoListFieldTypes.Category );
				left -= GetFieldSize( TodoListFieldTypes.Developer );
				left -= GetFieldSize( TodoListFieldTypes.Priority );
				left -= GetFieldSize( TodoListFieldTypes.Sprint );
			}

			object[] param = new object[ 5 ];
			param[ 0 ] = new Rect( left, 64, 1, 1 );
			param[ 1 ] = layers.ToArray();
			param[ 2 ] = selectedIndices.ToArray();

			if( desc == "Category" )
			{
				param[ 3 ] = new EditorUtility.SelectMenuItemFunction( ToggleCategoriesDelegate );
			}
			else if( desc == "Developer" )
			{
				param[ 3 ] = new EditorUtility.SelectMenuItemFunction( ToggleDevelopersDelegate );
			}
			else if( desc == "Priority" )
			{
				param[ 3 ] = new EditorUtility.SelectMenuItemFunction( TogglePriorityDelegate );
			}
			else if( desc == "Sprint" )
			{
				param[ 3 ] = new EditorUtility.SelectMenuItemFunction( ToggleSprintDelegate );
			}
			else
			{
				param[ 3 ] = new EditorUtility.SelectMenuItemFunction( ToggleStatusDelegate );
			}

			param[ 4 ] = null;

			typeof( EditorUtility ).InvokeMember( "DisplayCustomMenu", BindingFlags.InvokeMethod | BindingFlags.NonPublic, null, typeof( EditorUtility ), param );
		}

		GUI.changed = preChange;
	}