Added window to edit chart data, and added Scrollspeed to each StrumLine in chart data (#176)
* edit chart data, and per strumline scrollspeed * forgot to delete a few things uh * almost forgor this * Change strum speed back to charts when disabled * value instead of label * set max scroll speed to 10
This commit is contained in:
@@ -39,6 +39,7 @@ typedef ChartStrumLine = {
|
||||
var ?visible:Null<Bool>;
|
||||
var ?strumPos:Array<Float>;
|
||||
var ?strumScale:Float;
|
||||
var ?scrollSpeed:Float;
|
||||
|
||||
var ?strumLinePos:Float; // Backwards compatability
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import funkin.backend.chart.ChartData;
|
||||
import flixel.math.FlxPoint;
|
||||
import funkin.backend.chart.ChartData.ChartMetaData;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class ChartDataScreen extends UISubstateWindow {
|
||||
public var data:ChartData;
|
||||
public var saveButton:UIButton;
|
||||
public var closeButton:UIButton;
|
||||
|
||||
public var scrollSpeedStepper:UINumericStepper;
|
||||
public var stageBox:UITextBox;
|
||||
|
||||
public function new(data:ChartData) {
|
||||
super();
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public override function create() {
|
||||
FlxG.sound.music.pause();
|
||||
Charter.instance.vocals.pause();
|
||||
|
||||
function addLabelOn(ui:UISprite, text:String)
|
||||
add(new UIText(ui.x, ui.y - 24, 0, text));
|
||||
|
||||
winTitle = 'Editing chart data';
|
||||
winWidth = 420; winHeight = 69*4; // guys look, the funny numbers!
|
||||
|
||||
super.create();
|
||||
|
||||
scrollSpeedStepper = new UINumericStepper(windowSpr.x + 20, windowSpr.y + 60, data.scrollSpeed, 0.1, 2, 0, 10, 82);
|
||||
add(scrollSpeedStepper);
|
||||
addLabelOn(scrollSpeedStepper, "Scroll Speed");
|
||||
|
||||
stageBox = new UITextBox(scrollSpeedStepper.x, scrollSpeedStepper.y + 60, PlayState.SONG.stage);
|
||||
add(stageBox);
|
||||
addLabelOn(stageBox, "Stage");
|
||||
|
||||
saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() {
|
||||
onSave();
|
||||
close();
|
||||
}, 125);
|
||||
add(saveButton);
|
||||
|
||||
closeButton = new UIButton(saveButton.x - 20, saveButton.y, "Cancel", function() {
|
||||
close();
|
||||
}, 125);
|
||||
add(closeButton);
|
||||
closeButton.x -= closeButton.bWidth;
|
||||
}
|
||||
|
||||
public function onSave()
|
||||
{
|
||||
PlayState.SONG.stage = stageBox.label.text;
|
||||
PlayState.SONG.scrollSpeed = scrollSpeedStepper.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -201,6 +201,11 @@ class Charter extends UIState {
|
||||
{
|
||||
label: "Edit metadata information",
|
||||
onSelect: chart_edit_metadata
|
||||
},
|
||||
null,
|
||||
{
|
||||
label: "Edit chart data",
|
||||
onSelect: chart_edit_data
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1085,6 +1090,8 @@ class Charter extends UIState {
|
||||
}
|
||||
function chart_edit_metadata(_)
|
||||
FlxG.state.openSubState(new MetaDataScreen(PlayState.SONG.meta));
|
||||
function chart_edit_data(_)
|
||||
FlxG.state.openSubState(new ChartDataScreen(PlayState.SONG));
|
||||
|
||||
function _playback_metronome(t) {
|
||||
t.icon = (Options.charterMetronomeEnabled = !Options.charterMetronomeEnabled) ? 1 : 0;
|
||||
|
||||
@@ -16,6 +16,8 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
public var hudScaleStepper:UINumericStepper;
|
||||
public var hudXStepper:UINumericStepper;
|
||||
public var hudYStepper:UINumericStepper;
|
||||
public var scrollSpeedStepper:UINumericStepper;
|
||||
public var usesChartscrollSpeed:UICheckbox;
|
||||
|
||||
public var characterIcons:Array<HealthIcon> = [];
|
||||
|
||||
@@ -44,7 +46,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
};
|
||||
|
||||
winTitle = creatingStrumLine ? 'Creating Strumline #$strumLineID' : 'Strumline #$strumLineID properties';
|
||||
winWidth = 690; winHeight = 334;
|
||||
winWidth = 690; winHeight = 390;
|
||||
|
||||
FlxG.sound.music.pause();
|
||||
Charter.instance.vocals.pause();
|
||||
@@ -70,6 +72,37 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
add(typeDropdown);
|
||||
addLabelOn(typeDropdown, "Type");
|
||||
|
||||
usesChartscrollSpeed = new UICheckbox(typeDropdown.x + 200 - 32 + 26, typeDropdown.y + 32 + 58, "Uses charts scroll speed?", strumLine.scrollSpeed == null);
|
||||
usesChartscrollSpeed.onChecked = function(b) {
|
||||
if(b)
|
||||
{
|
||||
scrollSpeedStepper.alpha = 0.4;
|
||||
scrollSpeedStepper.label.alpha = 0.4;
|
||||
scrollSpeedStepper.value = PlayState.SONG.scrollSpeed;
|
||||
scrollSpeedStepper.active = false;
|
||||
} else {
|
||||
scrollSpeedStepper.alpha = 1;
|
||||
scrollSpeedStepper.label.alpha = 1;
|
||||
scrollSpeedStepper.active = true;
|
||||
}
|
||||
|
||||
}
|
||||
add(usesChartscrollSpeed);
|
||||
|
||||
scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 32 + 58, usesChartscrollSpeed.checked ? PlayState.SONG.scrollSpeed : strumLine.scrollSpeed, 0.1, 2, 0, 10, 82);
|
||||
if(usesChartscrollSpeed.checked)
|
||||
{
|
||||
scrollSpeedStepper.alpha = 0.4;
|
||||
scrollSpeedStepper.label.alpha = 0.4;
|
||||
scrollSpeedStepper.active = false;
|
||||
} else {
|
||||
scrollSpeedStepper.alpha = 1;
|
||||
scrollSpeedStepper.label.alpha = 1;
|
||||
scrollSpeedStepper.active = true;
|
||||
}
|
||||
add(scrollSpeedStepper);
|
||||
addLabelOn(scrollSpeedStepper, "Scroll Speed");
|
||||
|
||||
var stagePositionI = strumLine.position == null ? strumLine.type : ["DAD", "BOYFRIEND", "GIRLFRIEND"].indexOf(strumLine.position.toUpperCase());
|
||||
|
||||
stagePositionDropdown = new UIDropDown(typeDropdown.x + 200 - 32 + 26, typeDropdown.y, 200, 32, ["DAD", "BOYFRIEND", "GIRLFRIEND"], stagePositionI);
|
||||
@@ -144,6 +177,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
strumPos: [hudXStepper.value, hudYStepper.value],
|
||||
strumScale: hudScaleStepper.value
|
||||
};
|
||||
if(!usesChartscrollSpeed.checked) strumLine.scrollSpeed = scrollSpeedStepper.value;
|
||||
if (onSave != null) onSave(strumLine);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,10 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
animPrefix = strumAnimPrefix[i % strumAnimPrefix.length];
|
||||
var babyArrow:Strum = new Strum(startingPos.x + ((Note.swagWidth * strumScale) * i), startingPos.y);
|
||||
babyArrow.ID = i;
|
||||
|
||||
|
||||
if(data.scrollSpeed != null)
|
||||
babyArrow.scrollSpeed = data.scrollSpeed;
|
||||
|
||||
var event = PlayState.instance.scripts.event("onStrumCreation", EventManager.get(StrumCreationEvent).recycle(babyArrow, PlayState.instance.strumLines.members.indexOf(this), i, animPrefix));
|
||||
|
||||
if (!event.cancelled) {
|
||||
|
||||
Reference in New Issue
Block a user