Add notification sound when new player joins lobby
This commit is contained in:
parent
20ea6d4a5f
commit
d731a658d8
@ -676,6 +676,7 @@ void ClientLobby::updatePlayerList(Event* event)
|
|||||||
unsigned player_count = data.getUInt8();
|
unsigned player_count = data.getUInt8();
|
||||||
std::vector<std::tuple<uint32_t, uint32_t, uint32_t, core::stringw,
|
std::vector<std::tuple<uint32_t, uint32_t, uint32_t, core::stringw,
|
||||||
int, KartTeam> > players;
|
int, KartTeam> > players;
|
||||||
|
core::stringw total_players;
|
||||||
for (unsigned i = 0; i < player_count; i++)
|
for (unsigned i = 0; i < player_count; i++)
|
||||||
{
|
{
|
||||||
std::tuple<uint32_t, uint32_t, uint32_t, core::stringw, int,
|
std::tuple<uint32_t, uint32_t, uint32_t, core::stringw, int,
|
||||||
@ -684,6 +685,7 @@ void ClientLobby::updatePlayerList(Event* event)
|
|||||||
std::get<1>(pl) = data.getUInt32();
|
std::get<1>(pl) = data.getUInt32();
|
||||||
std::get<2>(pl) = data.getUInt8();
|
std::get<2>(pl) = data.getUInt8();
|
||||||
data.decodeStringW(&std::get<3>(pl));
|
data.decodeStringW(&std::get<3>(pl));
|
||||||
|
total_players += std::get<3>(pl);
|
||||||
bool is_peer_waiting_for_game = data.getUInt8() == 1;
|
bool is_peer_waiting_for_game = data.getUInt8() == 1;
|
||||||
bool is_peer_server_owner = data.getUInt8() == 1;
|
bool is_peer_server_owner = data.getUInt8() == 1;
|
||||||
// icon to be used, see NetworkingLobby::loadedFromFile
|
// icon to be used, see NetworkingLobby::loadedFromFile
|
||||||
@ -697,6 +699,13 @@ void ClientLobby::updatePlayerList(Event* event)
|
|||||||
std::get<5>(pl) = (KartTeam)data.getUInt8();
|
std::get<5>(pl) = (KartTeam)data.getUInt8();
|
||||||
players.push_back(pl);
|
players.push_back(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notification sound for new player
|
||||||
|
if (!m_total_players.empty() &&
|
||||||
|
total_players.size() > m_total_players.size())
|
||||||
|
SFXManager::get()->quickSound("energy_bar_full");
|
||||||
|
m_total_players = total_players;
|
||||||
|
|
||||||
NetworkingLobby::getInstance()->updatePlayers(players);
|
NetworkingLobby::getInstance()->updatePlayers(players);
|
||||||
} // updatePlayerList
|
} // updatePlayerList
|
||||||
|
|
||||||
|
@ -87,6 +87,8 @@ private:
|
|||||||
|
|
||||||
std::map<PeerDisconnectInfo, irr::core::stringw> m_disconnected_msg;
|
std::map<PeerDisconnectInfo, irr::core::stringw> m_disconnected_msg;
|
||||||
|
|
||||||
|
irr::core::stringw m_total_players;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClientLobby(const TransportAddress& a, std::shared_ptr<Server> s);
|
ClientLobby(const TransportAddress& a, std::shared_ptr<Server> s);
|
||||||
virtual ~ClientLobby();
|
virtual ~ClientLobby();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user