From 6559751b8ea268db8035b4d47e2463f76b4792cf Mon Sep 17 00:00:00 2001 From: SoulliesOfficial <77235731+SoulliesOfficial@users.noreply.github.com> Date: Fri, 7 Feb 2025 00:37:50 -0500 Subject: [PATCH] =?UTF-8?q?PathNode=E7=A7=BB=E9=99=A4=E8=87=AA=E5=B8=A6Tra?= =?UTF-8?q?nsform=E5=92=8CColor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefabs/GameElements/PathNode.mat | 173 ++++++++++++++++++ Assets/Prefabs/GameElements/PathNode.mat.meta | 8 + Assets/Prefabs/GameElements/PathNode.prefab | 108 ++++++++++- Assets/Scripts/Base/BaseElement.cs | 4 +- Assets/Scripts/Base/Manager/EditorManager.cs | 16 +- Assets/Scripts/GameElements/Track/PathNode.cs | 35 ++-- 6 files changed, 312 insertions(+), 32 deletions(-) create mode 100644 Assets/Prefabs/GameElements/PathNode.mat create mode 100644 Assets/Prefabs/GameElements/PathNode.mat.meta diff --git a/Assets/Prefabs/GameElements/PathNode.mat b/Assets/Prefabs/GameElements/PathNode.mat new file mode 100644 index 00000000..08e43bb8 --- /dev/null +++ b/Assets/Prefabs/GameElements/PathNode.mat @@ -0,0 +1,173 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PathNode + m_Shader: {fileID: 211, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + m_InvalidKeywords: [] + m_LightmapFlags: 0 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - GRABPASS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BlendOp: 0 + - _BumpScale: 1 + - _CameraFadingEnabled: 0 + - _CameraFarFadeDistance: 2 + - _CameraNearFadeDistance: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _ColorMode: 0 + - _Cull: 0 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DistortionBlend: 0.5 + - _DistortionEnabled: 0 + - _DistortionStrength: 1 + - _DistortionStrengthScaled: 0 + - _DstBlend: 10 + - _DstBlendAlpha: 0 + - _EmissionEnabled: 0 + - _EnableExternalAlpha: 0 + - _EnvironmentReflections: 1 + - _FlipbookMode: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossinessSource: 0 + - _GlossyReflections: 0 + - _LightingEnabled: 0 + - _Metallic: 0 + - _Mode: 3 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Shininess: 0 + - _Smoothness: 0.5 + - _SmoothnessSource: 0 + - _SmoothnessTextureChannel: 0 + - _SoftParticlesEnabled: 0 + - _SoftParticlesFarFadeDistance: 1 + - _SoftParticlesNearFadeDistance: 0 + - _SpecSource: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} + - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] +--- !u!114 &2523386628062252728 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 diff --git a/Assets/Prefabs/GameElements/PathNode.mat.meta b/Assets/Prefabs/GameElements/PathNode.mat.meta new file mode 100644 index 00000000..bbac26e4 --- /dev/null +++ b/Assets/Prefabs/GameElements/PathNode.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 40de2c4d4a13a4ab2a7b404b9ea124dc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/GameElements/PathNode.prefab b/Assets/Prefabs/GameElements/PathNode.prefab index 68d1b129..fef4cd5d 100644 --- a/Assets/Prefabs/GameElements/PathNode.prefab +++ b/Assets/Prefabs/GameElements/PathNode.prefab @@ -1,5 +1,88 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &2852814640559356108 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5458850307965270050} + - component: {fileID: 5627864271135565099} + - component: {fileID: 7167795648212539471} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5458850307965270050 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2852814640559356108} + serializedVersion: 2 + 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_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 1315658469023090610} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &5627864271135565099 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2852814640559356108} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &7167795648212539471 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2852814640559356108} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 40de2c4d4a13a4ab2a7b404b9ea124dc, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &7248180033186031075 GameObject: m_ObjectHideFlags: 0 @@ -29,7 +112,8 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 5458850307965270050} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &8806291656250087362 @@ -56,6 +140,22 @@ MonoBehaviour: - Name: elementGuid Entry: 2 Data: 00000000000000000000000000000000 + - Name: matchedBM + Entry: 6 + Data: + - Name: submoduleList + Entry: 7 + Data: 0|System.Collections.Generic.List`1[[Ichni.RhythmGame.SubmoduleBase, + Assembly-CSharp]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: - Name: timeDurationSubmodule Entry: 6 Data: @@ -65,12 +165,14 @@ MonoBehaviour: - Name: colorSubmodule Entry: 6 Data: + - Name: PathNode+colorSubmodule + Entry: 6 + Data: elementName: - serialNumber: 0 + tags: [] parentElement: {fileID: 0} childElementList: [] track: {fileID: 0} - index: 0 node: _type: 0 position: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/Base/BaseElement.cs b/Assets/Scripts/Base/BaseElement.cs index d57d8f89..dbd076a5 100644 --- a/Assets/Scripts/Base/BaseElement.cs +++ b/Assets/Scripts/Base/BaseElement.cs @@ -31,6 +31,8 @@ namespace Ichni.RhythmGame public List childElementList = new List(); //次级模块 + public List submoduleList = new List(); + public TimeDurationSubmodule timeDurationSubmodule; public TransformSubmodule transformSubmodule; public ColorSubmodule colorSubmodule; @@ -55,7 +57,7 @@ namespace Ichni.RhythmGame /// public virtual void AfterInitialize() { - + } /// diff --git a/Assets/Scripts/Base/Manager/EditorManager.cs b/Assets/Scripts/Base/Manager/EditorManager.cs index 44b817bf..6011d3a3 100644 --- a/Assets/Scripts/Base/Manager/EditorManager.cs +++ b/Assets/Scripts/Base/Manager/EditorManager.cs @@ -40,15 +40,21 @@ namespace Ichni new FlexibleFloat(new List() { new(0, 2, 0, 1, AnimationCurveType.OutQuad) })); var tr0 = Trail.GenerateElement("Trail-0", Guid.NewGuid(), new List(), pp0, 5); // t0.trackRendererSubmodule = new TrackRendererSubmoduleAutoOrient(t0); - var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List(), t0, - new Vector3(-5, 5, 10), Vector3.forward, 1, Color.white); - var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List(), t0, - new Vector3(5, -5, 10), Vector3.forward, 0, Color.red); + var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List(), t0); + p0.transformSubmodule = new TransformSubmodule(p0, new Vector3(-5, 5, 10), Vector3.forward, Vector3.one); + p0.colorSubmodule = new ColorSubmodule(p0, Color.white); + var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List(), t0); + p1.transformSubmodule = new TransformSubmodule(p1, new Vector3(5, -5, 10), Vector3.forward, Vector3.one); + p1.colorSubmodule = new ColorSubmodule(p1, Color.red); var n0 = Tap.GenerateElement("Note-0", Guid.NewGuid(), new List(), 1f, t0); var n0v = BasicNoteVisual.GenerateElement("Note-0-V", Guid.NewGuid(), new List(), "basic", "BasicNoteTap3D", Vector3.zero, Vector3.zero, Vector3.one, n0); - elementList.ForEach(e => e.AfterInitialize()); + elementList.ForEach(e => + { + e.AfterInitialize(); + e.Refresh(); + }); } private void Update() diff --git a/Assets/Scripts/GameElements/Track/PathNode.cs b/Assets/Scripts/GameElements/Track/PathNode.cs index 47eeac47..0965b5ca 100644 --- a/Assets/Scripts/GameElements/Track/PathNode.cs +++ b/Assets/Scripts/GameElements/Track/PathNode.cs @@ -19,8 +19,7 @@ namespace Ichni.RhythmGame public SplinePoint node; - public static PathNode GenerateElement(string elementName, Guid id, List tags, - Track track, Vector3 nodePosition, Vector3 nodeNormal, float nodeSize, Color nodeColor) + public static PathNode GenerateElement(string elementName, Guid id, List tags, Track track) { PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform) .GetComponent(); @@ -29,10 +28,9 @@ namespace Ichni.RhythmGame pathNode.track = track; //pathNode.index = index; - pathNode.transformSubmodule = new TransformSubmodule(pathNode, nodePosition, - Quaternion.LookRotation(nodeNormal, Vector3.up).eulerAngles, Vector3.one * nodeSize); + pathNode.transformSubmodule = new TransformSubmodule(pathNode); pathNode.timeDurationSubmodule = new TimeDurationSubmodule(pathNode); - pathNode.colorSubmodule = new ColorSubmodule(pathNode, nodeColor); + pathNode.colorSubmodule = new ColorSubmodule(pathNode); track.trackPathSubmodule.pathNodeList.Add(pathNode); pathNode.SetParent(track); @@ -58,6 +56,10 @@ namespace Ichni.RhythmGame Vector3 normal = Quaternion.Euler(transformSubmodule.currentEulerAngles) * Vector3.up; float size = transformSubmodule.currentScale.x; Color color = colorSubmodule.currentBaseColor; + + transform.position = position; + transform.rotation = Quaternion.LookRotation(normal); + transform.localScale = Vector3.one * size; node = new SplinePoint(position, Vector3.up, normal, size, color); track.trackPathSubmodule.SetPathNode(this); @@ -68,8 +70,7 @@ namespace Ichni.RhythmGame { public override void SaveBM() { - matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM, index, - node.position, node.normal, node.size, node.color); + matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM); } } @@ -77,38 +78,26 @@ namespace Ichni.RhythmGame { public class PathNode_BM : BaseElement_BM { - public int index; - public Vector3 position; - public Vector3 normal; - public float size; - public Color color; - public PathNode_BM() { } - public PathNode_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement, - int index, Vector3 position, Vector3 normal, float size, Color color) + public PathNode_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement) : base(elementName, elementGuid, tags, attachedElement) { - this.index = index; - this.position = position; - this.normal = normal; - this.size = size; - this.color = color; + } public override void ExecuteBM() { matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags, - GetElement(attachedElementGuid) as Track, position, normal, size, color); + GetElement(attachedElementGuid) as Track); } public override BaseElement DuplicateBM(BaseElement parent) { - return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track, - position, normal, size, color); + return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track); } } }