diff --git a/source/funkin/editors/charter/ChartCreationScreen.hx b/source/funkin/editors/charter/ChartCreationScreen.hx index e9093a50..9d9654b5 100644 --- a/source/funkin/editors/charter/ChartCreationScreen.hx +++ b/source/funkin/editors/charter/ChartCreationScreen.hx @@ -7,7 +7,7 @@ import haxe.io.Bytes; typedef ChartCreationData = { var name:String; var chart:ChartData; - var meta:Dynamic; + var ?meta:Dynamic; var ?instBytes:Bytes; var ?voicesBytes:Bytes; } @@ -20,12 +20,6 @@ class ChartCreationScreen extends UISubstateWindow { public var stageTextBox:UITextBox; public var strumLineList:UIButtonList; - public var instExplorer:UIFileExplorer; - public var voicesExplorer:UIFileExplorer; - public var bpmStepper:UINumericStepper; - public var beatsPerMeasureStepper:UINumericStepper; - public var stepsPerBeatStepper:UINumericStepper; - public var saveButton:UIButton; public var closeButton:UIButton; @@ -37,8 +31,8 @@ class ChartCreationScreen extends UISubstateWindow { public override function create() { winTitle = "Creating New Chart"; - winWidth = 948 - 32 + 40; - winHeight = 520; + winWidth = 652; + winHeight = 600; super.create(); @@ -55,55 +49,21 @@ class ChartCreationScreen extends UISubstateWindow { add(difficultyNameTextBox); addLabelOn(difficultyNameTextBox, "Difficulty Name"); - scrollSpeedTextBox = new UINumericStepper(difficultyNameTextBox.x + 200 + 26, difficultyNameTextBox.y, 1.0, 0.1, 2, null, null, 90); - add(scrollSpeedTextBox); - addLabelOn(scrollSpeedTextBox, "Scroll Speed"); - - stageTextBox = new UITextBox(chartTitle.x, scrollSpeedTextBox.y + 32 + 36, "Stage", 125); + stageTextBox = new UITextBox(difficultyNameTextBox.x + 200 + 26, difficultyNameTextBox.y, "Stage", 125); add(stageTextBox); addLabelOn(stageTextBox, "Stage"); - strumLineList = new UIButtonList(scrollSpeedTextBox.x + 150 + 26, scrollSpeedTextBox.y, 520, 350, "", FlxPoint.get(510, 150), null, 5); + scrollSpeedTextBox = new UINumericStepper(stageTextBox.x + 125 + 26, difficultyNameTextBox.y, 1.0, 0.1, 2, null, null, 90); + add(scrollSpeedTextBox); + addLabelOn(scrollSpeedTextBox, "Scroll Speed"); + + strumLineList = new UIButtonList(difficultyNameTextBox.x, difficultyNameTextBox.y+difficultyNameTextBox.bHeight+36, 620, (552-179)-16, "", FlxPoint.get(620, 246), null, 6); strumLineList.frames = Paths.getFrames('editors/ui/inputbox'); strumLineList.cameraSpacing = 0; - strumLineList.add(new StrumLineButton(0, "dad", 0, true)); - strumLineList.add(new StrumLineButton(1, "bf", 1, true)); - strumLineList.add(new StrumLineButton(2, "gf", 2, false)); + strumLineList.add(new StrumLineButton(0, "bf", 1, true)); add(strumLineList); addLabelOn(strumLineList, "Strumlines"); - var songTitle:UIText; - add(songTitle = new UIText(stageTextBox.x, stageTextBox.y + 32 + 26, 0, "Specific Song (OPTIONAL)", 28)); - - instExplorer = new UIFileExplorer(songTitle.x, songTitle.y + songTitle.height + 36, 174, null, Paths.SOUND_EXT, function (res) { - var audioPlayer:UIAudioPlayer = new UIAudioPlayer(instExplorer.x + 8, instExplorer.y + 8, res); - instExplorer.members.push(audioPlayer); - instExplorer.uiElement = audioPlayer; - }); - add(instExplorer); - addLabelOn(instExplorer, "Inst Audio File"); - - voicesExplorer = new UIFileExplorer(instExplorer.x + 174 + 26, instExplorer.y, 174, null, Paths.SOUND_EXT, function (res) { - var audioPlayer:UIAudioPlayer = new UIAudioPlayer(voicesExplorer.x + 8, voicesExplorer.y + 8, res); - voicesExplorer.members.push(audioPlayer); - voicesExplorer.uiElement = audioPlayer; - }); - add(voicesExplorer); - addLabelOn(voicesExplorer, "Voices Audio File"); - - bpmStepper = new UINumericStepper(instExplorer.x, instExplorer.y + 58 + 36, 100, 1, 2, 1, null, 90); - add(bpmStepper); - addLabelOn(bpmStepper, "BPM"); - - beatsPerMeasureStepper = new UINumericStepper(bpmStepper.x + 60 + 26, bpmStepper.y, 4, 1, 0, 1, null, 54); - add(beatsPerMeasureStepper); - addLabelOn(beatsPerMeasureStepper, "Time Signature"); - - add(new UIText(beatsPerMeasureStepper.x + 30, beatsPerMeasureStepper.y + 3, 0, "/", 22)); - - stepsPerBeatStepper = new UINumericStepper(beatsPerMeasureStepper.x + 30 + 24, beatsPerMeasureStepper.y, 4, 1, 0, 1, null, 54); - add(stepsPerBeatStepper); - saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Create Chart", function() { createChart(); close(); @@ -118,6 +78,7 @@ class ChartCreationScreen extends UISubstateWindow { } function createChart() { + /* var strlines = []; for (strline in strumLineList.buttons.members) { strlines.push({ @@ -143,75 +104,148 @@ class ChartCreationScreen extends UISubstateWindow { if (onSave != null) onSave({ name: difficultyNameTextBox.label.text, chart: chartData, - meta: { - bpm: bpmStepper.value, - beatsPerMeasure: beatsPerMeasureStepper.value, - stepsPerBeat: stepsPerBeatStepper.value - }, - instBytes: instExplorer.file, - voicesBytes: voicesExplorer.file }); + */ } } class StrumLineButton extends UIButton { - public var numberText:UIText; - public var positionXStepper:UINumericStepper; - public var positionXStepperText:UIText; - public var positionYStepper:UINumericStepper; - public var positionYStepperText:UIText; - public var typeDropDownText:UIText; - public var typeDropDown:UIDropDown; - public var visibleCheckBoxText:UIText; - public var visibleCheckBox:UICheckbox; - public var characterList:UIButtonList; + public var strumLineID:Int = -1; + public var strumLine:ChartStrumLine = { + characters: [ + "bf" + ], + type: 0, + notes: [], + position: "dad", + visible: true, + strumPos: [0,0], + strumLinePos: 0, + strumScale: 1, + vocalsSuffix: "" + }; + + public var idText:UIText; + + public var charactersList:UIButtonList; + public var typeDropdown:UIDropDown; + public var stagePositionDropdown:UIDropDown; + public var hudScaleStepper:UINumericStepper; + public var hudXStepper:UINumericStepper; + public var hudYStepper:UINumericStepper; + public var visibleCheckbox:UICheckbox; + public var scrollSpeedStepper:UINumericStepper; + public var usesChartscrollSpeed:UICheckbox; + + public var deleteButton:UIButton; + public var deleteIcon:FlxSprite; + + public var labels:Map = []; + public var XYComma:UIText; + public function new(id:Int, char:String, type:Int, visible:Bool) { - super(0, 0, '', function () {}, 510, 150); - numberText = new UIText(5, 5, 0, 'Strumline #$id'); - members.push(numberText); + super(0, 0, '', function () {}, 620, 246); - positionXStepperText = new UIText(numberText.x, numberText.y + 26, 0, "X (ratio)"); - members.push(positionXStepperText); + autoAlpha = false; frames = Paths.getFrames('editors/ui/inputbox'); - positionXStepper = new UINumericStepper(positionXStepperText.x, positionXStepperText.y + 24, 1.0, 0.1, 2, null, null, 90); - members.push(positionXStepper); + function addLabelOn(ui:UISprite, text:String, ?size:Int):UIText { + var uiText:UIText = new UIText(ui.x, ui.y - 24, 0, text, size); + members.push(uiText); labels.set(ui, uiText); + return uiText; + } - positionYStepperText = new UIText(positionXStepper.x + 60 + 26, positionXStepper.y, 0, "Y"); - members.push(positionYStepperText); + charactersList = new UIButtonList(16, 8+26, 210, 160, "", FlxPoint.get(200, 40), null, 5); + charactersList.frames = Paths.getFrames('editors/ui/inputbox'); + charactersList.cameraSpacing = 0; + charactersList.add(new CompactCharacterButton(char, [], charactersList)); + members.push(charactersList); + idText = addLabelOn(charactersList, 'Strumline - #$id'); - positionYStepper = new UINumericStepper(positionYStepperText.x, positionYStepperText.y + 24, 1.0, 0.1, 2, null, null, 90); - members.push(positionYStepper); + typeDropdown = new UIDropDown(charactersList.x + charactersList.bWidth + 16, 8+26, 200, 32, ["OPPONENT", "PLAYER", "ADDITIONAL"], strumLine.type); + members.push(typeDropdown); + addLabelOn(typeDropdown, "Type"); - visibleCheckBoxText = new UIText(positionXStepper.x + 90 + 26, positionXStepper.y, 0, "Visible?"); - members.push(visibleCheckBoxText); + var stagePositionI = strumLine.position == null ? strumLine.type : ["DAD", "BOYFRIEND", "GIRLFRIEND"].indexOf(strumLine.position.toUpperCase()); - visibleCheckBox = new UICheckbox(visibleCheckBoxText.x, positionYStepperText.y + 24, "Visible", visible); - members.push(visibleCheckBox); + stagePositionDropdown = new UIDropDown(typeDropdown.x + 200 - 32 + 26, typeDropdown.y, 200, 32, ["DAD", "BOYFRIEND", "GIRLFRIEND"], stagePositionI); + members.push(stagePositionDropdown); + addLabelOn(stagePositionDropdown, "Stage Position"); - typeDropDownText = new UIText(positionXStepper.x, positionXStepper.y + 32 + 36, 0, "Type"); - members.push(typeDropDownText); + hudScaleStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 64, strumLine.strumScale == null ? 1 : strumLine.strumScale, 0.001, 2, null, null, 74); + members.push(hudScaleStepper); + addLabelOn(hudScaleStepper, "Scale"); - typeDropDown = new UIDropDown(typeDropDownText.x, typeDropDownText.y + 24, 165, 32, ["OPPONENT", "PLAYER", "ADDITIONAL"], type); - members.push(typeDropDown); + var strOffset:Float = strumLine.strumLinePos == null ? (strumLine.type == 1 ? 0.75 : 0.25) : strumLine.strumLinePos; - characterList = new UIButtonList(numberText.x + 265 + 26, numberText.y, 210, 140, "", FlxPoint.get(200, 40), null, 5); - characterList.frames = Paths.getFrames('editors/ui/inputbox'); - characterList.cameraSpacing = 0; - characterList.add(new CompactCharacterButton(char, [], characterList)); - members.push(characterList); + var startingPos:FlxPoint = strumLine.strumLinePos == null ? + FlxPoint.get(strOffset, 50) : + FlxPoint.get(strOffset, strumLine.strumPos[1]); + + hudXStepper = new UINumericStepper(hudScaleStepper.x + 80 - 32 + 26, hudScaleStepper.y, startingPos.x, 0.01, 2, 0, 2, 84); + members.push(hudXStepper); + addLabelOn(hudXStepper, "Hud Position (X,Y)"); + + members.push(XYComma = new UIText(hudXStepper.x + 84 - 32 + 0, hudXStepper.y + 9, 0, ",", 22)); + + hudYStepper = new UINumericStepper(hudXStepper.x + 84 - 32 + 26, hudXStepper.y, startingPos.y, 0.001, 2, null, null, 84); + members.push(hudYStepper); + + visibleCheckbox = new UICheckbox(hudYStepper.x + hudYStepper.bWidth + 42, hudYStepper.y + 9, "Visible?", strumLine.visible); + members.push(visibleCheckbox); + + scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 128, strumLine.scrollSpeed, 0.1, 2, 0, 10, 82); + if(strumLine.scrollSpeed == null) + { + scrollSpeedStepper.selectable = false; + } else { + scrollSpeedStepper.selectable = true; + } + members.push(scrollSpeedStepper); + addLabelOn(scrollSpeedStepper, "Scroll Speed"); + + usesChartscrollSpeed = new UICheckbox(scrollSpeedStepper.x + 104, typeDropdown.y + 135, "Uses charts scroll speed?", strumLine.scrollSpeed == null); + usesChartscrollSpeed.onChecked = function(b) { + if(b) + { + scrollSpeedStepper.value = PlayState.SONG.scrollSpeed; + scrollSpeedStepper.selectable = false; + } else { + scrollSpeedStepper.selectable = true; + } + } + members.push(usesChartscrollSpeed); + + deleteButton = new UIButton(16, 246-32-11, "", function () { + // Shit + }, 620-32); + deleteButton.color = 0xFFFF0000; + deleteButton.autoAlpha = false; + members.push(deleteButton); + + deleteIcon = new FlxSprite(deleteButton.x + ((deleteButton.bWidth/2)-(15/2)), deleteButton.y + ((deleteButton.bHeight/2)-(16/2))).loadGraphic(Paths.image('editors/delete-button')); + deleteIcon.antialiasing = false; + members.push(deleteIcon); } - public override function update(elapsed) { - numberText.follow(this, 5, 5); - positionXStepperText.follow(numberText, 0, 26); - positionXStepper.follow(positionXStepperText, 0, 24); - positionYStepperText.follow(positionXStepperText, 65 + 26, 0); - positionYStepper.follow(positionYStepperText, 0, 24); - visibleCheckBoxText.follow(positionYStepperText, 65 + 26, 0); - visibleCheckBox.follow(visibleCheckBoxText, 0, 24); - typeDropDownText.follow(positionXStepper, 0, 36); - typeDropDown.follow(typeDropDownText, 0, 24); - characterList.follow(numberText, 265 + 26, 0); + + public override function update(elapsed:Float) { super.update(elapsed); + + charactersList.follow(this, 16, 8+26); + typeDropdown.follow(this, charactersList.x + charactersList.bWidth + 16, 8+26); + stagePositionDropdown.follow(this, typeDropdown.x + 200 - 32 + 26, 8+26); + hudScaleStepper.follow(this, typeDropdown.x, 8+26 + 64); + hudXStepper.follow(this, hudScaleStepper.x + 80 - 32 + 26, 8+26 + 64); + hudYStepper.follow(this, hudXStepper.x + 84 - 32 + 26, 8+26 + 64); + visibleCheckbox.follow(this, hudYStepper.x + hudYStepper.bWidth + 42, 8+26 + 64 + 9); + scrollSpeedStepper.follow(this, typeDropdown.x, 8+26 + 128); + usesChartscrollSpeed.follow(this, scrollSpeedStepper.x + 104, 8+26 + 135); + + deleteButton.follow(this, 16, 246-32-11); + deleteIcon.follow(this, 16 + ((deleteButton.bWidth/2)-(15/2)), (246-32-11) + ((deleteButton.bHeight/2)-(16/2))); + + XYComma.follow(hudXStepper, 84 - 32, 9); + for (ui => text in labels) + text.follow(ui, 0, -24); } } diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index b1ed7a60..1258b30f 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1050,7 +1050,7 @@ class Charter extends UIState { __autosaveElapsed += elapsed; if (__autosaveElapsed > 5) { - trace("some autosaves"); + // trace("some autosaves"); __autosaveElapsed = 0; } } diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 8e9422f7..9f95c4d8 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -155,7 +155,7 @@ class CharterStrumlineScreen extends UISubstateWindow { } } - + vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixlist, strumLine.vocalsSuffix != "" ? suffixlist.indexOf(strumLine.vocalsSuffix) : 0); add(vocalsSuffixDropDown); addLabelOn(vocalsSuffixDropDown, "Vocal Suffix"); @@ -192,7 +192,6 @@ class CharacterButton extends UIButton { public function new(x:Float, y:Float, char:String, charsList:Array, parent:UIButtonList) { super(x, y, "", null, 250, 54); - autoAlpha = false; charIcon = new HealthIcon(Character.getIconFromCharName(char)); charIcon.scale.set(0.3, 0.3);