Fix New-Conductor
This commit is contained in:
@@ -90,7 +90,9 @@ class Flags {
|
||||
public static var DEFAULT_GAMEOVER_LOSS_SFX:String = "gameOverSFX";
|
||||
public static var DEFAULT_GAMEOVER_RETRY_SFX:String = "gameOverEnd";
|
||||
|
||||
public static var DEFAULT_CAM_ZOOM_INTERVAL:Int = 4;
|
||||
public static var DEFAULT_CAM_ZOOM_INTERVAL:Int = 1;
|
||||
public static var DEFAULT_CAM_ZOOM_OFFSET:Float = 0;
|
||||
//public static var DEFAULT_CAM_ZOOM_EVERY:BeatType = MEASURE;
|
||||
public static var DEFAULT_CAM_ZOOM_STRENGTH:Int = 1;
|
||||
public static var DEFAULT_CAM_ZOOM:Float = 1.05; // what zoom level it defaults to
|
||||
public static var DEFAULT_HUD_ZOOM:Float = 1.0;
|
||||
|
||||
@@ -9,6 +9,7 @@ import funkin.backend.chart.ChartData;
|
||||
import funkin.backend.system.Conductor;
|
||||
import funkin.backend.system.framerate.Framerate;
|
||||
import funkin.editors.charter.CharterBackdropGroup.CharterBackdropDummy;
|
||||
import funkin.editors.charter.CharterBackdropGroup.CharterGridSeperatorBase;
|
||||
import funkin.editors.charter.CharterBackdropGroup.EventBackdrop;
|
||||
import funkin.editors.charter.CharterStrumline;
|
||||
import funkin.editors.ui.UIContextMenu.UIContextMenuOption;
|
||||
|
||||
@@ -82,12 +82,12 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
else {
|
||||
chartEvent.events = [for (i in eventsList.buttons.members) i.event];
|
||||
chartEvent.refreshEventIcons();
|
||||
Charter.instance.updateBPMEvents();
|
||||
|
||||
Charter.undos.addToUndo(CEditEvent(chartEvent, oldEvents, [for (event in events) Reflect.copy(event)]));
|
||||
}
|
||||
}
|
||||
|
||||
Charter.instance.updateBPMEvents();
|
||||
close();
|
||||
});
|
||||
saveButton.x -= saveButton.bWidth;
|
||||
@@ -112,17 +112,23 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
|
||||
// destroy old elements
|
||||
paramsFields = [];
|
||||
while(paramsPanel.members.length > 0) {
|
||||
var e = paramsPanel.members.pop();
|
||||
if(e != null) {
|
||||
e.destroy();
|
||||
}
|
||||
for(e in paramsPanel) {
|
||||
e.destroy();
|
||||
paramsPanel.remove(e);
|
||||
}
|
||||
|
||||
if (id >= 0 && id < events.length) {
|
||||
curEvent = id;
|
||||
var curEvent = events[curEvent];
|
||||
eventName.text = curEvent.name;
|
||||
// add new elements
|
||||
var y:Float = eventName.y + eventName.height + 10;
|
||||
for(k=>param in EventsData.getEventParams(curEvent.name)) {
|
||||
function addLabel() {
|
||||
var label:UIText = new UIText(eventName.x, y, 0, param.name);
|
||||
y += label.height + 4;
|
||||
paramsPanel.add(label);
|
||||
};
|
||||
|
||||
var value:Dynamic = CoolUtil.getDefault(curEvent.params[k], param.defValue);
|
||||
var lastAdded = switch(param.type) {
|
||||
@@ -193,88 +199,6 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
}
|
||||
}
|
||||
|
||||
function generateEventUI(event:ChartEvent):Void {
|
||||
var script = CharterEvent.getUIScript(event, "event-ui");
|
||||
if(script != null && !(script is DummyScript)) {
|
||||
script.set("paramsPanel", paramsPanel);
|
||||
script.set("paramsFields", paramsFields);
|
||||
if(script.get("generateUI") != null) {
|
||||
if(script.call("generateUI") == false)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// add new elements
|
||||
var _y:Float = eventName.y + eventName.height + 10;
|
||||
var params = EventsData.getEventParams(event.name);
|
||||
for(k=>param in params) {
|
||||
var x = eventName.x + (param.x == null ? 0 : param.x);
|
||||
var y = (param.y == null ? _y : param.y);
|
||||
|
||||
function addLabel() {
|
||||
var label:UIText = new UIText(x, y, 0, param.name);
|
||||
_y += label.height + 4;
|
||||
y += label.height + 4;
|
||||
paramsPanel.add(label);
|
||||
};
|
||||
|
||||
var value:Dynamic = CoolUtil.getDefault(event.params[k], param.defValue);
|
||||
var lastAdded = switch(param.type) {
|
||||
case TString:
|
||||
addLabel();
|
||||
var textBox:UITextBox = new UITextBox(x, y, cast value);
|
||||
paramsPanel.add(textBox); paramsFields.push(textBox);
|
||||
textBox;
|
||||
case TBool:
|
||||
var checkbox = new UICheckbox(x, y, param.name, cast value);
|
||||
paramsPanel.add(checkbox); paramsFields.push(checkbox);
|
||||
checkbox;
|
||||
case TInt(min, max, step):
|
||||
addLabel();
|
||||
var numericStepper = new UINumericStepper(x, y, cast value, CoolUtil.getDefault(step, 1), 0, min, max);
|
||||
paramsPanel.add(numericStepper); paramsFields.push(numericStepper);
|
||||
numericStepper;
|
||||
case TFloat(min, max, step, precision):
|
||||
addLabel();
|
||||
var numericStepper = new UINumericStepper(x, y, cast value, CoolUtil.getDefault(step, 1), precision, min, max);
|
||||
paramsPanel.add(numericStepper); paramsFields.push(numericStepper);
|
||||
numericStepper;
|
||||
case TStrumLine:
|
||||
addLabel();
|
||||
var dropdown = new UIDropDown(x, y, 320, 32, [
|
||||
for(k=>s in cast(FlxG.state, Charter).strumLines.members)
|
||||
'Strumline #${k+1} (${s.strumLine.characters[0]})'
|
||||
], cast value);
|
||||
paramsPanel.add(dropdown); paramsFields.push(dropdown);
|
||||
dropdown;
|
||||
case TColorWheel:
|
||||
addLabel();
|
||||
var colorWheel = new UIColorwheel(x, y, CoolUtil.getColorFromDynamic(value));
|
||||
paramsPanel.add(colorWheel); paramsFields.push(colorWheel);
|
||||
colorWheel;
|
||||
case TDropDown(options):
|
||||
addLabel();
|
||||
var dropdown = new UIDropDown(x, y, 320, 32, options, Std.int(Math.abs(options.indexOf(cast value))));
|
||||
paramsPanel.add(dropdown); paramsFields.push(dropdown);
|
||||
dropdown;
|
||||
default:
|
||||
paramsFields.push(null);
|
||||
null;
|
||||
}
|
||||
if (lastAdded is UISliceSprite)
|
||||
_y += cast(lastAdded, UISliceSprite).bHeight + 4;
|
||||
else if (lastAdded is FlxSprite)
|
||||
_y += cast(lastAdded, FlxSprite).height + 6;
|
||||
}
|
||||
|
||||
if(script != null && !(script is DummyScript)) {
|
||||
if(script.get("postGenerateUI") != null) {
|
||||
script.set("params", params);
|
||||
script.call("postGenerateUI");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveCurTab() {
|
||||
if (curEvent < 0) return;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class CharterMetaDataScreen extends UISubstateWindow {
|
||||
public var songNameTextBox:UITextBox;
|
||||
public var bpmStepper:UINumericStepper;
|
||||
public var beatsPerMeasureStepper:UINumericStepper;
|
||||
public var stepsPerBeatStepper :UINumericStepper;
|
||||
public var denominatorStepper:UINumericStepper;
|
||||
public var customPropertiesButtonList:UIButtonList<PropertyButton>;
|
||||
|
||||
public var displayNameTextBox:UITextBox;
|
||||
@@ -93,7 +93,7 @@ class CharterMetaDataScreen extends UISubstateWindow {
|
||||
add(difficultiesTextBox);
|
||||
addLabelOn(difficultiesTextBox, "Difficulties");
|
||||
|
||||
customPropertiesButtonList = new UIButtonList<PropertyButton>(stepsPerBeatStepper.x + 80 + 26 + 105, songNameTextBox.y, 290, 316, '', FlxPoint.get(280, 35), null, 5);
|
||||
customPropertiesButtonList = new UIButtonList<PropertyButton>(denominatorStepper.x + 80 + 26 + 105, songNameTextBox.y, 290, 316, '', FlxPoint.get(280, 35), null, 5);
|
||||
customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox');
|
||||
customPropertiesButtonList.cameraSpacing = 0;
|
||||
customPropertiesButtonList.addButton.callback = function() {
|
||||
@@ -148,7 +148,7 @@ class CharterMetaDataScreen extends UISubstateWindow {
|
||||
name: songNameTextBox.label.text,
|
||||
bpm: bpmStepper.value,
|
||||
beatsPerMeasure: Std.int(beatsPerMeasureStepper.value),
|
||||
stepsPerBeat: Std.int(stepsPerBeatStepper.value),
|
||||
stepsPerBeat: Std.int(16 / denominatorStepper.value),
|
||||
displayName: displayNameTextBox.label.text,
|
||||
icon: iconTextBox.label.text,
|
||||
color: colorWheel.curColor,
|
||||
|
||||
@@ -27,7 +27,7 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
public var songNameTextBox:UITextBox;
|
||||
public var bpmStepper:UINumericStepper;
|
||||
public var beatsPerMeasureStepper:UINumericStepper;
|
||||
public var stepsPerBeatStepper :UINumericStepper;
|
||||
public var denominatorStepper:UINumericStepper;
|
||||
public var instExplorer:UIFileExplorer;
|
||||
public var voicesExplorer:UIFileExplorer;
|
||||
public var importFrom:UIButton;
|
||||
@@ -395,14 +395,14 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
]));
|
||||
}
|
||||
} else {
|
||||
for (stepper in [bpmStepper, beatsPerMeasureStepper, stepsPerBeatStepper])
|
||||
for (stepper in [bpmStepper, beatsPerMeasureStepper, denominatorStepper])
|
||||
@:privateAccess stepper.__onChange(stepper.label.text);
|
||||
|
||||
var meta:ChartMetaData = {
|
||||
name: songNameTextBox.label.text,
|
||||
bpm: bpmStepper.value,
|
||||
beatsPerMeasure: Std.int(beatsPerMeasureStepper.value),
|
||||
stepsPerBeat: Std.int(stepsPerBeatStepper.value),
|
||||
stepsPerBeat: Std.int(16 / denominatorStepper.value),
|
||||
displayName: displayNameTextBox.label.text,
|
||||
icon: iconTextBox.label.text,
|
||||
color: colorWheel.curColor,
|
||||
|
||||
@@ -377,13 +377,28 @@ class PlayState extends MusicBeatState
|
||||
*/
|
||||
public var camZooming:Bool = false;
|
||||
/**
|
||||
* Interval of cam zooming (beats).
|
||||
* For example: if set to 4, the camera will zoom every 4 beats.
|
||||
*/
|
||||
public var camZoomingInterval:Int = Flags.DEFAULT_CAM_ZOOM_INTERVAL;
|
||||
* Interval of cam zooming (in conductor values).
|
||||
* Example: If Interval is 1 and Beat Type is on MEASURE, it'll zoom every a measure.
|
||||
* NOTE: Will set to 4 if not found any other time signatures unlike 4/4
|
||||
*/
|
||||
public var camZoomingInterval:Float = Flags.DEFAULT_CAM_ZOOM_INTERVAL;
|
||||
/**
|
||||
* How strong the cam zooms should be (defaults to 1)
|
||||
*/
|
||||
* Number of Conductor values to offset camZooming by.
|
||||
*/
|
||||
public var camZoomingOffset:Float = Flags.DEFAULT_CAM_ZOOM_OFFSET;
|
||||
/**
|
||||
* Beat type for interval of cam zooming.
|
||||
* Example: If Beat Type is on STEP and Interval is 2, it'll zoom every 2 steps.
|
||||
* NOTE: Will set to BEAT if not found any other time signatures unlike 4/4
|
||||
*/
|
||||
public var camZoomingEvery:BeatType = MEASURE;
|
||||
/**
|
||||
* Stores what was the last beat for the cam zooming intervals.
|
||||
*/
|
||||
public var camZoomingLastBeat:Float;
|
||||
/**
|
||||
* How strong the cam zooms should be (defaults to 1)
|
||||
*/
|
||||
public var camZoomingStrength:Float = Flags.DEFAULT_CAM_ZOOM_STRENGTH;
|
||||
/**
|
||||
* Default multiplier for `maxCamZoom`.
|
||||
@@ -1056,13 +1071,22 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
if (songData == null) songData = SONG;
|
||||
|
||||
events = songData.events != null ? songData.events.copy() : [];
|
||||
// get first camera focus
|
||||
for(e in events) {
|
||||
if (e.time > 10) break;
|
||||
if (e.name == "Camera Movement") {
|
||||
executeEvent(e);
|
||||
break;
|
||||
var foundCam = false;
|
||||
var foundSigs = songData.meta.beatsPerMeasure.getDefault(4) != 4 || songData.meta.stepsPerBeat.getDefault(4) != 4;
|
||||
|
||||
if (events == null) events = [];
|
||||
else events = [
|
||||
for (e in songData.events) {
|
||||
switch (e.name) {
|
||||
case "Camera Movement": if (!foundCam && e.time < 10) {
|
||||
foundCam = true;
|
||||
executeEvent(e);
|
||||
}
|
||||
case "Time Signature Change": if (!foundSigs && (e.params[0] != 4 || e.params[1] != 4)) {
|
||||
foundSigs = true;
|
||||
}
|
||||
}
|
||||
e;
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1075,13 +1099,6 @@ class PlayState extends MusicBeatState
|
||||
return FlxSort.byValues(FlxSort.DESCENDING, p1.time, p2.time);
|
||||
});
|
||||
|
||||
var beatsPerMeasure:Float = songData.meta.beatsPerMeasure.getDefault(Flags.DEFAULT_BEATS_PER_MEASURE);
|
||||
var stepsPerBeat:Int = songData.meta.stepsPerBeat.getDefault(Flags.DEFAULT_STEPS_PER_BEAT);
|
||||
|
||||
camZoomingInterval = Std.int(beatsPerMeasure);
|
||||
|
||||
Conductor.changeBPM(songData.meta.bpm, beatsPerMeasure, stepsPerBeat);
|
||||
|
||||
curSong = songData.meta.name.toLowerCase();
|
||||
curSongID = curSong.replace(" ", "-");
|
||||
|
||||
@@ -2010,13 +2027,6 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
super.beatHit(curBeat);
|
||||
|
||||
if (camZoomingInterval < 1) camZoomingInterval = 1;
|
||||
if (Options.camZoomOnBeat && camZooming && FlxG.camera.zoom < maxCamZoom && curBeat % camZoomingInterval == 0)
|
||||
{
|
||||
FlxG.camera.zoom += Flags.CAM_BOP_STRENGTH * camZoomingStrength;
|
||||
camHUD.zoom += Flags.HUD_BOP_STRENGTH * camZoomingStrength;
|
||||
}
|
||||
|
||||
if (doIconBop)
|
||||
for (icon in iconArray)
|
||||
if (icon.bump != null)
|
||||
|
||||
Reference in New Issue
Block a user