Beispiel #1
0
        private void DoActiveTargetsGUI()
        {
            bool hasPaintTarget = GridPaintingState.scenePaintTarget != null;

            using (new EditorGUI.DisabledScope(!hasPaintTarget || GridPaintingState.validTargets == null))
            {
                GUILayout.Label(Styles.activeTargetLabel, GUILayout.Width(k_ActiveTargetLabelWidth));
                GUIContent content = GUIContent.Temp(hasPaintTarget ? GridPaintingState.scenePaintTarget.name : "Nothing");
                if (EditorGUILayout.DropdownButton(content, FocusType.Passive, EditorStyles.popup, GUILayout.Width(k_ActiveTargetDropdownWidth)))
                {
                    int index        = hasPaintTarget ? Array.IndexOf(GridPaintingState.validTargets, GridPaintingState.scenePaintTarget) : 0;
                    var menuData     = new GridPaintTargetsDropdown.MenuItemProvider();
                    var flexibleMenu = new GridPaintTargetsDropdown(menuData, index, null, SelectTarget, k_ActiveTargetDropdownWidth);
                    PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), flexibleMenu);
                }
            }
        }
Beispiel #2
0
        private void DoActiveTargetsGUI()
        {
            bool flag = GridPaintingState.scenePaintTarget != null;

            using (new EditorGUI.DisabledScope(!flag || GridPaintingState.validTargets == null))
            {
                GUILayout.Label(GridPaintPaletteWindow.Styles.activeTargetLabel, new GUILayoutOption[]
                {
                    GUILayout.Width(90f)
                });
                GUIContent content = GUIContent.Temp((!flag) ? "Nothing" : GridPaintingState.scenePaintTarget.name);
                if (EditorGUILayout.DropdownButton(content, FocusType.Passive, EditorStyles.popup, new GUILayoutOption[]
                {
                    GUILayout.Width(130f)
                }))
                {
                    int selectionIndex = (!flag) ? 0 : Array.IndexOf <GameObject>(GridPaintingState.validTargets, GridPaintingState.scenePaintTarget);
                    GridPaintTargetsDropdown.MenuItemProvider itemProvider = new GridPaintTargetsDropdown.MenuItemProvider();
                    GridPaintTargetsDropdown windowContent = new GridPaintTargetsDropdown(itemProvider, selectionIndex, null, new Action <int, object>(this.SelectTarget), 130f);
                    PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), windowContent);
                }
            }
        }