Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve selective UI API #3805

Merged
merged 7 commits into from
Jun 2, 2016
Merged
4 changes: 4 additions & 0 deletions addons/common/RscInfoType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 7 additions & 0 deletions addons/fcs/ACE_UI.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ACE_UI {
class gunnerZeroing {
class conditions {
ADDON = "false";
};
};
};
1 change: 1 addition & 0 deletions addons/fcs/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class CfgPatches {
};

#include "CfgEventHandlers.hpp"
#include "ACE_UI.hpp"

#include "CfgAmmo.hpp"
#include "CfgMagazines.hpp"
Expand Down
7 changes: 7 additions & 0 deletions addons/reload/ACE_UI.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ACE_UI {
class ammoCount {
class conditions {
ADDON = "false";
};
};
};
5 changes: 1 addition & 4 deletions addons/reload/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ class CfgPatches {
};

#include "CfgVehicles.hpp"

#include "CfgMagazines.hpp"

#include "CfgEventHandlers.hpp"

#include "CfgActions.hpp"

#include "ACE_Settings.hpp"
#include "ACE_UI.hpp"
2 changes: 1 addition & 1 deletion addons/reload/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
102 changes: 85 additions & 17 deletions addons/ui/ACE_Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ACE_Settings {
};

// ADVANCED
// Upper Weapon Info
// Soldier
class GVAR(weaponName) {
category = CSTRING(Category);
displayName = CSTRING(WeaponName);
Expand All @@ -70,8 +70,6 @@ class ACE_Settings {
value = 1;
isClientSettable = 1;
};

// Lower Weapon Info
class GVAR(ammoType) {
category = CSTRING(Category);
displayName = CSTRING(AmmoType);
Expand All @@ -85,7 +83,7 @@ class ACE_Settings {
displayName = CSTRING(AmmoCount);
description = CSTRING(RequiresSoldierVehicleWeaponInfo);
typeName = "BOOL";
value = 0;
value = 1;
isClientSettable = 1;
};
class GVAR(magCount) {
Expand Down Expand Up @@ -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);
Expand All @@ -138,8 +134,6 @@ class ACE_Settings {
value = 1;
isClientSettable = 1;
};

// Stamina Bar
class GVAR(staminaBar) {
category = CSTRING(Category);
displayName = CSTRING(StaminaBar);
Expand All @@ -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);
Expand Down Expand Up @@ -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 changes: 180 additions & 0 deletions addons/ui/ACE_UI.hpp
Original file line number Diff line number Diff line change
@@ -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 {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of condition vs conditions here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition is the main condition (vehicle/soldier UI), conditions class is for anything else to add extra conditions, such as other components or mods.

Copy link
Contributor

@thojkooi thojkooi May 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should put our main condition in the conditions class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had that at first, but this makes it easier to handle, because the main condition gets evaluated before any other and if not applicable it doesn't toggle the element at all (no point as you can't see it anyways), while other conditions determine if it should be visible or hidden.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a different effect though? Both cases the elements end up not visible? Why are those separate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/acemod/ACE3/pull/3805/files#diff-fc2d593f082cd4c729bb26d91f30ede9R31

The only thing is that no other condition gets evaluated if that one is false. I could put it into conditions class and filter it out in configProperties as well if that would make it nicer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean that if one of the other conditions is false, the rest of those are still evaluated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, if one is false it will set the element to hidden, if they are all true it will show the element. The difference between the main condition and the conditions class is that when the control is shown by the engine you still need to make sure you hide/show it every time the UI gets updated by the engine. Meanwhile the main condition will exit right away if the control is not getting rendered at all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the condition defines when an element is available and the conditions if it is shown/hidden?

};
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 {};
};
};
Loading