Disordered editor start
This commit is contained in:
parent
24be556e38
commit
f9a3a5427c
18 changed files with 223 additions and 17 deletions
7
addons/pvzadventure/GroupSpawn.cs
Normal file
7
addons/pvzadventure/GroupSpawn.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
using Godot;
|
||||
|
||||
public partial class GroupSpawn : Resource
|
||||
{
|
||||
[Export] public PackedScene packedScene;
|
||||
[Export] public int amount;
|
||||
}
|
||||
1
addons/pvzadventure/GroupSpawn.cs.uid
Normal file
1
addons/pvzadventure/GroupSpawn.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b604mrxpt0owi
|
||||
12
addons/pvzadventure/RowSpawn.cs
Normal file
12
addons/pvzadventure/RowSpawn.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public partial class RowSpawn : Resource
|
||||
{
|
||||
[Export] public SpawnInfo zombie1;
|
||||
[Export] public SpawnInfo zombie2;
|
||||
[Export] public SpawnInfo zombie3;
|
||||
[Export] public SpawnInfo zombie4;
|
||||
[Export] public SpawnInfo zombie5;
|
||||
|
||||
}
|
||||
1
addons/pvzadventure/RowSpawn.cs.uid
Normal file
1
addons/pvzadventure/RowSpawn.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://comcftlx0eey2
|
||||
|
|
@ -5,7 +5,7 @@ using Godot.Collections;
|
|||
[Tool]
|
||||
public partial class WaveData : Resource
|
||||
{
|
||||
[Export] private Array<SpawnInfo> zombiesDisordered;
|
||||
[Export] private Array<SpawnInfo> zombiesOrdered;
|
||||
[Export] private Array<GroupSpawn> zombiesDisordered;
|
||||
[Export] private Array<RowSpawn> zombiesOrdered;
|
||||
[Export] private Array<FieldSpawn> spawns;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public partial class ZombieRowSpawn : Resource
|
||||
{
|
||||
[Export] public ZombieResource zombie1;
|
||||
[Export] public ZombieResource zombie2;
|
||||
[Export] public ZombieResource zombie3;
|
||||
[Export] public ZombieResource zombie4;
|
||||
[Export] public ZombieResource zombie5;
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dkq82o31vr3i2"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dkq82o31vr3i2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dkgxtig5fwdgi" path="res://addons/pvzadventure/scripts/AdventureEditor.cs" id="1_go5yu"]
|
||||
[ext_resource type="Script" uid="uid://binuuattefn7d" path="res://addons/pvzadventure/scripts/FileButton.cs" id="2_d5hwn"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbiv5n3asc848" path="res://addons/pvzadventure/scenes/disordered_editor.tscn" id="3_1ojhm"]
|
||||
[ext_resource type="Script" uid="uid://b0hl4ap18wbb2" path="res://addons/pvzadventure/scripts/AdventureResourceInspector.cs" id="3_d5hwn"]
|
||||
|
||||
[node name="AdventureEditor" type="MarginContainer"]
|
||||
|
|
@ -48,6 +49,9 @@ split_offset = 500
|
|||
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/WorkArea"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DisorderedEditor" parent="VBoxContainer/WorkArea/PanelContainer" instance=ExtResource("3_1ojhm")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Inspector" type="VSplitContainer" parent="VBoxContainer/WorkArea"]
|
||||
layout_mode = 2
|
||||
|
||||
|
|
|
|||
43
addons/pvzadventure/scenes/disordered_editor.tscn
Normal file
43
addons/pvzadventure/scenes/disordered_editor.tscn
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dbiv5n3asc848"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dvwbkbsccrnri" path="res://addons/pvzadventure/scripts/DisorderedEditor.cs" id="1_55p46"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_c8vty"]
|
||||
content_margin_left = 20.0
|
||||
bg_color = Color(0.351173, 0.700939, 0, 1)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(0.216217, 0.607245, 9.62615e-07, 1)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[node name="DisorderedEditor" type="ScrollContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
vertical_scroll_mode = 0
|
||||
script = ExtResource("1_55p46")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 0
|
||||
theme_override_constants/margin_top = 0
|
||||
theme_override_constants/margin_right = 0
|
||||
theme_override_constants/margin_bottom = 200
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="AddButton" type="Button" parent="MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_c8vty")
|
||||
45
addons/pvzadventure/scenes/dn_d_card.tscn
Normal file
45
addons/pvzadventure/scenes/dn_d_card.tscn
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dcxxgs78o2apq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c2wsvwbqpay8p" path="res://addons/pvzadventure/scripts/DnDCard.cs" id="1_k1qq1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_t7e3j"]
|
||||
bg_color = Color(0.136826, 0.136826, 0.136826, 1)
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color(0.099986, 0.099986, 0.0999859, 1)
|
||||
border_blend = true
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_k1qq1"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[node name="DnDCard" type="PanelContainer"]
|
||||
custom_minimum_size = Vector2(60, 80)
|
||||
anchors_preset = -1
|
||||
anchor_right = 0.098
|
||||
anchor_bottom = 0.172
|
||||
offset_right = 1.2
|
||||
offset_bottom = 11.2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_t7e3j")
|
||||
script = ExtResource("1_k1qq1")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
texture = SubResource("ViewportTexture_k1qq1")
|
||||
expand_mode = 4
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
canvas_item_default_texture_filter = 0
|
||||
size = Vector2i(50, 70)
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="SubViewport"]
|
||||
position = Vector2(0, -40)
|
||||
zoom = Vector2(0.6, 0.6)
|
||||
23
addons/pvzadventure/scenes/dn_d_with_number.tscn
Normal file
23
addons/pvzadventure/scenes/dn_d_with_number.tscn
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bcswnjdptjuuf"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dcxxgs78o2apq" path="res://addons/pvzadventure/scenes/dn_d_card.tscn" id="1_7k686"]
|
||||
[ext_resource type="Script" uid="uid://da8tobx0q5ij3" path="res://addons/pvzadventure/scripts/DnDWithNumber.cs" id="1_dkrus"]
|
||||
|
||||
[node name="DnDWithNumber" type="VBoxContainer"]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_dkrus")
|
||||
|
||||
[node name="DnDCard" parent="." instance=ExtResource("1_7k686")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
min_value = 1.0
|
||||
value = 1.0
|
||||
allow_greater = true
|
||||
|
||||
[connection signal="DnDDropped" from="DnDCard" to="." method="OnCardDropped"]
|
||||
[connection signal="value_changed" from="SpinBox" to="." method="OnNumberSubmitted"]
|
||||
|
|
@ -19,4 +19,5 @@ public partial class AdventureEditor : MarginContainer
|
|||
{
|
||||
ResourceSaver.Save(editedResource, editedPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
7
addons/pvzadventure/scripts/DisorderedEditor.cs
Normal file
7
addons/pvzadventure/scripts/DisorderedEditor.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public partial class DisorderedEditor : ScrollContainer
|
||||
{
|
||||
public WaveData editedWave;
|
||||
}
|
||||
1
addons/pvzadventure/scripts/DisorderedEditor.cs.uid
Normal file
1
addons/pvzadventure/scripts/DisorderedEditor.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dvwbkbsccrnri
|
||||
37
addons/pvzadventure/scripts/DnDCard.cs
Normal file
37
addons/pvzadventure/scripts/DnDCard.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
[Tool]
|
||||
public partial class DnDCard : PanelContainer
|
||||
{
|
||||
private Variant tempData;
|
||||
private PackedScene packedScene;
|
||||
private Node instantiated;
|
||||
|
||||
[Signal] public delegate void DnDDroppedEventHandler(PackedScene scene);
|
||||
|
||||
public override void _Notification(int what)
|
||||
{
|
||||
if (what == NotificationDragBegin)
|
||||
{
|
||||
tempData = GetViewport().GuiGetDragData();
|
||||
}
|
||||
else if (what == NotificationDragEnd && GetGlobalRect().HasPoint(GetGlobalMousePosition()))
|
||||
{
|
||||
var loaded = ResourceLoader.Load(tempData.AsGodotDictionary()["files"].AsStringArray()[0]);
|
||||
if (loaded is PackedScene scene)
|
||||
{
|
||||
packedScene = scene;
|
||||
EmitSignal(SignalName.DnDDropped, packedScene);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Refresh()
|
||||
{
|
||||
if (instantiated != null) instantiated.QueueFree();
|
||||
instantiated = packedScene.Instantiate();
|
||||
GetNode("SubViewport").AddChild(instantiated);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1
addons/pvzadventure/scripts/DnDCard.cs.uid
Normal file
1
addons/pvzadventure/scripts/DnDCard.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c2wsvwbqpay8p
|
||||
26
addons/pvzadventure/scripts/DnDWithNumber.cs
Normal file
26
addons/pvzadventure/scripts/DnDWithNumber.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public partial class DnDWithNumber : VBoxContainer
|
||||
{
|
||||
[Signal] public delegate void DnDChangedEventHandler(PackedScene scene, int number);
|
||||
private PackedScene packedScene;
|
||||
private int number;
|
||||
|
||||
public void OnCardDropped(PackedScene scene)
|
||||
{
|
||||
packedScene = scene;
|
||||
SendSignal();
|
||||
}
|
||||
|
||||
public void OnNumberSubmitted(float value)
|
||||
{
|
||||
number = (int)value;
|
||||
SendSignal();
|
||||
}
|
||||
|
||||
public void SendSignal()
|
||||
{
|
||||
EmitSignal(SignalName.DnDChanged, packedScene, number);
|
||||
}
|
||||
}
|
||||
1
addons/pvzadventure/scripts/DnDWithNumber.cs.uid
Normal file
1
addons/pvzadventure/scripts/DnDWithNumber.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://da8tobx0q5ij3
|
||||
|
|
@ -1,9 +1,17 @@
|
|||
[gd_resource type="Resource" script_class="AdventureLevelResource" load_steps=2 format=3 uid="uid://bx1wnrgickeyd"]
|
||||
[gd_resource type="Resource" script_class="AdventureLevelResource" load_steps=4 format=3 uid="uid://bx1wnrgickeyd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bximdujbkj2n4" path="res://addons/pvzadventure/AdventureLevelResource.cs" id="1_ed2ji"]
|
||||
[ext_resource type="Script" uid="uid://7rptlb5qr3b6" path="res://addons/pvzadventure/WaveData.cs" id="2_46l53"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_46l53"]
|
||||
script = ExtResource("2_46l53")
|
||||
zombiesDisordered = [null]
|
||||
zombiesOrdered = [null]
|
||||
spawns = [null]
|
||||
metadata/_custom_type_script = "uid://7rptlb5qr3b6"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ed2ji")
|
||||
startSun = 0.0
|
||||
waves = []
|
||||
waves = [SubResource("Resource_46l53")]
|
||||
metadata/_custom_type_script = "uid://bximdujbkj2n4"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue