ACE3/addons/interaction/functions/fn_MoveDown.sqf

67 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-01-11 19:32:51 +00:00
/*
Author: Garth de Wet (LH)
2015-01-11 23:13:47 +00:00
2015-01-11 19:32:51 +00:00
Description:
Depending on the passed value, either scrolls down through the list or up.
2015-01-11 23:13:47 +00:00
Parameters:
2015-01-11 19:32:51 +00:00
NUMBER - Amount to increase current interaction target
2015-01-11 23:13:47 +00:00
2015-01-11 19:32:51 +00:00
Returns:
Nothing
2015-01-11 23:13:47 +00:00
2015-01-11 19:32:51 +00:00
Example:
1 call FUNC(MoveDown);
-1 call FUNC(MoveDown);
2015-01-11 19:32:51 +00:00
*/
2015-01-11 23:13:47 +00:00
#include "script_component.hpp"
2015-01-11 19:32:51 +00:00
#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}})
2015-01-11 23:13:47 +00:00
if (isNil QGVAR(MainButton)) exitWith{};
if (isNil QGVAR(Buttons)) exitWith{};
_count = (count GVAR(Buttons))- 1;
GVAR(SelectedButton) = CLAMP(GVAR(SelectedButton) + _this, 0, _count);
2015-01-11 19:32:51 +00:00
2015-01-11 23:13:47 +00:00
_target = GVAR(Target);
_player = ACE_player;
2015-01-11 19:32:51 +00:00
_vehicle = vehicle _player;
disableSerialization;
2015-01-11 23:13:47 +00:00
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Flow_Display);
_top = GVAR(SelectedButton) - 2;
2015-01-11 19:32:51 +00:00
_i = 0;
while {_i <= 4} do {
_index =_i + _top;
_ctrl = _dlgInteractionDialog displayCtrl (1200 + _i);
if (_index >= 0 && {_index <= _count}) then {
2015-01-11 23:13:47 +00:00
_action = GVAR(Buttons) select _index;
2015-01-11 19:32:51 +00:00
_ctrl ctrlShow true;
_ctrl ctrlSetText (_action select 5);
_color = [1,1,1,1];
if !([_target, _player] call (_action select 2)) then {
_color = [0.3,0.3,0.3,0.8];
};
if (_i == 0 || _i == 4) then {
_color set [3, 0.5];
};
if (_i == 1 || _i == 3) then {
_color set [3, 0.75];
};
_ctrl ctrlSetTextColor _color;
}else{
_ctrl ctrlShow false;
};
_i = _i + 1;
};
_ctrl = _dlgInteractionDialog displayCtrl 1000;
2015-01-11 23:13:47 +00:00
_ctrl ctrlSetText ((GVAR(Buttons) select GVAR(SelectedButton)) select 0);
2015-01-11 19:32:51 +00:00
_ctrl = _dlgInteractionDialog displayCtrl 1100;
2015-01-11 23:13:47 +00:00
_current = (GVAR(Buttons) select GVAR(SelectedButton));
2015-01-11 19:32:51 +00:00
_infoText = "";
if !([_target, _player] call (_current select 2)) then {
_infoText = "Unavailable";
};
_ctrl ctrlSetText _infoText;
_ctrl ctrlShow (_infoText != "");