Fixed sector gameover ghost bug
This commit is contained in:
@@ -35,7 +35,7 @@ dependencies{
|
|||||||
natives "com.github.Anuken.Arc:natives-box2d-android:${getArcHash()}"
|
natives "com.github.Anuken.Arc:natives-box2d-android:${getArcHash()}"
|
||||||
|
|
||||||
//android dependencies magically disappear during compilation, thanks gradle!
|
//android dependencies magically disappear during compilation, thanks gradle!
|
||||||
def sdkFile = new File((String)System.getenv("ANDROID_HOME"), "/platforms/android-29/android.jar")
|
def sdkFile = new File((String)findSdkDir(), "/platforms/android-29/android.jar")
|
||||||
if(sdkFile.exists()) compileOnly files(sdkFile.absolutePath)
|
if(sdkFile.exists()) compileOnly files(sdkFile.absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
build.gradle
11
build.gradle
@@ -99,6 +99,17 @@ allprojects{
|
|||||||
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
|
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findSdkDir = {
|
||||||
|
//null because IntelliJ doesn't get env variables
|
||||||
|
def v = System.getenv("ANDROID_HOME")
|
||||||
|
if(v != null) return v
|
||||||
|
//rootDir is null here, amazing. brilliant.
|
||||||
|
def file = new File("local.properties")
|
||||||
|
if(!file.exists()) file = new File("../local.properties")
|
||||||
|
def props = new Properties().with{p -> p.load(file.newReader()); return p }
|
||||||
|
return props.get("sdk.dir")
|
||||||
|
}
|
||||||
|
|
||||||
generateLocales = {
|
generateLocales = {
|
||||||
def output = 'en\n'
|
def output = 'en\n'
|
||||||
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
def bundles = new File(project(':core').projectDir, 'assets/bundles/')
|
||||||
|
|||||||
@@ -549,6 +549,7 @@ sectors.nonelaunch = [lightgray]none (sun)
|
|||||||
sectors.rename = Rename Sector
|
sectors.rename = Rename Sector
|
||||||
|
|
||||||
sector.curcapture = Sector Captured
|
sector.curcapture = Sector Captured
|
||||||
|
sector.curlost = Sector Lost
|
||||||
sector.missingresources = [scarlet]Insufficient Core Resources
|
sector.missingresources = [scarlet]Insufficient Core Resources
|
||||||
sector.attacked = Sector [accent]{0}[white] under attack!
|
sector.attacked = Sector [accent]{0}[white] under attack!
|
||||||
sector.lost = Sector [accent]{0}[white] lost!
|
sector.lost = Sector [accent]{0}[white] lost!
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class GameState{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPaused(){
|
public boolean isPaused(){
|
||||||
return (is(State.paused) && !net.active()) || (gameOver && !net.active()) || (serverPaused && !isMenu());
|
return (is(State.paused) && !net.active()) || (gameOver && (!net.active() || isCampaign())) || (serverPaused && !isMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlaying(){
|
public boolean isPlaying(){
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class Sector{
|
|||||||
|
|
||||||
/** @return whether the player has a base here. */
|
/** @return whether the player has a base here. */
|
||||||
public boolean hasBase(){
|
public boolean hasBase(){
|
||||||
return save != null && info.hasCore;
|
return save != null && info.hasCore && !(Vars.state.isGame() && Vars.state.rules.sector == this && state.gameOver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return whether the enemy has a generated base here. */
|
/** @return whether the enemy has a generated base here. */
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ public class GameOverDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rebuild(){
|
void rebuild(){
|
||||||
title.setText("@gameover");
|
title.setText(state.isCampaign() ? "@sector.curlost" : "@gameover");
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
cont.clear();
|
cont.clear();
|
||||||
|
|
||||||
buttons.margin(10);
|
buttons.margin(10);
|
||||||
|
|
||||||
if(state.rules.pvp){
|
if(state.rules.pvp && winner != null){
|
||||||
cont.add(Core.bundle.format("gameover.pvp", winner.localized())).pad(6);
|
cont.add(Core.bundle.format("gameover.pvp", winner.localized())).pad(6);
|
||||||
buttons.button("@menu", () -> {
|
buttons.button("@menu", () -> {
|
||||||
hide();
|
hide();
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Sector findLauncher(Sector to){
|
Sector findLauncher(Sector to){
|
||||||
|
Sector launchSector = this.launchSector != null && this.launchSector.hasBase() ? this.launchSector : null;
|
||||||
//directly nearby.
|
//directly nearby.
|
||||||
if(to.near().contains(launchSector)) return launchSector;
|
if(to.near().contains(launchSector)) return launchSector;
|
||||||
|
|
||||||
@@ -711,7 +712,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
|
|
||||||
if((sector.hasBase() && mode == look) || canSelect(sector) || (sector.preset != null && sector.preset.alwaysUnlocked) || debugSelect){
|
if((sector.hasBase() && mode == look) || canSelect(sector) || (sector.preset != null && sector.preset.alwaysUnlocked) || debugSelect){
|
||||||
stable.button(mode == select ? "@sectors.select" : sector.hasBase() ? "@sectors.resume" : "@sectors.launch", Icon.play, () -> {
|
stable.button(mode == select ? "@sectors.select" : sector.hasBase() ? "@sectors.resume" : "@sectors.launch", Icon.play, () -> {
|
||||||
if(state.rules.sector == sector && !state.isMenu()){
|
if(sector.isBeingPlayed()){
|
||||||
//already at this sector
|
//already at this sector
|
||||||
hide();
|
hide();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class HudFragment extends Fragment{
|
|||||||
parent.fill(t -> {
|
parent.fill(t -> {
|
||||||
t.name = "paused";
|
t.name = "paused";
|
||||||
t.top().visible(() -> state.isPaused() && shown).touchable = Touchable.disabled;
|
t.top().visible(() -> state.isPaused() && shown).touchable = Touchable.disabled;
|
||||||
t.table(Styles.black5, top -> top.add("@paused").style(Styles.outlineLabel).pad(8f)).growX();
|
t.table(Styles.black5, top -> top.label(() -> state.gameOver && state.isCampaign() ? "@sector.curlost" : "@paused").style(Styles.outlineLabel).pad(8f)).growX();
|
||||||
});
|
});
|
||||||
|
|
||||||
//minimap + position
|
//minimap + position
|
||||||
|
|||||||
Reference in New Issue
Block a user