1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 15:37:49 +00:00

controllable sustain

This commit is contained in:
Cameron Taylor 2020-10-18 21:01:09 -07:00
parent 81612e2167
commit 414060eeb3

View file

@ -116,6 +116,7 @@ class ChartingState extends MusicBeatState
addSongUI(); addSongUI();
addSectionUI(); addSectionUI();
addNoteUI();
add(curRenderedNotes); add(curRenderedNotes);
add(curRenderedSustains); add(curRenderedSustains);
@ -231,6 +232,25 @@ class ChartingState extends MusicBeatState
UI_box.addGroup(tab_group_section); UI_box.addGroup(tab_group_section);
} }
var stepperSusLength:FlxUINumericStepper;
function addNoteUI():Void
{
var tab_group_note = new FlxUI(null, UI_box);
tab_group_note.name = 'Note';
stepperSusLength = new FlxUINumericStepper(10, 10, Conductor.stepCrochet / 2, 0, 0, Conductor.stepCrochet * 16);
stepperSusLength.value = 0;
stepperSusLength.name = 'note_susLength';
var applyLength:FlxButton = new FlxButton(100, 10, 'Apply');
tab_group_note.add(stepperSusLength);
tab_group_note.add(applyLength);
UI_box.addGroup(tab_group_note);
}
function loadSong(daSong:String):Void function loadSong(daSong:String):Void
{ {
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
@ -294,6 +314,11 @@ class ChartingState extends MusicBeatState
{ {
Conductor.changeBPM(Std.int(nums.value)); Conductor.changeBPM(Std.int(nums.value));
} }
else if (wname == 'note_susLength')
{
curSelectedNote[2] = nums.value;
updateGrid();
}
} }
// FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params); // FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params);
@ -332,10 +357,17 @@ class ChartingState extends MusicBeatState
curRenderedNotes.forEach(function(note:Note) curRenderedNotes.forEach(function(note:Note)
{ {
if (FlxG.mouse.overlaps(note)) if (FlxG.mouse.overlaps(note))
{
if (FlxG.keys.pressed.CONTROL)
{
selectNote(note);
}
else
{ {
trace('tryin to delete note...'); trace('tryin to delete note...');
deleteNote(note); deleteNote(note);
} }
}
}); });
} }
} }
@ -471,6 +503,11 @@ class ChartingState extends MusicBeatState
check_mustHitSection.checked = sec.mustHitSection; check_mustHitSection.checked = sec.mustHitSection;
} }
function updateNoteUI():Void
{
stepperSusLength.value = curSelectedNote[2];
}
function updateGrid():Void function updateGrid():Void
{ {
while (curRenderedNotes.members.length > 0) while (curRenderedNotes.members.length > 0)
@ -528,6 +565,24 @@ class ChartingState extends MusicBeatState
_song.notes.push(new Section(lengthInSteps)); _song.notes.push(new Section(lengthInSteps));
} }
function selectNote(note:Note):Void
{
var swagNum:Int = 0;
for (i in _song.notes[curSection].sectionNotes)
{
if (i.strumTime == note.strumTime && i.noteData % 4 == note.noteData)
{
curSelectedNote = _song.notes[curSection].sectionNotes[swagNum];
}
swagNum += 1;
}
updateGrid();
updateNoteUI();
}
function deleteNote(note:Note):Void function deleteNote(note:Note):Void
{ {
for (i in _song.notes[curSection].sectionNotes) for (i in _song.notes[curSection].sectionNotes)
@ -556,6 +611,7 @@ class ChartingState extends MusicBeatState
trace(curSection); trace(curSection);
updateGrid(); updateGrid();
updateNoteUI();
} }
function getStrumTime(yPos:Float):Float function getStrumTime(yPos:Float):Float