Cleanup
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package funkin.options;
|
||||
|
||||
import funkin.backend.system.Controls;
|
||||
import openfl.Lib;
|
||||
import flixel.util.FlxSave;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
|
||||
@@ -3,9 +3,6 @@ package funkin.options;
|
||||
import funkin.backend.system.framerate.Framerate;
|
||||
import funkin.options.type.Checkbox;
|
||||
import haxe.xml.Access;
|
||||
import flixel.tweens.FlxTween;
|
||||
import funkin.menus.MainMenuState;
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
import funkin.options.type.*;
|
||||
import funkin.options.categories.*;
|
||||
import funkin.options.TreeMenu;
|
||||
|
||||
@@ -3,10 +3,9 @@ package funkin.options;
|
||||
class OptionsTree extends FlxTypedGroup<OptionsScreen> {
|
||||
public var lastMenu:OptionsScreen;
|
||||
public var treeParent:TreeMenu;
|
||||
public override function new() {
|
||||
super();
|
||||
|
||||
}
|
||||
//public override function new() {
|
||||
// super();
|
||||
//}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
var last = members.last();
|
||||
|
||||
@@ -29,9 +29,6 @@ class PlayerSettings
|
||||
public var controls:Controls;
|
||||
#end
|
||||
|
||||
// public var avatar:Player;
|
||||
// public var camera(get, never):PlayCamera;
|
||||
|
||||
function new(id, scheme)
|
||||
{
|
||||
this.id = id;
|
||||
@@ -42,7 +39,7 @@ class PlayerSettings
|
||||
{
|
||||
controls.setKeyboardScheme(scheme);
|
||||
}
|
||||
|
||||
|
||||
static public function init():Void
|
||||
{
|
||||
if (solo == null)
|
||||
|
||||
@@ -5,10 +5,8 @@ import flixel.FlxState;
|
||||
import funkin.backend.FunkinText;
|
||||
import flixel.tweens.FlxTween;
|
||||
import funkin.menus.MainMenuState;
|
||||
import funkin.options.type.TextOption;
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
import funkin.options.type.OptionType;
|
||||
import funkin.options.categories.*;
|
||||
|
||||
class TreeMenu extends UIState {
|
||||
public var main:OptionsScreen;
|
||||
|
||||
@@ -48,9 +48,8 @@ class AppearanceOptions extends OptionsScreen {
|
||||
"If checked, switching windows will pause the game.",
|
||||
"autoPause"));
|
||||
}
|
||||
|
||||
private function __changeFPS(change:Float)
|
||||
{
|
||||
|
||||
private function __changeFPS(change:Float) {
|
||||
// if statement cause of the flixel warning
|
||||
if(FlxG.updateFramerate < Std.int(change))
|
||||
FlxG.drawFramerate = FlxG.updateFramerate = Std.int(change);
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package funkin.options.categories;
|
||||
|
||||
import flixel.util.FlxTimer;
|
||||
import funkin.backend.system.Conductor;
|
||||
|
||||
class GameplayOptions extends OptionsScreen {
|
||||
var __metronome = FlxG.sound.load(Paths.sound('editors/charter/metronome'));
|
||||
|
||||
var offsetSetting:NumOption;
|
||||
|
||||
public override function new() {
|
||||
super("Gameplay", 'Change Gameplay options such as Downscroll, Scroll Speed, Naughtyness...');
|
||||
add(new Checkbox(
|
||||
@@ -14,7 +18,7 @@ class GameplayOptions extends OptionsScreen {
|
||||
"Ghost Tapping",
|
||||
"If unchecked, trying to hit any strum that have no note that can be hit will cause a miss.",
|
||||
"ghostTapping"));
|
||||
add(new NumOption(
|
||||
add(offsetSetting = new NumOption(
|
||||
"Song Offset",
|
||||
"Changes the offset that songs should start with.",
|
||||
-999, // minimum
|
||||
@@ -31,23 +35,39 @@ class GameplayOptions extends OptionsScreen {
|
||||
"If unchecked, will stop the camera from zooming in every 4 beats",
|
||||
"camZoomOnBeat"));
|
||||
}
|
||||
private function __changeOffset(offset) Conductor.songOffset = offset;
|
||||
|
||||
private function __changeOffset(offset)
|
||||
Conductor.songOffset = offset;
|
||||
|
||||
var __lastBeat:Int = 0;
|
||||
var __lastSongBeat:Int = 0;
|
||||
|
||||
override function update(elapsed) {
|
||||
super.update(elapsed);
|
||||
FlxG.camera.zoom = CoolUtil.fpsLerp(FlxG.camera.zoom, 1, 0.04);
|
||||
if (members[2].selected) {
|
||||
|
||||
if (offsetSetting.selected) {
|
||||
FlxG.sound.music.volume = 0.5;
|
||||
if (__lastBeat != Conductor.curBeat) {
|
||||
FlxG.camera.zoom += 0.03;
|
||||
__lastBeat = Conductor.curBeat;
|
||||
}
|
||||
if (__lastSongBeat != Math.floor(Conductor.getStepForTime(FlxG.sound.music.time) / Conductor.stepsPerBeat)) {
|
||||
|
||||
var beat = Math.floor(Conductor.getStepForTime(FlxG.sound.music.time) / Conductor.stepsPerBeat);
|
||||
if (__lastSongBeat != beat) {
|
||||
__metronome.replay();
|
||||
__lastSongBeat = Math.floor(Conductor.getStepForTime(FlxG.sound.music.time) / Conductor.stepsPerBeat);
|
||||
__lastSongBeat = beat;
|
||||
}
|
||||
}
|
||||
else FlxG.sound.music.volume = 1;
|
||||
}
|
||||
|
||||
public override function close() {
|
||||
// To remove this timer move super.update(elapsed); to the end, but im afraid it will cause stuff to break
|
||||
new FlxTimer().start(0.0000001, (_) -> {
|
||||
FlxG.camera.zoom = 1;
|
||||
FlxG.sound.music.volume = 1;
|
||||
});
|
||||
super.close();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
package funkin.options.keybinds;
|
||||
|
||||
import flixel.effects.FlxFlicker;
|
||||
import funkin.backend.system.Controls;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
|
||||
class ChangeKeybindSubState extends MusicBeatSubstate {
|
||||
@@ -27,7 +23,7 @@ class ChangeKeybindSubState extends MusicBeatSubstate {
|
||||
if (cast(key, Int) <= 0) return;
|
||||
|
||||
if (key == ESCAPE && !FlxG.keys.pressed.SHIFT) {
|
||||
close();
|
||||
close();
|
||||
cancelCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package funkin.options.keybinds;
|
||||
|
||||
import flixel.effects.FlxFlicker;
|
||||
import funkin.backend.system.Controls;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package funkin.options.keybinds;
|
||||
|
||||
import funkin.backend.system.Controls;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
|
||||
using StringTools;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package funkin.options.type;
|
||||
|
||||
import flixel.effects.FlxFlicker;
|
||||
|
||||
class ArrayOption extends OptionType {
|
||||
public var selectCallback:String->Void;
|
||||
|
||||
@@ -31,17 +29,12 @@ class ArrayOption extends OptionType {
|
||||
|
||||
this.parent = parent;
|
||||
|
||||
if(Reflect.field(parent, optionName) != null)
|
||||
{
|
||||
if(options.indexOf(Reflect.field(parent, optionName)) != -1)
|
||||
this.currentSelection = options.indexOf(Reflect.field(parent, optionName));
|
||||
else
|
||||
this.currentSelection = 0;
|
||||
}
|
||||
|
||||
|
||||
var fieldValue = Reflect.field(parent, optionName);
|
||||
if(fieldValue != null)
|
||||
this.currentSelection = Std.int(Math.max(0, options.indexOf(fieldValue)));
|
||||
|
||||
this.optionName = optionName;
|
||||
|
||||
|
||||
add(__text = new Alphabet(100, 20, text, true));
|
||||
add(__selectiontext = new Alphabet(__text.width + 120, -30, formatTextOption(), false));
|
||||
}
|
||||
@@ -52,7 +45,7 @@ class ArrayOption extends OptionType {
|
||||
|
||||
public override function onChangeSelection(change:Float):Void
|
||||
{
|
||||
if(currentSelection <= 0 && change == -1 || currentSelection >= options.length - 1 && change == 1 ) return;
|
||||
if(currentSelection <= 0 && change == -1 || currentSelection >= options.length - 1 && change == 1) return;
|
||||
currentSelection += Math.round(change);
|
||||
__selectiontext.text = formatTextOption();
|
||||
Reflect.setField(parent, optionName, options[currentSelection]);
|
||||
|
||||
@@ -2,7 +2,6 @@ package funkin.options.type;
|
||||
|
||||
import flixel.math.FlxPoint;
|
||||
|
||||
@:allow()
|
||||
class Checkbox extends TextOption {
|
||||
|
||||
public var checkbox:FlxSprite;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package funkin.options.type;
|
||||
|
||||
import funkin.game.HealthIcon;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class EditorIconOption extends IconOption {
|
||||
|
||||
@@ -2,7 +2,6 @@ package funkin.options.type;
|
||||
|
||||
import funkin.backend.system.Controls;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import funkin.options.OptionsScreen;
|
||||
|
||||
class OptionType extends FlxSpriteGroup {
|
||||
public var controls(get, null):Controls;
|
||||
|
||||
Reference in New Issue
Block a user