diff options
| author | chai <chaifix@163.com> | 2021-09-01 19:29:48 +0800 | 
|---|---|---|
| committer | chai <chaifix@163.com> | 2021-09-01 19:29:48 +0800 | 
| commit | 8c519185b0053daa23c5c5978d47baf77c1391b0 (patch) | |
| tree | 72c149df2e9691db3e079c92fb03219c9ddc8e9e /Assets/ActionTool/Editor/ActionPreviewEditor.cs | |
| parent | 21278085eae9c069fcb5cf61fbcdb6ca18f15b69 (diff) | |
*action tool的帧范围
Diffstat (limited to 'Assets/ActionTool/Editor/ActionPreviewEditor.cs')
| -rw-r--r-- | Assets/ActionTool/Editor/ActionPreviewEditor.cs | 21 | 
1 files changed, 10 insertions, 11 deletions
| 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;
 | 
