Exemplo n.º 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();*/
    }
Exemplo n.º 2
0
    public void Start(Handle h)
    {
        if (h.m_go == null)
        {
            return;
        }
        SequenceHandle seq = h.m_go.GetComponent <SequenceHandle>();

        if (seq == null)
        {
            return;
        }
        foreach (var sub in seq.m_handles)
        {
            sub.Start();
        }
    }
Exemplo n.º 3
0
    public void SetTime(Handle h, float time)
    {
        if (h.m_go == null)
        {
            return;
        }
        SequenceHandle seq = h.m_go.GetComponent <SequenceHandle>();

        if (seq == null)
        {
            return;
        }
        foreach (var sub in seq.m_handles)
        {
            sub.SetTime(time, false, false, true);
        }
    }
Exemplo n.º 4
0
    //左边序列控件属性区
    void DrawLeftInfo()
    {
        using (new AutoBeginVertical(EditorStyles.objectFieldThumb, GUILayout.Width(wLeft), GUILayout.Height(hMiddle)))
        {
            using (new AutoLabelWidth(100))
            {
                if (m_seq.DrawGoField <SequenceHandle>(m_comp, m_handle, "子处理的外部对象"))
                {
                    m_subHandles = m_handle.m_go.GetComponent <SequenceHandle>();
                }

                EditorGUI.BeginChangeCheck();
                float delay      = EditorGUILayout.FloatField("延迟", m_handle.m_delay);
                float duration   = EditorGUILayout.FloatField("持续时间", m_handle.m_duration);
                float rate       = EditorGUILayout.FloatField("倍速", m_handle.m_rate);
                bool  isRealtime = EditorGUILayout.Toggle("真实时间", m_handle.m_isRealtime);
                int   playType   = EditorGUILayout.Popup("类型", (int)m_handle.m_playType, Handle.PlayTypeName);
                int   endCount   = m_handle.m_endCount;
                if (m_handle.IsEndCountValid)
                {
                    endCount = UnityEditor.EditorGUILayout.IntField("循环次数", m_handle.m_endCount);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    if (m_handle.m_isRealtime != isRealtime || m_handle.m_rate != rate)
                    {
                        m_handle.m_rate       = rate;
                        m_handle.m_isRealtime = isRealtime;
                        this.m_subHandles.SyncHandle(this.m_comp, this.m_handle);
                        EditorUtil.SetDirty(m_comp);
                        return;
                    }
                    EditorUtil.RegisterUndo("Handle Change", m_comp);
                    m_handle.m_delay    = delay;
                    m_handle.m_duration = duration;
                    m_handle.m_playType = (Handle.PlayType)playType;
                    m_handle.m_endCount = endCount;
                    EditorUtil.SetDirty(m_comp);
                }
            }
        }
    }