예제 #1
0
  @Override
  public void init(GameEngine engine) {
    EngineTime time = (EngineTime) CoreRegistry.get(Time.class);
    time.setPaused(true);
    time.setGameTime(0);

    CoreRegistry.get(Game.class).load(gameManifest);
    switch (netMode) {
      case CLIENT:
        initClient();
        break;
      default:
        initHost();
        break;
    }

    progress = 0;
    maxProgress = 0;
    for (LoadProcess process : loadProcesses) {
      maxProgress += process.getExpectedCost();
    }

    popStep();
    loadingScreen = nuiManager.setScreen("engine:loadingScreen", LoadingScreen.class);
    loadingScreen.updateStatus(current.getMessage(), current.getProgress());
  }
예제 #2
0
 @Override
 public void update(float delta) {
   long startTime = 1000 * Sys.getTime() / Sys.getTimerResolution();
   while (current != null && 1000 * Sys.getTime() / Sys.getTimerResolution() - startTime < 20) {
     if (current.step()) {
       popStep();
     }
   }
   if (current == null) {
     nuiManager.popScreen();
     CoreRegistry.get(GameEngine.class).changeState(new StateIngame());
   } else {
     float progressValue =
         (progress + current.getExpectedCost() * current.getProgress()) / maxProgress;
     loadingScreen.updateStatus(current.getMessage(), progressValue);
     nuiManager.update(delta);
   }
 }