Buggy starting point

This commit is contained in:
Jojackman1
2026-01-19 13:48:14 -07:00
parent 985a975577
commit 44117ec414
21 changed files with 266 additions and 153 deletions

View File

@@ -4,13 +4,15 @@ using System;
public partial class ChangeMenuInitiator : Node
{
float TransitionDelay = 0; // seconds
Node cameFrom;
string cameFrom;
public void ChangeMenu(string type, string destination, Node cameFromInput)
public void ChangeMenu(string type, string destination, string cameFromInput)
{
cameFromInput = cameFrom;
cameFrom = cameFromInput;
if (type == "SLOW")
{
GD.Print("slow switch");
// Load the menu change manager
var scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MenuChangeManager.tscn");
var inst = (Node2D)scene.Instantiate();
@@ -27,6 +29,7 @@ public partial class ChangeMenuInitiator : Node
}
if (type == "FAST")
{
GD.Print("fast switch");
var scene = GD.Load<PackedScene>($"res://Assets/Scenes/MenusAndLevels/{destination}.tscn");
var inst = (Node2D)scene.Instantiate();
GetTree().Root.AddChild(inst);
@@ -38,14 +41,13 @@ public partial class ChangeMenuInitiator : Node
DeleteMenu("LoadIn");
}
}
void DeleteMenu(StringName arg)
{
if (arg == "LoadIn")
{
// Delete current scene (MAKE SURE THE PARENT OF THE PARENT OF THIS SCRIPT IS THE SCENE)
cameFrom.QueueFree();
// Delete current scene that it came from
GetTree().Root.GetNode(cameFrom).QueueFree();
}
}

View File

@@ -1,37 +0,0 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class LevelSelectionManager : Node2D
{
Dictionary<string, string> ConnectionRef = new Dictionary<string, string>();
public override void _Ready()
{
// Create Dictionary
ConnectionRef.Add("Level1", "Level2");
ConnectionRef.Add("Level2", "Level3");
ConnectionRef.Add("Level3", "Level4");
ConnectionRef.Add("Level4", "Level5");
// Disable all levels but the first
foreach (Node2D arg in GetNode("UISelector").GetChildren())
{
if (ConnectionRef.ContainsValue(arg.Name))
arg.SetProcess(false);
}
// Edit buttons according to what is completed
foreach (string arg in GetTree().Root.GetNode<CommonData>("CommonData").LevelsCompleted)
{
if (ConnectionRef.ContainsKey(arg))
{
// Remove fake button
GetNode("FakeButtons").GetNode<Node2D>(ConnectionRef[arg]).Visible = false;
// Add real button
GetNode("UISelector").GetNode<Node2D>(ConnectionRef[arg]).Visible = true;
GetNode("UISelector").GetNode<Node2D>(ConnectionRef[arg]).SetProcess(true);
}
}
}
}

View File

@@ -1 +0,0 @@
uid://bqqpex5a35ttm

View File

@@ -5,6 +5,7 @@ public partial class SceneChangeButton : Button
{
void _on_pressed()
{
GetTree().Root.GetNode("CommonData").GetNode<ChangeMenuInitiator>("ChangeMenuInitiator").ChangeMenu("HTP", "slow",GetParent());
if (GetTree().Root.GetNode("Camera").HasNode("MenuChangeManager") == false) // makes sure the menu is not currently being changed
GetTree().Root.GetNode("CommonData").GetNode<ChangeMenuInitiator>("ChangeMenuInitiator").ChangeMenu("SLOW", "Level1", GetParent().Name);
}
}

View File

@@ -7,7 +7,16 @@ public partial class TipManager : RichTextLabel
string[] TipList =
{
"Example Tip"
"Example Tip1",
"Example Tip2",
"Example Tip3",
"Example Tip4",
"Example Tip5",
"Example Tip6",
"Example Tip7",
"Example Tip8",
"Example Tip9"
};
public override void _Ready()

View File

@@ -1,46 +0,0 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class UISelector : Node2D
{
List<Node2D> AvailableOptions = new List<Node2D>();
public Node2D SelectedOption;
int SelectedKey = 0;
Node2D SelectionIndicator;
public override void _Ready()
{
// Set up selection indicator
SelectionIndicator = GetNode<Node2D>("SelectionIndicator");
// Set up list of options
foreach (Node2D option in GetChildren())
{
if (option != SelectionIndicator)
AvailableOptions.Add(option);
}
// Set defaults
SelectedOption = AvailableOptions[SelectedKey];
SelectionIndicator.Position = SelectedOption.Position;
}
public override void _Process(double delta)
{
// Select next option
if(Input.IsActionJustPressed("menu_right") && SelectedKey < AvailableOptions.Count - 1)
{
SelectedKey += 1;
}
// Select previous option
if(Input.IsActionJustPressed("menu_left") && SelectedKey != 0)
{
SelectedKey -= 1;
}
SelectedOption = AvailableOptions[SelectedKey];
SelectionIndicator.Position = SelectedOption.Position;
}
}

View File

@@ -1 +0,0 @@
uid://b02hgywj3kck