mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-23 21:56:46 +00:00
hold assets are updated aswell
This commit is contained in:
parent
b6eda8e498
commit
328e590f92
|
@ -140,7 +140,11 @@ class NoteSprite extends FunkinSprite
|
|||
this.active = false;
|
||||
}
|
||||
|
||||
function setupNoteGraphic(noteStyle:NoteStyle):Void
|
||||
/**
|
||||
* Creates frames and animations
|
||||
* @param noteStyle The `NoteStyle` instance
|
||||
*/
|
||||
public function setupNoteGraphic(noteStyle:NoteStyle):Void
|
||||
{
|
||||
noteStyle.buildNoteSprite(this);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import funkin.data.song.SongData.SongNoteData;
|
|||
import funkin.ui.options.PreferencesMenu;
|
||||
import funkin.util.SortUtil;
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.play.notes.notekind.NoteKindManager;
|
||||
|
||||
/**
|
||||
* A group of sprites which handles the receptor, the note splashes, and the notes (with sustains) for a given player.
|
||||
|
@ -708,6 +709,9 @@ class Strumline extends FlxSpriteGroup
|
|||
|
||||
if (noteSprite != null)
|
||||
{
|
||||
var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind) ?? this.noteStyle;
|
||||
noteSprite.setupNoteGraphic(noteKindStyle);
|
||||
|
||||
noteSprite.direction = note.getDirection();
|
||||
noteSprite.noteData = note;
|
||||
|
||||
|
@ -727,6 +731,9 @@ class Strumline extends FlxSpriteGroup
|
|||
|
||||
if (holdNoteSprite != null)
|
||||
{
|
||||
var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind) ?? this.noteStyle;
|
||||
holdNoteSprite.setupHoldNoteGraphic(noteKindStyle);
|
||||
|
||||
holdNoteSprite.parentStrumline = this;
|
||||
holdNoteSprite.noteData = note;
|
||||
holdNoteSprite.strumTime = note.time;
|
||||
|
|
|
@ -99,7 +99,27 @@ class SustainTrail extends FlxSprite
|
|||
*/
|
||||
public function new(noteDirection:NoteDirection, sustainLength:Float, noteStyle:NoteStyle)
|
||||
{
|
||||
super(0, 0, noteStyle.getHoldNoteAssetPath());
|
||||
super(0, 0);
|
||||
|
||||
// BASIC SETUP
|
||||
this.sustainLength = sustainLength;
|
||||
this.fullSustainLength = sustainLength;
|
||||
this.noteDirection = noteDirection;
|
||||
|
||||
setupHoldNoteGraphic(noteStyle);
|
||||
|
||||
indices = new DrawData<Int>(12, true, TRIANGLE_VERTEX_INDICES);
|
||||
|
||||
this.active = true; // This NEEDS to be true for the note to be drawn!
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates hold note graphic and applies correct zooming
|
||||
* @param noteStyle The note style
|
||||
*/
|
||||
public function setupHoldNoteGraphic(noteStyle:NoteStyle):Void
|
||||
{
|
||||
loadGraphic(noteStyle.getHoldNoteAssetPath());
|
||||
|
||||
antialiasing = true;
|
||||
|
||||
|
@ -109,13 +129,9 @@ class SustainTrail extends FlxSprite
|
|||
endOffset = bottomClip = 1;
|
||||
antialiasing = false;
|
||||
}
|
||||
|
||||
zoom = 1.0;
|
||||
zoom *= noteStyle.fetchHoldNoteScale();
|
||||
|
||||
// BASIC SETUP
|
||||
this.sustainLength = sustainLength;
|
||||
this.fullSustainLength = sustainLength;
|
||||
this.noteDirection = noteDirection;
|
||||
|
||||
zoom *= 0.7;
|
||||
|
||||
// CALCULATE SIZE
|
||||
|
@ -131,9 +147,6 @@ class SustainTrail extends FlxSprite
|
|||
updateColorTransform();
|
||||
|
||||
updateClipping();
|
||||
indices = new DrawData<Int>(12, true, TRIANGLE_VERTEX_INDICES);
|
||||
|
||||
this.active = true; // This NEEDS to be true for the note to be drawn!
|
||||
}
|
||||
|
||||
function getBaseScrollSpeed()
|
||||
|
@ -195,6 +208,11 @@ class SustainTrail extends FlxSprite
|
|||
*/
|
||||
public function updateClipping(songTime:Float = 0):Void
|
||||
{
|
||||
if (graphic == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var clipHeight:Float = FlxMath.bound(sustainHeight(sustainLength - (songTime - strumTime), parentStrumline?.scrollSpeed ?? 1.0), 0, graphicHeight);
|
||||
if (clipHeight <= 0.1)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package funkin.play.notes.notekind;
|
||||
|
||||
import funkin.data.notestyle.NoteStyleRegistry;
|
||||
import funkin.play.notes.notestyle.NoteStyle;
|
||||
import funkin.modding.IScriptedClass.INoteScriptedClass;
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
|
||||
|
@ -11,19 +9,25 @@ import funkin.modding.events.ScriptEvent;
|
|||
class NoteKind implements INoteScriptedClass
|
||||
{
|
||||
/**
|
||||
* the name of the note kind
|
||||
* The name of the note kind
|
||||
*/
|
||||
public var noteKind:String;
|
||||
|
||||
/**
|
||||
* description used in chart editor
|
||||
* Description used in chart editor
|
||||
*/
|
||||
public var description:String = "";
|
||||
public var description:String;
|
||||
|
||||
public function new(noteKind:String, description:String = "")
|
||||
/**
|
||||
* Custom note style
|
||||
*/
|
||||
public var noteStyleId:String;
|
||||
|
||||
public function new(noteKind:String, description:String = "", noteStyleId:String = "")
|
||||
{
|
||||
this.noteKind = noteKind;
|
||||
this.description = description;
|
||||
this.noteStyleId = noteStyleId;
|
||||
}
|
||||
|
||||
public function toString():String
|
||||
|
@ -31,23 +35,6 @@ class NoteKind implements INoteScriptedClass
|
|||
return noteKind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the note style of the given note. Use this in `onNoteIncoming`
|
||||
* @param note
|
||||
* @param noteStyle
|
||||
*/
|
||||
function setNoteStyle(note:NoteSprite, noteStyleId:String):Void
|
||||
{
|
||||
var noteStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyleId);
|
||||
noteStyle.buildNoteSprite(note);
|
||||
|
||||
note.setGraphicSize(Strumline.STRUMLINE_SIZE);
|
||||
note.updateHitbox();
|
||||
|
||||
// this calls the setter for playing the correct animation
|
||||
note.direction = note.direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all notes of this kind
|
||||
* @return Array<NoteSprite>
|
||||
|
|
|
@ -3,6 +3,8 @@ package funkin.play.notes.notekind;
|
|||
import funkin.modding.events.ScriptEventDispatcher;
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.ui.debug.charting.util.ChartEditorDropdowns;
|
||||
import funkin.data.notestyle.NoteStyleRegistry;
|
||||
import funkin.play.notes.notestyle.NoteStyle;
|
||||
|
||||
class NoteKindManager
|
||||
{
|
||||
|
@ -44,7 +46,7 @@ class NoteKindManager
|
|||
{
|
||||
var noteEvent:NoteScriptEvent = cast(event, NoteScriptEvent);
|
||||
|
||||
var noteKind:NoteKind = noteKinds.get(noteEvent.note.noteData.kind);
|
||||
var noteKind:NoteKind = noteKinds.get(noteEvent.note.kind);
|
||||
|
||||
if (noteKind != null)
|
||||
{
|
||||
|
@ -59,4 +61,16 @@ class NoteKindManager
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the note style from the given note kind
|
||||
* @param noteKind note kind name
|
||||
* @return NoteStyle
|
||||
*/
|
||||
public static function getNoteStyle(noteKind:String):Null<NoteStyle>
|
||||
{
|
||||
var noteStyleId:String = noteKinds.get(noteKind)?.noteStyleId ?? "";
|
||||
|
||||
return NoteStyleRegistry.instance.fetchEntry(noteStyleId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue