5180 fichiers 38.5 Mo 0 téléchargements 221 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / api / snowwar / SnowWarLeaveBlock.ts
SnowWarLeaveBlock.ts 901 o Télécharger le fichier
/**
 * Leave block of the games hub (AIR GamesMainViewController.checkBlockStatus):
 * after leaving a running match the play button is disabled and shows the
 * time left as m:ss. The server sends the length in seconds
 * (Game2UserBlocked / Game2GameDirectoryStatus); it is kept as a wall-clock
 * deadline so a throttled tab still counts down correctly.
 */
export const snowWarBlockDeadline = (seconds: number, now: number): number =>
    (seconds > 0) ? now + (seconds * 1000) : 0;

export const snowWarBlockSecondsLeft = (deadline: number, now: number): number =>
    (deadline > now) ? Math.ceil((deadline - now) / 1000) : 0;

export const formatSnowWarBlockCountdown = (seconds: number): string =>
{
    const total = Math.max(0, Math.floor(seconds));
    const minutes = Math.floor(total / 60);
    const rest = total % 60;

    return `${ minutes }:${ (rest < 10) ? '0' : '' }${ rest }`;
};
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser