1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-08 19:27:18 -05:00
OpenDiablo2/OpenDiablo2.Core/AutofacModule.cs
2018-11-24 22:34:16 -05:00

34 lines
1.5 KiB
C#

using Autofac;
using OpenDiablo2.Common.Interfaces;
using OpenDiablo2.Core.GameState_;
using OpenDiablo2.Core.Map_Engine;
using OpenDiablo2.Core.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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.");
builder.RegisterType<GameEngine>().AsImplementedInterfaces().SingleInstance();
builder.RegisterType<MPQProvider>().As<IMPQProvider>().SingleInstance();
builder.RegisterType<ResourceManager>().As<IResourceManager>().SingleInstance();
builder.RegisterType<TextDictionary>().As<ITextDictionary>().SingleInstance();
builder.RegisterType<Button>().AsSelf().InstancePerDependency(); // TODO: Never register as Self() if we aren't in common...
builder.RegisterType<TextBox>().AsSelf().InstancePerDependency(); // TODO: Never register as Self() if we aren't in common...
builder.RegisterType<GameState>().As<IGameState>().SingleInstance();
builder.RegisterType<EngineDataManager>().As<IEngineDataManager>().SingleInstance();
builder.RegisterType<MapEngine>().As<IMapEngine>().SingleInstance();
}
}
}