Update CreditsMain.hx (#370)
* Update CreditsMain.hx Made it easier to edit via script, also added color node support. * edited items name idea from @NeeEoo * sweet --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
This commit is contained in:
@@ -3,5 +3,5 @@
|
||||
<menu name="Mod Credits" desc="Modify mod credits here">
|
||||
<!-- \/ You can also set the portrait shader as false as you can see below in the github one -->
|
||||
<credit name="Credit Example" desc="Click me to know more about me!" icon="credit icon example" size="130" url="https://youtu.be/fugtxz1znVw"/>
|
||||
<github user="NexIsDumb" customName="Nex is Dumb" desc="The bitch who made these credits menus" size="100" portrait="false"/>
|
||||
<github user="NexIsDumb" customName="Nex is Dumb" desc="The bitch who made these credits menus" size="100" portrait="false" color="#808080"/>
|
||||
</menu>
|
||||
|
||||
@@ -4,9 +4,11 @@ import funkin.options.OptionsScreen;
|
||||
import funkin.options.type.*;
|
||||
import funkin.options.TreeMenu;
|
||||
import haxe.xml.Access;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class CreditsMain extends TreeMenu {
|
||||
var bg:FlxSprite;
|
||||
var items:Array<OptionType> = [];
|
||||
|
||||
public override function create() {
|
||||
bg = new FlxSprite(-80).loadGraphic(Paths.image('menus/menuBGBlue'));
|
||||
@@ -18,7 +20,6 @@ class CreditsMain extends TreeMenu {
|
||||
bg.antialiasing = true;
|
||||
add(bg);
|
||||
|
||||
var selectables:Array<OptionType> = [];
|
||||
var xmlPath = Paths.xml('config/credits');
|
||||
for(source in [funkin.backend.assets.AssetsLibraryList.AssetSource.SOURCE, funkin.backend.assets.AssetsLibraryList.AssetSource.MODS]) {
|
||||
if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT", source)) {
|
||||
@@ -31,17 +32,17 @@ class CreditsMain extends TreeMenu {
|
||||
|
||||
if (access != null)
|
||||
for(c in parseCreditsFromXML(access, source))
|
||||
selectables.push(c);
|
||||
items.push(c);
|
||||
}
|
||||
}
|
||||
selectables.push(new TextOption("Codename Engine >", "Select this to see all the contributors of the engine!", function() {
|
||||
items.push(new TextOption("Codename Engine >", "Select this to see all the contributors of the engine!", function() {
|
||||
optionsTree.add(Type.createInstance(CreditsCodename, []));
|
||||
}));
|
||||
selectables.push(new TextOption("Friday Night Funkin'", "Select this to open the itch.io page of the original game to donate!", function() {
|
||||
items.push(new TextOption("Friday Night Funkin'", "Select this to open the itch.io page of the original game to donate!", function() {
|
||||
CoolUtil.openURL("https://ninja-muffin24.itch.io/funkin");
|
||||
}));
|
||||
|
||||
main = new OptionsScreen('Credits', 'The people who made this possible!', selectables);
|
||||
main = new OptionsScreen('Credits', 'The people who made this possible!', items);
|
||||
super.create();
|
||||
|
||||
DiscordUtil.call("onMenuLoaded", ["Credits Menu"]);
|
||||
@@ -68,11 +69,13 @@ class CreditsMain extends TreeMenu {
|
||||
html_url: 'https://github.com/$username',
|
||||
avatar_url: 'https://github.com/$username.png'
|
||||
};
|
||||
|
||||
credsMenus.push(new GithubIconOption(user, desc, null,
|
||||
var opt:GithubIconOption = new GithubIconOption(user, desc, null,
|
||||
node.has.customName ? node.att.customName : null, node.has.size ? Std.parseInt(node.att.size) : 96,
|
||||
node.has.portrait ? node.att.portrait.toLowerCase() == "false" ? false : true : true
|
||||
));
|
||||
);
|
||||
if (node.has.color)
|
||||
@:privateAccess opt.__text.color = FlxColor.fromString(node.att.color);
|
||||
credsMenus.push(opt);
|
||||
} else {
|
||||
if (!node.has.name) {
|
||||
Logs.trace("A credit node requires a name attribute.", WARNING);
|
||||
@@ -82,11 +85,14 @@ class CreditsMain extends TreeMenu {
|
||||
|
||||
switch(node.name) {
|
||||
case "credit":
|
||||
credsMenus.push(new PortraitOption(name, desc, function() if(node.has.url) CoolUtil.openURL(node.att.url),
|
||||
var opt:PortraitOption = new PortraitOption(name, desc, function() if(node.has.url) CoolUtil.openURL(node.att.url),
|
||||
node.has.icon && Paths.assetsTree.existsSpecific(Paths.image('credits/${node.att.icon}'), "IMAGE", source) ?
|
||||
FlxG.bitmap.add(Paths.image('credits/${node.att.icon}')) : null, node.has.size ? Std.parseInt(node.att.size) : 96,
|
||||
node.has.portrait ? node.att.portrait.toLowerCase() == "false" ? false : true : true
|
||||
));
|
||||
);
|
||||
if (node.has.color)
|
||||
@:privateAccess opt.__text.color = FlxColor.fromString(node.att.color);
|
||||
credsMenus.push(opt);
|
||||
|
||||
case "menu":
|
||||
credsMenus.push(new TextOption(name + " >", desc, function() {
|
||||
|
||||
Reference in New Issue
Block a user