Merge branch 'main' into translations-system
This commit is contained in:
@@ -4,6 +4,10 @@ import flixel.input.keyboard.FlxKey;
|
||||
import flixel.util.FlxSave;
|
||||
import openfl.Lib;
|
||||
|
||||
/**
|
||||
* The save data of the engine.
|
||||
* Mod save data is stored in `FlxG.save.data`.
|
||||
**/
|
||||
@:build(funkin.backend.system.macros.OptionsMacro.build())
|
||||
@:build(funkin.backend.system.macros.FunkinSaveMacro.build("__save", "__flush", "__load"))
|
||||
class Options
|
||||
@@ -52,7 +56,7 @@ class Options
|
||||
*/
|
||||
public static var freeplayLastSong:String = null;
|
||||
public static var freeplayLastDifficulty:String = "normal";
|
||||
public static var contributors:Array<funkin.backend.system.github.GitHubContributor> = [];
|
||||
public static var contributors:Array<funkin.backend.system.github.GitHubContributor.CreditsGitHubContributor> = [];
|
||||
public static var mainDevs:Array<Int> = []; // IDs
|
||||
public static var lastUpdated:Null<Float>;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class OptionsScreen extends FlxTypedSpriteGroup<OptionType> {
|
||||
|
||||
if (members.length > 0) {
|
||||
members[curSelected].selected = true;
|
||||
if (controls.ACCEPT || FlxG.mouse.justReleased) {
|
||||
if (controls.ACCEPT || (FlxG.mouse.justReleased && Main.timeSinceFocus > 0.25)) {
|
||||
members[curSelected].onSelect();
|
||||
onSelect(members[curSelected]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package funkin.options.type;
|
||||
|
||||
/**
|
||||
* Option type that allows you to select an array of options.
|
||||
**/
|
||||
class ArrayOption extends OptionType {
|
||||
public var selectCallback:String->Void;
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package funkin.options.type;
|
||||
|
||||
import flixel.math.FlxPoint;
|
||||
|
||||
/**
|
||||
* Option type that allows you to toggle a checkbox.
|
||||
**/
|
||||
class Checkbox extends TextOption {
|
||||
public var checkbox:FlxSprite;
|
||||
public var checked(default, set):Bool;
|
||||
|
||||
@@ -5,10 +5,11 @@ import flixel.util.FlxColor;
|
||||
import funkin.backend.shaders.CustomShader;
|
||||
import funkin.backend.system.github.GitHub;
|
||||
import openfl.display.BitmapData;
|
||||
import funkin.backend.system.github.GitHubContributor.CreditsGitHubContributor;
|
||||
|
||||
class GithubIconOption extends TextOption
|
||||
{
|
||||
public var user(default, null):Dynamic; // Can possibly be GitHubUser or GitHubContributor
|
||||
public var user(default, null):CreditsGitHubContributor; // Can possibly be GitHubUser or GitHubContributor, but CreditsGitHubContributor has only the fields we need
|
||||
public var icon:GithubUserIcon = null;
|
||||
public var usePortrait(default, set) = true;
|
||||
|
||||
@@ -19,7 +20,7 @@ class GithubIconOption extends TextOption
|
||||
return usePortrait = value;
|
||||
}
|
||||
|
||||
public function new(user:Dynamic, desc:String, ?callback:Void->Void, ?customName:String, size:Int = 96, usePortrait:Bool = true, waitUntilLoad:Float = 0.25) {
|
||||
public function new(user:CreditsGitHubContributor, desc:String, ?callback:Void->Void, ?customName:String, size:Int = 96, usePortrait:Bool = true, waitUntilLoad:Float = 0.25) {
|
||||
super(customName == null ? user.login : customName, desc, callback == null ? function() CoolUtil.openURL(user.html_url) : callback);
|
||||
this.user = user;
|
||||
this.icon = new GithubUserIcon(user, size, waitUntilLoad);
|
||||
@@ -31,10 +32,10 @@ class GithubIconOption extends TextOption
|
||||
class GithubUserIcon extends FlxSprite
|
||||
{
|
||||
public var waitUntilLoad:Null<Float>;
|
||||
private var user:Dynamic;
|
||||
private var user:CreditsGitHubContributor;
|
||||
private var size:Int;
|
||||
|
||||
public override function new(user:Dynamic, size:Int = 96, waitUntilLoad:Float = 0.25) {
|
||||
public override function new(user:CreditsGitHubContributor, size:Int = 96, waitUntilLoad:Float = 0.25) {
|
||||
this.user = user;
|
||||
this.size = size;
|
||||
this.waitUntilLoad = waitUntilLoad;
|
||||
@@ -49,7 +50,7 @@ class GithubUserIcon extends FlxSprite
|
||||
}
|
||||
|
||||
final mutex = new sys.thread.Mutex();
|
||||
override function drawComplex(camera:FlxCamera):Void { // Making the image downlaod only if the player actually sees it on the screeeeen - Nex
|
||||
override function drawComplex(camera:FlxCamera):Void { // Making the image download only if the player actually sees it on the screen - Nex
|
||||
if(waitUntilLoad <= 0) {
|
||||
waitUntilLoad = null;
|
||||
Main.execAsync(function() {
|
||||
@@ -73,7 +74,7 @@ class GithubUserIcon extends FlxSprite
|
||||
}
|
||||
|
||||
if(planB) {
|
||||
if(unfLink) user = GitHub.getUser(user.login, function(e) Logs.error('Failed to download github user info for ${user.login}: ${CoolUtil.removeIP(e.message)}')); // Api part - Nex
|
||||
if(unfLink) user = cast GitHub.getUser(user.login, function(e) Logs.error('Failed to download github user info for ${user.login}: ${CoolUtil.removeIP(e.message)}')); // Api part - Nex
|
||||
try bytes = HttpUtil.requestBytes('${user.avatar_url}&size=$size')
|
||||
catch(e) Logs.error('Failed to download github pfp for ${user.login}: ${CoolUtil.removeIP(e.message)}');
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@ package funkin.options.type;
|
||||
|
||||
import funkin.game.HealthIcon;
|
||||
|
||||
/**
|
||||
* Option type that has an icon.
|
||||
* Used for the credits menu.
|
||||
**/
|
||||
class IconOption extends TextOption {
|
||||
public var iconSpr:HealthIcon;
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package funkin.options.type;
|
||||
import flixel.util.FlxColor;
|
||||
import funkin.game.HealthIcon;
|
||||
|
||||
/**
|
||||
* Option type that has a new button, and is green.
|
||||
**/
|
||||
class NewOption extends TextOption {
|
||||
public var iconSpr:FlxSprite;
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package funkin.options.type;
|
||||
|
||||
import flixel.effects.FlxFlicker;
|
||||
|
||||
/**
|
||||
* Option type that allows stepping through a number.
|
||||
**/
|
||||
class NumOption extends OptionType {
|
||||
public var selectCallback:Float->Void;
|
||||
|
||||
|
||||
@@ -3,8 +3,12 @@ package funkin.options.type;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import funkin.backend.system.Controls;
|
||||
|
||||
/**
|
||||
* Base class for all option types.
|
||||
* Used in OptionsMenu.
|
||||
**/
|
||||
class OptionType extends FlxSpriteGroup {
|
||||
public var controls(get, null):Controls;
|
||||
public var controls(get, never):Controls;
|
||||
public var selected:Bool = false;
|
||||
public var desc:String;
|
||||
public var rawDesc(default, set):String;
|
||||
|
||||
@@ -3,6 +3,10 @@ package funkin.options.type;
|
||||
import flixel.graphics.FlxGraphic;
|
||||
import funkin.backend.shaders.CustomShader;
|
||||
|
||||
/**
|
||||
* Option type that has a portrait.
|
||||
* Used in the credits menu.
|
||||
**/
|
||||
class PortraitOption extends TextOption {
|
||||
public var portrait:FlxSprite = null;
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package funkin.options.type;
|
||||
|
||||
import flixel.effects.FlxFlicker;
|
||||
|
||||
/**
|
||||
* Option type that has text.
|
||||
**/
|
||||
class TextOption extends OptionType {
|
||||
public var selectCallback:Void->Void;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user