mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #853 from acemod/cacheparsetext
cache ctrlSetStructedText parseText
This commit is contained in:
commit
74867230d6
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
GVAR(ParsedTextCached) = [];
|
||||||
|
|
||||||
//Setup text/shadow color matrix
|
//Setup text/shadow color matrix
|
||||||
[] call FUNC(setupTextColors);
|
[] call FUNC(setupTextColors);
|
||||||
["SettingChanged", {
|
["SettingChanged", {
|
||||||
|
@ -8,6 +8,7 @@ PREP(compileMenu);
|
|||||||
PREP(compileMenuSelfAction);
|
PREP(compileMenuSelfAction);
|
||||||
PREP(collectActiveActionTree);
|
PREP(collectActiveActionTree);
|
||||||
PREP(createAction);
|
PREP(createAction);
|
||||||
|
PREP(ctrlSetParsedTextCached);
|
||||||
PREP(findActionNode);
|
PREP(findActionNode);
|
||||||
PREP(handlePlayerChanged);
|
PREP(handlePlayerChanged);
|
||||||
PREP(isSubPath);
|
PREP(isSubPath);
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
// by commy2
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_ctrl", "_index", "_text"];
|
||||||
|
|
||||||
|
_ctrl = _this select 0;
|
||||||
|
_index = _this select 1;
|
||||||
|
_text = _this select 2;
|
||||||
|
|
||||||
|
if (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"")) then {
|
||||||
|
GVAR(ParsedTextCached) set [_index, _text];
|
||||||
|
_ctrl ctrlSetStructuredText parseText _text;
|
||||||
|
};
|
@ -27,19 +27,21 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
|
|||||||
GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
|
GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
|
||||||
};
|
};
|
||||||
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
||||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
|
||||||
if(_icon == "") then {
|
if(_icon == "") then {
|
||||||
_icon = DEFAULT_ICON;
|
_icon = DEFAULT_ICON;
|
||||||
};
|
};
|
||||||
|
|
||||||
_text = if (GVAR(UseListMenu)) then {
|
_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' color='%2' align='left'/><t color='%3' size='0.80' shadow='2' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, _text]
|
||||||
} else {
|
} 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_breakLine" callExtension _text];
|
format ["<img image='%1' color='%2' align='center'/><br/><t color='%3' size='0.80' align='center' shadow='2' shadowColor='%4' shadowOffset='0.06'>%5</t>", _icon, _iconColor, _textColor, _shadowColor, "ace_breakLine" callExtension _text];
|
||||||
};
|
};
|
||||||
|
|
||||||
_ctrl ctrlSetStructuredText (parseText _text);
|
//_ctrl ctrlSetStructuredText parseText _text;
|
||||||
_text = if (GVAR(UseListMenu)) then {
|
[_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached);
|
||||||
|
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||||
|
|
||||||
|
if (GVAR(UseListMenu)) then {
|
||||||
_ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW];
|
_ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW];
|
||||||
} else {
|
} else {
|
||||||
_ctrl ctrlSetPosition [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW];
|
_ctrl ctrlSetPosition [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW];
|
||||||
|
@ -22,14 +22,14 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
|
|||||||
|
|
||||||
private "_ctrl";
|
private "_ctrl";
|
||||||
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
_ctrl = GVAR(iconCtrls) select GVAR(iconCount);
|
||||||
GVAR(iconCount) = GVAR(iconCount) + 1;
|
|
||||||
|
|
||||||
if (GVAR(UseListMenu)) then {
|
if (GVAR(UseListMenu)) then {
|
||||||
_ctrl ctrlSetStructuredText (parseText format ["<img image='%1' color='#FF0000' size='1.6'/>", _icon]);
|
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
||||||
_ctrl ctrlSetPosition [(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW];
|
_ctrl ctrlSetPosition [(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW];
|
||||||
} else {
|
} else {
|
||||||
_ctrl ctrlSetStructuredText (parseText format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]);
|
[_ctrl, GVAR(iconCount), format ["<img image='%1' color='#FF0000' size='1.6' align='center'/>", _icon]] call FUNC(ctrlSetParsedTextCached);
|
||||||
_ctrl ctrlSetPosition [(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW];
|
_ctrl ctrlSetPosition [(_sPos select 0)-(0.050*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.1*SafeZoneW, 0.035*SafeZoneW];
|
||||||
};
|
};
|
||||||
//_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1];
|
//_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1];
|
||||||
|
GVAR(iconCount) = GVAR(iconCount) + 1;
|
||||||
_ctrl ctrlCommit 0;
|
_ctrl ctrlCommit 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user