Exemple #1
0
        public void DoGUIWindow()
        {
            if (isOpen && isEnable)
            {
                var pos = rect.position;
                rect = RGUI.ResizableWindow(GetHashCode(), rect,
                                            (id) =>
                {
                    var buttonSize = new Vector2(40f, 15f);
                    var buttonPos  = new Vector2(rect.size.x - buttonSize.x, 2f);
                    var buttonRect = new Rect(buttonPos, buttonSize);
                    if (GUI.Button(buttonRect, "✕", RGUIStyle.flatButton))
                    {
                        CloseWindow();
                    }

                    foreach (var func in GetGUIFuncs())
                    {
                        func();
                    }
                    GUI.DragWindow();

                    if (Event.current.type == EventType.Used)
                    {
                        WindowInvoker.SetFocusedWindow(this);
                    }
                }
                                            , name, RGUIStyle.darkWindow);

                isMoved |= pos != rect.position;
            }
        }
        public void DoGUI()
        {
            if (dicChanged)
            {
                list       = dic.Values.ToList();
                dicChanged = false;
            }

            if (isWindow)
            {
                var style    = RGUIStyle.darkWindow;
                var minWidth = 0f;
                if (!string.IsNullOrEmpty(name))
                {
                    tmpContent.text = name;
                    minWidth        = style.CalcSize(tmpContent).x;
                }

                rect = RGUI.ResizableWindow(GetHashCode(), rect, (id) =>
                {
                    list.ForEach(l => l.DoGUI());
                    if (isDraggable)
                    {
                        GUI.DragWindow();
                    }
                },
                                            name, RGUIStyle.darkWindow, GUILayout.MinWidth(minWidth));
            }
            else
            {
                list.ForEach(l => l.DoGUI());
            }
        }
Exemple #3
0
        float DrawSlide(float v, string label)
        {
            var tmp = RGUI.PrefixLabelSetting.width;

            RGUI.PrefixLabelSetting.width = 16f;
            v = RGUI.Slider(v, label);

            RGUI.PrefixLabelSetting.width = tmp;

            return(v);

            /*
             * using (new GUILayout.HorizontalScope())
             * {
             *  GUILayout.Label(label, GUILayout.Width(16f));
             *  v = GUILayout.HorizontalSlider(v, 0f, 1f);
             *  float.TryParse(GUILayout.TextField(v.ToString("0.000"), GUILayout.Width(40f)), out v); ;
             * }
             *
             * return v;
             */
        }