From 993310906e0e85224a329233510af586b3d91360 Mon Sep 17 00:00:00 2001 From: UncertainProd <83609901+UncertainProd@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:02:17 +0530 Subject: [PATCH] Fix for incorrect handling of click-event in FlxUIPopup --- flixel/addons/ui/FlxUIPopup.hx | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/flixel/addons/ui/FlxUIPopup.hx b/flixel/addons/ui/FlxUIPopup.hx index 0b6f1d2..7a495a4 100644 --- a/flixel/addons/ui/FlxUIPopup.hx +++ b/flixel/addons/ui/FlxUIPopup.hx @@ -188,29 +188,20 @@ class FlxUIPopup extends FlxUISubState implements IFlxUIWidget switch (id) { case FlxUITypedButton.CLICK_EVENT: - var str = ""; if (eventParams != null) { - if ((eventParams[0] is String)) + var buttonAmount:Int = Std.int(eventParams[0]); + if ((_parentState is IFlxUIState)) { - str = Std.string(eventParams[0]); + // This fixes a bug where the event was being sent to this popup rather than the state that created it + castParent().getEvent(CLICK_EVENT, this, buttonAmount, eventParams); } - - var buttonAmount:Int = Std.int(eventParams[0]); - if (str == "affirm" || str == "cancel" || str == "alt") + else { - if ((_parentState is IFlxUIState)) - { - // This fixes a bug where the event was being sent to this popup rather than the state that created it - castParent().getEvent(CLICK_EVENT, this, buttonAmount, eventParams); - } - else - { - // This is a generic fallback in case something goes wrong - FlxUI.event(CLICK_EVENT, this, buttonAmount, eventParams); - } - close(); + // This is a generic fallback in case something goes wrong + FlxUI.event(CLICK_EVENT, this, buttonAmount, eventParams); } + close(); } } super.getEvent(id, sender, data, eventParams);