public static void DrawGUI(FoCsControlPanel owner)
        {
            using (Disposables.VerticalScope(FoCsGUI.Styles.Unity.Box, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true))) {
                FoCsGUI.Layout.Label("List Limiter", FoCsGUI.Styles.Unity.BoldLabel);
                FoCsGUI.Layout.InfoBox("Careful, Disabling this may cause lag in larger lists. This is also the case when its active, but it is reduced. This is caused by the way the Unity Editor is drawn.");

                UnityReorderableListProperty.LimitingEnabled =
                    FoCsGUI.Layout.Toggle(UnityReorderableListProperty.LimitingEnabled? Enabled : Disabled, UnityReorderableListProperty.LimitingEnabled);

                using (var cc = Disposables.ChangeCheck()) {
                    FoCsGUI.Layout.Label("List Range", FoCsGUI.Styles.Unity.BoldLabel);
                    FoCsGUI.Layout.InfoBox("Change max number of displayed items in the lists. DEFAULT = 25");
                    var num = FoCsGUI.Layout.IntField("Total Display Count", UnityReorderableListProperty.ListLimiter.TOTAL_VISIBLE_COUNT);

                    if (cc.changed)
                    {
                        UnityReorderableListProperty.ListLimiter.TOTAL_VISIBLE_COUNT = num;
                    }
                }

                FoCsGUI.Layout.Label();
                FoCsGUI.Layout.Label();
                ShowDebug = FoCsGUI.Layout.Toggle(ShowDebug? DebugEnabled : DebugDisabled, ShowDebug);

                if (ShowDebug)
                {
                    ReorderableListCacheTab.DrawGUI(owner);
                }
            }
        }
示例#2
0
        public static eInt DrawDisabledPropertyWithMenu(bool disabled, Rect position, SerProp property, GUICon label, GUICon[] Options, int active, bool autoLabelField = false)
        {
            Action <Rect> draw = rect => {
                using (Disposables.SetIndent(0))
                    PropertyField(rect.Edit(RectEdit.ChangeY(-1), RectEdit.SetHeight(SingleLine)), property, GUICon.none, property.hasVisibleChildren, autoLabelField);
            };

            return(DrawActionWithMenu(disabled, position, draw, label, Options, active));
        }
示例#3
0
        private static eProp PropFieldMaster(Rect pos, SerProp prop, GUICon cont, bool includeChildren, AttributeCheck ignoreCheck, bool autoLabelField = false)
        {
            if (!autoLabelField)
            {
                return(PropDraw(pos, prop, cont, includeChildren, ignoreCheck));
            }

            using (Disposables.LabelFieldSetWidth(pos.width * 0.4f))
                return(PropDraw(pos, prop, cont, includeChildren, ignoreCheck));
        }
        public static void DrawGUI(FoCsControlPanel owner)
        {
            using (Disposables.HorizontalScope()) {
                FoCsGUI.Layout.Label("Type of Object", GUILayout.Width(Screen.width * 0.4f));
                FoCsGUI.Layout.Label("Method of copy");
            }

            foreach (var copyMode in CopyPasteUtility.TypeCopyData)
            {
                using (Disposables.HorizontalScope()) {
                    FoCsGUI.Layout.Label(copyMode.Key.ToString(), GUILayout.Width(Screen.width * 0.4f));
                    FoCsGUI.Layout.Label(copyMode.Value.ToString());
                }
            }
        }
示例#5
0
            private static eBool PropertyFieldMaster(GUICon label, SerializedProperty property, bool includeChildren, params GUILayOpt[] options)
            {
                if (property.propertyType == SerializedPropertyType.Quaternion)
                {
                    using (var cc = Disposables.ChangeCheck()) {
                        QuaternionPropertyDrawer.Draw(GetControlRect(false, options), property, label);

                        return(GUIEvent.Create(GUILayoutUtility.GetLastRect(), cc.changed));
                    }
                }

                var val = EditorGUILayout.PropertyField(property, includeChildren, options);

                return(GUIEvent.Create(GUILayoutUtility.GetLastRect(), val));
            }
        public static void DrawGUI(FoCsControlPanel owner)
        {
            using (Disposables.VerticalScope()) {
                foreach (var reorderableListStorage in UnityReorderableListStorage.storages)
                {
                    foreach (var reorderableListProperty in reorderableListStorage.URLPList)
                    {
                        using (Disposables.VerticalScope(FoCsGUI.Styles.Unity.Box)) {
                            using (Disposables.HorizontalScope()) {
                                FoCsGUI.Layout.Label("Key");
                                FoCsGUI.Layout.Label(reorderableListProperty.Key);
                            }

                            using (Disposables.HorizontalScope()) {
                                FoCsGUI.Layout.Label("Limiter");
                                FoCsGUI.Layout.Label(reorderableListProperty.Value.Limiter != null? reorderableListProperty.Value.Limiter.ToString() : "NULL");
                            }
                        }
                    }
                }
            }
        }
示例#7
0
        public static eInt DrawActionWithMenu(bool disabled, Rect position, Action <Rect> draw, GUICon label, GUICon[] Options, int active)
        {
            var propRect  = new Rect(position);
            var labelRect = new Rect(position);
            var menuRect  = new Rect(position);

            labelRect     = labelRect.Edit(RectEdit.SubtractY(1), RectEdit.SetWidth(EditorGUIUtility.labelWidth));
            menuRect.xMin = menuRect.xMax - MENU_BUTTON_SIZE;
            menuRect.xMax = position.xMax;
            propRect.xMin = labelRect.xMax;
            propRect.xMax = menuRect.xMin - 2;
            Label(labelRect, label);

            using (Disposables.DisabledScope(disabled))
                draw.Trigger(propRect);

            using (Disposables.SetIndent(0)) {
                var index = EditorGUI.Popup(menuRect, GUICon.none, active, Options, Styles.InLineOptionsMenu);

                return(GUIEvent.Create(position, index));
            }
        }
 public static void DrawGUI(FoCsControlPanel owner)
 {
     using (Disposables.HorizontalScope(FoCsGUI.Styles.Unity.Box, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)))
         FoCsGUI.Layout.Label("FoCs Info");
 }
        public void DrawContextMenuButtons()
        {
            if (contextData.Count == 0)
            {
                return;
            }

            FoCsGUI.Layout.Space(4);
            FoCsGUI.Layout.LabelField("Context Menu:", FoCsGUI.Styles.Unity.BoldLabel);
            //TODO: Refine ContextMenuLayoutAttribute Logic
            var rectRows = new Dictionary <int, Rect>();

            foreach (var kv in contextData)
            {
                var enabledState = GUI.enabled;
                var isEnabled    = true;

                if (kv.Value.Validate != null)
                {
                    isEnabled = (bool)kv.Value.Validate.Invoke(target, null);
                }

                GUI.enabled = isEnabled;

                if (kv.Value.Function != null)
                {
                    if (kv.Value.Layout.HasValue)
                    {
                        var  layout = kv.Value.Layout.Value;
                        Rect rect;

                        if (rectRows.ContainsKey(layout.Column))
                        {
                            rect = rectRows[layout.Column];
                        }
                        else
                        {
                            FoCsGUI.Layout.Space();
                            rect = GUILayoutUtility.GetLastRect();
                            rectRows.Add(layout.Column, rect);
                        }

                        using (var scope = Disposables.RectHorizontalScope(layout.AmountPerLine, rect)) {
                            if (layout.Row != 0)
                            {
                                scope.GetNext(layout.Row);
                            }

                            if (FoCsGUI.Button(scope.GetNext(), kv.Key))
                            {
                                InvokeMethod(kv);
                            }
                        }
                    }
                    else
                    {
                        if (FoCsGUI.Layout.Button(kv.Key))
                        {
                            InvokeMethod(kv);
                        }
                    }
                }

                GUI.enabled = enabledState;
            }
        }