mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
align ui
This commit is contained in:
@@ -276,6 +276,7 @@ public class HudUi {
|
||||
modUiScale = settings.getInt("infoUiScale") / 100f;
|
||||
mainTable.clearChildren();
|
||||
addTable();
|
||||
coreItems.rebuild();
|
||||
}
|
||||
if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))){
|
||||
if(input.keyTap(KeyCode.r)) lockButton.change();
|
||||
@@ -930,11 +931,11 @@ public class HudUi {
|
||||
});
|
||||
wavePane.setOverscroll(false, false);
|
||||
wavePane.setWidget(new Table(tx -> tx.table(this::setWave).left()));
|
||||
|
||||
waveTable = new Table(table -> {
|
||||
table.add(new Table(Tex.button, t -> {
|
||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
||||
t.add(wavePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||
}){
|
||||
table.left();
|
||||
table.defaults().width(Scl.scl(modUiScale) * 32 * 8f).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||
table.add(new Table(Tex.button, t -> t.add(wavePane)){
|
||||
@Override
|
||||
protected void drawBackground(float x, float y) {
|
||||
if(getBackground() == null) return;
|
||||
@@ -1030,10 +1031,9 @@ public class HudUi {
|
||||
corePane.setOverscroll(false, false);
|
||||
|
||||
coreTable = new Table(table -> {
|
||||
table.add(new Table(Tex.button, t -> {
|
||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
||||
t.add(corePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||
}){
|
||||
table.left();
|
||||
table.defaults().width(Scl.scl(modUiScale) * 50 * 8f).height(Scl.scl(modUiScale) * 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;
|
||||
@@ -1059,6 +1059,7 @@ public class HudUi {
|
||||
if(tile.overlay().uiIcon != atlas.find("error")) image.image(tile.overlay().uiIcon);
|
||||
if(tile.block().uiIcon != atlas.find("error")) image.image(tile.block().uiIcon);
|
||||
});
|
||||
head.row();
|
||||
Label label = new Label(() -> tile == null ? "(null, null)" : "(" + tile.x + ", " + tile.y + ")");
|
||||
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
|
||||
head.add(label).center();
|
||||
@@ -1068,25 +1069,14 @@ public class HudUi {
|
||||
|
||||
public void addTileTable(){
|
||||
if(uiIndex != 3) return;
|
||||
ScrollPane tilePane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
|
||||
tilePane.setScrollingDisabled(true, false);
|
||||
tilePane.setScrollYForce(tileScrollPos);
|
||||
tilePane.update(() -> {
|
||||
if(tilePane.hasScroll()){
|
||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||
if(result == null || !result.isDescendantOf(tilePane)){
|
||||
scene.setScrollFocus(null);
|
||||
}
|
||||
}
|
||||
tileScrollPos = tilePane.getScrollY();
|
||||
tilePane.setWidget(new Table(tx -> tx.table(this::setTile).left()));
|
||||
});
|
||||
|
||||
tilePane.setOverscroll(false, false);
|
||||
tileTable = new Table(table -> {
|
||||
table.add(new Table(Tex.button, t -> {
|
||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
||||
t.add(tilePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||
table.left();
|
||||
table.defaults().minWidth(Scl.scl(modUiScale) * 32 * 8f).minHeight(Scl.scl(modUiScale) * 20 * 8f).align(Align.left);
|
||||
table.add(new Table(Tex.button, t->{
|
||||
t.update(()->{
|
||||
t.clearChildren();
|
||||
setTile(t);
|
||||
});
|
||||
}){
|
||||
@Override
|
||||
protected void drawBackground(float x, float y) {
|
||||
@@ -1119,26 +1109,25 @@ public class HudUi {
|
||||
|
||||
public void addItemTable(){
|
||||
if(uiIndex != 4) return;
|
||||
ScrollPane tilePane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
|
||||
tilePane.setScrollingDisabled(true, false);
|
||||
tilePane.setScrollYForce(tileScrollPos);
|
||||
tilePane.update(() -> {
|
||||
if(tilePane.hasScroll()){
|
||||
ScrollPane itemPane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
|
||||
itemPane.setScrollingDisabled(true, false);
|
||||
itemPane.setScrollYForce(tileScrollPos);
|
||||
itemPane.update(() -> {
|
||||
if(itemPane.hasScroll()){
|
||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||
if(result == null || !result.isDescendantOf(tilePane)){
|
||||
if(result == null || !result.isDescendantOf(itemPane)){
|
||||
scene.setScrollFocus(null);
|
||||
}
|
||||
}
|
||||
itemScrollPos = tilePane.getScrollY();
|
||||
itemScrollPos = itemPane.getScrollY();
|
||||
});
|
||||
tilePane.setWidget(new Table(this::setItem).left());
|
||||
itemPane.setWidget(new Table(this::setItem).left());
|
||||
itemPane.setOverscroll(false, false);
|
||||
|
||||
tilePane.setOverscroll(false, false);
|
||||
itemTable = new Table(table -> {
|
||||
table.add(new Table(Tex.button, t -> {
|
||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
||||
t.add(tilePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||
}){
|
||||
table.left();
|
||||
table.defaults().width(Scl.scl(modUiScale) * 50 * 8f).height(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||
table.add(new Table(Tex.button, t -> t.add(itemPane)){
|
||||
@Override
|
||||
protected void drawBackground(float x, float y) {
|
||||
if(getBackground() == null) return;
|
||||
|
||||
@@ -96,10 +96,10 @@ public class CoresItemsDisplay {
|
||||
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)).add(item.localizedName).style(Styles.outlineLabel));
|
||||
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)).left();
|
||||
tt.add(label).minWidth(5 * 8f * Scl.scl(modUiScale < 1 ? modUiScale : 1)).left();
|
||||
}));
|
||||
add(new Table(tt -> {
|
||||
tt.bottom().right();
|
||||
@@ -108,10 +108,10 @@ public class CoresItemsDisplay {
|
||||
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));
|
||||
tt.add(label).bottom().right().padTop(16f * Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
||||
tt.pack();
|
||||
}));
|
||||
}}).padRight(3 * Scl.scl(modUiScale)).left();
|
||||
}}).padRight(3 * Scl.scl(modUiScale < 1 ? modUiScale : 1)).left();
|
||||
if(++i[0] % 5 == 0) itemTable.row();
|
||||
}
|
||||
}
|
||||
@@ -122,10 +122,10 @@ public class CoresItemsDisplay {
|
||||
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)).tooltip(tt -> tt.background(Styles.black6).margin(2f * Scl.scl(modUiScale)).add(unit.localizedName).style(Styles.outlineLabel));
|
||||
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)).minWidth(5 * 8f * Scl.scl(modUiScale)).left();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SBar extends Element{
|
||||
NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
|
||||
int[] pads = region.pads;
|
||||
if(pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]);
|
||||
out = new ScaledNinePatchDrawable(patch, Scl.scl());
|
||||
out = new ScaledNinePatchDrawable(patch, 1);
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -150,15 +150,7 @@ public class SBar extends Element{
|
||||
ScissorStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
Fonts.outline.draw(name, x + width / 2f, y + height / 2f, Color.white, Scl.scl(modUiScale < 1 ? modUiScale : 1), false, Align.center);
|
||||
Font font = Fonts.outline;
|
||||
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||
lay.setText(font, name);
|
||||
|
||||
|
||||
Pools.free(lay);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user