This commit is contained in:
SoulliesOfficial
2025-07-21 05:42:20 -04:00
parent e483cfe502
commit bae0bfbc20
533 changed files with 172709 additions and 125965 deletions

View File

@@ -27,20 +27,6 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
if (note == null) throw new System.Exception("NoteVisual只能生成在Note下。");
this.note = note;
note.noteVisual = this;
if (isFirstGenerated)
{
throw new NotImplementedException("游戏本体不会出现isFirstGenerated为true的情况。");
/*note.noteJudgeSubmodule.AddJudgeUnit("TouchArea");
effectSubmodule.effectCollection["Generate"].Add(new DTMNoteGenerateExpand(this, 1f, 0.2f));
effectSubmodule.effectCollection["Perfect"].Add(new DTMNotePerfectBurst(this));
if (objectName.Contains("Tap"))
{
effectSubmodule.effectCollection["Good"].Add(new DTMNoteGoodBurst(this));
effectSubmodule.effectCollection["Bad"].Add(new DTMNoteBadBurst(this));
}
effectSubmodule.effectCollection["Miss"].Add(new DTMNoteMissTransparent(this, 0.2f));*/
}
}
public override void AfterInitialize()
@@ -51,17 +37,19 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public override void Recover()
{
effectPartList.ForEach(effectPart =>
foreach (GameObject part in notePartList)
{
effectPart.GetComponent<ParticleSystem>().Stop();
});
foreach (Renderer renderer in notePartList.Select(part => part.GetComponent<Renderer>()))
{
renderer.material.SetFloat("_MainAlpha", 1f);
Renderer rend = part.GetComponent<Renderer>();
if (rend != null)
{
rend.material.SetFloat("_MainAlpha", 1f);
}
}
foreach (EffectBase effect in effectSubmodule.effectCollection["Generate"])
{
effect.Recover();
}
noteMain.transform.localScale = Vector3.zero;
}
}
@@ -83,14 +71,14 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
for (int i = 0; i < partRendererList.Count; i++)
{
partRendererList[i].material = Instantiate(normalMaterialList[i]);
partRendererList[i].material = normalMaterialList[i];
}
}
else
{
for (int i = 0; i < partRendererList.Count; i++)
{
partRendererList[i].material = Instantiate(highlightMaterialList[i]);
partRendererList[i].material = highlightMaterialList[i];
}
}
}

View File

@@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Dreamteck.Splines;
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap;
using UniRx;
using UnityEngine;
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public partial class DTMNoteVisualHold : DTMNoteVisual, INoteVisualHold, IHaveTransformSubmodule
{
public Hold hold { get; set; }
public MeshGenerator meshGenerator;
public SplinePositioner headPoint, tailPoint;
public static DTMNoteVisualHold GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName)
{
DTMNoteVisualHold noteVisualHold = SubstantialObject.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement).GetComponent<DTMNoteVisualHold>();
return noteVisualHold;
}
public override void FirstSetUpObject(bool isFirstGenerated)
{
NoteBase note = parentElement as NoteBase;
if(note == null) throw new System.Exception("NoteVisual只能生成在Note下。");
if(!note.isOnTrack) throw new System.Exception("这种HoldNoteVisual只能生成在Track上。");
this.note = note;
note.noteVisual = this;
this.hold = note as Hold;
this.headPoint = notePartList[0].GetComponent<SplinePositioner>();
this.meshGenerator = notePartList[1].GetComponent<MeshGenerator>();
this.tailPoint = notePartList[2].GetComponent<SplinePositioner>();
this.hold.trackPositioner.autoUpdate = false;
headPoint.spline = hold.track.trackPathSubmodule.path;
meshGenerator.spline = hold.track.trackPathSubmodule.path;
tailPoint.spline = hold.track.trackPathSubmodule.path;
}
public override void AfterInitialize()
{
base.AfterInitialize();
Recover();
}
public override void Recover()
{
foreach (GameObject part in notePartList)
{
Renderer rend = part.GetComponent<Renderer>();
if (rend != null)
{
rend.material.SetFloat("_MainAlpha", 1f);
}
}
foreach (EffectBase effect in effectSubmodule.effectCollection["Generate"])
{
effect.Recover();
}
}
}
public partial class DTMNoteVisualHold
{
public override void SaveBM()
{
matchedBM = new DTMNoteVisualHold_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, themeBundleName, objectName);
}
private float startPercent, endPercent;
public void UpdateHoldInMovableTrack()
{
if (effectSubmodule.effectCollection["Generate"].Any(e => e.nowEffectState == EffectBase.EffectState.Middle))
{
return;
}
TrackTimeSubmoduleMovable trackTimeSubmoduleMovable = hold.track.trackTimeSubmodule as TrackTimeSubmoduleMovable;
startPercent = trackTimeSubmoduleMovable.GetTrackPercent(hold.exactJudgeTime + hold.holdingTime);
endPercent = trackTimeSubmoduleMovable.GetTrackPercent(hold.holdEndTime);
hold.trackPositioner.SetPercent(startPercent);
meshGenerator.SetClipRange(startPercent, endPercent);
headPoint.SetPercent(startPercent);
tailPoint.SetPercent(endPercent);
}
public void UpdateHoldInStaticTrack()
{
//throw new NotImplementedException();
}
public void SetTransformObserver()
{
Observable.EveryUpdate().Subscribe(_ =>
{
if (transformSubmodule == null)
{
return;
}
bool willRefresh = false;
if (transformSubmodule.positionDirtyMark)
{
transformSubmodule.currentPosition = transformSubmodule.originalPosition + transformSubmodule.positionOffset;
transformSubmodule.positionDirtyMark = false;
willRefresh = true;
transformSubmodule.positionOffset = Vector3.zero;
}
if (willRefresh)
{
Refresh();
}
}).AddTo(gameObject);
}
public override void Refresh()
{
base.Refresh();
Vector2 posOffset = new Vector2(transformSubmodule.currentPosition.x, transformSubmodule.currentPosition.y);
hold.trackPositioner.motion.offset = posOffset;
meshGenerator.offset = posOffset;
headPoint.motion.offset = posOffset;
tailPoint.motion.offset = posOffset;
}
}
namespace Beatmap
{
public class DTMNoteVisualHold_BM : SubstantialObject_BM
{
public DTMNoteVisualHold_BM()
{
}
public DTMNoteVisualHold_BM(string elementName, Guid id, List<string> tags,
GameElement_BM parent, string themeBundleName, string objectName) :
base(elementName, id, tags, parent, themeBundleName, objectName)
{
}
public override void ExecuteBM()
{
matchedElement = DTMNoteVisualHold.GenerateElement(elementName, elementGuid, tags, false,
GetElement(attachedElementGuid), themeBundleName, objectName);
}
public override GameElement DuplicateBM(GameElement parent)
{
return DTMNoteVisualHold.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent, themeBundleName, objectName);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b426e434ca7bbe4b9dce2a80472de6f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: