mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Interface toggles
This commit is contained in:
parent
c6e71fbc36
commit
5d279e11ec
@ -79,10 +79,17 @@ class GVAR(interface) {
|
||||
};
|
||||
};
|
||||
};
|
||||
class nameTool: RscText {
|
||||
idc = IDC_TOOL_NAME;
|
||||
class toolbar: RscControlsGroupNoScrollbars {
|
||||
idc = IDC_TOOL;
|
||||
x = safeZoneX;
|
||||
y = safeZoneY;
|
||||
w = safeZoneW;
|
||||
h = TOOL_H;
|
||||
class controls {
|
||||
class nameTool: RscText {
|
||||
idc = IDC_TOOL_NAME;
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = TOOL_W * 2;
|
||||
h = TOOL_H;
|
||||
shadow = 2;
|
||||
@ -96,7 +103,7 @@ class GVAR(interface) {
|
||||
};
|
||||
class viewTool: nameTool {
|
||||
idc = IDC_TOOL_VIEW;
|
||||
x = safeZoneX + TOOL_W * 2 + MARGIN;
|
||||
x = TOOL_W * 2 + MARGIN;
|
||||
w = TOOL_W;
|
||||
};
|
||||
class viewFrame: viewTool {
|
||||
@ -105,7 +112,7 @@ class GVAR(interface) {
|
||||
};
|
||||
class clockTool: viewTool {
|
||||
idc = IDC_TOOL_CLOCK;
|
||||
x = safeZoneX + TOOL_W * 3 + MARGIN * 2;
|
||||
x = TOOL_W * 3 + MARGIN * 2;
|
||||
};
|
||||
class clockFrame: clockTool {
|
||||
idc = -1;
|
||||
@ -113,7 +120,7 @@ class GVAR(interface) {
|
||||
};
|
||||
class focusTool: viewTool {
|
||||
idc = IDC_TOOL_FOCUS;
|
||||
x = safeZoneX + safeZoneW - TOOL_W * 3 - MARGIN * 2;
|
||||
x = safeZoneW - TOOL_W * 3 - MARGIN * 2;
|
||||
};
|
||||
class focusFrame: focusTool {
|
||||
idc = -1;
|
||||
@ -121,7 +128,7 @@ class GVAR(interface) {
|
||||
};
|
||||
class fovTool: viewTool {
|
||||
idc = IDC_TOOL_FOV;
|
||||
x = safeZoneX + safeZoneW - TOOL_W * 2 - MARGIN;
|
||||
x = safeZoneW - TOOL_W * 2 - MARGIN;
|
||||
};
|
||||
class fovFrame: fovTool {
|
||||
idc = -1;
|
||||
@ -129,12 +136,14 @@ class GVAR(interface) {
|
||||
};
|
||||
class speedTool: viewTool {
|
||||
idc = IDC_TOOL_SPEED;
|
||||
x = safeZoneX + safeZoneW - TOOL_W;
|
||||
x = safeZoneW - TOOL_W;
|
||||
};
|
||||
class speedFrame: speedTool {
|
||||
idc = -1;
|
||||
style = 64;
|
||||
};
|
||||
};
|
||||
};
|
||||
class unitTools: RscControlsGroupNoScrollbars {
|
||||
idc = IDC_UNIT;
|
||||
x = safeZoneX;
|
||||
@ -153,9 +162,9 @@ class GVAR(interface) {
|
||||
colorBorder[] = {COL_FORE};
|
||||
colorBackground[] = {COL_BACK};
|
||||
colorSelect[] = {
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])",
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])",
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])",
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
|
||||
1
|
||||
};
|
||||
multiselectEnabled = 0;
|
||||
@ -167,19 +176,20 @@ class GVAR(interface) {
|
||||
w = TOOL_W * 2;
|
||||
h = TOOL_H;
|
||||
sizeEx = TOOL_H;
|
||||
colorBackground[] = {COL_FORE_D};
|
||||
text = CSTRING(RefreshList);
|
||||
action = QUOTE([] call FUNC(updateUnits));
|
||||
};
|
||||
};
|
||||
};
|
||||
class spectatorMap: RscMapControl {
|
||||
class mapOverlay: RscMapControl {
|
||||
idc = IDC_MAP;
|
||||
x = safeZoneX;
|
||||
y = safeZoneY + TOOL_H;
|
||||
y = safeZoneY;
|
||||
w = safeZoneW;
|
||||
h = safeZoneH;
|
||||
};
|
||||
class helpBox: RscControlsGroupNoScrollbars {
|
||||
class helpSplash: RscControlsGroupNoScrollbars {
|
||||
idc = IDC_HELP;
|
||||
x = 0.5 - W_PART(12);
|
||||
y = 0.5 - H_PART(12);
|
||||
@ -196,12 +206,7 @@ class GVAR(interface) {
|
||||
class helpTitle: helpBack {
|
||||
h = H_PART(1);
|
||||
colorText[]={COL_FORE};
|
||||
colorBackground[] = {
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])",
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])",
|
||||
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])",
|
||||
1
|
||||
};
|
||||
colorBackground[] = {COL_FORE_D};
|
||||
sizeEx = H_PART(1);
|
||||
text = CSTRING(HelpTitle);
|
||||
};
|
||||
|
@ -10,11 +10,20 @@ PREP(handleRespawn);
|
||||
PREP(handleTree);
|
||||
PREP(moduleSpectatorSettings);
|
||||
PREP(setSpectator);
|
||||
PREP(updateInterface);
|
||||
PREP(updateUnits);
|
||||
PREP(updateView);
|
||||
|
||||
GVAR(showComp) = true;
|
||||
GVAR(showHelp) = true;
|
||||
GVAR(showInterface) = true;
|
||||
GVAR(showMap) = false;
|
||||
GVAR(showTool) = true;
|
||||
GVAR(showUnit) = true;
|
||||
|
||||
GVAR(unitList) = [];
|
||||
GVAR(unitBlacklist) = [];
|
||||
GVAR(unitWhitelist) = [];
|
||||
|
||||
|
||||
ADDON = true;
|
||||
|
@ -124,9 +124,10 @@ switch (toLower _mode) do {
|
||||
// Initalize the display
|
||||
_display = _args select 0;
|
||||
|
||||
// Hide the map
|
||||
(_display displayCtrl IDC_MAP) ctrlShow false;
|
||||
(_display displayCtrl IDC_MAP) mapCenterOnCamera false;
|
||||
// Always show interface and hide map upon opening
|
||||
GVAR(showInterface) = true;
|
||||
GVAR(showMap) = false;
|
||||
[] call FUNC(updateInterface);
|
||||
|
||||
// Set text values
|
||||
(_display displayCtrl IDC_TOOL_FOCUS) ctrlSetText str(GVAR(camFocus));
|
||||
@ -195,14 +196,11 @@ switch (toLower _mode) do {
|
||||
|
||||
switch (_dik) do {
|
||||
case 1: { // Esc
|
||||
["close"] call FUNC(handleInterface); // Handle esc menu goes here, currently closes for purposes of testing
|
||||
[player,false] call FUNC(setSpectator); // Handle esc menu goes here, currently closes for purposes of testing
|
||||
};
|
||||
case 14: { // Backspace
|
||||
private ["_tree","_show"];
|
||||
_tree = _display displayCtrl IDC_UNIT;
|
||||
_show = !ctrlShown _tree;
|
||||
|
||||
_tree ctrlShow _show;
|
||||
GVAR(showInterface) = !GVAR(showInterface);
|
||||
[] call FUNC(updateInterface);
|
||||
};
|
||||
case 16: { // Q
|
||||
GVAR(camBoom) set [0,true];
|
||||
@ -210,6 +208,14 @@ switch (toLower _mode) do {
|
||||
case 17: { // W
|
||||
GVAR(camDolly) set [0,true];
|
||||
};
|
||||
case 20: { // T
|
||||
GVAR(showTool) = !GVAR(showTool);
|
||||
[] call FUNC(updateInterface);
|
||||
};
|
||||
case 22: { // U
|
||||
GVAR(showUnit) = !GVAR(showUnit);
|
||||
[] call FUNC(updateInterface);
|
||||
};
|
||||
case 29: { // Ctrl
|
||||
GVAR(ctrlKey) = true;
|
||||
};
|
||||
@ -223,21 +229,19 @@ switch (toLower _mode) do {
|
||||
GVAR(camDolly) set [3,true];
|
||||
};
|
||||
case 35: { // H
|
||||
private ["_help","_show"];
|
||||
_help = _display displayCtrl IDC_HELP;
|
||||
_show = !ctrlShown _help;
|
||||
|
||||
_help ctrlShow _show;
|
||||
GVAR(showHelp) = !GVAR(showHelp);
|
||||
[] call FUNC(updateInterface);
|
||||
};
|
||||
case 37: { // K
|
||||
GVAR(showComp) = !GVAR(showComp);
|
||||
[] call FUNC(updateInterface);
|
||||
};
|
||||
case 44: { // Z
|
||||
GVAR(camBoom) set [1,true];
|
||||
};
|
||||
case 50: { // M
|
||||
private ["_map","_show"];
|
||||
_map = _display displayCtrl IDC_MAP;
|
||||
_show = !ctrlShown _map;
|
||||
|
||||
_map ctrlShow _show;
|
||||
GVAR(showMap) = !GVAR(showMap);
|
||||
[] call FUNC(updateInterface);
|
||||
//[_show] call FUNC(handleMap);
|
||||
};
|
||||
case 57: { // Spacebar
|
||||
|
19
addons/spectator/functions/fnc_updateInterface.sqf
Normal file
19
addons/spectator/functions/fnc_updateInterface.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_display","_elements","_show"];
|
||||
disableSerialization;
|
||||
|
||||
_display = GETUVAR(GVAR(display),displayNull);
|
||||
_elements = [IDC_COMP,IDC_HELP,IDC_MAP,IDC_TOOL,IDC_UNIT];
|
||||
_show = [GVAR(showComp),GVAR(showHelp),GVAR(showMap),GVAR(showTool),GVAR(showUnit)];
|
||||
|
||||
// Hide/show interface elements in accordance with good UX design
|
||||
if (GVAR(showInterface)) then {
|
||||
{
|
||||
(_display displayCtrl _x) ctrlShow (_show select _forEachIndex);
|
||||
} forEach _elements;
|
||||
} else {
|
||||
{
|
||||
(_display displayCtrl _x) ctrlShow GVAR(showInterface);
|
||||
} forEach _elements;
|
||||
};
|
@ -52,3 +52,4 @@
|
||||
// UI colours
|
||||
#define COL_BACK 0.1,0.1,0.1,0.8
|
||||
#define COL_FORE 1,1,1,1
|
||||
#define COL_FORE_D 0.1,0.1,0.1,1
|
||||
|
Loading…
Reference in New Issue
Block a user