Move gameover ads loading to gameover state.

This commit is contained in:
MAJigsaw77
2025-06-07 16:38:38 +03:00
parent 537c7cb5a1
commit 814c563c55
2 changed files with 22 additions and 29 deletions
+22
View File
@@ -22,6 +22,9 @@ import funkin.effects.RetroCameraFade;
import flixel.math.FlxPoint;
import funkin.util.TouchUtil;
import openfl.utils.Assets;
#if FEATURE_MOBILE_ADVERTISEMENTS
import funkin.mobile.util.AdMobUtil;
#end
/**
* A substate which renders over the PlayState when the player dies.
@@ -408,13 +411,32 @@ class GameOverSubState extends MusicBeatSubState
RetroCameraFade.fadeToBlack(FlxG.camera, 10, 2);
new FlxTimer().start(2, _ -> {
FlxG.camera.filters = [];
#if FEATURE_MOBILE_ADVERTISEMENTS
if (Constants.GLOBAL_BLUEBALL_COUNTER > 0 && Constants.GLOBAL_BLUEBALL_COUNTER % 3 == 0)
{
AdMobUtil.loadInterstitial(resetPlaying.bind(true));
}
else
resetPlaying(true);
#else
resetPlaying(true);
#end
});
}
else
{
FlxG.camera.fade(FlxColor.BLACK, 2, false, function() {
#if FEATURE_MOBILE_ADVERTISEMENTS
if (Constants.GLOBAL_BLUEBALL_COUNTER > 0 && Constants.GLOBAL_BLUEBALL_COUNTER % 3 == 0)
{
AdMobUtil.loadInterstitial(resetPlaying.bind());
}
else
resetPlaying();
#else
resetPlaying();
#end
});
}
});
-29
View File
@@ -1250,34 +1250,6 @@ class PlayState extends MusicBeatSubState
if (iconP2 != null) iconP2.updatePosition();
}
#if FEATURE_MOBILE_ADVERTISEMENTS
if (Constants.GLOBAL_BLUEBALL_COUNTER > 0 && Constants.GLOBAL_BLUEBALL_COUNTER % 3 == 0)
{
AdMobUtil.loadInterstitial(function():Void {
// Transition to the game over substate.
var gameOverSubState = new GameOverSubState(
{
isChartingMode: isChartingMode,
transparent: persistentDraw
});
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
openSubState(gameOverSubState);
});
}
else
{
// Transition to the game over substate.
var gameOverSubState = new GameOverSubState(
{
isChartingMode: isChartingMode,
transparent: persistentDraw
});
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
openSubState(gameOverSubState);
}
#else
// Transition to the game over substate.
var gameOverSubState = new GameOverSubState(
{
@@ -1287,7 +1259,6 @@ class PlayState extends MusicBeatSubState
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
openSubState(gameOverSubState);
#end
}
function processSongEvents():Void