Beispiel #1
0
    static int RemoveSubHandle(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(UI.SequenceHandle), typeof(UnityEngine.Component), typeof(UI.Handle), typeof(float)))
            {
                UI.SequenceHandle     obj  = (UI.SequenceHandle)ToLua.ToObject(L, 1);
                UnityEngine.Component arg0 = (UnityEngine.Component)ToLua.ToObject(L, 2);
                UI.Handle             arg1 = (UI.Handle)ToLua.ToObject(L, 3);
                float arg2 = (float)LuaDLL.lua_tonumber(L, 4);
                obj.RemoveSubHandle(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(UI.SequenceHandle), typeof(UnityEngine.Component), typeof(UI.Handle), typeof(UI.Handle)))
            {
                UI.SequenceHandle     obj  = (UI.SequenceHandle)ToLua.ToObject(L, 1);
                UnityEngine.Component arg0 = (UnityEngine.Component)ToLua.ToObject(L, 2);
                UI.Handle             arg1 = (UI.Handle)ToLua.ToObject(L, 3);
                UI.Handle             arg2 = (UI.Handle)ToLua.ToObject(L, 4);
                obj.RemoveSubHandle(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UI.SequenceHandle.RemoveSubHandle"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #2
0
        //下边子处理详细页面
        void DrawBottomSubHandles()
        {
            Handle remove = null;

            using (AutoBeginScrollView a = new AutoBeginScrollView(ScrollBottom, false, false, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
            {
                ScrollBottom = a.Scroll;
                using (new AutoBeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
                {
                    int   idx               = 0;
                    float time              = -1;
                    int   idxTime           = -1;    //第几个时间点,包含不可见的
                    int   row               = 0;     //第几行,可见的
                    int   col               = 0;     //第几列,可见的
                    bool  isDurationInvalid = false; //是不是即时的
                    Color PreviousColor     = GUI.backgroundColor;
                    foreach (var h in this.m_subHandles.m_handles)
                    {
                        //画处理组,大菱形
                        if (!Mathf.Approximately(h.m_delay, time))
                        {
                            idx = 0;
                            ++idxTime;
                            time = h.m_delay;
                            row  = 0;
                        }
                        else
                        {
                            ++idx;
                        }

                        if (h.m_seqIsShow == false)
                        {
                            continue;
                        }

                        //新一列
                        if (row == 0 && h.m_seqIsShow)
                        {
                            if (col != 0)
                            {
                                GUILayout.EndVertical();
                                GUILayout.EndScrollView();
                            }

                            GUI.backgroundColor = col % 2 == 0 ? Color.white : new Color(0.90f, 0.90f, 1f);
                            ScrolBottomCol[col] = GUILayout.BeginScrollView(ScrolBottomCol[col], GUILayout.Width(250), GUILayout.ExpandHeight(true));
                            GUILayout.BeginVertical(EditorStyles.miniButtonMid, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

                            //这一列是不是即时的
                            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                            float old2 = UnityEditor.EditorGUIUtility.labelWidth;
                            UnityEditor.EditorGUIUtility.labelWidth = 50;
                            isDurationInvalid = EditorGUILayout.Toggle("即时", h.m_isDurationInvalid, GUILayout.ExpandWidth(true));
                            if (isDurationInvalid != h.m_isDurationInvalid)
                            {
                                this.m_subHandles.SetDurationInvalid(h.m_delay, isDurationInvalid);
                            }
                            UnityEditor.EditorGUIUtility.labelWidth = old2;
                            GUIStyle style = new GUIStyle();
                            style.richText = true;
                            GUILayout.Label(string.Format("<color=white>索引:<size=14><b><color=maroon>{0}</color></b></size> {1:0.##}</color>", idxTime, h.m_delay), style, GUILayout.Width(60));
                            GUILayout.EndHorizontal();
                            ++col;
                        }


                        GUI.backgroundColor = PreviousColor;
                        GUILayout.BeginVertical(EditorStyles.objectFieldThumb, GUILayout.ExpandWidth(true));
                        GUILayout.Space(5);
                        if (!isDurationInvalid)
                        {
                            //画标题
                            GUILayout.BeginHorizontal();
                            if (GUILayout.Button("隐藏", EditorStyles.miniButtonLeft, GUILayout.Width(50), GUILayout.Height(20)))
                            {
                                h.m_seqIsShow = false;
                            }
                            GUIStyle style = new GUIStyle(EditorStyles.miniButtonMid);
                            style.richText = true;
                            GUILayout.Label(string.Format("<size=14><color=white>{0}{1}</color></size>", h.CurTypeName, h.m_id), style, GUILayout.ExpandWidth(true), GUILayout.Height(20));
                            if (GUILayout.Button("删除", EditorStyles.miniButtonRight, GUILayout.Width(50), GUILayout.Height(20)))
                            {
                                remove = h;
                            }
                            GUILayout.EndHorizontal();

                            //画内容
                            float old = UnityEditor.EditorGUIUtility.labelWidth;
                            UnityEditor.EditorGUIUtility.labelWidth = 50;
                            if (h.CurHandle.OnDrawGo(m_comp, h, "对象"))
                            {
                                h.CurHandle.OnReset(h, false, true);
                            }
                            h.CurHandle.OnDrawMid(m_comp, h, SimpleHandleEditor.OnOpenWnd, true);
                            UnityEditor.EditorGUIUtility.labelWidth = old;
                        }
                        else
                        {
                            //即时处理的话显示得简单点
                            float old = UnityEditor.EditorGUIUtility.labelWidth;
                            UnityEditor.EditorGUIUtility.labelWidth = 50;
                            GUILayout.BeginHorizontal();
                            if (h.CurHandle.OnDrawGo(m_comp, h, h.CurTypeName))
                            {
                                h.CurHandle.OnReset(h, false, true);
                            }
                            if (GUILayout.Button("删除", GUILayout.Width(50), GUILayout.Height(20)))
                            {
                                remove = h;
                            }
                            GUILayout.EndHorizontal();
                            h.CurHandle.OnDrawMin(m_comp, h, SimpleHandleEditor.OnOpenWnd, true);
                            UnityEditor.EditorGUIUtility.labelWidth = old;
                        }
                        GUILayout.Space(5);
                        GUILayout.EndVertical();


                        ++row;
                    }

                    if (col != 0)
                    {
                        GUILayout.EndVertical();
                        GUILayout.EndScrollView();
                    }
                    GUI.backgroundColor = PreviousColor;
                }
            }

            //删除
            if (remove != null)
            {
                m_subHandles.RemoveSubHandle(this.m_comp, this.m_handle, remove);
            }
        }