fixed wave, clean clean up

This commit is contained in:
sharlotte
2021-08-05 14:28:58 +09:00
parent 65d7bd1350
commit 680972234f
3 changed files with 17 additions and 17 deletions

View File

@@ -226,7 +226,6 @@ public class BarInfo {
} }
if(target instanceof Unit unit && target instanceof Payloadc pay && unit.type != null){ if(target instanceof Unit unit && target instanceof Payloadc pay && unit.type != null){
strings.set(4, Core.bundle.format("shar-stat.payloadCapacity", format(Mathf.round(Mathf.sqrt(pay.payloadUsed()))), format(Mathf.round(Mathf.sqrt(unit.type().payloadCapacity))))); strings.set(4, Core.bundle.format("shar-stat.payloadCapacity", format(Mathf.round(Mathf.sqrt(pay.payloadUsed()))), format(Mathf.round(Mathf.sqrt(unit.type().payloadCapacity)))));
colors.set(4, Pal.items); colors.set(4, Pal.items);

View File

@@ -1,6 +1,5 @@
package UnitInfo.core; package UnitInfo.core;
import UnitInfo.SVars;
import UnitInfo.ui.*; import UnitInfo.ui.*;
import arc.*; import arc.*;
import arc.graphics.*; import arc.graphics.*;
@@ -36,6 +35,7 @@ import mindustry.world.blocks.distribution.MassDriver;
import mindustry.world.blocks.power.PowerNode; import mindustry.world.blocks.power.PowerNode;
import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.*;
import static UnitInfo.SVars.clear;
import static arc.Core.*; import static arc.Core.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -432,7 +432,7 @@ public class HudUi {
update(() -> { update(() -> {
if(getTarget() instanceof Unit u && u.stack.item != null && u.stack.amount > 0) if(getTarget() instanceof Unit u && u.stack.item != null && u.stack.amount > 0)
setDrawable(u.stack.item.uiIcon); setDrawable(u.stack.item.uiIcon);
else setDrawable(Core.atlas.find("clear")); else setDrawable(clear);
}); });
visibility = () -> getTarget() instanceof Unit; visibility = () -> getTarget() instanceof Unit;
}}.setScaling(Scaling.fit)).size(Scl.scl(30f)).padBottom(Scl.scl(4 * 8f)).padRight(Scl.scl(6 * 8f)); }}.setScaling(Scaling.fit)).size(Scl.scl(30f)).padBottom(Scl.scl(4 * 8f)).padRight(Scl.scl(6 * 8f));
@@ -484,7 +484,7 @@ public class HudUi {
t.left(); t.left();
t.add(new Image(){{ t.add(new Image(){{
update(() -> { update(() -> {
TextureRegion region = Core.atlas.find("clear"); TextureRegion region = clear;
if(Vars.state.rules.unitAmmo && getTarget() instanceof Unit u && u.type != null){ if(Vars.state.rules.unitAmmo && getTarget() instanceof Unit u && u.type != null){
UnitType type = u.type; UnitType type = u.type;
@@ -503,7 +503,7 @@ public class HudUi {
weapon = new Table(tx -> { weapon = new Table(tx -> {
tx.left().defaults().minSize(Scl.scl(12 * 8f)); tx.left().defaults().minSize(Scl.scl(12 * 8f));
tx.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, tt -> { tx.add(new Table(Tex.button, tt -> {
tt.left().top().defaults().width(Scl.scl(24/3f * 8f)).minHeight(Scl.scl(12/3f * 8f)); tt.left().top().defaults().width(Scl.scl(24/3f * 8f)).minHeight(Scl.scl(12/3f * 8f));
if(getTarget() instanceof Unit u && u.type != null) { if(getTarget() instanceof Unit u && u.type != null) {
@@ -580,16 +580,16 @@ public class HudUi {
unitTable = new Table(table -> { unitTable = new Table(table -> {
table.left(); table.left();
addBars(); addBars();
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().width(Scl.scl(25 * 8f)).scaling(Scaling.bounded); t.defaults().width(Scl.scl(25 * 8f)).scaling(Scaling.bounded);
t.table(Tex.underline2, tt -> { t.table(Tex.underline2, tt -> {
Stack stack = new Stack(){{ Stack stack = new Stack(){{
add(new Table(ttt -> ttt.add(new Image(){{ add(new Table(ttt -> ttt.add(new Image(){{
update(() -> { update(() -> {
TextureRegion region = atlas.find("clear"); TextureRegion region = clear;
if(getTarget() instanceof Unit && ((Unit) getTarget()).type() != null) region = ((Unit) getTarget()).type().uiIcon; if(getTarget() instanceof Unit && ((Unit) getTarget()).type() != null) region = ((Unit) getTarget()).type().uiIcon;
if(getTarget() instanceof Building && ((Building) getTarget()).block != null) { else if(getTarget() instanceof Building && ((Building) getTarget()).block != null) {
if(getTarget() instanceof ConstructBlock.ConstructBuild) region = ((ConstructBlock.ConstructBuild) getTarget()).current.uiIcon; if(getTarget() instanceof ConstructBlock.ConstructBuild) region = ((ConstructBlock.ConstructBuild) getTarget()).current.uiIcon;
else region = ((Building) getTarget()).block.uiIcon; else region = ((Building) getTarget()).block.uiIcon;
} }
@@ -599,7 +599,7 @@ public class HudUi {
add(new Table(ttt -> { add(new Table(ttt -> {
ttt.add(new Stack(){{ ttt.add(new Stack(){{
add(new Table(temp -> temp.add(new Image(){{ add(new Table(temp -> temp.add(new Image(){{
update(()-> setDrawable(getTarget() instanceof Unit ? Icon.defenseSmall.getRegion() : SVars.clear)); update(()-> setDrawable(getTarget() instanceof Unit ? Icon.defenseSmall.getRegion() : clear));
}}.setScaling(Scaling.fit)))); }}.setScaling(Scaling.fit))));
add(new Table(temp -> { add(new Table(temp -> {
@@ -835,7 +835,7 @@ public class HudUi {
public void addWaveTable(){ public void addWaveTable(){
if(uiIndex != 1) return; if(uiIndex != 1) return;
ScrollPane wavePane = new ScrollPane(new Image(Core.atlas.find("clear")).setScaling(Scaling.fit), Styles.smallPane); ScrollPane wavePane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
wavePane.setScrollingDisabled(true, false); wavePane.setScrollingDisabled(true, false);
wavePane.setScrollYForce(waveScrollPos); wavePane.setScrollYForce(waveScrollPos);
wavePane.update(() -> { wavePane.update(() -> {
@@ -852,7 +852,7 @@ public class HudUi {
wavePane.setOverscroll(false, false); wavePane.setOverscroll(false, false);
wavePane.setWidget(new Table(tx -> tx.table(this::setWave).left())); wavePane.setWidget(new Table(tx -> tx.table(this::setWave).left()));
waveTable = new Table(table -> { waveTable = new Table(table -> {
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left();
t.add(wavePane).maxHeight(Scl.scl(32 * 8f)); t.add(wavePane).maxHeight(Scl.scl(32 * 8f));
}){ }){
@@ -942,7 +942,7 @@ public class HudUi {
corePane.setOverscroll(false, false); corePane.setOverscroll(false, false);
coreTable = new Table(table -> { coreTable = new Table(table -> {
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left();
t.add(corePane).maxHeight(Scl.scl(32 * 8f)); t.add(corePane).maxHeight(Scl.scl(32 * 8f));
}){ }){
@@ -978,7 +978,7 @@ public class HudUi {
public void addTileTable(){ public void addTileTable(){
if(uiIndex != 3) return; if(uiIndex != 3) return;
ScrollPane tilePane = new ScrollPane(new Image(Core.atlas.find("clear")).setScaling(Scaling.fit), Styles.smallPane); ScrollPane tilePane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
tilePane.setScrollingDisabled(true, false); tilePane.setScrollingDisabled(true, false);
tilePane.setScrollYForce(tileScrollPos); tilePane.setScrollYForce(tileScrollPos);
tilePane.update(() -> { tilePane.update(() -> {
@@ -994,7 +994,7 @@ public class HudUi {
tilePane.setOverscroll(false, false); tilePane.setOverscroll(false, false);
tileTable = new Table(table -> { tileTable = new Table(table -> {
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left();
t.add(tilePane).maxHeight(Scl.scl(32 * 8f)); t.add(tilePane).maxHeight(Scl.scl(32 * 8f));
}){ }){
@@ -1027,7 +1027,7 @@ public class HudUi {
public void addItemTable(){ public void addItemTable(){
if(uiIndex != 4) return; if(uiIndex != 4) return;
ScrollPane tilePane = new ScrollPane(new Image(Core.atlas.find("clear")).setScaling(Scaling.fit), Styles.smallPane); ScrollPane tilePane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
tilePane.setScrollingDisabled(true, false); tilePane.setScrollingDisabled(true, false);
tilePane.setScrollYForce(tileScrollPos); tilePane.setScrollYForce(tileScrollPos);
tilePane.update(() -> { tilePane.update(() -> {
@@ -1043,7 +1043,7 @@ public class HudUi {
tilePane.setOverscroll(false, false); tilePane.setOverscroll(false, false);
itemTable = new Table(table -> { itemTable = new Table(table -> {
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left();
t.add(tilePane).maxHeight(Scl.scl(32 * 8f)); t.add(tilePane).maxHeight(Scl.scl(32 * 8f));
}){ }){

View File

@@ -291,6 +291,7 @@ public class SettingS {
addGraphicCheckSetting("pastwave", false); addGraphicCheckSetting("pastwave", false);
addGraphicCheckSetting("emptywave", true); addGraphicCheckSetting("emptywave", true);
addGraphicSlideSetting("wavemax", 50, 0, 200, 1, s -> s + "waves");
addGraphicCheckSetting("scan", false); addGraphicCheckSetting("scan", false);
addGraphicSlideSetting("rangemax", 10, 0, 100, 1, s -> s + "tiles"); addGraphicSlideSetting("rangemax", 10, 0, 100, 1, s -> s + "tiles");
addGraphicCheckSetting("coreRange", false); addGraphicCheckSetting("coreRange", false);