コード例 #1
0
        protected override void mapBindings()
        {
            base.mapBindings();

            commandBinder.Bind <StartSignal>().To <HelloWorldStartCommand>().Once();
            commandBinder.Bind <DoManagementSignal>().To <DoManagementCommand>().Pooled();           // THIS IS THE NEW MAPPING!!!

            mediationBinder.Bind <HelloWorldView>().To <HelloWorldMediator>();
            mediationBinder.Bind <StatusView>().To <StatusMediator>();


            ManagerAsMonoBehaviour manager = GameObject.Find("Manager").GetComponent <ManagerAsMonoBehaviour>();

            injectionBinder.Bind <ISomeManager>().ToValue(manager);

            injectionBinder.Bind <ShowTextSignal>().ToSingleton();
        }
コード例 #2
0
        protected override void mapBindings()
        {
            base.mapBindings();
            // we bind a command to StartSignal since it is invoked by SignalContext (the parent class) on Launch()
            commandBinder.Bind <StartSignal>().To <HelloWorldStartCommand>().Once();
            commandBinder.Bind <DoManagementSignal>().To <DoManagementCommand>().Pooled();

            // bind our view to its mediator
            mediationBinder.Bind <HelloWorldView>().To <HelloWorldMediator>();

            // bind our interface to a concrete implementation
            //injectionBinder.Bind<ISomeManager>().To<ManagerAsNormalClass>().ToSingleton();

            // bind the manager implemented as a MonoBehaviour
            ManagerAsMonoBehaviour manager = GameObject.Find("Manager").GetComponent <ManagerAsMonoBehaviour>();

            injectionBinder.Bind <ISomeManager>().ToValue(manager);
        }