Example #1
0
        public sealed override void Draw(GUIEvent guievent)
        {
            m_hedaerRect.Z = m_size.X;
            m_pos.X        = (int)m_pos.X;
            m_pos.Y        = (int)m_pos.Y;

            var rect = new Vector4(m_pos, m_size.X, m_size.Y);

            GUILayout.BeginContainer(rect, GUIStyle.Current.BackgroundColor, GUIOption.Border());
            {
                bool headerover = GUIUtility.RectContainsCheck(GUILayout.GetRectAbsolute(m_hedaerRect), GUI.Event.Pointer);
                GUILayout.Rect(m_hedaerRect, headerover ? GUIStyle.Current.ColorActive : GUIStyle.Current.ColorActiveD);
                GUILayout.BeginHorizontal();
                GUILayout.Text(m_title);
                if (m_dialogCloseable)
                {
                    GUILayout.Indent((int)(rect.Z - GUILayout.CurrentLayout.Offset.X - 24));
                    if (GUILayout.Button("X", GUIStyle.Current.ColorActiveD, GUIOption.Width(23)))
                    {
                        OnDestroy();
                    }
                }
                GUILayout.EndHorizontal();

                var contentrect = GUILayout.Context.currentArea.Rect;
                contentrect.Y += m_hedaerRect.W;
                contentrect.Z -= 1;
                contentrect.W -= (m_hedaerRect.W + 1);

                GUILayout.BeginContainer(contentrect);
                {
                    OnDraw();
                }
                GUILayout.EndContainer();

                //for optimize
                bool onmove = false;
                if (m_dialogMoveable && m_dragMove.OnDrag(headerover))
                {
                    m_pos += GUI.Event.DragOffset;

                    m_pos.X = Mathf.Clamp(m_pos.X, 0, GUI.Context.baseRect.Z);
                    m_pos.Y = Mathf.Clamp(m_pos.Y, 0, GUI.Context.baseRect.W);
                    onmove  = true;
                }
                if (m_dialogRezieable && !onmove)
                {
                    var rectResize = GUILayout.Context.currentArea.Rect;
                    rectResize.Y += (rectResize.W - 3);
                    rectResize.X += rectResize.Z - 3;
                    rectResize.Z  = 6;
                    rectResize.W  = 6;

                    if (m_dragResizeHV.OnDrag(rectResize))
                    {
                        m_size  += GUI.Event.DragOffset;
                        m_size.Y = Mathf.Clamp(m_size.Y, m_dialogMinSize.Y, m_dialogMaxSize.Y);
                        m_size.X = Mathf.Clamp(m_size.X, m_dialogMinSize.X, m_dialogMaxSize.X);
                    }
                }
            }

            //var grect = new Vector4(0, 0, 100, 30);
            //GUI.DrawRect(grect, RigelColor.Green);
            //GUI.DrawText(grect, "GUITEXT", RigelColor.White);
            //GUI.Button(grect, "GUIBUTTON");
            //GUI.DrawBorder(grect, 2, RigelColor.Green);

            GUILayout.EndContainer();
        }
Example #2
0
 public override void Draw(GUIEvent guievent)
 {
 }
Example #3
0
 public abstract void Draw(GUIEvent guievent);
Example #4
0
 public virtual void Draw(GUIEvent guievent)
 {
     GUI.SetDrawTarget(m_drawTarget);
 }