mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
only trigger confirmation popup if state changed
This commit is contained in:
parent
aeaf7f7b88
commit
8f3f4d7a05
2 changed files with 13 additions and 10 deletions
|
@ -95,15 +95,6 @@ bool ModsStatusNode::init() {
|
|||
}
|
||||
|
||||
void ModsStatusNode::updateState() {
|
||||
enum class DownloadState {
|
||||
None,
|
||||
SomeCancelled,
|
||||
AllDone,
|
||||
SomeErrored,
|
||||
SomeToBeConfirmed,
|
||||
SomeFetching,
|
||||
SomeDownloading,
|
||||
};
|
||||
DownloadState state = DownloadState::None;
|
||||
auto upgradeState = [&](DownloadState into) {
|
||||
if (static_cast<int>(state) < static_cast<int>(into)) {
|
||||
|
@ -206,7 +197,7 @@ void ModsStatusNode::updateState() {
|
|||
|
||||
m_viewBtn->setVisible(true);
|
||||
m_viewBtn->setTarget(this, menu_selector(ModsStatusNode::onConfirm));
|
||||
askConfirmModInstalls();
|
||||
if(m_lastState != state) askConfirmModInstalls();
|
||||
} break;
|
||||
|
||||
case DownloadState::SomeFetching: {
|
||||
|
@ -243,6 +234,7 @@ void ModsStatusNode::updateState() {
|
|||
} break;
|
||||
}
|
||||
|
||||
m_lastState = state;
|
||||
m_btnMenu->updateLayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,16 @@ using namespace geode::prelude;
|
|||
|
||||
class ModsStatusNode : public CCNode {
|
||||
protected:
|
||||
enum class DownloadState {
|
||||
None,
|
||||
SomeCancelled,
|
||||
AllDone,
|
||||
SomeErrored,
|
||||
SomeToBeConfirmed,
|
||||
SomeFetching,
|
||||
SomeDownloading,
|
||||
};
|
||||
|
||||
CCScale9Sprite* m_statusBG;
|
||||
CCLabelBMFont* m_status;
|
||||
CCLabelBMFont* m_statusPercentage;
|
||||
|
@ -28,6 +38,7 @@ protected:
|
|||
CCMenuItemSpriteExtra* m_restartBtn;
|
||||
EventListener<UpdateModListStateFilter> m_updateStateListener;
|
||||
EventListener<server::ModDownloadFilter> m_downloadListener;
|
||||
DownloadState m_lastState = DownloadState::None;
|
||||
|
||||
bool init();
|
||||
void updateState();
|
||||
|
|
Loading…
Reference in a new issue