diff --git a/mono/2.5d/2.5D Demo (Mono C#).csproj b/mono/2.5d/2.5D Demo (Mono C#).csproj
index 7282c23c..0dbfc3d1 100644
--- a/mono/2.5d/2.5D Demo (Mono C#).csproj
+++ b/mono/2.5d/2.5D Demo (Mono C#).csproj
@@ -1,4 +1,4 @@
-
+
Debug
@@ -53,6 +53,7 @@
+
@@ -63,4 +64,4 @@
-
\ No newline at end of file
+
diff --git a/mono/2.5d/addons/node25d-cs/Node25D.cs b/mono/2.5d/addons/node25d-cs/Node25D.cs
index 99afb8b6..bdfc9d90 100644
--- a/mono/2.5d/addons/node25d-cs/Node25D.cs
+++ b/mono/2.5d/addons/node25d-cs/Node25D.cs
@@ -83,6 +83,10 @@ public class Node25D : Node2D, IComparable
///
protected void Node25DProcess()
{
+ if (transform25D.basis == new Basis25D())
+ {
+ SetViewMode(0);
+ }
CheckViewMode();
if (spatialNode != null)
{
@@ -92,34 +96,60 @@ public class Node25D : Node2D, IComparable
{
spatialNode = GetChild(0);
}
+
GlobalPosition = transform25D.FlatPosition;
}
+ public void SetViewMode(int viewModeIndex)
+ {
+ switch (viewModeIndex)
+ {
+ case 0:
+ transform25D.basis = Basis25D.FortyFive * SCALE;
+ break;
+ case 1:
+ transform25D.basis = Basis25D.Isometric * SCALE;
+ break;
+ case 2:
+ transform25D.basis = Basis25D.TopDown * SCALE;
+ break;
+ case 3:
+ transform25D.basis = Basis25D.FrontSide * SCALE;
+ break;
+ case 4:
+ transform25D.basis = Basis25D.ObliqueY * SCALE;
+ break;
+ case 5:
+ transform25D.basis = Basis25D.ObliqueZ * SCALE;
+ break;
+ }
+ }
+
private void CheckViewMode()
{
- if (Input.IsActionJustPressed("top_down_mode"))
+ if (Input.IsActionJustPressed("forty_five_mode"))
{
- transform25D.basis = Basis25D.TopDown * SCALE;
- }
- else if (Input.IsActionJustPressed("front_side_mode"))
- {
- transform25D.basis = Basis25D.FrontSide * SCALE;
- }
- else if (Input.IsActionJustPressed("forty_five_mode"))
- {
- transform25D.basis = Basis25D.FortyFive * SCALE;
+ SetViewMode(0);
}
else if (Input.IsActionJustPressed("isometric_mode"))
{
- transform25D.basis = Basis25D.Isometric * SCALE;
+ SetViewMode(1);
+ }
+ else if (Input.IsActionJustPressed("top_down_mode"))
+ {
+ SetViewMode(2);
+ }
+ else if (Input.IsActionJustPressed("front_side_mode"))
+ {
+ SetViewMode(3);
}
else if (Input.IsActionJustPressed("oblique_y_mode"))
{
- transform25D.basis = Basis25D.ObliqueY * SCALE;
+ SetViewMode(4);
}
else if (Input.IsActionJustPressed("oblique_z_mode"))
{
- transform25D.basis = Basis25D.ObliqueZ * SCALE;
+ SetViewMode(5);
}
}
diff --git a/mono/2.5d/addons/node25d-cs/main_screen/.broken-cs-files/Viewport25D.cs b/mono/2.5d/addons/node25d-cs/main_screen/.broken-cs-files/Viewport25D.cs
new file mode 100644
index 00000000..f1ead376
--- /dev/null
+++ b/mono/2.5d/addons/node25d-cs/main_screen/.broken-cs-files/Viewport25D.cs
@@ -0,0 +1,230 @@
+using Godot;
+
+// This is identical to the GDScript version, yet it doesn't work.
+[Tool]
+public class Viewport25D : Control
+{
+ private int zoomLevel = 0;
+ private bool isPanning = false;
+ private Vector2 panCenter;
+ private Vector2 viewportCenter;
+ private int viewModeIndex = 0;
+
+ // The type or namespace name 'EditorInterface' could not be found (are you missing a using directive or an assembly reference?)
+ // No idea why this error shows up in VS Code. It builds fine...
+ public EditorInterface editorInterface; // Set in node25d_plugin.gd
+ private bool moving = false;
+
+ private Viewport viewport2d;
+ private Viewport viewportOverlay;
+ private ButtonGroup viewModeButtonGroup;
+ private Label zoomLabel;
+ private PackedScene gizmo25dScene;
+
+ public async override void _Ready()
+ {
+ // Give Godot a chance to fully load the scene. Should take two frames.
+ //yield(get_tree(), "idle_frame");
+ //yield(get_tree(), "idle_frame");
+ await ToSignal(GetTree(), "idle_frame");
+ await ToSignal(GetTree(), "idle_frame");
+ var editedSceneRoot = GetTree().EditedSceneRoot;
+ if (editedSceneRoot == null)
+ {
+ // Godot hasn't finished loading yet, so try loading the plugin again.
+ //editorInterface.SetPluginEnabled("node25d", false);
+ //editorInterface.SetPluginEnabled("node25d", true);
+ return;
+ }
+ // Alright, we're loaded up. Now check if we have a valid world and assign it.
+ var world2d = editedSceneRoot.GetViewport().World2d;
+ if (world2d == GetViewport().World2d)
+ {
+ return; // This is the MainScreen25D scene opened in the editor!
+ }
+ viewport2d.World2d = world2d;
+
+ // Onready vars.
+ viewport2d = GetNode("Viewport2D");
+ viewportOverlay = GetNode("ViewportOverlay");
+ viewModeButtonGroup = GetParent().GetNode("TopBar").GetNode("ViewModeButtons").GetNode