| 115 | } |
| 116 | |
| 117 | void TeamClient::update() { |
| 118 | handleRpcResponses(); |
| 119 | |
| 120 | if (!m_hasPendingInvitation) { |
| 121 | if (Time::monotonicTime() - m_pollInvitationsTimer > Root::singleton().assets()->json("/interface.config:invitationPollInterval").toFloat()) { |
| 122 | m_pollInvitationsTimer = Time::monotonicTime(); |
| 123 | JsonObject request; |
| 124 | request["playerUuid"] = m_clientContext->playerUuid().hex(); |
| 125 | invokeRemote("team.pollInvitation", request, [this](Json response) { |
| 126 | if (response.isNull()) |
| 127 | return; |
| 128 | if (m_hasPendingInvitation) |
| 129 | return; |
| 130 | m_pendingInvitation = {Uuid(response.getString("inviterUuid")), response.getString("inviterName")}; |
| 131 | m_hasPendingInvitation = true; |
| 132 | }); |
| 133 | } |
| 134 | } |
| 135 | if (!m_fullUpdateRunning) { |
| 136 | if (Time::monotonicTime() - m_fullUpdateTimer > Root::singleton().assets()->json("/interface.config:fullUpdateInterval").toFloat()) { |
| 137 | m_fullUpdateTimer = Time::monotonicTime(); |
| 138 | pullFullUpdate(); |
| 139 | } |
| 140 | } |
| 141 | if (!m_statusUpdateRunning) { |
| 142 | if (Time::monotonicTime() - m_statusUpdateTimer > Root::singleton().assets()->json("/interface.config:statusUpdateInterval").toFloat()) { |
| 143 | m_statusUpdateTimer = Time::monotonicTime(); |
| 144 | statusUpdate(); |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | void TeamClient::pullFullUpdate() { |
| 150 | if (m_fullUpdateRunning) |