From 1a4893e3f700d9410bad64b11398fd8c61548aa9 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Tue, 14 Nov 2023 23:32:35 +0100 Subject: [PATCH] onReady proxy --- haxe/ui/backend/flixel/UIRuntimeFragment.hx | 6 ++++++ haxe/ui/backend/flixel/UIRuntimeState.hx | 6 ++++++ haxe/ui/backend/flixel/UIRuntimeSubState.hx | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/haxe/ui/backend/flixel/UIRuntimeFragment.hx b/haxe/ui/backend/flixel/UIRuntimeFragment.hx index 5bb15a6..3ab0575 100644 --- a/haxe/ui/backend/flixel/UIRuntimeFragment.hx +++ b/haxe/ui/backend/flixel/UIRuntimeFragment.hx @@ -19,10 +19,16 @@ class UIRuntimeFragment extends UIFragmentBase implements IComponentDelegate { / root = buildViaRTTI(rtti); linkViaRTTI(rtti, this, root); if (root != null) { + root.registerEvent(UIEvent.READY, (_) -> { + onReady(); + }); add(root); } } + private function onReady() { + } + public var component(get, set):Component; private function get_component():Component { return root; diff --git a/haxe/ui/backend/flixel/UIRuntimeState.hx b/haxe/ui/backend/flixel/UIRuntimeState.hx index 9bb975d..31ea1dd 100644 --- a/haxe/ui/backend/flixel/UIRuntimeState.hx +++ b/haxe/ui/backend/flixel/UIRuntimeState.hx @@ -21,11 +21,17 @@ class UIRuntimeState extends UIStateBase { // uses rtti to "build" a class with root = buildViaRTTI(rtti); linkViaRTTI(rtti, this, root); if (root != null) { + root.registerEvent(UIEvent.READY, (_) -> { + onReady(); + }); Screen.instance.addComponent(root); } super.create(); } + private function onReady() { + } + ///////////////////////////////////////////////////////////////////////////////////////////////// // util functions ///////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/haxe/ui/backend/flixel/UIRuntimeSubState.hx b/haxe/ui/backend/flixel/UIRuntimeSubState.hx index a27ee76..6d0dba2 100644 --- a/haxe/ui/backend/flixel/UIRuntimeSubState.hx +++ b/haxe/ui/backend/flixel/UIRuntimeSubState.hx @@ -21,11 +21,17 @@ class UIRuntimeSubState extends UISubStateBase { // uses rtti to "build" a class root = buildViaRTTI(rtti); linkViaRTTI(rtti, this, root); if (root != null) { + root.registerEvent(UIEvent.READY, (_) -> { + onReady(); + }); Screen.instance.addComponent(root); } super.create(); } + private function onReady() { + } + ///////////////////////////////////////////////////////////////////////////////////////////////// // util functions /////////////////////////////////////////////////////////////////////////////////////////////////