This commit is contained in:
Yoshman29
2023-02-22 03:05:37 +01:00
parent 4b98b0ba31
commit b1349c09b9
3 changed files with 39 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
2373
2384
+35 -1
View File
@@ -1,5 +1,6 @@
package funkin.menus.credits;
import funkin.ui.FunkinText;
import flixel.util.FlxColor;
import funkin.shaders.CustomShader;
import flixel.math.FlxMath;
@@ -25,12 +26,15 @@ class CreditsCodename extends OptionsScreen {
public var interpColor:FlxInterpolateColor;
public var errorMessage:String = "";
public override function create() {
contributors = GitHub.getContributors("YoshiCrafter29", "CodenameEngine", function(e) {
trace(e);
errorMessage = Std.string(e);
});
var totalContributions = 0;
for(c in contributors)
@@ -49,7 +53,29 @@ class CreditsCodename extends OptionsScreen {
interpColor = new FlxInterpolateColor(bg.color);
}
public override function changeSelection(change:Int) {
if (contributors.length <= 0)
return;
super.changeSelection(change);
}
public override function createAdditional() {
if (contributors.length <= 0) {
var t = new FunkinText(0, 0, FlxG.width, 'Could not load engine contributors.\nMake sure you\'re connected to the Internet.\n\n${errorMessage}\n\nPress BACK to go back.', 40, true);
t.alignment = CENTER;
t.borderSize *= 1.75;
t.screenCenter();
var bg = new FlxSprite(0, 0).makeGraphic(1, 1, 0xFF000000);
bg.alpha = 0.5;
bg.scale.set(FlxG.width - 80, t.height + 40);
bg.updateHitbox();
bg.screenCenter();
add(bg);
add(t);
return;
}
for(k=>c in contributors) {
var spr = new FlxSprite(0, (OptionsScreen.optionHeight * (k+0.5)) - 48);
spr.antialiasing = true;
@@ -75,6 +101,13 @@ class CreditsCodename extends OptionsScreen {
public override function update(elapsed:Float) {
super.update(elapsed);
if (contributors.length <= 0) {
if (controls.BACK)
exit();
return;
}
if (avatarLoadListId < contributorsAvatars.length) {
for(i in avatarLoadListId...contributorsAvatars.length) {
var v = contributorsSprites[i];
@@ -99,6 +132,7 @@ class CreditsCodename extends OptionsScreen {
}
public override function exit() {
FlxTransitionableState.skipNextTransOut = true;
FlxG.switchState(new CreditsMain());
}
}
+3 -3
View File
@@ -85,15 +85,15 @@ class OptionsScreen extends MusicBeatState {
options[curSelected].onSelect();
}
if (controls.BACK) {
Options.applySettings();
Options.save();
Options.applySettings();
exit();
}
FlxG.camera.scroll.x = lerp(FlxG.camera.scroll.x, scrollDest.x, 0.25);
FlxG.camera.scroll.y = lerp(FlxG.camera.scroll.y, scrollDest.y, 0.25);
for(option in options) {
var angle = Math.cos((option.y + (optionHeight / 2) - (FlxG.camera.scroll.y + (FlxG.height / 2))) / (FlxG.height * 1.25) * Math.PI);
var angle = Math.cos((option.y + (optionHeight / 2) - (FlxG.camera.scroll.y + ((FlxG.height - descBG.height) / 2))) / (FlxG.height * 1.25) * Math.PI);
option.x = -50 + (Math.abs(angle) * 150);
}
@@ -115,7 +115,7 @@ class OptionsScreen extends MusicBeatState {
for(e in options)
e.selected = false;
options[curSelected].selected = true;
scrollDest.set(-50, -(FlxG.height / 2) + ((curSelected + 0.5) * optionHeight));
scrollDest.set(-50, -((FlxG.height - descBG.height) / 2) + ((curSelected + 0.5) * optionHeight));
updateDesc();
}
}