From ab482ab3df64d97c3df9921f6d645d914368bf08 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 30 Jul 2021 11:45:46 +0800 Subject: +misc --- Assets/ActionTool/Editor/ActionColliderEditor.cs | 28 ++++++++ Assets/ActionTool/Editor/ActionManager.cs | 26 ++++--- Assets/ActionTool/Editor/ActionPreviewEditor.cs | 65 ++++++++++++++--- Assets/ActionTool/Resources/blockbox.png | Bin 0 -> 245 bytes Assets/ActionTool/Resources/blockbox.png.meta | 88 +++++++++++++++++++++++ Assets/ActionTool/Resources/defendbox.png | Bin 0 -> 192 bytes Assets/ActionTool/Resources/defendbox.png.meta | 88 +++++++++++++++++++++++ Assets/ActionTool/Resources/throwbox.png | Bin 0 -> 195 bytes Assets/ActionTool/Resources/throwbox.png.meta | 88 +++++++++++++++++++++++ 9 files changed, 364 insertions(+), 19 deletions(-) create mode 100644 Assets/ActionTool/Resources/blockbox.png create mode 100644 Assets/ActionTool/Resources/blockbox.png.meta create mode 100644 Assets/ActionTool/Resources/defendbox.png create mode 100644 Assets/ActionTool/Resources/defendbox.png.meta create mode 100644 Assets/ActionTool/Resources/throwbox.png create mode 100644 Assets/ActionTool/Resources/throwbox.png.meta (limited to 'Assets/ActionTool') diff --git a/Assets/ActionTool/Editor/ActionColliderEditor.cs b/Assets/ActionTool/Editor/ActionColliderEditor.cs index 346cadbc..9bb77515 100644 --- a/Assets/ActionTool/Editor/ActionColliderEditor.cs +++ b/Assets/ActionTool/Editor/ActionColliderEditor.cs @@ -23,6 +23,10 @@ namespace ActionTool private void OnDisable() { + ActionManager.colliderData = null; + ActionManager.ColliderWindow = null; + if(ActionManager.PreviewWindow != null) + ActionManager.PreviewWindow.Repaint(); } private void Update() @@ -46,6 +50,30 @@ namespace ActionTool GUILayout.Space(2); + EditorGUILayout.LabelField(collider.type.ToString() + " " + ActionManager.colliderIndex, styles.textBoldBig, GUILayout.Height(25)); + + GUILayout.Space(2); + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Save")) + { + + } + if (GUILayout.Button("Revert")) + { + + } + Color prevColor = GUI.backgroundColor; + GUI.backgroundColor = Color.red; + if (GUILayout.Button("Delete")) + { + ActionManager.DeleteCurBox(); + } + GUI.backgroundColor = prevColor; + EditorGUILayout.EndHorizontal(); + + GUILayout.Space(5); + scroll = EditorGUILayout.BeginScrollView(scroll); Type type = collider.GetType(); diff --git a/Assets/ActionTool/Editor/ActionManager.cs b/Assets/ActionTool/Editor/ActionManager.cs index 7becca02..feefde88 100644 --- a/Assets/ActionTool/Editor/ActionManager.cs +++ b/Assets/ActionTool/Editor/ActionManager.cs @@ -89,10 +89,11 @@ namespace ActionTool public static AnimationEventBase animationEvent { get { return m_CurAnimationEvent; } } private static ColliderData s_CurColliderData; - public static ColliderData colliderData { get { return s_CurColliderData; } } + public static ColliderData colliderData { get { return s_CurColliderData; } set { s_CurColliderData = value; } } public static ColliderData.ColliderFrame s_CurEditColliderFrame; public static ColliderData.ColliderFrame editColliderFrame { get { return s_CurEditColliderFrame; } } + public static ColliderData s_CurEditFrameCollider; private static ActionToolGizmos s_Gizmos; public static ActionToolGizmos gizmos { get { return s_Gizmos; } } @@ -119,6 +120,8 @@ namespace ActionTool public static string unitAnimationClipFolder { get { return unitFolder + "AnimationClip/"; } } public static string unitDataFolder { get { return unitFolder + "UnitData/"; } } + public static int colliderIndex; + public static void OnSelectObj(GameObject obj) { Release(); @@ -168,7 +171,7 @@ namespace ActionTool animationData = null; OnSelectAnimationEvent(null); - OnSelectColliderFrame(null); + OnSelectColliderFrame(null, null); OnSelectBox(null); if (EventEditWindow) EventEditWindow.Close(); if (ColliderFrameWindow) ColliderFrameWindow.Close(); @@ -357,14 +360,17 @@ namespace ActionTool { if (s_CurColliderData == null) return; - ColliderWindow = EditorWindow.GetWindow(true); + if(ColliderWindow == null) + ColliderWindow = EditorWindow.GetWindow(true); } - public static void OnSelectBox(ColliderData collider) + public static void OnSelectBox(ColliderData collider, int index = 0) { s_CurColliderData = collider; if (ColliderWindow != null) ColliderWindow.Repaint(); + colliderIndex = index; + EditCollider(); } public static void AddNewBoxFrame(object param) @@ -375,7 +381,7 @@ namespace ActionTool if(data != null) { var frameData = data.AddFrame(frameIndex); - OnSelectColliderFrame(frameData); + OnSelectColliderFrame(frameData, data); } } @@ -392,19 +398,21 @@ namespace ActionTool public static void DeleteCurFrame() { - if (s_CurColliderData == null) + if (s_CurEditFrameCollider == null) return; if (s_CurEditColliderFrame == null) return; - s_CurColliderData.DeleteFrame(s_CurEditColliderFrame.frame); + s_CurEditFrameCollider.DeleteFrame(s_CurEditColliderFrame.frame); + s_CurEditColliderFrame = null; } - public static void OnSelectColliderFrame(ColliderData.ColliderFrame frame) + public static void OnSelectColliderFrame(ColliderData.ColliderFrame frame, ColliderData collider = null) { s_CurEditColliderFrame = frame; + s_CurEditFrameCollider = collider; - if (frame != null) + if (frame != null) { ColliderFrameWindow = EditorWindow.GetWindow(true); diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs index ecec6dde..8b13b70a 100644 --- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs +++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs @@ -28,8 +28,12 @@ namespace ActionTool Texture m_UITextureEnd; Texture m_UITexturePrevious; Texture m_UITextureStart; + Texture m_UITextureNewHurtBox; Texture m_UITextureNewHitBox; + Texture m_UITextureNewThrowBox; + Texture m_UITextureNewBlockBox; + Texture m_UITextureNewDefendBox; GUIStyle m_StyleBold; @@ -59,7 +63,9 @@ namespace ActionTool m_UITextureStart = (Texture)Resources.Load("button_control_start"); m_UITextureNewHurtBox = (Texture)Resources.Load("hurtbox"); m_UITextureNewHitBox = (Texture)Resources.Load("hitbox"); - + m_UITextureNewThrowBox = (Texture)Resources.Load("throwbox"); + m_UITextureNewBlockBox = (Texture)Resources.Load("blockbox"); + m_UITextureNewDefendBox = (Texture)Resources.Load("defendbox"); } void Update() @@ -107,8 +113,11 @@ namespace ActionTool GUI.enabled = ActionManager.animationData != null; GUI_Toolbar_NewHurtBox(ref x, ref y); GUI_Toolbar_NewHitBox(ref x, ref y); - GUI_Toolbar_Detail(ref x, ref y); - GUI_Toolbar_Delete(ref x, ref y); + GUI_Toolbar_NewThrowBox(ref x, ref y); + GUI_Toolbar_NewBlockBox(ref x, ref y); + GUI_Toolbar_NewDefendBox(ref x, ref y); + //GUI_Toolbar_Detail(ref x, ref y); + //GUI_Toolbar_Delete(ref x, ref y); GUI.enabled = true; GUI_DrawSeperateLine(x + 10 + kToolbarControlMargin, 0, kToolbarHeight); @@ -322,7 +331,10 @@ namespace ActionTool return; DrawBoxList(animData.hurtBoxes, ref y, Color.green); DrawBoxList(animData.hitBoxes, ref y, Color.red); - GenericMenu_BoxFrame(); + DrawBoxList(animData.throwBoxes, ref y, Color.blue); + DrawBoxList(animData.blockBoxes, ref y, Color.yellow); + DrawBoxList(animData.defendBoxes, ref y, Color.magenta); + GenericMenu_BoxFrame(); } void DrawBoxList(List boxes, ref float y, Color c) @@ -352,7 +364,7 @@ namespace ActionTool GUI.color = c; if (select) { - ActionManager.OnSelectBox(box); + ActionManager.OnSelectBox(box, index); //float length = action.totalFrame * kFrameWidth; //ui.DrawHorizontalLineFast(y, kTimeLineViewXOffset, kTimeLineViewXOffset + length, c * 0.7f); @@ -377,12 +389,12 @@ namespace ActionTool bool frameSelect = GUI.Toggle(frameRect, frameSelected, "",styles.keyFrameButton); if(!frameSelected && frameSelect) { - ActionManager.OnSelectBox(box); - ActionManager.OnSelectColliderFrame(frame); + //ActionManager.OnSelectBox(box, i); + ActionManager.OnSelectColliderFrame(frame, box); } else if(frameSelect && !frameSelect) { - ActionManager.OnSelectColliderFrame(null); + ActionManager.OnSelectColliderFrame(null, null); } if(prevIndex != -1) { @@ -429,8 +441,8 @@ namespace ActionTool BoxParam param = new BoxParam(); param.collider = box; param.frame = frame; - if(ActionManager.colliderData != box) - ActionManager.OnSelectBox(box); + //if(ActionManager.colliderData != box) + // ActionManager.OnSelectBox(box, index); GenericMenu _newFrameMenu = new GenericMenu(); _newFrameMenu.AddItem(new GUIContent("New Frame"), false, ActionManager.AddNewBoxFrame, param); _newFrameMenu.AddItem(new GUIContent("Delete"), false, ActionManager.DeleteBoxFrame, param); @@ -473,6 +485,39 @@ namespace ActionTool x += kToolbarControlSize; } + void GUI_Toolbar_NewThrowBox(ref float x, ref float y) + { + x += kToolbarControlMargin; + Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize); + if (GUI.Button(rect, new GUIContent(" + ", m_UITextureNewThrowBox, "New hit box"))) + { + ActionManager.NewHitBox(); + } + x += kToolbarControlSize; + } + + void GUI_Toolbar_NewDefendBox(ref float x, ref float y) + { + x += kToolbarControlMargin; + Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize); + if (GUI.Button(rect, new GUIContent(" + ", m_UITextureNewDefendBox, "New hit box"))) + { + ActionManager.NewHitBox(); + } + x += kToolbarControlSize; + } + + void GUI_Toolbar_NewBlockBox(ref float x, ref float y) + { + x += kToolbarControlMargin; + Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize); + if (GUI.Button(rect, new GUIContent(" + ", m_UITextureNewBlockBox, "New hit box"))) + { + ActionManager.NewHitBox(); + } + x += kToolbarControlSize; + } + void GUI_Toolbar_Detail(ref float x, ref float y) { x += kToolbarControlMargin + 20; diff --git a/Assets/ActionTool/Resources/blockbox.png b/Assets/ActionTool/Resources/blockbox.png new file mode 100644 index 00000000..b2d8294b Binary files /dev/null and b/Assets/ActionTool/Resources/blockbox.png differ diff --git a/Assets/ActionTool/Resources/blockbox.png.meta b/Assets/ActionTool/Resources/blockbox.png.meta new file mode 100644 index 00000000..f69399ad --- /dev/null +++ b/Assets/ActionTool/Resources/blockbox.png.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: eba969e46a302f1488a1db4ba3d8f6b0 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ActionTool/Resources/defendbox.png b/Assets/ActionTool/Resources/defendbox.png new file mode 100644 index 00000000..d07f602e Binary files /dev/null and b/Assets/ActionTool/Resources/defendbox.png differ diff --git a/Assets/ActionTool/Resources/defendbox.png.meta b/Assets/ActionTool/Resources/defendbox.png.meta new file mode 100644 index 00000000..266c3cda --- /dev/null +++ b/Assets/ActionTool/Resources/defendbox.png.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: e22b481e2b96b334bb851db2d1c3230b +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ActionTool/Resources/throwbox.png b/Assets/ActionTool/Resources/throwbox.png new file mode 100644 index 00000000..c0ef8467 Binary files /dev/null and b/Assets/ActionTool/Resources/throwbox.png differ diff --git a/Assets/ActionTool/Resources/throwbox.png.meta b/Assets/ActionTool/Resources/throwbox.png.meta new file mode 100644 index 00000000..91cc8560 --- /dev/null +++ b/Assets/ActionTool/Resources/throwbox.png.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: aa2cd616a3c164e4fb96e377e007cad6 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0