2016-05-18 15:16:35 +00:00
|
|
|
/*
|
2018-02-24 17:44:57 +00:00
|
|
|
* Author: SilentSpike, mharis001
|
|
|
|
* Initalizes the "Teleport Players" Zeus module display.
|
2016-05-18 15:16:35 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: teleportPlayers controls group <CONTROL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2016-11-15 12:07:48 +00:00
|
|
|
* None
|
2016-05-18 15:16:35 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [CONTROL] call ace_zeus_fnc_ui_teleportPlayers
|
|
|
|
*
|
2016-05-18 15:16:35 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
2016-05-15 20:02:40 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
params ["_control"];
|
|
|
|
|
|
|
|
//Generic Init:
|
2016-11-15 12:07:48 +00:00
|
|
|
private _display = ctrlParent _control;
|
|
|
|
private _ctrlButtonOK = _display displayCtrl 1; //IDC_OK
|
|
|
|
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull);
|
2016-05-15 20:02:40 +00:00
|
|
|
TRACE_1("logicObject",_logic);
|
|
|
|
|
|
|
|
_control ctrlRemoveAllEventHandlers "setFocus";
|
|
|
|
|
|
|
|
//Specific on-load stuff:
|
|
|
|
private _listbox = _display displayCtrl 16189;
|
|
|
|
{
|
|
|
|
if (alive _x) then {
|
|
|
|
_listbox lbSetData [_listbox lbAdd (name _x), getPlayerUID _x];
|
|
|
|
};
|
2017-04-11 14:59:06 +00:00
|
|
|
} forEach ([] call CBA_fnc_players);
|
2016-05-15 20:02:40 +00:00
|
|
|
|
|
|
|
_listbox lbSetCurSel 0;
|
2016-05-18 15:16:35 +00:00
|
|
|
(_display displayCtrl 16188) cbSetChecked (_logic getVariable ["tpGroup",false]);
|
2016-05-15 20:02:40 +00:00
|
|
|
|
2018-02-24 17:44:57 +00:00
|
|
|
private _fnc_onKeyUp = {
|
|
|
|
params ["_display"];
|
|
|
|
|
|
|
|
private _listbox = _display displayCtrl 16189;
|
|
|
|
private _edit = _display displayCtrl 16190;
|
|
|
|
private _text = toLower ctrlText _edit;
|
|
|
|
|
|
|
|
lbClear _listbox;
|
|
|
|
|
|
|
|
{
|
|
|
|
if (alive _x) then {
|
|
|
|
if ([toLower name _x, _text] call CBA_fnc_find > -1) then {
|
|
|
|
_listbox lbSetData [_listbox lbAdd (name _x), getPlayerUID _x];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach ([] call CBA_fnc_players);
|
|
|
|
|
|
|
|
// Alert user to zero search matches
|
|
|
|
if (lbSize _listbox == 0) then {
|
|
|
|
_edit ctrlSetTooltip (localize LSTRING(ModuleTeleportPlayers_noneFound));
|
|
|
|
_edit ctrlSetTextColor [1, 0, 0, 1];
|
|
|
|
} else {
|
|
|
|
_edit ctrlSetTooltip "";
|
|
|
|
_edit ctrlSetTextColor [1, 1, 1, 1];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-05-15 20:02:40 +00:00
|
|
|
private _fnc_onUnload = {
|
|
|
|
params ["_display"];
|
|
|
|
|
|
|
|
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull);
|
|
|
|
if (isNull _logic) exitWith {};
|
|
|
|
|
|
|
|
// Store checkbox value for reopening
|
|
|
|
_logic setVariable ["tpGroup", cbChecked (_display displayCtrl 16188)];
|
|
|
|
};
|
|
|
|
|
|
|
|
private _fnc_onConfirm = {
|
|
|
|
params [["_ctrlButtonOK", controlNull, [controlNull]]];
|
2016-05-18 15:16:35 +00:00
|
|
|
|
2016-05-15 20:02:40 +00:00
|
|
|
private _display = ctrlparent _ctrlButtonOK;
|
|
|
|
if (isNull _display) exitWith {};
|
|
|
|
|
|
|
|
private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull);
|
2016-05-16 13:55:19 +00:00
|
|
|
if (isNull _logic) exitWith {};
|
2016-05-15 20:02:40 +00:00
|
|
|
|
|
|
|
private _lb = _display displayCtrl 16189;
|
|
|
|
|
|
|
|
private _uid = _lb lbData (lbCurSel _lb);
|
|
|
|
private _group = cbChecked (_display displayCtrl 16188);
|
|
|
|
|
|
|
|
[_logic, _uid, _group] call FUNC(moduleTeleportPlayers);
|
|
|
|
};
|
|
|
|
|
2018-02-24 17:44:57 +00:00
|
|
|
_display displayAddEventHandler ["KeyUp", _fnc_onKeyUp];
|
2016-05-15 20:02:40 +00:00
|
|
|
_display displayAddEventHandler ["unload", _fnc_onUnload];
|
|
|
|
_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm];
|