1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-05 09:47:18 -05:00
OpenDiablo2/OpenDiablo2.Core/AutofacModule.cs

38 lines
2.1 KiB
C#
Raw Normal View History

2018-11-22 00:18:42 -05:00
using Autofac;
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Common.Interfaces.Drawing;
using OpenDiablo2.Common.Interfaces.Mobs;
using OpenDiablo2.Core.GameState_;
using OpenDiablo2.Core.Map_Engine;
using OpenDiablo2.Core.UI;
2018-11-22 00:18:42 -05:00
namespace OpenDiablo2.Core
{
public sealed class AutofacModule : Module
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected override void Load(ContainerBuilder builder)
{
log.Info("Configuring OpenDiablo2.Core service implementations.");
2018-11-26 18:18:23 -05:00
builder.RegisterType<Button>().As<IButton>().InstancePerDependency();
builder.RegisterType<EngineDataManager>().As<IEngineDataManager>().SingleInstance();
builder.RegisterType<ItemManager>().As<IItemManager>().SingleInstance();
2018-11-22 00:18:42 -05:00
builder.RegisterType<GameEngine>().AsImplementedInterfaces().SingleInstance();
2018-11-26 18:18:23 -05:00
builder.RegisterType<GameState>().As<IGameState>().SingleInstance();
builder.RegisterType<MapEngine>().As<IMapEngine>().SingleInstance();
builder.RegisterType<MiniPanel>().As<IMiniPanel>().InstancePerDependency();
builder.RegisterType<PanelFrame>().As<IPanelFrame>().InstancePerDependency();
2018-12-07 18:45:23 -05:00
builder.RegisterType<CharacterPanel>().AsImplementedInterfaces().InstancePerDependency();
builder.RegisterType<InventoryPanel>().AsImplementedInterfaces().InstancePerDependency();
builder.RegisterType<ItemContainer>().As<IItemContainer>().InstancePerDependency();
2018-11-22 00:18:42 -05:00
builder.RegisterType<MPQProvider>().As<IMPQProvider>().SingleInstance();
builder.RegisterType<ResourceManager>().As<IResourceManager>().SingleInstance();
builder.RegisterType<TextDictionary>().As<ITextDictionary>().SingleInstance();
2018-11-26 18:18:23 -05:00
builder.RegisterType<TextBox>().As<ITextBox>().InstancePerDependency();
builder.RegisterType<MobManager>().As<IMobManager>().SingleInstance(); // TODO: This needs to have client and server versions...
2018-11-22 00:18:42 -05:00
}
}
}