Class DebugAction
An abstract class that can be used to easily create debug-only actions that are available when TinyLife.Debug.ShowDebugActions is enabled. They complete immediately when started and invoke their Run() method once on completion. A debug action type should be created using Create(string, ObjectCategory, Type, CanExecuteDelegate) or one of its overloads.
public abstract class DebugAction : Action, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderDebugAction
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
DebugAction(ActionType, ActionInfo)
Creates a new action with the given action information.
public DebugAction(ActionType type, ActionInfo info)
Parameters
type
ActionTypeThe type for this action.
info
ActionInfoThe information for this action.
Methods
Create(string, ObjectCategory, Action<Action>, CanExecuteDelegate)
Creates type settings for a debug action that executes a simple Action with the given settings.
public static ActionType.TypeSettings Create(string name, ObjectCategory context, Action<Action> run, ActionType.CanExecuteDelegate canExecute = null)
Parameters
name
stringThe name.
context
ObjectCategoryThe context.
run
Action<Action>The action to execute when this debug action is run.
canExecute
ActionType.CanExecuteDelegateA ActionType.CanExecuteDelegate that determines whether the action can be started.
Returns
- ActionType.TypeSettings
The created type settings.
Create(string, ObjectCategory, string, Func<ActionInfo, IEnumerable<object>>, CanExecuteDelegate)
Creates type settings for a debug action that executes a Cheats entry with the given settings.
public static ActionType.TypeSettings Create(string name, ObjectCategory context, string cheat, Func<ActionInfo, IEnumerable<object>> args = null, ActionType.CanExecuteDelegate canExecute = null)
Parameters
name
stringThe name.
context
ObjectCategoryThe context.
cheat
stringThe cheat to execute when this debug action is run.
args
Func<ActionInfo, IEnumerable<object>>The arguments to pass to the executed
cheat
when this debug action is run.canExecute
ActionType.CanExecuteDelegateA ActionType.CanExecuteDelegate that determines whether the action can be started.
Returns
- ActionType.TypeSettings
The created type settings.
Create(string, ObjectCategory, string, (string Name, Func<ActionInfo, IEnumerable<object>> Args)[], CanExecuteDelegate)
Creates type settings for a debug action that executes a set of Cheats entry with the given potential arguments. Each argument is displayed as an ActionArgument when executing.
public static ActionType.TypeSettings Create(string name, ObjectCategory context, string cheat, (string Name, Func<ActionInfo, IEnumerable<object>> Args)[] runsArgs, ActionType.CanExecuteDelegate canExecute = null)
Parameters
name
stringThe name.
context
ObjectCategoryThe context.
cheat
stringThe cheat to execute when this debug action is run.
runsArgs
(string Name, Func<ActionInfo, IEnumerable<object>> Args)[]The choices of arguments to pass to the executed
cheat
when this debug action is run.canExecute
ActionType.CanExecuteDelegateA ActionType.CanExecuteDelegate that determines whether the action can be started.
Returns
- ActionType.TypeSettings
The created type settings.
Create(string, ObjectCategory, Type, CanExecuteDelegate)
Creates type settings for a debug action with the given settings.
public static ActionType.TypeSettings Create(string name, ObjectCategory context, Type constructedType, ActionType.CanExecuteDelegate canExecute = null)
Parameters
name
stringThe name.
context
ObjectCategoryThe context.
constructedType
TypeThe type of action to construct.
canExecute
ActionType.CanExecuteDelegateA ActionType.CanExecuteDelegate that determines whether the action can be started.
Returns
- ActionType.TypeSettings
The created type settings.
Create(string, ObjectCategory, (string Name, Action<Action> Action)[], CanExecuteDelegate)
Creates type settings for a debug action that executes a set of simple Action functions with the given settings. Each action function is displayed as an ActionArgument when executing.
public static ActionType.TypeSettings Create(string name, ObjectCategory context, (string Name, Action<Action> Action)[] runs, ActionType.CanExecuteDelegate canExecute = null)
Parameters
name
stringThe name.
context
ObjectCategoryThe context.
runs
(string Name, Action<Action> Action)[]The actions to execute when this debug action is run.
canExecute
ActionType.CanExecuteDelegateA ActionType.CanExecuteDelegate that determines whether the action can be started.
Returns
- ActionType.TypeSettings
The created type settings.
Create(string, ObjectCategory, (string Name, Func<ActionInfo, bool> Valid, Action<Action> Action)[], CanExecuteDelegate)
Creates type settings for a debug action that executes a set of simple Action functions with the given settings. Each action function is displayed as an ActionArgument when executing.
public static ActionType.TypeSettings Create(string name, ObjectCategory context, (string Name, Func<ActionInfo, bool> Valid, Action<Action> Action)[] runs, ActionType.CanExecuteDelegate canExecute = null)
Parameters
name
stringThe name.
context
ObjectCategoryThe context.
runs
(string Name, Func<ActionInfo, bool> Valid, Action<Action> Action)[]The actions to execute when this debug action is run.
canExecute
ActionType.CanExecuteDelegateA ActionType.CanExecuteDelegate that determines whether the action can be started.
Returns
- ActionType.TypeSettings
The created type settings.
IsCompleted()
This method is called every update frame by a Person if this action is currently active to check if it should be stopped. If this returns a result other than Completed, OnCompleted(CompletionType) will be called and the action is stopped. By default, only ForceResult modifies the completion type, otherwise Active is returned.
public override CompletionType IsCompleted()
Returns
- CompletionType
The current completion type of this action
OnCompleted(CompletionType)
This method is called when this action IsCompleted(), or if it is canceled from an outside source. Note that, if this method is called as a result of IsCompleted(), the CompletionType passed will be the same. By default, only OnActionCompleted(Action, CompletionType, bool) is called.
public override void OnCompleted(CompletionType type)
Parameters
type
CompletionTypeThe type that this action completed with
Run()
Runs this debug action's behavior.
protected abstract void Run()