mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Merge pull request #6010 from kevlahnota/master2
update player death transition
This commit is contained in:
@@ -24,6 +24,7 @@ import com.github.tommyettinger.textra.TextraLabel;
|
||||
import com.github.tommyettinger.textra.TypingAdapter;
|
||||
import com.github.tommyettinger.textra.TypingLabel;
|
||||
import forge.Forge;
|
||||
import forge.adventure.character.CharacterSprite;
|
||||
import forge.adventure.character.MapActor;
|
||||
import forge.adventure.character.PlayerSprite;
|
||||
import forge.adventure.data.DialogData;
|
||||
@@ -646,13 +647,20 @@ public abstract class GameStage extends Stage {
|
||||
PointOfInterest poi = Current.world().findPointsOfInterest("Spawn");
|
||||
if (poi != null) {
|
||||
Forge.advFreezePlayerControls = true;
|
||||
showImageDialog(Forge.getLocalizer().getMessage("lblYouDied", Current.player().getName()), null,
|
||||
() -> FThreads.invokeInEdtNowOrLater(() -> Forge.setTransitionScreen(new TransitionScreen(() -> {
|
||||
Forge.advFreezePlayerControls = false;
|
||||
WorldStage.getInstance().setPosition(new Vector2(poi.getPosition().x - 16f, poi.getPosition().y + 16f));
|
||||
WorldStage.getInstance().loadPOI(poi);
|
||||
Forge.clearTransitionScreen();
|
||||
}, null, false, true, false, false))));
|
||||
getPlayerSprite().setAnimation(CharacterSprite.AnimationTypes.Death);
|
||||
getPlayerSprite().playEffect(Paths.EFFECT_BLOOD, 0.5f);
|
||||
Timer.schedule(new Timer.Task() {
|
||||
@Override
|
||||
public void run() {
|
||||
showImageDialog(Forge.getLocalizer().getMessage("lblYouDied", Current.player().getName()), null,
|
||||
() -> FThreads.invokeInEdtNowOrLater(() -> Forge.setTransitionScreen(new TransitionScreen(() -> {
|
||||
Forge.advFreezePlayerControls = false;
|
||||
WorldStage.getInstance().setPosition(new Vector2(poi.getPosition().x - 16f, poi.getPosition().y + 16f));
|
||||
WorldStage.getInstance().loadPOI(poi);
|
||||
Forge.clearTransitionScreen();
|
||||
}, Forge.takeScreenshot(), ""))));
|
||||
}
|
||||
}, 1f);
|
||||
}//Spawn shouldn't be null
|
||||
}
|
||||
|
||||
|
||||
@@ -935,7 +935,7 @@ public class MapStage extends GameStage {
|
||||
|
||||
@Override
|
||||
protected void onActing(float delta) {
|
||||
if (isPaused() || isDialogOnlyInput())
|
||||
if (isPaused() || isDialogOnlyInput() || Forge.advFreezePlayerControls)
|
||||
return;
|
||||
Iterator<EnemySprite> it = enemies.iterator();
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
|
||||
boolean collided = false;
|
||||
@Override
|
||||
protected void onActing(float delta) {
|
||||
if (isPaused() || MapStage.getInstance().isDialogOnlyInput())
|
||||
if (isPaused() || MapStage.getInstance().isDialogOnlyInput() || Forge.advFreezePlayerControls)
|
||||
return;
|
||||
drawNavigationArrow();
|
||||
if (player.isMoving()) {
|
||||
|
||||
@@ -31,13 +31,17 @@ public class TransitionScreen extends FContainer {
|
||||
Texture vsTexture;
|
||||
String enemyAtlasPath, playerAvatarName, enemyAvatarName;
|
||||
private String message = "", playerRecord = "", enemyRecord = "";
|
||||
boolean matchTransition, isloading, isIntro, isFadeMusic, isArenaScene;
|
||||
boolean matchTransition, isloading, isIntro, isFadeMusic, isArenaScene, isAlternate;
|
||||
GlyphLayout layout;
|
||||
|
||||
public TransitionScreen(Runnable proc, TextureRegion screen, boolean enterMatch, boolean loading) {
|
||||
this(proc, screen, enterMatch, loading, false, false);
|
||||
}
|
||||
|
||||
public TransitionScreen(Runnable proc, TextureRegion screen, String message) {//simple for custom transition
|
||||
this(proc, screen, true, false, false, false, false, message, null, "", "", "", "", "");
|
||||
}
|
||||
|
||||
public TransitionScreen(Runnable proc, TextureRegion screen, boolean enterMatch, boolean loading, String loadingMessage) {
|
||||
this(proc, screen, enterMatch, loading, false, false, loadingMessage, null, "", "", "", "", "");
|
||||
}
|
||||
@@ -51,6 +55,9 @@ public class TransitionScreen extends FContainer {
|
||||
}
|
||||
|
||||
public TransitionScreen(Runnable proc, TextureRegion screen, boolean enterMatch, boolean loading, boolean intro, boolean fadeMusic, String loadingMessage, TextureRegion player, String enemyAtlas, String playerName, String enemyName, String playerRecord, String enemyRecord) {
|
||||
this(proc, screen, false, enterMatch, loading, intro, fadeMusic, loadingMessage, player, enemyAtlas, playerName, enemyName, playerRecord, enemyRecord);
|
||||
}
|
||||
public TransitionScreen(Runnable proc, TextureRegion screen, boolean alternate, boolean enterMatch, boolean loading, boolean intro, boolean fadeMusic, String loadingMessage, TextureRegion player, String enemyAtlas, String playerName, String enemyName, String playerRecord, String enemyRecord) {
|
||||
progressBar = new FProgressBar();
|
||||
progressBar.setMaximum(100);
|
||||
progressBar.setPercentMode(true);
|
||||
@@ -62,6 +69,7 @@ public class TransitionScreen extends FContainer {
|
||||
isloading = loading;
|
||||
isIntro = intro;
|
||||
isFadeMusic = fadeMusic;
|
||||
isAlternate = alternate;
|
||||
message = loadingMessage;
|
||||
this.playerRecord = playerRecord;
|
||||
this.enemyRecord = enemyRecord;
|
||||
@@ -99,7 +107,7 @@ public class TransitionScreen extends FContainer {
|
||||
}
|
||||
|
||||
private class BGAnimation extends ForgeAnimation {
|
||||
float DURATION = isArenaScene ? 1.2f : 0.6f;
|
||||
float DURATION = isArenaScene || isAlternate ? 1.2f : 0.6f;
|
||||
private float progress = 0;
|
||||
TextureRegion enemyAvatar;
|
||||
|
||||
@@ -119,7 +127,12 @@ public class TransitionScreen extends FContainer {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (isloading) {
|
||||
if (isAlternate) {
|
||||
g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
|
||||
if (textureRegion != null) {
|
||||
g.drawPortalFade(textureRegion, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight(), Math.min(percentage, 1f), true);
|
||||
}
|
||||
} else if (isloading) {
|
||||
g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
|
||||
FSkinTexture bgTexture = Forge.isMobileAdventureMode ? FSkinTexture.ADV_BG_TEXTURE : FSkinTexture.BG_TEXTURE;
|
||||
if (bgTexture != null) {
|
||||
|
||||
Reference in New Issue
Block a user