mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
marged core tap to item tap
This commit is contained in:
@@ -91,7 +91,6 @@ warning = Too many waves to display! Lag may occur.
|
|||||||
#Hud
|
#Hud
|
||||||
hud.unit = Unit Info
|
hud.unit = Unit Info
|
||||||
hud.wave = Wave Info
|
hud.wave = Wave Info
|
||||||
hud.core = Core Info
|
|
||||||
hud.item = Resource Info
|
hud.item = Resource Info
|
||||||
hud.cancel = Hidden
|
hud.cancel = Hidden
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ warning = 표시될 웨이브 수가 너무 많습니다! 많은 랙이 걸릴
|
|||||||
#Hud
|
#Hud
|
||||||
hud.unit = 유닛 정보
|
hud.unit = 유닛 정보
|
||||||
hud.wave = 단계 정보
|
hud.wave = 단계 정보
|
||||||
hud.core = 코어 정보
|
|
||||||
hud.item = 자원 정보
|
hud.item = 자원 정보
|
||||||
hud.cancel = 닫음
|
hud.cancel = 닫음
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ import mindustry.world.blocks.distribution.MassDriver;
|
|||||||
import mindustry.world.blocks.payloads.Payload;
|
import mindustry.world.blocks.payloads.Payload;
|
||||||
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
||||||
import mindustry.world.blocks.power.PowerNode;
|
import mindustry.world.blocks.power.PowerNode;
|
||||||
import mindustry.world.blocks.storage.*;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
@@ -45,7 +42,6 @@ import static mindustry.Vars.*;
|
|||||||
|
|
||||||
public class HudUi {
|
public class HudUi {
|
||||||
Seq<Element> bars = new Seq<>();
|
Seq<Element> bars = new Seq<>();
|
||||||
Table weapon = new Table();
|
|
||||||
Table mainTable = new Table();
|
Table mainTable = new Table();
|
||||||
Table baseTable = new Table();
|
Table baseTable = new Table();
|
||||||
Table unitTable = new Table();
|
Table unitTable = new Table();
|
||||||
@@ -54,7 +50,6 @@ public class HudUi {
|
|||||||
Table itemTable = new Table();
|
Table itemTable = new Table();
|
||||||
Table waveInfoTable = new Table();
|
Table waveInfoTable = new Table();
|
||||||
float waveScrollPos;
|
float waveScrollPos;
|
||||||
float coreScrollPos;
|
|
||||||
float itemScrollPos;
|
float itemScrollPos;
|
||||||
|
|
||||||
Teamc lockedTarget;
|
Teamc lockedTarget;
|
||||||
@@ -334,12 +329,9 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(EventType.ResetEvent.class, e -> {
|
Events.on(EventType.BlockDestroyEvent.class, e -> coreItems.resetUsed());
|
||||||
if(settings.getBool("allTeam")) coreItems.teams = Team.all;
|
Events.on(EventType.CoreChangeEvent.class, e -> coreItems.resetUsed());
|
||||||
else coreItems.teams = Team.baseTeams;
|
Events.on(EventType.ResetEvent.class, e -> coreItems.resetUsed());
|
||||||
coreItems.resetUsed();
|
|
||||||
coreItems.tables.each(Group::clear);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(int index, Seq<Button> buttons, Label label, Table table, Table labelTable, String hud){
|
public void reset(int index, Seq<Button> buttons, Label label, Table table, Table labelTable, String hud){
|
||||||
@@ -349,7 +341,6 @@ public class HudUi {
|
|||||||
addBars();
|
addBars();
|
||||||
addUnitTable();
|
addUnitTable();
|
||||||
addWaveTable();
|
addWaveTable();
|
||||||
addCoreTable();
|
|
||||||
addItemTable();
|
addItemTable();
|
||||||
table.removeChild(baseTable);
|
table.removeChild(baseTable);
|
||||||
labelTable.setPosition(buttons.items[uiIndex].x, buttons.items[uiIndex].y);
|
labelTable.setPosition(buttons.items[uiIndex].x, buttons.items[uiIndex].y);
|
||||||
@@ -366,17 +357,17 @@ public class HudUi {
|
|||||||
t.table(tt -> {
|
t.table(tt -> {
|
||||||
tt.add(new Stack() {{
|
tt.add(new Stack() {{
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.add(new Image(type.uiIcon)).size(iconMed);
|
ttt.image(type.uiIcon).size(iconMed);
|
||||||
}));
|
}));
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.right().bottom();
|
ttt.right().bottom();
|
||||||
ttt.add(new Label(() -> Groups.unit.count(u -> u.type == type && u.team == state.rules.waveTeam && u.isBoss()) + ""));
|
ttt.label(() -> Groups.unit.count(u -> u.type == type && u.team == state.rules.waveTeam && u.isBoss()) + "");
|
||||||
}));
|
}));
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.top().right();
|
ttt.top().right();
|
||||||
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
|
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
|
||||||
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
|
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
|
||||||
ttt.add(image).size(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 12f);
|
ttt.add(image).size(Scl.scl(Math.min(modUiScale, 1)) * 12f);
|
||||||
ttt.pack();
|
ttt.pack();
|
||||||
}));
|
}));
|
||||||
}}).pad(6);
|
}}).pad(6);
|
||||||
@@ -461,9 +452,9 @@ public class HudUi {
|
|||||||
Table labelTable = new Table(t -> t.add(label).left().padRight(Scl.scl(modUiScale) * 40 * 8f));
|
Table labelTable = new Table(t -> t.add(label).left().padRight(Scl.scl(modUiScale) * 40 * 8f));
|
||||||
|
|
||||||
table.table(t -> {
|
table.table(t -> {
|
||||||
Seq<Button> buttons = Seq.with(null, null, null, null, null);
|
Seq<Button> buttons = Seq.with(null, null, null, null);
|
||||||
Seq<String> strs = Seq.with("hud.unit", "hud.wave", "hud.core", "hud.item", "hud.cancel");
|
Seq<String> strs = Seq.with("hud.unit", "hud.wave", "hud.item", "hud.cancel");
|
||||||
Seq<TextureRegionDrawable> icons = Seq.with(Icon.units, Icon.fileText, Icon.commandRally, Icon.copy, Icon.cancel);
|
Seq<TextureRegionDrawable> icons = Seq.with(Icon.units, Icon.fileText, Icon.copy, Icon.cancel);
|
||||||
for(int i = 0; i < buttons.size; i++){
|
for(int i = 0; i < buttons.size; i++){
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
buttons.set(i, t.button(icons.get(i), Styles.clearToggleTransi, () ->
|
buttons.set(i, t.button(icons.get(i), Styles.clearToggleTransi, () ->
|
||||||
@@ -764,36 +755,36 @@ public class HudUi {
|
|||||||
public void addUnitTable(){
|
public void addUnitTable(){
|
||||||
if(uiIndex != 0) return;
|
if(uiIndex != 0) return;
|
||||||
unitTable = new Table(table -> {
|
unitTable = new Table(table -> {
|
||||||
table.left().defaults().width(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 27 * 8f).maxHeight(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 35 * 8f).align(Align.left);
|
table.left().defaults().width(Scl.scl(Math.min(modUiScale, 1)) * 27 * 8f).maxHeight(Scl.scl(Math.min(modUiScale, 1)) * 35 * 8f).align(Align.left);
|
||||||
addBars();
|
addBars();
|
||||||
Table table1 = new Table(Tex.button, t -> {
|
Table table1 = new Table(Tex.button, t -> {
|
||||||
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 -> {
|
||||||
update(() -> {
|
ttt.setSize(Scl.scl(modUiScale) * 4f * 8f);
|
||||||
|
ttt.image(() -> {
|
||||||
TextureRegion region = clear;
|
TextureRegion region = clear;
|
||||||
if(getTarget() instanceof Unit u && u.type != null) region = ((Unit) getTarget()).type().uiIcon;
|
if(getTarget() instanceof Unit u && u.type != null) region = ((Unit) getTarget()).type().uiIcon;
|
||||||
else if(getTarget() instanceof Building b && b.block != null) {
|
else if(getTarget() instanceof Building b && b.block != null) {
|
||||||
if(getTarget() instanceof ConstructBlock.ConstructBuild cb) region = cb.current.uiIcon;
|
if(getTarget() instanceof ConstructBlock.ConstructBuild cb) region = cb.current.uiIcon;
|
||||||
else region = b.block.uiIcon;
|
else region = b.block.uiIcon;
|
||||||
}
|
}
|
||||||
setDrawable(region);
|
return region;
|
||||||
});
|
});
|
||||||
}}.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 4f * 8f)));
|
}));
|
||||||
|
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.add(new Stack(){{
|
ttt.add(new Stack(){{
|
||||||
add(new Table(temp -> {
|
add(new Table(temp -> {
|
||||||
temp.add(new Image(Icon.defenseSmall.getRegion()).setScaling(Scaling.fit));
|
temp.image(new ScaledNinePatchDrawable(new NinePatch(Icon.defenseSmall.getRegion()), modUiScale));
|
||||||
temp.visibility = () -> getTarget() instanceof Unit;
|
temp.visibility = () -> getTarget() instanceof Unit;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
add(new Table(temp -> {
|
add(new Table(temp -> {
|
||||||
if(getTarget() instanceof Unit) {
|
Label label = new Label(() -> (getTarget() instanceof Unit u && u.type != null ? (int) u.type.armor + "" : ""));
|
||||||
Label label = new Label(() -> (getTarget() instanceof Unit u && u.type != null ? (int) u.type.armor + "" : ""));
|
label.setColor(Pal.surge);
|
||||||
label.setColor(Pal.surge);
|
label.setFontScale(Scl.scl(modUiScale) * 0.5f);
|
||||||
label.setFontScale(Scl.scl(modUiScale) * 0.5f);
|
temp.add(label).center();
|
||||||
temp.add(label).center();
|
|
||||||
}
|
|
||||||
temp.pack();
|
temp.pack();
|
||||||
}));
|
}));
|
||||||
}}).padLeft(Scl.scl(modUiScale) * 2 * 8f).padBottom(Scl.scl(modUiScale) * 2 * 8f);
|
}}).padLeft(Scl.scl(modUiScale) * 2 * 8f).padBottom(Scl.scl(modUiScale) * 2 * 8f);
|
||||||
@@ -802,12 +793,13 @@ public class HudUi {
|
|||||||
|
|
||||||
Label label = new Label(() -> {
|
Label label = new Label(() -> {
|
||||||
String name = "";
|
String name = "";
|
||||||
if(getTarget() instanceof Unit && ((Unit) getTarget()).type() != null)
|
if(getTarget() instanceof Unit u && u.type != null)
|
||||||
name = "[accent]" + ((Unit) getTarget()).type().localizedName + "[]";
|
name = "[accent]" + u.type.localizedName + "[]";
|
||||||
if(getTarget() instanceof Building && ((Building) getTarget()).block() != null) {
|
if(getTarget() instanceof Building b && b.block != null) {
|
||||||
if(getTarget() instanceof ConstructBlock.ConstructBuild) name = "[accent]" + ((ConstructBlock.ConstructBuild) getTarget()).current.localizedName + "[]";
|
if(getTarget() instanceof ConstructBlock.ConstructBuild cb) name = "[accent]" + cb.current.localizedName + "[]";
|
||||||
else name = "[accent]" + ((Building) getTarget()).block.localizedName + "[]";
|
else name = "[accent]" + b.block.localizedName + "[]";
|
||||||
}
|
}
|
||||||
|
if(name.length() > 12) return name.substring(0, 12) + "...";
|
||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
|
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
|
||||||
@@ -825,18 +817,17 @@ public class HudUi {
|
|||||||
lockButton.getStyle().imageDown = Icon.lock.tint(locked ? Pal.accent : Color.white);
|
lockButton.getStyle().imageDown = Icon.lock.tint(locked ? Pal.accent : Color.white);
|
||||||
});
|
});
|
||||||
|
|
||||||
lockButton = Elem.newImageButton(Styles.clearPartiali, Icon.lock.tint(locked ? Pal.accent : Color.white), 3 * 8f, () -> {
|
lockButton = Elem.newImageButton(Styles.clearPartiali, Icon.lock.tint(locked ? Pal.accent : Color.white), 3 * 8f * Scl.scl(modUiScale), () -> {
|
||||||
locked = !locked;
|
locked = !locked;
|
||||||
if(locked) lockedTarget = getTarget();
|
lockedTarget = locked ? getTarget() : null;
|
||||||
else lockedTarget = null;
|
|
||||||
});
|
});
|
||||||
lockButton.visibility = () -> getTarget() != null;
|
lockButton.visibility = () -> !getTarget().isNull();
|
||||||
|
|
||||||
tt.top();
|
tt.top();
|
||||||
tt.add(stack);
|
tt.add(stack);
|
||||||
tt.add(label);
|
tt.add(label);
|
||||||
tt.add(button).size(Scl.scl(modUiScale) * 5 * 8f);
|
tt.add(button).size(Scl.scl(modUiScale) * 5 * 8f);
|
||||||
tt.add(lockButton).size(Scl.scl(modUiScale) * 3 * 8f);
|
tt.add(lockButton);
|
||||||
|
|
||||||
tt.clicked(()->{
|
tt.clicked(()->{
|
||||||
if(getTarget() == null) return;
|
if(getTarget() == null) return;
|
||||||
@@ -848,16 +839,14 @@ public class HudUi {
|
|||||||
to.table(Tex.underline2, tool2 -> {
|
to.table(Tex.underline2, tool2 -> {
|
||||||
Label label2 = new Label(()->{
|
Label label2 = new Label(()->{
|
||||||
if(getTarget() instanceof Unit u){
|
if(getTarget() instanceof Unit u){
|
||||||
if(u.getPlayer() != null) return u.getPlayer().name;
|
if(u.isPlayer()) return u.getPlayer().name;
|
||||||
else if(u.type != null) return u.type.localizedName;
|
if(u.type != null) return u.type.localizedName;
|
||||||
}
|
}
|
||||||
else if(getTarget() instanceof Building b) return b.block.localizedName;
|
else if(getTarget() instanceof Building b) return b.block.localizedName;
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
|
|
||||||
if(modUiScale < 1) label2.setFontScale(Scl.scl(modUiScale));
|
if(modUiScale < 1) label2.setFontScale(Scl.scl(modUiScale));
|
||||||
tool2.add(label2);
|
tool2.add(label2);
|
||||||
|
|
||||||
});
|
});
|
||||||
to.row();
|
to.row();
|
||||||
Label label2 = new Label(()->getTarget() == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(getTarget().x() / tilesize, 2) + ", " + Strings.fixed(getTarget().y() / tilesize, 2) + ")");
|
Label label2 = new Label(()->getTarget() == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(getTarget().x() / tilesize, 2) + ", " + Strings.fixed(getTarget().y() / tilesize, 2) + ")");
|
||||||
@@ -876,6 +865,8 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
t.setColor(t.color.cpy().a(1f));
|
t.setColor(t.color.cpy().a(1f));
|
||||||
|
|
||||||
|
t.background(Tex.button);
|
||||||
}){
|
}){
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(float x, float y) {
|
protected void drawBackground(float x, float y) {
|
||||||
@@ -960,7 +951,7 @@ public class HudUi {
|
|||||||
tt.add(new Stack(){{
|
tt.add(new Stack(){{
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.center();
|
ttt.center();
|
||||||
ttt.add(image).size(iconLarge * Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
ttt.add(image).size(iconLarge * Scl.scl(Math.min(modUiScale, 1)));
|
||||||
ttt.pack();
|
ttt.pack();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -976,7 +967,7 @@ public class HudUi {
|
|||||||
ttt.top().right();
|
ttt.top().right();
|
||||||
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
|
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
|
||||||
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
|
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
|
||||||
ttt.add(image).size(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 12f);
|
ttt.add(image).size(Scl.scl(Math.min(modUiScale, 1)) * 12f);
|
||||||
ttt.visible(() -> group.effect == StatusEffects.boss);
|
ttt.visible(() -> group.effect == StatusEffects.boss);
|
||||||
ttt.pack();
|
ttt.pack();
|
||||||
}));
|
}));
|
||||||
@@ -1065,7 +1056,7 @@ public class HudUi {
|
|||||||
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.left().defaults().width(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 32 * 8f).maxHeight(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 32 * 8f).align(Align.left);
|
table.left().defaults().width(Scl.scl(Math.min(modUiScale, 1)) * 32 * 8f).maxHeight(Scl.scl(Math.min(modUiScale, 1)) * 32 * 8f).align(Align.left);
|
||||||
table.add(new Table(Tex.button, t -> t.add(wavePane)){
|
table.add(new Table(Tex.button, t -> t.add(wavePane)){
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(float x, float y) {
|
protected void drawBackground(float x, float y) {
|
||||||
@@ -1074,115 +1065,13 @@ public class HudUi {
|
|||||||
getBackground().draw(x, y, width, height);
|
getBackground().draw(x, y, width, height);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
}).padRight(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 39 * 8f);
|
}).padRight(Scl.scl(Math.min(modUiScale, 1)) * 39 * 8f);
|
||||||
|
|
||||||
table.fillParent = true;
|
table.fillParent = true;
|
||||||
table.visibility = () -> uiIndex == 1;
|
table.visibility = () -> uiIndex == 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCore(Table table){
|
|
||||||
table.table(t -> {
|
|
||||||
coreamounts = Groups.build.count(b -> b instanceof CoreBlock.CoreBuild);
|
|
||||||
if(Vars.player.unit() == null) return;
|
|
||||||
|
|
||||||
for(int i = 0; i < coreItems.tables.size; i++){
|
|
||||||
if(coreItems.teams[i].cores().isEmpty()) continue;
|
|
||||||
if(state.rules.pvp && coreItems.teams[i] != player.team()) continue;
|
|
||||||
int finalI = i;
|
|
||||||
t.table(Tex.underline2, head -> {
|
|
||||||
t.center();
|
|
||||||
Label label = new Label(() -> "[#" + coreItems.teams[finalI].color.toString() + "]" + coreItems.teams[finalI].name + "[]");
|
|
||||||
label.setFontScale(Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
|
||||||
head.add(label);
|
|
||||||
});
|
|
||||||
t.row();
|
|
||||||
for(int r = 0, n = coreItems.teams[i].cores().size; r < n; r++) {
|
|
||||||
CoreBlock.CoreBuild core = coreItems.teams[i].cores().get(r);
|
|
||||||
|
|
||||||
if(n > 1 && r % 3 == 0) t.row();
|
|
||||||
else if(r % 3 == 0) t.row();
|
|
||||||
|
|
||||||
t.table(tt -> {
|
|
||||||
tt.stack(
|
|
||||||
new Table(s -> {
|
|
||||||
s.center();
|
|
||||||
Image image = new Image(core.block.uiIcon);
|
|
||||||
image.clicked(() -> {
|
|
||||||
if(control.input instanceof DesktopInput)
|
|
||||||
((DesktopInput) control.input).panning = true;
|
|
||||||
Core.camera.position.set(core.x, core.y);
|
|
||||||
});
|
|
||||||
if(!mobile) {
|
|
||||||
HandCursorListener listener1 = new HandCursorListener();
|
|
||||||
image.addListener(listener1);
|
|
||||||
image.update(() -> image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)));
|
|
||||||
}
|
|
||||||
image.addListener(new Tooltip(ttt -> {
|
|
||||||
Label label = new Label(() -> "([#" + Tmp.c1.set(Color.green).lerp(Color.red, 1 - core.healthf()).toString() + "]" + Strings.fixed(core.health, 2) + "[]/" + Strings.fixed(core.block.health, 2) + ")");
|
|
||||||
if (modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
|
|
||||||
ttt.background(Tex.button).add(label);
|
|
||||||
}));
|
|
||||||
s.add(image).size(iconLarge * Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
|
||||||
}),
|
|
||||||
new Table(h -> {
|
|
||||||
h.bottom().defaults().height(Scl.scl(modUiScale) * 9f).width(Scl.scl(modUiScale) * iconLarge * 1.5f).growX();
|
|
||||||
SBar bar = new SBar(() -> "", () -> Pal.health, () -> core.health / core.block.health);
|
|
||||||
bar.onedot = true;
|
|
||||||
bar.init();
|
|
||||||
h.add(bar);
|
|
||||||
h.pack();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
tt.row();
|
|
||||||
Label label = new Label(() -> "(" + (int) core.x / 8 + ", " + (int) core.y / 8 + ")");
|
|
||||||
label.setFontScale(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 0.75f);
|
|
||||||
tt.add(label);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
t.row();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addCoreTable(){
|
|
||||||
if(uiIndex != 2) return;
|
|
||||||
ScrollPane corePane = new ScrollPane(new Table(tx -> tx.table(this::setCore).left()), Styles.smallPane);
|
|
||||||
corePane.setScrollingDisabled(true, false);
|
|
||||||
corePane.setScrollYForce(coreScrollPos);
|
|
||||||
corePane.setOverscroll(false, false);
|
|
||||||
|
|
||||||
corePane.update(() -> {
|
|
||||||
if(corePane.hasScroll()){
|
|
||||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
|
||||||
if(result == null || !result.isDescendantOf(corePane)){
|
|
||||||
scene.setScrollFocus(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
coreScrollPos = corePane.getScrollY();
|
|
||||||
|
|
||||||
if(coreamounts != Groups.build.count(b -> b instanceof CoreBlock.CoreBuild))
|
|
||||||
corePane.setWidget(new Table(tx -> tx.table(this::setCore).left()));
|
|
||||||
});
|
|
||||||
|
|
||||||
coreTable = new Table(table -> {
|
|
||||||
table.left();
|
|
||||||
table.defaults().width(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 50 * 8f).height(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 32 * 8f).align(Align.left);
|
|
||||||
table.add(new Table(Tex.button, t -> t.add(corePane)){
|
|
||||||
@Override
|
|
||||||
protected void drawBackground(float x, float y) {
|
|
||||||
if(getBackground() == null) return;
|
|
||||||
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
|
|
||||||
getBackground().draw(x, y, width, height);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
}).padRight(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 39 * 8f);
|
|
||||||
|
|
||||||
table.fillParent = true;
|
|
||||||
table.visibility = () -> uiIndex == 2;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItem(Table table){
|
public void setItem(Table table){
|
||||||
table.table(t -> {
|
table.table(t -> {
|
||||||
for(int i = 0; i < coreItems.tables.size; i++){
|
for(int i = 0; i < coreItems.tables.size; i++){
|
||||||
@@ -1199,10 +1088,11 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addItemTable(){
|
public void addItemTable(){
|
||||||
if(uiIndex != 3) return;
|
if(uiIndex != 2) return;
|
||||||
ScrollPane itemPane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
|
ScrollPane itemPane = new ScrollPane(new Table(this::setItem).left(), Styles.smallPane);
|
||||||
itemPane.setScrollingDisabled(true, false);
|
itemPane.setScrollingDisabled(true, false);
|
||||||
itemPane.setScrollYForce(itemScrollPos);
|
itemPane.setScrollYForce(itemScrollPos);
|
||||||
|
itemPane.setOverscroll(false, false);
|
||||||
itemPane.update(() -> {
|
itemPane.update(() -> {
|
||||||
if(itemPane.hasScroll()){
|
if(itemPane.hasScroll()){
|
||||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||||
@@ -1212,24 +1102,19 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
itemScrollPos = itemPane.getScrollY();
|
itemScrollPos = itemPane.getScrollY();
|
||||||
});
|
});
|
||||||
itemPane.setWidget(new Table(this::setItem).left());
|
|
||||||
itemPane.setOverscroll(false, false);
|
|
||||||
|
|
||||||
itemTable = new Table(table -> {
|
itemTable = new Table(table -> {
|
||||||
table.left();
|
table.left().defaults().width(Scl.scl(Math.min(modUiScale, 1)) * 50 * 8f).height(Scl.scl(Math.min(modUiScale, 1)) * 32 * 8f).align(Align.left);
|
||||||
table.defaults().width(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 50 * 8f).height(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 32 * 8f).align(Align.left);
|
table.table(Tex.button, t -> {
|
||||||
table.add(new Table(Tex.button, t -> t.add(itemPane)){
|
t.add(itemPane);
|
||||||
@Override
|
t.update(() -> {
|
||||||
protected void drawBackground(float x, float y) {
|
NinePatchDrawable patch = (NinePatchDrawable)Tex.button;
|
||||||
if(getBackground() == null) return;
|
t.setBackground(patch.tint(Tmp.c1.set(patch.getPatch().getColor()).a(settings.getInt("uiopacity") / 100f)));
|
||||||
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
|
});
|
||||||
getBackground().draw(x, y, width, height);
|
}).padRight(Scl.scl(Math.min(modUiScale, 1)) * 39 * 8f);
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
}).padRight(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 39 * 8f);
|
|
||||||
|
|
||||||
table.fillParent = true;
|
table.fillParent = true;
|
||||||
table.visibility = () -> uiIndex == 3;
|
table.visibility = () -> uiIndex == 2;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,16 +49,15 @@ public class Main extends Mod {
|
|||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
Core.app.post(() -> {
|
Core.app.post(() -> {
|
||||||
Mods.ModMeta meta = Vars.mods.locateMod("unitinfo").meta;
|
Mods.ModMeta meta = Vars.mods.locateMod("unitinfo").meta;
|
||||||
meta.displayName = "[#B5FFD9]Unit Infomation[]";
|
meta.displayName = "[#B5FFD9]Unit Infomation[]";
|
||||||
meta.author = "[#B5FFD9]Sharlotte[lightgray]#0018[][]";
|
meta.author = "[#B5FFD9]Sharlotte[lightgray]#0018[][]";
|
||||||
meta.description = bundle.get("shar-description");
|
meta.description = bundle.get("shar-description");
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(ClientLoadEvent.class, e -> {
|
Events.on(ClientLoadEvent.class, e -> {
|
||||||
hud = new HudUi();
|
hud = new HudUi();
|
||||||
settingAdder.init();
|
settingAdder.init();
|
||||||
hud.addCoreTable();
|
|
||||||
hud.addWaveTable();
|
hud.addWaveTable();
|
||||||
hud.addUnitTable();
|
hud.addUnitTable();
|
||||||
hud.addTable();
|
hud.addTable();
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class SettingS {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
addGraphicCheckSetting("spathfinder", true);
|
addGraphicCheckSetting("spathfinder", true);
|
||||||
addGraphicSlideSetting("infoUiScale", 100, 25, 300, 25, s -> s + "%");
|
addGraphicSlideSetting("infoUiScale", 100, 50, 200, 10, s -> s + "%");
|
||||||
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec");
|
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec");
|
||||||
addGraphicCheckSetting("pastwave", false);
|
addGraphicCheckSetting("pastwave", false);
|
||||||
addGraphicCheckSetting("emptywave", true);
|
addGraphicCheckSetting("emptywave", true);
|
||||||
|
|||||||
@@ -1,35 +1,49 @@
|
|||||||
package UnitInfo.ui;
|
package UnitInfo.ui;
|
||||||
|
|
||||||
|
import arc.Core;
|
||||||
|
import arc.graphics.Color;
|
||||||
|
import arc.math.Mathf;
|
||||||
|
import arc.scene.Element;
|
||||||
|
import arc.scene.event.HandCursorListener;
|
||||||
|
import arc.scene.ui.Image;
|
||||||
import arc.scene.ui.Label;
|
import arc.scene.ui.Label;
|
||||||
|
import arc.scene.ui.ScrollPane;
|
||||||
|
import arc.scene.ui.Tooltip;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
|
import arc.util.Strings;
|
||||||
import arc.util.Time;
|
import arc.util.Time;
|
||||||
|
import arc.util.Tmp;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.core.*;
|
import mindustry.core.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.graphics.Pal;
|
||||||
|
import mindustry.input.DesktopInput;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static UnitInfo.SVars.modUiScale;
|
import static UnitInfo.SVars.modUiScale;
|
||||||
import static arc.Core.settings;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class CoresItemsDisplay {
|
public class CoresItemsDisplay {
|
||||||
private final ObjectMap<Team, ObjectSet<Item>> usedItems = new ObjectMap<>();
|
private final ObjectMap<Team, ObjectSet<Item>> usedItems = new ObjectMap<>();
|
||||||
private final ObjectMap<Team, ObjectSet<UnitType>> usedUnits = new ObjectMap<>();
|
private final ObjectMap<Team, ObjectSet<UnitType>> usedUnits = new ObjectMap<>();
|
||||||
|
private final ObjectMap<Team, Seq<ItemStack>> prevItems = new ObjectMap<>();
|
||||||
|
private final ObjectMap<Team, Seq<ItemStack>> updateItems = new ObjectMap<>();
|
||||||
|
private final ObjectIntMap<Team> coreAmount = new ObjectIntMap<>();
|
||||||
private CoreBlock.CoreBuild core;
|
private CoreBlock.CoreBuild core;
|
||||||
public Team[] teams;
|
public Team[] teams;
|
||||||
public Seq<Table> tables = new Seq<>();
|
public Seq<Table> tables = new Seq<>();
|
||||||
public ObjectMap<Team, Seq<ItemStack>> prevItems = new ObjectMap<>();
|
|
||||||
public ObjectMap<Team, Seq<ItemStack>> updateItems = new ObjectMap<>();
|
|
||||||
float heat;
|
float heat;
|
||||||
|
|
||||||
public CoresItemsDisplay(Team[] teams) {
|
public CoresItemsDisplay(Team[] teams) {
|
||||||
this.teams = teams;
|
this.teams = teams;
|
||||||
resetUsed();
|
resetUsed();
|
||||||
rebuild();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetUsed(){
|
public void resetUsed(){
|
||||||
@@ -37,15 +51,20 @@ public class CoresItemsDisplay {
|
|||||||
usedUnits.clear();
|
usedUnits.clear();
|
||||||
updateItems.clear();
|
updateItems.clear();
|
||||||
prevItems.clear();
|
prevItems.clear();
|
||||||
|
coreAmount.clear();
|
||||||
|
if(settings.getBool("allTeam")) teams = Team.all;
|
||||||
|
else 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<>());
|
||||||
Seq<ItemStack> stacks = new Seq();
|
Seq<ItemStack> stacks = new Seq<ItemStack>();
|
||||||
content.items().each(i -> stacks.add(new ItemStack(i, 0)));
|
content.items().each(i -> stacks.add(new ItemStack(i, 0)));
|
||||||
updateItems.put(team, stacks);
|
updateItems.put(team, stacks);
|
||||||
prevItems.put(team, stacks);
|
prevItems.put(team, stacks);
|
||||||
|
coreAmount.put(team, team.cores().size);
|
||||||
}
|
}
|
||||||
tables.each(t->t.background(null));
|
tables.each(t->t.background(null));
|
||||||
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateItem(Team team){
|
public void updateItem(Team team){
|
||||||
@@ -54,85 +73,129 @@ public class CoresItemsDisplay {
|
|||||||
prevItems.get(team).get(item.id).set(item, core.items.get(item));
|
prevItems.get(team).get(item.id).set(item, core.items.get(item));
|
||||||
}
|
}
|
||||||
prevItems.clear();
|
prevItems.clear();
|
||||||
Seq<ItemStack> stacks = new Seq();
|
Seq<ItemStack> stacks = new Seq<ItemStack>();
|
||||||
if(core != null) content.items().each(i -> stacks.add(new ItemStack(i, core.items.get(i))));
|
if(core != null) content.items().each(i -> stacks.add(new ItemStack(i, core.items.get(i))));
|
||||||
prevItems.put(team, stacks);
|
prevItems.put(team, stacks);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Table setTable(Team team){
|
||||||
|
return new Table(t -> {
|
||||||
|
t.clear();
|
||||||
|
t.background(Styles.black6).margin(2).defaults().width(Scl.scl(Math.min(modUiScale, 1)) * 48 * 8f);
|
||||||
|
|
||||||
|
t.update(() -> {
|
||||||
|
core = team.core();
|
||||||
|
heat += Time.delta;
|
||||||
|
|
||||||
|
if(heat >= settings.getInt("coreItemCheckRate")) {
|
||||||
|
heat = 0;
|
||||||
|
updateItem(team);
|
||||||
|
}
|
||||||
|
if(coreAmount.get(team) != team.cores().size ||
|
||||||
|
content.items().contains(item -> core != null && core.items.get(item) > 0 && usedItems.get(team).add(item)) ||
|
||||||
|
content.units().contains(unit -> Groups.unit.count(u -> u.type == unit && u.team == team) > 0 && usedUnits.get(team).add(unit))){
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final int[] i = {0};
|
||||||
|
t.table(coretable -> {
|
||||||
|
for(CoreBlock.CoreBuild core : team.cores()) {
|
||||||
|
coretable.table().update(tt -> {
|
||||||
|
tt.clear();
|
||||||
|
tt.table(ttt -> {
|
||||||
|
ttt.stack(
|
||||||
|
new Table(s -> {
|
||||||
|
s.center();
|
||||||
|
Image image = new Image(core.block.uiIcon);
|
||||||
|
image.clicked(() -> {
|
||||||
|
if(control.input instanceof DesktopInput)
|
||||||
|
((DesktopInput) control.input).panning = true;
|
||||||
|
Core.camera.position.set(core.x, core.y);
|
||||||
|
});
|
||||||
|
if(!mobile) {
|
||||||
|
HandCursorListener listener1 = new HandCursorListener();
|
||||||
|
image.addListener(listener1);
|
||||||
|
image.update(() -> image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)));
|
||||||
|
}
|
||||||
|
image.addListener(new Tooltip(tttt -> {
|
||||||
|
Label label = new Label(() -> "([#" + Tmp.c1.set(Color.green).lerp(Color.red, 1 - core.healthf()).toString() + "]" + Strings.fixed(core.health, 2) + "[]/" + Strings.fixed(core.block.health, 2) + ")");
|
||||||
|
if (modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
|
||||||
|
tttt.background(Tex.button).add(label);
|
||||||
|
}));
|
||||||
|
s.add(image).size(iconLarge * Scl.scl(Math.min(modUiScale, 1)));
|
||||||
|
}),
|
||||||
|
new Table(h -> {
|
||||||
|
h.bottom().defaults().height(Scl.scl(modUiScale) * 9f).width(Scl.scl(modUiScale) * iconLarge * 1.5f).growX();
|
||||||
|
h.add(new SBar(() -> "", () -> Pal.health, () -> core.health / core.block.health).rect().init());
|
||||||
|
h.pack();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
ttt.row();
|
||||||
|
Label label = new Label(() -> "(" + (int) core.x / 8 + ", " + (int) core.y / 8 + ")");
|
||||||
|
label.setFontScale(Scl.scl(Math.min(modUiScale, 1)) * 0.75f);
|
||||||
|
ttt.add(label);
|
||||||
|
});
|
||||||
|
if(++i[0] % 5 == 0) coretable.row();
|
||||||
|
}).padLeft(4).padRight(4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.row();
|
||||||
|
i[0] = 0;
|
||||||
|
t.table(itemTable -> {
|
||||||
|
itemTable.center();
|
||||||
|
for(Item item : content.items()){
|
||||||
|
itemTable.table().update(tt -> {
|
||||||
|
tt.clear();
|
||||||
|
if(team.core() != null && team.core().items.has(item)) {
|
||||||
|
tt.stack(
|
||||||
|
new Table(ttt -> {
|
||||||
|
ttt.image(item.uiIcon).size(iconSmall * Scl.scl(Math.min(modUiScale, 1))).tooltip(tttt -> tttt.background(Styles.black6).margin(2f * Scl.scl(Math.min(modUiScale, 1))).add(item.localizedName).style(Styles.outlineLabel));
|
||||||
|
Label label = new Label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item)));
|
||||||
|
label.setFontScale(Scl.scl(Math.min(modUiScale, 1)));
|
||||||
|
ttt.add(label).minWidth(5 * 8f * Scl.scl(Math.min(modUiScale, 1))).left();
|
||||||
|
}),
|
||||||
|
new Table(ttt -> {
|
||||||
|
ttt.bottom().right();
|
||||||
|
Label label = new Label(() -> {
|
||||||
|
int amount = updateItems.get(team).get(item.id).amount;
|
||||||
|
return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "[]";
|
||||||
|
});
|
||||||
|
label.setFontScale(0.65f * Scl.scl(Math.min(modUiScale, 1)));
|
||||||
|
ttt.add(label).bottom().right().padTop(16f * Scl.scl(Math.min(modUiScale, 1)));
|
||||||
|
ttt.pack();
|
||||||
|
})
|
||||||
|
).padRight(3 * Scl.scl(Math.min(modUiScale, 1))).left();
|
||||||
|
if(++i[0] % 5 == 0) itemTable.row();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.row();
|
||||||
|
i[0] = 0;
|
||||||
|
t.table(unitTable -> {
|
||||||
|
unitTable.center();
|
||||||
|
for(UnitType unit : content.units()){
|
||||||
|
unitTable.table().update(tt -> {
|
||||||
|
tt.clear();
|
||||||
|
if(unit != UnitTypes.block && Groups.unit.contains(u -> u.type == unit && u.team == team)){
|
||||||
|
tt.image(unit.uiIcon).size(iconSmall * Scl.scl(Math.min(modUiScale, 1))).padRight(3 * Scl.scl(Math.min(modUiScale, 1))).tooltip(ttt -> ttt.background(Styles.black6).margin(2f * Scl.scl(Math.min(modUiScale, 1))).add(unit.localizedName).style(Styles.outlineLabel));
|
||||||
|
Label label = new Label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit)));
|
||||||
|
label.setFontScale(Scl.scl(Math.min(modUiScale, 1)));
|
||||||
|
tt.add(label).padRight(3 * Scl.scl(Math.min(modUiScale, 1))).minWidth(5 * 8f * Scl.scl(Math.min(modUiScale, 1))).left();
|
||||||
|
if(++i[0] % 5 == 0) unitTable.row();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void rebuild(){
|
public void rebuild(){
|
||||||
tables.clear();
|
tables.clear();
|
||||||
for(Team team : teams) {
|
for(Team team : teams) {
|
||||||
tables.add(new Table(t -> {
|
tables.add(setTable(team));
|
||||||
t.clear();
|
|
||||||
|
|
||||||
if(usedItems.size > 0 || usedUnits.size > 0){
|
|
||||||
t.background(Styles.black6);
|
|
||||||
t.margin(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
t.update(() -> {
|
|
||||||
core = team.core();
|
|
||||||
|
|
||||||
heat += Time.delta;
|
|
||||||
if(heat >= settings.getInt("coreItemCheckRate")) {
|
|
||||||
heat = 0;
|
|
||||||
updateItem(team);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(content.items().contains(item -> core != null &&
|
|
||||||
core.items.get(item) > 0 &&
|
|
||||||
usedItems.get(team).add(item)) ||
|
|
||||||
content.units().contains(unit -> core != null &&
|
|
||||||
Groups.unit.count(u -> u.type == unit && u.team == team) > 0 &&
|
|
||||||
usedUnits.get(team).add(unit))){
|
|
||||||
rebuild();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final int[] i = {0};
|
|
||||||
t.table(itemTable -> {
|
|
||||||
itemTable.center();
|
|
||||||
for(Item item : content.items()){
|
|
||||||
if(usedItems.get(team).contains(item)){
|
|
||||||
itemTable.add(new Stack(){{
|
|
||||||
add(new Table(tt -> {
|
|
||||||
tt.image(item.uiIcon).size(iconSmall * Scl.scl(modUiScale < 1 ? modUiScale : 1)).tooltip(ttt -> ttt.background(Styles.black6).margin(2f * Scl.scl(modUiScale < 1 ? modUiScale : 1)).add(item.localizedName).style(Styles.outlineLabel));
|
|
||||||
Label label = new Label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item)));
|
|
||||||
label.setFontScale(Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
|
||||||
tt.add(label).minWidth(5 * 8f * Scl.scl(modUiScale < 1 ? modUiScale : 1)).left();
|
|
||||||
}));
|
|
||||||
add(new Table(tt -> {
|
|
||||||
tt.bottom().right();
|
|
||||||
Label label = new Label(() -> {
|
|
||||||
int amount = updateItems.get(team).get(item.id).amount;
|
|
||||||
return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "[]";
|
|
||||||
});
|
|
||||||
label.setFontScale(0.65f * Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
|
||||||
tt.add(label).bottom().right().padTop(16f * Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
|
||||||
tt.pack();
|
|
||||||
}));
|
|
||||||
}}).padRight(3 * Scl.scl(modUiScale < 1 ? modUiScale : 1)).left();
|
|
||||||
if(++i[0] % 5 == 0) itemTable.row();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
t.row();
|
|
||||||
i[0] = 0;
|
|
||||||
t.table(unitTable -> {
|
|
||||||
unitTable.center();
|
|
||||||
for(UnitType unit : content.units()){
|
|
||||||
if(unit != UnitTypes.block && usedUnits.get(team).contains(unit)){
|
|
||||||
unitTable.image(unit.uiIcon).size(iconSmall * Scl.scl(modUiScale < 1 ? modUiScale : 1)).padRight(3 * Scl.scl(modUiScale < 1 ? modUiScale : 1)).tooltip(tt -> tt.background(Styles.black6).margin(2f * Scl.scl(modUiScale < 1 ? modUiScale : 1)).add(unit.localizedName).style(Styles.outlineLabel));
|
|
||||||
Label label = new Label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit)));
|
|
||||||
label.setFontScale(Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
|
||||||
unitTable.add(label).padRight(3 * Scl.scl(modUiScale < 1 ? modUiScale : 1)).minWidth(5 * 8f * Scl.scl(modUiScale < 1 ? modUiScale : 1)).left();
|
|
||||||
|
|
||||||
if(++i[0] % 5 == 0) unitTable.row();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,12 @@ public class SBar extends Element{
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(){
|
public SBar rect(){
|
||||||
|
onedot = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SBar init(){
|
||||||
boolean ssim = Core.settings.getBool("ssim");
|
boolean ssim = Core.settings.getBool("ssim");
|
||||||
boolean shar = Core.settings.getBool("shar");
|
boolean shar = Core.settings.getBool("shar");
|
||||||
boolean shar1 = Core.settings.getBool("shar1");
|
boolean shar1 = Core.settings.getBool("shar1");
|
||||||
@@ -89,6 +94,7 @@ public class SBar extends Element{
|
|||||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSSSS-top"), 32, 32, 16, 16);
|
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSSSS-top"), 32, 32, 16, 16);
|
||||||
spriteWidth = Core.atlas.find("unitinfo-barSSSSSS").width;
|
spriteWidth = Core.atlas.find("unitinfo-barSSSSSS").width;
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user