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

110 lines
3.5 KiB
C#
Raw Normal View History

2025-06-03 02:42:28 -04:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public partial class DTMNoteVisual : NoteVisualBase
{
public List<Material> normalMaterialList;
public List<Material> highlightMaterialList;
public new static DTMNoteVisual GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement, bool isHighlighted)
{
DTMNoteVisual noteVisual = NoteVisualBase.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isHighlighted).GetComponent<DTMNoteVisual>();
return noteVisual;
}
public override void FirstSetUpObject(bool isFirstGenerated)
{
NoteBase note = parentElement as NoteBase;
if (note == null) throw new System.Exception("NoteVisual只能生成在Note下。");
this.note = note;
note.noteVisual = this;
}
public override void AfterInitialize()
{
base.AfterInitialize();
Recover();
}
public override void Recover()
{
2025-07-21 05:42:20 -04:00
foreach (GameObject part in notePartList)
2025-06-03 02:42:28 -04:00
{
2025-07-21 05:42:20 -04:00
Renderer rend = part.GetComponent<Renderer>();
if (rend != null)
{
rend.material.SetFloat("_MainAlpha", 1f);
}
}
2025-06-03 02:42:28 -04:00
2025-07-21 05:42:20 -04:00
foreach (EffectBase effect in effectSubmodule.effectCollection["Generate"])
2025-06-03 02:42:28 -04:00
{
2025-07-21 05:42:20 -04:00
effect.Recover();
2025-06-03 02:42:28 -04:00
}
}
}
public partial class DTMNoteVisual
{
public override void SaveBM()
{
matchedBM = new Beatmap.DTMNoteVisual_BM(elementName, elementGuid, tags,
parentElement.matchedBM as GameElement_BM, themeBundleName, objectName, isHighlighted);
}
public override void SetHighlight()
{
List<Renderer> partRendererList = notePartList.Select(part => part.GetComponent<Renderer>()).ToList();
//partRendererList.ForEach(rend => Destroy(rend.material));
if (!isHighlighted)
{
for (int i = 0; i < partRendererList.Count; i++)
{
2025-07-21 05:42:20 -04:00
partRendererList[i].material = normalMaterialList[i];
2025-06-03 02:42:28 -04:00
}
}
else
{
for (int i = 0; i < partRendererList.Count; i++)
{
2025-07-21 05:42:20 -04:00
partRendererList[i].material = highlightMaterialList[i];
2025-06-03 02:42:28 -04:00
}
}
}
}
namespace Beatmap
{
public class DTMNoteVisual_BM : NoteVisualBase_BM
{
public DTMNoteVisual_BM()
{
}
public DTMNoteVisual_BM(string elementName, Guid id, List<string> tags,
GameElement_BM parent, string themeBundleName, string objectName, bool isHighlighted) :
base(elementName, id, tags, parent, themeBundleName, objectName, isHighlighted)
{
}
public override void ExecuteBM()
{
matchedElement = DTMNoteVisual.GenerateElement(elementName, elementGuid, tags, false,
themeBundleName, objectName, GetElement(attachedElementGuid), isHighlighted);
}
}
}
}