// ================================================================ // CRAZYGAMES SDK INTEGRATION - PROFESSIONAL WRAPPER // ================================================================ const AdSystem = { sdk: null, initialized: false, sdkAvailable: false, isAdPlaying: false, audioWasSuspended: false, lastDeathAdTime: 0, deathAdCooldown: 90000, // Inicialización del SDK async init() { try { console.log('[AdSystem] Inicializando CrazyGames SDK v3...'); // Verificar que el SDK esté disponible if (typeof window.CrazyGames === 'undefined' || !window.CrazyGames.SDK) { console.warn('[AdSystem] SDK no disponible (posible AdBlock)'); this.sdkAvailable = false; this.initialized = true; return false; } // Inicializar el SDK this.sdk = await window.CrazyGames.SDK.init(); this.sdkAvailable = true; this.initialized = true; console.log('[AdSystem] SDK inicializado correctamente'); return true; } catch (error) { console.error('[AdSystem] Error al inicializar SDK:', error); this.sdkAvailable = false; this.initialized = true; return false; } }, // Solicitar anuncio (rewarded o midgame) async requestAd(type = 'midgame') { if (!this.sdkAvailable || !this.sdk) { console.warn(`[AdSystem] No se puede mostrar ${type} ad - SDK no disponible`); return { success: false, error: 'SDK_NOT_AVAILABLE' }; } if (this.isAdPlaying) { console.warn('[AdSystem] Ya hay un anuncio en reproducción'); return { success: false, error: 'AD_ALREADY_PLAYING' }; } try { console.log(`[AdSystem] Solicitando ${type} ad...`); this.isAdPlaying = true; // Gestionar audio antes del anuncio this.handleAudioBeforeAd(); // Solicitar el anuncio según el tipo if (type === 'rewarded') { return new Promise((resolve) => { this.sdk.ad.requestAd('rewarded', { adStarted: () => { console.log('[AdSystem] Rewarded ad iniciado'); this.onAdStarted(); }, adFinished: () => { console.log('[AdSystem] Rewarded ad completado'); this.onAdFinished(); resolve({ success: true, rewarded: true }); }, adError: (error) => { console.error('[AdSystem] Error en rewarded ad:', error); this.onAdError(error); resolve({ success: false, error: error }); } }); }); } else { // Midgame ad return new Promise((resolve) => { this.sdk.ad.requestAd('midgame', { adStarted: () => { console.log('[AdSystem] Midgame ad iniciado'); this.onAdStarted(); }, adFinished: () => { console.log('[AdSystem] Midgame ad completado'); this.onAdFinished(); resolve({ success: true }); }, adError: (error) => { console.error('[AdSystem] Error en midgame ad:', error); this.onAdError(error); resolve({ success: false, error: error }); } }); }); } } catch (error) { console.error(`[AdSystem] Error al solicitar ${type} ad:`, error); this.isAdPlaying = false; this.handleAudioAfterAd(); return { success: false, error: error.toString() }; } }, // Eventos de gameplay (OBLIGATORIO para QA) gameplayStart() { if (!this.sdkAvailable || !this.sdk) return; try { this.sdk.game.gameplayStart(); console.log('[AdSystem] gameplayStart() llamado'); } catch (error) { console.error('[AdSystem] Error en gameplayStart:', error); } }, gameplayStop() { if (!this.sdkAvailable || !this.sdk) return; try { this.sdk.game.gameplayStop(); console.log('[AdSystem] gameplayStop() llamado'); } catch (error) { console.error('[AdSystem] Error en gameplayStop:', error); } }, // Gestión de audio durante anuncios handleAudioBeforeAd() { try { if (typeof AudioSys !== 'undefined' && AudioSys.ctx) { if (AudioSys.ctx.state === 'running') { this.audioWasSuspended = false; AudioSys.ctx.suspend(); console.log('[AdSystem] Audio suspendido para anuncio'); } else { this.audioWasSuspended = true; } } } catch (error) { console.error('[AdSystem] Error al suspender audio:', error); } }, handleAudioAfterAd() { try { if (typeof AudioSys !== 'undefined' && AudioSys.ctx && !this.audioWasSuspended) { AudioSys.ctx.resume(); console.log('[AdSystem] Audio reanudado después de anuncio'); } } catch (error) { console.error('[AdSystem] Error al reanudar audio:', error); } }, // Callbacks de eventos de anuncio onAdStarted() { this.isAdPlaying = true; }, onAdFinished() { this.isAdPlaying = false; this.handleAudioAfterAd(); }, onAdError(error) { this.isAdPlaying = false; this.handleAudioAfterAd(); console.error('[AdSystem] Ad error:', error); } }; // Inicializar SDK cuando cargue la ventana window.addEventListener('load', async function() { console.log('[CrazyGames] Iniciando integración del SDK...'); await AdSystem.init(); });
📱

ROTATE YOUR DEVICE

Game optimized for horizontal mode

CUERPO
⚖️ 0.0kg
¡TAREAS INCOMPLETAS!

ACTIVA EL GENERADOR Y REPARA LOS CIRCUITOS

MANTÉN [N] PARA HACKEAR
👆
REPARACIÓN DE CIRCUITOS

Arrastra para conectar los cables del mismo color

SINCRONIZACIÓN DE SEÑAL

Pulsa ESPACIO o TOCA cuando la línea blanca esté en la zona verde (3 veces)

DEBUG INFO
\n
ELIMINADO

Regresando al menú...

¡ESCAPE!

Has sobrevivido a la zona de cuarentena.

⏱ TIEMPO RESTANTE
05:00
RANKING
TIEMPO AGOTADO
FIN DE LA PARTIDA
# Jugador Puntos Estado
⚙️
💬
⬆️AVANZAR
⬇️VOLVER
🛡️SEGUIRME
🌍EXPLORAR
V31.0 - 10/3/26

⏸ PAUSA

⭐ ARBOL DE HABILIDADES

XP disponible: 0
ARRASTRA LOS BOTONES PARA MOVERLOS
🖥️ Play in full screen for greater immersion?
👉 Press to Play