- add the imported server task addon to the current framework with task ownership, task catalog, mission-manager attack generation, org-owned reward routing, participant notifications, and reputation syncing - restructure org persistence so core org data, assets, fleet, and members are handled through the current Redis/extension model with matching Rust repository and service updates - wire the client CAD addon into the framework, actor device action, shared web UI bridge pattern, and task listing/acceptance flow - add a source-driven CAD web UI layout with ui.config.mjs and extend the shared web UI builder to support custom HTML template pages for multi-surface UIs
88 lines
2.6 KiB
Plaintext
88 lines
2.6 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_handleUIEvents.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2026-03-28
|
|
* Public: No
|
|
*
|
|
* Description:
|
|
* Handles CAD browser UI events.
|
|
*
|
|
* Arguments:
|
|
* 0: Control [CONTROL]
|
|
* 1: Confirm dialog flag [BOOL]
|
|
* 2: Browser message [STRING]
|
|
*
|
|
* Return Value:
|
|
* UI event handled [BOOL]
|
|
*
|
|
* Example:
|
|
* [_control, false, _message] call forge_client_cad_fnc_handleUIEvents
|
|
*/
|
|
|
|
params ["_control", "_isConfirmDialog", "_message"];
|
|
|
|
private _alert = fromJSON _message;
|
|
private _event = _alert getOrDefault ["event", ""];
|
|
private _data = _alert getOrDefault ["data", nil];
|
|
|
|
diag_log format ["[FORGE:Client:CAD] Handling UI event: %1", _event];
|
|
|
|
if (_isConfirmDialog) exitWith { true };
|
|
|
|
switch (_event) do {
|
|
case "cad::ready": {
|
|
GVAR(CADUIBridge) call ["handleReady", [_control, _data]];
|
|
};
|
|
case "cad::tasks::refresh": {
|
|
GVAR(CADUIBridge) call ["requestTaskCatalog", []];
|
|
};
|
|
case "cad::tasks::accept": {
|
|
private _taskID = "";
|
|
if (_data isEqualType createHashMap) then {
|
|
_taskID = _data getOrDefault ["taskID", ""];
|
|
};
|
|
|
|
GVAR(CADUIBridge) call ["requestTaskAccept", [_taskID]];
|
|
};
|
|
case "map::zoomIn": {
|
|
private _mapCtrl = uiNamespace getVariable [QGVAR(MapCtrl), controlNull];
|
|
if (isNull _mapCtrl) exitWith {};
|
|
|
|
private _currentZoom = ctrlMapScale _mapCtrl;
|
|
private _newZoom = (_currentZoom * 0.5) max 0.001;
|
|
private _center = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5];
|
|
_mapCtrl ctrlMapAnimAdd [0.3, _newZoom, _center];
|
|
ctrlMapAnimCommit _mapCtrl;
|
|
};
|
|
case "map::zoomOut": {
|
|
private _mapCtrl = uiNamespace getVariable [QGVAR(MapCtrl), controlNull];
|
|
if (isNull _mapCtrl) exitWith {};
|
|
|
|
private _currentZoom = ctrlMapScale _mapCtrl;
|
|
private _newZoom = (_currentZoom * 2) min 1;
|
|
private _center = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5];
|
|
_mapCtrl ctrlMapAnimAdd [0.3, _newZoom, _center];
|
|
ctrlMapAnimCommit _mapCtrl;
|
|
};
|
|
case "map::search": {
|
|
private _query = str _data;
|
|
private _bottomBar = uiNamespace getVariable [QGVAR(BottomBarCtrl), controlNull];
|
|
if (isNull _bottomBar) exitWith {};
|
|
|
|
_bottomBar ctrlWebBrowserAction ["ExecJS", format ["updateStatus('Search not yet implemented: %1');", _query]];
|
|
};
|
|
case "map::close": {
|
|
if !(isNil QGVAR(CADUIBridge)) then {
|
|
GVAR(CADUIBridge) call ["handleClose", []];
|
|
};
|
|
closeDialog 1;
|
|
};
|
|
default {
|
|
diag_log format ["[FORGE:Client:CAD] WARNING: Unhandled UI event: %1", _event];
|
|
};
|
|
};
|
|
|
|
true
|