Fix 5 or 6 issues with charting

This commit is contained in:
EliteMasterEric
2023-02-28 13:17:28 -05:00
parent 8c002393e3
commit 20e6c7a2be
6 changed files with 206 additions and 170 deletions
@@ -1,7 +1,6 @@
package funkin.ui.debug.charting;
import flixel.FlxObject;
import flixel.FlxBasic;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxFramesCollection;
import flixel.graphics.frames.FlxTileFrames;
@@ -14,6 +13,14 @@ import funkin.play.song.SongData.SongNoteData;
*/
class ChartEditorNoteSprite extends FlxSprite
{
/**
* The list of available note skin to validate against.
*/
public static final NOTE_STYLES:Array<String> = ['Normal', 'Pixel'];
/**
* The ChartEditorState this note belongs to.
*/
public var parentState:ChartEditorState;
/**
@@ -22,6 +29,11 @@ class ChartEditorNoteSprite extends FlxSprite
*/
public var noteData(default, set):SongNoteData;
/**
* The name of the note style currently in use.
*/
public var noteStyle(get, null):String;
/**
* This note is the previous sprite in a sustain chain.
*/
@@ -222,14 +234,20 @@ class ChartEditorNoteSprite extends FlxSprite
return this.childNoteSprite;
}
public function playNoteAnimation()
function get_noteStyle():String
{
// Fall back to 'Normal' if it's not a valid note style.
return if (NOTE_STYLES.contains(this.parentState.currentSongNoteSkin)) this.parentState.currentSongNoteSkin else 'Normal';
}
public function playNoteAnimation():Void
{
// Decide whether to display a note or a sustain.
var baseAnimationName:String = 'tap';
if (this.parentNoteSprite != null) baseAnimationName = (this.childNoteSprite != null) ? 'hold' : 'holdEnd';
// Play the appropriate animation for the type, direction, and skin.
var animationName = '${baseAnimationName}${this.noteData.getDirectionName()}${this.parentState.currentSongNoteSkin}';
var animationName:String = '${baseAnimationName}${this.noteData.getDirectionName()}${this.noteStyle}';
this.animation.play(animationName);