You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.2 KiB

2 days ago
using Godot;
using System;
public partial class OptionPicker : Node2D
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void Reset()
{
foreach (Node child in GetChildren())
{
if (child is SlotSymbol slotSymbol)
{
slotSymbol.SetToRandom();
}
}
}
public void Show(bool visible = true)
2 days ago
{
foreach (CanvasItem child in GetChildren())
{
child.Visible = visible;
}
}
public void Hide()
{
Show(false);
}
public const double SLIDE_DELAY = .15;
public const double SLIDE_TIME = .25;
2 days ago
public SlotSymbol Select(int index)
{
SlotSymbol child = GetChildren()[index+1] as SlotSymbol;
var tween = CreateTween();
tween.TweenInterval(SLIDE_DELAY);
tween.TweenProperty(child, "position", child.Position - new Vector2(0, 180), SLIDE_TIME);
tween.TweenCallback(Callable.From(Hide));
tween.TweenProperty(child, "position", child.Position, 0);
//Show(false);
return child;
2 days ago
}
}