From 70a335da5d5148474457f50091e4db190cf74428 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Mon, 4 Jul 2022 10:28:40 -0400 Subject: [PATCH 1/4] spawn tempo changes on load --- Assets/Scenes/Editor.unity | 463 +++++++++++++++++- Assets/Scripts/Beatmap.cs | 14 + .../LevelEditor/Timeline/TempoTimeline.cs | 11 +- .../Scripts/LevelEditor/Timeline/Timeline.cs | 13 +- .../LevelEditor/Timeline/VolumeTimeline.cs | 6 +- .../LevelEditor/Timeline/VolumeTimelineObj.cs | 105 ++++ .../Timeline/VolumeTimelineObj.cs.meta | 11 + 7 files changed, 598 insertions(+), 25 deletions(-) create mode 100644 Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs create mode 100644 Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs.meta diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index d88de72e8..e3db87ea6 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -1938,7 +1938,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: -49.99994, y: 0} + m_AnchoredPosition: {x: -50, y: 0} m_SizeDelta: {x: 39.99997, y: 40} m_Pivot: {x: 1, y: 0.5} --- !u!114 &129013734 @@ -5307,6 +5307,66 @@ MonoBehaviour: m_EditorClassIdentifier: m_Padding: {x: 0, y: 0, z: 0, w: 0} m_Softness: {x: 0, y: 0} +--- !u!1 &380411593 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 380411594} + - component: {fileID: 380411595} + m_Layer: 5 + m_Name: VolumeChange + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &380411594 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 380411593} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1.0001352, z: 1.0001352} + m_Children: + - {fileID: 1436123038} + - {fileID: 1126835991} + - {fileID: 746356639} + - {fileID: 1186810249} + m_Father: {fileID: 1037563074} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0.7099991} + m_SizeDelta: {x: 0.0876, y: 0.71} + m_Pivot: {x: 0, y: 1} +--- !u!114 &380411595 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 380411593} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 86bb8f2f290876a4387f1ea6fedf332b, type: 3} + m_Name: + m_EditorClassIdentifier: + rectTransform: {fileID: 380411594} + volumeTXT: {fileID: 746356640} + raycastRect: {fileID: 1186810249} + volumeChange: + beat: 0 + length: 0 + volume: 0 + hovering: 0 --- !u!1 &390899752 GameObject: m_ObjectHideFlags: 0 @@ -10240,6 +10300,140 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 735918244} m_CullTransparentMesh: 1 +--- !u!1 &746356638 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 746356639} + - component: {fileID: 746356641} + - component: {fileID: 746356640} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &746356639 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746356638} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.01111111, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 380411594} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 1.137, y: 0} + m_SizeDelta: {x: 200, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &746356640 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746356638} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 100% + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 78e7291cdeccdfc4fa61249845605144, type: 2} + m_sharedMaterial: {fileID: 5250768452915780979, guid: 78e7291cdeccdfc4fa61249845605144, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 16.2 + m_fontSizeBase: 16.2 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &746356641 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746356638} + m_CullTransparentMesh: 1 --- !u!1 &749172746 GameObject: m_ObjectHideFlags: 0 @@ -12023,8 +12217,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1589389272} m_HandleRect: {fileID: 1589389271} m_Direction: 2 - m_Value: 1 - m_Size: 0.52903855 + m_Value: -0.00000013204993 + m_Size: 0.5293149 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -12614,8 +12808,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 111.50012, y: 40} - m_SizeDelta: {x: 223, y: 30.339996} + m_AnchoredPosition: {x: 111.50012, y: 38} + m_SizeDelta: {x: 223, y: 26.849} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &954835806 MonoBehaviour: @@ -12707,8 +12901,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: -22, y: 0} - m_SizeDelta: {x: 50, y: 30.34} + m_AnchoredPosition: {x: -22, y: -0.00013852} + m_SizeDelta: {x: 50, y: 26.849} m_Pivot: {x: 1, y: 0.5} --- !u!114 &967717800 MonoBehaviour: @@ -12891,10 +13085,10 @@ RectTransform: m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0.36, y: 33.998} - m_Pivot: {x: 0.5, y: 1} + m_SizeDelta: {x: 0.36, y: 0} + m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &983551350 MonoBehaviour: m_ObjectHideFlags: 0 @@ -13561,14 +13755,15 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] + m_Children: + - {fileID: 380411594} m_Father: {fileID: 1852819573} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: 0, y: 30.189209} - m_SizeDelta: {x: 0, y: 30.191} + m_AnchoredPosition: {x: 0, y: 31.184998} + m_SizeDelta: {x: 0, y: 31.187} m_Pivot: {x: 0, y: 1} --- !u!114 &1037563075 MonoBehaviour: @@ -13621,6 +13816,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: StartingVolume: {fileID: 967717800} + volumeTimelineObjs: [] --- !u!1 &1038760564 GameObject: m_ObjectHideFlags: 0 @@ -14819,6 +15015,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1123278334} m_CullTransparentMesh: 1 +--- !u!1 &1126835990 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1126835991} + - component: {fileID: 1126835993} + - component: {fileID: 1126835992} + m_Layer: 5 + m_Name: Image (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1126835991 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1126835990} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 380411594} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0.03, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1126835992 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1126835990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1126835993 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1126835990} + m_CullTransparentMesh: 1 --- !u!1 &1128012797 GameObject: m_ObjectHideFlags: 0 @@ -15065,7 +15336,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 129.94681} + m_AnchoredPosition: {x: 0, y: 361.05325} m_SizeDelta: {x: 0, y: 491} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -15436,6 +15707,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1183003085} m_CullTransparentMesh: 1 +--- !u!1 &1186810248 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1186810249} + - component: {fileID: 1186810251} + - component: {fileID: 1186810250} + m_Layer: 5 + m_Name: Raycast + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1186810249 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1186810248} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 380411594} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0.36, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1186810250 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1186810248} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1186810251 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1186810248} + m_CullTransparentMesh: 1 --- !u!1 &1186982020 GameObject: m_ObjectHideFlags: 0 @@ -16621,10 +16967,10 @@ RectTransform: m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0.03, y: 33.998} - m_Pivot: {x: 0.5, y: 1} + m_SizeDelta: {x: 0.03, y: -0.0000008866191} + m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1287203021 MonoBehaviour: m_ObjectHideFlags: 0 @@ -17219,7 +17565,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 49.99994, y: 0} + m_AnchoredPosition: {x: 50, y: 0} m_SizeDelta: {x: 39.999985, y: 40} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1345846031 @@ -17599,6 +17945,81 @@ MonoBehaviour: layer: {fileID: 1906769994} tempoLayer: {fileID: 1511927534} musicLayer: {fileID: 954835807} +--- !u!1 &1436123037 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1436123038} + - component: {fileID: 1436123040} + - component: {fileID: 1436123039} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1436123038 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1436123037} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 380411594} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0.15, y: 11.84} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &1436123039 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1436123037} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e3b85a6fda50d2343a8dfb2fc70c2b32, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1436123040 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1436123037} + m_CullTransparentMesh: 1 --- !u!1 &1438983641 GameObject: m_ObjectHideFlags: 0 @@ -20488,8 +20909,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 111.50012, y: -14.244141} - m_SizeDelta: {x: 223, y: -138.84} + m_AnchoredPosition: {x: 111.50012, y: -16.119995} + m_SizeDelta: {x: 223, y: -135.09} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1671351976 MonoBehaviour: @@ -22695,7 +23116,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -84.09497} + m_AnchoredPosition: {x: 0, y: -84.09494} m_SizeDelta: {x: 320, y: -115.28} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 diff --git a/Assets/Scripts/Beatmap.cs b/Assets/Scripts/Beatmap.cs index e381ffe83..23e030d24 100644 --- a/Assets/Scripts/Beatmap.cs +++ b/Assets/Scripts/Beatmap.cs @@ -20,6 +20,7 @@ namespace HeavenStudio public List entities = new List(); public List tempoChanges = new List(); + public List volumeChanges = new List(); public float firstBeatOffset; [Serializable] @@ -85,5 +86,18 @@ namespace HeavenStudio return this.MemberwiseClone(); } } + + [Serializable] + public class VolumeChange : ICloneable + { + public float beat; + public float length; + public float volume; + + public object Clone() + { + return this.MemberwiseClone(); + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs b/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs index 6e7a40621..adfa9495d 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs @@ -131,7 +131,16 @@ namespace HeavenStudio.Editor.Track UpdateOffsetText(); } - private void AddTempoChange(bool create, Beatmap.TempoChange tempoChange_ = null) + public void ClearTempoTimeline() + { + foreach (TempoTimelineObj tempoTimelineObj in tempoTimelineObjs) + { + Destroy(tempoTimelineObj.gameObject); + } + tempoTimelineObjs.Clear(); + } + + public void AddTempoChange(bool create, Beatmap.TempoChange tempoChange_ = null) { GameObject tempoChange = Instantiate(RefTempoChange.gameObject, this.transform); diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index 8c565db1f..dc71fd26d 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -101,6 +101,7 @@ namespace HeavenStudio.Editor.Track public void LoadRemix() { + // beatmap entities for (int i = 0; i < eventObjs.Count; i++) { Destroy(eventObjs[i].gameObject); @@ -109,11 +110,21 @@ namespace HeavenStudio.Editor.Track for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++) { - var entity = GameManager.instance.Beatmap.entities[i]; var e = GameManager.instance.Beatmap.entities[i]; AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * LayerHeight()), e, false, RandomID()); } + + //tempo changes + TempoInfo.ClearTempoTimeline(); + for (int i = 0; i < GameManager.instance.Beatmap.tempoChanges.Count; i++) + { + var t = GameManager.instance.Beatmap.tempoChanges[i]; + + TempoInfo.AddTempoChange(false, t); + } + + //volume changes } public void Init() diff --git a/Assets/Scripts/LevelEditor/Timeline/VolumeTimeline.cs b/Assets/Scripts/LevelEditor/Timeline/VolumeTimeline.cs index 39b3b3aa5..bcc460b99 100644 --- a/Assets/Scripts/LevelEditor/Timeline/VolumeTimeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/VolumeTimeline.cs @@ -16,6 +16,8 @@ namespace HeavenStudio.Editor.Track public TMP_InputField StartingVolume; private RectTransform StartingVolumeRect; + public List volumeTimelineObjs = new List(); + private bool firstUpdate; void Start() @@ -74,8 +76,8 @@ namespace HeavenStudio.Editor.Track } else if (newVol < 0) { - StartingVolume.text = "1"; - newVol = 1; + StartingVolume.text = "0"; + newVol = 0; } GameManager.instance.Beatmap.musicVolume = newVol; diff --git a/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs new file mode 100644 index 000000000..e800c5ee4 --- /dev/null +++ b/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs @@ -0,0 +1,105 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using TMPro; + +using DG.Tweening; + +namespace HeavenStudio.Editor.Track +{ + public class VolumeTimelineObj : MonoBehaviour + { + [Header("Components")] + [SerializeField] private RectTransform rectTransform; + [SerializeField] private TMP_Text volumeTXT; + [SerializeField] private RectTransform raycastRect; + + public Beatmap.VolumeChange volumeChange; + + private float startPosX; + private bool moving = false; + + public bool hovering; + + private float lastPosX; + + private void Start() + { + rectTransform = GetComponent(); + volumeTXT = transform.GetChild(2).GetComponent(); + UpdateVolume(); + } + + private void Update() + { + if (Timeline.instance.timelineState.musicVolume && !Conductor.instance.NotStopped()) + { + if (RectTransformUtility.RectangleContainsScreenPoint(raycastRect, Input.mousePosition, Editor.instance.EditorCamera)) + { + float newVolume = Input.mouseScrollDelta.y; + + if (Input.GetKey(KeyCode.LeftShift)) + newVolume *= 5f; + if (Input.GetKey(KeyCode.LeftControl)) + newVolume /= 100f; + + volumeChange.volume += newVolume; + + //make sure volume is positive + volumeChange.volume = Mathf.Clamp(volumeChange.volume, 0, 100); + + if (Input.GetMouseButtonDown(0)) + { + Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition); + startPosX = mousePos.x - transform.position.x; + moving = true; + lastPosX = transform.localPosition.x; + } + else if (Input.GetMouseButtonDown(1)) + { + GameManager.instance.Beatmap.volumeChanges.Remove(volumeChange); + transform.parent.GetComponent().volumeTimelineObjs.Remove(this); + Destroy(this.gameObject); + } + + hovering = true; + } + else + { + hovering = false; + } + + if (moving) + { + Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition); + + transform.position = new Vector3(mousePos.x - startPosX, transform.position.y, 0); + transform.localPosition = new Vector3(Mathf.Clamp(Starpelly.Mathp.Round2Nearest(transform.localPosition.x, Timeline.SnapInterval()), 0, Mathf.Infinity), transform.localPosition.y); + } + if (Input.GetMouseButtonUp(0)) + { + if (transform.parent.GetComponent().volumeTimelineObjs.Find(c => c.gameObject.transform.localPosition.x == this.transform.localPosition.x && c != this) != null) + { + transform.localPosition = new Vector3(lastPosX, transform.localPosition.y); + } + else + { + volumeChange.beat = transform.localPosition.x; + } + + moving = false; + lastPosX = transform.localPosition.x; + } + + UpdateVolume(); + } + } + + private void UpdateVolume() + { + volumeTXT.text = $"{volumeChange.volume}%"; + Timeline.instance.FitToSong(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs.meta b/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs.meta new file mode 100644 index 000000000..6e1eb12ea --- /dev/null +++ b/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 86bb8f2f290876a4387f1ea6fedf332b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 21c175d025629e15f9d1dd9838b371660c72901b Mon Sep 17 00:00:00 2001 From: minenice55 Date: Mon, 4 Jul 2022 11:29:19 -0400 Subject: [PATCH 2/4] fully functional snap change menu --- Assets/Scenes/Editor.unity | 483 +++++++++++++++++- Assets/Scripts/LevelEditor/SnapDialog.cs | 28 - Assets/Scripts/LevelEditor/SnapDialog.meta | 8 + .../SnapDialog/SnapChangeButton.cs | 22 + .../SnapDialog/SnapChangeButton.cs.meta | 11 + .../LevelEditor/SnapDialog/SnapDialog.cs | 52 ++ .../{ => SnapDialog}/SnapDialog.cs.meta | 0 Assets/Scripts/LevelEditor/TempoFinder.meta | 8 + .../{ => TempoFinder}/TempoFinder.cs | 0 .../{ => TempoFinder}/TempoFinder.cs.meta | 0 .../{ => TempoFinder}/TempoFinderButton.cs | 0 .../TempoFinderButton.cs.meta | 0 .../Scripts/LevelEditor/Timeline/Timeline.cs | 2 + 13 files changed, 559 insertions(+), 55 deletions(-) delete mode 100644 Assets/Scripts/LevelEditor/SnapDialog.cs create mode 100644 Assets/Scripts/LevelEditor/SnapDialog.meta create mode 100644 Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs create mode 100644 Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs.meta create mode 100644 Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs rename Assets/Scripts/LevelEditor/{ => SnapDialog}/SnapDialog.cs.meta (100%) create mode 100644 Assets/Scripts/LevelEditor/TempoFinder.meta rename Assets/Scripts/LevelEditor/{ => TempoFinder}/TempoFinder.cs (100%) rename Assets/Scripts/LevelEditor/{ => TempoFinder}/TempoFinder.cs.meta (100%) rename Assets/Scripts/LevelEditor/{ => TempoFinder}/TempoFinderButton.cs (100%) rename Assets/Scripts/LevelEditor/{ => TempoFinder}/TempoFinderButton.cs.meta (100%) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index e3db87ea6..2827a2537 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -1089,7 +1089,7 @@ RectTransform: m_GameObject: {fileID: 57310822} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 1, y: -1, z: 1} m_Children: [] m_Father: {fileID: 316841412} m_RootOrder: 0 @@ -1302,9 +1302,11 @@ RectTransform: m_Children: - {fileID: 270434624} - {fileID: 1121370304} + - {fileID: 365690206} - {fileID: 344865318} - {fileID: 1550880755} - {fileID: 316841412} + - {fileID: 2099454902} m_Father: {fileID: 683816222} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -4211,6 +4213,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 270434623} m_CullTransparentMesh: 1 +--- !u!1 &279065747 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 279065748} + - component: {fileID: 279065750} + - component: {fileID: 279065749} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &279065748 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 279065747} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2099454902} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &279065749 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 279065747} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0.5803922, b: 0.5882353, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 6809f7224eccf2142985b642abf0e0e1, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &279065750 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 279065747} + m_CullTransparentMesh: 1 --- !u!1 &279538357 GameObject: m_ObjectHideFlags: 0 @@ -4752,13 +4829,14 @@ GameObject: - component: {fileID: 316841412} - component: {fileID: 316841415} - component: {fileID: 316841414} + - component: {fileID: 316841413} m_Layer: 5 m_Name: Decrement m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &316841412 RectTransform: m_ObjectHideFlags: 0 @@ -4772,13 +4850,59 @@ RectTransform: m_Children: - {fileID: 57310823} m_Father: {fileID: 58525996} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 184, y: -47.8} m_SizeDelta: {x: 58.76, y: 58.76} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &316841413 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316841411} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7e0cac45de7228a4c8f7bc6adb0751a2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 316841414} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + SnapDialog: {fileID: 683816223} + isDown: 1 --- !u!114 &316841414 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4979,7 +5103,7 @@ GameObject: - component: {fileID: 344865320} - component: {fileID: 344865319} m_Layer: 5 - m_Name: tempLabel + m_Name: snapLabel m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -4997,12 +5121,12 @@ RectTransform: m_LocalScale: {x: 0.9995906, y: 0.9995906, z: 0.9995906} m_Children: [] m_Father: {fileID: 58525996} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 11.82} - m_SizeDelta: {x: 309.85, y: 50} + m_AnchoredPosition: {x: 16.588013, y: -20.04} + m_SizeDelta: {x: 217.54, y: 145.54} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &344865319 MonoBehaviour: @@ -5024,7 +5148,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: (Nothing Here!) + m_text: 1/4 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 4810e200fa0cb24438bac52343d7674b, type: 2} m_sharedMaterial: {fileID: 2100000, guid: 6d4610587e293f74ca2b71ec1cf59da3, type: 2} @@ -5033,8 +5157,8 @@ MonoBehaviour: m_fontMaterials: [] m_fontColor32: serializedVersion: 2 - rgba: 4278190208 - m_fontColor: {r: 0.5019608, g: 0, b: 0, a: 1} + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} m_enableVertexGradient: 0 m_colorMode: 3 m_fontColorGradient: @@ -5051,12 +5175,12 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 36 - m_fontSizeBase: 36 + m_fontSize: 100 + m_fontSizeBase: 100 m_fontWeight: 400 - m_enableAutoSizing: 0 - m_fontSizeMin: 18 - m_fontSizeMax: 72 + m_enableAutoSizing: 1 + m_fontSizeMin: 80 + m_fontSizeMax: 100 m_fontStyle: 0 m_HorizontalAlignment: 2 m_VerticalAlignment: 512 @@ -5307,6 +5431,140 @@ MonoBehaviour: m_EditorClassIdentifier: m_Padding: {x: 0, y: 0, z: 0, w: 0} m_Softness: {x: 0, y: 0} +--- !u!1 &365690205 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 365690206} + - component: {fileID: 365690208} + - component: {fileID: 365690207} + m_Layer: 5 + m_Name: label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &365690206 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 365690205} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.9995906, y: 0.9995906, z: 0.9995906} + m_Children: [] + m_Father: {fileID: 58525996} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -156.16, y: -20.04} + m_SizeDelta: {x: 127.95, y: 145.54} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &365690207 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 365690205} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Current Snap:' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 4810e200fa0cb24438bac52343d7674b, type: 2} + m_sharedMaterial: {fileID: 8580487687356851718, guid: 4810e200fa0cb24438bac52343d7674b, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4292664540 + m_fontColor: {r: 0.8627451, g: 0.8627451, b: 0.8627451, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 25 + m_fontSizeBase: 25 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &365690208 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 365690205} + m_CullTransparentMesh: 1 --- !u!1 &380411593 GameObject: m_ObjectHideFlags: 0 @@ -5888,7 +6146,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 0.5803922, b: 0.5882353, a: 1} + m_Color: {r: 0.5986803, g: 1, b: 0.5803922, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -9378,6 +9636,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: snapSetter: {fileID: 683816221} + snapText: {fileID: 344865319} --- !u!1 &689207019 GameObject: m_ObjectHideFlags: 0 @@ -12217,8 +12476,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1589389272} m_HandleRect: {fileID: 1589389271} m_Direction: 2 - m_Value: -0.00000013204993 - m_Size: 0.5293149 + m_Value: -0.0000011884493 + m_Size: 0.5289384 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -13762,8 +14021,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: 0, y: 31.184998} - m_SizeDelta: {x: 0, y: 31.187} + m_AnchoredPosition: {x: -0, y: 28.925} + m_SizeDelta: {x: 0, y: 28.927} m_Pivot: {x: 0, y: 1} --- !u!114 &1037563075 MonoBehaviour: @@ -15336,7 +15595,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 361.05325} + m_AnchoredPosition: {x: 0, y: 361.05347} m_SizeDelta: {x: 0, y: 491} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -19493,8 +19752,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -26.46289} - m_SizeDelta: {x: 1440.022, y: -115.3} + m_AnchoredPosition: {x: 0, y: -27.594} + m_SizeDelta: {x: 1440.022, y: -113.04} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1527251881 MonoBehaviour: @@ -20024,13 +20283,14 @@ GameObject: - component: {fileID: 1550880755} - component: {fileID: 1550880758} - component: {fileID: 1550880757} + - component: {fileID: 1550880756} m_Layer: 5 m_Name: Increment m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1550880755 RectTransform: m_ObjectHideFlags: 0 @@ -20044,13 +20304,59 @@ RectTransform: m_Children: - {fileID: 413228133} m_Father: {fileID: 58525996} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 184, y: 16.199982} m_SizeDelta: {x: 58.76, y: 58.76} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1550880756 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1550880754} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7e0cac45de7228a4c8f7bc6adb0751a2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1550880757} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + SnapDialog: {fileID: 683816223} + isDown: 0 --- !u!114 &1550880757 MonoBehaviour: m_ObjectHideFlags: 0 @@ -23116,8 +23422,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -84.09494} - m_SizeDelta: {x: 320, y: -115.28} + m_AnchoredPosition: {x: -0, y: -84.09494} + m_SizeDelta: {x: 320, y: -113.02} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 GameObject: @@ -26187,6 +26493,129 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2067805742} m_CullTransparentMesh: 1 +--- !u!1 &2099454901 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2099454902} + - component: {fileID: 2099454905} + - component: {fileID: 2099454904} + - component: {fileID: 2099454903} + m_Layer: 5 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2099454902 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099454901} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.00032, y: 1.00032, z: 1.00032} + m_Children: + - {fileID: 279065748} + m_Father: {fileID: 58525996} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 154.74002, y: -711.80005} + m_SizeDelta: {x: 58.76, y: 58.76} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2099454903 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099454901} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7e0cac45de7228a4c8f7bc6adb0751a2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2099454904} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + SnapDialog: {fileID: 0} + isDown: 0 +--- !u!114 &2099454904 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099454901} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &2099454905 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099454901} + m_CullTransparentMesh: 1 --- !u!1 &2127582756 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/LevelEditor/SnapDialog.cs b/Assets/Scripts/LevelEditor/SnapDialog.cs deleted file mode 100644 index d6a1949ed..000000000 --- a/Assets/Scripts/LevelEditor/SnapDialog.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace HeavenStudio.Editor -{ - public class SnapDialog : MonoBehaviour - { - [SerializeField] private GameObject snapSetter; - private void Awake() - { - } - - public void SwitchSnapDialog() - { - if(snapSetter.activeSelf) { - snapSetter.SetActive(false); - } else { - snapSetter.SetActive(true); - } - } - - private void Update() - { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/SnapDialog.meta b/Assets/Scripts/LevelEditor/SnapDialog.meta new file mode 100644 index 000000000..ed186b8f3 --- /dev/null +++ b/Assets/Scripts/LevelEditor/SnapDialog.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 537580972fcefa548bd9ee5e8254cbfc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs b/Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs new file mode 100644 index 000000000..b6651ca6c --- /dev/null +++ b/Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; + +namespace HeavenStudio.Editor +{ + public class SnapChangeButton : Button, IPointerDownHandler + { + public SnapDialog SnapDialog; + public bool isDown; + + public override void OnPointerDown(PointerEventData eventData) + { + if (eventData.button == PointerEventData.InputButton.Left) + { + SnapDialog.ChangeCommon(isDown); + } + } + } +} diff --git a/Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs.meta b/Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs.meta new file mode 100644 index 000000000..5ec35f5f9 --- /dev/null +++ b/Assets/Scripts/LevelEditor/SnapDialog/SnapChangeButton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e0cac45de7228a4c8f7bc6adb0751a2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs b/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs new file mode 100644 index 000000000..a51b852ab --- /dev/null +++ b/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs @@ -0,0 +1,52 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using HeavenStudio.Editor.Track; + +using TMPro; + +namespace HeavenStudio.Editor +{ + public class SnapDialog : MonoBehaviour + { + [SerializeField] private GameObject snapSetter; + [SerializeField] private TMP_Text snapText; + private Timeline timeline; + + private static float[] CommonDenominators = { 1, 2, 3, 4, 6, 8, 12, 16}; + private int currentCommon = 3; + private void Start() + { + timeline = Timeline.instance; + } + + public void SwitchSnapDialog() + { + if(snapSetter.activeSelf) { + snapSetter.SetActive(false); + } else { + snapSetter.SetActive(true); + } + } + + public void ChangeCommon(bool down = false) + { + if(down) { + currentCommon--; + } else { + currentCommon++; + } + if(currentCommon < 0) { + currentCommon = 0; + } else if(currentCommon >= CommonDenominators.Length) { + currentCommon = CommonDenominators.Length - 1; + } + timeline.SetSnap(1f / CommonDenominators[currentCommon]); + } + + private void Update() + { + snapText.text = $"1/{CommonDenominators[currentCommon]}"; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/SnapDialog.cs.meta b/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs.meta similarity index 100% rename from Assets/Scripts/LevelEditor/SnapDialog.cs.meta rename to Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs.meta diff --git a/Assets/Scripts/LevelEditor/TempoFinder.meta b/Assets/Scripts/LevelEditor/TempoFinder.meta new file mode 100644 index 000000000..841abb22d --- /dev/null +++ b/Assets/Scripts/LevelEditor/TempoFinder.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 36b14c8563ea37442aa7a2f0342549b5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/TempoFinder.cs b/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs similarity index 100% rename from Assets/Scripts/LevelEditor/TempoFinder.cs rename to Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs diff --git a/Assets/Scripts/LevelEditor/TempoFinder.cs.meta b/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs.meta similarity index 100% rename from Assets/Scripts/LevelEditor/TempoFinder.cs.meta rename to Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs.meta diff --git a/Assets/Scripts/LevelEditor/TempoFinderButton.cs b/Assets/Scripts/LevelEditor/TempoFinder/TempoFinderButton.cs similarity index 100% rename from Assets/Scripts/LevelEditor/TempoFinderButton.cs rename to Assets/Scripts/LevelEditor/TempoFinder/TempoFinderButton.cs diff --git a/Assets/Scripts/LevelEditor/TempoFinderButton.cs.meta b/Assets/Scripts/LevelEditor/TempoFinder/TempoFinderButton.cs.meta similarity index 100% rename from Assets/Scripts/LevelEditor/TempoFinderButton.cs.meta rename to Assets/Scripts/LevelEditor/TempoFinder/TempoFinderButton.cs.meta diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index dc71fd26d..e1dc268e6 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -30,6 +30,8 @@ namespace HeavenStudio.Editor.Track public static float SnapInterval() { return instance.snapInterval; } + public void SetSnap(float snap) { snapInterval = snap; } + public class CurrentTimelineState { public bool selected; From fb39a7c5fe92a28132fa5bf47ab8d8916aaefee6 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Mon, 4 Jul 2022 12:57:19 -0400 Subject: [PATCH 3/4] copy entities, prep settings menu --- Assets/Scenes/Editor.unity | 58 +++++++++++++++---- Assets/Scripts/LevelEditor/Editor.cs | 7 ++- .../Scripts/LevelEditor/SettingsDialog.meta | 8 +++ .../SettingsDialog/SettingsDialog.cs | 27 +++++++++ .../SettingsDialog/SettingsDialog.cs.meta | 11 ++++ .../Scripts/LevelEditor/Timeline/Timeline.cs | 8 +++ .../LevelEditor/Timeline/TimelineEventObj.cs | 9 +++ 7 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 Assets/Scripts/LevelEditor/SettingsDialog.meta create mode 100644 Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs create mode 100644 Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs.meta diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 2827a2537..3c5d47101 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -205,7 +205,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 3236233} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 1946344932} + m_TargetAssemblyTypeName: HeavenStudio.Editor.SettingsDialog, Assembly-CSharp + m_MethodName: SwitchSettingsDialog + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!114 &3236233 MonoBehaviour: m_ObjectHideFlags: 0 @@ -12476,8 +12488,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1589389272} m_HandleRect: {fileID: 1589389271} m_Direction: 2 - m_Value: -0.0000011884493 - m_Size: 0.5289384 + m_Value: 1 + m_Size: 0.5293149 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -14021,7 +14033,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -0, y: 28.925} + m_AnchoredPosition: {x: 0, y: 28.924988} m_SizeDelta: {x: 0, y: 28.927} m_Pivot: {x: 0, y: 1} --- !u!114 &1037563075 @@ -15595,7 +15607,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 361.05347} + m_AnchoredPosition: {x: 0, y: 129.94681} m_SizeDelta: {x: 0, y: 491} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -18122,11 +18134,11 @@ MonoBehaviour: UndoBTN: {fileID: 1747099763} RedoBTN: {fileID: 2131880462} MusicSelectBTN: {fileID: 1055877579} - EditorSettingsBTN: {fileID: 3236232} - EditorThemeBTN: {fileID: 528192061} FullScreenBTN: {fileID: 151246938} TempoFinderBTN: {fileID: 1478799966} SnapDiagBTN: {fileID: 1201441977} + EditorThemeBTN: {fileID: 528192061} + EditorSettingsBTN: {fileID: 3236232} tooltipText: {fileID: 1196204504} discordDuringTesting: 0 canSelect: 1 @@ -19752,7 +19764,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -27.594} + m_AnchoredPosition: {x: 0, y: -27.593994} m_SizeDelta: {x: 1440.022, y: -113.04} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1527251881 @@ -23422,7 +23434,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: -0, y: -84.09494} + m_AnchoredPosition: {x: 0, y: -84.09494} m_SizeDelta: {x: 320, y: -113.02} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 @@ -24277,6 +24289,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1946344931} + - component: {fileID: 1946344932} m_Layer: 5 m_Name: SettingsMenu m_TagString: Untagged @@ -24306,6 +24319,19 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1946344932 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1946344930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d82cc04699de2e54483ca0e0468d9ed2, type: 3} + m_Name: + m_EditorClassIdentifier: + settingsMenu: {fileID: 1946344930} --- !u!1 &1946352456 GameObject: m_ObjectHideFlags: 0 @@ -24388,7 +24414,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1946352459} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 1946344932} + m_TargetAssemblyTypeName: HeavenStudio.Editor.SettingsDialog, Assembly-CSharp + m_MethodName: SwitchSettingsDialog + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!114 &1946352459 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index fb053576e..b4d70b99f 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -48,12 +48,13 @@ namespace HeavenStudio.Editor [SerializeField] private Button UndoBTN; [SerializeField] private Button RedoBTN; [SerializeField] private Button MusicSelectBTN; - [SerializeField] private Button EditorSettingsBTN; - [SerializeField] private Button EditorThemeBTN; [SerializeField] private Button FullScreenBTN; [SerializeField] private Button TempoFinderBTN; [SerializeField] private Button SnapDiagBTN; + [SerializeField] private Button EditorThemeBTN; + [SerializeField] private Button EditorSettingsBTN; + [Header("Tooltip")] public TMP_Text tooltipText; @@ -102,12 +103,12 @@ namespace HeavenStudio.Editor Tooltip.AddTooltip(UndoBTN.gameObject, "Undo [Ctrl+Z]"); Tooltip.AddTooltip(RedoBTN.gameObject, "Redo [Ctrl+Y or Ctrl+Shift+Z]"); Tooltip.AddTooltip(MusicSelectBTN.gameObject, "Music Select"); - Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings [Ctrl+Shift+O]"); Tooltip.AddTooltip(EditorThemeBTN.gameObject, "Editor Theme"); Tooltip.AddTooltip(FullScreenBTN.gameObject, "Preview [Tab]"); Tooltip.AddTooltip(TempoFinderBTN.gameObject, "Tempo Finder"); Tooltip.AddTooltip(SnapDiagBTN.gameObject, "Snap Settings"); + Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings [Ctrl+Shift+O]"); UpdateEditorStatus(true); } diff --git a/Assets/Scripts/LevelEditor/SettingsDialog.meta b/Assets/Scripts/LevelEditor/SettingsDialog.meta new file mode 100644 index 000000000..ae50f8391 --- /dev/null +++ b/Assets/Scripts/LevelEditor/SettingsDialog.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 907f7d1eb5d90af408aa531ea366e63e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs b/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs new file mode 100644 index 000000000..c19c60442 --- /dev/null +++ b/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs @@ -0,0 +1,27 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using HeavenStudio.Editor.Track; + +using TMPro; + +namespace HeavenStudio.Editor +{ + public class SettingsDialog : MonoBehaviour + { + [SerializeField] private GameObject settingsMenu; + + private void Start() {} + + public void SwitchSettingsDialog() + { + if(settingsMenu.activeSelf) { + settingsMenu.SetActive(false); + } else { + settingsMenu.SetActive(true); + } + } + + private void Update() {} + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs.meta b/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs.meta new file mode 100644 index 000000000..90f131b73 --- /dev/null +++ b/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d82cc04699de2e54483ca0e0468d9ed2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index e1dc268e6..05dc3532a 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -611,6 +611,14 @@ namespace HeavenStudio.Editor.Track return eventObj; } + public TimelineEventObj CopyEventObject(Beatmap.Entity e) + { + Beatmap.Entity clone = (Beatmap.Entity) e.Clone(); + TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3(clone.beat, -clone.track * Timeline.instance.LayerHeight()), clone, true, RandomID()); + + return dup; + } + public void DestroyEventObject(Beatmap.Entity entity) { if (EventParameterManager.instance.entity == entity) diff --git a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs index 7d736dd19..cbf557fd9 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs @@ -41,6 +41,7 @@ namespace HeavenStudio.Editor.Track private bool resizingLeft; private bool resizingRight; private bool inResizeRegion; + private bool wasDuplicated; public Vector2 lastMovePos; public bool isCreating; public string eventObjID; @@ -167,6 +168,13 @@ namespace HeavenStudio.Editor.Track if (Timeline.instance.eventObjs.FindAll(c => c.moving).Count > 0 && selected) { + //duplicate the entity if holding alt or r-click + if ((!wasDuplicated) && (Input.GetKey(KeyCode.LeftAlt) || Input.GetMouseButton(1))) + { + wasDuplicated = true; + var te = Timeline.instance.CopyEventObject(entity); + } + Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition); lastPos_ = transform.localPosition; @@ -291,6 +299,7 @@ namespace HeavenStudio.Editor.Track } moving = false; + wasDuplicated = false; Cancel(); if (isCreating == true) From e2956f7c290e23881b849542ee85f761f3ed3774 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Mon, 4 Jul 2022 13:09:23 -0400 Subject: [PATCH 4/4] make copying use deep copies lol --- Assets/Scripts/Beatmap.cs | 6 +++ .../Scripts/LevelEditor/Timeline/Timeline.cs | 50 +++++++++---------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Assets/Scripts/Beatmap.cs b/Assets/Scripts/Beatmap.cs index 23e030d24..f64731038 100644 --- a/Assets/Scripts/Beatmap.cs +++ b/Assets/Scripts/Beatmap.cs @@ -54,6 +54,12 @@ namespace HeavenStudio return this.MemberwiseClone(); } + public Entity DeepCopy() + { + //lol the AI generated this + return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(this)); + } + public object this[string propertyName] { get diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index 05dc3532a..35bd8120c 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -572,36 +572,36 @@ namespace HeavenStudio.Editor.Track GameManager.instance.SortEventsList(); tempEntity = en; + + // default param value + var game = EventCaller.instance.GetMinigame(eventName.Split(0)); + var ep = EventCaller.instance.GetGameAction(game, eventName.Split(1)).parameters; + + if (ep != null) + { + for (int i = 0; i < ep.Count; i++) + { + object returnVal = ep[i].parameter; + + var propertyType = returnVal.GetType(); + if (propertyType == typeof(EntityTypes.Integer)) + { + returnVal = ((EntityTypes.Integer)ep[i].parameter).val; + } + else if (propertyType == typeof(EntityTypes.Float)) + { + returnVal = ((EntityTypes.Float)ep[i].parameter).val; + } + + tempEntity[ep[i].propertyName] = returnVal; + } + } } else { GameManager.instance.Beatmap.entities.Add(entity); GameManager.instance.SortEventsList(); } - - // default param value - var game = EventCaller.instance.GetMinigame(eventName.Split(0)); - var ep = EventCaller.instance.GetGameAction(game, eventName.Split(1)).parameters; - - if (ep != null) - { - for (int i = 0; i < ep.Count; i++) - { - object returnVal = ep[i].parameter; - - var propertyType = returnVal.GetType(); - if (propertyType == typeof(EntityTypes.Integer)) - { - returnVal = ((EntityTypes.Integer)ep[i].parameter).val; - } - else if (propertyType == typeof(EntityTypes.Float)) - { - returnVal = ((EntityTypes.Float)ep[i].parameter).val; - } - - tempEntity[ep[i].propertyName] = returnVal; - } - } } eventObjs.Add(eventObj); @@ -613,7 +613,7 @@ namespace HeavenStudio.Editor.Track public TimelineEventObj CopyEventObject(Beatmap.Entity e) { - Beatmap.Entity clone = (Beatmap.Entity) e.Clone(); + Beatmap.Entity clone = e.DeepCopy(); TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3(clone.beat, -clone.track * Timeline.instance.LayerHeight()), clone, true, RandomID()); return dup;