示例#1
0
        /// <summary>
        /// Closes the Navigation Field. (Optional) Draws additional controls on top of the content.
        /// </summary>
        public static void EndNavigationField(bool showNativeControls = true)
        {
            Gl.EndArea();             //end offset area
            if (lastDrawnNavField != null)
            {
                if (showNativeControls)
                {
                    if (G.Button(new U.Rect(lastDrawnNavField.backupRect.width - lastDrawnNavField.border - 23, 5, 20, 20), new U.GUIContent("+", "Center View")))
                    {
                        lastDrawnNavField.CenterView();
                    }
                }

#if UNITY_EDITOR
                G.Button(new U.Rect(0, 0, lastDrawnNavField.backupRect.width, lastDrawnNavField.backupRect.height), "", "Label");                 //force hot control
#endif
            }

            Gl.EndArea();             //end field viewport area

            if (lastDrawnNavField != null)
            {
                lastDrawnNavField.DragUpdate();
            }

            lastDrawnNavField = null;
        }
示例#2
0
        /// <summary>
        /// Opens the navigation field drawer.
        /// </summary>
        public static void BeginNavigationField(ref NavigationFieldData navField, U.Vector2?restriction = null)
        {
            lastDrawnNavField = navField;

            U.Rect _fieldRect = FindLayoutAreaRect(ref navField.backupRect, navField.border);

            BeginColorPocket(navField.backgroundColor);
            Gl.BeginArea(_fieldRect, "", "Box");
            EndColorPocket();

            navField.DrawBackground();
            navField.DragUpdate();

            U.Vector2 _restriction = restriction ?? (new U.Vector2(_fieldRect.width, _fieldRect.height) - navField.scrollView);
            Gl.BeginArea(new U.Rect(navField.scrollView.x, navField.scrollView.y, _restriction.x, _restriction.y));
        }