fix chart reading, scroll chart notes!
This commit is contained in:
+46
-2
@@ -1,6 +1,8 @@
|
||||
using System.Reflection.PortableExecutable;
|
||||
using Godot;
|
||||
using WacK.Data.Chart;
|
||||
using WacK.Data.Mer;
|
||||
using WacK.Things.TunnelObjects;
|
||||
|
||||
namespace WacK.Scenes
|
||||
{
|
||||
@@ -24,13 +26,55 @@ namespace WacK.Scenes
|
||||
// initialized by another scene, BEFORE loading this one!
|
||||
public static PlayParameters playParams;
|
||||
|
||||
// TunnelObjects we can instantiate
|
||||
public static PackedScene notePlay = GD.Load<PackedScene>("res://Things/TunnelObjects/Notes/NoteTouch.tscn");
|
||||
|
||||
[Export]
|
||||
public Control noteDisplay;
|
||||
|
||||
private Chart chart;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
// parse mer and create chart for current play
|
||||
chart = new(playParams.chartPath);
|
||||
}
|
||||
private void OnDestroy()
|
||||
RealizeChart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates necessary notes onto the noteDisplay for the player to see.
|
||||
/// </summary>
|
||||
private void RealizeChart()
|
||||
{
|
||||
foreach (var msNote in chart.playNotes)
|
||||
{
|
||||
GD.Print(msNote.Key);
|
||||
foreach (var note in msNote.Value)
|
||||
{
|
||||
THNotePlay nNote;
|
||||
switch (note)
|
||||
{
|
||||
default: // tap note
|
||||
nNote = notePlay.Instantiate<THNotePlay>();
|
||||
break;
|
||||
}
|
||||
nNote.Init(note);
|
||||
var nPos = nNote.Position;
|
||||
nPos.Y = msNote.Key * -1000;
|
||||
nNote.Position = nPos;
|
||||
noteDisplay.AddChild(nNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
var nPos = noteDisplay.Position;
|
||||
nPos.Y += (float)delta * 1000;
|
||||
noteDisplay.Position = nPos;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
playParams = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user