├── PyramidGame.tmproj ├── README ├── README.txt ├── assets ├── config │ ├── ISurprisesXMLImporter.as │ ├── SurprisesXMLImporter.as │ └── surprisesConfig.xml └── skins │ ├── PyramidGame │ ├── FlMotionClasses.fla │ ├── FlMotionClasses.html │ ├── FlMotionClasses.swf │ ├── GameIncidentsSkin Report.txt │ ├── GameIncidentsSkin.fla │ ├── GameIncidentsSkin.html │ ├── GameIncidentsSkin.swf │ ├── GameSkin.swf │ ├── GameSkin_plusIcons.fla │ ├── GameSkin_plusIcons.html │ ├── GreyGameSkin.fla │ ├── GreyGameSkin.swf │ ├── ProjectSprouts.png │ ├── test.fla │ └── test.swf │ ├── PyramidGameSkin.as │ └── SurprisesSkin.as ├── bin ├── PyramidGame-debug.swf ├── PyramidGame.html └── PyramidGameRunner.swf ├── lib ├── FLoxy.swc ├── FlMotionClasses.swc ├── as3-signals.swc ├── asunit3 │ ├── AsUnit.as │ └── asunit │ │ ├── errors │ │ ├── AbstractError.as │ │ ├── AssertionFailedError.as │ │ ├── ClassNotFoundError.as │ │ ├── InstanceNotFoundError.as │ │ └── UnimplementedFeatureError.as │ │ ├── framework │ │ ├── Assert.as │ │ ├── AsyncOperation.as │ │ ├── AsynchronousHTTPServiceTestCase.as │ │ ├── AsynchronousTestCase.as │ │ ├── AsynchronousTestCaseExample.as │ │ ├── RemotingTestCase.as │ │ ├── Test.as │ │ ├── TestCase.as │ │ ├── TestCaseExample.as │ │ ├── TestFailure.as │ │ ├── TestListener.as │ │ ├── TestMethod.as │ │ ├── TestResult.as │ │ └── TestSuite.as │ │ ├── runner │ │ ├── BaseTestRunner.as │ │ ├── TestSuiteLoader.as │ │ └── Version.as │ │ ├── textui │ │ ├── AirRunner.as │ │ ├── FlexRunner.as │ │ ├── FlexTestRunner.as │ │ ├── ResultPrinter.as │ │ ├── TestRunner.as │ │ ├── TestTime.as │ │ └── XMLResultPrinter.as │ │ └── util │ │ ├── ArrayIterator.as │ │ ├── Iterator.as │ │ └── Properties.as ├── asx.swc ├── greensock │ └── gs │ │ ├── OverwriteManager.as │ │ ├── TweenGroup.as │ │ ├── TweenLite.as │ │ ├── TweenMax.as │ │ ├── easing │ │ ├── Back.as │ │ ├── Bounce.as │ │ ├── Circ.as │ │ ├── Cubic.as │ │ ├── EaseLookup.as │ │ ├── Elastic.as │ │ ├── Expo.as │ │ ├── Linear.as │ │ ├── Quad.as │ │ ├── Quart.as │ │ ├── Quint.as │ │ ├── Sine.as │ │ ├── Strong.as │ │ └── easing_readme.txt │ │ ├── events │ │ └── TweenEvent.as │ │ ├── plugins │ │ ├── AutoAlphaPlugin.as │ │ ├── BevelFilterPlugin.as │ │ ├── BezierPlugin.as │ │ ├── BezierThroughPlugin.as │ │ ├── BlurFilterPlugin.as │ │ ├── ColorMatrixFilterPlugin.as │ │ ├── ColorTransformPlugin.as │ │ ├── DropShadowFilterPlugin.as │ │ ├── EndArrayPlugin.as │ │ ├── FastTransformPlugin.as │ │ ├── FilterPlugin.as │ │ ├── FrameLabelPlugin.as │ │ ├── FramePlugin.as │ │ ├── GlowFilterPlugin.as │ │ ├── HexColorsPlugin.as │ │ ├── QuaternionsPlugin.as │ │ ├── RemoveTintPlugin.as │ │ ├── RoundPropsPlugin.as │ │ ├── ScalePlugin.as │ │ ├── SetSizePlugin.as │ │ ├── ShortRotationPlugin.as │ │ ├── TintPlugin.as │ │ ├── TweenPlugin.as │ │ ├── VisiblePlugin.as │ │ └── VolumePlugin.as │ │ └── utils │ │ └── tween │ │ ├── ArrayTweenInfo.as │ │ ├── BevelFilterVars.as │ │ ├── BlurFilterVars.as │ │ ├── ColorMatrixFilterVars.as │ │ ├── ColorTransformVars.as │ │ ├── DropShadowFilterVars.as │ │ ├── FilterVars.as │ │ ├── GlowFilterVars.as │ │ ├── SubVars.as │ │ ├── TransformAroundCenterVars.as │ │ ├── TransformAroundPointVars.as │ │ ├── TweenInfo.as │ │ ├── TweenLiteVars.as │ │ └── TweenMaxVars.as ├── hamcrest.swc ├── mockolate │ └── mockolate │ │ ├── errors │ │ ├── ExpectationError.as │ │ ├── InvocationError.as │ │ ├── MockolateError.as │ │ └── VerificationError.as │ │ ├── ingredients │ │ ├── Couverture.as │ │ ├── Expectation.as │ │ ├── Invocation.as │ │ ├── InvocationType.as │ │ ├── MockingCouverture.as │ │ ├── Mockolate.as │ │ ├── MockolateFactory.as │ │ ├── Mockolatier.as │ │ ├── MockolatierMaster.as │ │ ├── RecordingCouverture.as │ │ ├── Verification.as │ │ ├── VerifyingCouverture.as │ │ ├── answers │ │ │ ├── Answer.as │ │ │ ├── CallsAnswer.as │ │ │ ├── DispatchesEventAnswer.as │ │ │ ├── PassThroughAnswer.as │ │ │ ├── ReturnsAnswer.as │ │ │ ├── ReturnsCallAnswer.as │ │ │ ├── ReturnsValueAnswer.as │ │ │ └── ThrowsAnswer.as │ │ ├── faux │ │ │ ├── FauxFloxyInterceptor.as │ │ │ ├── FauxFloxyInvocation.as │ │ │ ├── FauxInvocation.as │ │ │ └── FauxMockolate.as │ │ ├── floxy │ │ │ ├── FloxyInvocation.as │ │ │ ├── FloxyMockolate.as │ │ │ ├── FloxyMockolateFactory.as │ │ │ └── InterceptingCouverture.as │ │ └── mockolate_ingredient.as │ │ ├── make.as │ │ ├── mock.as │ │ ├── nice.as │ │ ├── prepare.as │ │ ├── strict.as │ │ ├── stub.as │ │ └── verify.as └── robotlegs │ └── org │ ├── robotlegs │ ├── adapters │ │ ├── SwiftSuspendersInjector.as │ │ └── SwiftSuspendersReflector.as │ ├── base │ │ ├── CommandMap.as │ │ ├── ContextBase.as │ │ ├── ContextError.as │ │ ├── ContextEvent.as │ │ ├── EventMap.as │ │ ├── MediatorBase.as │ │ ├── MediatorMap.as │ │ ├── ViewMap.as │ │ └── ViewMapBase.as │ ├── core │ │ ├── ICommandMap.as │ │ ├── IContext.as │ │ ├── IContextProvider.as │ │ ├── IEventMap.as │ │ ├── IInjector.as │ │ ├── IMediator.as │ │ ├── IMediatorMap.as │ │ ├── IReflector.as │ │ └── IViewMap.as │ ├── mvcs │ │ ├── Actor.as │ │ ├── Command.as │ │ ├── Context.as │ │ └── Mediator.as │ └── utilities │ │ ├── modular │ │ ├── base │ │ │ ├── ModuleCommandMap.as │ │ │ ├── ModuleContextEvent.as │ │ │ └── ModuleEventDispatcher.as │ │ ├── core │ │ │ ├── IModuleCommandMap.as │ │ │ ├── IModuleContext.as │ │ │ ├── IModuleContextView.as │ │ │ └── IModuleEventDispatcher.as │ │ └── mvcs │ │ │ ├── ModuleContext.as │ │ │ ├── ModuleContextView.as │ │ │ └── ModuleMediator.as │ │ └── signals │ │ ├── base │ │ └── SignalCommandMap.as │ │ ├── core │ │ ├── ISignalCommandMap.as │ │ └── ISignalContext.as │ │ └── mvcs │ │ ├── SignalCommand.as │ │ └── SignalContext.as │ └── swiftsuspenders │ ├── InjectionConfig.as │ ├── InjectionType.as │ ├── Injector.as │ ├── InjectorError.as │ ├── Reflector.as │ ├── injectionpoints │ ├── ConstructorInjectionPoint.as │ ├── InjectionPoint.as │ ├── MethodInjectionPoint.as │ ├── NoParamsConstructorInjectionPoint.as │ ├── PostConstructInjectionPoint.as │ └── PropertyInjectionPoint.as │ └── injectionresults │ ├── IInjectionResult.as │ ├── InjectClassResult.as │ ├── InjectNullResult.as │ ├── InjectSingletonResult.as │ └── InjectValueResult.as ├── rakefile.rb ├── rakefiles └── sprouts_test_extensions.rb ├── reports └── flexpmd │ └── pmd.xml ├── script ├── generate └── generators │ ├── event │ ├── USAGE │ ├── event_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── Event.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── interface │ ├── USAGE │ ├── interface_generator.rb │ └── templates │ │ ├── Component.mxml │ │ └── Interface.as │ ├── rlcommand │ ├── USAGE │ ├── rlcommand_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── RLCommand.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── rlcontext │ ├── USAGE │ ├── rlcontext_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── RLContext.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── rlmediator │ ├── USAGE │ ├── rlmediator_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── RLMediator.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── rlmodel │ ├── USAGE │ ├── rlmodel_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── RLModel.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── rlmodule │ ├── USAGE │ ├── rlmodule_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── RLModule.as │ │ ├── RLModuleContext.as │ │ ├── RLModuleContextTest.as │ │ ├── RLModuleMediator.as │ │ ├── RLModuleMediatorTest.as │ │ ├── RLModuleTest.as │ │ └── TestSuite.as │ ├── rlservice │ ├── USAGE │ ├── rlservice_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── RLService.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── rlview_with_mediator │ ├── USAGE │ ├── rlview_with_mediator_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── MediatorTestCase.as │ │ ├── RLMediator.as │ │ ├── RLView.as │ │ ├── TestSuite.as │ │ └── ViewTestCase.as │ ├── rlview_with_signals │ ├── USAGE │ ├── rlview_with_signals_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── RLView.as │ │ ├── TestSuite.as │ │ └── ViewTestCase.as │ ├── roboteyes_test │ ├── USAGE │ ├── roboteyes_test_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── signal │ ├── USAGE │ ├── signal_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── Signal.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ ├── signal_response_pair │ ├── USAGE │ ├── signal_response_pair_generator.rb │ └── templates │ │ ├── Component.mxml │ │ ├── SignalResponsePair.as │ │ ├── TestCase.as │ │ └── TestSuite.as │ └── support │ ├── USAGE │ ├── support_generator.rb │ └── templates │ ├── Component.mxml │ └── Support.as ├── src ├── PyramidGame.as ├── PyramidGameRunner.as ├── PyramidGameXMLRunner.as ├── com │ └── newloop │ │ ├── animations │ │ └── LoaderDaisy.as │ │ ├── roboteyes │ │ ├── core │ │ │ ├── RobotEyes.as │ │ │ ├── RobotEyesChief.as │ │ │ └── RobotEyesMaster.as │ │ ├── drivers │ │ │ ├── DisplayObjectDriver.as │ │ │ ├── DisplayObjectDriverList.as │ │ │ ├── InteractiveObjectDriver.as │ │ │ └── TextFieldDriver.as │ │ ├── errors │ │ │ └── RobotEyesError.as │ │ ├── getA.as │ │ └── inViewOf.as │ │ └── util │ │ ├── BrowserUtilities.as │ │ ├── ColourUtilities.as │ │ ├── DisplayObjectExposer.as │ │ ├── DisplayObjectUtilities.as │ │ ├── Iterator.as │ │ ├── NumberIterator.as │ │ ├── StringUtilities.as │ │ ├── UnitHelpers.as │ │ ├── VectorUtilities.as │ │ └── events │ │ └── DebugEvent.as ├── org │ ├── osflash │ │ └── signalsv1 │ │ │ ├── DeluxeSignal.as │ │ │ ├── IDeluxeSignal.as │ │ │ ├── IDispatcher.as │ │ │ ├── ISignal.as │ │ │ ├── ISignalOwner.as │ │ │ ├── Signal.as │ │ │ ├── SignalResponsePair.as │ │ │ ├── SyncSignalResponsePair.as │ │ │ ├── events │ │ │ ├── GenericEvent.as │ │ │ ├── IBubbleEventHandler.as │ │ │ └── IEvent.as │ │ │ └── natives │ │ │ ├── INativeDispatcher.as │ │ │ ├── NativeMappedSignal.as │ │ │ ├── NativeRelaySignal.as │ │ │ └── NativeSignal.as │ └── robotlegs │ │ ├── base │ │ ├── CompoundCommandConfig.as │ │ ├── CompoundCommandMap.as │ │ ├── EventAsPayload.as │ │ ├── GuardedCommandMap.as │ │ ├── OptionCommandMap.as │ │ ├── OptionEvent.as │ │ └── RelaxedEventMap.as │ │ ├── core │ │ ├── ICompoundCommandConfig.as │ │ ├── ICompoundCommandContext.as │ │ ├── ICompoundCommandMap.as │ │ ├── IEventAsPayload.as │ │ ├── IGuard.as │ │ ├── IGuardedCommandMap.as │ │ ├── IOptionCommandMap.as │ │ ├── IOptionCommandMapper.as │ │ ├── IRelaxedEventContext.as │ │ └── IRelaxedEventMap.as │ │ ├── mvcs │ │ ├── CompoundCommand.as │ │ ├── OptionCommandMapper.as │ │ └── SignalMediator.as │ │ └── utilities │ │ └── deferredcommandqueue │ │ ├── DeferredCommandQueue.as │ │ ├── DeferredCommandQueueEvent.as │ │ ├── IDeferredCommandQueue.as │ │ └── RunNextDeferredCommand.as └── strategy │ ├── PyramidGameContext.as │ ├── PyramidGameView.as │ ├── PyramidGameViewMediator.as │ ├── controller │ ├── commands │ │ ├── ConfigureModelsCommand.as │ │ ├── ProcessGameOverCommand.as │ │ ├── ProcessGameWonCommand.as │ │ ├── RestartGameCommand.as │ │ ├── StartGameCommand.as │ │ ├── StartViewCommand.as │ │ ├── bootstraps │ │ │ ├── BootstrapDayCycleCommands.as │ │ │ ├── BootstrapGameEndingsCommand.as │ │ │ ├── BootstrapGameStartup.as │ │ │ ├── BootstrapModels.as │ │ │ └── BootstrapViewMediators.as │ │ ├── daycycle │ │ │ ├── CastRandomEventsCommand.as │ │ │ ├── CheckForWeekendCommand.as │ │ │ ├── CheckStoneStockCommand.as │ │ │ ├── HireWorkersCommand.as │ │ │ ├── MapDilemmaConsequencesCommand.as │ │ │ ├── OfferLabourCommand.as │ │ │ ├── OfferStoneCommand.as │ │ │ ├── OfferWeekendWorkingCommand.as │ │ │ ├── ProcessDayEndCommand.as │ │ │ ├── ProcessDayStartCommand.as │ │ │ ├── SkipHireWorkersCommand.as │ │ │ └── TakeStoneDeliveryCommand.as │ │ └── surpriseconsequences │ │ │ ├── AdjustDayProductivityCommand.as │ │ │ ├── AdjustEnvironmentalImpactCommand.as │ │ │ ├── AdjustProgressCommand.as │ │ │ ├── AdjustSafetyCommand.as │ │ │ ├── AdjustTargetCommand.as │ │ │ ├── AdjustTeamProductivityCommand.as │ │ │ ├── ApplyStoneInsuranceCommand.as │ │ │ ├── ContinueGameCommand.as │ │ │ ├── DoubleStoneStorageCommand.as │ │ │ ├── NullConsequenceCommand.as │ │ │ ├── RestTheWeekendCommand.as │ │ │ ├── RiskAccidentCommand.as │ │ │ ├── SpendMoneyCommand.as │ │ │ ├── SuspendWorkerCommand.as │ │ │ └── WorkTheWeekendCommand.as │ ├── events │ │ ├── DailyProgressEvent.as │ │ ├── DayCycleEvent.as │ │ ├── DilemmaEvent.as │ │ ├── GameEvent.as │ │ ├── GameOverEvent.as │ │ ├── GameWonEvent.as │ │ ├── LabourSupplyEvent.as │ │ ├── LabourSuspensionEvent.as │ │ ├── ResourceBoundaryEvent.as │ │ ├── ResourceStatusEvent.as │ │ ├── StoneStockCheckEvent.as │ │ └── StoneSupplyEvent.as │ └── surprises │ │ ├── BaseSurpriseEventCaster.as │ │ ├── DilemmaSurpriseEventCaster.as │ │ ├── IDilemmaSurpriseEventCaster.as │ │ ├── ILabourSurpriseEventCaster.as │ │ ├── IStoneSurpriseEventCaster.as │ │ ├── ISurpriseEventCaster.as │ │ ├── LabourSurpriseEventCaster.as │ │ ├── StoneSurpriseEventCaster.as │ │ ├── SurprisesClassImporter.as │ │ └── SurprisesSpec.as │ ├── model │ ├── FirstGameConfig.as │ ├── GameConfigVO.as │ ├── IGameConfig.as │ ├── base │ │ ├── GameFactorModel.as │ │ ├── GameImpactFactorModel.as │ │ ├── GameMetricBaseModel.as │ │ ├── IGameFactorModel.as │ │ ├── IGameMetricModel.as │ │ ├── IImpactModel.as │ │ ├── IMarketVariationModel.as │ │ └── MarketVariationModel.as │ ├── gameplay │ │ ├── DilemmaOptionVO.as │ │ ├── DilemmaVO.as │ │ ├── IDilemmaVO.as │ │ ├── IOptionVO.as │ │ ├── OptionVO.as │ │ └── dilemmas │ │ │ ├── DilemmaConfig.as │ │ │ ├── DilemmaConfigBuilder.as │ │ │ └── WeekendWorkingDilemma.as │ ├── markets │ │ ├── ILabourAvailabilityMarket.as │ │ ├── ILabourPriceMarket.as │ │ ├── IStoneAvailabilityMarket.as │ │ ├── IStonePriceMarket.as │ │ ├── LabourAvailabilityMarket.as │ │ ├── LabourPriceMarket.as │ │ ├── StoneAvailabilityMarket.as │ │ └── StonePriceMarket.as │ ├── resources │ │ ├── BuildingProgressModel.as │ │ ├── CalendarModel.as │ │ ├── CashModel.as │ │ ├── EnvironmentalImpactModel.as │ │ ├── HealthAndSafetyModel.as │ │ ├── IBuildingProgressModel.as │ │ ├── ICalendarModel.as │ │ ├── ICashModel.as │ │ ├── IEnvironmentalImpactModel.as │ │ ├── IHealthAndSafetyModel.as │ │ ├── ILabourModel.as │ │ ├── IStoneSupplyModel.as │ │ ├── IWorker.as │ │ ├── LabourModel.as │ │ ├── StoneSupplyModel.as │ │ ├── TempWorker.as │ │ └── Worker.as │ └── transactions │ │ ├── DailyProductivityVO.as │ │ ├── NullStoneTransactionVO.as │ │ ├── StoneTransactionVO.as │ │ └── WorkerProductivityVO.as │ └── view │ ├── PyramidProgressView.as │ ├── PyramidProgressViewMediator.as │ ├── SkyView.as │ ├── SkyViewMediator.as │ ├── WorkerView.as │ ├── decisions │ ├── DilemmaView.as │ ├── DilemmaViewMediator.as │ ├── IStoneOfferView.as │ ├── LabourOfferView.as │ ├── LabourOfferViewMediator.as │ ├── NoStoneView.as │ ├── NoStoneViewMediator.as │ ├── StoneDilemmaView.as │ ├── StoneOfferView.as │ ├── StoneOfferViewMediator.as │ ├── WorkerForHireView.as │ └── WorkerForHireViewMediator.as │ ├── logs │ ├── LineGraph.as │ └── LineGraphMediator.as │ ├── messages │ ├── BaseGameMessageView.as │ ├── DaySummaryView.as │ ├── DaySummaryViewMediator.as │ ├── GameMessageText.as │ ├── GameOverView.as │ ├── GameOverViewMediator.as │ ├── GameWonView.as │ ├── GameWonViewMediator.as │ ├── IGameMessageText.as │ ├── StoneStockCheckView.as │ └── StoneStockCheckViewMediator.as │ └── status │ ├── BaseGaugeStatusView.as │ ├── BaseStatusView.as │ ├── CalendarStatusView.as │ ├── CalendarStatusViewMediator.as │ ├── CashStatusView.as │ ├── CashStatusViewMediator.as │ ├── EnvironmentStatusView.as │ ├── EnvironmentStatusViewMediator.as │ ├── ProgressStatusView.as │ ├── ProgressStatusViewMediator.as │ ├── SafetyStatusView.as │ ├── SafetyStatusViewMediator.as │ ├── StoneStockStatusView.as │ ├── StoneStockStatusViewMediator.as │ ├── TeamStatusView.as │ └── TeamStatusViewMediator.as ├── support ├── org │ └── robotlegs │ │ └── mvcs │ │ └── CommandSupport.as └── strategy │ └── model │ ├── MinimumUnwinnableGameConfigSupport.as │ └── gameplay │ ├── DilemmaVOSupport.as │ └── OptionVOSupport.as ├── test ├── AllTests.as ├── config │ └── SurprisesXMLImporterTest.as └── strategy │ ├── PyramidGameContextTest.as │ ├── PyramidGameViewMediatorTest.as │ ├── PyramidGameViewTest.as │ ├── controller │ ├── commands │ │ ├── ConfigureModelsCommandTest.as │ │ ├── ProcessGameOverCommandTest.as │ │ ├── ProcessGameWonCommandTest.as │ │ ├── RestartGameCommandTest.as │ │ ├── StartGameCommandTest.as │ │ ├── StartViewCommandTest.as │ │ ├── daycycle │ │ │ ├── CastRandomEventsCommandTest.as │ │ │ ├── CheckForWeekendCommandTest.as │ │ │ ├── CheckStoneStockCommandTest.as │ │ │ ├── HireWorkersCommandTest.as │ │ │ ├── MapDilemmaConsequencesCommandTest.as │ │ │ ├── OfferLabourCommandTest.as │ │ │ ├── OfferStoneCommandTest.as │ │ │ ├── OfferWeekendWorkingCommandTest.as │ │ │ ├── ProcessDayEndCommandTest.as │ │ │ ├── ProcessDayStartCommandTest.as │ │ │ ├── SkipHireWorkersCommandTest.as │ │ │ └── TakeStoneDeliveryCommandTest.as │ │ └── surpriseconsequences │ │ │ ├── AdjustDayProductivityCommandTest.as │ │ │ ├── AdjustEnvironmentalImpactCommandTest.as │ │ │ ├── AdjustProgressCommandTest.as │ │ │ ├── AdjustSafetyCommandTest.as │ │ │ ├── AdjustTargetCommandTest.as │ │ │ ├── AdjustTeamProductivityCommandTest.as │ │ │ ├── ApplyStoneInsuranceCommandTest.as │ │ │ ├── ContinueGameCommandTest.as │ │ │ ├── DoubleStoneStorageCommandTest.as │ │ │ ├── RestTheWeekendCommandTest.as │ │ │ ├── RiskAccidentCommandTest.as │ │ │ ├── SpendMoneyCommandTest.as │ │ │ ├── SuspendWorkerCommandTest.as │ │ │ └── WorkTheWeekendCommandTest.as │ ├── events │ │ ├── DailyProgressEventTest.as │ │ ├── DayCycleEventTest.as │ │ ├── DilemmaEventTest.as │ │ ├── GameEventTest.as │ │ ├── GameOverEventTest.as │ │ ├── GameWonEventTest.as │ │ ├── LabourSupplyEventTest.as │ │ ├── LabourSuspensionEventTest.as │ │ ├── ResourceBoundaryEventTest.as │ │ ├── ResourceStatusEventTest.as │ │ ├── StoneStockCheckEventTest.as │ │ └── StoneSupplyEventTest.as │ └── surprises │ │ ├── DilemmaSurpriseEventCasterTest.as │ │ ├── LabourSurpriseEventCasterTest.as │ │ └── StoneSurpriseEventCasterTest.as │ ├── model │ ├── FirstGameConfigTest.as │ ├── base │ │ ├── GameFactorModelTest.as │ │ └── MarketVariationModelTest.as │ ├── gameplay │ │ ├── DilemmaVOTest.as │ │ ├── OptionVOTest.as │ │ └── dilemmas │ │ │ ├── DilemmaConfigBuilderTest.as │ │ │ └── WeekendWorkingDilemmaTest.as │ ├── markets │ │ ├── LabourAvailabilityMarketTest.as │ │ ├── LabourPriceMarketTest.as │ │ ├── StoneAvailabilityMarketTest.as │ │ └── StonePriceMarketTest.as │ └── resources │ │ ├── BuildingProgressModelTest.as │ │ ├── CalendarModelTest.as │ │ ├── CashModelTest.as │ │ ├── EnvironmentalImpactModelTest.as │ │ ├── HealthAndSafetyModelTest.as │ │ ├── LabourModelTest.as │ │ ├── StoneSupplyModelTest.as │ │ └── WorkerTest.as │ ├── view │ ├── PyramidProgressViewMediatorTest.as │ ├── PyramidProgressViewTest.as │ ├── SkyViewMediatorTest.as │ ├── SkyViewTest.as │ ├── WorkerViewTest.as │ ├── decisions │ │ ├── DilemmaViewMediatorTest.as │ │ ├── DilemmaViewTest.as │ │ ├── LabourOfferViewMediatorTest.as │ │ ├── LabourOfferViewTest.as │ │ ├── NoStoneViewMediatorTest.as │ │ ├── NoStoneViewTest.as │ │ ├── StoneDilemmaViewTest.as │ │ ├── StoneOfferViewMediatorTest.as │ │ ├── StoneOfferViewTest.as │ │ ├── WorkerForHireViewMediatorTest.as │ │ └── WorkerForHireViewTest.as │ ├── logs │ │ ├── LineGraphMediatorTest.as │ │ └── LineGraphTest.as │ ├── messages │ │ ├── DaySummaryViewMediatorTest.as │ │ ├── DaySummaryViewTest.as │ │ ├── GameOverViewMediatorTest.as │ │ ├── GameOverViewTest.as │ │ ├── GameWonViewMediatorTest.as │ │ ├── GameWonViewTest.as │ │ ├── StoneStockCheckViewMediatorTest.as │ │ └── StoneStockCheckViewTest.as │ └── status │ │ ├── CalendarStatusViewMediatorTest.as │ │ ├── CalendarStatusViewTest.as │ │ ├── CashStatusViewMediatorTest.as │ │ ├── CashStatusViewTest.as │ │ ├── EnvironmentStatusViewMediatorTest.as │ │ ├── EnvironmentStatusViewTest.as │ │ ├── ProgressStatusViewMediatorTest.as │ │ ├── ProgressStatusViewTest.as │ │ ├── SafetyStatusViewMediatorTest.as │ │ ├── SafetyStatusViewTest.as │ │ ├── StoneStockStatusViewMediatorTest.as │ │ ├── StoneStockStatusViewTest.as │ │ ├── TeamStatusViewMediatorTest.as │ │ └── TeamStatusViewTest.as │ └── xendtoendtests │ ├── APyramidGameEndToEndTest.as │ ├── BStartingConditionsTest.as │ └── CFirstDayTest.as ├── todo.txt └── tools └── findMediatorEventMappings.rb /README: -------------------------------------------------------------------------------- 1 | A simple strategy game engine built with robotlegs, without the use of a game-controller or 'god object'. 2 | 3 | That's the plan anyway. I'll post progress here as I work through it so that the commits roughly capture the workflow. -------------------------------------------------------------------------------- /assets/config/ISurprisesXMLImporter.as: -------------------------------------------------------------------------------- 1 | package config 2 | { 3 | 4 | public interface ISurprisesXMLImporter 5 | { 6 | function get surprisesXML():XML; 7 | } 8 | 9 | } 10 | 11 | -------------------------------------------------------------------------------- /assets/config/SurprisesXMLImporter.as: -------------------------------------------------------------------------------- 1 | package config 2 | { 3 | import flash.utils.ByteArray; 4 | import config.ISurprisesXMLImporter; 5 | 6 | public class SurprisesXMLImporter extends Object implements ISurprisesXMLImporter 7 | { 8 | [Embed(source='surprisesConfig.xml', mimeType="application/octet-stream")] 9 | protected static const SurprisesConfigXML:Class; 10 | 11 | protected var _xml:XML; 12 | 13 | public function SurprisesXMLImporter() 14 | { 15 | super(); 16 | } 17 | 18 | public function get surprisesXML():XML 19 | { 20 | return _xml ||= processXML(); 21 | } 22 | 23 | protected function processXML():XML 24 | { 25 | var file:ByteArray = new SurprisesConfigXML(); 26 | var str:String = file.readUTFBytes( file.length ); 27 | var xml:XML = new XML( str ); 28 | return xml; 29 | } 30 | 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /assets/skins/PyramidGame/FlMotionClasses.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/FlMotionClasses.fla -------------------------------------------------------------------------------- /assets/skins/PyramidGame/FlMotionClasses.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/FlMotionClasses.swf -------------------------------------------------------------------------------- /assets/skins/PyramidGame/GameIncidentsSkin.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/GameIncidentsSkin.fla -------------------------------------------------------------------------------- /assets/skins/PyramidGame/GameIncidentsSkin.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/GameIncidentsSkin.swf -------------------------------------------------------------------------------- /assets/skins/PyramidGame/GameSkin.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/GameSkin.swf -------------------------------------------------------------------------------- /assets/skins/PyramidGame/GameSkin_plusIcons.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/GameSkin_plusIcons.fla -------------------------------------------------------------------------------- /assets/skins/PyramidGame/GreyGameSkin.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/GreyGameSkin.fla -------------------------------------------------------------------------------- /assets/skins/PyramidGame/GreyGameSkin.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/GreyGameSkin.swf -------------------------------------------------------------------------------- /assets/skins/PyramidGame/ProjectSprouts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/ProjectSprouts.png -------------------------------------------------------------------------------- /assets/skins/PyramidGame/test.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/test.fla -------------------------------------------------------------------------------- /assets/skins/PyramidGame/test.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/assets/skins/PyramidGame/test.swf -------------------------------------------------------------------------------- /bin/PyramidGame-debug.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/bin/PyramidGame-debug.swf -------------------------------------------------------------------------------- /bin/PyramidGameRunner.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/bin/PyramidGameRunner.swf -------------------------------------------------------------------------------- /lib/FLoxy.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/lib/FLoxy.swc -------------------------------------------------------------------------------- /lib/FlMotionClasses.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/lib/FlMotionClasses.swc -------------------------------------------------------------------------------- /lib/as3-signals.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/lib/as3-signals.swc -------------------------------------------------------------------------------- /lib/asunit3/asunit/errors/AbstractError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class AbstractError extends Error { 4 | 5 | public function AbstractError(message:String) { 6 | super(message); 7 | name = "AbstractError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/errors/AssertionFailedError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class AssertionFailedError extends Error { 4 | 5 | public function AssertionFailedError(message:String) { 6 | super(message); 7 | name = "AssertionFailedError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/errors/ClassNotFoundError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class ClassNotFoundError extends Error { 4 | 5 | public function ClassNotFoundError(message:String) { 6 | super(message); 7 | name = "ClassNotFoundError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/errors/InstanceNotFoundError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class InstanceNotFoundError extends Error { 4 | 5 | public function InstanceNotFoundError(message:String) { 6 | super(message); 7 | name = "InstanceNotFoundError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/errors/UnimplementedFeatureError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class UnimplementedFeatureError extends Error { 4 | 5 | public function UnimplementedFeatureError(message:String) { 6 | super(message); 7 | name = "UnimplementedFeatureError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/framework/Test.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import flash.display.DisplayObjectContainer; 3 | import flash.events.IEventDispatcher; 4 | 5 | public interface Test extends IEventDispatcher { 6 | function countTestCases():int; 7 | function getName():String; 8 | function getTestMethods():Array; 9 | function toString():String; 10 | function setResult(result:TestListener):void; 11 | function run():void; 12 | function runBare():void; 13 | function getCurrentMethod():String; 14 | function getIsComplete():Boolean; 15 | function setContext(context:DisplayObjectContainer):void; 16 | function getContext():DisplayObjectContainer; 17 | } 18 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/framework/TestListener.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import asunit.errors.AssertionFailedError; 3 | 4 | public interface TestListener { 5 | 6 | /** 7 | * Run the provided Test. 8 | */ 9 | function run(test:Test):void; 10 | /** 11 | * A test started. 12 | */ 13 | function startTest(test:Test):void; 14 | /** 15 | * A failure occurred. 16 | */ 17 | function addFailure(test:Test, t:AssertionFailedError):void; 18 | /** 19 | * An error occurred. 20 | */ 21 | function addError(test:Test, t:Error):void; 22 | /** 23 | * A test method has begun execution. 24 | */ 25 | function startTestMethod(test:Test, methodName:String):void; 26 | /** 27 | * A test method has completed. 28 | */ 29 | function endTestMethod(test:Test, methodName:String):void; 30 | /** 31 | * A test ended. 32 | */ 33 | function endTest(test:Test):void; 34 | } 35 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/framework/TestMethod.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import flash.utils.getTimer; 4 | 5 | /** 6 | * A TestFailure collects a failed test together with 7 | * the caught exception. 8 | * @see TestResult 9 | */ 10 | public class TestMethod { 11 | protected var test:Test; 12 | protected var method:String; 13 | 14 | private var _duration:Number; 15 | private var start:Number; 16 | 17 | /** 18 | * Constructs a TestMethod with a given Test and method name. 19 | */ 20 | public function TestMethod(test:Test, method:String) { 21 | this.test = test; 22 | this.method = method; 23 | start = getTimer(); 24 | } 25 | 26 | public function getName():String { 27 | return method; 28 | } 29 | 30 | public function endTest(test:Test):void { 31 | _duration = (getTimer() - start) * .001; 32 | } 33 | 34 | public function duration():Number { 35 | return _duration; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/runner/BaseTestRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.runner { 2 | import flash.display.Sprite; 3 | 4 | /** 5 | * Base class for all test runners. 6 | * This class was born live on stage in Sardinia during XP2000. 7 | */ 8 | public class BaseTestRunner extends Sprite { 9 | 10 | // Filters stack frames from internal JUnit classes 11 | public static function getFilteredTrace(stack:String):String { 12 | return stack; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/asunit3/asunit/runner/TestSuiteLoader.as: -------------------------------------------------------------------------------- 1 | package asunit.runner { 2 | 3 | public interface TestSuiteLoader { 4 | // throws ClassNotFoundException 5 | function load(suiteClassName:String):Class; 6 | // throws ClassNotFoundException 7 | function reload(aClass:Class):Class; 8 | } 9 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/runner/Version.as: -------------------------------------------------------------------------------- 1 | package asunit.runner { 2 | 3 | public class Version { 4 | private static var version:String = "3.0"; 5 | 6 | public static function id():String { 7 | return version.toString(); 8 | } 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/textui/AirRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | import asunit.framework.TestResult; 3 | 4 | import mx.core.WindowedApplication; 5 | 6 | /** 7 | * The base class for Air application runners that use the Flex framework. 8 | * 9 | * @includeExample AirRunnerExample.mxml 10 | * 11 | * @author Ian 12 | * @playerversion AIR 1.1 13 | **/ 14 | public class AirRunner extends WindowedApplication { 15 | 16 | protected var runner:TestRunner; 17 | 18 | override protected function createChildren():void { 19 | super.createChildren(); 20 | runner = new FlexTestRunner(); 21 | rawChildren.addChild(runner); 22 | } 23 | 24 | public function start(testCase:Class, testMethod:String = null, showTrace:Boolean = false) : TestResult { 25 | return runner.start(testCase, testMethod, showTrace); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/asunit3/asunit/textui/FlexRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | import asunit.framework.TestResult; 3 | 4 | import mx.core.Application; 5 | 6 | /** 7 | * The FlexTestRunner should be the base class for your 8 | * test harness if you're testing a project that uses Flex components. 9 | * 10 | * @includeExample FlexRunnerExample.mxml 11 | **/ 12 | public class FlexRunner extends Application { 13 | protected var runner:TestRunner; 14 | 15 | override protected function createChildren():void { 16 | super.createChildren(); 17 | runner = new FlexTestRunner(); 18 | rawChildren.addChild(runner); 19 | } 20 | 21 | public function start(testCase:Class, testMethod:String = null, showTrace:Boolean = false):TestResult { 22 | return runner.start(testCase, testMethod, showTrace); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/asunit3/asunit/util/ArrayIterator.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | 3 | import asunit.util.Iterator; 4 | 5 | [ExcludeClass] 6 | public class ArrayIterator implements Iterator { 7 | private var list:Array; 8 | private var index:Number = 0; 9 | 10 | public function ArrayIterator(list:Array) { 11 | this.list = list; 12 | } 13 | 14 | public function hasNext():Boolean { 15 | return list[index] != null; 16 | } 17 | 18 | public function next():Object { 19 | return list[index++]; 20 | } 21 | 22 | public function reset():void { 23 | index = 0; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/asunit3/asunit/util/Iterator.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | 3 | [ExcludeClass] 4 | public interface Iterator { 5 | function next():Object; 6 | function hasNext():Boolean; 7 | function reset():void; 8 | } 9 | } -------------------------------------------------------------------------------- /lib/asunit3/asunit/util/Properties.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | import asunit.errors.UnimplementedFeatureError; 3 | import flash.errors.IllegalOperationError; 4 | 5 | [ExcludeClass] 6 | public dynamic class Properties { 7 | 8 | public function store(sharedObjectId:String):void { 9 | throw new UnimplementedFeatureError("Properties.store"); 10 | } 11 | 12 | public function put(key:String, value:Object):void { 13 | this[key] = value; 14 | } 15 | 16 | public function setProperty(key:String, value:Object):void { 17 | put(key, value); 18 | } 19 | 20 | public function getProperty(key:String):Object { 21 | try { 22 | return this[key]; 23 | } 24 | catch(e:Error) { 25 | throw IllegalOperationError("Properties.getProperty"); 26 | } 27 | return null; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /lib/asx.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/lib/asx.swc -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Back.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Back { 3 | public static function easeIn (t:Number, b:Number, c:Number, d:Number, s:Number = 1.70158):Number { 4 | return c*(t/=d)*t*((s+1)*t - s) + b; 5 | } 6 | public static function easeOut (t:Number, b:Number, c:Number, d:Number, s:Number = 1.70158):Number { 7 | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 8 | } 9 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number, s:Number = 1.70158):Number { 10 | if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 11 | return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Bounce.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Bounce { 3 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 4 | if ((t/=d) < (1/2.75)) { 5 | return c*(7.5625*t*t) + b; 6 | } else if (t < (2/2.75)) { 7 | return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 8 | } else if (t < (2.5/2.75)) { 9 | return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 10 | } else { 11 | return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 12 | } 13 | } 14 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 15 | return c - easeOut(d-t, 0, c, d) + b; 16 | } 17 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 18 | if (t < d/2) return easeIn (t*2, 0, c, d) * .5 + b; 19 | else return easeOut (t*2-d, 0, c, d) * .5 + c*.5 + b; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Circ.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Circ { 3 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 4 | return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 5 | } 6 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 7 | return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 8 | } 9 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 10 | if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 11 | return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Cubic.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Cubic { 3 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 4 | return c*(t/=d)*t*t + b; 5 | } 6 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 7 | return c*((t=t/d-1)*t*t + 1) + b; 8 | } 9 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 10 | if ((t/=d/2) < 1) return c/2*t*t*t + b; 11 | return c/2*((t-=2)*t*t + 2) + b; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Expo.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Expo { 3 | public static function easeIn(t:Number, b:Number, c:Number, d:Number):Number { 4 | return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b - c * 0.001; 5 | } 6 | public static function easeOut(t:Number, b:Number, c:Number, d:Number):Number { 7 | return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 8 | } 9 | public static function easeInOut(t:Number, b:Number, c:Number, d:Number):Number { 10 | if (t==0) return b; 11 | if (t==d) return b+c; 12 | if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 13 | return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Linear.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Linear { 3 | public static function easeNone (t:Number, b:Number, c:Number, d:Number):Number { 4 | return c*t/d + b; 5 | } 6 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 7 | return c*t/d + b; 8 | } 9 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 10 | return c*t/d + b; 11 | } 12 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 13 | return c*t/d + b; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Quad.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Quad { 3 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 4 | return c*(t/=d)*t + b; 5 | } 6 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 7 | return -c *(t/=d)*(t-2) + b; 8 | } 9 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 10 | if ((t/=d/2) < 1) return c/2*t*t + b; 11 | return -c/2 * ((--t)*(t-2) - 1) + b; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Quart.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Quart { 3 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 4 | return c*(t/=d)*t*t*t + b; 5 | } 6 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 7 | return -c * ((t=t/d-1)*t*t*t - 1) + b; 8 | } 9 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 10 | if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 11 | return -c/2 * ((t-=2)*t*t*t - 2) + b; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Quint.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Quint { 3 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 4 | return c*(t/=d)*t*t*t*t + b; 5 | } 6 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 7 | return c*((t=t/d-1)*t*t*t*t + 1) + b; 8 | } 9 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 10 | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 11 | return c/2*((t-=2)*t*t*t*t + 2) + b; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Sine.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Sine { 3 | private static const _HALF_PI:Number = Math.PI / 2; 4 | 5 | public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number { 6 | return -c * Math.cos(t/d * _HALF_PI) + c + b; 7 | } 8 | public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number { 9 | return c * Math.sin(t/d * _HALF_PI) + b; 10 | } 11 | public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number { 12 | return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /lib/greensock/gs/easing/Strong.as: -------------------------------------------------------------------------------- 1 | package gs.easing { 2 | public class Strong { 3 | public static function easeIn(t:Number, b:Number, c:Number, d:Number):Number { 4 | return c*(t/=d)*t*t*t*t + b; 5 | } 6 | public static function easeOut(t:Number, b:Number, c:Number, d:Number):Number { 7 | return c*((t=t/d-1)*t*t*t*t + 1) + b; 8 | } 9 | public static function easeInOut(t:Number, b:Number, c:Number, d:Number):Number { 10 | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 11 | return c/2*((t-=2)*t*t*t*t + 2) + b; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/greensock/gs/events/TweenEvent.as: -------------------------------------------------------------------------------- 1 | /* 2 | VERSION: 0.9 3 | DATE: 7/15/2008 4 | ACTIONSCRIPT VERSION: 3.0 (Requires Flash Player 9) 5 | DESCRIPTION: 6 | Used for Event dispatching from the AS3 version of TweenMax (www.tweenmax.com) 7 | 8 | 9 | CODED BY: Jack Doyle, jack@greensock.com 10 | Copyright 2008, GreenSock (This work is subject to the terms at http://www.greensock.com/terms_of_use.html.) 11 | */ 12 | 13 | package gs.events { 14 | import flash.events.Event; 15 | 16 | public class TweenEvent extends Event { 17 | public static const version:Number = 0.9; 18 | public static const START:String = "start"; 19 | public static const UPDATE:String = "update"; 20 | public static const COMPLETE:String = "complete"; 21 | 22 | public var info:Object; 23 | 24 | public function TweenEvent($type:String, $info:Object = null, $bubbles:Boolean = false, $cancelable:Boolean = false){ 25 | super($type, $bubbles, $cancelable); 26 | this.info = $info; 27 | } 28 | 29 | public override function clone():Event{ 30 | return new TweenEvent(this.type, this.info, this.bubbles, this.cancelable); 31 | } 32 | 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /lib/greensock/gs/utils/tween/ArrayTweenInfo.as: -------------------------------------------------------------------------------- 1 | /* 2 | VERSION: 1.0 3 | DATE: 1/23/2009 4 | ACTIONSCRIPT VERSION: 3.0 5 | UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenLite.com 6 | DESCRIPTION: 7 | Stores basic info about Array tweens in TweenLite/Max. 8 | 9 | AUTHOR: Jack Doyle, jack@greensock.com 10 | Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. 11 | */ 12 | 13 | package gs.utils.tween { 14 | 15 | public class ArrayTweenInfo { 16 | public var index:uint; 17 | public var start:Number; 18 | public var change:Number; 19 | 20 | public function ArrayTweenInfo($index:uint, $start:Number, $change:Number) { 21 | this.index = $index; 22 | this.start = $start; 23 | this.change = $change; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /lib/greensock/gs/utils/tween/FilterVars.as: -------------------------------------------------------------------------------- 1 | /* 2 | VERSION: 1.0 3 | DATE: 1/29/2009 4 | ACTIONSCRIPT VERSION: 3.0 5 | DESCRIPTION: 6 | This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant 7 | strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in 8 | the TweenLiteVars or TweenMaxVars for more information. 9 | 10 | 11 | AUTHOR: Jack Doyle, jack@greensock.com 12 | Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. 13 | */ 14 | 15 | 16 | package gs.utils.tween { 17 | public class FilterVars extends SubVars { 18 | public var remove:Boolean; 19 | public var index:int; 20 | public var addFilter:Boolean; 21 | 22 | public function FilterVars($remove:Boolean=false, $index:int=-1, $addFilter:Boolean=false) { 23 | super(); 24 | this.remove = $remove; 25 | if ($index > -1) { 26 | this.index = $index; 27 | } 28 | this.addFilter = $addFilter; 29 | } 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /lib/greensock/gs/utils/tween/SubVars.as: -------------------------------------------------------------------------------- 1 | /* 2 | VERSION: 1.0 3 | DATE: 1/29/2009 4 | ACTIONSCRIPT VERSION: 3.0 5 | DESCRIPTION: 6 | This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant 7 | strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in 8 | the TweenLiteVars or TweenMaxVars for more information. 9 | 10 | 11 | AUTHOR: Jack Doyle, jack@greensock.com 12 | Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. 13 | */ 14 | 15 | 16 | package gs.utils.tween { 17 | public class SubVars { 18 | public var isTV:Boolean = true; 19 | public var exposedVars:Object; 20 | 21 | public function SubVars() { 22 | this.exposedVars = {}; 23 | } 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /lib/greensock/gs/utils/tween/TweenInfo.as: -------------------------------------------------------------------------------- 1 | /* 2 | VERSION: 1.0 3 | DATE: 1/21/2009 4 | ACTIONSCRIPT VERSION: 3.0 5 | UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenLite.com 6 | DESCRIPTION: 7 | Stores basic info about individual property tweens in TweenLite/Max. 8 | 9 | AUTHOR: Jack Doyle, jack@greensock.com 10 | Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership. 11 | */ 12 | 13 | package gs.utils.tween { 14 | 15 | public class TweenInfo { 16 | public var target:Object; 17 | public var property:String; 18 | public var start:Number; 19 | public var change:Number; 20 | public var name:String; 21 | public var isPlugin:Boolean; 22 | 23 | public function TweenInfo($target:Object, $property:String, $start:Number, $change:Number, $name:String, $isPlugin:Boolean) { 24 | this.target = $target; 25 | this.property = $property; 26 | this.start = $start; 27 | this.change = $change; 28 | this.name = $name; 29 | this.isPlugin = $isPlugin; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /lib/hamcrest.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stray/robotlegs-demo-StrategyGame/7d8662f04d21b57bb6d44cf53772fa0a1261e5dc/lib/hamcrest.swc -------------------------------------------------------------------------------- /lib/mockolate/mockolate/errors/ExpectationError.as: -------------------------------------------------------------------------------- 1 | package mockolate.errors 2 | { 3 | import mockolate.ingredients.Expectation; 4 | import mockolate.ingredients.Mockolate; 5 | 6 | /** 7 | * Expectation-related Error 8 | */ 9 | public class ExpectationError extends MockolateError 10 | { 11 | private var _expectation:Expectation; 12 | 13 | /** 14 | * Constructor 15 | */ 16 | public function ExpectationError(message:Object, expectation:Expectation, mockolate:Mockolate, target:Object) 17 | { 18 | super(message, mockolate, target); 19 | 20 | _expectation = expectation; 21 | } 22 | 23 | /** 24 | * Expectation instance related to this Error 25 | */ 26 | public function get expectation():Expectation 27 | { 28 | return _expectation; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /lib/mockolate/mockolate/errors/InvocationError.as: -------------------------------------------------------------------------------- 1 | package mockolate.errors 2 | { 3 | import mockolate.ingredients.Invocation; 4 | import mockolate.ingredients.Mockolate; 5 | 6 | /** 7 | * Invocation-related Error 8 | */ 9 | public class InvocationError extends MockolateError 10 | { 11 | private var _invocation:Invocation; 12 | 13 | /** 14 | * Constructor. 15 | */ 16 | public function InvocationError(message:Object, invocation:Invocation, mockolate:Mockolate, target:Object) 17 | { 18 | super(message, mockolate, target); 19 | 20 | _invocation = invocation; 21 | } 22 | 23 | public function get invocation():Invocation 24 | { 25 | return _invocation; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /lib/mockolate/mockolate/errors/MockolateError.as: -------------------------------------------------------------------------------- 1 | package mockolate.errors 2 | { 3 | import asx.string.substitute; 4 | 5 | import mockolate.ingredients.Mockolate; 6 | 7 | /** 8 | * Mockolate-related Error 9 | */ 10 | public class MockolateError extends Error 11 | { 12 | private var _mockolate:Mockolate; 13 | private var _target:Object; 14 | 15 | /** 16 | * Constructor. 17 | */ 18 | public function MockolateError(message:Object, mockolate:Mockolate, target:Object) { 19 | 20 | if (message is Array) 21 | message = substitute(message[0], message[1] || []); 22 | 23 | super(message); 24 | 25 | _mockolate = mockolate; 26 | _target = target; 27 | } 28 | 29 | public function get mockolate():Mockolate { 30 | return _mockolate; 31 | } 32 | 33 | public function get target():Object { 34 | return _target; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/errors/VerificationError.as: -------------------------------------------------------------------------------- 1 | package mockolate.errors 2 | { 3 | import mockolate.ingredients.Expectation; 4 | import mockolate.ingredients.Mockolate; 5 | import mockolate.ingredients.Verification; 6 | 7 | /** 8 | * Verification-related Error 9 | */ 10 | public class VerificationError extends MockolateError 11 | { 12 | private var _verification:Verification; 13 | 14 | /** 15 | * Constructor. 16 | */ 17 | public function VerificationError( 18 | message:Object, 19 | verification:Verification, 20 | mockolate:Mockolate, 21 | target:Object) 22 | { 23 | super(message, mockolate, target); 24 | 25 | _verification = verification; 26 | } 27 | 28 | /** 29 | * Verification instance related to this Error 30 | */ 31 | public function get verification():Verification 32 | { 33 | return _verification; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/answers/Answer.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.answers 2 | { 3 | import mockolate.ingredients.Invocation; 4 | 5 | /** 6 | * Answer instances are used by mock() and stub() 7 | * to define the behaviour of a method or property invocation. 8 | * 9 | * @author drewbourne 10 | */ 11 | public interface Answer 12 | { 13 | /** 14 | * Perform Answer action. 15 | * 16 | * @param invocation 17 | * @returns possible Invocation.returnValue 18 | */ 19 | function invoke(invocation:Invocation):*; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/answers/CallsAnswer.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.answers 2 | { 3 | import mockolate.ingredients.Invocation; 4 | 5 | /** 6 | * Calls a Function. 7 | * 8 | * @see mockolate.ingredients.MockingCouverture 9 | * 10 | * @example 11 | * 12 | * mock(instance).method("message").calls(function(a:int, b:int):void { 13 | * trace("message", a, b); 14 | * // "message 1 2" 15 | * }, [1, 2]); 16 | * 17 | */ 18 | public class CallsAnswer implements Answer 19 | { 20 | private var _function:Function; 21 | private var _args:Array; 22 | 23 | /** 24 | * Constructor. 25 | * 26 | * @param fn Function to call 27 | * @param args Array of arguments to pass to fn. 28 | */ 29 | public function CallsAnswer(fn:Function, args:Array=null) 30 | { 31 | _function = fn; 32 | _args = args || []; 33 | } 34 | 35 | /** 36 | * @inheritDoc 37 | */ 38 | public function invoke(invocation:Invocation):* 39 | { 40 | _function.apply(null, _args); 41 | return undefined; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/answers/PassThroughAnswer.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.answers 2 | { 3 | import mockolate.ingredients.Invocation; 4 | 5 | /** 6 | * @example 7 | * 8 | * stub.pass(); 9 | * 10 | */ 11 | public class PassThroughAnswer implements Answer 12 | { 13 | /** 14 | * Constructor. 15 | */ 16 | public function PassThroughAnswer() 17 | { 18 | } 19 | 20 | /** 21 | * @inheritDoc 22 | */ 23 | public function invoke(invocation:Invocation):* 24 | { 25 | // return invocation.proceed(); 26 | return undefined; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/answers/ReturnsCallAnswer.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.answers 2 | { 3 | import mockolate.ingredients.Invocation; 4 | 5 | /** 6 | * Calls a Function and returns the resulting value. 7 | * 8 | * @see ReturnsAnswer 9 | * @see mockolate.ingredients.Invocation#returnValue 10 | * @see mockolate.ingredients.MockingCouverture#returns() 11 | * 12 | * @author drewbourne 13 | */ 14 | public class ReturnsCallAnswer implements Answer 15 | { 16 | private var _function:Function; 17 | private var _args:Array; 18 | 19 | /** 20 | * Constructor. 21 | */ 22 | public function ReturnsCallAnswer(fn:Function, args:Array=null) 23 | { 24 | _function = fn; 25 | _args = args || []; 26 | } 27 | 28 | /** 29 | * @inheritDoc 30 | */ 31 | public function invoke(invocation:Invocation):* 32 | { 33 | return _function.apply(null, _args); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/answers/ReturnsValueAnswer.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.answers 2 | { 3 | import mockolate.ingredients.Invocation; 4 | 5 | /** 6 | * Returns a value. 7 | * 8 | * @see mockolate.ingredients.Invocation#returnValue 9 | * @see mockolate.ingredients.MockingCouverture#returns() 10 | * 11 | * @author drewbourne 12 | */ 13 | public class ReturnsValueAnswer implements Answer 14 | { 15 | private var _value:*; 16 | 17 | public function ReturnsValueAnswer(value:*) 18 | { 19 | _value = value; 20 | } 21 | 22 | public function invoke(invocation:Invocation):* 23 | { 24 | return _value; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/answers/ThrowsAnswer.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.answers 2 | { 3 | import mockolate.ingredients.Invocation; 4 | 5 | /** 6 | * Throws an Error. 7 | * 8 | * @see mockolate.ingredients.MockingCouverture#throws() 9 | * 10 | * @example 11 | * 12 | * mock(instance).method("explode").throws(new ArgumentError("Oh no!")); 13 | * 14 | */ 15 | public class ThrowsAnswer implements Answer 16 | { 17 | private var _error:Error; 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param error Error instance to throw. 23 | */ 24 | public function ThrowsAnswer(error:Error) 25 | { 26 | _error = error; 27 | } 28 | 29 | /** 30 | * @inheritDoc 31 | */ 32 | public function invoke(invocation:Invocation):* 33 | { 34 | throw _error; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/faux/FauxFloxyInterceptor.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.faux 2 | { 3 | import mockolate.ingredients.Invocation; 4 | import mockolate.ingredients.Mockolate; 5 | import mockolate.ingredients.mockolate_ingredient; 6 | 7 | import org.floxy.IInterceptor; 8 | import org.floxy.IInvocation; 9 | 10 | use namespace mockolate_ingredient; 11 | 12 | public class FauxFloxyInterceptor implements IInterceptor 13 | { 14 | private var _interceptHandler:Function; 15 | 16 | public function FauxFloxyInterceptor(interceptorHandler:Function) 17 | { 18 | super(); 19 | 20 | _interceptHandler = interceptorHandler; 21 | } 22 | 23 | public function intercept(invocation:IInvocation):void 24 | { 25 | _interceptHandler(invocation); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/faux/FauxMockolate.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.faux 2 | { 3 | import mockolate.ingredients.Invocation; 4 | import mockolate.ingredients.Mockolate; 5 | import mockolate.ingredients.mockolate_ingredient; 6 | 7 | import org.floxy.IInterceptor; 8 | import org.floxy.IInvocation; 9 | 10 | use namespace mockolate_ingredient; 11 | 12 | public class FauxMockolate extends Mockolate 13 | { 14 | private var _invokedHandler:Function; 15 | 16 | public function FauxMockolate(invokedHandler:Function, name:String=null) 17 | { 18 | super(name); 19 | 20 | _invokedHandler = invokedHandler; 21 | } 22 | 23 | override mockolate_ingredient function invoked(invocation:Invocation):Mockolate 24 | { 25 | _invokedHandler(invocation); 26 | return this; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/floxy/FloxyMockolate.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.floxy 2 | { 3 | import mockolate.ingredients.Mockolate; 4 | import mockolate.ingredients.mockolate_ingredient; 5 | 6 | use namespace mockolate_ingredient; 7 | 8 | /** 9 | * Mockolate extension for use with FLoxy proxies. 10 | */ 11 | public class FloxyMockolate extends Mockolate 12 | { 13 | // couvertures 14 | private var _interceptor:InterceptingCouverture; 15 | 16 | public function FloxyMockolate(name:String) 17 | { 18 | super(name); 19 | } 20 | 21 | /** 22 | * FLoxy IInterceptor. 23 | */ 24 | mockolate_ingredient function get interceptor():InterceptingCouverture 25 | { 26 | return _interceptor; 27 | } 28 | 29 | mockolate_ingredient function set interceptor(value:InterceptingCouverture):void 30 | { 31 | _interceptor = value; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/floxy/InterceptingCouverture.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients.floxy 2 | { 3 | import org.floxy.IInterceptor; 4 | import org.floxy.IInvocation; 5 | 6 | import asx.string.substitute; 7 | 8 | import mockolate.ingredients.Couverture; 9 | import mockolate.ingredients.Invocation; 10 | import mockolate.ingredients.Mockolate; 11 | import mockolate.ingredients.mockolate_ingredient; 12 | 13 | use namespace mockolate_ingredient; 14 | 15 | /** 16 | * FLoxy IInterceptor implementation for Mockolate. 17 | */ 18 | public class InterceptingCouverture extends Couverture implements IInterceptor 19 | { 20 | /** 21 | * Constructor. 22 | */ 23 | public function InterceptingCouverture(mockolate:Mockolate) 24 | { 25 | super(mockolate); 26 | } 27 | 28 | /** 29 | * Called by FLoxy proxy instances. 30 | * 31 | * @private 32 | */ 33 | public function intercept(invocation:IInvocation):void 34 | { 35 | mockolate.mockolate_ingredient::invoked(new FloxyInvocation(invocation)); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/ingredients/mockolate_ingredient.as: -------------------------------------------------------------------------------- 1 | package mockolate.ingredients 2 | { 3 | /** 4 | * This namespace is used for hiding implementation details (methods and properties) 5 | * that cannot be protected as they need to be visible to classes in other packages. 6 | * 7 | * @private 8 | */ 9 | public namespace mockolate_ingredient = 'mockolate.ingredients.only'; 10 | } -------------------------------------------------------------------------------- /lib/mockolate/mockolate/make.as: -------------------------------------------------------------------------------- 1 | package mockolate 2 | { 3 | import mockolate.ingredients.MockolatierMaster; 4 | 5 | /** 6 | * Alias of strict() 7 | * 8 | * @see mockolate#strict() 9 | * 10 | * @author drewbourne 11 | */ 12 | public function make(klass:Class, name:String=null, constructorArgs:Array=null):* 13 | { 14 | return strict(klass, name, constructorArgs); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/nice.as: -------------------------------------------------------------------------------- 1 | package mockolate 2 | { 3 | import mockolate.ingredients.MockolatierMaster; 4 | 5 | /** 6 | * Creates an instance of the given Class that will behave as a 'nice' mock. 7 | * 8 | * When a Mockolate is 'nice' it will return false-y values for any method 9 | * or property that does not have a mock() or 10 | * stub() Expectation defined. 11 | * 12 | * @param klass Class to create a nice mock for. 13 | * @param name Name for the mock instance. 14 | * 15 | * @see mockolate#strict() 16 | * @see mockolate#mock() 17 | * @see mockolate#stub() 18 | * 19 | * @example 20 | * 21 | * var flavour:Flavour = nice(Flavour); 22 | * 23 | * 24 | * @author drewbourne 25 | */ 26 | public function nice(klass:Class, name:String=null, constructorArgs:Array=null):* 27 | { 28 | return MockolatierMaster.nice(klass, name, constructorArgs); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/prepare.as: -------------------------------------------------------------------------------- 1 | package mockolate 2 | { 3 | import flash.events.EventDispatcher; 4 | import flash.events.IEventDispatcher; 5 | 6 | import mockolate.ingredients.MockolatierMaster; 7 | 8 | // TODO prepare(...classes, Function); if the last param is a function than use it as the completion callback. 9 | /** 10 | * Prepares a Class for use with Mockolate. 11 | * 12 | * Classes are prepared asynchronously. prepare() returns an IEventDispatcher 13 | * that will fire an Event.COMPLETE event when finished preparing. 14 | * 15 | * @param ...rest One or more Class references. 16 | * @return IEventDispatcher 17 | * 18 | * @see mockolate#nice() 19 | * @see mockolate#strict() 20 | * 21 | * @example 22 | * 23 | * prepare(Chocolate, Milk, Sugar); 24 | * 25 | * 26 | * @author drewbourne 27 | */ 28 | public function prepare(... rest):IEventDispatcher 29 | { 30 | return MockolatierMaster.prepare(rest); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/strict.as: -------------------------------------------------------------------------------- 1 | package mockolate 2 | { 3 | import mockolate.ingredients.MockolatierMaster; 4 | 5 | /** 6 | * Creates an instance of the given Class that will behave as a 'strict' mock. 7 | * 8 | * When a Mockolate is 'strict' it will throw an UnspecifiedBehaviourError 9 | * for any method or property that does not have a mock() or 10 | * stub() Expectation defined. 11 | * 12 | * @param klass Class to create a strict mock for. 13 | * @param name Name for the mock instance. 14 | * 15 | * @see mockolate#strict() 16 | * @see mockolate#mock() 17 | * @see mockolate#stub() 18 | * 19 | * @example 20 | * 21 | * var flavour:Flavour = nice(Flavour); 22 | * 23 | * 24 | * @author drewbourne 25 | */ 26 | public function strict(klass:Class, name:String=null, constructorArgs:Array=null):* 27 | { 28 | return MockolatierMaster.strict(klass, name, constructorArgs); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/mockolate/mockolate/verify.as: -------------------------------------------------------------------------------- 1 | package mockolate 2 | { 3 | import mockolate.ingredients.MockolatierMaster; 4 | import mockolate.ingredients.VerifyingCouverture; 5 | 6 | /** 7 | * Verify Expectations and Invocations. 8 | * 9 | * Calling verify() will verify that any Expectations defined 10 | * by mock() have been invoked their expected number of times. 11 | * 12 | * Using the VerifyingCouverture additional verification can be performed 13 | * on the Invocations recorded by the Mockolate instance. 14 | * 15 | * @see mockolate.ingredients.VerifyingCouverture 16 | * 17 | * @example 18 | * 19 | * 20 | * 21 | * @author drewbourne 22 | */ 23 | public function verify(target:*):VerifyingCouverture 24 | { 25 | return MockolatierMaster.verify(target); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/adapters/SwiftSuspendersReflector.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.adapters 9 | { 10 | import org.robotlegs.core.IReflector; 11 | import org.swiftsuspenders.Reflector; 12 | 13 | /** 14 | * SwiftSuspender IReflector adpater - See: SwiftSuspenders 15 | * 16 | * @author tschneidereit 17 | */ 18 | public class SwiftSuspendersReflector extends Reflector implements IReflector 19 | { 20 | } 21 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/base/ContextError.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.base 9 | { 10 | 11 | /** 12 | * A framework Error implementation 13 | */ 14 | public class ContextError extends Error 15 | { 16 | public static const E_COMMANDMAP_NOIMPL:String = 'Command Class does not implement an execute() method'; 17 | public static const E_COMMANDMAP_OVR:String = 'Cannot overwrite map'; 18 | 19 | public static const E_MEDIATORMAP_NOIMPL:String = 'Mediator Class does not implement IMediator'; 20 | public static const E_MEDIATORMAP_OVR:String = 'Mediator Class has already been mapped to a View Class in this context'; 21 | 22 | public static const E_EVENTMAP_NOSNOOPING:String = 'Listening to the context eventDispatcher is not enabled for this EventMap'; 23 | 24 | public function ContextError(message:String = "", id:int = 0) 25 | { 26 | super(message, id); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/core/IContext.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.core 9 | { 10 | import flash.events.IEventDispatcher; 11 | 12 | /** 13 | * The Robotlegs Context contract 14 | */ 15 | public interface IContext 16 | { 17 | /** 18 | * The IContext's IEventDispatcher 19 | */ 20 | function get eventDispatcher():IEventDispatcher; 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/core/IContextProvider.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.core 9 | { 10 | 11 | /** 12 | * The Robotlegs Context Provider contract 13 | */ 14 | public interface IContextProvider 15 | { 16 | /** 17 | * Retrieve the IContext 18 | * @return The IContext 19 | */ 20 | function getContext():IContext; 21 | } 22 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/modular/base/ModuleCommandMap.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.utilities.modular.base 9 | { 10 | import org.robotlegs.base.CommandMap; 11 | import org.robotlegs.core.IInjector; 12 | import org.robotlegs.core.IReflector; 13 | import org.robotlegs.utilities.modular.core.IModuleCommandMap; 14 | import org.robotlegs.utilities.modular.core.IModuleEventDispatcher; 15 | 16 | public class ModuleCommandMap extends CommandMap implements IModuleCommandMap 17 | { 18 | public function ModuleCommandMap(eventDispatcher:IModuleEventDispatcher, injector:IInjector, reflector:IReflector) 19 | { 20 | super(eventDispatcher, injector, reflector); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/modular/base/ModuleEventDispatcher.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.utilities.modular.base 9 | { 10 | import flash.events.EventDispatcher; 11 | import flash.events.IEventDispatcher; 12 | 13 | import org.robotlegs.utilities.modular.core.IModuleEventDispatcher; 14 | 15 | public class ModuleEventDispatcher extends EventDispatcher implements IModuleEventDispatcher 16 | { 17 | public function ModuleEventDispatcher(target:IEventDispatcher = null) 18 | { 19 | super(target); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/modular/core/IModuleCommandMap.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.utilities.modular.core 9 | { 10 | import org.robotlegs.core.ICommandMap; 11 | 12 | public interface IModuleCommandMap extends ICommandMap 13 | { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/modular/core/IModuleContext.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.utilities.modular.core 9 | { 10 | 11 | public interface IModuleContext 12 | { 13 | function setModuleDispatcher(dispatcher:IModuleEventDispatcher):void; 14 | } 15 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/modular/core/IModuleContextView.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.utilities.modular.core 9 | { 10 | 11 | public interface IModuleContextView 12 | { 13 | function setModuleDispatcher(dispatcher:IModuleEventDispatcher):void; 14 | 15 | function startup():void; 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/modular/core/IModuleEventDispatcher.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.utilities.modular.core 9 | { 10 | import flash.events.IEventDispatcher; 11 | 12 | public interface IModuleEventDispatcher extends IEventDispatcher 13 | { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/modular/mvcs/ModuleContextView.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.robotlegs.utilities.modular.mvcs 9 | { 10 | import flash.display.Sprite; 11 | 12 | import org.robotlegs.utilities.modular.core.IModuleContextView; 13 | import org.robotlegs.utilities.modular.core.IModuleEventDispatcher; 14 | 15 | public class ModuleContextView extends Sprite implements IModuleContextView 16 | { 17 | protected var context:ModuleContext; 18 | 19 | public function ModuleContextView() 20 | { 21 | } 22 | 23 | public function setModuleDispatcher(dispatcher:IModuleEventDispatcher):void 24 | { 25 | context.setModuleDispatcher(dispatcher); 26 | } 27 | 28 | public function startup():void 29 | { 30 | context.startup(); 31 | } 32 | 33 | public function getModuleContext():ModuleContext{ 34 | return context; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/signals/core/ISignalCommandMap.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.utilities.signals.core 2 | { 3 | import org.osflash.signals.ISignal; 4 | 5 | public interface ISignalCommandMap 6 | { 7 | function mapSignal(signal:ISignal, commandClass:Class, oneShot:Boolean = false):void; 8 | 9 | function mapSignalClass(signalClass:Class, commandClass:Class, oneShot:Boolean = false):ISignal; 10 | 11 | function hasSignalCommand(signal:ISignal, commandClass:Class):Boolean; 12 | 13 | function unmapSignal(signal:ISignal, commandClass:Class):void; 14 | 15 | function unmapSignalClass(signalClass:Class, commandClass:Class):void; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/signals/core/ISignalContext.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.utilities.signals.core 2 | { 3 | 4 | import org.robotlegs.core.IContext; 5 | 6 | public interface ISignalContext extends IContext 7 | { 8 | function get signalCommandMap():ISignalCommandMap; 9 | function set signalCommandMap(value:ISignalCommandMap):void; 10 | } 11 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/signals/mvcs/SignalCommand.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.utilities.signals.mvcs 2 | { 3 | import org.robotlegs.utilities.signals.core.ISignalCommandMap; 4 | 5 | import org.robotlegs.mvcs.Command; 6 | 7 | public class SignalCommand extends Command 8 | { 9 | [Inject] 10 | public var signalCommandMap:ISignalCommandMap; 11 | } 12 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/robotlegs/utilities/signals/mvcs/SignalContext.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.utilities.signals.mvcs 2 | { 3 | import flash.display.DisplayObjectContainer; 4 | 5 | import org.robotlegs.utilities.signals.base.SignalCommandMap; 6 | import org.robotlegs.utilities.signals.core.ISignalCommandMap; 7 | import org.robotlegs.utilities.signals.core.ISignalContext; 8 | 9 | import org.robotlegs.mvcs.Context; 10 | 11 | public class SignalContext extends Context implements ISignalContext 12 | { 13 | protected var _signalCommandMap:ISignalCommandMap; 14 | 15 | public function SignalContext(contextView:DisplayObjectContainer = null, autoStartup:Boolean = true) 16 | { 17 | super(contextView, autoStartup); 18 | } 19 | 20 | public function get signalCommandMap():ISignalCommandMap 21 | { 22 | return _signalCommandMap || (_signalCommandMap = new SignalCommandMap(injector)); 23 | } 24 | 25 | public function set signalCommandMap(value:ISignalCommandMap):void 26 | { 27 | _signalCommandMap = value; 28 | } 29 | 30 | override protected function mapInjections():void 31 | { 32 | super.mapInjections(); 33 | injector.mapValue(ISignalCommandMap, signalCommandMap); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /lib/robotlegs/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionpoints 9 | { 10 | import flash.utils.Dictionary; 11 | import org.swiftsuspenders.Injector; 12 | 13 | public class NoParamsConstructorInjectionPoint extends InjectionPoint 14 | { 15 | public function NoParamsConstructorInjectionPoint() 16 | { 17 | super(null, null); 18 | } 19 | 20 | override public function applyInjection(target : Object, injector : Injector, singletons : Dictionary) : Object 21 | { 22 | return new target(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /script/generate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'rubygems' 3 | require 'sprout' 4 | sprout 'sprout-as3-bundle' 5 | 6 | # Add a class name if TestSuites were generated 7 | if(ARGV.size == 1 && ARGV[0] == 'suite') 8 | ARGV << 'AllTests' 9 | end 10 | 11 | # Insert class type by default 12 | if(ARGV.size == 1) 13 | ARGV.unshift('class') 14 | end 15 | 16 | # Execute generators like this: 17 | # script/generate class utils.MathUtil 18 | # script/generate suite 19 | # script/generate test utils.MathUtilTest 20 | 21 | Sprout::Sprout.generate('as3', ARGV.shift, ARGV, File.dirname(File.dirname(__FILE__))) 22 | -------------------------------------------------------------------------------- /script/generators/event/event_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class EventGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'Event.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_case_path 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/event/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/event/templates/Event.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import flash.events.Event; 4 | 5 | public class <%= class_name %> extends Event { 6 | 7 | //-------------------------------------- 8 | // CLASS CONSTANTS 9 | //-------------------------------------- 10 | 11 | public static const SOME_EVENT:String = "someEvent" 12 | 13 | 14 | //-------------------------------------- 15 | // CONSTRUCTOR 16 | //-------------------------------------- 17 | 18 | /** 19 | * @constructor 20 | */ 21 | public function <%= class_name %>(type:String, bubbles:Boolean=true, cancelable:Boolean=false ){ 22 | super(type, bubbles, cancelable); 23 | } 24 | 25 | //-------------------------------------- 26 | // GETTER/SETTERS 27 | //-------------------------------------- 28 | 29 | //-------------------------------------- 30 | // PUBLIC METHODS 31 | //-------------------------------------- 32 | 33 | override public function clone() : Event { 34 | return new <%= class_name %>(type, bubbles, cancelable); 35 | } 36 | 37 | //-------------------------------------- 38 | // PRIVATE VARIABLES 39 | //-------------------------------------- 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /script/generators/event/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/interface/interface_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class InterfaceGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'Interface.as', full_class_path 11 | end 12 | 13 | end 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /script/generators/interface/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/interface/templates/Interface.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | public interface <%= class_name %> { 4 | 5 | function <%= class_name %>():void; 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /script/generators/rlcommand/rlcommand_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlcommandGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLCommand.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_case_path 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/rlcommand/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlcommand/templates/RLCommand.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | 6 | public class <%= class_name %> extends Command 7 | { 8 | 9 | override public function execute():void 10 | { 11 | // do stuff here 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /script/generators/rlcommand/templates/TestCase.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Command; 6 | 7 | public class <%= test_case_name %> extends TestCase { 8 | private var <%= instance_name %>:<%= class_name %>; 9 | 10 | public function <%= test_case_name %>(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | <%= instance_name %> = new <%= class_name %>(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | <%= instance_name %> = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>); 26 | } 27 | 28 | public function testIsCommand():void{ 29 | assertTrue("<%= instance_name %> is robotlegs Command", <%= instance_name %> is Command); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", false); 34 | } 35 | 36 | public function testExecute():void { 37 | assertTrue("Execute returns void", (<%= instance_name %>.execute() == void)); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /script/generators/rlcommand/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/rlcontext/rlcontext_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlcontextGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLContext.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_case_path 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/rlcontext/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlcontext/templates/TestCase.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Context; 6 | 7 | public class <%= test_case_name %> extends TestCase { 8 | private var <%= instance_name %>:<%= class_name %>; 9 | 10 | public function <%= test_case_name %>(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | <%= instance_name %> = new <%= class_name %>(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | <%= instance_name %> = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>); 26 | } 27 | 28 | public function testIsContext():void{ 29 | assertTrue("<%= instance_name %> is robotlegs Context", <%= instance_name %> is Context); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", false); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /script/generators/rlcontext/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/rlmediator/rlmediator_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlmediatorGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLMediator.as', full_class_dir + '/' + class_name + 'Mediator.as' 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_dir + '/' + class_name + 'MediatorTest.as' 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/rlmediator/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlmediator/templates/TestCase.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Mediator; 6 | 7 | public class <%= class_name %>MediatorTest extends TestCase { 8 | private var <%= instance_name %>Mediator:<%= class_name %>Mediator; 9 | 10 | public function <%= class_name %>MediatorTest(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | <%= instance_name %>Mediator = new <%= class_name %>Mediator(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | <%= instance_name %>Mediator = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("<%= instance_name %>Mediator is <%= class_name %>Mediator", <%= instance_name %>Mediator is <%= class_name %>Mediator); 26 | } 27 | 28 | public function testIsMediator():void{ 29 | assertTrue("<%= instance_name %>Mediator is robotlegs Mediator", <%= instance_name %>Mediator is Mediator); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", false); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /script/generators/rlmediator/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/rlmodel/rlmodel_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlmodelGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLModel.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_case_path 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/rlmodel/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlmodel/templates/RLModel.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import org.robotlegs.mvcs.Actor; 4 | 5 | public class <%= class_name %> extends Actor { 6 | 7 | public function <%= class_name %>() { 8 | } 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /script/generators/rlmodel/templates/TestCase.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Actor; 6 | 7 | public class <%= test_case_name %> extends TestCase { 8 | private var <%= instance_name %>:<%= class_name %>; 9 | 10 | public function <%= test_case_name %>(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | <%= instance_name %> = new <%= class_name %>(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | <%= instance_name %> = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>); 26 | } 27 | 28 | public function testIsModel():void{ 29 | assertTrue("<%= instance_name %> is robotlegs Actor", <%= instance_name %> is Actor); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", false); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /script/generators/rlmodel/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/rlmodule/rlmodule_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlmoduleGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLModule.as', full_class_path 11 | m.template 'RLModuleMediator.as', full_class_dir + '/' + class_name + 'Mediator.as' 12 | m.template 'RLModuleContext.as', full_class_dir + '/' + class_name + 'Context.as' 13 | end 14 | 15 | m.directory full_test_dir 16 | m.template 'RLModuleTest.as', full_test_case_path 17 | m.template 'RLModuleMediatorTest.as', full_test_dir + '/' + class_name + 'MediatorTest.as' 18 | m.template 'RLModuleContextTest.as', full_test_dir + '/' + class_name + 'ContextTest.as' 19 | 20 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 21 | end 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /script/generators/rlmodule/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlmodule/templates/RLModule.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import org.robotlegs.utilities.modular.mvcs.ModuleContext; 4 | import org.robotlegs.utilities.modular.mvcs.ModuleContextView; 5 | 6 | public class <%= class_name %> extends ModuleContextView { 7 | 8 | public function <%= class_name %>() { 9 | 10 | context = new <%= class_name %>Context(this); 11 | 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /script/generators/rlmodule/templates/RLModuleContextTest.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | import org.robotlegs.utilities.modular.mvcs.ModuleContext; 5 | 6 | public class <%= class_name %>ContextTest extends TestCase { 7 | private var instance:<%= class_name %>Context; 8 | 9 | public function <%= class_name %>ContextTest(methodName:String=null) { 10 | super(methodName) 11 | } 12 | 13 | override protected function setUp():void { 14 | super.setUp(); 15 | instance = new <%= class_name %>Context(); 16 | } 17 | 18 | override protected function tearDown():void { 19 | super.tearDown(); 20 | instance = null; 21 | } 22 | 23 | public function testInstantiated():void { 24 | assertTrue("instance is <%= class_name %>Context", instance is <%= class_name %>Context); 25 | } 26 | 27 | public function testIsModuleContext():void { 28 | assertTrue("instance is ModuleContext", instance is ModuleContext); 29 | } 30 | 31 | public function testFailure():void { 32 | assertTrue("Failing test", false); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /script/generators/rlmodule/templates/RLModuleTest.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | import org.robotlegs.utilities.modular.mvcs.ModuleContextView; 5 | 6 | public class <%= class_name %>Test extends TestCase { 7 | private var instance:<%= class_name %>; 8 | 9 | public function <%= class_name %>Test(methodName:String=null) { 10 | super(methodName) 11 | } 12 | 13 | override protected function setUp():void { 14 | super.setUp(); 15 | instance = new <%= class_name %>(); 16 | } 17 | 18 | override protected function tearDown():void { 19 | super.tearDown(); 20 | instance = null; 21 | } 22 | 23 | public function testInstantiated():void { 24 | assertTrue("instance is <%= class_name %>", instance is <%= class_name %>); 25 | } 26 | 27 | public function testIsModuleContextView():void { 28 | assertTrue("instance is ModuleContextView", instance is ModuleContextView); 29 | } 30 | 31 | public function testFailure():void { 32 | assertTrue("Failing test", false); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /script/generators/rlmodule/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/rlservice/rlservice_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlserviceGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLService.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_case_path 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/rlservice/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlservice/templates/RLService.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import org.robotlegs.mvcs.Actor; 4 | 5 | public class <%= class_name %> extends Actor{ 6 | 7 | /* INHERITED INJECTIONS: 8 | [Inject(name='mvcsEventDispatcher')] 9 | public var eventDispatcher:IEventDispatcher; 10 | 11 | [Inject(name='mvcsEventMap')] 12 | public var eventMap:IEventMap; 13 | */ 14 | 15 | //-------------------------------------------------------------------------- 16 | // 17 | // Initialization 18 | // 19 | //-------------------------------------------------------------------------- 20 | /** 21 | * No comment. 22 | * 23 | */ 24 | public function <%= class_name %>() 25 | { 26 | super(); 27 | } 28 | 29 | //-------------------------------------------------------------------------- 30 | // 31 | // API 32 | // 33 | //-------------------------------------------------------------------------- 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /script/generators/rlservice/templates/TestCase.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Actor; 6 | 7 | public class <%= test_case_name %> extends TestCase { 8 | private var <%= instance_name %>:<%= class_name %>; 9 | 10 | public function <%= test_case_name %>(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | <%= instance_name %> = new <%= class_name %>(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | <%= instance_name %> = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>); 26 | } 27 | 28 | public function testIsService():void{ 29 | assertTrue("<%= instance_name %> is robotlegs Actor", <%= instance_name %> is Actor); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", false); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /script/generators/rlservice/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/rlview_with_mediator/rlview_with_mediator_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlviewWithMediatorGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLView.as', full_class_path 11 | m.template 'RLMediator.as', full_class_dir + '/' + class_name + 'Mediator.as' 12 | end 13 | 14 | m.directory full_test_dir 15 | m.template 'ViewTestCase.as', full_test_case_path 16 | m.template 'MediatorTestCase.as', full_test_dir + '/' + class_name + 'MediatorTest.as' 17 | 18 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 19 | end 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /script/generators/rlview_with_mediator/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlview_with_mediator/templates/RLView.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import flash.display.Sprite; 4 | 5 | public class <%= class_name %> extends Sprite { 6 | 7 | 8 | //-------------------------------------------------------------------------- 9 | // 10 | // Initialization 11 | // 12 | //-------------------------------------------------------------------------- 13 | /** 14 | * Event handling takes place via the mediator: <%= class_name %>Mediator 15 | * 16 | */ 17 | 18 | public function <%= class_name %>() { 19 | 20 | } 21 | 22 | 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /script/generators/rlview_with_mediator/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/rlview_with_mediator/templates/ViewTestCase.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import flash.display.Sprite; 6 | 7 | public class <%= test_case_name %> extends TestCase { 8 | private var <%= instance_name %>:<%= class_name %>; 9 | 10 | public function <%= test_case_name %>(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | <%= instance_name %> = new <%= class_name %>(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | <%= instance_name %> = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>); 26 | } 27 | 28 | public function testIsSprite():void{ 29 | assertTrue("<%= instance_name %> is Sprite", <%= instance_name %> is Sprite); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", false); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /script/generators/rlview_with_signals/rlview_with_signals_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RlviewWithSignalsGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'RLView.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'ViewTestCase.as', full_test_case_path 15 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 16 | end 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /script/generators/rlview_with_signals/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/rlview_with_signals/templates/RLView.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import flash.display.Sprite; 4 | 5 | import org.osflash.signals.Signal; 6 | 7 | public class <%= class_name %> extends Sprite { 8 | 9 | 10 | private var _signal:Signal; 11 | 12 | //-------------------------------------------------------------------------- 13 | // 14 | // Initialization 15 | // 16 | //-------------------------------------------------------------------------- 17 | /** 18 | * Event handling takes place via the mediator: <%= class_name %>Mediator 19 | * 20 | */ 21 | 22 | public function <%= class_name %>() { 23 | initSignals(); 24 | } 25 | 26 | 27 | 28 | 29 | private function initSignals():void 30 | { 31 | _signal = new Signal(); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /script/generators/rlview_with_signals/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/roboteyes_test/roboteyes_test_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class RoboteyesTestGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | m.directory model.endtoend_test_dir 9 | m.template 'TestCase.as', model.endtoend_test_dir + '/' + class_name + 'EndToEndTest.as' 10 | 11 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 12 | end 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /script/generators/roboteyes_test/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/roboteyes_test/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/signal/signal_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class SignalGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'Signal.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_case_path 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/signal/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/signal/templates/Signal.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import org.osflash.signals.Signal; 4 | 5 | public class <%= class_name %> extends Signal { 6 | 7 | public function <%= class_name %>() { 8 | super(); 9 | } 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /script/generators/signal/templates/TestCase.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.framework.TestCase; 4 | import org.osflash.signals.Signal; 5 | 6 | public class <%= test_case_name %> extends TestCase { 7 | private var <%= instance_name %>:<%= class_name %>; 8 | 9 | public function <%= test_case_name %>(methodName:String=null) { 10 | super(methodName) 11 | } 12 | 13 | override protected function setUp():void { 14 | super.setUp(); 15 | <%= instance_name %> = new <%= class_name %>(); 16 | } 17 | 18 | override protected function tearDown():void { 19 | super.tearDown(); 20 | <%= instance_name %> = null; 21 | } 22 | 23 | public function testInstantiated():void { 24 | assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>); 25 | } 26 | 27 | public function testIsSignal():void{ 28 | assertTrue("<%= instance_name %> is Signal", <%= instance_name %> is Signal); 29 | } 30 | 31 | public function testFailure():void { 32 | assertTrue("Failing test", false); 33 | } 34 | 35 | public function testValueClasses():void{ 36 | assertEqualsArrays("<%= class_name %>.valueClasses has correct values", [Signal], <%= class_name %>.valueClasses); 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /script/generators/signal/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/signal_response_pair/signal_response_pair_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class SignalResponsePairGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | def manifest 5 | record do |m| 6 | # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" 7 | 8 | if(!user_requested_test) 9 | m.directory full_class_dir 10 | m.template 'SignalResponsePair.as', full_class_path 11 | end 12 | 13 | m.directory full_test_dir 14 | m.template 'TestCase.as', full_test_case_path 15 | 16 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /script/generators/signal_response_pair/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/signal_response_pair/templates/SignalResponsePair.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import org.osflash.signals.Signal; 4 | import org.osflash.signals.SyncSignalResponsePair; 5 | 6 | public class <%= class_name %> extends SyncSignalResponsePair { 7 | 8 | public function <%= class_name %>() { 9 | super(); 10 | } 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /script/generators/signal_response_pair/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | 9 | import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %> 10 | import <%= test_case %>;<% end %> 11 | 12 | public class AllTests extends TestSuite { 13 | 14 | public function AllTests() {<% test_case_classes.each do |test_case| %> 15 | addTest(new <%= test_case %>());<% end %> 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /script/generators/support/support_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | class SupportGenerator < Sprout::Generator::NamedBase # :nodoc: 3 | 4 | # Support class name - auto generated to className + Support if not specified 5 | attr_reader :support_class_name 6 | 7 | def manifest 8 | record do |m| 9 | 10 | if(ARGV.size == 2) 11 | @support_class_name = class_name + ARGV[1] 12 | else 13 | @support_class_name = class_name + 'Support' 14 | end 15 | 16 | full_support_dir = full_class_dir.gsub(src_dir, model.support_dir) 17 | m.directory full_support_dir 18 | m.template 'Support.as', full_support_dir + '/' + support_class_name + '.as' 19 | 20 | end 21 | end 22 | 23 | 24 | end 25 | -------------------------------------------------------------------------------- /script/generators/support/templates/Component.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /script/generators/support/templates/Support.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import <%= package_name %>.<%= class_name %>; 4 | 5 | public class <%= support_class_name %> extends <%= class_name %> { 6 | 7 | // Testable constants 8 | //public static const MY_CONST:String = 'myConstant'; 9 | 10 | //-------------------------------------------------------------------------- 11 | // 12 | // Initialization 13 | // 14 | //-------------------------------------------------------------------------- 15 | 16 | public function <%= support_class_name %>() { 17 | // pass constants to the super constructor for properties 18 | super(); 19 | } 20 | 21 | //-------------------------------------------------------------------------- 22 | // 23 | // Overridden API 24 | // 25 | //-------------------------------------------------------------------------- 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/PyramidGameRunner.as: -------------------------------------------------------------------------------- 1 | package { 2 | import asunit.textui.TestRunner; 3 | 4 | public class PyramidGameRunner extends TestRunner { 5 | 6 | public function PyramidGameRunner() { 7 | // start(clazz:Class, methodName:String, showTrace:Boolean) 8 | // NOTE: sending a particular class and method name will 9 | // execute setUp(), the method and NOT tearDown. 10 | // This allows you to get visual confirmation while developing 11 | // visual entities 12 | start(AllTests, null, TestRunner.SHOW_TRACE); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/PyramidGameXMLRunner.as: -------------------------------------------------------------------------------- 1 | package { 2 | import asunit.textui.TestRunner; 3 | import asunit.textui.XMLResultPrinter; 4 | 5 | public class PyramidGameXMLRunner extends TestRunner { 6 | 7 | public function PyramidGameXMLRunner() { 8 | // start(clazz:Class, methodName:String, showTrace:Boolean) 9 | // NOTE: sending a particular class and method name will 10 | // execute setUp(), the method and NOT tearDown. 11 | // This allows you to get visual confirmation while developing 12 | // visual entities 13 | setPrinter(new XMLResultPrinter()); 14 | start(AllTests, null, TestRunner.SHOW_TRACE); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/com/newloop/roboteyes/getA.as: -------------------------------------------------------------------------------- 1 | package com.newloop.roboteyes 2 | { 3 | 4 | import com.newloop.roboteyes.core.RobotEyesMaster; 5 | import com.newloop.roboteyes.drivers.DisplayObjectDriver; 6 | 7 | /** 8 | * Class description. 9 | * 10 | * @langversion ActionScript 3.0 11 | * @playerversion Flash 9.0 12 | * 13 | * @author Lindsey Fallow 14 | * @since 07.01.2010 15 | */ 16 | 17 | public function getA(viewClazz:Class):DisplayObjectDriver 18 | { 19 | return RobotEyesMaster.getA(viewClazz); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/com/newloop/roboteyes/inViewOf.as: -------------------------------------------------------------------------------- 1 | /* AS3 2 | Copyright 2010 Newloop. 3 | */ 4 | package com.newloop.roboteyes { 5 | 6 | import com.newloop.roboteyes.core.RobotEyesMaster; 7 | import com.newloop.roboteyes.drivers.DisplayObjectDriver; 8 | 9 | /** 10 | * Class description. 11 | * 12 | * @langversion ActionScript 3.0 13 | * @playerversion Flash 9.0 14 | * 15 | * @author Lindsey Fallow 16 | * @since 07.01.2010 17 | */ 18 | 19 | public function inViewOf(viewClazz:Class):DisplayObjectDriver{ 20 | return RobotEyesMaster.inViewOf(viewClazz); 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/org/osflash/signalsv1/IDispatcher.as: -------------------------------------------------------------------------------- 1 | package org.osflash.signalsv1 2 | { 3 | /** 4 | * 5 | */ 6 | public interface IDispatcher 7 | { 8 | /** 9 | * Dispatches an object to listeners. 10 | * @param valueObjects Any number of parameters to send to listeners. Will be type-checked against valueClasses. 11 | * @throws ArgumentError ArgumentError: valueObjects are not compatible with valueClasses. 12 | */ 13 | function dispatch(...valueObjects):void; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/org/osflash/signalsv1/ISignalOwner.as: -------------------------------------------------------------------------------- 1 | package org.osflash.signalsv1 2 | { 3 | /** 4 | * ISignalOwner gives access to the powerful function, removeAll. This should only be called by trusted classes. 5 | */ 6 | public interface ISignalOwner extends ISignal, IDispatcher 7 | { 8 | /** 9 | * Unsubscribes all listeners from the signal. 10 | */ 11 | function removeAll():void 12 | } 13 | } -------------------------------------------------------------------------------- /src/org/osflash/signalsv1/events/IBubbleEventHandler.as: -------------------------------------------------------------------------------- 1 | package org.osflash.signalsv1.events 2 | { 3 | 4 | public interface IBubbleEventHandler 5 | { 6 | /** 7 | * Handler for event bubbling. 8 | * It's left to the IBubbleEventHandler to decide what to do with the event. 9 | * @param event The event that bubbled up. 10 | * @return whether to continue bubbling this event 11 | */ 12 | function onEventBubbled(event:IEvent):Boolean; 13 | } 14 | } -------------------------------------------------------------------------------- /src/org/osflash/signalsv1/events/IEvent.as: -------------------------------------------------------------------------------- 1 | package org.osflash.signalsv1.events 2 | { 3 | import org.osflash.signalsv1.IDeluxeSignal; 4 | 5 | public interface IEvent 6 | { 7 | /** The object that originally dispatched the event. 8 | * When dispatched from an signal, the target is the object containing the signal. */ 9 | function get target():Object; 10 | function set target(value:Object):void; 11 | 12 | /** The object that added the listener for the event. */ 13 | function get currentTarget():Object; 14 | function set currentTarget(value:Object):void; 15 | 16 | /** The signal that dispatched the event. */ 17 | function get signal():IDeluxeSignal; 18 | function set signal(value:IDeluxeSignal):void; 19 | 20 | /** Indicates whether the event is a bubbling event. */ 21 | function get bubbles():Boolean; 22 | function set bubbles(value:Boolean):void; 23 | 24 | /** Returns a new copy of the instance. */ 25 | function clone():IEvent; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/org/osflash/signalsv1/natives/INativeDispatcher.as: -------------------------------------------------------------------------------- 1 | package org.osflash.signalsv1.natives 2 | { 3 | import flash.events.Event; 4 | import flash.events.IEventDispatcher; 5 | 6 | /** 7 | * Similar to IDispatcher but using strong types specific to Flash's native event system. 8 | */ 9 | public interface INativeDispatcher 10 | { 11 | /** 12 | * The type of event permitted to be dispatched. Corresponds to flash.events.Event.type. 13 | */ 14 | function get eventType():String; 15 | 16 | /** 17 | * The class of event permitted to be dispatched. Will be flash.events.Event or a subclass. 18 | */ 19 | function get eventClass():Class; 20 | 21 | /** 22 | * The object considered the source of the dispatched events. 23 | */ 24 | function get target():IEventDispatcher; 25 | 26 | /** 27 | * Dispatches an event to listeners. 28 | * @param event An instance of a class that is or extends flash.events.Event. 29 | * @throws ArgumentError ArgumentError: Event object [event] is not an instance of [eventClass]. 30 | * @throws ArgumentError ArgumentError: Event object has incorrect type. Expected [eventType] but was [event.type]. 31 | */ 32 | function dispatch(event:Event):Boolean; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/org/robotlegs/base/EventAsPayload.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.base 2 | { 3 | import flash.events.Event; 4 | import org.robotlegs.core.IEventAsPayload; 5 | 6 | public class EventAsPayload extends Object implements IEventAsPayload 7 | { 8 | 9 | public function EventAsPayload(event:Event, eventClass:Class, named:String = '') 10 | { 11 | _event = event; 12 | _eventClass = eventClass ||= Event; 13 | _named = named; 14 | } 15 | 16 | private var _event:Event; 17 | 18 | public function get event():Event 19 | { 20 | return _event; 21 | } 22 | 23 | private var _eventClass:Class; 24 | 25 | public function get eventClass():Class 26 | { 27 | return _eventClass; 28 | } 29 | 30 | private var _named:String; 31 | 32 | public function get named():String 33 | { 34 | return _named; 35 | } 36 | 37 | public function toString():String 38 | { 39 | return '[EventAsPayload] - event: ' + _event + " | eventClass: " + _eventClass + " | named: " + _named; 40 | } 41 | 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /src/org/robotlegs/core/ICompoundCommandConfig.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core { 2 | 3 | import flash.events.Event; 4 | 5 | public interface ICompoundCommandConfig { 6 | 7 | function addRequiredEvent(eventType:String, eventClass:Class = null, named:String = ""):ICompoundCommandConfig; 8 | 9 | function get requiredEvents():Array; 10 | 11 | function get remainingRequiredEvents():Array; 12 | 13 | function get requiredInOrder():Boolean; 14 | 15 | function get eventsAsPayloads():Array; 16 | 17 | function get oneshot():Boolean; 18 | } 19 | } -------------------------------------------------------------------------------- /src/org/robotlegs/core/ICompoundCommandContext.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core 2 | { 3 | 4 | public interface ICompoundCommandContext 5 | { 6 | function get compoundCommandMap():ICompoundCommandMap; 7 | function set compoundCommandMap(value:ICompoundCommandMap):void; 8 | } 9 | 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/org/robotlegs/core/ICompoundCommandMap.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core { 2 | 3 | public interface ICompoundCommandMap extends ICommandMap { 4 | 5 | function mapToEvents(commandClass:Class, oneshot:Boolean = false, requiredInOrder:Boolean = false):ICompoundCommandConfig; 6 | 7 | function hasCompoundCommand(commandClass:Class):Boolean; 8 | 9 | function unmapCompoundCommand(commandClass:Class):ICompoundCommandConfig; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/org/robotlegs/core/IEventAsPayload.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core 2 | { 3 | import flash.events.Event; 4 | 5 | public interface IEventAsPayload 6 | { 7 | function get event():Event; 8 | 9 | function get eventClass():Class; 10 | 11 | function get named():String; 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/org/robotlegs/core/IGuard.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core 2 | { 3 | 4 | public interface IGuard 5 | { 6 | 7 | function approve():Boolean; 8 | 9 | } 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/org/robotlegs/core/IGuardedCommandMap.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core { 2 | 3 | import org.robotlegs.core.ICommandMap; 4 | 5 | public interface IGuardedCommandMap extends ICommandMap { 6 | 7 | /** 8 | * Map a Command to an Event type, with Guards 9 | * 10 | *

The commandClass must implement an execute() method

11 | *

The guards must be a Class which implements an approve() method

12 | *

or an Array of Classes which implements an approve() method

13 | * 14 | * @param eventType The Event type to listen for 15 | * @param commandClass The Class to instantiate - must have an execute() method 16 | * @param guards The Classes of the guard or guards to instantiate - must have an approve() method 17 | * @param eventClass Optional Event class for a stronger mapping. Defaults to flash.events.Event. Your commandClass can optionally [Inject] a variable of this type to access the event that triggered the command. 18 | * @param oneshot Unmap the Class after execution? 19 | * 20 | * @throws org.robotlegs.base::ContextError 21 | */ 22 | function mapGuardedEvent(eventType:String, commandClass:Class, guards:*, eventClass:Class = null, oneshot:Boolean = false):void; 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /src/org/robotlegs/core/IOptionCommandMap.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core { 2 | 3 | import org.robotlegs.core.ICommandMap; 4 | 5 | public interface IOptionCommandMap extends ICommandMap { 6 | 7 | function mapOption(optionNumber:uint, commandClass:Class):void; 8 | 9 | function hasCommandForOption(optionNumber:uint):Boolean; 10 | 11 | function unmapAllOptions():void; 12 | 13 | function optionTypeByNumber(optionNumber:uint):String; 14 | } 15 | } -------------------------------------------------------------------------------- /src/org/robotlegs/core/IOptionCommandMapper.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core 2 | { 3 | import strategy.model.gameplay.IOptionVO; 4 | import org.robotlegs.core.IOptionCommandMap; 5 | 6 | public interface IOptionCommandMapper 7 | { 8 | 9 | function set optionCommandMap(value:IOptionCommandMap):void; 10 | 11 | function get optionCommandMap():IOptionCommandMap; 12 | 13 | function mapDilemmaOptions(options:Vector.):void; 14 | 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/org/robotlegs/core/IRelaxedEventContext.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core 2 | { 3 | 4 | public interface IRelaxedEventContext 5 | { 6 | function get relaxedEventMap():IRelaxedEventMap; 7 | 8 | function set relaxedEventMap(value:IRelaxedEventMap):void; 9 | 10 | } 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/org/robotlegs/core/IRelaxedEventMap.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.core 2 | { 3 | import flash.events.IEventDispatcher; 4 | 5 | public interface IRelaxedEventMap 6 | { 7 | function mapRelaxedListener(type:String, listener:Function, eventClass:Class = null, ownerObject:* = null, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = true):void; 8 | 9 | function unmapRelaxedListener(type:String, listener:Function, eventClass:Class = null, ownerObject:* = null, useCapture:Boolean = false):void; 10 | 11 | function rememberEvent(type:String, eventClass:Class = null):void; 12 | 13 | function unmapListenersFor(ownerObject:*):void; 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /src/org/robotlegs/mvcs/CompoundCommand.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.mvcs 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import org.robotlegs.core.ICompoundCommandMap; 6 | 7 | [Inject] 8 | public var compoundCommandMap:ICompoundCommandMap; 9 | 10 | public class CompoundCommand extends Command 11 | { 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /src/org/robotlegs/mvcs/OptionCommandMapper.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.mvcs 2 | { 3 | import org.robotlegs.core.IOptionCommandMap; 4 | import strategy.model.gameplay.IOptionVO; 5 | import org.robotlegs.core.IOptionCommandMapper; 6 | 7 | public class OptionCommandMapper implements IOptionCommandMapper 8 | { 9 | 10 | protected var _optionCommandMap:IOptionCommandMap; 11 | 12 | [Inject] 13 | public function set optionCommandMap(value:IOptionCommandMap):void 14 | { 15 | _optionCommandMap = value; 16 | }; 17 | 18 | public function get optionCommandMap():IOptionCommandMap 19 | { 20 | return _optionCommandMap; 21 | } 22 | 23 | public function mapDilemmaOptions(options:Vector.):void 24 | { 25 | for each (var option:IOptionVO in options) 26 | { 27 | var id:uint = option.id; 28 | for each (var consequenceCommand:Class in option.consequences) 29 | { 30 | _optionCommandMap.mapOption(id, consequenceCommand); 31 | } 32 | } 33 | } 34 | 35 | 36 | 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /src/org/robotlegs/utilities/deferredcommandqueue/DeferredCommandQueueEvent.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.utilities.deferredcommandqueue 2 | { 3 | 4 | import flash.events.Event; 5 | 6 | public class DeferredCommandQueueEvent extends Event 7 | { 8 | 9 | public static const QUEUE_COMPLETED:String = "DeferredCommandQueueEvent.queueCompleted"; 10 | 11 | public function DeferredCommandQueueEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) 12 | { 13 | super(type, bubbles, cancelable); 14 | } 15 | 16 | override public function clone():Event 17 | { 18 | return new DeferredCommandQueueEvent(type, bubbles, cancelable); 19 | } 20 | 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/org/robotlegs/utilities/deferredcommandqueue/IDeferredCommandQueue.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.utilities.deferredcommandqueue { 2 | 3 | public interface IDeferredCommandQueue { 4 | 5 | function addCommandToQueue(commandClass:Class, isRepeated:Boolean = false):Boolean; 6 | 7 | function getNextCommand():Class; 8 | 9 | function get hasNextCommand():Boolean; 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/org/robotlegs/utilities/deferredcommandqueue/RunNextDeferredCommand.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.utilities.deferredcommandqueue 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | 6 | public class RunNextDeferredCommand extends Command 7 | { 8 | 9 | [Inject] 10 | public var deferredCommandQueue:IDeferredCommandQueue; 11 | 12 | override public function execute():void 13 | { 14 | if(!deferredCommandQueue.hasNextCommand) 15 | { 16 | dispatch(new DeferredCommandQueueEvent(DeferredCommandQueueEvent.QUEUE_COMPLETED)); 17 | return; 18 | } 19 | 20 | var commandClass:Class = deferredCommandQueue.getNextCommand(); 21 | var command:Object = injector.instantiate(commandClass); 22 | command.execute(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/strategy/controller/commands/ProcessGameWonCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.ICalendarModel; 6 | import strategy.model.resources.ICashModel; 7 | import strategy.controller.events.GameWonEvent; 8 | 9 | public class ProcessGameWonCommand extends Command 10 | { 11 | 12 | [Inject] 13 | public var cashModel:ICashModel; 14 | 15 | [Inject] 16 | public var calendarModel:ICalendarModel; 17 | 18 | override public function execute():void 19 | { 20 | var cashRemaining:Number = cashModel.currentValue; 21 | var daysRemaining:uint = calendarModel.currentValue; 22 | var evt:GameWonEvent = new GameWonEvent(GameWonEvent.GAME_WON, daysRemaining, cashRemaining); 23 | dispatch(evt); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/RestartGameCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.events.GameEvent; 6 | 7 | public class RestartGameCommand extends Command 8 | { 9 | 10 | override public function execute():void 11 | { 12 | var evt:GameEvent = new GameEvent(GameEvent.GAME_RESTARTED); 13 | contextView.dispatchEvent(evt); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/StartGameCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.events.GameEvent; 6 | 7 | public class StartGameCommand extends Command 8 | { 9 | 10 | override public function execute():void 11 | { 12 | var evt:GameEvent = new GameEvent(GameEvent.GAME_STARTED); 13 | dispatch(evt); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/StartViewCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.PyramidGameView; 6 | import flash.display.Sprite; 7 | import strategy.view.SkyView; 8 | import skins.PyramidGameSkin; 9 | 10 | public class StartViewCommand extends Command 11 | { 12 | 13 | override public function execute():void 14 | { 15 | addBackground(); 16 | addGame(); 17 | addForeground(); 18 | } 19 | 20 | protected function addBackground():void 21 | { 22 | contextView.addChild(new SkyView()); 23 | } 24 | 25 | protected function addGame():void 26 | { 27 | var mainGameView:Sprite = new PyramidGameView(); 28 | contextView.addChild(mainGameView); 29 | } 30 | 31 | protected function addForeground():void 32 | { 33 | contextView.addChild(new PyramidGameSkin.ForegroundSkin() as Sprite); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/bootstraps/BootstrapGameEndingsCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.bootstraps 2 | { 3 | import strategy.controller.events.ResourceBoundaryEvent; 4 | import strategy.controller.commands.ProcessGameOverCommand; 5 | import strategy.controller.commands.ProcessGameWonCommand; 6 | import org.robotlegs.mvcs.Command; 7 | 8 | public class BootstrapGameEndingsCommand extends Command 9 | { 10 | 11 | override public function execute():void 12 | { 13 | commandMap.mapEvent(ResourceBoundaryEvent.BOUNDARY_BREACHED, ProcessGameOverCommand, ResourceBoundaryEvent); 14 | commandMap.mapEvent(ResourceBoundaryEvent.TARGET_REACHED, ProcessGameWonCommand, ResourceBoundaryEvent); 15 | } 16 | 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/CastRandomEventsCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.ICalendarModel; 6 | import strategy.model.IGameConfig; 7 | import strategy.controller.surprises.IDilemmaSurpriseEventCaster; 8 | 9 | public class CastRandomEventsCommand extends Command 10 | { 11 | [Inject] 12 | public var calendarModel:ICalendarModel; 13 | 14 | [Inject] 15 | public var config:IGameConfig; 16 | 17 | [Inject] 18 | public var dilemmaSurpriseEventCaster:IDilemmaSurpriseEventCaster; 19 | 20 | override public function execute():void 21 | { 22 | if(calendarModel.daysPassed > config.numberOfNormalDaysAtStart) 23 | { 24 | dilemmaSurpriseEventCaster.castSurpriseEvent(); 25 | } 26 | else 27 | { 28 | dilemmaSurpriseEventCaster.castNormalEvent(); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/CheckForWeekendCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.IGameConfig; 6 | import strategy.model.resources.ICalendarModel; 7 | import strategy.controller.events.DayCycleEvent; 8 | 9 | public class CheckForWeekendCommand extends Command 10 | { 11 | [Inject] 12 | public var config:IGameConfig; 13 | 14 | [Inject] 15 | public var calendarModel:ICalendarModel; 16 | 17 | override public function execute():void 18 | { 19 | if(isTheWeekend) 20 | { 21 | var weekendEvent:DayCycleEvent = new DayCycleEvent(DayCycleEvent.WEEKEND_DAY_STARTED); 22 | dispatch(weekendEvent); 23 | } 24 | else 25 | { 26 | var workingDayEvent:DayCycleEvent = new DayCycleEvent(DayCycleEvent.WORKING_DAY_STARTED); 27 | dispatch(workingDayEvent); 28 | } 29 | } 30 | 31 | private function get isTheWeekend():Boolean 32 | { 33 | var daysPassed:uint = calendarModel.daysPassed; 34 | var weekDays:uint = 7; 35 | var workingDays:uint = config.workingDaysPerWeek; 36 | 37 | if((daysPassed % weekDays) == workingDays) 38 | { 39 | return true; 40 | } 41 | 42 | return false; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/CheckStoneStockCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.IStoneSupplyModel; 6 | import strategy.controller.events.DayCycleEvent; 7 | import strategy.controller.events.StoneStockCheckEvent; 8 | 9 | public class CheckStoneStockCommand extends Command 10 | { 11 | 12 | [Inject] 13 | public var stoneSupply:IStoneSupplyModel; 14 | 15 | override public function execute():void 16 | { 17 | if(stoneSupply.currentValue <= stoneSupply.max) 18 | { 19 | passStockCheck(); 20 | } 21 | else 22 | { 23 | findStockStolen(); 24 | } 25 | } 26 | 27 | protected function passStockCheck():void 28 | { 29 | var evt:DayCycleEvent = new DayCycleEvent(DayCycleEvent.STONE_STOCK_CHECKED); 30 | dispatch(evt); 31 | } 32 | 33 | protected function findStockStolen():void 34 | { 35 | var excessStone:Number = stoneSupply.currentValue - stoneSupply.max; 36 | var stoneStolen:Number = Math.round(excessStone * Math.random()); 37 | if(!stoneSupply.isInsured) 38 | { 39 | stoneSupply.adjustByValue(-stoneStolen); 40 | } 41 | var evt:StoneStockCheckEvent = new StoneStockCheckEvent(StoneStockCheckEvent.STOCK_STOLEN, stoneStolen, stoneSupply.isInsured); 42 | dispatch(evt); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/HireWorkersCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.events.DayCycleEvent; 6 | import strategy.model.transactions.WorkerProductivityVO; 7 | import strategy.controller.events.LabourSupplyEvent; 8 | import strategy.model.resources.ILabourModel; 9 | 10 | public class HireWorkersCommand extends Command 11 | { 12 | [Inject] 13 | public var labourSupplyEvent:LabourSupplyEvent; 14 | 15 | [Inject] 16 | public var labourModel:ILabourModel; 17 | 18 | override public function execute():void 19 | { 20 | var workersHired:Vector. = labourSupplyEvent.workers; 21 | 22 | labourModel.appendWorkers(workersHired); 23 | 24 | var evt:DayCycleEvent = new DayCycleEvent(DayCycleEvent.LABOUR_HIRE_COMPLETED); 25 | dispatch(evt); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/MapDilemmaConsequencesCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.events.DilemmaEvent; 6 | import org.robotlegs.core.IOptionCommandMapper; 7 | import strategy.model.gameplay.IDilemmaVO; 8 | 9 | public class MapDilemmaConsequencesCommand extends Command 10 | { 11 | [Inject] 12 | public var optionCommandMapper:IOptionCommandMapper; 13 | 14 | [Inject] 15 | public var dilemmaEvent:DilemmaEvent; 16 | 17 | override public function execute():void 18 | { 19 | trace("MapDilemmaConsequencesCommand::execute()"); 20 | var dilemmaVO:IDilemmaVO = dilemmaEvent.dilemmaVO; 21 | trace("dilemma: " + dilemmaVO.title); 22 | optionCommandMapper.mapDilemmaOptions(dilemmaVO.options); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/OfferLabourCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.surprises.ILabourSurpriseEventCaster; 6 | import strategy.model.resources.ICalendarModel; 7 | import strategy.model.IGameConfig; 8 | 9 | public class OfferLabourCommand extends Command 10 | { 11 | [Inject] 12 | public var labourSurpriseEventCaster:ILabourSurpriseEventCaster; 13 | 14 | [Inject] 15 | public var calendarModel:ICalendarModel; 16 | 17 | [Inject] 18 | public var config:IGameConfig; 19 | 20 | override public function execute():void 21 | { 22 | if(calendarModel.daysPassed > config.numberOfNormalDaysAtStart) 23 | { 24 | labourSurpriseEventCaster.castSurpriseEvent(); 25 | } 26 | else 27 | { 28 | labourSurpriseEventCaster.castNormalEvent(); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/OfferStoneCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.surprises.IStoneSurpriseEventCaster; 6 | import strategy.model.resources.ICalendarModel; 7 | import strategy.model.IGameConfig; 8 | 9 | public class OfferStoneCommand extends Command 10 | { 11 | [Inject] 12 | public var stoneSurpriseEventCaster:IStoneSurpriseEventCaster; 13 | 14 | [Inject] 15 | public var calendarModel:ICalendarModel; 16 | 17 | [Inject] 18 | public var config:IGameConfig; 19 | 20 | override public function execute():void 21 | { 22 | if(calendarModel.daysPassed > config.numberOfNormalDaysAtStart) 23 | { 24 | stoneSurpriseEventCaster.castSurpriseEvent(); 25 | } 26 | else 27 | { 28 | stoneSurpriseEventCaster.castNormalEvent(); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/OfferWeekendWorkingCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import strategy.model.gameplay.dilemmas.WeekendWorkingDilemma; 5 | import strategy.controller.events.DilemmaEvent; 6 | import strategy.model.gameplay.IDilemmaVO; 7 | import org.robotlegs.mvcs.Command; 8 | import org.robotlegs.core.IOptionCommandMapper; 9 | 10 | public class OfferWeekendWorkingCommand extends Command 11 | { 12 | override public function execute():void 13 | { 14 | var weekendDilemma:IDilemmaVO = new WeekendWorkingDilemma(); 15 | 16 | var evt:DilemmaEvent = new DilemmaEvent(DilemmaEvent.DILEMMA_PRESENTED, weekendDilemma); 17 | dispatch(evt); 18 | } 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/SkipHireWorkersCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.events.DayCycleEvent; 6 | 7 | public class SkipHireWorkersCommand extends Command 8 | { 9 | 10 | override public function execute():void 11 | { 12 | var evt:DayCycleEvent = new DayCycleEvent(DayCycleEvent.LABOUR_HIRE_COMPLETED); 13 | dispatch(evt); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/daycycle/TakeStoneDeliveryCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.daycycle 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.ICashModel; 6 | import strategy.controller.events.StoneSupplyEvent; 7 | import strategy.model.resources.IStoneSupplyModel; 8 | import strategy.model.transactions.StoneTransactionVO; 9 | import strategy.controller.events.DayCycleEvent; 10 | 11 | public class TakeStoneDeliveryCommand extends Command 12 | { 13 | [Inject] 14 | public var stoneSupplyEvent:StoneSupplyEvent; 15 | 16 | [Inject] 17 | public var cashModel:ICashModel; 18 | 19 | [Inject] 20 | public var stoneSupplyModel:IStoneSupplyModel; 21 | 22 | override public function execute():void 23 | { 24 | trace("TakeStoneDeliveryCommand::execute()"); 25 | var transactionVO:StoneTransactionVO = stoneSupplyEvent.transactionVO; 26 | var quantity:Number = transactionVO.quantity; 27 | var price:Number = transactionVO.price; 28 | 29 | stoneSupplyModel.adjustByValue(quantity); 30 | 31 | var cost:Number = quantity * price; 32 | 33 | cashModel.adjustByValue(-cost); 34 | 35 | var evt:DayCycleEvent = new DayCycleEvent(DayCycleEvent.STONE_DELIVERY_COMPLETED); 36 | dispatch(evt); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/AdjustDayProductivityCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import org.robotlegs.base.OptionEvent; 6 | import strategy.model.resources.ILabourModel; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class AdjustDayProductivityCommand extends Command 10 | { 11 | [Inject] 12 | public var optionEvent:OptionEvent; 13 | 14 | [Inject] 15 | public var labour:ILabourModel; 16 | 17 | override public function execute():void 18 | { 19 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 20 | labour.changeTodaysProductivityBy(dilemmaConfig.productivity); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/AdjustEnvironmentalImpactCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import org.robotlegs.base.OptionEvent; 6 | import strategy.model.resources.IEnvironmentalImpactModel; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class AdjustEnvironmentalImpactCommand extends Command 10 | { 11 | [Inject] 12 | public var optionEvent:OptionEvent; 13 | 14 | [Inject] 15 | public var environmentModel:IEnvironmentalImpactModel; 16 | 17 | override public function execute():void 18 | { 19 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 20 | environmentModel.adjustByValue(dilemmaConfig.environment); 21 | environmentModel.dailyImpact = dilemmaConfig.dailyEnvironmentChange; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/AdjustProgressCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import org.robotlegs.base.OptionEvent; 6 | import strategy.model.resources.IBuildingProgressModel; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class AdjustProgressCommand extends Command 10 | { 11 | 12 | [Inject] 13 | public var optionEvent:OptionEvent; 14 | 15 | [Inject] 16 | public var progress:IBuildingProgressModel; 17 | 18 | override public function execute():void 19 | { 20 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 21 | progress.adjustByValue(dilemmaConfig.progress); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/AdjustSafetyCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import org.robotlegs.base.OptionEvent; 6 | import strategy.model.resources.IHealthAndSafetyModel; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class AdjustSafetyCommand extends Command 10 | { 11 | [Inject] 12 | public var optionEvent:OptionEvent; 13 | 14 | [Inject] 15 | public var safety:IHealthAndSafetyModel; 16 | 17 | override public function execute():void 18 | { 19 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 20 | safety.adjustByValue(dilemmaConfig.safety); 21 | if(safety.currentValue < 100) 22 | { 23 | safety.dailyImpact = dilemmaConfig.dailySafetyChange; 24 | } 25 | else 26 | { 27 | safety.dailyImpact = safety.dailyImpact * dilemmaConfig.dailySafetyChange; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/AdjustTargetCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.IBuildingProgressModel; 6 | import org.robotlegs.base.OptionEvent; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class AdjustTargetCommand extends Command 10 | { 11 | [Inject] 12 | public var progress:IBuildingProgressModel; 13 | 14 | [Inject] 15 | public var optionEvent:OptionEvent; 16 | 17 | override public function execute():void 18 | { 19 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 20 | progress.max = progress.max + dilemmaConfig.target; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/AdjustTeamProductivityCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import org.robotlegs.base.OptionEvent; 6 | import strategy.model.resources.ILabourModel; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class AdjustTeamProductivityCommand extends Command 10 | { 11 | [Inject] 12 | public var optionEvent:OptionEvent; 13 | 14 | [Inject] 15 | public var labour:ILabourModel; 16 | 17 | override public function execute():void 18 | { 19 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 20 | labour.adjustTeamEnergy(dilemmaConfig.productivity); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/ApplyStoneInsuranceCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.IStoneSupplyModel; 6 | 7 | public class ApplyStoneInsuranceCommand extends Command 8 | { 9 | [Inject] 10 | public var stoneSupply:IStoneSupplyModel; 11 | 12 | override public function execute():void 13 | { 14 | stoneSupply.isInsured = true; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/ContinueGameCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.events.DayCycleEvent; 6 | 7 | public class ContinueGameCommand extends Command 8 | { 9 | 10 | override public function execute():void 11 | { 12 | var evt:DayCycleEvent = new DayCycleEvent(DayCycleEvent.RANDOM_EVENTS_COMPLETED); 13 | dispatch(evt); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/DoubleStoneStorageCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.ICashModel; 6 | import strategy.model.resources.IStoneSupplyModel; 7 | import org.robotlegs.base.OptionEvent; 8 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 9 | 10 | public class DoubleStoneStorageCommand extends Command 11 | { 12 | [Inject] 13 | public var cash:ICashModel; 14 | 15 | [Inject] 16 | public var stoneStock:IStoneSupplyModel; 17 | 18 | [Inject] 19 | public var optionEvent:OptionEvent; 20 | 21 | 22 | override public function execute():void 23 | { 24 | trace("DoubleStoneStorageCommand::execute()"); 25 | 26 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 27 | 28 | cash.adjustByValue(dilemmaConfig.cash); 29 | 30 | stoneStock.max = stoneStock.max + dilemmaConfig.stoneCapacity; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/NullConsequenceCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | import org.robotlegs.mvcs.Command; 4 | 5 | public class NullConsequenceCommand extends Command 6 | { 7 | 8 | override public function execute():void 9 | { 10 | // do nothing 11 | } 12 | 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/RiskAccidentCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.controller.surprises.IDilemmaSurpriseEventCaster; 6 | import org.robotlegs.core.IOptionCommandMap; 7 | 8 | public class RiskAccidentCommand extends Command 9 | { 10 | [Inject] 11 | public var dilemmaCaster:IDilemmaSurpriseEventCaster; 12 | 13 | override public function execute():void 14 | { 15 | dilemmaCaster.castAccidentWithPercentageProbability(50); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/SpendMoneyCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.ICashModel; 6 | import org.robotlegs.base.OptionEvent; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class SpendMoneyCommand extends Command 10 | { 11 | [Inject] 12 | public var cash:ICashModel; 13 | 14 | [Inject] 15 | public var optionEvent:OptionEvent; 16 | 17 | override public function execute():void 18 | { 19 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 20 | cash.adjustByValue(dilemmaConfig.cash); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/SuspendWorkerCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import org.robotlegs.base.OptionEvent; 6 | import strategy.model.resources.ILabourModel; 7 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 8 | 9 | public class SuspendWorkerCommand extends Command 10 | { 11 | [Inject] 12 | public var optionEvent:OptionEvent; 13 | 14 | [Inject] 15 | public var labour:ILabourModel; 16 | 17 | override public function execute():void 18 | { 19 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 20 | labour.suspendWorkerForDays(dilemmaConfig.days); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/strategy/controller/commands/surpriseconsequences/WorkTheWeekendCommand.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands.surpriseconsequences 2 | { 3 | 4 | import org.robotlegs.mvcs.Command; 5 | import strategy.model.resources.ILabourModel; 6 | import strategy.model.resources.IWorker; 7 | import strategy.controller.events.DayCycleEvent; 8 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 9 | import org.robotlegs.base.OptionEvent; 10 | 11 | public class WorkTheWeekendCommand extends Command 12 | { 13 | [Inject] 14 | public var labourModel:ILabourModel; 15 | 16 | [Inject] 17 | public var optionEvent:OptionEvent; 18 | 19 | override public function execute():void 20 | { 21 | var dilemmaConfig:DilemmaConfig = optionEvent.payload as DilemmaConfig; 22 | labourModel.adjustTeamEnergy(dilemmaConfig.productivity); 23 | var evt:DayCycleEvent = new DayCycleEvent(DayCycleEvent.WORKING_DAY_STARTED); 24 | dispatch(evt); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/strategy/controller/events/GameEvent.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.events { 2 | 3 | import flash.events.Event; 4 | 5 | public class GameEvent extends Event { 6 | 7 | //-------------------------------------- 8 | // CLASS CONSTANTS 9 | //-------------------------------------- 10 | 11 | public static const GAME_STARTED:String = "GameEvent.gameStarted"; 12 | public static const GAME_RESTARTED:String = "GameEvent.gameRestarted"; 13 | 14 | 15 | //-------------------------------------- 16 | // CONSTRUCTOR 17 | //-------------------------------------- 18 | 19 | /** 20 | * @constructor 21 | */ 22 | public function GameEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false ){ 23 | super(type, bubbles, cancelable); 24 | } 25 | 26 | //-------------------------------------- 27 | // GETTER/SETTERS 28 | //-------------------------------------- 29 | 30 | //-------------------------------------- 31 | // PUBLIC METHODS 32 | //-------------------------------------- 33 | 34 | override public function clone() : Event { 35 | return new GameEvent(type, bubbles, cancelable); 36 | } 37 | 38 | //-------------------------------------- 39 | // PRIVATE VARIABLES 40 | //-------------------------------------- 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/strategy/controller/events/ResourceBoundaryEvent.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.events { 2 | 3 | import flash.events.Event; 4 | 5 | public class ResourceBoundaryEvent extends Event { 6 | 7 | //-------------------------------------- 8 | // CLASS CONSTANTS 9 | //-------------------------------------- 10 | 11 | public static const TARGET_REACHED:String = "ResourceBoundaryEvent.targetReached"; 12 | public static const BOUNDARY_BREACHED:String = "ResourceBoundaryEvent.boundaryBreached"; 13 | 14 | 15 | //-------------------------------------- 16 | // CONSTRUCTOR 17 | //-------------------------------------- 18 | 19 | /** 20 | * @constructor 21 | */ 22 | public function ResourceBoundaryEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false ){ 23 | super(type, bubbles, cancelable); 24 | } 25 | 26 | //-------------------------------------- 27 | // GETTER/SETTERS 28 | //-------------------------------------- 29 | 30 | //-------------------------------------- 31 | // PUBLIC METHODS 32 | //-------------------------------------- 33 | 34 | override public function clone() : Event { 35 | return new ResourceBoundaryEvent(type, bubbles, cancelable); 36 | } 37 | 38 | //-------------------------------------- 39 | // PRIVATE VARIABLES 40 | //-------------------------------------- 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/strategy/controller/surprises/BaseSurpriseEventCaster.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.surprises 2 | { 3 | import org.robotlegs.mvcs.Actor; 4 | 5 | public class BaseSurpriseEventCaster extends Actor implements ISurpriseEventCaster 6 | { 7 | protected var _surprisePercentageProbability:Number = 50; 8 | 9 | public function BaseSurpriseEventCaster() 10 | { 11 | super(); 12 | } 13 | 14 | public function set surprisePercentageProbability(value:Number):void 15 | { 16 | _surprisePercentageProbability = value; 17 | } 18 | 19 | public function castSurpriseEvent():void 20 | { 21 | if(_surprisePercentageProbability/100 > Math.random()) 22 | { 23 | dispatchSurpriseEvent(); 24 | } 25 | else 26 | { 27 | dispatchNormalEvent(); 28 | } 29 | } 30 | 31 | public function castNormalEvent():void 32 | { 33 | dispatchNormalEvent(); 34 | } 35 | 36 | public function primeSurpriseEvents():void 37 | { 38 | 39 | } 40 | 41 | protected function dispatchNormalEvent():void 42 | { 43 | 44 | } 45 | 46 | protected function dispatchSurpriseEvent():void 47 | { 48 | 49 | } 50 | 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /src/strategy/controller/surprises/IDilemmaSurpriseEventCaster.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.surprises 2 | { 3 | 4 | public interface IDilemmaSurpriseEventCaster extends ISurpriseEventCaster 5 | { 6 | function castAccidentWithPercentageProbability(probability:Number):void; 7 | } 8 | 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/strategy/controller/surprises/ILabourSurpriseEventCaster.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.surprises { 2 | 3 | public interface ILabourSurpriseEventCaster extends ISurpriseEventCaster { 4 | 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/strategy/controller/surprises/IStoneSurpriseEventCaster.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.surprises 2 | { 3 | 4 | public interface IStoneSurpriseEventCaster extends ISurpriseEventCaster 5 | { 6 | 7 | } 8 | 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/strategy/controller/surprises/ISurpriseEventCaster.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.surprises 2 | { 3 | import flash.events.IEventDispatcher; 4 | 5 | public interface ISurpriseEventCaster 6 | { 7 | function set surprisePercentageProbability(value:Number):void; 8 | 9 | function castSurpriseEvent():void; 10 | 11 | function castNormalEvent():void; 12 | 13 | function get eventDispatcher():IEventDispatcher; 14 | 15 | function set eventDispatcher(value:IEventDispatcher):void; 16 | 17 | function primeSurpriseEvents():void; 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /src/strategy/controller/surprises/SurprisesClassImporter.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.surprises 2 | { 3 | import strategy.controller.commands.surpriseconsequences.*; 4 | 5 | public class SurprisesClassImporter extends Object 6 | { 7 | 8 | private var importedClasses:Array = new Array( 9 | AdjustDayProductivityCommand, 10 | AdjustEnvironmentalImpactCommand, 11 | AdjustProgressCommand, 12 | AdjustSafetyCommand, 13 | AdjustTargetCommand, 14 | AdjustTeamProductivityCommand, 15 | ApplyStoneInsuranceCommand, 16 | ContinueGameCommand, 17 | DoubleStoneStorageCommand, 18 | NullConsequenceCommand, 19 | RestTheWeekendCommand, 20 | RiskAccidentCommand, 21 | SpendMoneyCommand, 22 | SuspendWorkerCommand, 23 | WorkTheWeekendCommand 24 | ) 25 | 26 | 27 | } 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/strategy/controller/surprises/SurprisesSpec.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.surprises 2 | { 3 | 4 | public class SurprisesSpec extends Object 5 | { 6 | 7 | public function SurprisesSpec() 8 | { 9 | } 10 | 11 | 12 | } 13 | 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/strategy/model/FirstGameConfig.as: -------------------------------------------------------------------------------- 1 | package strategy.model { 2 | 3 | public class FirstGameConfig extends GameConfigVO { 4 | 5 | public function FirstGameConfig() { 6 | _calendarDays = 30; 7 | _workingDaysPerWeek = 5; 8 | _daysPerTurn = 1; 9 | _targetBuildTotal = 6500; 10 | _minimumTeamSize = 3; 11 | _maximumTeamSize = 4; 12 | _minimumWorkerProductivity = 90; 13 | _maximumWorkerProductivity = 120; 14 | _minimumLabourCost = 200; 15 | _maximumLabourCost = 400; 16 | 17 | _startingBudget = 125000; 18 | _stoneStockCapacity = 500; 19 | 20 | _numberOfNormalDaysAtStart = 3; 21 | 22 | _minimumStoneAvailability = 300; 23 | _maximumStoneAvailability = 450; 24 | _stoneAvailabilityVariability = 50; 25 | _minimumStonePrice = 8; 26 | _maximumStonePrice = 20; 27 | 28 | _stoneSurpriseEventProbability = 20; 29 | 30 | _dailyEnvironmentalImpact = -2; 31 | _dailySafetyImpact = -2; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/strategy/model/base/GameFactorModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.base { 2 | 3 | import strategy.controller.events.ResourceStatusEvent; 4 | 5 | public class GameFactorModel extends GameMetricBaseModel implements IGameFactorModel { 6 | 7 | protected var updateType:String = ' '; 8 | 9 | public function GameFactorModel() { 10 | } 11 | 12 | //--------------------------------------- 13 | // IGameFactorModel Implementation 14 | //--------------------------------------- 15 | 16 | //import strategy.model.base.IGameFactorModel; 17 | public function get currentPercentage():Number 18 | { 19 | return (((currentValue - min)/range) * 100); 20 | } 21 | 22 | public function set currentPercentage(value:Number):void 23 | { 24 | currentValue = min + (range * (value/100)); 25 | } 26 | 27 | public function adjustByValue(value:Number):void 28 | { 29 | currentValue = currentValue + value; 30 | } 31 | 32 | public function adjustByPercentage(value:Number):void 33 | { 34 | var factor:Number = 1 + (value/100); 35 | currentValue = currentValue * factor; 36 | } 37 | 38 | override protected function dispatchUpdateEvent():void 39 | { 40 | var evt:ResourceStatusEvent = new ResourceStatusEvent(updateType, currentValue, currentPercentage); 41 | dispatch(evt); 42 | } 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /src/strategy/model/base/GameImpactFactorModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.base 2 | { 3 | 4 | public class GameImpactFactorModel extends GameFactorModel implements IImpactModel 5 | { 6 | protected var _dailyImpact:Number = 0; 7 | 8 | public function GameImpactFactorModel() 9 | { 10 | super(); 11 | } 12 | 13 | //--------------------------------------- 14 | // IImpactModel Implementation 15 | //--------------------------------------- 16 | 17 | //import strategy.model.base.IImpactModel; 18 | public function set dailyImpact(value:Number):void 19 | { 20 | _dailyImpact = value; 21 | } 22 | 23 | public function get dailyImpact():Number 24 | { 25 | return _dailyImpact; 26 | } 27 | 28 | public function applyImpact():void 29 | { 30 | currentValue = currentValue + _dailyImpact; 31 | } 32 | 33 | override public function set currentValue(value:Number):void 34 | { 35 | value = Math.min(value, max); 36 | value = Math.max(value, min); 37 | super.currentValue = value; 38 | } 39 | 40 | } 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/strategy/model/base/IGameFactorModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.base { 2 | 3 | public interface IGameFactorModel extends IGameMetricModel { 4 | 5 | function get currentPercentage():Number; 6 | 7 | function set currentPercentage(value:Number):void; 8 | 9 | function adjustByValue(value:Number):void; 10 | 11 | function adjustByPercentage(value:Number):void; 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/strategy/model/base/IGameMetricModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.base 2 | { 3 | import flash.events.IEventDispatcher; 4 | 5 | public interface IGameMetricModel 6 | { 7 | 8 | function get max():Number; 9 | 10 | function set max(value:Number):void; 11 | 12 | function get min():Number; 13 | 14 | function set min(value:Number):void; 15 | 16 | function get currentValue():Number; 17 | 18 | function set currentValue(value:Number):void; 19 | 20 | function get history():Vector.; 21 | 22 | function get eventDispatcher():IEventDispatcher; 23 | 24 | function set eventDispatcher(value:IEventDispatcher):void; 25 | 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /src/strategy/model/base/IImpactModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.base 2 | { 3 | 4 | public interface IImpactModel 5 | { 6 | 7 | function applyImpact():void; 8 | 9 | function set dailyImpact(value:Number):void; 10 | 11 | function get dailyImpact():Number; 12 | 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/strategy/model/base/IMarketVariationModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.base { 2 | 3 | public interface IMarketVariationModel extends IGameMetricModel { 4 | 5 | function get volatility():Number; 6 | 7 | function set volatility(value:Number):void; 8 | 9 | function get pointAverage():uint; 10 | 11 | function set pointAverage(value:uint):void; 12 | 13 | function move():void; 14 | 15 | function setToMaximum():void; 16 | 17 | function setToMinimum():void; 18 | 19 | function setToMidpoint():void; 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/strategy/model/gameplay/DilemmaOptionVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.gameplay 2 | { 3 | import strategy.model.gameplay.dilemmas.DilemmaConfig; 4 | 5 | public class DilemmaOptionVO extends OptionVO 6 | { 7 | 8 | public function DilemmaOptionVO(id:uint, title:String, consequences:Vector., payload:DilemmaConfig = null) 9 | { 10 | // trace("DilemmaOptionVO::DilemmaOptionVO()", id, title, consequences, payload); 11 | super(id, title, consequences, payload); 12 | } 13 | 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /src/strategy/model/gameplay/DilemmaVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.gameplay { 2 | 3 | import flash.display.Sprite; 4 | 5 | public class DilemmaVO implements IDilemmaVO { 6 | 7 | protected var _title:String; 8 | protected var _question:String; 9 | protected var _options:Vector.; 10 | protected var _image:Sprite; 11 | 12 | public function DilemmaVO(title:String, question:String, options:Vector., image:Sprite) { 13 | //trace("DilemmaVO::()", title, question, options, image); 14 | _title = title; 15 | _question = question; 16 | _options = options; 17 | _image = image; 18 | } 19 | 20 | //--------------------------------------- 21 | // IDilemmaVO Implementation 22 | //--------------------------------------- 23 | 24 | //import strategy.model.gameplay.IDilemmaVO; 25 | public function get title():String 26 | { 27 | return _title; 28 | } 29 | 30 | public function get question():String 31 | { 32 | return _question; 33 | } 34 | 35 | public function get options():Vector. 36 | { 37 | return _options; 38 | } 39 | 40 | public function get image():Sprite 41 | { 42 | return _image; 43 | } 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /src/strategy/model/gameplay/IDilemmaVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.gameplay { 2 | 3 | import flash.display.Sprite; 4 | 5 | public interface IDilemmaVO { 6 | 7 | function get title():String; 8 | 9 | function get question():String; 10 | 11 | function get options():Vector.; 12 | 13 | function get image():Sprite; 14 | } 15 | } -------------------------------------------------------------------------------- /src/strategy/model/gameplay/IOptionVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.gameplay { 2 | 3 | public interface IOptionVO { 4 | 5 | function get title():String; 6 | 7 | function get id():uint; 8 | 9 | function get consequences():Vector.; 10 | 11 | function get payload():*; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/strategy/model/gameplay/OptionVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.gameplay { 2 | 3 | public class OptionVO implements IOptionVO { 4 | 5 | protected var _title:String; 6 | protected var _id:uint; 7 | protected var _consequences:Vector.; 8 | protected var _payload:*; 9 | 10 | public function OptionVO(id:uint, title:String, consequences:Vector., payload:* = null) { 11 | _id = id; 12 | _title = title; 13 | _consequences = consequences; 14 | _payload = payload; 15 | } 16 | 17 | //--------------------------------------- 18 | // IOptionVO Implementation 19 | //--------------------------------------- 20 | 21 | //import strategy.model.gameplay.IOptionVO; 22 | public function get title():String 23 | { 24 | return _title; 25 | } 26 | 27 | public function get id():uint 28 | { 29 | return _id; 30 | } 31 | 32 | public function get consequences():Vector. 33 | { 34 | return _consequences; 35 | } 36 | 37 | public function get payload():* 38 | { 39 | return _payload; 40 | } 41 | 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/strategy/model/markets/ILabourAvailabilityMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import strategy.model.base.IMarketVariationModel; 4 | 5 | public interface ILabourAvailabilityMarket extends IMarketVariationModel { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /src/strategy/model/markets/ILabourPriceMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import strategy.model.base.IMarketVariationModel; 4 | 5 | public interface ILabourPriceMarket extends IMarketVariationModel { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /src/strategy/model/markets/IStoneAvailabilityMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import strategy.model.base.IMarketVariationModel; 4 | 5 | public interface IStoneAvailabilityMarket extends IMarketVariationModel { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /src/strategy/model/markets/IStonePriceMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import strategy.model.base.IMarketVariationModel; 4 | 5 | public interface IStonePriceMarket extends IMarketVariationModel { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /src/strategy/model/markets/LabourAvailabilityMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import org.robotlegs.mvcs.Actor; 4 | import strategy.model.base.MarketVariationModel; 5 | 6 | public class LabourAvailabilityMarket extends MarketVariationModel implements ILabourAvailabilityMarket { 7 | 8 | public function LabourAvailabilityMarket() { 9 | } 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /src/strategy/model/markets/LabourPriceMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import strategy.model.base.MarketVariationModel; 4 | 5 | public class LabourPriceMarket extends MarketVariationModel implements ILabourPriceMarket { 6 | 7 | public function LabourPriceMarket() { 8 | } 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /src/strategy/model/markets/StoneAvailabilityMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import strategy.model.base.MarketVariationModel; 4 | 5 | public class StoneAvailabilityMarket extends MarketVariationModel implements IStoneAvailabilityMarket { 6 | 7 | public function StoneAvailabilityMarket() { 8 | } 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /src/strategy/model/markets/StonePriceMarket.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import strategy.model.base.MarketVariationModel; 4 | 5 | public class StonePriceMarket extends MarketVariationModel implements IStonePriceMarket { 6 | 7 | public function StonePriceMarket() { 8 | } 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/BuildingProgressModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.GameFactorModel; 4 | import strategy.controller.events.ResourceStatusEvent; 5 | import strategy.controller.events.ResourceBoundaryEvent; 6 | 7 | public class BuildingProgressModel extends GameFactorModel implements IBuildingProgressModel 8 | { 9 | 10 | public function BuildingProgressModel() 11 | { 12 | updateType = ResourceStatusEvent.BUILDING_PROGRESS_UPDATED; 13 | _currentValue = 0; 14 | } 15 | 16 | override public function set max(value:Number):void 17 | { 18 | super.max = value; 19 | dispatchUpdateEvent(); 20 | } 21 | 22 | override protected function checkBoundaries():void 23 | { 24 | if(Math.round(currentValue) >= max) 25 | { 26 | trace("building complete: ", currentValue, max); 27 | var evt:ResourceBoundaryEvent = new ResourceBoundaryEvent(ResourceBoundaryEvent.TARGET_REACHED); 28 | dispatch(evt); 29 | } 30 | } 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/CalendarModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.GameFactorModel; 4 | import strategy.controller.events.ResourceStatusEvent; 5 | import strategy.controller.events.ResourceBoundaryEvent; 6 | 7 | public class CalendarModel extends GameFactorModel implements ICalendarModel { 8 | 9 | public function CalendarModel() { 10 | updateType = ResourceStatusEvent.CALENDAR_UPDATED; 11 | } 12 | 13 | override protected function checkBoundaries():void 14 | { 15 | if(currentValue <= min) 16 | { 17 | trace("CalendarModel::checkBoundaries firing breach"); 18 | var evt:ResourceBoundaryEvent = new ResourceBoundaryEvent(ResourceBoundaryEvent.BOUNDARY_BREACHED); 19 | dispatch(evt); 20 | } 21 | } 22 | 23 | //--------------------------------------- 24 | // ICalendarModel Implementation 25 | //--------------------------------------- 26 | 27 | //import strategy.model.resources.ICalendarModel; 28 | public function get daysPassed():uint 29 | { 30 | return (max - currentValue); 31 | } 32 | 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/CashModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import org.robotlegs.mvcs.Actor; 4 | import strategy.model.base.GameFactorModel; 5 | import strategy.controller.events.ResourceStatusEvent; 6 | import strategy.controller.events.ResourceBoundaryEvent; 7 | 8 | public class CashModel extends GameFactorModel implements ICashModel { 9 | 10 | public function CashModel() { 11 | updateType = ResourceStatusEvent.CASH_UPDATED; 12 | } 13 | 14 | override protected function checkBoundaries():void 15 | { 16 | if(currentValue <= min) 17 | { 18 | trace("CashModel::checkBoundaries firing breach"); 19 | var evt:ResourceBoundaryEvent = new ResourceBoundaryEvent(ResourceBoundaryEvent.BOUNDARY_BREACHED); 20 | dispatch(evt); 21 | } 22 | } 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/EnvironmentalImpactModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.GameImpactFactorModel; 4 | import strategy.controller.events.ResourceStatusEvent; 5 | 6 | public class EnvironmentalImpactModel extends GameImpactFactorModel implements IEnvironmentalImpactModel { 7 | 8 | public function EnvironmentalImpactModel() { 9 | updateType = ResourceStatusEvent.ENVIRONMENTAL_IMPACT_UPDATED; 10 | } 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/HealthAndSafetyModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.controller.events.ResourceStatusEvent; 4 | import strategy.model.base.GameImpactFactorModel; 5 | 6 | public class HealthAndSafetyModel extends GameImpactFactorModel implements IHealthAndSafetyModel { 7 | 8 | public function HealthAndSafetyModel() { 9 | updateType = ResourceStatusEvent.HEALTH_AND_SAFETY_UPDATED; 10 | } 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/IBuildingProgressModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.IGameFactorModel; 4 | 5 | public interface IBuildingProgressModel extends IGameFactorModel { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/ICalendarModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.IGameFactorModel; 4 | 5 | public interface ICalendarModel extends IGameFactorModel { 6 | 7 | function get daysPassed():uint; 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/ICashModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.IGameFactorModel; 4 | 5 | public interface ICashModel extends IGameFactorModel { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/IEnvironmentalImpactModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.IGameFactorModel; 4 | import strategy.model.base.IImpactModel; 5 | 6 | public interface IEnvironmentalImpactModel extends IGameFactorModel, IImpactModel { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/IHealthAndSafetyModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.IGameFactorModel; 4 | import strategy.model.base.IImpactModel; 5 | 6 | public interface IHealthAndSafetyModel extends IGameFactorModel, IImpactModel { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/ILabourModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.resources.IWorker; 4 | import strategy.model.base.IMarketVariationModel; 5 | import strategy.model.markets.ILabourPriceMarket; 6 | import strategy.model.transactions.WorkerProductivityVO; 7 | 8 | public interface ILabourModel extends IMarketVariationModel { 9 | 10 | function get teamSize():uint; 11 | 12 | function set teamSize(value:uint):void; 13 | 14 | function get team():Vector.; 15 | 16 | function get teamCost():Number; 17 | 18 | function set labourPriceMarket(value:ILabourPriceMarket):void; 19 | 20 | function appendWorkers(workers:Vector.):void; 21 | 22 | function removeTempWorkers():void; 23 | 24 | function adjustTeamEnergy(value:Number):void; 25 | 26 | function suspendWorkerForDays(days:uint):void; 27 | 28 | function changeTodaysProductivityBy(value:Number):void; 29 | } 30 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/IStoneSupplyModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.IGameFactorModel; 4 | 5 | public interface IStoneSupplyModel extends IGameFactorModel { 6 | 7 | function get isInsured():Boolean; 8 | 9 | function set isInsured(value:Boolean):void; 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/IWorker.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.IMarketVariationModel; 4 | 5 | public interface IWorker extends IMarketVariationModel { 6 | 7 | function get energyLevel():Number; 8 | 9 | function set energyLevel(value:Number):void; 10 | 11 | function get maxEnergyLevel():Number; 12 | 13 | function set maxEnergyLevel(value:Number):void; 14 | 15 | function adjustEnergyLevel(value:Number):void; 16 | 17 | function get pay():Number; 18 | 19 | function set pay(value:Number):void; 20 | 21 | function suspendForDays(days:int):void; 22 | 23 | function get isSuspended():Boolean; 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/StoneSupplyModel.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources { 2 | 3 | import strategy.model.base.GameFactorModel; 4 | import strategy.controller.events.ResourceStatusEvent; 5 | 6 | public class StoneSupplyModel extends GameFactorModel implements IStoneSupplyModel { 7 | 8 | public function StoneSupplyModel() { 9 | updateType = ResourceStatusEvent.STONE_SUPPLY_UPDATED; 10 | } 11 | 12 | override public function set max(value:Number):void 13 | { 14 | if(value != _max) 15 | { 16 | _max = value; 17 | var evt:ResourceStatusEvent = new ResourceStatusEvent(ResourceStatusEvent.STONE_CAPACITY_UPDATED, _max, 100); 18 | dispatch(evt); 19 | } 20 | } 21 | 22 | private var _isInsured:Boolean; 23 | 24 | public function get isInsured():Boolean 25 | { 26 | return _isInsured; 27 | } 28 | 29 | public function set isInsured(value:Boolean):void 30 | { 31 | if (value !== _isInsured) 32 | { 33 | _isInsured = value; 34 | } 35 | } 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /src/strategy/model/resources/TempWorker.as: -------------------------------------------------------------------------------- 1 | package strategy.model.resources 2 | { 3 | 4 | public class TempWorker extends Worker 5 | { 6 | 7 | public function TempWorker() 8 | { 9 | super(); 10 | _energyModel.min = DEFAULT_MAX_ENERGY_LEVEL; 11 | } 12 | 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/strategy/model/transactions/DailyProductivityVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.transactions 2 | { 3 | 4 | public class DailyProductivityVO extends Object 5 | { 6 | 7 | public function DailyProductivityVO(stonesBuilt:Number, wagesPaid:Number) 8 | { 9 | _stonesBuilt = stonesBuilt; 10 | _wagesPaid = wagesPaid; 11 | } 12 | 13 | protected var _stonesBuilt:Number; 14 | 15 | public function get stonesBuilt():Number 16 | { 17 | return _stonesBuilt; 18 | } 19 | 20 | protected var _wagesPaid:Number; 21 | 22 | public function get wagesPaid():Number 23 | { 24 | return _wagesPaid; 25 | } 26 | 27 | 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/strategy/model/transactions/NullStoneTransactionVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.transactions 2 | { 3 | 4 | public class NullStoneTransactionVO extends StoneTransactionVO 5 | { 6 | 7 | public function NullStoneTransactionVO() 8 | { 9 | super(0, 0); 10 | } 11 | 12 | } 13 | 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/strategy/model/transactions/StoneTransactionVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.transactions { 2 | 3 | public class StoneTransactionVO { 4 | 5 | /** 6 | * @constructor 7 | */ 8 | public function StoneTransactionVO(quantity:Number, price:Number){ 9 | _quantity = quantity; 10 | _price = price; 11 | } 12 | 13 | //-------------------------------------- 14 | // GETTER/SETTERS 15 | //-------------------------------------- 16 | 17 | protected var _quantity:Number; 18 | 19 | public function get quantity():Number 20 | { 21 | return _quantity; 22 | } 23 | 24 | protected var _price:Number; 25 | 26 | public function get price():Number 27 | { 28 | return _price; 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/strategy/model/transactions/WorkerProductivityVO.as: -------------------------------------------------------------------------------- 1 | package strategy.model.transactions 2 | { 3 | 4 | public class WorkerProductivityVO extends DailyProductivityVO 5 | { 6 | 7 | public function WorkerProductivityVO(stonesBuilt:Number, wagesPaid:Number) 8 | { 9 | super(stonesBuilt, wagesPaid); 10 | } 11 | 12 | public function toString():String 13 | { 14 | return ("[WorkerProductivityVO, stones:" + _stonesBuilt + ", wages:" + _wagesPaid + "]") 15 | } 16 | 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/strategy/view/WorkerView.as: -------------------------------------------------------------------------------- 1 | package strategy.view { 2 | 3 | import flash.display.Sprite; 4 | 5 | public class WorkerView extends Sprite { 6 | 7 | 8 | public function WorkerView(skin:Sprite) { 9 | addChild(skin); 10 | _suspended = skin.getChildByName('suspended') as Sprite; 11 | _suspended.visible = false; 12 | } 13 | 14 | private var _suspended:Sprite; 15 | 16 | public function get suspended():Boolean 17 | { 18 | return _suspended.visible; 19 | } 20 | 21 | public function set suspended(value:Boolean):void 22 | { 23 | _suspended.visible = value; 24 | } 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /src/strategy/view/decisions/IStoneOfferView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.decisions 2 | { 3 | import org.osflash.signalsv1.Signal; 4 | 5 | public interface IStoneOfferView 6 | { 7 | function get submitSignal():Signal; 8 | } 9 | 10 | } -------------------------------------------------------------------------------- /src/strategy/view/decisions/StoneDilemmaView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.decisions { 2 | 3 | import flash.display.Sprite; 4 | import skins.PyramidGameSkin; 5 | import flash.text.TextField; 6 | 7 | //StoneDeliveryDilemmaSkin 8 | 9 | public class StoneDilemmaView extends StoneOfferView implements IStoneOfferView { 10 | 11 | protected var _message:String; 12 | 13 | //-------------------------------------------------------------------------- 14 | // 15 | // Initialization 16 | // 17 | //-------------------------------------------------------------------------- 18 | /** 19 | * Event handling takes place via the mediator: StoneDilemmaViewMediator 20 | * 21 | */ 22 | 23 | public function StoneDilemmaView(price:Number, availability:Number, message:String) { 24 | _message = message; 25 | _skinClass = PyramidGameSkin.StoneDeliveryDilemmaSkin; 26 | super(price, availability); 27 | } 28 | 29 | override protected function init(skinClass:Class):void 30 | { 31 | super.init(skinClass); 32 | var skin:Sprite = getChildAt(0) as Sprite; 33 | var messageField:TextField = skin.getChildByName('message_txt') as TextField; 34 | messageField.text = _message; 35 | } 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /src/strategy/view/messages/DaySummaryView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.messages { 2 | 3 | import skins.PyramidGameSkin; 4 | import strategy.view.messages.BaseGameMessageView; 5 | 6 | public class DaySummaryView extends BaseGameMessageView { 7 | 8 | //-------------------------------------------------------------------------- 9 | // 10 | // Initialization 11 | // 12 | //-------------------------------------------------------------------------- 13 | /** 14 | * Event handling takes place via the mediator: DaySummaryViewMediator 15 | * 16 | */ 17 | 18 | public function DaySummaryView(blocksBuilt:Number, wagesPaid:Number) { 19 | init(PyramidGameSkin.DailyProgressSummarySkin); 20 | setFieldValue('quantity_txt', Math.round(blocksBuilt).toString()); 21 | setFieldValue('cost_txt', Math.round(wagesPaid).toString() + " coins"); 22 | } 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /src/strategy/view/messages/GameMessageText.as: -------------------------------------------------------------------------------- 1 | package strategy.view.messages 2 | { 3 | import strategy.view.messages.IGameMessageText; 4 | 5 | public class GameMessageText extends Object implements IGameMessageText 6 | { 7 | 8 | protected const CALENDAR_FAIL_MESSAGE:String = "The project ran out of time."; 9 | protected const CASH_FAIL_MESSAGE:String = "The project ran out of money."; 10 | protected const CASH_AND_CALENDAR_FAIL_MESSAGE:String = "The project ran out of money and time."; 11 | 12 | //--------------------------------------- 13 | // IGameMessageText Implementation 14 | //--------------------------------------- 15 | 16 | //import strategy.view.messages.IGameMessageText; 17 | public function get calendarFailMessage():String 18 | { 19 | return CALENDAR_FAIL_MESSAGE; 20 | } 21 | 22 | public function get cashFailMessage():String 23 | { 24 | return CASH_FAIL_MESSAGE; 25 | } 26 | 27 | public function get cashAndCalendarFailMessage():String 28 | { 29 | return CASH_AND_CALENDAR_FAIL_MESSAGE; 30 | } 31 | 32 | } 33 | 34 | 35 | } -------------------------------------------------------------------------------- /src/strategy/view/messages/GameOverView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.messages { 2 | 3 | import flash.display.Sprite; 4 | import strategy.view.messages.BaseGameMessageView; 5 | import skins.PyramidGameSkin; 6 | 7 | public class GameOverView extends BaseGameMessageView { 8 | 9 | 10 | //-------------------------------------------------------------------------- 11 | // 12 | // Initialization 13 | // 14 | //-------------------------------------------------------------------------- 15 | /** 16 | * Event handling takes place via the mediator: GameOverViewMediator 17 | * 18 | */ 19 | 20 | public function GameOverView(message:String) { 21 | init(PyramidGameSkin.GameOverSkin); 22 | setFieldValue('message_txt', message); 23 | } 24 | 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /src/strategy/view/messages/GameWonView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.messages { 2 | 3 | import flash.display.Sprite; 4 | import strategy.view.messages.BaseGameMessageView; 5 | import skins.PyramidGameSkin; 6 | 7 | public class GameWonView extends BaseGameMessageView { 8 | 9 | 10 | //-------------------------------------------------------------------------- 11 | // 12 | // Initialization 13 | // 14 | //-------------------------------------------------------------------------- 15 | /** 16 | * Event handling takes place via the mediator: GameWonViewMediator 17 | * 18 | */ 19 | 20 | public function GameWonView(days:uint, cash:Number) { 21 | init(PyramidGameSkin.GameWonSkin); 22 | setFieldValue("days_txt", days.toString() + " days"); 23 | setFieldValue('cost_txt', cash.toString() + " coins"); 24 | } 25 | 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /src/strategy/view/messages/IGameMessageText.as: -------------------------------------------------------------------------------- 1 | package strategy.view.messages 2 | { 3 | 4 | public interface IGameMessageText 5 | { 6 | 7 | function get calendarFailMessage():String; 8 | 9 | function get cashFailMessage():String; 10 | 11 | function get cashAndCalendarFailMessage():String; 12 | 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/strategy/view/messages/StoneStockCheckView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.messages { 2 | 3 | import flash.display.Sprite; 4 | import strategy.view.messages.BaseGameMessageView; 5 | import skins.PyramidGameSkin; 6 | import gs.TweenLite; 7 | 8 | public class StoneStockCheckView extends BaseGameMessageView { 9 | 10 | 11 | //-------------------------------------------------------------------------- 12 | // 13 | // Initialization 14 | // 15 | //-------------------------------------------------------------------------- 16 | /** 17 | * Event handling takes place via the mediator: StoneStockCheckViewMediator 18 | * 19 | */ 20 | 21 | public function StoneStockCheckView(quantityStolen:Number, withInsurance:Boolean = false) { 22 | init(PyramidGameSkin.StoneStockCheckSkin); 23 | setFieldValue('quantity_txt', quantityStolen.toString()+ " stones"); 24 | showInsuranceStamp(withInsurance); 25 | } 26 | 27 | private function showInsuranceStamp(withInsurance:Boolean):void 28 | { 29 | if(withInsurance) 30 | { 31 | var insuranceStamp:Sprite = _skin.getChildByName("insurance_stamp") as Sprite; 32 | TweenLite.to(insuranceStamp, 0.3, {alpha:1, scaleX:1, scaleY:1, delay:3}) 33 | } 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /src/strategy/view/status/BaseGaugeStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status 2 | { 3 | import flash.display.Sprite; 4 | 5 | public class BaseGaugeStatusView extends Sprite 6 | { 7 | protected var _range:Number; 8 | protected var _indicator:Sprite; 9 | 10 | public function BaseGaugeStatusView() 11 | { 12 | super(); 13 | } 14 | 15 | public function updateStatus(value:Number):void 16 | { 17 | var xPosition:Number = _range * (value/100); 18 | _indicator.x = xPosition; 19 | } 20 | 21 | protected function init(skinClass:Class):void 22 | { 23 | var skin:Sprite = new skinClass() as Sprite; 24 | addChild(skin); 25 | var thermometer:Sprite = skin.getChildByName('thermometer') as Sprite; 26 | var thermometer_background:Sprite = thermometer.getChildByName('thermometer_background') as Sprite; 27 | _range = thermometer_background.width; 28 | _indicator = thermometer.getChildByName('indicator') as Sprite; 29 | } 30 | 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/strategy/view/status/BaseStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status { 2 | 3 | import flash.display.Sprite; 4 | import flash.text.TextField; 5 | 6 | public class BaseStatusView extends Sprite { 7 | 8 | protected var statusText:TextField; 9 | 10 | //-------------------------------------------------------------------------- 11 | // 12 | // Initialization 13 | // 14 | //-------------------------------------------------------------------------- 15 | /** 16 | * Event handling takes place via the mediator: CalendarStatusViewMediator 17 | * 18 | */ 19 | 20 | public function BaseStatusView() { 21 | } 22 | 23 | public function updateStatus(value:Number):void 24 | { 25 | statusText.text = Math.round(value).toString(); 26 | } 27 | 28 | protected function init(skinClass:Class):void 29 | { 30 | var skin:Sprite = new skinClass() as Sprite; 31 | statusText = skin.getChildByName("status_txt") as TextField; 32 | addChild(skin); 33 | } 34 | 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/strategy/view/status/CalendarStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status { 2 | 3 | import skins.PyramidGameSkin; 4 | 5 | public class CalendarStatusView extends BaseStatusView { 6 | 7 | 8 | //-------------------------------------------------------------------------- 9 | // 10 | // Initialization 11 | // 12 | //-------------------------------------------------------------------------- 13 | /** 14 | * Event handling takes place via the mediator: CalendarStatusViewMediator 15 | * 16 | */ 17 | 18 | public function CalendarStatusView() { 19 | init(PyramidGameSkin.CalendarStatusSkin); 20 | } 21 | 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /src/strategy/view/status/CashStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status { 2 | 3 | import skins.PyramidGameSkin; 4 | 5 | public class CashStatusView extends BaseStatusView { 6 | 7 | 8 | //-------------------------------------------------------------------------- 9 | // 10 | // Initialization 11 | // 12 | //-------------------------------------------------------------------------- 13 | /** 14 | * Event handling takes place via the mediator: CashStatusViewMediator 15 | * 16 | */ 17 | 18 | public function CashStatusView() { 19 | init(PyramidGameSkin.CashStatusSkin); 20 | } 21 | 22 | 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /src/strategy/view/status/EnvironmentStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status { 2 | 3 | import skins.PyramidGameSkin; 4 | import strategy.view.status.BaseGaugeStatusView; 5 | 6 | public class EnvironmentStatusView extends BaseGaugeStatusView { 7 | 8 | 9 | //-------------------------------------------------------------------------- 10 | // 11 | // Initialization 12 | // 13 | //-------------------------------------------------------------------------- 14 | /** 15 | * Event handling takes place via the mediator: EnvironmentStatusViewMediator 16 | * 17 | */ 18 | 19 | public function EnvironmentStatusView() { 20 | init(PyramidGameSkin.EnvironmentStatusSkin); 21 | } 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /src/strategy/view/status/ProgressStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status { 2 | 3 | import strategy.view.status.BaseStatusView; 4 | import skins.PyramidGameSkin; 5 | 6 | public class ProgressStatusView extends BaseStatusView { 7 | 8 | 9 | //-------------------------------------------------------------------------- 10 | // 11 | // Initialization 12 | // 13 | //-------------------------------------------------------------------------- 14 | /** 15 | * Event handling takes place via the mediator: ProgressStatusViewMediator 16 | * 17 | */ 18 | 19 | public function ProgressStatusView() { 20 | init(PyramidGameSkin.ProgressStatusSkin) 21 | } 22 | 23 | 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /src/strategy/view/status/SafetyStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status { 2 | 3 | import skins.PyramidGameSkin; 4 | import strategy.view.status.BaseGaugeStatusView; 5 | 6 | public class SafetyStatusView extends BaseGaugeStatusView { 7 | 8 | 9 | //-------------------------------------------------------------------------- 10 | // 11 | // Initialization 12 | // 13 | //-------------------------------------------------------------------------- 14 | /** 15 | * Event handling takes place via the mediator: SafetyStatusViewMediator 16 | * 17 | */ 18 | 19 | public function SafetyStatusView() { 20 | init(PyramidGameSkin.SafetyStatusSkin); 21 | } 22 | 23 | 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /src/strategy/view/status/StoneStockStatusView.as: -------------------------------------------------------------------------------- 1 | package strategy.view.status { 2 | 3 | import strategy.view.status.BaseStatusView; 4 | import skins.PyramidGameSkin; 5 | import flash.display.Sprite; 6 | import flash.text.TextField; 7 | 8 | public class StoneStockStatusView extends BaseStatusView { 9 | 10 | protected var capacityText:TextField; 11 | 12 | 13 | //-------------------------------------------------------------------------- 14 | // 15 | // Initialization 16 | // 17 | //-------------------------------------------------------------------------- 18 | /** 19 | * Event handling takes place via the mediator: StoneStockStatusViewMediator 20 | * 21 | */ 22 | 23 | public function StoneStockStatusView() { 24 | init(PyramidGameSkin.StoneStockStatusSkin); 25 | } 26 | 27 | public function updateCapacity(value:Number):void 28 | { 29 | capacityText.text = Math.round(value).toString(); 30 | } 31 | 32 | override protected function init(skinClass:Class):void 33 | { 34 | var skin:Sprite = new skinClass() as Sprite; 35 | statusText = skin.getChildByName("status_txt") as TextField; 36 | capacityText = skin.getChildByName("capacity_txt") as TextField; 37 | addChild(skin); 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /support/org/robotlegs/mvcs/CommandSupport.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.mvcs { 2 | 3 | import org.robotlegs.mvcs.Command; 4 | 5 | public class CommandSupport extends Command { 6 | 7 | // Testable constants 8 | //public static const MY_CONST:String = 'myConstant'; 9 | 10 | //-------------------------------------------------------------------------- 11 | // 12 | // Initialization 13 | // 14 | //-------------------------------------------------------------------------- 15 | 16 | //-------------------------------------------------------------------------- 17 | // 18 | // Overridden API 19 | // 20 | //-------------------------------------------------------------------------- 21 | 22 | public override function execute():void 23 | { 24 | trace("CommandSupport::execute()"); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /support/strategy/model/gameplay/OptionVOSupport.as: -------------------------------------------------------------------------------- 1 | package strategy.model.gameplay { 2 | 3 | import strategy.model.gameplay.OptionVO; 4 | import org.robotlegs.mvcs.CommandSupport; 5 | 6 | public class OptionVOSupport extends OptionVO { 7 | 8 | // Testable constants 9 | //public static const MY_CONST:String = 'myConstant'; 10 | 11 | //-------------------------------------------------------------------------- 12 | // 13 | // Initialization 14 | // 15 | //-------------------------------------------------------------------------- 16 | 17 | public function OptionVOSupport(id:uint = 1) { 18 | // pass constants to the super constructor for properties 19 | var title:String = "Option title " + id.toString(); 20 | var consequences:Vector. = new Vector.(); 21 | consequences.push(CommandSupport); 22 | super(id, title, consequences); 23 | } 24 | 25 | //-------------------------------------------------------------------------- 26 | // 27 | // Overridden API 28 | // 29 | //-------------------------------------------------------------------------- 30 | 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /test/config/SurprisesXMLImporterTest.as: -------------------------------------------------------------------------------- 1 | package config { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | public class SurprisesXMLImporterTest extends TestCase { 6 | private var instance:SurprisesXMLImporter; 7 | 8 | public function SurprisesXMLImporterTest(methodName:String=null) { 9 | super(methodName); 10 | } 11 | 12 | override protected function setUp():void { 13 | super.setUp(); 14 | instance = new SurprisesXMLImporter(); 15 | } 16 | 17 | override protected function tearDown():void { 18 | super.tearDown(); 19 | instance = null; 20 | } 21 | 22 | public function testInstantiated():void { 23 | assertTrue("instance is SurprisesXMLImporter", instance is SurprisesXMLImporter); 24 | } 25 | 26 | public function testFailure():void { 27 | assertTrue("Failing test", true); 28 | } 29 | 30 | public function test_supplies_xml():void { 31 | assertTrue("Supplies xml", instance.surprisesXML != null); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/strategy/PyramidGameContextTest.as: -------------------------------------------------------------------------------- 1 | package strategy { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Context; 6 | 7 | public class PyramidGameContextTest extends TestCase { 8 | private var instance:PyramidGameContext; 9 | 10 | public function PyramidGameContextTest(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | instance = new PyramidGameContext(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | instance = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("instance is PyramidGameContext", instance is PyramidGameContext); 26 | } 27 | 28 | public function testIsContext():void{ 29 | assertTrue("instance is robotlegs Context", instance is Context); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", true); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /test/strategy/controller/commands/StartViewCommandTest.as: -------------------------------------------------------------------------------- 1 | package strategy.controller.commands { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Command; 6 | import flash.display.Sprite; 7 | 8 | public class StartViewCommandTest extends TestCase { 9 | private var instance:StartViewCommand; 10 | 11 | public function StartViewCommandTest(methodName:String=null) { 12 | super(methodName) 13 | } 14 | 15 | override protected function setUp():void { 16 | super.setUp(); 17 | instance = new StartViewCommand(); 18 | instance.contextView = new Sprite(); 19 | } 20 | 21 | override protected function tearDown():void { 22 | super.tearDown(); 23 | instance = null; 24 | } 25 | 26 | public function testInstantiated():void { 27 | assertTrue("instance is StartViewCommand", instance is StartViewCommand); 28 | } 29 | 30 | public function testIsCommand():void{ 31 | assertTrue("instance is robotlegs Command", instance is Command); 32 | } 33 | 34 | public function testFailure():void { 35 | assertTrue("Failing test", true); 36 | } 37 | 38 | public function testExecute():void { 39 | assertTrue("Execute returns void", (instance.execute() == void)); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /test/strategy/model/FirstGameConfigTest.as: -------------------------------------------------------------------------------- 1 | package strategy.model { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | public class FirstGameConfigTest extends TestCase { 6 | private var instance:FirstGameConfig; 7 | 8 | public function FirstGameConfigTest(methodName:String=null) { 9 | super(methodName) 10 | } 11 | 12 | override protected function setUp():void { 13 | super.setUp(); 14 | instance = new FirstGameConfig(); 15 | } 16 | 17 | override protected function tearDown():void { 18 | super.tearDown(); 19 | instance = null; 20 | } 21 | 22 | public function testInstantiated():void { 23 | assertTrue("instance is FirstGameConfig", instance is FirstGameConfig); 24 | } 25 | 26 | public function testFailure():void { 27 | assertTrue("Failing test", true); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /test/strategy/model/gameplay/dilemmas/WeekendWorkingDilemmaTest.as: -------------------------------------------------------------------------------- 1 | package strategy.model.gameplay.dilemmas { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | public class WeekendWorkingDilemmaTest extends TestCase { 6 | private var instance:WeekendWorkingDilemma; 7 | 8 | public function WeekendWorkingDilemmaTest(methodName:String=null) { 9 | super(methodName) 10 | } 11 | 12 | override protected function setUp():void { 13 | super.setUp(); 14 | instance = new WeekendWorkingDilemma(); 15 | } 16 | 17 | override protected function tearDown():void { 18 | super.tearDown(); 19 | instance = null; 20 | } 21 | 22 | public function testInstantiated():void { 23 | assertTrue("instance is WeekendWorkingDilemma", instance is WeekendWorkingDilemma); 24 | } 25 | 26 | public function testFailure():void { 27 | assertTrue("Failing test", true); 28 | } 29 | 30 | public function test_has_2_options():void { 31 | assertEquals("Has 2 options", 2, instance.options.length); 32 | } 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /test/strategy/model/markets/LabourAvailabilityMarketTest.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Actor; 6 | 7 | public class LabourAvailabilityMarketTest extends TestCase { 8 | private var instance:LabourAvailabilityMarket; 9 | 10 | public function LabourAvailabilityMarketTest(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | instance = new LabourAvailabilityMarket(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | instance = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("instance is LabourAvailabilityMarket", instance is LabourAvailabilityMarket); 26 | } 27 | 28 | public function testIsModel():void{ 29 | assertTrue("instance is robotlegs Actor", instance is Actor); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", true); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /test/strategy/model/markets/LabourPriceMarketTest.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Actor; 6 | 7 | public class LabourPriceMarketTest extends TestCase { 8 | private var instance:LabourPriceMarket; 9 | 10 | public function LabourPriceMarketTest(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | instance = new LabourPriceMarket(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | instance = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("instance is LabourPriceMarket", instance is LabourPriceMarket); 26 | } 27 | 28 | public function testIsModel():void{ 29 | assertTrue("instance is robotlegs Actor", instance is Actor); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", true); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /test/strategy/model/markets/StoneAvailabilityMarketTest.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Actor; 6 | import flash.events.EventDispatcher; 7 | 8 | public class StoneAvailabilityMarketTest extends TestCase { 9 | private var instance:StoneAvailabilityMarket; 10 | 11 | public function StoneAvailabilityMarketTest(methodName:String=null) { 12 | super(methodName) 13 | } 14 | 15 | override protected function setUp():void { 16 | super.setUp(); 17 | instance = new StoneAvailabilityMarket(); 18 | instance.eventDispatcher = new EventDispatcher(); 19 | } 20 | 21 | override protected function tearDown():void { 22 | super.tearDown(); 23 | instance = null; 24 | } 25 | 26 | public function testInstantiated():void { 27 | assertTrue("instance is StoneAvailabilityMarket", instance is StoneAvailabilityMarket); 28 | } 29 | 30 | public function testIsModel():void{ 31 | assertTrue("instance is robotlegs Actor", instance is Actor); 32 | } 33 | 34 | public function testFailure():void { 35 | assertTrue("Failing test", true); 36 | } 37 | 38 | public function test_get_currentValue():void { 39 | assertEquals("Get currentValue", (instance.min + instance.max)/2, instance.currentValue); 40 | } 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /test/strategy/model/markets/StonePriceMarketTest.as: -------------------------------------------------------------------------------- 1 | package strategy.model.markets { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Actor; 6 | 7 | public class StonePriceMarketTest extends TestCase { 8 | private var instance:StonePriceMarket; 9 | 10 | public function StonePriceMarketTest(methodName:String=null) { 11 | super(methodName) 12 | } 13 | 14 | override protected function setUp():void { 15 | super.setUp(); 16 | instance = new StonePriceMarket(); 17 | } 18 | 19 | override protected function tearDown():void { 20 | super.tearDown(); 21 | instance = null; 22 | } 23 | 24 | public function testInstantiated():void { 25 | assertTrue("instance is StonePriceMarket", instance is StonePriceMarket); 26 | } 27 | 28 | public function testIsModel():void{ 29 | assertTrue("instance is robotlegs Actor", instance is Actor); 30 | } 31 | 32 | public function testFailure():void { 33 | assertTrue("Failing test", true); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /test/strategy/view/PyramidProgressViewMediatorTest.as: -------------------------------------------------------------------------------- 1 | package strategy.view { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Mediator; 6 | import flash.events.EventDispatcher; 7 | 8 | public class PyramidProgressViewMediatorTest extends TestCase { 9 | private var instanceMediator:PyramidProgressViewMediator; 10 | 11 | public function PyramidProgressViewMediatorTest(methodName:String=null) { 12 | super(methodName) 13 | } 14 | 15 | override protected function setUp():void { 16 | super.setUp(); 17 | instanceMediator = new PyramidProgressViewMediator(); 18 | instanceMediator.view = new PyramidProgressView(); 19 | instanceMediator.eventDispatcher = new EventDispatcher(); 20 | instanceMediator.onRegister(); 21 | } 22 | 23 | override protected function tearDown():void { 24 | super.tearDown(); 25 | instanceMediator = null; 26 | } 27 | 28 | public function testInstantiated():void { 29 | assertTrue("instanceMediator is PyramidProgressViewMediator", instanceMediator is PyramidProgressViewMediator); 30 | } 31 | 32 | public function testIsMediator():void{ 33 | assertTrue("instanceMediator is robotlegs Mediator", instanceMediator is Mediator); 34 | } 35 | 36 | public function testFailure():void { 37 | assertTrue("Failing test", true); 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /test/strategy/view/SkyViewMediatorTest.as: -------------------------------------------------------------------------------- 1 | package strategy.view { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Mediator; 6 | import flash.events.EventDispatcher; 7 | 8 | public class SkyViewMediatorTest extends TestCase { 9 | private var skyViewMediator:SkyViewMediator; 10 | 11 | public function SkyViewMediatorTest(methodName:String=null) { 12 | super(methodName) 13 | } 14 | 15 | override protected function setUp():void { 16 | super.setUp(); 17 | skyViewMediator = new SkyViewMediator(); 18 | skyViewMediator.view = new SkyView(); 19 | skyViewMediator.eventDispatcher = new EventDispatcher(); 20 | skyViewMediator.onRegister(); 21 | } 22 | 23 | override protected function tearDown():void { 24 | super.tearDown(); 25 | skyViewMediator = null; 26 | } 27 | 28 | public function testInstantiated():void { 29 | assertTrue("skyViewMediator is SkyViewMediator", skyViewMediator is SkyViewMediator); 30 | } 31 | 32 | public function testIsMediator():void{ 33 | assertTrue("skyViewMediator is robotlegs Mediator", skyViewMediator is Mediator); 34 | } 35 | 36 | public function testFailure():void { 37 | assertTrue("Failing test", true); 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /test/strategy/view/SkyViewTest.as: -------------------------------------------------------------------------------- 1 | package strategy.view { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import flash.display.Sprite; 6 | import strategy.view.SkyView; 7 | 8 | public class SkyViewTest extends TestCase { 9 | private var skyView:SkyView; 10 | 11 | public function SkyViewTest(methodName:String=null) { 12 | super(methodName) 13 | } 14 | 15 | override protected function setUp():void { 16 | super.setUp(); 17 | skyView = new SkyView(); 18 | } 19 | 20 | override protected function tearDown():void { 21 | super.tearDown(); 22 | skyView = null; 23 | } 24 | 25 | public function testInstantiated():void { 26 | assertTrue("skyView is SkyView", skyView is SkyView); 27 | } 28 | 29 | public function testIsSprite():void{ 30 | assertTrue("skyView is Sprite", skyView is Sprite); 31 | } 32 | 33 | public function testFailure():void { 34 | assertTrue("Failing test", true); 35 | } 36 | 37 | public function test_moveTo_50():void { 38 | addChild(skyView); 39 | skyView.showDayPercentage(50); 40 | assertTrue("verified visually", true); 41 | removeChild(skyView); 42 | } 43 | 44 | public function test_night():void { 45 | addChild(skyView); 46 | skyView.night(); 47 | assertTrue("verified visually", true); 48 | removeChild(skyView); 49 | } 50 | 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /test/strategy/view/WorkerViewTest.as: -------------------------------------------------------------------------------- 1 | package strategy.view { 2 | 3 | import asunit.framework.TestCase; 4 | import flash.display.Sprite; 5 | 6 | public class WorkerViewTest extends TestCase { 7 | private var workerView:WorkerView; 8 | 9 | public function WorkerViewTest(methodName:String=null) { 10 | super(methodName) 11 | } 12 | 13 | override protected function setUp():void { 14 | super.setUp(); 15 | workerView = new WorkerView(workerSprite); 16 | } 17 | 18 | override protected function tearDown():void { 19 | super.tearDown(); 20 | workerView = null; 21 | } 22 | 23 | public function testInstantiated():void { 24 | assertTrue("workerView is WorkerView", workerView is WorkerView); 25 | } 26 | 27 | public function testFailure():void { 28 | assertTrue("Failing test", true); 29 | } 30 | 31 | private function get workerSprite():Sprite 32 | { 33 | var parentSprite:Sprite = new Sprite(); 34 | var childSprite:Sprite = new Sprite(); 35 | childSprite.name = 'suspended'; 36 | parentSprite.addChild(childSprite); 37 | return parentSprite; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /test/strategy/view/logs/LineGraphMediatorTest.as: -------------------------------------------------------------------------------- 1 | package strategy.view.logs { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import org.robotlegs.mvcs.Mediator; 6 | import flash.events.EventDispatcher; 7 | 8 | public class LineGraphMediatorTest extends TestCase { 9 | private var lineGraphMediator:LineGraphMediator; 10 | 11 | public function LineGraphMediatorTest(methodName:String=null) { 12 | super(methodName) 13 | } 14 | 15 | override protected function setUp():void { 16 | super.setUp(); 17 | lineGraphMediator = new LineGraphMediator(); 18 | lineGraphMediator.view = new LineGraph(); 19 | lineGraphMediator.eventDispatcher = new EventDispatcher(); 20 | lineGraphMediator.onRegister(); 21 | } 22 | 23 | override protected function tearDown():void { 24 | super.tearDown(); 25 | lineGraphMediator = null; 26 | } 27 | 28 | public function testInstantiated():void { 29 | assertTrue("lineGraphMediator is LineGraphMediator", lineGraphMediator is LineGraphMediator); 30 | } 31 | 32 | public function testIsMediator():void{ 33 | assertTrue("lineGraphMediator is robotlegs Mediator", lineGraphMediator is Mediator); 34 | } 35 | 36 | public function testFailure():void { 37 | assertTrue("Failing test", false); 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /todo.txt: -------------------------------------------------------------------------------- 1 | // TODO: Random Event Generator 2 | // TODO: Process random event consequences 3 | // TODO: Health and safety event generator 4 | // TODO: Environment event generator 5 | // TODO: Health and safety monitor view 6 | // TODO: Environment monitor view 7 | // TODO: Project log graphs 8 | // TODO: 5 day week, with weekend breaks 9 | // TODO: Weekends impact on energy if worked 10 | 11 | --------------------------------------------------------------------------------