StrangeIoC
0.6.0
The IoC/Binding Framework for Unity3D and C#
|
A Binder that triggers the instantiation of Commands using Signals. More...
Public Member Functions | |
override void | ResolveBinding (IBinding binding, object key) |
This method places individual Bindings into the bindings Dictionary as part of the resolving process. More... | |
override void | OnRemove () |
The Binder is being removed Override this method to clean up remaining bindings. | |
override ICommandBinding | Bind< T > () |
Bind a trigger Key by generic Type. | |
override void | Unbind< T > () |
Unbind by Signal Type More... | |
override void | Unbind (object key, object name) |
Unbind by Signal Instance More... | |
override ICommandBinding | GetBinding< T > () |
Retrieve a binding based on the provided Type. | |
Public Member Functions inherited from strange.extensions.command.impl.CommandBinder | |
override IBinding | GetRawBinding () |
Generate an unpopulated IBinding in whatever concrete form the Binder dictates. | |
virtual void | ReactTo (object trigger) |
Trigger a key that unlocks one or more Commands. | |
virtual void | ReactTo (object trigger, object data) |
Trigger a key that unlocks one or more Commands and provide a data injection to that Command. | |
virtual void | Stop (object key) |
Called to halt execution of a currently running command group. | |
virtual void | ReleaseCommand (ICommand command) |
Release a previously retained Command. More... | |
Pool< T > | GetPool< T > () |
Retrieve the Pool of the specified type. | |
bool | Trigger< T > (object data) |
Cause this ITriggerable to access any provided Key in its Binder by the provided generic and data. More... | |
bool | Trigger (object key, object data) |
Cause this ITriggerable to access any provided Key in its Binder by the provided key and data. More... | |
new virtual ICommandBinding | Bind (object value) |
Bind a trigger Key by value. | |
Public Member Functions inherited from strange.framework.impl.Binder | |
delegate void | BindingResolver (IBinding binding) |
A handler for resolving the nature of a binding during chained commands. | |
virtual IBinding | GetBinding (object key) |
Retrieve a binding based on the provided object. | |
virtual IBinding | GetBinding< T > (object name) |
Retrieve a binding based on the provided Key (generic)/Name combo. | |
virtual IBinding | GetBinding (object key, object name) |
Retrieve a binding based on the provided Key/Name combo. | |
virtual void | Unbind (object key) |
Remove a binding based on the provided Key. | |
virtual void | Unbind< T > (object name) |
Remove a binding based on the provided Key (generic) / Name combo. | |
virtual void | Unbind (IBinding binding) |
Remove the provided binding from the Binder. | |
virtual void | RemoveValue (IBinding binding, object value) |
Remove a select value from the given binding. | |
virtual void | RemoveKey (IBinding binding, object key) |
Remove a select key from the given binding. | |
virtual void | RemoveName (IBinding binding, object name) |
Remove a select name from the given binding. | |
Protected Member Functions | |
override ICommand | invokeCommand (Type cmd, ICommandBinding binding, object data, int depth) |
ICommand | createCommandForSignal (Type cmd, object data, List< Type > signalTypes) |
Create a Command and bind its injectable parameters to the Signal types. | |
Protected Member Functions inherited from strange.extensions.command.impl.CommandBinder | |
void | next (ICommandBinding binding, object data, int depth) |
virtual void | disposeOfSequencedData (object data) |
virtual ICommand | createCommand (object cmd, object data) |
ICommand | getCommand (Type type) |
void | trackCommand (ICommand command, ICommandBinding binding) |
void | executeCommand (ICommand command) |
override void | resolver (IBinding binding) |
The default handler for resolving bindings during chained commands. | |
virtual Pool | makePoolFromType (Type type) |
Protected Member Functions inherited from strange.framework.impl.Binder | |
void | registerNameConflict (object key, IBinding newBinding, IBinding existingBinding) |
Take note of bindings that are in conflict. More... | |
bool | isConflictCleared (Dictionary< IBinding, object > dict, IBinding binding) |
Returns true if the provided binding and the binding in the dict are no longer conflicting. | |
void | clearConflict (object key, object name, Dictionary< IBinding, object > dict) |
T[] | spliceValueAt< T > (int splicePos, object[] objectValue) |
object[] | spliceValueAt (int splicePos, object[] objectValue) |
Remove the item at splicePos from the list objectValue. | |
Additional Inherited Members | |
Protected Attributes inherited from strange.extensions.command.impl.CommandBinder | |
Dictionary< Type, Pool > | pools = new Dictionary<Type, Pool> () |
HashSet< ICommand > | activeCommands = new HashSet<ICommand>() |
Tracker for parallel commands in progress. | |
Dictionary< ICommand, ICommandBinding > | activeSequences = new Dictionary<ICommand, ICommandBinding> () |
Tracker for sequences in progress. | |
Properties inherited from strange.extensions.command.impl.CommandBinder | |
IInjectionBinder | injectionBinder [get, set] |
bool | usePooling [get, set] |
A Binder that triggers the instantiation of Commands using Signals.
Commands are where the logic of your application belongs. These Commands typically focus on a single function, such as adding a View, requesting a service, reading from or saving to a model.
The act of binding Signals to Commands means that code needn't know anything about a Signal recipient, or even how the Signal will be used. For example, a Mediator might dispatch a Signal that two View objects collided. A Command would then determine that the result of that Signal was to Destroy both objects, tell a ScoreKeeper model to change the score and request a message be sent to the server. Whether that example means one Command or three is up to your coding preference... SignalCommandBinder can trigger one Command or multiple Commands off the same Signal.
Signals bind their parameters to Command injections by comparing types and do not understand named injections. Therefore, in order to Bind a Command's injections to a Signal, PARAMETERS/INJECTIONS MUST BE OF UNIQUE TYPES. It is not, therefore, possible to bind a Signal with two of the same type to a Command.
Note that like CommandBinder, SignalCommandBinder features sequencing. By default, SignalCommandBinder fires all Commands in parallel. If your binding specifies InSequence()
, Commands will run serially, with the option of suspending the chain at any time.
Example bindings:
Bind(someSignal).To<SomeCommand>(); Bind<SomeSignalClass>().To<StartCommand>().Once(); //Destroy the binding immediately after a single use Bind<SomeSignalClass>().To<FirstCommand>().To<SecondCommand>().To<ThirdGCommand>().InSequence(); //Bind a sequence
See Command for details on asynchronous Commands and cancelling sequences.
|
inlinevirtual |
This method places individual Bindings into the bindings Dictionary as part of the resolving process.
Note that while some Bindings may store multiple keys, each key takes a unique position in the bindings Dictionary.
Conflicts in the course of fluent binding are expected, but GetBinding will throw an error if there are any unresolved conflicts.
Reimplemented from strange.framework.impl.Binder.
|
inlinevirtual |
Unbind by Signal Instance
key | Instance of IBaseSignal |
Reimplemented from strange.framework.impl.Binder.
|
inlinevirtual |
Unbind by Signal Type
InjectionException | If there is no binding for this type. |
Reimplemented from strange.framework.impl.Binder.