Merge branches '6.0' and 'splinterface-impl' of https://github.com/Anuken/Mindustry into splinterface-impl

# Conflicts:
#	core/assets/sprites/block_colors.png
#	core/assets/sprites/sprites.atlas
#	core/assets/sprites/sprites.png
#	core/assets/sprites/sprites3.png
#	core/assets/sprites/sprites5.png
#	core/src/mindustry/Vars.java
#	core/src/mindustry/entities/traits/SaveTrait.java
#	core/src/mindustry/maps/generators/MapGenerator.java
#	core/src/mindustry/ui/dialogs/DeployDialog.java
#	core/src/mindustry/world/blocks/Floor.java
#	desktop/src/mindustry/desktop/DesktopLauncher.java
#	gradle.properties
This commit is contained in:
Anuken
2020-02-04 12:25:18 -05:00
82 changed files with 1708 additions and 502 deletions

View File

@@ -1,7 +1,6 @@
package mindustry.ui.dialogs;
import arc.*;
import arc.struct.*;
import arc.func.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
@@ -10,10 +9,10 @@ import arc.math.*;
import arc.math.geom.*;
import arc.scene.*;
import arc.scene.event.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.scene.utils.*;
import arc.struct.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.core.GameState.*;
@@ -29,6 +28,7 @@ import mindustry.ui.layout.TreeLayout.*;
import static mindustry.Vars.*;
//TODO remove (legacy, no longer needed)
public class DeployDialog extends FloatingDialog{
private final float nodeSize = Scl.scl(230f);
private ObjectSet<ZoneNode> nodes = new ObjectSet<>();
@@ -105,7 +105,7 @@ public class DeployDialog extends FloatingDialog{
bounds.y += nodeSize*0.4f;
}
public void setup(){
void setup(){
platform.updateRPC();
cont.clear();
@@ -122,7 +122,7 @@ public class DeployDialog extends FloatingDialog{
setFilter(TextureFilter.Linear);
}}){{
float[] time = {0};
setColor(Color.grays(0.3f));
setColor(Color.gray(0.3f));
setScale(1.5f);
update(() -> {
setOrigin(Align.center);
@@ -140,19 +140,19 @@ public class DeployDialog extends FloatingDialog{
Stack sub = new Stack();
if(slot.getZone() != null){
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.grays(0.1f)).grow()));
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.gray(0.1f)).grow()));
sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> {
TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();
if(draw.getRegion().getTexture().isDisposed()){
draw.setRegion(slot.getZone().preview);
}
//sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> {
//TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();
//if(draw.getRegion().getTexture().isDisposed()){
// draw.setRegion(slot.getZone().preview);
// }
Texture text = slot.previewTexture();
if(draw.getRegion() == slot.getZone().preview && text != null){
draw.setRegion(new TextureRegion(text));
}
}).color(Color.darkGray).grow()));
//if(draw.getRegion() == slot.getZone().preview && text != null){
// draw.setRegion(new TextureRegion(text));
//}
// }).color(Color.darkGray).grow()));
}
TextButton button = Elements.newButton(Core.bundle.format("resume", slot.getZone().localizedName), Styles.squaret, () -> {
@@ -249,12 +249,12 @@ public class DeployDialog extends FloatingDialog{
for(ZoneNode node : nodes){
Stack stack = new Stack();
Tmp.v1.set(node.width, node.height);
if(node.zone.preview != null){
Tmp.v1.set(Scaling.fit.apply(node.zone.preview.getWidth(), node.zone.preview.getHeight(), node.width, node.height));
}
//if(node.zone.preview != null){
// Tmp.v1.set(Scaling.fit.apply(node.zone.preview.getWidth(), node.zone.preview.getHeight(), node.width, node.height));
//}
stack.setSize(Tmp.v1.x, Tmp.v1.y);
stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.darkGray : Color.grays(0.2f)).grow()));
// stack.setSize(Tmp.v1.x, Tmp.v1.y);
// stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.darkGray : Color.gray(0.2f)).grow()));
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
Button button = new Button(Styles.squaret);

View File

@@ -200,7 +200,6 @@ public class FileChooser extends FloatingDialog{
files.add(upbutton).align(Align.topLeft).fillX().expandX().height(50).pad(2).colspan(2);
files.row();
ButtonGroup<TextButton> group = new ButtonGroup<>();
group.setMinCheckCount(0);

View File

@@ -92,7 +92,7 @@ public class GameOverDialog extends FloatingDialog{
hide();
state.set(State.menu);
logic.reset();
ui.deploy.show();
ui.planet.show();
}).size(130f, 60f);
}else{
buttons.addButton("$menu", () -> {

View File

@@ -0,0 +1,30 @@
package mindustry.ui.dialogs;
import mindustry.content.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.*;
import static mindustry.Vars.ui;
public class PlanetDialog extends FloatingDialog{
private PlanetRenderer renderer = new PlanetRenderer();
public PlanetDialog(){
super("", Styles.fullDialog);
addCloseButton();
buttons.addImageTextButton("$techtree", Icon.tree, () -> ui.tech.show()).size(230f, 64f);
shown(this::setup);
}
void setup(){
cont.clear();
titleTable.remove();
cont.addRect((x, y, w, h) -> {
renderer.render(Planets.starter);
}).grow();
}
}

View File

@@ -59,7 +59,7 @@ public class TechTreeDialog extends FloatingDialog{
treeLayout();
});
hidden(ui.deploy::setup);
hidden(ui.planet::setup);
addCloseButton();

View File

@@ -14,6 +14,7 @@ import mindustry.ui.Cicon;
import static mindustry.Vars.*;
//TODO remove
public class ZoneInfoDialog extends FloatingDialog{
private LoadoutDialog loadout = new LoadoutDialog();
@@ -152,13 +153,13 @@ public class ZoneInfoDialog extends FloatingDialog{
if(!data.isUnlocked(zone)){
Sounds.unlock.play();
data.unlockContent(zone);
ui.deploy.setup();
ui.planet.setup();
setup(zone);
}else{
ui.deploy.hide();
ui.planet.hide();
data.removeItems(zone.getLaunchCost());
hide();
control.playZone(zone);
//control.playZone(zone);
}
}).minWidth(200f).margin(13f).padTop(5).disabled(b -> zone.locked() ? !zone.canUnlock() : !data.hasItems(zone.getLaunchCost())).uniformY().get();

View File

@@ -21,9 +21,9 @@ public class FadeInFragment extends Fragment{
@Override
public void draw(){
Draw.color(0f, 0f, 0f, Mathf.clamp(1f - time));
Fill.crect(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
Draw.color();
Draw.color(0f, 0f, 0f, Mathf.clamp(1f - time));
Fill.crect(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
Draw.color();
}
@Override

View File

@@ -100,7 +100,7 @@ public class MenuFragment extends Fragment{
container.defaults().size(size).pad(5).padTop(4f);
MobileButton
play = new MobileButton(Icon.play, "$campaign", () -> checkPlay(ui.deploy::show)),
play = new MobileButton(Icon.play, "$campaign", () -> checkPlay(ui.planet::show)),
custom = new MobileButton(Icon.rightOpenOut, "$customgame", () -> checkPlay(ui.custom::show)),
maps = new MobileButton(Icon.download, "$loadgame", () -> checkPlay(ui.load::show)),
join = new MobileButton(Icon.add, "$joingame", () -> checkPlay(ui.join::show)),
@@ -165,7 +165,7 @@ public class MenuFragment extends Fragment{
buttons(t,
new Buttoni("$play", Icon.play,
new Buttoni("$campaign", Icon.play, () -> checkPlay(ui.deploy::show)),
new Buttoni("$campaign", Icon.play, () -> checkPlay(ui.planet::show)),
new Buttoni("$joingame", Icon.add, () -> checkPlay(ui.join::show)),
new Buttoni("$customgame", Icon.terrain, () -> checkPlay(ui.custom::show)),
new Buttoni("$loadgame", Icon.download, () -> checkPlay(ui.load::show)),