mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
improved again
This commit is contained in:
@@ -3,6 +3,8 @@ package UnitInfo.core;
|
|||||||
import UnitInfo.SUtils;
|
import UnitInfo.SUtils;
|
||||||
import UnitInfo.ui.*;
|
import UnitInfo.ui.*;
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.func.Cons;
|
||||||
|
import arc.func.Floatf;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.input.*;
|
import arc.input.*;
|
||||||
@@ -19,6 +21,8 @@ import arc.util.*;
|
|||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.core.*;
|
import mindustry.core.*;
|
||||||
|
import mindustry.ctype.ContentType;
|
||||||
|
import mindustry.ctype.UnlockableContent;
|
||||||
import mindustry.entities.Units;
|
import mindustry.entities.Units;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
@@ -27,6 +31,7 @@ import mindustry.graphics.*;
|
|||||||
import mindustry.logic.Ranged;
|
import mindustry.logic.Ranged;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
import mindustry.ui.dialogs.BaseDialog;
|
||||||
import mindustry.ui.dialogs.SchematicsDialog;
|
import mindustry.ui.dialogs.SchematicsDialog;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
@@ -62,7 +67,7 @@ public class HudUi {
|
|||||||
|
|
||||||
boolean waveShown, schemShown;
|
boolean waveShown, schemShown;
|
||||||
private Schematic firstSchematic;
|
private Schematic firstSchematic;
|
||||||
private Seq<String> selectedTags = new Seq<>();
|
private final Seq<String> selectedTags = new Seq<>();
|
||||||
private Runnable rebuildList = () -> {};
|
private Runnable rebuildList = () -> {};
|
||||||
|
|
||||||
float a;
|
float a;
|
||||||
@@ -191,37 +196,33 @@ public class HudUi {
|
|||||||
int[] i = {0};
|
int[] i = {0};
|
||||||
enemyamount = Groups.unit.count(u -> u.team == state.rules.waveTeam);
|
enemyamount = Groups.unit.count(u -> u.team == state.rules.waveTeam);
|
||||||
content.units().each(type -> Groups.unit.contains(u -> u.type == type && u.team == state.rules.waveTeam && u.isBoss()), type -> {
|
content.units().each(type -> Groups.unit.contains(u -> u.type == type && u.team == state.rules.waveTeam && u.isBoss()), type -> {
|
||||||
t.table(tt -> {
|
t.table(tt ->
|
||||||
tt.add(new Stack() {{
|
tt.stack(
|
||||||
add(new Table(ttt -> {
|
new Table(ttt -> ttt.image(type.uiIcon).size(iconSmall)),
|
||||||
ttt.image(type.uiIcon).size(iconSmall);
|
new Table(ttt -> {
|
||||||
}));
|
|
||||||
add(new Table(ttt -> {
|
|
||||||
ttt.right().bottom();
|
ttt.right().bottom();
|
||||||
Label label = new Label(() -> Groups.unit.count(u -> u.type == type && u.team == state.rules.waveTeam && u.isBoss()) + "");
|
Label label = new Label(() -> Groups.unit.count(u -> u.type == type && u.team == state.rules.waveTeam && u.isBoss()) + "");
|
||||||
label.setFontScale(0.75f);
|
label.setFontScale(0.75f);
|
||||||
ttt.add(label);
|
ttt.add(label);
|
||||||
ttt.pack();
|
ttt.pack();
|
||||||
}));
|
}),
|
||||||
add(new Table(ttt -> {
|
new Table(ttt -> {
|
||||||
ttt.top().right();
|
ttt.top().right();
|
||||||
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
|
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))));
|
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
|
||||||
ttt.add(image).size(Scl.scl(modUiScale) * 12f);
|
ttt.add(image).size(Scl.scl(modUiScale) * 12f);
|
||||||
ttt.pack();
|
ttt.pack();
|
||||||
}));
|
})
|
||||||
}}).pad(6);
|
).pad(6)
|
||||||
});
|
);
|
||||||
if(++i[0] % 6 == 0) t.row();
|
if(++i[0] % 6 == 0) t.row();
|
||||||
});
|
});
|
||||||
t.row();
|
t.row();
|
||||||
i[0] = 0;
|
i[0] = 0;
|
||||||
content.units().each(type -> Groups.unit.contains(u -> u.type == type && u.team == state.rules.waveTeam && !u.isBoss()), type -> {
|
content.units().each(type -> Groups.unit.contains(u -> u.type == type && u.team == state.rules.waveTeam && !u.isBoss()), type -> {
|
||||||
t.table(tt -> {
|
t.table(tt ->
|
||||||
tt.add(new Stack() {{
|
tt.add(new Stack() {{
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> ttt.add(new Image(type.uiIcon)).size(iconSmall)));
|
||||||
ttt.add(new Image(type.uiIcon)).size(iconSmall);
|
|
||||||
}));
|
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.right().bottom();
|
ttt.right().bottom();
|
||||||
Label label = new Label(() -> Groups.unit.count(u -> u.type == type && u.team == state.rules.waveTeam && !u.isBoss()) + "");
|
Label label = new Label(() -> Groups.unit.count(u -> u.type == type && u.team == state.rules.waveTeam && !u.isBoss()) + "");
|
||||||
@@ -229,15 +230,15 @@ public class HudUi {
|
|||||||
ttt.add(label);
|
ttt.add(label);
|
||||||
ttt.pack();
|
ttt.pack();
|
||||||
}));
|
}));
|
||||||
}}).pad(6);
|
}}).pad(6)
|
||||||
});
|
);
|
||||||
if(++i[0] % 6 == 0) t.row();
|
if(++i[0] % 6 == 0) t.row();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTile(Table table){
|
public void setTile(Table table){
|
||||||
table.table(t -> {
|
table.table(t ->
|
||||||
t.table(Tex.underline2, head -> {
|
t.table(Tex.underline2, head -> {
|
||||||
head.table(image -> {
|
head.table(image -> {
|
||||||
image.left();
|
image.left();
|
||||||
@@ -247,17 +248,304 @@ public class HudUi {
|
|||||||
});
|
});
|
||||||
Label label = new Label(() -> getTile() == null ? "(null, null)" : "(" + getTile().x + ", " + getTile().y + ")");
|
Label label = new Label(() -> getTile() == null ? "(null, null)" : "(" + getTile().x + ", " + getTile().y + ")");
|
||||||
head.add(label).center();
|
head.add(label).center();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showInfo(Schematic schematic){
|
||||||
|
try {
|
||||||
|
((SchematicsDialog.SchematicInfoDialog)SUtils.invoke(ui.schematics, "info")).show(schematic);
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkTags(Schematic s){
|
||||||
|
boolean any = false;
|
||||||
|
Seq<String> seq = null;
|
||||||
|
try {
|
||||||
|
seq = (Seq<String>) SUtils.invoke(ui.schematics, "tags");
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(seq == null) return;
|
||||||
|
for(var tag : s.labels){
|
||||||
|
if(!seq.contains(tag)){
|
||||||
|
seq.add(tag);
|
||||||
|
any = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(any) setSchemTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void showImport(){
|
||||||
|
BaseDialog dialog = new BaseDialog("@editor.export");
|
||||||
|
dialog.cont.pane(p -> {
|
||||||
|
p.margin(10f);
|
||||||
|
p.table(Tex.button, t -> {
|
||||||
|
TextButton.TextButtonStyle style = Styles.cleart;
|
||||||
|
t.defaults().size(280f, 60f).left();
|
||||||
|
t.row();
|
||||||
|
t.button("@schematic.copy.import", Icon.copy, style, () -> {
|
||||||
|
dialog.hide();
|
||||||
|
try{
|
||||||
|
Schematic s = Schematics.readBase64(Core.app.getClipboardText());
|
||||||
|
s.removeSteamID();
|
||||||
|
schematics.add(s);
|
||||||
|
setSchemTable();
|
||||||
|
ui.showInfoFade("@schematic.saved");
|
||||||
|
checkTags(s);
|
||||||
|
showInfo(s);
|
||||||
|
}catch(Throwable e){
|
||||||
|
ui.showException(e);
|
||||||
|
}
|
||||||
|
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null || !Core.app.getClipboardText().startsWith(schematicBaseStart));
|
||||||
|
t.row();
|
||||||
|
t.button("@schematic.importfile", Icon.download, style, () -> platform.showFileChooser(true, schematicExtension, file -> {
|
||||||
|
dialog.hide();
|
||||||
|
|
||||||
|
try{
|
||||||
|
Schematic s = Schematics.read(file);
|
||||||
|
s.removeSteamID();
|
||||||
|
schematics.add(s);
|
||||||
|
setSchemTable();
|
||||||
|
showInfo(s);
|
||||||
|
checkTags(s);
|
||||||
|
}catch(Exception e){
|
||||||
|
ui.showException(e);
|
||||||
|
}
|
||||||
|
})).marginLeft(12f);
|
||||||
|
t.row();
|
||||||
|
if(steam){
|
||||||
|
t.button("@schematic.browseworkshop", Icon.book, style, () -> {
|
||||||
|
dialog.hide();
|
||||||
|
platform.openWorkshop();
|
||||||
|
}).marginLeft(12f);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.addCloseButton();
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void showExport(Schematic s){
|
||||||
|
BaseDialog dialog = new BaseDialog("@editor.export");
|
||||||
|
dialog.cont.pane(p -> {
|
||||||
|
p.margin(10f);
|
||||||
|
p.table(Tex.button, t -> {
|
||||||
|
TextButton.TextButtonStyle style = Styles.cleart;
|
||||||
|
t.defaults().size(280f, 60f).left();
|
||||||
|
if(steam && !s.hasSteamID()){
|
||||||
|
t.button("@schematic.shareworkshop", Icon.book, style,
|
||||||
|
() -> platform.publish(s)).marginLeft(12f);
|
||||||
|
t.row();
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
t.button("@schematic.copy", Icon.copy, style, () -> {
|
||||||
|
dialog.hide();
|
||||||
|
ui.showInfoFade("@copied");
|
||||||
|
Core.app.setClipboardText(schematics.writeBase64(s));
|
||||||
|
}).marginLeft(12f);
|
||||||
|
t.row();
|
||||||
|
t.button("@schematic.exportfile", Icon.export, style, () -> {
|
||||||
|
dialog.hide();
|
||||||
|
platform.export(s.name(), schematicExtension, file -> Schematics.write(s, file));
|
||||||
|
}).marginLeft(12f);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.addCloseButton();
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tagsChanged(){
|
||||||
|
rebuildList.run();
|
||||||
|
Seq<String> tags = null;
|
||||||
|
try {
|
||||||
|
tags = (Seq<String>) SUtils.invoke(ui.schematics, "tags");
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(tags == null) return;
|
||||||
|
Core.settings.putJson("schematic-tags", String.class, tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addTag(Schematic s, String tag){
|
||||||
|
s.labels.add(tag);
|
||||||
|
s.save();
|
||||||
|
tagsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeTag(Schematic s, String tag){
|
||||||
|
s.labels.remove(tag);
|
||||||
|
s.save();
|
||||||
|
tagsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
//shows a dialog for creating a new tag
|
||||||
|
void showNewTag(Cons<String> result){
|
||||||
|
Seq<String> tags = null;
|
||||||
|
try {
|
||||||
|
tags = (Seq<String>) SUtils.invoke(ui.schematics, "tags");
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(tags == null) return;
|
||||||
|
Seq<String> finalTags = tags;
|
||||||
|
ui.showTextInput("@schematic.addtag", "", "", out -> {
|
||||||
|
if(finalTags.contains(out)){
|
||||||
|
ui.showInfo("@schematic.tagexists");
|
||||||
|
}else{
|
||||||
|
finalTags.add(out);
|
||||||
|
tagsChanged();
|
||||||
|
result.get(out);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSchemTable() {
|
void showNewIconTag(Cons<String> cons){
|
||||||
schemListTable = new Table(table -> {
|
Seq<String> tags = null;
|
||||||
|
try {
|
||||||
|
tags = (Seq<String>) SUtils.invoke(ui.schematics, "tags");
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(tags == null) return;
|
||||||
|
Seq<String> finalTags = tags;
|
||||||
|
new Dialog(){{
|
||||||
|
closeOnBack();
|
||||||
|
setFillParent(true);
|
||||||
|
|
||||||
|
cont.pane(t ->
|
||||||
|
resized(true, () -> {
|
||||||
|
t.clearChildren();
|
||||||
|
t.marginRight(19f);
|
||||||
|
t.defaults().size(48f);
|
||||||
|
|
||||||
|
int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f));
|
||||||
|
|
||||||
|
for(ContentType ctype : defaultContentIcons){
|
||||||
|
t.row();
|
||||||
|
t.image().colspan(cols).growX().width(Float.NEGATIVE_INFINITY).height(3f).color(Pal.accent);
|
||||||
|
t.row();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for(UnlockableContent u : content.getBy(ctype).<UnlockableContent>as()){
|
||||||
|
if(!u.isHidden() && u.unlockedNow() && u.hasEmoji() && !finalTags.contains(u.emoji())){
|
||||||
|
t.button(new TextureRegionDrawable(u.uiIcon), Styles.cleari, iconMed, () -> {
|
||||||
|
String out = u.emoji() + "";
|
||||||
|
|
||||||
|
finalTags.add(out);
|
||||||
|
tagsChanged();
|
||||||
|
cons.get(out);
|
||||||
|
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
if(++i % cols == 0) t.row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
buttons.button("@back", Icon.left, this::hide).size(210f, 64f);
|
||||||
|
}}.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void buildTags(Schematic schem, Table t, boolean name){
|
||||||
|
t.clearChildren();
|
||||||
|
t.left();
|
||||||
|
Seq<String> tags = null;
|
||||||
|
try {
|
||||||
|
tags = (Seq<String>) SUtils.invoke(ui.schematics, "tags");
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(tags == null) return;
|
||||||
|
|
||||||
|
//sort by order in the main target array. the complexity of this is probably awful
|
||||||
|
Seq<String> finalTags = tags;
|
||||||
|
schem.labels.sort((Floatf<String>) finalTags::indexOf);
|
||||||
|
|
||||||
|
if(name) t.add("@schematic.tags").padRight(4);
|
||||||
|
t.pane(s -> {
|
||||||
|
s.left();
|
||||||
|
s.defaults().pad(3).height(42f);
|
||||||
|
for(var tag : schem.labels){
|
||||||
|
s.table(Tex.button, i -> {
|
||||||
|
i.add(tag).padRight(4).height(42f).labelAlign(Align.center);
|
||||||
|
i.button(Icon.cancelSmall, Styles.emptyi, () -> {
|
||||||
|
removeTag(schem, tag);
|
||||||
|
buildTags(schem, t, name);
|
||||||
|
}).size(42f).padRight(-9f).padLeft(-9f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}).fillX().left().height(42f).scrollY(false);
|
||||||
|
|
||||||
|
Seq<String> finalTags1 = tags;
|
||||||
|
t.button(Icon.addSmall, () -> {
|
||||||
|
var dialog = new BaseDialog("@schematic.addtag");
|
||||||
|
dialog.addCloseButton();
|
||||||
|
dialog.cont.pane(p -> {
|
||||||
|
p.clearChildren();
|
||||||
|
|
||||||
|
float sum = 0f;
|
||||||
|
Table current = new Table().left();
|
||||||
|
for(var tag : finalTags1){
|
||||||
|
if(schem.labels.contains(tag)) continue;
|
||||||
|
|
||||||
|
var next = Elem.newButton(tag, () -> {
|
||||||
|
addTag(schem, tag);
|
||||||
|
buildTags(schem, t, name);
|
||||||
|
dialog.hide();
|
||||||
|
});
|
||||||
|
next.getLabel().setWrap(false);
|
||||||
|
|
||||||
|
next.pack();
|
||||||
|
float w = next.getPrefWidth() + Scl.scl(6f);
|
||||||
|
|
||||||
|
if(w + sum >= Core.graphics.getWidth() * (Core.graphics.isPortrait() ? 1f : 0.8f)){
|
||||||
|
p.add(current).row();
|
||||||
|
current = new Table();
|
||||||
|
current.left();
|
||||||
|
current.add(next).height(42f).pad(2);
|
||||||
|
sum = 0;
|
||||||
|
}else{
|
||||||
|
current.add(next).height(42f).pad(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
sum += w;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sum > 0){
|
||||||
|
p.add(current).row();
|
||||||
|
}
|
||||||
|
|
||||||
|
Cons<String> handleTag = res -> {
|
||||||
|
dialog.hide();
|
||||||
|
addTag(schem, res);
|
||||||
|
buildTags(schem, t, name);
|
||||||
|
};
|
||||||
|
|
||||||
|
p.row();
|
||||||
|
|
||||||
|
p.table(v -> {
|
||||||
|
v.left().defaults().fillX().height(42f).pad(2);
|
||||||
|
v.button("@schematic.texttag", Icon.add, () -> showNewTag(handleTag)).wrapLabel(false).get().getLabelCell().padLeft(4);
|
||||||
|
v.button("@schematic.icontag", Icon.add, () -> showNewIconTag(handleTag)).wrapLabel(false).get().getLabelCell().padLeft(4);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
}).size(42f).tooltip("@schematic.addtag");
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSchemTable() {
|
||||||
|
schemListTable.clear();
|
||||||
|
Table table = schemListTable;
|
||||||
table.right();
|
table.right();
|
||||||
table.button("Schemtic List", Icon.downOpen, Styles.squareTogglet, () -> {
|
table.button("Schematic List", Icon.downOpen, Styles.squareTogglet, () -> schemShown = !schemShown).width(160f).height(60f).checked(b -> {
|
||||||
schemShown = !schemShown;
|
|
||||||
setSchemTable();
|
|
||||||
}).width(160f).height(60f).checked(b -> {
|
|
||||||
Image image = (Image)b.getCells().first().get();
|
Image image = (Image)b.getCells().first().get();
|
||||||
image.setDrawable(schemShown ? Icon.upOpen : Icon.downOpen);
|
image.setDrawable(schemShown ? Icon.upOpen : Icon.downOpen);
|
||||||
return schemShown;
|
return schemShown;
|
||||||
@@ -287,21 +575,20 @@ public class HudUi {
|
|||||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||||
if(pane1.hasScroll() && (result == null || !result.isDescendantOf(pane1)))
|
if(pane1.hasScroll() && (result == null || !result.isDescendantOf(pane1)))
|
||||||
scene.setScrollFocus(null);
|
scene.setScrollFocus(null);
|
||||||
tagScrollPos = pane1.getScrollY();
|
tagScrollPos = pane1.getScrollX();
|
||||||
});
|
});
|
||||||
|
|
||||||
pane1.setOverscroll(false, false);
|
pane1.setOverscroll(false, false);
|
||||||
pane1.setScrollingDisabled(false, true);
|
pane1.setScrollingDisabled(false, true);
|
||||||
pane1.setScrollYForce(tagScrollPos);
|
pane1.setScrollXForce(tagScrollPos);
|
||||||
|
|
||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
ScrollPane pane = t.pane(Styles.nonePane, p -> {
|
ScrollPane pane = t.pane(Styles.nonePane, p -> {
|
||||||
p.table().update(tt -> {
|
p.table(tt -> {
|
||||||
tt.clear();
|
|
||||||
|
|
||||||
firstSchematic = null;
|
firstSchematic = null;
|
||||||
|
|
||||||
|
tt.button("Import", Icon.download, this::showImport).width(160f).height(64f).row();
|
||||||
for(Schematic s : schematics.all()){
|
for(Schematic s : schematics.all()){
|
||||||
if(selectedTags.any() && !s.labels.containsAll(selectedTags)) continue;
|
if(selectedTags.any() && !s.labels.containsAll(selectedTags)) continue;
|
||||||
if(firstSchematic == null) firstSchematic = s;
|
if(firstSchematic == null) firstSchematic = s;
|
||||||
@@ -310,6 +597,77 @@ public class HudUi {
|
|||||||
sel[0] = tt.button(b -> {
|
sel[0] = tt.button(b -> {
|
||||||
b.top();
|
b.top();
|
||||||
b.margin(0f);
|
b.margin(0f);
|
||||||
|
b.table(buttons -> {
|
||||||
|
buttons.left();
|
||||||
|
buttons.defaults().size(162/4f);
|
||||||
|
|
||||||
|
ImageButton.ImageButtonStyle style = Styles.clearPartiali;
|
||||||
|
|
||||||
|
buttons.button(Icon.info, style, () -> {
|
||||||
|
showInfo(s);
|
||||||
|
});
|
||||||
|
|
||||||
|
buttons.button(Icon.upload, style, () -> {
|
||||||
|
showExport(s);
|
||||||
|
});
|
||||||
|
|
||||||
|
buttons.button(Icon.pencil, style, () -> {
|
||||||
|
new Dialog("@schematic.rename"){{
|
||||||
|
setFillParent(true);
|
||||||
|
|
||||||
|
cont.margin(30);
|
||||||
|
|
||||||
|
cont.add("@schematic.tags").padRight(6f);
|
||||||
|
cont.table(tags -> buildTags(s, tags, false)).maxWidth(400f).fillX().left().row();
|
||||||
|
|
||||||
|
cont.margin(30).add("@name").padRight(6f);
|
||||||
|
TextField nameField = cont.field(s.name(), null).size(400f, 55f).left().get();
|
||||||
|
|
||||||
|
cont.row();
|
||||||
|
|
||||||
|
cont.margin(30).add("@editor.description").padRight(6f);
|
||||||
|
TextField descField = cont.area(s.description(), Styles.areaField, t -> {}).size(400f, 140f).left().get();
|
||||||
|
|
||||||
|
Runnable accept = () -> {
|
||||||
|
s.tags.put("name", nameField.getText());
|
||||||
|
s.tags.put("description", descField.getText());
|
||||||
|
s.save();
|
||||||
|
hide();
|
||||||
|
setSchemTable();
|
||||||
|
};
|
||||||
|
|
||||||
|
buttons.defaults().size(120, 54).pad(4);
|
||||||
|
buttons.button("@ok", accept).disabled(b -> nameField.getText().isEmpty());
|
||||||
|
buttons.button("@cancel", this::hide);
|
||||||
|
|
||||||
|
keyDown(KeyCode.enter, () -> {
|
||||||
|
if(!nameField.getText().isEmpty() && Core.scene.getKeyboardFocus() != descField){
|
||||||
|
accept.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
keyDown(KeyCode.escape, this::hide);
|
||||||
|
keyDown(KeyCode.back, this::hide);
|
||||||
|
show();
|
||||||
|
}};
|
||||||
|
});
|
||||||
|
|
||||||
|
if(s.hasSteamID()){
|
||||||
|
buttons.button(Icon.link, style, () -> platform.viewListing(s));
|
||||||
|
}else{
|
||||||
|
buttons.button(Icon.trash, style, () -> {
|
||||||
|
if(s.mod != null){
|
||||||
|
ui.showInfo(Core.bundle.format("mod.item.remove", s.mod.meta.displayName()));
|
||||||
|
}else{
|
||||||
|
ui.showConfirm("@confirm", "@schematic.delete.confirm", () -> {
|
||||||
|
schematics.remove(s);
|
||||||
|
setSchemTable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}).growX().height(50f);
|
||||||
|
b.row();
|
||||||
b.stack(new SchematicsDialog.SchematicImage(s).setScaling(Scaling.fit), new Table(n -> {
|
b.stack(new SchematicsDialog.SchematicImage(s).setScaling(Scaling.fit), new Table(n -> {
|
||||||
n.top();
|
n.top();
|
||||||
n.table(Styles.black3, c -> {
|
n.table(Styles.black3, c -> {
|
||||||
@@ -320,19 +678,8 @@ public class HudUi {
|
|||||||
})).size(160f);
|
})).size(160f);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
if(sel[0].childrenPressed()) return;
|
if(sel[0].childrenPressed()) return;
|
||||||
if(state.isMenu()){
|
|
||||||
try {
|
|
||||||
((SchematicsDialog.SchematicInfoDialog)SUtils.invoke(ui.schematics, "info")).show(s);
|
|
||||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(!Vars.state.rules.schematicsAllowed){
|
|
||||||
ui.showInfo("@schematic.disabled");
|
|
||||||
}else{
|
|
||||||
control.input.useSchematic(s);
|
control.input.useSchematic(s);
|
||||||
}
|
|
||||||
}
|
|
||||||
}).pad(4).style(Styles.cleari).get();
|
}).pad(4).style(Styles.cleari).get();
|
||||||
|
|
||||||
sel[0].getStyle().up = Tex.pane;
|
sel[0].getStyle().up = Tex.pane;
|
||||||
@@ -358,10 +705,10 @@ public class HudUi {
|
|||||||
};
|
};
|
||||||
rebuildList.run();
|
rebuildList.run();
|
||||||
}, true, () -> schemShown);
|
}, true, () -> schemShown);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSchemTable() {
|
public void addSchemTable() {
|
||||||
|
if(mobile) return;
|
||||||
setSchemTable();
|
setSchemTable();
|
||||||
|
|
||||||
Table table = (Table) scene.find("minimap/position");
|
Table table = (Table) scene.find("minimap/position");
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ package UnitInfo.core;
|
|||||||
import UnitInfo.shaders.LineShader;
|
import UnitInfo.shaders.LineShader;
|
||||||
import UnitInfo.shaders.RangeShader;
|
import UnitInfo.shaders.RangeShader;
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.net.Server;
|
||||||
|
import arc.util.Log;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
|
import mindustry.core.NetClient;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
|
import mindustry.gen.Call;
|
||||||
import mindustry.mod.*;
|
import mindustry.mod.*;
|
||||||
|
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
|
|||||||
@@ -1,42 +1,37 @@
|
|||||||
package UnitInfo.core;
|
package UnitInfo.core;
|
||||||
|
|
||||||
import UnitInfo.ui.FreeBar;
|
import UnitInfo.ui.*;
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.graphics.gl.FrameBuffer;
|
import arc.graphics.gl.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.Position;
|
import arc.math.geom.*;
|
||||||
import arc.scene.ui.layout.Scl;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.Seq;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.Vars;
|
import mindustry.*;
|
||||||
import mindustry.ai.Pathfinder;
|
import mindustry.ai.*;
|
||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.content.Fx;
|
import mindustry.content.*;
|
||||||
import mindustry.core.Renderer;
|
import mindustry.core.*;
|
||||||
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.graphics.*;
|
||||||
import mindustry.logic.LUnitControl;
|
import mindustry.logic.*;
|
||||||
import mindustry.ui.Fonts;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.Block;
|
import mindustry.world.*;
|
||||||
import mindustry.world.Tile;
|
import mindustry.world.blocks.defense.*;
|
||||||
import mindustry.world.blocks.defense.ForceProjector;
|
|
||||||
import mindustry.world.blocks.defense.turrets.*;
|
import mindustry.world.blocks.defense.turrets.*;
|
||||||
import mindustry.world.blocks.distribution.MassDriver;
|
import mindustry.world.blocks.distribution.*;
|
||||||
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
import mindustry.world.blocks.payloads.*;
|
||||||
import mindustry.world.blocks.power.PowerNode;
|
import mindustry.world.blocks.power.*;
|
||||||
import mindustry.world.blocks.storage.CoreBlock;
|
import mindustry.world.blocks.storage.*;
|
||||||
import mindustry.world.blocks.units.CommandCenter;
|
import mindustry.world.blocks.units.*;
|
||||||
import mindustry.world.blocks.units.Reconstructor;
|
|
||||||
import mindustry.world.blocks.units.UnitFactory;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static UnitInfo.SUtils.floatFormat;
|
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -195,12 +190,12 @@ public class OverDrawer {
|
|||||||
if(!mobile && !Vars.state.isPaused() && settings.getBool("gaycursor"))
|
if(!mobile && !Vars.state.isPaused() && settings.getBool("gaycursor"))
|
||||||
Fx.mine.at(Core.input.mouseWorldX(), Core.input.mouseWorldY(), Tmp.c2.set(Color.red).shiftHue(Time.time * 1.5f));
|
Fx.mine.at(Core.input.mouseWorldX(), Core.input.mouseWorldY(), Tmp.c2.set(Color.red).shiftHue(Time.time * 1.5f));
|
||||||
|
|
||||||
if(!renderer.pixelator.enabled()) Groups.unit.each(unit -> unit.item() != null && unit.itemTime > 0.01f, unit -> {
|
if(!renderer.pixelator.enabled()) Groups.unit.each(unit -> unit.item() != null && unit.itemTime > 0.01f, unit ->
|
||||||
Fonts.outline.draw(unit.stack.amount + "",
|
Fonts.outline.draw(unit.stack.amount + "",
|
||||||
unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY),
|
unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY),
|
||||||
unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY) - 3,
|
unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY) - 3,
|
||||||
Pal.accent, 0.25f * unit.itemTime / Scl.scl(1f), false, Align.center);
|
Pal.accent, 0.25f * unit.itemTime / Scl.scl(1f), false, Align.center)
|
||||||
});
|
);
|
||||||
|
|
||||||
if(!state.rules.polygonCoreProtection && settings.getBool("coreRange") && player != null){
|
if(!state.rules.polygonCoreProtection && settings.getBool("coreRange") && player != null){
|
||||||
state.teams.eachEnemyCore(player.team(), core -> {
|
state.teams.eachEnemyCore(player.team(), core -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user