Rework
This commit is contained in:
parent
57f30b8018
commit
623362e430
33 changed files with 69 additions and 261 deletions
|
|
@ -4,9 +4,8 @@ using System;
|
|||
[Tool]
|
||||
public partial class AdventureResourceInspector : Node
|
||||
{
|
||||
const int DISORDERED = 0;
|
||||
const int ORDERED = 1;
|
||||
const int SPAWNS = 2;
|
||||
const int ORDERED = 0;
|
||||
const int EVENTS = 1;
|
||||
|
||||
private Tree tree;
|
||||
private AdventureLevelResource heldResource;
|
||||
|
|
@ -31,6 +30,7 @@ public partial class AdventureResourceInspector : Node
|
|||
tree.Clear();
|
||||
root = tree.CreateItem();
|
||||
root.DisableFolding = true;
|
||||
root.SetText(0, "Level");
|
||||
EmitSignal(SignalName.Refreshed);
|
||||
|
||||
for (int i = 0; i < heldResource.waves.Count; i++)
|
||||
|
|
@ -40,14 +40,11 @@ public partial class AdventureResourceInspector : Node
|
|||
item.SetText(0, string.Format("Wave {0}", i));
|
||||
item.AddButton(0, deleteTexture, tooltipText: "Removes wave. (note that number will not visibly change)");
|
||||
|
||||
var disorder = tree.CreateItem(item);
|
||||
disorder.SetText(0, "Disordered zombies");
|
||||
|
||||
var order = tree.CreateItem(item);
|
||||
order.SetText(0, "Ordered zombies");
|
||||
order.SetText(0, "Zombies");
|
||||
|
||||
var spawns = tree.CreateItem(item);
|
||||
spawns.SetText(0, "Field spawns");
|
||||
spawns.SetText(0, "Events");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,20 +58,24 @@ public partial class AdventureResourceInspector : Node
|
|||
public void OnItemSelected()
|
||||
{
|
||||
var selected = tree.GetSelected();
|
||||
if (selected.GetParent() == root) return;
|
||||
|
||||
var index = selected.GetIndex();
|
||||
if (index == DISORDERED)
|
||||
if (selected == root)
|
||||
{
|
||||
GD.Print("level pressed");
|
||||
|
||||
}
|
||||
else if (index == ORDERED)
|
||||
{
|
||||
|
||||
}
|
||||
else if (index == SPAWNS)
|
||||
else
|
||||
{
|
||||
if (selected.GetParent() == root) return;
|
||||
|
||||
var index = selected.GetIndex();
|
||||
if (index == ORDERED)
|
||||
{
|
||||
GD.Print("Zombies pressed");
|
||||
}
|
||||
else if (index == EVENTS)
|
||||
{
|
||||
GD.Print("Events pressed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public partial class DisorderedEditor : ScrollContainer
|
||||
{
|
||||
public WaveData editedWave;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://dvwbkbsccrnri
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
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 +0,0 @@
|
|||
uid://c2wsvwbqpay8p
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
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 +0,0 @@
|
|||
uid://da8tobx0q5ij3
|
||||
Loading…
Add table
Add a link
Reference in a new issue