feat: implemented clear-one and clear-all buttons.

This commit is contained in:
UW Admin 2020-11-21 17:53:18 -05:00 committed by Vsevolod Kremianskii
parent a99a3a21da
commit 8ab6b7cfa6

View file

@ -196,6 +196,7 @@ void HUD::showCombatHud() {
// TODO: make those class members? // TODO: make those class members?
showControl("BTN_CLEARALL"); showControl("BTN_CLEARALL");
showControl("BTN_CLEARONE"); showControl("BTN_CLEARONE");
showControl("BTN_CLEARONE2");
showControl("LBL_CMBTMODEMSG"); showControl("LBL_CMBTMODEMSG");
showControl("LBL_CMBTMSGBG"); showControl("LBL_CMBTMSGBG");
@ -213,6 +214,7 @@ void HUD::showCombatHud() {
void HUD::hideCombatHud() { void HUD::hideCombatHud() {
hideControl("BTN_CLEARALL"); hideControl("BTN_CLEARALL");
hideControl("BTN_CLEARONE"); hideControl("BTN_CLEARONE");
showControl("BTN_CLEARONE2");
hideControl("LBL_CMBTMODEMSG"); hideControl("LBL_CMBTMODEMSG");
hideControl("LBL_CMBTMSGBG"); hideControl("LBL_CMBTMSGBG");
@ -233,7 +235,7 @@ void HUD::drawActionQueueItems() const {
// clear the drawn queue items first // clear the drawn queue items first
for (int j = 0; j < 4; ++j) { for (int j = 0; j < 4; ++j) {
Control& qItem = getControl("LBL_QUEUE" + to_string(j)); Control &qItem = getControl("LBL_QUEUE" + to_string(j));
qItem.setBorderFill(""); qItem.setBorderFill("");
} }
@ -241,6 +243,7 @@ void HUD::drawActionQueueItems() const {
while (i < 4 && it != actionQueue.end()) { while (i < 4 && it != actionQueue.end()) {
ActionType actionType = (*it)->type(); ActionType actionType = (*it)->type();
// TODO: if (isDisplayableAction(*it))
if (actionType == ActionType::AttackObject) { if (actionType == ActionType::AttackObject) {
Control &qItem = getControl("LBL_QUEUE"+to_string(i)); Control &qItem = getControl("LBL_QUEUE"+to_string(i));
qItem.setBorderFill("i_attack"); qItem.setBorderFill("i_attack");
@ -268,6 +271,19 @@ void HUD::onClick(const string &control) {
_game->openInGameMenu(InGameMenu::Tab::Map); _game->openInGameMenu(InGameMenu::Tab::Map);
} else if (control == "BTN_OPT") { } else if (control == "BTN_OPT") {
_game->openInGameMenu(InGameMenu::Tab::Options); _game->openInGameMenu(InGameMenu::Tab::Options);
} else if (control == "BTN_CLEARALL") {
_game->party().leader()->actionQueue().clear();
} else if (control == "BTN_CLEARONE" || control == "BTN_CLEARONE2") {
auto &actionQueue = _game->party().leader()->actionQueue();
for (auto& it=actionQueue.begin(); it!=actionQueue.end(); ++it) {
// TODO: if (isDisplayableAction(*it))
if ((*it)->type() == ActionType::AttackObject) {
(*it)->complete();
break;
}
}
} }
} }