StrangeIoC  0.6.0
The IoC/Binding Framework for Unity3D and C#
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | Protected Member Functions | Static Protected Attributes | Properties | List of all members
strange.extensions.context.impl.MVCSContext Class Reference

The recommended Context for getting the most out of StrangeIoC. More...

Inheritance diagram for strange.extensions.context.impl.MVCSContext:
strange.extensions.context.impl.CrossContext strange.extensions.context.impl.Context strange.extensions.context.api.ICrossContextCapable strange.framework.impl.Binder strange.extensions.context.api.IContext strange.framework.api.IBinder strange.framework.api.IBinder

Public Member Functions

 MVCSContext (MonoBehaviour view)
 The recommended Constructor Just pass in the instance of your ContextView. More...
 
 MVCSContext (MonoBehaviour view, ContextStartupFlags flags)
 
 MVCSContext (MonoBehaviour view, bool autoMapping)
 
override IContext SetContextView (object view)
 Set the object that represents the top of the Context hierarchy. More...
 
override void Launch ()
 Fires ContextEvent.START Whatever Command/Sequence you want to happen first should be mapped to this event. More...
 
override object GetComponent< T > ()
 Gets an instance of the provided generic type. More...
 
override object GetComponent< T > (object name)
 Gets an instance of the provided generic type and name from the InjectionBinder Always bear in mind that doing this risks adding dependencies that must be cleaned up when Contexts are removed. More...
 
override void AddView (object view)
 Register a View with this Context.
 
override void RemoveView (object view)
 Remove a View from this Context.
 
override void OnRemove ()
 Clean up. Called by a ContextView in its OnDestroy method.
 
- Public Member Functions inherited from strange.extensions.context.impl.CrossContext
 CrossContext (object view)
 
 CrossContext (object view, ContextStartupFlags flags)
 
 CrossContext (object view, bool autoMapping)
 
override IContext AddContext (IContext context)
 Add another Context to this one.
 
virtual void AssignCrossContext (ICrossContextCapable childContext)
 Add cross-context functionality to a child context being added.
 
virtual void RemoveCrossContext (ICrossContextCapable childContext)
 Clean up cross-context functionality from a child context being removed.
 
override IContext RemoveContext (IContext context)
 Remove a context from this one.
 
- Public Member Functions inherited from strange.extensions.context.impl.Context
 Context (object view, ContextStartupFlags flags)
 
 Context (object view)
 
 Context (object view, bool autoMapping)
 
virtual object GetContextView ()
 Get the ContextView.
 
virtual IContext Start ()
 Call this from your Root to set everything in action.
 
- 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 Bind< T > ()
 Bind a Binding Key to a class or interface generic.
 
virtual IBinding Bind (object key)
 Bind a Binding Key to a value.
 
virtual IBinding GetBinding< T > ()
 Retrieve a binding based on the provided Type.
 
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< T > ()
 Remove a binding based on the provided Key (generic)
 
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 (object key, object name)
 Remove a binding based on the provided Key / 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.
 
virtual IBinding GetRawBinding ()
 Generate an unpopulated IBinding in whatever concrete form the Binder dictates.
 
virtual void ResolveBinding (IBinding binding, object key)
 This method places individual Bindings into the bindings Dictionary as part of the resolving process. More...
 

Protected Member Functions

override void addCoreComponents ()
 Map the relationships between the Binders. More...
 
override void instantiateCoreComponents ()
 Override to instantiate componentry. Or just extend MVCSContext.
 
override void postBindings ()
 Override to do things after binding but before app launch.
 
virtual void cacheView (MonoBehaviour view)
 Caches early-riser Views. More...
 
virtual void mediateViewCache ()
 Provide mediation for early-riser Views.
 

Static Protected Attributes

static ISemiBinding viewCache = new SemiBinding()
 A list of Views Awake before the Context is fully set up.
 

Properties

ICommandBinder commandBinder [get, set]
 A Binder that maps Events to Commands.
 
IEventDispatcher dispatcher [get, set]
 A Binder that serves as the Event bus for the Context.
 
IMediationBinder mediationBinder [get, set]
 A Binder that maps Views to Mediators.
 
IImplicitBinder implicitBinder [get, set]
 
ISequencer sequencer [get, set]
 A Binder that maps Events to Sequences.
 
- Properties inherited from strange.extensions.context.impl.CrossContext
ICrossContextInjectionBinder injectionBinder [get, set]
 A Binder that handles dependency injection binding and instantiation.
 
virtual IDispatcher crossContextDispatcher [get, set]
 
virtual IBinder crossContextBridge [get, set]
 
- Properties inherited from strange.extensions.context.impl.Context
object contextView [get, set]
 The top of the View hierarchy. More...
 
- Properties inherited from strange.extensions.context.api.ICrossContextCapable
ICrossContextInjectionBinder injectionBinder [get, set]
 All cross-context capable contexts must implement an injectionBinder.
 
IDispatcher crossContextDispatcher [get, set]
 Set and get the shared system bus for communicating across contexts.
 

Additional Inherited Members

- Public Attributes inherited from strange.extensions.context.impl.Context
bool autoStartup
 If false, the Launch() method won't fire.
 
- Static Public Attributes inherited from strange.extensions.context.impl.Context
static IContext firstContext
 In a multi-Context app, this represents the first Context to instantiate.
 
- Protected Attributes inherited from strange.extensions.context.impl.CrossContext
IEventDispatcher _crossContextDispatcher
 A specific instance of EventDispatcher that communicates across multiple contexts. More...
 

Detailed Description

The recommended Context for getting the most out of StrangeIoC.

By extending this Context, you get the entire all-singing/all-dancing version of Strange, as it was shipped from the warehouse and ready for you to map your dependencies.

As the name suggests, MVCSContext provides structure for app development using the classic MVC (Model-View-Controller) design pattern, and adds 'S' (Service) for asynchronous calls outside the application. Strange is highly modular, so you needn't use MVCSContext if you don't want to (you can extend Context or CrossContext directly) but MVCS is a highly proven design strategy and MVCSContext is by far the easiest way to get familiar with what Strange has to offer.

The parts:

Constructor & Destructor Documentation

strange.extensions.context.impl.MVCSContext.MVCSContext ( MonoBehaviour  view)
inline

The recommended Constructor Just pass in the instance of your ContextView.

Everything will begin automatically. Other constructors offer the option of interrupting startup at useful moments.

Member Function Documentation

override void strange.extensions.context.impl.MVCSContext.addCoreComponents ( )
inlineprotectedvirtual

Map the relationships between the Binders.

Although you can override this method, it is recommended that you provide all your application bindings in mapBindings().

Reimplemented from strange.extensions.context.impl.CrossContext.

virtual void strange.extensions.context.impl.MVCSContext.cacheView ( MonoBehaviour  view)
inlineprotectedvirtual

Caches early-riser Views.

If a View is on stage at startup, it's possible for that View to be Awake before this Context has finished initing. cacheView() maintains a list of such 'early-risers' until the Context is ready to mediate them.

override object strange.extensions.context.impl.MVCSContext.GetComponent< T > ( )
inline

Gets an instance of the provided generic type.

Always bear in mind that doing this risks adding dependencies that must be cleaned up when Contexts are removed.

Implements strange.extensions.context.api.ICrossContextCapable.

override object strange.extensions.context.impl.MVCSContext.GetComponent< T > ( object  name)
inline

Gets an instance of the provided generic type and name from the InjectionBinder Always bear in mind that doing this risks adding dependencies that must be cleaned up when Contexts are removed.

Implements strange.extensions.context.api.ICrossContextCapable.

override void strange.extensions.context.impl.MVCSContext.Launch ( )
inlinevirtual

Fires ContextEvent.START Whatever Command/Sequence you want to happen first should be mapped to this event.

Reimplemented from strange.extensions.context.impl.Context.

override IContext strange.extensions.context.impl.MVCSContext.SetContextView ( object  view)
inlinevirtual

Set the object that represents the top of the Context hierarchy.

In MVCSContext, this would be a GameObject.

Reimplemented from strange.extensions.context.impl.Context.


The documentation for this class was generated from the following file: