Campaign slot preview
This commit is contained in:
@@ -87,6 +87,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
skin.addRegions(Core.atlas);
|
skin.addRegions(Core.atlas);
|
||||||
loadExtraStyle(skin);
|
loadExtraStyle(skin);
|
||||||
skin.add("outline", Core.assets.get("outline"));
|
skin.add("outline", Core.assets.get("outline"));
|
||||||
|
skin.getFont("outline").getData().markupEnabled = true;
|
||||||
skin.getFont("default").getData().markupEnabled = true;
|
skin.getFont("default").getData().markupEnabled = true;
|
||||||
skin.getFont("default").setOwnsTexture(false);
|
skin.getFont("default").setOwnsTexture(false);
|
||||||
skin.load(Core.files.internal("sprites/uiskin.json"));
|
skin.load(Core.files.internal("sprites/uiskin.json"));
|
||||||
|
|||||||
@@ -309,6 +309,10 @@ public class Saves{
|
|||||||
current = null;
|
current = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Core.assets.isLoaded(loadPreviewFile().path())){
|
||||||
|
Core.assets.unload(loadPreviewFile().path());
|
||||||
|
}
|
||||||
|
|
||||||
saveSlots();
|
saveSlots();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.anuke.arc.graphics.g2d.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
import io.anuke.arc.scene.*;
|
import io.anuke.arc.scene.*;
|
||||||
|
import io.anuke.arc.scene.style.*;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.scene.utils.*;
|
import io.anuke.arc.scene.utils.*;
|
||||||
@@ -78,20 +79,30 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
}}.setScaling(Scaling.fit));
|
}}.setScaling(Scaling.fit));
|
||||||
|
|
||||||
if(control.saves.getZoneSlot() != null){
|
if(control.saves.getZoneSlot() != null){
|
||||||
float size = 230f;
|
float size = 250f;
|
||||||
|
|
||||||
stack.add(new Table(t -> {
|
stack.add(new Table(t -> {
|
||||||
SaveSlot slot = control.saves.getZoneSlot();
|
SaveSlot slot = control.saves.getZoneSlot();
|
||||||
|
|
||||||
Stack sub = new Stack();
|
Stack sub = new Stack();
|
||||||
|
|
||||||
if(control.saves.getZoneSlot().getZone() != null){
|
if(slot.getZone() != null){
|
||||||
sub.add(new Table(f -> f.margin(4f).add(new Image("whiteui")).color(Color.fromGray(0.1f)).grow()));
|
sub.add(new Table(f -> f.margin(4f).add(new Image("whiteui")).color(Color.fromGray(0.1f)).grow()));
|
||||||
sub.add(new Table(f -> f.margin(4f).add(new Image(control.saves.getZoneSlot().getZone().preview).setScaling(Scaling.fit)).color(Color.DARK_GRAY).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);
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture text = slot.previewTexture();
|
||||||
|
if(draw.getRegion() == slot.getZone().preview && text != null){
|
||||||
|
draw.setRegion(new TextureRegion(text));
|
||||||
|
}
|
||||||
|
}).color(Color.DARK_GRAY).grow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TextButton button = Elements.newButton(Core.bundle.format("resume", slot.getZone().localizedName()), "square", () -> {
|
TextButton button = Elements.newButton(Core.bundle.format("resume", slot.getZone().localizedName()), "square", () -> {
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
logic.reset();
|
logic.reset();
|
||||||
@@ -128,7 +139,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
slot.delete();
|
slot.delete();
|
||||||
setup();
|
setup();
|
||||||
});
|
});
|
||||||
}).width(230f).height(50f).padTop(3);
|
}).width(size).height(50f).padTop(3);
|
||||||
}));
|
}));
|
||||||
}else{
|
}else{
|
||||||
stack.add(new View());
|
stack.add(new View());
|
||||||
|
|||||||
Reference in New Issue
Block a user