Files
FNF-i486-Engine/source/FlashingState.hx
ShadowMario e5b570dd76 Experimental changes
- Rewrote transition data
NOTE: Use MusicBeatState instead of FlxG for resetState and switchState functions or the transition won't work

- Added a new Performance option that needs further testing (Persistent Cached Data)
- Fixed Chart Editor dumb ass crash from a last minute change
- Fixed other minor bugs
2021-08-03 03:00:27 -03:00

68 lines
1.8 KiB
Haxe

package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxSubState;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.effects.FlxFlicker;
import lime.app.Application;
import flixel.addons.transition.FlxTransitionableState;
import flixel.tweens.FlxTween;
import flixel.util.FlxTimer;
class FlashingState extends MusicBeatState
{
public static var leftState:Bool = false;
var warnText:FlxText;
override function create()
{
super.create();
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
add(bg);
warnText = new FlxText(0, 0, FlxG.width,
"Hey, watch out!\n
This Mod contains some flashing lights!\n
Press ENTER to disable them now or go to Options Menu.\n
Press ESCAPE to ignore this message.\n
You've been warned!",
32);
warnText.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, CENTER);
warnText.screenCenter(Y);
add(warnText);
}
override function update(elapsed:Float)
{
if(!leftState) {
var back:Bool = controls.BACK;
if (controls.ACCEPT || back) {
leftState = true;
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
if(!back) {
ClientPrefs.flashing = false;
ClientPrefs.saveSettings();
FlxG.sound.play(Paths.sound('confirmMenu'));
FlxFlicker.flicker(warnText, 1, 0.1, false, true, function(flk:FlxFlicker) {
new FlxTimer().start(0.5, function (tmr:FlxTimer) {
MusicBeatState.switchState(new TitleState());
});
});
} else {
FlxG.sound.play(Paths.sound('cancelMenu'));
FlxTween.tween(warnText, {alpha: 0}, 1, {
onComplete: function (twn:FlxTween) {
MusicBeatState.switchState(new TitleState());
}
});
}
}
}
super.update(elapsed);
}
}