-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Dev Console #2
base: master
Are you sure you want to change the base?
Conversation
{ | ||
base._Input(@event); | ||
if (@event is InputEventKey eKey ) { | ||
// Key is ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can simplify here.
eKey { KeyLabel = Key.QuoteLedt } && eKey.IsReleased()
{ | ||
cFunc.Call(context); | ||
} | ||
if (command is CVar<string> cVarString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably export this to new func with type probably HandleVar(T varType, comman
} | ||
public void Print(object what) | ||
{ | ||
ConsoleManager.Contents += what; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can simplify here by $"{what}\n";
|
||
public static Node GetConsole() | ||
{ | ||
var console = SceneManager.GetPackedScene("DevConsole").Instantiate() as DevConsole; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do additional checks if exists, if does not disable the console
/// </summary> | ||
/// <param name="name">The name of the command</param> | ||
/// <param name="CFuncOrCVar">A CVar or CFunc Command</param> | ||
public static void Register(string name, Command CFuncOrCVar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have an unregister
Description = description; | ||
// Check at runtime if the type is one of the allowed types | ||
if (typeof(T) != typeof(int) && typeof(T) != typeof(float) && | ||
typeof(T) != typeof(bool) && typeof(T) != typeof(string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to use any number type. [interface exist for it]
string, bool is good
Added new DevConsole system. scenes that are allowed to spawn and use the developer console need to inherit ConsoleEnabledScene instead of Control, base._Input is required. I've made some example commands in MainMenu, but they can be registered from anywhere