Save on edit
This commit is contained in:
parent
19e16c62d7
commit
f7d19bbae6
10 changed files with 86 additions and 68 deletions
|
|
@ -60,11 +60,12 @@ layout_mode = 2
|
|||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ResourceInspector" type="VBoxContainer" parent="Editor/WorkArea/Inspector" node_paths=PackedStringArray("editorContainer")]
|
||||
[node name="ResourceInspector" type="VBoxContainer" parent="Editor/WorkArea/Inspector" node_paths=PackedStringArray("editorContainer", "adventureEditor")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("3_d5hwn")
|
||||
editorContainer = NodePath("../../PanelContainer")
|
||||
adventureEditor = NodePath("../../../..")
|
||||
|
||||
[node name="Tree" type="Tree" parent="Editor/WorkArea/Inspector/ResourceInspector"]
|
||||
custom_minimum_size = Vector2(0, 100)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://segxys6udhyw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://fof6kr0et8ng" path="res://addons/pvzadventure/scripts/ZE_GridItem.cs" id="1_agbb0"]
|
||||
[ext_resource type="Script" uid="uid://fof6kr0et8ng" path="res://addons/pvzadventure/scripts/ZE_GridItem.cs" id="1_fwfh1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jbknv"]
|
||||
bg_color = Color(0.18359, 0.18359, 0.18359, 1)
|
||||
|
|
@ -19,7 +19,7 @@ anchor_bottom = 0.25
|
|||
offset_right = -0.200005
|
||||
offset_bottom = -15.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_jbknv")
|
||||
script = ExtResource("1_agbb0")
|
||||
script = ExtResource("1_fwfh1")
|
||||
|
||||
[node name="Texture" type="TextureRect" parent="."]
|
||||
layout_mode = 2
|
||||
|
|
@ -131,5 +131,6 @@ size_flags_horizontal = 3
|
|||
size_flags_vertical = 3
|
||||
script = ExtResource("1_klhya")
|
||||
|
||||
[connection signal="SaveCallback" from="ZombieGrid/HBoxContainer/RowEditors" to="." method="Save"]
|
||||
[connection signal="pressed" from="ZombieGrid/HBoxContainer/ControlButtons/NewButton" to="ZombieGrid/HBoxContainer/RowEditors" method="AddSpawn"]
|
||||
[connection signal="pressed" from="ZombieGrid/HBoxContainer/ControlButtons/RemoveButton" to="ZombieGrid/HBoxContainer/RowEditors" method="RemoveSpawn"]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ public partial class AdventureResourceInspector : Node
|
|||
|
||||
[Export]
|
||||
public Control editorContainer;
|
||||
[Export]
|
||||
public AdventureEditor adventureEditor;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -106,6 +108,7 @@ public partial class AdventureResourceInspector : Node
|
|||
|
||||
editorContainer.AddChild(editor);
|
||||
editor.SetEditedWave(heldResource.waves[GetWaveIndex(selected.GetParent())]);
|
||||
editor.SaveCallback += adventureEditor.Save;
|
||||
return;
|
||||
}
|
||||
else if (index == EVENTS)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ public partial class ZE_GridContainer : Control
|
|||
{
|
||||
private PackedScene rowEditorScene = ResourceLoader.Load<PackedScene>("uid://buvnw8a7pku78");
|
||||
private WaveData waveData;
|
||||
[Signal] public delegate void SaveCallbackEventHandler();
|
||||
public void SetData(WaveData data)
|
||||
{
|
||||
waveData = data;
|
||||
|
|
@ -33,6 +34,11 @@ public partial class ZE_GridContainer : Control
|
|||
{
|
||||
var editor = rowEditorScene.Instantiate<ZE_RowEditor>();
|
||||
editor.editedSpawn = spawn;
|
||||
editor.SaveCallback += Save;
|
||||
AddChild(editor);
|
||||
}
|
||||
private void Save()
|
||||
{
|
||||
EmitSignal(SignalName.SaveCallback);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Godot;
|
|||
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()
|
||||
{
|
||||
|
|
@ -21,5 +22,6 @@ public partial class ZE_RowEditor : VBoxContainer
|
|||
public void OnResourceChanged(ZombieResource resource, int index)
|
||||
{
|
||||
editedSpawn.zombies[index] = resource;
|
||||
EmitSignal(SignalName.SaveCallback);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,15 @@ public partial class ZombieEditor : VBoxContainer
|
|||
{
|
||||
public WaveData editedWave;
|
||||
[Export] private ZE_GridContainer container;
|
||||
[Signal] public delegate void SaveCallbackEventHandler();
|
||||
|
||||
public void SetEditedWave(WaveData data)
|
||||
{
|
||||
editedWave = data;
|
||||
container.SetData(editedWave);
|
||||
}
|
||||
public void Save()
|
||||
{
|
||||
EmitSignal(SignalName.SaveCallback);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue