Ejemplo n.º 1
0
        public virtual void OnGUI()
        {
            if (isVisible)
            {
                OnDrawWindow();
            }

            if (Input.anyKeyDown && ((options & Options.IsPopup) == Options.IsPopup))
            {
                if ((Event.current.keyCode == 0))
                {
                    var pos = Input.mousePosition;
                    pos.y = Screen.height - pos.y;
                    if (((m_draw != null) && !m_draw.rect.Contains(pos)))
                    {
                        this.Close();
                    }
                }
                else
                {
                    this.Close();
                }
            }

            if (m_draw != null)
            {
                m_draw.enabled = isVisible &&
                                 (((options & Options.InFreeCamera) == Options.InFreeCamera) ? true : !MUISkin.comeraController.m_freeCamera);

                if (Title == "")
                {
                    m_titleHeight = 8;
                }
                else
                {
                    m_titleHeight = MUISkin.CalcTextHeight();
                }

                if (m_resize != null)
                {
                    var ratio = UIView.GetAView().ratio;
                    m_resize.relativePosition = new Vector3(m_draw.resizeRect.x * ratio, m_draw.resizeRect.y * ratio, 0);
                }
            }
        }
Ejemplo n.º 2
0
        public void UpdateWindow()
        {
            if (Title == "")
            {
                m_titleHeight = 8;
            }
            else
            {
                m_titleHeight = MUISkin.CalcTextHeight();
            }

            if (m_drag != null)
            {
                m_drag.width = width;
                if ((options & Options.FullDragabled) == Options.FullDragabled)
                {
                    float h = height;
                    if (m_resize != null)
                    {
                        if (height < 50)
                        {
                            m_drag.width = width - m_resize.width - 2;
                        }
                        else
                        {
                            h = height - m_resize.height - 2;
                        }
                    }
                    m_drag.height = h;
                }
                else
                {
                    if (m_titleHeight > 0)
                    {
                        m_drag.height = m_titleHeight - 2;
                    }
                    else
                    {
                        m_drag.height = 20;
                    }
                }
            }

            if (m_resize != null)
            {
                m_resize.relativePosition = new Vector3(width - m_resize.width - 1, height - m_resize.height - 1);
            }

            //this.m_MinSize = minSize;

            if (m_draw != null)
            {
                var ratio = UIView.GetAView().ratio;
                m_draw.rect = new Rect(absolutePosition.x / ratio, absolutePosition.y / ratio, width / ratio, height / ratio);
                if (m_resize != null)
                {
                    m_draw.resizeRect = new Rect(m_draw.rect.width - MUISkin.config.resizeButtonWidth - 3, m_draw.rect.height - MUISkin.config.resizeButtonWidth + 4,
                                                 MUISkin.config.resizeButtonWidth + 2, MUISkin.config.resizeButtonWidth - 5);
                }
            }
        }