feat(landing): add landing component with animations and services
This commit is contained in:
parent
35bfa3be7f
commit
e6e7d65602
13 changed files with 1805 additions and 3 deletions
104
frontend/src/app/services/game.service.ts
Normal file
104
frontend/src/app/services/game.service.ts
Normal file
|
@ -0,0 +1,104 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
export interface Game {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
imageUrl: string;
|
||||
minBet: number;
|
||||
maxBet: number;
|
||||
rtp: number;
|
||||
lastWin: number;
|
||||
winChance: number;
|
||||
lastWinner: string;
|
||||
trending: boolean;
|
||||
maxWin: number;
|
||||
popularity: number;
|
||||
volatility: 'low' | 'medium' | 'high';
|
||||
features: string[];
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GameService {
|
||||
private readonly INITIAL_GAMES: Game[] = [
|
||||
{
|
||||
id: 'mega-fortune',
|
||||
name: 'Mega Fortune Dreams',
|
||||
description: '🔥 Progressive Jackpot at €1.2M - Must Drop Today!',
|
||||
imageUrl: 'assets/games/mega-fortune.jpg',
|
||||
minBet: 0.2,
|
||||
maxBet: 100,
|
||||
rtp: 96.5,
|
||||
lastWin: 15789,
|
||||
winChance: 99.9,
|
||||
lastWinner: 'VIP Player',
|
||||
trending: true,
|
||||
maxWin: 1000000,
|
||||
popularity: 98,
|
||||
volatility: 'high',
|
||||
features: ['Progressive Jackpot', 'Free Spins', 'Multipliers'],
|
||||
},
|
||||
{
|
||||
id: 'lightning-roulette',
|
||||
name: 'Lightning Roulette',
|
||||
description: '⚡️ 500x Multipliers Active - Hot Streak!',
|
||||
imageUrl: 'assets/games/lightning-roulette.jpg',
|
||||
minBet: 1,
|
||||
maxBet: 500,
|
||||
rtp: 97.1,
|
||||
lastWin: 23456,
|
||||
winChance: 99.7,
|
||||
lastWinner: 'New Player',
|
||||
trending: true,
|
||||
maxWin: 500000,
|
||||
popularity: 95,
|
||||
volatility: 'medium',
|
||||
features: ['Lightning Multipliers', 'Live Dealer', 'Instant Wins'],
|
||||
},
|
||||
];
|
||||
|
||||
private readonly STAT_RANGES = {
|
||||
WIN: {
|
||||
MIN: 10000,
|
||||
MAX: 50000,
|
||||
},
|
||||
WIN_CHANCE: {
|
||||
MIN: 99,
|
||||
MAX: 100,
|
||||
},
|
||||
POPULARITY: {
|
||||
MIN: 80,
|
||||
MAX: 100,
|
||||
},
|
||||
};
|
||||
|
||||
private readonly games = new BehaviorSubject<Game[]>(this.INITIAL_GAMES);
|
||||
readonly games$ = this.games.asObservable();
|
||||
|
||||
updateGameStats(): void {
|
||||
const updatedGames = this.games.value.map((game) => ({
|
||||
...game,
|
||||
...this.generateNewStats(),
|
||||
}));
|
||||
this.games.next(updatedGames);
|
||||
}
|
||||
|
||||
getGameById(id: string): Game | undefined {
|
||||
return this.games.value.find((game) => game.id === id);
|
||||
}
|
||||
|
||||
private generateNewStats(): Partial<Game> {
|
||||
return {
|
||||
lastWin: this.getRandomInRange(this.STAT_RANGES.WIN),
|
||||
winChance: this.getRandomInRange(this.STAT_RANGES.WIN_CHANCE),
|
||||
popularity: this.getRandomInRange(this.STAT_RANGES.POPULARITY),
|
||||
};
|
||||
}
|
||||
|
||||
private getRandomInRange(range: { MIN: number; MAX: number }): number {
|
||||
return Math.floor(Math.random() * (range.MAX - range.MIN)) + range.MIN;
|
||||
}
|
||||
}
|
Reference in a new issue