Skip to content

Commit

Permalink
Common - Add settings for additional progress bar information (#8428)
Browse files Browse the repository at this point in the history
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
  • Loading branch information
LinkIsGrim and PabstMirror authored Oct 10, 2021
1 parent 6128b8e commit 1b31843
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
16 changes: 13 additions & 3 deletions addons/common/functions/fnc_progressBar.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _ctrlPos set [1, ((0 + 29 * GVAR(settingProgressBarLocation)) * ((((safezoneW /
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0;

[{
(_this select 0) params ["_args", "_onFinish", "_onFail", "_condition", "_player", "_startTime", "_totalTime", "_exceptions"];
(_this select 0) params ["_args", "_onFinish", "_onFail", "_condition", "_player", "_startTime", "_totalTime", "_exceptions", "_title"];

private _elapsedTime = CBA_missionTime - _startTime;
private _errorCode = -1;
Expand Down Expand Up @@ -95,6 +95,16 @@ _ctrlPos set [1, ((0 + 29 * GVAR(settingProgressBarLocation)) * ((((safezoneW /
};
} else {
//Update Progress Bar (ratio of elepased:total)
(uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime);
private _ratio = _elapsedTime / _totalTime;
(uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition _ratio;
switch (GVAR(progressBarInfo)) do {
case 0: {};
case 1: {
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText (_title + format [" (%1", floor (_ratio * 100)] + "%)");
};
case 2: {
(uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText (_title + " " + format [localize LSTRING(TimeLeft), ceil (_totalTime - _elapsedTime)]);
};
};
};
}, 0, [_args, _onFinish, _onFail, _condition, _player, CBA_missionTime, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler;
}, 0, [_args, _onFinish, _onFail, _condition, _player, CBA_missionTime, _totalTime, _exceptions, _localizedTitle]] call CBA_fnc_addPerFrameHandler;
9 changes: 9 additions & 0 deletions addons/common/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@
false,
2
] call CBA_fnc_addSetting;

[
QGVAR(progressBarInfo),
"LIST",
[LSTRING(progressBarInfoName), LSTRING(progressBarInfoDesc)],
format ["ACE %1", localize LSTRING(DisplayName)],
[[0, 1, 2], [LSTRING(None), LSTRING(progressBarInfoPercentage), LSTRING(progressBarInfoTime)], 2],
0
] call CBA_fnc_addSetting;
31 changes: 31 additions & 0 deletions addons/common/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1470,5 +1470,36 @@
<English>Both</English>
<Turkish>İkisi de</Turkish>
</Key>
<Key ID="STR_ACE_Common_progressBarInfoName">
<English>Additional progress bar information</English>
</Key>
<Key ID="STR_ACE_Common_progressBarInfoDesc">
<English>Controls extra information shown in progress bar.</English>
</Key>
<Key ID="STR_ACE_Common_progressBarInfoPercentage">
<English>Percentage</English>
</Key>
<Key ID="STR_ACE_Common_progressBarInfoTime">
<English>Time remaining</English>
</Key>
<Key ID="STR_ACE_Common_None">
<English>None</English>
<Czech>Žádná</Czech>
<German>Keine</German>
<Russian>Нет</Russian>
<Polish>Brak</Polish>
<Italian>Nessuna</Italian>
<Spanish>Nada</Spanish>
<French>Aucune</French>
<Chinese>無</Chinese>
<Japanese>なし</Japanese>
<Korean>활성화 없음</Korean>
<Portuguese>Nenhuma</Portuguese>
<Chinesesimp>无</Chinesesimp>
<Turkish>Yok</Turkish>
</Key>
<Key ID="STR_ACE_Common_TimeLeft">
<English>Time left: %1s</English>
</Key>
</Package>
</Project>

0 comments on commit 1b31843

Please sign in to comment.