forge/arma/client/addons/cad/functions/fnc_initUI.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

91 lines
2.6 KiB
Plaintext

#include "..\script_component.hpp"
/*
* File: fnc_initUI.sqf
* Author: IDSolutions
* Date: 2026-03-28
* Public: No
*
* Description:
* Initializes the CAD map dialog controls and local map event handling.
*
* Arguments:
* 0: Display [DISPLAY]
*
* Return Value:
* UI initialized [BOOL]
*
* Example:
* [_display] call forge_client_cad_fnc_initUI
*/
params [["_display", displayNull, [displayNull]]];
if (isNull _display) exitWith { false };
private _mapCtrl = _display displayCtrl 1001;
private _topBarCtrl = _display displayCtrl 1002;
private _bottomBarCtrl = _display displayCtrl 1003;
private _sidePanelCtrl = _display displayCtrl 1005;
uiNamespace setVariable [QGVAR(Display), _display];
uiNamespace setVariable [QGVAR(MapCtrl), _mapCtrl];
uiNamespace setVariable [QGVAR(TopBarCtrl), _topBarCtrl];
uiNamespace setVariable [QGVAR(BottomBarCtrl), _bottomBarCtrl];
uiNamespace setVariable [QGVAR(SidePanelCtrl), _sidePanelCtrl];
private _center = if (isNull player) then {
[worldSize / 2, worldSize / 2, 0]
} else {
getPosATL player
};
_mapCtrl ctrlMapAnimAdd [0, 0.2, _center];
ctrlMapAnimCommit _mapCtrl;
_mapCtrl ctrlAddEventHandler ["MouseButtonClick", {
params ["_ctrl", "_button", "_xPos", "_yPos"];
private _worldPos = _ctrl ctrlMapScreenToWorld [_xPos, _yPos];
private _bottomBar = uiNamespace getVariable [QGVAR(BottomBarCtrl), controlNull];
if (isNull _bottomBar) exitWith {};
private _jsCode = format [
"updateStatus('Clicked at: %1, %2');",
round (_worldPos # 0),
round (_worldPos # 1)
];
_bottomBar ctrlWebBrowserAction ["ExecJS", _jsCode];
}];
_mapCtrl ctrlAddEventHandler ["MouseMoving", {
params ["_ctrl", "_xPos", "_yPos"];
private _worldPos = _ctrl ctrlMapScreenToWorld [_xPos, _yPos];
private _topBar = uiNamespace getVariable [QGVAR(TopBarCtrl), controlNull];
if (isNull _topBar) exitWith {};
private _jsCode = format [
"updateCoordinates(%1, %2);",
_worldPos # 0,
_worldPos # 1
];
_topBar ctrlWebBrowserAction ["ExecJS", _jsCode];
}];
[] spawn {
while { !isNull (uiNamespace getVariable [QGVAR(Display), displayNull]) } do {
private _mapCtrl = uiNamespace getVariable [QGVAR(MapCtrl), controlNull];
private _topBar = uiNamespace getVariable [QGVAR(TopBarCtrl), controlNull];
if (!isNull _mapCtrl && { !isNull _topBar }) then {
_topBar ctrlWebBrowserAction ["ExecJS", format ["updateScale(%1);", round (ctrlMapScale _mapCtrl)]];
};
sleep 0.5;
};
};
diag_log "[FORGE:Client:CAD] CAD UI initialized.";
true