mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 00:03:50 +00:00
Tick summon request timeout down in UI render loop; auto-expire on timeout
This commit is contained in:
parent
770ac645d5
commit
b381f1e13f
2 changed files with 13 additions and 0 deletions
|
|
@ -713,6 +713,14 @@ public:
|
||||||
float getSummonTimeoutSec() const { return summonTimeoutSec_; }
|
float getSummonTimeoutSec() const { return summonTimeoutSec_; }
|
||||||
void acceptSummon();
|
void acceptSummon();
|
||||||
void declineSummon();
|
void declineSummon();
|
||||||
|
void tickSummonTimeout(float dt) {
|
||||||
|
if (!pendingSummonRequest_) return;
|
||||||
|
summonTimeoutSec_ -= dt;
|
||||||
|
if (summonTimeoutSec_ <= 0.0f) {
|
||||||
|
pendingSummonRequest_ = false;
|
||||||
|
summonTimeoutSec_ = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---- Trade ----
|
// ---- Trade ----
|
||||||
enum class TradeStatus : uint8_t {
|
enum class TradeStatus : uint8_t {
|
||||||
|
|
|
||||||
|
|
@ -4407,6 +4407,11 @@ void GameScreen::renderDuelRequestPopup(game::GameHandler& gameHandler) {
|
||||||
void GameScreen::renderSummonRequestPopup(game::GameHandler& gameHandler) {
|
void GameScreen::renderSummonRequestPopup(game::GameHandler& gameHandler) {
|
||||||
if (!gameHandler.hasPendingSummonRequest()) return;
|
if (!gameHandler.hasPendingSummonRequest()) return;
|
||||||
|
|
||||||
|
// Tick the timeout down
|
||||||
|
float dt = ImGui::GetIO().DeltaTime;
|
||||||
|
gameHandler.tickSummonTimeout(dt);
|
||||||
|
if (!gameHandler.hasPendingSummonRequest()) return; // expired
|
||||||
|
|
||||||
auto* window = core::Application::getInstance().getWindow();
|
auto* window = core::Application::getInstance().getWindow();
|
||||||
float screenW = window ? static_cast<float>(window->getWidth()) : 1280.0f;
|
float screenW = window ? static_cast<float>(window->getWidth()) : 1280.0f;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue