Merge pull request #2731 from kevlahnota/newmaster2

fix splashscreen NPE, disable flip sfx
This commit is contained in:
Anthony Calosa
2023-03-23 13:55:53 +08:00
committed by GitHub
4 changed files with 23 additions and 4 deletions

View File

@@ -526,7 +526,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
if (state == CardStateName.FaceDown) {
view.updateHiddenId(game.nextHiddenCardId());
}
game.fireEvent(new GameEventCardStatsChanged(this, true)); //ensure stats updated for new characteristics
game.fireEvent(new GameEventCardStatsChanged(this)); //ensure stats updated for new characteristics
}
}
return true;

View File

@@ -22,7 +22,9 @@ public class GameEventCardStatsChanged extends GameEvent {
public GameEventCardStatsChanged(Card affected, boolean isTransform) {
cards = Arrays.asList(affected);
transform = isTransform;
//the transform should only fire once so the flip effect sound will trigger once every transformation...
// disable for now
transform = false;
}
public GameEventCardStatsChanged(Collection<Card> affected) {

View File

@@ -2,6 +2,7 @@ package forge.adventure.scene;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
@@ -55,6 +56,7 @@ public class ArenaScene extends UIScene implements IAfterMatch {
final Sprite edgeM;
final Sprite edgeWin;
final Sprite edgeWinM;
boolean enable = true;
boolean arenaStarted = false;
private ArenaScene() {
@@ -107,6 +109,8 @@ public class ArenaScene extends UIScene implements IAfterMatch {
}
private void startButton() {
if (!enable)
return;
if (roundsWon == 0) {
Dialog startDialog = prepareDialog(Forge.getLocalizer().getMessage("lblStart"), ButtonYes | ButtonNo, () -> startArena());
startDialog.text("Do you want to go into the Arena?");
@@ -119,6 +123,7 @@ public class ArenaScene extends UIScene implements IAfterMatch {
int roundsWon = 0;
private void startArena() {
enable = false;
goldLabel.setVisible(false);
arenaStarted = true;
startButton.setText("[%80]" + Forge.getLocalizer().getMessage("lblContinue"));
@@ -132,6 +137,7 @@ public class ArenaScene extends UIScene implements IAfterMatch {
@Override
public void setWinner(boolean winner) {
enable = false;
Array<ArenaRecord> winners = new Array<>();
Array<EnemySprite> winnersEnemies = new Array<>();
for (int i = 0; i < fighters.size - 2; i += 2) {
@@ -189,7 +195,15 @@ public class ArenaScene extends UIScene implements IAfterMatch {
}
if (Forge.isLandscapeMode()) {
actor.toFront();
actor.addAction(Actions.sequence(Actions.moveBy(0f, gridSize * 2f, 1), Actions.moveBy((float) (gridSize * stepsToTheSide * (leftPlayer ? 1 : -1)), 0f, 1)));
actor.addAction(Actions.sequence(Actions.moveBy(0f, gridSize * 2f, 1), Actions.moveBy((float) (gridSize * stepsToTheSide * (leftPlayer ? 1 : -1)), 0f, 1), new Action() {
@Override
public boolean act(float v) {
enable = true;
return true;
}
}));
} else {
enable = true;
}
}

View File

@@ -239,7 +239,10 @@ public class SplashScreen extends FContainer {
}
void drawTransition(Graphics g, boolean openAdventure, float percentage) {
TextureRegion tr = new TextureRegion(Forge.getAssets().fallback_skins().get("title"));
Texture t = Forge.getAssets().fallback_skins().get("title");
TextureRegion tr = null;
if (t != null)
tr = new TextureRegion(t);
float oldAlpha = g.getfloatAlphaComposite();
g.setAlphaComposite(percentage);
if (openAdventure) {