Deployment dialog replaced

This commit is contained in:
Anuken
2020-01-12 20:01:32 -05:00
parent e6f1d194ae
commit c637ec15ff
13 changed files with 87 additions and 45 deletions

View File

@@ -29,6 +29,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 +106,7 @@ public class DeployDialog extends FloatingDialog{
bounds.y += nodeSize*0.4f;
}
public void setup(){
void setup(){
platform.updateRPC();
cont.clear();

View File

@@ -88,7 +88,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,29 @@
package mindustry.ui.dialogs;
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.draw();
}).grow();
}
}

View File

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

View File

@@ -152,10 +152,10 @@ 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);

View File

@@ -1,14 +1,15 @@
package mindustry.ui.fragments;
import arc.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.scene.*;
import arc.scene.event.*;
import mindustry.graphics.*;
/** Fades in a black overlay.*/
public class FadeInFragment extends Fragment{
private static final float duration = 40f;
float time = 0f;
PlanetRenderer rend = new PlanetRenderer();
@Override
public void build(Group parent){
@@ -20,10 +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();
rend.draw();
Draw.color(0f, 0f, 0f, Mathf.clamp(1f - time));
Fill.crect(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
Draw.color();
}
@Override
@@ -31,7 +31,7 @@ public class FadeInFragment extends Fragment{
super.act(delta);
time += 1f / duration;
if(time > 1){
//remove();
remove();
}
}
});

View File

@@ -100,7 +100,7 @@ public class MenuFragment extends Fragment{
container.defaults().size(size).pad(5).padTop(4f);
MobileButton
play = new MobileButton(Icon.play2, "$campaign", () -> checkPlay(ui.deploy::show)),
play = new MobileButton(Icon.play2, "$campaign", () -> checkPlay(ui.planet::show)),
custom = new MobileButton(Icon.playCustom, "$customgame", () -> checkPlay(ui.custom::show)),
maps = new MobileButton(Icon.load, "$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.play2Small,
new Buttoni("$campaign", Icon.play2Small, () -> checkPlay(ui.deploy::show)),
new Buttoni("$campaign", Icon.play2Small, () -> checkPlay(ui.planet::show)),
new Buttoni("$joingame", Icon.addSmall, () -> checkPlay(ui.join::show)),
new Buttoni("$customgame", Icon.editorSmall, () -> checkPlay(ui.custom::show)),
new Buttoni("$loadgame", Icon.loadSmall, () -> checkPlay(ui.load::show)),