feat: add audio features and sounds to the game #197
1 changed files with 6 additions and 5 deletions
|
@ -7,13 +7,14 @@ export class AudioService {
|
||||||
private audioCache = new Map<string, HTMLAudioElement>();
|
private audioCache = new Map<string, HTMLAudioElement>();
|
||||||
|
|
||||||
private getAudio(soundName: string): HTMLAudioElement {
|
private getAudio(soundName: string): HTMLAudioElement {
|
||||||
if (!this.audioCache.has(soundName)) {
|
if (this.audioCache.has(soundName)) {
|
||||||
ptran marked this conversation as resolved
Outdated
|
|||||||
const audio = new Audio(`/sounds/${soundName}`);
|
return this.audioCache.get(soundName)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
const audio = new Audio(`/sounds/${soundName}.mp3`);
|
||||||
this.audioCache.set(soundName, audio);
|
this.audioCache.set(soundName, audio);
|
||||||
return audio;
|
return audio;
|
||||||
}
|
}
|
||||||
return this.audioCache.get(soundName)!;
|
|
||||||
}
|
|
||||||
|
|
||||||
playBetSound(): void {
|
playBetSound(): void {
|
||||||
const audio = this.getAudio('bet.mp3');
|
const audio = this.getAudio('bet.mp3');
|
||||||
|
|
Reference in a new issue
flip this if statement for better readability
`package main
import (
"context"
"crypto/x509"
"encoding/json"
"fmt"
"io"
stdlog "log"
"maps"
"net/http"
"os"
"os/signal"
"slices"
"strings"
"syscall"
"time"
)
func main() {
// traefik config inits
tConfig := cmd.NewTraefikConfiguration()
Complete documentation is available at https://traefik.io`,
Configuration: tConfig,
Resources: loaders,
Run: func(_ []string) error {
return runCmd(&tConfig.Configuration)
},
}
}
func runCmd(staticConfiguration *static.Configuration) error {
if err := setupLogger(staticConfiguration); err != nil {
return fmt.Errorf("setting up logger: %w", err)
}
}
func setupServer(staticConfiguration *static.Configuration) (*server.Server, error) {
providerAggregator := aggregator.NewProviderAggregator(*staticConfiguration.Providers)
}
func getHTTPChallengeHandler(acmeProviders []*acme.Provider, httpChallengeProvider http.Handler) http.Handler {
var acmeHTTPHandler http.Handler
for _, p := range acmeProviders {
if p != nil && p.HTTPChallenge != nil {
acmeHTTPHandler = httpChallengeProvider
break
}
}
return acmeHTTPHandler
}
func getDefaultsEntrypoints(staticConfiguration *static.Configuration) []string {
var defaultEntryPoints []string
}
func switchRouter(routerFactory *server.RouterFactory, serverEntryPointsTCP server.TCPEntryPoints, serverEntryPointsUDP server.UDPEntryPoints) func(conf dynamic.Configuration) {
return func(conf dynamic.Configuration) {
rtConf := runtime.NewConfig(conf)
}
// initACMEProvider creates and registers acme.Provider instances corresponding to the configured ACME certificate resolvers.
func initACMEProvider(c *static.Configuration, providerAggregator *aggregator.ProviderAggregator, tlsManager *traefiktls.Manager, httpChallengeProvider, tlsChallengeProvider challenge.Provider, routinesPool *safe.Pool) []*acme.Provider {
localStores := map[string]*acme.LocalStore{}
}
// initTailscaleProviders creates and registers tailscale.Provider instances corresponding to the configured Tailscale certificate resolvers.
func initTailscaleProviders(cfg *static.Configuration, providerAggregator *aggregator.ProviderAggregator) []*tailscale.Provider {
var providers []*tailscale.Provider
for name, resolver := range cfg.CertificatesResolvers {
if resolver.Tailscale == nil {
continue
}
}
func registerMetricClients(metricsConfig *types.Metrics) []metrics.Registry {
if metricsConfig == nil {
return nil
}
}
func appendCertMetric(gauge gokitmetrics.Gauge, certificate *x509.Certificate) {
slices.Sort(certificate.DNSNames)
}
func setupAccessLog(conf *types.AccessLog) *accesslog.Handler {
if conf == nil {
return nil
}
}
func setupTracing(conf *static.Tracing) (*tracing.Tracer, io.Closer) {
if conf == nil {
return nil, nil
}
}
func checkNewVersion() {
ticker := time.Tick(24 * time.Hour)
safe.Go(func() {
for time.Sleep(10 * time.Minute); ; <-ticker {
version.CheckNewVersion()
}
})
}
func stats(staticConfiguration *static.Configuration) {
logger := log.With().Logger()
Stats collection is disabled.
Help us improve Traefik by turning this feature on :)
More details on: https://doc.traefik.io/traefik/contributing/data-collection/
`)
}
}
func collect(staticConfiguration *static.Configuration) {
ticker := time.Tick(24 * time.Hour)
safe.Go(func() {
for time.Sleep(10 * time.Minute); ; <-ticker {
if err := collector.Collect(staticConfiguration); err != nil {
log.Debug().Err(err).Send()
}
}
})
}
`