Skip to content

Commit

Permalink
freeze
Browse files Browse the repository at this point in the history
close #78
  • Loading branch information
Zealot111 committed Nov 11, 2014
1 parent ac9d85a commit e80ac10
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 5 deletions.
8 changes: 8 additions & 0 deletions addons/WMT_Main/functions/defines.sqf
Expand Up @@ -4,6 +4,9 @@
#define IDC_MENU_OPTION 61001
#define IDC_MENU_ADMIN 61002
#define IDC_MENU_CLOSE 61003
#define IDC_MENU_TEAM_READY 61004
#define IDC_MENU_TEAM_NOT_READY 61005


#define IDD_OPTIONS_OPTIONS 17000
#define IDC_OPTIONS_FOOT_TEXT 17001
Expand All @@ -25,6 +28,11 @@
#define IDD_ADMINPANEL_ADD10 62007
#define IDD_ADMINPANEL_SUB 62008

#define IDD_ADMINPANEL_FREEZETIME 62009
#define IDD_ADMINPANEL_FREEZEADD5 62010
#define IDD_ADMINPANEL_FREEZEADD10 62011
#define IDD_ADMINPANEL_FREEZESUB 62012

#define IDD_FEEDBACK 63000
#define IDC_FEEDBACK_TEXT 63001
#define IDC_FEEDBACK_CLOSE 63002
Expand Down
4 changes: 2 additions & 2 deletions addons/WMT_Main/functions/fn_FreezeUI.sqf
Expand Up @@ -16,16 +16,16 @@

PR(_triggers) = [];

if (leader player == player) then {
if (leader player == player || serverCommandAvailable('#kick') ) then {
_triggers = [
[true, 0, "ALPHA", "PRESENT","this","[] call WMT_fnc_FreezeVoteStart ","",localize "STR_WMT_FreezeVoteStart"] call WMT_fnc_CreateTrigger,
[true, 0, "BRAVO", "PRESENT","this","[] call WMT_fnc_FreezeVoteWait ","",localize "STR_WMT_FreezeVoteWait"] call WMT_fnc_CreateTrigger
];
};

sleep 0.01;

while {WMT_pub_frzState < 3} do {

PR(_time3) = round(WMT_pub_frzTimeLeft);
PR(_sec) = 0;
if (WMT_pub_frzState == 2) then {
Expand Down
50 changes: 49 additions & 1 deletion addons/WMT_Main/functions/fn_HandlerAdminPanel.sqf
Expand Up @@ -26,6 +26,13 @@ switch (_event) do
PR(_dialog) = _arg select 0;
uiNamespace setVariable ["WMT_Dialog_Menu", _dialog];
_dialog displayAddEventHandler ["MouseMoving", "true"];

if ( WMT_pub_frzState >= 3 ) then {
(_dialog displayCtrl IDD_ADMINPANEL_FREEZETIME) ctrlShow false;
(_dialog displayCtrl IDD_ADMINPANEL_FREEZEADD5) ctrlShow false;
(_dialog displayCtrl IDD_ADMINPANEL_FREEZEADD10) ctrlShow false;
(_dialog displayCtrl IDD_ADMINPANEL_FREEZESUB) ctrlShow false;
};

["loop", _dialog] call WMT_fnc_HandlerAdminPanel;
};
Expand Down Expand Up @@ -102,7 +109,34 @@ switch (_event) do
};
};
};

[_arg] spawn {
disableSerialization;
PR(_dialog) = _this select 0;
PR(_ctrlTime) = _dialog displayCtrl IDD_ADMINPANEL_FREEZETIME;
while {(uiNamespace getVariable ["WMT_Dialog_Menu",displayNull]) == _dialog && WMT_pub_frzState < 3} do {

PR(_leftTime) = 0 max WMT_pub_frzTimeLeft;
PR(_min) = floor(_leftTime/60);
PR(_sec) = floor(_leftTime%60);
PR(_text) = "";

if(_sec<10) then {
_text = format ["%1: %2:0%3",localize "STR_WMT_TimeLeftFreeze", _min, _sec];
} else {
_text = format ["%1: %2:%3",localize "STR_WMT_TimeLeftFreeze", _min, _sec];
};

_ctrlTime ctrlSetText _text;
sleep 0.1;

};
if ((uiNamespace getVariable ["WMT_Dialog_Menu",displayNull]) == _dialog) then {
(_dialog displayCtrl IDD_ADMINPANEL_FREEZETIME) ctrlShow false;
(_dialog displayCtrl IDD_ADMINPANEL_FREEZEADD5) ctrlShow false;
(_dialog displayCtrl IDD_ADMINPANEL_FREEZEADD10) ctrlShow false;
(_dialog displayCtrl IDD_ADMINPANEL_FREEZESUB) ctrlShow false;
};
};
};
case "changeTime" : {
if !(isNil "wmt_param_MissionTime") then {
Expand Down Expand Up @@ -133,5 +167,19 @@ switch (_event) do
publicVariable "WMT_Global_Announcement";
};
};

case "freezeTime" : {
PR(_deltaTime) = _arg; // minutes
WMT_pub_frzTimeLeft = WMT_pub_frzTimeLeft + _deltaTime * 60;
publicVariable "WMT_pub_frzTimeLeft";

if(_deltaTime>0) then {
WMT_Global_Announcement = format [localize "STR_WMT_TimeIncreasedFreeze", _deltaTime, round(WMT_pub_frzTimeLeft/60)];
} else {
WMT_Global_Announcement = format [localize "STR_WMT_TimeReducedFreeze", -_deltaTime, round(WMT_pub_frzTimeLeft/60)];
};
WMT_Global_Announcement call WMT_fnc_Announcement;
publicVariable "WMT_Global_Announcement";
};
};
_return
18 changes: 18 additions & 0 deletions addons/WMT_Main/functions/fn_HandlerMenu.sqf
Expand Up @@ -29,7 +29,25 @@ switch (_event) do

(_dialog displayCtrl IDC_MENU_ADMIN) ctrlSetText localize 'STR_WMT_AdminPanel';
};
if ( WMT_pub_frzState < 3 && (leader player == player || serverCommandAvailable('#kick')) ) then {
(_dialog displayCtrl IDC_MENU_TEAM_READY) ctrlShow true;
(_dialog displayCtrl IDC_MENU_TEAM_NOT_READY) ctrlShow true;
} else {
(_dialog displayCtrl IDC_MENU_TEAM_READY) ctrlShow false;
(_dialog displayCtrl IDC_MENU_TEAM_NOT_READY) ctrlShow false;

};
};
case "teamready" :{
closeDialog 0;
[] call WMT_fnc_FreezeVoteStart;
};

case "teamnotready" : {
closeDialog 0;
[] call WMT_fnc_FreezeVoteWait;
};

case "close": {
uiNamespace setVariable ["WMT_Dialog_Menu", nil];
};
Expand Down
5 changes: 5 additions & 0 deletions addons/WMT_Main/functions/fn_PrepareTime_server.sqf
Expand Up @@ -24,6 +24,7 @@ if (isNil "WMT_pub_frzVoteWait") then { WMT_pub_frzVoteWait = []; };
if (isNil "WMT_pub_frzVoteStart") then { WMT_pub_frzVoteStart = []; };
if (isNil "WMT_pub_frzTimeLeftForced") then { WMT_pub_frzTimeLeftForced = 30; };
if (isNil "WMT_pub_frzTimeLeft") then { WMT_pub_frzTimeLeft = _freeztime; };
if (isNil "WMT_frzBeginDate") then {WMT_frzBeginDate = date;};

if (_freeztime ==0 ) then { WMT_pub_frzState = 3; };

Expand Down Expand Up @@ -51,3 +52,7 @@ while {WMT_pub_frzState < 3} do
if (round(WMT_pub_frzTimeLeft) % 10 == 0) then {publicVariable "WMT_pub_frzTimeLeft";};
};

setDate WMT_frzBeginDate;



5 changes: 4 additions & 1 deletion addons/WMT_Main/functions/fn_RemoveBots.sqf
Expand Up @@ -2,7 +2,10 @@

PR(_rtime) = [_this, 0, 300] call BIS_fnc_param;

waitUntil{sleep 0.725; time > _rtime};


waitUntil{!isNil "WMT_pub_frzState"};
waitUntil{sleep 0.725; time > _rtime && WMT_pub_frzState >= 3};

{
PR(_isplayer) = _x getVariable ["WMT_PlayerName", nil];
Expand Down
2 changes: 1 addition & 1 deletion addons/WMT_Main/resource/CfgModuls.h
Expand Up @@ -182,7 +182,7 @@ class CfgVehicles
displayName = "$STR_WMT_RemoveBots";
description = "";
typeName = "NUMBER";
defaultValue = 5;
defaultValue = 3;
};
};
};
Expand Down
48 changes: 48 additions & 0 deletions addons/WMT_Main/resource/RscWMTAdminPanel.h
Expand Up @@ -8,6 +8,12 @@
#define IDD_ADMINPANEL_ADD10 62007
#define IDD_ADMINPANEL_SUB 62008

#define IDD_ADMINPANEL_FREEZETIME 62009
#define IDD_ADMINPANEL_FREEZEADD5 62010
#define IDD_ADMINPANEL_FREEZEADD10 62011
#define IDD_ADMINPANEL_FREEZESUB 62012


class RscWMTAdminPanel {
movingEnable = 1;
idd = IDD_ADMINPANEL;
Expand All @@ -30,6 +36,16 @@ class RscWMTAdminPanel {
w = 0.7;
h = 0.09;
};

class Background3: RscText {
colorBackground[] = {0, 0, 0, 0.75};
idc = -1;
x = 0.0;
y = 0.65;
w = 0.7;
h = 0.09;
};

class BackgroundHead: RscText {
colorBackground[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])",
Expand Down Expand Up @@ -108,6 +124,38 @@ class RscWMTAdminPanel {
text = $STR_WMT_Sub5Min;
action = "['changeTime',-5] call WMT_fnc_HandlerAdminPanel";
};

class freezeText_Time : RscText {
idc = IDD_ADMINPANEL_FREEZETIME;
x = 0.05;
y = 0.675;
w = 0.4;
text = "Left freezetime: 45:12";
};
class Button_freezeAddTime10: RscWMTButton_ext{
idc = IDD_ADMINPANEL_FREEZEADD10;
x = 0.48;
y = 0.745;
w = 0.22;
text = $STR_WMT_Add10Min;
action = "['freezeTime',10] call WMT_fnc_HandlerAdminPanel";
};
class Button_freezeAddTime5: RscWMTButton_ext{
idc = IDD_ADMINPANEL_FREEZEADD5;
x = 0.24;
y = 0.745;
w = 0.22;
text = $STR_WMT_Add5Min;
action = "['freezeTime',5] call WMT_fnc_HandlerAdminPanel";
};
class Button_freezeSubtractTime: RscWMTButton_ext{
idc = IDD_ADMINPANEL_FREEZESUB;
x = 0.0;
y = 0.745;
w = 0.22;
text = $STR_WMT_Sub5Min;
action = "['freezeTime',-5] call WMT_fnc_HandlerAdminPanel";
};
};
};

17 changes: 17 additions & 0 deletions addons/WMT_Main/resource/RscWMTMainMenu.h
Expand Up @@ -2,6 +2,8 @@
#define IDC_MENU_OPTION 61001
#define IDC_MENU_ADMIN 61002
#define IDC_MENU_CLOSE 61003
#define IDC_MENU_TEAM_READY 61004
#define IDC_MENU_TEAM_NOT_READY 61005

class RscWMTMainMenu {
idd = IDD_DSIAPLAY_MAINMENU;
Expand Down Expand Up @@ -43,5 +45,20 @@ class RscWMTMainMenu {
text = $STR_WMT_Close;
action = "closeDialog 0;";
};
class Button_TeamReady : RscWMTButtonMenu_ext {
idc = IDC_MENU_TEAM_READY;
x = -0.46;
y = 0.255;
text = $STR_WMT_FreezeVoteStart;
action = "['teamready',_this] call WMT_fnc_HandlerMenu";
};
class Button_TeamNotReady : RscWMTButtonMenu_ext {
idc = IDC_MENU_TEAM_NOT_READY;
x = -0.46;
y = 0.360;
h = 0.15;
text = $STR_WMT_FreezeVoteWait;
action = "['teamnotready',_this] call WMT_fnc_HandlerMenu";
};
};
};
12 changes: 12 additions & 0 deletions addons/WMT_Main/stringtable.xml
Expand Up @@ -318,10 +318,22 @@
<Original>Time mission is reduced by %1 minutes (%2:00)</Original>
<Russian>Время на миссию уменьшено на %1 минут (%2:00)</Russian>
</Key>
<Key ID="STR_WMT_TimeIncreasedFreeze">
<Original>Freezetime is increased by %1 minutes (%2:00)</Original>
<Russian>Время фризтайма увеличено на %1 минут (%2:00)</Russian>
</Key>
<Key ID="STR_WMT_TimeReducedFreeze">
<Original>Freezetime is reduced by %1 minutes (%2:00)</Original>
<Russian>Время фризтайма уменьшено на %1 минут (%2:00)</Russian>
</Key>
<Key ID="STR_WMT_TimeLeft">
<Original>Time left</Original>
<Russian>Оставшееся время</Russian>
</Key>
<Key ID="STR_WMT_TimeLeftFreeze">
<Original>Freezetime left</Original>
<Russian>Время фризтайма</Russian>
</Key>
<Key ID="STR_WMT_Add5Min">
<Original>+ 5 min</Original>
<Russian>+ 5 мин</Russian>
Expand Down

0 comments on commit e80ac10

Please sign in to comment.