Moved editor options to a separate window, added some editor features (read desc)
-Added grid sub-divisions up to 4, implemented for both mouse editing and number key editing -Made a separate editor options window that contains: *Amount of sub-divisions *Snap to grid checkbox (now holding shift cancels out the check box) *Play hitsounds checkbox *Mute instrumental checkbox
This commit is contained in:
parent
5c0124f398
commit
1fd6cdde91
File diff suppressed because one or more lines are too long
@ -49,6 +49,7 @@ class ChartingState extends MusicBeatState
|
||||
public var snap:Int = 1;
|
||||
|
||||
var UI_box:FlxUITabMenu;
|
||||
var UI_options:FlxUITabMenu;
|
||||
|
||||
/**
|
||||
* Array of notes showing when each section STARTS in STEPS
|
||||
@ -69,6 +70,9 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
var GRID_SIZE:Int = 40;
|
||||
|
||||
var subDivisions:Float = 1;
|
||||
var defaultSnap:Bool = true;
|
||||
|
||||
var dummyArrow:FlxSprite;
|
||||
|
||||
var curRenderedNotes:FlxTypedGroup<Note>;
|
||||
@ -131,8 +135,10 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
blackBorder.alpha = 0.3;
|
||||
|
||||
/*
|
||||
snapText = new FlxText(60,10,0,"Snap: 1/" + snap + " (Press SHIFT to unsnap the cursor)\nAdd Notes: 1-8 (or click)\nDiff: 0", 14);
|
||||
snapText.scrollFactor.set();
|
||||
*/
|
||||
|
||||
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
|
||||
add(gridBlackLine);
|
||||
@ -187,21 +193,35 @@ class ChartingState extends MusicBeatState
|
||||
];
|
||||
|
||||
UI_box = new FlxUITabMenu(null, tabs, true);
|
||||
|
||||
|
||||
UI_box.scrollFactor.set();
|
||||
UI_box.resize(300, 400);
|
||||
UI_box.x = FlxG.width / 2 + 40;
|
||||
UI_box.y = 20;
|
||||
add(UI_box);
|
||||
|
||||
var opt_tabs = [{name: "Options", label:'Editor Options'}];
|
||||
|
||||
UI_options = new FlxUITabMenu(null, opt_tabs, true);
|
||||
|
||||
UI_options.scrollFactor.set();
|
||||
UI_options.selected_tab = 0;
|
||||
UI_options.resize(300, 200);
|
||||
UI_options.x = UI_box.x;
|
||||
UI_options.y = FlxG.height - 300;
|
||||
add(UI_options);
|
||||
|
||||
addSongUI();
|
||||
addSectionUI();
|
||||
addNoteUI();
|
||||
|
||||
addOptionsUI();
|
||||
|
||||
add(curRenderedNotes);
|
||||
add(curRenderedSustains);
|
||||
|
||||
add(blackBorder);
|
||||
add(snapText);
|
||||
//add(snapText);
|
||||
|
||||
|
||||
|
||||
@ -210,10 +230,65 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
function addGrid(?divisions:Float = 1)
|
||||
{
|
||||
// This here is because non-integer numbers aren't supported as grid sizes, making the grid slowly 'drift' as it goes on
|
||||
var h = GRID_SIZE / divisions;
|
||||
if (Math.floor(h) != h)
|
||||
h = GRID_SIZE;
|
||||
|
||||
remove(gridBG);
|
||||
gridBG = FlxGridOverlay.create(GRID_SIZE, Std.int(GRID_SIZE / divisions), GRID_SIZE * 8, GRID_SIZE * 16);
|
||||
gridBG = FlxGridOverlay.create(GRID_SIZE, Std.int(h), GRID_SIZE * 8, GRID_SIZE * 16);
|
||||
add(gridBG);
|
||||
}
|
||||
|
||||
var stepperDiv:FlxUINumericStepper;
|
||||
var check_snap:FlxUICheckBox;
|
||||
function addOptionsUI()
|
||||
{
|
||||
stepperDiv = new FlxUINumericStepper(10, 26, 1, subDivisions, 1, 4);
|
||||
stepperDiv.value = 0;
|
||||
stepperDiv.name = 'divisions';
|
||||
|
||||
var stepperDivLabel = new FlxText(8, 10, 'Grid sub-divisions');
|
||||
|
||||
var hitsounds = new FlxUICheckBox(10, 60, null, null, "Play hitsounds", 100);
|
||||
hitsounds.checked = false;
|
||||
hitsounds.callback = function()
|
||||
{
|
||||
playClaps = hitsounds.checked;
|
||||
};
|
||||
|
||||
var check_mute_inst = new FlxUICheckBox(10, 90, null, null, "Mute Instrumental", 100);
|
||||
check_mute_inst.checked = false;
|
||||
check_mute_inst.callback = function()
|
||||
{
|
||||
var vol:Float = 1;
|
||||
|
||||
if (check_mute_inst.checked)
|
||||
vol = 0;
|
||||
|
||||
FlxG.sound.music.volume = vol;
|
||||
};
|
||||
|
||||
check_snap = new FlxUICheckBox(80, 25, null, null, "Snap to grid", 100);
|
||||
check_snap.checked = defaultSnap;
|
||||
// _song.needsVoices = check_voices.checked;
|
||||
check_snap.callback = function()
|
||||
{
|
||||
defaultSnap = check_snap.checked;
|
||||
trace('CHECKED!');
|
||||
};
|
||||
|
||||
var tab_options = new FlxUI(null, UI_options);
|
||||
tab_options.name = "Options";
|
||||
tab_options.add(stepperDiv);
|
||||
tab_options.add(stepperDivLabel);
|
||||
tab_options.add(check_snap);
|
||||
tab_options.add(hitsounds);
|
||||
tab_options.add(check_mute_inst);
|
||||
|
||||
UI_options.addGroup(tab_options);
|
||||
}
|
||||
|
||||
function addSongUI():Void
|
||||
{
|
||||
var UI_songTitle = new FlxUIInputText(10, 10, 70, _song.song, 8);
|
||||
@ -228,18 +303,6 @@ class ChartingState extends MusicBeatState
|
||||
trace('CHECKED!');
|
||||
};
|
||||
|
||||
var check_mute_inst = new FlxUICheckBox(10, 200, null, null, "Mute Instrumental (in editor)", 100);
|
||||
check_mute_inst.checked = false;
|
||||
check_mute_inst.callback = function()
|
||||
{
|
||||
var vol:Float = 1;
|
||||
|
||||
if (check_mute_inst.checked)
|
||||
vol = 0;
|
||||
|
||||
FlxG.sound.music.volume = vol;
|
||||
};
|
||||
|
||||
var saveButton:FlxButton = new FlxButton(110, 8, "Save", function()
|
||||
{
|
||||
saveLevel();
|
||||
@ -291,14 +354,6 @@ class ChartingState extends MusicBeatState
|
||||
stepperSongVol.value = FlxG.sound.music.volume;
|
||||
stepperSongVol.name = 'song_instvol';
|
||||
|
||||
|
||||
var hitsounds = new FlxUICheckBox(10, stepperSongVol.y + 60, null, null, "Play hitsounds", 100);
|
||||
hitsounds.checked = false;
|
||||
hitsounds.callback = function()
|
||||
{
|
||||
playClaps = hitsounds.checked;
|
||||
};
|
||||
|
||||
var stepperSongVolLabel = new FlxText(74, 110, 'Instrumental Volume');
|
||||
|
||||
|
||||
@ -367,7 +422,7 @@ class ChartingState extends MusicBeatState
|
||||
tab_group_song.add(UI_songTitle);
|
||||
tab_group_song.add(restart);
|
||||
tab_group_song.add(check_voices);
|
||||
tab_group_song.add(check_mute_inst);
|
||||
//tab_group_song.add(check_mute_inst);
|
||||
tab_group_song.add(saveButton);
|
||||
tab_group_song.add(reloadSong);
|
||||
tab_group_song.add(reloadSongJson);
|
||||
@ -387,7 +442,7 @@ class ChartingState extends MusicBeatState
|
||||
tab_group_song.add(shiftNoteDialLabel3);
|
||||
tab_group_song.add(stepperShiftNoteDialms);
|
||||
tab_group_song.add(shiftNoteButton);
|
||||
tab_group_song.add(hitsounds);
|
||||
//tab_group_song.add(hitsounds);
|
||||
|
||||
var tab_group_assets = new FlxUI(null, UI_box);
|
||||
tab_group_assets.name = "Assets";
|
||||
@ -404,7 +459,6 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
UI_box.addGroup(tab_group_song);
|
||||
UI_box.addGroup(tab_group_assets);
|
||||
UI_box.scrollFactor.set();
|
||||
|
||||
camFollow = new FlxObject(280, 0, 1, 1);
|
||||
add(camFollow);
|
||||
@ -458,7 +512,7 @@ class ChartingState extends MusicBeatState
|
||||
check_mustHitSection.checked = true;
|
||||
// _song.needsVoices = check_mustHit.checked;
|
||||
|
||||
check_altAnim = new FlxUICheckBox(10, 400, null, null, "Alternate Animation", 100);
|
||||
check_altAnim = new FlxUICheckBox(10, 340, null, null, "Alternate Animation", 100);
|
||||
check_altAnim.name = 'check_altAnim';
|
||||
|
||||
check_changeBPM = new FlxUICheckBox(10, 60, null, null, 'Change BPM', 100);
|
||||
@ -586,53 +640,55 @@ class ChartingState extends MusicBeatState
|
||||
var nums:FlxUINumericStepper = cast sender;
|
||||
var wname = nums.name;
|
||||
FlxG.log.add(wname);
|
||||
if (wname == 'section_length')
|
||||
{
|
||||
if (nums.value <= 4)
|
||||
nums.value = 4;
|
||||
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
|
||||
updateGrid();
|
||||
}
|
||||
else if (wname == 'song_speed')
|
||||
{
|
||||
if (nums.value <= 0)
|
||||
nums.value = 0;
|
||||
_song.speed = nums.value;
|
||||
}
|
||||
else if (wname == 'song_bpm')
|
||||
{
|
||||
if (nums.value <= 0)
|
||||
nums.value = 1;
|
||||
tempBpm = Std.int(nums.value);
|
||||
Conductor.mapBPMChanges(_song);
|
||||
Conductor.changeBPM(Std.int(nums.value));
|
||||
}
|
||||
else if (wname == 'note_susLength')
|
||||
{
|
||||
if (curSelectedNote == null)
|
||||
return;
|
||||
|
||||
if (nums.value <= 0)
|
||||
nums.value = 0;
|
||||
curSelectedNote[2] = nums.value;
|
||||
updateGrid();
|
||||
}
|
||||
else if (wname == 'section_bpm')
|
||||
switch (wname)
|
||||
{
|
||||
if (nums.value <= 0.1)
|
||||
nums.value = 0.1;
|
||||
_song.notes[curSection].bpm = Std.int(nums.value);
|
||||
updateGrid();
|
||||
}else if (wname == 'song_vocalvol')
|
||||
{
|
||||
if (nums.value <= 0.1)
|
||||
nums.value = 0.1;
|
||||
vocals.volume = nums.value;
|
||||
}else if (wname == 'song_instvol')
|
||||
{
|
||||
if (nums.value <= 0.1)
|
||||
nums.value = 0.1;
|
||||
FlxG.sound.music.volume = nums.value;
|
||||
case 'section_length':
|
||||
if (nums.value <= 4)
|
||||
nums.value = 4;
|
||||
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
|
||||
updateGrid();
|
||||
|
||||
case 'song_speed':
|
||||
if (nums.value <= 0)
|
||||
nums.value = 0;
|
||||
_song.speed = nums.value;
|
||||
|
||||
case 'song_bpm':
|
||||
if (nums.value <= 0)
|
||||
nums.value = 1;
|
||||
tempBpm = Std.int(nums.value);
|
||||
Conductor.mapBPMChanges(_song);
|
||||
Conductor.changeBPM(Std.int(nums.value));
|
||||
|
||||
case 'note_susLength':
|
||||
if (curSelectedNote == null)
|
||||
return;
|
||||
|
||||
if (nums.value <= 0)
|
||||
nums.value = 0;
|
||||
curSelectedNote[2] = nums.value;
|
||||
updateGrid();
|
||||
|
||||
case 'section_bpm':
|
||||
if (nums.value <= 0.1)
|
||||
nums.value = 0.1;
|
||||
_song.notes[curSection].bpm = Std.int(nums.value);
|
||||
updateGrid();
|
||||
|
||||
case 'song_vocalvol':
|
||||
if (nums.value <= 0.1)
|
||||
nums.value = 0.1;
|
||||
vocals.volume = nums.value;
|
||||
|
||||
case 'song_instvol':
|
||||
if (nums.value <= 0.1)
|
||||
nums.value = 0.1;
|
||||
FlxG.sound.music.volume = nums.value;
|
||||
|
||||
case 'divisions':
|
||||
subDivisions = nums.value;
|
||||
updateGrid();
|
||||
}
|
||||
}
|
||||
|
||||
@ -679,7 +735,7 @@ class ChartingState extends MusicBeatState
|
||||
{
|
||||
updateHeads();
|
||||
|
||||
snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable" : "Snap Disabled, Shift to renable. It's a bit buggy") + ")\nAdd Notes: 1-8 (or click)";
|
||||
//snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable" : "Snap Disabled, Shift to renable. It's a bit buggy") + ")\nAdd Notes: 1-8 (or click)";
|
||||
|
||||
curStep = recalculateSteps();
|
||||
|
||||
@ -691,9 +747,18 @@ class ChartingState extends MusicBeatState
|
||||
snap = 192;
|
||||
if (snap <= 1)
|
||||
snap = 1;*/
|
||||
|
||||
/*
|
||||
if (FlxG.keys.justPressed.SHIFT)
|
||||
doSnapShit = !doSnapShit;
|
||||
*/
|
||||
|
||||
doSnapShit = defaultSnap;
|
||||
if (FlxG.keys.pressed.SHIFT)
|
||||
{
|
||||
doSnapShit = !defaultSnap;
|
||||
}
|
||||
|
||||
check_snap.checked = doSnapShit;
|
||||
|
||||
Conductor.songPosition = FlxG.sound.music.time;
|
||||
_song.song = typingShit.text;
|
||||
@ -872,11 +937,20 @@ class ChartingState extends MusicBeatState
|
||||
&& FlxG.mouse.y > gridBG.y
|
||||
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps))
|
||||
{
|
||||
dummyArrow.visible = true;
|
||||
|
||||
dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE;
|
||||
if (FlxG.keys.pressed.SHIFT)
|
||||
dummyArrow.y = FlxG.mouse.y;
|
||||
|
||||
var div_by:Float = GRID_SIZE / subDivisions;
|
||||
|
||||
if (doSnapShit)
|
||||
dummyArrow.y = Math.floor(FlxG.mouse.y / div_by) * div_by;
|
||||
else
|
||||
dummyArrow.y = Math.floor(FlxG.mouse.y / GRID_SIZE) * GRID_SIZE;
|
||||
dummyArrow.y = FlxG.mouse.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
dummyArrow.visible = false;
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER)
|
||||
@ -988,11 +1062,12 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
trace(increase + " - " + curStep + " - " + (curStep + increase));
|
||||
|
||||
curStep += increase;
|
||||
// *Maybe a pre-snap goes here but I don't really know, I don't chart with number keys
|
||||
FlxG.sound.music.time += (increase * Conductor.stepCrochet) / subDivisions;
|
||||
|
||||
var stepMs = curStep * Conductor.stepCrochet;
|
||||
var msStep = FlxG.sound.music.time / Conductor.stepCrochet;
|
||||
|
||||
FlxG.sound.music.time = stepMs;
|
||||
curStep = Std.int(msStep);
|
||||
}
|
||||
else
|
||||
FlxG.sound.music.time -= (amount * Conductor.stepCrochet * 0.4);
|
||||
@ -1208,9 +1283,9 @@ class ChartingState extends MusicBeatState
|
||||
stepperSusLength.value = curSelectedNote[2];
|
||||
}
|
||||
|
||||
function updateGrid(?divisions:Float = 1):Void
|
||||
function updateGrid():Void
|
||||
{
|
||||
addGrid(divisions);
|
||||
addGrid(subDivisions);
|
||||
|
||||
remove(gridBlackLine);
|
||||
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user