diff --git a/core/assets/ui/uiskin.json b/core/assets/ui/uiskin.json index 991226d7e9..121c5e473c 100644 --- a/core/assets/ui/uiskin.json +++ b/core/assets/ui/uiskin.json @@ -63,7 +63,7 @@ io.anuke.ucore.scene.ui.Window$WindowStyle: { dialog: {stageBackground: dialogDim, titleFont: default-font, background: window, titleFontColor: white } }, io.anuke.ucore.scene.ui.KeybindDialog$KeybindDialogStyle: { - default: {keyColor: red, keyNameColor: grey}, + default: {keyColor: red, keyNameColor: white}, }, io.anuke.ucore.scene.ui.ProgressBar$ProgressBarStyle: { default-horizontal: {background: progressbar, knob: progressbar-filled, knobBefore: progressbar-filled }, diff --git a/core/src/io/anuke/moment/Control.java b/core/src/io/anuke/moment/Control.java index 524eceded8..86016bd7a8 100644 --- a/core/src/io/anuke/moment/Control.java +++ b/core/src/io/anuke/moment/Control.java @@ -245,14 +245,15 @@ public class Control extends RendererModule{ @Override public void update(){ - if(Gdx.input.isKeyJustPressed(Keys.ESCAPE)) - Gdx.app.exit(); + //if(Gdx.input.isKeyJustPressed(Keys.ESCAPE) && Gdx.app.getType() == ApplicationType.Desktop) + // Gdx.app.exit(); if(!main.playing){ clearScreen(); return; } + if(!main.paused) Entities.update(); input(); diff --git a/core/src/io/anuke/moment/Moment.java b/core/src/io/anuke/moment/Moment.java index d2b9a0aed2..a60074149f 100644 --- a/core/src/io/anuke/moment/Moment.java +++ b/core/src/io/anuke/moment/Moment.java @@ -39,6 +39,7 @@ public class Moment extends ModuleController{ public Array spawnpoints = new Array(); public boolean playing = false; + public boolean paused = false; @Override public void init(){ @@ -55,7 +56,8 @@ public class Moment extends ModuleController{ "left", Keys.A, "down", Keys.S, "right", Keys.D, - "rotate", Keys.R + "rotate", Keys.R, + "menu", Keys.ESCAPE ); Settings.loadAll("io.anuke.moment"); @@ -80,6 +82,7 @@ public class Moment extends ModuleController{ @Override public void update(){ + if(!paused) super.update(); if(!playing) return; diff --git a/core/src/io/anuke/moment/UI.java b/core/src/io/anuke/moment/UI.java index 04c9ca7599..a5aef672e3 100644 --- a/core/src/io/anuke/moment/UI.java +++ b/core/src/io/anuke/moment/UI.java @@ -13,6 +13,7 @@ import io.anuke.moment.world.Tile; import io.anuke.moment.world.TileType; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.UGraphics; +import io.anuke.ucore.core.UInput; import io.anuke.ucore.modules.SceneModule; import io.anuke.ucore.scene.builders.*; import io.anuke.ucore.scene.style.Styles; @@ -25,7 +26,7 @@ public class UI extends SceneModule{ Table itemtable; PrefsDialog prefs; KeybindDialog keys; - Dialog about; + Dialog about, menu; BooleanSupplier play = () -> { return main.playing; @@ -67,6 +68,17 @@ public class UI extends SceneModule{ Draw.clear(); } scene.getBatch().end(); + + if(UInput.keyUp("menu")){ + if(menu.getScene() != null){ + menu.hide(); + main.paused = false; + }else{ + main.paused = true; + menu.show(scene); + } + } + }else{ } @@ -93,7 +105,33 @@ public class UI extends SceneModule{ about = new Dialog("About"); about.getContentTable().add("Made by Anuken for the" + "\nGDL Metal Monstrosity jam." + "\nTools used:"); about.addCloseButton(); - + + menu = new Dialog("Paused", "dialog"); + menu.content().addButton("Back", ()->{ + menu.hide(); + main.paused = false; + }).width(200); + + menu.content().row(); + menu.content().addButton("Back to menu", ()->{ + new Dialog("Confirm", "dialog"){ + { + text("Are you sure you want to quit?"); + button("Ok", true); + button("Cancel", false); + } + + protected void result(Object object){ + if(object == Boolean.TRUE){ + menu.hide(); + main.paused = false; + main.playing = false; + } + } + }.show(scene); + + }).width(200); + build.begin(scene); new table(){{ @@ -152,28 +190,40 @@ public class UI extends SceneModule{ i++; - String description = r.result.description(); - if(r.result.ammo != null){ - description += "\n[SALMON]Ammo: " + r.result.ammo.name(); - } - Table tiptable = new Table(); - tiptable.background("button"); - tiptable.add("[PURPLE]" + r.result.name(), 0.75f).left().padBottom(2f); - ItemStack[] req = r.requirements; - for(ItemStack s : req){ + Runnable run = ()->{ + tiptable.clearChildren(); + + String description = r.result.description(); + if(r.result.ammo != null){ + description += "\n[SALMON]Ammo: " + r.result.ammo.name(); + } + + + tiptable.background("button"); + tiptable.add("[PURPLE]" + r.result.name(), 0.75f).left().padBottom(2f); + + ItemStack[] req = r.requirements; + for(ItemStack s : req){ + tiptable.row(); + int amount = Math.min(main.items.get(s.item, 0), s.amount); + tiptable.add( + (amount >= s.amount ? "[YELLOW]" : "[RED]") + +s.item + ": " + amount + " / " +s.amount, 0.5f).left(); + } + tiptable.row(); - tiptable.add("[YELLOW]" + s.amount + "x " + s.item.name(), 0.5f).left(); - } + tiptable.add().size(10); + tiptable.row(); + tiptable.add("[ORANGE]" + description).left(); + tiptable.pad(10f); + }; + + run.run(); + + Tooltip tip = new Tooltip(tiptable, run); - tiptable.row(); - tiptable.add().size(10); - tiptable.row(); - tiptable.add("[ORANGE]" + description).left(); - tiptable.pad(10f); - - Tooltip tip = new Tooltip(tiptable); tip.setInstant(true); image.addListener(tip); @@ -185,6 +235,10 @@ public class UI extends SceneModule{ table.add().size(size); } + //if((int)((float)recipes.size/rows+1) == 2){ + // table.row(); + //} + table.setVisible(()->{ return button.isChecked(); });