Initial upload. Not currently functional as a mod. Includes some slightly refactored source code as well as the original mission this was debuted in zipped up as reference + example of usage.

This commit is contained in:
Clarky committed 2026-08-08 17:42:15 +10:00
commit 75b737230e
32 files changed
+2049

No files matched your search

+190
View File
@@ -0,0 +1,190 @@
/*
Author: Clarky
Purpose: Opens a dialog which a player can use to browse supported vehicles and spend Materiel to purchase / place a vehicle into the game world.
*/
#include "\a3\ui_f\hpp\definecommongrids.inc"
#include "\a3\ui_f\hpp\defineresincl.inc"
#include "\a3\ui_f\hpp\definedikcodes.inc"
import RscStructuredText;
import RscPicture;
import RscButtonMenuOK;
import RscButtonMenuCancel;
import RscListNBox;
class VehicleFactoryDialog
{
idd = 9999;
movingEnable = 1;
enableSimulation = 1;
class ControlsBackground
{
class CLF_Rsc_Text_Background: RscText
{
idc = 1103;
x = 7.25314e-07 * safezoneW;
y = 0.0247778 * safezoneH;
w = 0.340312 * safezoneW;
h = 0.481222 * safezoneH;
colorBackground[] = {0.3,0.4,0.4,0.8};
canDrag = 1;
};
class CLF_Rsc_Text_TopBar: RscText
{
idc = 1100;
x = -2.58163e-07 * safezoneW;
y = 1.43424e-08 * safezoneH;
w = 0.340312 * safezoneW;
h = 0.022 * safezoneH;
colorBackground[] = {0.4,0.5,0.5,1};
canDrag = 1;
};
class CLF_Rsc_StructuredText_Title: RscStructuredText
{
idc = 1101;
text = "<t font='EtelkaMonospaceProBold'>Vehicle Factory</t>"; //--- ToDo: Localize;
x = 0.00515599 * safezoneW;
y = 0.033 * safezoneH;
w = 0.324844 * safezoneW;
h = 0.022 * safezoneH;
colorText[] = {1,1,1,1};
colorBackground[] = {-1,-1,-1,0};
sizeEx = 1 * GUI_GRID_H;
};
class CLF_Rsc_Text_CategoryBack: RscText
{
idc = 1102;
x = 0.015469 * safezoneW;
y = 0.066 * safezoneH;
w = 0.309375 * safezoneW;
h = 0.044 * safezoneH;
colorBackground[] = {0.2,0.23,0.23,0.6};
};
class CLF_Rsc_Text_ListBackground: RscText
{
idc = 1104;
x = 0.0103132 * safezoneW;
y = 0.121 * safezoneH;
w = 0.319688 * safezoneW;
h = 0.33 * safezoneH;
colorBackground[] = {0.2,0.23,0.23,0.6};
};
class CLF_Rsc_Text_Headers1: RscText
{
idc = 1105;
text = "Vehicle Name";
x = 0.0113132 * safezoneW;
y = 0.124 * safezoneH;
w = 0.179688 * safezoneW;
h = 0.03 * safezoneH;
colorText[] = {1,1,1,1};
};
class CLF_Rsc_Text_Headers2: RscText
{
idc = 1106;
text = "Cost";
x = 0.2633132 * safezoneW;
y = 0.124 * safezoneH;
w = 0.079688 * safezoneW;
h = 0.03 * safezoneH;
colorText[] = {1,1,1,1};
};
class CLF_Rsc_Text_Headers3: RscText
{
idc = 1107;
text = "Time";
x = 0.2933132 * safezoneW;
y = 0.124 * safezoneH;
w = 0.079688 * safezoneW;
h = 0.03 * safezoneH;
colorText[] = {1,1,1,1};
};
};
class Controls
{
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by Clarky, v1.063, #Mehomo)
////////////////////////////////////////////////////////
class CLF_Rsc_ButtonMenu_Cat1: RscButtonMenu
{
idc = 2400;
text = "Unarmed"; //--- ToDo: Localize;
x = 0.0154685 * safezoneW;
y = 0.077 * safezoneH;
w = 0.0670312 * safezoneW;
h = 0.022 * safezoneH;
action = "[CLF_Category1] call CLF_fnc_populateVehicleList;";
};
class CLF_Rsc_ButtonMenu_Cat2: RscButtonMenu
{
idc = 2401;
text = "Vehicle"; //--- ToDo: Localize;
x = 0.134062 * safezoneW;
y = 0.077 * safezoneH;
w = 0.0721875 * safezoneW;
h = 0.022 * safezoneH;
action = "[CLF_Category2] call CLF_fnc_populateVehicleList;";
};
class CLF_Rsc_ButtonMenu_Aircraft: RscButtonMenu
{
idc = 2402;
text = "Support"; //--- ToDo: Localize;
x = 0.257812 * safezoneW;
y = 0.077 * safezoneH;
w = 0.0670312 * safezoneW;
h = 0.022 * safezoneH;
action = "[CLF_Category3] call CLF_fnc_populateVehicleList;";
};
class CLF_Rsc_ListNBox_Vehicles: RscListNBox
{
idc = 1500;
x = 0.0103132 * safezoneW;
y = 0.158 * safezoneH;
w = 0.319688 * safezoneW;
h = 0.290 * safezoneH;
columns[] = {
0.00,
0.80,
0.90
};
};
class CLF_Rsc_ButtonMenuOK: RscButtonMenuOK
{
text = "Confirm"; //--- ToDo: Localize;
x = 0.0154695 * safezoneW;
y = 0.462 * safezoneH;
w = 0.061875 * safezoneW;
h = 0.022 * safezoneH;
tooltip = "Confirm selection."; //--- ToDo: Localize;
action = "[] call CLF_fnc_factoryConfirmSelection;";
};
class CLF_Rsc_ButtonMenuCancel: RscButtonMenuCancel
{
x = 0.262969 * safezoneW;
y = 0.462 * safezoneH;
w = 0.061875 * safezoneW;
h = 0.022 * safezoneH;
tooltip = "Close dialog."; //--- ToDo: Localize;
};
/*
class CLF_Rsc_ControlsGroup_Main: RscControlsGroup
{
idc = 2300;
x = 0.329843 * safezoneW + safezoneX;
y = 0.258 * safezoneH + safezoneY;
w = 0.340312 * safezoneW;
h = 0.506 * safezoneH;
showHScrollbar = 0;
};*/
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////
};
};
+87
View File
@@ -0,0 +1,87 @@
/*
Author: Clarky
Usage:
[_category] call CLF_fnc_populateVehicleList;
Intended to be called via the VehicleFactory dialog
Purpose:
Populate's the display's listbox with relevant data from the chosen category
*/
// Pass in the category to load
params ["_category"];
// Load up the vehicle factory dialog - IDC 9999
private _display = findDisplay 9999;
private _listBox = _display displayCtrl 1500;
// Exit if no valid display or listbox found
if (isNull _display) exitWith {hint "Error loading Vehicle Factory Dialog";};
if (isNull _listBox) exitWith {hint "Error loading Vehicle Factory Listbox";};
// Unload the current listbox if it already has data
lnbClear _listBox;
_display setVariable [
"CurrentCategory",
_category
];
{
// Load up params from the currently looped vehicle in supplied category
_x params [
"_class",
"_cost",
"_buildTime",
"_specialisation",
"_specialisationData"
];
// Determine attributes to load into the list row
private _displayName = getText(configFile >> "CfgVehicles" >> _class >> "displayName");
private _icon = getText(configFile >> "CfgVehicles" >> _class >> "icon");
// private _icon = "\A3\ui_f\data\map\VehicleIcons\iconObject_1x1_ca.paa";
// If vehicle is tagged with a specialisation, update display name for row
if (_specialisation == "SUPPLY") then {
private _baseDisplayName = _displayName;
_displayName = format ["[SUPPLY] %1", _baseDisplayName];
};
if (_specialisation == "BUILD") then {
private _baseDisplayName = _displayName;
_displayName = format ["[BUILD] %1", _baseDisplayName];
};
private _row = _listBox lnbAddRow [
_displayName,
str _cost,
str _buildTime
];
_listBox lnbSetColor [[_row,0], [1,1,1,1]];
_listBox lnbSetColor [[_row,1], [0.8,0.8,0.8,1]];
_listBox lnbSetColor [[_row,3], [1,1,1,1]];
//_listBox lnbSetColor [[_row,4], [0.8,0.8,0.8,1]];
// Store the vehicle data in the listbox row so that it can be retrieved when the Confirm button is pressed on the dialog
private _vehicleData = [
_class,
_cost,
_buildTime,
_specialisation,
_specialisationData
];
_listBox lnbSetData [
[_row,0],
str _vehicleData
];
// Update new row's icon and set its index for retrieval later
_listBox lnbSetPicture [[_row,0], _icon];
_listBox lnbSetValue [[_row,0], _forEachIndex];
} foreach _category;