Show live online-players count on the home screen
- OnlineService.getOnlineCount(); mock random-walks a believable number, SignalrService reads GET /api/stats/online (server tracks hub connections) - Home screen badge with pulsing dot, polls every 8s, localized digits Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -737,6 +737,14 @@ export class MockOnlineService implements OnlineService {
|
||||
|
||||
/* --------------------- leaderboard / shop / daily ------------------ */
|
||||
|
||||
private onlineCount = 600 + Math.floor(Math.random() * 900);
|
||||
async getOnlineCount(): Promise<number> {
|
||||
// gentle random walk so the badge feels alive
|
||||
this.onlineCount += Math.round((Math.random() - 0.5) * 40);
|
||||
this.onlineCount = Math.max(120, Math.min(6000, this.onlineCount));
|
||||
return this.onlineCount;
|
||||
}
|
||||
|
||||
async getLeaderboard(): Promise<LeaderboardEntry[]> {
|
||||
const p = await this.getProfile();
|
||||
const others = Array.from({ length: 24 }, () => ({
|
||||
|
||||
Reference in New Issue
Block a user