Class SimpleCommand
Simplified command base class with auto-serialization. Use [Command] attribute on class and [Arg] attributes on properties.
Benefits over BaseCommand:
- No separate factory class needed
- Auto-serialization of [Arg] properties
- Auto-generated usage/help text
- Optional Undo (default no-op)
Use BaseCommand instead when you need:
- Custom serialization format
- Complex undo logic
- Maximum performance (no reflection)
public abstract class SimpleCommand : BaseCommand, ICommand
- Inheritance
-
objectSimpleCommand
- Implements
- Derived
- Inherited Members
Methods
Deserialize(BinaryReader)
Auto-deserializes all [Arg] properties.
public override sealed void Deserialize(BinaryReader reader)
Parameters
readerBinaryReader
Execute(GameState)
Override to implement execution logic.
public override abstract void Execute(GameState gameState)
Parameters
gameStateGameState
Serialize(BinaryWriter)
Auto-serializes all [Arg] properties.
public override sealed void Serialize(BinaryWriter writer)
Parameters
writerBinaryWriter
Undo(GameState)
Override to implement undo logic. Default is no-op.
public override void Undo(GameState gameState)
Parameters
gameStateGameState
Validate(GameState)
Override to implement validation logic.
public override abstract bool Validate(GameState gameState)
Parameters
gameStateGameState
Returns
- bool