Merge branch 'master' of https://github.com/Anuken/Mindustry into v105
@@ -42,7 +42,7 @@ task deploy(type: Copy){
|
|||||||
}
|
}
|
||||||
|
|
||||||
android{
|
android{
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.3'
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
sourceSets{
|
sourceSets{
|
||||||
main{
|
main{
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{version:1,fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
||||||
BIN
core/assets-raw/sprites/units/cix-cell.png
Normal file
|
After Width: | Height: | Size: 359 B |
BIN
core/assets-raw/sprites/units/cix-foot.png
Normal file
|
After Width: | Height: | Size: 375 B |
BIN
core/assets-raw/sprites/units/cix-joint.png
Normal file
|
After Width: | Height: | Size: 230 B |
BIN
core/assets-raw/sprites/units/cix-leg-base.png
Normal file
|
After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
core/assets-raw/sprites/weapons/missiles-mount.png
Normal file
|
After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 818 KiB After Width: | Height: | Size: 826 KiB |
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 124 KiB |
@@ -218,6 +218,13 @@ public class Fx{
|
|||||||
});
|
});
|
||||||
}).ground(),
|
}).ground(),
|
||||||
|
|
||||||
|
unitLandSmall = new Effect(30, e -> {
|
||||||
|
color(Tmp.c1.set(e.color).mul(1.1f));
|
||||||
|
randLenVectors(e.id, 6, 12f * e.finpow(), (x, y) -> {
|
||||||
|
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.1f);
|
||||||
|
});
|
||||||
|
}).ground(),
|
||||||
|
|
||||||
unitPickup = new Effect(18, e -> {
|
unitPickup = new Effect(18, e -> {
|
||||||
color(Pal.lightishGray);
|
color(Pal.lightishGray);
|
||||||
stroke(e.fin() * 2f);
|
stroke(e.fin() * 2f);
|
||||||
|
|||||||
@@ -280,50 +280,6 @@ public class TechTree implements ContentList{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
node(draugFactory, () -> {
|
|
||||||
node(spiritFactory, () -> {
|
|
||||||
node(phantomFactory);
|
|
||||||
});
|
|
||||||
|
|
||||||
node(daggerFactory, () -> {
|
|
||||||
node(commandCenter, () -> {});
|
|
||||||
node(crawlerFactory, () -> {
|
|
||||||
node(titanFactory, () -> {
|
|
||||||
node(fortressFactory, () -> {
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
node(wraithFactory, () -> {
|
|
||||||
node(ghoulFactory, () -> {
|
|
||||||
node(revenantFactory, () -> {
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
node(dartPad, () -> {
|
|
||||||
node(deltaPad, () -> {
|
|
||||||
|
|
||||||
node(javelinPad, () -> {
|
|
||||||
node(tridentPad, () -> {
|
|
||||||
node(glaivePad);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
node(tauPad, () -> {
|
|
||||||
node(omegaPad, () -> {
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});*/
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -367,8 +323,7 @@ public class TechTree implements ContentList{
|
|||||||
/** Extra objectives needed to research this. TODO implement */
|
/** Extra objectives needed to research this. TODO implement */
|
||||||
public Objective[] objectives = {};
|
public Objective[] objectives = {};
|
||||||
/** Turns required to research this content. */
|
/** Turns required to research this content. */
|
||||||
//TODO keep track of turns that have been used so far
|
public int turns = 3; //TODO keep track of turns that have been used so far
|
||||||
public int turns = 1;
|
|
||||||
/** Nodes that depend on this node. */
|
/** Nodes that depend on this node. */
|
||||||
public final Array<TechNode> children = new Array<>();
|
public final Array<TechNode> children = new Array<>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.content;
|
package mindustry.content;
|
||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
|
import arc.math.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
@@ -71,10 +72,24 @@ public class UnitTypes implements ContentList{
|
|||||||
cix = new UnitType("cix"){{
|
cix = new UnitType("cix"){{
|
||||||
drag = 0.1f;
|
drag = 0.1f;
|
||||||
speed = 0.8f;
|
speed = 0.8f;
|
||||||
hitsize = 8f;
|
hitsize = 9f;
|
||||||
health = 130;
|
health = 140;
|
||||||
|
|
||||||
legCount = 6;
|
legCount = 6;
|
||||||
|
rotateShooting = false;
|
||||||
|
|
||||||
|
for(boolean b : Mathf.booleans){
|
||||||
|
weapons.add(
|
||||||
|
new Weapon("missiles-mount"){{
|
||||||
|
reload = 20f;
|
||||||
|
x = 4f * Mathf.sign(b);
|
||||||
|
rotate = true;
|
||||||
|
mirror = false;
|
||||||
|
flipSprite = !b;
|
||||||
|
shake = 1f;
|
||||||
|
bullet = Bullets.missileSwarm;
|
||||||
|
}});
|
||||||
|
}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
titan = new UnitType("titan"){{
|
titan = new UnitType("titan"){{
|
||||||
|
|||||||
@@ -392,6 +392,15 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
public void init(){
|
public void init(){
|
||||||
platform.updateRPC();
|
platform.updateRPC();
|
||||||
|
|
||||||
|
//just a regular reminder
|
||||||
|
if(!OS.prop("user.name").equals("anuke") && !OS.hasEnv("iknowwhatimdoing")){
|
||||||
|
if(mobile){
|
||||||
|
ui.showInfo("[scarlet]6.0 doesn't work on mobile.[] Don't play it.");
|
||||||
|
}else{
|
||||||
|
ui.showInfo("[scarlet]6.0 is not supposed to be played.[] Go do something else.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//play tutorial on stop
|
//play tutorial on stop
|
||||||
if(!settings.getBool("playedtutorial", false)){
|
if(!settings.getBool("playedtutorial", false)){
|
||||||
Core.app.post(() -> Core.app.post(this::playTutorial));
|
Core.app.post(() -> Core.app.post(this::playTutorial));
|
||||||
@@ -400,7 +409,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
//display UI scale changed dialog
|
//display UI scale changed dialog
|
||||||
if(Core.settings.getBool("uiscalechanged", false)){
|
if(Core.settings.getBool("uiscalechanged", false)){
|
||||||
Core.app.post(() -> Core.app.post(() -> {
|
Core.app.post(() -> Core.app.post(() -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("$confirm");
|
BaseDialog dialog = new BaseDialog("$confirm");
|
||||||
dialog.setFillParent(true);
|
dialog.setFillParent(true);
|
||||||
|
|
||||||
float[] countdown = {60 * 11};
|
float[] countdown = {60 * 11};
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ import static mindustry.Vars.*;
|
|||||||
public class Logic implements ApplicationListener{
|
public class Logic implements ApplicationListener{
|
||||||
|
|
||||||
public Logic(){
|
public Logic(){
|
||||||
Events.on(WorldLoadEvent.class, event -> {
|
|
||||||
//TODO remove later
|
|
||||||
//Weathers.snow.create();
|
|
||||||
});
|
|
||||||
|
|
||||||
Events.on(WaveEvent.class, event -> {
|
Events.on(WaveEvent.class, event -> {
|
||||||
if(state.isCampaign()){
|
if(state.isCampaign()){
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
connection.viewHeight = viewHeight;
|
connection.viewHeight = viewHeight;
|
||||||
|
|
||||||
//disable shooting when a mech flies
|
//disable shooting when a mech flies
|
||||||
if(!player.dead() && player.unit().isFlying() && !player.unit().type().flying){
|
if(!player.dead() && player.unit().isFlying() && player.unit() instanceof Mechc){
|
||||||
shooting = false;
|
shooting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showConfirm(String title, String text, Boolp hide, Runnable confirmed){
|
public void showConfirm(String title, String text, Boolp hide, Runnable confirmed){
|
||||||
FloatingDialog dialog = new FloatingDialog(title);
|
BaseDialog dialog = new BaseDialog(title);
|
||||||
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
@@ -475,7 +475,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showCustomConfirm(String title, String text, String yes, String no, Runnable confirmed, Runnable denied){
|
public void showCustomConfirm(String title, String text, String yes, String no, Runnable confirmed, Runnable denied){
|
||||||
FloatingDialog dialog = new FloatingDialog(title);
|
BaseDialog dialog = new BaseDialog(title);
|
||||||
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
@@ -493,7 +493,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showOkText(String title, String text, Runnable confirmed){
|
public void showOkText(String title, String text, Runnable confirmed){
|
||||||
FloatingDialog dialog = new FloatingDialog(title);
|
BaseDialog dialog = new BaseDialog(title);
|
||||||
dialog.cont.add(text).width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
dialog.cont.add(text).width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import mindustry.type.*;
|
|||||||
import mindustry.type.Sector.*;
|
import mindustry.type.Sector.*;
|
||||||
import mindustry.type.Weather.*;
|
import mindustry.type.Weather.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.environment.*;
|
||||||
import mindustry.world.blocks.legacy.*;
|
import mindustry.world.blocks.legacy.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -78,6 +79,18 @@ public class World{
|
|||||||
return height()*tilesize;
|
return height()*tilesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public Floor floor(int x, int y){
|
||||||
|
Tile tile = tile(x, y);
|
||||||
|
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public Floor floorWorld(float x, float y){
|
||||||
|
Tile tile = tileWorld(x, y);
|
||||||
|
return tile == null ? Blocks.air.asFloor() : tile.floor();
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Tile tile(int pos){
|
public Tile tile(int pos){
|
||||||
return tile(Point2.x(pos), Point2.y(pos));
|
return tile(Point2.x(pos), Point2.y(pos));
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public abstract class Content implements Comparable<Content>, Disposable{
|
|||||||
|
|
||||||
|
|
||||||
public Content(){
|
public Content(){
|
||||||
this.id = (short) Vars.content.getBy(getContentType()).size;
|
this.id = (short)Vars.content.getBy(getContentType()).size;
|
||||||
Vars.content.handleContent(this);
|
Vars.content.handleContent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,15 +25,13 @@ public abstract class Content implements Comparable<Content>, Disposable{
|
|||||||
public abstract ContentType getContentType();
|
public abstract ContentType getContentType();
|
||||||
|
|
||||||
/** Called after all content and modules are created. Do not use to load regions or texture data! */
|
/** Called after all content and modules are created. Do not use to load regions or texture data! */
|
||||||
public void init(){
|
public void init(){}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after all content is created, only on non-headless versions.
|
* Called after all content is created, only on non-headless versions.
|
||||||
* Use for loading regions or other image data.
|
* Use for loading regions or other image data.
|
||||||
*/
|
*/
|
||||||
public void load(){
|
public void load(){}
|
||||||
}
|
|
||||||
|
|
||||||
/** @return whether an error ocurred during mod loading. */
|
/** @return whether an error ocurred during mod loading. */
|
||||||
public boolean hasErrored(){
|
public boolean hasErrored(){
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package mindustry.editor;
|
package mindustry.editor;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.Struct;
|
import mindustry.annotations.Annotations.*;
|
||||||
import arc.struct.LongArray;
|
import arc.struct.LongArray;
|
||||||
import mindustry.game.Team;
|
import mindustry.game.Team;
|
||||||
import mindustry.gen.TileOp;
|
import mindustry.gen.TileOp;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
private MapResizeDialog resizeDialog;
|
private MapResizeDialog resizeDialog;
|
||||||
private MapGenerateDialog generateDialog;
|
private MapGenerateDialog generateDialog;
|
||||||
private ScrollPane pane;
|
private ScrollPane pane;
|
||||||
private FloatingDialog menu;
|
private BaseDialog menu;
|
||||||
private Rules lastSavedRules;
|
private Rules lastSavedRules;
|
||||||
private boolean saved = false;
|
private boolean saved = false;
|
||||||
private boolean shownWithMap = false;
|
private boolean shownWithMap = false;
|
||||||
@@ -58,7 +58,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
infoDialog = new MapInfoDialog(editor);
|
infoDialog = new MapInfoDialog(editor);
|
||||||
generateDialog = new MapGenerateDialog(editor, true);
|
generateDialog = new MapGenerateDialog(editor, true);
|
||||||
|
|
||||||
menu = new FloatingDialog("$menu");
|
menu = new BaseDialog("$menu");
|
||||||
menu.addCloseButton();
|
menu.addCloseButton();
|
||||||
|
|
||||||
float swidth = 180f;
|
float swidth = 180f;
|
||||||
@@ -309,7 +309,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
* 3) listener
|
* 3) listener
|
||||||
*/
|
*/
|
||||||
private void createDialog(String title, Object... arguments){
|
private void createDialog(String title, Object... arguments){
|
||||||
FloatingDialog dialog = new FloatingDialog(title);
|
BaseDialog dialog = new BaseDialog(title);
|
||||||
|
|
||||||
float h = 90f;
|
float h = 90f;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import mindustry.world.blocks.environment.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class MapGenerateDialog extends FloatingDialog{
|
public class MapGenerateDialog extends BaseDialog{
|
||||||
private final Prov<GenerateFilter>[] filterTypes = new Prov[]{
|
private final Prov<GenerateFilter>[] filterTypes = new Prov[]{
|
||||||
NoiseFilter::new, ScatterFilter::new, TerrainFilter::new, DistortFilter::new,
|
NoiseFilter::new, ScatterFilter::new, TerrainFilter::new, DistortFilter::new,
|
||||||
RiverNoiseFilter::new, OreFilter::new, OreMedianFilter::new, MedianFilter::new,
|
RiverNoiseFilter::new, OreFilter::new, OreMedianFilter::new, MedianFilter::new,
|
||||||
@@ -284,7 +284,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showAdd(){
|
void showAdd(){
|
||||||
FloatingDialog selection = new FloatingDialog("$add");
|
BaseDialog selection = new BaseDialog("$add");
|
||||||
selection.setFillParent(false);
|
selection.setFillParent(false);
|
||||||
selection.cont.defaults().size(210f, 60f);
|
selection.cont.defaults().size(210f, 60f);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import mindustry.io.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
public class MapInfoDialog extends FloatingDialog{
|
public class MapInfoDialog extends BaseDialog{
|
||||||
private final MapEditor editor;
|
private final MapEditor editor;
|
||||||
private final WaveInfoDialog waveInfo;
|
private final WaveInfoDialog waveInfo;
|
||||||
private final MapGenerateDialog generate;
|
private final MapGenerateDialog generate;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import mindustry.ui.dialogs.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.maps;
|
import static mindustry.Vars.maps;
|
||||||
|
|
||||||
public class MapLoadDialog extends FloatingDialog{
|
public class MapLoadDialog extends BaseDialog{
|
||||||
private Map selected = null;
|
private Map selected = null;
|
||||||
|
|
||||||
public MapLoadDialog(Cons<Map> loader){
|
public MapLoadDialog(Cons<Map> loader){
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import arc.scene.ui.layout.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
public class MapResizeDialog extends FloatingDialog{
|
public class MapResizeDialog extends BaseDialog{
|
||||||
private static final int minSize = 50, maxSize = 500, increment = 50;
|
private static final int minSize = 50, maxSize = 500, increment = 50;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import mindustry.ui.dialogs.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.ui;
|
import static mindustry.Vars.ui;
|
||||||
|
|
||||||
public class MapSaveDialog extends FloatingDialog{
|
public class MapSaveDialog extends BaseDialog{
|
||||||
private TextField field;
|
private TextField field;
|
||||||
private Cons<String> listener;
|
private Cons<String> listener;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import mindustry.ui.dialogs.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
import static mindustry.game.SpawnGroup.never;
|
import static mindustry.game.SpawnGroup.never;
|
||||||
|
|
||||||
public class WaveInfoDialog extends FloatingDialog{
|
public class WaveInfoDialog extends BaseDialog{
|
||||||
private final static int displayed = 20;
|
private final static int displayed = 20;
|
||||||
private Array<SpawnGroup> groups = new Array<>();
|
private Array<SpawnGroup> groups = new Array<>();
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
|||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
buttons.button("$waves.edit", () -> {
|
buttons.button("$waves.edit", () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("$waves.edit");
|
BaseDialog dialog = new BaseDialog("$waves.edit");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.cont.defaults().size(210f, 64f);
|
dialog.cont.defaults().size(210f, 64f);
|
||||||
@@ -235,7 +235,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showUpdate(SpawnGroup group){
|
void showUpdate(SpawnGroup group){
|
||||||
FloatingDialog dialog = new FloatingDialog("");
|
BaseDialog dialog = new BaseDialog("");
|
||||||
dialog.setFillParent(true);
|
dialog.setFillParent(true);
|
||||||
dialog.cont.pane(p -> {
|
dialog.cont.pane(p -> {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -3,6 +3,5 @@ package mindustry.entities;
|
|||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
|
|
||||||
public class Leg{
|
public class Leg{
|
||||||
public final Vec2 joint = new Vec2(), base = new Vec2(), target = new Vec2();
|
public final Vec2 joint = new Vec2(), base = new Vec2();
|
||||||
public boolean moving = false;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,26 +2,34 @@ package mindustry.entities.comp;
|
|||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.blocks.environment.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||||
@Import float x, y, rotation, elevation;
|
@Import float x, y, elevation;
|
||||||
|
@Import UnitType type;
|
||||||
|
|
||||||
transient Leg[] legs = {};
|
transient Leg[] legs = {};
|
||||||
transient float totalLength;
|
transient float totalLength;
|
||||||
|
transient int lastGroup;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
//keep elevation halfway
|
//keep elevation halfway
|
||||||
elevation = 0.5f;
|
elevation = 0.5f;
|
||||||
|
|
||||||
int count = type().legCount;
|
int count = type.legCount;
|
||||||
float legLength = type().legLength;
|
float legLength = type.legLength;
|
||||||
|
float rotation = vel().angle();
|
||||||
|
|
||||||
if(legs.length != type().legCount){
|
//set up initial leg positions
|
||||||
|
if(legs.length != type.legCount){
|
||||||
this.legs = new Leg[count];
|
this.legs = new Leg[count];
|
||||||
|
|
||||||
float spacing = 360f / count;
|
float spacing = 360f / count;
|
||||||
@@ -36,16 +44,39 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float moveSpeed = 0.1f;
|
float moveSpeed = type.legSpeed;
|
||||||
int div = Math.max(legs.length / 2, 2);
|
int div = Math.max(legs.length / 2, 2);
|
||||||
float moveSpace = legLength / 1.6f / (div / 2f);
|
float moveSpace = legLength / 1.6f / (div / 2f);
|
||||||
|
|
||||||
totalLength += Mathf.dst(deltaX(), deltaY());
|
totalLength += Mathf.dst(deltaX(), deltaY());
|
||||||
|
|
||||||
int stage = (int)(totalLength / moveSpace);
|
int stage = (int)(totalLength / moveSpace);
|
||||||
int odd = stage % div;
|
int group = stage % div;
|
||||||
|
|
||||||
|
if(lastGroup != group){
|
||||||
|
//create ripple effects when switching leg groups
|
||||||
|
int i = 0;
|
||||||
|
for(Leg l : legs){
|
||||||
|
if(i++ % div == lastGroup){
|
||||||
|
Floor floor = Vars.world.floorWorld(l.base.x, l.base.y);
|
||||||
|
if(floor.isLiquid){
|
||||||
|
floor.walkEffect.at(l.base.x, l.base.y, 0, floor.mapColor);
|
||||||
|
}else{
|
||||||
|
Fx.unitLandSmall.at(l.base.x, l.base.y, 0.5f, floor.mapColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
//shake when legs contact ground
|
||||||
|
if(type.landShake > 0){
|
||||||
|
Effects.shake(type.landShake, type.landShake, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastGroup = group;
|
||||||
|
}
|
||||||
|
|
||||||
float movespace = 360f / legs.length / 4f;
|
float movespace = 360f / legs.length / 4f;
|
||||||
float trns = vel().len() * 12.5f * div/1.5f;
|
float trns = vel().len() * 12.5f * div/1.5f * type.legTrns;
|
||||||
|
|
||||||
Tmp.v4.trns(rotation, trns);
|
Tmp.v4.trns(rotation, trns);
|
||||||
|
|
||||||
@@ -58,7 +89,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
Tmp.v1.trns(dstRot, legLength).add(x, y).add(Tmp.v4);
|
Tmp.v1.trns(dstRot, legLength).add(x, y).add(Tmp.v4);
|
||||||
Tmp.v2.trns(rot2, legLength / 2f).add(x, y).add(Tmp.v4);
|
Tmp.v2.trns(rot2, legLength / 2f).add(x, y).add(Tmp.v4);
|
||||||
|
|
||||||
if(i % div == odd){
|
if(i % div == group){
|
||||||
l.base.lerpDelta(Tmp.v1, moveSpeed);
|
l.base.lerpDelta(Tmp.v1, moveSpeed);
|
||||||
l.joint.lerpDelta(Tmp.v2, moveSpeed / 4f);
|
l.joint.lerpDelta(Tmp.v2, moveSpeed / 4f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,28 +9,6 @@ import mindustry.world.*;
|
|||||||
/** Holds objective classes. */
|
/** Holds objective classes. */
|
||||||
public class Objectives{
|
public class Objectives{
|
||||||
|
|
||||||
//TODO
|
|
||||||
public static class Wave implements Objective{
|
|
||||||
public int wave;
|
|
||||||
|
|
||||||
public Wave(int wave){
|
|
||||||
this.wave = wave;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Wave(){}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean complete(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String display(){
|
|
||||||
//TODO
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Unlock implements Objective{
|
public static class Unlock implements Objective{
|
||||||
public @NonNull Block block;
|
public @NonNull Block block;
|
||||||
|
|
||||||
@@ -102,9 +80,8 @@ public class Objectives{
|
|||||||
boolean complete();
|
boolean complete();
|
||||||
|
|
||||||
/** @return the string displayed when this objective is completed, in imperative form.
|
/** @return the string displayed when this objective is completed, in imperative form.
|
||||||
* e.g. when the objective is 'complete 10 waves', this would display "complete 10 waves".
|
* e.g. when the objective is 'complete 10 waves', this would display "complete 10 waves". */
|
||||||
* If this objective should not be displayed, should return null.*/
|
String display();
|
||||||
@Nullable String display();
|
|
||||||
|
|
||||||
/** Build a display for this zone requirement.*/
|
/** Build a display for this zone requirement.*/
|
||||||
default void build(Table table){
|
default void build(Table table){
|
||||||
|
|||||||
@@ -579,11 +579,11 @@ public class DesktopInput extends InputHandler{
|
|||||||
float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation()) * strafePenalty;
|
float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation()) * strafePenalty;
|
||||||
float xa = Core.input.axis(Binding.move_x);
|
float xa = Core.input.axis(Binding.move_x);
|
||||||
float ya = Core.input.axis(Binding.move_y);
|
float ya = Core.input.axis(Binding.move_y);
|
||||||
boolean boosted = (!unit.type().flying && unit.isFlying());
|
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||||
|
|
||||||
movement.set(xa, ya).nor().scl(speed);
|
movement.set(xa, ya).nor().scl(speed);
|
||||||
float mouseAngle = Angles.mouseAngle(unit.x(), unit.y());
|
float mouseAngle = Angles.mouseAngle(unit.x(), unit.y());
|
||||||
boolean aimCursor = omni && isShooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted;
|
boolean aimCursor = omni && isShooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted && unit.type().rotateShooting;
|
||||||
|
|
||||||
if(aimCursor){
|
if(aimCursor){
|
||||||
unit.lookAt(mouseAngle);
|
unit.lookAt(mouseAngle);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package mindustry.logic;
|
|||||||
|
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
public class LogicDialog extends FloatingDialog{
|
public class LogicDialog extends BaseDialog{
|
||||||
|
|
||||||
public LogicDialog(){
|
public LogicDialog(){
|
||||||
super("");
|
super("");
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public abstract class FilterOption{
|
|||||||
public void build(Table table){
|
public void build(Table table){
|
||||||
table.button(b -> b.image(supplier.get().icon(Cicon.small)).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
table.button(b -> b.image(supplier.get().icon(Cicon.small)).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||||
.setRegion(supplier.get() == Blocks.air ? Icon.block.getRegion() : supplier.get().icon(Cicon.small))).size(8 * 3), () -> {
|
.setRegion(supplier.get() == Blocks.air ? Icon.block.getRegion() : supplier.get().icon(Cicon.small))).size(8 * 3), () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("");
|
BaseDialog dialog = new BaseDialog("");
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Block block : Vars.content.blocks()){
|
for(Block block : Vars.content.blocks()){
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class BeControl{
|
|||||||
int[] length = {0};
|
int[] length = {0};
|
||||||
Fi file = bebuildDirectory.child("client-be-" + updateBuild + ".jar");
|
Fi file = bebuildDirectory.child("client-be-" + updateBuild + ".jar");
|
||||||
|
|
||||||
FloatingDialog dialog = new FloatingDialog("$be.updating");
|
BaseDialog dialog = new BaseDialog("$be.updating");
|
||||||
download(updateUrl, file, i -> length[0] = i, v -> progress[0] = v, () -> cancel[0], () -> {
|
download(updateUrl, file, i -> length[0] = i, v -> progress[0] = v, () -> cancel[0], () -> {
|
||||||
try{
|
try{
|
||||||
Runtime.getRuntime().exec(new String[]{"java", "-DlastBuild=" + Version.build, "-Dberestart", "-jar", file.absolutePath()});
|
Runtime.getRuntime().exec(new String[]{"java", "-DlastBuild=" + Version.build, "-Dberestart", "-jar", file.absolutePath()});
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ import arc.func.Prov;
|
|||||||
import mindustry.net.Packets.*;
|
import mindustry.net.Packets.*;
|
||||||
|
|
||||||
public class Registrator{
|
public class Registrator{
|
||||||
private static ClassEntry[] classes = {
|
private static final ClassEntry[] classes = {
|
||||||
new ClassEntry(StreamBegin.class, StreamBegin::new),
|
new ClassEntry(StreamBegin.class, StreamBegin::new),
|
||||||
new ClassEntry(StreamChunk.class, StreamChunk::new),
|
new ClassEntry(StreamChunk.class, StreamChunk::new),
|
||||||
new ClassEntry(WorldStream.class, WorldStream::new),
|
new ClassEntry(WorldStream.class, WorldStream::new),
|
||||||
new ClassEntry(ConnectPacket.class, ConnectPacket::new),
|
new ClassEntry(ConnectPacket.class, ConnectPacket::new),
|
||||||
new ClassEntry(InvokePacket.class, InvokePacket::new)
|
new ClassEntry(InvokePacket.class, InvokePacket::new)
|
||||||
};
|
};
|
||||||
private static ObjectIntMap<Class> ids = new ObjectIntMap<>();
|
private static final ObjectIntMap<Class<?>> ids = new ObjectIntMap<>();
|
||||||
|
|
||||||
static{
|
static{
|
||||||
if(classes.length > 127) throw new RuntimeException("Can't have more than 127 registered classes!");
|
if(classes.length > 127) throw new RuntimeException("Can't have more than 127 registered classes!");
|
||||||
|
|||||||
@@ -37,12 +37,13 @@ public class UnitType extends UnlockableContent{
|
|||||||
public float drag = 0.3f, accel = 0.5f, landShake = 0f;
|
public float drag = 0.3f, accel = 0.5f, landShake = 0f;
|
||||||
public float health = 200f, range = -1, armor = 0f;
|
public float health = 200f, range = -1, armor = 0f;
|
||||||
public boolean targetAir = true, targetGround = true;
|
public boolean targetAir = true, targetGround = true;
|
||||||
public boolean faceTarget = true, isCounted = true, lowAltitude = false;
|
public boolean faceTarget = true, rotateShooting = true, isCounted = true, lowAltitude = false;
|
||||||
public boolean canBoost = false;
|
public boolean canBoost = false;
|
||||||
public int legCount = 4;
|
|
||||||
public float legLength = 24f;
|
|
||||||
public float sway = 1f;
|
public float sway = 1f;
|
||||||
|
|
||||||
|
public int legCount = 4;
|
||||||
|
public float legLength = 24f, legSpeed = 0.1f, legTrns = 1f;
|
||||||
|
|
||||||
public int itemCapacity = 30;
|
public int itemCapacity = 30;
|
||||||
public int drillTier = -1;
|
public int drillTier = -1;
|
||||||
public float buildSpeed = 1f, mineSpeed = 1f;
|
public float buildSpeed = 1f, mineSpeed = 1f;
|
||||||
@@ -59,7 +60,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public Sound deathSound = Sounds.bang;
|
public Sound deathSound = Sounds.bang;
|
||||||
|
|
||||||
public Array<Weapon> weapons = new Array<>();
|
public Array<Weapon> weapons = new Array<>();
|
||||||
public TextureRegion baseRegion, legRegion, region, shadowRegion, cellRegion, occlusionRegion;
|
public TextureRegion baseRegion, legRegion, region, shadowRegion, cellRegion, occlusionRegion, jointRegion, footRegion, legBaseRegion;
|
||||||
|
|
||||||
public UnitType(String name){
|
public UnitType(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -114,6 +115,9 @@ public class UnitType extends UnlockableContent{
|
|||||||
weapons.each(Weapon::load);
|
weapons.each(Weapon::load);
|
||||||
region = Core.atlas.find(name);
|
region = Core.atlas.find(name);
|
||||||
legRegion = Core.atlas.find(name + "-leg");
|
legRegion = Core.atlas.find(name + "-leg");
|
||||||
|
jointRegion = Core.atlas.find(name + "-joint");
|
||||||
|
footRegion = Core.atlas.find(name + "-foot");
|
||||||
|
legBaseRegion = Core.atlas.find(name + "-leg-base", name + "-leg");
|
||||||
baseRegion = Core.atlas.find(name + "-base");
|
baseRegion = Core.atlas.find(name + "-base");
|
||||||
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
|
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
|
||||||
occlusionRegion = Core.atlas.find("circle-shadow");
|
occlusionRegion = Core.atlas.find("circle-shadow");
|
||||||
@@ -285,7 +289,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
Draw.rect(weapon.region,
|
Draw.rect(weapon.region,
|
||||||
unit.x() + Angles.trnsx(rotation, weapon.x * i, weapon.y) + Angles.trnsx(weaponRotation, 0, recoil),
|
unit.x() + Angles.trnsx(rotation, weapon.x * i, weapon.y) + Angles.trnsx(weaponRotation, 0, recoil),
|
||||||
unit.y() + Angles.trnsy(rotation, weapon.x * i, weapon.y) + Angles.trnsy(weaponRotation, 0, recoil),
|
unit.y() + Angles.trnsy(rotation, weapon.x * i, weapon.y) + Angles.trnsy(weaponRotation, 0, recoil),
|
||||||
width * Draw.scl,
|
width * Draw.scl * -Mathf.sign(weapon.flipSprite),
|
||||||
weapon.region.getHeight() * Draw.scl,
|
weapon.region.getHeight() * Draw.scl,
|
||||||
weaponRotation);
|
weaponRotation);
|
||||||
}
|
}
|
||||||
@@ -319,24 +323,31 @@ public class UnitType extends UnlockableContent{
|
|||||||
public void drawLegs(Legsc unit){
|
public void drawLegs(Legsc unit){
|
||||||
Leg[] legs = unit.legs();
|
Leg[] legs = unit.legs();
|
||||||
|
|
||||||
Lines.stroke(4f, Color.gray);
|
|
||||||
float srad = 2.1f;
|
float ssize = footRegion.getWidth() * Draw.scl * 1.5f;
|
||||||
|
|
||||||
for(Leg leg : legs){
|
for(Leg leg : legs){
|
||||||
|
Drawf.shadow(leg.base.x, leg.base.y, ssize);
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for(Leg leg : legs){
|
||||||
|
boolean flip = index++ >= legs.length/2f;
|
||||||
|
int flips = Mathf.sign(flip);
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
|
Lines.stroke(legRegion.getHeight() * Draw.scl * flips);
|
||||||
Lines.line(legRegion, unit.x(), unit.y(), leg.joint.x, leg.joint.y, CapStyle.none, 0);
|
Lines.line(legRegion, unit.x(), unit.y(), leg.joint.x, leg.joint.y, CapStyle.none, 0);
|
||||||
Lines.line(legRegion, leg.joint.x, leg.joint.y, leg.base.x, leg.base.y, CapStyle.none, 0);
|
|
||||||
|
|
||||||
Draw.color(Pal.darkMetal);
|
Lines.stroke(legBaseRegion.getHeight() * Draw.scl * flips);
|
||||||
Fill.circle(leg.joint.x, leg.joint.y, srad);
|
Lines.line(legBaseRegion, leg.joint.x, leg.joint.y, leg.base.x, leg.base.y, CapStyle.none, 0);
|
||||||
|
|
||||||
Draw.color(Pal.darkerMetal);
|
float angle1 = unit.angleTo(leg.joint), angle2 = unit.angleTo(leg.base);
|
||||||
Fill.circle(leg.base.x, leg.base.y, srad);
|
|
||||||
|
|
||||||
Draw.color();
|
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
|
||||||
//Lines.line(unit.x(), unit.y(), leg.base.x, leg.base.y);
|
Draw.rect(footRegion, leg.base.x, leg.base.y, angle2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class Weapon{
|
|||||||
/** whether to mirror the weapon (draw two of them, which is the default) */
|
/** whether to mirror the weapon (draw two of them, which is the default) */
|
||||||
public boolean mirror = true;
|
public boolean mirror = true;
|
||||||
/** whether to flip the weapon's position/side on the ship (only valid when mirror is false) */
|
/** whether to flip the weapon's position/side on the ship (only valid when mirror is false) */
|
||||||
public boolean flipped = false;
|
public boolean flipped = false, flipSprite = false;
|
||||||
/** whether to shoot the weapons in different arms one after another, rather than all at once; only valid when mirror = true */
|
/** whether to shoot the weapons in different arms one after another, rather than all at once; only valid when mirror = true */
|
||||||
public boolean alternate = false;
|
public boolean alternate = false;
|
||||||
/** whether to rotate toward the target independently of unit */
|
/** whether to rotate toward the target independently of unit */
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public abstract class Weather extends MappableContent{
|
|||||||
return ContentType.weather;
|
return ContentType.weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote
|
@Remote(called = Loc.server)
|
||||||
public static void createWeather(Weather weather, float intensity, float duration){
|
public static void createWeather(Weather weather, float intensity, float duration){
|
||||||
weather.create(intensity, duration);
|
weather.create(intensity, duration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import mindustry.ui.Links.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class AboutDialog extends FloatingDialog{
|
public class AboutDialog extends BaseDialog{
|
||||||
private Array<String> contributors = new Array<>();
|
private Array<String> contributors = new Array<>();
|
||||||
private static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid");
|
private static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid");
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public class AboutDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showCredits(){
|
public void showCredits(){
|
||||||
FloatingDialog dialog = new FloatingDialog("$credits");
|
BaseDialog dialog = new BaseDialog("$credits");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.cont.add("$credits.text").fillX().wrap().get().setAlignment(Align.center);
|
dialog.cont.add("$credits.text").fillX().wrap().get().setAlignment(Align.center);
|
||||||
dialog.cont.row();
|
dialog.cont.row();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import mindustry.net.Administration.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class AdminsDialog extends FloatingDialog{
|
public class AdminsDialog extends BaseDialog{
|
||||||
|
|
||||||
public AdminsDialog(){
|
public AdminsDialog(){
|
||||||
super("$server.admins");
|
super("$server.admins");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import mindustry.net.Administration.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class BansDialog extends FloatingDialog{
|
public class BansDialog extends BaseDialog{
|
||||||
|
|
||||||
public BansDialog(){
|
public BansDialog(){
|
||||||
super("$server.bans");
|
super("$server.bans");
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import mindustry.graphics.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class FloatingDialog extends Dialog{
|
public class BaseDialog extends Dialog{
|
||||||
private boolean wasPaused;
|
private boolean wasPaused;
|
||||||
protected boolean shouldPause;
|
protected boolean shouldPause;
|
||||||
|
|
||||||
public FloatingDialog(String title, DialogStyle style){
|
public BaseDialog(String title, DialogStyle style){
|
||||||
super(title, style);
|
super(title, style);
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
this.title.setAlignment(Align.center);
|
this.title.setAlignment(Align.center);
|
||||||
@@ -40,7 +40,7 @@ public class FloatingDialog extends Dialog{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public FloatingDialog(String title){
|
public BaseDialog(String title){
|
||||||
this(title, Core.scene.getStyle(DialogStyle.class));
|
this(title, Core.scene.getStyle(DialogStyle.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ import arc.scene.ui.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
|
||||||
public class ColorPicker extends FloatingDialog{
|
public class ColorPicker extends BaseDialog{
|
||||||
private Cons<Color> cons = c -> {};
|
private Cons<Color> cons = c -> {};
|
||||||
private Color current = new Color();
|
private Color current = new Color();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import arc.scene.ui.ScrollPane;
|
|||||||
import arc.scene.ui.layout.Table;
|
import arc.scene.ui.layout.Table;
|
||||||
import mindustry.ctype.UnlockableContent;
|
import mindustry.ctype.UnlockableContent;
|
||||||
|
|
||||||
public class ContentInfoDialog extends FloatingDialog{
|
public class ContentInfoDialog extends BaseDialog{
|
||||||
|
|
||||||
public ContentInfoDialog(){
|
public ContentInfoDialog(){
|
||||||
super("$info.title");
|
super("$info.title");
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ public class ControlsDialog extends KeybindDialog{
|
|||||||
buttons.button("$back", Icon.left, this::hide).size(230f, 64f);
|
buttons.button("$back", Icon.left, this::hide).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key -> {
|
keyDown(key -> {
|
||||||
if(key == KeyCode.escape || key == KeyCode.back)
|
if(key == KeyCode.escape || key == KeyCode.back) hide();
|
||||||
hide();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import mindustry.graphics.*;
|
|||||||
import mindustry.maps.*;
|
import mindustry.maps.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
|
||||||
public class CustomGameDialog extends FloatingDialog{
|
public class CustomGameDialog extends BaseDialog{
|
||||||
private MapPlayDialog dialog = new MapPlayDialog();
|
private MapPlayDialog dialog = new MapPlayDialog();
|
||||||
|
|
||||||
public CustomGameDialog(){
|
public CustomGameDialog(){
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ import mindustry.world.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class CustomRulesDialog extends FloatingDialog{
|
public class CustomRulesDialog extends BaseDialog{
|
||||||
private Table main;
|
private Table main;
|
||||||
private Rules rules;
|
private Rules rules;
|
||||||
private Prov<Rules> resetter;
|
private Prov<Rules> resetter;
|
||||||
private LoadoutDialog loadoutDialog;
|
private LoadoutDialog loadoutDialog;
|
||||||
private FloatingDialog banDialog;
|
private BaseDialog banDialog;
|
||||||
|
|
||||||
public CustomRulesDialog(){
|
public CustomRulesDialog(){
|
||||||
super("$mode.custom");
|
super("$mode.custom");
|
||||||
|
|
||||||
loadoutDialog = new LoadoutDialog();
|
loadoutDialog = new LoadoutDialog();
|
||||||
banDialog = new FloatingDialog("$bannedblocks");
|
banDialog = new BaseDialog("$bannedblocks");
|
||||||
banDialog.addCloseButton();
|
banDialog.addCloseButton();
|
||||||
|
|
||||||
banDialog.shown(this::rebuildBanned);
|
banDialog.shown(this::rebuildBanned);
|
||||||
@@ -84,7 +84,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
|||||||
}).get().setScrollYForce(previousScroll);
|
}).get().setScrollYForce(previousScroll);
|
||||||
banDialog.cont.row();
|
banDialog.cont.row();
|
||||||
banDialog.cont.button("$add", Icon.add, () -> {
|
banDialog.cont.button("$add", Icon.add, () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("$add");
|
BaseDialog dialog = new BaseDialog("$add");
|
||||||
dialog.cont.pane(t -> {
|
dialog.cont.pane(t -> {
|
||||||
t.left().margin(14f);
|
t.left().margin(14f);
|
||||||
int[] i = {0};
|
int[] i = {0};
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.ui;
|
import static mindustry.Vars.ui;
|
||||||
|
|
||||||
public class DatabaseDialog extends FloatingDialog{
|
public class DatabaseDialog extends BaseDialog{
|
||||||
|
|
||||||
public DatabaseDialog(){
|
public DatabaseDialog(){
|
||||||
super("$database");
|
super("$database");
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.platform;
|
import static mindustry.Vars.platform;
|
||||||
|
|
||||||
public class FileChooser extends FloatingDialog{
|
public class FileChooser extends BaseDialog{
|
||||||
private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
|
private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
|
||||||
private static Fi lastDirectory = homeDirectory;
|
private static Fi lastDirectory = homeDirectory;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class GameOverDialog extends FloatingDialog{
|
public class GameOverDialog extends BaseDialog{
|
||||||
private Team winner;
|
private Team winner;
|
||||||
|
|
||||||
public GameOverDialog(){
|
public GameOverDialog(){
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.io.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class HostDialog extends FloatingDialog{
|
public class HostDialog extends BaseDialog{
|
||||||
float w = 300;
|
float w = 300;
|
||||||
|
|
||||||
public HostDialog(){
|
public HostDialog(){
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class JoinDialog extends FloatingDialog{
|
public class JoinDialog extends BaseDialog{
|
||||||
Array<Server> servers = new Array<>();
|
Array<Server> servers = new Array<>();
|
||||||
Dialog add;
|
Dialog add;
|
||||||
Server renaming;
|
Server renaming;
|
||||||
@@ -44,7 +44,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
buttons.button("?", () -> ui.showInfo("$join.info")).size(60f, 64f).width(-1);
|
buttons.button("?", () -> ui.showInfo("$join.info")).size(60f, 64f).width(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
add = new FloatingDialog("$joingame.title");
|
add = new BaseDialog("$joingame.title");
|
||||||
add.cont.add("$joingame.ip").padRight(5f).left();
|
add.cont.add("$joingame.ip").padRight(5f).left();
|
||||||
|
|
||||||
TextField field = add.cont.field(Core.settings.getString("ip"), text -> {
|
TextField field = add.cont.field(Core.settings.getString("ip"), text -> {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.Locale;
|
|||||||
import static mindustry.Vars.locales;
|
import static mindustry.Vars.locales;
|
||||||
import static mindustry.Vars.ui;
|
import static mindustry.Vars.ui;
|
||||||
|
|
||||||
public class LanguageDialog extends FloatingDialog{
|
public class LanguageDialog extends BaseDialog{
|
||||||
private Locale lastLocale;
|
private Locale lastLocale;
|
||||||
private ObjectMap<Locale, String> displayNames = ObjectMap.of(
|
private ObjectMap<Locale, String> displayNames = ObjectMap.of(
|
||||||
Locale.TRADITIONAL_CHINESE, "正體中文",
|
Locale.TRADITIONAL_CHINESE, "正體中文",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import java.io.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class LoadDialog extends FloatingDialog{
|
public class LoadDialog extends BaseDialog{
|
||||||
ScrollPane pane;
|
ScrollPane pane;
|
||||||
Table slots;
|
Table slots;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class LoadoutDialog extends FloatingDialog{
|
public class LoadoutDialog extends BaseDialog{
|
||||||
private Runnable hider;
|
private Runnable hider;
|
||||||
private Runnable resetter;
|
private Runnable resetter;
|
||||||
private Runnable updater;
|
private Runnable updater;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class MapPlayDialog extends FloatingDialog{
|
public class MapPlayDialog extends BaseDialog{
|
||||||
CustomRulesDialog dialog = new CustomRulesDialog();
|
CustomRulesDialog dialog = new CustomRulesDialog();
|
||||||
Rules rules;
|
Rules rules;
|
||||||
@NonNull Gamemode selectedGamemode = Gamemode.survival;
|
@NonNull Gamemode selectedGamemode = Gamemode.survival;
|
||||||
@@ -89,7 +89,7 @@ public class MapPlayDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void displayGameModeHelp(){
|
private void displayGameModeHelp(){
|
||||||
FloatingDialog d = new FloatingDialog(Core.bundle.get("mode.help.title"));
|
BaseDialog d = new BaseDialog(Core.bundle.get("mode.help.title"));
|
||||||
d.setFillParent(false);
|
d.setFillParent(false);
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.defaults().pad(1f);
|
table.defaults().pad(1f);
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class MapsDialog extends FloatingDialog{
|
public class MapsDialog extends BaseDialog{
|
||||||
private FloatingDialog dialog;
|
private BaseDialog dialog;
|
||||||
|
|
||||||
public MapsDialog(){
|
public MapsDialog(){
|
||||||
super("$maps");
|
super("$maps");
|
||||||
@@ -158,7 +158,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showMapInfo(Map map){
|
void showMapInfo(Map map){
|
||||||
dialog = new FloatingDialog("$editor.mapinfo");
|
dialog = new BaseDialog("$editor.mapinfo");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
|
|
||||||
float mapsize = Core.graphics.isPortrait() ? 160f : 300f;
|
float mapsize = Core.graphics.isPortrait() ? 160f : 300f;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import mindustry.gen.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.renderer;
|
import static mindustry.Vars.renderer;
|
||||||
|
|
||||||
public class MinimapDialog extends FloatingDialog{
|
public class MinimapDialog extends BaseDialog{
|
||||||
|
|
||||||
public MinimapDialog(){
|
public MinimapDialog(){
|
||||||
super("$minimap");
|
super("$minimap");
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.io.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ModsDialog extends FloatingDialog{
|
public class ModsDialog extends BaseDialog{
|
||||||
|
|
||||||
public ModsDialog(){
|
public ModsDialog(){
|
||||||
super("$mods");
|
super("$mods");
|
||||||
@@ -25,7 +25,6 @@ public class ModsDialog extends FloatingDialog{
|
|||||||
|
|
||||||
buttons.button("$mods.guide", Icon.link, () -> Core.app.openURI(modGuideURL)).size(210, 64f);
|
buttons.button("$mods.guide", Icon.link, () -> Core.app.openURI(modGuideURL)).size(210, 64f);
|
||||||
|
|
||||||
|
|
||||||
shown(this::setup);
|
shown(this::setup);
|
||||||
|
|
||||||
hidden(() -> {
|
hidden(() -> {
|
||||||
@@ -67,7 +66,7 @@ public class ModsDialog extends FloatingDialog{
|
|||||||
float margin = 12f;
|
float margin = 12f;
|
||||||
|
|
||||||
buttons.button("$mod.import", Icon.add, style, () -> {
|
buttons.button("$mod.import", Icon.add, style, () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("$mod.import");
|
BaseDialog dialog = new BaseDialog("$mod.import");
|
||||||
|
|
||||||
TextButtonStyle bstyle = Styles.cleart;
|
TextButtonStyle bstyle = Styles.cleart;
|
||||||
|
|
||||||
@@ -245,7 +244,7 @@ public class ModsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showMod(LoadedMod mod){
|
private void showMod(LoadedMod mod){
|
||||||
FloatingDialog dialog = new FloatingDialog(mod.meta.displayName());
|
BaseDialog dialog = new BaseDialog(mod.meta.displayName());
|
||||||
|
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import mindustry.gen.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class PausedDialog extends FloatingDialog{
|
public class PausedDialog extends BaseDialog{
|
||||||
private SaveDialog save = new SaveDialog();
|
private SaveDialog save = new SaveDialog();
|
||||||
private LoadDialog load = new LoadDialog();
|
private LoadDialog load = new LoadDialog();
|
||||||
private boolean wasClient = false;
|
private boolean wasClient = false;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class PlanetDialog extends FloatingDialog{
|
public class PlanetDialog extends BaseDialog{
|
||||||
private static final Color
|
private static final Color
|
||||||
outlineColor = Pal.accent.cpy().a(1f),
|
outlineColor = Pal.accent.cpy().a(1f),
|
||||||
hoverColor = Pal.accent.cpy().a(0.5f),
|
hoverColor = Pal.accent.cpy().a(0.5f),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ResourcesDialog extends FloatingDialog{
|
public class ResourcesDialog extends BaseDialog{
|
||||||
|
|
||||||
public ResourcesDialog(){
|
public ResourcesDialog(){
|
||||||
super("//TODO resources");
|
super("//TODO resources");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import mindustry.ui.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class SchematicsDialog extends FloatingDialog{
|
public class SchematicsDialog extends BaseDialog{
|
||||||
private SchematicInfoDialog info = new SchematicInfoDialog();
|
private SchematicInfoDialog info = new SchematicInfoDialog();
|
||||||
private Schematic firstSchematic;
|
private Schematic firstSchematic;
|
||||||
private String search = "";
|
private String search = "";
|
||||||
@@ -97,7 +97,7 @@ public class SchematicsDialog extends FloatingDialog{
|
|||||||
showInfo(s);
|
showInfo(s);
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons.button(Icon.download, style, () -> {
|
buttons.button(Icon.upload, style, () -> {
|
||||||
showExport(s);
|
showExport(s);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ public class SchematicsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showImport(){
|
public void showImport(){
|
||||||
FloatingDialog dialog = new FloatingDialog("$editor.export");
|
BaseDialog dialog = new BaseDialog("$editor.export");
|
||||||
dialog.cont.pane(p -> {
|
dialog.cont.pane(p -> {
|
||||||
p.margin(10f);
|
p.margin(10f);
|
||||||
p.table(Tex.button, t -> {
|
p.table(Tex.button, t -> {
|
||||||
@@ -217,7 +217,7 @@ public class SchematicsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showExport(Schematic s){
|
public void showExport(Schematic s){
|
||||||
FloatingDialog dialog = new FloatingDialog("$editor.export");
|
BaseDialog dialog = new BaseDialog("$editor.export");
|
||||||
dialog.cont.pane(p -> {
|
dialog.cont.pane(p -> {
|
||||||
p.margin(10f);
|
p.margin(10f);
|
||||||
p.table(Tex.button, t -> {
|
p.table(Tex.button, t -> {
|
||||||
@@ -312,7 +312,7 @@ public class SchematicsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SchematicInfoDialog extends FloatingDialog{
|
public static class SchematicInfoDialog extends BaseDialog{
|
||||||
|
|
||||||
SchematicInfoDialog(){
|
SchematicInfoDialog(){
|
||||||
super("");
|
super("");
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
private Table prefs;
|
private Table prefs;
|
||||||
private Table menu;
|
private Table menu;
|
||||||
private FloatingDialog dataDialog;
|
private BaseDialog dataDialog;
|
||||||
private boolean wasPaused;
|
private boolean wasPaused;
|
||||||
|
|
||||||
public SettingsMenuDialog(){
|
public SettingsMenuDialog(){
|
||||||
@@ -77,7 +77,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
prefs.clearChildren();
|
prefs.clearChildren();
|
||||||
prefs.add(menu);
|
prefs.add(menu);
|
||||||
|
|
||||||
dataDialog = new FloatingDialog("$settings.data");
|
dataDialog = new BaseDialog("$settings.data");
|
||||||
dataDialog.addCloseButton();
|
dataDialog.addCloseButton();
|
||||||
|
|
||||||
dataDialog.cont.table(Tex.button, t -> {
|
dataDialog.cont.table(Tex.button, t -> {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package mindustry.ui.dialogs;
|
package mindustry.ui.dialogs;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.scene.ui.layout.Stack;
|
|
||||||
import arc.struct.*;
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.input.*;
|
import arc.input.*;
|
||||||
@@ -13,11 +11,14 @@ import arc.scene.actions.*;
|
|||||||
import arc.scene.event.*;
|
import arc.scene.event.*;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
|
import arc.scene.ui.layout.Stack;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.content.TechTree.*;
|
import mindustry.content.TechTree.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
|
import mindustry.game.Objectives.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@@ -29,7 +30,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class TechTreeDialog extends FloatingDialog{
|
public class TechTreeDialog extends BaseDialog{
|
||||||
private final float nodeSize = Scl.scl(60f);
|
private final float nodeSize = Scl.scl(60f);
|
||||||
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
||||||
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
||||||
@@ -361,6 +362,21 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
}).fillX().left();
|
}).fillX().left();
|
||||||
t.row();
|
t.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO test if this works
|
||||||
|
if(node.objectives.length > 0){
|
||||||
|
t.table(r -> {
|
||||||
|
r.add("$complete").colspan(2).left();
|
||||||
|
r.row();
|
||||||
|
for(Objective o : node.objectives){
|
||||||
|
r.image(Icon.right).padRight(4);
|
||||||
|
r.add(o.display()).color(Color.lightGray);
|
||||||
|
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||||
|
r.row();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.row();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
desc.add("$completed");
|
desc.add("$completed");
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import arc.scene.ui.layout.Table;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.net.Administration.TraceInfo;
|
import mindustry.net.Administration.TraceInfo;
|
||||||
|
|
||||||
public class TraceDialog extends FloatingDialog{
|
public class TraceDialog extends BaseDialog{
|
||||||
|
|
||||||
public TraceDialog(){
|
public TraceDialog(){
|
||||||
super("$trace");
|
super("$trace");
|
||||||
|
|||||||
@@ -1,171 +0,0 @@
|
|||||||
package mindustry.ui.dialogs;
|
|
||||||
|
|
||||||
import arc.*;
|
|
||||||
import arc.struct.*;
|
|
||||||
import arc.graphics.*;
|
|
||||||
import arc.scene.ui.*;
|
|
||||||
import arc.scene.ui.layout.*;
|
|
||||||
import mindustry.game.*;
|
|
||||||
import mindustry.game.Objectives.*;
|
|
||||||
import mindustry.gen.*;
|
|
||||||
import mindustry.graphics.*;
|
|
||||||
import mindustry.type.*;
|
|
||||||
import mindustry.ui.Cicon;
|
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
//TODO remove
|
|
||||||
public class ZoneInfoDialog extends FloatingDialog{
|
|
||||||
private LoadoutDialog loadout = new LoadoutDialog();
|
|
||||||
|
|
||||||
public ZoneInfoDialog(){
|
|
||||||
super("");
|
|
||||||
|
|
||||||
titleTable.remove();
|
|
||||||
addCloseButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show(SectorPreset zone){
|
|
||||||
setup(zone);
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setup(SectorPreset zone){
|
|
||||||
cont.clear();
|
|
||||||
|
|
||||||
Table iteminfo = new Table();
|
|
||||||
Runnable rebuildItems = () -> {
|
|
||||||
int i = 0;
|
|
||||||
iteminfo.clear();
|
|
||||||
|
|
||||||
if(!zone.unlocked()) return;
|
|
||||||
|
|
||||||
for(ItemStack stack : zone.getLaunchCost()){
|
|
||||||
if(stack.amount == 0) continue;
|
|
||||||
|
|
||||||
if(i++ % 2 == 0){
|
|
||||||
iteminfo.row();
|
|
||||||
}
|
|
||||||
iteminfo.image(stack.item.icon(Cicon.small)).size(8 * 3).padRight(1);
|
|
||||||
iteminfo.add(stack.amount + "").color(Color.lightGray).padRight(5);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
rebuildItems.run();
|
|
||||||
|
|
||||||
cont.pane(cont -> {
|
|
||||||
if(zone.locked()){
|
|
||||||
cont.image(Icon.lock);
|
|
||||||
cont.row();
|
|
||||||
cont.add("$locked").padBottom(6);
|
|
||||||
cont.row();
|
|
||||||
|
|
||||||
cont.table(req -> {
|
|
||||||
req.defaults().left();
|
|
||||||
|
|
||||||
Array<Objectives.Objective> zones = zone.requirements.select(o -> !(o instanceof Unlock));
|
|
||||||
|
|
||||||
if(!zones.isEmpty()){
|
|
||||||
req.table(r -> {
|
|
||||||
r.add("$complete").colspan(2).left();
|
|
||||||
r.row();
|
|
||||||
for(Objectives.Objective o : zones){
|
|
||||||
r.image(Icon.terrain).padRight(4);
|
|
||||||
r.add(o.display()).color(Color.lightGray);
|
|
||||||
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
|
||||||
r.row();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
req.row();
|
|
||||||
Array<Unlock> blocks = zone.requirements.select(o -> o instanceof Unlock).as();
|
|
||||||
|
|
||||||
if(!blocks.isEmpty()){
|
|
||||||
req.table(r -> {
|
|
||||||
r.add("$research.list").colspan(2).left();
|
|
||||||
r.row();
|
|
||||||
for(Unlock blocko : blocks){
|
|
||||||
r.image(blocko.block.icon(Cicon.small)).size(8 * 3).padRight(5);
|
|
||||||
r.add(blocko.block.localizedName).color(Color.lightGray).left();
|
|
||||||
r.image(blocko.block.unlocked() ? Icon.ok : Icon.cancel, blocko.block.unlocked() ? Color.lightGray : Color.scarlet).padLeft(3);
|
|
||||||
r.row();
|
|
||||||
}
|
|
||||||
|
|
||||||
}).padTop(10);
|
|
||||||
}
|
|
||||||
}).growX();
|
|
||||||
|
|
||||||
}else{
|
|
||||||
cont.add(zone.localizedName).color(Pal.accent).growX().center();
|
|
||||||
cont.row();
|
|
||||||
cont.image().color(Pal.accent).height(3).pad(6).growX();
|
|
||||||
cont.row();
|
|
||||||
cont.table(desc -> {
|
|
||||||
desc.left().defaults().left().width(Core.graphics.isPortrait() ? 350f : 500f);
|
|
||||||
desc.pane(t -> t.marginRight(12f).add(zone.description).wrap().growX()).fillX().maxHeight(mobile ? 300f : 450f).pad(2).padBottom(8f).get().setScrollingDisabled(true, false);
|
|
||||||
desc.row();
|
|
||||||
|
|
||||||
desc.table(t -> {
|
|
||||||
t.left();
|
|
||||||
t.add("$zone.resources").padRight(6);
|
|
||||||
|
|
||||||
/*
|
|
||||||
if(zone.resources.size > 0){
|
|
||||||
t.table(r -> {
|
|
||||||
t.left();
|
|
||||||
int i = 0;
|
|
||||||
for(Item item : zone.resources){
|
|
||||||
r.image(item.icon(Cicon.small)).size(8 * 3);
|
|
||||||
if(++i % 4 == 0){
|
|
||||||
r.row();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
t.add("$none");
|
|
||||||
}*/
|
|
||||||
});
|
|
||||||
|
|
||||||
Rules rules = zone.getRules();
|
|
||||||
|
|
||||||
desc.row();
|
|
||||||
desc.add(Core.bundle.format("zone.objective", Core.bundle.get(!rules.attackMode ? "zone.objective.survival" : "zone.objective.attack")));
|
|
||||||
|
|
||||||
if(zone.bestWave() > 0){
|
|
||||||
desc.row();
|
|
||||||
desc.add(Core.bundle.format("bestwave", zone.bestWave()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cont.row();
|
|
||||||
}
|
|
||||||
cont.marginRight(12f);
|
|
||||||
});
|
|
||||||
cont.row();
|
|
||||||
|
|
||||||
/*
|
|
||||||
cont.button(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureObjective.display()),
|
|
||||||
() -> loadout.show(zone.loadout.findCore().itemCapacity, zone.getStartingItems(), zone::resetStartingItems, zone::updateLaunchCost, rebuildItems)
|
|
||||||
).fillX().pad(3).disabled(b -> !zone.canConfigure());*/
|
|
||||||
|
|
||||||
cont.row();
|
|
||||||
|
|
||||||
Button button = cont.button(zone.locked() ? "$uncover" : "$launch", () -> {
|
|
||||||
if(!data.isUnlocked(zone)){
|
|
||||||
Sounds.unlock.play();
|
|
||||||
data.unlockContent(zone);
|
|
||||||
ui.planet.setup();
|
|
||||||
setup(zone);
|
|
||||||
}else{
|
|
||||||
ui.planet.hide();
|
|
||||||
data.removeItems(zone.getLaunchCost());
|
|
||||||
hide();
|
|
||||||
//control.playZone(zone);
|
|
||||||
}
|
|
||||||
}).minWidth(200f).margin(13f).padTop(5).disabled(b -> zone.locked() ? !zone.canUnlock() : !data.hasItems(zone.getLaunchCost())).uniformY().get();
|
|
||||||
|
|
||||||
button.row();
|
|
||||||
button.add(iteminfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -532,7 +532,7 @@ public class HudFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showLaunchConfirm(){
|
private void showLaunchConfirm(){
|
||||||
FloatingDialog dialog = new FloatingDialog("$launch");
|
BaseDialog dialog = new BaseDialog("$launch");
|
||||||
dialog.update(() -> {
|
dialog.update(() -> {
|
||||||
if(!inLaunchWave()){
|
if(!inLaunchWave()){
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package mindustry.world.blocks.production;
|
||||||
|
|
||||||
|
import arc.util.ArcAnnotate.*;
|
||||||
|
import arc.util.io.*;
|
||||||
|
import mindustry.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
public class ResearchBlock extends Block{
|
||||||
|
|
||||||
|
public ResearchBlock(String name){
|
||||||
|
super(name);
|
||||||
|
|
||||||
|
update = true;
|
||||||
|
solid = true;
|
||||||
|
hasPower = true;
|
||||||
|
hasItems = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ResearchBlockEntity extends TileEntity{
|
||||||
|
public @Nullable UnlockableContent researching;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTile(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(Writes write){
|
||||||
|
super.write(write);
|
||||||
|
|
||||||
|
if(researching != null){
|
||||||
|
write.b(researching.getContentType().ordinal());
|
||||||
|
write.s(researching.id);
|
||||||
|
}else{
|
||||||
|
write.b(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(Reads read, byte revision){
|
||||||
|
super.read(read, revision);
|
||||||
|
|
||||||
|
byte type = read.b();
|
||||||
|
if(type != -1){
|
||||||
|
researching = Vars.content.getByID(ContentType.all[type], read.s());
|
||||||
|
}else{
|
||||||
|
researching = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -98,7 +98,7 @@ public class MessageBlock extends Block{
|
|||||||
accepted = str -> configure(str);
|
accepted = str -> configure(str);
|
||||||
}});
|
}});
|
||||||
}else{
|
}else{
|
||||||
FloatingDialog dialog = new FloatingDialog("$editmessage");
|
BaseDialog dialog = new BaseDialog("$editmessage");
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
TextArea a = dialog.cont.add(new TextArea(message.replace("\n", "\r"))).size(380f, 160f).get();
|
TextArea a = dialog.cont.add(new TextArea(message.replace("\n", "\r"))).size(380f, 160f).get();
|
||||||
a.setFilter((textField, c) -> {
|
a.setFilter((textField, c) -> {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class SWorkshop implements SteamUGCCallback{
|
|||||||
if(details.getResult() == SteamResult.OK){
|
if(details.getResult() == SteamResult.OK){
|
||||||
if(details.getOwnerID().equals(SVars.user.user.getSteamID())){
|
if(details.getOwnerID().equals(SVars.user.user.getSteamID())){
|
||||||
|
|
||||||
FloatingDialog dialog = new FloatingDialog("$workshop.info");
|
BaseDialog dialog = new BaseDialog("$workshop.info");
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.cont.add("$workshop.menu").pad(20f);
|
dialog.cont.add("$workshop.menu").pad(20f);
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
@@ -107,7 +107,7 @@ public class SWorkshop implements SteamUGCCallback{
|
|||||||
}).size(210f, 64f);
|
}).size(210f, 64f);
|
||||||
|
|
||||||
dialog.buttons.button("$workshop.update", Icon.up, () -> {
|
dialog.buttons.button("$workshop.update", Icon.up, () -> {
|
||||||
new FloatingDialog("$workshop.update"){{
|
new BaseDialog("$workshop.update"){{
|
||||||
setFillParent(false);
|
setFillParent(false);
|
||||||
cont.margin(10).add("$changelog").padRight(6f);
|
cont.margin(10).add("$changelog").padRight(6f);
|
||||||
cont.row();
|
cont.row();
|
||||||
@@ -177,7 +177,7 @@ public class SWorkshop implements SteamUGCCallback{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showPublish(Cons<SteamPublishedFileID> published){
|
void showPublish(Cons<SteamPublishedFileID> published){
|
||||||
FloatingDialog dialog = new FloatingDialog("$confirm");
|
BaseDialog dialog = new BaseDialog("$confirm");
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.cont.add("$publish.confirm").width(600f).wrap();
|
dialog.cont.add("$publish.confirm").width(600f).wrap();
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=c8cdb44c30f50d0350c403547ad25532ad77c465
|
archash=edaf52e6768e0c24cc4598de8105d07a6c66efd8
|
||||||
|
|||||||