-
Notifications
You must be signed in to change notification settings - Fork 0
louissalin/StateUI
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This state machine lets you use Ninject and declare your bindings in contexts that are associated with states in the state machine. This way, bindings are executed by the Ninject module only if the associated state is the current state. For example, reusing the samurai examples from Ninject's own website, you can write: sm = new StateMachine(); sm.AddState(s => s.Name = "UseSword"); sm.AddState(s => s.Name = "LoseSword"); sm.CreatePathFrom.State("UseSword").To.State("LoseSword"); // when starting the state machine, the first state declared // is automatically loaded. So "UseSword" is the current inital state. sm.Start(); LoadKernel(); var samurai = _kernel.Get<Samurai>(); samurai.Attack(); sm.ChangeState("LoseSword"); LoadKernel(); samurai = _kernel.Get<Samurai>(); samurai.Attack(); which results in the following being outputed: Attacking with a sword! Attacking with my bare hands! Please refer to the ConsoleSamurai sample in the src/Samples directory for the complete code. Compiling: --------- To compile, download NInject and add NInject.dll to the lib/ folder. If you'll want to run the unit tests, you will need nunit.framework.dll and SpecUnit.dll in the lib/ folder also. Make sure that the nunit dll is of the same version as the one used to compile SpecUnit. If you are on Windows, well... I hope makefiles work fine on Windows! More serioulsy, it might not be so hard to create a solution file for this or to make the makefile work. $ make This will make the libraries, but won't compile the tests. $ make samples This will build the sample projects. $ make all This will compile everything.
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published