Permalink
Browse files

Merge branch 'master' of git://github.com/nielswijers/Ash

  • Loading branch information...
2 parents baf6cd4 + 0bd6266 commit 30484a7fc9748e9c9c3056deeec76f54632bd111 @richardlord committed Oct 4, 2012
@@ -1,16 +1,19 @@
-package net.richardlord.asteroids
-{
+package net.richardlord.asteroids {
+ import robotlegs.bender.bundles.mvcs.MVCSBundle;
+ import flash.display.DisplayObjectContainer;
import net.richardlord.ash.integration.robotlegs.AshExtension;
import net.richardlord.asteroids.events.StartGameEvent;
- import robotlegs.bender.core.api.IContext;
- import robotlegs.bender.core.impl.ContextBuilder;
- import robotlegs.bender.extensions.commandMap.CommandMapExtension;
+ import robotlegs.bender.extensions.commandCenter.CommandCenterExtension;
import robotlegs.bender.extensions.eventCommandMap.EventCommandMapExtension;
import robotlegs.bender.extensions.eventCommandMap.api.IEventCommandMap;
+ import robotlegs.bender.extensions.eventDispatcher.EventDispatcherExtension;
+ import robotlegs.bender.framework.api.IContext;
+ import robotlegs.bender.framework.impl.Context;
import flash.display.Sprite;
import flash.events.Event;
+ import flash.events.IEventDispatcher;
[SWF(width='600', height='450', frameRate='60', backgroundColor='#000000')]
@@ -24,16 +27,17 @@ package net.richardlord.asteroids
private function init( event : Event ) : void
{
removeEventListener( Event.ENTER_FRAME, init );
- var context : IContext = ( new ContextBuilder() )
- .withContextView( this )
- .withExtension( AshExtension )
- .withExtension( CommandMapExtension )
- .withExtension( EventCommandMapExtension )
- .build();
-
- var commandMap : IEventCommandMap = context.injector.getInstance( IEventCommandMap );
- commandMap.map( StartGameEvent.START_GAME, StartGameEvent ).toCommand( StartAsteroids );
- context.dispatcher.dispatchEvent( new StartGameEvent( this, stage.stageWidth, stage.stageHeight ) );
+ var context : IContext = ( new Context() )
+ .extend( AshExtension )
+ .extend( MVCSBundle)
+ .configure(this);
+
+ context.injector.map(DisplayObjectContainer)
+ context.injector.getInstance(IEventCommandMap);
+ var commandMap : IEventCommandMap = context.injector.getInstance(IEventCommandMap);
+ commandMap.map(StartGameEvent.START_GAME, StartGameEvent).toCommand(StartAsteroids);
+ var dispatcher : IEventDispatcher = context.injector.getInstance(IEventDispatcher);
+ dispatcher.dispatchEvent(new StartGameEvent(this, stage.stageWidth, stage.stageHeight));
}
}
}
Binary file not shown.
Binary file not shown.
@@ -1,33 +1,26 @@
-package net.richardlord.ash.integration.robotlegs
-{
+package net.richardlord.ash.integration.robotlegs {
import net.richardlord.ash.core.Game;
import net.richardlord.ash.integration.swiftsuspenders.SwiftSuspendersGame;
- import robotlegs.bender.core.api.IContext;
- import robotlegs.bender.core.api.IContextExtension;
+ import robotlegs.bender.framework.api.IContext;
+ import robotlegs.bender.framework.api.IExtension;
+ import robotlegs.bender.framework.impl.UID;
/**
* A Robotlegs extension to enable the use of Ash inside a Robotlegs project. This
* wraps the SwiftSuspenders integration, passing the Robotlegs context's injector to
* the game for injecting into systems.
*/
- public class AshExtension implements IContextExtension
- {
- private var context : IContext;
+ public class AshExtension implements IExtension {
+ private const _uid : String = UID.create(AshExtension);
- public function install( context : IContext ) : void
- {
- this.context = context;
- context.injector.map( Game ).toValue( new SwiftSuspendersGame( context.injector ) );
- }
-
- public function initialize() : void
- {
+ public function extend(context : IContext) : void {
+ context.injector.map(Game).toValue(new SwiftSuspendersGame(context.injector));
}
- public function uninstall() : void
+ public function toString():String
{
- context.injector.unmap( Game );
+ return _uid;
}
}
}
@@ -38,5 +38,9 @@ package net.richardlord.ash.integration.swiftsuspenders
}
return null;
}
+
+ public function destroy():void{
+
+ }
}
}

0 comments on commit 30484a7

Please sign in to comment.