mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
added wave info
This commit is contained in:
@@ -12,11 +12,18 @@ shar-stat.liquidAmmo = Liquid: {0}
|
|||||||
shar-stat.power = Power: {0} / {1}
|
shar-stat.power = Power: {0} / {1}
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
|
setting.wavemax.name = Wave Amount to display
|
||||||
setting.coreui.name = Display core info UI
|
setting.coreui.name = Display core info UI
|
||||||
|
setting.waveui.name = Display wave info UI
|
||||||
setting.unitui.name = Display unit info UI
|
setting.unitui.name = Display unit info UI
|
||||||
setting.weaponui.name = Display weapon info UI
|
setting.weaponui.name = Display weapon info UI
|
||||||
setting.commandedunitui.name = Display command info UI
|
setting.commandedunitui.name = Display command info UI
|
||||||
setting.unithealthui.name = Display Unit Bar
|
setting.unithealthui.name = Display Unit Bar
|
||||||
setting.coreuiopacity.name = Core UI background Opacity
|
setting.coreuiopacity.name = Core UI background Opacity
|
||||||
|
setting.waveuiopacity.name = Wave UI background Opacity
|
||||||
setting.uiopacity.name = UI background Opacity
|
setting.uiopacity.name = UI background Opacity
|
||||||
setting.baropacity.name = Health Bar Opacity
|
setting.baropacity.name = Health Bar Opacity
|
||||||
|
|
||||||
|
#Dialog
|
||||||
|
editmaxwave = edit waves
|
||||||
|
invalid = invalid number format or number is too large (<= 2147483647). number will be default(100).
|
||||||
@@ -12,11 +12,18 @@ shar-stat.liquidAmmo = 액체: {0}
|
|||||||
shar-stat.power = 전력: {0} / {1}
|
shar-stat.power = 전력: {0} / {1}
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
|
setting.wavemax.name = 표시할 단계 수
|
||||||
setting.coreui.name = 코어 정보 UI 표시
|
setting.coreui.name = 코어 정보 UI 표시
|
||||||
|
setting.waveui.name = 단계 정보 UI 표시
|
||||||
setting.unitui.name = 유닛 정보 UI 표시
|
setting.unitui.name = 유닛 정보 UI 표시
|
||||||
setting.weaponui.name = 무기 정보 UI 표시
|
setting.weaponui.name = 무기 정보 UI 표시
|
||||||
setting.commandedunitui.name = 지휘 정보 UI 표시
|
setting.commandedunitui.name = 지휘 정보 UI 표시
|
||||||
setting.unithealthui.name = 유닛 바 표시
|
setting.unithealthui.name = 유닛 바 표시
|
||||||
setting.coreuiopacity.name = 코어 UI 배경 투명도
|
setting.coreuiopacity.name = 코어 UI 배경 투명도
|
||||||
|
setting.waveuiopacity.name = 단계 UI 배경 투명도
|
||||||
setting.uiopacity.name = UI 배경 투명도
|
setting.uiopacity.name = UI 배경 투명도
|
||||||
setting.baropacity.name = 유닛 바 투명도
|
setting.baropacity.name = 유닛 바 투명도
|
||||||
|
|
||||||
|
#Dialog
|
||||||
|
editmaxwave = 최대 단계 수정하기
|
||||||
|
invalid = 잘못된 숫자 형식이거나 최대값(2147483647)을 넘겼습니다. 기본값으로 돌아갑니다(25).
|
||||||
@@ -7,14 +7,12 @@ import arc.graphics.Color;
|
|||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.Mathf;
|
import arc.math.Mathf;
|
||||||
import arc.scene.Element;
|
import arc.scene.Element;
|
||||||
import arc.scene.style.TextureRegionDrawable;
|
|
||||||
import arc.scene.style.TransformDrawable;
|
import arc.scene.style.TransformDrawable;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.layout.Scl;
|
import arc.scene.ui.layout.Scl;
|
||||||
import arc.scene.ui.layout.Stack;
|
import arc.scene.ui.layout.Stack;
|
||||||
import arc.scene.ui.layout.Table;
|
import arc.scene.ui.layout.Table;
|
||||||
import arc.scene.utils.Elem;
|
import arc.scene.utils.Elem;
|
||||||
import arc.struct.ObjectMap;
|
|
||||||
import arc.struct.Seq;
|
import arc.struct.Seq;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.Vars;
|
import mindustry.Vars;
|
||||||
@@ -24,6 +22,7 @@ import mindustry.content.Liquids;
|
|||||||
import mindustry.entities.abilities.ForceFieldAbility;
|
import mindustry.entities.abilities.ForceFieldAbility;
|
||||||
import mindustry.entities.abilities.ShieldRegenFieldAbility;
|
import mindustry.entities.abilities.ShieldRegenFieldAbility;
|
||||||
import mindustry.entities.units.WeaponMount;
|
import mindustry.entities.units.WeaponMount;
|
||||||
|
import mindustry.game.SpawnGroup;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.Pal;
|
import mindustry.graphics.Pal;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@@ -37,6 +36,8 @@ import mindustry.world.blocks.storage.CoreBlock;
|
|||||||
import mindustry.world.consumers.ConsumePower;
|
import mindustry.world.consumers.ConsumePower;
|
||||||
import mindustry.world.consumers.ConsumeType;
|
import mindustry.world.consumers.ConsumeType;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static arc.Core.scene;
|
import static arc.Core.scene;
|
||||||
import static arc.Core.settings;
|
import static arc.Core.settings;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -45,6 +46,9 @@ public class HudUi {
|
|||||||
Seq<Element> bars = new Seq<>();
|
Seq<Element> bars = new Seq<>();
|
||||||
Table weapon = new Table();
|
Table weapon = new Table();
|
||||||
Table core = new Table();
|
Table core = new Table();
|
||||||
|
Table wave = new Table();
|
||||||
|
Table waveTable;
|
||||||
|
|
||||||
@Nullable UnitType type;
|
@Nullable UnitType type;
|
||||||
@Nullable Unit unit;
|
@Nullable Unit unit;
|
||||||
Element image;
|
Element image;
|
||||||
@@ -52,6 +56,8 @@ public class HudUi {
|
|||||||
float heat;
|
float heat;
|
||||||
float heat2;
|
float heat2;
|
||||||
float scrollPos;
|
float scrollPos;
|
||||||
|
int maxwave;
|
||||||
|
int coreamount;
|
||||||
|
|
||||||
public Unit getUnit(){
|
public Unit getUnit(){
|
||||||
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4);
|
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4);
|
||||||
@@ -629,14 +635,14 @@ public class HudUi {
|
|||||||
tx.add(new Table(tt -> {
|
tx.add(new Table(tt -> {
|
||||||
tt.defaults().maxWidth(24/3f * 3f).left().top();
|
tt.defaults().maxWidth(24/3f * 3f).left().top();
|
||||||
|
|
||||||
int amount = 0;
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
if(Vars.player.unit() != null) amount = Vars.player.unit().team().cores().size;
|
if(Vars.player.unit() == null) return;
|
||||||
for(int r = 0; r < amount; r++){
|
coreamount = Vars.player.unit().team().cores().size;
|
||||||
|
for(int r = 0; r < coreamount; r++){
|
||||||
CoreBlock.CoreBuild core = Vars.player.unit().team().cores().get(r);
|
CoreBlock.CoreBuild core = Vars.player.unit().team().cores().get(r);
|
||||||
TextureRegion region = core.block.icon(Cicon.full);
|
TextureRegion region = core.block.icon(Cicon.full);
|
||||||
|
|
||||||
if(amount > 1 && r % 4 == 0) {
|
if(coreamount > 1 && r % 4 == 0) {
|
||||||
tt.row();
|
tt.row();
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
@@ -686,25 +692,37 @@ public class HudUi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addCoreTable(){
|
public void addCoreTable(){
|
||||||
|
ScrollPane pane = new ScrollPane(new Image(Core.atlas.find("clear")), 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
pane.setOverscroll(false, false);
|
||||||
|
|
||||||
ui.hudGroup.addChild(new Table(table -> {
|
ui.hudGroup.addChild(new Table(table -> {
|
||||||
table.top().left();
|
table.top().right();
|
||||||
|
|
||||||
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> {
|
table.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t -> {
|
||||||
ScrollPane pane = new ScrollPane(new Image(Core.atlas.find("clear")), Styles.smallPane);
|
t.update(() -> {
|
||||||
pane.setScrollingDisabled(true, false);
|
if(coreamount == Vars.player.unit().team().cores().size || !Core.settings.getBool("coreui")) return;
|
||||||
pane.setScrollYForce(scrollPos);
|
t.clearChildren();
|
||||||
pane.update(() -> {
|
t.add(pane).maxHeight(Scl.scl(24 * 8f));
|
||||||
scrollPos = pane.getScrollY();
|
|
||||||
if(!Core.settings.getBool("coreui")) return;
|
|
||||||
pane.clearChildren();
|
|
||||||
pane.removeChild(core);
|
|
||||||
addCore();
|
|
||||||
pane.setWidget(core);
|
|
||||||
});
|
});
|
||||||
pane.setOverscroll(false, false);
|
|
||||||
t.add(pane).maxHeight(Scl.scl(12 * 8f));
|
|
||||||
}){
|
}){
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(float x, float y) {
|
protected void drawBackground(float x, float y) {
|
||||||
@@ -713,7 +731,7 @@ public class HudUi {
|
|||||||
Draw.color(color.r, color.g, color.b, (settings.getInt("coreuiopacity") / 100f) * this.parentAlpha);
|
Draw.color(color.r, color.g, color.b, (settings.getInt("coreuiopacity") / 100f) * this.parentAlpha);
|
||||||
getBackground().draw(x, y, width, height);
|
getBackground().draw(x, y, width, height);
|
||||||
}
|
}
|
||||||
}).padLeft(48 * 8f);
|
}).padRight(24 * 8f);
|
||||||
|
|
||||||
|
|
||||||
table.fillParent = true;
|
table.fillParent = true;
|
||||||
@@ -724,4 +742,140 @@ public class HudUi {
|
|||||||
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getWave(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++){
|
||||||
|
final int j = i;
|
||||||
|
if(state.rules.spawns.find(g -> g.getSpawned(j) > 0) != null) table.table(Tex.underline, t -> {
|
||||||
|
t.add(new Table(tt -> {
|
||||||
|
tt.left();
|
||||||
|
tt.add(new Label(() -> "[#" + Pal.accent.toString() + "]" + j + "[]"));
|
||||||
|
})).width(32f);
|
||||||
|
|
||||||
|
t.table(tx -> {
|
||||||
|
int row = 0;
|
||||||
|
for(SpawnGroup group : state.rules.spawns){
|
||||||
|
if(group.getSpawned(j) <= 0) continue;
|
||||||
|
row ++;
|
||||||
|
tx.add(new Table(tt -> {
|
||||||
|
tt.right();
|
||||||
|
tt.add(new Stack(){{
|
||||||
|
add(new Table(ttt -> {
|
||||||
|
ttt.add(new Image(group.type.icon(Cicon.large)));
|
||||||
|
}));
|
||||||
|
|
||||||
|
add(new Table(ttt -> {
|
||||||
|
ttt.bottom().left();
|
||||||
|
ttt.add(new Label(() -> group.getSpawned(j) + ""));
|
||||||
|
ttt.pack();
|
||||||
|
}));
|
||||||
|
}});
|
||||||
|
|
||||||
|
})).width(Cicon.large.size + 8f);
|
||||||
|
if(row % 4 == 0) tx.row();
|
||||||
|
/*
|
||||||
|
if(group.effect == StatusEffects.boss && group.getSpawned(i) > 0){
|
||||||
|
int diff = (i + 2) - state.wave;
|
||||||
|
|
||||||
|
//increments at which to warn about incoming guardian
|
||||||
|
if(diff == 1 || diff == 2 || diff == 5 || diff == 10){
|
||||||
|
showToast(Icon.warning, Core.bundle.format("wave.guardianwarn" + (diff == 1 ? ".one" : ""), diff));
|
||||||
|
}
|
||||||
|
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
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(6 * 8f);
|
||||||
|
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")), 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollPos = pane.getScrollY();
|
||||||
|
|
||||||
|
if(maxwave == settings.getInt("wavemax") || !Core.settings.getBool("waveui")) return;
|
||||||
|
pane.clearChildren();
|
||||||
|
addWave();
|
||||||
|
pane.setWidget(wave);
|
||||||
|
});
|
||||||
|
pane.setOverscroll(false, false);
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
if(t.getChildren().size > 1) {
|
||||||
|
while(t.getChildren().size == 1) t.getChildren().pop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}){
|
||||||
|
@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(56 * 8f);
|
||||||
|
|
||||||
|
|
||||||
|
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()))));
|
||||||
|
});
|
||||||
|
ui.hudGroup.addChild(waveTable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,6 @@ package UnitInfo.core;
|
|||||||
import UnitInfo.ui.FreeBar;
|
import UnitInfo.ui.FreeBar;
|
||||||
import arc.Core;
|
import arc.Core;
|
||||||
import arc.Events;
|
import arc.Events;
|
||||||
import arc.graphics.Color;
|
|
||||||
import arc.graphics.g2d.Draw;
|
|
||||||
import arc.math.Angles;
|
|
||||||
import arc.math.Mathf;
|
|
||||||
import arc.util.Time;
|
|
||||||
import arc.util.Tmp;
|
|
||||||
import mindustry.Vars;
|
import mindustry.Vars;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.Groups;
|
import mindustry.gen.Groups;
|
||||||
@@ -18,20 +12,18 @@ public class Main extends Mod {
|
|||||||
public static Setting settingAdder = new Setting();
|
public static Setting settingAdder = new Setting();
|
||||||
|
|
||||||
public Main(){
|
public Main(){
|
||||||
float[] unitFade = {0};
|
|
||||||
|
|
||||||
Events.on(ClientLoadEvent.class, e -> {
|
Events.on(ClientLoadEvent.class, e -> {
|
||||||
settingAdder.init();
|
|
||||||
HudUi hud = new HudUi();
|
HudUi hud = new HudUi();
|
||||||
|
settingAdder.init();
|
||||||
hud.addTable();
|
hud.addTable();
|
||||||
hud.addCoreTable();
|
hud.addCoreTable();
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(WorldLoadEvent.class, e -> {
|
Events.on(WorldLoadEvent.class, e -> {
|
||||||
HudUi hud = new HudUi();
|
HudUi hud = new HudUi();
|
||||||
hud.addTable();
|
hud.addWaveTable();
|
||||||
hud.addCoreTable();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.run(Trigger.draw, () -> {
|
Events.run(Trigger.draw, () -> {
|
||||||
if(Core.settings.getBool("unithealthui"))
|
if(Core.settings.getBool("unithealthui"))
|
||||||
Groups.unit.each(unit -> new FreeBar().draw(unit));
|
Groups.unit.each(unit -> new FreeBar().draw(unit));
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
package UnitInfo.core;
|
package UnitInfo.core;
|
||||||
|
|
||||||
import arc.Core;
|
import arc.Core;
|
||||||
|
import arc.Input;
|
||||||
|
import arc.scene.ui.Label;
|
||||||
|
import arc.scene.ui.SettingsDialog;
|
||||||
|
import arc.scene.ui.TextArea;
|
||||||
|
import arc.scene.ui.layout.Scl;
|
||||||
|
import arc.scene.ui.layout.Table;
|
||||||
|
import arc.util.Log;
|
||||||
import mindustry.Vars;
|
import mindustry.Vars;
|
||||||
|
import mindustry.gen.Icon;
|
||||||
|
import mindustry.ui.dialogs.BaseDialog;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static mindustry.Vars.ui;
|
||||||
|
|
||||||
public class Setting {
|
public class Setting {
|
||||||
public void addGraphicSetting(String key){
|
public void addGraphicSetting(String key){
|
||||||
Vars.ui.settings.graphics.checkPref(key, Core.settings.getBool(key));
|
ui.settings.graphics.checkPref(key, Core.settings.getBool(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(){
|
public void init(){
|
||||||
@@ -13,15 +26,90 @@ public class Setting {
|
|||||||
Core.settings.put("uiscalechanged", false);
|
Core.settings.put("uiscalechanged", false);
|
||||||
|
|
||||||
addGraphicSetting("coreui");
|
addGraphicSetting("coreui");
|
||||||
|
addGraphicSetting("waveui");
|
||||||
addGraphicSetting("unitui");
|
addGraphicSetting("unitui");
|
||||||
addGraphicSetting("weaponui");
|
addGraphicSetting("weaponui");
|
||||||
addGraphicSetting("commandedunitui");
|
addGraphicSetting("commandedunitui");
|
||||||
addGraphicSetting("unithealthui");
|
addGraphicSetting("unithealthui");
|
||||||
Vars.ui.settings.graphics.sliderPref("coreuiopacity", 25, 0, 100, 5, s -> s + "%");
|
SettingsDialog.SettingsTable.Setting waveSetting = new SettingsDialog.SettingsTable.Setting() {
|
||||||
Vars.ui.settings.graphics.sliderPref("uiopacity", 50, 0, 100, 5, s -> s + "%");
|
public int def;
|
||||||
Vars.ui.settings.graphics.sliderPref("baropacity", 50, 0, 100, 5, s -> s + "%");
|
{
|
||||||
|
def = 100;
|
||||||
|
name = "wavemax";
|
||||||
|
title = Core.bundle.get("setting.wavemax.name");
|
||||||
|
|
||||||
Core.settings.defaults("coreui", false);
|
Core.settings.defaults(name, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final StringBuilder message = new StringBuilder();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(SettingsDialog.SettingsTable settingsTable) {
|
||||||
|
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 = 0;
|
||||||
|
if(!str.isEmpty() || !(Objects.equals(str, ""))) number = Integer.parseInt(str);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}});
|
||||||
|
}else{
|
||||||
|
BaseDialog dialog = new BaseDialog("@editmaxwave");
|
||||||
|
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 {
|
||||||
|
Core.settings.put(name, Integer.parseInt(a.getText()));
|
||||||
|
label.setText(title + ": " + Integer.parseInt(a.getText()));
|
||||||
|
} 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));
|
||||||
|
|
||||||
|
settingsTable.table((t) -> {
|
||||||
|
t.left().defaults().left();
|
||||||
|
t.add(label).minWidth(label.getPrefWidth() / Scl.scl(1.0F) + 50.0F);
|
||||||
|
t.add(button).size(40F);
|
||||||
|
}).left().padTop(3.0F);
|
||||||
|
settingsTable.row();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ui.settings.graphics.pref(waveSetting);
|
||||||
|
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 + "%");
|
||||||
|
|
||||||
|
Core.settings.defaults("coreui", !Vars.mobile);
|
||||||
|
Core.settings.defaults("waveui", true);
|
||||||
Core.settings.defaults("unitui", true);
|
Core.settings.defaults("unitui", true);
|
||||||
Core.settings.defaults("weaponui", true);
|
Core.settings.defaults("weaponui", true);
|
||||||
Core.settings.defaults("commandedunitui", true);
|
Core.settings.defaults("commandedunitui", true);
|
||||||
|
|||||||
Reference in New Issue
Block a user