-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add CBA_fnc_progressBar #912
Conversation
addons/ui/fnc_progressBar.sqf
Outdated
Opens a progress bar. Closes the currently active progress bar. | ||
|
||
Parameters: | ||
_condition - Execute every frame. If reports false, close the progress bar <CODE> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_title
addons/ui/fnc_progressBar.sqf
Outdated
@@ -0,0 +1,168 @@ | |||
/* ---------------------------------------------------------------------------- | |||
Function: CBA_fnc_display |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong name
addons/ui/fnc_progressBar.sqf
Outdated
|
||
Examples: | ||
(begin example) | ||
["progress bar", {true}, 5, {hint "done"}, {hint "aborted"}] call CBA_fnc_display; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong function name
addons/ui/fnc_progressBar.sqf
Outdated
} else { | ||
QGVAR(ProgressBar) cutRsc [QGVAR(ProgressBar), "PLAIN"]; | ||
_display = uiNamespace getVariable QGVAR(ProgressBar); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo, MouseMoving, MouseHolding don't work for cutRsc.
addons/ui/fnc_progressBar.sqf
Outdated
if (!hasInterface) exitWith {}; | ||
|
||
if (canSuspend) exitWith { | ||
isNil (uiNamespace getVariable _fnc_scriptName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this bit all about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run the function unscheduled every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe prefer fnc_directCall for clarity?
I'd usually push the performance argument.. But this is scheduled soooooo....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I just hadn't see the uiNamespace
stuff before, was curious as to how that worked
addons/ui/fnc_progressBar.sqf
Outdated
[_onFailure, [_arguments, false, _elapsedTime, _totalTime]] call CBA_fnc_execNextFrame; | ||
}; | ||
|
||
if (_elapsedTime > _totalTime) exitWith { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_elapsedTime = (CBA_missionTime - _startTime) min _totalTime;
so elapsed can never be greater than total
Any suggestion on how to order those parameters? -__- |
onFailure could be optional. Most people probably don't need that. |
In truth, all params are optional, but I will edit the header. |
Why the change from a small onDraw EH to a big, always recompiling EachFrame EH? |
Latest is using onDraw.
|
The onDraw EH runs in the middle of the Drawing function of the map control, not at the end. So if you delete the map who'se function is currently running and the function then tries to continue drawing the map and access it's own variables.. boom. |
Not what I meant. I want to make sure this stuff doesn't behave weird if you e.g. create a new progress bar at the same time the previous one closes. |
Ready now hopefully. |
addons/ui/fnc_progressBar.sqf
Outdated
@@ -89,4 +80,70 @@ if (!isNil QGVAR(ProgressBarParams)) then { | |||
|
|||
GVAR(ProgressBarParams) = [_arguments, _condition, _onSuccess, _onFailure, CBA_missionTime, _totalTime, _blockMouse, _blockKeys, _allowClose]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that it really matters, but you could set these on the display itself and that way it get's cleaned up automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The display dies when saving and loading a savegame.
If I use a global instead, which is serialized properly, I can create a new loading bar with the same parameters once the game is loaded:
https://github.com/CBATeam/CBA_A3/pull/912/files#diff-8ff25e6d6abfb5db687c39f11a07e5b4R7
Only thing that doesn't work is the block input display, but I just assume that this only ever happens to mouse enabled progress bars, since only then you can use Esc to open the menu to save.
addons/ui/RscTitles.hpp
Outdated
}; | ||
|
||
class Script: RscMapControl { | ||
idc = IDC_PROGRESSBAR_SCRIPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File x\cba\addons\ui\RscTitles.hpp, line 51: '/RscTitles/cba_ui_ProgressBar/Script.idc': Missing ';' at the end of line
Guys, get me a "+1" on this one if you feel it's ready. |
When merged this pull request will: