This commit is contained in:
sharlotte
2021-08-26 09:25:12 +09:00
parent 24cd31776f
commit 09e5c4bc9e
8 changed files with 22 additions and 34 deletions

View File

@@ -2,14 +2,11 @@
shar-stat.health = Health: {0} shar-stat.health = Health: {0}
shar-stat.shield = Shield: {0} shar-stat.shield = Shield: {0}
shar-stat.payloadCapacity = Payloads: {0}² / {1}² shar-stat.payloadCapacity = Payloads: {0}² / {1}²
shar-stat.itemCapacity = Items: {0} / {1} shar-stat.capacity = {0}: {1} / {2}
shar-stat.liquidCapacity = Liquid: {0} / {1}
shar-stat.power = Power: {0} / {1} shar-stat.power = Power: {0} / {1}
shar-stat.powerIn = Power Income: {0}/s shar-stat.powerIn = Power Income: {0}/s
shar-stat.powerOut = Power Outcome: {0}/s shar-stat.powerOut = Power Outcome: {0}/s
shar-stat.ammos = Ammo: {0} / {1} shar-stat.ammos = Ammo: {0} / {1}
shar-stat.itemAmmo = Ammo: {0} / {1}
shar-stat.liquidAmmo = Liquid: {0} / {1}
shar-stat.commandUnits = Commands: {0} / {1} shar-stat.commandUnits = Commands: {0} / {1}
shar-stat.reload = Reload: {0}% shar-stat.reload = Reload: {0}%
shar-stat.progress = Progress: {0}% shar-stat.progress = Progress: {0}%

View File

@@ -2,14 +2,10 @@
shar-stat.health = 체력: {0} shar-stat.health = 체력: {0}
shar-stat.shield = 방어막: {0} shar-stat.shield = 방어막: {0}
shar-stat.payloadCapacity = 화물: {0}² / {1}² shar-stat.payloadCapacity = 화물: {0}² / {1}²
shar-stat.itemCapacity = 아이템: {0} / {1}
shar-stat.liquidCapacity = 액체: {0} / {1}
shar-stat.power = 전력: {0} / {1} shar-stat.power = 전력: {0} / {1}
shar-stat.powerIn = 전력 생산량: {0}/s shar-stat.powerIn = 전력 생산량: {0}/s
shar-stat.powerOut = 전력 소모량: {0}/s shar-stat.powerOut = 전력 소모량: {0}/s
shar-stat.ammos = 탄약: {0} / {1} shar-stat.ammos = 탄약: {0} / {1}
shar-stat.itemAmmo = 탄약 : {0} / {1}
shar-stat.liquidAmmo = 액체: {0} / {1}
shar-stat.commandUnits = 지휘 유닛: {0} / {1} shar-stat.commandUnits = 지휘 유닛: {0} / {1}
shar-stat.reload = 재장전: {0}% shar-stat.reload = 재장전: {0}%
shar-stat.progress = 진행도: {0}% shar-stat.progress = 진행도: {0}%

View File

@@ -2,15 +2,9 @@
shar-stat.health = Can: {0} shar-stat.health = Can: {0}
shar-stat.shield = Kalkan: {0} shar-stat.shield = Kalkan: {0}
shar-stat.payloadCapacity = Yük: {0}² / {1}² shar-stat.payloadCapacity = Yük: {0}² / {1}²
shar-stat.itemCapacity = Eşyalar: {0} / {1}
shar-stat.liquidCapacity = Sıvı: {0} / {1}
shar-stat.powerCapacity = Güç: {0} / {1}
shar-stat.powerUsage = Güç: {0} / {1}
shar-stat.ammos = Mermi: {0} / {1} shar-stat.ammos = Mermi: {0} / {1}
shar-stat.commandUnits = Komutlar: {0} / {1} shar-stat.commandUnits = Komutlar: {0} / {1}
shar-stat.reload = Yeniden Yükleme: {0}% shar-stat.reload = Yeniden Yükleme: {0}%
shar-stat.itemAmmo = Mermi: {0} / {1}
shar-stat.liquidAmmo = Liquid: {0} / {1}
shar-stat.power = Güç: {0} / {1} shar-stat.power = Güç: {0} / {1}
shar-stat.progress = İlerleme: {0}% shar-stat.progress = İlerleme: {0}%
shar-stat.attr = Bağlanma: x{0} shar-stat.attr = Bağlanma: x{0}

View File

@@ -2,12 +2,9 @@
shar-stat.health = 血量: {0} shar-stat.health = 血量: {0}
shar-stat.shield = 盾量: {0} shar-stat.shield = 盾量: {0}
shar-stat.payloadCapacity = 有效载荷: {0}² / {1}² shar-stat.payloadCapacity = 有效载荷: {0}² / {1}²
shar-stat.itemCapacity = 装载物品: {0} / {1}
shar-stat.ammos = 子弹量: {0} / {1} shar-stat.ammos = 子弹量: {0} / {1}
shar-stat.commandUnits = 控制单位: {0} / {1} shar-stat.commandUnits = 控制单位: {0} / {1}
shar-stat.reload = 冷却: {0}% shar-stat.reload = 冷却: {0}%
shar-stat.itemAmmo = 弹药 : {0} / {1}
shar-stat.liquidAmmo = 液体量: {0}
shar-stat.power = 可控制数?: {0} / {1} shar-stat.power = 可控制数?: {0} / {1}
# Settings # Settings

View File

@@ -19,8 +19,12 @@ public class SUtils {
public static String floatFormat(float number){ public static String floatFormat(float number){
if(number >= 1000) return UI.formatAmount((long)number); if(number >= 1000) return UI.formatAmount((long)number);
if(String.valueOf(number).length() > 2 && String.valueOf(number).split("[.]")[1].matches("0")) return String.valueOf(number).split("[.]")[0]; return Strings.fixed(number, 1);
return Strings.fixed(number, 2); }
public static String floatFormat(int number){
if(number >= 1000) return UI.formatAmount(number);
return String.valueOf(number);
} }
public static Object invoke(Object ut, String fieldName) throws IllegalAccessException, NoSuchFieldException { public static Object invoke(Object ut, String fieldName) throws IllegalAccessException, NoSuchFieldException {

View File

@@ -135,24 +135,24 @@ public class BarInfo {
numbers.set(1, (float) crafter.sense(LAccess.progress)); numbers.set(1, (float) crafter.sense(LAccess.progress));
} }
else if(target instanceof PowerNode.PowerNodeBuild node){ else if(target instanceof PowerNode.PowerNodeBuild node){
strings.set(1, bundle.format("bar.power", floatFormat(node.power.graph.getLastPowerStored()), floatFormat(node.power.graph.getLastCapacity()))); strings.set(1, bundle.format("shar-stat.power", floatFormat(node.power.graph.getLastPowerStored()), floatFormat(node.power.graph.getLastCapacity())));
colors.set(1, Pal.powerBar); colors.set(1, Pal.powerBar);
numbers.set(1, node.power.graph.getLastPowerStored() / node.power.graph.getLastCapacity()); numbers.set(1, node.power.graph.getLastPowerStored() / node.power.graph.getLastCapacity());
} }
else if(target instanceof PowerGenerator.GeneratorBuild generator){ else if(target instanceof PowerGenerator.GeneratorBuild generator){
strings.set(1, bundle.format("bar.power", floatFormat(generator.getPowerProduction() * generator.timeScale() * 60f))); strings.set(1, bundle.format("shar-stat.power", floatFormat(generator.getPowerProduction() * generator.timeScale() * 60f)));
colors.set(1, Pal.powerBar); colors.set(1, Pal.powerBar);
numbers.set(1, generator.productionEfficiency); numbers.set(1, generator.productionEfficiency);
} }
if(target instanceof ItemTurret.ItemTurretBuild turret) { if(target instanceof ItemTurret.ItemTurretBuild turret) {
ItemTurret block = (ItemTurret)turret.block; ItemTurret block = (ItemTurret)turret.block;
strings.set(2, bundle.format("shar-stat.itemAmmo", floatFormat(turret.totalAmmo), floatFormat(block.maxAmmo))); strings.set(2, bundle.format("shar-stat.capacity", turret.hasAmmo() ? block.ammoTypes.findKey(turret.peekAmmo(), true).localizedName : bundle.get("stat.ammo"), floatFormat(turret.totalAmmo), floatFormat(block.maxAmmo)));
colors.set(2, turret.hasAmmo() ? block.ammoTypes.findKey(turret.peekAmmo(), true).color : Pal.ammo); colors.set(2, turret.hasAmmo() ? block.ammoTypes.findKey(turret.peekAmmo(), true).color : Pal.ammo);
numbers.set(2, turret.totalAmmo / (float)block.maxAmmo); numbers.set(2, turret.totalAmmo / (float)block.maxAmmo);
} }
else if(target instanceof LiquidTurret.LiquidTurretBuild turret){ else if(target instanceof LiquidTurret.LiquidTurretBuild turret){
strings.set(2, bundle.format("shar-stat.liquidAmmo", floatFormat(turret.liquids.get(turret.liquids.current())), floatFormat(turret.block.liquidCapacity))); strings.set(2, bundle.format("shar-stat.capacity", turret.liquids.currentAmount() < 0.01f ? turret.liquids.current().localizedName : bundle.get("stat.ammo"), floatFormat(turret.liquids.get(turret.liquids.current())), floatFormat(turret.block.liquidCapacity)));
colors.set(2, turret.liquids.current().color); colors.set(2, turret.liquids.current().color);
numbers.set(2, turret.liquids.get(turret.liquids.current()) / turret.block.liquidCapacity); numbers.set(2, turret.liquids.get(turret.liquids.current()) / turret.block.liquidCapacity);
} }
@@ -165,21 +165,21 @@ public class BarInfo {
} }
else if(target instanceof Building b && b.block.hasItems) { else if(target instanceof Building b && b.block.hasItems) {
if(target instanceof CoreBlock.CoreBuild cb){ if(target instanceof CoreBlock.CoreBuild cb){
strings.set(2, bundle.format("shar-stat.itemCapacity", floatFormat(b.items.total()), floatFormat(cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow)))); strings.set(2, bundle.format("shar-stat.capacity", bundle.get("category.items"), floatFormat(b.items.total()), floatFormat(cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow))));
numbers.set(2, cb.items.total() / (cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow) * 1f)); numbers.set(2, cb.items.total() / (cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow) * 1f));
} }
else if(target instanceof StorageBlock.StorageBuild sb && !sb.canPickup() && sb.linkedCore instanceof CoreBlock.CoreBuild cb){ else if(target instanceof StorageBlock.StorageBuild sb && !sb.canPickup() && sb.linkedCore instanceof CoreBlock.CoreBuild cb){
strings.set(2, bundle.format("shar-stat.itemCapacity", floatFormat(sb.items.total()), floatFormat(cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow)))); strings.set(2, bundle.format("shar-stat.capacity", bundle.get("category.items"), floatFormat(sb.items.total()), floatFormat(cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow))));
numbers.set(2, sb.items.total() / (cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow) * 1f)); numbers.set(2, sb.items.total() / (cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow) * 1f));
} }
else { else {
strings.set(2, bundle.format("shar-stat.itemCapacity", floatFormat(b.items.total()), floatFormat(b.block.itemCapacity))); strings.set(2, bundle.format("shar-stat.capacity", bundle.get("category.items"), floatFormat(b.items.total()), floatFormat(b.block.itemCapacity)));
numbers.set(2, b.items.total() / (float) b.block.itemCapacity); numbers.set(2, b.items.total() / (float) b.block.itemCapacity);
} }
colors.set(2, Pal.items); colors.set(2, Pal.items);
} }
else if(target instanceof Unit unit && unit.type != null) { else if(target instanceof Unit unit && unit.type != null) {
strings.set(2, bundle.format("shar-stat.itemCapacity", floatFormat(unit.stack.amount), floatFormat(unit.type.itemCapacity))); strings.set(2, bundle.format("shar-stat.capacity", unit.stack.item.localizedName, floatFormat(unit.stack.amount), floatFormat(unit.type.itemCapacity)));
if(unit.stack.amount > 0 && unit.stack().item != null) colors.set(2, unit.stack.item.color.cpy().lerp(Color.white, 0.15f)); if(unit.stack.amount > 0 && unit.stack().item != null) colors.set(2, unit.stack.item.color.cpy().lerp(Color.white, 0.15f));
numbers.set(2, unit.stack.amount / (unit.type.itemCapacity * 1f)); numbers.set(2, unit.stack.amount / (unit.type.itemCapacity * 1f));
} }
@@ -261,7 +261,7 @@ public class BarInfo {
numbers.set(4, node.power.graph.getLastScaledPowerOut() / node.power.graph.getLastScaledPowerIn()); numbers.set(4, node.power.graph.getLastScaledPowerOut() / node.power.graph.getLastScaledPowerIn());
} }
else if(build.block.hasLiquids) { else if(build.block.hasLiquids) {
strings.set(4, bundle.format("shar-stat.liquidCapacity", floatFormat(build.liquids.currentAmount()), floatFormat(build.block.liquidCapacity))); strings.set(4, bundle.format("shar-stat.capacity", build.liquids.currentAmount() < 0.01f ? build.liquids.current().localizedName : bundle.get("bar.liquid"), floatFormat(build.liquids.currentAmount()), floatFormat(build.block.liquidCapacity)));
colors.set(4, build.liquids.current().color); colors.set(4, build.liquids.current().color);
numbers.set(4, build.liquids.currentAmount() / build.block.liquidCapacity); numbers.set(4, build.liquids.currentAmount() / build.block.liquidCapacity);
} }

View File

@@ -448,19 +448,19 @@ public class HudUi {
Button unitBtn = new ImageButton(new ScaledNinePatchDrawable(new NinePatch(Icon.grid.getRegion()), 0.5f), Styles.clearToggleTransi); Button unitBtn = new ImageButton(new ScaledNinePatchDrawable(new NinePatch(Icon.grid.getRegion()), 0.5f), Styles.clearToggleTransi);
Button logicBtn = new ImageButton(new ScaledNinePatchDrawable(new NinePatch(Icon.grid.getRegion()), 0.5f), Styles.clearToggleTransi); Button logicBtn = new ImageButton(new ScaledNinePatchDrawable(new NinePatch(Icon.grid.getRegion()), 0.5f), Styles.clearToggleTransi);
pathBtn.addListener(new Tooltip(l -> l.label(() -> "PathLine " + (pathLine ? "[accent]Enabled[]" : "[gray]Disabled[]"))){{allowMobile = true;}}); pathBtn.addListener(new Tooltip(l -> l.label(() -> "PathLine " + (pathLine ? "[accent]Enabled[]" : "[gray]Disabled[]"))));
pathBtn.clicked(() -> { pathBtn.clicked(() -> {
pathLine = !pathLine; pathLine = !pathLine;
pathBtn.setChecked(pathLine); pathBtn.setChecked(pathLine);
}); });
unitBtn.addListener(new Tooltip(l -> l.label(() -> "UnitLine " + (unitLine ? "[accent]Enabled[]" : "[gray]Disabled[]"))){{allowMobile = true;}}); unitBtn.addListener(new Tooltip(l -> l.label(() -> "UnitLine " + (unitLine ? "[accent]Enabled[]" : "[gray]Disabled[]"))));
unitBtn.clicked(() -> { unitBtn.clicked(() -> {
unitLine = !unitLine; unitLine = !unitLine;
unitBtn.setChecked(unitLine); unitBtn.setChecked(unitLine);
}); });
logicBtn.addListener(new Tooltip(l -> l.label(() -> "LogicLine " + (logicLine ? "[accent]Enabled[]" : "[gray]Disabled[]"))){{allowMobile = true;}}); logicBtn.addListener(new Tooltip(l -> l.label(() -> "LogicLine " + (logicLine ? "[accent]Enabled[]" : "[gray]Disabled[]"))));
logicBtn.clicked(() -> { logicBtn.clicked(() -> {
logicLine = !logicLine; logicLine = !logicLine;
logicBtn.setChecked(logicLine); logicBtn.setChecked(logicLine);
@@ -1024,7 +1024,7 @@ public class HudUi {
}).size(iconMed * Scl.scl(modUiScale)); }).size(iconMed * Scl.scl(modUiScale));
to.row(); to.row();
} }
})){{allowMobile = true;}}); })));
}); });
if(++row % 4 == 0) tx.row(); if(++row % 4 == 0) tx.row();
} }

View File

@@ -47,7 +47,7 @@ public class CoresItemsDisplay {
updateItems.clear(); updateItems.clear();
prevItems.clear(); prevItems.clear();
coreAmount.clear(); coreAmount.clear();
teams = new Seq<Team>(Team.all).addAll(Team.baseTeams).filter(t -> t.cores().any()).toArray(); teams = Team.baseTeams;
for(Team team : teams) { for(Team team : teams) {
usedItems.put(team, new ObjectSet<>()); usedItems.put(team, new ObjectSet<>());
usedUnits.put(team, new ObjectSet<>()); usedUnits.put(team, new ObjectSet<>());
@@ -148,7 +148,7 @@ public class CoresItemsDisplay {
new Table(ttt -> { new Table(ttt -> {
ttt.bottom().right(); ttt.bottom().right();
Label label = new Label(() -> { Label label = new Label(() -> {
int amount = updateItems.get(team).get(item.id).amount / (settings.getInt("coreItemCheckRate") / 60); int amount = (int)(updateItems.get(team).get(item.id).amount / ((settings.getInt("coreItemCheckRate") * 1f) / 60f));
return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "/s[]"; return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "/s[]";
}); });
label.setFontScale(0.65f * modUiScale); label.setFontScale(0.65f * modUiScale);