Icons for events in selector

Fixed crash when copying nothing
Fixed bug when constantly pressing right click
This commit is contained in:
NeeEoo
2023-06-10 11:58:12 +02:00
parent ee97bf118b
commit 256c7ae40a
11 changed files with 40 additions and 12 deletions
+1
View File
@@ -29,6 +29,7 @@
- [ ] Character Editor
- [ ] Add credits
- [ ] Verbose mode (`--verbose`)
- [ ] Tooltips
- [ ] Fix bugs
## `v1.1.0`
+3 -3
View File
@@ -86,7 +86,7 @@ class EditorPicker extends MusicBeatSubstate {
return;
}
changeSelection(-FlxG.mouse.wheel + (controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
FlxG.mouse.getScreenPosition(camera, curMousePos);
if (curMousePos.x != oldMousePos.x || curMousePos.y != oldMousePos.y) {
oldMousePos.set(curMousePos.x, curMousePos.y);
@@ -98,7 +98,7 @@ class EditorPicker extends MusicBeatSubstate {
if (options[curSelected].state != null) {
selected = true;
CoolUtil.playMenuSFX(CONFIRM);
MusicBeatState.skipTransIn = true;
MusicBeatState.skipTransOut = true;
@@ -187,7 +187,7 @@ class EditorPickerOption extends FlxTypedSpriteGroup<FlxSprite> {
selectionBG.alpha = (iconSpr.alpha = FlxEase.cubeOut(selectionLerp)) * 0.5;
selectionBG.x = FlxMath.lerp(-FlxG.width, 0, selectionLerp);
label.x = FlxMath.lerp(10, 25 + iconSpr.width + 25, selectionLerp);
iconSpr.x = label.x - 25 - iconSpr.width;
iconSpr.angle = Math.sin(iconRotationCycle * 0.5) * 5;
+6 -1
View File
@@ -491,6 +491,7 @@ class Charter extends UIState {
if (FlxG.mouse.justReleasedRight) {
if (!selection.contains(n))
selection = [n];
closeCurrentContextMenu();
openContextMenu(topMenu[1].childs);
}
}
@@ -618,8 +619,10 @@ class Charter extends UIState {
}
}
if (FlxG.mouse.justReleasedRight)
if (FlxG.mouse.justReleasedRight) {
closeCurrentContextMenu();
openContextMenu(topMenu[1].childs);
}
}
if (gridActionType == NONE && mousePos.x < 0) {
@@ -807,6 +810,8 @@ class Charter extends UIState {
#end
function _edit_copy(_) {
if(selection.length == 0) return;
var minStep:Float = selection[0].step;
for(s in selection)
if (s.step < minStep)
@@ -11,9 +11,13 @@ class CharterBackdrop extends FlxBackdrop {
makeGraphic(160, 160, 0xFF272727, true);
pixels.lock();
// Checkerboard
for(y in 0...4)
for(x in 0...2)
pixels.fillRect(new Rectangle(40*((x*2)+(y%2)), 40*y, 40, 40), 0xFF545454);
// Edges
pixels.fillRect(new Rectangle(0, 0, 1, 160), 0xFFDDDDDD);
pixels.fillRect(new Rectangle(159, 0, 1, 160), 0xFFDDDDDD);
pixels.unlock();
@@ -41,7 +41,7 @@ class CharterEvent extends UISliceSprite {
case "Camera Movement":
// custom icon for camera movement
var state = cast(FlxG.state, Charter);
if (event.params[0] != null && event.params[0] >= 0 && event.params[0] < state.strumLines.length) {
if (event.params != null && event.params[0] != null && event.params[0] >= 0 && event.params[0] < state.strumLines.length) {
// camera movement, use health icon
var healthIcon = new HealthIcon('${state.strumLines.members[event.params[0]].strumLine.characters[0]}');
healthIcon.setUnstretchedGraphicSize(32, 32, false);
@@ -14,7 +14,6 @@ class CharterEventAdd extends UISliceSprite {
members.push(text);
cursor = BUTTON;
}
public override function onHovered() {
@@ -17,10 +17,22 @@ class CharterEventTypeSelection extends UISubstateWindow {
var lastIndex:Int = 0;
for(k=>eventName in EventsData.eventsList) {
add(new UIButton(10, 41 + (32 * k), eventName, function() {
var button = new UIButton(10, 41 + (32 * k), eventName, function() {
close();
callback(eventName);
}, w));
}, w);
add(button);
var icon = CharterEvent.generateEventIcon({
name: eventName,
time: 0,
params: []
});
icon.setGraphicSize(20, 20); // Std.int(button.bHeight - 12)
icon.updateHitbox();
icon.x = button.x + 8;
icon.y = button.y + Math.abs(button.bHeight - icon.height) / 2;
add(icon);
lastIndex = k;
}
@@ -45,7 +45,7 @@ class CharterSelection extends EditorTreeMenu {
if (optionsTree.members.length > 1) { // selected a song
// small flashbang
var color:FlxColor = freeplayList.songs[main.curSelected].parsedColor.getDefault(0xFFFFFFFF);
bg.colorTransform.redOffset = 0.25 * color.red;
bg.colorTransform.greenOffset = 0.25 * color.green;
bg.colorTransform.blueOffset = 0.25 * color.blue;
+2 -2
View File
@@ -49,12 +49,12 @@ class EventsData {
eventsParams.set(eventName, []);
var fileTxt:String = Assets.getText(file);
if (fileTxt.trim() == "") {continue;}
if (fileTxt.trim() == "") continue;
try {
var data:Dynamic = Json.parse(fileTxt);
if (data == null || data.params == null) continue;
var finalParams:Array<EventParamInfo> = [];
for (paramData in cast(data.params, Array<Dynamic>)) {
try {
+6 -1
View File
@@ -117,9 +117,14 @@ class UIState extends MusicBeatState {
FlxG.stage.window.onTextInput.remove(onTextInput);
}
public function closeCurrentContextMenu() {
if(curContextMenu != null)
curContextMenu.close();
}
public function openContextMenu(options:Array<UIContextMenuOption>, ?callback:UIContextMenuCallback, ?x:Float, ?y:Float) {
var state = FlxG.state;
while(state.subState != null)
while(state.subState != null && !(state._requestSubStateReset && state._requestedSubState == null))
state = state.subState;
state.persistentDraw = true;
+2
View File
@@ -8,5 +8,7 @@ class UIText extends FunkinText {
public function new(x, y, w, text, size:Int = 15, color:FlxColor = 0xFFFFFFFF) {
super(x, y, w, text, size, false);
this.color = color;
this.active = false;
}
}