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

102 lines
3.4 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
{
2026-03-14 03:13:10 -04:00
#region [] Material Fields
2025-09-14 14:53:45 -04:00
public List<List<Material>> normalMaterialList;
public List<List<Material>> highlightMaterialList;
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
2026-03-14 03:13:10 -04:00
#region [] Lifecycle & Factory
2025-06-03 02:42:28 -04:00
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;
2025-09-14 14:53:45 -04:00
2025-09-06 21:58:48 -04:00
if (note is Flick flick)
{
flick.availableFlickDirections = new List<Vector2>() { Vector2.left, Vector2.right };
}
2025-06-03 02:42:28 -04:00
}
public override void AfterInitialize()
{
base.AfterInitialize();
Recover();
}
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
2026-03-14 03:13:10 -04:00
#region [] Visual Controls & Recovery
2025-06-03 02:42:28 -04:00
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 SetHighlight()
{
2025-10-02 23:49:18 -04:00
//List<Renderer> partRendererList = notePartList.Select(part => part.GetComponent<Renderer>()).ToList();
2025-06-03 02:42:28 -04:00
//partRendererList.ForEach(rend => Destroy(rend.material));
2025-10-02 23:49:18 -04:00
if (note is Tap or Hold)
{
extraPartList[0].gameObject.SetActive(isHighlighted);
}
/*if (!isHighlighted)
2025-06-03 02:42:28 -04:00
{
for (int i = 0; i < partRendererList.Count; i++)
{
2025-09-14 14:53:45 -04:00
for (int j = 0; j < partRendererList[i].materials.Length; j++)
{
partRendererList[i].materials[j] = normalMaterialList[i][j];
}
2025-06-03 02:42:28 -04:00
}
}
else
{
for (int i = 0; i < partRendererList.Count; i++)
{
2025-09-14 14:53:45 -04:00
for (int j = 0; j < partRendererList[i].materials.Length; j++)
{
partRendererList[i].materials[j] = highlightMaterialList[i][j];
}
2025-06-03 02:42:28 -04:00
}
2025-10-02 23:49:18 -04:00
}*/
2025-06-03 02:42:28 -04:00
}
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
}
}