mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-12-12 17:21:09 -05:00
218 lines
5.9 KiB
Haxe
218 lines
5.9 KiB
Haxe
|
package funkin.ui.freeplay.backcards;
|
||
|
|
||
|
import funkin.ui.freeplay.FreeplayState;
|
||
|
import flixel.FlxCamera;
|
||
|
import flixel.FlxSprite;
|
||
|
import flixel.group.FlxGroup;
|
||
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||
|
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
|
||
|
import flixel.math.FlxAngle;
|
||
|
import flixel.math.FlxPoint;
|
||
|
import flixel.text.FlxText;
|
||
|
import flixel.tweens.FlxEase;
|
||
|
import flixel.tweens.FlxTween;
|
||
|
import flixel.util.FlxColor;
|
||
|
import flixel.util.FlxSpriteUtil;
|
||
|
import flixel.util.FlxTimer;
|
||
|
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
||
|
import funkin.graphics.FunkinSprite;
|
||
|
import funkin.ui.freeplay.charselect.PlayableCharacter;
|
||
|
import funkin.ui.MusicBeatSubState;
|
||
|
import lime.utils.Assets;
|
||
|
import openfl.display.BlendMode;
|
||
|
import flixel.group.FlxSpriteGroup;
|
||
|
|
||
|
/**
|
||
|
* A class for the backing cards so they dont have to be part of freeplayState......
|
||
|
*/
|
||
|
class BackingCard extends FlxSpriteGroup
|
||
|
{
|
||
|
public var backingTextYeah:FlxAtlasSprite;
|
||
|
public var orangeBackShit:FunkinSprite;
|
||
|
public var alsoOrangeLOL:FunkinSprite;
|
||
|
public var pinkBack:FunkinSprite;
|
||
|
public var confirmGlow:FlxSprite;
|
||
|
public var confirmGlow2:FlxSprite;
|
||
|
public var confirmTextGlow:FlxSprite;
|
||
|
public var cardGlow:FlxSprite;
|
||
|
|
||
|
var _exitMovers:Null<FreeplayState.ExitMoverData>;
|
||
|
var _exitMoversCharSel:Null<FreeplayState.ExitMoverData>;
|
||
|
|
||
|
public function new(currentCharacter:PlayableCharacter)
|
||
|
{
|
||
|
super();
|
||
|
|
||
|
cardGlow = new FlxSprite(-30, -30).loadGraphic(Paths.image('freeplay/cardGlow'));
|
||
|
confirmGlow = new FlxSprite(-30, 240).loadGraphic(Paths.image('freeplay/confirmGlow'));
|
||
|
confirmTextGlow = new FlxSprite(-8, 115).loadGraphic(Paths.image('freeplay/glowingText'));
|
||
|
pinkBack = FunkinSprite.create('freeplay/pinkBack');
|
||
|
orangeBackShit = new FunkinSprite(84, 440).makeSolidColor(Std.int(pinkBack.width), 75, 0xFFFEDA00);
|
||
|
alsoOrangeLOL = new FunkinSprite(0, orangeBackShit.y).makeSolidColor(100, Std.int(orangeBackShit.height), 0xFFFFD400);
|
||
|
confirmGlow2 = new FlxSprite(confirmGlow.x, confirmGlow.y).loadGraphic(Paths.image('freeplay/confirmGlow2'));
|
||
|
backingTextYeah = new FlxAtlasSprite(640, 370, Paths.animateAtlas("freeplay/backing-text-yeah"),
|
||
|
{
|
||
|
FrameRate: 24.0,
|
||
|
Reversed: false,
|
||
|
// ?OnComplete:Void -> Void,
|
||
|
ShowPivot: false,
|
||
|
Antialiasing: true,
|
||
|
ScrollFactor: new FlxPoint(1, 1),
|
||
|
});
|
||
|
|
||
|
pinkBack.color = 0xFFFFD4E9; // sets it to pink!
|
||
|
pinkBack.x -= pinkBack.width;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Apply exit movers for the pieces of the backing card.
|
||
|
* @param exitMovers The exit movers to apply.
|
||
|
*/
|
||
|
public function applyExitMovers(?exitMovers:FreeplayState.ExitMoverData, ?exitMoversCharSel:FreeplayState.ExitMoverData):Void
|
||
|
{
|
||
|
if (exitMovers == null)
|
||
|
{
|
||
|
exitMovers = _exitMovers;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_exitMovers = exitMovers;
|
||
|
}
|
||
|
|
||
|
if (exitMovers == null) return;
|
||
|
|
||
|
if (exitMoversCharSel == null)
|
||
|
{
|
||
|
exitMoversCharSel = _exitMoversCharSel;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_exitMoversCharSel = exitMoversCharSel;
|
||
|
}
|
||
|
|
||
|
if (exitMoversCharSel == null) return;
|
||
|
|
||
|
exitMovers.set([pinkBack, orangeBackShit, alsoOrangeLOL],
|
||
|
{
|
||
|
x: -pinkBack.width,
|
||
|
y: pinkBack.y,
|
||
|
speed: 0.4,
|
||
|
wait: 0
|
||
|
});
|
||
|
|
||
|
exitMoversCharSel.set([pinkBack],
|
||
|
{
|
||
|
y: -100,
|
||
|
speed: 0.8,
|
||
|
wait: 0.1
|
||
|
});
|
||
|
|
||
|
exitMoversCharSel.set([orangeBackShit, alsoOrangeLOL],
|
||
|
{
|
||
|
y: -40,
|
||
|
speed: 0.8,
|
||
|
wait: 0.1
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Called in create. Adds sprites and tweens.
|
||
|
*/
|
||
|
public function init():Void
|
||
|
{
|
||
|
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
|
||
|
add(pinkBack);
|
||
|
|
||
|
add(orangeBackShit);
|
||
|
|
||
|
add(alsoOrangeLOL);
|
||
|
|
||
|
FlxSpriteUtil.alphaMaskFlxSprite(orangeBackShit, pinkBack, orangeBackShit);
|
||
|
orangeBackShit.visible = false;
|
||
|
alsoOrangeLOL.visible = false;
|
||
|
|
||
|
confirmTextGlow.blend = BlendMode.ADD;
|
||
|
confirmTextGlow.visible = false;
|
||
|
|
||
|
confirmGlow.blend = BlendMode.ADD;
|
||
|
|
||
|
confirmGlow.visible = false;
|
||
|
confirmGlow2.visible = false;
|
||
|
|
||
|
add(confirmGlow2);
|
||
|
add(confirmGlow);
|
||
|
|
||
|
add(confirmTextGlow);
|
||
|
|
||
|
add(backingTextYeah);
|
||
|
|
||
|
cardGlow.blend = BlendMode.ADD;
|
||
|
cardGlow.visible = false;
|
||
|
|
||
|
add(cardGlow);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Override parts of Freeplay depending on the card class.
|
||
|
*/
|
||
|
public function applyStyle(_freeplayState:FreeplayState):Void {}
|
||
|
|
||
|
/**
|
||
|
* Called after the dj finishes their start animation.
|
||
|
*/
|
||
|
public function introDone():Void
|
||
|
{
|
||
|
pinkBack.color = 0xFFFFD863;
|
||
|
orangeBackShit.visible = true;
|
||
|
alsoOrangeLOL.visible = true;
|
||
|
cardGlow.visible = true;
|
||
|
FlxTween.tween(cardGlow, {alpha: 0, "scale.x": 1.2, "scale.y": 1.2}, 0.45, {ease: FlxEase.sineOut});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Called when selecting a song.
|
||
|
*/
|
||
|
public function confirm():Void
|
||
|
{
|
||
|
FlxTween.color(pinkBack, 0.33, 0xFFFFD0D5, 0xFF171831, {ease: FlxEase.quadOut});
|
||
|
orangeBackShit.visible = false;
|
||
|
alsoOrangeLOL.visible = false;
|
||
|
|
||
|
confirmGlow.visible = true;
|
||
|
confirmGlow2.visible = true;
|
||
|
|
||
|
backingTextYeah.playAnimation("BF back card confirm raw", false, false, false, 0);
|
||
|
confirmGlow2.alpha = 0;
|
||
|
confirmGlow.alpha = 0;
|
||
|
|
||
|
FlxTween.tween(confirmGlow2, {alpha: 0.5}, 0.33,
|
||
|
{
|
||
|
ease: FlxEase.quadOut,
|
||
|
onComplete: function(_) {
|
||
|
confirmGlow2.alpha = 0.6;
|
||
|
confirmGlow.alpha = 1;
|
||
|
confirmTextGlow.visible = true;
|
||
|
confirmTextGlow.alpha = 1;
|
||
|
FlxTween.tween(confirmTextGlow, {alpha: 0.4}, 0.5);
|
||
|
FlxTween.tween(confirmGlow, {alpha: 0}, 0.5);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Called when exiting the freeplay menu
|
||
|
*/
|
||
|
public function disappear():Void
|
||
|
{
|
||
|
FlxTween.color(pinkBack, 0.25, 0xFFFFD863, 0xFFFFD0D5, {ease: FlxEase.quadOut});
|
||
|
|
||
|
cardGlow.visible = true;
|
||
|
cardGlow.alpha = 1;
|
||
|
cardGlow.scale.set(1, 1);
|
||
|
FlxTween.tween(cardGlow, {alpha: 0, "scale.x": 1.2, "scale.y": 1.2}, 0.25, {ease: FlxEase.sineOut});
|
||
|
|
||
|
orangeBackShit.visible = false;
|
||
|
alsoOrangeLOL.visible = false;
|
||
|
}
|
||
|
}
|