Create your own polished presentation in minutes. Just describe what you need.
Free to try, no credit card requiredBinding/Injecting Commands
commandBinder.Bind<StartSignal>().
To<StartCommand>();
class StartCommand : EventCommand {
override public void Execute() {
Debug.Log("GameStarted");
}
}
class GameStarter : Mediator {
[Inject]
public StartSignal startSignal { get; set; }
public overrride void OnRegister() {
startSignal.Dispatch();
}
}
Command
public class GameStarter : Mediator {
[Inject]
public IntSignal intSignal { get; set; }
public override void OnRegister() {
intSignal.Dispatch(20);
}
}
Signals
Example:
public class IntSignal : Signal<int> {}
injectionBinder.Bind<IntSignal>().ToSingleton();
Injection
class Spaceship : ISpaceship
{
public void input(float angle, float velocity)
{
//do stuff here
}
[Inject] //<----- The magic word!
public IWeapon weapon{get;set;}
}
Extensions
Examples:
Bind<Spaceship>().To<SampleSpaceship>();
Bind(“TotalDeaths”).To(42);
Bind<Spaceship>().To(“SampleSpaceship2”);
Bind<IComputer>().To<SuperComputer>().ToName(“EnthusiastBuild”);
Binding
injectionBinder.Bind<InterfaceHere>().To<ImpClassHere>();
StrangeIOC
To make it simple:
public class TextEditor
{
private ISpellChecker checker;
public TextEditor(ISpellChecker checker)
{
this.checker = checker;
}
}
Example:
public class TextEditor
{
private SpellChecker checker;
public TextEditor()
{
checker = new SpellChecker();
}
}
Dependency Injection
Inversion-of-Control
What is:
StrangeIOC
Create your own polished presentation in minutes. Just describe what you need.
Free to try, no credit card required