示例#1
0
    //绘制窗口时调用
    void OnGUI()
    {
        if (m_comp == null || m_handle == null || m_handle.m_type != Handle.Type.sequence)
        {
            this.ShowNotification(new GUIContent("空指针或处理的类型不是序列了。请设置正确后再打开编辑器"));
            return;
        }
        this.RemoveNotification();

        if (m_handle.m_go == null && m_comp.GetComponent <SequenceHandle>() != null)
        {
            m_handle.m_go = m_comp.gameObject;
            EditorUtil.SetDirty(m_comp.gameObject);
        }

        if (m_handle.m_go == null)
        {
            if (GUILayout.Button("原对象上创建一个SequenceHandle", GUILayout.Height(50)))
            {
                m_comp.AddComponentIfNoExist <SequenceHandle>();
                EditorUtil.SetDirty(m_comp.gameObject);
            }
            this.ShowNotification(new GUIContent("找不到SequenceHandle"));
            return;
        }
        //每次都重新获取下吧
        m_seq        = m_handle.CurHandle as HandleSequence;
        m_subHandles = m_handle.m_go.GetComponent <SequenceHandle>();

        //工具栏
        DrawTopToolbar();

        using (new AutoBeginHorizontal())
        {
            //左边序列控件属性区
            DrawLeftInfo();

            //右边时间轴
            GUIStyle style    = GUI.skin.box;//先收窄box的边距
            GUIStyle boxStyle = new GUIStyle(style);
            boxStyle.margin = new RectOffset(0, 0, 2, 2);
            GUI.skin.box    = boxStyle;
            DrawRightTimeLine();
            GUI.skin.box = style;
        }

        //下边子处理详细页面
        DrawBottomSubHandles();


        //ProcessHotkeys();*/
    }