Cleaned up pause menu mess / Added sector links
This commit is contained in:
@@ -379,17 +379,12 @@ public class Control extends Module{
|
|||||||
state.set(state.is(State.playing) ? State.paused : State.playing);
|
state.set(state.is(State.playing) ? State.paused : State.playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyTap("menu")){
|
if(Inputs.keyTap("menu") && !ui.restart.isShown()){
|
||||||
if(state.is(State.paused)){
|
if(ui.chatfrag.chatOpen()){
|
||||||
ui.paused.hide();
|
ui.chatfrag.hide();
|
||||||
state.set(State.playing);
|
}else if(!ui.paused.isShown() && !ui.hasDialog()){
|
||||||
}else if(!ui.restart.isShown()){
|
ui.paused.show();
|
||||||
if(ui.chatfrag.chatOpen()){
|
state.set(State.paused);
|
||||||
ui.chatfrag.hide();
|
|
||||||
}else{
|
|
||||||
ui.paused.show();
|
|
||||||
state.set(State.paused);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.maps;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import com.badlogic.gdx.utils.IntArray;
|
||||||
import io.anuke.annotations.Annotations.Serialize;
|
import io.anuke.annotations.Annotations.Serialize;
|
||||||
import io.anuke.mindustry.game.Saves.SaveSlot;
|
import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||||
import io.anuke.mindustry.game.SpawnGroup;
|
import io.anuke.mindustry.game.SpawnGroup;
|
||||||
@@ -24,6 +25,8 @@ public class Sector{
|
|||||||
public int saveID = -1;
|
public int saveID = -1;
|
||||||
/**Num of missions in this sector that have been completed so far.*/
|
/**Num of missions in this sector that have been completed so far.*/
|
||||||
public int completedMissions;
|
public int completedMissions;
|
||||||
|
/**List of links to other sector coords.*/
|
||||||
|
public IntArray links = new IntArray();
|
||||||
|
|
||||||
/**Display texture. Needs to be disposed.*/
|
/**Display texture. Needs to be disposed.*/
|
||||||
public transient Texture texture;
|
public transient Texture texture;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import io.anuke.ucore.scene.ui.Dialog;
|
|||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.state;
|
import static io.anuke.mindustry.Vars.state;
|
||||||
import static io.anuke.mindustry.Vars.ui;
|
|
||||||
|
|
||||||
public class FloatingDialog extends Dialog{
|
public class FloatingDialog extends Dialog{
|
||||||
private boolean wasPaused;
|
private boolean wasPaused;
|
||||||
@@ -29,19 +28,16 @@ public class FloatingDialog extends Dialog{
|
|||||||
|
|
||||||
hidden(() -> {
|
hidden(() -> {
|
||||||
if(shouldPause && !state.is(State.menu)){
|
if(shouldPause && !state.is(State.menu)){
|
||||||
if(!wasPaused || Net.active())
|
if(!wasPaused || Net.active()){
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
if(shouldPause && !state.is(State.menu)){
|
if(shouldPause && !state.is(State.menu)){
|
||||||
wasPaused = state.is(State.paused);
|
wasPaused = state.is(State.paused);
|
||||||
if(ui.paused.getScene() != null){
|
state.set(State.paused);
|
||||||
wasPaused = ui.paused.wasPaused;
|
|
||||||
}
|
|
||||||
if(!Net.active()) state.set(State.paused);
|
|
||||||
ui.paused.hide();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -71,8 +67,9 @@ public class FloatingDialog extends Dialog{
|
|||||||
buttons().addImageTextButton("$text.back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
buttons().addImageTextButton("$text.back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key -> {
|
keyDown(key -> {
|
||||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
if(key == Keys.ESCAPE || key == Keys.BACK) {
|
||||||
hide();
|
Gdx.app.postRunnable(this::hide);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
@@ -8,16 +9,22 @@ import io.anuke.ucore.util.Bundles;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class PausedDialog extends FloatingDialog{
|
public class PausedDialog extends FloatingDialog{
|
||||||
public boolean wasPaused = false;
|
|
||||||
private SaveDialog save = new SaveDialog();
|
private SaveDialog save = new SaveDialog();
|
||||||
private LoadDialog load = new LoadDialog();
|
private LoadDialog load = new LoadDialog();
|
||||||
private Table missionTable;
|
private Table missionTable;
|
||||||
|
|
||||||
public PausedDialog(){
|
public PausedDialog(){
|
||||||
super("$text.menu");
|
super("$text.menu");
|
||||||
|
shouldPause = true;
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
shown(this::rebuild);
|
shown(this::rebuild);
|
||||||
|
|
||||||
|
keyDown(key -> {
|
||||||
|
if(key == Keys.ESCAPE || key == Keys.BACK) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void rebuild(){
|
void rebuild(){
|
||||||
@@ -40,11 +47,6 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
shown(() -> {
|
|
||||||
wasPaused = state.is(State.paused);
|
|
||||||
if(!Net.active()) state.set(State.paused);
|
|
||||||
});
|
|
||||||
|
|
||||||
content().table(t -> missionTable = t).colspan(mobile ? 3 : 1);
|
content().table(t -> missionTable = t).colspan(mobile ? 3 : 1);
|
||||||
content().row();
|
content().row();
|
||||||
|
|
||||||
@@ -53,8 +55,6 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
|
|
||||||
content().addButton("$text.back", () -> {
|
content().addButton("$text.back", () -> {
|
||||||
hide();
|
hide();
|
||||||
if((!wasPaused || Net.active()) && !state.is(State.menu))
|
|
||||||
state.set(State.playing);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
content().row();
|
content().row();
|
||||||
@@ -86,8 +86,6 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
|
|
||||||
content().addRowImageTextButton("$text.back", "icon-play-2", isize, () -> {
|
content().addRowImageTextButton("$text.back", "icon-play-2", isize, () -> {
|
||||||
hide();
|
hide();
|
||||||
if(!wasPaused && !state.is(State.menu))
|
|
||||||
state.set(State.playing);
|
|
||||||
});
|
});
|
||||||
content().addRowImageTextButton("$text.settings", "icon-tools", isize, ui.settings::show);
|
content().addRowImageTextButton("$text.settings", "icon-tools", isize, ui.settings::show);
|
||||||
content().addRowImageTextButton("$text.save", "icon-save", isize, save::show).disabled(b -> world.getSector() != null);
|
content().addRowImageTextButton("$text.save", "icon-save", isize, save::show).disabled(b -> world.getSector() != null);
|
||||||
|
|||||||
@@ -50,11 +50,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
shown(() -> {
|
shown(() -> {
|
||||||
if(!state.is(State.menu)){
|
if(!state.is(State.menu)){
|
||||||
wasPaused = state.is(State.paused);
|
wasPaused = state.is(State.paused);
|
||||||
if(ui.paused.getScene() != null){
|
state.set(State.paused);
|
||||||
wasPaused = ui.paused.wasPaused;
|
|
||||||
}
|
|
||||||
if(!Net.active()) state.set(State.paused);
|
|
||||||
ui.paused.hide();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class UnlocksDialog extends FloatingDialog{
|
|||||||
public UnlocksDialog(){
|
public UnlocksDialog(){
|
||||||
super("$text.unlocks");
|
super("$text.unlocks");
|
||||||
|
|
||||||
addCloseButton();
|
|
||||||
shouldPause = true;
|
shouldPause = true;
|
||||||
|
addCloseButton();
|
||||||
shown(this::rebuild);
|
shown(this::rebuild);
|
||||||
onResize(this::rebuild);
|
onResize(this::rebuild);
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ public class UnlocksDialog extends FloatingDialog{
|
|||||||
|
|
||||||
Array<Content>[] allContent = content.getContentMap();
|
Array<Content>[] allContent = content.getContentMap();
|
||||||
|
|
||||||
for(int j =0; j< allContent.length; j ++){
|
for(int j = 0; j < allContent.length; j ++){
|
||||||
ContentType type = ContentType.values()[j];
|
ContentType type = ContentType.values()[j];
|
||||||
|
|
||||||
Array<Content> array = allContent[j];
|
Array<Content> array = allContent[j];
|
||||||
|
|||||||
Reference in New Issue
Block a user