102 lines
3.4 KiB
C#
102 lines
3.4 KiB
C#
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
|
|
{
|
|
#region [材质字段与属性] Material Fields
|
|
public List<List<Material>> normalMaterialList;
|
|
public List<List<Material>> highlightMaterialList;
|
|
#endregion
|
|
|
|
#region [生命周期与工厂] Lifecycle & Factory
|
|
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;
|
|
|
|
if (note is Flick flick)
|
|
{
|
|
flick.availableFlickDirections = new List<Vector2>() { Vector2.left, Vector2.right };
|
|
}
|
|
}
|
|
|
|
public override void AfterInitialize()
|
|
{
|
|
base.AfterInitialize();
|
|
Recover();
|
|
}
|
|
#endregion
|
|
|
|
#region [视觉控制与恢复] Visual Controls & Recovery
|
|
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 DTMNoteVisual
|
|
{
|
|
public override void SetHighlight()
|
|
{
|
|
//List<Renderer> partRendererList = notePartList.Select(part => part.GetComponent<Renderer>()).ToList();
|
|
|
|
//partRendererList.ForEach(rend => Destroy(rend.material));
|
|
|
|
if (note is Tap or Hold)
|
|
{
|
|
extraPartList[0].gameObject.SetActive(isHighlighted);
|
|
}
|
|
|
|
/*if (!isHighlighted)
|
|
{
|
|
for (int i = 0; i < partRendererList.Count; i++)
|
|
{
|
|
for (int j = 0; j < partRendererList[i].materials.Length; j++)
|
|
{
|
|
partRendererList[i].materials[j] = normalMaterialList[i][j];
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < partRendererList.Count; i++)
|
|
{
|
|
for (int j = 0; j < partRendererList[i].materials.Length; j++)
|
|
{
|
|
partRendererList[i].materials[j] = highlightMaterialList[i][j];
|
|
}
|
|
}
|
|
}*/
|
|
}
|
|
#endregion
|
|
}
|
|
} |