diff --git a/source/funkin/ui/credits/CreditsData.hx b/source/funkin/ui/credits/CreditsData.hx index 0f6ea6bcd..bf7f13ad5 100644 --- a/source/funkin/ui/credits/CreditsData.hx +++ b/source/funkin/ui/credits/CreditsData.hx @@ -5,7 +5,7 @@ package funkin.ui.credits; */ typedef CreditsData = { - var roles:Array; + var entries:Array; } /** @@ -13,8 +13,16 @@ typedef CreditsData = */ typedef CreditsDataRole = { - var roleName:String; - var members:Array; + @:optional + var header:String; + + @:optional + @:default([]) + var body:Array; + + @:optional + @:default(false) + var appendBackers:Bool; } /** @@ -22,5 +30,5 @@ typedef CreditsDataRole = */ typedef CreditsDataMember = { - var fullName:String; + var line:String; } diff --git a/source/funkin/ui/credits/CreditsDataHandler.hx b/source/funkin/ui/credits/CreditsDataHandler.hx index 6317dd55d..f2722ffbf 100644 --- a/source/funkin/ui/credits/CreditsDataHandler.hx +++ b/source/funkin/ui/credits/CreditsDataHandler.hx @@ -24,14 +24,14 @@ class CreditsDataHandler return; } - var roleCount = data.roles.length; - var memberCount = 0; - for (role in data.roles) + var entryCount = data.entries.length; + var lineCount = 0; + for (entry in data.entries) { - memberCount += role.members.length; + lineCount += entry?.body?.length ?? 0; } - trace('CreditsData($roleCount roles with $memberCount members)'); + trace('CreditsData($entryCount entries containing $lineCount lines)'); } /** @@ -43,15 +43,19 @@ class CreditsDataHandler public static inline function getFallback():CreditsData { return { - roles: [ + entries: [ { - roleName: 'Founders', - members: [ - {fullName: 'ninjamuffin99'}, - {fullName: 'PhantomArcade'}, - {fullName: 'KawaiSprite'}, - {fullName: 'evilsk8r'}, + header: 'Founders', + body: [ + {line: 'ninjamuffin99'}, + {line: 'PhantomArcade'}, + {line: 'KawaiSprite'}, + {line: 'evilsk8r'}, ] + }, + { + header: 'Kickstarter Backers', + appendBackers: true } ] }; diff --git a/source/funkin/ui/credits/CreditsState.hx b/source/funkin/ui/credits/CreditsState.hx index 1e5965695..d43e25114 100644 --- a/source/funkin/ui/credits/CreditsState.hx +++ b/source/funkin/ui/credits/CreditsState.hx @@ -116,17 +116,30 @@ class CreditsState extends MusicBeatState { var y = 0; - for (role in CreditsDataHandler.CREDITS_DATA.roles) + for (entry in CreditsDataHandler.CREDITS_DATA.entries) { - creditsGroup.add(buildCreditsLine(role.roleName, y, true, CreditsSide.Center)); - y += CREDITS_HEADER_FONT_SIZE; - - for (member in role.members) + if (entry.header != null) { - creditsGroup.add(buildCreditsLine(member.fullName, y, false, CreditsSide.Center)); + creditsGroup.add(buildCreditsLine(entry.header, y, true, CreditsSide.Center)); + y += CREDITS_HEADER_FONT_SIZE; + } + + for (line in entry?.body ?? []) + { + creditsGroup.add(buildCreditsLine(line.line, y, false, CreditsSide.Center)); y += CREDITS_FONT_SIZE; } + if (entry.appendBackers) + { + var backers = CreditsDataHandler.fetchBackerEntries(); + for (backer in backers) + { + creditsGroup.add(buildCreditsLine(backer, y, false, CreditsSide.Center)); + y += CREDITS_FONT_SIZE; + } + } + // Padding between each role. y += CREDITS_FONT_SIZE * 2; }