]]>
') center / cover";
loadingCover.style.display = "";
document.addEventListener('contextmenu', event => event.preventDefault());
function FocusGame() {
window.focus();
canvas.focus();
}
window.addEventListener('pointerdown', FocusGame);
window.addEventListener('touchstart', FocusGame);
let StartUnityInstance;
let myGameInstance;
let ysdk = null; // Yandex SDK pasif
// Varsayılan değerlerle environmentData, cloudSaves, paymentsData ve playerData gibi değişkenlerin tanımlanması
let environmentData = {
language: "en",
domain: "default_domain",
deviceType: "desktop",
isMobile: false,
isDesktop: true,
isTablet: false,
isTV: false,
appID: "default_app_id",
browserLang: navigator.language || "en",
payload: null,
promptCanShow: false,
reviewCanShow: false,
platform: navigator.platform,
browser: (function() {
let userAgent = navigator.userAgent;
if (userAgent.includes("YaBrowser")) return "Yandex";
if (userAgent.includes("OPR") || userAgent.includes("Opera")) return "Opera";
if (userAgent.includes("Firefox")) return "Firefox";
if (userAgent.includes("MSIE") || userAgent.includes("Trident")) return "IE";
if (userAgent.includes("Edge")) return "Edge";
if (userAgent.includes("Chrome")) return "Chrome";
if (userAgent.includes("Safari")) return "Safari";
return "Other";
})()
};
let cloudSaves = 'noData';
let paymentsData = 'none';
let playerData = 'noData'; // Varsayılan playerData tanımı
let player = null;
let payments = null;
let initGame = false;
let nowFullAdOpen = false;
// Eksik olabilecek tüm SDK işlevlerini varsayılan olarak tanımla
function GetPayments() { console.warn("GetPayments is not implemented"); return Promise.resolve("none"); }
function SaveCloud() { console.warn("SaveCloud is not implemented"); }
function LoadCloud() { console.warn("LoadCloud is not implemented"); return Promise.resolve("noData"); }
function InitPlayer() { console.warn("InitPlayer is not implemented"); return Promise.resolve("noData"); }
function FullAdShow() {
try {
console.log("Full-screen ad functionality is disabled.");
// Create a modal for the message
const warningModal = document.createElement('div');
warningModal.id = "warning-modal";
warningModal.style.position = "fixed";
warningModal.style.top = "0";
warningModal.style.left = "0";
warningModal.style.width = "100%";
warningModal.style.height = "100%";
warningModal.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
warningModal.style.color = "white";
warningModal.style.zIndex = "1000";
warningModal.style.display = "flex";
warningModal.style.flexDirection = "column";
warningModal.style.justifyContent = "center";
warningModal.style.alignItems = "center";
warningModal.innerHTML = `
FULL-SCREEN ADS ARE DISABLED
Please refresh the page to continue the game.
`;
// Append the modal to the body
document.body.appendChild(warningModal);
// Refresh the page on button click
document.getElementById("refresh-btn").onclick = function () {
console.log("Button clicked. Refreshing the page...");
location.reload(); // Refresh the page
};
} catch (error) {
console.error("Error during FullAdShow:", error);
}
}
function RewardedShow() {
try {
console.log("Rewarded ad functionality is disabled.");
// Create a modal for the message
const warningModal = document.createElement('div');
warningModal.id = "warning-modal";
warningModal.style.position = "fixed";
warningModal.style.top = "0";
warningModal.style.left = "0";
warningModal.style.width = "100%";
warningModal.style.height = "100%";
warningModal.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
warningModal.style.color = "white";
warningModal.style.zIndex = "1000";
warningModal.style.display = "flex";
warningModal.style.flexDirection = "column";
warningModal.style.justifyContent = "center";
warningModal.style.alignItems = "center";
warningModal.innerHTML = `
REWARD-AD BANNED IN YOUR SCHOOL
Please refresh the page to restart the game.
`;
// Append the modal to the body
document.body.appendChild(warningModal);
// Refresh the page on button click
document.getElementById("refresh-btn").onclick = function () {
location.reload(); // Refresh the page
};
} catch (error) {
console.error("Error during RewardedShow:", error);
}
}
function StickyAdActivity() { console.warn("StickyAdActivity is not implemented"); }
function Review() { console.warn("Review is not implemented"); }
function PromptShow() { console.warn("PromptShow is not implemented"); }
function InitLeaderboards() { console.warn("InitLeaderboards is not implemented"); }
function GetLeaderboardScores() { console.warn("GetLeaderboardScores is not implemented"); }
function SetLeaderboardScores() { console.warn("SetLeaderboardScores is not implemented"); }
function ConsumePurchase() { console.warn("ConsumePurchase is not implemented"); }
function ConsumePurchases() { console.warn("ConsumePurchases is not implemented"); } // Varsayılan tanım eklendi
function InitGame() {
try {
console.log('Init Game Success');
initGame = true;
if (nowFullAdOpen === true && myGameInstance != null) {
myGameInstance.SendMessage('YandexGame', 'OpenFullAd');
}
} catch (error) {
console.error("InitGame sırasında hata:", error);
}
}
// Hata oluştuğunda oyuna devam etmek için tüm hataları global olarak yakalayan yapı
window.addEventListener("unhandledrejection", function(event) {
console.warn("Hata es geçildi:", event.reason);
event.preventDefault();
});