mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Improve selective UI API (#3805)
* Improve selective UI API, Disable ammo count when reload component is loaded, Fix stance UI * Upgrade Selective UI framework for controls that share IDCs for gunner and soldier * Separate more soldier and gunner settings sharing same IDCs, Remove vehicle gunner weapon which has no effect anymore * Separate more soldier and gunner IDC sharing elements, Fix typo, Fix API setting not being respected in case where selective type is not the same on load * Rework Selective UI using ACE_UI config, Cleanup, Add ACE_UI to FCS component to mark it (is already disabled due to other necessary settings for FCS to function) * Do location check in function, Rename condition to location, change to number * Use macros in ACE_UI location
This commit is contained in:
parent
5c7148de1f
commit
4c995d4c5c
@ -111,4 +111,8 @@ class RscInGameUI {
|
||||
class RscStaminaBar {
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscStaminaBar"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgStaminaBar)),_this select 0)]);
|
||||
};
|
||||
|
||||
class RscStanceInfo {
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscStanceInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Stance')])] call FUNC(localEvent););
|
||||
};
|
||||
};
|
||||
|
7
addons/fcs/ACE_UI.hpp
Normal file
7
addons/fcs/ACE_UI.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
class ACE_UI {
|
||||
class gunnerZeroing {
|
||||
class conditions {
|
||||
ADDON = "false";
|
||||
};
|
||||
};
|
||||
};
|
@ -14,6 +14,7 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "ACE_UI.hpp"
|
||||
|
||||
#include "CfgAmmo.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
|
7
addons/reload/ACE_UI.hpp
Normal file
7
addons/reload/ACE_UI.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
class ACE_UI {
|
||||
class ammoCount {
|
||||
class conditions {
|
||||
ADDON = "false";
|
||||
};
|
||||
};
|
||||
};
|
@ -14,11 +14,8 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "CfgVehicles.hpp"
|
||||
|
||||
#include "CfgMagazines.hpp"
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
|
||||
#include "CfgActions.hpp"
|
||||
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "ACE_UI.hpp"
|
||||
|
@ -14,4 +14,4 @@
|
||||
#define DEBUG_SETTINGS DEBUG_ENABLED_RELOAD
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
@ -45,7 +45,7 @@ class ACE_Settings {
|
||||
};
|
||||
|
||||
// ADVANCED
|
||||
// Upper Weapon Info
|
||||
// Soldier
|
||||
class GVAR(weaponName) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(WeaponName);
|
||||
@ -70,8 +70,6 @@ class ACE_Settings {
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
|
||||
// Lower Weapon Info
|
||||
class GVAR(ammoType) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(AmmoType);
|
||||
@ -85,7 +83,7 @@ class ACE_Settings {
|
||||
displayName = CSTRING(AmmoCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(magCount) {
|
||||
@ -122,14 +120,12 @@ class ACE_Settings {
|
||||
};
|
||||
class GVAR(weaponLowerInfoBackground) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(WeaponLowerInfoBackground); //todo
|
||||
displayName = CSTRING(WeaponLowerInfoBackground);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
|
||||
// Stance
|
||||
class GVAR(stance) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(Stance);
|
||||
@ -138,8 +134,6 @@ class ACE_Settings {
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
|
||||
// Stamina Bar
|
||||
class GVAR(staminaBar) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(StaminaBar);
|
||||
@ -149,6 +143,88 @@ class ACE_Settings {
|
||||
isClientSettable = 1;
|
||||
};
|
||||
|
||||
// Gunner
|
||||
class GVAR(gunnerWeaponName) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerWeaponName);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerWeaponNameBackground) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerWeaponNameBackground);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerFiringMode) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerFiringMode);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerAmmoType) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerAmmoType);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerAmmoCount) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerAmmoCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerMagCount) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerMagCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerLaunchableName) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(gunnerLaunchableName);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerLaunchableCount) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(gunnerLaunchableCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerZeroing) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerZeroing);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(gunnerWeaponLowerInfoBackground) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(GunnerWeaponLowerInfoBackground);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
|
||||
// Vehicle
|
||||
class GVAR(vehicleName) {
|
||||
category = CSTRING(Category);
|
||||
@ -206,12 +282,4 @@ class ACE_Settings {
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(vehicleGunnerWeapon) {
|
||||
category = CSTRING(Category);
|
||||
displayName = CSTRING(VehicleGunnerWeapon);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
isClientSettable = 1;
|
||||
};
|
||||
};
|
||||
|
180
addons/ui/ACE_UI.hpp
Normal file
180
addons/ui/ACE_UI.hpp
Normal file
@ -0,0 +1,180 @@
|
||||
#define ANYWHERE 0
|
||||
#define GROUND_ONLY 1
|
||||
#define VEHICLE_ONLY 2
|
||||
|
||||
class ACE_UI {
|
||||
class weaponName {
|
||||
idd = 300;
|
||||
elements[] = {118};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class weaponNameBackground {
|
||||
idd = 300;
|
||||
elements[] = {1001, 1008};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class firingMode {
|
||||
idd = 300;
|
||||
elements[] = {187, 1203};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class ammoType {
|
||||
idd = 300;
|
||||
elements[] = {155};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class ammoCount {
|
||||
idd = 300;
|
||||
elements[] = {184};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class magCount {
|
||||
idd = 300;
|
||||
elements[] = {185};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class throwableName {
|
||||
idd = 300;
|
||||
elements[] = {152};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class throwableCount {
|
||||
idd = 300;
|
||||
elements[] = {151};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class zeroing {
|
||||
idd = 300;
|
||||
elements[] = {168};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class weaponLowerInfoBackground {
|
||||
idd = 300;
|
||||
elements[] = {1202};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class staminaBar {
|
||||
idd = 305;
|
||||
elements[] = {193};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class stance {
|
||||
idd = 303;
|
||||
elements[] = {188, 1201};
|
||||
location = GROUND_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerWeaponName {
|
||||
idd = 300;
|
||||
elements[] = {118};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerWeaponNameBackground {
|
||||
idd = 300;
|
||||
elements[] = {1001, 1008};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerFiringMode {
|
||||
idd = 300;
|
||||
elements[] = {187, 1203};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerAmmoType {
|
||||
idd = 300;
|
||||
elements[] = {155};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerAmmoCount {
|
||||
idd = 300;
|
||||
elements[] = {184};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerMagCount {
|
||||
idd = 300;
|
||||
elements[] = {185};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerLaunchableName {
|
||||
idd = 300;
|
||||
elements[] = {152};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerLaunchableCount {
|
||||
idd = 300;
|
||||
elements[] = {151};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerZeroing {
|
||||
idd = 300;
|
||||
elements[] = {168};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class gunnerWeaponLowerInfoBackground {
|
||||
idd = 300;
|
||||
elements[] = {1202};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class vehicleName {
|
||||
idd = 300;
|
||||
elements[] = {120};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class vehicleNameBackground {
|
||||
idd = 300;
|
||||
elements[] = {1000, 1013};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class vehicleFuelBar {
|
||||
idd = 300;
|
||||
elements[] = {113, 1202};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class vehicleSpeed {
|
||||
idd = 300;
|
||||
elements[] = {121, 1004, 1006};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class vehicleAltitude {
|
||||
idd = 300;
|
||||
elements[] = {122, 1005, 1014};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class vehicleDamage {
|
||||
idd = 300;
|
||||
elements[] = {111};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
class vehicleInfoBackground {
|
||||
idd = 300;
|
||||
elements[] = {1200};
|
||||
location = VEHICLE_ONLY;
|
||||
class conditions {};
|
||||
};
|
||||
};
|
@ -44,7 +44,7 @@ class CfgVehicles {
|
||||
};
|
||||
|
||||
// ADVANCED
|
||||
// Upper Weapon Info
|
||||
// Soldier
|
||||
class weaponName {
|
||||
displayName = CSTRING(WeaponName);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
@ -63,8 +63,6 @@ class CfgVehicles {
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
|
||||
// Lower Weapon Info
|
||||
class ammoType {
|
||||
displayName = CSTRING(AmmoType);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
@ -75,7 +73,7 @@ class CfgVehicles {
|
||||
displayName = CSTRING(AmmoCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
defaultValue = 1;
|
||||
};
|
||||
class magCount {
|
||||
displayName = CSTRING(MagCount);
|
||||
@ -107,16 +105,12 @@ class CfgVehicles {
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
|
||||
// Stance
|
||||
class stance {
|
||||
displayName = CSTRING(Stance);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
|
||||
// Stamina Bar
|
||||
class staminaBar {
|
||||
displayName = CSTRING(StaminaBar);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
@ -124,6 +118,68 @@ class CfgVehicles {
|
||||
defaultValue = 1;
|
||||
};
|
||||
|
||||
// Gunner
|
||||
class gunnerWeaponName {
|
||||
displayName = CSTRING(GunnerWeaponName);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerWeaponNameBackground {
|
||||
displayName = CSTRING(GunnerWeaponNameBackground);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerFiringMode {
|
||||
displayName = CSTRING(GunnerFiringMode);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerAmmoType {
|
||||
displayName = CSTRING(GunnerAmmoType);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerAmmoCount {
|
||||
displayName = CSTRING(GunnerAmmoCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerMagCount {
|
||||
displayName = CSTRING(GunnerMagCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerLaunchableName {
|
||||
displayName = CSTRING(gunnerLaunchableName);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerLaunchableCount {
|
||||
displayName = CSTRING(gunnerLaunchableCount);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerZeroing {
|
||||
displayName = CSTRING(GunnerZeroing);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class gunnerWeaponLowerInfoBackground {
|
||||
displayName = CSTRING(GunnerWeaponLowerInfoBackground);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
|
||||
// Vehicle
|
||||
class vehicleName {
|
||||
displayName = CSTRING(VehicleName);
|
||||
@ -167,12 +223,6 @@ class CfgVehicles {
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class vehicleGunnerWeapon {
|
||||
displayName = CSTRING(VehicleGunnerWeapon);
|
||||
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
};
|
||||
class ModuleDescription {
|
||||
description = CSTRING(ModuleDescription);
|
||||
|
@ -13,28 +13,27 @@ if (!hasInterface) exitWith {};
|
||||
// Defaults must be set in this EH to make sure controls are activated and advanced settings can be modified
|
||||
private _force = [true, false] select (GVAR(allowSelectiveUI));
|
||||
{
|
||||
[_x select 0, _x select 1, _x select 2, _force] call FUNC(setAdvancedElement);
|
||||
} forEach ELEMENTS_ADVANCED;
|
||||
private _name = configName _x;
|
||||
[_name, missionNamespace getVariable (format [QGVAR(%1), _name]), false, _force] call FUNC(setAdvancedElement);
|
||||
} forEach ("true" configClasses (configFile >> "ACE_UI"));
|
||||
|
||||
// Execute local event for when it's safe to modify UI through this API
|
||||
// infoDisplayChanged can execute multiple times, make sure it only happens once
|
||||
if (!GVAR(interfaceInitialized)) then {
|
||||
["InterfaceInitialized", []] call EFUNC(common,localEvent);
|
||||
GVAR(interfaceInitialized) = true;
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
// On changing settings
|
||||
["SettingChanged", {
|
||||
params ["_name"];
|
||||
|
||||
// Selective UI Basic
|
||||
if (_name in ELEMENTS_BASIC) then {
|
||||
[false] call FUNC(setElements);
|
||||
} else {
|
||||
[_name select [7], missionNamespace getVariable _name, true] call FUNC(setAdvancedElement);
|
||||
};
|
||||
|
||||
// Selective UI Advanced
|
||||
{
|
||||
_x params ["_idd", "_elements", "_elementName"];
|
||||
|
||||
if (_name == _elementName) then {
|
||||
[_idd, _elements, _elementName] call FUNC(setAdvancedElement);
|
||||
TRACE_2("Setting Changed",_name,_elementName);
|
||||
};
|
||||
} forEach ELEMENTS_ADVANCED;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -5,5 +5,6 @@ ADDON = false;
|
||||
#include "XEH_PREP.hpp"
|
||||
|
||||
GVAR(elementsSet) = [];
|
||||
GVAR(interfaceInitialized) = false;
|
||||
|
||||
ADDON = true;
|
||||
|
@ -16,6 +16,7 @@ class CfgPatches {
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "ACE_UI.hpp"
|
||||
|
||||
#include "RscChat.hpp"
|
||||
#include "RscVignette.hpp"
|
||||
|
@ -18,12 +18,13 @@ params ["_logic", "_units", "_activated"];
|
||||
|
||||
if (!_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(allowSelectiveUI), "allowSelectiveUI"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
// Basic
|
||||
if (isArray (missionConfigFile >> "showHUD")) then {
|
||||
// HUD visibility is hardcoded in mission config and showHUD command is overriden
|
||||
ACE_LOGINFO("User Interface Module Failed to Initialize Basic settings - showHUD overriden in mission config!");
|
||||
} else {
|
||||
[_logic, QGVAR(allowSelectiveUI), "allowSelectiveUI"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(soldierVehicleWeaponInfo), "soldierVehicleWeaponInfo"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleRadar), "vehicleRadar"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleCompass), "vehicleCompass"] call EFUNC(common,readSettingFromModule);
|
||||
@ -44,6 +45,16 @@ if (isArray (missionConfigFile >> "showHUD")) then {
|
||||
[_logic, QGVAR(weaponLowerInfoBackground), "weaponLowerInfoBackground"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(stance), "stance"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(staminaBar), "staminaBar"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerWeaponName), "gunnerWeaponName"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerWeaponNameBackground), "gunnerWeaponNameBackground"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerFiringMode), "gunnerFiringMode"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerAmmoType), "gunnerAmmoType"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerAmmoCount), "gunnerAmmoCount"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerMagCount), "gunnerMagCount"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerLaunchableName), "gunnerLaunchableName"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerLaunchableCount), "gunnerLaunchableCount"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerZeroing), "gunnerZeroing"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(gunnerWeaponLowerInfoBackground), "gunnerWeaponLowerInfoBackground"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleName), "vehicleName"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleNameBackground), "vehicleNameBackground"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleFuelBar), "vehicleFuelBar"] call EFUNC(common,readSettingFromModule);
|
||||
@ -51,6 +62,5 @@ if (isArray (missionConfigFile >> "showHUD")) then {
|
||||
[_logic, QGVAR(vehicleAltitude), "vehicleAltitude"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleDamage), "vehicleDamage"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleInfoBackground), "vehicleInfoBackground"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(vehicleGunnerWeapon), "vehicleGunnerWeapon"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
ACE_LOGINFO_1("User Interface Module Initialized. Allow client modifications: %1",GVAR(allowSelectiveUI));
|
||||
|
@ -3,33 +3,65 @@
|
||||
* Sets advanced visible element of the UI using displays and controls.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Element IDD <NUMBER>
|
||||
* 1: Element IDCs <ARRAY>
|
||||
* 2: Show/Hide Element OR Element ACE Settings Variable <BOOL/STRING>
|
||||
* 0: Element Name <STRING>
|
||||
* 1: Show/Hide Element <BOOL>
|
||||
* 2: Show Hint <BOOL>
|
||||
* 3: Force change even when disallowed <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* Successfully Set <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [303, [188], true, false] call ace_ui_fnc_setAdvancedElement
|
||||
* ["ace_ui_ammoCount", true, false] call ace_ui_fnc_setAdvancedElement
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_idd", "_elements", "_show", ["_force", false, [true]] ];
|
||||
|
||||
if (_elementInfo in GVAR(elementsSet)) exitWith {};
|
||||
params ["_element", "_show", ["_showHint", false, [true]], ["_force", false, [true]] ];
|
||||
|
||||
if (!_force && {!GVAR(allowSelectiveUI)}) exitWith {
|
||||
[LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured)
|
||||
[LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured);
|
||||
false
|
||||
};
|
||||
|
||||
// Get show/hide boolean from mission namespace if it's a string
|
||||
if (typeName _show == "STRING") then {
|
||||
_show = missionNamespace getVariable _show;
|
||||
private _config = configFile >> "ACE_UI" >> _element;
|
||||
|
||||
// Exit if main vehicle type condition not fitting
|
||||
private _location = getNumber (_config >> "location"); // (0-both, 1-ground, 2-vehicle)
|
||||
private _currentLocation = ACE_player == vehicle ACE_player;
|
||||
if ((_currentLocation && _location == 2) || (!_currentLocation && _location == 1)) exitWith {false};
|
||||
|
||||
private _idd = getNumber (_config >> "idd");
|
||||
private _elements = getArray (_config >> "elements");
|
||||
|
||||
// Get setting from config API
|
||||
{
|
||||
private _condition = call compile (getText _x);
|
||||
if !(_condition) exitWith {
|
||||
TRACE_2("Condition False",_element,_x);
|
||||
// Display and print info which component forced the element except for default vehicle check
|
||||
if (_showHint) then {
|
||||
[LSTRING(Disabled), 2] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
_show = false;
|
||||
};
|
||||
} forEach (configProperties [_config >> "conditions"]);
|
||||
|
||||
// Get setting from scripted API
|
||||
if (!_force) then {
|
||||
private _index = GVAR(elementsSet) find [_element, _show];
|
||||
if (_index == -1) then {
|
||||
_index = GVAR(elementsSet) find [_element, !_show];
|
||||
if (_index != -1) then {
|
||||
if (_showHint) then {
|
||||
[LSTRING(Disabled), 2] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
_show = ((GVAR(elementsSet)) select _index) select 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_show = [1, 0] select _show;
|
||||
|
||||
// Disable/Enable elements
|
||||
@ -40,7 +72,7 @@ private _success = false;
|
||||
// Loop through IGUI displays as they can be present several times for some reason
|
||||
{
|
||||
if (_idd == ctrlIDD _x) then {
|
||||
TRACE_3("Setting Element Visibility",_show,_idd,_idc);
|
||||
//TRACE_3("Setting Element Visibility",_show,_idd,_idc);
|
||||
|
||||
(_x displayCtrl _idc) ctrlSetFade _show;
|
||||
(_x displayCtrl _idc) ctrlCommit 0;
|
||||
|
@ -3,16 +3,15 @@
|
||||
* Setter for toggling advanced element visibility.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Set/Unset <BOOL> (default: true)
|
||||
* 1: Element IDD <NUMBER> (default: 0)
|
||||
* 2: Element IDCs <ARRAY> (default: [])
|
||||
* 3: Show/Hide Element OR Element ACE Settings Variable <BOOL/STRING> (default: false)
|
||||
* 0: Set/Unset <BOOL>
|
||||
* 1: Element Name <ARRAY/STRING>
|
||||
* 2: Show/Hide Element <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [true, 300, [188], false] call ace_ui_fnc_setElementVisibility
|
||||
* [true, "ace_ui_ammoCount", false] call ace_ui_fnc_setElementVisibility
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
@ -20,30 +19,43 @@
|
||||
|
||||
params [
|
||||
["_set", true, [true]],
|
||||
["_idd", 0, [0]],
|
||||
["_elements", [], [[]]],
|
||||
["_show", false, [true, ""]]
|
||||
["_element", "", [""]],
|
||||
["_show", false, [true]]
|
||||
];
|
||||
|
||||
// Verify element is bound
|
||||
if (!isClass (configFile >> "ACE_UI" >> _element)) exitWith {
|
||||
ACE_LOGWARNING_1("Element '%1' does not exist",_element);
|
||||
};
|
||||
|
||||
private _return = false;
|
||||
|
||||
if (_set) then {
|
||||
if ([_idd, _elements] in GVAR(elementsSet)) exitWith { TRACE_3("Element already set",_idd,_elements,GVAR(elementsSet)); };
|
||||
// Exit if element has been set from another component, print warning if after interface initialization
|
||||
if ([_element, _show] in GVAR(elementsSet) || {[_element, !_show] in GVAR(elementsSet)}) exitWith {
|
||||
if (GVAR(interfaceInitialized)) then {
|
||||
ACE_LOGWARNING_2("Element '%1' already set in %2",_element,GVAR(elementsSet));
|
||||
};
|
||||
};
|
||||
|
||||
TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet));
|
||||
private _success = [_idd, _elements, _show] call FUNC(setAdvancedElement);
|
||||
TRACE_3("Setting element",_element,_show,GVAR(elementsSet));
|
||||
private _success = [_element, _show, false, true] call FUNC(setAdvancedElement);
|
||||
|
||||
if (_success) then {
|
||||
GVAR(elementsSet) pushBack [_idd, _elements];
|
||||
GVAR(elementsSet) pushBack [_element, _show];
|
||||
_return = true;
|
||||
};
|
||||
} else {
|
||||
if ([_idd, _elements] in GVAR(elementsSet)) then {
|
||||
TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet));
|
||||
[_idd, _elements, _show] call FUNC(setAdvancedElement);
|
||||
if ([_element, _show] in GVAR(elementsSet) || {[_element, !_show] in GVAR(elementsSet)}) then {
|
||||
TRACE_3("Unsetting element",_element,_show,GVAR(elementsSet));
|
||||
|
||||
private _index = GVAR(elementsSet) find [_idd, _elements];
|
||||
private _index = GVAR(elementsSet) find [_element, _show];
|
||||
if (_index == -1) then {
|
||||
_index = GVAR(elementsSet) find [_element, !_show];
|
||||
};
|
||||
GVAR(elementsSet) deleteAt _index;
|
||||
|
||||
[_element, _show, false, true] call FUNC(setAdvancedElement);
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
|
@ -19,10 +19,6 @@ if (isArray (missionConfigFile >> "showHUD")) exitWith {};
|
||||
|
||||
params [ ["_force", false, [true]] ];
|
||||
|
||||
if (!_force && {!GVAR(allowSelectiveUI)}) exitWith {
|
||||
[LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
["ui", [
|
||||
true,
|
||||
GVAR(soldierVehicleWeaponInfo),
|
||||
|
@ -17,51 +17,26 @@
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
|
||||
// Elements
|
||||
// Basic Elements
|
||||
#define ELEMENTS_BASIC [QGVAR(soldierVehicleWeaponInfo), QGVAR(vehicleRadar), QGVAR(vehicleCompass), QGVAR(commandMenu), QGVAR(groupBar)]
|
||||
|
||||
// IDD, IDC, Element (must be string to compare to changed setting name)
|
||||
#define ELEMENTS_ADVANCED [ \
|
||||
[300, [118], QGVAR(weaponName)], \
|
||||
[300, [1001, 1008], QGVAR(weaponNameBackground)], \
|
||||
[300, [187, 1203], QGVAR(firingMode)], \
|
||||
[300, [155], QGVAR(ammoType)], \
|
||||
[300, [184], QGVAR(ammoCount)], \
|
||||
[300, [185], QGVAR(magCount)], \
|
||||
[300, [152], QGVAR(throwableName)], \
|
||||
[300, [151], QGVAR(throwableCount)], \
|
||||
[300, [1202], QGVAR(weaponLowerInfoBackground)], \
|
||||
[300, [168], QGVAR(zeroing)], \
|
||||
[305, [193], QGVAR(staminaBar)], \
|
||||
[303, [188, 1201], QGVAR(stance)], \
|
||||
[300, [120], QGVAR(vehicleName)], \
|
||||
[300, [1000, 1013], QGVAR(vehicleNameBackground)], \
|
||||
[300, [113, 1202], QGVAR(vehicleFuelBar)], \
|
||||
[300, [121, 1004, 1006], QGVAR(vehicleSpeed)], \
|
||||
[300, [122, 1005, 1014], QGVAR(vehicleAltitude)], \
|
||||
[300, [111], QGVAR(vehicleDamage)], \
|
||||
[300, [1200], QGVAR(vehicleInfoBackground)], \
|
||||
[300, [150], QGVAR(vehicleGunnerWeapon)] \
|
||||
]
|
||||
|
||||
|
||||
/*
|
||||
RscUnitInfo = 300
|
||||
--------------------
|
||||
118 (Weapon Name)
|
||||
+ 1001 (Weapon Name Background 1/2)
|
||||
+ 1008 (Weapon Name Background 2/2)
|
||||
118 (Weapon Name / Gunner Weapon Name)
|
||||
+ 1001 (Weapon Name Background 1/2 / Gunner Weapon Name Background 1/2)
|
||||
+ 1008 (Weapon Name Background 2/2 / Gunner Weapon Name Background 2/2)
|
||||
|
||||
187 (Firing Mode)
|
||||
+ 1203 (Firing Mode Background)
|
||||
187 (Firing Mode / Gunner Firing Mode)
|
||||
+ 1203 (Firing Mode Background / Gunner Firing Mode Background)
|
||||
|
||||
155 (Ammo Type)
|
||||
184 (Ammo Count) - disabled in config by ace_reload
|
||||
185 (Magazine Count)
|
||||
152 (Grenade/Flare Type)
|
||||
151 (Grenade/Flare Count)
|
||||
1202 (Lower Weapon Info Background)
|
||||
168 (Zeroing)
|
||||
155 (Ammo Type / Gunner Ammo Type)
|
||||
184 (Ammo Count / Gunner Ammo Count)
|
||||
185 (Magazine Count / Gunner Magazine Count)
|
||||
152 (Grenade/Flare Type / Launchable Type)
|
||||
151 (Grenade/Flare Count / Launchable Count)
|
||||
1202 (Lower Weapon Info Background / Gunner Lower Weapon Info Background)
|
||||
168 (Zeroing / Gunner Zeroing)
|
||||
|
||||
|
||||
120 (Vehicle Name)
|
||||
@ -80,8 +55,6 @@ RscUnitInfo = 300
|
||||
111 (Vehicle Damage)
|
||||
1200 (Vehicle Info Background)
|
||||
|
||||
150 (Vehicle Gunner Weapon)
|
||||
|
||||
|
||||
RscStanceInfo = 303
|
||||
--------------------
|
||||
|
@ -87,6 +87,36 @@
|
||||
<English>Stamina Bar</English>
|
||||
<Czech>Panel výdrže</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerWeaponName">
|
||||
<English>Gunner Weapon Name</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerWeaponNameBackground">
|
||||
<English>Gunner Weapon Name Background</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerFiringMode">
|
||||
<English>Gunner Firing Mode</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerAmmoType">
|
||||
<English>Gunner Ammo Type</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerAmmoCount">
|
||||
<English>Gunner Ammo Count</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerMagCount">
|
||||
<English>Gunner Magazine Count</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerLaunchableName">
|
||||
<English>Gunner Launchable Type</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerLaunchableCount">
|
||||
<English>Gunner Launchable Count</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerZeroing">
|
||||
<English>Gunner Zeroing</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_GunnerWeaponLowerInfoBackground">
|
||||
<English>Gunner Weapon Lower Info Background</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_VehicleName">
|
||||
<English>Vehicle Name</English>
|
||||
<Czech>Název vozidla</Czech>
|
||||
@ -115,17 +145,16 @@
|
||||
<English>Vehicle Info Background</English>
|
||||
<Czech>Info o vozidle v pozadí</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_VehicleGunnerWeapon">
|
||||
<English>Vehicle Gunner Weapon</English>
|
||||
<Czech>Střelcova zbraň ve vozidle</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_RequiresSoldierVehicleWeaponInfo">
|
||||
<English>Requires Soldier/Vehicle/Weapons Information.</English>
|
||||
<English>Requires Soldier/Vehicle/Weapon Information.</English>
|
||||
<Czech>Vyžaduje informace o Vojákovi/Vozidlu/Zbrani</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_Disallowed">
|
||||
<English>Modifying User Interface is disabled.</English>
|
||||
<Czech>Změna uživatelského rozhraní je zakázána.</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_UI_Disabled">
|
||||
<English>Cannot modify a forced User Interface element.</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user