mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
fix various things
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package UnitInfo.core;
|
||||
|
||||
import arc.Core;
|
||||
import arc.files.Fi;
|
||||
import arc.struct.Seq;
|
||||
import arc.util.Log;
|
||||
import mindustry.*;
|
||||
@@ -10,7 +11,8 @@ import org.hjson.*;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static UnitInfo.SVars.modRoot;
|
||||
import static mindustry.Vars.modDirectory;
|
||||
|
||||
public class ContentJSON {
|
||||
public static void save() {
|
||||
for(Seq<Content> content : Vars.content.getContentMap()) {
|
||||
@@ -39,7 +41,7 @@ public class ContentJSON {
|
||||
data.add(name, obj);
|
||||
});
|
||||
try {
|
||||
modRoot.child(content.peek().getContentType().toString() + ".json").writeString(data.toString(Stringify.FORMATTED));
|
||||
modDirectory.child("UnitInfo").child(content.peek().getContentType().toString() + ".json").writeString(data.toString(Stringify.FORMATTED));
|
||||
} catch (Throwable t){
|
||||
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ public class HudUi {
|
||||
|
||||
Table waveTable = (Table) scene.find("waves");
|
||||
Table table = (Table)waveTable.getChildren().first(); //HudFragment#198, name: x
|
||||
Table statusTable = (Table)waveTable.getChildren().get(1); // TODO: Use scene.find("statustable") when https://github.com/Anuken/Mindustry/pull/5904 is merged
|
||||
Table statusTable = Version.number >= 131 ? (Table)scene.find("statustable") : (Table)waveTable.getChildren().get(1);
|
||||
waveTable.removeChild(statusTable);
|
||||
table.row();
|
||||
table.stack(waveInfoTable, statusTable.top(), pathlineTable).fillX().colspan(table.getColumns());
|
||||
@@ -703,6 +703,7 @@ public class HudUi {
|
||||
|
||||
int row = 0;
|
||||
for(SpawnGroup group : groupsTmp.keys()){
|
||||
int spawners = state.rules.waveTeam.cores().size + (group.type.flying ? spawner.countFlyerSpawns() : spawner.countGroundSpawns());
|
||||
int amount = groupsTmp.get(group);
|
||||
tx.table(tt -> {
|
||||
Image image = new Image(group.type.uiIcon).setScaling(Scaling.fit);
|
||||
@@ -716,8 +717,11 @@ public class HudUi {
|
||||
new Table(ttt -> {
|
||||
ttt.bottom().left();
|
||||
Label label = new Label(() -> amount + "");
|
||||
label.setFontScale(Scl.scl(modUiScale) * 0.85f);
|
||||
label.setFontScale(Scl.scl(modUiScale) * 0.9f);
|
||||
Label multi = new Label(() -> "[gray]x" + spawners);
|
||||
multi.setFontScale(Scl.scl(modUiScale) * 0.8f);
|
||||
ttt.add(label);
|
||||
ttt.add(multi).padTop(8f);
|
||||
ttt.pack();
|
||||
}),
|
||||
|
||||
@@ -752,7 +756,7 @@ public class HudUi {
|
||||
tt.addListener(new Tooltip(t -> t.background(Tex.button).table(to -> {
|
||||
to.left();
|
||||
to.table(Tex.underline2, tot -> tot.add("[stat]" + group.type.localizedName + "[]")).row();
|
||||
to.add(bundle.format("shar-stat-waveAmount", amount)).row();
|
||||
to.add(bundle.format("shar-stat-waveAmount", amount + " [lightgray]x" + spawners + "[]")).row();
|
||||
to.add(bundle.format("shar-stat-waveShield", group.getShield(j))).row();
|
||||
if(group.effect != null) {
|
||||
if(group.effect == StatusEffects.none) return;
|
||||
@@ -810,7 +814,7 @@ public class HudUi {
|
||||
public void addWaveTable(){
|
||||
if(uiIndex != 1) return;
|
||||
waveTable = new Table(table -> {
|
||||
table.defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight());
|
||||
table.defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight() * Scl.scl(modUiScale));
|
||||
table.add(new Table(Tex.button, t -> {
|
||||
ScrollPane pane = t.pane(new ScrollPane.ScrollPaneStyle(){{
|
||||
vScroll = Tex.clear;
|
||||
@@ -862,7 +866,7 @@ public class HudUi {
|
||||
public void addItemTable(){
|
||||
if(uiIndex != 2) return;
|
||||
itemTable = new Table(table -> {
|
||||
table.left().defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight());
|
||||
table.left().defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(unitTable.getHeight() * Scl.scl(modUiScale));
|
||||
table.table(Tex.button, t -> {
|
||||
ScrollPane pane = t.pane(new ScrollPane.ScrollPaneStyle(){{
|
||||
vScroll = Tex.clear;
|
||||
|
||||
@@ -21,14 +21,14 @@ public class Main extends Mod {
|
||||
|
||||
Events.on(ClientLoadEvent.class, e -> {
|
||||
hud = new HudUi();
|
||||
settingAdder.init();
|
||||
new SettingS().init();
|
||||
hud.addWaveTable();
|
||||
hud.addUnitTable();
|
||||
hud.addTable();
|
||||
hud.addWaveInfoTable();
|
||||
hud.setEvents();
|
||||
OverDrawer.setEvent();
|
||||
if(debug) ContentJSON.save();
|
||||
if(jsonGen) ContentJSON.save();
|
||||
});
|
||||
|
||||
Events.on(WorldLoadEvent.class, e -> {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SettingS {
|
||||
public void add(Table table) {
|
||||
final String[] str = {""};
|
||||
Table table1 = new Table(t -> {
|
||||
final float[] value = new float[1];
|
||||
final float[] value = {def};
|
||||
t.add(new Label(title + ": ")).left().padRight(5)
|
||||
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SettingS {
|
||||
BaseDialog dialog = new BaseDialog("UnitInfo Setting");
|
||||
dialog.addCloseButton();
|
||||
sharset = new SettingsMenuDialog.SettingsTable();
|
||||
dialog.cont.center().add(sharset);
|
||||
dialog.cont.center().add(new Table(t -> t.pane(sharset).grow().row()));
|
||||
ui.settings.shown(() -> {
|
||||
Table settingUi = (Table)((Group)((Group)(ui.settings.getChildren().get(1))).getChildren().get(0)).getChildren().get(0); //This looks so stupid lol - lmfao
|
||||
settingUi.row();
|
||||
@@ -108,7 +108,7 @@ public class SettingS {
|
||||
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? "default bar" : s + "th bar", tapSeq);
|
||||
addGraphicSlideSetting("infoUiScale", 75, 50, 100, 5, s -> s + "%", tapSeq);
|
||||
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec", tapSeq);
|
||||
addGraphicTypeSetting("wavemax", 0, 100,200, true, () -> true, s -> s + "waves", tapSeq);
|
||||
addGraphicTypeSetting("wavemax", 0, 200,100, true, () -> true, s -> s + "waves", tapSeq);
|
||||
addGraphicCheckSetting("infoui", true, tapSeq);
|
||||
addGraphicCheckSetting("pastwave", false, tapSeq);
|
||||
addGraphicCheckSetting("emptywave", true, tapSeq);
|
||||
@@ -145,7 +145,7 @@ public class SettingS {
|
||||
settingSeq.add(drawSeq, etcSeq);
|
||||
|
||||
sharset.table(t -> {
|
||||
Seq<Button> buttons = new Seq<>();
|
||||
Seq<TextButton> buttons = new Seq<>();
|
||||
buttons.add(new TextButton(bundle.get("setting.shar-wave"), Styles.clearToggleMenut));
|
||||
buttons.add(new TextButton(bundle.get("setting.shar-range"), Styles.clearToggleMenut));
|
||||
buttons.add(new TextButton(bundle.get("setting.shar-opacity"), Styles.clearToggleMenut));
|
||||
@@ -155,7 +155,8 @@ public class SettingS {
|
||||
t.table(Styles.black8, bt -> {
|
||||
bt.top().align(Align.top);
|
||||
buttons.each(b -> {
|
||||
bt.add(b).minHeight(60f).minWidth(150f).top();
|
||||
b.getLabel().setFontScale(0.85f);
|
||||
bt.add(b).minHeight(60f * 0.85f).minWidth(150f * 0.85f).top();
|
||||
});
|
||||
}).grow().row();
|
||||
|
||||
@@ -174,6 +175,7 @@ public class SettingS {
|
||||
}));
|
||||
}
|
||||
t.add(stack);
|
||||
t.fillParent = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user