forge/arma/client/addons/cad/functions/fnc_initUIBridge.sqf
Jacob Schmidt 45a4f7460a Integrate task contracts and CAD UI pipeline
- 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
2026-03-28 02:20:34 -05:00

85 lines
2.8 KiB
Plaintext

#include "..\script_component.hpp"
/*
* File: fnc_initUIBridge.sqf
* Author: IDSolutions
* Date: 2026-03-28
* Public: No
*
* Description:
* Initializes the CAD UI bridge for sidepanel browser state and task event routing.
*
* Arguments:
* None
*
* Return Value:
* CAD UI bridge object [HASHMAP OBJECT]
*
* Example:
* call forge_client_cad_fnc_initUIBridge
*/
#pragma hemtt ignore_variables ["_self"]
private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
GVAR(CADUIBridgeBaseClass) = compileFinal createHashMapFromArray [
["#base", _webUIBridgeDeclaration],
["#type", "CADUIBridgeBaseClass"],
["getActiveBrowserControl", compileFinal {
private _display = uiNamespace getVariable [QGVAR(Display), displayNull];
if (isNull _display) exitWith {
_self call ["setActiveBrowserControl", [controlNull]];
controlNull
};
private _control = _display displayCtrl 1005;
_self call ["setActiveBrowserControl", [_control]];
_control
}],
["hasOpenScreen", compileFinal {
private _screen = _self call ["getScreen", []];
private _control = _self call ["getActiveBrowserControl", []];
!(isNull _control) && { _screen call ["isReady", []] }
}],
["handleReady", compileFinal {
params [["_control", controlNull, [controlNull]], ["_data", createHashMap, [createHashMap]]];
private _screen = _self call ["getScreen", []];
_screen call ["setControl", [_control]];
_screen call ["markReady", [true]];
_self call ["flushPendingEvents", []];
_self call ["requestTaskCatalog", []];
_self call ["refreshTaskCatalog", []];
true
}],
["requestTaskCatalog", compileFinal {
[SRPC(task,requestTaskCatalog), [getPlayerUID player]] call CFUNC(serverEvent);
true
}],
["requestTaskAccept", compileFinal {
params [["_taskID", "", [""]]];
if (_taskID isEqualTo "") exitWith { false };
[SRPC(task,requestAcceptTask), [getPlayerUID player, _taskID]] call CFUNC(serverEvent);
true
}],
["refreshTaskCatalog", compileFinal {
if (isNil QGVAR(CADRepository)) exitWith { false };
GVAR(CADRepository) call ["pushTaskCatalog", [_self]]
}],
["handleTaskAcceptResponse", compileFinal {
params [["_result", createHashMap, [createHashMap]]];
_self call ["sendEvent", ["cad::tasks::accept::response", createHashMapFromArray [
["message", _result getOrDefault ["message", "Task request processed."]],
["success", _result getOrDefault ["success", false]]
]]]
}]
];
GVAR(CADUIBridge) = createHashMapObject [GVAR(CADUIBridgeBaseClass)];
GVAR(CADUIBridge)