From 8c519185b0053daa23c5c5978d47baf77c1391b0 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 1 Sep 2021 19:29:48 +0800 Subject: =?UTF-8?q?*action=20tool=E7=9A=84=E5=B8=A7=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/ActionTool/Editor/ActionPreviewEditor.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'Assets/ActionTool/Editor/ActionPreviewEditor.cs') diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs index 6ff60ed5..5bb2e435 100644 --- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs +++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs @@ -307,7 +307,9 @@ namespace ActionTool GUI.Label(new Rect(xr, y, 510, 15), ActionManager.actionData.curAnimFrame.ToString("f2"), styles.textMiddleBold); GUI.Label(new Rect(xl + 150, y, 105, 15), "Normalized Time:", styles.textMiddle); GUI.Label(new Rect(xr + 150, y, 510, 15), ActionManager.actionData.curAnimTimeNormal.ToString("f2"), styles.textMiddleBold); - y += 15; + GUI.Label(new Rect(xl + 150 * 2, y, 105, 15), "Event Frame:", styles.textMiddle); + GUI.Label(new Rect(xr + 150 + 125, y, 510, 15), ((int)ActionManager.actionData.curAnimFrame).ToString(), styles.textMiddleBold); + y += 15; } @@ -409,7 +411,7 @@ namespace ActionTool float y = iy; float contentHeight = ActionManager.eventAndBoxCount * kFrameHeight + 40; - Rect content = new Rect(0, 0, action.totalFrame * kFrameWidth + 30, contentHeight); + Rect content = new Rect(0, 0, ((int)action.totalFrame + 1)* kFrameWidth + 30, contentHeight); float height = 300; if (position.height - kTimeLineViewYOffset > contentHeight + 15) height = contentHeight + 15; @@ -476,20 +478,20 @@ namespace ActionTool ActionData action = ActionManager.actionData; int sampleCount = (int)action.totalFrame + 1; - Rect bgRect = new Rect(kTimeLineViewXOffset, y, action.totalFrame * kFrameWidth, ActionManager.eventAndBoxCount * kFrameHeight); + Rect bgRect = new Rect(kTimeLineViewXOffset, y, sampleCount * kFrameWidth, ActionManager.eventAndBoxCount * kFrameHeight); GUI.Box(bgRect, ""); Color lineColor = new Color(0.3f, 0.3f, 0.3f); Color lineColor2 = new Color(0.5f, 0.5f, 0.5f); for (int i = 0; i < ActionManager.eventAndBoxCount + 1; i++) { - ui.DrawHorizontalLineFast(y + i * kFrameHeight, kTimeLineViewXOffset, kTimeLineViewXOffset + action.totalFrame * kFrameWidth, lineColor); + ui.DrawHorizontalLineFast(y + i * kFrameHeight, kTimeLineViewXOffset, kTimeLineViewXOffset + sampleCount * kFrameWidth, lineColor); } for(int i = 0; i <= sampleCount; ++i) { Color c = i % 5 == 0 ? lineColor2 : lineColor; float x = kTimeLineViewXOffset + i * kFrameWidth; - x = Mathf.Clamp(x, kTimeLineViewXOffset, kTimeLineViewXOffset + action.totalFrame * kFrameWidth); + //x = Mathf.Clamp(x, kTimeLineViewXOffset, kTimeLineViewXOffset + action.totalFrame * kFrameWidth); ui.DrawVerticalLineFast(x, y, y + ActionManager.eventAndBoxCount * kFrameHeight, c); } @@ -548,11 +550,6 @@ namespace ActionTool if (select) { ActionManager.OnSelectBox(box, index); - - //float length = action.totalFrame * kFrameWidth; - //ui.DrawHorizontalLineFast(y, kTimeLineViewXOffset, kTimeLineViewXOffset + length, c * 0.7f); - //ui.DrawHorizontalLineFast(y + kFrameHeight, kTimeLineViewXOffset, kTimeLineViewXOffset + length, c * 0.7f); - //ui.DrawVerticalLineFast(kTimeLineViewXOffset + length + 1, y, y + kFrameHeight, c * 0.7f); } else if(selected && !select) { @@ -608,6 +605,7 @@ namespace ActionTool if (e.button != 1 || !e.isMouse || e.type != EventType.MouseDown) return; ActionData action = ActionManager.actionData; + int sampleCount = (int)action.totalFrame + 1; float y = m_GridY + ActionManager.kMaxEventsPerFrame * kFrameHeight; Vector2 position = e.mousePosition; int boxCount = ActionManager.animationData.GetBoxesCount(); @@ -855,8 +853,9 @@ namespace ActionTool return; ActionData action = ActionManager.actionData; + int sampleCount = (int)action.totalFrame + 1; Vector2 position = Event.current.mousePosition; - Rect eventRegion = new Rect(kTimeLineViewXOffset, m_GridY, action.totalFrame * kFrameWidth, TimelineEventProxy.kMaxEventsPerFrame * kFrameHeight); + Rect eventRegion = new Rect(kTimeLineViewXOffset, m_GridY, sampleCount * kFrameWidth, TimelineEventProxy.kMaxEventsPerFrame * kFrameHeight); if (!eventRegion.Contains(position)) return; -- cgit v1.1-26-g67d0