Disordered editor start
This commit is contained in:
parent
24be556e38
commit
f9a3a5427c
18 changed files with 223 additions and 17 deletions
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue