window.screenOrientation="sensor_landscape"; loadLib("libs/min/laya.core.min.js"); loadLib("libs/min/laya.ui.min.js"); loadLib("libs/min/laya.d3.min.js"); loadLib("libs/min/laya.physics.min.js"); loadLib("libs/min/laya.physics3D.min.js"); window.langManager = { langType: "EN", langs: { EN: { biaotiArr: ["Wow!", "Cool!", "Perfect!", "Excellent!", "Wow!", "Cool!", "Perfect!", "Excellent!"], title_win: "Victory!", title_fail: "Failure!", not_enough_coins: "Not enough coins", }, RU: { biaotiArr: ["ого!","круто!","идеальный!", "Отлично!","ого!","круто!","идеальный!", "Отлично!"], title_win: "победа!", title_fail: "неудача!", not_enough_coins: "Не хватает монет", }, ZH: { biaotiArr: ["哇!","酷!","完美!","优秀!","哇!","酷!","完美!","优秀!"], title_win: "挑战成功", title_fail: "挑战失败", not_enough_coins: "金币不足", } }, imageMap: [], getLangStr(key, number) { let str = this.langs[this.langType][key]; if (!str) return key; number && (str = str.replace("{x}", number)); return str ? str : key; }, replaceStr(text) { return text; }, getLangImage(url) { let res = url; for (let index = 0; index < this.imageMap.length; index++) { let key = this.imageMap[index]; let name = `/${key}.png`; if (url.indexOf(name) > 0) { let langEnd = this.langType == "RU" ? "_ru" : (this.langType == "EN" ? "_en" : ""); let replaceName = `/${key}${langEnd}.png` res = url.replace(name, replaceName); break; } } return res; } } if (window.YaGames) { YaGames.init().then(ysdk => { console.log('Yandex SDK initialized'); window.ysdk = ysdk; var i18n = ysdk.environment.i18n; if (i18n.lang == "ru") { window.langManager.langType = "RU"; } else { window.langManager.langType = "EN"; } window.ysdk.getStorage() .then(storage => { var useAgent = window.navigator.userAgent.toLowerCase(); if (useAgent.indexOf("iphone") > 0) { window.ystorage = storage; } }) loadLib("js/bundle.js"); }).catch(err => { }) } else { loadLib("js/bundle.js"); }