示例#1
0
  public OpacitySpriteEdit(LevelMap map, double opacity, boolean isRelative) {
    super();
    this.map = map;

    sprites = new ArrayList(map.selectedSprites);

    // save the sprites' old opacity
    for (int i = 0; i < sprites.size(); i++) {
      SpriteInstance sprite = sprites.get(i);
      oldOpacities.add(sprite.opacity);
    }

    // change the sprites' opacity and save their new opacity
    for (int i = 0; i < sprites.size(); i++) {
      SpriteInstance sprite = sprites.get(i);

      if (isRelative) sprite.opacity *= opacity;
      else sprite.opacity = opacity;
      sprite.setOpacity(sprite.opacity);

      newOpacities.add(sprite.opacity);
    }

    map.flagModified();
  }
示例#2
0
  public void redo() {
    for (int i = 0; i < sprites.size(); i++) {
      SpriteInstance sprite = sprites.get(i);
      sprite.opacity = newOpacities.get(i);
    }

    map.flagModified();
  }
示例#3
0
  public void redo() {
    layer.addSprite(sprite);
    sprite.isSelected = false;

    map.flagModified();
  }
示例#4
0
  public void undo() {
    layer.removeSprite(sprite);
    sprite.isSelected = false;

    map.flagModified();
  }