diff options
author | chai <chaifix@163.com> | 2021-07-12 10:12:53 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-07-12 10:12:53 +0800 |
commit | 404297b51c1c71e6bb428aa199743b7fbf8db493 (patch) | |
tree | a0c3f7ba4cac452b3f97cfd740884915890324cc | |
parent | d373067ce7982c14040274f9eab8ad9a1c50c5f1 (diff) |
*misc
-rw-r--r-- | Assets/ActionTool/Editor/ActionColliderEditor.cs | 6 | ||||
-rw-r--r-- | Assets/ActionTool/Editor/ActionEditorStyles.cs | 9 | ||||
-rw-r--r-- | Assets/ActionTool/Editor/ActionEditorUI.cs | 71 | ||||
-rw-r--r-- | Assets/ActionTool/Editor/ActionManager.cs | 3 | ||||
-rw-r--r-- | Assets/ActionTool/Editor/ActionPreviewEditor.cs | 65 | ||||
-rw-r--r-- | Assets/Data/AnimationData/Erika/SuperKickCombo.asset | 10 | ||||
-rw-r--r-- | Assets/Data/AnimationData/Erika/Take 001.asset | 73 | ||||
-rw-r--r-- | Assets/Scripts/Unit/Collider/ColliderData.cs | 3 |
8 files changed, 145 insertions, 95 deletions
diff --git a/Assets/ActionTool/Editor/ActionColliderEditor.cs b/Assets/ActionTool/Editor/ActionColliderEditor.cs index 0c312806..d75fd8fc 100644 --- a/Assets/ActionTool/Editor/ActionColliderEditor.cs +++ b/Assets/ActionTool/Editor/ActionColliderEditor.cs @@ -62,13 +62,13 @@ namespace ActionTool GUILayout.Space(10);
- Color prevColor = GUI.color;
- GUI.color = Color.red;
+ Color prevColor = GUI.backgroundColor;
+ GUI.backgroundColor = Color.red;
if (GUILayout.Button("Delete"))
{
ActionManager.DeleteCurFrame();
}
- GUI.color = prevColor;
+ GUI.backgroundColor = prevColor;
if (GUI.changed)
{
diff --git a/Assets/ActionTool/Editor/ActionEditorStyles.cs b/Assets/ActionTool/Editor/ActionEditorStyles.cs index fd940b33..dc68da8d 100644 --- a/Assets/ActionTool/Editor/ActionEditorStyles.cs +++ b/Assets/ActionTool/Editor/ActionEditorStyles.cs @@ -14,6 +14,7 @@ namespace ActionTool public GUIStyle keyFrameButton;
Texture2D m_SelectIcon;
+ Texture2D m_KeyFrameIcon;
private static ActionEditorStyles s_instance;
public static ActionEditorStyles Get()
@@ -31,7 +32,9 @@ namespace ActionTool m_SelectIcon = (Texture2D)Resources.Load<Texture2D>("select_white");
m_SelectIcon.filterMode = FilterMode.Point;
- InitStyle(out textBold, GUI.skin.label, s => {
+ m_KeyFrameIcon = EditorGUIUtility.FindTexture("animationkeyframe");
+
+ InitStyle(out textBold, GUI.skin.label, s => {
s.fontStyle = FontStyle.Bold;
});
InitStyle(out selectObj, GUI.skin.button, s => {
@@ -46,11 +49,11 @@ namespace ActionTool });
InitStyle(out boxToggle, EditorStyles.miniButtonLeft, s => {
s.fontSize = 8;
- s.normal.textColor = Color.white;
+ s.normal.textColor = Color.white;
s.onNormal.textColor = Color.white;
s.active.textColor = Color.white;
s.onActive.textColor = Color.white;
- });
+ });
InitStyle(out keyFrameButton, GUI.skin.button, s => {
s.fontSize = 8;
});
diff --git a/Assets/ActionTool/Editor/ActionEditorUI.cs b/Assets/ActionTool/Editor/ActionEditorUI.cs index f04c10ea..91ff9cad 100644 --- a/Assets/ActionTool/Editor/ActionEditorUI.cs +++ b/Assets/ActionTool/Editor/ActionEditorUI.cs @@ -31,41 +31,46 @@ namespace ActionTool public void DrawVerticalLineFast(float x, float minY, float maxY, Color color)
{
- bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
- if (bWin)
- {
- GL.Color(color);
- GL.Vertex(new Vector3(x - 0.5f, minY, 0f));
- GL.Vertex(new Vector3(x + 0.5f, minY, 0f));
- GL.Vertex(new Vector3(x + 0.5f, maxY, 0f));
- GL.Vertex(new Vector3(x - 0.5f, maxY, 0f));
- }
- else
- {
- GL.Color(color);
- GL.Vertex(new Vector3(x, minY, 0f));
- GL.Vertex(new Vector3(x, maxY, 0f));
- }
- }
+ // GL画线在GenericMenu弹出来时会有问题
+ //bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
+ //if (bWin)
+ //{
+ // GL.Color(color);
+ // GL.Vertex(new Vector3(x - 0.5f, minY, 0f));
+ // GL.Vertex(new Vector3(x + 0.5f, minY, 0f));
+ // GL.Vertex(new Vector3(x + 0.5f, maxY, 0f));
+ // GL.Vertex(new Vector3(x - 0.5f, maxY, 0f));
+ //}
+ //else
+ //{
+ // GL.Color(color);
+ // GL.Vertex(new Vector3(x, minY, 0f));
+ // GL.Vertex(new Vector3(x, maxY, 0f));
+ //}
+ Rect rect = new Rect(x-0.5f, minY, 1, maxY - minY);
+ EditorGUI.DrawRect(rect, color);
+ }
- public void DrawHorizontalLineFast(float y, float minX, float maxX, Color color)
+ public void DrawHorizontalLineFast(float y, float minX, float maxX, Color color)
{
- bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
- if (bWin)
- {
- GL.Color(color);
- GL.Vertex(new Vector3(minX, y - 0.5f, 0f));
- GL.Vertex(new Vector3(minX, y + 0.5f, 0f));
- GL.Vertex(new Vector3(maxX, y + 0.5f, 0f));
- GL.Vertex(new Vector3(maxX, y - 0.5f, 0f));
- }
- else
- {
- GL.Color(color);
- GL.Vertex(new Vector3(minX, y, 0f));
- GL.Vertex(new Vector3(maxX, y, 0f));
- }
- }
+ //bool bWin = Application.platform == RuntimePlatform.WindowsEditor;
+ //if (bWin)
+ //{
+ // GL.Color(color);
+ // GL.Vertex(new Vector3(minX, y - 0.5f, 0f));
+ // GL.Vertex(new Vector3(minX, y + 0.5f, 0f));
+ // GL.Vertex(new Vector3(maxX, y + 0.5f, 0f));
+ // GL.Vertex(new Vector3(maxX, y - 0.5f, 0f));
+ //}
+ //else
+ //{
+ // GL.Color(color);
+ // GL.Vertex(new Vector3(minX, y, 0f));
+ // GL.Vertex(new Vector3(maxX, y, 0f));
+ //}
+ Rect rect = new Rect(minX, y - 0.5f, maxX - minX, 1);
+ EditorGUI.DrawRect(rect, color);
+ }
public void SelectObject(Object obj)
{
diff --git a/Assets/ActionTool/Editor/ActionManager.cs b/Assets/ActionTool/Editor/ActionManager.cs index 89e04c80..396e0342 100644 --- a/Assets/ActionTool/Editor/ActionManager.cs +++ b/Assets/ActionTool/Editor/ActionManager.cs @@ -328,7 +328,8 @@ namespace ActionTool var data = frame.collider;
if(data != null)
{
- data.AddFrame(frameIndex);
+ var frameData = data.AddFrame(frameIndex);
+ OnSelectColliderFrame(frameData);
}
}
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)
diff --git a/Assets/Data/AnimationData/Erika/SuperKickCombo.asset b/Assets/Data/AnimationData/Erika/SuperKickCombo.asset index b4fea728..aadb1c60 100644 --- a/Assets/Data/AnimationData/Erika/SuperKickCombo.asset +++ b/Assets/Data/AnimationData/Erika/SuperKickCombo.asset @@ -18,7 +18,15 @@ MonoBehaviour: hurtBoxes: - type: 1 pivot: 0 - frames: [] + frames: + - frame: 0 + active: 1 + position: {x: 0, y: 0, z: 0} + size: {x: 1, y: 1, z: 0.5} + - frame: 56 + active: 1 + position: {x: 0, y: 0, z: 0} + size: {x: 1, y: 1, z: 0.5} hitBoxes: - type: 0 pivot: 1 diff --git a/Assets/Data/AnimationData/Erika/Take 001.asset b/Assets/Data/AnimationData/Erika/Take 001.asset index 70429638..61f6845a 100644 --- a/Assets/Data/AnimationData/Erika/Take 001.asset +++ b/Assets/Data/AnimationData/Erika/Take 001.asset @@ -38,7 +38,7 @@ MonoBehaviour: - frame: 22 active: 1 position: {x: 0, y: 0, z: 0} - size: {x: 1, y: 0.76, z: 0.5} + size: {x: 1, y: 0.75, z: 0.5} - frame: 24 active: 1 position: {x: 0, y: 0, z: 0} @@ -50,11 +50,27 @@ MonoBehaviour: - frame: 40 active: 1 position: {x: 0, y: 0, z: 0} - size: {x: 1, y: 1.3, z: 0.5} + size: {x: 1, y: 1.16, z: 0.5} + - frame: 41 + active: 1 + position: {x: 0, y: 0, z: 0} + size: {x: 1, y: 0.78, z: 0.5} + - frame: 42 + active: 1 + position: {x: 0, y: 0, z: 0} + size: {x: 1, y: 0.95, z: 0.5} + - frame: 43 + active: 1 + position: {x: 0, y: 0, z: 0} + size: {x: 1, y: 1.07, z: 0.5} - frame: 45 active: 1 position: {x: 0, y: 0, z: 0} size: {x: 1, y: 0.61, z: 0.5} + - frame: 53 + active: 1 + position: {x: 0, y: 0, z: 0} + size: {x: 1, y: 1, z: 0.5} - frame: 82 active: 1 position: {x: 0, y: 0, z: 0} @@ -62,10 +78,59 @@ MonoBehaviour: hitBoxes: - type: 0 pivot: 1 - frames: [] + frames: + - frame: 11 + active: 1 + position: {x: 0, y: 1, z: 1} + size: {x: 1, y: 1, z: 0.5} + - frame: 17 + active: 1 + position: {x: 0, y: 0.58, z: 1} + size: {x: 1, y: 1, z: 0.5} + - type: 0 + pivot: 1 + frames: + - frame: 24 + active: 1 + position: {x: 0, y: 0.71, z: 1.14} + size: {x: 1, y: 1.78, z: 0.5} + - frame: 28 + active: 1 + position: {x: 0, y: 1.37, z: 1.31} + size: {x: 1, y: 1.62, z: 0.49} - type: 0 pivot: 1 - frames: [] + frames: + - frame: 40 + active: 1 + position: {x: 0, y: 0.84, z: 1.08} + size: {x: 1, y: 1, z: 0.5} + - frame: 43 + active: 1 + position: {x: 0, y: 0.6, z: 1.08} + size: {x: 1, y: 1, z: 0.5} + - type: 0 + pivot: 1 + frames: + - frame: 44 + active: 1 + position: {x: 0, y: 0.52, z: 0.82} + size: {x: 1, y: 1, z: 0.5} + - frame: 46 + active: 1 + position: {x: 0, y: 0.3, z: 0.85} + size: {x: 1, y: 1, z: 0.5} + - type: 0 + pivot: 1 + frames: + - frame: 48 + active: 1 + position: {x: 0, y: 0, z: 1.13} + size: {x: 1, y: 1, z: 0.5} + - frame: 51 + active: 1 + position: {x: 0, y: 0.31, z: 0.67} + size: {x: 1, y: 1, z: 0.5} throwBoxes: [] blockBoxes: [] defendBoxes: [] diff --git a/Assets/Scripts/Unit/Collider/ColliderData.cs b/Assets/Scripts/Unit/Collider/ColliderData.cs index 67881abc..ad4df73f 100644 --- a/Assets/Scripts/Unit/Collider/ColliderData.cs +++ b/Assets/Scripts/Unit/Collider/ColliderData.cs @@ -79,7 +79,7 @@ public class ColliderData return info;
}
- public void AddFrame(int frameIndex)
+ public ColliderFrame AddFrame(int frameIndex)
{
if (frames == null)
frames = new List<ColliderFrame>();
@@ -100,6 +100,7 @@ public class ColliderData return 1;
return 0;
});
+ return frame;
}
public void DeleteFrame(int frameIndex)
|