DTM Trail完成

This commit is contained in:
SoulliesOfficial
2025-04-20 03:10:41 -04:00
parent 83241a5814
commit 957b1e3702
10 changed files with 595 additions and 58 deletions

File diff suppressed because one or more lines are too long

View File

@@ -213,7 +213,7 @@ Camera:
y: 0
width: 1
height: 1
near clip plane: 0.3
near clip plane: 0.1
far clip plane: 1000
field of view: 60
orthographic: 0

File diff suppressed because one or more lines are too long

View File

@@ -96,7 +96,7 @@ namespace Ichni.RhythmGame
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Color");
var subcontainer = container.GenerateSubcontainer(1);
var subcontainer = container.GenerateSubcontainer(1, 300f);
var baseColor = inspector.GenerateBaseColorPicker(this, subcontainer, "Base Color", nameof(originalBaseColor));
baseColor.AddListenerFunction(Refresh);

View File

@@ -111,7 +111,7 @@ namespace Ichni.RhythmGame
{
foreach (GameElement x in EditorManager.instance.beatmapContainer.gameElementList)
{
if (x is IHaveTrail t)
if (x is IHaveTrail t && t.trailRenderer != null)
{
t.trailRenderer.emitting = emitting;
t.trailRenderer.enabled = emitting;

View File

@@ -47,6 +47,11 @@ namespace Ichni.Editor
gridMaterial = GetComponent<MeshRenderer>().material;
// 同步网格平面的值到材质(方便 Shader 内部判断)
gridMaterial.SetFloat("_Plane", gridPlane);
float lineWidthOf3840 = 2;
float screenWidth = Screen.width;
float lineWidth = lineWidthOf3840 * (screenWidth / 3840f);
gridMaterial.SetFloat("_LineWidth", lineWidth);
}
void Update()

View File

@@ -99,7 +99,7 @@
"positionZ" : {
"animatedFloatList" : [
{
"startValue" : 0,
"startValue" : -5,
"endValue" : 5,
"startTime" : 0,
"endTime" : 2.580645,
@@ -330,16 +330,6 @@
"attachedElementGuid" : {
"value" : "1500056c-f5cb-4c71-8096-d6aa6e2ef716"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackRendererSubmoduleAutoOrient_BM,Assembly-CSharp",
"materialThemeBundleName" : "departure_to_multiverse",
"materialName" : "EnergyTrail0",
"enableEmission" : true,
"emissionIntensity" : 1,
"zWrite" : false,
"attachedElementGuid" : {
"value" : "1500056c-f5cb-4c71-8096-d6aa6e2ef716"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
@@ -1741,16 +1731,6 @@
"attachedElementGuid" : {
"value" : "4bc6933c-22a2-4ffd-85ea-b3a9deefef0e"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackRendererSubmodulePathGenerator_BM,Assembly-CSharp",
"materialThemeBundleName" : "departure_to_multiverse",
"materialName" : "EnergyTrail0",
"enableEmission" : true,
"emissionIntensity" : 2,
"zWrite" : false,
"attachedElementGuid" : {
"value" : "4bc6933c-22a2-4ffd-85ea-b3a9deefef0e"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
@@ -2100,16 +2080,6 @@
"attachedElementGuid" : {
"value" : "84124676-d1d5-432e-97f4-b7144ae3b656"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackRendererSubmodulePathGenerator_BM,Assembly-CSharp",
"materialThemeBundleName" : "",
"materialName" : "",
"enableEmission" : false,
"emissionIntensity" : 0,
"zWrite" : false,
"attachedElementGuid" : {
"value" : "84124676-d1d5-432e-97f4-b7144ae3b656"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackTimeSubmoduleStatic_BM,Assembly-CSharp",
"trackTotalTime" : 1,
@@ -2610,6 +2580,355 @@
"attachedElementGuid" : {
"value" : "75d39ea7-9f05-4c49-8896-6463aca12626"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackPercentPoint_BM,Assembly-CSharp",
"trackPercent" : {
"animatedFloatList" : [
{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
}
]
},
"elementName" : "New Track Percent Point",
"tags" : [
],
"elementGuid" : {
"value" : "1538fdc1-16df-4579-ac23-b6f1648dfb7a"
},
"attachedElementGuid" : {
"value" : "1500056c-f5cb-4c71-8096-d6aa6e2ef716"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "1538fdc1-16df-4579-ac23-b6f1648dfb7a"
}
},{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMTrail_BM,Assembly-CSharp",
"visibleTimeLength" : {
"animatedFloatList" : [
{
"startValue" : 1,
"endValue" : 1,
"startTime" : 0,
"endTime" : 1,
"animationCurveType" : 0
}
]
},
"enableTimes" : {
"animatedBoolList" : [
{
"value" : false,
"time" : 0
},{
"value" : true,
"time" : 5
},{
"value" : false,
"time" : 20
}
]
},
"enableProcessTime" : 1,
"headSize" : 1,
"headRotateSpeed" : {
"animatedFloatList" : [
{
"startValue" : 10,
"endValue" : 10,
"startTime" : 0,
"endTime" : 20,
"animationCurveType" : 3
}
]
},
"isStatic" : false,
"themeBundleName" : "departure_to_multiverse",
"objectName" : "DTM_Trail",
"elementName" : "New Environment Object",
"tags" : [
],
"elementGuid" : {
"value" : "ad71a13a-d79b-4c58-933b-f2b5c738692f"
},
"attachedElementGuid" : {
"value" : "1538fdc1-16df-4579-ac23-b6f1648dfb7a"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "ad71a13a-d79b-4c58-933b-f2b5c738692f"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "ad71a13a-d79b-4c58-933b-f2b5c738692f"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
"originalBaseColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionEnabled" : true,
"originalEmissionColor" : {
"r" : 0.430388,
"g" : 0.240733,
"b" : 1,
"a" : 1
},
"originalEmissionIntensity" : 1,
"attachedElementGuid" : {
"value" : "ad71a13a-d79b-4c58-933b-f2b5c738692f"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackPercentPoint_BM,Assembly-CSharp",
"trackPercent" : {
"animatedFloatList" : [
{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
},{
"startValue" : 0,
"endValue" : 1,
"startTime" : 0,
"endTime" : 21.4,
"animationCurveType" : 0
}
]
},
"elementName" : "New Track Percent Point",
"tags" : [
],
"elementGuid" : {
"value" : "5e1f8cd6-8464-45b5-a544-5c0457516f4c"
},
"attachedElementGuid" : {
"value" : "4bc6933c-22a2-4ffd-85ea-b3a9deefef0e"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "5e1f8cd6-8464-45b5-a544-5c0457516f4c"
}
},{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMTrail_BM,Assembly-CSharp",
"visibleTimeLength" : {
"animatedFloatList" : [
{
"startValue" : 1,
"endValue" : 1,
"startTime" : 0,
"endTime" : 1,
"animationCurveType" : 0
}
]
},
"enableTimes" : {
"animatedBoolList" : [
{
"value" : false,
"time" : 0
},{
"value" : true,
"time" : 5
}
]
},
"enableProcessTime" : 1,
"headSize" : 1,
"headRotateSpeed" : {
"animatedFloatList" : [
]
},
"isStatic" : false,
"themeBundleName" : "departure_to_multiverse",
"objectName" : "DTM_Trail",
"elementName" : "New Environment Object",
"tags" : [
],
"elementGuid" : {
"value" : "e7f3c3e3-5767-48a9-adaf-4de5e704c6c9"
},
"attachedElementGuid" : {
"value" : "5e1f8cd6-8464-45b5-a544-5c0457516f4c"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "e7f3c3e3-5767-48a9-adaf-4de5e704c6c9"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "e7f3c3e3-5767-48a9-adaf-4de5e704c6c9"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
"originalBaseColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionEnabled" : true,
"originalEmissionColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"originalEmissionIntensity" : 1,
"attachedElementGuid" : {
"value" : "e7f3c3e3-5767-48a9-adaf-4de5e704c6c9"
}
}
],
"attachedElementGuid" : {

View File

@@ -4891,6 +4891,8 @@ MonoBehaviour:
enableTimes:
value: 0
animations: []
enableProcessTime: 0.5
headSize: 1
headRotateSpeed:
value: 0
currentAnimationIndex: 0

View File

@@ -15,12 +15,13 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public GameObject headPoint, headCircle;
public GameObject trailBody;
public bool isHeadEnabled;
public List<Renderer> renderers;
public ParticleSystem headCircleParticle;
public TrailRenderer trailRenderer { get; set; }
public bool isHeadEnabled;
public FlexibleFloat visibleTimeLength;
public FlexibleBool enableTimes;
public float enableProcessTime = 0.5f;
public float headSize = 1f;
@@ -29,30 +30,55 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public override bool haveEmission => true;
public new static DTMTrail GenerateElement(string elementName, Guid id, List<string> tags,
public static DTMTrail GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
bool isStatic, FlexibleBool enableTimes, FlexibleFloat headRotateSpeed, float enableProcessTime,
bool isStatic, FlexibleFloat visibleTimeLength, FlexibleBool enableTimes, FlexibleFloat headRotateSpeed, float enableProcessTime,
float headSize)
{
visibleTimeLength ??= new FlexibleFloat(new List<AnimatedFloat>() { new AnimatedFloat(0, 1, 1, 1, AnimationCurveType.Linear) });
DTMTrail dtmTrail = EnvironmentObject.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DTMTrail>();
dtmTrail.trailRenderer = dtmTrail.trailBody.GetComponent<TrailRenderer>();
dtmTrail.isHeadEnabled = false;
dtmTrail.visibleTimeLength = visibleTimeLength;
dtmTrail.enableTimes = enableTimes;
dtmTrail.headRotateSpeed = headRotateSpeed;
dtmTrail.enableProcessTime = enableProcessTime;
dtmTrail.headSize = headSize;
dtmTrail.SetUpTweeners();
var rotationBySpeedModule = dtmTrail.headCircleParticle.rotationBySpeed;
rotationBySpeedModule.z = 0;
dtmTrail.SetUpTweeners();
return dtmTrail;
}
public override void SetDefaultSubmodules()
{
base.SetDefaultSubmodules();
colorSubmodule.emissionEnabled = true;
colorSubmodule.originalEmissionColor = Color.white;
colorSubmodule.originalEmissionIntensity = 1;
}
public override void FirstSetUpObject(bool isFirstGenerated)
{
if (isFirstGenerated)
{
enableTimes = new FlexibleBool();
enableTimes.Add(new AnimatedBool(0f, false));
enableTimes.Add(new AnimatedBool(1f, true));
}
var rotationBySpeedModule = headCircleParticle.rotationBySpeed;
rotationBySpeedModule.z = 0;
headPoint.transform.localScale = Vector3.zero;
headCircle.transform.localScale = Vector3.zero;
}
public override void Refresh()
{
base.Refresh();
renderers.ForEach(rend =>
{
if (colorSubmodule.emissionEnabled)
@@ -84,6 +110,12 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
isHeadEnabled = false;
}
visibleTimeLength.UpdateFlexibleFloat(songTime);
if (visibleTimeLength.animations.Count > 0)
{
trailRenderer.time = visibleTimeLength.value;
}
if (isHeadEnabled && headRotateSpeed.animations.Count > 0)
{
headRotateSpeed.UpdateFlexibleFloat(songTime);
@@ -123,9 +155,14 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public void SetUpTweeners()
{
enableHeadSequence?.Kill(true);
disableHeadSequence?.Kill(true);
headBounceSequence?.Kill(true);
enableHeadSequence = DOTween.Sequence();
enableHeadSequence.Append(headPoint.transform.DOScale(headSize, enableProcessTime).SetEase(Ease.OutQuad));
enableHeadSequence.Join(headCircle.transform.DOScale(headSize, enableProcessTime).SetEase(Ease.OutQuad));
enableHeadSequence.OnComplete(()=>Debug.Log("Enable Head"));
enableHeadSequence.SetAutoKill(false);
disableHeadSequence = DOTween.Sequence();
@@ -152,7 +189,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public override void SaveBM()
{
matchedBM = new DTMTrail_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
themeBundleName, objectName, isStatic, enableTimes, headRotateSpeed, enableProcessTime, headSize);
themeBundleName, objectName, isStatic, visibleTimeLength, enableTimes, headRotateSpeed, enableProcessTime, headSize);
}
public override void SetUpInspector()
@@ -163,6 +200,13 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
var container = inspector.GenerateContainer("DTMTrail");
var subcontainer = container.GenerateSubcontainer(3);
var visibleTimeLengthButton = inspector.GenerateButton(this, subcontainer, "Visible Time Length", () =>
{
var ew = inspector.GenerateCompositeParameterWindow(
this, "Visible Time Length", nameof(visibleTimeLength));
ew.SetAsFlexibleFloat();
});
var enableTimeListButton = inspector.GenerateButton(this, subcontainer, "Enable Head Time List", () =>
{
var ew = inspector.GenerateCompositeParameterWindow(
@@ -176,9 +220,14 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
this, "Head Rotate Speed", nameof(headRotateSpeed));
ew.SetAsFlexibleFloat();
});
var enableProcessTimeInputField =
inspector.GenerateInputField(this, subcontainer, "Enable Process Time", nameof(enableProcessTime))
.AddListenerFunction(SetUpTweeners);
var enableProcessTimeInputField = inspector.GenerateInputField(this, subcontainer, "Enable Process Time", nameof(enableProcessTime));
var headSizeInputField = inspector.GenerateInputField(this, subcontainer, "Head Size", nameof(headSize));
var headSizeInputField =
inspector.GenerateInputField(this, subcontainer, "Head Size", nameof(headSize))
.AddListenerFunction(SetUpTweeners);
}
}
@@ -187,6 +236,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public partial class DTMTrail_BM : EnvironmentObject_BM
{
public FlexibleFloat_BM visibleTimeLength;
public FlexibleBool_BM enableTimes;
public float enableProcessTime = 0.5f;
public float headSize = 1f;
@@ -199,10 +249,11 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
}
public DTMTrail_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM parentElement,
string themeBundleName, string objectName, bool isStatic, FlexibleBool enableTimes, FlexibleFloat headRotateSpeed,
float enableProcessTime, float headSize):
string themeBundleName, string objectName, bool isStatic, FlexibleFloat visibleTimeLength,
FlexibleBool enableTimes, FlexibleFloat headRotateSpeed, float enableProcessTime, float headSize):
base(elementName, elementGuid, tags, parentElement, themeBundleName, objectName, isStatic)
{
this.visibleTimeLength = visibleTimeLength.ConvertToBM();
this.enableTimes = enableTimes.ConvertToBM();
this.headRotateSpeed = headRotateSpeed.ConvertToBM();
this.enableProcessTime = enableProcessTime;
@@ -212,14 +263,14 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public override void ExecuteBM()
{
matchedElement = DTMTrail.GenerateElement(elementName, elementGuid, tags, false,
themeBundleName, objectName, GetElement(attachedElementGuid), isStatic,
themeBundleName, objectName, GetElement(attachedElementGuid), isStatic, visibleTimeLength?.ConvertToGameType(),
enableTimes.ConvertToGameType(), headRotateSpeed?.ConvertToGameType(), enableProcessTime, headSize);
}
public override GameElement DuplicateBM(GameElement parent)
{
return DTMTrail.GenerateElement(elementName, Guid.NewGuid(), tags, false,
themeBundleName, objectName, parent, isStatic, enableTimes.ConvertToGameType(),
themeBundleName, objectName, parent, isStatic, visibleTimeLength?.ConvertToGameType(), enableTimes.ConvertToGameType(),
headRotateSpeed?.ConvertToGameType(), enableProcessTime, headSize);
}
}

View File

@@ -41,8 +41,6 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public partial class DTMNoteVisual
{
public override void SaveBM()
{
matchedBM = new Beatmap.DTMNoteVisual_BM(elementName, elementGuid, tags,