mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
to the left
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 286 B After Width: | Height: | Size: 252 B |
@@ -17,21 +17,17 @@ import mindustry.*;
|
|||||||
import mindustry.entities.Units;
|
import mindustry.entities.Units;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
|
||||||
import mindustry.logic.Ranged;
|
import mindustry.logic.Ranged;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
import mindustry.world.blocks.defense.turrets.*;
|
import mindustry.world.blocks.defense.turrets.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
|
||||||
|
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class HudUi {
|
public class HudUi {
|
||||||
public Table mainTable = new Table();
|
|
||||||
public Table baseTable = new Table();
|
|
||||||
public Table waveInfoTable = new Table();
|
public Table waveInfoTable = new Table();
|
||||||
public SchemDisplay schemTable;
|
public SchemDisplay schemTable;
|
||||||
|
|
||||||
@@ -42,7 +38,6 @@ public class HudUi {
|
|||||||
public boolean waveShown;
|
public boolean waveShown;
|
||||||
|
|
||||||
public float a;
|
public float a;
|
||||||
public int uiIndex = 3;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Teamc> T getTarget(){
|
public <T extends Teamc> T getTarget(){
|
||||||
@@ -89,8 +84,6 @@ public class HudUi {
|
|||||||
Log.warn("ui scaling reached zero");
|
Log.warn("ui scaling reached zero");
|
||||||
modUiScale = 0.25f;
|
modUiScale = 0.25f;
|
||||||
}
|
}
|
||||||
mainTable.clearChildren();
|
|
||||||
addTable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(settings.getBool("autoShooting")) {
|
if(settings.getBool("autoShooting")) {
|
||||||
@@ -208,9 +201,8 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addSchemTable() {
|
public void addSchemTable() {
|
||||||
Table table = (Table) scene.find("minimap/position");
|
Table table = ((Table) scene.find("minimap/position")).row();
|
||||||
table.row();
|
schemTable = new SchemDisplay();
|
||||||
schemTable=new SchemDisplay();
|
|
||||||
table.add(schemTable);
|
table.add(schemTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,51 +258,4 @@ public class HudUi {
|
|||||||
return waveShown;
|
return waveShown;
|
||||||
})).left().top()).fillX();
|
})).left().top()).fillX();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(int index, Seq<Button> buttons, Label label, Table table, Table labelTable, String hud){
|
|
||||||
uiIndex = index;
|
|
||||||
buttons.each(b -> b.setChecked(buttons.indexOf(b) == index));
|
|
||||||
label.setText(bundle.get(hud));
|
|
||||||
table.removeChild(baseTable);
|
|
||||||
labelTable.setPosition(buttons.items[uiIndex].x, buttons.items[uiIndex].y);
|
|
||||||
baseTable = table.table(tt -> tt.stack(labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).left().get();
|
|
||||||
a = 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addTable(){
|
|
||||||
mainTable = new Table(table -> {
|
|
||||||
table.left();
|
|
||||||
|
|
||||||
Label label = new Label("");
|
|
||||||
label.setColor(Pal.stat);
|
|
||||||
label.update(() -> {
|
|
||||||
a = Mathf.lerpDelta(a, 0f, 0.025f);
|
|
||||||
label.color.a = a;
|
|
||||||
});
|
|
||||||
label.setStyle(new Label.LabelStyle(){{
|
|
||||||
font = Fonts.outline;
|
|
||||||
fontColor = Color.white;
|
|
||||||
background = Styles.black8;
|
|
||||||
}});
|
|
||||||
label.setFontScale(Scl.scl(modUiScale));
|
|
||||||
Table labelTable = new Table(t -> t.add(label).left().padRight(Scl.scl(modUiScale) * 40 * 8f));
|
|
||||||
|
|
||||||
table.table(t -> {
|
|
||||||
Seq<Button> buttons = Seq.with(null, null, null, null);
|
|
||||||
Seq<String> strs = Seq.with("hud.unit", "hud.wave", "hud.item", "hud.cancel");
|
|
||||||
Seq<TextureRegionDrawable> icons = Seq.with(Icon.units, Icon.fileText, Icon.copy, Icon.cancel);
|
|
||||||
for(int i = 0; i < buttons.size; i++){
|
|
||||||
int finalI = i;
|
|
||||||
buttons.set(i, t.button(new ScaledNinePatchDrawable(new NinePatch(icons.get(i).getRegion()), modUiScale), Styles.clearToggleTransi, () ->
|
|
||||||
reset(finalI, buttons, label, table, labelTable, strs.get(finalI))).size(Scl.scl(modUiScale) * 5 * 8f).get());
|
|
||||||
t.row();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
baseTable = table.table(tt -> tt.stack(labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).left().get();
|
|
||||||
|
|
||||||
table.fillParent = true;
|
|
||||||
table.visibility = () -> ui.hudfrag.shown && !ui.minimapfrag.shown();
|
|
||||||
});
|
|
||||||
ui.hudGroup.addChild(mainTable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public class Main extends Mod {
|
|||||||
WindowTables.init();
|
WindowTables.init();
|
||||||
new HUDFragment().build(Vars.ui.hudGroup);
|
new HUDFragment().build(Vars.ui.hudGroup);
|
||||||
hud = new HudUi();
|
hud = new HudUi();
|
||||||
hud.addTable();
|
|
||||||
hud.addWaveInfoTable();
|
hud.addWaveInfoTable();
|
||||||
hud.addSchemTable();
|
hud.addSchemTable();
|
||||||
hud.setEvents();
|
hud.setEvents();
|
||||||
|
|||||||
@@ -12,12 +12,7 @@ public class HUDFragment extends Fragment{
|
|||||||
t.name = "Windows";
|
t.name = "Windows";
|
||||||
t.visible(() -> parent.visible);
|
t.visible(() -> parent.visible);
|
||||||
|
|
||||||
// windows (totally not a copyright violation)
|
t.center().left();
|
||||||
t.center().right();
|
|
||||||
t.add(unitTable).size(250f).visible(false);
|
|
||||||
t.add(waveTable).size(250f).visible(false);
|
|
||||||
t.add(coreTable).size(250f).visible(false);
|
|
||||||
|
|
||||||
// sidebar
|
// sidebar
|
||||||
t.add(new TaskbarTable(
|
t.add(new TaskbarTable(
|
||||||
unitTable,
|
unitTable,
|
||||||
@@ -25,6 +20,11 @@ public class HUDFragment extends Fragment{
|
|||||||
coreTable
|
coreTable
|
||||||
)).visible(TaskbarTable.visibility);
|
)).visible(TaskbarTable.visibility);
|
||||||
|
|
||||||
|
// windows (totally not a copyright violation)
|
||||||
|
t.add(unitTable).size(250f).visible(false);
|
||||||
|
t.add(waveTable).size(250f).visible(false);
|
||||||
|
t.add(coreTable).size(250f).visible(false);
|
||||||
|
|
||||||
t.update(()->{
|
t.update(()->{
|
||||||
for (Element child : t.getChildren()) {
|
for (Element child : t.getChildren()) {
|
||||||
if(child instanceof Updatable u) u.update();
|
if(child instanceof Updatable u) u.update();
|
||||||
|
|||||||
@@ -11,16 +11,14 @@ public class TaskbarTable extends Table{
|
|||||||
|
|
||||||
public TaskbarTable(WindowTable... items){
|
public TaskbarTable(WindowTable... items){
|
||||||
visible = true;
|
visible = true;
|
||||||
table(MindowsTex.sidebar,t -> {
|
table(MindowsTex.sidebar, t -> {
|
||||||
t.top().center();
|
t.top().center();
|
||||||
for(WindowTable w : items){
|
for(WindowTable w : items){
|
||||||
t.button(w.icon, Styles.emptyi, () -> {
|
t.button(w.icon, Styles.emptyi, () -> {
|
||||||
w.visible(visibility);
|
w.visible(visibility);
|
||||||
}).disabled(b -> w.visible)
|
}).disabled(b -> w.visible).size(40f).padRight(5f);
|
||||||
.size(40f)
|
|
||||||
.padLeft(5f);
|
|
||||||
t.row();
|
t.row();
|
||||||
}
|
}
|
||||||
}).right().center().width(40f);
|
}).left().center().width(40f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user