mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
substate loading type beat
This commit is contained in:
parent
41e6a270f0
commit
1a5b68acd8
3 changed files with 71 additions and 7 deletions
|
@ -1512,7 +1512,7 @@ class PlayState extends MusicBeatState
|
|||
else
|
||||
{
|
||||
var boyfriendPos = currentStage.getBoyfriend().getScreenPosition();
|
||||
var pauseSubState = new PauseSubState(boyfriendPos.x, boyfriendPos.y);
|
||||
var pauseSubState = new PauseSubState();
|
||||
openSubState(pauseSubState);
|
||||
pauseSubState.camera = camHUD;
|
||||
boyfriendPos.put();
|
||||
|
|
|
@ -2,6 +2,7 @@ package funkin.ui;
|
|||
|
||||
import flixel.FlxSprite;
|
||||
import haxe.Json;
|
||||
import lime.utils.Assets;
|
||||
|
||||
class StickerSubState extends MusicBeatSubstate
|
||||
{
|
||||
|
@ -9,10 +10,14 @@ class StickerSubState extends MusicBeatSubstate
|
|||
{
|
||||
super();
|
||||
|
||||
var stickerInfo:StickerInfo = new StickerInfo('sticker-set-1');
|
||||
var stickerInfo:StickerInfo = new StickerInfo('stickers-set-1');
|
||||
for (stickerSets in stickerInfo.getPack("all"))
|
||||
{
|
||||
trace(stickerSets);
|
||||
for (stickerShit in stickerInfo.getStickers(stickerSets))
|
||||
{
|
||||
var sticky:StickerSprite = new StickerSprite(FlxG.random.int(0, FlxG.width), FlxG.random.int(0, FlxG.height), stickerInfo.name, stickerShit);
|
||||
add(sticky);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +26,7 @@ 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'));
|
||||
super(x, y, Paths.image('transitionSwag/' + stickerSet + '/' + stickerName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,12 +39,64 @@ class StickerInfo
|
|||
|
||||
public function new(stickerSet:String):Void
|
||||
{
|
||||
var jsonInfo:StickerShit = cast Json.parse(Paths.file('assets/images/transitionSwag/' + stickerSet + '/stickers.json'));
|
||||
var path = Paths.file('images/transitionSwag/' + stickerSet + '/stickers.json');
|
||||
var json = Json.parse(Assets.getText(path));
|
||||
trace(json);
|
||||
|
||||
// doin this dipshit nonsense cuz i dunno how to deal with casting a json object with
|
||||
// a dash in its name (sticker-packs)
|
||||
var jsonInfo:StickerShit = cast json;
|
||||
|
||||
this.name = jsonInfo.name;
|
||||
this.artist = jsonInfo.artist;
|
||||
this.stickers = jsonInfo.stickers;
|
||||
this.stickerPacks = jsonInfo.stickerPacks;
|
||||
|
||||
stickerPacks = new Map<String, Array<String>>();
|
||||
|
||||
for (field in Reflect.fields(json.stickerPacks))
|
||||
{
|
||||
var stickerFunny = json.stickerPacks;
|
||||
var stickerStuff = Reflect.field(stickerFunny, field);
|
||||
|
||||
stickerPacks.set(field, cast stickerStuff);
|
||||
|
||||
trace(field);
|
||||
trace(Reflect.field(stickerFunny, field));
|
||||
}
|
||||
|
||||
trace(stickerPacks);
|
||||
|
||||
// creates a similar for loop as before but for the stickers
|
||||
stickers = new Map<String, Array<String>>();
|
||||
|
||||
for (field in Reflect.fields(json.stickers))
|
||||
{
|
||||
var stickerFunny = json.stickers;
|
||||
var stickerStuff = Reflect.field(stickerFunny, field);
|
||||
|
||||
stickers.set(field, cast stickerStuff);
|
||||
|
||||
trace(field);
|
||||
trace(Reflect.field(stickerFunny, field));
|
||||
}
|
||||
|
||||
trace(stickers);
|
||||
|
||||
// this.stickerPacks = cast jsonInfo.stickerPacks;
|
||||
// this.stickers = cast jsonInfo.stickers;
|
||||
|
||||
// trace(stickerPacks);
|
||||
// trace(stickers);
|
||||
|
||||
// for (packs in stickers)
|
||||
// {
|
||||
// // this.stickers.set(packs, Reflect.field(json, "sticker-packs"));
|
||||
// trace(packs);
|
||||
// }
|
||||
}
|
||||
|
||||
public function getStickers(stickerName:String):Array<String>
|
||||
{
|
||||
return this.stickers[stickerName];
|
||||
}
|
||||
|
||||
public function getPack(packName:String):Array<String>
|
||||
|
|
|
@ -46,6 +46,7 @@ class DebugMenuSubState extends MusicBeatSubstate
|
|||
onMenuChange(createItem("CHART EDITOR", openChartEditor));
|
||||
createItem("ANIMATION EDITOR", openAnimationEditor);
|
||||
createItem("STAGE EDITOR", openStageEditor);
|
||||
createItem("TEST STICKERS", testStickers);
|
||||
}
|
||||
|
||||
function onMenuChange(selected:TextMenuItem)
|
||||
|
@ -83,6 +84,12 @@ class DebugMenuSubState extends MusicBeatSubstate
|
|||
trace('Animation Editor');
|
||||
}
|
||||
|
||||
function testStickers()
|
||||
{
|
||||
openSubState(new funkin.ui.StickerSubState());
|
||||
trace('opened stickers');
|
||||
}
|
||||
|
||||
function openStageEditor()
|
||||
{
|
||||
trace('Stage Editor');
|
||||
|
|
Loading…
Reference in a new issue