Funkin/source/funkin/ui/StickerSubState.hx

59 lines
1.3 KiB
Haxe
Raw Normal View History

2023-04-04 22:24:00 -04:00
package funkin.ui;
2023-04-04 22:38:45 -04:00
import flixel.FlxSprite;
2023-04-04 22:24:00 -04:00
import haxe.Json;
class StickerSubState extends MusicBeatSubstate
{
public function new():Void
{
super();
var stickerInfo:StickerInfo = new StickerInfo('sticker-set-1');
2023-04-04 22:38:45 -04:00
for (stickerSets in stickerInfo.getPack("all"))
{
trace(stickerSets);
}
}
}
class StickerSprite extends FlxSprite
{
public function new(x:Float, y:Float, stickerSet:String, stickerName:String):Void
{
super(x, y, Paths.file('assets/images/transitionSwag/' + stickerSet + '/' + stickerName + '.png'));
2023-04-04 22:24:00 -04:00
}
}
class StickerInfo
{
public var name:String;
public var artist:String;
2023-04-04 22:38:45 -04:00
public var stickers:Map<String, Array<String>>;
public var stickerPacks:Map<String, Array<String>>;
2023-04-04 22:24:00 -04:00
public function new(stickerSet:String):Void
{
2023-04-04 22:38:45 -04:00
var jsonInfo:StickerShit = cast Json.parse(Paths.file('assets/images/transitionSwag/' + stickerSet + '/stickers.json'));
this.name = jsonInfo.name;
this.artist = jsonInfo.artist;
this.stickers = jsonInfo.stickers;
this.stickerPacks = jsonInfo.stickerPacks;
2023-04-04 22:24:00 -04:00
}
2023-04-04 22:38:45 -04:00
public function getPack(packName:String):Array<String>
{
return this.stickerPacks[packName];
}
2023-04-04 22:24:00 -04:00
}
2023-04-04 22:38:45 -04:00
// somethin damn cute just for the json to cast to!
typedef StickerShit =
2023-04-04 22:24:00 -04:00
{
2023-04-04 22:38:45 -04:00
name:String,
artist:String,
stickers:Map<String, Array<String>>,
stickerPacks:Map<String, Array<String>>
2023-04-04 22:24:00 -04:00
}