Files
ichni_Creator_Studio/Assets/ThemeBundles/DepartureToMultiverse/Scripts/NoteVisual/DTMNoteVisual.cs

135 lines
4.9 KiB
C#
Raw Normal View History

2025-02-17 14:46:14 -05:00
using System;
using System.Collections;
using System.Collections.Generic;
2025-04-20 14:30:28 -04:00
using System.Linq;
2025-02-17 14:46:14 -05:00
using Ichni.RhythmGame.Beatmap;
2025-04-20 14:30:28 -04:00
using Ichni.RhythmGame.ThemeBundles.Basic;
2025-02-17 14:46:14 -05:00
using UnityEngine;
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public partial class DTMNoteVisual : NoteVisualBase
{
2025-09-19 23:39:23 -04:00
public List<List<Material>> normalMaterialList;
public List<List<Material>> highlightMaterialList;
2025-05-20 04:28:10 -04:00
2025-03-13 13:49:27 -04:00
public new static DTMNoteVisual GenerateElement(string elementName, Guid id, List<string> tags,
2025-05-20 04:28:10 -04:00
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement, bool isHighlighted)
2025-02-17 14:46:14 -05:00
{
2025-05-20 04:28:10 -04:00
DTMNoteVisual noteVisual = NoteVisualBase.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isHighlighted).GetComponent<DTMNoteVisual>();
2025-02-28 20:08:00 +08:00
return noteVisual;
}
2025-02-28 20:08:00 +08:00
public override void FirstSetUpObject(bool isFirstGenerated)
{
2025-02-17 14:46:14 -05:00
NoteBase note = parentElement as NoteBase;
2025-02-28 20:08:00 +08:00
if (note == null) throw new System.Exception("NoteVisual只能生成在Note下。");
this.note = note;
note.noteVisual = this;
2025-02-17 14:46:14 -05:00
if (isFirstGenerated)
{
2025-03-11 17:28:49 -04:00
note.noteJudgeSubmodule.AddJudgeUnit("TouchArea");
2025-04-20 14:30:28 -04:00
effectSubmodule.effectCollection["Generate"].Add(new DTMNoteGenerateExpand(this, 1f, 0.2f));
effectSubmodule.effectCollection["Perfect"].Add(new DTMNotePerfectBurst(this));
2025-03-13 13:49:27 -04:00
if (objectName.Contains("Tap"))
{
effectSubmodule.effectCollection["Good"].Add(new DTMNoteGoodBurst(this));
effectSubmodule.effectCollection["Bad"].Add(new DTMNoteBadBurst(this));
}
2025-04-20 14:30:28 -04:00
effectSubmodule.effectCollection["Miss"].Add(new DTMNoteMissTransparent(this, 0.2f));
2025-02-17 14:46:14 -05:00
}
}
2025-04-20 14:30:28 -04:00
public override void AfterInitialize()
{
2025-05-10 14:27:10 -04:00
base.AfterInitialize();
2025-04-20 14:30:28 -04:00
Recover();
}
public override void Recover()
{
2025-07-20 13:39:29 -04:00
foreach (GameObject part in notePartList)
2025-04-20 14:30:28 -04:00
{
2025-07-20 13:39:29 -04:00
Renderer rend = part.GetComponent<Renderer>();
if (rend != null)
{
rend.material.SetFloat("_MainAlpha", 1f);
}
2025-04-20 14:30:28 -04:00
}
2025-07-20 13:39:29 -04:00
foreach (EffectBase effect in effectSubmodule.effectCollection["Generate"])
{
effect.Recover();
}
2025-04-20 14:30:28 -04:00
}
2025-02-17 14:46:14 -05:00
}
public partial class DTMNoteVisual
{
public override void SaveBM()
{
matchedBM = new Beatmap.DTMNoteVisual_BM(elementName, elementGuid, tags,
2025-05-20 04:28:10 -04:00
parentElement.matchedBM as GameElement_BM, themeBundleName, objectName, isHighlighted);
}
public override void SetHighlight()
{
2025-09-19 23:39:23 -04:00
//List<Renderer> partRendererList = notePartList.Select(part => part.GetComponent<Renderer>()).ToList();
2025-05-20 04:28:10 -04:00
//partRendererList.ForEach(rend => Destroy(rend.material));
2025-09-19 23:39:23 -04:00
if (note is Tap or Hold)
{
extraPartList[0].gameObject.SetActive(isHighlighted);
}
/*if (!isHighlighted)
2025-05-20 04:28:10 -04:00
{
for (int i = 0; i < partRendererList.Count; i++)
{
partRendererList[i].material = Instantiate(normalMaterialList[i]);
}
}
else
{
for (int i = 0; i < partRendererList.Count; i++)
{
partRendererList[i].material = Instantiate(highlightMaterialList[i]);
}
2025-09-19 23:39:23 -04:00
}*/
2025-02-17 14:46:14 -05:00
}
}
namespace Beatmap
{
2025-05-20 04:28:10 -04:00
public class DTMNoteVisual_BM : NoteVisualBase_BM
2025-02-17 14:46:14 -05:00
{
public DTMNoteVisual_BM()
{
}
public DTMNoteVisual_BM(string elementName, Guid id, List<string> tags,
2025-05-20 04:28:10 -04:00
GameElement_BM parent, string themeBundleName, string objectName, bool isHighlighted) :
base(elementName, id, tags, parent, themeBundleName, objectName, isHighlighted)
2025-02-17 14:46:14 -05:00
{
}
public override void ExecuteBM()
{
matchedElement = DTMNoteVisual.GenerateElement(elementName, elementGuid, tags, false,
2025-05-20 04:28:10 -04:00
themeBundleName, objectName, GetElement(attachedElementGuid), isHighlighted);
2025-02-17 14:46:14 -05:00
}
public override GameElement DuplicateBM(GameElement parent)
{
return DTMNoteVisual.GenerateElement(elementName, Guid.NewGuid(), tags, false, themeBundleName,
2025-05-20 04:28:10 -04:00
objectName, parent, isHighlighted);
2025-02-17 14:46:14 -05:00
}
}
}
}