mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-07 03:25:55 +00:00
Intro with new animator
This commit is contained in:
parent
d07fe420dd
commit
cd43b3361d
16 changed files with 788 additions and 19 deletions
60
Scripts/UI/AudioNameVisualizer.cs
Normal file
60
Scripts/UI/AudioNameVisualizer.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Cirno.Scripts;
|
||||
using GTweens.Builders;
|
||||
using GTweens.Easings;
|
||||
using GTweens.Tweens;
|
||||
using GTweensGodot.Extensions;
|
||||
|
||||
public partial class AudioNameVisualizer : AudioStreamPlayer2D
|
||||
{
|
||||
[Export]
|
||||
public string TrackName { get; private set; }
|
||||
|
||||
[Export]
|
||||
public string AuthorName { get; private set; }
|
||||
|
||||
[Export] public PackedScene CanvasTemplate;
|
||||
|
||||
private MusicVisualizerCanvas _canvasLayer;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Setup();
|
||||
|
||||
if (Autoplay)
|
||||
{
|
||||
ShowName();
|
||||
}
|
||||
}
|
||||
|
||||
private void Setup()
|
||||
{
|
||||
var existingCanvas = this.GetTree().Root.GetNodeOrNull<CanvasLayer>("AudioCanvas");
|
||||
|
||||
if (existingCanvas is null)
|
||||
{
|
||||
// _canvasLayer = new CanvasLayer();
|
||||
// _canvasLayer.Name = "AudioCanvas";
|
||||
_canvasLayer = CanvasTemplate.Instantiate<MusicVisualizerCanvas>();
|
||||
GetTree().Root.CallDeferred("add_child", _canvasLayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_canvasLayer = (MusicVisualizerCanvas)existingCanvas;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayWithName()
|
||||
{
|
||||
ShowName();
|
||||
Play();
|
||||
}
|
||||
|
||||
public void ShowName()
|
||||
{
|
||||
GD.Print("show name");
|
||||
_canvasLayer.ShowName(TrackName, AuthorName);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue