Beispiel #1
0
  private void setTheme(Theme theme) {
    if (theme == null) return;

    Sui.setTheme(theme);

    colors[0] = theme.getActiveTitleBar1();
    colors[1] = theme.getActiveTitleBar2();
    colors[2] = theme.getBackground();
    colors[3] = theme.getDisabledMask();
    colors[4] = theme.getForeground();
    colors[5] = theme.getPrimary1();
    colors[6] = theme.getPrimary2();
    colors[7] = theme.getPrimary3();
    colors[8] = theme.getPrimaryBorder1();
    colors[9] = theme.getPrimaryBorder2();
    colors[10] = theme.getSecondary1();
    colors[11] = theme.getSecondary2();
    colors[12] = theme.getSecondary3();
    colors[13] = theme.getSecondaryBorder1();
    colors[14] = theme.getSecondaryBorder2();
    colors[15] = theme.getTitleBar1();
    colors[16] = theme.getTitleBar2();

    for (int i = 0; i < labels.length; i++) {
      Color c = colors[i];
      labels[i].setBackground(new Color(c.r, c.g, c.b, c.a));
      methodNames[i].setBackground(theme.getBackground());
      methodNames[i].setForeground(theme.getForeground());
    }
    nameLabel.setForeground(theme.getForeground());
    nameLabel.setText(theme.getName());

    Sui.updateComponentTreeTheme(display);
  }
Beispiel #2
0
  public void takeDamage(int dmg) {
    // battle text points
    damageTaken.setText("-" + Integer.toString(dmg));
    damageTaken.pack();
    deltaDamage = show_damage_time;

    int x = getPos().getX() - targeted.getPos().getX();
    int y = getPos().getY() - targeted.getPos().getY();

    int center_x = 7 * 50 + 10;
    int center_y = 5 * 50 + 10;
    x = center_x + x * 50 + 30;
    y = center_y + y * 50 + 10;

    damageTaken.setLocation(x, y);

    this.hp -= dmg;
    if (this.hp < 1) {
      this.hp = 0;
      setDead(true);
    }
  }