예제 #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;
            }
        }
예제 #2
0
        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());
            }
        }