This repository has been archived on 2025-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
ADEPT/ADEPT-Godot/Core/Scripts/Main.cs
2025-02-15 10:54:05 -06:00

44 lines
1.4 KiB
C#

using System.Reflection;
using Godot;
using ADEPT.Core;
using ADEPT.Core.Cogwheel;
using Cogwheel;
namespace ADEPT.Core;
public partial class Main : Node
{
private static CommandsManager _commandsManager;
private static GodotCogwheelConsole _cogwheelConsole;
public CanvasLayer MainCanvas { get; private set; }
public override void _Ready()
{
MainCanvas = GetNode<CanvasLayer>("MainCanvas");
ADEPT.Initialize(this);
_commandsManager = new CommandsManager();
_cogwheelConsole = MainCanvas.GetNode<GodotCogwheelConsole>("CogwheelConsole");
if (_cogwheelConsole is null) throw new System.Exception("CogwheelConsole not found in MainNode.");
_commandsManager.AddAssembly(Assembly.GetExecutingAssembly());
_commandsManager.AddAssembly(Assembly.GetAssembly(typeof(CommandsManager)));
COGWHEEL.Initialize(_commandsManager, _cogwheelConsole);
COGWHEEL.RegisterObject(this);
_cogwheelConsole.LogInfo("COGWHEEL " + " initialized.");
_cogwheelConsole.LogInfo("ADEPT " + ADEPT.Constants.Version + " initialized.");
_cogwheelConsole.LogInfo("Type 'list' for a list of commands.");
}
[Command(Name = "test", Description = "Test command.")]
private void Test()
{
COGWHEEL.LogWarning("Testing!\nTesting!\nTesting!");
}
}