mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
improved ui design
added core camera
This commit is contained in:
@@ -14,23 +14,18 @@ shar-stat.power = Power: {0} / {1}
|
||||
# Settings
|
||||
setting.wavemax.name = Wave Amount to display
|
||||
setting.rangemax.name = Block Scan Range
|
||||
setting.panfix.name = Hold camera position for core camera ui. [lightgray](It shakes a lot when the player moves.)[]
|
||||
setting.scan.name = Display block scanner
|
||||
setting.range.name = Display turret range by block scanner
|
||||
setting.select.name = Display select Arrow
|
||||
setting.coreui.name = Display core info UI
|
||||
setting.waveui.name = Display wave info UI
|
||||
setting.unitui.name = Display unit info UI
|
||||
setting.infoui.name = Display info UI
|
||||
setting.weaponui.name = Display weapon info UI
|
||||
setting.commandedunitui.name = Display command info UI
|
||||
setting.unithealthui.name = Display Unit Bar
|
||||
setting.selectopacity.name = Select Arrow Opacity
|
||||
setting.coreuiopacity.name = Core UI background Opacity
|
||||
setting.waveuiopacity.name = Wave UI background Opacity
|
||||
setting.uiopacity.name = UI background Opacity
|
||||
setting.baropacity.name = Health Bar Opacity
|
||||
setting.coreuiscaling.name = Core UI Scaling [lightgray](need re-load the world)[]
|
||||
setting.waveuiscaling.name = Wave UI Scaling [lightgray](need re-load the world)[]
|
||||
setting.uiscaling.name = UI Scaling [lightgray](need restart game)[]
|
||||
setting.uiopacity.name = UI background Opacity
|
||||
setting.uiscaling.name = UI Scaling
|
||||
|
||||
#Dialog
|
||||
editmaxwave = edit waves(int)
|
||||
|
||||
@@ -14,23 +14,18 @@ shar-stat.power = 전력: {0} / {1}
|
||||
# Settings
|
||||
setting.wavemax.name = 표시할 단계 수
|
||||
setting.rangemax.name = 블록 스캔 사거리
|
||||
setting.panfix.name = 코어 UI용 카메라 고정 [lightgray](플레이어가 움직일 때 흔들림이 심합니다.)[]
|
||||
setting.scan.name = 블록 스캐너 표시
|
||||
setting.range.name = 블록 스캐너로 포탑 사거리 표시
|
||||
setting.select.name = 선택 화살표 표시
|
||||
setting.coreui.name = 코어 정보 UI 표시
|
||||
setting.waveui.name = 단계 정보 UI 표시
|
||||
setting.unitui.name = 유닛 정보 UI 표시
|
||||
setting.infoui.name = 정보 UI 표시
|
||||
setting.weaponui.name = 무기 정보 UI 표시
|
||||
setting.commandedunitui.name = 지휘 정보 UI 표시
|
||||
setting.unithealthui.name = 유닛 바 표시
|
||||
setting.selectopacity.name = 선택 화살표 투명도
|
||||
setting.coreuiopacity.name = 코어 UI 배경 투명도
|
||||
setting.waveuiopacity.name = 단계 UI 배경 투명도
|
||||
setting.uiopacity.name = UI 배경 투명도
|
||||
setting.baropacity.name = 유닛 바 투명도
|
||||
setting.coreuiscaling.name = 코어 정보 UI 스케일링 [lightgray](월드를 다시 로드해야 합니다)[]
|
||||
setting.waveuiscaling.name = 단계 정보 UI 스케일링 [lightgray](월드를 다시 로드해야 합니다)[]
|
||||
setting.uiscaling.name = UI 스케일링 [lightgray](게임을 다시 시작해야 합니다)[]
|
||||
setting.uiopacity.name = UI 배경 투명도
|
||||
setting.uiscaling.name = UI 스케일링
|
||||
|
||||
#Dialog
|
||||
editmaxwave = 최대 단계 수정하기(정수)
|
||||
|
||||
@@ -29,6 +29,7 @@ import mindustry.game.EventType;
|
||||
import mindustry.game.SpawnGroup;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.input.DesktopInput;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.defense.turrets.ItemTurret;
|
||||
@@ -47,24 +48,30 @@ import static mindustry.Vars.*;
|
||||
public class HudUi {
|
||||
Seq<Element> bars = new Seq<>();
|
||||
Table weapon = new Table();
|
||||
Table core = new Table();
|
||||
Table wave = new Table();
|
||||
Table waveTable;
|
||||
Table mainTable = new Table();
|
||||
Table baseTable = new Table();
|
||||
Table unitTable = new Table();
|
||||
Table waveTable = new Table();
|
||||
Table coreTable = new Table();
|
||||
|
||||
@Nullable UnitType type;
|
||||
@Nullable Unit unit;
|
||||
Element image;
|
||||
|
||||
int uiIndex = 0;
|
||||
|
||||
float heat;
|
||||
float heat2;
|
||||
float scrollPos;
|
||||
float coreScrollPos;
|
||||
float waveScrollPos;
|
||||
int maxwave;
|
||||
int savedwave;
|
||||
int coreamount;
|
||||
float unitFade;
|
||||
|
||||
Unit unit2;
|
||||
|
||||
boolean panFix = false;
|
||||
|
||||
public Unit getUnit(){
|
||||
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4);
|
||||
if(units.size <= 0) return player.unit();
|
||||
@@ -73,6 +80,93 @@ public class HudUi {
|
||||
else return unit;
|
||||
}
|
||||
|
||||
public void setDraw(){
|
||||
Events.run(EventType.Trigger.draw, () -> {
|
||||
if(!Core.settings.getBool("select")) return;
|
||||
Unit unit = getUnit();
|
||||
unitFade = Mathf.lerpDelta(unitFade, Mathf.num(unit != null), 0.1f);
|
||||
if(unit == null) return;
|
||||
if(unit2 == null || (unit2.x == 0f && unit2.y == 0f)) unit2 = unit;
|
||||
|
||||
Tmp.v1.set(unit2).lerp(unit, Mathf.clamp(Time.delta%60));
|
||||
if(Tmp.v1.x == unit.x && Tmp.v1.y == unit.y){
|
||||
hh += Time.delta;
|
||||
unit2 = unit;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
||||
float length = unit.hitSize * 1.5f + (unitFade * 2.5f);
|
||||
Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)).a(settings.getInt("uiopacity") / 100f));
|
||||
Draw.rect("select-arrow", Tmp.v1.x + Angles.trnsx(rot, length), Tmp.v1.y + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
||||
Draw.reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addTable(){
|
||||
mainTable = new Table(table -> {
|
||||
table.left();
|
||||
table.table(t -> {
|
||||
Button[] buttons = {null, null, null};
|
||||
buttons[0] = t.button(Icon.units, Styles.clearToggleTransi, () -> {
|
||||
uiIndex = 0;
|
||||
buttons[0].setChecked(true);
|
||||
buttons[1].setChecked(false);
|
||||
buttons[2].setChecked(false);
|
||||
addCoreTable();
|
||||
addWaveTable();
|
||||
addBars();
|
||||
addWeapon();
|
||||
addUnitTable();
|
||||
table.removeChild(baseTable);
|
||||
baseTable = table.table(tt -> tt.stack(unitTable, waveTable, coreTable).align(Align.left).left()).get();
|
||||
}).size(5*8f).get();
|
||||
t.row();
|
||||
buttons[1] = t.button(Icon.fileText, Styles.clearToggleTransi, () -> {
|
||||
uiIndex = 1;
|
||||
buttons[0].setChecked(false);
|
||||
buttons[1].setChecked(true);
|
||||
buttons[2].setChecked(false);
|
||||
addCoreTable();
|
||||
addWaveTable();
|
||||
addBars();
|
||||
addWeapon();
|
||||
addUnitTable();
|
||||
table.removeChild(baseTable);
|
||||
baseTable = table.table(tt -> tt.stack(unitTable, waveTable, coreTable).align(Align.left).left()).get();
|
||||
}).size(5*8f).get();
|
||||
t.row();
|
||||
buttons[2] = t.button(Icon.commandRally, Styles.clearToggleTransi, () -> {
|
||||
uiIndex = 2;
|
||||
buttons[0].setChecked(false);
|
||||
buttons[1].setChecked(false);
|
||||
buttons[2].setChecked(true);
|
||||
addCoreTable();
|
||||
addWaveTable();
|
||||
addBars();
|
||||
addWeapon();
|
||||
addUnitTable();
|
||||
table.removeChild(baseTable);
|
||||
baseTable = table.table(tt -> tt.stack(unitTable, waveTable, coreTable).align(Align.left).left()).get();
|
||||
}).size(5*8f).get();
|
||||
});
|
||||
|
||||
baseTable = table.table(tt -> {
|
||||
tt.stack(unitTable, waveTable, coreTable).align(Align.left).left();
|
||||
tt.visible(() -> settings.getBool("infoui"));
|
||||
}).get();
|
||||
|
||||
table.fillParent = true;
|
||||
table.visibility = () -> (
|
||||
ui.hudfrag.shown && !ui.minimapfrag.shown()
|
||||
&& (!Vars.mobile ||
|
||||
!(getUnit().isBuilding() || Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
||||
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
||||
});
|
||||
ui.hudGroup.addChild(mainTable);
|
||||
}
|
||||
|
||||
public void addBars(){
|
||||
bars.clear();
|
||||
bars.add(
|
||||
@@ -189,8 +283,7 @@ public class HudUi {
|
||||
{{
|
||||
left();
|
||||
update(() -> {
|
||||
|
||||
if(!Core.settings.getBool("unitui") || !(getUnit() instanceof BlockUnitUnit) || (
|
||||
if(!(getUnit() instanceof BlockUnitUnit) || (
|
||||
!(((BlockUnitUnit)getUnit()).tile() instanceof ItemTurret.ItemTurretBuild)
|
||||
&& !(((BlockUnitUnit)getUnit()).tile() instanceof LiquidTurret.LiquidTurretBuild)
|
||||
&& !(((BlockUnitUnit)getUnit()).tile() instanceof PowerTurret.PowerTurretBuild)
|
||||
@@ -260,7 +353,6 @@ public class HudUi {
|
||||
|
||||
t.add(new Image(){{
|
||||
update(() -> {
|
||||
if(!Core.settings.getBool("unitui")) return;
|
||||
setDrawable(getUnit().stack.item == null || getUnit().stack.amount <= 0 ? Core.atlas.find("clear") : getUnit().stack.item.icon(Cicon.small));
|
||||
});
|
||||
}
|
||||
@@ -321,8 +413,6 @@ public class HudUi {
|
||||
t.left();
|
||||
t.add(new Image(){{
|
||||
update(() -> {
|
||||
if(!Core.settings.getBool("unitui")) return;
|
||||
|
||||
if(!Vars.state.rules.unitAmmo){
|
||||
setDrawable(Core.atlas.find("clear"));
|
||||
return;
|
||||
@@ -512,30 +602,9 @@ public class HudUi {
|
||||
|
||||
|
||||
float hh;
|
||||
public void addTable(){
|
||||
Events.run(EventType.Trigger.draw, () -> {
|
||||
if(!Core.settings.getBool("select")) return;
|
||||
Unit unit = getUnit();
|
||||
unitFade = Mathf.lerpDelta(unitFade, Mathf.num(unit != null), 0.1f);
|
||||
if(unit == null) return;
|
||||
if(unit2 == null || (unit2.x == 0f && unit2.y == 0f)) unit2 = unit;
|
||||
|
||||
Tmp.v1.set(unit2).lerp(unit, Mathf.clamp(Time.delta%60));
|
||||
if(Tmp.v1.x == unit.x && Tmp.v1.y == unit.y){
|
||||
hh += Time.delta;
|
||||
unit2 = unit;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
||||
float length = unit.hitSize * 1.5f + (unitFade * 2.5f);
|
||||
Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)).a(settings.getInt("coreuiopacity") / 100f));
|
||||
Draw.rect("select-arrow", Tmp.v1.x + Angles.trnsx(rot, length), Tmp.v1.y + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
||||
Draw.reset();
|
||||
}
|
||||
});
|
||||
|
||||
ui.hudGroup.addChild(new Table(table -> {
|
||||
public void addUnitTable(){
|
||||
if(uiIndex != 0) return;
|
||||
unitTable = new Table(table -> {
|
||||
table.left();
|
||||
addBars();
|
||||
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> {
|
||||
@@ -545,13 +614,12 @@ public class HudUi {
|
||||
Stack stack = new Stack(){{
|
||||
add(new Table(ttt -> ttt.add(new Image(){{
|
||||
update(() -> {
|
||||
if(!Core.settings.getBool("unitui")) return;
|
||||
TextureRegion region = Core.atlas.find("clear");
|
||||
if(getUnit() instanceof BlockUnitUnit && getUnit().type != null) region = ((BlockUnitUnit)getUnit()).tile().block.icon(Cicon.large);
|
||||
else if(getUnit() != null && getUnit().type != null) region = getUnit().type.icon(Cicon.large);
|
||||
setDrawable(region);
|
||||
});
|
||||
}}.setScaling(Scaling.fit)).size(4f * 8f)));
|
||||
}}.setScaling(Scaling.fit)).size(Scl.scl(4f * 8f * (settings.getInt("uiscaling") / 100f)))));
|
||||
add(new Table(ttt -> {
|
||||
ttt.top().left();
|
||||
ttt.add(new Stack(){{
|
||||
@@ -591,6 +659,7 @@ public class HudUi {
|
||||
|
||||
return name;
|
||||
});
|
||||
|
||||
label.setFontScale(Scl.scl() * (settings.getInt("uiscaling") / 100f));
|
||||
TextButton button = Elem.newButton("?", Styles.clearPartialt, () -> {
|
||||
if(getUnit().type != null && getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit)getUnit()).tile() instanceof Turret.TurretBuild) ui.content.show(((BlockUnitUnit)getUnit()).tile().block);
|
||||
@@ -631,21 +700,18 @@ public class HudUi {
|
||||
}
|
||||
}).padRight(Scl.scl(24 * 8f * (settings.getInt("uiscaling") / 100f)));
|
||||
table.row();
|
||||
Unit unittemp = getUnit();
|
||||
table.update(() -> {
|
||||
if(!Core.settings.getBool("unitui")) return;
|
||||
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit) getUnit()).tile() instanceof Turret.TurretBuild){
|
||||
Turret.TurretBuild entity = ((Turret.TurretBuild)((BlockUnitUnit) getUnit()).tile());
|
||||
if(entity.charging) heat2 += Time.delta;
|
||||
else heat2 = 0f;
|
||||
}
|
||||
heat += Time.delta;
|
||||
if (heat >= 6 && unittemp != getUnit()) {
|
||||
if (heat >= 6) {
|
||||
heat = 0f;
|
||||
type = getUnit().type;
|
||||
unit = getUnit();
|
||||
|
||||
table.removeChild(weapon);
|
||||
table.removeChild(weapon);
|
||||
addWeapon();
|
||||
table.row();
|
||||
@@ -655,131 +721,118 @@ public class HudUi {
|
||||
});
|
||||
|
||||
table.fillParent = true;
|
||||
table.visibility = () -> Core.settings.getBool("unitui") && (
|
||||
ui.hudfrag.shown && !ui.minimapfrag.shown()
|
||||
&& (!Vars.mobile ||
|
||||
!(getUnit().isBuilding() || Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
||||
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
||||
}));
|
||||
}
|
||||
|
||||
public void addCore(){
|
||||
core = new Table(tx -> {
|
||||
tx.left();
|
||||
tx.add(new Table(tt -> {
|
||||
tt.defaults().maxWidth(Scl.scl(24/3f * 3f * (settings.getInt("coreuiscaling") / 100f))).left().top();
|
||||
|
||||
int row = 0;
|
||||
if(Vars.player.unit() == null) return;
|
||||
coreamount = Vars.player.unit().team().cores().size;
|
||||
for(int r = 0; r < coreamount; r++){
|
||||
CoreBlock.CoreBuild core = Vars.player.unit().team().cores().get(r);
|
||||
TextureRegion region = core.block.icon(Cicon.full);
|
||||
|
||||
if(coreamount > 1 && r % 4 == 0) {
|
||||
tt.row();
|
||||
row++;
|
||||
}
|
||||
else if(r % 4 == 0){
|
||||
tt.row();
|
||||
row++;
|
||||
}
|
||||
tt.table(coretable -> {
|
||||
coretable.center();
|
||||
coretable.add(new Stack(){{
|
||||
add(new Table(o -> {
|
||||
o.left();
|
||||
o.add(new Image(region).setScaling(Scaling.fit)).size(Scl.scl(6 * 8f * (settings.getInt("coreuiscaling") / 100f))).scaling(Scaling.fit);
|
||||
}));
|
||||
|
||||
add(new Table(h -> {
|
||||
h.add(new Stack(){{
|
||||
add(new Table(e -> {
|
||||
e.defaults().growX().height(Scl.scl(9 * (settings.getInt("coreuiscaling") / 100f))).width(Scl.scl(6f * 8f * (settings.getInt("coreuiscaling") / 100f))).padTop(Scl.scl(6 * 8f * (settings.getInt("coreuiscaling") / 100f)));
|
||||
Bar healthBar = new Bar(
|
||||
() -> "",
|
||||
() -> Pal.health,
|
||||
core::healthf);
|
||||
e.add(healthBar);
|
||||
e.pack();
|
||||
}));
|
||||
}});
|
||||
h.pack();
|
||||
}));
|
||||
}}).center();
|
||||
coretable.row();
|
||||
coretable.center();
|
||||
Label label = new Label(() -> "(" + (int)core.x / 8 + ", " + (int)core.y / 8 + ")");
|
||||
label.setFontScale(Scl.scl());
|
||||
coretable.add(label);
|
||||
}).left();
|
||||
tt.center();
|
||||
}
|
||||
}){
|
||||
@Override
|
||||
protected void drawBackground(float x, float y) {
|
||||
if(getBackground() == null) return;
|
||||
Color color = this.color;
|
||||
Draw.color(color.r, color.g, color.b, (settings.getInt("coreuiopacity") / 100f) * this.parentAlpha);
|
||||
getBackground().draw(x, y, width, height);
|
||||
}
|
||||
}).padLeft(Scl.scl(6 * 8f * (settings.getInt("coreuiscaling") / 100f)));
|
||||
tx.setColor(tx.color.cpy().a(1f));
|
||||
table.visibility = () -> uiIndex == 0;
|
||||
});
|
||||
}
|
||||
|
||||
public void setCore(Table table){
|
||||
table.add(new Table(t -> {
|
||||
if(Vars.player.unit() == null) return;
|
||||
coreamount = Vars.player.unit().team().cores().size;
|
||||
for(int r = 0; r < coreamount; r++){
|
||||
CoreBlock.CoreBuild core = Vars.player.unit().team().cores().get(r);
|
||||
TextureRegion region = core.block.icon(Cicon.full);
|
||||
|
||||
if(coreamount > 1 && r % 3 == 0) t.row();
|
||||
else if(r % 3 == 0) t.row();
|
||||
|
||||
t.table(tt -> {
|
||||
tt.left();
|
||||
tt.add(new Stack(){{
|
||||
add(new Table(tt -> {
|
||||
tt.add(new Stack(){{
|
||||
add(new Table(s -> {
|
||||
s.left();
|
||||
s.add(new Image(region).setScaling(Scaling.fit)).size(Scl.scl(6 * 8f * (settings.getInt("uiscaling") / 100f))).scaling(Scaling.fit);
|
||||
}));
|
||||
|
||||
add(new Table(s -> {
|
||||
s.add(new Stack(){{
|
||||
add(new Table(e -> {
|
||||
e.defaults().growX().height(Scl.scl(9 * (settings.getInt("uiscaling") / 100f))).width(Scl.scl(6f * 8f * (settings.getInt("uiscaling") / 100f))).padTop(Scl.scl(6 * 8f * (settings.getInt("coreuiscaling") / 100f)));
|
||||
Bar healthBar = new Bar(
|
||||
() -> "",
|
||||
() -> Pal.health,
|
||||
core::healthf);
|
||||
e.add(healthBar);
|
||||
e.pack();
|
||||
}));
|
||||
}});
|
||||
s.pack();
|
||||
}));
|
||||
}});
|
||||
tt.row();
|
||||
Label label = new Label(() -> "(" + (int)core.x / 8 + ", " + (int)core.y / 8 + ")");
|
||||
label.setFontScale(Scl.scl() * (settings.getInt("uiscaling") / 100f));
|
||||
tt.add(label);
|
||||
}));
|
||||
|
||||
add(new Table(tt -> { //unit info
|
||||
tt.center();
|
||||
TextButton button = new TextButton("?", Styles.clearPartialt);
|
||||
button.changed(() -> {
|
||||
if(!settings.getBool("panfix")) {
|
||||
if(control.input instanceof DesktopInput) ((DesktopInput) control.input).panning = true;
|
||||
Core.camera.position.set(core.x, core.y);
|
||||
}
|
||||
else panFix = !panFix;
|
||||
});
|
||||
tt.update(() -> {
|
||||
if(!settings.getBool("panfix")) return;
|
||||
button.setChecked(panFix);
|
||||
if(control.input instanceof DesktopInput) ((DesktopInput) control.input).panning = true;
|
||||
Core.camera.position.set(core.x, core.y);
|
||||
});
|
||||
tt.add(button).size(Scl.scl(3 * 8f * (settings.getInt("uiscaling") / 100f))).center().padBottom(2 * 6f);
|
||||
tt.pack();
|
||||
}));
|
||||
}});
|
||||
}).left();
|
||||
}
|
||||
}));
|
||||
}
|
||||
int coreAmount;
|
||||
public void addCoreTable(){
|
||||
ScrollPane pane = new ScrollPane(new Image(Core.atlas.find("clear")).setScaling(Scaling.fit), Styles.smallPane);
|
||||
pane.setScrollingDisabled(true, false);
|
||||
pane.setScrollYForce(scrollPos);
|
||||
pane.update(() -> {
|
||||
if(pane.hasScroll()){
|
||||
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.update(() -> {
|
||||
if(corePane.hasScroll()){
|
||||
Element result = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
|
||||
if(result == null || !result.isDescendantOf(pane)){
|
||||
if(result == null || !result.isDescendantOf(corePane)){
|
||||
Core.scene.setScrollFocus(null);
|
||||
}
|
||||
}
|
||||
|
||||
scrollPos = pane.getScrollY();
|
||||
|
||||
if(coreamount == Vars.player.unit().team().cores().size || !Core.settings.getBool("coreui")) return;
|
||||
pane.clearChildren();
|
||||
pane.removeChild(core);
|
||||
addCore();
|
||||
pane.setWidget(core);
|
||||
coreScrollPos = corePane.getScrollY();
|
||||
if(Vars.player != null && coreAmount != Vars.player.team().cores().size) {
|
||||
corePane.setWidget(new Table(tx -> tx.table(this::setCore).left()));
|
||||
coreAmount = Vars.player.team().cores().size;
|
||||
};
|
||||
});
|
||||
pane.setOverscroll(false, false);
|
||||
|
||||
ui.hudGroup.addChild(new Table(table -> {
|
||||
table.top().right();
|
||||
corePane.setOverscroll(false, false);
|
||||
|
||||
coreTable = new Table(table -> {
|
||||
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> {
|
||||
t.update(() -> {
|
||||
if(coreamount == Vars.player.unit().team().cores().size || !Core.settings.getBool("coreui")) return;
|
||||
t.clearChildren();
|
||||
t.add(pane).maxHeight(Scl.scl(24 * 8f * (settings.getInt("coreuiscaling") / 100f)));
|
||||
});
|
||||
t.defaults().minWidth(Scl.scl(25 * 8f * (settings.getInt("uiscaling") / 100f))).scaling(Scaling.fit).left();
|
||||
t.add(corePane).maxHeight(Scl.scl(32 * 8f * (settings.getInt("uiscaling") / 100f)));
|
||||
}){
|
||||
@Override
|
||||
protected void drawBackground(float x, float y) {
|
||||
if(getBackground() == null) return;
|
||||
Color color = this.color;
|
||||
Draw.color(color.r, color.g, color.b, (settings.getInt("coreuiopacity") / 100f) * this.parentAlpha);
|
||||
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(24 * 8f * (settings.getInt("coreuiscaling") / 100f)));
|
||||
|
||||
}).padRight(Scl.scl(39 * 8f * (settings.getInt("uiscaling") / 100f)));
|
||||
|
||||
table.fillParent = true;
|
||||
table.visibility = () -> Core.settings.getBool("coreui") && (
|
||||
ui.hudfrag.shown && !ui.minimapfrag.shown()
|
||||
&& (!Vars.mobile ||
|
||||
!(Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
||||
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
||||
}));
|
||||
table.visibility = () -> uiIndex == 2;
|
||||
});
|
||||
}
|
||||
|
||||
public void getWave(Table table){
|
||||
public void setWave(Table table){
|
||||
int winWave = state.isCampaign() && state.rules.winWave > 0 ? state.rules.winWave : Integer.MAX_VALUE;
|
||||
maxwave = settings.getInt("wavemax");
|
||||
for(int i = state.wave - 1; i <= Math.min(state.wave + maxwave, winWave - 2); i++){
|
||||
@@ -788,9 +841,9 @@ public class HudUi {
|
||||
t.add(new Table(tt -> {
|
||||
tt.left();
|
||||
Label label = new Label(() -> "[#" + Pal.accent.toString() + "]" + (j + 1) + "[]");
|
||||
label.setFontScale(Scl.scl() * (settings.getInt("waveuiscaling") / 100f));
|
||||
label.setFontScale(Scl.scl() * (settings.getInt("uiscaling") / 100f));
|
||||
tt.add(label);
|
||||
})).width(Scl.scl(32f * (settings.getInt("waveuiscaling") / 100f)));
|
||||
})).width(Scl.scl(32f * (settings.getInt("uiscaling") / 100f)));
|
||||
|
||||
t.table(tx -> {
|
||||
int row = 0;
|
||||
@@ -809,7 +862,7 @@ public class HudUi {
|
||||
add(new Table(ttt -> {
|
||||
ttt.bottom().left();
|
||||
Label label = new Label(() -> group.getSpawned(j) + "");
|
||||
label.setFontScale(Scl.scl() * (settings.getInt("waveuiscaling") / 100f));
|
||||
label.setFontScale(Scl.scl() * (settings.getInt("uiscaling") / 100f));
|
||||
ttt.add(label);
|
||||
ttt.pack();
|
||||
}));
|
||||
@@ -818,13 +871,13 @@ public class HudUi {
|
||||
ttt.top().right();
|
||||
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))));
|
||||
ttt.add(image).size(Scl.scl(12f * (settings.getInt("waveuiscaling") / 100f)));
|
||||
ttt.add(image).size(Scl.scl(12f * (settings.getInt("uiscaling") / 100f)));
|
||||
ttt.visible(() -> group.effect == StatusEffects.boss && group.getSpawned(j) > 0);
|
||||
ttt.pack();
|
||||
}));
|
||||
}});
|
||||
|
||||
})).width(Scl.scl((Cicon.large.size + 8f) * (settings.getInt("waveuiscaling") / 100f)));
|
||||
})).width(Scl.scl((Cicon.large.size + 8f) * (settings.getInt("uiscaling") / 100f)));
|
||||
if(row % 4 == 0) tx.row();
|
||||
}
|
||||
});
|
||||
@@ -832,92 +885,39 @@ public class HudUi {
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
public void addWave(){
|
||||
wave = new Table(tx -> {
|
||||
tx.left();
|
||||
tx.add(new Table(tt -> {
|
||||
tt.defaults().left().top().minSize(0f);
|
||||
tt.table(this::getWave).left();
|
||||
|
||||
tt.update(() -> {
|
||||
if(maxwave == settings.getInt("wavemax") || !Core.settings.getBool("waveui")) return;
|
||||
tt.clearChildren();
|
||||
getWave(tt);
|
||||
});
|
||||
}){
|
||||
@Override
|
||||
protected void drawBackground(float x, float y) {
|
||||
if(getBackground() == null) return;
|
||||
Color color = this.color;
|
||||
Draw.color(color.r, color.g, color.b, (settings.getInt("waveuiopacity") / 100f) * this.parentAlpha);
|
||||
getBackground().draw(x, y, width, height);
|
||||
}
|
||||
}).padLeft(Scl.scl(6 * 8f * (settings.getInt("waveuiscaling") / 100f)));
|
||||
tx.setColor(tx.color.cpy().a(1f));
|
||||
});
|
||||
}
|
||||
|
||||
public void addWaveTable(){
|
||||
waveTable = new Table(table -> {
|
||||
table.name = "wave";
|
||||
table.top().left();
|
||||
|
||||
ScrollPane pane = new ScrollPane(new Image(Core.atlas.find("clear")).setScaling(Scaling.fit), Styles.smallPane);
|
||||
pane.setScrollingDisabled(true, false);
|
||||
pane.setScrollYForce(scrollPos);
|
||||
pane.update(() -> {
|
||||
if(pane.hasScroll()){
|
||||
Element result = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
|
||||
if(result == null || !result.isDescendantOf(pane)){
|
||||
Core.scene.setScrollFocus(null);
|
||||
}
|
||||
if(uiIndex != 1) return;
|
||||
ScrollPane wavePane = new ScrollPane(new Image(Core.atlas.find("clear")).setScaling(Scaling.fit), Styles.smallPane);
|
||||
wavePane.setScrollingDisabled(true, false);
|
||||
wavePane.setScrollYForce(waveScrollPos);
|
||||
wavePane.update(() -> {
|
||||
if(wavePane.hasScroll()){
|
||||
Element result = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
|
||||
if(result == null || !result.isDescendantOf(wavePane)){
|
||||
Core.scene.setScrollFocus(null);
|
||||
}
|
||||
|
||||
scrollPos = pane.getScrollY();
|
||||
|
||||
if(maxwave == settings.getInt("wavemax") || !Core.settings.getBool("waveui")) return;
|
||||
pane.clearChildren();
|
||||
addWave();
|
||||
pane.setWidget(wave);
|
||||
});
|
||||
pane.setOverscroll(false, false);
|
||||
|
||||
}
|
||||
waveScrollPos = wavePane.getScrollY();
|
||||
wavePane.setWidget(new Table(tx -> tx.table(this::setWave).left()));
|
||||
});
|
||||
wavePane.setOverscroll(false, false);
|
||||
waveTable = new Table(table -> {
|
||||
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> {
|
||||
t.update(() -> {
|
||||
if(Vars.state.isMenu() || Vars.state.isEditor()) {
|
||||
waveTable = null;
|
||||
t.clearChildren();
|
||||
}
|
||||
if(maxwave == settings.getInt("wavemax") || !Core.settings.getBool("waveui")) return;
|
||||
t.clearChildren();
|
||||
if(t.getChildren().size < 1) t.add(pane).maxHeight(Scl.scl(24 * 8f * (settings.getInt("waveuiscaling") / 100f)));
|
||||
|
||||
if(t.getChildren().size > 1) {
|
||||
while(t.getChildren().size == 1) t.getChildren().pop();
|
||||
}
|
||||
});
|
||||
t.defaults().minWidth(Scl.scl(25 * 8f * (settings.getInt("uiscaling") / 100f))).scaling(Scaling.fit).left();
|
||||
t.add(wavePane).maxHeight(Scl.scl(32 * 8f * (settings.getInt("uiscaling") / 100f)));
|
||||
}){
|
||||
@Override
|
||||
protected void drawBackground(float x, float y) {
|
||||
if(getBackground() == null) return;
|
||||
Color color = this.color;
|
||||
Draw.color(color.r, color.g, color.b, (settings.getInt("waveuiopacity") / 100f) * this.parentAlpha);
|
||||
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
|
||||
getBackground().draw(x, y, width, height);
|
||||
Draw.reset();
|
||||
}
|
||||
}).padTop(Scl.scl(16 * 8f * (settings.getInt("waveuiscaling") / 100f)));
|
||||
|
||||
}).padRight(Scl.scl(39 * 8f * (settings.getInt("uiscaling") / 100f)));
|
||||
|
||||
table.fillParent = true;
|
||||
table.visibility = () -> Core.settings.getBool("waveui") && (
|
||||
ui.hudfrag.shown && !ui.minimapfrag.shown()
|
||||
&& (!Vars.mobile ||
|
||||
!(Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
||||
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
||||
table.visibility = () -> uiIndex == 1;
|
||||
});
|
||||
|
||||
waveTable.update(() -> {
|
||||
if(Vars.state.isMenu()) ui.hudGroup.removeChild(waveTable); //h
|
||||
});
|
||||
ui.hudGroup.addChild(waveTable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,11 @@ public class Main extends Mod {
|
||||
Events.on(ClientLoadEvent.class, e -> {
|
||||
hud = new HudUi();
|
||||
settingAdder.init();
|
||||
hud.addTable();
|
||||
hud.addCoreTable();
|
||||
hud.addWaveTable();
|
||||
hud.addUnitTable();
|
||||
hud.addTable();
|
||||
hud.setDraw();
|
||||
});
|
||||
|
||||
Events.on(WorldLoadEvent.class, e -> {
|
||||
|
||||
@@ -11,6 +11,7 @@ import arc.scene.ui.layout.Scl;
|
||||
import arc.scene.ui.layout.Table;
|
||||
import arc.util.Align;
|
||||
import arc.util.Log;
|
||||
import arc.util.Scaling;
|
||||
import mindustry.Vars;
|
||||
import mindustry.gen.Icon;
|
||||
import mindustry.ui.dialogs.BaseDialog;
|
||||
@@ -155,33 +156,27 @@ public class Setting {
|
||||
boolean tmp = Core.settings.getBool("uiscalechanged", false);
|
||||
Core.settings.put("uiscalechanged", false);
|
||||
|
||||
addGraphicSetting("panfix");
|
||||
addGraphicSetting("scan");
|
||||
addGraphicSetting("range");
|
||||
addGraphicSetting("select");
|
||||
addGraphicSetting("coreui");
|
||||
addGraphicSetting("waveui");
|
||||
addGraphicSetting("unitui");
|
||||
addGraphicSetting("infoui");
|
||||
addGraphicSetting("weaponui");
|
||||
addGraphicSetting("commandedunitui");
|
||||
addGraphicSetting("unithealthui");
|
||||
addGraphicTypeSetting("wavemax", 100, "@editmaxwave","@invalid", 200);
|
||||
addGraphicTypeSetting("rangemax", 10, "@editrange","@invalid", 100);
|
||||
|
||||
ui.settings.graphics.sliderPref("coreuiscaling", 100, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("waveuiscaling", 100, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("uiscaling", 100, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("selectopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("coreuiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("waveuiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("uiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("baropacity", 100, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("uiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
ui.settings.graphics.sliderPref("uiscaling", 100, 0, 100, 5, s -> s + "%");
|
||||
|
||||
Core.settings.defaults("panfix", false);
|
||||
Core.settings.defaults("scan", true);
|
||||
Core.settings.defaults("range", false);
|
||||
Core.settings.defaults("select", true);
|
||||
Core.settings.defaults("coreui", false);
|
||||
Core.settings.defaults("waveui", true);
|
||||
Core.settings.defaults("unitui", true);
|
||||
Core.settings.defaults("infoui", true);
|
||||
Core.settings.defaults("weaponui", true);
|
||||
Core.settings.defaults("commandedunitui", true);
|
||||
Core.settings.defaults("unithealthui", true);
|
||||
|
||||
Reference in New Issue
Block a user