convert every single editor sfx path to flags

This commit is contained in:
Frakits
2025-07-25 22:57:16 +03:00
parent 93e23ebc69
commit 492668076c
11 changed files with 61 additions and 31 deletions
+30
View File
@@ -197,6 +197,36 @@ class Flags {
public static var URL_EDITOR_FALLBACK:String = "https://www.youtube.com/watch?v=9Youam7GYdQ";
public static var URL_FNF_ITCH:String = "https://ninja-muffin24.itch.io/funkin";
/**
* Default editor sound paths
*/
public static var DEFAULT_EDITOR_AUTOSAVE_SOUND = "editors/autosave";
public static var DEFAULT_EDITOR_BUTTONCLICK_SOUND = "editors/buttonClick";
public static var DEFAULT_EDITOR_CLICK_SOUND = "editors/click";
public static var DEFAULT_EDITOR_COPY_SOUND = "editors/copy";
public static var DEFAULT_EDITOR_CUT_SOUND = "editors/cut";
public static var DEFAULT_EDITOR_DELETE_SOUND = "editors/delete";
public static var DEFAULT_EDITOR_OFFSETDRAG_SOUND = "editors/offsetDrag";
public static var DEFAULT_EDITOR_PASTE_SOUND = "editors/paste";
public static var DEFAULT_EDITOR_REDO_SOUND = "editors/redo";
public static var DEFAULT_EDITOR_SAVE_SOUND = "editors/save";
public static var DEFAULT_EDITOR_TEXTREMOVE_SOUND = "editors/textRemove";
public static var DEFAULT_EDITOR_TEXTTYPE_SOUND = "editors/textType";
public static var DEFAULT_EDITOR_UNDO_SOUND = "editors/undo";
public static var DEFAULT_EDITOR_WINDOWAPPEAR_SOUND = "editors/windowAppear";
public static var DEFAULT_CHARTER_HITSOUND_SOUND = "editors/charter/hitsound";
public static var DEFAULT_CHARTER_METRONOME_SOUND = "editors/charter/metronome";
public static var DEFAULT_CHARTER_NOTEDELETE_SOUND = "editors/charter/noteDelete";
public static var DEFAULT_CHARTER_NOTEPLACE_SOUND = "editors/charter/notePlace";
public static var DEFAULT_CHARTER_SCROLL_SOUND = "editors/charter/scroll";
public static var DEFAULT_CHARTER_SNAPPINGCHANGE_SOUND = "editors/charter/snappingChange";
public static var DEFAULT_CHARTER_STRUMLOCK_SOUND = "editors/charter/strumLock";
public static var DEFAULT_CHARTER_STRUMUNLOCK_SOUND = "editors/charter/strumUnlock";
public static var DEFAULT_CHARTER_SUSTAINADD_SOUND = "editors/charter/sustainAdd";
public static var DEFAULT_CHARTER_SUSTAINDELETE_SOUND = "editors/charter/sustainDelete";
public static var DEFAULT_CHARACTER_GHOSTDISABLE_SOUND = "editors/character/ghostDisable";
public static var DEFAULT_CHARACTER_GHOSTENABLE_SOUND = "editors/character/ghostEnable";
public static var DEFAULT_GLSL_VERSION:String = "120";
@:also(funkin.backend.utils.HttpUtil.userAgent)
public static var USER_AGENT:String = 'request';
@@ -424,12 +424,12 @@ class CharacterAnimButton extends UIButton {
public function toggleGhost() {
if (valid && parent.ghosts.indexOf(anim) == -1) {
FlxG.sound.play(Paths.sound('editors/character/ghostEnable'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_CHARACTER_GHOSTENABLE_SOUND));
parent.ghosts.push(anim);
ghostIcon.animation.play("alive", true);
ghostIcon.color = 0xFFFFFFFF;
} else {
FlxG.sound.play(Paths.sound('editors/character/ghostDisable'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_CHARACTER_GHOSTDISABLE_SOUND));
parent.ghosts.remove(anim);
ghostIcon.animation.play("dead", true);
ghostIcon.color = 0xFFADADAD;
@@ -99,7 +99,7 @@ class CharacterAnimsWindow extends UIButtonList<CharacterAnimButton> {
displayAnimsFramesList.remove(name);
public function deleteAnimation(button:CharacterAnimButton, addToUndo:Bool = true) {
FlxG.sound.play(Paths.sound('editors/delete'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_DELETE_SOUND));
if (buttons.members.length <= 1) return;
if (character.getAnimName() == button.anim)
@:privateAccess CharacterEditor.instance._animation_down(null);
@@ -498,7 +498,7 @@ class CharacterEditor extends UIState {
}
function _undo(undo:CharacterEditorChange) {
FlxG.sound.play(Paths.sound('editors/undo'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_UNDO_SOUND));
switch (undo) {
case null: // do nothing
case CCharEditPosition(oldPos, newPos):
@@ -569,7 +569,7 @@ class CharacterEditor extends UIState {
}
function _redo(redo:CharacterEditorChange) {
FlxG.sound.play(Paths.sound('editors/redo'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_REDO_SOUND));
switch (redo) {
case null: // do nothing
case CCharEditPosition(oldPos, newPos):
+15 -15
View File
@@ -408,8 +408,8 @@ class Charter extends UIState {
}
];
hitsound = FlxG.sound.load(Paths.sound('editors/charter/hitsound'));
metronome = FlxG.sound.load(Paths.sound('editors/charter/metronome'));
hitsound = FlxG.sound.load(Paths.sound(Flags.DEFAULT_CHARTER_HITSOUND_SOUND));
metronome = FlxG.sound.load(Paths.sound(Flags.DEFAULT_CHARTER_METRONOME_SOUND));
charterCamera = FlxG.camera;
uiCamera = new FlxCamera();
@@ -511,7 +511,7 @@ class Charter extends UIState {
strumlineLockButton = new CharterStrumlineButton("editors/charter/lock-strumline", translate("lock-unlock"));
strumlineLockButton.onClick = function () {
FlxG.sound.play(Paths.sound(!strumLines.draggable ? 'editors/charter/strumUnlock' : 'editors/charter/strumLock'));
FlxG.sound.play(Paths.sound(!strumLines.draggable ? Flags.DEFAULT_CHARTER_STRUMUNLOCK_SOUND : Flags.DEFAULT_CHARTER_STRUMLOCK_SOUND));
if (strumLines != null) {
strumLines.draggable = !strumLines.draggable;
strumlineLockButton.textTweenColor.color = strumLines.draggable ? 0xFF5C95CA : 0xFFE16565;
@@ -951,7 +951,7 @@ class Charter extends UIState {
notesGroup.add(note);
selection = [note];
undos.addToUndo(CCreateSelection([note]));
FlxG.sound.play(Paths.sound('editors/charter/notePlace'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_CHARTER_NOTEPLACE_SOUND));
}
isSelecting = false;
}
@@ -1080,7 +1080,7 @@ class Charter extends UIState {
if (selected == null) return selected;
if (selected is CharterNote) {
FlxG.sound.play(Paths.sound('editors/charter/noteDelete'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_CHARTER_NOTEDELETE_SOUND));
var note:CharterNote = cast selected;
note.strumLineID = strumLines.members.indexOf(note.strumLine);
note.strumLine = null; // For static undos :D
@@ -1581,7 +1581,7 @@ class Charter extends UIState {
function _file_saveas_psych(_) savePsychChartAs();
function _edit_copy(_, playSFX=true) {
if (playSFX) FlxG.sound.play(Paths.sound('editors/undo'));
if (playSFX) FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_COPY_SOUND));
if(selection.length == 0) return;
var minStep:Float = selection[0].step;
@@ -1600,7 +1600,7 @@ class Charter extends UIState {
];
}
function _edit_paste(_) {
FlxG.sound.play(Paths.sound('editors/paste'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_PASTE_SOUND));
if (clipboard.length <= 0) return;
var minStep = curStep;
@@ -1628,7 +1628,7 @@ class Charter extends UIState {
}
function _edit_cut(_) {
FlxG.sound.play(Paths.sound('editors/cut'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_CUT_SOUND));
if (selection == null || selection.length == 0) return;
_edit_copy(_, false);
@@ -1636,7 +1636,7 @@ class Charter extends UIState {
}
function _edit_delete(_) {
FlxG.sound.play(Paths.sound('editors/delete'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_DELETE_SOUND));
if (selection == null || selection.length == 0) return;
selection.loop((n:CharterNote) -> {
noteDeleteAnims.deleteNotes.push({note: n, time: noteDeleteAnims.deleteTime});
@@ -1645,7 +1645,7 @@ class Charter extends UIState {
}
function _undo(undo:CharterChange) {
FlxG.sound.play(Paths.sound('editors/undo'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_UNDO_SOUND));
switch(undo) {
case null: // do nothing
case CDeleteStrumLine(strumLineID, strumLine):
@@ -1706,7 +1706,7 @@ class Charter extends UIState {
}
function _redo(redo:CharterChange) {
FlxG.sound.play(Paths.sound('editors/redo'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_REDO_SOUND));
switch(redo) {
case null: // do nothing
case CDeleteStrumLine(strumLineID, strumLine):
@@ -2051,8 +2051,8 @@ class Charter extends UIState {
inline function _snap_decreasesnap(_) changequant(-1);
inline function _snap_resetsnap(_) setquant(16);
inline function changequant(change:Int) {FlxG.sound.play(Paths.sound('editors/charter/snappingChange')); quant = quants[FlxMath.wrap(quants.indexOf(quant) + change, 0, quants.length-1)]; buildSnapsUI();};
inline function setquant(newQuant:Int) {FlxG.sound.play(Paths.sound('editors/charter/snappingChange')); quant = newQuant; buildSnapsUI();}
inline function changequant(change:Int) {FlxG.sound.play(Paths.sound(Flags.DEFAULT_CHARTER_SNAPPINGCHANGE_SOUND)); quant = quants[FlxMath.wrap(quants.indexOf(quant) + change, 0, quants.length-1)]; buildSnapsUI();};
inline function setquant(newQuant:Int) {FlxG.sound.play(Paths.sound(Flags.DEFAULT_CHARTER_SNAPPINGCHANGE_SOUND)); quant = newQuant; buildSnapsUI();}
function buildSnapsUI():Array<UIContextMenuOption> {
var snapsTopButton:UITopMenuButton = topMenuSpr == null ? null : cast topMenuSpr.members[snapIndex];
@@ -2088,12 +2088,12 @@ class Charter extends UIState {
}
inline function _note_addsustain(t) {
FlxG.sound.play(Paths.sound('editors/charter/sustainAdd'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_CHARTER_SUSTAINADD_SOUND));
changeNoteSustain(1);
}
inline function _note_subtractsustain(t) {
FlxG.sound.play(Paths.sound('editors/charter/sustainDelete'));
FlxG.sound.play(Paths.sound(DEFAULT_CHARTER_SUSTAINDELETE_SOUND));
changeNoteSustain(-1);
}
@@ -82,7 +82,7 @@ class CharterAutoSaveUI extends UISliceSprite {
icon.animation.curAnim.curFrame = 1;
for (member in [this, progressBar, progressBarBack, autosavingText]) member.color = 0xFFA3EC95;
FlxG.sound.play(Paths.sound("editors/autosave"));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_AUTOSAVE_SOUND));
(new FlxTimer()).start(1, (_) -> {disappearAnimation();});
});
+2 -2
View File
@@ -731,7 +731,7 @@ class StageEditor extends UIState {
}
function _edit_undo(_) {
FlxG.sound.play(Paths.sound('editors/undo'));
FlxG.sound.play(Flags.DEFAULT_EDITOR_UNDO_SOUND);
var undo = undos.undo();
switch(undo) {
case null:
@@ -757,7 +757,7 @@ class StageEditor extends UIState {
}
function _edit_redo(_) {
FlxG.sound.play(Paths.sound('editors/redo'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_REDO_SOUND));
var redo = undos.redo();
switch(redo) {
case null:
+1 -1
View File
@@ -30,7 +30,7 @@ class UIButton extends UISliceSprite {
super.onHovered();
if (FlxG.mouse.justPressed) {
hasBeenPressed = true;
FlxG.sound.play(Paths.sound('editors/buttonClick'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_BUTTONCLICK_SOUND));
}
if (FlxG.mouse.justReleased && callback != null && shouldPress && hasBeenPressed) {
callback();
+2 -2
View File
@@ -106,7 +106,7 @@ class UIState extends MusicBeatState {
}
if (FlxG.mouse.justPressed) {
FlxG.sound.play(Paths.sound('editors/click'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_CLICK_SOUND));
}
if (FlxG.mouse.justReleased)
@@ -154,7 +154,7 @@ class UIState extends MusicBeatState {
}
public function openContextMenu(options:Array<UIContextMenuOption>, ?callback:UIContextMenuCallback, ?x:Float, ?y:Float, ?w:Int) {
FlxG.sound.play(Paths.sound('editors/windowAppear'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_WINDOWAPPEAR_SOUND));
var state = FlxG.state;
while(state.subState != null && !(state._requestSubStateReset && state._requestedSubState == null))
state = state.subState;
+4 -4
View File
@@ -110,7 +110,7 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
case RIGHT:
changeSelection(1);
case BACKSPACE:
FlxG.sound.play(Paths.sound('editors/textRemove'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_TEXTREMOVE_SOUND));
if (position > 0) {
label.text = label.text.substr(0, position-1) + label.text.substr(position);
changeSelection(-1);
@@ -120,7 +120,7 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
case END:
position = label.text.length;
case V:
FlxG.sound.play(Paths.sound('editors/textType'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_TEXTTYPE_SOUND));
// Hey lj here, fixed copying because before we checked if the modifier was left or right ctrl
// but somehow it gave a int outside of the KeyModifier's range :sob:
// apparently there is a boolean that just checks for you. yw :D
@@ -131,14 +131,14 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT);
if (data != null) onTextInput(data);
case C:
FlxG.sound.play(Paths.sound('editors/textType'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_TEXTTYPE_SOUND));
// if we are not holding ctrl, ignore
if (!modifier.ctrlKey) return;
// copying
Clipboard.generalClipboard.setData(TEXT_FORMAT, label.text);
default:
FlxG.sound.play(Paths.sound('editors/textType'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_TEXTTYPE_SOUND));
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ class UIWindow extends UISliceSprite {
content = new FlxTypedGroup<FlxBasic>();
members.push(content);
FlxG.sound.play(Paths.sound('editors/windowAppear'));
FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_WINDOWAPPEAR_SOUND));
}
public override function update(elapsed:Float) {