Files
ichni_Official/Assets/Scripts/Game/GameElements/ElementFolder/ElementFolder.cs
SoulliesOfficial 6aa498f6be
2025-08-11 14:04:06 -04:00

87 lines
2.7 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using Lean.Pool;
using Sirenix.OdinInspector;
using UniRx;
using UnityEngine;
namespace Ichni.RhythmGame
{
public partial class ElementFolder : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
{
public List<Track> trackList;
public TransformSubmodule transformSubmodule { get; set; }
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
public static ElementFolder GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated, GameElement parentElement)
{
ElementFolder elementFolder = Instantiate(GameManager.instance.basePrefabs.elementFolder).GetComponent<ElementFolder>();
elementFolder.Initialize(name, id, tags, isFirstGenerated, parentElement);
return elementFolder;
}
public override void SetDefaultSubmodules()
{
transformSubmodule = new TransformSubmodule(this);
timeDurationSubmodule = new TimeDurationSubmodule(this);
}
}
public partial class ElementFolder
{
public override void SaveBM()
{
matchedBM = parentElement != null ?
new ElementFolder_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM) :
new ElementFolder_BM(elementName, elementGuid, tags, null);
}
}
public partial class ElementFolder
{
[Button("Test GetAllNotes")]
public List<NoteBase> GetAllNotes()
{
List<NoteBase> notes = new List<NoteBase>();
foreach (GameElement element in childElementList)
{
if (element is NoteBase note)
{
notes.Add(note);
}
}
/*foreach (NoteBase note in notes)
{
Debug.Log(note.GetType() + " " + note.elementName + " " + note.exactJudgeTime);
}*/
return notes;
}
}
namespace Beatmap
{
public class ElementFolder_BM : GameElement_BM
{
public ElementFolder_BM()
{
}
public ElementFolder_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
: base(elementName, elementGuid, tags, attachedElement)
{
}
public override void ExecuteBM()
{
matchedElement = ElementFolder.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid));
}
}
}
}