-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from DerZade/patch_1.1.2
Update 1.2
- Loading branch information
Showing
14 changed files
with
115 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
params ["_display"]; | ||
|
||
//exit if BOC is disabled | ||
if (missionNamespace getVariable ['zade_boc_disabled',false]) exitWith {}; | ||
|
||
//get lowest button that is hidden | ||
private _notshown = 948; | ||
for "_i" from 948 to 945 step -1 do { | ||
if !(ctrlShown (_display displayCtrl _i)) then { | ||
_notshown = _i; | ||
}; | ||
}; | ||
|
||
//default offset of two buttons | ||
private _offset = ((ctrlPosition (_display displayCtrl 932)) select 1) - ((ctrlPosition (_display displayCtrl 930)) select 1); | ||
|
||
private _btn = _display ctrlCreate ["RscButtonArsenal", 9233]; | ||
|
||
//set pos | ||
private _pos = ctrlPosition (_display displayCtrl (_notshown - 1)); | ||
_pos set [1, (_pos select 1) + _offset]; | ||
_btn ctrlSetPosition _pos; | ||
_btn ctrlCommit 0; | ||
|
||
//set color | ||
_btn ctrlSetBackgroundColor [0,0,0,0.5]; | ||
|
||
//add EH to backpack list and button | ||
(_display displayCtrl 965) ctrlAddEventHandler ["LBSelChanged",zade_boc_fnc_arsenal_updateUI]; | ||
_btn ctrlAddEventHandler ["ButtonClick",zade_boc_fnc_arsenal_onButtonClick]; | ||
|
||
_display displayAddEventHandler ["KeyDown", "params ['_disp','_key']; if (_key isEqualTo 14) then {[_disp] spawn {sleep 0.02; ((_this select 0) displayCtrl 9233) ctrlShow (ctrlShown ((_this select 0) displayCtrl 932));};};"]; | ||
|
||
[_display] call zade_boc_fnc_arsenal_updateUI; |
13 changes: 13 additions & 0 deletions
13
addons/zade_boc/functions/arsenal/fn_arsenal_onButtonClick.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
private _center = missionnamespace getvariable ["BIS_fnc_arsenal_center",player]; | ||
|
||
private _chestpack = [_center] call zade_boc_fnc_chestpack; | ||
private _backpack = backpack _center; | ||
|
||
private _action = ["onback", "onchest"] select (_chestpack isEqualTo ""); | ||
if (!(_backpack isEqualTo "") and !(_chestpack isEqualTo "")) then {_action = "swap";}; | ||
|
||
//exec action | ||
[_center] call (missionNamespace getVariable (format ["zade_boc_fnc_action%1",_action])); | ||
|
||
//update arsenal | ||
["ListSelectCurrent"] call BIS_fnc_arsenal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (isServer and isMultiplayer) exitWith {}; | ||
|
||
[missionNamespace, "arsenalOpened", zade_boc_fnc_arsenalOpened] call BIS_fnc_addScriptedEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
disableSerialization; | ||
params ["_display"]; | ||
|
||
if (_display isEqualType controlNull) exitWith { //the onSelChanged EH calls before the actual backpack changed so we have to wait a little bit | ||
[ctrlParent _display] spawn {sleep 0.05; _this call zade_boc_fnc_arsenal_updateUI}; | ||
}; | ||
|
||
//the arsenal unit | ||
private _center = missionnamespace getvariable ["BIS_fnc_arsenal_center",player]; | ||
|
||
private _chestpack = [_center] call zade_boc_fnc_chestpack; | ||
private _backpack = backpack _center; | ||
|
||
private _action = ["onback", "onchest"] select (_chestpack isEqualTo ""); | ||
if (!(_backpack isEqualTo "") and !(_chestpack isEqualTo "")) then {_action = "swap";}; | ||
|
||
(_display displayCtrl 9233) ctrlSetText format ["\zade_boc\data\actions\%1_ca.paa",_action]; | ||
(_display displayCtrl 9233) ctrlSetTooltip localize format ["STR_zade_boc_%1",_action]; | ||
|
||
if ((_backpack isEqualTo "") and (_chestpack isEqualTo "")) then { | ||
(_display displayCtrl 9233) ctrlEnable false; | ||
(_display displayCtrl 9233) ctrlSetTooltip ""; | ||
} else { | ||
(_display displayCtrl 9233) ctrlEnable true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters