Apply BASE new MapLabels feature

This commit is contained in:
2023-10-31 19:44:34 +01:00
parent f74548713d
commit 3b99bc561a
27 changed files with 160 additions and 112 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -101,14 +101,16 @@ INSERT INTO "PUBLIC"."ENEMY_DROP" VALUES
(9, 'skeleton_archer', 'ranged:wooden_bow', 0.3, '1'), (9, 'skeleton_archer', 'ranged:wooden_bow', 0.3, '1'),
(10, 'skeleton_archer', 'ammo:wooden_arrow', 0.7, '1d4+3'), (10, 'skeleton_archer', 'ammo:wooden_arrow', 0.7, '1d4+3'),
(11, 'deku', 'junk:eye', 0.7, '1d2'); (11, 'deku', 'junk:eye', 0.7, '1d2');
CREATE MEMORY TABLE "PUBLIC"."START_GAME"( CREATE MEMORY TABLE "PUBLIC"."CONFIG"(
"ID" SMALLINT NOT NULL, "KEY" VARCHAR NOT NULL,
"START_POINT" VARCHAR NOT NULL "VALUE" VARCHAR
); );
ALTER TABLE "PUBLIC"."START_GAME" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_C0" PRIMARY KEY("ID"); ALTER TABLE "PUBLIC"."CONFIG" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_7" PRIMARY KEY("KEY");
-- 1 +/- SELECT COUNT(*) FROM PUBLIC.START_GAME; -- 3 +/- SELECT COUNT(*) FROM PUBLIC.CONFIG;
INSERT INTO "PUBLIC"."START_GAME" VALUES INSERT INTO "PUBLIC"."CONFIG" VALUES
(1, 'Forrest,Main,1,12'); ('start_game', 'Hero Home,Main,Start'),
('screen', '1000x800'),
('camera_scale', '2');
CREATE MEMORY TABLE "PUBLIC"."LEVELS"( CREATE MEMORY TABLE "PUBLIC"."LEVELS"(
"LEVEL" INT DEFAULT NEXT VALUE FOR "PUBLIC"."SYSTEM_SEQUENCE_704587BB_DC0E_44AB_A7F0_3DE0CA44FE3F" NOT NULL NULL_TO_DEFAULT SEQUENCE "PUBLIC"."SYSTEM_SEQUENCE_704587BB_DC0E_44AB_A7F0_3DE0CA44FE3F", "LEVEL" INT DEFAULT NEXT VALUE FOR "PUBLIC"."SYSTEM_SEQUENCE_704587BB_DC0E_44AB_A7F0_3DE0CA44FE3F" NOT NULL NULL_TO_DEFAULT SEQUENCE "PUBLIC"."SYSTEM_SEQUENCE_704587BB_DC0E_44AB_A7F0_3DE0CA44FE3F",
"MAX_HP" VARCHAR NOT NULL "MAX_HP" VARCHAR NOT NULL
@@ -132,9 +134,10 @@ CREATE MEMORY TABLE "PUBLIC"."THROWING_WEAPON"(
"ICON" VARCHAR NOT NULL "ICON" VARCHAR NOT NULL
); );
ALTER TABLE "PUBLIC"."THROWING_WEAPON" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_40" PRIMARY KEY("ID"); ALTER TABLE "PUBLIC"."THROWING_WEAPON" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_40" PRIMARY KEY("ID");
-- 1 +/- SELECT COUNT(*) FROM PUBLIC.THROWING_WEAPON; -- 2 +/- SELECT COUNT(*) FROM PUBLIC.THROWING_WEAPON;
INSERT INTO "PUBLIC"."THROWING_WEAPON" VALUES INSERT INTO "PUBLIC"."THROWING_WEAPON" VALUES
('deku_arrow', 'Deku''s arrow', 500, '2d4', 'Arrow', 'Arrow', '5d4', 'Punch', 'Arrow punch', 'Poof', 'Arrow punch', 'Generic,8,10'); ('deku_arrow', 'Deku''s arrow', 500, '2d4', 'Arrow', 'Arrow', '5d4', 'Punch', 'Arrow punch', 'Poof', 'Arrow punch', 'Generic,8,10'),
('shuriken', 'Shuriken', 100, '3d6', 'Shuriken', 'Arrow', '5d4', 'Punch', 'Arrow punch', 'Poof', 'Arrow punch', 'Generic,9,2');
CREATE MEMORY TABLE "PUBLIC"."ENEMY"( CREATE MEMORY TABLE "PUBLIC"."ENEMY"(
"ID" VARCHAR NOT NULL, "ID" VARCHAR NOT NULL,
"NAME" VARCHAR NOT NULL, "NAME" VARCHAR NOT NULL,

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -4,6 +4,9 @@ import com.bartlomiejpluta.demo.world.item.Item;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import java.util.Arrays;
import java.util.Collection;
import java.util.Random;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
public class Chest extends MapObject { public class Chest extends MapObject {
@@ -29,4 +32,30 @@ public class Chest extends MapObject {
throw new IllegalStateException("Chest is full!"); throw new IllegalStateException("Chest is full!");
} }
public Chest addItem(Item item, int slot) {
if(slot >= content.length) {
throw new IllegalStateException("The [" + slot + "] slot exceeds the chest size (" + content.length + ")!");
}
if (content[slot] != null) {
throw new IllegalStateException("The [" + slot + "] slot is already filled!");
}
content[slot] = item;
return this;
}
public Chest shuffle() {
var random = new Random();
for(int i = content.length - 1; i > 0; --i) {
var index = random.nextInt(i + 1);
var tmp = content[index];
content[index] = content[i];
content[i] = tmp;
}
return this;
}
} }

View File

@@ -1,6 +1,7 @@
package com.bartlomiejpluta.demo.entity; package com.bartlomiejpluta.demo.entity;
import A.maps; import A.maps;
import com.bartlomiejpluta.base.api.map.layer.object.MapPin;
import com.bartlomiejpluta.demo.runner.DemoRunner; import com.bartlomiejpluta.demo.runner.DemoRunner;
import lombok.NonNull; import lombok.NonNull;
@@ -13,12 +14,23 @@ public class Door extends MapObject {
private final int layerId; private final int layerId;
private final Player player; private final Player player;
public Door(@NonNull MapPin label, @NonNull String id) {
super(id);
this.mapUid = label.getMap();
this.layerId = label.getLayer();
this.targetX = label.getX();
this.targetY = label.getY();
player = DemoRunner.instance().getPlayer();
setPositionOffset(0, 16);
}
public Door(@NonNull String mapName, @NonNull String layerName, int targetX, int targetY, @NonNull String id) { public Door(@NonNull String mapName, @NonNull String layerName, int targetX, int targetY, @NonNull String id) {
super(id); super(id);
this.mapUid = maps.get(mapName).uid; var map = maps.byName(mapName);
this.mapUid = map.$;
this.targetX = targetX; this.targetX = targetX;
this.targetY = targetY; this.targetY = targetY;
this.layerId = maps.getLayer(mapName, layerName); this.layerId = map.layer(layerName).$;
player = DemoRunner.instance().getPlayer(); player = DemoRunner.instance().getPlayer();
setPositionOffset(0, 16); setPositionOffset(0, 16);
} }

View File

@@ -49,7 +49,7 @@ public class Enemy extends Creature implements NPC {
} }
public Enemy(@NonNull DB.model.EnemyModel template) { public Enemy(@NonNull DB.model.EnemyModel template) {
super(ContextHolder.INSTANCE.getContext().createCharacter(A.charsets.get(template.getCharset()).uid)); super(ContextHolder.INSTANCE.getContext().createCharacter(A.charsets.byName(template.getCharset()).$));
this.template = template; this.template = template;
name = template.getName(); name = template.getName();
maxHp = DiceRoller.roll(template.getHp()); maxHp = DiceRoller.roll(template.getHp());
@@ -78,7 +78,7 @@ public class Enemy extends Creature implements NPC {
this.throwingWeapon = new ThrowingWeapon(split[0], DiceRoller.roll(split[1])); this.throwingWeapon = new ThrowingWeapon(split[0], DiceRoller.roll(split[1]));
} }
this.dieAnimation = new SimpleAnimationRunner(A.animations.get(template.getDieAnimation()).uid); this.dieAnimation = new SimpleAnimationRunner(A.animations.byName(template.getDieAnimation()).$);
} }
@Override @Override
@@ -94,7 +94,7 @@ public class Enemy extends Creature implements NPC {
@Override @Override
public void die() { public void die() {
super.die(); super.die();
changeCharacterSet(A.charsets.get(template.getDeadCharset()).uid); changeCharacterSet(A.charsets.byName(template.getDeadCharset()).$);
setScale(0.5f); setScale(0.5f);
setBlocking(false); setBlocking(false);
setZIndex(-1); setZIndex(-1);
@@ -102,7 +102,7 @@ public class Enemy extends Creature implements NPC {
ai = NoopAI.INSTANCE; ai = NoopAI.INSTANCE;
dieAnimation.run(context, getLayer(), this); dieAnimation.run(context, getLayer(), this);
context.playSound(A.sounds.get(template.getDieSound()).uid); context.playSound(A.sounds.byName(template.getDieSound()).$);
context.fireEvent(new EnemyDiedEvent(this)); context.fireEvent(new EnemyDiedEvent(this));
LootGenerator.generate(template.getId(), loot); LootGenerator.generate(template.getId(), loot);

View File

@@ -22,11 +22,11 @@ public abstract class MapObject extends com.bartlomiejpluta.base.util.world.MapO
} }
public MapObject(@NonNull DB.model.ObjectModel template) { public MapObject(@NonNull DB.model.ObjectModel template) {
super(ContextHolder.INSTANCE.getContext().createCharacter(A.charsets.get(template.getCharset()).uid), template.getFrame()); super(ContextHolder.INSTANCE.getContext().createCharacter(A.charsets.byName(template.getCharset()).$), template.getFrame());
this.context = ContextHolder.INSTANCE.getContext(); this.context = ContextHolder.INSTANCE.getContext();
this.runner = DemoRunner.instance(); this.runner = DemoRunner.instance();
this.name = template.getName(); this.name = template.getName();
this.interactSound = A.sounds.get(template.getInteractSound()).uid; this.interactSound = A.sounds.byName(template.getInteractSound()).$;
} }
@Override @Override

View File

@@ -28,7 +28,7 @@ public class Player extends Creature {
this.hp = this.maxHp; this.hp = this.maxHp;
alive = true; alive = true;
changeCharacterSet(A.charsets.luna.uid); changeCharacterSet(A.charsets.luna.$);
setScale(1f); setScale(1f);
setSpeed(4f); setSpeed(4f);
setAnimationSpeed(1f); setAnimationSpeed(1f);

View File

@@ -58,7 +58,7 @@ public class EquipmentWindow extends DecoratedWindow {
public EquipmentWindow(Context context, GUI gui, Map<String, Component> refs) { public EquipmentWindow(Context context, GUI gui, Map<String, Component> refs) {
super(context, gui, refs); super(context, gui, refs);
this.player = DemoRunner.instance().getPlayer(); this.player = DemoRunner.instance().getPlayer();
this.popupMenuWindow = gui.inflateWindow(A.widgets.eq_item_menu.uid); this.popupMenuWindow = gui.inflateWindow(A.widgets.eq_item_menu.$);
this.popupMenu = popupMenuWindow.reference("menu", VOptionChoice.class); this.popupMenu = popupMenuWindow.reference("menu", VOptionChoice.class);
this.useBtn = popupMenuWindow.reference("use", Button.class); this.useBtn = popupMenuWindow.reference("use", Button.class);
this.dropBtn = popupMenuWindow.reference("drop", Button.class); this.dropBtn = popupMenuWindow.reference("drop", Button.class);

View File

@@ -81,7 +81,7 @@ public class ItemIconView extends IconView {
@Attribute(value = "placeholder", separator = ",") @Attribute(value = "placeholder", separator = ",")
public void setPlaceholderIcon(String icon, int row, int column) { public void setPlaceholderIcon(String icon, int row, int column) {
this.placeholderIconPaint = gui.createPaint(); this.placeholderIconPaint = gui.createPaint();
this.placeholderIconSet = gui.getIconSet(A.iconsets.get(icon).uid); this.placeholderIconSet = gui.getIconSet(A.iconsets.byName(icon).$);
this.placeholderIconSetRow = row; this.placeholderIconSetRow = row;
this.placeholderIconSetColumn = column; this.placeholderIconSetColumn = column;
} }
@@ -121,7 +121,7 @@ public class ItemIconView extends IconView {
if (item != null && item instanceof ItemStack stack) { if (item != null && item instanceof ItemStack stack) {
gui.beginPath(); gui.beginPath();
gui.setFontFace(fonts.roboto_regular.uid); gui.setFontFace(fonts.roboto_regular.$);
gui.setFontSize(17); gui.setFontSize(17);
gui.putText(x + 15, y + 5, String.valueOf(stack.getCount())); gui.putText(x + 15, y + 5, String.valueOf(stack.getCount()));
gui.setFillColor(textColor); gui.setFillColor(textColor);

View File

@@ -1,13 +1,16 @@
package com.bartlomiejpluta.demo.map; package com.bartlomiejpluta.demo.map;
import A.maps;
import com.bartlomiejpluta.base.api.camera.Camera; import com.bartlomiejpluta.base.api.camera.Camera;
import com.bartlomiejpluta.base.api.context.Context; import com.bartlomiejpluta.base.api.context.Context;
import com.bartlomiejpluta.base.api.entity.Entity;
import com.bartlomiejpluta.base.api.gui.Window; import com.bartlomiejpluta.base.api.gui.Window;
import com.bartlomiejpluta.base.api.gui.WindowPosition; import com.bartlomiejpluta.base.api.gui.WindowPosition;
import com.bartlomiejpluta.base.api.icon.Icon; import com.bartlomiejpluta.base.api.icon.Icon;
import com.bartlomiejpluta.base.api.input.Input; import com.bartlomiejpluta.base.api.input.Input;
import com.bartlomiejpluta.base.api.input.Key; import com.bartlomiejpluta.base.api.input.Key;
import com.bartlomiejpluta.base.api.map.handler.MapHandler; import com.bartlomiejpluta.base.api.map.handler.MapHandler;
import com.bartlomiejpluta.base.api.map.layer.object.MapPin;
import com.bartlomiejpluta.base.api.map.layer.object.ObjectLayer; import com.bartlomiejpluta.base.api.map.layer.object.ObjectLayer;
import com.bartlomiejpluta.base.api.map.model.GameMap; import com.bartlomiejpluta.base.api.map.model.GameMap;
import com.bartlomiejpluta.base.api.move.Direction; import com.bartlomiejpluta.base.api.move.Direction;
@@ -87,63 +90,42 @@ public abstract class BaseMapHandler implements MapHandler {
return guiManager.showDialog(message, WindowPosition.BOTTOM); return guiManager.showDialog(message, WindowPosition.BOTTOM);
} }
public Enemy enemy(@NonNull String id) { protected <T extends Entity> T addEntity(T entity, MapPin tile) {
return new Enemy(id); entity.setCoordinates(tile.getX(), tile.getY());
map.getObjectLayer(tile.getLayer()).addEntity(entity);
return entity;
} }
public Enemy enemy(ObjectLayer layer, int x, int y, @NonNull String id) { public Enemy enemy(@NonNull MapPin tile, @NonNull String id) {
var enemy = new Enemy(id); return addEntity(new Enemy(id), tile);
enemy.setCoordinates(x, y);
layer.addEntity(enemy);
return enemy;
} }
public Chest chest(ObjectLayer layer, int x, int y, @NonNull String id) { public Chest chest(@NonNull MapPin tile, @NonNull String id) {
var chest = new Chest(id); return addEntity(new Chest(id), tile);
chest.setCoordinates(x, y);
layer.addEntity(chest);
return chest;
} }
public Door door(ObjectLayer layer, int x, int y, @NonNull String mapName, @NonNull String layerName, int targetX, int targetY, @NonNull String id) { public Door door(@NonNull MapPin tile, @NonNull MapPin target, @NonNull String id) {
var door = new Door(mapName, layerName, targetX, targetY, id); return addEntity(new Door(target, id), tile);
door.setCoordinates(x, y);
layer.addEntity(door);
return door;
} }
public CharacterSpawner spawner(ObjectLayer layer, int x, int y) { public CharacterSpawner spawner(@NonNull MapPin tile) {
var spawner = new CharacterSpawner().trackEntities(EnemyDiedEvent.TYPE); return addEntity(new CharacterSpawner().trackEntities(EnemyDiedEvent.TYPE), tile);
spawner.setCoordinates(x, y);
layer.addEntity(spawner);
return spawner;
} }
public Medicament medicament(@NonNull String id, int count) { public Medicament medicament(@NonNull MapPin tile, @NonNull String id, int count) {
return new Medicament(id, count); return addEntity(new Medicament(id, count), tile);
} }
public Medicament medicament(ObjectLayer layer, int x, int y, @NonNull String id, int count) { public Icon icon(@NonNull MapPin tile, String iconSetUid, int row, int column) {
var medicament = new Medicament(id, count);
medicament.setCoordinates(x, y);
layer.addEntity(medicament);
return medicament;
}
public Icon icon(ObjectLayer layer, int x, int y, String iconSetUid, int row, int column) {
var icon = context.createIcon(iconSetUid, row, column); var icon = context.createIcon(iconSetUid, row, column);
icon.setScale(1f); icon.setScale(1f);
icon.setZIndex(-1); icon.setZIndex(-1);
icon.setCoordinates(x, y); return addEntity(icon, tile);
layer.addEntity(icon);
return icon;
} }
public Warp warp(ObjectLayer layer, int x, int y, String targetMap, String targetLayer, int targetX, int targetY) { public Warp warp(@NonNull MapPin tile, MapPin target) {
var warp = new Warp(A.maps.get(targetMap).uid, A.maps.getLayer(targetMap, targetLayer), targetX, targetY); var warp = new Warp(target);
warp.setEntity(player); warp.setEntity(player);
warp.setCoordinates(x, y); return addEntity(warp, tile);
layer.addEntity(warp);
return warp;
} }
} }

View File

@@ -36,20 +36,20 @@ public class GuiManager {
this.gui.setRoot(this.manager); this.gui.setRoot(this.manager);
this.startMenu = gui.inflateWindow(A.widgets.start_menu.uid, StartMenuWindow.class); this.startMenu = gui.inflateWindow(A.widgets.start_menu.$, StartMenuWindow.class);
this.startMenu.reference("new_game", Button.class).setAction(runner::newGame); this.startMenu.reference("new_game", Button.class).setAction(runner::newGame);
this.startMenu.reference("exit", Button.class).setAction(runner::exit); this.startMenu.reference("exit", Button.class).setAction(runner::exit);
this.equipment = gui.inflateWindow(A.widgets.equipment.uid, EquipmentWindow.class); this.equipment = gui.inflateWindow(A.widgets.equipment.$, EquipmentWindow.class);
this.gameMenu = gui.inflateWindow(A.widgets.game_menu.uid, GameMenuWindow.class); this.gameMenu = gui.inflateWindow(A.widgets.game_menu.$, GameMenuWindow.class);
this.gameMenu.reference("resume_game", Button.class).setAction(this::resumeGame); this.gameMenu.reference("resume_game", Button.class).setAction(this::resumeGame);
this.gameMenu.reference("equipment", Button.class).setAction(() -> manager.open(equipment)); this.gameMenu.reference("equipment", Button.class).setAction(() -> manager.open(equipment));
this.gameMenu.reference("start_menu", Button.class).setAction(runner::returnToStartMenu); this.gameMenu.reference("start_menu", Button.class).setAction(runner::returnToStartMenu);
this.gameMenu.reference("exit", Button.class).setAction(runner::exit); this.gameMenu.reference("exit", Button.class).setAction(runner::exit);
this.dialog = gui.inflateWindow(A.widgets.dialog.uid, DialogWindow.class); this.dialog = gui.inflateWindow(A.widgets.dialog.$, DialogWindow.class);
this.loot = gui.inflateWindow(widgets.loot_menu.uid, LootWindow.class); this.loot = gui.inflateWindow(widgets.loot_menu.$, LootWindow.class);
} }
private void handleGameMenuKeyEvent(KeyEvent event) { private void handleGameMenuKeyEvent(KeyEvent event) {

View File

@@ -1,5 +1,7 @@
package com.bartlomiejpluta.demo.runner; package com.bartlomiejpluta.demo.runner;
import A.maps;
import DB.ConfigDAO;
import DB.dao; import DB.dao;
import com.bartlomiejpluta.base.api.context.Context; import com.bartlomiejpluta.base.api.context.Context;
import com.bartlomiejpluta.base.api.gui.GUI; import com.bartlomiejpluta.base.api.gui.GUI;
@@ -34,12 +36,15 @@ public class DemoRunner implements GameRunner {
private void configureScreen() { private void configureScreen() {
var resolution = screen.getCurrentResolution(); var resolution = screen.getCurrentResolution();
screen.setSize(800, 600); var config = dao.config.find("screen").getValue().split("x");
screen.setPosition((resolution.x() - 1800) / 2, (resolution.y() - 1000) / 2); var width = Integer.parseInt(config[0]);
var height = Integer.parseInt(config[1]);
screen.setSize(width, height);
screen.setPosition((resolution.x() - width) / 2, (resolution.y() - height) / 2);
} }
private void configureCamera() { private void configureCamera() {
context.getCamera().setScale(2.5f); context.getCamera().setScale(Float.parseFloat(dao.config.find("camera_scale").getValue()));
} }
private void initMenu() { private void initMenu() {
@@ -49,12 +54,12 @@ public class DemoRunner implements GameRunner {
private void initHUD() { private void initHUD() {
hud = context.newGUI(); hud = context.newGUI();
hud.hide(); hud.hide();
var hudComponent = hud.inflateComponent(A.widgets.hud.uid); var hudComponent = hud.inflateComponent(A.widgets.hud.$);
hud.setRoot(hudComponent); hud.setRoot(hudComponent);
} }
private void initPlayer() { private void initPlayer() {
this.player = new Player(context.createCharacter(A.charsets.luna.uid)); this.player = new Player(context.createCharacter(A.charsets.luna.$));
} }
public void newGame() { public void newGame() {
@@ -62,13 +67,19 @@ public class DemoRunner implements GameRunner {
guiManager.closeAll(); guiManager.closeAll();
guiManager.enableGameMenu(); guiManager.enableGameMenu();
player.reset(); player.reset();
var start = dao.start_game.find((short) 1); var start = dao.config.find("start_game").getValue().split(",");
var startPoint = start.getStartPoint().split(",");
context.openMap(A.maps.get(startPoint[0]).uid); var map = A.maps.byName(start[0]);
context.getMap().getObjectLayer(A.maps.getLayer(startPoint[0], startPoint[1])).addEntity(this.player); var layer = map.layer(start[1]);
player.setCoordinates(parseInt(startPoint[2]), parseInt(startPoint[3])); var label = layer.label(start[2]);
context.openMap(map.$);
context.getMap().getObjectLayer(layer.$).addEntity(this.player);
player.setCoordinates(label.getX(), label.getY());
context.resume(); context.resume();
hud.show(); hud.show();
var x = A.maps.hero_home.main.entry;
} }
public void returnToStartMenu() { public void returnToStartMenu() {

View File

@@ -6,6 +6,6 @@ import com.bartlomiejpluta.base.api.icon.Icon;
public class IconUtil { public class IconUtil {
public static Icon parseIcon(String iconDefinition) { public static Icon parseIcon(String iconDefinition) {
var parts = iconDefinition.split(","); var parts = iconDefinition.split(",");
return ContextHolder.INSTANCE.getContext().createIcon(A.iconsets.get(parts[0]).uid, Integer.parseInt(parts[1]), Integer.parseInt(parts[2])); return ContextHolder.INSTANCE.getContext().createIcon(A.iconsets.byName(parts[0]).$, Integer.parseInt(parts[1]), Integer.parseInt(parts[2]));
} }
} }

View File

@@ -37,8 +37,8 @@ public class MeleeWeapon extends BaseItem implements Weapon {
this.name = template.getName(); this.name = template.getName();
this.dmgRoller = DiceRoller.of(template.getDamage()); this.dmgRoller = DiceRoller.of(template.getDamage());
this.cooldown = template.getCooldown(); this.cooldown = template.getCooldown();
this.animation = new RandomAnimationsRunner(2).nRange(0, 2f).nScale(0.2f, 0.15f).uAnimationSpeed(0.5f, 1f).nRotation(0, 10).offset(0, -10).uDelay(250, 500).with(A.animations.get(template.getAnimation()).uid); this.animation = new RandomAnimationsRunner(2).nRange(0, 2f).nScale(0.2f, 0.15f).uAnimationSpeed(0.5f, 1f).nRotation(0, 10).offset(0, -10).uDelay(250, 500).with(A.animations.byName(template.getAnimation()).$);
this.sound = A.sounds.get(template.getSound()).uid; this.sound = A.sounds.byName(template.getSound()).$;
} }
@Override @Override

View File

@@ -52,12 +52,12 @@ public class RangedWeapon extends BaseItem implements Weapon {
this.dmgRoller = DiceRoller.of(template.getDamage()); this.dmgRoller = DiceRoller.of(template.getDamage());
this.rangeRoller = DiceRoller.of(template.getRange()); this.rangeRoller = DiceRoller.of(template.getRange());
this.cooldown = template.getCooldown(); this.cooldown = template.getCooldown();
this.animation = new BulletAnimationRunner(A.animations.get(template.getAnimation()).uid).infinite().offset(0, -15).onHit(this::onHit).onMiss(this::onMiss).speed(7f).animationSpeed(4f).scale(0.6f); this.animation = new BulletAnimationRunner(A.animations.byName(template.getAnimation()).$).infinite().offset(0, -15).onHit(this::onHit).onMiss(this::onMiss).speed(7f).animationSpeed(4f).scale(0.6f);
this.sound = A.sounds.get(template.getSound()).uid; this.sound = A.sounds.byName(template.getSound()).$;
this.punchAnimation = new SimpleAnimationRunner(A.animations.get(template.getPunchAnimation()).uid); this.punchAnimation = new SimpleAnimationRunner(A.animations.byName(template.getPunchAnimation()).$);
this.punchSound = A.sounds.get(template.getPunchSound()).uid; this.punchSound = A.sounds.byName(template.getPunchSound()).$;
this.missAnimation = new SimpleAnimationRunner(A.animations.get(template.getMissAnimation()).uid).scale(0.4f); this.missAnimation = new SimpleAnimationRunner(A.animations.byName(template.getMissAnimation()).$).scale(0.4f);
this.missSound = A.sounds.get(template.getMissSound()).uid; this.missSound = A.sounds.byName(template.getMissSound()).$;
} }
private void onHit(Movable attacker, Entity target) { private void onHit(Movable attacker, Entity target) {

View File

@@ -57,12 +57,12 @@ public class ThrowingWeapon extends StackableItem implements Weapon {
this.dmgRoller = DiceRoller.of(template.getDamage()); this.dmgRoller = DiceRoller.of(template.getDamage());
this.rangeRoller = DiceRoller.of(template.getRange()); this.rangeRoller = DiceRoller.of(template.getRange());
this.cooldown = template.getCooldown(); this.cooldown = template.getCooldown();
this.animation = new BulletAnimationRunner(A.animations.get(template.getAnimation()).uid).infinite().offset(0, -15).onHit(this::onHit).onMiss(this::onMiss).speed(7f).animationSpeed(4f).scale(0.6f); this.animation = new BulletAnimationRunner(A.animations.byName(template.getAnimation()).$).infinite().offset(0, -15).onHit(this::onHit).onMiss(this::onMiss).speed(7f).animationSpeed(4f).scale(0.6f);
this.sound = A.sounds.get(template.getSound()).uid; this.sound = A.sounds.byName(template.getSound()).$;
this.punchAnimation = new SimpleAnimationRunner(A.animations.get(template.getPunchAnimation()).uid); this.punchAnimation = new SimpleAnimationRunner(A.animations.byName(template.getPunchAnimation()).$);
this.punchSound = A.sounds.get(template.getPunchSound()).uid; this.punchSound = A.sounds.byName(template.getPunchSound()).$;
this.missAnimation = new SimpleAnimationRunner(A.animations.get(template.getMissAnimation()).uid).scale(0.4f); this.missAnimation = new SimpleAnimationRunner(A.animations.byName(template.getMissAnimation()).$).scale(0.4f);
this.missSound = A.sounds.get(template.getMissSound()).uid; this.missSound = A.sounds.byName(template.getMissSound()).$;
} }
private void onHit(Movable attacker, Entity target) { private void onHit(Movable attacker, Entity target) {

View File

@@ -23,7 +23,7 @@
<base:BorderLayout-BottomLeft> <base:BorderLayout-BottomLeft>
<base:Label <base:Label
ref="log" ref="log"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="400f" width="400f"
height="25f" height="25f"
alignment="bottom|left" alignment="bottom|left"
@@ -34,7 +34,7 @@
<base:BorderLayout-BottomRight width="auto" height="auto"> <base:BorderLayout-BottomRight width="auto" height="auto">
<base:TextView <base:TextView
ref="debug" ref="debug"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
alignment="top|right" alignment="top|right"
color="0xFFFFFF" color="0xFFFFFF"
fontSize="15f"/> fontSize="15f"/>

View File

@@ -7,7 +7,7 @@
margin="20f" margin="20f"
width="900f" width="900f"
height="auto"> height="auto">
<base:TextView ref="message" alignment="top|left" font="A.fonts.roboto_regular.uid" fontSize="40f" width="relative" <base:TextView ref="message" alignment="top|left" font="A.fonts.roboto_regular.$" fontSize="40f" width="relative"
rows="4" color="0xFFFFFF"/> rows="4" color="0xFFFFFF"/>
</demo:DialogWindow> </demo:DialogWindow>

View File

@@ -10,7 +10,7 @@
<demo:Button <demo:Button
ref="use" ref="use"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"
@@ -20,7 +20,7 @@
<demo:Button <demo:Button
ref="drop" ref="drop"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"
@@ -30,7 +30,7 @@
<demo:Button <demo:Button
ref="cancel" ref="cancel"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"

View File

@@ -10,7 +10,7 @@
<base:VLayout width="200f"> <base:VLayout width="200f">
<base:Label <base:Label
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
alignment="top|center" alignment="top|center"
red="1f" red="1f"
@@ -23,7 +23,7 @@
<base:VOptionChoice ref="menu" width="relative"> <base:VOptionChoice ref="menu" width="relative">
<demo:Button <demo:Button
ref="resume_game" ref="resume_game"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"
@@ -33,7 +33,7 @@
<demo:Button <demo:Button
ref="equipment" ref="equipment"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"
@@ -43,7 +43,7 @@
<demo:Button <demo:Button
ref="start_menu" ref="start_menu"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"
@@ -53,7 +53,7 @@
<demo:Button <demo:Button
ref="exit" ref="exit"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"

View File

@@ -9,7 +9,7 @@
<base:VLayout width="200f"> <base:VLayout width="200f">
<base:Label <base:Label
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
alignment="top|center" alignment="top|center"
red="1f" red="1f"
@@ -22,7 +22,7 @@
<base:VOptionChoice ref="menu" width="relative"> <base:VOptionChoice ref="menu" width="relative">
<demo:Button <demo:Button
ref="new_game" ref="new_game"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"
@@ -32,7 +32,7 @@
<demo:Button <demo:Button
ref="exit" ref="exit"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
red="1f" red="1f"
green="1f" green="1f"

View File

@@ -10,7 +10,7 @@
<base:VLayout width="auto" height="auto"> <base:VLayout width="auto" height="auto">
<base:Label <base:Label
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
alignment="top|left" alignment="top|left"
red="1f" red="1f"
@@ -69,7 +69,7 @@
<base:VLayout height="relative" padding="20f" width="250f"> <base:VLayout height="relative" padding="20f" width="250f">
<base:Label ref="item-name" <base:Label ref="item-name"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
alignment="top|center" alignment="top|center"
color="0xFFFFFF" color="0xFFFFFF"
@@ -77,7 +77,7 @@
margin="5f"/> margin="5f"/>
<base:Label ref="item-details" <base:Label ref="item-details"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
alignment="top|left" alignment="top|left"
color="0xFFFFFF" color="0xFFFFFF"

View File

@@ -11,7 +11,7 @@
<base:VLayout width="auto" height="auto"> <base:VLayout width="auto" height="auto">
<base:Label <base:Label
ref="title" ref="title"
font="A.fonts.roboto_regular.uid" font="A.fonts.roboto_regular.$"
width="relative" width="relative"
alignment="top|center" alignment="top|center"
red="1f" red="1f"