Added buttonlist for softcoded, added attributes list
This commit is contained in:
@@ -6,28 +6,36 @@ class PropertyButton extends UIButton {
|
||||
public var deleteButton:UIButton;
|
||||
public var deleteIcon:FlxSprite;
|
||||
|
||||
public function new(property, value, parent) {
|
||||
super(0, 0, '', function () {}, 280, 35);
|
||||
members.push(propertyText = new UITextBox(5, 5, property, 100, 25));
|
||||
members.push(valueText = new UITextBox(propertyText.x + propertyText.bWidth + 10, 5, value, 135, 25));
|
||||
public function new(property, value, parent, width:Int = 280, height:Int = 35, nameWidth:Int = 100, valueWidth:Int = 135, inputHeight:Int = 25) {
|
||||
super(0, 0, '', function () {}, width, height);
|
||||
members.push(propertyText = new UITextBox(5, 5, property, nameWidth, inputHeight));
|
||||
members.push(valueText = new UITextBox(propertyText.x + propertyText.bWidth + 10, 5, value, valueWidth, inputHeight));
|
||||
|
||||
deleteButton = new UIButton(valueText.x + 135, bHeight/2 - (25/2), "", function () {
|
||||
var deleteSize = height - 5 * 2;
|
||||
deleteButton = new UIButton(valueText.x + 135, bHeight/2 - (deleteSize/2), "", function () {
|
||||
parent.remove(this);
|
||||
}, 25, 25);
|
||||
}, deleteSize, deleteSize);
|
||||
deleteButton.color = 0xFFFF0000;
|
||||
deleteButton.autoAlpha = false;
|
||||
members.push(deleteButton);
|
||||
|
||||
deleteIcon = new FlxSprite(deleteButton.x + (15/2), deleteButton.y + 8).loadGraphic(Paths.image('editors/delete-button'));
|
||||
deleteIcon = new FlxSprite(deleteButton.x, deleteButton.y).loadGraphic(Paths.image('editors/delete-button'));
|
||||
deleteIcon.antialiasing = false;
|
||||
members.push(deleteIcon);
|
||||
|
||||
updatePos();
|
||||
}
|
||||
|
||||
public override function update(elapsed) {
|
||||
super.update(elapsed);
|
||||
propertyText.follow(this, 5, 5);
|
||||
valueText.follow(this, propertyText.x + propertyText.bWidth, 5);
|
||||
deleteButton.follow(this, valueText.x + 135, bHeight/2 - (25/2));
|
||||
deleteIcon.follow(deleteButton, 5, 5);
|
||||
updatePos();
|
||||
}
|
||||
|
||||
public function updatePos() {
|
||||
propertyText.follow(this, 5, bHeight/2 - (propertyText.bHeight/2));
|
||||
valueText.follow(this, propertyText.x + propertyText.bWidth, bHeight/2 - (valueText.bHeight/2));
|
||||
//deleteButton.follow(this, valueText.x + 135, bHeight/2 - (25/2));
|
||||
deleteButton.follow(this, bWidth - deleteButton.bWidth - 5, bHeight/2 - deleteButton.bHeight/2);
|
||||
deleteIcon.follow(deleteButton, deleteButton.bWidth / 2 - deleteIcon.width / 2, deleteButton.bHeight / 2 - deleteIcon.height / 2);
|
||||
}
|
||||
}
|
||||
@@ -197,6 +197,7 @@ class StageEditor extends UIState {
|
||||
|
||||
// Load from xml
|
||||
var order:Array<Dynamic> = [];
|
||||
var orderNodes:Array<Access> = [];
|
||||
stage = new Stage(__stage, this, false);
|
||||
stage.onXMLLoaded = function(xml:Access, elems:Array<Access>) {
|
||||
return elems;
|
||||
@@ -212,14 +213,14 @@ class StageEditor extends UIState {
|
||||
}
|
||||
stage.onNodeLoaded = function(node:Access, sprite:Dynamic):Dynamic {
|
||||
var parent = new Access(node.x.parent);
|
||||
var name = "";
|
||||
//var name = "";
|
||||
trace(node, sprite);
|
||||
if(sprite is FlxSprite) {
|
||||
//sprite.forceIsOnScreen = true; // hack
|
||||
}
|
||||
if(sprite is FunkinSprite) {
|
||||
var sprite:FunkinSprite = cast sprite;
|
||||
name = sprite.name;
|
||||
//name = sprite.name;
|
||||
sprite.extra.set(exID("node"), node);
|
||||
sprite.extra.set(exID("type"), node.name);
|
||||
sprite.extra.set(exID("imageFile"), '${node.getAtt("sprite").getDefault(sprite.name)}');
|
||||
@@ -236,7 +237,7 @@ class StageEditor extends UIState {
|
||||
case "girlfriend": "gf";
|
||||
default: charPos.name;
|
||||
}
|
||||
name = charPos.name;
|
||||
//name = charPos.name;
|
||||
var char = new Character(0,0, charName, stage.isCharFlipped(charPos.name, charName == "bf"), true);
|
||||
char.debugMode = true;
|
||||
// Play first anim, and make it the last frame
|
||||
@@ -265,6 +266,7 @@ class StageEditor extends UIState {
|
||||
chars.push(char);
|
||||
}
|
||||
order.push(sprite);
|
||||
orderNodes.push(node);
|
||||
xmlMap.set(sprite, node);
|
||||
|
||||
return sprite;
|
||||
@@ -325,7 +327,7 @@ class StageEditor extends UIState {
|
||||
openSubState(substate);
|
||||
}
|
||||
for (i=>sprite in order) {
|
||||
var xml = xmlMap.get(sprite);
|
||||
var xml = (sprite != null) ? xmlMap.get(sprite) : orderNodes[i];
|
||||
if(xml != null) {
|
||||
if(sprite is FunkinSprite) {
|
||||
var sprite:FunkinSprite = cast sprite;
|
||||
@@ -951,7 +953,8 @@ class StageEditor extends UIState {
|
||||
}
|
||||
|
||||
function handleSelection(sprite:FunkinSprite) {
|
||||
var buttonBoxes = sprite.extra.get(exID("buttonBoxes"));
|
||||
if(!sprite.extra.exists(exID("buttonBoxes"))) return;
|
||||
var buttonBoxes:Array<FlxPoint> = cast sprite.extra.get(exID("buttonBoxes"));
|
||||
|
||||
dotCheckSize = dot.frameWidth / 0.7/stageCamera.zoom; // basically adjust it to the zoom.
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ class StageCharacterButton extends StageElementButton {
|
||||
public override function updateInfo() {
|
||||
char.visible = !isHidden;
|
||||
char.alpha = 0.5 * charPos.alpha;
|
||||
charPos.scale.x = char.scale.x;
|
||||
charPos.scale.y = char.scale.y;
|
||||
super.updateInfo();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ class UISoftcodedWindow extends UISubstateWindow {
|
||||
set(k, e);
|
||||
}
|
||||
set("self", this);
|
||||
set("hasSaveButtons", true);
|
||||
set("hasSaveButton", true);
|
||||
set("hasCloseButton", true);
|
||||
set("getRadioButtons", function(forID:String) {
|
||||
var radios:Array<UIRadioButton> = cast members.filter((o) -> o is UIRadioButton);
|
||||
return cast radios.filter((o) -> o.forID == forID);
|
||||
@@ -231,6 +232,36 @@ class UISoftcodedWindow extends UISubstateWindow {
|
||||
add(dropdown);
|
||||
addLabelOn(dropdown, label);
|
||||
dropdown;
|
||||
case "buttonlist":
|
||||
//x:Float, y:Float, width:Int, height:Int, windowName:String, buttonSize:FlxPoint, ?buttonOffset:FlxPoint, ?buttonSpacing:Float
|
||||
var buttonlist = new UIButtonList<UIButton>(
|
||||
x,
|
||||
y,
|
||||
execAtt(el, "width"),
|
||||
execAtt(el, "height"),
|
||||
execString(el.getAtt("title")).getDefault(""),
|
||||
FlxPoint.get(execAtt(el, "buttonSizeX", 0), execAtt(el, "buttonSizeY", 0)),
|
||||
FlxPoint.get(execAtt(el, "buttonOffsetX", 0), execAtt(el, "buttonOffsetY", 0)),
|
||||
execAtt(el, "buttonSpacing")
|
||||
);
|
||||
var old = get("buttonlist");
|
||||
set("buttonlist", buttonlist);
|
||||
var texture = "editors/ui/inputbox";
|
||||
var code = "";
|
||||
for(node in getArr(el.elements)) {
|
||||
switch(node.name) {
|
||||
case "camSpacing": buttonlist.cameraSpacing = execAtt(node, "value", 0);
|
||||
case "texture": texture = execString(node.getAtt("path")).getDefault(texture);
|
||||
case "code": code = node.innerData;
|
||||
}
|
||||
}
|
||||
buttonlist.frames = Paths.getFrames(texture);
|
||||
if(code != "")
|
||||
exec(code);
|
||||
add(buttonlist);
|
||||
addLabelOn(buttonlist, label);
|
||||
set("buttonlist", old);
|
||||
buttonlist;
|
||||
// UIColorwheel
|
||||
// UIAudioPlayer
|
||||
// UIButtonList
|
||||
|
||||
Reference in New Issue
Block a user