示例#1
0
  private void initManagers() {

    SplashScreen.getInstance().post("Loading modules ...");
    ModuleManager moduleManager =
        CoreRegistry.putPermanently(ModuleManager.class, new ModuleManagerImpl());

    SplashScreen.getInstance().post("Loading reflections ...");
    ReflectFactory reflectFactory =
        CoreRegistry.putPermanently(ReflectFactory.class, new ReflectionReflectFactory());
    CopyStrategyLibrary copyStrategyLibrary =
        CoreRegistry.putPermanently(
            CopyStrategyLibrary.class, new CopyStrategyLibrary(reflectFactory));

    CoreRegistry.putPermanently(
        TypeSerializationLibrary.class,
        new TypeSerializationLibrary(reflectFactory, copyStrategyLibrary));

    SplashScreen.getInstance().post("Loading assets ...");
    AssetManager assetManager =
        CoreRegistry.putPermanently(
            AssetManager.class, new AssetManagerImpl(moduleManager.getEnvironment()));
    assetManager.setEnvironment(moduleManager.getEnvironment());
    CoreRegistry.putPermanently(CollisionGroupManager.class, new CollisionGroupManager());
    CoreRegistry.putPermanently(WorldGeneratorManager.class, new WorldGeneratorManager());
    CoreRegistry.putPermanently(ComponentSystemManager.class, new ComponentSystemManager());
    CoreRegistry.putPermanently(
        ParameterAdapterManager.class, ParameterAdapterManager.createCore());
    CoreRegistry.putPermanently(NetworkSystem.class, new NetworkSystemImpl(time));
    CoreRegistry.putPermanently(Game.class, new Game(this, time));
    assetManager.setEnvironment(moduleManager.getEnvironment());

    AssetType.registerAssetTypes(assetManager);
    ApplyModulesUtil.applyModules();
  }
 @Override
 public void initialise(GameEngine engine, Context rootContext) {
   rootContext.put(ParameterAdapterManager.class, ParameterAdapterManager.createCore());
 }