mirror of
https://github.com/MaciejkaG/statki.git
synced 2024-11-30 05:42:56 +01:00
a027313139
- Multiple visual improvements to animation - Added ship color dimming when they sunk - Added game ending (looks and works primitvely for now) - Added socket.io client error handling and alerts - Finished and improved hit registration and client hit display To-do: - Fix timers (currently resetting the timer is global, which by mistake affects other independent lobbies, critical bug) - Post-match stats - Improve many mechanics - Improve overall quality of the game
72 lines
1.8 KiB
JavaScript
72 lines
1.8 KiB
JavaScript
// Handling connection errors
|
|
socket.on("reconnecting", (number) => {
|
|
Toastify({
|
|
text: `Ponowne łączenie... ${number}`,
|
|
duration: 5000,
|
|
newWindow: true,
|
|
gravity: "bottom",
|
|
position: "right",
|
|
stopOnFocus: true,
|
|
className: "bshipstoast",
|
|
}).showToast();
|
|
});
|
|
|
|
socket.on("reconnect", () => {
|
|
Toastify({
|
|
text: "Połączono ponownie",
|
|
duration: 5000,
|
|
newWindow: true,
|
|
gravity: "bottom",
|
|
position: "right",
|
|
stopOnFocus: true,
|
|
className: "bshipstoast",
|
|
}).showToast();
|
|
});
|
|
|
|
socket.on("reconnect_error", () => {
|
|
Toastify({
|
|
text: "Wystąpił problem w trakcie ponownego łączenia",
|
|
duration: 5000,
|
|
newWindow: true,
|
|
gravity: "bottom",
|
|
position: "right",
|
|
stopOnFocus: true,
|
|
className: "bshipstoast",
|
|
}).showToast();
|
|
});
|
|
|
|
socket.on("reconnect_failed", () => {
|
|
Toastify({
|
|
text: "Nie udało się połączyć ponownie",
|
|
duration: 5000,
|
|
newWindow: true,
|
|
gravity: "bottom",
|
|
position: "right",
|
|
stopOnFocus: true,
|
|
className: "bshipstoast",
|
|
}).showToast();
|
|
});
|
|
|
|
socket.on("disconnect", () => {
|
|
Toastify({
|
|
text: "Rozłączono z serwerem\nSpróbuj odświeżyć stronę jeżeli błąd będzie się powtarzał",
|
|
duration: 5000,
|
|
newWindow: true,
|
|
gravity: "bottom",
|
|
position: "right",
|
|
stopOnFocus: true,
|
|
className: "bshipstoast",
|
|
}).showToast();
|
|
});
|
|
|
|
socket.on("error", () => {
|
|
Toastify({
|
|
text: "Błąd połączenia",
|
|
duration: 5000,
|
|
newWindow: true,
|
|
gravity: "bottom",
|
|
position: "right",
|
|
stopOnFocus: true,
|
|
className: "bshipstoast",
|
|
}).showToast();
|
|
}); |