complete refactor

This commit is contained in:
Rendo 2025-07-25 18:48:49 +05:00
commit de2e8b1e50
71 changed files with 212 additions and 137 deletions

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon.Resources;
namespace Newlon.Components.GUI.Seedpackets;
@ -8,7 +9,7 @@ public partial class Seedpacket : TextureButton
public static AudioStream UntapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap2.mp3");
public static AudioStream LiftStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/seedlift.mp3");
private const string PATH_TO_PACKED_SCENE = "res://scenes/gui/seedpacket.tscn";
private EntityResource _resource;
private GridEntityResource _resource;
private Label _cost;
private TextureRect _icon;
private Timer _timer;
@ -46,14 +47,14 @@ public partial class Seedpacket : TextureButton
}
if (_handler is ISeedpacketProcess processHandler) processHandler.Process();
}
public void SetResource(EntityResource resource)
public void SetResource(GridEntityResource resource)
{
_resource = resource;
UpdateContents();
}
public EntityResource GetResource()
public GridEntityResource GetResource()
{
return _resource;
}
@ -69,10 +70,10 @@ public partial class Seedpacket : TextureButton
_cost.Text = _resource.Cost.ToString();
_icon.Texture = _resource.Preview;
_timer.WaitTime = _resource.ReloadTime;
if (_resource.customFrame != null)
if (_resource.CustomFrame != null)
{
TextureNormal = _resource.customFrame.frame;
_cost.LabelSettings = _resource.customFrame.font;
TextureNormal = _resource.CustomFrame.frame;
_cost.LabelSettings = _resource.CustomFrame.font;
}
}