├── .gitignore ├── lib ├── Moq.dll ├── UnityEditor.dll ├── UnityEngine.dll ├── nunit.framework.dll └── swiftsuspenders-sharp.dll ├── packages ├── Moq.4.5.8 │ ├── Moq.4.5.8.nupkg │ └── lib │ │ └── net45 │ │ └── Moq.dll ├── Castle.Core.3.3.3 │ ├── Changes.txt │ ├── Castle.Core.3.3.3.nupkg │ ├── lib │ │ ├── sl4 │ │ │ └── Castle.Core.dll │ │ ├── sl5 │ │ │ └── Castle.Core.dll │ │ ├── net35 │ │ │ └── Castle.Core.dll │ │ ├── net45 │ │ │ └── Castle.Core.dll │ │ └── net40-client │ │ │ └── Castle.Core.dll │ ├── readme.txt │ └── License.txt └── NUnitTestAdapter.WithFramework.2.0.0 │ ├── lib │ ├── nunit.core.dll │ ├── nunit.util.dll │ ├── nunit.framework.dll │ ├── nunit.core.interfaces.dll │ └── NUnit.VisualStudio.TestAdapter.dll │ ├── NUnitTestAdapter.WithFramework.2.0.0.nupkg │ └── tools │ └── install.ps1 ├── src └── Robotlegs │ └── Bender │ ├── Extensions │ ├── Vigilance │ │ ├── readme.md │ │ └── VigilantException.cs │ ├── Modularity │ │ ├── DSL │ │ │ ├── ModuleChannels.cs │ │ │ └── IModuleConnectionAction.cs │ │ ├── API │ │ │ └── IModuleConnector.cs │ │ └── Impl │ │ │ └── ModularContextEvent.cs │ ├── CommandCenter │ │ ├── API │ │ │ ├── ICommand.cs │ │ │ ├── ICommandTrigger.cs │ │ │ └── ICommandExecutor.cs │ │ ├── DSL │ │ │ ├── ICommandMapper.cs │ │ │ └── ICommandUnmapper.cs │ │ └── Impl │ │ │ └── NullCommandTrigger.cs │ ├── ContextViews │ │ ├── API │ │ │ └── IContextView.cs │ │ ├── Impl │ │ │ └── ContextView.cs │ │ ├── ContextViewListenerConfig.cs │ │ └── readme.md │ ├── Matching │ │ ├── ITypeMatcher.cs │ │ ├── ITypeMatcherFactory.cs │ │ ├── ITypeFilter.cs │ │ ├── AssignableFromMatcher.cs │ │ ├── InstanceOfMatcher.cs │ │ └── TypeMatcherException.cs │ ├── Mediation │ │ ├── API │ │ │ ├── IView.cs │ │ │ ├── IEventView.cs │ │ │ └── IMediator.cs │ │ ├── DSL │ │ │ ├── IMediatorViewHandler.cs │ │ │ ├── IMediatorManager.cs │ │ │ ├── IMediatorFactory.cs │ │ │ ├── IMediatorUnmapper.cs │ │ │ └── IMediatorMapper.cs │ │ └── Impl │ │ │ └── NullMediatorUnmapper.cs │ ├── EventManagement │ │ ├── API │ │ │ ├── IEvent.cs │ │ │ ├── IDispatcher.cs │ │ │ ├── IEventDispatcher.cs │ │ │ └── LifecycleEvent.cs │ │ ├── readme.md │ │ └── Impl │ │ │ └── Event.cs │ ├── ViewManagement │ │ ├── API │ │ │ ├── IViewHandler.cs │ │ │ ├── IStageCrawler.cs │ │ │ ├── IViewStateWatcher.cs │ │ │ ├── IViewManager.cs │ │ │ └── IParentFinder.cs │ │ ├── StageObserverExtension.md │ │ ├── StageCrawlerExtension.md │ │ ├── Impl │ │ │ ├── BlankViewStateWatcherExtension.cs │ │ │ ├── BlankParentFinder.cs │ │ │ └── StageCrawler.cs │ │ └── ManualStageObserverExtension.md │ ├── EnhancedLogging │ │ ├── ConsoleLoggingExtension.cs │ │ ├── InjectableLoggerExtension.cs │ │ ├── readme.md │ │ └── InjectorActivityLoggingExtension.cs │ ├── ViewProcessor │ │ ├── Impl │ │ │ ├── IViewProcessorViewHandler.cs │ │ │ ├── IViewProcessorFactory.cs │ │ │ ├── NullProcessor.cs │ │ │ └── NullViewProcessorUnmapper.cs │ │ ├── API │ │ │ └── ViewProcessorMapException.cs │ │ └── DSL │ │ │ ├── IViewProcessorMappingConfig.cs │ │ │ ├── IViewProcessorUnmapper.cs │ │ │ └── IViewProcessorMapping.cs │ ├── LocalEventMap │ │ ├── API │ │ │ └── IEventMap.cs │ │ └── LocalEventMapExtension.cs │ ├── DirectCommand │ │ ├── DirectCommandMapExtension.cs │ │ ├── API │ │ │ ├── IDirectCommandMapper.cs │ │ │ └── IDirectCommandMap.cs │ │ └── DSL │ │ │ └── IDirectCommandConfigurator.cs │ └── EventCommand │ │ ├── EventCommandMapExtension.cs │ │ └── API │ │ └── IEventCommandMap.cs │ ├── Framework │ ├── API │ │ ├── IBundle.cs │ │ ├── IHook.cs │ │ ├── IGuard.cs │ │ ├── IConfig.cs │ │ ├── IMatcher.cs │ │ ├── IExtension.cs │ │ ├── IPinEvent.cs │ │ ├── LifecycleState.cs │ │ ├── MessageDispatcherDelegate.cs │ │ ├── ILogTarget.cs │ │ ├── ILifecycleEvent.cs │ │ ├── LifecycleException.cs │ │ └── ILogging.cs │ └── Impl │ │ ├── LogLevel.cs │ │ └── ConfigManager.md │ └── Platforms │ └── Unity │ ├── Extensions │ ├── DebugLogging │ │ └── DebugLoggingExtension.cs │ ├── Mediation │ │ ├── UnityMediatorManagerExtension.cs │ │ └── Impl │ │ │ ├── EventView.cs │ │ │ └── View.cs │ ├── ContextViews │ │ ├── UnityStageCrawlerConfig.cs │ │ └── UnityFallbackStageCrawlerConfig.cs │ └── ViewManagement │ │ ├── Impl │ │ ├── UnityFallbackStageCrawler.cs │ │ ├── UnityViewStateWatcherExtension.cs │ │ └── UnityStageCrawler.cs │ │ └── UnityParentFinderExtension.cs │ └── DependencyProviders │ ├── UnityComponentProvider.cs │ └── UnitySingletonComponentProvider.cs ├── packages.config ├── tests └── Robotlegs │ └── Bender │ ├── Extensions │ ├── Matching │ │ ├── Support │ │ │ ├── IType1.cs │ │ │ ├── IType2.cs │ │ │ ├── ITypeX.cs │ │ │ ├── ITypeY.cs │ │ │ ├── TypeA.cs │ │ │ ├── TypeB.cs │ │ │ ├── TypeA1.cs │ │ │ ├── C │ │ │ │ └── PackagedTypeC.cs │ │ │ ├── A │ │ │ │ └── PackagedTypeA.cs │ │ │ ├── B │ │ │ │ └── PackagedTypeB.cs │ │ │ ├── TypeA12.cs │ │ │ └── TypeB12.cs │ │ └── InstanceOfMatcherTest.cs │ ├── Mediation │ │ ├── Support │ │ │ ├── NullMediator.cs │ │ │ ├── NullMediator2.cs │ │ │ └── CallbackMediator.cs │ │ └── Impl │ │ │ └── Support │ │ │ ├── MediatorWatcher.cs │ │ │ ├── MediatorViewHandlerStub.cs │ │ │ ├── MediatorWeakMapTracker.cs │ │ │ ├── SugaryMediator.cs │ │ │ └── SupportMediator.cs │ ├── CommandCenter │ │ └── Support │ │ │ ├── CallbackCommand2.cs │ │ │ ├── CallbackCommand.cs │ │ │ ├── NullCommand.cs │ │ │ ├── NullCommand2.cs │ │ │ ├── NullCommand3.cs │ │ │ ├── IncorrectExecuteCommand.cs │ │ │ ├── UnmapperStub.cs │ │ │ ├── PriorityMappingComparer.cs │ │ │ ├── MessageReturningCommand.cs │ │ │ ├── ReportMethodCommand.cs │ │ │ ├── SelfReportingCallbackCommand.cs │ │ │ ├── PriorityMapping.cs │ │ │ ├── ExecutelessCommand.cs │ │ │ ├── ClassReportingCallbackHook.cs │ │ │ ├── MethodParametersCommand.cs │ │ │ ├── SelfReportingCallbackHook.cs │ │ │ ├── CommandMapStub.cs │ │ │ ├── ClassReportingCallbackCommand.cs │ │ │ ├── ClassReportingCallbackCommand2.cs │ │ │ ├── ClassReportingCallbackGuard.cs │ │ │ ├── ClassReportingCallbackGuard2.cs │ │ │ ├── AbstractInterfaceImplementingCommand.cs │ │ │ ├── PayloadInjectionPointsHook.cs │ │ │ ├── PayloadInjectionPointsCommand.cs │ │ │ ├── OptionalInjectionPointsCommand.cs │ │ │ ├── PayloadInjectionPointsGuard.cs │ │ │ └── OptionalInjectionPointsCommandInstantiatingCommand.cs │ ├── EventManagement │ │ └── Support │ │ │ ├── BlankEvent.cs │ │ │ └── CustomEvent.cs │ ├── LocalEventMap │ │ └── Impl │ │ │ └── Support │ │ │ └── CustomEvent.cs │ ├── ViewProcessor │ │ └── Support │ │ │ ├── ITrackingProcessor.cs │ │ │ ├── NullProcessor2.cs │ │ │ └── Processor.cs │ ├── ViewManagement │ │ └── Support │ │ │ ├── SupportEventView.cs │ │ │ ├── TestSupportViewStateWatcherExtension.cs │ │ │ ├── TreeContainerSupport.cs │ │ │ ├── SupportContainer.cs │ │ │ ├── CustomParentFinder.cs │ │ │ └── SupportParentFinderExtension.cs │ ├── EventCommand │ │ └── Support │ │ │ ├── SupportEvent.cs │ │ │ ├── EventParametersCommand.cs │ │ │ ├── EventInjectedCallbackCommand.cs │ │ │ ├── EventInjectedCallbackGuard.cs │ │ │ ├── CommandMappingCommand.cs │ │ │ ├── CommandUnmappingCommand.cs │ │ │ └── SupportEventTriggeredSelfReportingCallbackCommand.cs │ ├── EnhancedLogging │ │ ├── Impl │ │ │ └── ConsoleLogTargetTest.cs │ │ └── ConsoleLoggingExtensionTest.cs │ ├── DirectCommand │ │ └── Support │ │ │ └── DirectCommandMapReportingCommand.cs │ └── Modularity │ │ └── Impl │ │ └── LogLevelTarget.cs │ ├── Framework │ └── Impl │ │ ├── GuardSupport │ │ ├── GrumpyGuard.cs │ │ ├── HappyGuard.cs │ │ ├── BossGuard.cs │ │ └── JustTheMIddleManGuard.cs │ │ ├── ConfigSupport │ │ ├── UntypedConfig.cs │ │ ├── PlainConfig.cs │ │ └── TypedConfig.cs │ │ ├── ContextSupport │ │ └── CallbackConfig.cs │ │ ├── LoggingSupport │ │ └── LogParams.cs │ │ └── HookSupport │ │ └── CallbackHook.cs │ └── Bundles │ └── MVCS │ └── MVCSBundleTest.cs ├── robotlegs-sharp-framework.sln ├── LICENSE ├── .travis.yml └── robotlegs-sharp-platform-unity.sln /.gitignore: -------------------------------------------------------------------------------- 1 | *.meta 2 | obj 3 | *.userprefs 4 | bin 5 | *.zip 6 | .vs -------------------------------------------------------------------------------- /lib/Moq.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/lib/Moq.dll -------------------------------------------------------------------------------- /lib/UnityEditor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/lib/UnityEditor.dll -------------------------------------------------------------------------------- /lib/UnityEngine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/lib/UnityEngine.dll -------------------------------------------------------------------------------- /lib/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/lib/nunit.framework.dll -------------------------------------------------------------------------------- /lib/swiftsuspenders-sharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/lib/swiftsuspenders-sharp.dll -------------------------------------------------------------------------------- /packages/Moq.4.5.8/Moq.4.5.8.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Moq.4.5.8/Moq.4.5.8.nupkg -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/Changes.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Castle.Core.3.3.3/Changes.txt -------------------------------------------------------------------------------- /packages/Moq.4.5.8/lib/net45/Moq.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Moq.4.5.8/lib/net45/Moq.dll -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/Castle.Core.3.3.3.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Castle.Core.3.3.3/Castle.Core.3.3.3.nupkg -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/lib/sl4/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Castle.Core.3.3.3/lib/sl4/Castle.Core.dll -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/lib/sl5/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Castle.Core.3.3.3/lib/sl5/Castle.Core.dll -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/lib/net35/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Castle.Core.3.3.3/lib/net35/Castle.Core.dll -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/lib/net45/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Castle.Core.3.3.3/lib/net45/Castle.Core.dll -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/lib/net40-client/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/Castle.Core.3.3.3/lib/net40-client/Castle.Core.dll -------------------------------------------------------------------------------- /packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.core.dll -------------------------------------------------------------------------------- /packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.util.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.util.dll -------------------------------------------------------------------------------- /packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.framework.dll -------------------------------------------------------------------------------- /packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.core.interfaces.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/NUnitTestAdapter.WithFramework.2.0.0/lib/nunit.core.interfaces.dll -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Vigilance/readme.md: -------------------------------------------------------------------------------- 1 | # Vigilance Extension 2 | 3 | ## Overview 4 | 5 | The Vigilance Extension throws Errors when warnings, errors or fatal messages are logged. This keeps the good times rolling. -------------------------------------------------------------------------------- /packages/NUnitTestAdapter.WithFramework.2.0.0/lib/NUnit.VisualStudio.TestAdapter.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/NUnitTestAdapter.WithFramework.2.0.0/lib/NUnit.VisualStudio.TestAdapter.dll -------------------------------------------------------------------------------- /packages/NUnitTestAdapter.WithFramework.2.0.0/NUnitTestAdapter.WithFramework.2.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotlegs-sharp/robotlegs-sharp-framework/HEAD/packages/NUnitTestAdapter.WithFramework.2.0.0/NUnitTestAdapter.WithFramework.2.0.0.nupkg -------------------------------------------------------------------------------- /packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/NUnitTestAdapter.WithFramework.2.0.0/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | $asms = $package.AssemblyReferences | %{$_.Name} 3 | foreach ($reference in $project.Object.References) 4 | { 5 | if ($asms -contains $reference.Name + ".dll") 6 | { 7 | if ($reference.Name -ne "nunit.framework") 8 | { 9 | $reference.CopyLocal = $false; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/IBundle.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public interface IBundle : IExtension 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/IHook.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public interface IHook 11 | { 12 | void Hook (); 13 | } 14 | } -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/readme.txt: -------------------------------------------------------------------------------- 1 | Thanks for downloading this Castle package. 2 | You can find full list of changes in changes.txt 3 | 4 | Documentation (work in progress, contributions appreciated): 5 | Dictionary Adapter - http://docs.castleproject.org/Tools.Castle-DictionaryAdapter.ashx 6 | DynamicProxy - http://docs.castleproject.org/Tools.DynamicProxy.ashx 7 | Discusssion group: - http://groups.google.com/group/castle-project-users 8 | StackOverflow tags: - castle-dynamicproxy, castle-dictionaryadapter, castle 9 | 10 | Issue tracker: - http://issues.castleproject.org/dashboard -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/IGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public interface IGuard 11 | { 12 | bool Approve (); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/IConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public interface IConfig 11 | { 12 | void Configure (); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/IType1.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public interface IType1 12 | { 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/IType2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public interface IType2 12 | { 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/ITypeX.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public interface ITypeX 12 | { 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/ITypeY.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public interface ITypeY 12 | { 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Support/NullMediator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Mediation.Support 9 | { 10 | 11 | public class NullMediator 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Support/NullMediator2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Mediation.Support 9 | { 10 | 11 | public class NullMediator2 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Modularity/DSL/ModuleChannels.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Modularity.DSL 9 | { 10 | public enum ModuleChannels 11 | { 12 | Global 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/IMatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public interface IMatcher 11 | { 12 | bool Matches(object item); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/CommandCenter/API/ICommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.CommandCenter.API 9 | { 10 | public interface ICommand 11 | { 12 | void Execute(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/IExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public interface IExtension 11 | { 12 | void Extend(IContext context); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ContextViews/API/IContextView.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.ContextViews.API 9 | { 10 | public interface IContextView 11 | { 12 | object view { get; } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Matching/ITypeMatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching 9 | { 10 | public interface ITypeMatcher 11 | { 12 | ITypeFilter CreateTypeFilter(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/API/IView.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.Mediation.API 11 | { 12 | public interface IView 13 | { 14 | event Action RemoveView; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventManagement/API/IEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.EventManagement.API 11 | { 12 | public interface IEvent 13 | { 14 | Enum type { get; } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Matching/ITypeMatcherFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching 9 | { 10 | public interface ITypeMatcherFactory : ITypeMatcher 11 | { 12 | TypeMatcher Clone(); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/CallbackCommand2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class CallbackCommand2 : CallbackCommand 13 | { 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventManagement/API/IDispatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.EventManagement.API 11 | { 12 | public interface IDispatcher 13 | { 14 | void Dispatch (IEvent evt); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/Impl/LogLevel.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.Impl 9 | { 10 | public enum LogLevel 11 | { 12 | FATAL = 2, 13 | ERROR = 4, 14 | WARN = 8, 15 | INFO = 16, 16 | DEBUG = 32 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/API/IViewHandler.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.API 11 | { 12 | public interface IViewHandler 13 | { 14 | void HandleView(object view, Type type); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/IPinEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.API 11 | { 12 | public interface IPinEvent 13 | { 14 | event Action Detained; 15 | event Action Released; 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /packages/Castle.Core.3.3.3/License.txt: -------------------------------------------------------------------------------- 1 | Copyright 2004-2014 Castle Project - http://www.castleproject.org/ 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Vigilance/VigilantException.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.Vigilance 11 | { 12 | public class VigilantException : Exception 13 | { 14 | public VigilantException (string message) : base (message) {} 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/GuardSupport/GrumpyGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.GuardSupport 11 | { 12 | public class HappyGuard 13 | { 14 | public bool Approve() 15 | { 16 | return true; 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/GuardSupport/HappyGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.GuardSupport 11 | { 12 | public class GrumpyGuard 13 | { 14 | public bool Approve() 15 | { 16 | return false; 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/API/IStageCrawler.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewManagement.Impl; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.API 11 | { 12 | public interface IStageCrawler 13 | { 14 | ContainerBinding Binding { set; } 15 | void Scan(object view); 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/LifecycleState.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public enum LifecycleState 11 | { 12 | UNINITIALIZED, 13 | INITIALIZING, 14 | ACTIVE, 15 | SUSPENDING, 16 | SUSPENDED, 17 | RESUMING, 18 | DESTROYING, 19 | DESTROYED 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/StageObserverExtension.md: -------------------------------------------------------------------------------- 1 | # Stage Observer Extension 2 | 3 | ## Overview 4 | 5 | The Stage Observer Extension adds a single instance. Which listens for everything that is Event.ADDED_TO_STAGE on all root containers in the Container Registry, and then processes the view for you. 6 | 7 | It will listen for removal and new root containers and adjust it's listeners appropriatley. 8 | 9 | The Stage Observer has a static instance stored in the extension but will destory/cleanup when all context's have been destroyed. 10 | 11 | ## How to Install 12 | 13 | This extension is already installed in the MVCS bundle, but if you're not using that: 14 | 15 | ```as3 16 | context.install(StageObserverExtension); 17 | ``` -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/API/IEventView.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EventManagement.API; 9 | using Robotlegs.Bender.Extensions.Mediation.API; 10 | 11 | 12 | namespace Robotlegs.Bender.Extensions.Mediation.API 13 | { 14 | public interface IEventView : IView 15 | { 16 | IEventDispatcher dispatcher{ get; set;} 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventManagement/Support/BlankEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.EventManagement.Support 12 | { 13 | public class BlankEvent : Event 14 | { 15 | public BlankEvent(Enum type):base(type) 16 | { 17 | 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/StageCrawlerExtension.md: -------------------------------------------------------------------------------- 1 | # Stage Crawler Extension 2 | 3 | ## Overview 4 | 5 | The Stage Crawler Extension scans and handles all views in the containers or contextview after context initialization. 6 | This enables us to handle the views that might already be on the stage before initialization which would otherwise not be processed (or mediated). 7 | 8 | It is reliant on either a IViewManager or a ContextView upon initializtion. 9 | 10 | ## How to Install 11 | 12 | This extension is already installed in the MVCS bundle, but if you're not using that: 13 | 14 | ```as3 15 | context.install(StageCrawlerExtension); 16 | ``` 17 | 18 | Then after the context has been initialized, the containers will be scanned and then the views will be processed. -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/CallbackCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class CallbackCommand 13 | { 14 | [Inject("ExecuteCallback")] 15 | public Action callback; 16 | 17 | public void Execute() 18 | { 19 | callback (); 20 | } 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Bundles/MVCS/MVCSBundleTest.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Robotlegs.Bender.Framework.API; 3 | using Robotlegs.Bender.Framework.Impl; 4 | 5 | namespace Robotlegs.Bender.Bundles.MVCS 6 | { 7 | [TestFixture] 8 | public class MVCSBundleTest 9 | { 10 | /*============================================================================*/ 11 | /* Tests */ 12 | /*============================================================================*/ 13 | 14 | [Test] 15 | public void MVCSBundleInstalls() 16 | { 17 | IContext context = new Context (); 18 | context.Install (); 19 | context.Initialize (); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/GuardSupport/BossGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.GuardSupport 11 | { 12 | public class JustTheMiddleManGuard 13 | { 14 | [Inject] 15 | public BossGuard bossDecision; 16 | 17 | public bool Approve() 18 | { 19 | return bossDecision.Approve(); 20 | } 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Modularity/DSL/IModuleConnectionAction.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.Modularity.DSL 11 | { 12 | public interface IModuleConnectionAction 13 | { 14 | 15 | IModuleConnectionAction RelayEvent(Enum eventType); 16 | 17 | IModuleConnectionAction ReceiveEvent(Enum eventType); 18 | 19 | void Suspend(); 20 | 21 | void Resume(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/API/IViewStateWatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.API 11 | { 12 | public interface IViewStateWatcher 13 | { 14 | bool isAdded { get; } 15 | 16 | event Action added; 17 | event Action removed; 18 | event Action disabled; 19 | event Action enabled; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/LocalEventMap/Impl/Support/CustomEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 8 | 9 | namespace Robotlegs.Bender.Extensions.LocalEventMap.Impl.Support 10 | { 11 | public class CustomEvent : Event 12 | { 13 | public enum Type 14 | { 15 | STARTED 16 | } 17 | 18 | public CustomEvent(Type type) : base(type) 19 | { 20 | 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventManagement/readme.md: -------------------------------------------------------------------------------- 1 | # Event Dispatcher Extension 2 | 3 | ## Overview 4 | 5 | The event dispatcher extension simply maps a shared event dispatcher into a context. The extension is required by many event driven extensions. 6 | 7 | ## Extension Installation 8 | 9 | ```as3 10 | _context = new Context() 11 | .install(EventDispatcherExtension); 12 | ``` 13 | 14 | You can provide the dispatcher instance you wish to use manually if you so desire: 15 | 16 | ```as3 17 | _context = new Context() 18 | .install(new EventDispatcherExtension(dispatcher)); 19 | ``` 20 | 21 | ## Extension Usage 22 | 23 | An instance of IEventDispatcher is mapped into the context during extension installation. This instance can be injected into clients. 24 | 25 | ```as3 26 | [Inject] 27 | public var eventDispatcher:IEventDispatcher; 28 | ``` -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Matching/ITypeFilter.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using Robotlegs.Bender.Framework.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.Matching 13 | { 14 | public interface ITypeFilter : IMatcher 15 | { 16 | List AllOfTypes {get;} 17 | List AnyOfTypes {get;} 18 | List NoneOfTypes {get;} 19 | string Descriptor {get;} 20 | } 21 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/DSL/IMediatorViewHandler.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.Mediation.API; 9 | using Robotlegs.Bender.Extensions.ViewManagement.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.Mediation.DSL 12 | { 13 | public interface IMediatorViewHandler : IViewHandler 14 | { 15 | void AddMapping (IMediatorMapping mapping); 16 | 17 | void RemoveMapping (IMediatorMapping mapping); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewProcessor/Support/ITrackingProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewProcessor.Support 12 | { 13 | public interface ITrackingProcessor 14 | { 15 | void Process(object view, Type type, IInjector injector); 16 | 17 | void Unprocess(object view, Type type, IInjector injector); 18 | } 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewProcessor/Support/NullProcessor2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewProcessor.Support 11 | { 12 | public class NullProcessor2 13 | { 14 | 15 | public void Process(object view, Type type, object injector) 16 | { 17 | } 18 | 19 | public void Unprocess (object view, Type type, object injector) 20 | { 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/GuardSupport/JustTheMIddleManGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.GuardSupport 11 | { 12 | public class BossGuard 13 | { 14 | protected bool _approve = false; 15 | 16 | public BossGuard(bool approve) 17 | { 18 | _approve = approve; 19 | } 20 | 21 | public bool Approve() 22 | { 23 | return _approve; 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewManagement/Support/SupportEventView.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EventManagement.API; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewManagement.Support 12 | { 13 | public class SupportEventView : SupportView 14 | { 15 | public IEventDispatcher dispatcher = new EventDispatcher(); 16 | 17 | public SupportEventView () 18 | { 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/DSL/IMediatorManager.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.Mediation.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.Mediation.DSL 12 | { 13 | public interface IMediatorManager 14 | { 15 | event Action ViewRemoved; 16 | 17 | void AddMediator (object mediator, object item, IMediatorMapping mapping); 18 | 19 | void RemoveMediator (object mediator, object item, IMediatorMapping mapping); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EnhancedLogging/ConsoleLoggingExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EnhancedLogging.Impl; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | 12 | namespace Robotlegs.Bender.Extensions.EnhancedLogging 13 | { 14 | public class ConsoleLoggingExtension : IExtension 15 | { 16 | public void Extend (IContext context) 17 | { 18 | context.AddLogTarget(new ConsoleLogTarget(context)); 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/DebugLogging/DebugLoggingExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Framework.API; 9 | using Robotlegs.Bender.Platforms.Unity.Extensions.DebugLogging.Impl; 10 | 11 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.DebugLogging 12 | { 13 | public class DebugLoggingExtension : IExtension 14 | { 15 | public void Extend (IContext context) 16 | { 17 | context.AddLogTarget(new DebugLogTarget(context)); 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ContextViews/Impl/ContextView.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ContextViews.API; 9 | 10 | namespace Robotlegs.Bender.Extensions.ContextViews.Impl 11 | { 12 | 13 | public class ContextView : IContextView 14 | { 15 | private object _view; 16 | 17 | public ContextView (object view) 18 | { 19 | _view = view; 20 | } 21 | 22 | public object view 23 | { 24 | get 25 | { 26 | return _view; 27 | } 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /robotlegs-sharp-framework.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "robotlegs-sharp-framework", "robotlegs-sharp-framework.csproj", "{BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/Impl/BlankViewStateWatcherExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewManagement; 9 | using Robotlegs.Bender.Extensions.ViewManagement.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewManagement.Impl 12 | { 13 | public class BlankViewStateWatcherExtension : ViewStateWatcherExtension 14 | { 15 | protected override IViewStateWatcher GetViewStateWatcher (object contextView) 16 | { 17 | return null; 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EnhancedLogging/InjectableLoggerExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EnhancedLogging.Impl; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.EnhancedLogging 12 | { 13 | public class InjectableLoggerExtension : IExtension 14 | { 15 | public void Extend (IContext context) 16 | { 17 | context.injector.Map(typeof(ILogging)).ToProvider(new LoggerProvider(context)); 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventManagement/Impl/Event.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.EventManagement.Impl 12 | { 13 | [Serializable] 14 | public class Event : IEvent 15 | { 16 | private Enum _type; 17 | 18 | public Enum type 19 | { 20 | get 21 | { 22 | return _type; 23 | } 24 | } 25 | 26 | public Event (Enum type) 27 | { 28 | _type = type; 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Matching/AssignableFromMatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.Matching 12 | { 13 | public class AssignableFromMatcher : IMatcher 14 | { 15 | private Type _type; 16 | 17 | public AssignableFromMatcher(Type type) 18 | { 19 | _type = type; 20 | } 21 | 22 | public bool Matches(object item) 23 | { 24 | return item.GetType().IsAssignableFrom(_type); 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/MessageDispatcherDelegate.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | public delegate void HandlerMessageDelegate(object message); 11 | public delegate void HandlerMessageCallbackDelegate(object message, HandlerAsyncCallback callback); 12 | public delegate void HandlerAsyncCallback(object error = null); 13 | 14 | public delegate void CallbackErrorDelegate(object error); 15 | public delegate void CallbackErrorMessageDelegate(object error, object message); 16 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Matching/InstanceOfMatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.Matching 12 | { 13 | public class InstanceOfMatcher : IMatcher 14 | { 15 | private Type _type; 16 | 17 | public InstanceOfMatcher(Type type) 18 | { 19 | _type = type; 20 | } 21 | 22 | public bool Matches(object item) 23 | { 24 | return _type.IsInstanceOfType(item); 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/NullCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 9 | { 10 | public class NullCommand 11 | { 12 | /*============================================================================*/ 13 | /* Public Functions */ 14 | /*============================================================================*/ 15 | 16 | public void Execute() 17 | { 18 | 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/TypeA.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public class TypeA 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public TypeA() : base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/TypeB.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public class TypeB 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public TypeB() : base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/NullCommand2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 9 | { 10 | public class NullCommand2 11 | { 12 | /*============================================================================*/ 13 | /* Public Functions */ 14 | /*============================================================================*/ 15 | 16 | public void Execute() 17 | { 18 | 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/NullCommand3.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 9 | { 10 | public class NullCommand3 11 | { 12 | /*============================================================================*/ 13 | /* Public Functions */ 14 | /*============================================================================*/ 15 | 16 | public void Execute() 17 | { 18 | 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventManagement/Support/CustomEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.EventManagement.Support 12 | { 13 | public class CustomEvent : Event 14 | { 15 | public enum Type 16 | { 17 | A, 18 | B, 19 | C 20 | } 21 | 22 | public string message; 23 | 24 | public CustomEvent (Type type, string message) : base(type) 25 | { 26 | this.message = message; 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/CommandCenter/DSL/ICommandMapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.DSL 11 | { 12 | public interface ICommandMapper 13 | { 14 | /// 15 | /// Creates a command mapping 16 | /// 17 | /// Mapping configurator 18 | /// The Command Class to map 19 | ICommandConfigurator ToCommand(); 20 | ICommandConfigurator ToCommand(Type commandType); 21 | } 22 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/Impl/IViewProcessorViewHandler.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.ViewProcessor.DSL; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewProcessor.Impl 12 | { 13 | public interface IViewProcessorViewHandler 14 | { 15 | void AddMapping (IViewProcessorMapping mapping); 16 | 17 | void RemoveMapping (IViewProcessorMapping mapping); 18 | 19 | void ProcessItem(object item, Type type); 20 | 21 | void UnprocessItem(object item, Type type); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/TypeA1.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public class TypeA1 : TypeA, IType1 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public TypeA1() : base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/C/PackagedTypeC.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support.C 9 | { 10 | 11 | public class PackagedTypeC 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public PackagedTypeC() : base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/A/PackagedTypeA.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support.A 9 | { 10 | 11 | public class PackagedTypeA 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public PackagedTypeA() : base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/B/PackagedTypeB.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support.B 9 | { 10 | 11 | public class PackagedTypeB 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public PackagedTypeB() : base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/TypeA12.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public class TypeA12 : TypeA, IType1, IType2 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public TypeA12() : base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/Support/TypeB12.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Matching.Support 9 | { 10 | 11 | public class TypeB12 : TypeB, IType1, IType2 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | public TypeB12():base() 19 | { 20 | 21 | } 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/CommandCenter/DSL/ICommandUnmapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.DSL 11 | { 12 | public interface ICommandUnmapper 13 | { 14 | /// 15 | /// Unmaps a Command 16 | /// 17 | /// Command to unmap 18 | void FromCommand(); 19 | void FromCommand(Type commandType); 20 | 21 | /// 22 | /// Unmaps all commands from this trigger 23 | /// 24 | void FromAll(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Impl/Support/MediatorWatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | 11 | namespace Robotlegs.Bender.Extensions.Mediation.Impl.Support 12 | { 13 | public class MediatorWatcher 14 | { 15 | protected List _notifications = new List(); 16 | 17 | public List Notifications 18 | { 19 | get 20 | { 21 | return _notifications; 22 | } 23 | } 24 | 25 | public void Notify(string message) 26 | { 27 | _notifications.Add(message); 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/IncorrectExecuteCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class IncorrectExecuteCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | public string Execute = "Execute"; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/DSL/IMediatorFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using Robotlegs.Bender.Extensions.Mediation.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.Mediation.DSL 13 | { 14 | public interface IMediatorFactory 15 | { 16 | object GetMediator (object item, IMediatorMapping mapping); 17 | 18 | List CreateMediators (object item, Type type, IEnumerable mappings); 19 | 20 | void RemoveMediators (object item); 21 | 22 | void RemoveAllMediators(); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/Mediation/UnityMediatorManagerExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.Mediation.DSL; 9 | using Robotlegs.Bender.Framework.API; 10 | using Robotlegs.Bender.Platforms.Unity.Extensions.Mediation.Impl; 11 | 12 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.Mediation 13 | { 14 | public class UnityMediatorManagerExtension : IExtension 15 | { 16 | public void Extend (IContext context) 17 | { 18 | context.injector.Map (typeof(IMediatorManager)).ToSingleton (typeof(UnityMediatorManager)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventCommand/Support/SupportEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EventManagement.API; 9 | using System; 10 | 11 | 12 | namespace Robotlegs.Bender.Extensions.EventCommand.Support 13 | { 14 | public class SupportEvent : IEvent 15 | { 16 | public enum Type 17 | { 18 | TYPE1, 19 | TYPE2 20 | } 21 | private SupportEvent.Type _type; 22 | 23 | public SupportEvent (SupportEvent.Type type) 24 | { 25 | _type = type; 26 | } 27 | 28 | public Enum type 29 | { 30 | get { return _type; } 31 | } 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewProcessor/Support/Processor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System.Collections.Generic; 9 | using System; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewProcessor.Support 12 | { 13 | public class Processor 14 | { 15 | [Inject("timingTracker")] 16 | public List timingTracker; 17 | 18 | public void Process(object view, Type type, object injector) 19 | { 20 | timingTracker.Add(typeof(Processor)); 21 | } 22 | 23 | public void Unprocess(object view, Type type, object injector) 24 | { 25 | 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/Impl/ConfigManager.md: -------------------------------------------------------------------------------- 1 | # Config Manager 2 | 3 | The config manager is the part of the context that manages all objects that are passed into the 'Configure' function call for the Context. 4 | 5 | When items are passed into Configure. It is checked with all IMatchers on an object and if it passes, it can then then use the handler function on it. 6 | 7 | Config manager adds two IMatcher and Handler functions to it. 8 | 9 | * Check to see if the object is a Type. If it is it, after initialization of the context it will reflect the type into IConfig and call configure(). 10 | 11 | * Check to see if the object is an IConfig. If it is it, after initialization of the context it will call configure(). 12 | 13 | 14 | You can add new IMatchers and Handlers for anything that is passed into configure. 15 | Please be aware, that your IMatchers and IHandlers will not wait for the context to initialize before processing. This is a feature tied into the previous handlers. -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/Impl/IViewProcessorFactory.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using Robotlegs.Bender.Extensions.ViewProcessor.DSL; 11 | 12 | namespace Robotlegs.Bender.Extensions.ViewProcessor.Impl 13 | { 14 | public interface IViewProcessorFactory 15 | { 16 | void RunProcessors(object view, Type type, IEnumerable processorMappings); 17 | 18 | void RunUnprocessors(object view, Type type, IEnumerable processorMappings); 19 | 20 | void RunAllUnprocessors(); 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/Mediation/Impl/EventView.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EventManagement.API; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.Mediation.Impl 12 | { 13 | public class EventView : View 14 | { 15 | private IEventDispatcher _dispatcher = new EventDispatcher(); 16 | public IEventDispatcher dispatcher 17 | { 18 | get 19 | { 20 | return _dispatcher; 21 | } 22 | set 23 | { 24 | _dispatcher = value; 25 | } 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EnhancedLogging/Impl/ConsoleLogTargetTest.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | using NUnit.Framework; 8 | 9 | namespace Robotlegs.Bender.Extensions.EnhancedLogging.Impl 10 | { 11 | public class ConsoleLogTargetTest 12 | { 13 | 14 | /*============================================================================*/ 15 | /* Tests */ 16 | /*============================================================================*/ 17 | 18 | // [Test] 19 | public void test() 20 | { 21 | // todo: how to test? 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EnhancedLogging/ConsoleLoggingExtensionTest.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | using NUnit.Framework; 8 | 9 | namespace Robotlegs.Bender.Extensions.EnhancedLogging 10 | { 11 | 12 | public class ConsoleLoggingExtensionTest 13 | { 14 | 15 | /*============================================================================*/ 16 | /* Tests */ 17 | /*============================================================================*/ 18 | 19 | // [Test] 20 | public void test() 21 | { 22 | // todo: how to test? 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/LocalEventMap/API/IEventMap.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.LocalEventMap.API 12 | { 13 | public interface IEventMap 14 | { 15 | void MapListener(IEventDispatcher dispatcher, Enum type, Delegate listener, Type eventClass = null); 16 | 17 | void UnmapListener(IEventDispatcher dispatcher, Enum type, Delegate listener, Type eventClass = null); 18 | 19 | void UnmapListeners(); 20 | 21 | void Suspend(); 22 | 23 | void Resume(); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/DSL/IMediatorUnmapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.Mediation.DSL 11 | { 12 | /// 13 | /// Unmaps a Mediator 14 | /// 15 | public interface IMediatorUnmapper 16 | { 17 | /// 18 | /// Unmaps a mediator from this matcher 19 | /// 20 | /// Mediator to unmap 21 | void FromMediator(Type mediatorType); 22 | 23 | /// 24 | /// Unmaps all mediator mappings for this matcher 25 | /// 26 | void FromAll(); 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Matching/TypeMatcherException.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.Matching 11 | { 12 | public class TypeMatcherException : Exception 13 | { 14 | public const string EMPTY_MATCHER = "An empty matcher will create a filter which matches nothing. You should specify at least one condition for the filter."; 15 | 16 | public const string SEALED_MATCHER = "This matcher has been sealed and can no longer be configured."; 17 | 18 | public TypeMatcherException (string message) : base(message) 19 | { 20 | 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/ContextViews/UnityStageCrawlerConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewManagement.API; 9 | using Robotlegs.Bender.Framework.API; 10 | using Robotlegs.Bender.Platforms.Unity.Extensions.ViewManager.Impl; 11 | 12 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.ContextViews 13 | { 14 | public class UnityStageCrawlerConfig : IConfig 15 | { 16 | [Inject] 17 | public IInjector injector {get;set;} 18 | 19 | public void Configure () 20 | { 21 | injector.Map (typeof(IStageCrawler)).ToType (typeof(UnityStageCrawler)); 22 | } 23 | 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/CommandCenter/API/ICommandTrigger.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.CommandCenter.API 9 | { 10 | public interface ICommandTrigger 11 | { 12 | /// 13 | /// Invoked when the trigger should be activated. 14 | /// 15 | ///

Use this to add event listeners or Signal handlers.

16 | ///
17 | void Activate(); 18 | 19 | /// 20 | /// Invoked when the trigger should be deactivated. 21 | /// 22 | ///

Use this to remove event listeners or Signal handlers.

23 | ///
24 | void Deactivate(); 25 | } 26 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Impl/Support/MediatorViewHandlerStub.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.ViewManagement.API; 10 | using Robotlegs.Bender.Extensions.Mediation.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.Mediation.Impl.Support 13 | { 14 | public class MediatorViewHandlerStub : IViewHandler 15 | { 16 | public virtual void AddMapping(IMediatorMapping mapping) 17 | { 18 | } 19 | 20 | public virtual void RemoveMapping(IMediatorMapping mapping) 21 | { 22 | } 23 | 24 | public virtual void HandleView (object view, Type type) 25 | { 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/DSL/IMediatorMapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.Mediation.DSL 11 | { 12 | /// 13 | /// Maps a matcher to a concrete Mediator type 14 | /// 15 | public interface IMediatorMapper 16 | { 17 | /// 18 | /// Maps a matcher to a concrete Mediator type 19 | /// 20 | /// Mapping configurator 21 | /// The concrete mediator type 22 | IMediatorConfigurator ToMediator(Type mediatorType); 23 | IMediatorConfigurator ToMediator(); 24 | 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/UnmapperStub.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.CommandCenter.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 12 | { 13 | public class UnmapperStub 14 | { 15 | /*============================================================================*/ 16 | /* Public Functions */ 17 | /*============================================================================*/ 18 | 19 | public virtual void Unmap(ICommandMapping mapping) 20 | { 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/Impl/BlankParentFinder.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System.Collections.Generic; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.Impl 11 | { 12 | public class BlankParentFinder : IParentFinder 13 | { 14 | public bool Contains (object parentContainer, object childContainer) 15 | { 16 | return false; 17 | } 18 | 19 | public object FindParent (object childView, IEnumerable containers) 20 | { 21 | return null; 22 | } 23 | 24 | public object FindParent (object childView, Dictionary containers) 25 | { 26 | return null; 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Impl/Support/MediatorWeakMapTracker.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System.Collections.Generic; 9 | using Robotlegs.Bender.Extensions.Mediation.API; 10 | 11 | 12 | namespace Robotlegs.Bender.Extensions.Mediation.Impl.Support 13 | { 14 | public class MediatorWeakMapTracker 15 | { 16 | 17 | protected Dictionary _mediators = new Dictionary(); 18 | 19 | public Dictionary TrackedMediators 20 | { 21 | get 22 | { 23 | return _mediators; 24 | } 25 | } 26 | 27 | public void TrackMediator(IMediator mediator) 28 | { 29 | _mediators.Add (mediator, true); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Modularity/API/IModuleConnector.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.Modularity.DSL; 9 | 10 | namespace Robotlegs.Bender.Extensions.Modularity.API 11 | { 12 | /// 13 | /// Create event relays between modules 14 | /// 15 | public interface IModuleConnector 16 | { 17 | /// 18 | /// Connects to a specified channel. 19 | /// 20 | /// The channel Id. 21 | IModuleConnectionAction OnChannel(object channelId); 22 | 23 | /// 24 | /// Connects to the default channel 25 | /// 26 | IModuleConnectionAction OnDefaultChannel(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/Impl/NullProcessor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewProcessor.Impl 11 | { 12 | public class NullProcessor 13 | { 14 | 15 | /*============================================================================*/ 16 | /* Public Functions */ 17 | /*============================================================================*/ 18 | 19 | public void Process(object view, Type type, object injector) 20 | { 21 | } 22 | 23 | public void Unprocess(object view, Type type, object injector) 24 | { 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/Impl/NullMediatorUnmapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.Mediation.DSL; 10 | 11 | namespace Robotlegs.Bender.Extensions.Mediation.Impl 12 | { 13 | public class NullMediatorUnmapper : IMediatorUnmapper 14 | { 15 | /*============================================================================*/ 16 | /* Public Functions */ 17 | /*============================================================================*/ 18 | 19 | public void FromMediator(Type mediatorTyp) 20 | { 21 | } 22 | 23 | public void FromAll() 24 | { 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/CommandCenter/Impl/NullCommandTrigger.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.CommandCenter.API; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Impl 11 | { 12 | public class NullCommandTrigger : ICommandTrigger 13 | { 14 | /*============================================================================*/ 15 | /* Public Functions */ 16 | /*============================================================================*/ 17 | 18 | public void Activate () 19 | { 20 | 21 | } 22 | 23 | public void Deactivate () 24 | { 25 | 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/API/IViewManager.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewManagement.API 12 | { 13 | public interface IViewManager 14 | { 15 | void AddContainer(object container); 16 | void RemoveContainer(object container); 17 | void SetFallbackContainer (object container); 18 | void RemoveFallbackContainer (); 19 | void AddViewHandler(IViewHandler handler); 20 | void RemoveViewHandler(IViewHandler handler); 21 | void RemoveAllHandlers(); 22 | event Action ContainerAdded; 23 | event Action ContainerRemoved; 24 | List Containers { get; } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewManagement/Support/TestSupportViewStateWatcherExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewManagement.API; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.Support 11 | { 12 | public class TestSupportViewStateWatcherExtension : ViewStateWatcherExtension 13 | { 14 | protected override IViewStateWatcher GetViewStateWatcher(object contextView) 15 | { 16 | if (contextView is SupportView) 17 | return contextView as IViewStateWatcher; 18 | else 19 | { 20 | _logger.Warn ("contextView is not a SupportType type. Cant use the TestSupportViewStateWatcherExtension"); 21 | return null; 22 | } 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Mediation/API/IMediator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.Mediation.API 9 | { 10 | public interface IMediator 11 | { 12 | /** 13 | * Initializes the mediator. This is run automatically by the mediatorMap when a mediator is created. 14 | * Normally the initialize function is where you would add handlers using the eventMap. 15 | */ 16 | void Initialize(); 17 | 18 | /** 19 | * Destroys the mediator. This is run automatically by the mediatorMap when a mediator is destroyed. 20 | * You should clean up any handlers that were added directly (eventMap handlers will be cleaned up automatically). 21 | */ 22 | void Destroy(); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/PriorityMappingComparer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using Robotlegs.Bender.Extensions.CommandCenter.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 13 | { 14 | public class PriorityMappingComparer : IComparer 15 | { 16 | public int Compare (ICommandMapping a, ICommandMapping b) 17 | { 18 | int aPriority = (a is PriorityMapping) ? (a as PriorityMapping).priority : 0; 19 | int bPriority = (b is PriorityMapping) ? (b as PriorityMapping).priority : 0; 20 | if (aPriority == bPriority) 21 | return 0; 22 | return aPriority > bPriority ? 1 : -1; 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/DirectCommand/DirectCommandMapExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 |  8 | using Robotlegs.Bender.Extensions.DirectCommand.API; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.DirectCommand 12 | { 13 | public class DirectCommandMapExtension : IExtension 14 | { 15 | /*============================================================================*/ 16 | /* Public Functions */ 17 | /*============================================================================*/ 18 | 19 | public void Extend (IContext context) 20 | { 21 | context.injector.Map(typeof(IDirectCommandMap)).ToType(typeof(Impl.DirectCommandMap)); 22 | } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 - 2015 the original author or authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/API/ViewProcessorMapException.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewProcessor.API 11 | { 12 | public class ViewProcessorMapException : Exception 13 | { 14 | /*============================================================================*/ 15 | /* Constructor */ 16 | /*============================================================================*/ 17 | 18 | /// 19 | /// Creates a View Processor Map Error 20 | /// 21 | /// The error message 22 | public ViewProcessorMapException(string message) : base(message) 23 | { 24 | 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/DSL/IViewProcessorMappingConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.ViewProcessor.DSL 9 | { 10 | public interface IViewProcessorMappingConfig 11 | { 12 | /// 13 | /// A list of guards to consult before allowing a view to be processed 14 | /// 15 | /// Self 16 | /// A list of guards. 17 | IViewProcessorMappingConfig WithGuards(params object[] guards); 18 | 19 | /// 20 | /// A list of hooks to run before processing a view 21 | /// 22 | /// Self 23 | /// A list of hooks. 24 | IViewProcessorMappingConfig WithHooks(params object[] hooks); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/ILogTarget.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Framework.Impl; 10 | 11 | namespace Robotlegs.Bender.Framework.API 12 | { 13 | public interface ILogTarget 14 | { 15 | /// 16 | /// Captures a log message 17 | /// 18 | /// The source of the log message 19 | /// The log level of the message 20 | /// message timestamp 21 | /// The log message 22 | /// Message parameters 23 | void Log(object source, LogLevel level, DateTime timestamp, object message, params object[] messageParameters); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/ILifecycleEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.API 11 | { 12 | public interface ILifecycleEvent 13 | { 14 | event Action ERROR; 15 | 16 | event Action STATE_CHANGE; 17 | 18 | event Action PRE_INITIALIZE; 19 | event Action INITIALIZE; 20 | event Action POST_INITIALIZE; 21 | 22 | event Action PRE_SUSPEND; 23 | event Action SUSPEND; 24 | event Action POST_SUSPEND; 25 | 26 | event Action PRE_RESUME; 27 | event Action RESUME; 28 | event Action POST_RESUME; 29 | 30 | event Action PRE_DESTROY; 31 | event Action DESTROY; 32 | event Action POST_DESTROY; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/DirectCommand/API/IDirectCommandMapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.CommandCenter.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.DirectCommand.API 12 | { 13 | public interface IDirectCommandMapper 14 | { 15 | /// 16 | /// Creates a mapping for a command class 17 | /// 18 | /// The command configurator 19 | /// The concrete command class 20 | IDirectCommandConfigurator Map(Type commandClass); 21 | IDirectCommandConfigurator Map(); 22 | 23 | /// 24 | /// Executes the configured command(s) 25 | /// 26 | /// The command payload 27 | void Execute(CommandPayload payload = null); 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/Impl/NullViewProcessorUnmapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewProcessor.DSL; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewProcessor.Impl 11 | { 12 | public class NullViewProcessorUnmapper : IViewProcessorUnmapper 13 | { 14 | /*============================================================================*/ 15 | /* Public Functions */ 16 | /*============================================================================*/ 17 | 18 | public void FromProcess(object processorClassOrInstance) 19 | { 20 | } 21 | 22 | public void FromAll() 23 | { 24 | } 25 | 26 | public void FromNoProcess() 27 | { 28 | } 29 | 30 | public void FromInjection() 31 | { 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventManagement/API/IEventDispatcher.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.EventManagement.API 11 | { 12 | public interface IEventDispatcher : IDispatcher 13 | { 14 | void AddEventListener (Enum type, Action listener); 15 | void AddEventListener (Enum type, Action listener); 16 | void AddEventListener (Enum type, Action listener); 17 | void AddEventListener(Enum type, Delegate listener); 18 | void RemoveEventListener(Enum type, Action listener); 19 | void RemoveEventListener(Enum type, Action listener); 20 | void RemoveEventListener(Enum type, Action listener); 21 | void RemoveEventListener(Enum type, Delegate listener); 22 | void RemoveAllEventListeners(); 23 | bool HasEventListener (Enum type); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/Mediation/Impl/View.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.Mediation.API; 10 | using Robotlegs.Bender.Extensions.ViewManagement.API; 11 | using UnityEngine; 12 | 13 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.Mediation.Impl 14 | { 15 | public class View : MonoBehaviour, IView 16 | { 17 | public event Action RemoveView 18 | { 19 | add 20 | { 21 | _removeView += value; 22 | } 23 | remove 24 | { 25 | _removeView -= value; 26 | } 27 | } 28 | 29 | private Action _removeView; 30 | 31 | protected virtual void Start () 32 | { 33 | ViewNotifier.RegisterView(this); 34 | } 35 | 36 | protected virtual void OnDestroy () 37 | { 38 | if (_removeView != null) 39 | _removeView(this); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/ContextViews/UnityFallbackStageCrawlerConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.ViewManagement.API; 10 | using Robotlegs.Bender.Framework.API; 11 | using Robotlegs.Bender.Platforms.Unity.Extensions.ViewManager.Impl; 12 | 13 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.ContextViews 14 | { 15 | public class UnityFallbackStageCrawlerConfig : IConfig 16 | { 17 | [Inject] 18 | public IInjector injector {get;set;} 19 | 20 | public void Configure () 21 | { 22 | Type stageCrawlerInterface = typeof(IStageCrawler); 23 | if (injector.HasMapping (stageCrawlerInterface)) 24 | { 25 | injector.Unmap (stageCrawlerInterface); 26 | } 27 | injector.Map (stageCrawlerInterface).ToType (typeof(UnityFallbackStageCrawler)); 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewManagement/Support/TreeContainerSupport.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System.Collections.Generic; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.Support 11 | { 12 | public class TreeContainerSupport : SupportContainer 13 | { 14 | // Testable constants 15 | public List children = new List(); 16 | 17 | public TreeContainerSupport(uint tree_depth, uint tree_width) { 18 | Populate(tree_depth, tree_width); 19 | } 20 | 21 | protected void Populate(uint tree_depth, uint tree_width) 22 | { 23 | if (tree_depth == 0) 24 | return; 25 | 26 | for (uint i = 0; i < tree_width; i++) 27 | { 28 | TreeContainerSupport child = new TreeContainerSupport(tree_depth - 1, tree_width); 29 | children.Add(child); 30 | AddChild(child); 31 | } 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/DSL/IViewProcessorUnmapper.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.ViewProcessor.DSL 9 | { 10 | /// 11 | /// Unmaps a view processor 12 | /// 13 | public interface IViewProcessorUnmapper 14 | { 15 | /// 16 | /// Unmaps a processor from a matcher 17 | /// 18 | /// Processor class or instance to remove from a matcher. 19 | void FromProcess(object processorClassOrInstance); 20 | 21 | /// 22 | /// Unmaps a matcher 23 | /// 24 | void FromNoProcess(); 25 | 26 | /// 27 | /// Unmaps an injection processor 28 | /// 29 | void FromInjection(); 30 | 31 | /// 32 | /// Unmaps all processors from this matcher 33 | /// 34 | void FromAll(); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EnhancedLogging/readme.md: -------------------------------------------------------------------------------- 1 | # Enhanced Logging 2 | 3 | Provides a number of extensions related to logging. 4 | 5 | ## TraceLoggerExtension 6 | 7 | Adds a TraceLogTarget to the context. This will simply `trace()` log messages. 8 | 9 | ## InjectableLoggerExtension 10 | 11 | If you install the InjectableLoggerExtension (already included in the MVCS bundle), getting loggers becomes even easier - simply inject an ILogger: 12 | 13 | ```as3 14 | public class MyClass 15 | { 16 | [Inject] 17 | public var logger:ILogger; 18 | 19 | public function MyClass() 20 | { 21 | // don't try to access the logger in your constructor 22 | // it won't have been set yet 23 | } 24 | 25 | public function explode(size:String):void 26 | { 27 | logger.info("There was a {0} explosion!", [size]); 28 | } 29 | } 30 | ``` 31 | 32 | ## InjectorActivityLoggingExtension 33 | 34 | Ever wanted to know what the injector is up to? The InjectorActivityLoggingExtension adds listeners to the injector and logs its every move. 35 | 36 | The injection and mappings events are logged at the DEBUG level, so be sure to set your logLevel to debug if you want to see them. 37 | 38 | WARNING: This extension will seriously degrade performance. Use it for fun, not profit. 39 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/ConfigSupport/UntypedConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.ConfigSupport 11 | { 12 | public class UntypedConfig 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("callback")] 19 | public Action callback; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Configure() 26 | { 27 | callback(this); 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/ViewManagement/Impl/UnityFallbackStageCrawler.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.Mediation.API; 9 | using Robotlegs.Bender.Extensions.ViewManagement.Impl; 10 | using UnityEngine; 11 | 12 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.ViewManager.Impl 13 | { 14 | public class UnityFallbackStageCrawler : StageCrawler 15 | { 16 | protected override void ScanContainer (object container) 17 | { 18 | ScanAll (); 19 | } 20 | 21 | private void ProcessViewsFromRoot(Transform view) 22 | { 23 | ScanAll (); 24 | } 25 | 26 | private void ScanAll() 27 | { 28 | object[] viewScripts = GameObject.FindObjectsOfType(typeof(MonoBehaviour)); 29 | 30 | foreach (MonoBehaviour viewScript in viewScripts) 31 | { 32 | if (viewScript is IView) 33 | { 34 | ProcessView (viewScript); 35 | } 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/ConfigSupport/PlainConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.ConfigSupport 11 | { 12 | public class PlainConfig 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("callback")] 19 | public Action callback; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | [PostConstruct] 26 | public void init() 27 | { 28 | callback(this); 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventCommand/EventCommandMapExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EventCommand.API; 9 | using Robotlegs.Bender.Extensions.EventCommand.Impl; 10 | using Robotlegs.Bender.Framework.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.EventCommand 13 | { 14 | /// 15 | /// The Event Command Map allows you to bind Events to Commands 16 | /// 17 | 18 | public class EventCommandMapExtension : IExtension 19 | { 20 | /*============================================================================*/ 21 | /* Public Functions */ 22 | /*============================================================================*/ 23 | 24 | public void Extend (IContext context) 25 | { 26 | context.injector.Map(typeof(IEventCommandMap)).ToSingleton(typeof(Impl.EventCommandMap)); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: robotlegs-sharp-framework-test.sln 3 | install: 4 | - nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner 5 | script: 6 | - build_number=$TRAVIS_BUILD_NUMBER 7 | - version_number=0.9.3 8 | - xbuild /p:Configuration=Release robotlegs-sharp-framework-test.sln 9 | - cp ./lib/*.dll ./bin/Release 10 | - mono --runtime=v3.5 ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./bin/Release/Robotlegs-Sharp-Framework-Test.dll 11 | after_success: 12 | - mv bin/Release/*.dll bin/ 13 | - mkdir bin/editor 14 | - mv bin/Robotlegs-Sharp-Platform-Unity-Editor.dll bin/editor/Robotlegs-Sharp-Platform-Unity-Editor.dll 15 | - mv lib/swiftsuspenders-sharp.dll bin/swiftsuspenders-sharp.dll 16 | - zip -r build.zip src bin/Robotlegs-Sharp-Framework.dll bin/Robotlegs-Sharp-Platform-Unity.dll bin/editor/Robotlegs-Sharp-Platform-Unity-Editor.dll bin/swiftsuspenders-sharp.dll readme.md LICENSE 17 | - curl --ftp-create-dirs -T build.zip -u ${travis_ftp_user}:${travis_ftp_pass} ftp://$travis_ftp_host/robotlegs-sharp-framework-v${version_number}_b${build_number}.zip 18 | - curl --data "version=${version_number}&build=${build_number}&update_key=${travis_update_key}" ${travis_update_url} 19 | notifications: 20 | email: 21 | - prankard@gmail.com 22 | - matt@rancon.co.uk 23 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewManagement/Support/SupportContainer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.Support 11 | { 12 | public class SupportContainer 13 | { 14 | protected int _childCount; 15 | 16 | public int NumChildren 17 | { 18 | get 19 | { 20 | return _childCount; 21 | } 22 | } 23 | 24 | public virtual SupportContainer Parent 25 | { 26 | get 27 | { 28 | return _parent; 29 | } 30 | protected set 31 | { 32 | _parent = value; 33 | } 34 | } 35 | 36 | protected SupportContainer _parent; 37 | 38 | public virtual void AddChild(SupportContainer child) 39 | { 40 | _childCount++; 41 | child.Parent = this; 42 | } 43 | 44 | public virtual void RemoveChild(SupportContainer child) 45 | { 46 | if (child.Parent == this) 47 | { 48 | child.Parent = null; 49 | } 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/MessageReturningCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class MessageReturningCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject] 19 | public string message; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public string Execute() 26 | { 27 | return message; 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/DependencyProviders/UnityComponentProvider.cs: -------------------------------------------------------------------------------- 1 | using Robotlegs.Bender.Extensions.ContextViews.API; 2 | using SwiftSuspenders; 3 | using SwiftSuspenders.DependencyProviders; 4 | using System; 5 | using System.Collections.Generic; 6 | using UnityEngine; 7 | using SwiftSuspenders.Errors; 8 | 9 | namespace Robotlegs.Bender.DependencyProviders 10 | { 11 | public class UnityComponentProvider : AbstractUnityComponentProvider, DependencyProvider 12 | { 13 | public UnityComponentProvider(Type componentType) : base(componentType) { } 14 | 15 | public UnityComponentProvider(Type componentType, GameObject parentObject) : base(componentType, parentObject) { } 16 | 17 | public UnityComponentProvider(Type componentType, Transform parentObject) : base(componentType, parentObject) { } 18 | 19 | public object Apply(Type targetType, Injector activeInjector, Dictionary injectParameters) 20 | { 21 | AddComponent(activeInjector, componentType); 22 | 23 | activeInjector.InjectInto(component); 24 | 25 | if (_postApply != null) 26 | { 27 | _postApply(this, component); 28 | } 29 | return component; 30 | } 31 | 32 | public void Destroy() 33 | { 34 | if (_preDestroy != null) 35 | { 36 | _preDestroy(this, component); 37 | } 38 | RemoveComponent(); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/DirectCommand/API/IDirectCommandMap.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.DirectCommand.API 9 | { 10 | public interface IDirectCommandMap : IDirectCommandMapper 11 | { 12 | /// 13 | /// Pins a command in memory 14 | /// 15 | /// The command instance to pin 16 | void Detain(object command); 17 | 18 | /// 19 | /// Unpins a command instance from memory 20 | /// 21 | /// The command instance to unpin 22 | void Release(object command); 23 | 24 | /// 25 | /// Adds a handler to the process mappings 26 | /// 27 | /// Self 28 | /// Delegate that accepts a mapping 29 | IDirectCommandMap AddMappingProcessor(Robotlegs.Bender.Extensions.CommandCenter.Impl.CommandMappingList.Processor handler); 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventCommand/Support/EventParametersCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.EventCommand.Support 11 | { 12 | public class EventParametersCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ExecuteCallback")] 19 | public Action callback; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Execute(SupportEvent evt) 26 | { 27 | callback(evt); 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewManagement/Support/CustomParentFinder.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System.Collections.Generic; 9 | using Robotlegs.Bender.Extensions.ViewManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewManagement.Support 12 | { 13 | public class CustomParentFinder : IParentFinder 14 | { 15 | private bool _contains; 16 | 17 | private object _parent; 18 | 19 | public CustomParentFinder(bool contains, object parent) 20 | { 21 | _contains = contains; 22 | _parent = parent; 23 | } 24 | 25 | public bool Contains (object parentContainer, object childContainer) 26 | { 27 | return _contains; 28 | } 29 | 30 | public object FindParent (object childView, Dictionary containers) 31 | { 32 | return _parent; 33 | } 34 | 35 | public object FindParent (object childView, IEnumerable containers) 36 | { 37 | return _parent; 38 | } 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/ConfigSupport/TypedConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Framework.Impl.ConfigSupport 12 | { 13 | public class TypedConfig : IConfig 14 | { 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | [Inject("callback")] 20 | public Action callback; 21 | 22 | /*============================================================================*/ 23 | /* Public Functions */ 24 | /*============================================================================*/ 25 | 26 | public void Configure () 27 | { 28 | callback (this); 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewProcessor/DSL/IViewProcessorMapping.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.Matching; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewProcessor.DSL 12 | { 13 | public interface IViewProcessorMapping 14 | { 15 | /// 16 | /// The matchher for this mapping 17 | /// 18 | ITypeFilter Matcher {get;} 19 | 20 | /// 21 | /// The processor object for this mapping 22 | /// 23 | object Processor { get; set; } 24 | 25 | /// 26 | /// The processor type for this mapping 27 | /// 28 | Type ProcessorClass { get; } 29 | 30 | /// 31 | /// Returns a list of guards to consult before allowing a view to be processed 32 | /// 33 | object[] Guards {get;} 34 | 35 | /// 36 | /// Returns a list of hooks to run before processing a view 37 | /// 38 | object[] Hooks { get; } 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/ReportMethodCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class ReportMethodCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Report() 26 | { 27 | reportingFunc(typeof(ReportMethodCommand)); 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Support/CallbackMediator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.Mediation.Support 11 | { 12 | 13 | public class CallbackMediator 14 | { 15 | 16 | /*============================================================================*/ 17 | /* Public Properties */ 18 | /*============================================================================*/ 19 | 20 | [Inject(true, "callback")] 21 | public Action callback; 22 | 23 | /*============================================================================*/ 24 | /* Public Functions */ 25 | /*============================================================================*/ 26 | 27 | [PostConstruct] 28 | public void Init() 29 | { 30 | if (callback != null) 31 | { 32 | callback(this); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/LocalEventMap/LocalEventMapExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.LocalEventMap.API; 9 | using Robotlegs.Bender.Extensions.LocalEventMap.Impl; 10 | using Robotlegs.Bender.Framework.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.LocalEventMap 13 | { 14 | /// 15 | /// An Event Map keeps track of listeners and provides the ability to 16 | /// unregister all the listeners which a single method call. 17 | /// 18 | public class LocalEventMapExtension : IExtension 19 | { 20 | /*============================================================================*/ 21 | /* Public Functions */ 22 | /*============================================================================*/ 23 | 24 | public void Extend (IContext context) 25 | { 26 | context.injector.Map(typeof(IEventMap)).ToType((typeof(EventMap))); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/SelfReportingCallbackCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class SelfReportingCallbackCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ExecuteCallback")] 19 | public Action callback; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Execute() 26 | { 27 | callback(this); 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Matching/InstanceOfMatcherTest.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using NUnit.Framework; 9 | 10 | namespace Robotlegs.Bender.Extensions.Matching 11 | { 12 | [TestFixture] 13 | public class InstanceOfMatcherTest 14 | { 15 | 16 | /*============================================================================*/ 17 | /* Tests */ 18 | /*============================================================================*/ 19 | 20 | [Test] 21 | public void matches_type() 22 | { 23 | Assert.That(new InstanceOfMatcher(typeof(float)).Matches(5f), Is.True); 24 | } 25 | 26 | [Test] 27 | public void does_not_match_wrong_type() 28 | { 29 | Assert.That(new InstanceOfMatcher(typeof(string)).Matches(5f), Is.False); 30 | } 31 | 32 | [Test] 33 | public void does_not_match_wrong_type_int_float() 34 | { 35 | Assert.That(new InstanceOfMatcher(typeof(int)).Matches(5f), Is.False); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/PriorityMapping.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.CommandCenter.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 12 | { 13 | public class PriorityMapping : CommandMapping 14 | { 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | public int priority; 20 | 21 | /*============================================================================*/ 22 | /* Constructor */ 23 | /*============================================================================*/ 24 | 25 | public PriorityMapping (Type command, int priority) : base(command) 26 | { 27 | this.priority = priority; 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/ExecutelessCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class ExecutelessCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | [PostConstruct] 26 | public void init() 27 | { 28 | reportingFunc(typeof(ExecutelessCommand)); 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/ClassReportingCallbackHook.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class ClassReportingCallbackHook 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Hook() 26 | { 27 | if (reportingFunc != null) 28 | { 29 | reportingFunc(typeof(ClassReportingCallbackHook)); 30 | } 31 | } 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/MethodParametersCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class MethodParametersCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Execute(string message, int code) 26 | { 27 | reportingFunc(message); 28 | reportingFunc(code); 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /robotlegs-sharp-platform-unity.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "robotlegs-sharp-platform-unity", "robotlegs-sharp-platform-unity.csproj", "{9DA7E079-E927-439D-BC50-BBD2EB30B5D3}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "robotlegs-sharp-framework", "robotlegs-sharp-framework.csproj", "{BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {BA0B7671-3283-4AFE-B5B2-8CF9BD9C74BE}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {9DA7E079-E927-439D-BC50-BBD2EB30B5D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {9DA7E079-E927-439D-BC50-BBD2EB30B5D3}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {9DA7E079-E927-439D-BC50-BBD2EB30B5D3}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {9DA7E079-E927-439D-BC50-BBD2EB30B5D3}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | EndGlobal 24 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/SelfReportingCallbackHook.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class SelfReportingCallbackHook 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject] 19 | public SelfReportingCallbackCommand command; 20 | 21 | [Inject("HookCallback")] 22 | public Action callback; 23 | 24 | /*============================================================================*/ 25 | /* Public Functions */ 26 | /*============================================================================*/ 27 | 28 | public void Hook() 29 | { 30 | callback(this); 31 | } 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/ViewManagement/UnityParentFinderExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewManagement; 9 | using Robotlegs.Bender.Extensions.ViewManagement.Impl; 10 | using Robotlegs.Bender.Framework.API; 11 | using Robotlegs.Bender.Framework.Unity.Extensions.ViewManagement.Impl; 12 | 13 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.ViewManager 14 | { 15 | public class UnityParentFinderExtension : IExtension 16 | { 17 | private IInjector _injector; 18 | 19 | private IParentFinder _parentFinder; 20 | 21 | public void Extend (IContext context) 22 | { 23 | _injector = context.injector; 24 | 25 | _parentFinder = new UnityParentFinder(); 26 | _injector.Map(typeof(IParentFinder)).ToValue(_parentFinder); 27 | context.BeforeInitializing(BeforeInitializing); 28 | } 29 | 30 | private void BeforeInitializing() 31 | { 32 | ContainerRegistry registry = _injector.GetInstance(typeof(ContainerRegistry)) as ContainerRegistry; 33 | registry.SetParentFinder(_parentFinder); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/CommandMapStub.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.CommandCenter.API; 10 | using Moq; 11 | 12 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 13 | { 14 | public class CommandMapStub 15 | { 16 | /*============================================================================*/ 17 | /* Public Functions */ 18 | /*============================================================================*/ 19 | 20 | public virtual object KeyFactory(params object[] args) 21 | { 22 | string s = ""; 23 | for (int i = 0; i < args.Length; i++) 24 | { 25 | s += args[i].ToString (); 26 | if (i < args.Length - 1) 27 | s += "::"; 28 | } 29 | return s; 30 | } 31 | 32 | public virtual ICommandTrigger TriggerFactory(params object[] args) 33 | { 34 | return new Mock ().Object; 35 | } 36 | 37 | public virtual void Hook(params object[] args) 38 | { 39 | 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/ClassReportingCallbackCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class ClassReportingCallbackCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Execute() 26 | { 27 | if (reportingFunc != null) 28 | { 29 | reportingFunc (typeof(ClassReportingCallbackCommand)); 30 | } 31 | } 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/ClassReportingCallbackCommand2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class ClassReportingCallbackCommand2 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public void Execute() 26 | { 27 | if (reportingFunc != null) 28 | { 29 | reportingFunc (typeof(ClassReportingCallbackCommand2)); 30 | } 31 | } 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/DirectCommand/Support/DirectCommandMapReportingCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.DirectCommand.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.DirectCommand.Support 12 | { 13 | public class DirectCommandMapReportingCommand 14 | { 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | [Inject] 20 | public IDirectCommandMap dcm; 21 | 22 | [Inject("ReportingFunction")] 23 | public Action reportingFunc; 24 | 25 | /*============================================================================*/ 26 | /* Public Functions */ 27 | /*============================================================================*/ 28 | 29 | public void Execute() 30 | { 31 | reportingFunc(dcm); 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/CommandCenter/API/ICommandExecutor.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System.Collections.Generic; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.API 11 | { 12 | /// 13 | /// Optional Command interface. 14 | /// 15 | ///

Note, you do not need to implement this interface, 16 | /// any class with an execute method can be used.

17 | ///
18 | public interface ICommandExecutor 19 | { 20 | /// 21 | /// Execute a command for a given mapping 22 | /// 23 | /// The Command Mapping 24 | /// The Command Payload 25 | void ExecuteCommand(ICommandMapping mapping, CommandPayload payload); 26 | 27 | /// 28 | /// Execute a list of commands for a given list of mappings 29 | /// 30 | /// The Command Mappings 31 | /// The Command Payload 32 | void ExecuteCommands(IEnumerable mapping, CommandPayload payload); 33 | } 34 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/ClassReportingCallbackGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class ClassReportingCallbackGuard 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public bool Approve() 26 | { 27 | if (reportingFunc != null) 28 | { 29 | reportingFunc(typeof(ClassReportingCallbackGuard)); 30 | } 31 | return true; 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/ClassReportingCallbackGuard2.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class ClassReportingCallbackGuard2 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | /*============================================================================*/ 22 | /* Public Functions */ 23 | /*============================================================================*/ 24 | 25 | public bool Approve() 26 | { 27 | if (reportingFunc != null) 28 | { 29 | reportingFunc(typeof(ClassReportingCallbackGuard2)); 30 | } 31 | return true; 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/Modularity/Impl/ModularContextEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.API; 10 | using Robotlegs.Bender.Framework.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.Modularity.Impl 13 | { 14 | public class ModularContextEvent : IEvent 15 | { 16 | private Type _type; 17 | private IContext _context; 18 | private object _contextView; 19 | 20 | public enum Type 21 | { 22 | CONTEXT_ADD, 23 | CONTEXT_REMOVE 24 | } 25 | 26 | public Enum type 27 | { 28 | get 29 | { 30 | return _type; 31 | } 32 | } 33 | 34 | public IContext Context 35 | { 36 | get 37 | { 38 | return _context; 39 | } 40 | } 41 | 42 | public object ContextView 43 | { 44 | get 45 | { 46 | return _contextView; 47 | } 48 | } 49 | 50 | public ModularContextEvent(ModularContextEvent.Type type, IContext context, object contextView) 51 | { 52 | _type = type; 53 | _context = context; 54 | _contextView = contextView; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/AbstractInterfaceImplementingCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.CommandCenter.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 12 | { 13 | public class AbstractInterfaceImplementingCommand : ICommand 14 | { 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | [Inject("ReportingFunction")] 20 | public Action reportingFunc; 21 | 22 | /*============================================================================*/ 23 | /* Public Functions */ 24 | /*============================================================================*/ 25 | 26 | public void Execute() 27 | { 28 | reportingFunc(typeof(AbstractInterfaceImplementingCommand)); 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/PayloadInjectionPointsHook.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class PayloadInjectionPointsHook 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject] 19 | public string message; 20 | 21 | [Inject] 22 | public int code; 23 | 24 | [Inject("ReportingFunction")] 25 | public Action reportingFunc; 26 | 27 | /*============================================================================*/ 28 | /* Public Functions */ 29 | /*============================================================================*/ 30 | 31 | public void Hook() 32 | { 33 | reportingFunc(message); 34 | reportingFunc(code); 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/PayloadInjectionPointsCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class PayloadInjectionPointsCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject] 19 | public string message; 20 | 21 | [Inject] 22 | public int code; 23 | 24 | [Inject("ReportingFunction")] 25 | public Action reportingFunc; 26 | 27 | /*============================================================================*/ 28 | /* Public Functions */ 29 | /*============================================================================*/ 30 | 31 | public void Execute() 32 | { 33 | reportingFunc(message); 34 | reportingFunc(code); 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EnhancedLogging/InjectorActivityLoggingExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.EnhancedLogging.Impl; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.EnhancedLogging 12 | { 13 | /// 14 | /// This extension logs messages for all Injector actions. 15 | /// 16 | /// Warning: this extension will degrade the performance of your application. 17 | /// 18 | public class InjectorActivityLoggingExtension : IExtension/// 19 | { 20 | /*============================================================================*/ 21 | /* Public Functions */ 22 | /*============================================================================*/ 23 | 24 | public void Extend (IContext context) 25 | { 26 | InjectorListener listener = new InjectorListener( 27 | context.injector, context.GetLogger(this)); 28 | // context.afterDestroying(listener.destroy); 29 | context.AfterDestroying (listener.Destroy); 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventCommand/Support/EventInjectedCallbackCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | using Robotlegs.Bender.Extensions.EventManagement.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.EventCommand.Support 13 | { 14 | public class EventInjectedCallbackCommand 15 | { 16 | /*============================================================================*/ 17 | /* Public Properties */ 18 | /*============================================================================*/ 19 | 20 | [Inject] 21 | public IEvent evt; 22 | 23 | [Inject("ExecuteCallback")] 24 | public Action callback; 25 | 26 | /*============================================================================*/ 27 | /* Public Functions */ 28 | /*============================================================================*/ 29 | 30 | public void Execute() 31 | { 32 | callback(this); 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/API/IParentFinder.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System.Collections.Generic; 9 | using Robotlegs.Bender.Extensions.ViewManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewManagement 12 | { 13 | public interface IParentFinder 14 | { 15 | /// 16 | /// Method to check if a container contains another container 17 | /// 18 | /// The parent container 19 | /// The child container 20 | bool Contains (object parentContainer, object childContainer); 21 | 22 | // View Find Parent Container 23 | /// 24 | /// Method to check the view to find it's container (if any) 25 | /// 26 | /// The parent container object or null 27 | /// The child view 28 | /// A dictionary of ContainerBindings by Container as a key 29 | object FindParent (object childView, Dictionary containers); 30 | object FindParent (object childView, IEnumerable containers); 31 | } 32 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/OptionalInjectionPointsCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class OptionalInjectionPointsCommand 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject("ReportingFunction")] 19 | public Action reportingFunc; 20 | 21 | [Inject(true)] 22 | public string message; 23 | 24 | [Inject(true)] 25 | public int code; 26 | 27 | /*============================================================================*/ 28 | /* Public Functions */ 29 | /*============================================================================*/ 30 | 31 | public void Execute() 32 | { 33 | reportingFunc(message); 34 | reportingFunc(code); 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/PayloadInjectionPointsGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 11 | { 12 | public class PayloadInjectionPointsGuard 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | [Inject] 19 | public string message; 20 | 21 | [Inject] 22 | public int code; 23 | 24 | [Inject("ReportingFunction")] 25 | public Action reportingFunc; 26 | 27 | /*============================================================================*/ 28 | /* Public Functions */ 29 | /*============================================================================*/ 30 | 31 | public bool Approve() 32 | { 33 | reportingFunc(message); 34 | reportingFunc(code); 35 | return true; 36 | } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventCommand/Support/EventInjectedCallbackGuard.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | using Robotlegs.Bender.Extensions.EventManagement.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.EventCommand.Support 13 | { 14 | public class EventInjectedCallbackGuard 15 | { 16 | /*============================================================================*/ 17 | /* Public Properties */ 18 | /*============================================================================*/ 19 | 20 | [Inject] 21 | public IEvent evt; 22 | 23 | [Inject("ApproveCallback")] 24 | public Action callback; 25 | 26 | /*============================================================================*/ 27 | /* Public Functions */ 28 | /*============================================================================*/ 29 | 30 | public bool Approve() 31 | { 32 | callback(this); 33 | return true; 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/CommandCenter/Support/OptionalInjectionPointsCommandInstantiatingCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Extensions.CommandCenter.Support 12 | { 13 | public class OptionalInjectionPointsCommandInstantiatingCommand 14 | { 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | [Inject] 20 | public IInjector injector; 21 | 22 | /*============================================================================*/ 23 | /* Public Functions */ 24 | /*============================================================================*/ 25 | 26 | public void Execute() 27 | { 28 | OptionalInjectionPointsCommand command = injector.InstantiateUnmapped(); 29 | command.Execute(); 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/ViewManagement/Support/SupportParentFinderExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Framework.API; 9 | using Robotlegs.Bender.Extensions.ViewManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.ViewManagement.Support 12 | { 13 | public class SupportParentFinderExtension : IExtension 14 | { 15 | private IInjector _injector; 16 | 17 | private IParentFinder _parentFinder; 18 | 19 | public void Extend (IContext context) 20 | { 21 | _injector = context.injector; 22 | 23 | _parentFinder = new SupportParentFinder(); 24 | _injector.Map(typeof(IParentFinder)).ToValue(_parentFinder); 25 | context.BeforeInitializing(BeforeInitializing); 26 | } 27 | 28 | private void BeforeInitializing() 29 | { 30 | if (_injector.HasDirectMapping (typeof(ContainerRegistry))) 31 | { 32 | ContainerRegistry registry = _injector.GetInstance (typeof(ContainerRegistry)) as ContainerRegistry; 33 | registry.SetParentFinder(_parentFinder); 34 | _injector.Unmap (typeof(IParentFinder)); 35 | _injector.Map(typeof(IParentFinder)).ToValue(registry); 36 | } 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/ViewManagement/Impl/UnityViewStateWatcherExtension.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewManagement; 9 | using Robotlegs.Bender.Extensions.ViewManagement.API; 10 | using Robotlegs.Bender.Platforms.Unity.Extensions.ViewManager.Impl; 11 | using UnityEngine; 12 | 13 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.ViewManager.Impl 14 | { 15 | public class UnityViewStateWatcherExtension : ViewStateWatcherExtension 16 | { 17 | protected override IViewStateWatcher GetViewStateWatcher (object contextView) 18 | { 19 | GameObject target = null; 20 | if(contextView is GameObject) target = contextView as GameObject; 21 | else if(contextView is Component) target = (contextView as Component).gameObject; 22 | 23 | if(target == null) 24 | { 25 | _logger.Warn("ContextView is not a Component or a GameObject, {0}", contextView); 26 | return null; 27 | } 28 | UnityViewStateWatcher viewStateWatcher = target.AddComponent(); 29 | viewStateWatcher.target = contextView; 30 | return viewStateWatcher; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ContextViews/ContextViewListenerConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ContextViews.API; 9 | using Robotlegs.Bender.Extensions.ViewManagement.API; 10 | using Robotlegs.Bender.Framework.API; 11 | 12 | 13 | namespace Robotlegs.Bender.Extensions.ContextViews 14 | { 15 | public class ContextViewListenerConfig : IConfig 16 | { 17 | /*============================================================================*/ 18 | /* Public Properties */ 19 | /*============================================================================*/ 20 | 21 | [Inject] 22 | public IContextView contextView {get;set;} 23 | 24 | [Inject] 25 | public IViewManager viewManager {get;set;} 26 | 27 | /*============================================================================*/ 28 | /* Public Functions */ 29 | /*============================================================================*/ 30 | 31 | public void Configure () 32 | { 33 | viewManager.AddContainer(contextView.view); 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Impl/Support/SugaryMediator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Bundles.MVCS; 9 | using System; 10 | using Robotlegs.Bender.Extensions.EventManagement.API; 11 | 12 | 13 | namespace Robotlegs.Bender.Extensions.Mediation.Impl.Support 14 | { 15 | 16 | public class SugaryMediator : Mediator 17 | { 18 | 19 | public override void Initialize() 20 | { 21 | 22 | } 23 | 24 | public override void Destroy () 25 | { 26 | 27 | } 28 | 29 | public void Try_addViewListener(Enum eventType, Action callback) 30 | { 31 | AddViewListener (eventType, callback); 32 | } 33 | 34 | public void Try_addContextListener(Enum eventType, Action callback) 35 | { 36 | AddContextListener(eventType, callback); 37 | } 38 | 39 | public void Try_removeViewListener(Enum eventType, Action callback) 40 | { 41 | RemoveViewListener(eventType, callback); 42 | } 43 | 44 | public void Try_removeContextListener(Enum eventType, Action callback) 45 | { 46 | RemoveContextListener(eventType, callback); 47 | } 48 | 49 | public void Try_dispatch(IEvent evt) 50 | { 51 | Dispatch(evt); 52 | } 53 | 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Modularity/Impl/LogLevelTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Robotlegs.Bender.Framework.API; 3 | 4 | namespace Robotlegs.Bender.Extensions.Modularity.Impl 5 | { 6 | public class LogLevelTarget : ILogTarget 7 | { 8 | public event LogEventDelegate DEBUG; 9 | public event LogEventDelegate ERROR; 10 | public event LogEventDelegate FATAL; 11 | public event LogEventDelegate INFO; 12 | public event LogEventDelegate WARN; 13 | 14 | public delegate void LogEventDelegate(object source, object message, params object[] messageParameters); 15 | 16 | public void Log (object source, Robotlegs.Bender.Framework.Impl.LogLevel level, DateTime timestamp, object message, params object[] messageParameters) 17 | { 18 | switch (level) 19 | { 20 | case Robotlegs.Bender.Framework.Impl.LogLevel.DEBUG: 21 | if (DEBUG != null) 22 | DEBUG (source, message, messageParameters); 23 | break; 24 | case Robotlegs.Bender.Framework.Impl.LogLevel.ERROR: 25 | if (ERROR != null) 26 | ERROR (source, message, messageParameters); 27 | break; 28 | case Robotlegs.Bender.Framework.Impl.LogLevel.FATAL: 29 | if (FATAL != null) 30 | FATAL (source, message, messageParameters); 31 | break; 32 | case Robotlegs.Bender.Framework.Impl.LogLevel.INFO: 33 | if (INFO != null) 34 | INFO (source, message, messageParameters); 35 | break; 36 | case Robotlegs.Bender.Framework.Impl.LogLevel.WARN: 37 | if (WARN != null) 38 | WARN (source, message, messageParameters); 39 | break; 40 | } 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/Extensions/ViewManagement/Impl/UnityStageCrawler.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.Mediation.API; 9 | using Robotlegs.Bender.Extensions.ViewManagement.Impl; 10 | using UnityEngine; 11 | 12 | namespace Robotlegs.Bender.Platforms.Unity.Extensions.ViewManager.Impl 13 | { 14 | public class UnityStageCrawler : StageCrawler 15 | { 16 | protected override void ScanContainer (object container) 17 | { 18 | Transform containerTransform = null; 19 | if (container is GameObject) 20 | { 21 | containerTransform = (container as GameObject).transform; 22 | } 23 | else if (container is Transform) 24 | { 25 | containerTransform = container as Transform; 26 | } 27 | else 28 | return; 29 | 30 | ProcessViewsFromRoot (containerTransform); 31 | } 32 | 33 | private void ProcessViewsFromRoot(Transform view) 34 | { 35 | MonoBehaviour[] viewScripts = view.GetComponentsInChildren(false); 36 | 37 | foreach (MonoBehaviour viewScript in viewScripts) 38 | { 39 | if (viewScript is IView) 40 | { 41 | ProcessView (viewScript); 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/Mediation/Impl/Support/SupportMediator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.ViewManagement.Support; 10 | 11 | namespace Robotlegs.Bender.Extensions.Mediation.Impl.Support 12 | { 13 | public class SupportMediator 14 | { 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | [Inject] 20 | public MediatorWatcher mediatorWatcher {get;set;} 21 | 22 | [Inject] 23 | public SupportView view {get;set;} 24 | 25 | /*============================================================================*/ 26 | /* Public Functions */ 27 | /*============================================================================*/ 28 | 29 | public void Initialize() 30 | { 31 | mediatorWatcher.Notify("SupportMediator"); 32 | } 33 | 34 | public void Destroy() 35 | { 36 | mediatorWatcher.Notify("SupportMediator destroy"); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/LifecycleException.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.API 11 | { 12 | public class LifecycleException : Exception 13 | { 14 | 15 | /*============================================================================*/ 16 | /* Public Static Properties */ 17 | /*============================================================================*/ 18 | 19 | public const string SYNC_HANDLER_ARG_MISMATCH = "When and After handlers must accept 0 or 1 arguments"; 20 | 21 | public const string LATE_HANDLER_ERROR_MESSAGE = "Handler added late and will never fire"; 22 | 23 | /*============================================================================*/ 24 | /* Constructor */ 25 | /*============================================================================*/ 26 | 27 | /// 28 | /// Creates a Lifecycle Exception 29 | /// 30 | /// The error message 31 | public LifecycleException (string message) : base(message) 32 | { 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/ManualStageObserverExtension.md: -------------------------------------------------------------------------------- 1 | # Manual Stage Observer Extension 2 | 3 | The manual stage observer extension is not installed in the MVCSBundle, the automatic StageObserverExtension is added instead. 4 | 5 | The manual stage observer allows you to register your views manually with bubbling events. 6 | 7 | In order to register a view, you still need to have a container registered in the ContainerRegistry, which is usually installed in the ViewManager/ContextView extension. 8 | 9 | ## How to Install 10 | 11 | You can install this extension like so: 12 | 13 | ```as3 14 | context.install(ManualStageObserver); 15 | ``` 16 | 17 | ## How to use 18 | 19 | You can manually send views to be processed with event bubbling. 20 | All you have to do is dispatch a ConfigureViewEvent from that view that needs to be processed. 21 | 22 | Here is an example of sprite that will get processed after it has been added to stage: 23 | 24 | 25 | ```as3 26 | package robotlegs.bender.extensions.viewManager.impl 27 | { 28 | import flash.display.Sprite; 29 | import robotlegs.bender.extensions.viewManager.impl; 30 | 31 | public class ManualRegisteredView : Sprite 32 | { 33 | public function ManualRegisteredView() 34 | { 35 | addEventListner(Event.ADDED_TO_STAGE, init, false, 0, true); 36 | } 37 | 38 | private function init(e:Event):void 39 | { 40 | dispatchEvent(new ConfigureViewEvent(ConfigureViewEvent.CONFIGURE_VIEW)); 41 | } 42 | } 43 | } 44 | ``` 45 | 46 | Again, this will only get registered if the view is a child of a container like the ContextView. -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventManagement/API/LifecycleEvent.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | 11 | namespace Robotlegs.Bender.Extensions.EventManagement.API 12 | { 13 | public class LifecycleEvent : Event 14 | { 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | public enum Type 20 | { 21 | ERROR, 22 | STATE_CHANGE, 23 | PRE_INITIALIZE, 24 | INITIALIZE, 25 | POST_INITIALIZE, 26 | PRE_SUSPEND, 27 | SUSPEND, 28 | POST_SUSPEND, 29 | PRE_RESUME, 30 | RESUME, 31 | POST_RESUME, 32 | PRE_DESTROY, 33 | DESTROY, 34 | POST_DESTROY 35 | } 36 | 37 | /*============================================================================*/ 38 | /* Constructor */ 39 | /*============================================================================*/ 40 | 41 | public LifecycleEvent (Type type) : base(type) 42 | { 43 | 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ViewManagement/Impl/StageCrawler.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using Robotlegs.Bender.Extensions.ViewManagement.API; 9 | 10 | namespace Robotlegs.Bender.Extensions.ViewManagement.Impl 11 | { 12 | public abstract class StageCrawler : IStageCrawler 13 | { 14 | private ContainerBinding _binding; 15 | 16 | /*============================================================================*/ 17 | /* Public Functions */ 18 | /*============================================================================*/ 19 | public ContainerBinding Binding 20 | { 21 | set 22 | { 23 | _binding = value; 24 | } 25 | } 26 | 27 | public void Scan(object view) 28 | { 29 | ScanContainer(view); 30 | } 31 | 32 | /*============================================================================*/ 33 | /* Protected Functions */ 34 | /*============================================================================*/ 35 | 36 | protected abstract void ScanContainer(object container); 37 | 38 | protected void ProcessView(object view) 39 | { 40 | _binding.HandleView(view, view.GetType()); 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventCommand/Support/CommandMappingCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | using Robotlegs.Bender.Extensions.EventCommand.API; 11 | using Robotlegs.Bender.Extensions.EventManagement.API; 12 | 13 | namespace Robotlegs.Bender.Extensions.EventCommand.Support 14 | { 15 | public class CommandMappingCommand 16 | { 17 | /*============================================================================*/ 18 | /* Public Properties */ 19 | /*============================================================================*/ 20 | 21 | [Inject] 22 | public IEvent evt; 23 | 24 | [Inject("nestedCommand")] 25 | public Type commandClass; 26 | 27 | [Inject] 28 | public IEventCommandMap eventCommandMap; 29 | 30 | /*============================================================================*/ 31 | /* Public Functions */ 32 | /*============================================================================*/ 33 | 34 | public void Execute() 35 | { 36 | eventCommandMap.Map(evt.type, typeof(IEvent)).ToCommand(commandClass); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Framework/API/ILogging.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Framework.API 9 | { 10 | /** 11 | * The Robotlegs logger contract 12 | */ 13 | public interface ILogging 14 | { 15 | /** 16 | * Logs a message for debug purposes 17 | * @param message Message to log 18 | * @param params Message parameters 19 | */ 20 | // 21 | void Debug(object message, params object[] parameters); 22 | 23 | /** 24 | * Logs a message for notification purposes 25 | * @param message Message to log 26 | * @param params Message parameters 27 | */ 28 | void Info(object message, params object[] parameters); 29 | 30 | /** 31 | * Logs a warning message 32 | * @param message Message to log 33 | * @param params Message parameters 34 | */ 35 | void Warn(object message, params object[] parameters); 36 | 37 | /** 38 | * Logs an error message 39 | * @param message Message to log 40 | * @param params Message parameters 41 | */ 42 | void Error(object message, params object[] parameters); 43 | 44 | /** 45 | * Logs a fatal error message 46 | * @param message Message to log 47 | * @param params Message parameters 48 | */ 49 | void Fatal(object message, params object[] parameters); 50 | } 51 | } -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventCommand/Support/CommandUnmappingCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | using Robotlegs.Bender.Extensions.EventCommand.API; 11 | using Robotlegs.Bender.Extensions.EventManagement.API; 12 | 13 | namespace Robotlegs.Bender.Extensions.EventCommand.Support 14 | { 15 | public class CommandUnmappingCommand 16 | { 17 | /*============================================================================*/ 18 | /* Public Properties */ 19 | /*============================================================================*/ 20 | 21 | [Inject] 22 | public IEvent evt; 23 | 24 | [Inject("nestedCommand")] 25 | public Type commandClass; 26 | 27 | [Inject] 28 | public IEventCommandMap eventCommandMap; 29 | 30 | /*============================================================================*/ 31 | /* Public Functions */ 32 | /*============================================================================*/ 33 | 34 | public void Execute() 35 | { 36 | eventCommandMap.Unmap(evt.type, typeof(Event)).FromCommand(commandClass); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Extensions/EventCommand/Support/SupportEventTriggeredSelfReportingCallbackCommand.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.EventManagement.Impl; 10 | using Robotlegs.Bender.Extensions.EventManagement.API; 11 | 12 | namespace Robotlegs.Bender.Extensions.EventCommand.Support 13 | { 14 | public class SupportEventTriggeredSelfReportingCallbackCommand 15 | { 16 | /*============================================================================*/ 17 | /* Public Properties */ 18 | /*============================================================================*/ 19 | 20 | [Inject(true)] 21 | public IEvent untypedEvent; 22 | 23 | [Inject(true)] 24 | public SupportEvent typedEvent; 25 | 26 | [Inject("ExecuteCallback")] 27 | public Action callback; 28 | 29 | /*============================================================================*/ 30 | /* Public Functions */ 31 | /*============================================================================*/ 32 | 33 | public void Execute() 34 | { 35 | callback(this); 36 | } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Platforms/Unity/DependencyProviders/UnitySingletonComponentProvider.cs: -------------------------------------------------------------------------------- 1 | using Robotlegs.Bender.Extensions.ContextViews.API; 2 | using SwiftSuspenders; 3 | using SwiftSuspenders.DependencyProviders; 4 | using System; 5 | using System.Collections.Generic; 6 | using UnityEngine; 7 | using SwiftSuspenders.Errors; 8 | 9 | namespace Robotlegs.Bender.DependencyProviders 10 | { 11 | public class UnitySingletonComponentProvider : AbstractUnityComponentProvider, DependencyProvider 12 | { 13 | public UnitySingletonComponentProvider(Type componentType) : base(componentType) { } 14 | 15 | public UnitySingletonComponentProvider(Type componentType, GameObject parentObject) : base(componentType, parentObject) { } 16 | 17 | public UnitySingletonComponentProvider(Type componentType, Transform parentObject) : base(componentType, parentObject) { } 18 | 19 | private bool _destroyed = false; 20 | 21 | public object Apply(Type targetType, Injector activeInjector, Dictionary injectParameters) 22 | { 23 | if (_destroyed) 24 | throw new InjectorException("Forbidden usage of unmapped singleton provider for type " 25 | + targetType.ToString()); 26 | 27 | if (component == null) 28 | { 29 | AddComponent(activeInjector, componentType); 30 | 31 | activeInjector.InjectInto(component); 32 | } 33 | 34 | if (_postApply != null) 35 | { 36 | _postApply(this, component); 37 | } 38 | return component; 39 | } 40 | 41 | public void Destroy() 42 | { 43 | if (_preDestroy != null) 44 | { 45 | _preDestroy(this, component); 46 | } 47 | _destroyed = true; 48 | RemoveComponent(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/ContextViews/readme.md: -------------------------------------------------------------------------------- 1 | # ContextView Extension (Bundled with MVCS) 2 | 3 | The Context View Extension adds a configuration processor to the context that consumes a ContextView object and maps the provided view as a DisplayObjectContainer into the context. Many extensions require a DisplayObjectContainer to be present in order to function correctly. 4 | 5 | ## Installation 6 | 7 | ### During Context Construction 8 | 9 | ```as3 10 | _context = new Context() 11 | .install(ContextViewExtension) 12 | .configure(new ContextView(this)); 13 | ``` 14 | 15 | Note: The ContextViewExtension must be installed before the ContextView is provided or it will not be processed. 16 | 17 | In the example above we provide the instance "this" to use as the view. We assume that "this" is a valid DisplayObjectContainer. 18 | 19 | # StageSync Extension (Bundled with MVCS) 20 | 21 | The Stage Sync Extension waits for a ContextView to be added as a configuration, and initializes and destroys the context based on the contextView's stage presence. 22 | 23 | ```as3 24 | _context = new Context() 25 | .install(ContextViewExtension, StageSyncExtension) 26 | .configure(new ContextView(this)); 27 | ``` 28 | 29 | Due to the StageSyncExtension the context above will automatically initialize when the Context View lands on the stage. 30 | 31 | ## Manual Context Initialization 32 | 33 | If you do not install the StageSync Extension or do not provide a Context View you must initialize the context manually: 34 | 35 | ```as3 36 | _context = new Context() 37 | .install(MyCompanyBundle) 38 | .configure(MyAppConfig, SomeOtherConfig) 39 | .initialize(); 40 | ``` 41 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/EventCommand/API/IEventCommandMap.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Extensions.CommandCenter.DSL; 10 | using Robotlegs.Bender.Extensions.CommandCenter.Impl; 11 | 12 | namespace Robotlegs.Bender.Extensions.EventCommand.API 13 | { 14 | public interface IEventCommandMap 15 | { 16 | /// 17 | /// Creates a mapping for an Event based trigger 18 | /// 19 | /// The Event type 20 | /// The concrete Event class 21 | ICommandMapper Map(Enum type, Type eventClass = null); 22 | ICommandMapper Map(Enum type); 23 | 24 | /// 25 | /// Unmaps an Event based trigger from a Command 26 | /// 27 | /// The Event type 28 | /// The concrete Event class 29 | ICommandUnmapper Unmap(Enum type, Type eventClass = null); 30 | ICommandUnmapper Unmap(Enum type); 31 | 32 | /// 33 | /// Adds a handler to a process mappings 34 | /// 35 | /// Self 36 | /// Function that accepts a mapping 37 | IEventCommandMap AddMappingProcessor(CommandMappingList.Processor handler); 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/ContextSupport/CallbackConfig.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | using Robotlegs.Bender.Framework.API; 10 | 11 | namespace Robotlegs.Bender.Framework.Impl.ContextSupport 12 | { 13 | public class CallbackConfig : IConfig 14 | { 15 | /*============================================================================*/ 16 | /* Private Properties */ 17 | /*============================================================================*/ 18 | 19 | private Action _callback; 20 | 21 | /*============================================================================*/ 22 | /* Constructor */ 23 | /*============================================================================*/ 24 | 25 | public CallbackConfig(Action callback) 26 | { 27 | _callback = callback; 28 | } 29 | 30 | /*============================================================================*/ 31 | /* Public Functions */ 32 | /*============================================================================*/ 33 | 34 | public void Configure() 35 | { 36 | _callback(); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Robotlegs/Bender/Extensions/DirectCommand/DSL/IDirectCommandConfigurator.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | namespace Robotlegs.Bender.Extensions.DirectCommand.API 9 | { 10 | public interface IDirectCommandConfigurator : IDirectCommandMapper 11 | { 12 | /// 13 | /// The 'execute' method to invoke on the Command instance 14 | /// 15 | /// Self 16 | /// The method name 17 | IDirectCommandConfigurator WithExecuteMethod(string name); 18 | 19 | /// 20 | /// Guards to check before allowing a command to execute 21 | /// 22 | /// Self 23 | /// Guards 24 | IDirectCommandConfigurator WithGuards(params object[] guards); 25 | 26 | /// 27 | /// Hooks to run before command execution 28 | /// 29 | /// Self 30 | /// Hooks 31 | IDirectCommandConfigurator WithHooks(params object[] hooks); 32 | 33 | /// 34 | /// Should the payload values be injected into the command instance? 35 | /// 36 | /// Self 37 | /// Toggle 38 | IDirectCommandConfigurator WithPayloadInjection(bool value = true); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/LoggingSupport/LogParams.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.LoggingSupport 11 | { 12 | public struct LogParams 13 | { 14 | /*============================================================================*/ 15 | /* Public Properties */ 16 | /*============================================================================*/ 17 | 18 | public object source; 19 | 20 | public LogLevel level; 21 | 22 | public DateTime timestamp; 23 | 24 | public object message; 25 | 26 | public object[] messageParameters; 27 | 28 | /*============================================================================*/ 29 | /* Constructor */ 30 | /*============================================================================*/ 31 | 32 | public LogParams(object source, LogLevel level, DateTime timestamp, object message, params object[] messageParameters) 33 | { 34 | this.source = source; 35 | this.level = level; 36 | this.timestamp = timestamp; 37 | this.message = message; 38 | this.messageParameters = messageParameters; 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /tests/Robotlegs/Bender/Framework/Impl/HookSupport/CallbackHook.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright (c) 2014-2016 the original author or authors. All Rights Reserved. 3 | // 4 | // NOTICE: You are permitted to use, modify, and distribute this file 5 | // in accordance with the terms of the license agreement accompanying it. 6 | //------------------------------------------------------------------------------ 7 | 8 | using System; 9 | 10 | namespace Robotlegs.Bender.Framework.Impl.HookSupport 11 | { 12 | public class CallbackHook 13 | { 14 | 15 | /*============================================================================*/ 16 | /* Public Properties */ 17 | /*============================================================================*/ 18 | 19 | [Inject(true, "hookCallback")] 20 | public Action callback; 21 | 22 | /*============================================================================*/ 23 | /* Constructor */ 24 | /*============================================================================*/ 25 | 26 | public CallbackHook(Action callback = null) 27 | { 28 | this.callback = callback; 29 | } 30 | 31 | /*============================================================================*/ 32 | /* Public Functions */ 33 | /*============================================================================*/ 34 | 35 | public void Hook() 36 | { 37 | if (callback != null) 38 | callback(); 39 | } 40 | } 41 | } 42 | 43 | --------------------------------------------------------------------------------