mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
rename package
This commit is contained in:
103
src/informatis/SUtils.java
Normal file
103
src/informatis/SUtils.java
Normal file
@@ -0,0 +1,103 @@
|
||||
package informatis;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.Mathf;
|
||||
import arc.scene.style.*;
|
||||
import arc.struct.Seq;
|
||||
import arc.util.*;
|
||||
import mindustry.Vars;
|
||||
import mindustry.core.UI;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.UnitType;
|
||||
import mindustry.type.weapons.*;
|
||||
import mindustry.world.Tile;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import static informatis.SVars.*;
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.player;
|
||||
|
||||
public class SUtils {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Teamc> T getTarget(){
|
||||
if(locked && target != null) {
|
||||
if(settings.getBool("deadTarget") && !Groups.all.contains(e -> e == target)) {
|
||||
target = player.unit();
|
||||
locked = false;
|
||||
}
|
||||
else return (T) target; //if there is locked target, return it first.
|
||||
}
|
||||
|
||||
Seq<Unit> units = Groups.unit.intersect(input.mouseWorldX(), input.mouseWorldY(), 4, 4); // well, 0.5tile is enough to search them
|
||||
if(units.size > 0)
|
||||
return (T) units.peek(); //if there is unit, return it.
|
||||
else if(getTile() != null && getTile().build != null)
|
||||
return (T) getTile().build; //if there isn't unit but there is build, return it.
|
||||
else if(player.unit() instanceof BlockUnitUnit b && b.tile() != null)
|
||||
return (T)b.tile();
|
||||
return (T) player.unit(); //if there aren't unit and not build, return player.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Tile getTile(){
|
||||
return Vars.world.tileWorld(input.mouseWorldX(), input.mouseWorldY());
|
||||
}
|
||||
|
||||
public static Drawable getDrawable(TextureAtlas.AtlasRegion region, int left, int right, int top, int bottom){
|
||||
int[] splits = {left, right, top, bottom};
|
||||
int[] pads = region.pads;
|
||||
NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
|
||||
if(pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]);
|
||||
|
||||
return new ScaledNinePatchDrawable(patch, 1);
|
||||
}
|
||||
|
||||
public static <T extends Number> String formatNumber(T number){
|
||||
return formatNumber(number, 1);
|
||||
}
|
||||
public static <T extends Number> String formatNumber(T number, int step){
|
||||
if(number.intValue() >= 1000) return UI.formatAmount(number.longValue());
|
||||
return Strings.fixed(number.floatValue(), step);
|
||||
}
|
||||
|
||||
public static float bulletRange(BulletType b) {
|
||||
float a = 0;
|
||||
float n = 1;
|
||||
for (int i = 0; i < b.lifetime; i++) {
|
||||
a += n;
|
||||
n *= (1 - b.drag);
|
||||
};
|
||||
a += n;
|
||||
a /= b.lifetime;
|
||||
return b.speed * a * Mathf.pow(1 - b.drag, b.lifetime / 2) * b.lifetime +
|
||||
Math.max(b.lightning > 0 || b instanceof LightningBulletType ? (b.lightningLength + b.lightningLengthRand) * 6 : 0,
|
||||
b.fragBullet != null ? bulletRange(b.fragBullet) * b.fragLifeMax * b.fragVelocityMax : b.splashDamageRadius);
|
||||
}
|
||||
|
||||
public static float unitRange(UnitType u) {
|
||||
final float[] mrng = {0};
|
||||
u.weapons.each(w -> w.bullet != null, w -> {
|
||||
mrng[0] = Math.max(mrng[0], (w instanceof RepairBeamWeapon || w instanceof PointDefenseWeapon) ? 0 : bulletRange(w.bullet));
|
||||
if(mrng[0] == 0) mrng[0] = w.bullet.range;
|
||||
});
|
||||
return mrng[0];
|
||||
}
|
||||
|
||||
public static Object invoke(Object ut, String fieldName) throws IllegalAccessException, NoSuchFieldException {
|
||||
Field field = ut.getClass().getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
return field.get(ut);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isOutCamera(float x, float y) {
|
||||
return !isInCamera(x, y, 0);
|
||||
}
|
||||
|
||||
public static boolean isInCamera(float x, float y, float size) {
|
||||
Tmp.r2.setCentered(x, y, size);
|
||||
return Tmp.r1.overlaps(Tmp.r2);
|
||||
}
|
||||
}
|
||||
16
src/informatis/SVars.java
Normal file
16
src/informatis/SVars.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package informatis;
|
||||
|
||||
import informatis.shaders.*;
|
||||
import arc.graphics.g2d.TextureRegion;
|
||||
import mindustry.gen.Teamc;
|
||||
|
||||
import static arc.Core.atlas;
|
||||
|
||||
public class SVars {
|
||||
public static TextureRegion clear = atlas.find("clear");
|
||||
public static TextureRegion error = atlas.find("error");
|
||||
public static RangeShader turretRange = new RangeShader();
|
||||
public static Teamc target;
|
||||
public static boolean locked;
|
||||
public static float uiResumeRate = 3 * 60f; //default 3s
|
||||
}
|
||||
228
src/informatis/core/BarInfo.java
Normal file
228
src/informatis/core/BarInfo.java
Normal file
@@ -0,0 +1,228 @@
|
||||
package informatis.core;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.TextureRegion;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.abilities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.defense.*;
|
||||
import mindustry.world.blocks.defense.turrets.*;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
import mindustry.world.blocks.units.*;
|
||||
import mindustry.world.consumers.*;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import static informatis.SUtils.*;
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
import static informatis.SVars.*;
|
||||
import static informatis.ui.SIcons.*;
|
||||
|
||||
public class BarInfo {
|
||||
public static Seq<BarData> data = new Seq<>();
|
||||
|
||||
public static <T extends Teamc> void getInfo(T target) throws IllegalAccessException, NoSuchFieldException {
|
||||
data.clear();
|
||||
|
||||
if(target instanceof Healthc){
|
||||
Healthc healthc = (Healthc) target;
|
||||
float pro = healthc.health();
|
||||
data.add(new BarData(bundle.format("shar-stat.health", formatNumber(pro)), Pal.health, pro, health));
|
||||
}
|
||||
|
||||
if(target instanceof Unit unit){
|
||||
float max = ((ShieldRegenFieldAbility) content.units().copy().max(ut -> {
|
||||
ShieldRegenFieldAbility ability = (ShieldRegenFieldAbility) ut.abilities.find(ab -> ab instanceof ShieldRegenFieldAbility);
|
||||
if(ability == null) return 0;
|
||||
return ability.max;
|
||||
}).abilities.find(abil -> abil instanceof ShieldRegenFieldAbility)).max;
|
||||
//float commands = Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == target);
|
||||
|
||||
data.add(new BarData(bundle.format("shar-stat.shield", formatNumber(unit.shield())), Pal.surge, unit.shield() / max, shield));
|
||||
data.add(new BarData(bundle.format("shar-stat.capacity", unit.stack.item.localizedName, formatNumber(unit.stack.amount), formatNumber(unit.type.itemCapacity)), unit.stack.amount > 0 && unit.stack().item != null ? unit.stack.item.color.cpy().lerp(Color.white, 0.15f) : Color.white, unit.stack.amount / (unit.type.itemCapacity * 1f), item));
|
||||
//data.add(new BarData(bundle.format("shar-stat.commandUnits", formatNumber(commands), formatNumber(unit.type().commandLimit)), Pal.powerBar.cpy().lerp(Pal.surge.cpy().mul(Pal.lighterOrange), Mathf.absin(Time.time, 7f / (1f + Mathf.clamp(commands / (unit.type().commandLimit * 1f))), 1f)), commands / (unit.type().commandLimit * 1f)));
|
||||
if(target instanceof Payloadc pay) data.add(new BarData(bundle.format("shar-stat.payloadCapacity", formatNumber(Mathf.round(Mathf.sqrt(pay.payloadUsed()))), formatNumber(Mathf.round(Mathf.sqrt(unit.type().payloadCapacity)))), Pal.items, pay.payloadUsed() / unit.type().payloadCapacity));
|
||||
if(state.rules.unitAmmo) data.add(new BarData(bundle.format("shar-stat.ammos", formatNumber(unit.ammo()), formatNumber(unit.type().ammoCapacity)), unit.type().ammoType.color(), unit.ammof()));
|
||||
}
|
||||
|
||||
else if(target instanceof Building build){
|
||||
if(build.block.hasLiquids) data.add(new BarData(bundle.format("shar-stat.capacity", build.liquids.currentAmount() < 0.01f ? build.liquids.current().localizedName : bundle.get("bar.liquid"), formatNumber(build.liquids.currentAmount()), formatNumber(build.block.liquidCapacity)), build.liquids.current().color, build.liquids.currentAmount() / build.block.liquidCapacity, liquid));
|
||||
|
||||
if(build.block.hasPower && build.block.consumesPower){
|
||||
ConsumePower cons = build.block.consPower;
|
||||
data.add(new BarData(bundle.format("shar-stat.power", formatNumber(build.power.status * 60f * (cons.buffered ? cons.capacity : cons.usage)), formatNumber(60f * (cons.buffered ? cons.capacity : cons.usage))), Pal.powerBar, Mathf.zero(cons.requestedPower(build)) && build.power.graph.getPowerProduced() + build.power.graph.getBatteryStored() > 0f ? 1f : build.power.status, power));
|
||||
}
|
||||
if(build.block.hasItems) {
|
||||
float value;
|
||||
if (target instanceof CoreBlock.CoreBuild cb) value = cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow);
|
||||
else if(target instanceof StorageBlock.StorageBuild sb && !sb.canPickup() && sb.linkedCore instanceof CoreBlock.CoreBuild cb) value = cb.storageCapacity * content.items().count(UnlockableContent::unlockedNow);
|
||||
else value = build.block.itemCapacity;
|
||||
data.add(new BarData(bundle.format("shar-stat.capacity", bundle.get("category.items"), formatNumber(build.items.total()), value), Pal.items, build.items.total() / value, item));
|
||||
}
|
||||
}
|
||||
|
||||
if(target instanceof ReloadTurret.ReloadTurretBuild || target instanceof MassDriver.MassDriverBuild){
|
||||
float pro;
|
||||
if(target instanceof ReloadTurret.ReloadTurretBuild turret) pro = turret.reloadCounter / ((Turret)turret.block).reload;
|
||||
else {
|
||||
MassDriver.MassDriverBuild mass = (MassDriver.MassDriverBuild) target;
|
||||
pro = mass.reloadCounter;
|
||||
}
|
||||
data.add(new BarData(bundle.format("shar-stat.reload", formatNumber(pro * 100f)), Pal.accent.cpy().lerp(Color.orange, pro), pro, reload));
|
||||
}
|
||||
|
||||
if(target instanceof ForceProjector.ForceBuild force){
|
||||
ForceProjector forceBlock = (ForceProjector) force.block;
|
||||
float max = forceBlock.shieldHealth + forceBlock.phaseShieldBoost * force.phaseHeat;
|
||||
data.add(new BarData(bundle.format("shar-stat.shield", formatNumber(max-force.buildup), formatNumber(max)), Pal.shield, (max-force.buildup)/max, shield));
|
||||
}
|
||||
|
||||
if(target instanceof MendProjector.MendBuild || target instanceof OverdriveProjector.OverdriveBuild || target instanceof ConstructBlock.ConstructBuild || target instanceof Reconstructor.ReconstructorBuild || target instanceof UnitFactory.UnitFactoryBuild || target instanceof Drill.DrillBuild || target instanceof GenericCrafter.GenericCrafterBuild) {
|
||||
float pro;
|
||||
if(target instanceof MendProjector.MendBuild mend){
|
||||
pro = (float) mend.sense(LAccess.progress);
|
||||
Tmp.c1.set(Pal.heal);
|
||||
}
|
||||
else if(target instanceof OverdriveProjector.OverdriveBuild over){
|
||||
OverdriveProjector block = (OverdriveProjector)over.block;
|
||||
Field ohno = OverdriveProjector.OverdriveBuild.class.getDeclaredField("charge");
|
||||
ohno.setAccessible(true);
|
||||
pro = (float) ohno.get(over)/((OverdriveProjector)over.block).reload;
|
||||
Tmp.c1.set(Color.valueOf("feb380"));
|
||||
|
||||
data.add(new BarData(bundle.format("bar.boost", (int)(over.realBoost() * 100)), Pal.accent, over.realBoost() / (block.hasBoost ? block.speedBoost + block.speedBoostPhase : block.speedBoost)));
|
||||
}
|
||||
else if(target instanceof ConstructBlock.ConstructBuild construct){
|
||||
pro = construct.progress;
|
||||
Tmp.c1.set(Pal.darkerMetal);
|
||||
}
|
||||
else if(target instanceof UnitFactory.UnitFactoryBuild factory){
|
||||
pro = factory.fraction();
|
||||
Tmp.c1.set(Pal.darkerMetal);
|
||||
|
||||
if(factory.unit() == null) data.add(new BarData("[lightgray]" + Iconc.cancel, Pal.power, 0f));
|
||||
else {
|
||||
float value = factory.team.data().countType(factory.unit());
|
||||
data.add(new BarData(bundle.format("bar.unitcap", Fonts.getUnicodeStr(factory.unit().name), formatNumber(value), formatNumber(Units.getCap(factory.team))), Pal.power, value / Units.getCap(factory.team)));
|
||||
}
|
||||
}
|
||||
else if(target instanceof Reconstructor.ReconstructorBuild reconstruct){
|
||||
pro = reconstruct.fraction();
|
||||
Tmp.c1.set(Pal.darkerMetal);
|
||||
|
||||
if(reconstruct.unit() == null) data.add(new BarData("[lightgray]" + Iconc.cancel, Pal.power, 0f));
|
||||
else {
|
||||
float value = reconstruct.team.data().countType(reconstruct.unit());
|
||||
data.add(new BarData(bundle.format("bar.unitcap", Fonts.getUnicodeStr(reconstruct.unit().name), formatNumber(value), formatNumber(Units.getCap(reconstruct.team))), Pal.power, value / Units.getCap(reconstruct.team)));
|
||||
}
|
||||
|
||||
}
|
||||
else if(target instanceof Drill.DrillBuild drill){
|
||||
pro = (float) drill.sense(LAccess.progress);
|
||||
Tmp.c1.set(drill.dominantItem == null ? Pal.items : drill.dominantItem.color);
|
||||
|
||||
data.add(new BarData(bundle.format("bar.drillspeed", formatNumber(drill.lastDrillSpeed * 60 * drill.timeScale())), Pal.ammo, drill.warmup));
|
||||
}
|
||||
else {
|
||||
GenericCrafter.GenericCrafterBuild crafter = (GenericCrafter.GenericCrafterBuild) target;
|
||||
GenericCrafter block = (GenericCrafter) crafter.block;
|
||||
|
||||
pro = (float) crafter.sense(LAccess.progress);
|
||||
if(block.outputItem != null) Tmp.c1.set(block.outputItem.item.color);
|
||||
else if(block.outputLiquid != null) Tmp.c1.set(block.outputLiquid.liquid.color);
|
||||
else Tmp.c1.set(Pal.items);
|
||||
}
|
||||
|
||||
data.add(new BarData(bundle.format("shar-stat.progress", formatNumber(pro * 100f)), Tmp.c1, pro));
|
||||
}
|
||||
|
||||
if(target instanceof PowerGenerator.GeneratorBuild generator){
|
||||
data.add(new BarData(bundle.format("shar-stat.powerIn", formatNumber(generator.getPowerProduction() * generator.timeScale() * 60f)), Pal.powerBar, generator.productionEfficiency, power));
|
||||
}
|
||||
|
||||
if(target instanceof PowerNode.PowerNodeBuild || target instanceof PowerTurret.PowerTurretBuild) {
|
||||
float value, max;
|
||||
if(target instanceof PowerNode.PowerNodeBuild node){
|
||||
max = node.power.graph.getLastPowerStored();
|
||||
value = node.power.graph.getLastCapacity();
|
||||
|
||||
data.add(new BarData(bundle.format("bar.powerlines", node.power.links.size, ((PowerNode)node.block).maxNodes), Pal.items, (float)node.power.links.size / (float)((PowerNode)node.block).maxNodes));
|
||||
data.add(new BarData(bundle.format("shar-stat.powerOut", "-" + formatNumber(node.power.graph.getLastScaledPowerOut() * 60f)), Pal.powerBar, node.power.graph.getLastScaledPowerOut() / node.power.graph.getLastScaledPowerIn(), power));
|
||||
data.add(new BarData(bundle.format("shar-stat.powerIn", formatNumber(node.power.graph.getLastScaledPowerIn() * 60f)), Pal.powerBar, node.power.graph.getLastScaledPowerIn() / node.power.graph.getLastScaledPowerOut(), power));
|
||||
data.add(new BarData(bundle.format("bar.powerbalance", (node.power.graph.getPowerBalance() >= 0 ? "+" : "") + formatNumber(node.power.graph.getPowerBalance() * 60)), Pal.powerBar, node.power.graph.getLastPowerProduced() / node.power.graph.getLastPowerNeeded(), power));
|
||||
}
|
||||
else { //TODO: why is this different
|
||||
PowerTurret.PowerTurretBuild turret = (PowerTurret.PowerTurretBuild) target;
|
||||
max = turret.block.consPower.usage;
|
||||
value = turret.power.status * turret.power.graph.getLastScaledPowerIn();
|
||||
}
|
||||
|
||||
data.add(new BarData(bundle.format("shar-stat.power", formatNumber(Math.max(value, max) * 60), formatNumber(max * 60)), Pal.power, value / max));
|
||||
}
|
||||
|
||||
if(target instanceof ItemTurret.ItemTurretBuild turret) {
|
||||
ItemTurret block = (ItemTurret)turret.block;
|
||||
data.add(new BarData(bundle.format("shar-stat.capacity", turret.hasAmmo() ? block.ammoTypes.findKey(turret.peekAmmo(), true).localizedName : bundle.get("stat.ammo"), formatNumber(turret.totalAmmo), formatNumber(block.maxAmmo)), turret.hasAmmo() ? block.ammoTypes.findKey(turret.peekAmmo(), true).color : Pal.ammo, turret.totalAmmo / (float)block.maxAmmo, ammo));
|
||||
}
|
||||
|
||||
if(target instanceof LiquidTurret.LiquidTurretBuild turret){
|
||||
data.add(new BarData(bundle.format("shar-stat.capacity", turret.liquids.currentAmount() < 0.01f ? turret.liquids.current().localizedName : bundle.get("stat.ammo"), formatNumber(turret.liquids.get(turret.liquids.current())), formatNumber(turret.block.liquidCapacity)), turret.liquids.current().color, turret.liquids.get(turret.liquids.current()) / turret.block.liquidCapacity, liquid));
|
||||
}
|
||||
|
||||
if(target instanceof AttributeCrafter.AttributeCrafterBuild || target instanceof ThermalGenerator.ThermalGeneratorBuild || (target instanceof SolidPump.SolidPumpBuild crafter && ((SolidPump)crafter.block).attribute != null)) {
|
||||
float display, pro;
|
||||
if (target instanceof AttributeCrafter.AttributeCrafterBuild crafter) {
|
||||
AttributeCrafter block = (AttributeCrafter) crafter.block;
|
||||
display = (block.baseEfficiency + Math.min(block.maxBoost, block.boostScale * block.sumAttribute(block.attribute, crafter.tileX(), crafter.tileY()))) * 100f;
|
||||
pro = block.boostScale * crafter.attrsum / block.maxBoost;
|
||||
}
|
||||
else if (target instanceof ThermalGenerator.ThermalGeneratorBuild thermal) {
|
||||
ThermalGenerator block = (ThermalGenerator) thermal.block;
|
||||
float max = content.blocks().max(b -> b instanceof Floor f && f.attributes != null ? f.attributes.get(block.attribute) : 0).asFloor().attributes.get(block.attribute);
|
||||
display = block.sumAttribute(block.attribute, thermal.tileX(), thermal.tileY()) * 100;
|
||||
pro = block.sumAttribute(block.attribute, thermal.tileX(), thermal.tileY()) / block.size / block.size / max;
|
||||
}
|
||||
else {
|
||||
SolidPump.SolidPumpBuild crafter = (SolidPump.SolidPumpBuild) target;
|
||||
SolidPump block = (SolidPump) crafter.block;
|
||||
float fraction = Math.max(crafter.validTiles + crafter.boost + (block.attribute == null ? 0 : block.attribute.env()), 0);
|
||||
float max = content.blocks().max(b -> b instanceof Floor f && f.attributes != null ? f.attributes.get(block.attribute) : 0).asFloor().attributes.get(block.attribute);
|
||||
display = Math.max(block.sumAttribute(block.attribute, crafter.tileX(), crafter.tileY()) / block.size / block.size + block.baseEfficiency, 0f) * 100 * block.percentSolid(crafter.tileX(), crafter.tileY());
|
||||
pro = fraction / max;
|
||||
}
|
||||
|
||||
data.add(new BarData(bundle.format("shar-stat.attr", Mathf.round(display)), Pal.ammo, pro));
|
||||
}
|
||||
}
|
||||
|
||||
public static class BarData {
|
||||
public String name;
|
||||
public Color color;
|
||||
public float number;
|
||||
public TextureRegion icon = clear;
|
||||
|
||||
BarData(String name, Color color, float number) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
BarData(String name, Color color, float number, TextureRegion icon) {
|
||||
this(name, color, number);
|
||||
this.icon = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
267
src/informatis/core/EditorTool.java
Normal file
267
src/informatis/core/EditorTool.java
Normal file
@@ -0,0 +1,267 @@
|
||||
package informatis.core;
|
||||
|
||||
import arc.func.Boolf;
|
||||
import arc.func.Cons;
|
||||
import arc.input.KeyCode;
|
||||
import arc.math.Mathf;
|
||||
import arc.math.geom.Bresenham2;
|
||||
import arc.math.geom.Point2;
|
||||
import arc.struct.IntSeq;
|
||||
import arc.util.Structs;
|
||||
import mindustry.content.Blocks;
|
||||
import mindustry.game.Team;
|
||||
import mindustry.world.Block;
|
||||
import mindustry.world.Tile;
|
||||
import informatis.ui.window.*;
|
||||
|
||||
import static informatis.ui.window.MapEditorWindow.*;
|
||||
import static informatis.ui.window.Windows.editorTable;
|
||||
import static mindustry.Vars.world;
|
||||
|
||||
public enum EditorTool{
|
||||
zoom(KeyCode.v),
|
||||
pick(KeyCode.i){
|
||||
public void touched(int x, int y){
|
||||
if(!Structs.inBounds(x, y, world.width(), world.height())) return;
|
||||
|
||||
Tile tile = world.tile(x, y);
|
||||
drawBlock = tile.block() == Blocks.air || !tile.block().inEditor ? tile.overlay() == Blocks.air ? tile.floor() : tile.overlay() : tile.block();
|
||||
}
|
||||
},
|
||||
line(KeyCode.l, "replace", "orthogonal"){
|
||||
|
||||
@Override
|
||||
public void touchedLine(int x1, int y1, int x2, int y2){
|
||||
//straight
|
||||
if(mode == 1){
|
||||
if(Math.abs(x2 - x1) > Math.abs(y2 - y1)){
|
||||
y2 = y1;
|
||||
}else{
|
||||
x2 = x1;
|
||||
}
|
||||
}
|
||||
|
||||
Bresenham2.line(x1, y1, x2, y2, (x, y) -> {
|
||||
if(mode == 0){
|
||||
//replace
|
||||
editorTable.drawBlocksReplace(x, y);
|
||||
}else{
|
||||
//normal
|
||||
editorTable.drawBlocks(x, y);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
pencil(KeyCode.b, "replace", "square", "drawteams"){
|
||||
{
|
||||
edit = true;
|
||||
draggable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touched(int x, int y){
|
||||
if(mode == -1){
|
||||
//normal mode
|
||||
editorTable.drawBlocks(x, y);
|
||||
}else if(mode == 0){
|
||||
//replace mode
|
||||
editorTable.drawBlocksReplace(x, y);
|
||||
}else if(mode == 1){
|
||||
//square mode
|
||||
editorTable.drawBlocks(x, y, true, tile -> true);
|
||||
}else if(mode == 2){
|
||||
//draw teams
|
||||
editorTable.drawCircle(x, y, tile -> tile.setTeam(drawTeam));
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
eraser(KeyCode.e, "eraseores"){
|
||||
{
|
||||
edit = true;
|
||||
draggable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touched(int x, int y){
|
||||
editorTable.drawCircle(x, y, tile -> {
|
||||
if(mode == -1){
|
||||
//erase block
|
||||
tile.remove();
|
||||
}else if(mode == 0){
|
||||
//erase ore
|
||||
tile.clearOverlay();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fill(KeyCode.g, "replaceall", "fillteams"){
|
||||
{
|
||||
edit = true;
|
||||
}
|
||||
|
||||
IntSeq stack = new IntSeq();
|
||||
|
||||
@Override
|
||||
public void touched(int x, int y){
|
||||
if(!Structs.inBounds(x, y, world.width(), world.height()) || world.tile(x, y).block()!=null&&world.tile(x, y).block().isMultiblock()) return;
|
||||
Tile tile = world.tile(x, y);
|
||||
|
||||
//mode 0 or 1, fill everything with the floor/tile or replace it
|
||||
if(mode == 0 || mode == -1){
|
||||
if(tile.block().isMultiblock()) return;
|
||||
|
||||
Boolf<Tile> tester;
|
||||
Cons<Tile> setter;
|
||||
Block drawBlock = MapEditorWindow.drawBlock;
|
||||
|
||||
if(drawBlock.isOverlay()){
|
||||
Block dest = tile.overlay();
|
||||
if(dest == drawBlock) return;
|
||||
tester = t -> t.overlay() == dest && (t.floor().hasSurface() || !t.floor().needsSurface);
|
||||
setter = t -> t.setOverlay(drawBlock);
|
||||
}else if(drawBlock.isFloor()){
|
||||
Block dest = tile.floor();
|
||||
if(dest == drawBlock) return;
|
||||
tester = t -> t.floor() == dest;
|
||||
setter = t -> t.setFloorUnder(drawBlock.asFloor());
|
||||
}else{
|
||||
Block dest = tile.block();
|
||||
if(dest == drawBlock) return;
|
||||
tester = t -> t.block() == dest;
|
||||
setter = t -> t.setBlock(drawBlock, drawTeam);
|
||||
}
|
||||
|
||||
//replace only when the mode is 0 using the specified functions
|
||||
fill(x, y, mode == 0, tester, setter);
|
||||
}else if(mode == 1){ //mode 1 is team fill
|
||||
//only fill synthetic blocks, it's meaningless otherwise
|
||||
if(tile.synthetic()){
|
||||
Team dest = tile.team();
|
||||
if(dest == drawTeam) return;
|
||||
fill(x, y, false, t -> t.getTeamID() == dest.id && t.synthetic(), t -> t.setTeam(drawTeam));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fill(int x, int y, boolean replace, Boolf<Tile> tester, Cons<Tile> filler){
|
||||
int width = world.width(), height = world.height();
|
||||
|
||||
if(replace){
|
||||
//just do it on everything
|
||||
for(int cx = 0; cx < width; cx++){
|
||||
for(int cy = 0; cy < height; cy++){
|
||||
Tile tile = world.tile(cx, cy);
|
||||
if(tester.get(tile)){
|
||||
filler.get(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
//perform flood fill
|
||||
int x1;
|
||||
|
||||
stack.clear();
|
||||
stack.add(Point2.pack(x, y));
|
||||
|
||||
try{
|
||||
while(stack.size > 0 && stack.size < width*height){
|
||||
int popped = stack.pop();
|
||||
x = Point2.x(popped);
|
||||
y = Point2.y(popped);
|
||||
|
||||
x1 = x;
|
||||
while(x1 >= 0 && tester.get(world.tile(x1, y))) x1--;
|
||||
x1++;
|
||||
boolean spanAbove = false, spanBelow = false;
|
||||
while(x1 < width && tester.get(world.tile(x1, y))){
|
||||
filler.get(world.tile(x1, y));
|
||||
|
||||
if(!spanAbove && y > 0 && tester.get(world.tile(x1, y - 1))){
|
||||
stack.add(Point2.pack(x1, y - 1));
|
||||
spanAbove = true;
|
||||
}else if(spanAbove && !tester.get(world.tile(x1, y - 1))){
|
||||
spanAbove = false;
|
||||
}
|
||||
|
||||
if(!spanBelow && y < height - 1 && tester.get(world.tile(x1, y + 1))){
|
||||
stack.add(Point2.pack(x1, y + 1));
|
||||
spanBelow = true;
|
||||
}else if(spanBelow && y < height - 1 && !tester.get(world.tile(x1, y + 1))){
|
||||
spanBelow = false;
|
||||
}
|
||||
x1++;
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
}catch(OutOfMemoryError e){
|
||||
//hack
|
||||
stack = null;
|
||||
System.gc();
|
||||
e.printStackTrace();
|
||||
stack = new IntSeq();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
spray(KeyCode.r, "replace"){
|
||||
final double chance = 0.012;
|
||||
|
||||
{
|
||||
edit = true;
|
||||
draggable = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touched(int x, int y){
|
||||
//floor spray
|
||||
if(drawBlock.isFloor()){
|
||||
editorTable.drawCircle(x, y, tile -> {
|
||||
if(Mathf.chance(chance)){
|
||||
tile.setFloor(drawBlock.asFloor());
|
||||
}
|
||||
});
|
||||
}else if(mode == 0){ //replace-only mode, doesn't affect air
|
||||
editorTable.drawBlocks(x, y, tile -> Mathf.chance(chance) && tile.block() != Blocks.air);
|
||||
}else{
|
||||
editorTable.drawBlocks(x, y, tile -> Mathf.chance(chance));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static final EditorTool[] all = values();
|
||||
|
||||
/** All the internal alternate placement modes of this tool. */
|
||||
public final String[] altModes;
|
||||
/** Key to activate this tool. */
|
||||
public KeyCode key = KeyCode.unset;
|
||||
/** The current alternate placement mode. -1 is the standard mode, no changes.*/
|
||||
public int mode = -1;
|
||||
/** Whether this tool causes canvas changes when touched.*/
|
||||
public boolean edit;
|
||||
/** Whether this tool should be dragged across the canvas when the mouse moves.*/
|
||||
public boolean draggable;
|
||||
|
||||
EditorTool(){
|
||||
this(new String[]{});
|
||||
}
|
||||
|
||||
EditorTool(KeyCode code){
|
||||
this(new String[]{});
|
||||
this.key = code;
|
||||
}
|
||||
|
||||
EditorTool(String... altModes){
|
||||
this.altModes = altModes;
|
||||
}
|
||||
|
||||
EditorTool(KeyCode code, String... altModes){
|
||||
this.altModes = altModes;
|
||||
this.key = code;
|
||||
}
|
||||
|
||||
public void touched(int x, int y){}
|
||||
|
||||
public void touchedLine(int x1, int y1, int x2, int y2){}
|
||||
}
|
||||
58
src/informatis/core/Main.java
Normal file
58
src/informatis/core/Main.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package informatis.core;
|
||||
|
||||
import arc.input.KeyCode;
|
||||
import informatis.ui.*;
|
||||
import informatis.ui.draws.OverDraws;
|
||||
import informatis.ui.window.*;
|
||||
import arc.*;
|
||||
import mindustry.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.mod.*;
|
||||
|
||||
import static informatis.SVars.*;
|
||||
import static arc.Core.*;
|
||||
import static informatis.SUtils.*;
|
||||
import static informatis.ui.WindowManager.windows;
|
||||
|
||||
public class Main extends Mod {
|
||||
@Override
|
||||
public void init(){
|
||||
Core.app.post(() -> {
|
||||
Mods.ModMeta meta = Vars.mods.locateMod("informatis").meta;
|
||||
meta.displayName = "[#B5FFD9]Informatis[]";
|
||||
meta.author = "[#B5FFD9]Sharlotte[lightgray]#0018[][]";
|
||||
meta.description = bundle.get("shar-description");
|
||||
});
|
||||
|
||||
Events.run(Trigger.update, () -> {
|
||||
try {
|
||||
BarInfo.getInfo(getTarget());
|
||||
} catch (IllegalAccessException | NoSuchFieldException err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
target = getTarget();
|
||||
|
||||
for (Window window : windows) {
|
||||
if(window instanceof Updatable u) u.update();
|
||||
}
|
||||
|
||||
if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))) {
|
||||
if(input.keyTap(KeyCode.r)) {
|
||||
if(target==getTarget()) locked = !locked;
|
||||
target = getTarget();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(ClientLoadEvent.class, e -> {
|
||||
Windows.load();
|
||||
|
||||
SettingS.init();
|
||||
WindowManager.init();
|
||||
DisplayManager.init();
|
||||
OverDraws.init();
|
||||
OverDrawer.init();
|
||||
});
|
||||
}
|
||||
}
|
||||
70
src/informatis/core/OverDrawer.java
Normal file
70
src/informatis/core/OverDrawer.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package informatis.core;
|
||||
|
||||
import informatis.ui.draws.*;
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
import static informatis.SVars.*;
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class OverDrawer {
|
||||
|
||||
public static void init(){
|
||||
Events.run(EventType.Trigger.draw, () -> {
|
||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||
|
||||
Draw.z(Layer.max);
|
||||
if(settings.getBool("spawnerarrow")) {
|
||||
float leng = (player.unit() != null && player.unit().hitSize > 4 * 8f ? player.unit().hitSize * 1.5f : 4 * 8f) + sin;
|
||||
Tmp.v1.set(camera.position);
|
||||
Lines.stroke(1f + sin / 2, Pal.accent);
|
||||
Lines.circle(Tmp.v1.x, Tmp.v1.y, leng - 4f);
|
||||
spawner.getSpawns().each(t -> Drawf.arrow(Tmp.v1.x, Tmp.v1.y, t.worldx(), t.worldy(), leng, (Math.min(200 * 8f, Mathf.dst(Tmp.v1.x, Tmp.v1.y, t.worldx(), t.worldy())) / (200 * 8f)) * (5f + sin)));
|
||||
}
|
||||
|
||||
if(settings.getBool("select")) {
|
||||
Draw.color(Tmp.c1.set(locked ? Color.orange : Color.darkGray).lerp(locked ? Color.scarlet : Color.gray, Mathf.absin(Time.time, 3f, 1f)).a(settings.getInt("selectopacity") / 100f));
|
||||
float length = (target instanceof Unit u ? u.hitSize : target instanceof Building b ? b.block.size * tilesize : 0) * 1.5f + 2.5f;
|
||||
for(int i = 0; i < 4; i++){
|
||||
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
||||
Draw.rect("select-arrow", target.x() + Angles.trnsx(rot, length), target.y() + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
||||
}
|
||||
}
|
||||
|
||||
if(settings.getBool("distanceLine")) {
|
||||
Posc from = player;
|
||||
Position to = target;
|
||||
if(to == from || to == null) to = input.mouseWorld();
|
||||
if(player.unit() instanceof BlockUnitUnit bu) Tmp.v1.set(bu.x() + bu.tile().block.offset, bu.y() + bu.tile().block.offset).sub(to.getX(), to.getY()).limit(bu.tile().block.size * tilesize + sin + 0.5f);
|
||||
else Tmp.v1.set(from.x(), from.y()).sub(to.getX(), to.getY()).limit((player.unit()==null?0:player.unit().hitSize) + sin + 0.5f);
|
||||
|
||||
float x2 = from.x() - Tmp.v1.x, y2 = from.y() - Tmp.v1.y, x1 = to.getX() + Tmp.v1.x, y1 = to.getY() + Tmp.v1.y;
|
||||
int segs = (int) (to.dst(from.x(), from.y()) / tilesize);
|
||||
if(segs > 0){
|
||||
Lines.stroke(2.5f, Pal.gray);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
Lines.stroke(1f, Pal.placing);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
|
||||
Fonts.outline.draw(Strings.fixed(to.dst(from.x(), from.y()), 2) + " (" + segs + " " + bundle.get("tiles") + ")",
|
||||
from.x() + Angles.trnsx(Angles.angle(from.x(), from.y(), to.getX(), to.getY()), player.unit().hitSize() + Math.min(segs, 6) * 8f),
|
||||
from.y() + Angles.trnsy(Angles.angle(from.x(), from.y(), to.getX(), to.getY()), player.unit().hitSize() + Math.min(segs, 6) * 8f) - 3,
|
||||
Pal.accent, 0.25f, false, Align.center);
|
||||
}
|
||||
}
|
||||
|
||||
//global drawing, which needs camera-clipping
|
||||
Core.camera.bounds(Tmp.r1);
|
||||
for(OverDraw drawer : OverDraws.all) drawer.draw();
|
||||
});
|
||||
}
|
||||
}
|
||||
154
src/informatis/core/SettingS.java
Normal file
154
src/informatis/core/SettingS.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package informatis.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.ui.*;
|
||||
import mindustry.ui.dialogs.*;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class SettingS {
|
||||
public static SettingsMenuDialog.SettingsTable sharset;
|
||||
|
||||
public static void addGraphicCheckSetting(String key, boolean def, Seq<SharSetting> list){
|
||||
list.add(new SharSetting(key, def) {
|
||||
|
||||
@Override
|
||||
public void add(Table table) {
|
||||
CheckBox box = new CheckBox(title);
|
||||
box.update(() -> box.setChecked(settings.getBool(name)));
|
||||
box.changed(() -> settings.put(name, box.isChecked()));
|
||||
|
||||
box.left();
|
||||
addDesc(table.add(box).left().padTop(3f).get());
|
||||
table.row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void addGraphicSlideSetting(String key, int def, int min, int max, int step, SettingsMenuDialog.StringProcessor sp, Seq<SharSetting> list){
|
||||
list.add(new SharSetting(key, def) {
|
||||
|
||||
@Override
|
||||
public void add(Table table){
|
||||
|
||||
Label value = new Label("", Styles.outlineLabel);
|
||||
Table content = new Table();
|
||||
content.add(title, Styles.outlineLabel).left().growX().wrap();
|
||||
content.add(value).padLeft(10f).right();
|
||||
content.margin(3f, 33f, 3f, 33f);
|
||||
content.touchable = Touchable.disabled;
|
||||
|
||||
Slider slider = new Slider(min, max, step, false);
|
||||
slider.setValue(settings.getInt(name));
|
||||
slider.changed(() -> {
|
||||
settings.put(name, (int)slider.getValue());
|
||||
value.setText(sp.get((int)slider.getValue()));
|
||||
});
|
||||
slider.change();
|
||||
|
||||
addDesc(table.stack(slider, content).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4f).get());
|
||||
table.row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static 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(Table table) {
|
||||
final String[] str = {""};
|
||||
Table table1 = new Table(t -> {
|
||||
final float[] value = {def};
|
||||
t.add(new Label(title + ": ")).left().padRight(5)
|
||||
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
||||
|
||||
t.field((integer ? String.valueOf(value[0]).split("[.]")[0] : value[0]) + str[0], s -> {
|
||||
str[0] = h.get(s);
|
||||
value[0] = s.isEmpty() ? def : Strings.parseFloat(s);
|
||||
|
||||
if(integer) settings.put(key, (int)value[0]);
|
||||
else settings.put(key, value[0]);
|
||||
|
||||
}).update(a -> a.setDisabled(!condition.get()))
|
||||
.valid(f -> Strings.canParsePositiveFloat(f) && Strings.parseFloat(f) >= min && Strings.parseFloat(f) <= max).width(120f).left();
|
||||
});
|
||||
|
||||
addDesc(table.add(table1).left().padTop(4f).get());
|
||||
table.row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
BaseDialog dialog = new BaseDialog(bundle.get("setting.shar-title"));
|
||||
dialog.addCloseButton();
|
||||
sharset = new SettingsMenuDialog.SettingsTable();
|
||||
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
|
||||
settingUi.row();
|
||||
settingUi.button(bundle.get("setting.shar-title"), Styles.cleart, dialog::show);
|
||||
});
|
||||
|
||||
Seq<Seq<SharSetting>> settingSeq = new Seq<>();
|
||||
Seq<SharSetting> tapSeq = new Seq<>();
|
||||
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? bundle.get("default-bar") : s + bundle.get("th-bar"), tapSeq);
|
||||
addGraphicCheckSetting("schem", !mobile, tapSeq);
|
||||
|
||||
//TODO: remove all drawing settings
|
||||
Seq<SharSetting> drawSeq = new Seq<>();
|
||||
addGraphicSlideSetting("selectopacity", 50, 0, 100, 5, s -> s + "%", drawSeq);
|
||||
addGraphicSlideSetting("baropacity", 50, 0, 100, 5, s -> s + "%", drawSeq);
|
||||
addGraphicCheckSetting("aliceRange", false, drawSeq);
|
||||
addGraphicCheckSetting("RangeShader", false, drawSeq);
|
||||
addGraphicCheckSetting("select", false, drawSeq);
|
||||
addGraphicCheckSetting("distanceLine", false, drawSeq);
|
||||
addGraphicCheckSetting("spawnerarrow", false, drawSeq);
|
||||
addGraphicCheckSetting("elementdebug", false, drawSeq);
|
||||
addGraphicCheckSetting("hiddenElem", false, drawSeq);
|
||||
|
||||
settingSeq.add(tapSeq, drawSeq);
|
||||
|
||||
sharset.table(t -> {
|
||||
Seq<TextButton> buttons = new Seq<>();
|
||||
buttons.add(new TextButton(bundle.get("setting.shar-ui"), Styles.cleart));
|
||||
buttons.add(new TextButton(bundle.get("setting.shar-draw"), Styles.cleart));
|
||||
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 -> {
|
||||
b.getLabel().setFontScale(0.85f);
|
||||
bt.add(b).minHeight(60f * 0.85f).minWidth(150f * 0.85f).top();
|
||||
});
|
||||
}).grow().row();
|
||||
|
||||
Stack stack = new Stack();
|
||||
for(int i = 0; i < settingSeq.size; i++){
|
||||
int finalI = i;
|
||||
stack.add(new Table(st -> {
|
||||
for(SharSetting setting : settingSeq.get(finalI))
|
||||
st.table(setting::add).left().row();
|
||||
|
||||
st.button(Core.bundle.get("settings.reset", "Reset to Defaults"), () -> {
|
||||
settingSeq.get(finalI).each(s -> Core.settings.put(s.name, Core.settings.getDefault(s.name)));
|
||||
}).margin(14.0f).width(240.0f).pad(6.0f);
|
||||
st.visibility = () -> buttons.get(finalI).isChecked();
|
||||
st.pack();
|
||||
}));
|
||||
}
|
||||
t.add(stack);
|
||||
t.fillParent = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
26
src/informatis/core/SharSetting.java
Normal file
26
src/informatis/core/SharSetting.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package informatis.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) {
|
||||
|
||||
}
|
||||
}
|
||||
24
src/informatis/shaders/RangeShader.java
Normal file
24
src/informatis/shaders/RangeShader.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package informatis.shaders;
|
||||
|
||||
import arc.Core;
|
||||
import arc.graphics.gl.Shader;
|
||||
import arc.scene.ui.layout.Scl;
|
||||
import arc.util.Time;
|
||||
import mindustry.Vars;
|
||||
|
||||
public class RangeShader extends Shader {
|
||||
public RangeShader() {
|
||||
super(Core.files.internal("shaders/screenspace.vert"), Vars.tree.get("shaders/turretrange.frag"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
setUniformf("u_dp", Scl.scl(1f));
|
||||
setUniformf("u_time", Time.time / Scl.scl(1f));
|
||||
setUniformf("u_offset",
|
||||
Core.camera.position.x - Core.camera.width / 2,
|
||||
Core.camera.position.y - Core.camera.height / 2);
|
||||
setUniformf("u_texsize", Core.camera.width, Core.camera.height);
|
||||
setUniformf("u_invsize", 1f/Core.camera.width, 1f/Core.camera.height);
|
||||
}
|
||||
}
|
||||
28
src/informatis/ui/DisplayManager.java
Normal file
28
src/informatis/ui/DisplayManager.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package informatis.ui;
|
||||
|
||||
import arc.scene.ui.layout.Table;
|
||||
import arc.struct.Seq;
|
||||
import informatis.ui.display.ElementDisplay;
|
||||
import informatis.ui.display.SchemDisplay;
|
||||
import informatis.ui.display.WaveInfoDisplay;
|
||||
|
||||
import static arc.Core.scene;
|
||||
import static mindustry.Vars.ui;
|
||||
|
||||
public class DisplayManager {
|
||||
public static void init() {
|
||||
//layout debug
|
||||
Seq.with(scene.root,
|
||||
ui.picker, ui.editor, ui.controls, ui.restart, ui.join, ui.discord,
|
||||
ui.load, ui.custom, ui.language, ui.database, ui.settings, ui.host,
|
||||
ui.paused, ui.about, ui.bans, ui.admins, ui.traces, ui.maps, ui.content,
|
||||
ui.planet, ui.research, ui.mods, ui.schematics, ui.logic
|
||||
).each(dialog-> dialog.addChild(new ElementDisplay(dialog)));
|
||||
|
||||
//schem quick-slot
|
||||
Table table = ((Table) scene.find("minimap/position")).row();
|
||||
table.add(new SchemDisplay());
|
||||
new WaveInfoDisplay().addWaveInfoTable();
|
||||
|
||||
}
|
||||
}
|
||||
118
src/informatis/ui/FreeBar.java
Normal file
118
src/informatis/ui/FreeBar.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package informatis.ui;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.*;
|
||||
import mindustry.entities.abilities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.blocks.payloads.Payload;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class FreeBar {
|
||||
public static void draw(Unit unit){
|
||||
if(unit.dead()) return;
|
||||
|
||||
Draw.z(Layer.flyingUnit + 1);
|
||||
|
||||
Bits statuses = new Bits();
|
||||
Bits applied = unit.statusBits();
|
||||
if(!statuses.equals(applied) && applied != null){
|
||||
int i = 0;
|
||||
int row = 0;
|
||||
for(StatusEffect effect : content.statusEffects()){
|
||||
if(applied.get(effect.id) && !effect.isHidden()){
|
||||
Draw.rect(effect.uiIcon, unit.x - (unit.type.hitSize + 4)/2 + i * 4, unit.y - 4 + 4 * row, 4,4);
|
||||
if(++i > 2 * (unit.type.hitSize + 4)) row++;
|
||||
}
|
||||
}
|
||||
statuses.set(applied);
|
||||
}
|
||||
|
||||
if(unit instanceof Payloadc payload && payload.payloads().any()){
|
||||
int i = 0;
|
||||
int row = 0;
|
||||
for(Payload p : payload.payloads()){
|
||||
Draw.rect(p.icon(), unit.x - (unit.type.hitSize + 4)/2 + i * 4, unit.y - 12 - 4 * row, 4,4);
|
||||
if(++i > 2 * (unit.type.hitSize + 4)) row++;
|
||||
}
|
||||
}
|
||||
|
||||
Draw.color(0.1f, 0.1f, 0.1f, (settings.getInt("baropacity") / 100f));
|
||||
float width = unit.type.hitSize + 4f;
|
||||
float height = 2f;
|
||||
float x = unit.x;
|
||||
float y = unit.y - 8;
|
||||
for(int i : Mathf.signs) {
|
||||
for(int ii = 0; ii < 2; ii++){
|
||||
float shadowx = x + ii * 0.25f;
|
||||
float shadowy = y - ii * 0.5f;
|
||||
Fill.poly(FloatSeq.with(
|
||||
shadowx - (width / 2 + height), shadowy,
|
||||
shadowx - width / 2, shadowy + i * height,
|
||||
shadowx + width / 2, shadowy + i * height,
|
||||
shadowx + (width / 2 + height), shadowy,
|
||||
shadowx + width / 2, shadowy + i * -height,
|
||||
shadowx - width / 2, shadowy + i * -height));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Draw.color(Pal.health.cpy().a((settings.getInt("baropacity") / 100f)));
|
||||
float topWidth = - width / 2 + width * Mathf.clamp(unit.healthf());
|
||||
float moser = topWidth + height;
|
||||
if(unit.health <= 0) moser = (width / 2 + height) * (2 * Mathf.clamp(unit.healthf()) - 1);
|
||||
|
||||
for(int i : Mathf.signs) {
|
||||
Fill.poly(FloatSeq.with(
|
||||
x - (width / 2 + height), y,
|
||||
x - width / 2, y + i * height,
|
||||
x + topWidth, y + i * height,
|
||||
x + moser, y,
|
||||
x + topWidth, y + i * -height,
|
||||
x - width / 2, y + i * -height));
|
||||
}
|
||||
}
|
||||
|
||||
if(Vars.state.rules.unitAmmo) {
|
||||
float topWidth = - width / 2 + width * Mathf.clamp(unit.ammof());
|
||||
float moser = topWidth + height;
|
||||
if(unit.ammo <= 0) moser = (width / 2 + height) * (2 * Mathf.clamp(unit.ammof()) - 1);
|
||||
|
||||
Draw.color((unit.dead() || unit instanceof BlockUnitc ? Pal.ammo : unit.type.ammoType.color()).cpy().a((settings.getInt("baropacity") / 100f)));
|
||||
Fill.poly(FloatSeq.with(
|
||||
x - (width / 2 + height), y,
|
||||
x - width / 2, y + height,
|
||||
x + topWidth, y + height,
|
||||
x + moser, y,
|
||||
x + topWidth, y - height,
|
||||
x - width / 2, y - height));
|
||||
}
|
||||
|
||||
{
|
||||
float max1 = ((ShieldRegenFieldAbility)content.units().copy().filter(ut -> ut.abilities.find(abil -> abil instanceof ShieldRegenFieldAbility) != null).sort(ut -> ((ShieldRegenFieldAbility)ut.abilities.find(abil -> abil instanceof ShieldRegenFieldAbility)).max).peek().abilities.find(abil -> abil instanceof ShieldRegenFieldAbility)).max;
|
||||
float max2 = 0f;
|
||||
if(unit.type.abilities.find(abil -> abil instanceof ForceFieldAbility) != null) max2 = ((ForceFieldAbility) unit.type.abilities.find(abil -> abil instanceof ForceFieldAbility)).max;
|
||||
float max = Mathf.clamp(unit.shield / Math.max(max1, max2));
|
||||
|
||||
float topWidth = - width / 2 + width * max;
|
||||
float moser = topWidth + height;
|
||||
if(unit.shield <= 0) moser = (width / 2 + height) * (2 * max - 1);
|
||||
|
||||
Draw.color(Pal.surge.cpy().a((settings.getInt("baropacity") / 100f)));
|
||||
Fill.poly(FloatSeq.with(
|
||||
x - (width / 2 + height), y,
|
||||
x - width / 2, y - height,
|
||||
x + topWidth, y - height,
|
||||
x + moser, y,
|
||||
x + topWidth, y + height,
|
||||
x - width / 2, y + height));
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
37
src/informatis/ui/OverScrollPane.java
Normal file
37
src/informatis/ui/OverScrollPane.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package informatis.ui;
|
||||
|
||||
import arc.math.geom.Vec2;
|
||||
import arc.scene.Element;
|
||||
import arc.scene.ui.ScrollPane;
|
||||
|
||||
import static arc.Core.input;
|
||||
import static arc.Core.scene;
|
||||
|
||||
public class OverScrollPane extends ScrollPane {
|
||||
Vec2 scrollPos;
|
||||
|
||||
|
||||
public OverScrollPane(Element widget, ScrollPaneStyle style, Vec2 scrollPos){
|
||||
super(widget, style);
|
||||
this.scrollPos = scrollPos;
|
||||
|
||||
update(() -> {
|
||||
if (hasScroll()) {
|
||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||
if (result == null || !result.isDescendantOf(this)) {
|
||||
scene.setScrollFocus(null);
|
||||
}
|
||||
}
|
||||
scrollPos.x = getScrollX();
|
||||
scrollPos.y = getScrollY();
|
||||
});
|
||||
setOverscroll(false, false);
|
||||
setScrollYForce(scrollPos.x);
|
||||
setScrollYForce(scrollPos.y);
|
||||
}
|
||||
|
||||
public OverScrollPane disableScroll(boolean x, boolean y) {
|
||||
setScrollingDisabled(x, y);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
142
src/informatis/ui/SBar.java
Normal file
142
src/informatis/ui/SBar.java
Normal file
@@ -0,0 +1,142 @@
|
||||
package informatis.ui;
|
||||
|
||||
import informatis.SUtils;
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.util.Align;
|
||||
import arc.util.Tmp;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.Fonts;
|
||||
|
||||
public class SBar extends Element{
|
||||
static final Rect scissor = new Rect();
|
||||
|
||||
Floatp fraction;
|
||||
String name = "";
|
||||
float value, lastValue, blink;
|
||||
final Color blinkColor = new Color();
|
||||
NinePatchDrawable bar, top;
|
||||
float spriteWidth;
|
||||
|
||||
public boolean onedot = false;
|
||||
|
||||
public SBar(Prov<String> name, Prov<Color> color, Floatp fraction){
|
||||
this.fraction = fraction;
|
||||
try{
|
||||
lastValue = value = Mathf.clamp(fraction.get());
|
||||
}catch(Exception e){ //getting the fraction may involve referring to invalid data
|
||||
lastValue = value = 0f;
|
||||
}
|
||||
update(() -> {
|
||||
try{
|
||||
this.name = name.get();
|
||||
this.blinkColor.set(color.get());
|
||||
setColor(color.get());
|
||||
}catch(Exception e){ //getting the fraction may involve referring to invalid data
|
||||
this.name = "";
|
||||
}
|
||||
});
|
||||
init();
|
||||
}
|
||||
|
||||
public SBar rect(){
|
||||
onedot = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SBar init(){
|
||||
int h = Core.settings.getInt("barstyle");
|
||||
|
||||
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barS"), 10, 10, 9, 9);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barS-top"), 10, 10, 9, 9);
|
||||
spriteWidth = Core.atlas.find("informatis-barS").width;
|
||||
if(onedot){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-1dotbar"), 0,0,0,0);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-1dotbar-top"),0,0,0,0);
|
||||
spriteWidth = Core.atlas.find("informatis-1dotbar").width;
|
||||
}
|
||||
else if(h == 1){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSS"), 14, 14, 19, 19);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSS-top"), 14, 14, 19, 19);
|
||||
spriteWidth = Core.atlas.find("informatis-barSS").width;
|
||||
}
|
||||
else if(h == 2){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSS"), 25, 25, 17, 17);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSS-top"), 25, 25, 17, 17);
|
||||
spriteWidth = Core.atlas.find("informatis-barSSS").width;
|
||||
}
|
||||
else if(h == 3){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSSS"), 25, 25, 17, 17);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSSS-top"), 25, 25, 17, 17);
|
||||
spriteWidth = Core.atlas.find("informatis-barSSSS").width;
|
||||
}
|
||||
else if(h == 4){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSSSS"), 27, 27, 16, 16);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSSSS-top"), 27, 27, 16, 16);
|
||||
spriteWidth = Core.atlas.find("informatis-barSSSSS").width;
|
||||
}
|
||||
else if(h == 5){
|
||||
bar = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSSSSS"), 32, 32, 16, 16);
|
||||
top = (NinePatchDrawable) SUtils.getDrawable(Core.atlas.find("informatis-barSSSSSS-top"), 32, 32, 16, 16);
|
||||
spriteWidth = Core.atlas.find("informatis-barSSSSSS").width;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
if(fraction == null) return;
|
||||
|
||||
float computed;
|
||||
try{
|
||||
computed = Mathf.clamp(fraction.get());
|
||||
}catch(Exception e){ //getting the fraction may involve referring to invalid data
|
||||
computed = 0f;
|
||||
}
|
||||
|
||||
if(lastValue > computed){
|
||||
blink = 1f;
|
||||
lastValue = computed;
|
||||
}
|
||||
|
||||
if(Float.isNaN(lastValue)) lastValue = 0;
|
||||
if(Float.isInfinite(lastValue)) lastValue = 1f;
|
||||
if(Float.isNaN(value)) value = 0;
|
||||
if(Float.isInfinite(value)) value = 1f;
|
||||
if(Float.isNaN(computed)) computed = 0;
|
||||
if(Float.isInfinite(computed)) computed = 1f;
|
||||
|
||||
blink = Mathf.lerpDelta(blink, 0f, 0.2f);
|
||||
value = Mathf.lerpDelta(value, computed, 0.05f);
|
||||
|
||||
Draw.colorl(0.1f);
|
||||
bar.draw(x, y, width, height);
|
||||
|
||||
Draw.color(Tmp.c1.set(color).mul(Pal.lightishGray), blinkColor, blink);
|
||||
float topWidth = width * value;
|
||||
if(topWidth > spriteWidth){
|
||||
top.draw(x, y, topWidth, height);
|
||||
} else if(ScissorStack.push(scissor.set(x, y, topWidth, height))){
|
||||
top.draw(x, y, spriteWidth, height);
|
||||
ScissorStack.pop();
|
||||
}
|
||||
|
||||
Draw.color(color, blinkColor, blink);
|
||||
float topWidthReal = width * Math.min(value, computed);
|
||||
if(topWidthReal > spriteWidth){
|
||||
top.draw(x, y, topWidthReal, height);
|
||||
} else if(ScissorStack.push(scissor.set(x, y, topWidthReal, height))){
|
||||
top.draw(x, y, spriteWidth, height);
|
||||
ScissorStack.pop();
|
||||
}
|
||||
|
||||
Fonts.outline.draw(name, x + width / 2f, y + height * 0.75f, Color.white, 1, false, Align.center);
|
||||
}
|
||||
}
|
||||
14
src/informatis/ui/SIcons.java
Normal file
14
src/informatis/ui/SIcons.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package informatis.ui;
|
||||
|
||||
import arc.Core;
|
||||
import arc.graphics.g2d.TextureRegion;
|
||||
|
||||
public class SIcons {
|
||||
public static TextureRegion health = Core.atlas.find("informatis-health");
|
||||
public static TextureRegion shield = Core.atlas.find("informatis-shield");
|
||||
public static TextureRegion item = Core.atlas.find("informatis-item");
|
||||
public static TextureRegion liquid = Core.atlas.find("informatis-liquid");
|
||||
public static TextureRegion power = Core.atlas.find("informatis-power");
|
||||
public static TextureRegion ammo = Core.atlas.find("informatis-ammo");
|
||||
public static TextureRegion reload = Core.atlas.find("informatis-reload");
|
||||
}
|
||||
5
src/informatis/ui/Updatable.java
Normal file
5
src/informatis/ui/Updatable.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package informatis.ui;
|
||||
|
||||
public interface Updatable {
|
||||
void update();
|
||||
}
|
||||
56
src/informatis/ui/WindowManager.java
Normal file
56
src/informatis/ui/WindowManager.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package informatis.ui;
|
||||
|
||||
import arc.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ui.*;
|
||||
import informatis.ui.window.Window;
|
||||
|
||||
public class WindowManager {
|
||||
public static Seq<Window> windows = new Seq<>();
|
||||
|
||||
public static void init(){
|
||||
Log.info(windows.size);
|
||||
|
||||
Vars.ui.hudGroup.fill(t -> {
|
||||
t.name = "Windows";
|
||||
for(Window window : windows){
|
||||
t.add(window);
|
||||
}
|
||||
});
|
||||
|
||||
Vars.ui.hudGroup.fill(t -> {
|
||||
t.center().left();
|
||||
t.table(Core.atlas.drawable("informatis-sidebar"), b -> {
|
||||
b.name = "Window Buttons";
|
||||
b.left();
|
||||
|
||||
for(Window window : windows){
|
||||
b.button(window.icon, Styles.emptyi, () -> {
|
||||
window.toggle();
|
||||
|
||||
// Disabling the parent's layout fixes issues with updating elements inside windows.
|
||||
// However, it also disables the layout of all its children, so we need to re-enable them.
|
||||
window.parent.setLayoutEnabled(false);
|
||||
window.setLayoutEnabled(true);
|
||||
for(Window w : windows){
|
||||
w.setLayoutEnabled(true);
|
||||
}
|
||||
}).disabled(window.shown)
|
||||
.size(40f)
|
||||
.tooltip(tt -> {
|
||||
tt.setBackground(Styles.black6);
|
||||
tt.label(() -> Core.bundle.get("window."+window.name+".name")).pad(2f);
|
||||
});
|
||||
b.row();
|
||||
}
|
||||
}).left();
|
||||
});
|
||||
}
|
||||
|
||||
public static int register(Window window){
|
||||
windows.add(window);
|
||||
return windows.size - 1;
|
||||
}
|
||||
}
|
||||
61
src/informatis/ui/display/ElementDisplay.java
Normal file
61
src/informatis/ui/display/ElementDisplay.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package informatis.ui.display;
|
||||
|
||||
import arc.graphics.g2d.Draw;
|
||||
import arc.graphics.g2d.Lines;
|
||||
import arc.scene.Element;
|
||||
import arc.scene.Group;
|
||||
import arc.scene.event.Touchable;
|
||||
import arc.struct.SnapshotSeq;
|
||||
import arc.util.Tmp;
|
||||
import mindustry.graphics.Layer;
|
||||
import mindustry.graphics.Pal;
|
||||
|
||||
import static arc.Core.scene;
|
||||
import static arc.Core.settings;
|
||||
|
||||
public class ElementDisplay extends Element {
|
||||
Group root;
|
||||
|
||||
public ElementDisplay() {
|
||||
this(scene.root);
|
||||
}
|
||||
public ElementDisplay(Group root) {
|
||||
this.root = root;
|
||||
fillParent = true;
|
||||
touchable = Touchable.disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
super.draw();
|
||||
if(!settings.getBool("elementdebug")) return;
|
||||
Draw.z(Layer.max);
|
||||
Lines.stroke(1);
|
||||
addRect(root.getChildren());
|
||||
}
|
||||
|
||||
void addRect(SnapshotSeq<Element> elements) {
|
||||
elements.each(elem-> {
|
||||
elem.updateVisibility();
|
||||
if(elem.visible || settings.getBool("hiddenElem")) {
|
||||
elem.localToStageCoordinates(Tmp.v1.set(0, 0));
|
||||
if(elem.hasMouse()) {
|
||||
Draw.color(Pal.accent);
|
||||
Lines.stroke(3);
|
||||
}
|
||||
if(elem.hasScroll()) {
|
||||
Draw.color(Pal.lancerLaser);
|
||||
Lines.stroke(3);
|
||||
}
|
||||
if(elem.hasKeyboard()) {
|
||||
Draw.color(Pal.sap);
|
||||
Lines.stroke(5);
|
||||
}
|
||||
Lines.rect(Tmp.v1.x, Tmp.v1.y, elem.getWidth(), elem.getHeight());
|
||||
Draw.color();
|
||||
Lines.stroke(1);
|
||||
if(elem instanceof Group group) addRect(group.getChildren());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
498
src/informatis/ui/display/SchemDisplay.java
Normal file
498
src/informatis/ui/display/SchemDisplay.java
Normal file
@@ -0,0 +1,498 @@
|
||||
package informatis.ui.display;
|
||||
|
||||
import informatis.SUtils;
|
||||
import arc.Core;
|
||||
import arc.func.Cons;
|
||||
import arc.func.Floatf;
|
||||
import arc.graphics.Color;
|
||||
import arc.input.KeyCode;
|
||||
import arc.scene.Element;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.scene.utils.Elem;
|
||||
import arc.struct.Seq;
|
||||
import arc.util.Align;
|
||||
import arc.util.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.ui.Styles;
|
||||
import mindustry.ui.dialogs.*;
|
||||
import informatis.ui.Updatable;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
import static mindustry.Vars.ui;
|
||||
|
||||
public class SchemDisplay extends Table implements Updatable {
|
||||
static float schemScrollPos, tagScrollPos;
|
||||
static boolean schemShown;
|
||||
static Schematic firstSchematic;
|
||||
static final Seq<String> selectedTags = new Seq<>();
|
||||
static Runnable rebuildList = () -> {};
|
||||
float heat;
|
||||
|
||||
public SchemDisplay() {
|
||||
setSchemTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
heat += Time.delta;
|
||||
if(heat>=60f) {
|
||||
heat = 0;
|
||||
setSchemTable();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSchemTable() {
|
||||
clear();
|
||||
if(!settings.getBool(("schem"))) return;
|
||||
right();
|
||||
button(bundle.get("hud.schematic-list"), Icon.downOpen, Styles.squareTogglet, () -> schemShown = !schemShown).width(160f).height(60f).checked(b -> {
|
||||
Image image = (Image)b.getCells().first().get();
|
||||
image.setDrawable(schemShown ? Icon.upOpen : Icon.downOpen);
|
||||
return schemShown;
|
||||
}).row();
|
||||
collapser(t -> {
|
||||
t.background(Styles.black8).defaults().maxHeight(72 * 8f).maxWidth(160f);
|
||||
rebuildList = () -> {
|
||||
t.clearChildren();
|
||||
ScrollPane pane1 = t.pane(Styles.noBarPane, p -> {
|
||||
p.left().defaults().pad(2).height(42f);
|
||||
try {
|
||||
for(String tag : (Seq<String>)SUtils.invoke(ui.schematics, "tags")){
|
||||
p.button(tag, Styles.togglet, () -> {
|
||||
if(selectedTags.contains(tag)){
|
||||
selectedTags.remove(tag);
|
||||
}else{
|
||||
selectedTags.add(tag);
|
||||
}
|
||||
rebuildList.run();
|
||||
}).checked(selectedTags.contains(tag)).with(c -> c.getLabel().setWrap(false));
|
||||
}
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).fillX().height(42f).get();
|
||||
pane1.update(() -> {
|
||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||
if(pane1.hasScroll() && (result == null || !result.isDescendantOf(pane1)))
|
||||
scene.setScrollFocus(null);
|
||||
tagScrollPos = pane1.getScrollX();
|
||||
});
|
||||
|
||||
pane1.setOverscroll(false, false);
|
||||
pane1.setScrollingDisabled(false, true);
|
||||
pane1.setScrollXForce(tagScrollPos);
|
||||
|
||||
t.row();
|
||||
|
||||
ScrollPane pane = t.pane(Styles.noBarPane, p -> {
|
||||
p.table(tt -> {
|
||||
firstSchematic = null;
|
||||
|
||||
tt.button("@editor.import", Icon.download, this::showImport).width(160f).height(64f).row();
|
||||
for(Schematic s : schematics.all()){
|
||||
if(selectedTags.any() && !s.labels.containsAll(selectedTags)) continue;
|
||||
if(firstSchematic == null) firstSchematic = s;
|
||||
|
||||
Button[] sel = {null};
|
||||
sel[0] = tt.button(b -> {
|
||||
b.top();
|
||||
b.margin(0f);
|
||||
b.table(buttons -> {
|
||||
buttons.left();
|
||||
buttons.defaults().size(162/4f);
|
||||
|
||||
ImageButton.ImageButtonStyle style = Styles.clearNonei;
|
||||
|
||||
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 -> {
|
||||
n.top();
|
||||
n.table(Styles.black3, c -> {
|
||||
Label label = c.add(s.name()).style(Styles.outlineLabel).color(Color.white).top().growX().maxWidth(200f - 8f).get();
|
||||
label.setEllipsis(true);
|
||||
label.setAlignment(Align.center);
|
||||
}).growX().margin(1).pad(4).maxWidth(Scl.scl(160f - 8f)).padBottom(0);
|
||||
})).size(160f);
|
||||
}, () -> {
|
||||
if(sel[0].childrenPressed()) return;
|
||||
control.input.useSchematic(s);
|
||||
|
||||
}).pad(4).style(Styles.cleari).get();
|
||||
|
||||
sel[0].getStyle().up = Tex.pane;
|
||||
tt.row();
|
||||
}
|
||||
|
||||
if(firstSchematic == null){
|
||||
tt.add(bundle.get("none"));
|
||||
}
|
||||
});
|
||||
}).grow().get();
|
||||
|
||||
pane.update(() -> {
|
||||
Element result = scene.hit(input.mouseX(), input.mouseY(), true);
|
||||
if(pane.hasScroll() && (result == null || !result.isDescendantOf(pane)))
|
||||
scene.setScrollFocus(null);
|
||||
schemScrollPos = pane.getScrollY();
|
||||
});
|
||||
|
||||
pane.setOverscroll(false, false);
|
||||
pane.setScrollingDisabled(true, false);
|
||||
pane.setScrollYForce(schemScrollPos);
|
||||
};
|
||||
rebuildList.run();
|
||||
}, true, () -> schemShown);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void showNewIconTag(Cons<String> cons){
|
||||
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");
|
||||
}
|
||||
}
|
||||
115
src/informatis/ui/display/WaveInfoDisplay.java
Normal file
115
src/informatis/ui/display/WaveInfoDisplay.java
Normal file
@@ -0,0 +1,115 @@
|
||||
package informatis.ui.display;
|
||||
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.Block;
|
||||
import mindustry.world.Tile;
|
||||
import mindustry.world.blocks.environment.Floor;
|
||||
|
||||
import static informatis.SUtils.*;
|
||||
import static informatis.SVars.*;
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class WaveInfoDisplay {
|
||||
public boolean waveShown;
|
||||
|
||||
public void addWaveInfoTable() {
|
||||
Table waveInfoTable = new Table(Tex.buttonEdge4, table -> {
|
||||
table.center();
|
||||
table.table(head -> {
|
||||
head.table(image -> {
|
||||
image.left();
|
||||
image.image(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return clear;
|
||||
Floor floor = tile.floor();
|
||||
if(floor.uiIcon == error) return clear;
|
||||
return floor.uiIcon;
|
||||
}).size(iconSmall);
|
||||
image.image(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return clear;
|
||||
Floor floor = tile.overlay();
|
||||
if(floor.uiIcon == error) return clear;
|
||||
return floor.uiIcon;
|
||||
}).size(iconSmall);
|
||||
image.image(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return clear;
|
||||
Block floor = tile.block();
|
||||
if(floor.uiIcon == error) return clear;
|
||||
return floor.uiIcon;
|
||||
}).size(iconSmall);
|
||||
});
|
||||
head.label(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return "(NaN, NaN)";
|
||||
return Strings.format("(@, @)", tile.x, tile.y);
|
||||
}).center();
|
||||
});
|
||||
table.row();
|
||||
table.image().height(4f).color(Pal.gray).growX().row();
|
||||
/*
|
||||
table.table(tttt -> {
|
||||
tttt.center();
|
||||
int[] i = {0};
|
||||
|
||||
content.units().each(type -> Groups.unit.contains(u -> u.type == type && (state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && u.isBoss()), type -> {
|
||||
tttt.table(stt ->
|
||||
stt.stack(
|
||||
new Table(ttt -> ttt.image(type.uiIcon).size(iconSmall)),
|
||||
new Table(ttt -> {
|
||||
ttt.right().bottom();
|
||||
Label label = new Label(() -> Groups.unit.count(u -> u.type == type && (state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && u.isBoss()) + "");
|
||||
label.setFontScale(0.75f);
|
||||
ttt.add(label);
|
||||
ttt.pack();
|
||||
}),
|
||||
new Table(ttt -> {
|
||||
ttt.top().right();
|
||||
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))));
|
||||
ttt.add(image).size(12f);
|
||||
ttt.pack();
|
||||
})
|
||||
).pad(6)
|
||||
);
|
||||
if(++i[0] % 6 == 0) tttt.row();
|
||||
});
|
||||
tttt.row();
|
||||
i[0] = 0;
|
||||
content.units().each(type -> Groups.unit.contains(u -> u.type == type && (state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && !u.isBoss()), type -> {
|
||||
tttt.table(ttt ->
|
||||
ttt.add(new Stack() {{
|
||||
add(new Table(ttt -> ttt.add(new Image(type.uiIcon)).size(iconSmall)));
|
||||
add(new Table(ttt -> {
|
||||
ttt.right().bottom();
|
||||
Label label = new Label(() -> Groups.unit.count(u -> u.type == type &&(state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && !u.isBoss()) + "");
|
||||
label.setFontScale(0.75f);
|
||||
ttt.add(label);
|
||||
ttt.pack();
|
||||
}));
|
||||
}}).pad(6)
|
||||
);
|
||||
if(++i[0] % 6 == 0) tttt.row();
|
||||
});
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
Table waveTable = (Table) scene.find("waves");
|
||||
Table infoTable = (Table) scene.find("infotable");
|
||||
waveTable.removeChild(infoTable);
|
||||
waveTable.row();
|
||||
waveTable.stack(
|
||||
new Table(tt -> tt.collapser(t -> t.stack(waveInfoTable, infoTable).growX(), true, () -> waveShown).growX()).top(),
|
||||
new Table(tt -> tt.button(Icon.downOpen, Styles.clearTogglei, () -> waveShown = !waveShown).size(4 * 8f).checked(b -> {
|
||||
b.getImage().setDrawable(waveShown ? Icon.upOpen : Icon.downOpen);
|
||||
return waveShown;
|
||||
})).left().top()).fillX();
|
||||
}
|
||||
}
|
||||
37
src/informatis/ui/draws/BlockDraw.java
Normal file
37
src/informatis/ui/draws/BlockDraw.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package informatis.ui.draws;
|
||||
|
||||
import arc.graphics.g2d.Draw;
|
||||
import arc.graphics.g2d.Fill;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import mindustry.gen.Groups;
|
||||
import mindustry.graphics.Pal;
|
||||
|
||||
import static informatis.SUtils.*;
|
||||
import static arc.Core.settings;
|
||||
|
||||
public class BlockDraw extends OverDraw {
|
||||
BlockDraw(String name, TextureRegionDrawable icon) {
|
||||
super(name, icon);
|
||||
registerOption("blockStatus");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
super.draw();
|
||||
Groups.build.each(b->{
|
||||
if(isInCamera(b.x, b.y, b.block.size/2f) && settings.getBool("blockStatus") && enabled) {
|
||||
if(b.block.consumers.length > 0) {
|
||||
float multiplier = b.block.size > 1 ? 1.0F : 0.64F;
|
||||
float brcx = b.x + (float)(b.block.size * 8) / 2.0F - 8.0F * multiplier / 2.0F;
|
||||
float brcy = b.y - (float)(b.block.size * 8) / 2.0F + 8.0F * multiplier / 2.0F;
|
||||
Draw.z(71.0F);
|
||||
Draw.color(Pal.gray);
|
||||
Fill.square(brcx, brcy, 2.5F * multiplier, 45.0F);
|
||||
Draw.color(b.status().color);
|
||||
Fill.square(brcx, brcy, 1.5F * multiplier, 45.0F);
|
||||
Draw.color();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
159
src/informatis/ui/draws/LinkDraw.java
Normal file
159
src/informatis/ui/draws/LinkDraw.java
Normal file
@@ -0,0 +1,159 @@
|
||||
package informatis.ui.draws;
|
||||
|
||||
import arc.graphics.Color;
|
||||
import arc.graphics.g2d.Draw;
|
||||
import arc.graphics.g2d.Lines;
|
||||
import arc.math.Angles;
|
||||
import arc.math.Mathf;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import arc.struct.IntSeq;
|
||||
import arc.struct.Seq;
|
||||
import arc.util.Time;
|
||||
import arc.util.Tmp;
|
||||
import mindustry.core.Renderer;
|
||||
import mindustry.gen.Building;
|
||||
import mindustry.gen.Groups;
|
||||
import mindustry.graphics.Drawf;
|
||||
import mindustry.graphics.Layer;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.world.blocks.distribution.MassDriver;
|
||||
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
||||
|
||||
import static arc.Core.atlas;
|
||||
import static arc.Core.settings;
|
||||
import static mindustry.Vars.*;
|
||||
import static informatis.SVars.*;
|
||||
|
||||
public class LinkDraw extends OverDraw {
|
||||
Seq<MassDriver.MassDriverBuild> linkedMasses = new Seq<>();
|
||||
Seq<PayloadMassDriver.PayloadDriverBuild> linkedPayloadMasses = new Seq<>();
|
||||
Seq<Building> linkedNodes = new Seq<>();
|
||||
|
||||
LinkDraw(String name, TextureRegionDrawable icon) {
|
||||
super(name, icon);
|
||||
registerOption("powerNode");
|
||||
registerOption("massDriver");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
if(!enabled) return;
|
||||
|
||||
Draw.z(Layer.max);
|
||||
if(target instanceof Building b){
|
||||
if(settings.getBool("powerNode") && enabled) {
|
||||
linkedNodes.clear();
|
||||
drawNodeLink(b);
|
||||
}
|
||||
if(settings.getBool("massDriver") && enabled) {
|
||||
if (target instanceof MassDriver.MassDriverBuild mass) {
|
||||
linkedMasses.clear();
|
||||
drawMassLink(mass);
|
||||
} else if (target instanceof PayloadMassDriver.PayloadDriverBuild mass) {
|
||||
linkedPayloadMasses.clear();
|
||||
drawMassPayloadLink(mass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawMassPayloadLink(PayloadMassDriver.PayloadDriverBuild from){
|
||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||
|
||||
//call every mass drivers that link to this driver
|
||||
for(Building b : Groups.build) {
|
||||
if (b != from && b instanceof PayloadMassDriver.PayloadDriverBuild fromMass && world.build(fromMass.link) == from && !linkedPayloadMasses.contains(fromMass)) {
|
||||
linkedPayloadMasses.add(fromMass);
|
||||
drawMassPayloadLink(fromMass);
|
||||
}
|
||||
}
|
||||
|
||||
//get and draw line between this mass driver and linked one
|
||||
Building target = world.build(from.link);
|
||||
if(target instanceof PayloadMassDriver.PayloadDriverBuild targetDriver) {
|
||||
Tmp.v1.set(from.x + from.block.offset, from.y + from.block.offset).sub(targetDriver.x, targetDriver.y).limit(from.block.size * tilesize + sin + 0.5f);
|
||||
float x2 = from.x - Tmp.v1.x, y2 = from.y - Tmp.v1.y, x1 = targetDriver.x + Tmp.v1.x, y1 = targetDriver.y + Tmp.v1.y;
|
||||
int segs = (int) (targetDriver.dst(from.x, from.y) / tilesize);
|
||||
Lines.stroke(4f, Pal.gray);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
Lines.stroke(2f, Pal.placing);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
Lines.stroke(1f, Pal.accent);
|
||||
Drawf.circles(from.x, from.y, (from.tile.block().size / 2f + 1) * tilesize + sin - 2f, Pal.accent);
|
||||
Drawf.arrow(from.x, from.y, targetDriver.x, targetDriver.y, from.block.size * tilesize + sin, 4f + sin);
|
||||
for (Building shooter : from.waitingShooters) {
|
||||
Drawf.circles(shooter.x, shooter.y, (from.tile.block().size / 2f + 1) * tilesize + sin - 2f);
|
||||
Drawf.arrow(shooter.x, shooter.y, from.x, from.y, from.block.size * tilesize + sin, 4f + sin);
|
||||
}
|
||||
|
||||
//call method again when target links to another mass driver which isn't stored in array
|
||||
if(!linkedPayloadMasses.contains(targetDriver)) {
|
||||
linkedPayloadMasses.add(targetDriver);
|
||||
drawMassPayloadLink(targetDriver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawMassLink(MassDriver.MassDriverBuild from){
|
||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||
|
||||
//call every mass drivers that link to this driver
|
||||
for(Building b : Groups.build) {
|
||||
if (b != from && b instanceof MassDriver.MassDriverBuild fromMass && world.build(fromMass.link) == from && !linkedMasses.contains(fromMass)) {
|
||||
linkedMasses.add(fromMass);
|
||||
drawMassLink(fromMass);
|
||||
}
|
||||
}
|
||||
|
||||
//get and draw line between this mass driver and linked one
|
||||
Building target = world.build(from.link);
|
||||
if(target instanceof MassDriver.MassDriverBuild targetDriver) {
|
||||
Tmp.v1.set(from.x + from.block.offset, from.y + from.block.offset).sub(targetDriver.x, targetDriver.y).limit(from.block.size * tilesize + sin + 0.5f);
|
||||
float x2 = from.x - Tmp.v1.x, y2 = from.y - Tmp.v1.y, x1 = targetDriver.x + Tmp.v1.x, y1 = targetDriver.y + Tmp.v1.y;
|
||||
int segs = (int) (targetDriver.dst(from.x, from.y) / tilesize);
|
||||
Lines.stroke(4f, Pal.gray);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
Lines.stroke(2f, Pal.placing);
|
||||
Lines.dashLine(x1, y1, x2, y2, segs);
|
||||
Lines.stroke(1f, Pal.accent);
|
||||
Drawf.circles(from.x, from.y, (from.tile.block().size / 2f + 1) * tilesize + sin - 2f, Pal.accent);
|
||||
Drawf.arrow(from.x, from.y, targetDriver.x, targetDriver.y, from.block.size * tilesize + sin, 4f + sin);
|
||||
for (Building shooter : from.waitingShooters) {
|
||||
Drawf.circles(shooter.x, shooter.y, (from.tile.block().size / 2f + 1) * tilesize + sin - 2f);
|
||||
Drawf.arrow(shooter.x, shooter.y, from.x, from.y, from.block.size * tilesize + sin, 4f + sin);
|
||||
}
|
||||
|
||||
//call method again when target links to another mass driver which isn't stored in array
|
||||
if(!linkedMasses.contains(targetDriver)) {
|
||||
linkedMasses.add(targetDriver);
|
||||
drawMassLink(targetDriver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IntSeq getPowerLinkedBuilds(Building build) {
|
||||
IntSeq seq = new IntSeq(build.power.links);
|
||||
seq.addAll(build.proximity().mapInt(Building::pos));
|
||||
return seq;
|
||||
}
|
||||
|
||||
void drawNodeLink(Building node) {
|
||||
if(node.power == null) return;
|
||||
if(!linkedNodes.contains(node)) {
|
||||
linkedNodes.add(node);
|
||||
int[] builds = getPowerLinkedBuilds(node).items;
|
||||
for(int i : builds) {
|
||||
Building other = world.build(i);
|
||||
if(other == null || other.power == null) return;
|
||||
float angle1 = Angles.angle(node.x, node.y, other.x, other.y),
|
||||
vx = Mathf.cosDeg(angle1), vy = Mathf.sinDeg(angle1),
|
||||
len1 = node.block.size * tilesize / 2f - 1.5f, len2 = other.block.size * tilesize / 2f - 1.5f;
|
||||
Draw.color(Color.white, Color.valueOf("98ff98"), (1f - node.power.graph.getSatisfaction()) * 0.86f + Mathf.absin(3f, 0.1f));
|
||||
Draw.alpha(Renderer.laserOpacity);
|
||||
Drawf.laser(atlas.find("informatis-Slaser"), atlas.find("informatis-Slaser"), atlas.find("informatis-Slaser-end"), node.x + vx * len1, node.y + vy * len1, other.x - vx * len2, other.y - vy * len2, 0.25f);
|
||||
|
||||
drawNodeLink(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
src/informatis/ui/draws/OverDraw.java
Normal file
52
src/informatis/ui/draws/OverDraw.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package informatis.ui.draws;
|
||||
|
||||
import arc.scene.Element;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import arc.scene.ui.CheckBox;
|
||||
import arc.scene.ui.layout.Table;
|
||||
import arc.struct.Seq;
|
||||
import mindustry.ui.Styles;
|
||||
|
||||
import static arc.Core.bundle;
|
||||
import static arc.Core.settings;
|
||||
|
||||
public class OverDraw {
|
||||
public TextureRegionDrawable icon;
|
||||
public String name;
|
||||
public boolean enabled = false;
|
||||
public Seq<String> options = new Seq<>();
|
||||
|
||||
|
||||
OverDraw(String name, TextureRegionDrawable icon) {
|
||||
this.name = name;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public void displayStats(Table parent) {
|
||||
if(options.isEmpty()) return;
|
||||
parent.background(Styles.squarei.up);
|
||||
|
||||
options.each(name-> parent.check(bundle.get("setting."+name+".name"), settings.getBool(name), b->settings.put(name, b)).tooltip(t->t.background(Styles.black8).add(bundle.get("setting."+name+".description"))).disabled(!enabled).row());
|
||||
}
|
||||
|
||||
public void draw() {}
|
||||
|
||||
public <T> void onEnabled(T param) {
|
||||
if(param instanceof Table t) {
|
||||
for (int i = 0; i < t.getChildren().size; i++) {
|
||||
Element elem = t.getChildren().get(i);
|
||||
if (elem instanceof CheckBox cb) cb.setDisabled(!enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registerOption(String name) {
|
||||
registerOption(name, settings.has(name) && settings.getBool(name));
|
||||
}
|
||||
|
||||
public void registerOption(String name, boolean defaults) {
|
||||
options.add(name);
|
||||
settings.put(name, defaults);
|
||||
}
|
||||
}
|
||||
|
||||
17
src/informatis/ui/draws/OverDraws.java
Normal file
17
src/informatis/ui/draws/OverDraws.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package informatis.ui.draws;
|
||||
|
||||
import mindustry.gen.Icon;
|
||||
|
||||
public class OverDraws {
|
||||
public static OverDraw range, link, unit, block, util;
|
||||
public static OverDraw[] all = {};
|
||||
|
||||
public static void init() {
|
||||
range = new RangeDraw("Range Draws", Icon.commandRally);
|
||||
link = new LinkDraw("Link Draws", Icon.line);
|
||||
unit = new UnitDraw("Unit Draws", Icon.units);
|
||||
block = new BlockDraw("Block Draws", Icon.crafting);
|
||||
util = new UtilDraw("Utils", Icon.github);
|
||||
all = new OverDraw[]{range, link, unit, block, util};
|
||||
}
|
||||
}
|
||||
81
src/informatis/ui/draws/RangeDraw.java
Normal file
81
src/informatis/ui/draws/RangeDraw.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package informatis.ui.draws;
|
||||
|
||||
import arc.graphics.Color;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.graphics.gl.FrameBuffer;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import arc.struct.ObjectMap;
|
||||
import arc.struct.Seq;
|
||||
import mindustry.game.Team;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Drawf;
|
||||
import mindustry.world.blocks.defense.turrets.BaseTurret;
|
||||
import mindustry.world.blocks.defense.turrets.TractorBeamTurret;
|
||||
import mindustry.world.blocks.defense.turrets.Turret;
|
||||
|
||||
import static informatis.SVars.turretRange;
|
||||
import static informatis.SUtils.*;
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.player;
|
||||
|
||||
public class RangeDraw extends OverDraw {
|
||||
FrameBuffer effectBuffer = new FrameBuffer();
|
||||
ObjectMap<Team, Seq<BaseTurret.BaseTurretBuild>> turrets = new ObjectMap<>();
|
||||
|
||||
RangeDraw(String name, TextureRegionDrawable icon) {
|
||||
super(name, icon);
|
||||
registerOption("airRange");
|
||||
registerOption("groundRange");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
if(!enabled) return;
|
||||
|
||||
effectBuffer.resize(graphics.getWidth(), graphics.getHeight());
|
||||
|
||||
Unit unit = player.unit();
|
||||
turrets.clear();
|
||||
for(Team team : Team.baseTeams) {
|
||||
Draw.drawRange(166 + (Team.baseTeams.length-team.id) * 3, 1, () -> effectBuffer.begin(Color.clear), () -> {
|
||||
effectBuffer.end();
|
||||
effectBuffer.blit(turretRange);
|
||||
});
|
||||
turrets.put(team, new Seq<>());
|
||||
}
|
||||
|
||||
Groups.build.each(b-> settings.getBool("aliceRange") || player.team() != b.team, b -> {
|
||||
if(b instanceof BaseTurret.BaseTurretBuild turret) {
|
||||
float range = turret.range();
|
||||
if (isInCamera(b.x, b.y, range)) {
|
||||
int index = b.team.id;
|
||||
Draw.color(b.team.color);
|
||||
|
||||
boolean air = settings.getBool("airRange") && enabled;
|
||||
boolean ground = settings.getBool("groundRange") && enabled;
|
||||
boolean valid = false;
|
||||
if (unit == null) valid = true;
|
||||
else if (b instanceof Turret.TurretBuild build) {
|
||||
Turret t = (Turret) build.block;
|
||||
if(t.targetAir&&!air||t.targetGround&&!ground) return;
|
||||
if((unit.isFlying() ? t.targetAir : t.targetGround) && build.hasAmmo() && build.canConsume()) valid = true;
|
||||
} else if (b instanceof TractorBeamTurret.TractorBeamBuild build) {
|
||||
TractorBeamTurret t = (TractorBeamTurret) build.block;
|
||||
if(t.targetAir&&!air||t.targetGround&&!ground) return;
|
||||
if((unit.isFlying() ? t.targetAir : t.targetGround) && build.canConsume()) valid = true;
|
||||
}
|
||||
|
||||
if(!valid) index = 0;
|
||||
|
||||
if(b.team==player.team()) index = b.team.id;
|
||||
|
||||
Draw.color(Team.baseTeams[index].color);
|
||||
if (settings.getBool("RangeShader")) {
|
||||
Draw.z(166+(Team.baseTeams.length-index)*3);
|
||||
Fill.poly(b.x, b.y, Lines.circleVertices(range), range);
|
||||
} else Drawf.dashCircle(b.x, b.y, range, b.team.color);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
111
src/informatis/ui/draws/UnitDraw.java
Normal file
111
src/informatis/ui/draws/UnitDraw.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package informatis.ui.draws;
|
||||
|
||||
import informatis.ui.FreeBar;
|
||||
import arc.graphics.g2d.Lines;
|
||||
import arc.math.Angles;
|
||||
import arc.math.Mathf;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import arc.scene.ui.layout.Scl;
|
||||
import arc.struct.Seq;
|
||||
import arc.util.Align;
|
||||
import arc.util.Tmp;
|
||||
import mindustry.Vars;
|
||||
import mindustry.ai.Pathfinder;
|
||||
import mindustry.ai.RtsAI;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.entities.units.UnitController;
|
||||
import mindustry.game.Team;
|
||||
import mindustry.gen.Groups;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.logic.LUnitControl;
|
||||
import mindustry.ui.Fonts;
|
||||
import mindustry.world.Tile;
|
||||
import mindustry.world.blocks.storage.CoreBlock;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static informatis.SUtils.*;
|
||||
import static arc.Core.settings;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class UnitDraw extends OverDraw {
|
||||
Seq<Tile> pathTiles = new Seq<>();
|
||||
int otherCores;
|
||||
|
||||
UnitDraw(String name, TextureRegionDrawable icon) {
|
||||
super(name, icon);
|
||||
registerOption("pathLine");
|
||||
registerOption("logicLine");
|
||||
registerOption("unitLine");
|
||||
registerOption("unitItem");
|
||||
registerOption("unitBar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
if(!enabled) return;
|
||||
|
||||
Groups.unit.each(u-> isInCamera(u.x, u.y, u.hitSize), u -> {
|
||||
UnitController c = u.controller();
|
||||
RtsAI rts = u.team.data().rtsAi;
|
||||
|
||||
if(settings.getBool("logicLine") && c instanceof LogicAI ai && (ai.control == LUnitControl.approach || ai.control == LUnitControl.move)) {
|
||||
Lines.stroke(1, u.team.color);
|
||||
Lines.line(u.x(), u.y(), ai.moveX, ai.moveY);
|
||||
Lines.stroke(0.5f + Mathf.absin(6f, 0.5f), Tmp.c1.set(Pal.logicOperations).lerp(Pal.sap, Mathf.absin(6f, 0.5f)));
|
||||
Lines.line(u.x(), u.y(), ai.controller.x, ai.controller.y);
|
||||
}
|
||||
|
||||
if(settings.getBool("unitLine") && !u.type.flying && !(c instanceof MinerAI || c instanceof BuilderAI || c instanceof RepairAI || c instanceof DefenderAI || c instanceof FlyingAI)) {
|
||||
Lines.stroke(1, u.team.color);
|
||||
|
||||
otherCores = Groups.build.count(b -> b instanceof CoreBlock.CoreBuild && b.team != u.team);
|
||||
pathTiles.clear();
|
||||
getNextTile(u.tileOn(), u.controller() instanceof SuicideAI ? 0 : u.pathType(), u.team, u.pathType());
|
||||
pathTiles.filter(Objects::nonNull);
|
||||
for(int i = 0; i < pathTiles.size-1; i++) {
|
||||
Tile from = pathTiles.get(i);
|
||||
Tile to = pathTiles.get(i + 1);
|
||||
if(isOutCamera(from.worldx(), from.worldy())) continue;
|
||||
Lines.line(from.worldx(), from.worldy(), to.worldx(), to.worldy());
|
||||
}
|
||||
}
|
||||
|
||||
if(settings.getBool("unitBar")) FreeBar.draw(u);
|
||||
|
||||
if(settings.getBool("unitItem") && !renderer.pixelator.enabled() && u.item() != null && u.itemTime > 0.01f)
|
||||
Fonts.outline.draw(u.stack.amount + "",
|
||||
u.x + Angles.trnsx(u.rotation + 180f, u.type.itemOffsetY),
|
||||
u.y + Angles.trnsy(u.rotation + 180f, u.type.itemOffsetY) - 3,
|
||||
Pal.accent, 0.25f * u.itemTime / Scl.scl(1f), false, Align.center);
|
||||
});
|
||||
|
||||
if(settings.getBool("pathLine")) spawner.getSpawns().each(t -> {
|
||||
Team enemyTeam = state.rules.waveTeam;
|
||||
Lines.stroke(1, enemyTeam.color);
|
||||
for(int p = 0; p < (Vars.state.rules.spawns.count(g->g.type.naval)>0?3:2); p++) {
|
||||
pathTiles.clear();
|
||||
otherCores = Groups.build.count(b -> b instanceof CoreBlock.CoreBuild && b.team != enemyTeam);
|
||||
getNextTile(t, p, enemyTeam, Pathfinder.fieldCore);
|
||||
pathTiles.filter(Objects::nonNull);
|
||||
|
||||
for(int i = 0; i < pathTiles.size-1; i++) {
|
||||
Tile from = pathTiles.get(i);
|
||||
Tile to = pathTiles.get(i + 1);
|
||||
if(isOutCamera(from.worldx(), from.worldy())) continue;
|
||||
Lines.line(from.worldx(), from.worldy(), to.worldx(), to.worldy());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Tile getNextTile(Tile tile, int cost, Team team, int finder) {
|
||||
Pathfinder.Flowfield field = pathfinder.getField(team, cost, Mathf.clamp(finder, 0, 0));
|
||||
Tile tile1 = pathfinder.getTargetTile(tile, field);
|
||||
pathTiles.add(tile1);
|
||||
if(tile1 == tile || tile1 == null ||
|
||||
(finder == 0 && (otherCores != Groups.build.count(b -> b instanceof CoreBlock.CoreBuild && b.team != team) || tile1.build instanceof CoreBlock.CoreBuild)))
|
||||
return tile1;
|
||||
return getNextTile(tile1, cost, team, finder);
|
||||
}
|
||||
}
|
||||
82
src/informatis/ui/draws/UtilDraw.java
Normal file
82
src/informatis/ui/draws/UtilDraw.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package informatis.ui.draws;
|
||||
|
||||
import arc.input.KeyCode;
|
||||
import arc.math.Angles;
|
||||
import arc.math.geom.Geometry;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import mindustry.entities.Units;
|
||||
import mindustry.game.Team;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.logic.Ranged;
|
||||
import mindustry.world.blocks.ControlBlock;
|
||||
import mindustry.world.blocks.defense.turrets.Turret;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class UtilDraw extends OverDraw {
|
||||
Teamc shotTarget;
|
||||
|
||||
UtilDraw(String name, TextureRegionDrawable icon) {
|
||||
super(name, icon);
|
||||
registerOption("autoShooting");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
super.draw();
|
||||
|
||||
if(!enabled) return;
|
||||
if(settings.getBool("autoShooting")) {
|
||||
Unit unit = player.unit();
|
||||
if (unit.type == null) return;
|
||||
boolean omni = unit.type.omniMovement;
|
||||
boolean validHealTarget = unit.type.canHeal && shotTarget instanceof Building b && b.isValid() && b.damaged() && shotTarget.team() == unit.team && shotTarget.within(unit, unit.type.range);
|
||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||
if ((unit.type != null && Units.invalidateTarget(shotTarget, unit, unit.type.range) && !validHealTarget) || state.isEditor()) {
|
||||
shotTarget = null;
|
||||
}
|
||||
|
||||
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());
|
||||
boolean aimCursor = omni && player.shooting && unit.type.hasWeapons() && unit.type.faceTarget && !boosted && unit.type.rotateToBuilding;
|
||||
unit.lookAt(aimCursor ? mouseAngle : unit.prefRotation());
|
||||
|
||||
//update shooting if not building + not mining
|
||||
if(!player.unit().activelyBuilding() && player.unit().mineTile == null) {
|
||||
if(input.keyDown(KeyCode.mouseLeft)) {
|
||||
player.shooting = !boosted;
|
||||
unit.aim(player.mouseX = input.mouseWorldX(), player.mouseY = input.mouseWorldY());
|
||||
} else if(shotTarget == null) {
|
||||
player.shooting = false;
|
||||
if(unit instanceof BlockUnitUnit b) {
|
||||
if(b.tile() instanceof ControlBlock c && !c.shouldAutoTarget()) {
|
||||
Building build = b.tile();
|
||||
float range = build instanceof Ranged ? ((Ranged) build).range() : 0f;
|
||||
boolean targetGround = build instanceof Turret.TurretBuild && ((Turret) build.block).targetAir;
|
||||
boolean targetAir = build instanceof Turret.TurretBuild && ((Turret) build.block).targetGround;
|
||||
shotTarget = Units.closestTarget(build.team, build.x, build.y, range, u -> u.checkTarget(targetAir, targetGround), u -> targetGround);
|
||||
}
|
||||
else shotTarget = null;
|
||||
} else if(unit.type != null) {
|
||||
float range = unit.hasWeapons() ? unit.range() : 0f;
|
||||
shotTarget = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(unit.type.targetAir, unit.type.targetGround), u -> unit.type.targetGround);
|
||||
|
||||
if(unit.type.canHeal && shotTarget == null) {
|
||||
shotTarget = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded));
|
||||
if (shotTarget != null && !unit.within(shotTarget, range)) {
|
||||
shotTarget = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.shooting = !boosted;
|
||||
unit.rotation(Angles.angle(unit.x, unit.y, shotTarget.x(), shotTarget.y()));
|
||||
unit.aim(shotTarget.x(), shotTarget.y());
|
||||
}
|
||||
}
|
||||
unit.controlWeapons(player.shooting && !boosted);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
206
src/informatis/ui/window/CoreWindow.java
Normal file
206
src/informatis/ui/window/CoreWindow.java
Normal file
@@ -0,0 +1,206 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
import arc.Events;
|
||||
import mindustry.game.EventType;
|
||||
import informatis.ui.*;
|
||||
import arc.Core;
|
||||
import arc.graphics.Color;
|
||||
import arc.math.Mathf;
|
||||
import arc.math.geom.Vec2;
|
||||
import arc.scene.event.HandCursorListener;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.struct.Seq;
|
||||
import arc.util.*;
|
||||
import mindustry.Vars;
|
||||
import mindustry.content.UnitTypes;
|
||||
import mindustry.core.UI;
|
||||
import mindustry.game.Team;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.input.DesktopInput;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.Styles;
|
||||
import mindustry.world.blocks.storage.CoreBlock;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class CoreWindow extends Window implements Updatable {
|
||||
Vec2 scrollPos = new Vec2(0, 0);
|
||||
Table window;
|
||||
float heat;
|
||||
ObjectMap<Team, ItemData> itemData = new ObjectMap<>();
|
||||
|
||||
public CoreWindow() {
|
||||
super(Icon.list, "core");
|
||||
resetUsed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Table table) {
|
||||
window = table;
|
||||
scrollPos = new Vec2(0, 0);
|
||||
|
||||
table.background(Styles.black8).top();
|
||||
table.add(new OverScrollPane(rebuild(), Styles.noBarPane, scrollPos).disableScroll(true, false)).grow().name("core-pane");
|
||||
Events.on(EventType.WorldLoadEvent.class, e -> resetUsed());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
heat += Time.delta;
|
||||
if(heat >= 60f) {
|
||||
heat = 0f;
|
||||
ScrollPane pane = find("core-pane");
|
||||
pane.setWidget(rebuild());
|
||||
for(Team team : getTeams()) {
|
||||
if(!itemData.containsKey(team)) itemData.put(team, new ItemData());
|
||||
itemData.get(team).updateItems(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Table rebuild() {
|
||||
return new Table(table -> {
|
||||
table.top();
|
||||
for(Team team : getTeams()) {
|
||||
table.table(row-> {
|
||||
row.center();
|
||||
row.add(setTable(team)).margin(8f).row();
|
||||
row.image().height(4f).color(team.color).growX();
|
||||
}).growX().row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Seq<Team> getTeams(){
|
||||
return Seq.with(Team.all).filter(Team::active);
|
||||
}
|
||||
|
||||
public void resetUsed(){
|
||||
for(Team team : getTeams()) {
|
||||
itemData.put(team, new ItemData());
|
||||
}
|
||||
}
|
||||
|
||||
public Table setTable(Team team){
|
||||
return new Table(table -> {
|
||||
table.add(team.name).color(team.color).row();
|
||||
int max = Math.max(1, Math.round(window.getWidth()/2/60));
|
||||
table.table(coretable -> {
|
||||
int row = 0;
|
||||
|
||||
for(CoreBlock.CoreBuild core : team.cores()) {
|
||||
coretable.table(tt -> {
|
||||
tt.stack(
|
||||
new Table(s -> {
|
||||
s.center();
|
||||
Image image = new Image(core.block.uiIcon);
|
||||
image.clicked(() -> {
|
||||
if(control.input instanceof DesktopInput)
|
||||
((DesktopInput) control.input).panning = true;
|
||||
Core.camera.position.set(core.x, core.y);
|
||||
});
|
||||
HandCursorListener listener1 = new HandCursorListener();
|
||||
image.addListener(listener1);
|
||||
image.update(() -> {
|
||||
image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta));
|
||||
});
|
||||
Tooltip.Tooltips option = new Tooltip.Tooltips();
|
||||
option.animations=false;
|
||||
s.add(image).size(iconLarge).get().addListener(new Tooltip(tool -> {
|
||||
tool.background(Styles.black6).label(() -> "([#" + Tmp.c1.set(Color.green).lerp(Color.red, 1 - core.healthf()).toString() + "]" + Strings.fixed(core.health, 2) + "[]/" + Strings.fixed(core.block.health, 2) + ")");
|
||||
}, option));
|
||||
}),
|
||||
new Table(h -> {
|
||||
h.bottom().defaults().height(9f).width(iconLarge * 1.5f).growX();
|
||||
h.add(new SBar(() -> "", () -> Pal.health, () -> core.health / core.block.health).rect().init());
|
||||
h.pack();
|
||||
})
|
||||
).row();
|
||||
Label label = new Label(Strings.format("(@, @)",core.tileX(), core.tileY()));
|
||||
label.setFontScale(0.75f);
|
||||
tt.add(label);
|
||||
}).padTop(2).padLeft(4).padRight(4);
|
||||
if(row++ % max == max-1){
|
||||
coretable.row();
|
||||
}
|
||||
}
|
||||
}).row();
|
||||
|
||||
table.table(itemTable -> {
|
||||
int row = 0;
|
||||
|
||||
CoreBlock.CoreBuild core = team.core();
|
||||
for(int i = 0; i < Vars.content.items().size; i++){
|
||||
Item item = Vars.content.item(i);
|
||||
if(!team.items().has(item)) return;
|
||||
itemTable.stack(
|
||||
new Table(ttt -> {
|
||||
ttt.image(item.uiIcon).size(iconSmall).tooltip(tttt -> tttt.background(Styles.black6).add(item.localizedName).style(Styles.outlineLabel).margin(2f));
|
||||
ttt.add(UI.formatAmount(core.items.get(item))).minWidth(5 * 8f).left();
|
||||
}),
|
||||
new Table(ttt -> {
|
||||
ttt.bottom().right();
|
||||
int amount = itemData.get(team).updateItems.isEmpty()?0:Mathf.floor(itemData.get(team).updateItems.get(item.id).amount);
|
||||
Label label = new Label(amount + "/s");
|
||||
label.setFontScale(0.65f);
|
||||
label.setColor(amount > 0 ? Color.green : amount == 0 ? Color.orange : Color.red);
|
||||
ttt.add(label).bottom().right().padTop(16f);
|
||||
ttt.pack();
|
||||
})).padRight(3).left();
|
||||
if(row++ % max == max-1){
|
||||
itemTable.row();
|
||||
}
|
||||
}
|
||||
}).row();
|
||||
|
||||
table.table(unitTable -> {
|
||||
int row = 0;
|
||||
|
||||
for(UnitType unit : Vars.content.units()){
|
||||
if(unit != UnitTypes.block && Groups.unit.contains(u -> u.type == unit && u.team == team)){
|
||||
unitTable.table(tt -> {
|
||||
tt.center();
|
||||
tt.image(unit.uiIcon).size(iconSmall).padRight(3).tooltip(ttt -> ttt.background(Styles.black6).add(unit.localizedName).style(Styles.outlineLabel).margin(2f));
|
||||
tt.add(UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit))).padRight(3).minWidth(5 * 8f).left();
|
||||
});
|
||||
if(row++ % max == max-1){
|
||||
unitTable.row();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
static class ItemData {
|
||||
Seq<ItemStack> prevItems = new Seq<>();
|
||||
Seq<ItemStack> updateItems = new Seq<>();
|
||||
|
||||
ItemData() {
|
||||
resetItems();
|
||||
}
|
||||
|
||||
public void resetItems(){
|
||||
Seq<ItemStack> stacks = Vars.content.items().map(item -> new ItemStack(item, 0));
|
||||
updateItems.clear().addAll(stacks);
|
||||
prevItems.clear().addAll(stacks);
|
||||
}
|
||||
|
||||
public void updateItems(Team team){
|
||||
CoreBlock.CoreBuild core = team.core();
|
||||
if (core != null) {
|
||||
Seq<ItemStack> stack = updateItems;
|
||||
if(stack.isEmpty()) Vars.content.items().each(i -> stack.add(new ItemStack(i, 0)));
|
||||
for (Item item : Vars.content.items()) {
|
||||
stack.get(item.id).set(item, core.items.get(item) - (prevItems != null ? prevItems.get(item.id).amount : 0));
|
||||
if (prevItems != null) prevItems.get(item.id).set(item, core.items.get(item));
|
||||
}
|
||||
|
||||
if(prevItems != null) prevItems.clear().addAll(Vars.content.items().map(i -> new ItemStack(i, core.items.get(i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
473
src/informatis/ui/window/MapEditorWindow.java
Normal file
473
src/informatis/ui/window/MapEditorWindow.java
Normal file
@@ -0,0 +1,473 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
import arc.Events;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.geom.Geometry;
|
||||
import arc.scene.Element;
|
||||
import arc.scene.style.Drawable;
|
||||
import arc.struct.ObjectMap;
|
||||
import mindustry.editor.MapEditor;
|
||||
import mindustry.game.EventType;
|
||||
import mindustry.graphics.Layer;
|
||||
import informatis.core.EditorTool;
|
||||
import informatis.ui.*;
|
||||
import arc.Core;
|
||||
import arc.func.*;
|
||||
import arc.graphics.Color;
|
||||
import arc.input.KeyCode;
|
||||
import arc.math.Mathf;
|
||||
import arc.math.geom.Vec2;
|
||||
import arc.scene.event.Touchable;
|
||||
import arc.scene.style.TextureRegionDrawable;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.scene.utils.Elem;
|
||||
import arc.struct.Seq;
|
||||
import arc.util.*;
|
||||
import mindustry.Vars;
|
||||
import mindustry.content.Blocks;
|
||||
import mindustry.game.Team;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.ui.Styles;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class MapEditorWindow extends Window implements Updatable {
|
||||
Vec2 scrollPos = new Vec2(0, 0);
|
||||
Table window;
|
||||
TextField search;
|
||||
EditorTool tool;
|
||||
final Vec2[][] brushPolygons = new Vec2[MapEditor.brushSizes.length][0];
|
||||
float heat;
|
||||
float brushSize = -1;
|
||||
|
||||
boolean drawing;
|
||||
int lastx, lasty;
|
||||
float lastw, lasth;
|
||||
|
||||
public static Team drawTeam = Team.sharded;
|
||||
public static Block drawBlock = Blocks.router;
|
||||
|
||||
public MapEditorWindow() {
|
||||
super(Icon.map, "editor");
|
||||
|
||||
for(int i = 0; i < MapEditor.brushSizes.length; i++){
|
||||
float size = MapEditor.brushSizes[i];
|
||||
float mod = size % 1f;
|
||||
brushPolygons[i] = Geometry.pixelCircle(size, (index, x, y) -> Mathf.dst(x, y, index - mod, index - mod) <= size - 0.5f);
|
||||
}
|
||||
|
||||
Events.run(EventType.Trigger.draw, ()->{
|
||||
float cx = Core.camera.position.x, cy = Core.camera.position.y;
|
||||
float scaling = 8;
|
||||
|
||||
Draw.z(Layer.max);
|
||||
|
||||
if(Core.settings.getBool("grid")){
|
||||
Lines.stroke(1f);
|
||||
Draw.color(Pal.accent);
|
||||
for(int i = (int)(-0.5f*Core.camera.height/8); i < (int)(0.5f*Core.camera.height/8); i++) {
|
||||
Lines.line(Mathf.floor((cx-0.5f*Core.camera.width)/8)*8+4, Mathf.floor((cy + i*8)/8)*8+4, Mathf.floor((cx+0.5f*Core.camera.width)/8)*8+4,Mathf.floor((cy + i*8)/8)*8+4);
|
||||
}
|
||||
for(int i = (int)(-0.5f*Core.camera.width/8); i < (int)(0.5f*Core.camera.width/8); i++) {
|
||||
Lines.line(Mathf.floor((cx + i*8)/8)*8+4, Mathf.floor((cy+0.5f*Core.camera.height)/8)*8+4, Mathf.floor((cx + i*8)/8)*8+4,Mathf.floor((cy-0.5f*Core.camera.height)/8)*8+4);
|
||||
}
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
Tile tile = world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
||||
if(tile == null || tool == null || brushSize < 1) return;
|
||||
|
||||
int index = 0;
|
||||
for(int i = 0; i < MapEditor.brushSizes.length; i++){
|
||||
if(brushSize == MapEditor.brushSizes[i]){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Lines.stroke(Scl.scl(2f), Pal.accent);
|
||||
|
||||
if((!drawBlock.isMultiblock() || tool == EditorTool.eraser) && tool != EditorTool.fill){
|
||||
if(tool == EditorTool.line && drawing){
|
||||
Lines.poly(brushPolygons[index], lastx, lasty, scaling);
|
||||
Lines.poly(brushPolygons[index], tile.x*8, tile.y*8, scaling);
|
||||
}
|
||||
|
||||
if((tool.edit || (tool == EditorTool.line && !drawing)) && (!mobile || drawing)){
|
||||
if(tool == EditorTool.pencil && tool.mode == 1){
|
||||
Lines.square(tile.x*8, tile.y*8, scaling * (brushSize + 0.5f));
|
||||
}else{
|
||||
Lines.poly(brushPolygons[index], tile.x*8-4, tile.y*8-4, scaling);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if((tool.edit || tool == EditorTool.line) && (!mobile || drawing)){
|
||||
float offset = (drawBlock.size % 2 == 0 ? scaling / 2f : 0f);
|
||||
Lines.square(
|
||||
tile.x*8 + scaling / 2f + offset,
|
||||
tile.y*8 + scaling / 2f + offset,
|
||||
scaling * drawBlock.size / 2f);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Table table) {
|
||||
scrollPos = new Vec2(0, 0);
|
||||
search = Elem.newField(null, f->{});
|
||||
search.setMessageText(Core.bundle.get("players.search")+"...");
|
||||
window = table;
|
||||
|
||||
table.left();
|
||||
table.top().background(Styles.black8);
|
||||
|
||||
ObjectMap<Drawable, Element> displays = new ObjectMap<>();
|
||||
displays.put(Icon.map, new Table(display -> {
|
||||
display.table(t->{
|
||||
t.left().background(Tex.underline2);
|
||||
t.label(()-> drawBlock == null ? "[gray]None[]" : "[accent]" + drawBlock.localizedName + "[] "+ drawBlock.emoji());
|
||||
t.add(search).growX().pad(8).name("search");
|
||||
}).growX().row();
|
||||
display.add(new OverScrollPane(rebuildEditor(), Styles.noBarPane, scrollPos).disableScroll(true, false)).grow().name("editor-pane").row();
|
||||
}));
|
||||
displays.put(Icon.settings, new Table(display -> {
|
||||
display.add(new OverScrollPane(rebuildRule(), Styles.noBarPane, scrollPos).disableScroll(true, false)).grow().name("rule-pane").row();
|
||||
}));
|
||||
|
||||
table.table(buttons -> {
|
||||
buttons.top().left();
|
||||
|
||||
displays.each((icon, display) -> {
|
||||
buttons.button(icon, Styles.clearTogglei, ()->{
|
||||
Log.info(table.getChildren().get(table.getChildren().size-1));
|
||||
if(table.getChildren().size > 1) table.getChildren().get(table.getChildren().size-1).remove();
|
||||
table.add(display).grow();
|
||||
}).row();
|
||||
});
|
||||
}).growY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
heat += Time.delta;
|
||||
if(heat >= 60f) {
|
||||
heat = 0f;
|
||||
|
||||
if(lastw != window.getWidth() || lasth != window.getHeight()) resetPane();
|
||||
lastw = width;
|
||||
lasth = height;
|
||||
}
|
||||
|
||||
Tile tile = world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
||||
if(tile == null || tool == null || brushSize < 1 || drawBlock == null || hasMouse()) return;
|
||||
if(Core.input.isTouched()) {
|
||||
if((tool == EditorTool.line && drawing) || (!mobile && !Core.input.keyDown(KeyCode.mouseLeft))) return;
|
||||
drawing = true;
|
||||
lastx = tile.x;
|
||||
lasty = tile.y;
|
||||
tool.touched(lastx, lasty);
|
||||
}
|
||||
else {
|
||||
if(tool == EditorTool.line && drawing) tool.touchedLine(lastx, lasty, tile.x, tile.y);
|
||||
drawing = false;
|
||||
lastx = -1;
|
||||
lasty = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void resetPane() {
|
||||
ScrollPane pane = find("editor-pane");
|
||||
if(pane != null) pane.setWidget(rebuildEditor());
|
||||
}
|
||||
|
||||
Table rebuildRule() {
|
||||
return new Table(table -> {
|
||||
table.top().left();
|
||||
|
||||
table.table(rules -> {
|
||||
rules.top().left();
|
||||
|
||||
Label label = rules.add("Block Health: ").get();
|
||||
Slider slider = new Slider(0, 100, 1, false);
|
||||
slider.changed(() -> {
|
||||
label.setText("Block Health: "+(int)slider.getValue()+"%");
|
||||
});
|
||||
slider.change();
|
||||
slider.moved(hp->Groups.build.each(b->b.health(b.block.health*hp/100)));
|
||||
rules.add(slider);
|
||||
}).grow();
|
||||
});
|
||||
}
|
||||
|
||||
Table rebuildEditor() {
|
||||
return new Table(table-> {
|
||||
table.top();
|
||||
Seq<Block> blocks = Vars.content.blocks().copy();
|
||||
if(search.getText().length() > 0){
|
||||
blocks.filter(p -> p.name.toLowerCase().contains(search.getText().toLowerCase())||p.localizedName.toLowerCase().contains(search.getText().toLowerCase()));
|
||||
}
|
||||
table.table(select-> this.buildBlockSelection(null, select, blocks, ()-> drawBlock, block-> drawBlock =block, false)).marginTop(16f).marginBottom(16f).row();
|
||||
table.image().height(4f).color(Pal.gray).growX().row();
|
||||
table.table(select-> this.buildTeamSelection(player.team(), select, Seq.with(Team.all), ()->drawTeam, block->drawTeam=block, false)).marginTop(16f).marginBottom(16f).row();
|
||||
table.image().height(4f).color(Pal.gray).growX().row();
|
||||
table.table(body-> {
|
||||
body.table(tools -> {
|
||||
tools.top().left();
|
||||
tools.table(title -> title.left().background(Tex.underline2).add("Tools [accent]"+(tool==null?"":tool.name())+"[]")).growX().row();
|
||||
tools.table(bt->{
|
||||
Cons<EditorTool> addTool = tool -> {
|
||||
ImageButton button = new ImageButton(ui.getIcon(tool.name()), Styles.clearTogglei);
|
||||
button.clicked(() -> {
|
||||
button.toggle();
|
||||
if(this.tool==tool) this.tool = null;
|
||||
else this.tool = tool;
|
||||
resetPane();
|
||||
});
|
||||
button.update(()->button.setChecked(this.tool == tool));
|
||||
|
||||
Label mode = new Label("");
|
||||
mode.setColor(Pal.remove);
|
||||
mode.update(() -> mode.setText(tool.mode == -1 ? "" : "M" + (tool.mode + 1) + " "));
|
||||
mode.setAlignment(Align.bottomRight, Align.bottomRight);
|
||||
mode.touchable = Touchable.disabled;
|
||||
|
||||
bt.stack(button, mode);
|
||||
};
|
||||
|
||||
addTool.get(EditorTool.line);
|
||||
addTool.get(EditorTool.pencil);
|
||||
addTool.get(EditorTool.eraser);
|
||||
addTool.get(EditorTool.fill);
|
||||
addTool.get(EditorTool.spray);
|
||||
|
||||
ImageButton grid = new ImageButton(Icon.grid, Styles.clearTogglei);
|
||||
grid.clicked(() -> {
|
||||
grid.toggle();
|
||||
Core.settings.put("grid", !Core.settings.getBool("grid"));
|
||||
});
|
||||
grid.update(()->grid.setChecked(Core.settings.getBool("grid")));
|
||||
bt.add(grid);
|
||||
});
|
||||
tools.row();
|
||||
Slider slider = new Slider(0, MapEditor.brushSizes.length - 1, 1, false);
|
||||
slider.moved(f -> brushSize = MapEditor.brushSizes[(int)f]);
|
||||
for(int j = 0; j < MapEditor.brushSizes.length; j++){
|
||||
if(MapEditor.brushSizes[j] == brushSize){
|
||||
slider.setValue(j);
|
||||
}
|
||||
}
|
||||
Label label = new Label("Brush: "+brushSize);
|
||||
label.touchable = Touchable.disabled;
|
||||
tools.stack(slider, label).width(getDisplayWidth()/5).center();
|
||||
}).left().width(getDisplayWidth() / 2).margin(8f).growY();
|
||||
body.image().width(4f).height(body.getHeight()).color(Pal.gray).growY();
|
||||
body.table(options -> {
|
||||
options.top().left();
|
||||
options.table(title -> title.left().background(Tex.underline2).add("Options [accent]"+(tool!=null&&tool.mode>=0&&tool.mode<tool.altModes.length?tool.altModes[tool.mode]:"")+"[]")).growX().row();
|
||||
options.table(option-> {
|
||||
if(tool==null) return;
|
||||
|
||||
option.top().left();
|
||||
for (int i = 0; i < tool.altModes.length; i++) {
|
||||
int mode = i;
|
||||
String name = tool.altModes[i];
|
||||
|
||||
option.button(b -> {
|
||||
b.left().marginLeft(6);
|
||||
b.setStyle(Styles.clearTogglei);
|
||||
b.add(Core.bundle.get("toolmode." + name)).left().row();
|
||||
b.add(Core.bundle.get("toolmode." + name + ".description")).color(Color.lightGray).left();
|
||||
}, () -> tool.mode = (tool.mode == mode ? -1 : mode)).update(b -> b.setChecked(tool.mode == mode)).margin(12f).growX().row();
|
||||
}
|
||||
}).grow();
|
||||
}).left().width(getDisplayWidth() / 2).margin(8f).growY();
|
||||
}).grow();
|
||||
});
|
||||
}
|
||||
|
||||
<T extends Block> void buildBlockSelection(@Nullable Block block, Table table, Seq<T> items, Prov<T> holder, Cons<T> consumer, boolean closeSelect){
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
group.setMinCheckCount(0);
|
||||
Table cont = new Table();
|
||||
cont.defaults().size(40);
|
||||
|
||||
int i = 0;
|
||||
int row = 4;
|
||||
int max = Math.max(row, Math.round(getDisplayWidth()/2/8/row));
|
||||
|
||||
for(T item : items){
|
||||
if(!item.unlockedNow()) continue;
|
||||
|
||||
ImageButton button = cont.button(Tex.whiteui, Styles.clearTogglei, 24, () -> {
|
||||
if(closeSelect) control.input.config.hideConfig();
|
||||
}).group(group).tooltip(t->t.background(Styles.black8).add(item.localizedName.replace(search.getText(), "[accent]"+search.getText()+"[]"))).get();
|
||||
button.changed(() -> consumer.get(button.isChecked() ? item : null));
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(item.uiIcon);
|
||||
button.update(() -> button.setChecked(holder.get() == item));
|
||||
|
||||
if(i++ % max == max-1){
|
||||
cont.row();
|
||||
}
|
||||
}
|
||||
|
||||
//add extra blank spaces so it looks nice
|
||||
if(i % max != 0){
|
||||
int remaining = max - (i % max);
|
||||
for(int j = 0; j < remaining; j++){
|
||||
cont.image(Styles.black6);
|
||||
}
|
||||
}
|
||||
|
||||
ScrollPane pane = new ScrollPane(cont, Styles.smallPane);
|
||||
pane.setScrollingDisabled(true, false);
|
||||
pane.setScrollYForce(blockScroll);
|
||||
pane.update(() -> blockScroll = pane.getScrollY());
|
||||
pane.setOverscroll(false, false);
|
||||
table.add(pane).maxHeight(Scl.scl(row * 10 * 5));
|
||||
}
|
||||
float blockScroll;
|
||||
|
||||
<T extends Team> void buildTeamSelection(@Nullable Team team, Table table, Seq<T> items, Prov<T> holder, Cons<T> consumer, boolean closeSelect){
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
group.setMinCheckCount(0);
|
||||
Table cont = new Table();
|
||||
cont.defaults().size(40);
|
||||
|
||||
int i = 0;
|
||||
int row = 2;
|
||||
int max = Math.max(row, Math.round(getDisplayWidth()/2/8/row/2));
|
||||
|
||||
for(T item : items){
|
||||
ImageButton button = cont.button(Tex.whiteui, Styles.clearTogglei, 24, () -> {
|
||||
if(closeSelect) control.input.config.hideConfig();
|
||||
}).group(group).tooltip(t->t.background(Styles.black8).add(item.localized().replace(search.getText(), "[accent]"+search.getText()+"[]"))).with(img -> img.getStyle().imageUpColor = item.color).get();
|
||||
button.changed(() -> consumer.get(button.isChecked() ? item : null));
|
||||
button.update(() -> button.setChecked(holder.get() == item));
|
||||
|
||||
if(i++ % max == max-1){
|
||||
cont.row();
|
||||
}
|
||||
}
|
||||
|
||||
//add extra blank spaces so it looks nice
|
||||
if(i % max != 0){
|
||||
int remaining = max - (i % max);
|
||||
for(int j = 0; j < remaining; j++){
|
||||
cont.image(Styles.black6);
|
||||
}
|
||||
}
|
||||
|
||||
ScrollPane pane = new ScrollPane(cont, Styles.smallPane);
|
||||
pane.setScrollingDisabled(true, false);
|
||||
pane.setScrollYForce(teamScroll);
|
||||
pane.update(() -> teamScroll = pane.getScrollY());
|
||||
pane.setOverscroll(false, false);
|
||||
table.add(pane).maxHeight(Scl.scl(row * 10 * 5));
|
||||
}
|
||||
float teamScroll;
|
||||
|
||||
float getDisplayWidth() {
|
||||
return window.getWidth() - (window.find("buttons") == null ? 1 : window.find("buttons").getWidth());
|
||||
}
|
||||
|
||||
public void drawBlocksReplace(int x, int y){
|
||||
drawBlocks(x, y, tile -> tile.block() != Blocks.air || drawBlock.isFloor());
|
||||
}
|
||||
|
||||
public void drawBlocks(int x, int y){
|
||||
drawBlocks(x, y, false, tile -> true);
|
||||
}
|
||||
|
||||
public void drawBlocks(int x, int y, Boolf<Tile> tester){
|
||||
drawBlocks(x, y, false, tester);
|
||||
}
|
||||
|
||||
int rotation = 0;
|
||||
public void drawBlocks(int x, int y, boolean square, Boolf<Tile> tester){
|
||||
if(drawBlock.isMultiblock()){
|
||||
x = Mathf.clamp(x, (drawBlock.size - 1) / 2, world.width() - drawBlock.size / 2 - 1);
|
||||
y = Mathf.clamp(y, (drawBlock.size - 1) / 2, world.height() - drawBlock.size / 2 - 1);
|
||||
if(!hasOverlap(x, y)){
|
||||
world.tile(x, y).setBlock(drawBlock, drawTeam, rotation);
|
||||
}
|
||||
}else{
|
||||
boolean isFloor = drawBlock.isFloor() && drawBlock != Blocks.air;
|
||||
|
||||
Cons<Tile> drawer = tile -> {
|
||||
if(!tester.get(tile)) return;
|
||||
|
||||
if(isFloor){
|
||||
tile.setFloor(drawBlock.asFloor());
|
||||
}else if(!(tile.block().isMultiblock() && !drawBlock.isMultiblock())){
|
||||
tile.setBlock(drawBlock, drawTeam, rotation);
|
||||
}
|
||||
};
|
||||
|
||||
if(square){
|
||||
drawSquare(x, y, drawer);
|
||||
}else{
|
||||
drawCircle(x, y, drawer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawCircle(int x, int y, Cons<Tile> drawer){
|
||||
int clamped = (int)brushSize;
|
||||
for(int rx = -clamped; rx <= clamped; rx++){
|
||||
for(int ry = -clamped; ry <= clamped; ry++){
|
||||
if(Mathf.within(rx, ry, brushSize - 0.5f + 0.0001f)){
|
||||
int wx = x + rx, wy = y + ry;
|
||||
|
||||
if(wx < 0 || wy < 0 || wx >= world.width() || wy >= world.height()){
|
||||
continue;
|
||||
}
|
||||
|
||||
drawer.get(world.tile(wx, wy));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawSquare(int x, int y, Cons<Tile> drawer){
|
||||
int clamped = (int)brushSize;
|
||||
for(int rx = -clamped; rx <= clamped; rx++){
|
||||
for(int ry = -clamped; ry <= clamped; ry++){
|
||||
int wx = x + rx, wy = y + ry;
|
||||
|
||||
if(wx < 0 || wy < 0 || wx >= world.width() || wy >= world.height()){
|
||||
continue;
|
||||
}
|
||||
|
||||
drawer.get(world.tile(wx, wy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasOverlap(int x, int y){
|
||||
Tile tile = world.tile(x, y);
|
||||
//allow direct replacement of blocks of the same size
|
||||
if(tile != null && tile.isCenter() && tile.block() != drawBlock && tile.block().size == drawBlock.size && tile.x == x && tile.y == y){
|
||||
return false;
|
||||
}
|
||||
|
||||
//else, check for overlap
|
||||
int offsetx = -(drawBlock.size - 1) / 2;
|
||||
int offsety = -(drawBlock.size - 1) / 2;
|
||||
for(int dx = 0; dx < drawBlock.size; dx++){
|
||||
for(int dy = 0; dy < drawBlock.size; dy++){
|
||||
int worldx = dx + offsetx + x;
|
||||
int worldy = dy + offsety + y;
|
||||
Tile other = world.tile(worldx, worldy);
|
||||
|
||||
if(other != null && other.block().isMultiblock()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
121
src/informatis/ui/window/PlayerWindow.java
Normal file
121
src/informatis/ui/window/PlayerWindow.java
Normal file
@@ -0,0 +1,121 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
import informatis.ui.OverScrollPane;
|
||||
import informatis.ui.Updatable;
|
||||
import arc.Core;
|
||||
import arc.graphics.Color;
|
||||
import arc.graphics.g2d.Draw;
|
||||
import arc.graphics.g2d.Lines;
|
||||
import arc.math.geom.Vec2;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.scene.utils.Elem;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.input.DesktopInput;
|
||||
import mindustry.ui.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
|
||||
public class PlayerWindow extends Window implements Updatable {
|
||||
Vec2 scrollPos = new Vec2(0, 0);
|
||||
TextField search;
|
||||
ImageButton.ImageButtonStyle ustyle;
|
||||
@Nullable Player target;
|
||||
float heat;
|
||||
|
||||
public PlayerWindow() {
|
||||
super(Icon.players, "player");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Table table) {
|
||||
scrollPos = new Vec2(0, 0);
|
||||
search = Elem.newField(null, f->{});
|
||||
search.setMessageText(Core.bundle.get("players.search"));
|
||||
|
||||
ustyle = new ImageButton.ImageButtonStyle(){{
|
||||
down = Styles.none;
|
||||
up = Styles.none;
|
||||
imageDownColor = Pal.accent;
|
||||
imageUpColor = Color.white;
|
||||
imageOverColor = Color.lightGray;
|
||||
}};
|
||||
|
||||
table.background(Styles.black8).top();
|
||||
table.label(()-> Core.bundle.format(Groups.player.size() == 1 ? "players.single" : "players", Groups.player.size())).row();
|
||||
table.add(search).growX().pad(8).name("search").maxTextLength(maxNameLength).row();
|
||||
table.add(new OverScrollPane(rebuild(), Styles.noBarPane, scrollPos).disableScroll(true, false)).grow().name("player-pane");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
heat += Time.delta;
|
||||
if(heat >= 60f) {
|
||||
heat = 0f;
|
||||
ScrollPane pane = find("player-pane");
|
||||
pane.setWidget(rebuild());
|
||||
}
|
||||
if(target!=null) {
|
||||
if(control.input instanceof DesktopInput)
|
||||
((DesktopInput) control.input).panning = true;
|
||||
Core.camera.position.set(target.x, target.y);
|
||||
}
|
||||
}
|
||||
|
||||
public Table rebuild(){
|
||||
return new Table(table -> {
|
||||
float h = 74f;
|
||||
|
||||
Seq<Player> players = Groups.player.copy(new Seq<>());
|
||||
|
||||
players.sort(Structs.comps(Structs.comparing(Player::team), Structs.comparingBool(p -> !p.admin)));
|
||||
if(search.getText().length() > 0){
|
||||
players.filter(p -> Strings.stripColors(p.name().toLowerCase()).contains(search.getText().toLowerCase()));
|
||||
}
|
||||
|
||||
if(players.isEmpty()){
|
||||
table.add(Core.bundle.format("players.notfound")).center();
|
||||
return;
|
||||
}
|
||||
|
||||
for(Player user : players){
|
||||
table.table(userTable-> {
|
||||
userTable.left().margin(5).marginBottom(10);
|
||||
|
||||
Table table1 = new Table(){
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
Draw.color(target==user?Pal.accent:Pal.gray);
|
||||
Draw.alpha(parentAlpha);
|
||||
Lines.stroke(Scl.scl(4f));
|
||||
Lines.rect(x, y, width, height);
|
||||
Draw.reset();
|
||||
}
|
||||
};
|
||||
table1.margin(8);
|
||||
table1.add(new Image(user.icon()).setScaling(Scaling.bounded)).grow();
|
||||
table1.clicked(() -> {
|
||||
if(target==user) target = null;
|
||||
else target = user;
|
||||
});
|
||||
|
||||
userTable.add(table1).size(h).name(user.name()); //unit icon
|
||||
userTable.labelWrap(user.name()).color(user.color()).width(170f).pad(10); //name
|
||||
userTable.image(Icon.admin).padRight(5).visible(()->user.admin); //admin
|
||||
userTable.button(Icon.hammer, ustyle, () -> { //vote kick
|
||||
ui.showConfirm("@confirm", Core.bundle.format("confirmvotekick", user.name()), () -> {
|
||||
Call.sendChatMessage("/votekick " + user.name());
|
||||
});
|
||||
}).right().visible(()->user.team()==player.team()&&user!=player&&!user.admin);
|
||||
}).padBottom(-6).maxHeight(h + 14).row();
|
||||
table.image().height(4f).color(state.rules.pvp ? user.team().color : Pal.gray).growX().row();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
74
src/informatis/ui/window/ToolWindow.java
Normal file
74
src/informatis/ui/window/ToolWindow.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
import informatis.ui.OverScrollPane;
|
||||
import informatis.ui.Updatable;
|
||||
import informatis.ui.draws.OverDraw;
|
||||
import informatis.ui.draws.OverDraws;
|
||||
import arc.math.geom.Vec2;
|
||||
import arc.scene.ui.ScrollPane;
|
||||
import arc.scene.ui.layout.Table;
|
||||
import arc.util.Time;
|
||||
import mindustry.gen.Icon;
|
||||
import mindustry.gen.Tex;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.ui.Styles;
|
||||
|
||||
public class ToolWindow extends Window implements Updatable {
|
||||
Vec2 scrollPos = new Vec2(0, 0);
|
||||
OverDraw selected;
|
||||
float heat;
|
||||
|
||||
public ToolWindow() {
|
||||
super(Icon.edit, "tool");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Table table) {
|
||||
scrollPos = new Vec2(0, 0);
|
||||
|
||||
table.background(Styles.black8).top().left();
|
||||
table.table(pane->{
|
||||
pane.add(new OverScrollPane(rebuild(), Styles.noBarPane, scrollPos).disableScroll(true, false)).name("tool-pane");
|
||||
}).top().marginLeft(4f).marginRight(12f);
|
||||
table.table(stats->{
|
||||
stats.top();
|
||||
stats.add(rebuildStats()).name("tool-stats");
|
||||
}).growY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
heat += Time.delta;
|
||||
if(heat >= 60f) {
|
||||
heat = 0f;
|
||||
ScrollPane pane = find("tool-pane");
|
||||
pane.setWidget(rebuild());
|
||||
}
|
||||
}
|
||||
|
||||
Table rebuild() {
|
||||
return new Table(icons->{
|
||||
for(OverDraw draw : OverDraws.all) {
|
||||
icons.button(draw.icon, ()->{
|
||||
selected=draw;
|
||||
Table table = find("tool-stats");
|
||||
table.clearChildren();
|
||||
table.add(rebuildStats());
|
||||
}).grow().tooltip(t->t.background(Styles.black8).add(draw.name).color(Pal.accent)).row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Table rebuildStats() {
|
||||
return new Table(tool->{
|
||||
if(selected==null) return;
|
||||
tool.top();
|
||||
tool.table(Tex.underline2, label->label.add(selected.name).color(Pal.accent)).row();
|
||||
tool.table(des-> selected.displayStats(des)).name("unit-stats").row();
|
||||
tool.check("enable", selected.enabled, c->{
|
||||
selected.enabled=c;
|
||||
selected.onEnabled(find("unit-stats"));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
253
src/informatis/ui/window/UnitWindow.java
Normal file
253
src/informatis/ui/window/UnitWindow.java
Normal file
@@ -0,0 +1,253 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
import arc.math.Mathf;
|
||||
import informatis.core.*;
|
||||
import informatis.ui.*;
|
||||
import arc.graphics.Color;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.Bits;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.Vars;
|
||||
import mindustry.core.UI;
|
||||
import mindustry.entities.units.WeaponMount;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.type.StatusEffect;
|
||||
import mindustry.type.Weapon;
|
||||
import mindustry.ui.Styles;
|
||||
import mindustry.world.blocks.ConstructBlock;
|
||||
import mindustry.world.blocks.payloads.Payload;
|
||||
|
||||
import static informatis.SVars.*;
|
||||
import static informatis.SUtils.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
class UnitWindow extends Window {
|
||||
final Seq<Color> lastColors = Seq.with(Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear);
|
||||
final Rect scissor = new Rect();
|
||||
Seq<Table> bars = new Seq<>(); //temp
|
||||
Vec2 scrollPos = new Vec2(0, 0);
|
||||
|
||||
public UnitWindow() {
|
||||
super(Icon.units, "unit");
|
||||
for(int i = 0; i < 6; i++) addBar();
|
||||
}
|
||||
|
||||
//TODO: add new UnitInfoDisplay(), new WeaponDisplay();
|
||||
@Override
|
||||
protected void build(Table table) {
|
||||
scrollPos = new Vec2(0, 0);
|
||||
table.top().background(Styles.black8);
|
||||
table.table(tt -> {
|
||||
tt.center();
|
||||
Image image = new Image() {
|
||||
@Override
|
||||
public void draw() {
|
||||
super.draw();
|
||||
|
||||
int offset = 8;
|
||||
Draw.color(locked?Pal.accent:Pal.gray);
|
||||
Draw.alpha(parentAlpha);
|
||||
Lines.stroke(Scl.scl(3f));
|
||||
Lines.rect(x-offset/2f, y-offset/2f, width+offset, height+offset);
|
||||
Draw.reset();
|
||||
}
|
||||
};
|
||||
image.update(()->{
|
||||
TextureRegion region = clear;
|
||||
if (target instanceof Unit u && u.type != null) region = u.type.uiIcon;
|
||||
else if (target instanceof Building b) {
|
||||
if (target instanceof ConstructBlock.ConstructBuild cb) region = cb.current.uiIcon;
|
||||
else if (b.block != null) region = b.block.uiIcon;
|
||||
}
|
||||
image.setDrawable(region);
|
||||
});
|
||||
image.clicked(()->{
|
||||
if(target==getTarget()) locked = !locked;
|
||||
target = getTarget();
|
||||
});
|
||||
|
||||
tt.add(image).size(iconMed).padRight(12f);
|
||||
tt.label(() -> {
|
||||
if (target instanceof Unit u && u.type != null) return u.type.localizedName;
|
||||
if (target instanceof Building b && b.block != null) {
|
||||
if (target instanceof ConstructBlock.ConstructBuild cb) return cb.current.localizedName;
|
||||
return b.block.localizedName;
|
||||
}
|
||||
return "";
|
||||
}).color(Pal.accent);
|
||||
}).tooltip((to -> {
|
||||
to.background(Styles.black6);
|
||||
to.label(() -> target instanceof Unit u && u.isPlayer() ? u.getPlayer().name() : "AI").row();
|
||||
to.label(() -> target == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(target.x() / tilesize, 2) + ", " + Strings.fixed(target.y() / tilesize, 2) + ")").row();
|
||||
to.label(() -> target instanceof Unit u ? "[accent]"+ Strings.fixed(u.armor, 0) + "[] Armor" : "");
|
||||
})).margin(12f).row();
|
||||
table.image().height(4f).color((target==null?player.unit():target).team().color).growX().row();
|
||||
table.add(new OverScrollPane(new Table(bars -> {
|
||||
bars.top();
|
||||
bars.table().update(t->{
|
||||
t.clear();
|
||||
this.bars.clear();
|
||||
for(int i = 0; i < 6; i++) addBar();
|
||||
for (Table bar : this.bars) {
|
||||
t.add(bar).growX().row();
|
||||
}
|
||||
}).growX();
|
||||
}), Styles.noBarPane, scrollPos).disableScroll(true, false)).growX().padTop(12f);
|
||||
}
|
||||
|
||||
void addBar() {
|
||||
int index = this.bars.size;
|
||||
bars.add(new Table(bar -> {
|
||||
bar.add(new SBar(
|
||||
() -> {
|
||||
BarInfo.BarData data = index >= BarInfo.data.size ? null : BarInfo.data.get(index);
|
||||
return data == null ? "[lightgray]<Empty>[]" : data.name;
|
||||
},
|
||||
() -> {
|
||||
BarInfo.BarData data = index >= BarInfo.data.size ? null : BarInfo.data.get(index);
|
||||
if (index >= lastColors.size) lastColors.size = index+1;
|
||||
if (data == null) return lastColors.get(index);
|
||||
if (data.color != Color.clear) lastColors.set(index, data.color);
|
||||
return lastColors.get(index);
|
||||
},
|
||||
() -> {
|
||||
BarInfo.BarData data = index >= BarInfo.data.size ? null : BarInfo.data.get(index);
|
||||
return data == null ? 0 : data.number;
|
||||
}
|
||||
)).height(4 * 8f).growX();
|
||||
bar.add(new Image(){
|
||||
@Override
|
||||
public void draw() {
|
||||
validate();
|
||||
|
||||
BarInfo.BarData data = index >= BarInfo.data.size ? null : BarInfo.data.get(index);
|
||||
Draw.color(Color.white);
|
||||
Draw.alpha(parentAlpha * color.a);
|
||||
if(data == null) {
|
||||
new TextureRegionDrawable(clear).draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
||||
return;
|
||||
}
|
||||
TextureRegionDrawable region = new TextureRegionDrawable(data.icon);
|
||||
region.draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
||||
Draw.color(data.color);
|
||||
if(ScissorStack.push(scissor.set(x, y, imageWidth * scaleX, imageHeight * scaleY * data.number))){
|
||||
region.draw(x, y, imageWidth * scaleX, imageHeight * scaleY);
|
||||
ScissorStack.pop();
|
||||
}
|
||||
}
|
||||
}).size(iconMed * 0.75f).padLeft(8f);
|
||||
}));
|
||||
}
|
||||
|
||||
static class WeaponDisplay extends Table {
|
||||
WeaponDisplay() {
|
||||
table().update(tt -> {
|
||||
tt.clear();
|
||||
if(getTarget() instanceof Unit u && u.type != null && u.hasWeapons()) {
|
||||
for(int r = 0; r < u.type.weapons.size; r++){
|
||||
Weapon weapon = u.type.weapons.get(r);
|
||||
WeaponMount mount = u.mounts[r];
|
||||
int finalR = r;
|
||||
tt.table(ttt -> {
|
||||
ttt.left();
|
||||
if((1 + finalR) % 4 == 0) ttt.row();
|
||||
ttt.stack(
|
||||
new Table(o -> {
|
||||
o.left();
|
||||
o.add(new Image(!weapon.name.equals("") && weapon.outlineRegion.found() ? weapon.outlineRegion : u.type.uiIcon){
|
||||
@Override
|
||||
public void draw(){
|
||||
validate();
|
||||
float x = this.x;
|
||||
float y = this.y;
|
||||
float scaleX = this.scaleX;
|
||||
float scaleY = this.scaleY;
|
||||
Draw.color(color);
|
||||
Draw.alpha(parentAlpha * color.a);
|
||||
|
||||
if(getDrawable() instanceof TransformDrawable){
|
||||
float rotation = getRotation();
|
||||
if(scaleX != 1 || scaleY != 1 || rotation != 0){
|
||||
getDrawable().draw(x + imageX, y + imageY, originX - imageX, originY - imageY, imageWidth, imageHeight, scaleX, scaleY, rotation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
y -= (mount.reload) / weapon.reload * weapon.recoil;
|
||||
if(getDrawable() != null)
|
||||
getDrawable().draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
||||
}
|
||||
}).size(iconLarge);
|
||||
}),
|
||||
new Table(h -> {
|
||||
h.defaults().growX().height(9f).width(iconLarge).padTop(18f);
|
||||
h.add(new SBar(
|
||||
() -> "",
|
||||
() -> Pal.accent.cpy().lerp(Color.orange, mount.reload / weapon.reload),
|
||||
() -> mount.reload / weapon.reload).rect().init());
|
||||
h.pack();
|
||||
})
|
||||
);
|
||||
}).pad(4);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
static class UnitInfoDisplay extends Table {
|
||||
UnitInfoDisplay() {
|
||||
top();
|
||||
float[] count = new float[]{-1};
|
||||
table().update(t -> {
|
||||
if(getTarget() instanceof Payloadc payload){
|
||||
if(count[0] != payload.payloadUsed()){
|
||||
t.clear();
|
||||
t.top().left();
|
||||
|
||||
float pad = 0;
|
||||
float items = payload.payloads().size;
|
||||
if(8 * 2 * items + pad * items > 275f){
|
||||
pad = (275f - (8 * 2) * items) / items;
|
||||
}
|
||||
int i = 0;
|
||||
for(Payload p : payload.payloads()){
|
||||
t.image(p.icon()).size(8 * 2).padRight(pad);
|
||||
if(++i % 12 == 0) t.row();
|
||||
}
|
||||
|
||||
count[0] = payload.payloadUsed();
|
||||
}
|
||||
}else{
|
||||
count[0] = -1;
|
||||
t.clear();
|
||||
}
|
||||
}).growX().visible(() -> getTarget() instanceof Payloadc p && p.payloadUsed() > 0).colspan(2).row();
|
||||
|
||||
Bits statuses = new Bits();
|
||||
table().update(t -> {
|
||||
t.left();
|
||||
if(getTarget() instanceof Statusc st){
|
||||
Bits applied = st.statusBits();
|
||||
if(!statuses.equals(applied)){
|
||||
t.clear();
|
||||
|
||||
if(applied != null){
|
||||
for(StatusEffect effect : Vars.content.statusEffects()){
|
||||
if(applied.get(effect.id) && !effect.isHidden()){
|
||||
t.image(effect.uiIcon).size(iconSmall).get()
|
||||
.addListener(new Tooltip(l -> l.label(() -> effect.localizedName + " [lightgray]" + UI.formatTime(st.getDuration(effect))).style(Styles.outlineLabel)));
|
||||
}
|
||||
}
|
||||
statuses.set(applied);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).left();
|
||||
}
|
||||
}
|
||||
}
|
||||
207
src/informatis/ui/window/WaveWindow.java
Normal file
207
src/informatis/ui/window/WaveWindow.java
Normal file
@@ -0,0 +1,207 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
import mindustry.Vars;
|
||||
import mindustry.type.UnitType;
|
||||
import informatis.ui.OverScrollPane;
|
||||
import arc.Events;
|
||||
import arc.graphics.Color;
|
||||
import arc.math.Mathf;
|
||||
import arc.math.geom.Vec2;
|
||||
import arc.scene.event.Touchable;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.StatusEffects;
|
||||
import mindustry.game.EventType;
|
||||
import mindustry.game.SpawnGroup;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.ui.*;
|
||||
import informatis.ui.Updatable;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static arc.Core.settings;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
|
||||
public class WaveWindow extends Window implements Updatable {
|
||||
static Vec2 scrollPos = new Vec2(0, 0);
|
||||
Table window;
|
||||
float heat;
|
||||
|
||||
public WaveWindow() {
|
||||
super(Icon.waves, "wave");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Table table) {
|
||||
window = table;
|
||||
|
||||
table.top().background(Styles.black8);
|
||||
ScrollPane pane = new OverScrollPane(rebuild(), Styles.noBarPane, scrollPos).disableScroll(true, false);
|
||||
table.add(pane).grow().name("wave-pane").row();
|
||||
table.table(total -> {
|
||||
total.left();
|
||||
total.label(()->"~"+state.wave+"+");
|
||||
total.field(""+settings.getInt("wavemax"), f->{
|
||||
String str = f.replaceAll("\\D", "");
|
||||
if(str.isEmpty()) settings.put("wavemax", 0);
|
||||
else settings.put("wavemax", Integer.parseInt(str));
|
||||
});
|
||||
total.table().update(units->{
|
||||
units.clear();
|
||||
units.center();
|
||||
|
||||
if(Groups.unit.count(u->u.team==state.rules.waveTeam) <= 0) {
|
||||
units.add("[lightgray]<Empty>[]");
|
||||
return;
|
||||
}
|
||||
|
||||
int row = 0;
|
||||
int max = Math.max(1, Math.round(window.getWidth()/2/8/2));
|
||||
for (UnitType unit : Vars.content.units()) {
|
||||
int amount = Groups.unit.count(u->u.type==unit&&u.team==state.rules.waveTeam);
|
||||
if(amount<=0) continue;
|
||||
units.stack(
|
||||
new Table(ttt -> {
|
||||
ttt.center();
|
||||
ttt.image(unit.uiIcon).size(iconMed);
|
||||
ttt.pack();
|
||||
}),
|
||||
|
||||
new Table(ttt -> {
|
||||
ttt.bottom().left();
|
||||
ttt.add(amount + "").padTop(2f).fontScale(0.9f);
|
||||
ttt.pack();
|
||||
})
|
||||
).pad(2f);
|
||||
if(row++ % max == max-1){
|
||||
units.row();
|
||||
}
|
||||
}
|
||||
}).growX();
|
||||
}).growX().row();
|
||||
table.image().height(4f).color(Pal.gray).growX().row();
|
||||
table.table(option->{
|
||||
option.check("Show empty wave", settings.getBool("emptywave"), b->settings.put("emptywave", b)).margin(4f);
|
||||
option.check("Show previous wave", settings.getBool("pastwave"), b->settings.put("pastwave", b)).margin(4f);
|
||||
});
|
||||
Events.on(EventType.WorldLoadEvent.class, e -> {
|
||||
pane.clearChildren();
|
||||
pane.setWidget(rebuild());
|
||||
});
|
||||
Events.on(EventType.WaveEvent.class, e -> {
|
||||
pane.clearChildren();
|
||||
pane.setWidget(rebuild());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
heat += Time.delta;
|
||||
if(heat >= 60f) {
|
||||
heat = 0f;
|
||||
ScrollPane pane = find("wave-pane");
|
||||
pane.setWidget(rebuild());
|
||||
}
|
||||
}
|
||||
|
||||
public ObjectIntMap<SpawnGroup> getWaveGroup(int index) {
|
||||
ObjectIntMap<SpawnGroup> groups = new ObjectIntMap<>();
|
||||
for (SpawnGroup group : state.rules.spawns) {
|
||||
if (group.getSpawned(index) <= 0) continue;
|
||||
SpawnGroup sameTypeKey = groups.keys().toArray().find(g -> g.type == group.type && g.effect != StatusEffects.boss);
|
||||
if (sameTypeKey != null) groups.increment(sameTypeKey, sameTypeKey.getSpawned(index));
|
||||
else groups.put(group, group.getSpawned(index));
|
||||
}
|
||||
Seq<SpawnGroup> groupSorted = groups.keys().toArray().copy().sort((g1, g2) -> {
|
||||
int boss = Boolean.compare(g1.effect != StatusEffects.boss, g2.effect != StatusEffects.boss);
|
||||
if (boss != 0) return boss;
|
||||
int hitSize = Float.compare(-g1.type.hitSize, -g2.type.hitSize);
|
||||
if (hitSize != 0) return hitSize;
|
||||
return Integer.compare(-g1.type.id, -g2.type.id);
|
||||
});
|
||||
ObjectIntMap<SpawnGroup> groupsTmp = new ObjectIntMap<>();
|
||||
groupSorted.each(g -> groupsTmp.put(g, groups.get(g)));
|
||||
|
||||
return groupsTmp;
|
||||
}
|
||||
|
||||
Table rebuild(){
|
||||
return new Table(table -> {
|
||||
table.touchable = Touchable.enabled;
|
||||
table.table(body->{
|
||||
body.center();
|
||||
for (int i = settings.getBool("pastwave") ? 1 : state.wave; i <= Math.min(state.wave + settings.getInt("wavemax"), (state.isCampaign() && state.rules.winWave > 0 ? state.rules.winWave : Integer.MAX_VALUE)); i++) {
|
||||
final int index = i;
|
||||
|
||||
if (state.rules.spawns.find(g -> g.getSpawned(index-1) > 0) == null && !settings.getBool("emptywave")) continue;
|
||||
|
||||
body.table(waveRow -> {
|
||||
waveRow.left();
|
||||
|
||||
waveRow.add(index+"").update(label -> {
|
||||
Color color = Pal.accent;
|
||||
if (state.wave == index) color = Color.red;
|
||||
else if (state.wave - 1 == index && state.enemies > 0) color = Color.red.cpy().shiftHue(Time.time);
|
||||
|
||||
label.setColor(color);
|
||||
});
|
||||
waveRow.table(unitTable -> {
|
||||
unitTable.center();
|
||||
|
||||
if (state.rules.spawns.find(g -> g.getSpawned(index-1) > 0) == null) {
|
||||
if (settings.getBool("emptywave")) unitTable.add(bundle.get("empty"));
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectIntMap<SpawnGroup> groups = getWaveGroup(index-1);
|
||||
|
||||
int row = 0;
|
||||
int max = Math.max(1, Math.round(window.getWidth()/2/8));
|
||||
for (SpawnGroup group : groups.keys()) {
|
||||
int spawners = state.rules.waveTeam.cores().size + (group.type.flying ? spawner.countFlyerSpawns() : spawner.countGroundSpawns());
|
||||
int amount = groups.get(group);
|
||||
unitTable.stack(
|
||||
new Table(ttt -> {
|
||||
ttt.center();
|
||||
ttt.image(group.type.uiIcon).size(iconMed);
|
||||
ttt.pack();
|
||||
}),
|
||||
|
||||
new Table(ttt -> {
|
||||
ttt.bottom().left();
|
||||
ttt.add(amount + "").padTop(2f).fontScale(0.9f);
|
||||
ttt.add("[gray]x" + spawners).padTop(10f).fontScale(0.7f);
|
||||
ttt.pack();
|
||||
}),
|
||||
|
||||
new Table(ttt -> {
|
||||
ttt.top().right();
|
||||
ttt.image(Icon.warning.getRegion()).update(img -> img.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)))).size(12f);
|
||||
ttt.visible(() -> group.effect == StatusEffects.boss);
|
||||
ttt.pack();
|
||||
})
|
||||
).pad(2f).get().addListener(new Tooltip(to -> {
|
||||
to.background(Styles.black6);
|
||||
to.margin(4f).left();
|
||||
to.add("[stat]" + group.type.localizedName + "[]").row();
|
||||
to.row();
|
||||
to.add(bundle.format("shar-stat-waveAmount", amount + " [lightgray]x" + spawners + "[]")).row();
|
||||
to.add(bundle.format("shar-stat-waveShield", group.getShield(index-1))).row();
|
||||
if (group.effect != null && group.effect != StatusEffects.none)
|
||||
to.add(bundle.get("shar-stat.waveStatus") + group.effect.emoji() + "[stat]" + group.effect.localizedName).row();
|
||||
}));
|
||||
if(row++ % max == max-1){
|
||||
unitTable.row();
|
||||
}
|
||||
}
|
||||
}).growX().margin(12f);
|
||||
}).growX().row();
|
||||
body.image().height(4f).color(Pal.gray).growX().row();
|
||||
}
|
||||
}).grow().margin(40f);
|
||||
});
|
||||
}
|
||||
}
|
||||
135
src/informatis/ui/window/Window.java
Normal file
135
src/informatis/ui/window/Window.java
Normal file
@@ -0,0 +1,135 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.input.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.ui.*;
|
||||
import informatis.ui.WindowManager;
|
||||
|
||||
public class Window extends Table{
|
||||
public TextureRegionDrawable icon;
|
||||
public int id;
|
||||
public Cons<Table> content;
|
||||
public boolean shown = false;
|
||||
|
||||
public float minWindowWidth = 160, minWindowHeight = 60;
|
||||
public float maxWindowWidth = Float.MAX_VALUE, maxWindowHeight = Float.MAX_VALUE;
|
||||
|
||||
public Window(TextureRegionDrawable icon, String name){
|
||||
this(icon, name, null);
|
||||
}
|
||||
|
||||
public Window(TextureRegionDrawable icon, String name, Cons<Table> content){
|
||||
this.content = content;
|
||||
this.name = name;
|
||||
this.icon = icon;
|
||||
|
||||
titleBar();
|
||||
pane(t -> {
|
||||
t.setBackground(Styles.black5);
|
||||
t.top().left();
|
||||
build(t);
|
||||
}).grow().top().left().get().setScrollingDisabled(true, true);
|
||||
bottomBar();
|
||||
|
||||
setPosition(Core.graphics.getWidth() / 2f - getWidth() / 2f, Core.graphics.getHeight() / 2f - getHeight() / 2f);
|
||||
id = WindowManager.register(this);
|
||||
|
||||
visible(() -> shown);
|
||||
}
|
||||
|
||||
protected void build(Table t){
|
||||
if(content != null) content.get(t);
|
||||
}
|
||||
|
||||
protected void titleBar(){
|
||||
table(t -> {
|
||||
// icon and title
|
||||
t.table(Tex.buttonEdge1, b -> {
|
||||
b.top().left();
|
||||
b.image(() -> icon == null ? Icon.none.getRegion() : icon.getRegion()).size(20f).padLeft(15).top().left();
|
||||
b.pane(Styles.noBarPane, p -> {
|
||||
p.top().left();
|
||||
p.labelWrap(() -> Core.bundle.get("window."+name+".name")).padLeft(20).top().left().get().setAlignment(Align.topLeft);
|
||||
}).left().height(40f).growX().get().setScrollingDisabled(true, true);
|
||||
}).maxHeight(40f).grow();
|
||||
|
||||
// exit button
|
||||
t.table(Tex.buttonEdge3, b -> {
|
||||
b.button(Icon.cancel, Styles.emptyi, () -> shown = false);
|
||||
}).maxHeight(40f).width(80f).growY();
|
||||
|
||||
// handles the dragging.
|
||||
t.touchable = Touchable.enabled;
|
||||
t.addListener(new InputListener(){
|
||||
float lastX, lastY;
|
||||
@Override
|
||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button) {
|
||||
Vec2 v = t.localToStageCoordinates(Tmp.v1.set(x, y));
|
||||
lastX = v.x;
|
||||
lastY = v.y;
|
||||
toFront();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchDragged(InputEvent event, float dx, float dy, int pointer) {
|
||||
Vec2 v = t.localToStageCoordinates(Tmp.v1.set(dx, dy));
|
||||
|
||||
setPosition( x + (v.x - lastX), y + (v.y - lastY));
|
||||
|
||||
lastX = v.x;
|
||||
lastY = v.y;
|
||||
}
|
||||
});
|
||||
}).top().height(40f).growX();
|
||||
row();
|
||||
}
|
||||
|
||||
protected void bottomBar(){
|
||||
row();
|
||||
table(Styles.black5, t -> {
|
||||
t.table().growX();
|
||||
t.table(Icon.resizeSmall, r -> {
|
||||
r.bottom().left();
|
||||
r.touchable = Touchable.enabled;
|
||||
r.addListener(new InputListener(){
|
||||
float lastX, lastY;
|
||||
@Override
|
||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button) {
|
||||
Vec2 v = r.localToStageCoordinates(Tmp.v1.set(x, y));
|
||||
lastX = v.x;
|
||||
lastY = v.y;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchDragged(InputEvent event, float x, float y, int pointer) {
|
||||
Vec2 v = r.localToStageCoordinates(Tmp.v1.set(x, y));
|
||||
float w = v.x - lastX;
|
||||
float h = v.y - lastY;
|
||||
|
||||
// will softlock if initial size is smaller than minimum
|
||||
// so don't do that!
|
||||
if(getWidth() + w < minWindowWidth || getWidth() + w > maxWindowWidth) w = 0;
|
||||
if(getHeight() - h < minWindowHeight || getHeight() - h > maxWindowHeight) h = 0;
|
||||
sizeBy(w, -h);
|
||||
moveBy(0, h);
|
||||
lastX = v.x;
|
||||
lastY = v.y;
|
||||
}
|
||||
});
|
||||
}).size(20f).left();
|
||||
}).height(20f).growX();
|
||||
}
|
||||
|
||||
public void toggle(){
|
||||
shown = !shown;
|
||||
}
|
||||
}
|
||||
14
src/informatis/ui/window/Windows.java
Normal file
14
src/informatis/ui/window/Windows.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package informatis.ui.window;
|
||||
|
||||
public class Windows {
|
||||
public static MapEditorWindow editorTable;
|
||||
|
||||
public static void load(){
|
||||
new UnitWindow();
|
||||
new WaveWindow();
|
||||
new CoreWindow();
|
||||
new PlayerWindow();
|
||||
new ToolWindow();
|
||||
editorTable = new MapEditorWindow();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user