This commit is contained in:
Rendo 2025-07-03 19:34:09 +05:00
commit b932e82555
39 changed files with 575 additions and 78 deletions

View file

@ -0,0 +1,10 @@
using Godot;
namespace Newlon.Components.GUI.Seedpackets;
public class AlmanachHandler : SeedpacketHandler
{
public AlmanachHandler(Seedpacket owner) : base(owner)
{
}
}

View file

@ -0,0 +1 @@
uid://pse018r220mt

View file

@ -13,7 +13,7 @@ public class ChoosableHandler : SeedpacketHandler, ISeedpacketPress
var hotbarSeedpacket = Seedpacket.Prefab.Instantiate<Seedpacket>();
LevelGUIElements.Instance.SeedpacketsHotbar.AddChild(hotbarSeedpacket);
hotbarSeedpacket.SetPlantResource(_owner.GetPlantResource());
hotbarSeedpacket.SetResource(_owner.GetResource());
var pregameHandler = new HotbarPregameHandler(hotbarSeedpacket);
hotbarSeedpacket.SetHandler(pregameHandler);

View file

@ -10,13 +10,13 @@ public class HotbarHandler : SeedpacketHandler, ISeedpacketPress, ISeedpacketPro
public void Pressed()
{
PlantField.Instance.SetPlant(_owner, _owner.GetPlantResource());
PlantField.Instance.SetPlant(_owner, _owner.GetResource());
AudioSequencer.Play("lift_seed", Seedpacket.LiftStream);
}
public void Process()
{
_owner.disablePacket = RuntimeLevelData.Instance.SunCount < _owner.GetPlantResource().Cost;
_owner.disablePacket = RuntimeLevelData.Instance.SunCount < _owner.GetResource().Cost;
}
public void OnUnfocused()
{

View file

@ -8,7 +8,7 @@ public partial class Seedpacket : TextureButton
public static AudioStream UntapStream;
public static AudioStream LiftStream;
private const string PATH_TO_PACKED_SCENE = "res://scenes/gui/seedpacket.tscn";
private PlantResource _resource;
private DisplayResource _resource;
private Label _cost;
private TextureRect _icon;
private Timer _timer;
@ -50,14 +50,14 @@ public partial class Seedpacket : TextureButton
}
if (_handler is ISeedpacketProcess processHandler) processHandler.Process();
}
public void SetPlantResource( PlantResource resource )
public void SetResource(DisplayResource resource )
{
_resource = resource;
UpdateContents();
}
public PlantResource GetPlantResource()
public DisplayResource GetResource()
{
return _resource;
}