auto complete fixes (stages)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import funkin.game.Stage;
|
||||
import funkin.backend.chart.ChartData;
|
||||
import flixel.math.FlxPoint;
|
||||
import funkin.backend.chart.ChartData.ChartMetaData;
|
||||
@@ -12,7 +13,7 @@ class ChartDataScreen extends UISubstateWindow {
|
||||
public var closeButton:UIButton;
|
||||
|
||||
public var scrollSpeedStepper:UINumericStepper;
|
||||
public var stageTextBox:UITextBox;
|
||||
public var stageTextBox:UIAutoCompleteTextBox;
|
||||
|
||||
public function new(data:ChartData) {
|
||||
super();
|
||||
@@ -34,7 +35,11 @@ class ChartDataScreen extends UISubstateWindow {
|
||||
var title:UIText;
|
||||
add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, "Edit Chart Data", 28));
|
||||
|
||||
stageTextBox = new UITextBox(title.x, title.y + title.height + 38, PlayState.SONG.stage, 200);
|
||||
var stageFileList = Stage.getList(true);
|
||||
if (stageFileList.length == 0) stageFileList = Stage.getList(false);
|
||||
|
||||
stageTextBox = new UIAutoCompleteTextBox(title.x, title.y + title.height + 38, PlayState.SONG.stage, 200);
|
||||
stageTextBox.suggestItems = stageFileList;
|
||||
add(stageTextBox);
|
||||
addLabelOn(stageTextBox, "Stage");
|
||||
|
||||
|
||||
@@ -59,7 +59,9 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
var title:UIText;
|
||||
add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, creatingStrumLine ? "Create New Strumline" : "Edit Strumline Properties", 28));
|
||||
|
||||
var charFileList = Character.getList(false);
|
||||
var charFileList = Character.getList(true);
|
||||
if (charFileList.length == 0) charFileList = Character.getList(false);
|
||||
|
||||
charactersList = new UIButtonList<CharacterButton>(15, title.y + title.height + 36, 250, 259, "", FlxPoint.get(250, 54), null, 0);
|
||||
charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0, 0, "New Char", charFileList, charactersList));
|
||||
charactersList.cameraSpacing = 0;
|
||||
@@ -133,7 +135,6 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
}, 125);
|
||||
add(closeButton);
|
||||
closeButton.color = 0xFFFF0000;
|
||||
closeButton.x -= closeButton.bWidth;
|
||||
}
|
||||
|
||||
function saveStrumline() {
|
||||
|
||||
@@ -63,10 +63,11 @@ class UIAutoCompleteTextBox extends UITextBox {
|
||||
_suggestions = [];
|
||||
if(text.length > 0) {
|
||||
for(i in suggestItems) if(!_suggestions.contains(i) && i.startsWith(text)) _suggestions.push(i);
|
||||
//for(i in suggestItems) if(!_suggestions.contains(i) && i.contains(text)) _suggestions.push(i);
|
||||
_suggestions.remove(text);
|
||||
|
||||
// Clean up suggestions
|
||||
for(i in suggestItems) if(i == text) {_suggestions = [];}
|
||||
if (_suggestions.length > 0) _suggestions.sort(function(a, b) return a.length - b.length);
|
||||
}
|
||||
_suggestions.sort(function(a, b) return a.length - b.length);
|
||||
}
|
||||
|
||||
if(suggestionText.visible = (_suggestions.length != 0)) {
|
||||
|
||||
@@ -140,7 +140,6 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
|
||||
}
|
||||
// untested, but this should be a fix for if the text wont type
|
||||
public function onTextEdit(text:String, start:Int, end:Int):Void {
|
||||
trace(text, start, end);
|
||||
label.text = label.text.substr(0, position) + text + label.text.substr(position);
|
||||
position += text.length;
|
||||
}
|
||||
|
||||
@@ -238,6 +238,17 @@ class Stage extends FlxBasic implements IBeatReceiver {
|
||||
public function stepHit(curStep:Int) {}
|
||||
|
||||
public function measureHit(curMeasure:Int) {}
|
||||
|
||||
public static function getList(?mods:Bool = false):Array<String> {
|
||||
var list:Array<String> = [];
|
||||
for (path in Paths.getFolderContent('data/stages/', true, mods ? MODS : BOTH))
|
||||
if (Path.extension(path) == "xml" || Path.extension(path) == "hx") {
|
||||
var file:String = Path.withoutDirectory(Path.withoutExtension(path));
|
||||
if (!list.contains(file)) list.push(file);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
class StageCharPos extends FlxObject {
|
||||
|
||||
Reference in New Issue
Block a user