using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Ninject.Extensions.Factory;
using Ninject.Modules;
using V3.AI;
using V3.AI.Internal;
using V3.Camera;
using V3.Data;
using V3.Data.Internal;
using V3.Effects;
using V3.Input;
using V3.Input.Internal;
using V3.Map;
using V3.Screens;
using V3.Objects;
using V3.Widgets;
namespace V3
{
///
/// Defines the bindings of constants, factories and singletons for the
/// Ninject dependency injection framework.
///
public sealed class Bindings : NinjectModule
{
private readonly V3Game mGame;
private readonly GraphicsDeviceManager mGraphicsDeviceManager;
///
/// Creates a new Bindings instance for the given game and graphics
/// device manager.
///
/// the game that uses this instance
/// the graphics device manager
/// instance to use in this instance
public Bindings(V3Game game, GraphicsDeviceManager graphicsDeviceManager)
{
mGame = game;
mGraphicsDeviceManager = graphicsDeviceManager;
}
public override void Load()
{
// constants
Bind().ToConstant(mGame.Content);
Bind().ToConstant(mGame);
Bind().ToConstant(mGraphicsDeviceManager);
// factories
Bind().ToFactory();
Bind().ToFactory();
Bind().ToFactory();
Bind().ToFactory();
Bind().ToFactory();
// singletons
Bind().To().InSingletonScope();
Bind().To().InSingletonScope();
Bind().To().InSingletonScope();
Bind().To().InSingletonScope();
Bind().ToSelf().InSingletonScope();
Bind().To().InSingletonScope();
Bind().To().InSingletonScope();
Bind().ToSelf().InSingletonScope();
Bind().ToSelf().InSingletonScope();
Bind().To().InSingletonScope();
Bind().ToSelf().InSingletonScope();
// regular bindings
Bind().To();
Bind().To();
Bind().To();
}
}
}