Cleanup
This commit is contained in:
@@ -253,6 +253,7 @@ project(":core"){
|
|||||||
compile arcModule("arc-core")
|
compile arcModule("arc-core")
|
||||||
compile arcModule("extensions:freetype")
|
compile arcModule("extensions:freetype")
|
||||||
compile arcModule("extensions:g3d")
|
compile arcModule("extensions:g3d")
|
||||||
|
compile arcModule("extensions:fx")
|
||||||
compile arcModule("extensions:arcnet")
|
compile arcModule("extensions:arcnet")
|
||||||
compile "org.mozilla:rhino-runtime:1.7.12"
|
compile "org.mozilla:rhino-runtime:1.7.12"
|
||||||
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
input = new DesktopInput();
|
input = new DesktopInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!state.is(State.menu)){
|
if(state.isGame()){
|
||||||
player.add();
|
player.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +445,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
settings.save();
|
settings.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!state.is(State.menu)){
|
if(state.isGame()){
|
||||||
input.update();
|
input.update();
|
||||||
|
|
||||||
if(state.isCampaign()){
|
if(state.isCampaign()){
|
||||||
|
|||||||
@@ -58,6 +58,15 @@ public class GameState{
|
|||||||
return (is(State.paused) && !net.active()) || (gameOver && !net.active());
|
return (is(State.paused) && !net.active()) || (gameOver && !net.active());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return whether the current state is *not* the menu. */
|
||||||
|
public boolean isGame(){
|
||||||
|
return state != State.menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMenu(){
|
||||||
|
return state == State.menu;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean is(State astate){
|
public boolean is(State astate){
|
||||||
return state == astate;
|
return state == astate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class Logic implements ApplicationListener{
|
|||||||
Events.fire(Trigger.update);
|
Events.fire(Trigger.update);
|
||||||
universe.updateGlobal();
|
universe.updateGlobal();
|
||||||
|
|
||||||
if(!state.is(State.menu)){
|
if(state.isGame()){
|
||||||
if(!net.client()){
|
if(!net.client()){
|
||||||
state.enemies = Groups.unit.count(b -> b.team() == state.rules.waveTeam && b.type().isCounted);
|
state.enemies = Groups.unit.count(b -> b.team() == state.rules.waveTeam && b.type().isCounted);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
public void update(){
|
public void update(){
|
||||||
if(!net.client()) return;
|
if(!net.client()) return;
|
||||||
|
|
||||||
if(!state.is(State.menu)){
|
if(state.isGame()){
|
||||||
if(!connecting) sync();
|
if(!connecting) sync();
|
||||||
}else if(!connecting){
|
}else if(!connecting){
|
||||||
net.disconnect();
|
net.disconnect();
|
||||||
|
|||||||
@@ -673,7 +673,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
|
||||||
if(!headless && !closing && net.server() && state.is(State.menu)){
|
if(!headless && !closing && net.server() && state.isMenu()){
|
||||||
closing = true;
|
closing = true;
|
||||||
ui.loadfrag.show("$server.closing");
|
ui.loadfrag.show("$server.closing");
|
||||||
Time.runTask(5f, () -> {
|
Time.runTask(5f, () -> {
|
||||||
@@ -683,7 +683,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!state.is(State.menu) && net.server()){
|
if(state.isGame() && net.server()){
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import arc.math.*;
|
|||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.core.GameState.*;
|
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -27,7 +26,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
|
|
||||||
public FrameBuffer effectBuffer = new FrameBuffer(2, 2);
|
public FrameBuffer effectBuffer = new FrameBuffer(2, 2);
|
||||||
private Bloom bloom;
|
private Bloom bloom;
|
||||||
private Color clearColor;
|
private Color clearColor = new Color(0f, 0f, 0f, 1f);
|
||||||
private float targetscale = Scl.scl(4);
|
private float targetscale = Scl.scl(4);
|
||||||
private float camerascale = targetscale;
|
private float camerascale = targetscale;
|
||||||
private float landscale = 0f, landTime;
|
private float landscale = 0f, landTime;
|
||||||
@@ -37,8 +36,6 @@ public class Renderer implements ApplicationListener{
|
|||||||
public Renderer(){
|
public Renderer(){
|
||||||
camera = new Camera();
|
camera = new Camera();
|
||||||
Shaders.init();
|
Shaders.init();
|
||||||
|
|
||||||
clearColor = new Color(0f, 0f, 0f, 1f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shake(float intensity, float duration){
|
public void shake(float intensity, float duration){
|
||||||
@@ -68,7 +65,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
camera.width = graphics.getWidth() / camerascale;
|
camera.width = graphics.getWidth() / camerascale;
|
||||||
camera.height = graphics.getHeight() / camerascale;
|
camera.height = graphics.getHeight() / camerascale;
|
||||||
|
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
landTime = 0f;
|
landTime = 0f;
|
||||||
graphics.clear(Color.black);
|
graphics.clear(Color.black);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import arc.scene.ui.Tooltip.*;
|
|||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.core.GameState.*;
|
|
||||||
import mindustry.editor.*;
|
import mindustry.editor.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -185,10 +184,10 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
menuGroup.setFillParent(true);
|
menuGroup.setFillParent(true);
|
||||||
menuGroup.touchable(Touchable.childrenOnly);
|
menuGroup.touchable(Touchable.childrenOnly);
|
||||||
menuGroup.visible(() -> state.is(State.menu));
|
menuGroup.visible(() -> state.isMenu());
|
||||||
hudGroup.setFillParent(true);
|
hudGroup.setFillParent(true);
|
||||||
hudGroup.touchable(Touchable.childrenOnly);
|
hudGroup.touchable(Touchable.childrenOnly);
|
||||||
hudGroup.visible(() -> !state.is(State.menu));
|
hudGroup.visible(() -> state.isGame());
|
||||||
|
|
||||||
Core.scene.add(menuGroup);
|
Core.scene.add(menuGroup);
|
||||||
Core.scene.add(hudGroup);
|
Core.scene.add(hudGroup);
|
||||||
@@ -296,7 +295,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
table.setFillParent(true);
|
table.setFillParent(true);
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable(Touchable.disabled);
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.is(State.menu)) table.remove();
|
if(state.isMenu()) table.remove();
|
||||||
});
|
});
|
||||||
table.actions(Actions.delay(duration * 0.9f), Actions.fadeOut(duration * 0.1f, Interpolation.fade), Actions.remove());
|
table.actions(Actions.delay(duration * 0.9f), Actions.fadeOut(duration * 0.1f, Interpolation.fade), Actions.remove());
|
||||||
table.top().table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).padTop(10);
|
table.top().table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).padTop(10);
|
||||||
@@ -309,7 +308,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
table.setFillParent(true);
|
table.setFillParent(true);
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable(Touchable.disabled);
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.is(State.menu)) table.remove();
|
if(state.isMenu()) table.remove();
|
||||||
});
|
});
|
||||||
table.actions(Actions.delay(duration), Actions.remove());
|
table.actions(Actions.delay(duration), Actions.remove());
|
||||||
table.align(align).table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).pad(top, left, bottom, right);
|
table.align(align).table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).pad(top, left, bottom, right);
|
||||||
@@ -322,7 +321,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
table.setFillParent(true);
|
table.setFillParent(true);
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable(Touchable.disabled);
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.is(State.menu)) table.remove();
|
if(state.isMenu()) table.remove();
|
||||||
});
|
});
|
||||||
table.actions(Actions.delay(duration), Actions.remove());
|
table.actions(Actions.delay(duration), Actions.remove());
|
||||||
table.align(Align.center).table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).update(t -> {
|
table.align(Align.center).table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).update(t -> {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class MusicControl{
|
|||||||
|
|
||||||
/** Update and play the right music track.*/
|
/** Update and play the right music track.*/
|
||||||
public void update(){
|
public void update(){
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
silenced = false;
|
silenced = false;
|
||||||
if(ui.planet.isShown()){
|
if(ui.planet.isShown()){
|
||||||
play(Musics.launch);
|
play(Musics.launch);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class Saves{
|
|||||||
public void update(){
|
public void update(){
|
||||||
SaveSlot current = this.current;
|
SaveSlot current = this.current;
|
||||||
|
|
||||||
if(current != null && !state.is(State.menu)
|
if(current != null && state.isGame()
|
||||||
&& !(state.isPaused() && Core.scene.hasDialog())){
|
&& !(state.isPaused() && Core.scene.hasDialog())){
|
||||||
if(lastTimestamp != 0){
|
if(lastTimestamp != 0){
|
||||||
totalPlaytime += Time.timeSinceMillis(lastTimestamp);
|
totalPlaytime += Time.timeSinceMillis(lastTimestamp);
|
||||||
@@ -85,7 +85,7 @@ public class Saves{
|
|||||||
lastTimestamp = Time.millis();
|
lastTimestamp = Time.millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!state.is(State.menu) && !state.gameOver && current != null && current.isAutosave() && !state.rules.tutorial){
|
if(state.isGame() && !state.gameOver && current != null && current.isAutosave() && !state.rules.tutorial){
|
||||||
time += Time.delta();
|
time += Time.delta();
|
||||||
if(time > Core.settings.getInt("saveinterval") * 60){
|
if(time > Core.settings.getInt("saveinterval") * 60){
|
||||||
saving = true;
|
saving = true;
|
||||||
@@ -192,7 +192,7 @@ public class Saves{
|
|||||||
|
|
||||||
SaveIO.save(file);
|
SaveIO.save(file);
|
||||||
meta = SaveIO.getMeta(file);
|
meta = SaveIO.getMeta(file);
|
||||||
if(!state.is(State.menu)){
|
if(state.isGame()){
|
||||||
current = this;
|
current = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,11 +177,11 @@ public class DesktopInput extends InputHandler{
|
|||||||
isShooting = false;
|
isShooting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!state.is(State.menu) && Core.input.keyTap(Binding.minimap) && !scene.hasDialog() && !(scene.getKeyboardFocus() instanceof TextField)){
|
if(state.isGame() && Core.input.keyTap(Binding.minimap) && !scene.hasDialog() && !(scene.getKeyboardFocus() instanceof TextField)){
|
||||||
ui.minimapfrag.toggle();
|
ui.minimapfrag.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.is(State.menu) || Core.scene.hasDialog()) return;
|
if(state.isMenu() || Core.scene.hasDialog()) return;
|
||||||
|
|
||||||
//zoom camera
|
//zoom camera
|
||||||
if((!Core.scene.hasScroll() || Core.input.keyDown(Binding.diagonal_placement)) && !ui.chatfrag.shown() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0
|
if((!Core.scene.hasScroll() || Core.input.keyDown(Binding.diagonal_placement)) && !ui.chatfrag.shown() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0
|
||||||
@@ -491,7 +491,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(){
|
public void updateState(){
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
droppingItem = false;
|
droppingItem = false;
|
||||||
mode = none;
|
mode = none;
|
||||||
block = null;
|
block = null;
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){
|
public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){
|
||||||
if(state.is(State.menu)) return false;
|
if(state.isMenu()) return false;
|
||||||
|
|
||||||
down = true;
|
down = true;
|
||||||
|
|
||||||
@@ -513,7 +513,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(float x, float y){
|
public boolean longPress(float x, float y){
|
||||||
if(state.is(State.menu) || mode == none || player.dead()) return false;
|
if(state.isMenu() || mode == none || player.dead()) return false;
|
||||||
|
|
||||||
//get tile on cursor
|
//get tile on cursor
|
||||||
Tile cursor = tileAt(x, y);
|
Tile cursor = tileAt(x, y);
|
||||||
@@ -541,7 +541,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tap(float x, float y, int count, KeyCode button){
|
public boolean tap(float x, float y, int count, KeyCode button){
|
||||||
if(state.is(State.menu) || lineMode) return false;
|
if(state.isMenu() || lineMode) return false;
|
||||||
|
|
||||||
float worldx = Core.input.mouseWorld(x, y).x, worldy = Core.input.mouseWorld(x, y).y;
|
float worldx = Core.input.mouseWorld(x, y).x, worldy = Core.input.mouseWorld(x, y).y;
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
public void update(){
|
public void update(){
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
if(state.is(State.menu) ){
|
if(state.isMenu() ){
|
||||||
selectRequests.clear();
|
selectRequests.clear();
|
||||||
removals.clear();
|
removals.clear();
|
||||||
mode = none;
|
mode = none;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class ItemsDisplay extends Table{
|
|||||||
}).get().setScrollingDisabled(true, false), false).setDuration(0.3f);
|
}).get().setScrollingDisabled(true, false), false).setDuration(0.3f);
|
||||||
|
|
||||||
c.addImageTextButton("$launcheditems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
c.addImageTextButton("$launcheditems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
||||||
t.setText(state.is(State.menu) ? "$launcheditems" : "$launchinfo");
|
t.setText(state.isMenu() ? "$launcheditems" : "$launchinfo");
|
||||||
t.setChecked(col.isCollapsed());
|
t.setChecked(col.isCollapsed());
|
||||||
((Image)t.getChildren().get(1)).setDrawable(col.isCollapsed() ? Icon.upOpen : Icon.downOpen);
|
((Image)t.getChildren().get(1)).setDrawable(col.isCollapsed() ? Icon.upOpen : Icon.downOpen);
|
||||||
}).padBottom(4).left().fillX().margin(12f).minWidth(200f);
|
}).padBottom(4).left().fillX().margin(12f).minWidth(200f);
|
||||||
@@ -53,7 +53,7 @@ public class ItemsDisplay extends Table{
|
|||||||
private String format(Item item){
|
private String format(Item item){
|
||||||
builder.setLength(0);
|
builder.setLength(0);
|
||||||
builder.append(ui.formatAmount(data.items().get(item, 0)));
|
builder.append(ui.formatAmount(data.items().get(item, 0)));
|
||||||
if(!state.is(State.menu) && player.team().data().hasCore() && player.team().core().items().get(item) > 0){
|
if(state.isGame() && player.team().data().hasCore() && player.team().core().items().get(item) > 0){
|
||||||
builder.append(" [unlaunched]+ ");
|
builder.append(" [unlaunched]+ ");
|
||||||
builder.append(ui.formatAmount(state.teams.get(player.team()).core().items().get(item)));
|
builder.append(ui.formatAmount(state.teams.get(player.team()).core().items().get(item)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,6 @@ public class DatabaseDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean unlocked(UnlockableContent content){
|
boolean unlocked(UnlockableContent content){
|
||||||
return (!Vars.state.isCampaign() && !Vars.state.is(State.menu)) || content.unlocked();
|
return (!Vars.state.isCampaign() && !Vars.state.isMenu()) || content.unlocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class FloatingDialog extends Dialog{
|
|||||||
.growX().height(3f).pad(4f);
|
.growX().height(3f).pad(4f);
|
||||||
|
|
||||||
hidden(() -> {
|
hidden(() -> {
|
||||||
if(shouldPause && !state.is(State.menu)){
|
if(shouldPause && state.isGame()){
|
||||||
if(!wasPaused || net.active()){
|
if(!wasPaused || net.active()){
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class FloatingDialog extends Dialog{
|
|||||||
});
|
});
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
if(shouldPause && !state.is(State.menu)){
|
if(shouldPause && state.isGame()){
|
||||||
wasPaused = state.is(State.paused);
|
wasPaused = state.is(State.paused);
|
||||||
state.set(State.paused);
|
state.set(State.paused);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
cont.clear();
|
cont.clear();
|
||||||
|
|
||||||
update(() -> {
|
update(() -> {
|
||||||
if(state.is(State.menu) && isShown()){
|
if(state.isMenu() && isShown()){
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class SaveDialog extends LoadDialog{
|
|||||||
super("$savegame");
|
super("$savegame");
|
||||||
|
|
||||||
update(() -> {
|
update(() -> {
|
||||||
if(state.is(State.menu) && isShown()){
|
if(state.isMenu() && isShown()){
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class SchematicsDialog extends FloatingDialog{
|
|||||||
})).size(200f);
|
})).size(200f);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
if(sel[0].childrenPressed()) return;
|
if(sel[0].childrenPressed()) return;
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
showInfo(s);
|
showInfo(s);
|
||||||
}else{
|
}else{
|
||||||
control.input.useSchematic(s);
|
control.input.useSchematic(s);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
public SettingsMenuDialog(){
|
public SettingsMenuDialog(){
|
||||||
hidden(() -> {
|
hidden(() -> {
|
||||||
Sounds.back.play();
|
Sounds.back.play();
|
||||||
if(!state.is(State.menu)){
|
if(state.isGame()){
|
||||||
if(!wasPaused || net.active())
|
if(!wasPaused || net.active())
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
back();
|
back();
|
||||||
if(!state.is(State.menu)){
|
if(state.isGame()){
|
||||||
wasPaused = state.is(State.paused);
|
wasPaused = state.is(State.paused);
|
||||||
state.set(State.paused);
|
state.set(State.paused);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class BlockConfigFragment extends Fragment{
|
|||||||
@Override
|
@Override
|
||||||
public void act(float delta){
|
public void act(float delta){
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
table.visible(false);
|
table.visible(false);
|
||||||
configTile = null;
|
configTile = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
table.touchable(Touchable.enabled);
|
table.touchable(Touchable.enabled);
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
|
|
||||||
if(state.is(State.menu) || tile == null || !tile.isValid() || !tile.block().isAccessible() || tile.items().total() == 0){
|
if(state.isMenu() || tile == null || !tile.isValid() || !tile.block().isAccessible() || tile.items().total() == 0){
|
||||||
hide();
|
hide();
|
||||||
}else{
|
}else{
|
||||||
if(holding && lastItem != null){
|
if(holding && lastItem != null){
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ public class HudFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
|
|
||||||
t.top().visible(() -> {
|
t.top().visible(() -> {
|
||||||
if(state.is(State.menu) || !state.teams.get(player.team()).hasCore()){
|
if(state.isMenu() || !state.teams.get(player.team()).hasCore()){
|
||||||
coreAttackTime[0] = 0f;
|
coreAttackTime[0] = 0f;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ public class HudFragment extends Fragment{
|
|||||||
.style(Styles.outlineLabel)).padTop(10).visible(p.color.a >= 0.001f);
|
.style(Styles.outlineLabel)).padTop(10).visible(p.color.a >= 0.001f);
|
||||||
p.update(() -> {
|
p.update(() -> {
|
||||||
p.color.a = Mathf.lerpDelta(p.color.a, Mathf.num(showHudText), 0.2f);
|
p.color.a = Mathf.lerpDelta(p.color.a, Mathf.num(showHudText), 0.2f);
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
p.color.a = 0f;
|
p.color.a = 0f;
|
||||||
showHudText = false;
|
showHudText = false;
|
||||||
}
|
}
|
||||||
@@ -328,14 +328,14 @@ public class HudFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showToast(String text){
|
public void showToast(String text){
|
||||||
if(state.is(State.menu)) return;
|
if(state.isMenu()) return;
|
||||||
|
|
||||||
scheduleToast(() -> {
|
scheduleToast(() -> {
|
||||||
Sounds.message.play();
|
Sounds.message.play();
|
||||||
|
|
||||||
Table table = new Table(Tex.button);
|
Table table = new Table(Tex.button);
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
table.remove();
|
table.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -362,7 +362,7 @@ public class HudFragment extends Fragment{
|
|||||||
public void showUnlock(UnlockableContent content){
|
public void showUnlock(UnlockableContent content){
|
||||||
//some content may not have icons... yet
|
//some content may not have icons... yet
|
||||||
//also don't play in the tutorial to prevent confusion
|
//also don't play in the tutorial to prevent confusion
|
||||||
if(state.is(State.menu) || state.rules.tutorial) return;
|
if(state.isMenu() || state.rules.tutorial) return;
|
||||||
|
|
||||||
Sounds.message.play();
|
Sounds.message.play();
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ public class HudFragment extends Fragment{
|
|||||||
scheduleToast(() -> {
|
scheduleToast(() -> {
|
||||||
Table table = new Table(Tex.button);
|
Table table = new Table(Tex.button);
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
table.remove();
|
table.remove();
|
||||||
lastUnlockLayout = null;
|
lastUnlockLayout = null;
|
||||||
lastUnlockTable = null;
|
lastUnlockTable = null;
|
||||||
@@ -454,7 +454,7 @@ public class HudFragment extends Fragment{
|
|||||||
image.setFillParent(true);
|
image.setFillParent(true);
|
||||||
image.actions(Actions.fadeIn(40f / 60f));
|
image.actions(Actions.fadeIn(40f / 60f));
|
||||||
image.update(() -> {
|
image.update(() -> {
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
image.remove();
|
image.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -469,7 +469,7 @@ public class HudFragment extends Fragment{
|
|||||||
image.actions(Actions.fadeOut(0.8f), Actions.remove());
|
image.actions(Actions.fadeOut(0.8f), Actions.remove());
|
||||||
image.update(() -> {
|
image.update(() -> {
|
||||||
image.toFront();
|
image.toFront();
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
image.remove();
|
image.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import arc.scene.event.*;
|
|||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.core.GameState.*;
|
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.net.*;
|
import mindustry.net.*;
|
||||||
@@ -26,7 +25,7 @@ public class PlayerListFragment extends Fragment{
|
|||||||
parent.fill(cont -> {
|
parent.fill(cont -> {
|
||||||
cont.visible(() -> visible);
|
cont.visible(() -> visible);
|
||||||
cont.update(() -> {
|
cont.update(() -> {
|
||||||
if(!(net.active() && !state.is(State.menu))){
|
if(!(net.active() && state.isGame())){
|
||||||
visible = false;
|
visible = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import arc.util.serialization.*;
|
|||||||
import club.minnced.discord.rpc.*;
|
import club.minnced.discord.rpc.*;
|
||||||
import com.codedisaster.steamworks.*;
|
import com.codedisaster.steamworks.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.core.GameState.*;
|
|
||||||
import mindustry.core.*;
|
import mindustry.core.*;
|
||||||
import mindustry.desktop.steam.*;
|
import mindustry.desktop.steam.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
@@ -248,7 +247,7 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
if(!useDiscord && !steam) return;
|
if(!useDiscord && !steam) return;
|
||||||
|
|
||||||
//common elements they each share
|
//common elements they each share
|
||||||
boolean inGame = !state.is(State.menu);
|
boolean inGame = state.isGame();
|
||||||
String gameMapWithWave = "Unknown Map";
|
String gameMapWithWave = "Unknown Map";
|
||||||
String gameMode = "";
|
String gameMode = "";
|
||||||
String gamePlayersSuffix = "";
|
String gamePlayersSuffix = "";
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
|
|
||||||
handler.register("status", "Display server status.", arg -> {
|
handler.register("status", "Display server status.", arg -> {
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
info("Status: &rserver closed");
|
info("Status: &rserver closed");
|
||||||
}else{
|
}else{
|
||||||
info("Status:");
|
info("Status:");
|
||||||
@@ -777,7 +777,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
|
|
||||||
handler.register("gameover", "Force a game over.", arg -> {
|
handler.register("gameover", "Force a game over.", arg -> {
|
||||||
if(state.is(State.menu)){
|
if(state.isMenu()){
|
||||||
err("Not playing a map.");
|
err("Not playing a map.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ if(!hasProperty("release")){
|
|||||||
use(':Arc:extensions:arcnet')
|
use(':Arc:extensions:arcnet')
|
||||||
use(':Arc:extensions:packer')
|
use(':Arc:extensions:packer')
|
||||||
use(':Arc:extensions:g3d')
|
use(':Arc:extensions:g3d')
|
||||||
|
use(':Arc:extensions:fx')
|
||||||
use(':Arc:backends')
|
use(':Arc:backends')
|
||||||
use(':Arc:backends:backend-sdl')
|
use(':Arc:backends:backend-sdl')
|
||||||
use(':Arc:backends:backend-android')
|
use(':Arc:backends:backend-android')
|
||||||
|
|||||||
Reference in New Issue
Block a user