mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #921 from acemod/interactMoreOptions
Interact more options
This commit is contained in:
commit
9489cc9b18
@ -5,11 +5,11 @@ if (!hasInterface) exitWith {};
|
||||
|
||||
GVAR(ParsedTextCached) = [];
|
||||
|
||||
//Setup text/shadow color matrix
|
||||
//Setup text/shadow/size/color settings matrix
|
||||
[] call FUNC(setupTextColors);
|
||||
["SettingChanged", {
|
||||
PARAMS_1(_name);
|
||||
if ((_name == QGVAR(colorTextMax)) || {_name == QGVAR(colorTextMin)} || {_name == QGVAR(colorShadowMax)} || {_name == QGVAR(colorShadowMin)}) then {
|
||||
if (_name in [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) then {
|
||||
[] call FUNC(setupTextColors);
|
||||
};
|
||||
}] call EFUNC(common,addEventhandler);
|
||||
|
@ -68,6 +68,21 @@ class ACE_Settings {
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_Menu_ColorShadowMin";
|
||||
};
|
||||
class GVAR(textSize) {
|
||||
value = 2;
|
||||
typeName = "SCALAR";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_textSize";
|
||||
values[] = {"$str_very_small", "$str_small", "$str_medium", "$str_large", "$str_very_large"};
|
||||
};
|
||||
class GVAR(shadowSetting) {
|
||||
value = 2;
|
||||
typeName = "SCALAR";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Interact_shadowSetting";
|
||||
description = "$STR_ACE_Interact_shadowSettingDescription";
|
||||
values[] = {"$STR_A3_OPTIONS_DISABLED", "$STR_A3_OPTIONS_ENABLED", "$STR_ACE_Interact_shadowOutline"};
|
||||
};
|
||||
class GVAR(actionOnKeyRelease) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
|
@ -6,9 +6,7 @@
|
||||
* 0: Text <STRING>
|
||||
* 1: Icon <STRING>
|
||||
* 2: 2d position <ARRAY>
|
||||
* 3: Color <STRING>
|
||||
* 4: Shadow Color <STRING>
|
||||
* 5: Icon Color <STRING>
|
||||
* 3: Text Settings <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
@ -18,7 +16,7 @@
|
||||
#include "script_component.hpp"
|
||||
#define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa)
|
||||
private ["_ctrl", "_pos", "_displayNum"];
|
||||
PARAMS_6(_text,_icon,_sPos,_textColor,_shadowColor,_iconColor);
|
||||
PARAMS_4(_text,_icon,_sPos,_textSettings);
|
||||
|
||||
//systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1];
|
||||
|
||||
@ -27,25 +25,25 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
|
||||
GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
|
||||
};
|
||||
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||
|
||||
if(_icon == "") then {
|
||||
_icon = DEFAULT_ICON;
|
||||
};
|
||||
|
||||
_text = if (GVAR(UseListMenu)) then {
|
||||
format ["<img image='%1' color='%2' align='left'/><t color='%3' size='0.80' shadow='1' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, _text]
|
||||
format ["<img image='%1' align='left'/><t %2>%3</t>", _icon, _textSettings, _text]
|
||||
} else {
|
||||
format ["<img image='%1' color='%2' align='center'/><br/><t color='%3' size='0.80' align='center' shadow='1' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, "ace_break_line" callExtension _text];
|
||||
format ["<img image='%1' align='center'/><br/><t %2 align='center'>%3</t>", _icon, _textSettings, "ace_break_line" callExtension _text];
|
||||
};
|
||||
|
||||
//_ctrl ctrlSetStructuredText parseText _text;
|
||||
[_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached);
|
||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||
|
||||
_pos = [];
|
||||
if (GVAR(UseListMenu)) then {
|
||||
_pos = [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW];
|
||||
_pos = if (GVAR(UseListMenu)) then {
|
||||
[(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW]
|
||||
} else {
|
||||
_pos = [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW];
|
||||
[(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW]
|
||||
};
|
||||
|
||||
if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_menuInSelectedPath", "_path", "_menuDepth", "_x", "_offset", "_newPos", "_forEachIndex", "_player", "_pos", "_shadowColor", "_target", "_textColor"];
|
||||
private ["_menuInSelectedPath", "_path", "_menuDepth", "_x", "_offset", "_newPos", "_forEachIndex", "_player", "_pos", "_target", "_textSettings"];
|
||||
|
||||
EXPLODE_4_PVT(_this,_parentPath,_action,_sPos,_angles);
|
||||
EXPLODE_3_PVT(_action,_actionData,_activeChildren,_actionObject);
|
||||
@ -43,19 +43,16 @@ _menuInSelectedPath = true;
|
||||
//END_COUNTER(constructing_paths);
|
||||
//BEGIN_COUNTER(constructing_colors);
|
||||
|
||||
// Render icon
|
||||
// ARGB Color (First Hex Pair is transparancy)
|
||||
_textColor = GVAR(colorSelected);
|
||||
_shadowColor = GVAR(colorSelectedShadow);
|
||||
//Get text color settings string
|
||||
_textSettings = GVAR(colorSelectedSettings);
|
||||
if(!_menuInSelectedPath) then {
|
||||
_textColor = (GVAR(colorNotSelectedMatrix) select (count _path)) select _menuDepth;
|
||||
_shadowColor = (GVAR(colorShadowNotSelectedMatrix) select (count _path)) select _menuDepth;
|
||||
_textSettings = (GVAR(textSettingsMatrix) select (count _path)) select _menuDepth;
|
||||
};
|
||||
|
||||
//END_COUNTER(constructing_colors);
|
||||
//BEGIN_COUNTER(fnc_renderIcons);
|
||||
|
||||
[_actionData select 1, _actionData select 2, _sPos, _textColor, _shadowColor, "#FFFFFFFF"] call FUNC(renderIcon);
|
||||
[_actionData select 1, _actionData select 2, _sPos, _textSettings] call FUNC(renderIcon);
|
||||
|
||||
//END_COUNTER(fnc_renderIcons);
|
||||
|
||||
@ -71,7 +68,7 @@ if !(_menuInSelectedPath) exitWith {true};
|
||||
|
||||
//BEGIN_COUNTER(children);
|
||||
|
||||
private ["_numChildren","_angleSpan","_angle","_angleInterval","_scale","_offset"];
|
||||
private ["_numChildren","_angleSpan","_angle","_angleInterval","_scaleX", "_scaleY", "_offset", "_textSize"];
|
||||
_numChildren = count _activeChildren;
|
||||
_angleSpan = _maxAngleSpan min (55 * ((_numChildren) - 1));
|
||||
if (_angleSpan >= 305) then {
|
||||
@ -90,15 +87,23 @@ if (_numChildren == 1) then {
|
||||
};
|
||||
|
||||
// Scale menu based on the amount of children
|
||||
_scale = if (GVAR(UseListMenu)) then {
|
||||
0.17
|
||||
_scaleX = 1;
|
||||
_scaleY = 1;
|
||||
|
||||
if (GVAR(UseListMenu)) then {
|
||||
_textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize);
|
||||
_scaleX = _textSize * 0.17 * 1.1;
|
||||
_scaleY = 0.17 * 0.30 * 4/3;
|
||||
} else {
|
||||
0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5)
|
||||
_textSize = if (GVAR(textSize) > 2) then {1.3} else {1};
|
||||
_scaleX = _textSize * 0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5);
|
||||
_scaleY = _textSize * 0.17 * 4/3 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5);
|
||||
};
|
||||
|
||||
// Animate menu scale
|
||||
if (_menuInSelectedPath && (_menuDepth == count _path)) then {
|
||||
_scale = _scale * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * 8) min 1));
|
||||
_scaleX = _scaleX * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * 8) min 1));
|
||||
_scaleY = _scaleY * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * 8) min 1));
|
||||
};
|
||||
|
||||
_target = _actionObject;
|
||||
@ -110,12 +115,12 @@ _angle = _centerAngle - _angleSpan / 2;
|
||||
//BEGIN_COUNTER(children);
|
||||
private ["_offset","_newPos"];
|
||||
_newPos = if (GVAR(UseListMenu)) then {
|
||||
[(_sPos select 0) + _scale * 1.10,
|
||||
(_sPos select 1) + _scale * 0.30 * 4/3 * (_foreachindex - _numChildren/2 + 0.5)];
|
||||
} else {
|
||||
[(_sPos select 0) -_scale * cos _angle,
|
||||
(_sPos select 1) +_scale * (sin _angle) * 4/3];
|
||||
};
|
||||
[(_sPos select 0) + _scaleX,
|
||||
(_sPos select 1) + _scaleY * (_foreachindex - _numChildren/2 + 0.5)];
|
||||
} else {
|
||||
[(_sPos select 0) - _scaleX * (cos _angle),
|
||||
(_sPos select 1) + _scaleY * (sin _angle)];
|
||||
};
|
||||
|
||||
//drawLine3D [_pos, _newPos, [1,0,0,0.8]];
|
||||
//END_COUNTER(children);
|
||||
|
@ -23,17 +23,17 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
|
||||
};
|
||||
|
||||
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||
|
||||
_pos = [];
|
||||
if (GVAR(UseListMenu)) then {
|
||||
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
||||
_pos = [(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW];
|
||||
_pos = if (GVAR(UseListMenu)) then {
|
||||
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
||||
[(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW]
|
||||
} else {
|
||||
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
||||
_pos = [(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW];
|
||||
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
||||
[(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW]
|
||||
};
|
||||
|
||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||
|
||||
if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {
|
||||
_pos set [0, ((_pos select 0) - (GVAR(cursorPos) select 0) + 0.5)];
|
||||
_pos set [1, ((_pos select 1) - (GVAR(cursorPos) select 1) + 0.5)];
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_mixColor", "_rowT", "_rowS", "_menuDepth", "_pathCount"];
|
||||
private ["_menuDepth", "_mixColor", "_pathCount", "_row", "_shadowColor", "_textColor", "_textSize"];
|
||||
|
||||
//Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text
|
||||
_mixColor = {
|
||||
@ -30,23 +30,30 @@ _mixColor = {
|
||||
_return
|
||||
};
|
||||
|
||||
GVAR(colorSelected) = [GVAR(colorTextMin), GVAR(colorTextMax), 1] call _mixColor;
|
||||
GVAR(colorSelectedShadow) = [GVAR(colorShadowMin), GVAR(colorShadowMax), 1] call _mixColor;
|
||||
GVAR(colorNotSelectedMatrix) = [];
|
||||
GVAR(colorShadowNotSelectedMatrix) = [];
|
||||
_textColor = [GVAR(colorTextMin), GVAR(colorTextMax), 1] call _mixColor;
|
||||
_shadowColor = [GVAR(colorShadowMin), GVAR(colorShadowMax), 1] call _mixColor;
|
||||
_textSize = switch (GVAR(textSize)) do {
|
||||
case (0): {0.4};
|
||||
case (1): {0.6};
|
||||
case (2): {0.8};
|
||||
case (3): {1};
|
||||
case (4): {1.2};
|
||||
};
|
||||
|
||||
GVAR(colorSelectedSettings) = format ["color='%1' size='%2' shadow='%3' shadowColor='%4' shadowOffset='0.06'", _textColor, _textSize, GVAR(shadowSetting), _shadowColor];
|
||||
|
||||
GVAR(textSettingsMatrix) = [];
|
||||
for "_pathCount" from 0 to 15 do {
|
||||
_rowT = [];
|
||||
_rowS = [];
|
||||
_row = [];
|
||||
for "_menuDepth" from 0 to 15 do {
|
||||
if (_menuDepth > 0) then {
|
||||
_rowT pushBack ([GVAR(colorTextMin), GVAR(colorTextMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor);
|
||||
_rowS pushBack ([GVAR(colorShadowMin), GVAR(colorShadowMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor);
|
||||
_textColor = [GVAR(colorTextMin), GVAR(colorTextMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor;
|
||||
_shadowColor = [GVAR(colorShadowMin), GVAR(colorShadowMax), (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor;
|
||||
} else {
|
||||
_rowT pushBack ([GVAR(colorTextMin), GVAR(colorTextMax), 0] call _mixColor);
|
||||
_rowS pushBack ([GVAR(colorShadowMin), GVAR(colorShadowMax), 0] call _mixColor);
|
||||
_textColor = [GVAR(colorTextMin), GVAR(colorTextMax), 0] call _mixColor;
|
||||
_shadowColor = [GVAR(colorShadowMin), GVAR(colorShadowMax), 0] call _mixColor;
|
||||
};
|
||||
_row pushBack format ["color='%1' size='%2' shadow='%3' shadowColor='%4' shadowOffset='0.06'", _textColor, _textSize, GVAR(shadowSetting), _shadowColor];
|
||||
};
|
||||
GVAR(colorNotSelectedMatrix) pushBack _rowT;
|
||||
GVAR(colorShadowNotSelectedMatrix) pushBack _rowS;
|
||||
GVAR(textSettingsMatrix) pushBack _row;
|
||||
};
|
||||
|
@ -125,5 +125,17 @@
|
||||
<English>Do action when releasing menu key</English>
|
||||
<German>Aktion nach Loslassen der Taste ausführen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interact_textSize">
|
||||
<English>Interaction Text Size</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interact_shadowSetting">
|
||||
<English>Interaction Text Shadow</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interact_shadowSettingDescription">
|
||||
<English>Allows controlling the text's shadow. Outline ignores custom shadow colors.</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Interact_shadowOutline">
|
||||
<English>Outline</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user