mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
h
This commit is contained in:
17
build.bat
17
build.bat
@@ -1,3 +1,14 @@
|
|||||||
del /q C:\Users\lg\AppData\Roaming\Mindustry\mods\UnitInfo.jar;
|
: del /q C:\Users\lg\AppData\Roaming\Mindustry\mods\UnitInfo.jar;
|
||||||
move C:\Users\lg\Documents\GitHub\UnitInfo\build\libs\UnitInfo.jar C:\Users\lg\AppData\Roaming\Mindustry\mods;
|
: move C:\Users\lg\Documents\GitHub\UnitInfo\build\libs\UnitInfo.jar C:\Users\lg\AppData\Roaming\Mindustry\mods;
|
||||||
java -jar C:\Users\lg\Desktop\Mindustry.jar
|
: java -jar C:\Users\lg\Desktop\Mindustry.jar
|
||||||
|
|
||||||
|
|
||||||
|
: del D:\SteamLibrary\steamapps\common\Mindustry\saves\mods\CoreDesktop.jar
|
||||||
|
del C:\Users\lg\AppData\Roaming\Mindustry\mods\UnitInfo.jar
|
||||||
|
: xcopy D:\workspace\Java\Core\build\libs\CoreDesktop.jar D:\SteamLibrary\steamapps\common\Mindustry\saves\mods\ /k
|
||||||
|
xcopy C:\Users\lg\Documents\GitHub\UnitInfo\build\libs\UnitInfo.jar C:\Users\lg\AppData\Roaming\Mindustry\mods\ /k
|
||||||
|
del C:\Users\lg\Documents\GitHub\UnitInfo\build\libs\UnitInfo.jar
|
||||||
|
: cd C:\Users\lg\AppData\Roaming\Mindustry\
|
||||||
|
: java -jar Mindustry.jar
|
||||||
|
: start /max steam://rungameid/1127400
|
||||||
|
: java -jar D:\SteamLibrary\steamapps\common\Mindustry\jre\desktop.jar
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
package UnitInfo.core;
|
package UnitInfo.core;
|
||||||
|
|
||||||
|
import UnitInfo.ui.FreeBar;
|
||||||
import UnitInfo.ui.SBar;
|
import UnitInfo.ui.SBar;
|
||||||
import arc.Core;
|
import arc.Core;
|
||||||
|
import arc.Events;
|
||||||
import arc.func.Func;
|
import arc.func.Func;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.Color;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.math.Angles;
|
||||||
import arc.math.Mathf;
|
import arc.math.Mathf;
|
||||||
|
import arc.math.geom.Vec2;
|
||||||
import arc.scene.Element;
|
import arc.scene.Element;
|
||||||
import arc.scene.style.TransformDrawable;
|
import arc.scene.style.TransformDrawable;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
@@ -22,6 +26,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.EventType;
|
||||||
import mindustry.game.SpawnGroup;
|
import mindustry.game.SpawnGroup;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.Pal;
|
import mindustry.graphics.Pal;
|
||||||
@@ -36,8 +41,6 @@ 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.*;
|
||||||
@@ -57,20 +60,11 @@ public class HudUi {
|
|||||||
float heat2;
|
float heat2;
|
||||||
float scrollPos;
|
float scrollPos;
|
||||||
int maxwave;
|
int maxwave;
|
||||||
|
int savedwave;
|
||||||
int coreamount;
|
int coreamount;
|
||||||
|
float unitFade;
|
||||||
|
|
||||||
public void reset(){
|
Unit unit2;
|
||||||
bars.each(bar -> {
|
|
||||||
weapon = new Table();
|
|
||||||
core = new Table();
|
|
||||||
wave = new Table();
|
|
||||||
waveTable = new Table();
|
|
||||||
|
|
||||||
bar.visible = false;
|
|
||||||
bar.clear();
|
|
||||||
bar.remove();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -516,7 +510,35 @@ public class HudUi {
|
|||||||
tx.setColor(tx.color.cpy().a(1f));
|
tx.setColor(tx.color.cpy().a(1f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float hh;
|
||||||
public void addTable(){
|
public void addTable(){
|
||||||
|
Events.run(EventType.Trigger.draw, () -> {
|
||||||
|
Unit unit = getUnit();
|
||||||
|
unitFade = Mathf.lerpDelta(unitFade, Mathf.num(unit != null), 0.1f);
|
||||||
|
if(unit == null) return;
|
||||||
|
if(unit2 == null || (unit2.x == 0f && unit2.y == 0f)) unit2 = unit;
|
||||||
|
|
||||||
|
Tmp.v1.set(unit2).lerp(unit, Mathf.clamp(Time.delta%60));
|
||||||
|
if(Tmp.v1.x == unit.x && Tmp.v1.y == unit.y){
|
||||||
|
hh += Time.delta;
|
||||||
|
unit2 = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.info("from: (" + unit2.x + ", " + unit2.y + ")" + unit2);
|
||||||
|
Log.info("to: (" + unit.x + ", " + unit.y + ")" + unit);
|
||||||
|
Log.info("tmp: (" + Tmp.v1.x + ", " + Tmp.v1.y + ")" + Tmp.v1);
|
||||||
|
|
||||||
|
for(int i = 0; i < 4; i++){
|
||||||
|
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
||||||
|
float length = unit.hitSize * 1.5f + (unitFade * 2.5f);
|
||||||
|
Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)));
|
||||||
|
Draw.rect("select-arrow", Tmp.v1.x + Angles.trnsx(rot, length), Tmp.v1.y + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ui.hudGroup.addChild(new Table(table -> {
|
ui.hudGroup.addChild(new Table(table -> {
|
||||||
table.left();
|
table.left();
|
||||||
addBars();
|
addBars();
|
||||||
@@ -759,13 +781,12 @@ public class HudUi {
|
|||||||
public void getWave(Table table){
|
public void getWave(Table table){
|
||||||
int winWave = state.isCampaign() && state.rules.winWave > 0 ? state.rules.winWave : Integer.MAX_VALUE;
|
int winWave = state.isCampaign() && state.rules.winWave > 0 ? state.rules.winWave : Integer.MAX_VALUE;
|
||||||
maxwave = settings.getInt("wavemax");
|
maxwave = settings.getInt("wavemax");
|
||||||
|
|
||||||
for(int i = state.wave - 1; i <= Math.min(state.wave + maxwave, winWave - 2); i++){
|
for(int i = state.wave - 1; i <= Math.min(state.wave + maxwave, winWave - 2); i++){
|
||||||
final int j = i;
|
final int j = i;
|
||||||
if(state.rules.spawns.find(g -> g.getSpawned(j) > 0) != null) table.table(Tex.underline, t -> {
|
if(state.rules.spawns.find(g -> g.getSpawned(j) > 0) != null) table.table(Tex.underline, t -> {
|
||||||
t.add(new Table(tt -> {
|
t.add(new Table(tt -> {
|
||||||
tt.left();
|
tt.left();
|
||||||
tt.add(new Label(() -> "[#" + Pal.accent.toString() + "]" + j + "[]"));
|
tt.add(new Label(() -> "[#" + Pal.accent.toString() + "]" + (j + 1) + "[]"));
|
||||||
})).width(32f);
|
})).width(32f);
|
||||||
|
|
||||||
t.table(tx -> {
|
t.table(tx -> {
|
||||||
@@ -883,12 +904,19 @@ public class HudUi {
|
|||||||
|
|
||||||
|
|
||||||
table.fillParent = true;
|
table.fillParent = true;
|
||||||
table.visibility = () ->Core.settings.getBool("waveui") && (
|
table.visibility = () ->Core.settings.getBool("waveui") && (
|
||||||
ui.hudfrag.shown && !ui.minimapfrag.shown()
|
ui.hudfrag.shown && !ui.minimapfrag.shown()
|
||||||
&& (!Vars.mobile ||
|
&& (!Vars.mobile ||
|
||||||
!(Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
!(Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
||||||
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
waveTable.update(() -> {
|
||||||
|
if(Vars.state.isMenu()) {
|
||||||
|
ui.hudGroup.removeChild(waveTable); //h
|
||||||
|
Log.info(savedwave + ", " + state.wave);
|
||||||
|
}
|
||||||
|
});
|
||||||
ui.hudGroup.addChild(waveTable);
|
ui.hudGroup.addChild(waveTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package UnitInfo.core;
|
|||||||
import UnitInfo.ui.FreeBar;
|
import UnitInfo.ui.FreeBar;
|
||||||
import arc.Core;
|
import arc.Core;
|
||||||
import arc.Events;
|
import arc.Events;
|
||||||
|
import mindustry.Vars;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.Groups;
|
import mindustry.gen.Groups;
|
||||||
import mindustry.mod.Mod;
|
import mindustry.mod.Mod;
|
||||||
@@ -20,7 +21,13 @@ public class Main extends Mod {
|
|||||||
hud.addCoreTable();
|
hud.addCoreTable();
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(ResetEvent.class, e -> {
|
Events.on(WorldLoadEvent.class, e -> {
|
||||||
|
hud = new HudUi();
|
||||||
|
hud.addWaveTable();
|
||||||
|
});
|
||||||
|
|
||||||
|
Events.on(WaveEvent.class, e -> {
|
||||||
|
Vars.ui.hudGroup.removeChild(hud.waveTable);
|
||||||
hud = new HudUi();
|
hud = new HudUi();
|
||||||
hud.addWaveTable();
|
hud.addWaveTable();
|
||||||
});
|
});
|
||||||
@@ -28,17 +35,9 @@ public class Main extends Mod {
|
|||||||
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));
|
||||||
|
|
||||||
});
|
});
|
||||||
/*
|
|
||||||
unitFade[0] = Mathf.lerpDelta(unitFade[0], Mathf.num( Vars.player.unit() != null), 0.1f);
|
|
||||||
for(int i = 0; i < 4; i++){
|
|
||||||
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
|
||||||
float length = Vars.player.unit().hitSize() * 1.5f + (unitFade[0] * 2.5f);
|
|
||||||
Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)));
|
|
||||||
Draw.rect("select-arrow", Vars.player.unit().x + Angles.trnsx(rot, length), Vars.player.unit().y + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,23 +20,13 @@ public class Setting {
|
|||||||
public void addGraphicSetting(String key){
|
public void addGraphicSetting(String key){
|
||||||
ui.settings.graphics.checkPref(key, Core.settings.getBool(key));
|
ui.settings.graphics.checkPref(key, Core.settings.getBool(key));
|
||||||
}
|
}
|
||||||
|
public void addGraphicTypeSetting(String key, int defs, String dialogs, String invalid){
|
||||||
public void init(){
|
ui.settings.graphics.pref(new SettingsDialog.SettingsTable.Setting() {
|
||||||
boolean tmp = Core.settings.getBool("uiscalechanged", false);
|
public final int def;
|
||||||
Core.settings.put("uiscalechanged", false);
|
|
||||||
|
|
||||||
addGraphicSetting("coreui");
|
|
||||||
addGraphicSetting("waveui");
|
|
||||||
addGraphicSetting("unitui");
|
|
||||||
addGraphicSetting("weaponui");
|
|
||||||
addGraphicSetting("commandedunitui");
|
|
||||||
addGraphicSetting("unithealthui");
|
|
||||||
SettingsDialog.SettingsTable.Setting waveSetting = new SettingsDialog.SettingsTable.Setting() {
|
|
||||||
public int def;
|
|
||||||
{
|
{
|
||||||
def = 100;
|
def = defs;
|
||||||
name = "wavemax";
|
name = key;
|
||||||
title = Core.bundle.get("setting.wavemax.name");
|
title = Core.bundle.get("setting." + key + ".name", key);
|
||||||
|
|
||||||
Core.settings.defaults(name, def);
|
Core.settings.defaults(name, def);
|
||||||
}
|
}
|
||||||
@@ -70,7 +60,7 @@ public class Setting {
|
|||||||
};
|
};
|
||||||
}});
|
}});
|
||||||
}else{
|
}else{
|
||||||
BaseDialog dialog = new BaseDialog("@editmaxwave");
|
BaseDialog dialog = new BaseDialog(dialogs);
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
TextArea a = dialog.cont.add(new TextArea(message.toString().replace("\r", "\n"))).size(140f, 80f).get();
|
TextArea a = dialog.cont.add(new TextArea(message.toString().replace("\r", "\n"))).size(140f, 80f).get();
|
||||||
a.setMaxLength(String.valueOf(Integer.MAX_VALUE).length());
|
a.setMaxLength(String.valueOf(Integer.MAX_VALUE).length());
|
||||||
@@ -80,7 +70,7 @@ public class Setting {
|
|||||||
label.setText(title + ": " + Integer.parseInt(a.getText()));
|
label.setText(title + ": " + Integer.parseInt(a.getText()));
|
||||||
} catch(Throwable e) {
|
} catch(Throwable e) {
|
||||||
Log.info(e);
|
Log.info(e);
|
||||||
ui.showErrorMessage("@invalid");
|
ui.showErrorMessage(invalid);
|
||||||
|
|
||||||
Core.settings.put(name, def);
|
Core.settings.put(name, def);
|
||||||
label.setText(title + ": " + def);
|
label.setText(title + ": " + def);
|
||||||
@@ -100,9 +90,21 @@ public class Setting {
|
|||||||
}).left().padTop(3.0F);
|
}).left().padTop(3.0F);
|
||||||
settingsTable.row();
|
settingsTable.row();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(){
|
||||||
|
boolean tmp = Core.settings.getBool("uiscalechanged", false);
|
||||||
|
Core.settings.put("uiscalechanged", false);
|
||||||
|
|
||||||
|
addGraphicSetting("coreui");
|
||||||
|
addGraphicSetting("waveui");
|
||||||
|
addGraphicSetting("unitui");
|
||||||
|
addGraphicSetting("weaponui");
|
||||||
|
addGraphicSetting("commandedunitui");
|
||||||
|
addGraphicSetting("unithealthui");
|
||||||
|
addGraphicTypeSetting("wavemax", 100, "@editmaxwave","@invalid");
|
||||||
|
|
||||||
ui.settings.graphics.pref(waveSetting);
|
|
||||||
ui.settings.graphics.sliderPref("coreuiopacity", 50, 0, 100, 5, s -> s + "%");
|
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("waveuiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||||
ui.settings.graphics.sliderPref("uiopacity", 50, 0, 100, 5, s -> s + "%");
|
ui.settings.graphics.sliderPref("uiopacity", 50, 0, 100, 5, s -> s + "%");
|
||||||
|
|||||||
Reference in New Issue
Block a user