mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-11 15:56:21 +02:00
ui scale
This commit is contained in:
@@ -12,6 +12,7 @@ import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
import static UnitInfo.SVars.modUiScale;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class CoresItemsDisplay {
|
||||
@@ -95,8 +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).tooltip(ttt -> ttt.background(Styles.black6).margin(2f).add(item.localizedName).style(Styles.outlineLabel));
|
||||
tt.label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item))).minWidth(5 * 8f).left();
|
||||
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));
|
||||
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();
|
||||
}));
|
||||
add(new Table(tt -> {
|
||||
tt.bottom().right();
|
||||
@@ -104,11 +107,11 @@ public class CoresItemsDisplay {
|
||||
int amount = updateItems.get(team).get(item.id).amount;
|
||||
return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "[]";
|
||||
});
|
||||
label.setFontScale(0.65f);
|
||||
tt.add(label).bottom().right().padTop(16f);
|
||||
label.setFontScale(0.65f * Scl.scl(modUiScale < 1 ? modUiScale : 1));
|
||||
tt.add(label).bottom().right().padTop(16f * Scl.scl(modUiScale));
|
||||
tt.pack();
|
||||
}));
|
||||
}}).padRight(3).left();
|
||||
}}).padRight(3 * Scl.scl(modUiScale)).left();
|
||||
if(++i[0] % 5 == 0) itemTable.row();
|
||||
}
|
||||
}
|
||||
@@ -119,8 +122,11 @@ 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).padRight(3).tooltip(tt -> tt.background(Styles.black6).margin(2f).add(unit.localizedName).style(Styles.outlineLabel));
|
||||
unitTable.label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit))).padRight(3).minWidth(5 * 8f).left();
|
||||
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));
|
||||
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();
|
||||
|
||||
if(++i[0] % 5 == 0) unitTable.row();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,17 @@ import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.Label;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.Align;
|
||||
import arc.util.Strings;
|
||||
import arc.util.pooling.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
import static UnitInfo.SVars.modUiScale;
|
||||
import static mindustry.Vars.player;
|
||||
|
||||
public class SBar extends Element{
|
||||
static final Rect scissor = new Rect();
|
||||
|
||||
@@ -52,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, 1f);
|
||||
out = new ScaledNinePatchDrawable(patch, Scl.scl());
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -144,17 +150,15 @@ 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);
|
||||
font.getData().setScale(Scl.scl());
|
||||
lay.setText(font, name);
|
||||
font.setColor(Color.white);
|
||||
font.draw(name, x + width / 2f - lay.width / 2f, y + height / 2f + lay.height / 2f + 1);
|
||||
font.getData().setScale(Scl.scl());
|
||||
|
||||
|
||||
Pools.free(lay);
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user