Add support for respawn counter to spectator UI

Rather than hiding the BI respawn counter, it should be "integrated" into the UI via code if present.
This commit is contained in:
SilentSpike 2015-08-05 19:25:38 +01:00
parent 5200fd6a02
commit 42b5abae11
2 changed files with 39 additions and 7 deletions

View File

@ -1,6 +1,15 @@
// Temporary fix until BI take care of it
class RscFrame {
x = 0;
y = 0;
w = 0;
h = 0;
};
class RscButtonMenu; class RscButtonMenu;
class RscControlsGroupNoScrollbars; class RscControlsGroupNoScrollbars;
class RscFrame; //class RscFrame;
class RscListNBox; class RscListNBox;
class RscMapControl; class RscMapControl;
class RscPicture; class RscPicture;

View File

@ -43,9 +43,8 @@ switch (toLower _mode) do {
// Close map // Close map
openMap [false,false]; openMap [false,false];
// Disable BI damage effects and remove counter layer // Disable BI damage effects
BIS_fnc_feedback_allowPP = false; BIS_fnc_feedback_allowPP = false;
("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","plain"];
// Close all existing dialogs // Close all existing dialogs
while {dialog} do { while {dialog} do {
@ -81,7 +80,7 @@ switch (toLower _mode) do {
clearRadio; clearRadio;
_unit switchCamera "internal"; _unit switchCamera "internal";
// Re-enable BI damage effects // Enable BI damage effects
BIS_fnc_feedback_allowPP = true; BIS_fnc_feedback_allowPP = true;
// Cleanup camera variables // Cleanup camera variables
@ -154,9 +153,33 @@ switch (toLower _mode) do {
[localize LSTRING(prevUnit),"Left Arrow"] [localize LSTRING(prevUnit),"Left Arrow"]
]; ];
// Hacky way to enable keybindings // Handle support for BI's respawn counter
//_display displayAddEventHandler ["KeyUp", {[_this,'keyup'] call CBA_events_fnc_keyHandler}]; [{
//_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; if !(isNull (GETUVAR(RscRespawnCounter,displayNull))) then {
disableSerialization;
private ["_counter","_title","_back","_timer","_frame","_x","_y"];
_counter = GETUVAR(RscRespawnCounter,displayNull);
_title = _counter displayCtrl 1001;
_back = _counter displayCtrl 1002;
_timer = _counter displayCtrl 1003;
_frame = _counter ctrlCreate ["RscFrame",1008];
_x = safeZoneX + safeZoneW - TOOL_W * 4 - MARGIN * 3;
_y = safeZoneY + safeZoneH - TOOL_H;
// Timer
_title ctrlSetPosition [_x,_y,TOOL_W,TOOL_H];
_back ctrlSetPosition [_x,_y,TOOL_W,TOOL_H];
_timer ctrlSetPosition [_x,_y,TOOL_W,TOOL_H];
_frame ctrlSetPosition [_x,_y,TOOL_W,TOOL_H];
_timer ctrlSetFontHeight TOOL_H;
_title ctrlCommit 0;
_back ctrlCommit 0;
_timer ctrlCommit 0;
_frame ctrlCommit 0;
};
},[],0.5] call EFUNC(common,waitAndExecute);
}; };
case "onunload": { case "onunload": {
// Kill GUI PFHs // Kill GUI PFHs