UI: Decouple new chat display and tracking logic.

This commit is contained in:
Unknown W. Brackets committed 2021-09-14 18:08:16 -07:00
1 parent be0b0cd88d
commit 9403947b67
5 files changed
+24 -15

No files matched your search

+13 -1
View File
@@ -862,7 +862,7 @@ void EmuScreen::CreateViews() {
break;
}
ChoiceWithValueDisplay *btn = new ChoiceWithValueDisplay(&newChat, n->T("Chat"), layoutParams);
ChoiceWithValueDisplay *btn = new ChoiceWithValueDisplay(&newChatMessages_, n->T("Chat"), layoutParams);
root_->Add(btn)->OnClick.Handle(this, &EmuScreen::OnChat);
chatButton_ = btn;
chatMenu_ = root_->Add(new ChatMenu(screenManager()->getUIContext()->GetBounds(), new LayoutParams(FILL_PARENT, FILL_PARENT)));
@@ -987,6 +987,18 @@ void EmuScreen::update() {
resumeButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR && Memory::MemFault_MayBeResumable() ? V_VISIBLE : V_GONE);
resetButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR ? V_VISIBLE : V_GONE);
if (chatButton_ && chatMenu_) {
if (chatMenu_->GetVisibility() != V_GONE) {
chatMessages_ = GetChatMessageCount();
newChatMessages_ = 0;
} else {
int diff = GetChatMessageCount() - chatMessages_;
chatMessages_ += diff;
// Cap the count at 50.
newChatMessages_ = diff > 50 ? 50 : diff;
}
}
if (bootPending_) {
bootGame(gamePath_);
}