Merge branch 'main' into translations-system
This commit is contained in:
@@ -14,7 +14,7 @@ class CharacterEditor extends UIState {
|
||||
|
||||
public var ghosts:CharacterGhostsHandler;
|
||||
|
||||
public static var instance(get, null):CharacterEditor;
|
||||
public static var instance(get, never):CharacterEditor;
|
||||
|
||||
private static inline function get_instance()
|
||||
return FlxG.state is CharacterEditor ? cast FlxG.state : null;
|
||||
@@ -451,7 +451,7 @@ class CharacterEditor extends UIState {
|
||||
}));
|
||||
}
|
||||
|
||||
public function createAnim(animData:AnimData, animID:Int = -1, addtoUndo:Bool = true) {
|
||||
public function createAnim(animData:AnimData, animID:Int = -1, addToUndo:Bool = true) {
|
||||
XMLUtil.addAnimToSprite(character, animData);
|
||||
ghosts.createGhost(animData.name);
|
||||
var newButton = new CharacterAnimButtons(0, 0, animData.name, FlxPoint.get(animData.x,animData.y));
|
||||
@@ -460,11 +460,11 @@ class CharacterEditor extends UIState {
|
||||
|
||||
playAnimation(animData.name);
|
||||
|
||||
if (addtoUndo)
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CCreateAnim(character.getNameList().length, animData));
|
||||
}
|
||||
|
||||
public function editAnim(name:String, animData:AnimData, addtoUndo:Bool = true) {
|
||||
public function editAnim(name:String, animData:AnimData, addToUndo:Bool = true) {
|
||||
var oldAnimData:AnimData = character.animDatas.get(name);
|
||||
var buttoner:CharacterAnimButtons = null;
|
||||
for (button in characterAnimsWindow.buttons.members)
|
||||
@@ -478,11 +478,11 @@ class CharacterEditor extends UIState {
|
||||
if (character.getAnimName() == animData.name) // update anim ifs its currently selected
|
||||
playAnimation(animData.name);
|
||||
|
||||
if (addtoUndo)
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CEditAnim(animData.name, oldAnimData, animData));
|
||||
}
|
||||
|
||||
public function deleteAnim(name:String, addtoUndo:Bool = true) {
|
||||
public function deleteAnim(name:String, addToUndo:Bool = true) {
|
||||
var animOrder:Array<String> = [
|
||||
for (button in characterAnimsWindow.buttons.members)
|
||||
button.anim
|
||||
@@ -505,7 +505,7 @@ class CharacterEditor extends UIState {
|
||||
if (character.animOffsets.exists(name)) character.animOffsets.remove(name);
|
||||
if (character.animDatas.exists(name)) character.animDatas.remove(name);
|
||||
|
||||
if (addtoUndo)
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CDeleteAnim(oldID, oldAnimData));
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ class CharacterEditor extends UIState {
|
||||
}));
|
||||
}
|
||||
|
||||
public function editInfo(newInfo:Xml, addtoUndo:Bool = true) {
|
||||
public function editInfo(newInfo:Xml, addToUndo:Bool = true) {
|
||||
var lastAnim:String = character.getAnimName();
|
||||
|
||||
var oldInfo = character.buildXML();
|
||||
@@ -524,7 +524,7 @@ class CharacterEditor extends UIState {
|
||||
|
||||
playAnimation(lastAnim);
|
||||
|
||||
if (addtoUndo)
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CEditInfo(oldInfo, newInfo));
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ class CharacterEditor extends UIState {
|
||||
clearOffsets();
|
||||
}
|
||||
|
||||
function changeOffset(anim:String, change:FlxPoint, addtoUndo:Bool = true) {
|
||||
function changeOffset(anim:String, change:FlxPoint, addToUndo:Bool = true) {
|
||||
if (character.getNameList().length == 0) return;
|
||||
|
||||
var animData = character.animDatas.get(anim);
|
||||
@@ -608,11 +608,11 @@ class CharacterEditor extends UIState {
|
||||
|
||||
ghosts.updateOffsets(anim, change);
|
||||
|
||||
if (addtoUndo)
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CChangeOffset(anim, change));
|
||||
}
|
||||
|
||||
function clearOffsets(addtoUndo:Bool = true) {
|
||||
function clearOffsets(addToUndo:Bool = true) {
|
||||
if (character.getNameList().length == 0) return;
|
||||
|
||||
var oldOffsets:Map<String, FlxPoint> = [
|
||||
@@ -629,7 +629,7 @@ class CharacterEditor extends UIState {
|
||||
changeOffset(character.getAnimName(), FlxPoint.get(), false);
|
||||
ghosts.clearOffsets();
|
||||
|
||||
if (addtoUndo)
|
||||
if (addToUndo)
|
||||
undos.addToUndo(CResetOffsets(oldOffsets));
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class ChartCreationScreen extends UISubstateWindow {
|
||||
scrollSpeedTextBox.onChange = function (text:String) {
|
||||
@:privateAccess scrollSpeedTextBox.__onChange(text);
|
||||
for (button in strumLineList.buttons.members)
|
||||
if (button.usesChartscrollSpeed.checked)
|
||||
if (button.usesChartScrollSpeed.checked)
|
||||
button.scrollSpeedStepper.value = scrollSpeedTextBox.value;
|
||||
}
|
||||
add(scrollSpeedTextBox);
|
||||
@@ -149,7 +149,7 @@ class ChartCreationScreen extends UISubstateWindow {
|
||||
@:privateAccess stepper.__onChange(stepper.label.text);
|
||||
|
||||
strumLines.push({
|
||||
characters: [for (charb in strline.charactersList.buttons.members) charb.textBox.label.text],
|
||||
characters: [for (char in strline.charactersList.buttons.members) char.textBox.label.text],
|
||||
type: strline.typeDropdown.index,
|
||||
notes: [],
|
||||
position: strline.stagePositionDropdown.label.text.toLowerCase(),
|
||||
@@ -157,7 +157,7 @@ class ChartCreationScreen extends UISubstateWindow {
|
||||
strumPos: [0, strline.hudYStepper.value],
|
||||
strumLinePos: strline.hudXStepper.value,
|
||||
strumScale: strline.hudScaleStepper.value,
|
||||
scrollSpeed: strline.usesChartscrollSpeed.checked ? strline.scrollSpeedStepper.value : null
|
||||
scrollSpeed: strline.usesChartScrollSpeed.checked ? strline.scrollSpeedStepper.value : null
|
||||
});
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ class StrumLineButton extends UIButton {
|
||||
public var hudYStepper:UINumericStepper;
|
||||
public var visibleCheckbox:UICheckbox;
|
||||
public var scrollSpeedStepper:UINumericStepper;
|
||||
public var usesChartscrollSpeed:UICheckbox;
|
||||
public var usesChartScrollSpeed:UICheckbox;
|
||||
|
||||
public var deleteButton:UIButton;
|
||||
public var deleteIcon:FlxSprite;
|
||||
@@ -261,15 +261,15 @@ class StrumLineButton extends UIButton {
|
||||
members.push(scrollSpeedStepper);
|
||||
addLabelOn(scrollSpeedStepper, TU.translate("charterStrumLine.scrollSpeed"));
|
||||
|
||||
usesChartscrollSpeed = new UICheckbox(scrollSpeedStepper.x + 104, typeDropdown.y + 135, TU.translate("charterStrumLine.useChartScrollSpeed"), strumLine.scrollSpeed == null);
|
||||
usesChartscrollSpeed.onChecked = function(b) {
|
||||
usesChartScrollSpeed = new UICheckbox(scrollSpeedStepper.x + 104, typeDropdown.y + 135, TU.translate("charterStrumLine.useChartScrollSpeed"), strumLine.scrollSpeed == null);
|
||||
usesChartScrollSpeed.onChecked = function(b) {
|
||||
if(b) {
|
||||
scrollSpeedStepper.value = subState.scrollSpeedTextBox.value;
|
||||
scrollSpeedStepper.selectable = false;
|
||||
} else
|
||||
scrollSpeedStepper.selectable = true;
|
||||
}
|
||||
members.push(usesChartscrollSpeed);
|
||||
members.push(usesChartScrollSpeed);
|
||||
|
||||
deleteButton = new UIButton(16, 246-32-11, "", function () {
|
||||
parent.remove(this);
|
||||
@@ -294,7 +294,7 @@ class StrumLineButton extends UIButton {
|
||||
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);
|
||||
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)));
|
||||
|
||||
@@ -22,11 +22,11 @@ class Charter extends UIState {
|
||||
static var __diff:String;
|
||||
static var __reload:Bool;
|
||||
|
||||
var chart(get, null):ChartData;
|
||||
var chart(get, never):ChartData;
|
||||
private function get_chart()
|
||||
return PlayState.SONG;
|
||||
|
||||
public static var instance(get, null):Charter;
|
||||
public static var instance(get, never):Charter;
|
||||
|
||||
private static inline function get_instance()
|
||||
return FlxG.state is Charter ? cast FlxG.state : null;
|
||||
@@ -732,7 +732,6 @@ class Charter extends UIState {
|
||||
if (!autoSaveNotif.cancelled) {
|
||||
buildChart();
|
||||
var songPath:String = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}';
|
||||
|
||||
if (Options.charterAutoSavesSeparateFolder)
|
||||
Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: false, folder: "autosaves", prettyPrint: Options.editorPrettyPrint});
|
||||
else
|
||||
@@ -826,7 +825,7 @@ class Charter extends UIState {
|
||||
|
||||
var boundedChange:FlxPoint = changePoint.clone();
|
||||
|
||||
// Some maths, so cool bro -lunar (i dont know why i quopte my self here)
|
||||
// Some maths, so cool bro -lunar (i don't know why i quote my self here)
|
||||
if (s.step + changePoint.x < 0) boundedChange.x += Math.abs(s.step + changePoint.x);
|
||||
if (s.step + changePoint.x > __endStep-1) boundedChange.x -= (s.step + changePoint.x) - (__endStep-1);
|
||||
|
||||
@@ -1660,7 +1659,7 @@ class Charter extends UIState {
|
||||
inline function _snap_resetsnap(_) setquant(16);
|
||||
|
||||
inline function changequant(change:Int) {quant = quants[FlxMath.wrap(quants.indexOf(quant) + change, 0, quants.length-1)]; buildSnapsUI();};
|
||||
inline function setquant(newquant:Int) {quant = newquant; buildSnapsUI();}
|
||||
inline function setquant(newQuant:Int) {quant = newQuant; buildSnapsUI();}
|
||||
|
||||
function buildSnapsUI():Array<UIContextMenuOption> {
|
||||
var snapsTopButton:UITopMenuButton = topMenuSpr == null ? null : cast topMenuSpr.members[snapIndex];
|
||||
@@ -1868,7 +1867,7 @@ class Charter extends UIState {
|
||||
return newSelection.filter((s:ICharterSelectable) -> {return s != null;});
|
||||
}
|
||||
|
||||
// UH OH!!! DANGER ZONE APPOARCHING !!!! LUNARS SHITTY CODE !!!! -lunar
|
||||
// UH OH!!! DANGER ZONE APPROACHING !!!! LUNARS SHITTY CODE !!!! -lunar
|
||||
|
||||
@:noCompletion public function __relinkSingleSelection(selectable:ICharterSelectable):ICharterSelectable {
|
||||
if (selectable is CharterNote)
|
||||
|
||||
@@ -64,7 +64,7 @@ class CharterAutoSaveUI extends UISliceSprite {
|
||||
var __timer:FlxTimer;
|
||||
var __tween:FlxTween;
|
||||
|
||||
public function startAutoSave(time:Float, sucessText:String) {
|
||||
public function startAutoSave(time:Float, successText:String) {
|
||||
appearAnimation();
|
||||
|
||||
__tween = FlxTween.num(0, 1, time, null, (v:Float) -> {
|
||||
@@ -77,7 +77,7 @@ class CharterAutoSaveUI extends UISliceSprite {
|
||||
});
|
||||
__timer = new FlxTimer();
|
||||
__timer.start(time, (_) -> {
|
||||
autosavingText.text = sucessText; cancelButton.visible = false;
|
||||
autosavingText.text = successText; cancelButton.visible = false;
|
||||
|
||||
icon.animation.curAnim.curFrame = 1;
|
||||
for (member in [this, progressBar, progressBarBack, autosavingText]) member.color = 0xFFA3EC95;
|
||||
|
||||
@@ -23,7 +23,7 @@ class CharterMetaDataScreen extends UISubstateWindow {
|
||||
public var opponentModeCheckbox:UICheckbox;
|
||||
public var coopAllowedCheckbox:UICheckbox;
|
||||
public var colorWheel:UIColorwheel;
|
||||
public var difficulitesTextBox:UITextBox;
|
||||
public var difficultiesTextBox:UITextBox;
|
||||
|
||||
public function new(metadata:ChartMetaData) {
|
||||
super();
|
||||
@@ -91,9 +91,9 @@ class CharterMetaDataScreen extends UISubstateWindow {
|
||||
add(colorWheel);
|
||||
addLabelOn(colorWheel, translate("color"));
|
||||
|
||||
difficulitesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, metadata.difficulties.join(", "));
|
||||
add(difficulitesTextBox);
|
||||
addLabelOn(difficulitesTextBox, translate("difficulties"));
|
||||
difficultiesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, metadata.difficulties.join(", "));
|
||||
add(difficultiesTextBox);
|
||||
addLabelOn(difficultiesTextBox, translate("difficulties"));
|
||||
|
||||
customPropertiesButtonList = new UIButtonList<PropertyButton>(stepsPerBeatStepper.x + 80 + 26 + 105, songNameTextBox.y, 290, 316, '', FlxPoint.get(280, 35), null, 5);
|
||||
customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox');
|
||||
@@ -165,7 +165,7 @@ class CharterMetaDataScreen extends UISubstateWindow {
|
||||
parsedColor: colorWheel.curColor,
|
||||
opponentModeAllowed: opponentModeCheckbox.checked,
|
||||
coopAllowed: coopAllowedCheckbox.checked,
|
||||
difficulties: [for (diff in difficulitesTextBox.label.text.split(",")) diff.trim()],
|
||||
difficulties: [for (diff in difficultiesTextBox.label.text.split(",")) diff.trim()],
|
||||
customValues: customVals,
|
||||
};
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
|
||||
public function updatePos(step:Float, id:Int, susLength:Float = 0, ?type:Int = 0, ?strumLine:CharterStrumline = null) {
|
||||
this.step = step;
|
||||
this.id = id;
|
||||
this.susLength = susLength;
|
||||
this.susLength = Math.max(susLength, 0);
|
||||
this.type = type;
|
||||
if (strumLine != null) this.strumLine = strumLine;
|
||||
|
||||
|
||||
@@ -91,9 +91,9 @@ class CharterSelection extends EditorTreeMenu {
|
||||
}
|
||||
|
||||
public function saveSong(creation:SongCreationData) {
|
||||
var songAlreadlyExsits:Bool = [for (s in freeplayList.songs) s.name.toLowerCase()].contains(creation.meta.name.toLowerCase());
|
||||
var songAlreadyExists:Bool = [for (s in freeplayList.songs) s.name.toLowerCase()].contains(creation.meta.name.toLowerCase());
|
||||
|
||||
if (songAlreadlyExsits) {
|
||||
if (songAlreadyExists) {
|
||||
openSubState(new UIWarningSubstate(TU.translate("chartCreation.warnings.song-exists-title"), TU.translate("chartCreation.warnings.song-exists-body"), [
|
||||
{label: TU.translate("editor.ok"), color: 0xFFFF0000, onClick: function(t) {}},
|
||||
]));
|
||||
@@ -138,9 +138,9 @@ class CharterSelection extends EditorTreeMenu {
|
||||
}
|
||||
|
||||
public function saveChart(name:String, data:ChartData) {
|
||||
var difficultyAlreadlyExsits:Bool = curSong.difficulties.contains(name);
|
||||
var difficultyAlreadyExists:Bool = curSong.difficulties.contains(name);
|
||||
|
||||
if (difficultyAlreadlyExsits) {
|
||||
if (difficultyAlreadyExists) {
|
||||
openSubState(new UIWarningSubstate(TU.translate("chartCreation.warnings.chart-exists-title"), TU.translate("chartCreation.warnings.chart-exists-body"), [
|
||||
{label: TU.translate("editor.ok"), color: 0xFFFF0000, onClick: function(t) {}},
|
||||
]));
|
||||
|
||||
@@ -18,7 +18,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
public var hudYStepper:UINumericStepper;
|
||||
public var visibleCheckbox:UICheckbox;
|
||||
public var scrollSpeedStepper:UINumericStepper;
|
||||
public var usesChartscrollSpeed:UICheckbox;
|
||||
public var usesChartScrollSpeed:UICheckbox;
|
||||
|
||||
public var characterIcons:Array<HealthIcon> = [];
|
||||
|
||||
@@ -78,8 +78,8 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
add(typeDropdown);
|
||||
addLabelOn(typeDropdown, TU.translate("charterStrumLine.type"));
|
||||
|
||||
usesChartscrollSpeed = new UICheckbox(typeDropdown.x + 104, typeDropdown.y + 135, TU.translate("charterStrumLine.useChartScrollSpeed"), strumLine.scrollSpeed == null);
|
||||
usesChartscrollSpeed.onChecked = function(b) {
|
||||
usesChartScrollSpeed = new UICheckbox(typeDropdown.x + 104, typeDropdown.y + 135, TU.translate("charterStrumLine.useChartScrollSpeed"), strumLine.scrollSpeed == null);
|
||||
usesChartScrollSpeed.onChecked = function(b) {
|
||||
if(b)
|
||||
{
|
||||
scrollSpeedStepper.value = PlayState.SONG.scrollSpeed;
|
||||
@@ -88,10 +88,10 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
scrollSpeedStepper.selectable = true;
|
||||
}
|
||||
}
|
||||
add(usesChartscrollSpeed);
|
||||
add(usesChartScrollSpeed);
|
||||
|
||||
scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 128, usesChartscrollSpeed.checked ? PlayState.SONG.scrollSpeed : strumLine.scrollSpeed, 0.1, 2, 0, 10, 82);
|
||||
if(usesChartscrollSpeed.checked)
|
||||
scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 128, usesChartScrollSpeed.checked ? PlayState.SONG.scrollSpeed : strumLine.scrollSpeed, 0.1, 2, 0, 10, 82);
|
||||
if(usesChartScrollSpeed.checked)
|
||||
{
|
||||
scrollSpeedStepper.selectable = false;
|
||||
} else {
|
||||
@@ -141,20 +141,20 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
add(closeButton);
|
||||
closeButton.color = 0xFFFF0000;
|
||||
|
||||
var suffixlist = ["NONE"];
|
||||
var suffixList = ["NONE"];
|
||||
for (i in Paths.getFolderContent('songs/${Charter.__song.toLowerCase()}/song'))
|
||||
if (i.startsWith("Voices")) {
|
||||
i = haxe.io.Path.withoutExtension(i.substr("Voices".length));
|
||||
if (i == "") continue;
|
||||
for (j in PlayState.SONG.meta.difficulties) {
|
||||
if (i.endsWith('-${j.toLowerCase()}'))
|
||||
suffixlist.pushOnce(i.substring(0, i.length - j.length));
|
||||
suffixList.pushOnce(i.substring(0, i.length - j.length));
|
||||
else
|
||||
suffixlist.pushOnce(i);
|
||||
suffixList.pushOnce(i);
|
||||
}
|
||||
}
|
||||
|
||||
vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixlist, strumLine.vocalsSuffix != null && strumLine.vocalsSuffix != "" ? suffixlist.indexOf(strumLine.vocalsSuffix) : 0);
|
||||
vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixList, strumLine.vocalsSuffix != null && strumLine.vocalsSuffix != "" ? suffixList.indexOf(strumLine.vocalsSuffix) : 0);
|
||||
add(vocalsSuffixDropDown);
|
||||
addLabelOn(vocalsSuffixDropDown, TU.translate("charterStrumLine.vocalSuffix"));
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
strumScale: hudScaleStepper.value,
|
||||
vocalsSuffix: vocalsSuffixDropDown.options[vocalsSuffixDropDown.index] != "NONE" ? vocalsSuffixDropDown.options[vocalsSuffixDropDown.index] : ""
|
||||
};
|
||||
if(!usesChartscrollSpeed.checked) newStrumLine.scrollSpeed = scrollSpeedStepper.value;
|
||||
if(!usesChartScrollSpeed.checked) newStrumLine.scrollSpeed = scrollSpeedStepper.value;
|
||||
if (onSave != null) onSave(newStrumLine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
public var opponentModeCheckbox:UICheckbox;
|
||||
public var coopAllowedCheckbox:UICheckbox;
|
||||
public var colorWheel:UIColorwheel;
|
||||
public var difficulitesTextBox:UITextBox;
|
||||
public var difficultiesTextBox:UITextBox;
|
||||
|
||||
public var backButton:UIButton;
|
||||
public var saveButton:UIButton;
|
||||
@@ -138,9 +138,9 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
menuDataGroup.add(colorWheel);
|
||||
addLabelOn(colorWheel, translateMeta("color"));
|
||||
|
||||
difficulitesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, "");
|
||||
menuDataGroup.add(difficulitesTextBox);
|
||||
addLabelOn(difficulitesTextBox, translateMeta("difficulties"));
|
||||
difficultiesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, "");
|
||||
menuDataGroup.add(difficultiesTextBox);
|
||||
addLabelOn(difficultiesTextBox, translateMeta("difficulties"));
|
||||
|
||||
for (checkbox in [opponentModeCheckbox, coopAllowedCheckbox])
|
||||
{checkbox.y += 6; checkbox.x += 4;}
|
||||
@@ -253,7 +253,7 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
parsedColor: colorWheel.curColor,
|
||||
opponentModeAllowed: opponentModeCheckbox.checked,
|
||||
coopAllowed: coopAllowedCheckbox.checked,
|
||||
difficulties: [for (diff in difficulitesTextBox.label.text.split(",")) diff.trim()],
|
||||
difficulties: [for (diff in difficultiesTextBox.label.text.split(",")) diff.trim()],
|
||||
};
|
||||
|
||||
if (onSave != null) onSave({
|
||||
|
||||
@@ -44,10 +44,10 @@ class UIColorwheel extends UISliceSprite {
|
||||
|
||||
// Im too lazy to use a shader for this if its not even gonna change
|
||||
colorSlider.pixels.lock();
|
||||
for (pixely in 0...Std.int(colorSlider.height)) {
|
||||
var color:Int = FlxColor.fromHSB(pixely / (colorSlider.height-1) * 360, 1, 1);
|
||||
for (pixelx in 0...Std.int(colorSlider.width))
|
||||
if (colorSlider.pixels.getPixel32(pixelx, pixely) != FlxColor.TRANSPARENT) colorSlider.pixels.setPixel32(pixelx, pixely, color);
|
||||
for (pixelY in 0...Std.int(colorSlider.height)) {
|
||||
var color:Int = FlxColor.fromHSB(pixelY / (colorSlider.height-1) * 360, 1, 1);
|
||||
for (pixelX in 0...Std.int(colorSlider.width))
|
||||
if (colorSlider.pixels.getPixel32(pixelX, pixelY) != FlxColor.TRANSPARENT) colorSlider.pixels.setPixel32(pixelX, pixelY, color);
|
||||
}
|
||||
colorSlider.pixels.unlock();
|
||||
|
||||
@@ -123,7 +123,7 @@ class UIColorwheel extends UISliceSprite {
|
||||
public var colorChanged:Bool = false;
|
||||
|
||||
// Make the colorwheel feel better
|
||||
static inline var hitBoxExtenstion:Float = 8;
|
||||
static inline var hitBoxExtension:Float = 8;
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
if (hovered && FlxG.mouse.pressed) {
|
||||
@@ -132,7 +132,7 @@ class UIColorwheel extends UISliceSprite {
|
||||
for (sprite in [colorPicker, colorSlider]) {
|
||||
var spritePos:FlxPoint = sprite.getScreenPosition(FlxPoint.get(), __lastDrawCameras[0]);
|
||||
|
||||
if (((mousePos.x > (spritePos.x - (hitBoxExtenstion/2))) && (mousePos.x < spritePos.x - (hitBoxExtenstion/2) + (sprite.width + hitBoxExtenstion))) && ((mousePos.y > (spritePos.y - (hitBoxExtenstion/2))) && (mousePos.y < spritePos.y - (hitBoxExtenstion/2) + (sprite.height + hitBoxExtenstion)))) {
|
||||
if (((mousePos.x > (spritePos.x - (hitBoxExtension/2))) && (mousePos.x < spritePos.x - (hitBoxExtension/2) + (sprite.width + hitBoxExtension))) && ((mousePos.y > (spritePos.y - (hitBoxExtension/2))) && (mousePos.y < spritePos.y - (hitBoxExtension/2) + (sprite.height + hitBoxExtension)))) {
|
||||
mousePos -= FlxPoint.weak(spritePos.x, spritePos.y);
|
||||
mousePos.set(FlxMath.bound(mousePos.x, 0, sprite.width), FlxMath.bound(mousePos.y, 0, sprite.height));
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ import flixel.util.FlxColor;
|
||||
using StringTools;
|
||||
using flixel.util.FlxSpriteUtil;
|
||||
|
||||
typedef SliderSegement = {
|
||||
typedef SliderSegment = {
|
||||
var start:Float;
|
||||
var end:Float;
|
||||
var size:Float;
|
||||
}
|
||||
|
||||
class UISlider extends UISprite {
|
||||
public var segments:Array<SliderSegement> = [];
|
||||
public var segments:Array<SliderSegment> = [];
|
||||
public var barWidth:Int = 120;
|
||||
|
||||
public var progressbar:UISprite;
|
||||
@@ -36,7 +36,7 @@ class UISlider extends UISprite {
|
||||
public var valueStepper:UINumericStepper;
|
||||
public var onChange:Float->Void;
|
||||
|
||||
public function new(x:Float, y:Float, width:Int = 120, value:Float, segments:Array<SliderSegement>, centered:Bool) {
|
||||
public function new(x:Float, y:Float, width:Int = 120, value:Float, segments:Array<SliderSegment>, centered:Bool) {
|
||||
this.segments = segments;
|
||||
this.barWidth = width;
|
||||
this.progressCentered = centered;
|
||||
|
||||
@@ -13,7 +13,10 @@ import openfl.ui.MouseCursor;
|
||||
class UIState extends MusicBeatState {
|
||||
public var curContextMenu:UIContextMenu = null;
|
||||
|
||||
public static var state(get, null):UIState;
|
||||
public static var state(get, never):UIState;
|
||||
|
||||
private inline static function get_state()
|
||||
return FlxG.state is UIState ? cast FlxG.state : null;
|
||||
|
||||
public var buttonHandler:Void->Void = null;
|
||||
public var hoveredSprite:UISprite = null;
|
||||
@@ -24,9 +27,6 @@ class UIState extends MusicBeatState {
|
||||
private var __rect:FlxRect;
|
||||
private var __mousePos:FlxPoint;
|
||||
|
||||
private inline static function get_state()
|
||||
return FlxG.state is UIState ? cast FlxG.state : null;
|
||||
|
||||
public override function create() {
|
||||
__rect = new FlxRect();
|
||||
__mousePos = FlxPoint.get();
|
||||
|
||||
@@ -119,12 +119,21 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
|
||||
case END:
|
||||
position = label.text.length;
|
||||
case V:
|
||||
if (modifier == KeyModifier.LEFT_CTRL || modifier == KeyModifier.RIGHT_CTRL) {
|
||||
// paste
|
||||
var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT);
|
||||
if (data != null)
|
||||
onTextInput(data);
|
||||
}
|
||||
// Hey lj here, fixed copying because before we checked if the modifier was left or right ctrl
|
||||
// but somehow it gave a int outside of the KeyModifier's range :sob:
|
||||
// apparently there is a boolean that just checks for you. yw :D
|
||||
|
||||
// if we are not holding ctrl, ignore
|
||||
if (!modifier.ctrlKey) return;
|
||||
// we pasting
|
||||
var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT);
|
||||
if (data != null) onTextInput(data);
|
||||
case C:
|
||||
// if we are not holding ctrl, ignore
|
||||
if (!modifier.ctrlKey) return;
|
||||
|
||||
// copying
|
||||
Clipboard.generalClipboard.setData(TEXT_FORMAT, label.text);
|
||||
default:
|
||||
// nothing
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class UIUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process all options with shortcuts present in a `Array<UIContextMenuOption>`. Also checks childrens.
|
||||
* Process all options with shortcuts present in a `Array<UIContextMenuOption>`. Also checks children.
|
||||
* @param topMenuOptions
|
||||
*/
|
||||
public static function processShortcuts(topMenuOptions:Array<UIContextMenuOption>) {
|
||||
|
||||
Reference in New Issue
Block a user