Cleanup + Fixes

This commit is contained in:
NeeEoo
2023-07-27 11:37:18 +02:00
parent c4fd398b09
commit d17243b102
14 changed files with 66 additions and 41 deletions
+2
View File
@@ -166,6 +166,8 @@ class Main extends Sprite
public static function refreshAssets() {
FlxSoundTray.volumeChangeSFX = Paths.sound('menu/volume');
FlxSoundTray.volumeUpChangeSFX = null;
FlxSoundTray.volumeDownChangeSFX = null;
if (FlxG.game.soundTray != null)
FlxG.game.soundTray.text.setTextFormat(new TextFormat(Paths.font("vcr.ttf")));
+7
View File
@@ -121,6 +121,13 @@ class EditorPicker extends MusicBeatSubstate {
close();
}
override function destroy() {
super.destroy();
oldMousePos.put();
curMousePos.put();
}
public function changeSelection(change:Int) {
if (change == 0) return;
+1 -2
View File
@@ -8,8 +8,7 @@ class UIDebugState extends UIState {
FlxG.mouse.useSystemCursor = FlxG.mouse.visible = true;
var bg = new FlxSprite().makeGraphic(1, 1, 0xFF444444);
bg.scale.set(FlxG.width, FlxG.height);
var bg = new FlxSprite().makeSolid(FlxG.width, FlxG.height, 0xFF444444);
bg.updateHitbox();
bg.scrollFactor.set();
add(bg);
@@ -76,29 +76,20 @@ class CharterStrumlineScreen extends UISubstateWindow {
usesChartscrollSpeed.onChecked = function(b) {
if(b)
{
scrollSpeedStepper.alpha = 0.4;
scrollSpeedStepper.label.alpha = 0.4;
scrollSpeedStepper.value = PlayState.SONG.scrollSpeed;
scrollSpeedStepper.active = false;
scrollSpeedStepper.selectable = false;
} else {
scrollSpeedStepper.alpha = 1;
scrollSpeedStepper.label.alpha = 1;
scrollSpeedStepper.active = true;
scrollSpeedStepper.selectable = true;
}
}
add(usesChartscrollSpeed);
scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 32 + 58, usesChartscrollSpeed.checked ? PlayState.SONG.scrollSpeed : strumLine.scrollSpeed, 0.1, 2, 0, 10, 82);
if(usesChartscrollSpeed.checked)
{
scrollSpeedStepper.alpha = 0.4;
scrollSpeedStepper.label.alpha = 0.4;
scrollSpeedStepper.active = false;
scrollSpeedStepper.selectable = false;
} else {
scrollSpeedStepper.alpha = 1;
scrollSpeedStepper.label.alpha = 1;
scrollSpeedStepper.active = true;
scrollSpeedStepper.selectable = true;
}
add(scrollSpeedStepper);
addLabelOn(scrollSpeedStepper, "Scroll Speed");
+10 -10
View File
@@ -34,17 +34,17 @@ class UISliceSprite extends UISprite {
var x:Float = this.x;
var y:Float = this.y;
var topleft:FlxFrame = frames.frames[framesOffset];
var top:FlxFrame = frames.frames[framesOffset + 1];
var topright:FlxFrame = frames.frames[framesOffset + 2];
var middleleft:FlxFrame = frames.frames[framesOffset + 3];
var middle:FlxFrame = frames.frames[framesOffset + 4];
var middleright:FlxFrame = frames.frames[framesOffset + 5];
var bottomleft:FlxFrame = frames.frames[framesOffset + 6];
var bottom:FlxFrame = frames.frames[framesOffset + 7];
var bottomright:FlxFrame = frames.frames[framesOffset + 8];
@:privateAccess if (visible) {
var topleft:FlxFrame = frames.frames[framesOffset];
var top:FlxFrame = frames.frames[framesOffset + 1];
var topright:FlxFrame = frames.frames[framesOffset + 2];
var middleleft:FlxFrame = frames.frames[framesOffset + 3];
var middle:FlxFrame = frames.frames[framesOffset + 4];
var middleright:FlxFrame = frames.frames[framesOffset + 5];
var bottomleft:FlxFrame = frames.frames[framesOffset + 6];
var bottom:FlxFrame = frames.frames[framesOffset + 7];
var bottomright:FlxFrame = frames.frames[framesOffset + 8];
// TOP LEFT
frame = topleft;
setPosition(x, y);
+2 -1
View File
@@ -7,7 +7,7 @@ import funkin.backend.shaders.CustomShader;
// TODO: make UIWarningSubstate extend this
class UISubstateWindow extends MusicBeatSubstate {
var camShaders:Array<FlxCamera> = [];
var blurShader:CustomShader = Options.intensiveBlur ? new CustomShader("engine/editorBlur") : new CustomShader("engine/editorBlurFast");
var blurShader:CustomShader = new CustomShader(Options.intensiveBlur ? "engine/editorBlur" : "engine/editorBlurFast");
var titleSpr:UIText;
var messageSpr:UIText;
@@ -30,6 +30,7 @@ class UISubstateWindow extends MusicBeatSubstate {
super.create();
for(c in FlxG.cameras.list) {
// Prevent adding a shader if it already has one
@:privateAccess if(c._filters != null) {
var shouldSkip = false;
for(filter in c._filters) {
+12 -3
View File
@@ -37,7 +37,7 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
var cacheRect:Rectangle = new Rectangle();
public override function update(elapsed:Float) {
if (hovered && FlxG.mouse.justReleased && __lastDrawCameras.length > 0) {
if (selectable && hovered && FlxG.mouse.justReleased && __lastDrawCameras.length > 0) {
// get caret pos
var pos = FlxG.mouse.getScreenPosition(__lastDrawCameras[0], FlxPoint.get());
pos.x -= label.x;
@@ -57,11 +57,20 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
}
super.update(elapsed);
var selected = selectable && focused;
if(selectable) {
alpha = label.alpha = 1;
} else {
alpha = label.alpha = 0.4;
}
var off = multiline ? 4 : ((bHeight - label.height) / 2);
label.follow(this, 4, off);
framesOffset = (focused ? 18 : (hovered ? 9 : 0));
framesOffset = (selected ? 18 : (hovered ? 9 : 0));
@:privateAccess {
if (focused) {
if (selected) {
__wasFocused = true;
caretSpr.alpha = (FlxG.game.ticks % 666) >= 333 ? 1 : 0;
+21 -1
View File
@@ -1,12 +1,13 @@
package funkin.editors.ui;
import openfl.filters.ShaderFilter;
import flixel.tweens.FlxTween;
import flixel.tweens.FlxEase;
import funkin.backend.shaders.CustomShader;
class UIWarningSubstate extends MusicBeatSubstate {
var camShaders:Array<FlxCamera> = [];
var blurShader:CustomShader = Options.intensiveBlur ? new CustomShader("engine/editorBlur") : new CustomShader("engine/editorBlurFast");
var blurShader:CustomShader = new CustomShader(Options.intensiveBlur ? "engine/editorBlur" : "engine/editorBlurFast");
var title:String;
var message:String;
@@ -25,6 +26,25 @@ class UIWarningSubstate extends MusicBeatSubstate {
public override function create() {
for(c in FlxG.cameras.list) {
// Prevent adding a shader if it already has one
@:privateAccess if(c._filters != null) {
var shouldSkip = false;
for(filter in c._filters) {
if(filter is ShaderFilter) {
var filter:ShaderFilter = cast filter;
if(filter.shader is CustomShader) {
var shader:CustomShader = cast filter.shader;
if(shader.path == blurShader.path) {
shouldSkip = true;
break;
}
}
}
}
if(shouldSkip)
continue;
}
camShaders.push(c);
c.addShader(blurShader);
}
+1 -1
View File
@@ -9,7 +9,7 @@ class NoteGroup extends FlxTypedGroup<Note> {
var __currentlyLooping:Bool = false;
/**
* Preallocates the members array with nulls, but if theres anything before it clears it
* Preallocates the members array with nulls, but if theres anything in the array already it clears it
**/
public inline function preallocate(len:Int) {
members = cast new haxe.ds.Vector<Note>(len);
+1 -1
View File
@@ -233,7 +233,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
__justPressed = CoolUtil.getDefault(event.justPressed, []);
__justReleased = CoolUtil.getDefault(event.justReleased, []);
__notePerStrum = [for(_ in 0...members.length) null];
__notePerStrum = cast new haxe.ds.Vector(members.length);//[for(_ in 0...members.length) null];
if (__pressed.contains(true)) {
+1 -2
View File
@@ -14,8 +14,7 @@ class ModSwitchMenu extends MusicBeatSubstate {
public override function create() {
super.create();
var bg = new FlxSprite(0, 0).makeGraphic(1, 1, 0xFF000000);
bg.scale.set(FlxG.width, FlxG.height);
var bg = new FlxSprite(0, 0).makeSolid(FlxG.width, FlxG.height, 0xFF000000);
bg.updateHitbox();
bg.scrollFactor.set();
add(bg);
+1 -2
View File
@@ -60,8 +60,7 @@ class PauseSubState extends MusicBeatSubstate
if (__cancelDefault = event.cancelled) return;
var bg:FlxSprite = new FlxSprite().makeGraphic(1, 1, FlxColor.BLACK);
bg.scale.set(FlxG.width, FlxG.height);
var bg:FlxSprite = new FlxSprite().makeSolid(FlxG.width, FlxG.height, FlxColor.BLACK);
bg.updateHitbox();
bg.alpha = 0;
bg.scrollFactor.set();
+2 -4
View File
@@ -45,9 +45,8 @@ class StoryMenuState extends MusicBeatState {
persistentUpdate = persistentDraw = true;
// WEEK INFO
blackBar = new FlxSprite(0, 0).makeGraphic(1, 1, 0xFFFFFFFF);
blackBar = new FlxSprite(0, 0).makeSolid(FlxG.width, 56, 0xFFFFFFFF);
blackBar.color = 0xFF000000;
blackBar.setGraphicSize(FlxG.width, 56);
blackBar.updateHitbox();
scoreText = new FunkinText(10, 10, 0, "SCORE: -", 36);
@@ -57,9 +56,8 @@ class StoryMenuState extends MusicBeatState {
weekTitle.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT);
weekTitle.alpha = 0.7;
weekBG = new FlxSprite(0, 56).makeGraphic(1, 1, 0xFFFFFFFF);
weekBG = new FlxSprite(0, 56).makeSolid(FlxG.width, 400, 0xFFFFFFFF);
weekBG.color = 0xFFF9CF51;
weekBG.setGraphicSize(FlxG.width, 400);
weekBG.updateHitbox();
weekSprites = new FlxTypedGroup<MenuItem>();
+1 -1
View File
@@ -66,7 +66,7 @@ class TitleState extends MusicBeatState
persistentUpdate = true;
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
var bg:FlxSprite = new FlxSprite().makeSolid(FlxG.width, FlxG.height, FlxColor.BLACK);
add(bg);
#if TITLESCREEN_XML