Skip to content
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

Add method to return all commands. Add delegate to list for any commands executed #92

Merged
merged 3 commits into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Plugins/IngameDebugConsole/Scripts/DebugLogConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public static class DebugLogConsole
{
public delegate bool ParseFunction( string input, out object output );

public delegate void CommandExecutedDelegate( string command, object[] parameters );
public static event CommandExecutedDelegate OnCommandExecuted;

// All the commands
private static readonly List<ConsoleMethodInfo> methods = new List<ConsoleMethodInfo>();
private static readonly List<ConsoleMethodInfo> matchingMethods = new List<ConsoleMethodInfo>( 4 );
Expand Down Expand Up @@ -212,6 +215,11 @@ public static void SearchAssemblyForConsoleMethods( Assembly assembly )
}
}

public static List<ConsoleMethodInfo> GetAllCommands()
{
return methods;
}

// Logs the list of available commands
public static void LogAllCommands()
{
Expand Down Expand Up @@ -745,6 +753,9 @@ public static void ExecuteCommand( string command )
else
Debug.Log( "Returned: " + result.ToString() );
}

if( OnCommandExecuted != null )
OnCommandExecuted( methodToExecute.command, parameters );
}
}

Expand Down Expand Up @@ -1507,4 +1518,4 @@ private static bool ParseVector( string input, Type vectorType, out object outpu
return true;
}
}
}
}