Cleanup
This commit is contained in:
@@ -41,7 +41,7 @@ public class ItemsDisplay extends Table{
|
||||
}).get().setScrollingDisabled(true, false), false).setDuration(0.3f);
|
||||
|
||||
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());
|
||||
((Image)t.getChildren().get(1)).setDrawable(col.isCollapsed() ? Icon.upOpen : Icon.downOpen);
|
||||
}).padBottom(4).left().fillX().margin(12f).minWidth(200f);
|
||||
@@ -53,7 +53,7 @@ public class ItemsDisplay extends Table{
|
||||
private String format(Item item){
|
||||
builder.setLength(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(ui.formatAmount(state.teams.get(player.team()).core().items().get(item)));
|
||||
}
|
||||
|
||||
@@ -91,6 +91,6 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
hidden(() -> {
|
||||
if(shouldPause && !state.is(State.menu)){
|
||||
if(shouldPause && state.isGame()){
|
||||
if(!wasPaused || net.active()){
|
||||
state.set(State.playing);
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class FloatingDialog extends Dialog{
|
||||
});
|
||||
|
||||
shown(() -> {
|
||||
if(shouldPause && !state.is(State.menu)){
|
||||
if(shouldPause && state.isGame()){
|
||||
wasPaused = state.is(State.paused);
|
||||
state.set(State.paused);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
cont.clear();
|
||||
|
||||
update(() -> {
|
||||
if(state.is(State.menu) && isShown()){
|
||||
if(state.isMenu() && isShown()){
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ public class SaveDialog extends LoadDialog{
|
||||
super("$savegame");
|
||||
|
||||
update(() -> {
|
||||
if(state.is(State.menu) && isShown()){
|
||||
if(state.isMenu() && isShown()){
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
})).size(200f);
|
||||
}, () -> {
|
||||
if(sel[0].childrenPressed()) return;
|
||||
if(state.is(State.menu)){
|
||||
if(state.isMenu()){
|
||||
showInfo(s);
|
||||
}else{
|
||||
control.input.useSchematic(s);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
public SettingsMenuDialog(){
|
||||
hidden(() -> {
|
||||
Sounds.back.play();
|
||||
if(!state.is(State.menu)){
|
||||
if(state.isGame()){
|
||||
if(!wasPaused || net.active())
|
||||
state.set(State.playing);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
shown(() -> {
|
||||
back();
|
||||
if(!state.is(State.menu)){
|
||||
if(state.isGame()){
|
||||
wasPaused = state.is(State.paused);
|
||||
state.set(State.paused);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
@Override
|
||||
public void act(float delta){
|
||||
super.act(delta);
|
||||
if(state.is(State.menu)){
|
||||
if(state.isMenu()){
|
||||
table.visible(false);
|
||||
configTile = null;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
table.touchable(Touchable.enabled);
|
||||
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();
|
||||
}else{
|
||||
if(holding && lastItem != null){
|
||||
|
||||
@@ -229,7 +229,7 @@ public class HudFragment extends Fragment{
|
||||
});
|
||||
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ public class HudFragment extends Fragment{
|
||||
.style(Styles.outlineLabel)).padTop(10).visible(p.color.a >= 0.001f);
|
||||
p.update(() -> {
|
||||
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;
|
||||
showHudText = false;
|
||||
}
|
||||
@@ -328,14 +328,14 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
|
||||
public void showToast(String text){
|
||||
if(state.is(State.menu)) return;
|
||||
if(state.isMenu()) return;
|
||||
|
||||
scheduleToast(() -> {
|
||||
Sounds.message.play();
|
||||
|
||||
Table table = new Table(Tex.button);
|
||||
table.update(() -> {
|
||||
if(state.is(State.menu)){
|
||||
if(state.isMenu()){
|
||||
table.remove();
|
||||
}
|
||||
});
|
||||
@@ -362,7 +362,7 @@ public class HudFragment extends Fragment{
|
||||
public void showUnlock(UnlockableContent content){
|
||||
//some content may not have icons... yet
|
||||
//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();
|
||||
|
||||
@@ -371,7 +371,7 @@ public class HudFragment extends Fragment{
|
||||
scheduleToast(() -> {
|
||||
Table table = new Table(Tex.button);
|
||||
table.update(() -> {
|
||||
if(state.is(State.menu)){
|
||||
if(state.isMenu()){
|
||||
table.remove();
|
||||
lastUnlockLayout = null;
|
||||
lastUnlockTable = null;
|
||||
@@ -454,7 +454,7 @@ public class HudFragment extends Fragment{
|
||||
image.setFillParent(true);
|
||||
image.actions(Actions.fadeIn(40f / 60f));
|
||||
image.update(() -> {
|
||||
if(state.is(State.menu)){
|
||||
if(state.isMenu()){
|
||||
image.remove();
|
||||
}
|
||||
});
|
||||
@@ -469,7 +469,7 @@ public class HudFragment extends Fragment{
|
||||
image.actions(Actions.fadeOut(0.8f), Actions.remove());
|
||||
image.update(() -> {
|
||||
image.toFront();
|
||||
if(state.is(State.menu)){
|
||||
if(state.isMenu()){
|
||||
image.remove();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,7 +7,6 @@ import arc.scene.event.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.net.*;
|
||||
@@ -26,7 +25,7 @@ public class PlayerListFragment extends Fragment{
|
||||
parent.fill(cont -> {
|
||||
cont.visible(() -> visible);
|
||||
cont.update(() -> {
|
||||
if(!(net.active() && !state.is(State.menu))){
|
||||
if(!(net.active() && state.isGame())){
|
||||
visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user