コード例 #1
0
ファイル: FoldoutPanel.cs プロジェクト: XJINE/Unity_XGUI
        public bool Show(params Action[] actions)
        {
            var previousValue = Value;

            XGUILayout.VerticalLayout(() =>
            {
                var buttonContent = (Value ? "\u25BC " : "\u25BA ") + Title;

                XGUILayout.HorizontalLayout(() =>
                {
                    var expand = !string.IsNullOrEmpty(Title);
                    Value      = Value != GUILayout.Button(buttonContent, FoldoutButtonStyle, GUILayout.ExpandWidth(expand));
                    ButtonFieldAction?.Invoke();
                });

                if (Value)
                {
                    XGUILayout.VerticalLayout(() =>
                    {
                        foreach (var action in actions)
                        {
                            action();
                        }
                    }, FoldoutBoxStyle);
                }
            }, Value && BoxSkin ? GUI.skin.box : null);

            Updated = previousValue != Value;

            return(Value);
        }
コード例 #2
0
ファイル: ScrollPanel.cs プロジェクト: XJINE/Unity_XGUI
        public Vector2 Show(params Action[] actions)
        {
            var previousValue = Value;

            base.ShowTitle();

            var height = Mathf.Min(MaxHeight, Mathf.Max(MinHeight, Height));
            var width  = Mathf.Min(MaxWidth, Mathf.Max(MinWidth, Width));

            XGUILayout.VerticalLayout(() =>
            {
                Value = GUILayout.BeginScrollView(Value, GUILayout.Width(width),
                                                  GUILayout.MinWidth(width),
                                                  GUILayout.MaxWidth(width),
                                                  GUILayout.Height(height));
                foreach (var action in actions)
                {
                    action();
                }

                GUILayout.EndScrollView();
            },
                                      BoxSkin? GUI.skin.box : null, GUILayout.Height(height),
                                      GUILayout.MinHeight(height),
                                      GUILayout.MaxHeight(height));

            Updated = previousValue != Value;

            return(Value);
        }
コード例 #3
0
ファイル: VectorGUI.cs プロジェクト: XJINE/Unity_XGUI
        public override T Show(T value)
        {
            var previousValue = value;

            XGUILayout.VerticalLayout(() =>
            {
                base.ShowTitle();

                XGUILayout.HorizontalLayout(() =>
                {
                    value = ShowComponents(value);
                });
            });

            Updated = !previousValue.Equals(value);

            return(value);
        }