27 lines
740 B
C#
27 lines
740 B
C#
using Godot;
|
|
|
|
[Tool]
|
|
public partial class ZE_RowEditor : VBoxContainer
|
|
{
|
|
private PackedScene buttonScene = ResourceLoader.Load<PackedScene>("uid://segxys6udhyw");
|
|
[Signal] public delegate void SaveCallbackEventHandler();
|
|
public RowSpawn editedSpawn;
|
|
public override void _Ready()
|
|
{
|
|
for (int i = 0; i < editedSpawn.zombies.Count; i++)
|
|
{
|
|
var button = buttonScene.Instantiate<ZE_GridItem>();
|
|
AddChild(button);
|
|
button.index = i;
|
|
if (editedSpawn.zombies[i] != null)
|
|
button.SetData(editedSpawn.zombies[i]);
|
|
button.ResourceChanged += OnResourceChanged;
|
|
}
|
|
}
|
|
|
|
public void OnResourceChanged(ZombieResource resource, int index)
|
|
{
|
|
editedSpawn.zombies[index] = resource;
|
|
EmitSignal(SignalName.SaveCallback);
|
|
}
|
|
}
|