コード例 #1
0
  @Override
  public void resume(StateManager stateManager) {
    // if the device's resolution is our target size or lower, then we scale the game to our target
    // size
    // if(Game.P_WIDTH < Game.G_WIDTH && Game.P_HEIGHT < Game.G_HEIGHT)
    //	Game.shouldScale(true);
    // anything bigger and we don't scale
    // else
    //	Game.shouldScale(false);
    Game.shouldScale(true); // TODO: change this
    this.stateManager = stateManager;

    AssetManager am = this.stateManager.getAssetManager();

    // load gameplay assets and only the specific tiles for the map that the user chose
    GameplayAssets.loadGameplayAssets(am, tileSet);

    // create map
    if (map == null) map = new MapNPC(this, am, mapPath, gm);
    else gm.resume();

    map.resume(this, am, gm);

    paint = new Paint();
    switchTurnsFill = new Paint();
    switchTurnsFill.setColor(Color.BLACK);
    switchTurnsFont = new Paint();
    switchTurnsFont.setColor(Color.WHITE);
    switchTurnsFont.setTextAlign(Align.CENTER);
    switchTurnsFont.setTextSize(60); // TODO: scale this font size

    switchTurnsOKButton =
        new Button(
            GameplayAssets.okIcon,
            GameplayAssets.okArmedIcon,
            Game.G_WIDTH / 2 - (GameplayAssets.okIcon.getWidth() / 2),
            Game.G_HEIGHT / 2 + 30); // TODO: scale placement of button

    yesButton =
        new Button(
            GameplayAssets.yesIcon,
            GameplayAssets.yesArmedIcon,
            Game.G_WIDTH / 2 - GameplayAssets.yesIcon.getWidth() - 10,
            Game.G_HEIGHT / 2 + GameplayAssets.yesIcon.getHeight() / 2 + 30);
    noButton =
        new Button(
            GameplayAssets.noIcon,
            GameplayAssets.noArmedIcon,
            Game.G_WIDTH / 2 + 10,
            Game.G_HEIGHT / 2 + GameplayAssets.noIcon.getHeight() / 2 + 30);
    exitDialogPaint = new Paint();
    exitDialogPaint.setColor(Color.BLACK);
    exitDialogPaint.setAlpha(125);
  }
コード例 #2
0
 @Override
 public void dispose() {
   super.dispose();
   GameplayAssets.dispose();
   if (map != null) map.dispose();
 }