mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
improved SettingS.java
This commit is contained in:
@@ -358,11 +358,14 @@ public class HudUi {
|
||||
t.table(tt -> {
|
||||
tt.add(new Stack() {{
|
||||
add(new Table(ttt -> {
|
||||
ttt.image(type.uiIcon).size(iconMed);
|
||||
ttt.image(type.uiIcon).size(iconSmall);
|
||||
}));
|
||||
add(new Table(ttt -> {
|
||||
ttt.right().bottom();
|
||||
ttt.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);
|
||||
ttt.add(label);
|
||||
ttt.pack();
|
||||
}));
|
||||
add(new Table(ttt -> {
|
||||
ttt.top().right();
|
||||
@@ -372,8 +375,8 @@ public class HudUi {
|
||||
ttt.pack();
|
||||
}));
|
||||
}}).pad(6);
|
||||
if(++i[0] % 6 == 0) tt.row();
|
||||
});
|
||||
if(++i[0] % 6 == 0) t.row();
|
||||
});
|
||||
t.row();
|
||||
i[0] = 0;
|
||||
@@ -381,15 +384,18 @@ public class HudUi {
|
||||
t.table(tt -> {
|
||||
tt.add(new Stack() {{
|
||||
add(new Table(ttt -> {
|
||||
ttt.add(new Image(type.uiIcon)).size(iconMed);
|
||||
ttt.add(new Image(type.uiIcon)).size(iconSmall);
|
||||
}));
|
||||
add(new Table(ttt -> {
|
||||
ttt.right().bottom();
|
||||
ttt.add(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);
|
||||
ttt.add(label);
|
||||
ttt.pack();
|
||||
}));
|
||||
}}).pad(6);
|
||||
if(++i[0] % 6 == 0) tt.row();
|
||||
});
|
||||
if(++i[0] % 6 == 0) t.row();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -425,7 +431,7 @@ public class HudUi {
|
||||
});
|
||||
});
|
||||
Table pathlineTable = new Table(t -> {
|
||||
t.right();
|
||||
t.left();
|
||||
|
||||
Button pathBtn = new ImageButton(new ScaledNinePatchDrawable(new NinePatch(Icon.grid.getRegion()), 0.5f), Styles.clearToggleTransi);
|
||||
Button unitBtn = new ImageButton(new ScaledNinePatchDrawable(new NinePatch(Icon.grid.getRegion()), 0.5f), Styles.clearToggleTransi);
|
||||
@@ -875,7 +881,7 @@ public class HudUi {
|
||||
Label label2 = new Label(()->getTarget() == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(getTarget().x() / tilesize, 2) + ", " + Strings.fixed(getTarget().y() / tilesize, 2) + ")");
|
||||
label2.setFontScale(modUiScale);
|
||||
to.add(label2);
|
||||
})){{allowMobile = true;}});
|
||||
})));
|
||||
tt.update(()->tt.setBackground(((NinePatchDrawable)Tex.underline2).tint(getTarget().isNull() ? Color.gray : getTarget().team().color)));
|
||||
});
|
||||
t.row();
|
||||
|
||||
@@ -82,9 +82,8 @@ public class Main extends Mod {
|
||||
|
||||
Events.run(Trigger.draw, () -> {
|
||||
int[] units = {0};
|
||||
Groups.unit.each(u -> {
|
||||
if(pathLine || unitLine || logicLine) Groups.unit.each(u -> {
|
||||
Team team = u.team;
|
||||
otherCores = Groups.build.count(b -> b instanceof CoreBlock.CoreBuild && b.team != team);
|
||||
UnitController c = u.controller();
|
||||
UnitCommand com = team.data().command;
|
||||
|
||||
@@ -109,6 +108,7 @@ public class Main extends Mod {
|
||||
c instanceof FlyingAI || //not flying anyway
|
||||
com == UnitCommand.idle) return; //not idle
|
||||
|
||||
otherCores = Groups.build.count(b -> b instanceof CoreBlock.CoreBuild && b.team != team);
|
||||
getNextTile(u.tileOn(), u.pathType(), team, com.ordinal());
|
||||
pathTiles.filter(Objects::nonNull);
|
||||
for(int i = 1; i < pathTiles.size; i++) {
|
||||
@@ -141,7 +141,6 @@ public class Main extends Mod {
|
||||
pathTiles.clear();
|
||||
}
|
||||
});
|
||||
Draw.reset();
|
||||
|
||||
if(settings.getBool("blockstatus")) Groups.build.each(build -> {
|
||||
if(Vars.player != null && Vars.player.team() == build.team) return;
|
||||
@@ -164,16 +163,6 @@ public class Main extends Mod {
|
||||
if(Core.settings.getBool("unithealthui"))
|
||||
Groups.unit.each(unit -> new FreeBar().draw(unit));
|
||||
|
||||
if(Core.settings.getBool("scan")){
|
||||
float range = settings.getInt("rangemax") * 8f;
|
||||
for(Team team : Team.all)
|
||||
indexer.eachBlock(team, Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, b -> true, b -> new FreeBar().draw(b));
|
||||
Draw.color(Tmp.c1.set(Pal.accent).a(0.75f + Mathf.absin(3, 0.25f)));
|
||||
for(int i = 0; i < 4; i++)
|
||||
Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, 90 * i + Time.time % 360);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
|
||||
@@ -1,329 +1,181 @@
|
||||
package UnitInfo.core;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.scene.Group;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.scene.ui.layout.Stack;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.ui.dialogs.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class SettingS {
|
||||
public static SettingsMenuDialog.SettingsTable waveTable = new SettingsMenuDialog.SettingsTable();
|
||||
public static SettingsMenuDialog.SettingsTable opacityTable = new SettingsMenuDialog.SettingsTable();
|
||||
public static SettingsMenuDialog.SettingsTable scanTable = new SettingsMenuDialog.SettingsTable();
|
||||
public SettingsMenuDialog.SettingsTable sharset;
|
||||
|
||||
public void addGraphicCheckSetting(String key, boolean def){
|
||||
ui.settings.graphics.checkPref(key, def);
|
||||
}
|
||||
public void addGraphicSlideSetting(String key, int def, int min, int max, int step, SettingsMenuDialog.StringProcessor s){
|
||||
ui.settings.graphics.sliderPref(key, def, min, max, step, s);
|
||||
}
|
||||
/*
|
||||
public void addGraphicSlideSetting(String key, int def, int min, int max, int step, SettingsMenuDialog.StringProcessor s, Seq<SettingsMenuDialog.SettingsTable.SettingS> list){
|
||||
list.add(new SettingsMenuDialog.SettingsTable.SettingS(key) {
|
||||
{
|
||||
Core.settings.defaults(name, def);
|
||||
}
|
||||
public void addGraphicSlideSetting(String key, int def, int min, int max, int step, SettingsMenuDialog.StringProcessor s, Seq<SharSetting> list){
|
||||
list.add(new SharSetting(key, def) {
|
||||
|
||||
@Override
|
||||
public void add(SettingsMenuDialog.SettingsTable table){
|
||||
Slider slider = new Slider(min, max, step, false);
|
||||
|
||||
if(Version.build <= 128) slider.addListener(new Tooltip(t -> t.background(Tex.button).table(to -> to.add("[lightgray]" + Core.bundle.get("setting." + key + ".description") + "[]"))));
|
||||
slider.setValue(settings.getInt(name));
|
||||
|
||||
public void add(Table table){
|
||||
Label value = new Label("");
|
||||
value.setStyle(Styles.outlineLabel);
|
||||
value.touchable = Touchable.disabled;
|
||||
value.setAlignment(Align.center);
|
||||
value.setWrap(true);
|
||||
|
||||
Slider slider = new Slider(min, max, step, false);
|
||||
slider.setValue(settings.getInt(name));
|
||||
slider.changed(() -> {
|
||||
settings.put(name, (int)slider.getValue());
|
||||
value.setText(title + ": " + s.get((int)slider.getValue()));
|
||||
});
|
||||
|
||||
value.setAlignment(Align.center);
|
||||
value.setWrap(true);
|
||||
|
||||
slider.change();
|
||||
|
||||
table.stack(slider, value).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4);
|
||||
table.row();
|
||||
table.stack(slider, value).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).row();
|
||||
}
|
||||
});
|
||||
}
|
||||
public void addGraphicCheckSetting(String key, boolean def, Seq<SettingsMenuDialog.SettingsTable.SettingS> list){
|
||||
list.add(new SettingsMenuDialog.SettingsTable.SettingS() {
|
||||
{
|
||||
name = key;
|
||||
title = bundle.get("setting." + key + ".name");
|
||||
|
||||
Core.settings.defaults(name, def);
|
||||
}
|
||||
public void addGraphicCheckSetting(String key, boolean def, Seq<SharSetting> list){
|
||||
list.add(new SharSetting(key, def) {
|
||||
|
||||
@Override
|
||||
public void add(SettingsMenuDialog.SettingsTable table) {
|
||||
public void add(Table table) {
|
||||
CheckBox box = new CheckBox(title);
|
||||
if(Version.build <= 128) box.addListener(new Tooltip(t -> t.background(Tex.button).table(to -> to.add("[lightgray]" + Core.bundle.get("setting." + key + ".description") + "[]"))));
|
||||
|
||||
box.update(() -> box.setChecked(settings.getBool(name)));
|
||||
|
||||
box.changed(() -> settings.put(name, box.isChecked()));
|
||||
|
||||
box.left();
|
||||
table.add(box).left().padTop(3f);
|
||||
table.row();
|
||||
table.add(box).row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addGraphicTypeSetting(String key, int defs, String dialogs, String invalid, int warnMax, Seq<SettingsMenuDialog.SettingsTable.SettingS> list){
|
||||
list.add(new SettingsMenuDialog.SettingsTable.SettingS() {
|
||||
public final int def;
|
||||
{
|
||||
def = defs;
|
||||
name = key;
|
||||
title = Core.bundle.get("setting." + key + ".name");
|
||||
|
||||
Core.settings.defaults(name, def);
|
||||
}
|
||||
|
||||
public final StringBuilder message = new StringBuilder();
|
||||
public void addGraphicTypeSetting(String key, float min, float max, int def, boolean integer, Boolp condition, Func<String, String> h, Seq<SharSetting> list){
|
||||
list.add(new SharSetting(key, def) {
|
||||
|
||||
@Override
|
||||
public void add(SettingsMenuDialog.SettingsTable settingsTable) {
|
||||
String settingTitle = title;
|
||||
String settingName = name;
|
||||
Label label = new Label(title + ": " + def);
|
||||
|
||||
Table button = new Table(t -> t.button(Icon.pencil, () -> {
|
||||
if(Vars.mobile){
|
||||
Core.input.getTextInput(new Input.TextInput(){{
|
||||
text = message.toString();
|
||||
multiline = false;
|
||||
maxLength = String.valueOf(Integer.MAX_VALUE).length();
|
||||
accepted = str -> {
|
||||
|
||||
try {
|
||||
int number = Integer.parseInt(str);
|
||||
if(number >= warnMax){
|
||||
new Dialog(""){{
|
||||
setFillParent(true);
|
||||
cont.margin(15f);
|
||||
cont.add("@warn");
|
||||
cont.row();
|
||||
cont.image().width(300f).pad(2).height(4f).color(Color.scarlet);
|
||||
cont.row();
|
||||
cont.add("@warning").pad(2f).growX().wrap().get().setAlignment(Align.center);
|
||||
cont.row();
|
||||
cont.table(t -> {
|
||||
t.button("@yes", () -> {
|
||||
this.hide();
|
||||
Core.settings.put(settingName, number);
|
||||
label.setText(settingTitle + ": " + number);
|
||||
}).size(120, 50);
|
||||
t.button("@no", () -> {
|
||||
this.hide();
|
||||
Core.settings.put(settingName, def);
|
||||
label.setText(settingTitle + ": " + Core.settings.getInt(settingName));
|
||||
}).size(120, 50);
|
||||
}).pad(5);
|
||||
closeOnBack();
|
||||
}}.show();
|
||||
}
|
||||
else {
|
||||
Core.settings.put(settingName, number);
|
||||
label.setText(settingTitle + ": " + number);
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
Log.info(e);
|
||||
ui.showErrorMessage("@invalid");
|
||||
|
||||
Core.settings.put(settingName, def);
|
||||
label.setText(settingTitle + ": " + def);
|
||||
}
|
||||
};
|
||||
}});
|
||||
}else{
|
||||
BaseDialog dialog = new BaseDialog(dialogs);
|
||||
dialog.setFillParent(false);
|
||||
TextArea a = dialog.cont.add(new TextArea(message.toString().replace("\r", "\n"))).size(140f, 80f).get();
|
||||
a.setMaxLength(String.valueOf(Integer.MAX_VALUE).length());
|
||||
dialog.buttons.button("@ok", () -> {
|
||||
try {
|
||||
int number = Integer.parseInt(a.getText());
|
||||
if(number >= warnMax){
|
||||
String name1 = name;
|
||||
String title1 = title;
|
||||
new Dialog(""){{
|
||||
setFillParent(true);
|
||||
cont.margin(15f);
|
||||
cont.add("@warn");
|
||||
cont.row();
|
||||
cont.image().width(300f).pad(2).height(4f).color(Color.scarlet);
|
||||
cont.row();
|
||||
cont.add("@warning").pad(2f).growX().wrap().get().setAlignment(Align.center);
|
||||
cont.row();
|
||||
cont.table(t -> {
|
||||
t.button("@yes", () -> {
|
||||
this.hide();
|
||||
Core.settings.put(name1, number);
|
||||
label.setText(title1 + ": " + number);
|
||||
}).size(120, 50);
|
||||
t.button("@no", () -> {
|
||||
this.hide();
|
||||
Core.settings.put(name1, def);
|
||||
label.setText(title1 + ": " + Core.settings.getInt(name1));
|
||||
}).size(120, 50);
|
||||
}).pad(5);
|
||||
closeOnBack();
|
||||
}}.show();
|
||||
}else {
|
||||
Core.settings.put(name, number);
|
||||
label.setText(title + ": " + number);
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
Log.info(e);
|
||||
ui.showErrorMessage(invalid);
|
||||
|
||||
Core.settings.put(name, def);
|
||||
label.setText(title + ": " + def);
|
||||
}
|
||||
|
||||
dialog.hide();
|
||||
}).size(70f, 50f);
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
}).size(40f));
|
||||
|
||||
public void add(Table settingsTable) {
|
||||
final String[] str = {""};
|
||||
settingsTable.table(t -> {
|
||||
t.left().defaults().left();
|
||||
t.add(label).minWidth(label.getPrefWidth() / Scl.scl(1.0F) + 50.0F);
|
||||
t.add(button).size(40F);
|
||||
if(Version.build <= 128) t.addListener(new Tooltip(tt -> tt.background(Tex.button).table(to -> to.add("[lightgray]" + Core.bundle.get("setting." + key + ".description") + "[]"))));
|
||||
}).left().padTop(3.0F);
|
||||
settingsTable.row();
|
||||
}
|
||||
});
|
||||
}
|
||||
t.add(new Label(title + ": ")).left().padRight(5)
|
||||
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
||||
|
||||
public void addGraphicDialogSetting(String key, Seq<SettingsMenuDialog.SettingsTable.SettingS> list, SettingsMenuDialog.SettingsTable table){
|
||||
ui.settings.graphics.pref(new SettingsMenuDialog.SettingsTable.SettingS() {
|
||||
{
|
||||
name = key;
|
||||
title = Core.bundle.get("setting." + key + ".name");
|
||||
|
||||
Core.settings.defaults(name, 1);
|
||||
}
|
||||
|
||||
public Table rebuild() {
|
||||
table.clearChildren();
|
||||
|
||||
Iterator<SettingsMenuDialog.SettingsTable.SettingS> var1 = list.iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
SettingsMenuDialog.SettingsTable.SettingS setting = var1.next();
|
||||
setting.add(table);
|
||||
}
|
||||
table.button(Core.bundle.get("settings.reset", "Reset to Defaults"), () -> {
|
||||
Iterator<SettingsMenuDialog.SettingsTable.SettingS> var2 = list.iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
SettingsMenuDialog.SettingsTable.SettingS setting = var1.next();
|
||||
if (setting.name != null && setting.title != null) {
|
||||
Core.settings.put(setting.name, Core.settings.getDefault(setting.name));
|
||||
}
|
||||
}
|
||||
rebuild();
|
||||
}).margin(14.0F).width(240.0F).pad(6.0F);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SettingsMenuDialog.SettingsTable settingsTable) {
|
||||
settingsTable.table(Core.scene.getStyle(Button.ButtonStyle.class).up, t->{
|
||||
t.add(rebuild());
|
||||
t.row();
|
||||
t.field((integer ? settings.getInt(key) : settings.getFloat(key)) + str[0], s -> {
|
||||
settings.put(key, integer ? Strings.parseInt(s) : Strings.parseFloat(s));
|
||||
str[0] = h.get(s);
|
||||
}).update(a -> a.setDisabled(!condition.get()))
|
||||
.valid(f -> Strings.canParsePositiveFloat(f) && Strings.parseFloat(f) >= min && Strings.parseFloat(f) <= max).width(120f).left();
|
||||
});
|
||||
settingsTable.row();
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
public void init(){
|
||||
/*
|
||||
Seq<SettingsMenuDialog.SettingsTable.SettingS> waveSeq = new Seq<>();
|
||||
addGraphicCheckSetting("pastwave", false, waveSeq);
|
||||
addGraphicCheckSetting("emptywave", true, waveSeq);
|
||||
addGraphicTypeSetting("wavemax", 100, "@editmaxwave","@invalid", 200, waveSeq);
|
||||
addGraphicDialogSetting("wavesetting", waveSeq, waveTable);
|
||||
BaseDialog dialog = new BaseDialog("UnitInfo Setting");
|
||||
dialog.addCloseButton();
|
||||
sharset = new SettingsMenuDialog.SettingsTable();
|
||||
dialog.cont.center().add(sharset);
|
||||
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();
|
||||
settingUi.button(bundle.get("setting.shar-title"), Styles.cleart, dialog::show);
|
||||
});
|
||||
|
||||
Seq<SettingsMenuDialog.SettingsTable.SettingS> scanSeq = new Seq<>();
|
||||
addGraphicCheckSetting("scan", false, scanSeq);
|
||||
addGraphicTypeSetting("rangemax", 10, "@editrange","@invalid", 100, scanSeq);
|
||||
addGraphicCheckSetting("rangeNearby", true, scanSeq);
|
||||
addGraphicCheckSetting("allTeamRange", false, scanSeq);
|
||||
addGraphicCheckSetting("allTargetRange", false, scanSeq);
|
||||
addGraphicCheckSetting("unitRange", false, scanSeq);
|
||||
addGraphicCheckSetting("softRangeDrawing", false, scanSeq);
|
||||
addGraphicSlideSetting("softRangeOpacity", 10, 0, 25, 1, s -> s + "%", scanSeq);
|
||||
addGraphicSlideSetting("rangeRadius", 5, 0, 20, 1, s -> s + "tiles", scanSeq);
|
||||
addGraphicDialogSetting("wavesetting", scanSeq, scanTable);
|
||||
|
||||
Seq<SettingsMenuDialog.SettingsTable.SettingS> opacitySeq = new Seq<>();
|
||||
Seq<Seq<SharSetting>> settingSeq = new Seq<>();
|
||||
Seq<SharSetting> tapSeq = new Seq<>();
|
||||
addGraphicCheckSetting("infoui", true, tapSeq);
|
||||
addGraphicCheckSetting("weaponui", true, tapSeq);
|
||||
addGraphicTypeSetting("wavemax", 0, 100,200, true, () -> true, s -> s + "waves", tapSeq);
|
||||
addGraphicCheckSetting("pastwave", false, tapSeq);
|
||||
addGraphicCheckSetting("emptywave", true, tapSeq);
|
||||
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? "default bar" : s + "th bar", tapSeq);
|
||||
addGraphicSlideSetting("infoUiScale", 100, 50, 100, 5, s -> s + "%", tapSeq);
|
||||
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec", tapSeq);
|
||||
addGraphicCheckSetting("allTeam", false, tapSeq);
|
||||
|
||||
Seq<SharSetting> rangeSeq = new Seq<>();
|
||||
addGraphicTypeSetting("rangeRadius", 0, 50, 20, true, () -> true, s -> s + "tiles", rangeSeq);
|
||||
addGraphicCheckSetting("rangeNearby", true, rangeSeq);
|
||||
addGraphicCheckSetting("allTeamRange", false, rangeSeq);
|
||||
addGraphicCheckSetting("allTargetRange", false, rangeSeq);
|
||||
addGraphicCheckSetting("coreRange", false, rangeSeq);
|
||||
addGraphicCheckSetting("unitRange", false, rangeSeq);
|
||||
addGraphicCheckSetting("softRangeDrawing", false, rangeSeq);
|
||||
|
||||
Seq<SharSetting> opacitySeq = new Seq<>();
|
||||
addGraphicSlideSetting("selectopacity", 50, 0, 100, 5, s -> s + "%", opacitySeq);
|
||||
addGraphicSlideSetting("baropacity", 50, 0, 100, 5, s -> s + "%", opacitySeq);
|
||||
addGraphicSlideSetting("uiopacity", 50, 0, 100, 5, s -> s + "%", opacitySeq);
|
||||
addGraphicDialogSetting("opacitysetting", opacitySeq, opacityTable);
|
||||
*/
|
||||
addGraphicSlideSetting("softRangeOpacity", 10, 0, 25, 1, s -> s + "%", opacitySeq);
|
||||
|
||||
addGraphicSlideSetting("unitlinelimit", 50, 50, 250, 10, s -> s + "units");
|
||||
addGraphicSlideSetting("infoUiScale", 100, 50, 100, 5, s -> s + "%");
|
||||
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec");
|
||||
addGraphicCheckSetting("pastwave", false);
|
||||
addGraphicCheckSetting("emptywave", true);
|
||||
addGraphicSlideSetting("wavemax", 50, 0, 200, 1, s -> s + "waves");
|
||||
addGraphicCheckSetting("scan", false);
|
||||
addGraphicSlideSetting("rangemax", 10, 0, 100, 1, s -> s + "tiles");
|
||||
addGraphicCheckSetting("coreRange", false);
|
||||
addGraphicCheckSetting("rangeNearby", true);
|
||||
addGraphicCheckSetting("allTeamRange", false);
|
||||
addGraphicCheckSetting("allTargetRange", false);
|
||||
addGraphicCheckSetting("unitRange", false);
|
||||
addGraphicCheckSetting("softRangeDrawing", true);
|
||||
addGraphicSlideSetting("softRangeOpacity", 10, 0, 25, 1, s -> s + "%");
|
||||
addGraphicSlideSetting("rangeRadius", 15, 0, 20, 1, s -> s + "tiles");
|
||||
addGraphicSlideSetting("selectopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
addGraphicSlideSetting("baropacity", 50, 0, 100, 5, s -> s + "%");
|
||||
addGraphicSlideSetting("uiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||
Seq<SharSetting> drawSeq = new Seq<>();
|
||||
addGraphicCheckSetting("gaycursor", false, drawSeq);
|
||||
addGraphicCheckSetting("unithealthui", true, drawSeq);
|
||||
addGraphicCheckSetting("linkedMass", true, drawSeq);
|
||||
addGraphicCheckSetting("linkedNode", false, drawSeq);
|
||||
addGraphicCheckSetting("select", true, drawSeq);
|
||||
addGraphicCheckSetting("deadTarget", false, drawSeq);
|
||||
addGraphicCheckSetting("distanceLine", true, drawSeq);
|
||||
addGraphicSlideSetting("unitlinelimit", 50, 50, 250, 10, s -> s + "units", drawSeq);
|
||||
|
||||
addGraphicCheckSetting("autoShooting", false);
|
||||
addGraphicCheckSetting("infoui", true);
|
||||
addGraphicCheckSetting("weaponui", true);
|
||||
addGraphicCheckSetting("select", true);
|
||||
addGraphicCheckSetting("unithealthui", true);
|
||||
addGraphicCheckSetting("ssim", false);
|
||||
addGraphicCheckSetting("shar", false);
|
||||
addGraphicCheckSetting("shar1", false);
|
||||
addGraphicCheckSetting("shar2", false);
|
||||
addGraphicCheckSetting("shar3", false);
|
||||
addGraphicCheckSetting("gaycursor", false);
|
||||
addGraphicCheckSetting("allTeam", false);
|
||||
addGraphicCheckSetting("deadTarget", false);
|
||||
addGraphicCheckSetting("linkedMass", true);
|
||||
addGraphicCheckSetting("linkedNode", false);
|
||||
addGraphicCheckSetting("distanceLine", true);
|
||||
Seq<SharSetting> etcSeq = new Seq<>();
|
||||
addGraphicCheckSetting("autoShooting", false, etcSeq);
|
||||
settingSeq.add(tapSeq, rangeSeq, opacitySeq);
|
||||
settingSeq.add(drawSeq, etcSeq);
|
||||
|
||||
sharset.table(t -> {
|
||||
Seq<Button> 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));
|
||||
buttons.add(new TextButton(bundle.get("setting.shar-draw"), Styles.clearToggleMenut));
|
||||
buttons.add(new TextButton(bundle.get("setting.shar-etc"), Styles.clearToggleMenut));
|
||||
buttons.each(b -> b.clicked(() -> buttons.each(b1 -> b1.setChecked(b1 == b))));
|
||||
t.table(Styles.black8, bt -> {
|
||||
bt.top().align(Align.top);
|
||||
buttons.each(b -> {
|
||||
bt.add(b).minHeight(60f).minWidth(150f).top();
|
||||
});
|
||||
}).grow().row();
|
||||
|
||||
Stack stack = new Stack();
|
||||
for(int i = 0; i < settingSeq.size; i++){
|
||||
int finalI = i;
|
||||
stack.add(new Table(st -> {
|
||||
st.center();
|
||||
for(SharSetting setting : settingSeq.get(finalI)) {
|
||||
Label label = new Label(setting.description);
|
||||
label.setColor(Color.gray);
|
||||
label.setFontScale(0.75f);
|
||||
|
||||
st.table(stt -> {
|
||||
stt.center();
|
||||
setting.add(stt);
|
||||
stt.add(label);
|
||||
}).row();
|
||||
}
|
||||
|
||||
st.button(Core.bundle.get("settings.reset", "Reset to Defaults"), () -> {
|
||||
for(SharSetting setting : settingSeq.get(finalI)) {
|
||||
if(setting.name != null && setting.title != null) {
|
||||
Core.settings.put(setting.name, Core.settings.getDefault(setting.name));
|
||||
}
|
||||
}
|
||||
}).margin(14.0F).width(240.0F).pad(6.0F);
|
||||
st.visibility = () -> buttons.get(finalI).isChecked();
|
||||
st.pack();
|
||||
}));
|
||||
}
|
||||
t.add(stack);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
26
src/UnitInfo/core/SharSetting.java
Normal file
26
src/UnitInfo/core/SharSetting.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package UnitInfo.core;
|
||||
|
||||
import arc.Core;
|
||||
import arc.scene.ui.layout.Table;
|
||||
import mindustry.ui.dialogs.SettingsMenuDialog;
|
||||
|
||||
public abstract class SharSetting extends SettingsMenuDialog.SettingsTable.Setting {
|
||||
|
||||
public SharSetting(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public SharSetting(String name, Object def) {
|
||||
this(name);
|
||||
Core.settings.defaults(name, def);
|
||||
}
|
||||
|
||||
public void add(Table table) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SettingsMenuDialog.SettingsTable table) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,11 +54,7 @@ public class SBar extends Element{
|
||||
}
|
||||
|
||||
public SBar init(){
|
||||
boolean ssim = Core.settings.getBool("ssim");
|
||||
boolean shar = Core.settings.getBool("shar");
|
||||
boolean shar1 = Core.settings.getBool("shar1");
|
||||
boolean shar2 = Core.settings.getBool("shar2");
|
||||
boolean shar3 = Core.settings.getBool("shar3");
|
||||
int h = Core.settings.getInt("barstyle");
|
||||
|
||||
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barS"), 10, 10, 9, 9);
|
||||
@@ -69,27 +65,27 @@ public class SBar extends Element{
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-1dotbar-top"),0,0,0,0);
|
||||
spriteWidth = Core.atlas.find("unitinfo-1dotbar").width;
|
||||
}
|
||||
else if(ssim){
|
||||
else if(h == 1){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSS"), 14, 14, 19, 19);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSS-top"), 14, 14, 19, 19);
|
||||
spriteWidth = Core.atlas.find("unitinfo-barSS").width;
|
||||
}
|
||||
else if(shar){
|
||||
else if(h == 2){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSS"), 25, 25, 17, 17);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSS-top"), 25, 25, 17, 17);
|
||||
spriteWidth = Core.atlas.find("unitinfo-barSSS").width;
|
||||
}
|
||||
else if(shar1){
|
||||
else if(h == 3){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSS"), 25, 25, 17, 17);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSS-top"), 25, 25, 17, 17);
|
||||
spriteWidth = Core.atlas.find("unitinfo-barSSSS").width;
|
||||
}
|
||||
else if(shar2){
|
||||
else if(h == 4){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSSS"), 27, 27, 16, 16);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSSS-top"), 27, 27, 16, 16);
|
||||
spriteWidth = Core.atlas.find("unitinfo-barSSSSS").width;
|
||||
}
|
||||
else if(shar3){
|
||||
else if(h == 5){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSSSS"), 32, 32, 16, 16);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("unitinfo-barSSSSSS-top"), 32, 32, 16, 16);
|
||||
spriteWidth = Core.atlas.find("unitinfo-barSSSSSS").width;
|
||||
|
||||
Reference in New Issue
Block a user