mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
align ui
This commit is contained in:
@@ -276,6 +276,7 @@ public class HudUi {
|
|||||||
modUiScale = settings.getInt("infoUiScale") / 100f;
|
modUiScale = settings.getInt("infoUiScale") / 100f;
|
||||||
mainTable.clearChildren();
|
mainTable.clearChildren();
|
||||||
addTable();
|
addTable();
|
||||||
|
coreItems.rebuild();
|
||||||
}
|
}
|
||||||
if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))){
|
if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))){
|
||||||
if(input.keyTap(KeyCode.r)) lockButton.change();
|
if(input.keyTap(KeyCode.r)) lockButton.change();
|
||||||
@@ -930,11 +931,11 @@ 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(Tex.button, t -> {
|
table.left();
|
||||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
table.defaults().width(Scl.scl(modUiScale) * 32 * 8f).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||||
t.add(wavePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
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) {
|
||||||
if(getBackground() == null) return;
|
if(getBackground() == null) return;
|
||||||
@@ -1030,10 +1031,9 @@ public class HudUi {
|
|||||||
corePane.setOverscroll(false, false);
|
corePane.setOverscroll(false, false);
|
||||||
|
|
||||||
coreTable = new Table(table -> {
|
coreTable = new Table(table -> {
|
||||||
table.add(new Table(Tex.button, t -> {
|
table.left();
|
||||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
table.defaults().width(Scl.scl(modUiScale) * 50 * 8f).height(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||||
t.add(corePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
table.add(new Table(Tex.button, t -> t.add(corePane)){
|
||||||
}){
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(float x, float y) {
|
protected void drawBackground(float x, float y) {
|
||||||
if(getBackground() == null) return;
|
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.overlay().uiIcon != atlas.find("error")) image.image(tile.overlay().uiIcon);
|
||||||
if(tile.block().uiIcon != atlas.find("error")) image.image(tile.block().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 + ")");
|
Label label = new Label(() -> tile == null ? "(null, null)" : "(" + tile.x + ", " + tile.y + ")");
|
||||||
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
|
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
|
||||||
head.add(label).center();
|
head.add(label).center();
|
||||||
@@ -1068,25 +1069,14 @@ public class HudUi {
|
|||||||
|
|
||||||
public void addTileTable(){
|
public void addTileTable(){
|
||||||
if(uiIndex != 3) return;
|
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 -> {
|
tileTable = new Table(table -> {
|
||||||
table.add(new Table(Tex.button, t -> {
|
table.left();
|
||||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
table.defaults().minWidth(Scl.scl(modUiScale) * 32 * 8f).minHeight(Scl.scl(modUiScale) * 20 * 8f).align(Align.left);
|
||||||
t.add(tilePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
table.add(new Table(Tex.button, t->{
|
||||||
|
t.update(()->{
|
||||||
|
t.clearChildren();
|
||||||
|
setTile(t);
|
||||||
|
});
|
||||||
}){
|
}){
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(float x, float y) {
|
protected void drawBackground(float x, float y) {
|
||||||
@@ -1119,26 +1109,25 @@ public class HudUi {
|
|||||||
|
|
||||||
public void addItemTable(){
|
public void addItemTable(){
|
||||||
if(uiIndex != 4) return;
|
if(uiIndex != 4) return;
|
||||||
ScrollPane tilePane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
|
ScrollPane itemPane = new ScrollPane(new Image(clear).setScaling(Scaling.fit), Styles.smallPane);
|
||||||
tilePane.setScrollingDisabled(true, false);
|
itemPane.setScrollingDisabled(true, false);
|
||||||
tilePane.setScrollYForce(tileScrollPos);
|
itemPane.setScrollYForce(tileScrollPos);
|
||||||
tilePane.update(() -> {
|
itemPane.update(() -> {
|
||||||
if(tilePane.hasScroll()){
|
if(itemPane.hasScroll()){
|
||||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||||
if(result == null || !result.isDescendantOf(tilePane)){
|
if(result == null || !result.isDescendantOf(itemPane)){
|
||||||
scene.setScrollFocus(null);
|
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 -> {
|
itemTable = new Table(table -> {
|
||||||
table.add(new Table(Tex.button, t -> {
|
table.left();
|
||||||
t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
|
table.defaults().width(Scl.scl(modUiScale) * 50 * 8f).height(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
||||||
t.add(tilePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
|
table.add(new Table(Tex.button, t -> t.add(itemPane)){
|
||||||
}){
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(float x, float y) {
|
protected void drawBackground(float x, float y) {
|
||||||
if(getBackground() == null) return;
|
if(getBackground() == null) return;
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ public class CoresItemsDisplay {
|
|||||||
if(usedItems.get(team).contains(item)){
|
if(usedItems.get(team).contains(item)){
|
||||||
itemTable.add(new Stack(){{
|
itemTable.add(new Stack(){{
|
||||||
add(new Table(tt -> {
|
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 label = new Label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item)));
|
||||||
label.setFontScale(Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
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 -> {
|
add(new Table(tt -> {
|
||||||
tt.bottom().right();
|
tt.bottom().right();
|
||||||
@@ -108,10 +108,10 @@ public class CoresItemsDisplay {
|
|||||||
return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "[]";
|
return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "[]";
|
||||||
});
|
});
|
||||||
label.setFontScale(0.65f * Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
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();
|
tt.pack();
|
||||||
}));
|
}));
|
||||||
}}).padRight(3 * Scl.scl(modUiScale)).left();
|
}}).padRight(3 * Scl.scl(modUiScale < 1 ? modUiScale : 1)).left();
|
||||||
if(++i[0] % 5 == 0) itemTable.row();
|
if(++i[0] % 5 == 0) itemTable.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,10 +122,10 @@ public class CoresItemsDisplay {
|
|||||||
unitTable.center();
|
unitTable.center();
|
||||||
for(UnitType unit : content.units()){
|
for(UnitType unit : content.units()){
|
||||||
if(unit != UnitTypes.block && usedUnits.get(team).contains(unit)){
|
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 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));
|
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();
|
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]);
|
NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
|
||||||
int[] pads = region.pads;
|
int[] pads = region.pads;
|
||||||
if(pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]);
|
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;
|
return out;
|
||||||
}
|
}
|
||||||
@@ -150,15 +150,7 @@ public class SBar extends Element{
|
|||||||
ScissorStack.pop();
|
ScissorStack.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
Fonts.outline.draw(name, x + width / 2f, y + height / 2f, Color.white, Scl.scl(modUiScale < 1 ? modUiScale : 1), false, Align.center);
|
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