static int Clear(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UI.Handle obj = (UI.Handle)ToLua.CheckObject(L, 1, typeof(UI.Handle)); obj.Clear(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void OnEnable() { Cache(); if (m_playOnEnable && m_resetOnEnable) { ResetPlay(); } else if (!m_playOnEnable && m_resetOnEnable) { ResetStop(); } else if (!m_playOnEnable && !m_resetOnEnable) { m_handle.Clear();//暂停就好 } else if (m_playOnEnable && !m_resetOnEnable) { if (!m_handle.IsPlaying) { m_handle.Start();//没有运行就运行 } } }
//工具栏 void DrawTopToolbar() { GUILayout.Box("", EditorStyles.toolbar, GUILayout.ExpandWidth(true), GUILayout.Height(hToolBar)); if (Event.current.type == EventType.Repaint) { TopToolbar = GUILayoutUtility.GetLastRect(); } using (new AutoBeginArea(TopToolbar)) { using (new AutoBeginHorizontal()) { if (GUILayout.Button("展开所有", EditorStyles.toolbarButton, GUILayout.Width(50))) { foreach (var h in m_subHandles.m_handles) { h.m_seqIsExpand = true; } } if (GUILayout.Button("收起所有", EditorStyles.toolbarButton, GUILayout.Width(50))) { foreach (var h in m_subHandles.m_handles) { h.m_seqIsExpand = false; } } if (GUILayout.Button("显示所有", EditorStyles.toolbarButton, GUILayout.Width(50))) { foreach (var h in m_subHandles.m_handles) { h.m_seqIsShow = true; } } if (GUILayout.Button("隐藏所有", EditorStyles.toolbarButton, GUILayout.Width(50))) { foreach (var h in m_subHandles.m_handles) { h.m_seqIsShow = false; } } GUILayout.Space(wToolbarSpace); if (GUILayout.Button(EditorGUIUtility.IconContent(m_handle.IsPlaying ? "PauseButton" : "Animation.Play"), EditorStyles.toolbarButton, GUILayout.Width(wToolbarSpace))) { if (m_handle.IsPlaying) { m_handle.Clear(); } else { m_handle.Start(); } } if (GUILayout.Button(EditorGUIUtility.IconContent("Animation.PrevKey", "往前0.1秒"), EditorStyles.toolbarButton, GUILayout.Width(wToolbarSpace))) { CurTime = CurTime - 0.1f; } if (GUILayout.Button(EditorGUIUtility.IconContent("Animation.NextKey", "往后0.1秒"), EditorStyles.toolbarButton, GUILayout.Width(wToolbarSpace))) { CurTime = CurTime + 0.1f; } GUILayout.Space(wToolbarSpace); } } }