weird polish bullshit

This commit is contained in:
Cameron Taylor 2021-04-10 02:53:23 -04:00
parent 8bbeef10a1
commit fd56a32515
4 changed files with 162 additions and 42 deletions

View File

@ -96,8 +96,11 @@ class MainMenuState extends MusicBeatState
// addMenuItem('options', function () startExitState(new OptionMenu()));
#if CAN_OPEN_LINKS
var hasPopupBlocker = #if web true #else false #end;
menuItems.createItem('kickstarter', selectDonate, hasPopupBlocker);
// menuItems.createItem('donate', selectDonate, hasPopupBlocker);
if (VideoState.seenVideo)
menuItems.createItem('kickstarter', selectDonate, hasPopupBlocker);
else
menuItems.createItem('donate', selectDonate, hasPopupBlocker);
#end
menuItems.createItem('options', function() startExitState(new OptionsState()));
// #if newgrounds

View File

@ -915,8 +915,8 @@ class PlayState extends MusicBeatState
switch (curSong.toLowerCase())
{
// REMOVE THIS LATER
case 'stress':
stressIntro();
// case 'stress':
// stressIntro();
default:
startCountdown();
@ -1110,13 +1110,12 @@ class PlayState extends MusicBeatState
add(bfCatchGf);
bfCatchGf.visible = false;
var cutsceneSound:FlxSound = new FlxSound();
if (PreferencesMenu.getPref('censor-naughty'))
cutsceneSound.loadEmbedded(Paths.sound('stressCutscene'));
tankCutscene.startSyncAudio = FlxG.sound.play(Paths.sound('stressCutscene'));
else
{
cutsceneSound.loadEmbedded(Paths.sound('song3censor'));
tankCutscene.startSyncAudio = FlxG.sound.play(Paths.sound('song3censor'));
// cutsceneSound.loadEmbedded(Paths.sound('song3censor'));
var censor:FlxSprite = new FlxSprite();
censor.frames = Paths.getSparrowAtlas('cutsceneStuff/censor');
@ -1173,7 +1172,7 @@ class PlayState extends MusicBeatState
// new FlxTimer().start(0.01, function(tmr) cutsceneSound.play()); // cutsceneSound.play();
// cutsceneSound.play();
tankCutscene.startSyncAudio = cutsceneSound;
// tankCutscene.startSyncAudio = cutsceneSound;
// tankCutscene.animation.curAnim.curFrame
FlxG.camera.zoom = defaultCamZoom * 1.15;
@ -2229,7 +2228,13 @@ class PlayState extends MusicBeatState
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
FlxG.switchState(new StoryMenuState());
switch (PlayState.storyWeek)
{
case 7:
FlxG.switchState(new VideoState());
default:
FlxG.switchState(new StoryMenuState());
}
// if ()
StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;

View File

@ -109,29 +109,35 @@ class TitleState extends MusicBeatState
FlxG.switchState(new FreeplayState());
#elseif CHARTING
FlxG.switchState(new ChartingState());
#elseif web
if (!initialized)
{
video = new Video();
FlxG.stage.addChild(video);
/*
#elseif web
var netConnection = new NetConnection();
netConnection.connect(null);
netStream = new NetStream(netConnection);
netStream.client = {onMetaData: client_onMetaData};
netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netStream_onAsyncError);
netConnection.addEventListener(NetStatusEvent.NET_STATUS, netConnection_onNetStatus);
// netStream.addEventListener(NetStatusEvent.NET_STATUS) // netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
if (!initialized)
{
overlay = new Sprite();
overlay.graphics.beginFill(0, 0.5);
overlay.graphics.drawRect(0, 0, 1280, 720);
overlay.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
video = new Video();
FlxG.stage.addChild(video);
overlay.buttonMode = true;
FlxG.stage.addChild(overlay);
}
var netConnection = new NetConnection();
netConnection.connect(null);
netStream = new NetStream(netConnection);
netStream.client = {onMetaData: client_onMetaData};
netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netStream_onAsyncError);
netConnection.addEventListener(NetStatusEvent.NET_STATUS, netConnection_onNetStatus);
// netStream.addEventListener(NetStatusEvent.NET_STATUS) // netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
overlay = new Sprite();
overlay.graphics.beginFill(0, 0.5);
overlay.graphics.drawRect(0, 0, 1280, 720);
overlay.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
overlay.buttonMode = true;
// FlxG.stage.addChild(overlay);
}
*/
// netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
#else
@ -169,8 +175,8 @@ class TitleState extends MusicBeatState
{
if (event.info.code == 'NetStream.Play.Complete')
{
netStream.dispose();
FlxG.stage.removeChild(video);
// netStream.dispose();
// FlxG.stage.removeChild(video);
startIntro();
}
@ -182,7 +188,7 @@ class TitleState extends MusicBeatState
{
netStream.soundTransform.volume = 0.2;
netStream.soundTransform.pan = -1;
netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
// netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
FlxG.stage.removeChild(overlay);
}
@ -310,6 +316,9 @@ class TitleState extends MusicBeatState
else
initialized = true;
if (FlxG.sound.music != null)
FlxG.sound.music.onComplete = function() FlxG.switchState(new VideoState());
// credGroup.add(credTextShit);
}
@ -382,6 +391,9 @@ class TitleState extends MusicBeatState
if (pressedEnter && !transitioning && skippedIntro)
{
if (FlxG.sound.music != null)
FlxG.sound.music.onComplete = null;
// netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
NGio.unlockMedal(60960);
// If it's Friday according to da clock
@ -427,17 +439,18 @@ class TitleState extends MusicBeatState
{
skipIntro();
}
/*
#if web
if (!initialized && controls.ACCEPT)
{
// netStream.dispose();
// FlxG.stage.removeChild(video);
#if web
if (!initialized && controls.ACCEPT)
{
netStream.dispose();
FlxG.stage.removeChild(video);
startIntro();
skipIntro();
}
#end
startIntro();
skipIntro();
}
#end
*/
// if (FlxG.keys.justPressed.SPACE)
// swagShader.hasOutline = !swagShader.hasOutline;

99
source/VideoState.hx Normal file
View File

@ -0,0 +1,99 @@
package;
import flixel.FlxG;
import openfl.display.Sprite;
import openfl.events.AsyncErrorEvent;
import openfl.events.MouseEvent;
import openfl.events.NetStatusEvent;
import openfl.media.Video;
import openfl.net.NetConnection;
import openfl.net.NetStream;
class VideoState extends MusicBeatState
{
var video:Video;
var netStream:NetStream;
private var overlay:Sprite;
public static var seenVideo:Bool = false;
override function create()
{
super.create();
seenVideo = true;
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
video = new Video();
FlxG.addChildBelowMouse(video);
var netConnection = new NetConnection();
netConnection.connect(null);
netStream = new NetStream(netConnection);
netStream.client = {onMetaData: client_onMetaData};
netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, netStream_onAsyncError);
netConnection.addEventListener(NetStatusEvent.NET_STATUS, netConnection_onNetStatus);
// netStream.addEventListener(NetStatusEvent.NET_STATUS);
netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
overlay = new Sprite();
overlay.graphics.beginFill(0, 0.5);
overlay.graphics.drawRect(0, 0, 1280, 720);
overlay.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
overlay.buttonMode = true;
// FlxG.stage.addChild(overlay);
}
override function update(elapsed:Float)
{
if (controls.ACCEPT)
finishVid();
super.update(elapsed);
}
function finishVid():Void
{
netStream.dispose();
FlxG.removeChild(video);
FlxG.switchState(new TitleState());
}
private function client_onMetaData(metaData:Dynamic)
{
video.attachNetStream(netStream);
video.width = video.videoWidth;
video.height = video.videoHeight;
// video.
}
private function netStream_onAsyncError(event:AsyncErrorEvent):Void
{
trace("Error loading video");
}
private function netConnection_onNetStatus(event:NetStatusEvent):Void
{
if (event.info.code == 'NetStream.Play.Complete')
{
finishVid();
}
trace(event.toString());
}
private function overlay_onMouseDown(event:MouseEvent):Void
{
netStream.soundTransform.volume = 0.2;
netStream.soundTransform.pan = -1;
// netStream.play(Paths.file('music/kickstarterTrailer.mp4'));
FlxG.stage.removeChild(overlay);
}
}