Common - Add settings for additional progress bar information (#8428)

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
GhostIsSpooky 2021-10-10 13:49:41 -03:00 committed by GitHub
parent 6128b8ef06
commit 1b318433a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 3 deletions

View File

@ -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;
@ -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;

View File

@ -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;

View File

@ -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>