- replace placeholder garage interaction with real UI open flow - add catalog/session/UI bridge services for hydrate, sync, store, and retrieve actions - migrate garage web UI bundle to new app shell/runtime structure - align org/store function naming with shared init and UI bridge patterns
67 lines
1.7 KiB
Plaintext
67 lines
1.7 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_handleUIEvents.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2025-12-16
|
|
* Last Update: 2026-01-30
|
|
* Public: No
|
|
*
|
|
* Description:
|
|
* Handles the UI events.
|
|
*
|
|
* Arguments:
|
|
* 0: [CONTROL] - The control that triggered the event
|
|
* 1: [BOOL] - Whether the event is from a confirm dialog
|
|
* 2: [STRING] - The message containing the event data
|
|
*
|
|
* Return Value:
|
|
* UI events handled [BOOL]
|
|
*
|
|
* Example:
|
|
* call forge_client_garage_fnc_handleUIEvents;
|
|
*/
|
|
|
|
params ["_control", "_isConfirmDialog", "_message"];
|
|
|
|
private _alert = fromJSON _message;
|
|
private _event = _alert get "event";
|
|
private _data = _alert get "data";
|
|
|
|
diag_log format ["[FORGE:Client:Garage] Handling UI event: %1 with data: %2", _event, _data];
|
|
|
|
switch (_event) do {
|
|
case "garage::close": {
|
|
if !(isNil QGVAR(GarageUIBridge)) then {
|
|
GVAR(GarageUIBridge) call ["handleClose", []];
|
|
};
|
|
|
|
closeDialog 1;
|
|
};
|
|
case "garage::ready": {
|
|
if !(isNil QGVAR(GarageUIBridge)) then {
|
|
GVAR(GarageUIBridge) call ["handleReady", [_control, _data]];
|
|
};
|
|
};
|
|
case "garage::vehicle::retrieve::request": {
|
|
if !(isNil QGVAR(GarageUIBridge)) then {
|
|
GVAR(GarageUIBridge) call ["handleRetrieveRequest", [_data]];
|
|
};
|
|
};
|
|
case "garage::vehicle::store::request": {
|
|
if !(isNil QGVAR(GarageUIBridge)) then {
|
|
GVAR(GarageUIBridge) call ["handleStoreRequest", [_data]];
|
|
};
|
|
};
|
|
case "garage::refresh": {
|
|
if !(isNil QGVAR(GarageUIBridge)) then {
|
|
GVAR(GarageUIBridge) call ["refreshGarage", []];
|
|
};
|
|
};
|
|
default {
|
|
hint format ["Unhandled garage UI event: %1", _event];
|
|
};
|
|
};
|
|
|
|
true;
|