summaryrefslogtreecommitdiff
path: root/Assets/ActionTool/Editor/ActionPreviewEditor.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-07-12 10:12:53 +0800
committerchai <chaifix@163.com>2021-07-12 10:12:53 +0800
commit404297b51c1c71e6bb428aa199743b7fbf8db493 (patch)
treea0c3f7ba4cac452b3f97cfd740884915890324cc /Assets/ActionTool/Editor/ActionPreviewEditor.cs
parentd373067ce7982c14040274f9eab8ad9a1c50c5f1 (diff)
*misc
Diffstat (limited to 'Assets/ActionTool/Editor/ActionPreviewEditor.cs')
-rw-r--r--Assets/ActionTool/Editor/ActionPreviewEditor.cs65
1 files changed, 16 insertions, 49 deletions
diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs
index 8e620d54..8c9d8f05 100644
--- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs
+++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs
@@ -234,7 +234,7 @@ namespace ActionTool
void GUI_Slider( ref float y)
{
ActionData action = ActionManager.actionData;
- Rect rect = new Rect(kTimeLineViewXOffset - 4, y, action.totalFrame * kFrameWidth + 8, 15);
+ Rect rect = new Rect(kTimeLineViewXOffset - 4, y, action.totalFrame * kFrameWidth + 7, 15);
float t = GUI.HorizontalSlider(rect,action.curAnimTimeNormal, 0, 1);
if(t != action.curAnimTimeNormal)
{
@@ -261,14 +261,6 @@ namespace ActionTool
Rect bgRect = new Rect(kTimeLineViewXOffset, y, action.totalFrame * kFrameWidth, ActionManager.eventAndBoxCount * kFrameHeight);
GUI.Box(bgRect, "");
- ui.defaultUIMaterail.SetPass(0);
- GL.PushMatrix();
- GL.LoadPixelMatrix();
- bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
- if (bWin)
- GL.Begin(GL.QUADS);
- else
- GL.Begin(GL.LINES);
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++)
@@ -282,8 +274,6 @@ namespace ActionTool
x = Mathf.Clamp(x, kTimeLineViewXOffset, kTimeLineViewXOffset + action.totalFrame * kFrameWidth);
ui.DrawVerticalLineFast(x, y, y + ActionManager.eventAndBoxCount * kFrameHeight, c);
}
- GL.PopMatrix();
- GL.End();
y += ActionManager.eventAndBoxCount * kFrameHeight;
}
@@ -294,18 +284,8 @@ namespace ActionTool
ActionData action = ActionManager.actionData;
Rect bgRect = new Rect(kTimeLineViewXOffset, y, action.totalFrame * kFrameWidth, ActionManager.eventAndBoxCount * kFrameHeight);
ui.defaultUIMaterail.SetPass(0);
- GL.PushMatrix();
- GL.LoadPixelMatrix();
- bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
- if (bWin)
- GL.Begin(GL.QUADS);
- else
- GL.Begin(GL.LINES);
ui.DrawVerticalLineFast(kTimeLineViewXOffset + bgRect.width * action.curAnimTimeNormal, y, y + ActionManager.eventAndBoxCount * kFrameHeight, Color.red);
-
- GL.PopMatrix();
- GL.End();
}
void GUI_Events()
@@ -353,20 +333,10 @@ namespace ActionTool
{
ActionManager.OnSelectBox(box);
- ui.defaultUIMaterail.SetPass(0);
- GL.PushMatrix();
- GL.LoadPixelMatrix();
- bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
- if (bWin)
- GL.Begin(GL.QUADS);
- else
- GL.Begin(GL.LINES);
- 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);
- GL.PopMatrix();
- GL.End();
+ //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)
{
@@ -397,9 +367,16 @@ namespace ActionTool
{
float length = (frameIndex - prevIndex - 1) * kFrameWidth;
Rect region = new Rect(kTimeLineViewXOffset + (prevIndex + 1) * kFrameWidth, y, length, kFrameHeight);
- EditorGUI.DrawRect(region, c * 0.4f);
- }
- if (frame.active)
+ float animFrame = action.curAnimFrame;
+ Color col = c * 0.4f;
+ //if (ActionManager.IsPlay)
+ //{
+ bool highlight = action.curAnimFrame >= prevIndex && action.curAnimFrame < frameIndex;
+ col = highlight ? c * 0.6f : c * 0.4f;
+ //}
+ EditorGUI.DrawRect(region, col);
+ }
+ if (frame.active)
prevIndex = frameIndex;
else
prevIndex = -1;
@@ -409,7 +386,6 @@ namespace ActionTool
GUI.color = prevColor;
}
- GenericMenu _newFrameMenu;
void DrawBoxFrameMenuItem()
{
Event e = Event.current;
@@ -434,7 +410,7 @@ namespace ActionTool
param.frame = frame;
if(ActionManager.colliderData != box)
ActionManager.OnSelectBox(box);
- _newFrameMenu = new GenericMenu();
+ GenericMenu _newFrameMenu = new GenericMenu();
_newFrameMenu.AddItem(new GUIContent("New Frame"), false, ActionManager.AddNewBoxFrame, param);
_newFrameMenu.AddItem(new GUIContent("Delete"), false, ActionManager.DeleteBoxFrame, param);
_newFrameMenu.ShowAsContext();
@@ -448,19 +424,10 @@ namespace ActionTool
void GUI_DrawSeperateLine(float x, float y, float height)
{
ui.defaultUIMaterail.SetPass(0);
- GL.PushMatrix();
- GL.LoadPixelMatrix();
- bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
- if (bWin)
- GL.Begin(GL.QUADS);
- else
- GL.Begin(GL.LINES);
Color lineColor = new Color(0.3f, 0.3f, 0.3f);
Color lineColor2 = new Color(0.1f, 0.1f, 0.1f);
ui.DrawVerticalLineFast(x, y, y +height, lineColor2);
ui.DrawVerticalLineFast(x+1, y, y +height, lineColor);
- GL.PopMatrix();
- GL.End();
}
void GUI_Toolbar_NewHurtBox(ref float x, ref float y)