2023-08-13 20:11:40 -07:00
|
|
|
using Godot;
|
|
|
|
using SupaLidlGame.Extensions;
|
|
|
|
|
|
|
|
namespace SupaLidlGame.UI;
|
|
|
|
|
|
|
|
public partial class LocationDisplay : CenterContainer
|
|
|
|
{
|
|
|
|
private Label _mapName;
|
|
|
|
private Label _subtitle;
|
|
|
|
private AnimationPlayer _animPlayer;
|
|
|
|
|
|
|
|
public override void _Ready()
|
|
|
|
{
|
|
|
|
_mapName = GetNode<Label>("%MapName");
|
|
|
|
_subtitle = GetNode<Label>("%Subtitle");
|
|
|
|
_animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
|
|
|
|
|
|
|
|
var bus = this.GetEventBus();
|
|
|
|
bus.AreaChanged += OnAreaChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnAreaChanged(Scenes.Map map)
|
|
|
|
{
|
|
|
|
//var map = args.Map;
|
|
|
|
|
|
|
|
// if the area name is the same as the map name, do not show a subtitle
|
|
|
|
_subtitle.Visible = map.AreaName != map.MapName;
|
|
|
|
_mapName.Text = map.MapName;
|
|
|
|
_subtitle.Text = map.AreaName;
|
2023-08-15 19:52:15 -07:00
|
|
|
_animPlayer.Stop();
|
2023-08-13 20:11:40 -07:00
|
|
|
_animPlayer.Play("show");
|
|
|
|
}
|
|
|
|
}
|