public AGSSayComponent(IGameState state, IGameFactory factory, IInput input, ISayLocationProvider location, FastFingerChecker fastFingerChecker, ISayConfig sayConfig, IBlockingEvent <BeforeSayEventArgs> onBeforeSay, ISoundEmitter emitter, ISpeechCache speechCache) { _state = state; _factory = factory; _input = input; _location = location; _fastFingerChecker = fastFingerChecker; _emitter = emitter; _speechCache = speechCache; SpeechConfig = sayConfig; OnBeforeSay = onBeforeSay; }
public AGSSayBehavior(IGameState state, IGameFactory factory, IInput input, ISayLocationProvider location, FastFingerChecker fastFingerChecker, ISayConfig sayConfig, IHasOutfit outfit, IFaceDirectionBehavior faceDirection, IBlockingEvent<BeforeSayEventArgs> onBeforeSay, ISoundEmitter emitter, ISpeechCache speechCache) { _state = state; _factory = factory; _input = input; _location = location; _fastFingerChecker = fastFingerChecker; _outfit = outfit; _faceDirection = faceDirection; _emitter = emitter; _speechCache = speechCache; SpeechConfig = sayConfig; OnBeforeSay = onBeforeSay; }
public Resolver(IDevice device) { Builder = new ContainerBuilder(); if (device.ConfigFile.DebugResolves) { Builder.RegisterModule(new AutofacResolveLoggingModule()); } Builder.RegisterAssemblyTypes(typeof(AGSGame).GetTypeInfo().Assembly). Except <SpatialAStarPathFinder>().AsImplementedInterfaces(); registerDevice(device); Builder.RegisterType <GLImageRenderer>().As <IImageRenderer>(); Builder.RegisterType <AGSObject>().As <IObject>(); Builder.RegisterType <GLImage>().As <IImage>(); Builder.RegisterType <AGSDialogActions>().As <IDialogActions>(); Builder.RegisterType <AGSSayLocationProvider>().As <ISayLocationProvider>(); Builder.RegisterType <AGSTreeNodeViewProvider>().As <ITreeNodeViewProvider>(); Builder.RegisterType <AGSGameState>().SingleInstance().As <IGameState>(); Builder.RegisterType <AGSGame>().SingleInstance().As <IGame>(); Builder.RegisterType <AGSGameEvents>().SingleInstance().As <IGameEvents>(); Builder.RegisterType <BitmapPool>().SingleInstance(); Builder.RegisterType <GLViewportMatrixFactory>().SingleInstance().As <IGLViewportMatrixFactory>(); Builder.RegisterType <ResourceLoader>().SingleInstance().As <IResourceLoader>(); Builder.RegisterType <AGSCutscene>().SingleInstance().As <ICutscene>(); Builder.RegisterType <AGSRoomTransitions>().SingleInstance().As <IAGSRoomTransitions>(); Builder.RegisterType <ALAudioSystem>().SingleInstance().As <IAudioSystem>(); Builder.RegisterType <RoomMusicCrossFading>().SingleInstance().As <ICrossFading>(); Builder.RegisterType <AGSAudioSettings>().SingleInstance().As <IAudioSettings>(); Builder.RegisterType <ALListener>().SingleInstance().As <IAudioListener>(); Builder.RegisterType <RenderThreadSyncContext>().SingleInstance().As <IRenderMessagePump>().As <IRenderThread>(); Builder.RegisterType <UpdateThreadSyncContext>().SingleInstance().As <IUpdateMessagePump>().As <IUpdateThread>(); Builder.RegisterType <AGSClassicSpeechCache>().SingleInstance().As <ISpeechCache>(); Builder.RegisterType <GLGraphicsFactory>().SingleInstance().As <IGraphicsFactory>(); Builder.RegisterType <GLUtils>().SingleInstance().As <IGLUtils>(); Builder.RegisterType <AGSFocusedUI>().SingleInstance().As <IFocusedUI>().As <IModalWindows>(); Builder.RegisterType <RoomLimitsFromBackground>().SingleInstance().As <IRoomLimitsProvider>(); Builder.RegisterType <UIEventsAggregator>().SingleInstance(); Builder.RegisterType <AGSDisplayList>().SingleInstance().As <IDisplayList>(); Builder.RegisterType <AGSHitTest>().SingleInstance().As <IHitTest>(); Builder.RegisterType <GLTextureCache>().SingleInstance().As <ITextureCache>(); registerComponents(); Builder.RegisterType <AGSSprite>().As <ISprite>(); Builder.RegisterType <AGSBoundingBoxesBuilder>().As <IBoundingBoxBuilder>(); Builder.RegisterType <AGSTranslate>().As <ITranslate>(); Builder.RegisterType <AGSScale>().As <IScale>(); Builder.RegisterType <AGSRotate>().As <IRotate>(); Builder.RegisterType <AGSHasImage>().As <IHasImage>(); Builder.RegisterType <AGSEvent>().As <IEvent>(); Builder.RegisterType <AGSEvent>().As <IBlockingEvent>(); Builder.RegisterType <AGSRestrictionList>().As <IRestrictionList>(); Builder.RegisterGeneric(typeof(AGSEvent <>)).As(typeof(IEvent <>)); Builder.RegisterGeneric(typeof(AGSEvent <>)).As(typeof(IBlockingEvent <>)); FastFingerChecker checker = new FastFingerChecker(); Builder.RegisterInstance(checker); Builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource()); foreach (var action in _overrides) { action(this); } }
public Resolver(IDevice device, IGameSettings settings) { Builder = new ContainerBuilder(); if (device.ConfigFile.DebugResolves) { Builder.RegisterModule(new AutofacResolveLoggingModule()); } Builder.RegisterAssemblyTypes(typeof(AGSGame).GetTypeInfo().Assembly). Except <SpatialAStarPathFinder>().AsImplementedInterfaces().ExternallyOwned(); registerDevice(device); RegisterType <GLImage, IImage>(); RegisterType <AGSDialogActions, IDialogActions>(); RegisterType <AGSSayLocationProvider, ISayLocationProvider>(); RegisterType <AGSTreeNodeViewProvider, ITreeNodeViewProvider>(); Builder.RegisterType <AGSGameState>().SingleInstance().As <IGameState>().As <IAGSGameState>(); Builder.RegisterType <AGSGame>().SingleInstance().As <IGame>(); Builder.RegisterType <AGSGameEvents>().SingleInstance().As <IGameEvents>(); Builder.RegisterType <BitmapPool>().SingleInstance(); Builder.RegisterType <ResourceLoader>().SingleInstance().As <IResourceLoader>(); Builder.RegisterType <AGSCutscene>().SingleInstance().As <ICutscene>(); Builder.RegisterType <AGSRoomTransitions>().SingleInstance().As <IRoomTransitions>(); Builder.RegisterType <ALAudioSystem>().SingleInstance().As <IALAudioSystem>(); Builder.RegisterType <AGSAudioSystem>().SingleInstance().As <IAudioSystem>(); Builder.RegisterType <RoomMusicCrossFading>().SingleInstance().As <ICrossFading>(); Builder.RegisterType <AGSAudioSettings>().SingleInstance().As <IAudioSettings>(); Builder.RegisterType <ALListener>().SingleInstance().As <IAudioListener>(); Builder.RegisterType <RenderThreadSyncContext>().SingleInstance().As <IRenderMessagePump>().As <IRenderThread>(); Builder.RegisterType <UpdateThreadSyncContext>().SingleInstance().As <IUpdateMessagePump>().As <IUpdateThread>(); Builder.RegisterType <AGSClassicSpeechCache>().SingleInstance().As <ISpeechCache>(); Builder.RegisterType <GLGraphicsFactory>().SingleInstance().As <IGraphicsFactory>(); Builder.RegisterType <GLUtils>().SingleInstance().As <IGLUtils>(); Builder.RegisterType <AGSFocusedUI>().SingleInstance().As <IFocusedUI>().As <IModalWindows>(); Builder.RegisterType <RoomLimitsFromBackground>().SingleInstance().As <IRoomLimitsProvider>(); Builder.RegisterType <UIEventsAggregator>().SingleInstance(); Builder.RegisterType <AGSDisplayList>().SingleInstance().As <IDisplayList>(); Builder.RegisterType <AGSHitTest>().SingleInstance().As <IHitTest>().As <IAGSHitTest>(); Builder.RegisterType <AGSCursor>().SingleInstance().As <IAGSCursor>(); Builder.RegisterType <GLTextureCache>().SingleInstance().As <ITextureCache>(); Builder.RegisterType <AGSDefaultInteractions>().SingleInstance().As <IDefaultInteractions>(); Builder.RegisterType <InventorySubscriptions>().SingleInstance(); Builder.RegisterType <AGSShouldBlockInput>().SingleInstance().As <IShouldBlockInput>(); Builder.RegisterType <AGSMaskLoader>().SingleInstance().As <IMaskLoader>(); Builder.RegisterType <AGSGameFactory>().SingleInstance().As <IGameFactory>(); Builder.RegisterType <ALAudioFactory>().SingleInstance().As <IAudioFactory>(); Builder.RegisterType <AGSCoordinates>().SingleInstance().As <ICoordinates>(); Builder.RegisterType <RoomTransitionWorkflow>().SingleInstance().As <IRoomTransitionWorkflow>(); Builder.RegisterType <AGSGameLoop>().SingleInstance().As <IGameLoop>(); //Registering lambdas for increasing performance Builder.Register <IPanel>((c, p) => new AGSPanel(p.TypedAs <string>(), this)).ExternallyOwned(); Builder.Register <IButton>((c, p) => new AGSButton(p.TypedAs <string>(), this)).ExternallyOwned(); Builder.Register <ILabel>((c, p) => new AGSLabel(p.TypedAs <string>(), this)).ExternallyOwned(); Builder.Register <IObject>((c, p) => new AGSObject(p.TypedAs <string>(), this)).ExternallyOwned(); Builder.Register <ISlider>((c, p) => new AGSSlider(p.TypedAs <string>(), this)).ExternallyOwned(); Builder.Register <ITextBox>((c, p) => new AGSTextbox(p.TypedAs <string>(), this)).ExternallyOwned(); Builder.Register <ICheckBox>((c, p) => new AGSCheckBox(p.TypedAs <string>(), this)).ExternallyOwned(); Builder.Register <IComboBox>((c, p) => new AGSComboBox(p.TypedAs <string>(), this)).ExternallyOwned(); registerComponents(); //Registering lambdas for increasing performance Builder.Register <ITranslateComponent>((c, p) => new AGSTranslateComponent(c.Resolve <ITranslate>())).ExternallyOwned(); Builder.Register <ITranslate>((c, p) => new AGSTranslate()).ExternallyOwned(); Builder.Register <IScaleComponent>((c, p) => new AGSScaleComponent(c.Resolve <IScale>())).ExternallyOwned(); Builder.Register <IScale>((c, p) => new AGSScale()).ExternallyOwned(); Builder.Register <IRotateComponent>((c, p) => new AGSRotateComponent(c.Resolve <IRotate>())).ExternallyOwned(); Builder.Register <IRotate>((c, p) => new AGSRotate()).ExternallyOwned(); Builder.Register <IDrawableInfoComponent>((c, p) => new AGSDrawableInfoComponent()).ExternallyOwned(); Builder.Register <IUIEvents>((c, p) => new AGSUIEvents(c.Resolve <UIEventsAggregator>())).ExternallyOwned(); Builder.Register <ISkinComponent>((c, p) => new AGSSkinComponent(c.Resolve <IGameSettings>())).ExternallyOwned(); Builder.Register <IHasRoomComponent>((c, p) => new HasRoomComponent(c.Resolve <IGameState>())).ExternallyOwned(); Builder.Register <IAnimationComponent>((c, p) => new AGSAnimationComponent()).ExternallyOwned(); Builder.Register <IInObjectTreeComponent>((c, p) => new InObjectTreeComponent()).ExternallyOwned(); Builder.Register <IColliderComponent>((c, p) => new AGSCollider(c.Resolve <IGameState>())).ExternallyOwned(); Builder.Register <IVisibleComponent>((c, p) => new VisibleProperty()).ExternallyOwned(); Builder.Register <IEnabledComponent>((c, p) => new EnabledProperty()).ExternallyOwned(); Builder.Register <ICustomPropertiesComponent>((c, p) => new AGSCustomPropertiesComponent(c.Resolve <ICustomProperties>())).ExternallyOwned(); Builder.Register <IShaderComponent>((c, p) => new AGSShaderComponent()).ExternallyOwned(); Builder.Register <IBorderComponent>((c, p) => new AGSBorderComponent(c.Resolve <IRenderPipeline>())).ExternallyOwned(); Builder.Register <IPixelPerfectComponent>((c, p) => new AGSPixelPerfectComponent()).ExternallyOwned(); Builder.Register <IModelMatrixComponent>((c, p) => new AGSModelMatrixComponent(c.Resolve <IRuntimeSettings>())).ExternallyOwned(); Builder.Register <IWorldPositionComponent>((c, p) => new AGSWorldPositionComponent()).ExternallyOwned(); RegisterType <AGSSprite, ISprite>(); RegisterType <AGSBoundingBoxesBuilder, IBoundingBoxBuilder>(); RegisterType <AGSHasImage, IHasImage>(); RegisterType <AGSEvent, IEvent>(); RegisterType <AGSEvent, IBlockingEvent>(); RegisterType <AGSRestrictionList, IRestrictionList>(); Builder.RegisterGeneric(typeof(AGSEvent <>)).As(typeof(IEvent <>)).ExternallyOwned(); Builder.RegisterGeneric(typeof(AGSEvent <>)).As(typeof(IBlockingEvent <>)).ExternallyOwned(); FastFingerChecker checker = new FastFingerChecker(); Builder.RegisterInstance(checker); Builder.RegisterInstance(settings).As <IGameSettings>(); Builder.RegisterSource(new ResolveAnythingSource()); foreach (var action in _overrides) { action(this); } }
public Resolver(IEngineConfigFile configFile) { Builder = new ContainerBuilder (); if (configFile.DebugResolves) { Builder.RegisterModule(new AutofacResolveLoggingModule ()); } Builder.RegisterAssemblyTypes(typeof(AGSGame).GetTypeInfo().Assembly). Except<SpatialAStarPathFinder>().AsImplementedInterfaces(); Builder.RegisterType<GLImageRenderer>().As<IImageRenderer>(); Builder.RegisterType<AGSObject>().As<IObject>(); Builder.RegisterType<GLImage>().As<IImage>(); Builder.RegisterType<AGSDialogActions>().As<IDialogActions>(); Builder.RegisterType<AGSSayLocationProvider>().As<ISayLocationProvider>(); Builder.RegisterType<AGSGameState>().SingleInstance().As<IGameState>(); Builder.RegisterType<AGSGame>().SingleInstance().As<IGame>(); Builder.RegisterType<AGSGameEvents>().SingleInstance().As<IGameEvents>(); Builder.RegisterType<BitmapPool>().SingleInstance(); Builder.RegisterType<GLViewportMatrixFactory>().SingleInstance().As<IGLViewportMatrixFactory>(); Builder.RegisterType<ResourceLoader>().SingleInstance().As<IResourceLoader>(); Builder.RegisterType<AGSCutscene>().SingleInstance().As<ICutscene>(); Builder.RegisterType<AGSRoomTransitions>().SingleInstance().As<IAGSRoomTransitions>(); Builder.RegisterType<ALAudioSystem>().SingleInstance().As<IAudioSystem>(); Builder.RegisterType<RoomMusicCrossFading>().SingleInstance().As<ICrossFading>(); Builder.RegisterType<AGSAudioSettings>().SingleInstance().As<IAudioSettings>(); Builder.RegisterType<ALListener>().SingleInstance().As<IAudioListener>(); Builder.RegisterType<AGSSyncContext>().SingleInstance().As<IMessagePump>(); Builder.RegisterType<AGSClassicSpeechCache>().SingleInstance().As<ISpeechCache>(); Builder.RegisterType<GLGraphicsFactory>().SingleInstance().As<IGraphicsFactory>(); Builder.RegisterType<GLUtils>().SingleInstance().As<IGLUtils>(); registerComponents(); Builder.RegisterType<AGSSprite>().As<ISprite>(); Builder.RegisterType<GLMatrixBuilder>().As<IGLMatrixBuilder>(); Builder.RegisterType<GLBoundingBoxesBuilder>().As<IGLBoundingBoxBuilder>(); Builder.RegisterType<AGSPixelPerfectCollidable>().As<IPixelPerfectCollidable>(); Builder.RegisterType<AGSTranslate>().As<ITranslate>(); Builder.RegisterType<AGSScale>().As<IScale>(); Builder.RegisterType<AGSRotate>().As<IRotate>(); Builder.RegisterType<AGSHasImage>().As<IHasImage>(); Builder.RegisterGeneric(typeof(AGSEvent<>)).As(typeof(IEvent<>)); Builder.RegisterGeneric(typeof(AGSEvent<>)).As(typeof(IBlockingEvent<>)); Dictionary<string, ITexture> textures = new Dictionary<string, ITexture> (1024); Builder.RegisterInstance(textures); Builder.RegisterInstance(textures).As(typeof(IDictionary<string, ITexture>)); FastFingerChecker checker = new FastFingerChecker (); Builder.RegisterInstance(checker); Builder.RegisterInstance(Hooks.GraphicsBackend).As<IGraphicsBackend>(); Builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource()); foreach (var action in _overrides) action(this); }