(function() {
Object.assign || (Object.assign = function(a) {
for (var b = 1; b < arguments.length; b++)
for (var c in arguments[b])
a[c] = arguments[b][c];
return a
}
);
Object.values || (Object.values = function(a) {
return Object.keys(a).map(function(b) {
return a[b]
})
}
);
String.prototype.endsWith || (String.prototype.endsWith = function(a, b) {
var c = this.toString();
if ("number" !== typeof b || !isFinite(b) || Math.floor(b) !== b || b > c.length)
b = c.length;
b -= a.length;
a = c.lastIndexOf(a, b);
return -1 !== a && a === b
}
);
void 0 === Array.prototype.at && [Array, String].forEach(function(a) {
Object.defineProperty(a.prototype, "at", {
writable: !0,
enumerable: !1,
configurable: !0,
value: function(b) {
b = (0 > b ? Math.ceil(b) : Math.floor(b)) || 0;
0 > b && (b += this.length);
if (!(0 > b || b >= this.length))
return this[b]
}
})
});
void 0 === Array.prototype.find && Object.defineProperty(Array.prototype, "find", {
value: function(a, b) {
if (null == this)
throw TypeError('"this" is null or not defined');
var c = Object(this)
, d = c.length >>> 0;
if ("function" !== typeof a)
throw TypeError("predicate must be a function");
for (var e = 0; e < d; ) {
var f = c[e];
if (a.call(b, f, e, c))
return f;
e++
}
},
configurable: !0,
writable: !0
});
void 0 === Array.prototype.flat && Object.defineProperty(Array.prototype, "flat", {
value: function flat(a) {
var c = isNaN(a) ? 1 : Number(a);
return c ? Array.prototype.reduce.call(this, function(d, e) {
Array.isArray(e) ? d.push.apply(d, flat.call(e, c - 1)) : d.push(e);
return d
}, []) : Array.prototype.slice.call(this)
},
configurable: !0,
writable: !0
});
String.prototype.startsWith || Object.defineProperty(String.prototype, "startsWith", {
enumerable: !1,
configurable: !1,
writable: !1,
value: function(a, b) {
b = b || 0;
return this.indexOf(a, b) === b
}
});
String.prototype.includes || (String.prototype.includes = function(a, b) {
"number" !== typeof b && (b = 0);
return b + a.length > this.length ? !1 : -1 !== this.indexOf(a, b)
}
);
String.prototype.replaceAll || (String.prototype.replaceAll = function(a, b) {
"string" === typeof a && (a = a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
return this.replace(new RegExp(a,"g"), b)
}
);
Array.prototype.includes || Object.defineProperty(Array.prototype, "includes", {
value: function(a, b) {
if (null == this)
throw new TypeError('"this" is null or not defined');
var c = Object(this)
, d = c.length >>> 0;
if (0 === d)
return !1;
b |= 0;
for (b = Math.max(0 <= b ? b : d - Math.abs(b), 0); b < d; ) {
var e = c[b]
, f = a;
if (e === f || "number" === typeof e && "number" === typeof f && isNaN(e) && isNaN(f))
return !0;
b++
}
return !1
}
});
"function" != typeof Object.assign && Object.defineProperty(Object, "assign", {
value: function(a, b) {
if (null == a)
throw new TypeError("Cannot convert undefined or null to object");
for (var c = Object(a), d = 1; d < arguments.length; d++) {
var e = arguments[d];
if (null != e)
for (var f in e)
Object.prototype.hasOwnProperty.call(e, f) && (c[f] = e[f])
}
return c
},
writable: !0,
configurable: !0
});
Array.prototype.flat || (Array.prototype.flat = function(a) {
void 0 === a && (a = 1);
var b = function(c, d) {
return 1 > d ? c.slice() : c.reduce(function(e, f) {
return e.concat(Array.isArray(f) ? b(f, d - 1) : f)
}, [])
};
return b(this, a)
}
);
"undefined" === typeof URLSearchParams && (URLSearchParams = function(a) {
this.values = {};
this.size = 0;
if (a) {
"?" === a.charAt(0) && (a = a.substr(1));
a = a.split("&");
for (var b = 0; b < a.length; b++) {
var c = a[b].split("=")
, d = c[0];
c = decodeURIComponent(c[1].replace(/\+/g, " "));
this.set(d, c)
}
}
}
,
URLSearchParams.prototype.get = function(a) {
return this.values[a]
}
,
URLSearchParams.prototype.set = function(a, b) {
this.values[a] = b;
this.size = Object.keys(this.values).length
}
,
URLSearchParams.prototype.toString = function() {
return Object.keys(this.values).map(function(a) {
return a + "=" + this.values[a]
}, this).join("&")
}
);
var cleverapps = {
config: document.ccConfig || cc.game.config
};
cleverapps.CODE_SUCCEED = 0;
cleverapps.CODE_FAILED = 1;
cleverapps.CODE_CANCELLED = 2;
cleverapps.CODE_PENDING = 3;
cleverapps.CODE_CANCELLED_FACEBOOK_DIALOG = 4201;
cleverapps.normalize = function(a, b) {
b = b || 1;
for (var c = 0, d = 0; d < a.length; d++)
c += a[d];
return a.map(function(e) {
return e / c * b
})
}
;
cleverapps.getRequestParameters = function(a, b) {
var c = {};
if (a = a || window.location.search) {
a = a.substr(1);
a = a.split("&");
for (var d = 0; d < a.length; d++) {
var e = a[d].split("=")
, f = e[0];
e = e[1] || "";
if (!b)
try {
e = decodeURIComponent(e.replace(/\+/g, " "))
} catch (g) {
console.error("getRequestParameters decodeURIComponent - " + e)
}
c[f] = e
}
}
return c
}
;
cleverapps.setRequestParameters = function(a) {
var b = cleverapps.getRequestParameters();
b = Object.assign(b, a);
location.search = Object.keys(b).map(function(c) {
return c + "=" + b[c]
}).join("&")
}
;
cleverapps.isRumble = function() {
var a = cleverapps.meta.knockoutGame;
return a && a.isRumble()
}
;
cleverapps.isKnockoutGame = function() {
return "knockout" === cleverapps.config.regime
}
;
cleverapps.humanReadableNumber = function(a, b) {
var c = a;
if ("object" === typeof a) {
a = a.floatLevel || 0;
if ("merge" === cleverapps.config.type)
return Math.ceil(a) + 1;
a = cleverapps.isKnockoutGame() ? a / 6 : a / 2;
c = Math.floor(a);
b = Math.round(Level.LEVELS_PER_EPISODE * (a - c))
}
return (parseInt(c) || 0) * Level.LEVELS_PER_EPISODE + b + 1
}
;
cleverapps.arrayFill = function(a, b) {
for (var c = [], d = 0; d < a; d++)
c.push(b);
return c
}
;
cleverapps.formatAmount = function(a) {
if (1E3 > a)
return a;
var b = Math.floor(a / 1E3);
a -= 1E3 * b;
10 > a ? a = "00" + a : 100 > a && (a = "0" + a);
return b + " " + a
}
;
cleverapps.cmp = function(a, b) {
a = JSON.stringify(a);
b = JSON.stringify(b);
return a === b
}
;
cleverapps.loadSdk = function(a, b) {
b.onSuccessOnce = b.onSuccessOnce || cleverapps.once(b.onSuccess);
b.onFailureOnce = b.onFailureOnce || cleverapps.once(b.onFailure);
var c = b.onSuccessOnce
, d = b.onFailureOnce;
void 0 === b.attempt && (b.attempt = 3);
var e = document.createElement("script");
!1 !== b.crossorigin && e.setAttribute("crossorigin", "anonymous");
e.setAttribute("type", "text/javascript");
e.setAttribute("src", a);
b.attrs && Object.keys(b.attrs).forEach(function(h) {
e.setAttribute(h, b.attrs[h])
});
var f = function() {
clearTimeout(g);
e.onload = void 0;
e.onerror = void 0;
1 < b.attempt ? (document.body.contains(e) && document.body.removeChild(e),
b.attempt--,
cleverapps.loadSdk(a, b)) : d()
};
e.onload = function() {
clearTimeout(g);
c()
}
;
e.onerror = f;
var g = setTimeout(f, 3E4);
document.body.appendChild(e)
}
;
cleverapps.getFrameUserId = function(a, b) {
b = b || {};
var c = b.callback || function() {}
, d = b.key || cleverapps.config.name;
b = b.timeout || 6E4;
var e = document.createElement("iframe");
e.src = a + "cleverapps/res/getitem.html?key=" + d;
e.style = "display: none;";
document.body.appendChild(e);
var f = cleverapps.waitNoMore(b, function(g) {
console.log("Message received from the child: " + (g && g.data));
window.removeEventListener("message", f);
document.body.removeChild(e);
if (g && g.data)
try {
c(JSON.parse(g && g.data).id)
} catch (h) {
console.log("parse userid error - " + g && g.data, h),
c()
}
else
c()
});
window.addEventListener("message", f)
}
;
cleverapps.setUrlHash = function(a) {
var b = cleverapps.getRequestParameters(window.location.hash), c;
for (c in a) {
var d = a[c];
void 0 === d ? delete b[c] : b[c] = d
}
window.location.hash = Object.keys(b).map(function(e) {
return e + "=" + b[e]
}).join("&")
}
;
cleverapps.INTERVALS = {
second: 1,
minute: 60,
hour: 3600,
day: 86400,
week: 604800,
month: 2592E3
};
cleverapps.padZeroes = function(a, b) {
for (a += ""; a.length < b; )
a = "0" + a;
return a
}
;
cleverapps.compactTime = function(a, b) {
return a ? Math.max(Math.round((a - cleverapps.ZERO_DATE) / (b && b.seconds ? 1E3 : 6E4)), 0) : a
}
;
cleverapps.expandTime = function(a, b) {
return !a || a > cleverapps.ZERO_DATE ? a : a * (b && b.seconds ? 1E3 : 6E4) + cleverapps.ZERO_DATE
}
;
cleverapps.parseInterval = function(a) {
var b = 1E3 * parseInt(a), c;
for (c in cleverapps.INTERVALS)
if (-1 !== a.indexOf(c))
return b * cleverapps.INTERVALS[c];
return b
}
;
cleverapps.once = function(a) {
return function() {
if (a) {
var b = a;
a = void 0;
return b.apply(this, arguments)
}
}
}
;
cleverapps.shuffle = function(a) {
for (var b = 0; b < a.length; b++) {
var c = cleverapps.Random.random(a.length)
, d = a[b];
a[b] = a[c];
a[c] = d
}
return a
}
;
cleverapps.extractDateFromDateTime = function(a) {
return (new Date(a)).setHours(0, 0, 0, 0)
}
;
cleverapps.extractNumber = function(a) {
if (a) {
for (var b = "", c = 0; c < a.length; c++) {
var d = a.charAt(c);
if (d.match(/\d+/g))
b += d;
else if ("," === d || "." === d)
b += "."
}
return -1 !== b.indexOf(".") ? parseFloat(b) : parseInt(b)
}
}
;
cleverapps.override = function(a, b) {
for (var c in b) {
var d = a[c]
, e = b[c];
"undefined" !== typeof cc && d instanceof cc.Color ? a[c] = e : Array.isArray(d) && Array.isArray(e) ? a[c] = e : "object" === typeof d && "object" === typeof e ? cleverapps.override(d, e) : a[c] = e
}
return a
}
;
cleverapps.increaseStylesByKoef = function(a, b) {
for (var c in a) {
var d = a[c];
"number" === typeof d ? !Array.isArray(a) && cleverapps.UI.needUpdateSizes(a, c, d) && (a[c] *= b,
a[c] = Math.round(a[c])) : "object" === typeof d && cleverapps.UI.needUpdateSizes(a, c, d) && cleverapps.increaseStylesByKoef(d, b)
}
}
;
cleverapps.overrideStyles = function(a, b, c) {
void 0 !== a && void 0 !== b || console.log(a, b);
c && (a = cleverapps.clone(a, !0));
for (var d in b) {
c = a[d];
var e = b[d];
cleverapps.oneOf(c, cc.Color, VirtualResource) || c && c.fnt || c && c.tmplt ? a[d] = e : Array.isArray(e) ? a[d] = e : "object" === typeof c && "object" === typeof e ? cleverapps.overrideStyles(c, e) : a[d] = e
}
return a
}
;
cleverapps.overrideColors = function(a, b) {
var c = function(g) {
return g instanceof cc.Color || connector.info.isNative && g && void 0 !== g.r && void 0 !== g.g && void 0 !== g.b && void 0 !== g.a
}, d;
for (d in b) {
var e = a[d]
, f = b[d];
void 0 === e ? a[d] = f : c(e) && c(f) ? (e.r = f.r,
e.g = f.g,
e.b = f.b,
e.a = f.a) : "object" === typeof e && "object" === typeof f ? cleverapps.overrideColors(e, f) : a[d] = f
}
return a
}
;
cleverapps.overrideFonts = function(a, b) {
for (var c in b) {
var d = a[c]
, e = b[c];
if (void 0 === d)
a[c] = e;
else {
if (cleverapps.config.debugMode)
var f = JSON.stringify(d);
e.size && (d.size = e.size);
e.color && (d.color = e.color);
e.name && (d.name = e.name);
e.lineHeight && (d.lineHeight = e.lineHeight);
d.stroke = e.stroke;
d.shadow = e.shadow;
if (cleverapps.config.debugMode && (d = JSON.stringify(d),
f === d))
throw console.log("WAS BECOME override " + c),
console.log(f, d),
"Unnecessary overrideFonts: " + c;
}
a[c].fnt = !0
}
return a
}
;
cleverapps.overrideTemplates = function(a, b) {
for (var c in b) {
var d = a[c]
, e = b[c];
void 0 === e ? delete a[c] : void 0 === d ? a[c] = e : Object.assign(d, e);
a[c] && (a[c].tmplt = !0)
}
return a
}
;
cleverapps.clone = function(a, b) {
if (null === a)
return null;
if ("object" !== typeof a)
return a;
if ("undefined" !== typeof cc && a instanceof cc.Color)
return cc.color(a);
if ("undefined" !== typeof cc && cleverapps.oneOf(a, Bundle, VirtualResource))
return a;
if (Array.isArray(a)) {
var c = [];
for (var d = 0; d < a.length; d++)
b ? c.push(cleverapps.clone(a[d], !0)) : c.push(a[d]);
return c
}
cleverapps.config.debugMode && Object.getPrototypeOf(a) && Object.getPrototypeOf(a) !== Object.prototype && cleverapps.throwAsync("Clone only simple objects");
c = {};
for (d in a)
if (a[d] && a[d].fnt)
c[d] = a[d];
else if (b) {
if (cleverapps.config.debugMode && "undefined" !== typeof cc && a[d]instanceof cc.Node)
throw "clone node object with name - " + d;
c[d] = cleverapps.clone(a[d], !0)
} else
c[d] = a[d];
return c
}
;
cleverapps.accumulate = function(a, b) {
var c = void 0, d, e;
return function() {
d = this;
e = arguments;
void 0 === c && (c = setTimeout(function() {
clearTimeout(c);
c = void 0;
var f = d
, g = e;
e = d = void 0;
b.apply(f, g)
}, a))
}
}
;
cleverapps.extendFunc = function(a, b) {
return function() {
var c = this._super;
this._super = a;
var d = b.apply(this, arguments);
this._super = c;
return d
}
}
;
cleverapps.throttle = function(a, b) {
var c;
return function() {
c || (c = setTimeout(function() {
c = void 0
}, a),
b.apply(this, arguments))
}
}
;
cleverapps.postpone = function(a, b) {
var c, d, e;
return function() {
c = this;
d = arguments;
clearTimeout(e);
e = setTimeout(function() {
b.apply(c, d)
}, a)
}
}
;
cleverapps.timeredThrottle = function(a, b) {
var c, d, e, f = function() {
if (!e && d) {
e = setTimeout(function() {
e = void 0;
f()
}, a);
var g = c
, h = d;
d = c = void 0;
b.apply(g, h)
}
};
return function() {
c = this;
d = arguments;
f()
}
}
;
cleverapps.oneOf = function(a, b) {
for (var c = Array.isArray(b) ? b : Array.prototype.slice.call(arguments, 1), d = 0; d < c.length; d++)
if (a instanceof c[d])
return !0;
return !1
}
;
cleverapps.createSet = function(a) {
var b = {};
a.forEach(function(c) {
b[c] = !0
});
return b
}
;
cleverapps.contains = function(a, b, c) {
c = c || function(d) {
return d
}
;
a = cleverapps.toArray(a || []).map(c);
b = cleverapps.toArray(b || []).map(c);
return b.filter(function(d) {
return -1 !== a.indexOf(d)
}).length === b.length
}
;
cleverapps.substract = function(a, b, c) {
c = c || function(e) {
return e
}
;
a = a || [];
b = b || [];
var d = {};
b.forEach(function(e) {
d[c(e)] = !0
});
return a.filter(function(e) {
return void 0 === d[c(e)]
})
}
;
cleverapps.intersect = function(a, b, c) {
c = c || function(e) {
return e
}
;
a = cleverapps.toArray(a || []);
b = cleverapps.toArray(b || []).map(c);
var d = {};
b.forEach(function(e) {
d[e] = !0
});
return a.filter(function(e) {
return void 0 !== d[c(e)]
})
}
;
cleverapps.unique = function(a, b) {
if ("undefined" !== typeof Set && "function" === typeof Array.from && !b)
return Array.from(new Set(a));
var c = {}
, d = [];
a.forEach(function(e) {
var f = b ? b(e) : e;
!0 !== c[f] && (d.push(e),
c[f] = !0)
});
return d
}
;
cleverapps.callFunc = function(a) {
a && a()
}
;
cleverapps.intervalToString = function(a, b) {
void 0 === b && (b = !0);
a = Math.ceil(a / 1E3);
var c = a % 60;
a = Math.floor(a / 60);
var d = a % 60;
a = Math.floor(a / 60);
10 > c && (c = "0" + c);
10 > d && (d = "0" + d);
if (24 < a || 24 === a && (0 < d || 0 < c))
return Messages.get("dayTimeString", {
day: Math.floor(a / 24),
hr: a % 24
});
if (!b && 24 >= a && 0 < a)
return Messages.get("hoursMinutesString", {
hr: a,
min: d
});
10 > a && (a = "0" + a);
return (b ? a + ":" : "") + d + ":" + c
}
;
cleverapps.isLevels = function() {
return !([Meta.NONE].includes(cleverapps.meta.getType()) || ["klondike"].includes(cleverapps.config.type))
}
;
cleverapps.isStaging = function() {
return location.host ? !connector.info.isNative && cleverapps.config.debugMode && (location.host.includes("labsystech.ru") || location.host.includes("-staging.")) : !1
}
;
cleverapps.isLocalhost = function() {
return location.host ? !connector.info.isNative && ("localhost" === location.host || "127.0.0.1" === location.host || 0 === location.host.indexOf("192.168.")) : !1
}
;
cleverapps.isIFrame = function() {
return window.top !== window.self
}
;
cleverapps.checkStatus = function(a, b) {
Array.isArray(b) || (b = [b]);
return Array.isArray(a) ? 0 < a.filter(function(c) {
return cleverapps.checkStatus(c, b)
}).length : -1 !== b.indexOf(a) || a && a.errorMessage && a.errorMessage.status && -1 !== b.indexOf(a.errorMessage.status)
}
;
cleverapps.toArray = function(a) {
return Array.isArray(a) || void 0 === a || null === a ? a : [a]
}
;
cleverapps.wait = function(a, b) {
if (0 === a)
b();
else {
var c = 0;
return function() {
c++;
c === a && b()
}
}
}
;
cleverapps.waitNoMore = function(a, b) {
var c = setTimeout(function() {
console.log("waitNoMore timeout: " + a);
c = void 0;
b()
}, a);
return function() {
void 0 !== c && (clearTimeout(c),
c = void 0,
b.apply(this, arguments))
}
}
;
cleverapps.throwAsync = function(a, b) {
a = "object" === typeof a && a.group ? "REPORT: " + a.group.toUpperCase() + " " + a.message : a + " " + JSON.stringify((b || Error()).stack);
a = decodeURIComponent(a);
if (connector.platform.oneOf(connector.WECHAT))
window.onerror(a);
else
setTimeout(function() {
throw a;
}, 0)
}
;
cleverapps.isNumber = function(a) {
return "string" === typeof a && a && /^[0-9]+$/.test(a) || "number" === typeof a && !isNaN(a)
}
;
cleverapps.castType = function(a) {
return "string" === typeof a && cleverapps.isNumber(a) ? parseInt(a) : a
}
;
cleverapps.rangeArray = function(a, b) {
for (var c = []; a <= b; a++)
c.push(a);
return c
}
;
cleverapps.splitToChunks = function(a, b) {
b = Math.ceil(a.length / b);
for (var c = []; 0 < a.length; )
c.push(a.splice(0, b));
return c
}
;
cleverapps.splitToBatches = function(a, b) {
for (var c = []; 0 < a.length; )
c.push(a.splice(0, b));
return c
}
;
cleverapps.sign = function(a) {
return 0 > a ? -1 : 0 < a ? 1 : 0
}
;
cleverapps.clamp = function(a, b, c) {
return Math.min(Math.max(b, a), c)
}
;
cleverapps.splitHalfByWord = function(a) {
for (var b = Math.floor(a.length / 2), c = -1, d = 0; d <= b && -1 === c; d++)
" " === a.charAt(b - d) ? c = b - d : " " === a.charAt(b + d) && (c = b + d);
return -1 === c ? [a] : [a.substr(0, c), a.substr(c + 1)]
}
;
var OverridesContainer = function() {
this.overrides = []
};
OverridesContainer.prototype.override = function(a, b, c) {
if (a) {
var d = a[b];
a[b] = c;
this.overrides.push({
target: a,
key: b,
value: c,
oldValue: d
})
}
}
;
OverridesContainer.prototype.unoverride = function() {
var a = this.overrides;
this.overrides = [];
a.forEach(function(b) {
b.target[b.key] = b.oldValue
})
}
;
cleverapps.colorToHex = function(a) {
return (a.r << 16) + (a.g << 8) + (a.b | 0)
}
;
cleverapps.hashCode = function(a) {
if (void 0 === a || null === a || "number" === typeof a && isNaN(a))
return 0;
a += "";
for (var b = 0, c = 0; c < a.length; c++)
b = (b << 5) - b + a.charCodeAt(c);
return b
}
;
cleverapps.reverseObject = function(a) {
var b = {}, c;
for (c in a) {
var d = a[c];
if (void 0 !== b[d])
throw "Not unique key - " + c;
b[d] = c
}
return b
}
;
cleverapps.validateEmail = function(a) {
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)
}
;
cleverapps.fromBit = function(a) {
if (!a)
return [];
a = cleverapps.toArray(a);
var b = [], c;
a.forEach(function(d, e) {
for (c = cleverapps.SYNCED_BITS * e; d; )
d % 2 && b.push(c),
d = Math.floor(d / 2),
c++
});
return b
}
;
cleverapps.toBit = function(a, b) {
b = b || cleverapps.SYNCED_BITS;
var c = Math.ceil(b / cleverapps.SYNCED_BITS), d = cleverapps.arrayFill(c, 0), e, f = 0, g;
a.forEach(function(h) {
h >= b ? cleverapps.throwAsync(h + " is bigger then " + b) : (g = h % cleverapps.SYNCED_BITS,
e = (h - g) / cleverapps.SYNCED_BITS,
d[e] += Math.pow(2, g),
f = Math.max(e, f))
});
return 1 === c || 0 === f ? d[0] : d.slice(0, f + 1)
}
;
cleverapps.listToBit = function(a) {
var b = {}, c;
for (c in a) {
var d = cleverapps.toBit(Object.keys(a[c]));
0 !== d && (b[c] = d)
}
return b
}
;
cleverapps.listFromBit = function(a) {
var b = {}, c;
for (c in a)
b[c] = "object" === typeof a[c] ? a[c] : cleverapps.createSet(cleverapps.fromBit(a[c]));
return b
}
;
cleverapps.fakePromise = function() {
var a = function() {
return a
};
a.then = function() {
return a
}
;
a.catch = function() {
return a
}
;
return a
}
;
cleverapps.getCanvas = function() {
return document.getElementById("GameCanvas")
}
;
cleverapps.copyToClipboard = function(a, b) {
b = b || function() {
cleverapps.notification.create("Copied to clipboard")
}
;
var c = function() {
setTimeout(function() {
var d = document.createElement("textArea");
d.value = a;
d.style.hidden = !0;
document.body.appendChild(d);
try {
d.select(),
document.execCommand("copy"),
b()
} catch (e) {
console.log("Couldn't copy text to clipboard:", a)
}
document.body.removeChild(d)
}, 0)
};
try {
connector.platform.oneOf(connector.WECHAT) ? wx.setClipboardData({
data: a,
success: function() {
b()
},
fail: function(d) {
console.log("wx.setClipboardData fail", d)
}
}) : window.navigator.clipboard.writeText(a).then(b).catch(c)
} catch (d) {
c()
}
}
;
cleverapps.isNodeOrElement = function(a) {
return ("object" === typeof Node ? a instanceof Node : a && "object" === typeof a && "number" === typeof a.nodeType && "string" === typeof a.nodeName) || ("object" === typeof HTMLElement ? a instanceof HTMLElement : a && "object" === typeof a && null !== a && 1 === a.nodeType && "string" === typeof a.nodeName)
}
;
cleverapps.whenGameActiveListener = function(a) {
return function() {
var b = this
, c = arguments;
cleverapps.whenGameActive(function() {
a.apply(b, c)
})
}
}
;
cleverapps.whenGameActive = function(a) {
cc.game.isPaused() ? cleverapps.timeouts.setTimeout(a, 0) : a()
}
;
cleverapps.loadBase64Image = function(a, b) {
cleverapps.focusManager.display({
stack: !0,
focus: "LoadBase64Image",
action: function(c) {
var d = new WaitWindow;
cc.loader.loadImg(a, function(e, f) {
d.close();
c();
!e && f ? (e = document.createElement("canvas"),
e.height = f.naturalHeight,
e.width = f.naturalWidth,
e.getContext("2d").drawImage(f, 0, 0),
b(e.toDataURL("image/jpg"))) : (console.log("Error loading base64 image: ", a, e),
b())
})
}
})
}
;
cleverapps.ZERO_DATE = (new Date("2020-01-01")).getTime();
cleverapps.SYNCED_BITS = 52;
cleverapps.EMPTY_FUNCTION = function() {}
;
"undefined" !== typeof cc && cleverapps.config.debugMode && void 0 !== cleverapps.getRequestParameters(window.location.hash).dropDebugMode && (cleverapps.config.debugMode = !1);
"undefined" === typeof cc && (module.exports = cleverapps);
cleverapps.EventEmitter = function() {
this.bindings = {}
}
;
cleverapps.EventEmitter.prototype.once = function(a, b, c) {
var d = this.on(a, function() {
d.clear();
b.apply(this, arguments)
}
.bind(this), c)
}
;
cleverapps.EventEmitter.prototype.on = function(a, b, c) {
this.bindings[a] || (this.bindings[a] = []);
this.bindings[a].push(b);
var d = {
clear: function() {
if (this.bindings[a]) {
var e = this.bindings[a].indexOf(b);
0 <= e && this.bindings[a].splice(e, 1)
}
}
.bind(this)
};
addCleaner(c, d.clear);
return d
}
;
cleverapps.EventEmitter.prototype.off = function(a) {
this.bindings[a] = void 0
}
;
cleverapps.EventEmitter.prototype.purge = function() {
this.bindings = {}
}
;
cleverapps.EventEmitter.prototype.trigger = function() {
for (var a = [], b = 0; b < arguments.length; b++)
a.push(arguments[b]);
b = a.shift();
this.bindings[b] && this.bindings[b].slice().forEach(function(c) {
c.apply(this, a)
})
}
;
var addCleaner = function(a, b) {
"object" === typeof a && (a._cleaners || (a._cleaners = []),
a._cleaners.push(b))
}
, runCleaners = function(a) {
a._cleaners && (a._cleaners.forEach(cleverapps.callFunc),
delete a._cleaners)
};
cleverapps.EventsQueue = function(a) {
this.data = [];
this.interval = cleverapps.parseInterval(a)
}
;
cleverapps.EventsQueue.prototype.add = function(a) {
this.data.push(a);
this.data.sort();
this.shrink()
}
;
cleverapps.EventsQueue.prototype.first = function() {
this.shrink();
if (0 < this.data.length)
return this.data[0]
}
;
cleverapps.EventsQueue.prototype.shrink = function() {
for (; 0 < this.data.length && this.data[0] + this.interval <= Date.now(); )
this.data.shift()
}
;
cleverapps.EventsQueue.prototype.getShrinkLeftTime = function() {
if (0 < this.data.length)
return this.data[0] + this.interval - Date.now()
}
;
cleverapps.EventsQueue.prototype.size = function() {
this.shrink();
return this.data.length
}
;
cleverapps.Cache = function(a) {
this.capacity = a || 100;
this.data = {};
this.queue = []
}
;
cleverapps.Cache.prototype.set = function(a, b) {
if (!this.data[a]) {
var c = this.queue.indexOf(a);
-1 !== c && this.queue.splice(c, 1)
}
this.data[a] = b;
this.queue.push(a);
this.queue.length > this.capacity && (a = this.queue.shift(),
delete this.data[a])
}
;
cleverapps.Cache.prototype.get = function(a) {
return this.data[a]
}
;
var WebViewConsole = {
init: function() {
console.log = WebViewConsole.createMethod("ConsolePlugin.log");
console.warn = WebViewConsole.createMethod("ConsolePlugin.warn");
console.debug = WebViewConsole.createMethod("ConsolePlugin.debug");
console.info = WebViewConsole.createMethod("ConsolePlugin.info");
console.error = WebViewConsole.createMethod("ConsolePlugin.error")
},
createMethod: function(a) {
return function() {
for (var b = 0; b < arguments.length; b++)
if (cleverapps.isNodeOrElement(arguments[b]))
return;
connector.platform.callNative(a, {
message: arguments[0],
params: Array.from(arguments).slice(1)
})
}
}
};
var ResourceProcessor = {
addStaticUrl: function() {
var a = function(n) {
return "string" === typeof n && -1 !== [".plist", ".atlas"].indexOf(cc.path.extname(n))
}, b = function(n, p, q) {
if ("string" === typeof p && "@" === p.charAt(0))
return p;
if ("string" === typeof p && -1 === p.indexOf(q)) {
var r = bundles[n].originalPaths;
r && r[p] && (r[q + p] = r[p]);
return q + p
}
if ("font" === p.type)
return p.srcs = p.srcs.map(function(w) {
return b(n, w, q)
}),
p;
if ("object" === typeof p) {
r = {};
for (var u in p)
r[u] = b(n, p[u], q);
return r
}
return p
}, c = Object.keys(bundles), d;
for (d in c) {
var e = c[d]
, f = bundles[e]
, g = cleverapps.config.staticUrl
, h = cleverapps.config.externalStaticUrl || "";
if (g || h)
for (var k in f.urls) {
var m = f.urls[k]
, l = f.meta && f.meta.external && "string" === typeof m && -1 !== [".png", ".jpg"].indexOf(cc.path.extname(m)) && h || g;
l && (f.urls[k] = b(e, m, l))
}
g && Object.keys(f.jsons).forEach(function(n) {
a(f.jsons[n]) && (f.jsons[n] = b(e, f.jsons[n], g))
});
Object.keys(f.urls).forEach(function(n) {
a(f.urls[n]) && (f.jsons[n] = f.urls[n])
})
}
},
calcAlwaysNeed: function() {
var a = ["main"];
cleverapps.config.debugMode && a.push("dev_resources");
return a
},
calcProbablyNeed: function() {
if ("playable" === connector.info.source)
return [];
var a = ResourceProcessor.calcAlwaysNeed();
cleverapps.settings && a.push("language_" + cleverapps.settings.language);
var b = cleverapps.Plot.onStartup(void 0, !0)
, c = [];
"object" === typeof b && (c = b.options,
b = b.scene);
b = new b(c[0],c[1],c[2],c[3],c[4]);
a = a.concat(b.listBundles(), b.listBaseBundles());
a = cleverapps.unique(a);
return a = a.filter(function(d) {
return void 0 !== bundles[d]
})
}
};
cleverapps.products = {
unlimitedLives: {
title: {
en: "Unlimited lives",
fr: "Vies illimit\u00e9es",
ru: "\u0411\u0435\u0437\u043b\u0438\u043c\u0438\u0442\u043d\u044b\u0435 \u0436\u0438\u0437\u043d\u0438",
de: "Unbegrenzte Leben",
es: "Vidas ilimitadas",
pt: "Vidas ilimitadas",
it: "Vite illimitate",
nl: "Oneindige levens",
ar: "\u062d\u064a\u0627\u0629 \u063a\u064a\u0631 \u0645\u062d\u062f\u0648\u062f\u0629",
ja: "\u7121\u5236\u9650\u306e\u547d",
ko: "\ubb34\uc81c\ud55c \uc0dd\uba85",
tr: "S\u0131n\u0131rs\u0131z ya\u015famlar",
zh: "3\u5929\u65e0\u9650\u7545\u6e38",
pl: "Niesko\u0144czone \u017cycia",
lv: "Neierobe\u017eotas dz\u012bves"
},
description: {
en: "Unlimited Lives for 3 days!",
fr: "Des vies illimit\u00e9es pour 3 jours!",
ru: "\u0411\u0435\u0437\u043b\u0438\u043c\u0438\u0442\u043d\u044b\u0435 \u0436\u0438\u0437\u043d\u0438 \u043d\u0430 3 \u0434\u043d\u044f!",
de: "Unbegrenzte Leben f\u00fcr 3 Tage!",
es: "\u00a1Vidas ilimitadas por 3 d\u00edas!",
pt: "Vidas ilimitadas por 3 dias!",
it: "Vite illimitate per 3 giorni!",
nl: "Onbeperkt leven voor 3 dagen!",
ar: "\u062d\u064a\u0627\u0629 \u063a\u064a\u0631 \u0645\u062d\u062f\u0648\u062f\u0629 \u0644\u0645\u062f\u0629 3 \u0623\u064a\u0627\u0645!",
ja: "3\u65e5\u9593\u7121\u9650\u306e\u30e9\u30a4\u30d5!",
ko: "\ubb34\uc81c\ud55c 3 \uc77c \ub3d9\uc548\uc758 \uc0b6!",
tr: "3 g\u00fcn boyunca s\u0131n\u0131rs\u0131z hayat!",
zh: "\u65e0\u9650\u751f\u547d3\u5929!",
pl: "Nieograniczona Mieszka przez 3 dni!",
lv: "Neierobe\u017eots dz\u012bv\u012bbu 3 dienas!"
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/unlimitedlives.png",
price: 2.99,
id: {
android: "unlimitedlives",
amazon: "com.cleverapps.woodenblock.unlimitedlives",
ios: "com.cleverapps.woodenblock.unlimitedlives",
instant: "unlimitedlives",
yandex: "unlimitedlives",
samsung: "unlimitedlives",
facebook: "unlimitedlives",
rustore: "unlimitedlives",
wortal: "jp.rgames.testcrocword.purchase.unlimitedlives",
mymailru: 64,
mbga: 64,
draugiem: null,
microsoft: "9MSZ9DV4KSNJ",
discord: null
}
},
piggybank500: {
title: {
en: "Small Piggy Bank",
fr: "Petite tirelire",
ru: "\u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430",
de: "Kleines Sparschwein",
es: "Peque\u00f1a hucha",
pt: "Pequeno banco piggy",
it: "Piccolo salvadanaio",
nl: "Klein spaarvarken",
ar: "\u0627\u0644\u0628\u0646\u0643 \u0623\u0635\u0628\u0639 \u0635\u063a\u064a\u0631",
ja: "\u5c0f\u3055\u306a\u8caf\u7518\u30b4\u30fc\u30eb\u30c9\u7bb1",
ko: "\uc791\uc740 \ub3fc\uc9c0 \uc800\uae08\ud1b5",
tr: "K\u00fc\u00e7\u00fck kumbara",
zh: "\u5c0f\u5b58\u94b1\u7f50",
pl: "Ma\u0142y Skarbonka",
lv: "Maz\u0101 c\u016bci\u0146a banka"
},
description: {
en: "Small Piggy Bank full of coins!",
fr: "Petite tirelire pleine de pi\u00e8ces!",
ru: "\u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430 \u0441 \u043c\u043e\u043d\u0435\u0442\u0430\u043c\u0438!",
de: "Kleines Sparschwein voller M\u00fcnzen!",
es: "\u00a1Peque\u00f1a alcanc\u00eda llena de monedas!",
pt: "Cofrinho pequeno cheio de moedas!",
it: "Piccolo salvadanaio pieno di monete!",
nl: "Kleine spaarpot vol munten!",
ar: "\u062d\u0635\u0627\u0644\u0629 \u0646\u0642\u0648\u062f \u0635\u063a\u064a\u0631\u0629 \u0645\u0644\u064a\u0626\u0629 \u0628\u0627\u0644\u0639\u0645\u0644\u0627\u062a \u0627\u0644\u0645\u0639\u062f\u0646\u064a\u0629!",
ja: "\u7518\u30b4\u30fc\u30eb\u30c9\u3067\u3044\u3063\u3071\u3044\u306e\u5c0f\u3055\u306a\u8caf\u91d1\u7bb1!",
ko: "\ub3d9\uc804\uc774 \uac00\ub4dd\ud55c \uc791\uc740 \uc800\uae08\ud1b5!",
tr: "Madeni paralarla dolu k\u00fc\u00e7\u00fck Kumbara!",
zh: "\u5145\u6ee1\u91d1\u5e01\u7684\u5c0f\u5b58\u94b1\u7f50\uff01",
pl: "Ma\u0142a Skarbonka pe\u0142na monet!",
lv: "Maz\u0101 C\u016bci\u0146a banka pilna ar mon\u0113t\u0101m!"
},
price: 2.99,
image: "https://woodenblock.cleverappssg.com/res/fbproducts/piggy_bank.png",
id: {
amazon: "com.cleverapps.woodenblock.piggybank500",
ios: "com.cleverapps.woodenblock.piggybank500",
wortal: "jp.rgames.testcrocword.purchase.piggybank500",
mymailru: 12,
mbga: 12,
draugiem: null,
microsoft: "9PF3X4Z3BF88",
discord: null
}
},
piggybank1800: {
title: {
en: "Medium Piggy Bank",
fr: "Tirelire moyenne",
ru: "\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430",
de: "Mittleres Sparschwein",
es: "Hucha mediana",
pt: "Cofrinho m\u00e9dio",
it: "Salvadanaio medio",
nl: "Middelmatig spaarvarken",
ar: "\u0627\u0644\u0628\u0646\u0643 \u0623\u0635\u0628\u0639 \u0627\u0644\u0645\u062a\u0648\u0633\u0637\u0629",
ja: "\u4e2d\u578b\u8caf\u7518\u30b4\u30fc\u30eb\u30c9\u7bb1",
ko: "\uc911\uac04 \ub3fc\uc9c0 \uc800\uae08\ud1b5",
tr: "Orta kumbara",
zh: "\u4e2d\u578b\u5b58\u94b1\u7f50",
pl: "\u015aredni Skarbonka",
lv: "Vid\u0113ja c\u016bci\u0146a banka"
},
description: {
en: "Medium Piggy Bank full of coins!",
fr: "Tirelire moyenne pleine de pi\u00e8ces!",
ru: "\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430 \u0441 \u043c\u043e\u043d\u0435\u0442\u0430\u043c\u0438!",
de: "Mittleres Sparschwein voller M\u00fcnzen!",
es: "\u00a1Alcanc\u00eda mediana llena de monedas!",
pt: "Cofrinho m\u00e9dio cheio de moedas!",
it: "Salvadanaio medio pieno di monete!",
nl: "Middelgrote spaarpot vol munten!",
ar: "\u062d\u0635\u0627\u0644\u0629 \u0646\u0642\u0648\u062f \u0645\u062a\u0648\u0633\u0637\u0629 \u0645\u0644\u064a\u0626\u0629 \u0628\u0627\u0644\u0639\u0645\u0644\u0627\u062a \u0627\u0644\u0645\u0639\u062f\u0646\u064a\u0629!",
ja: "\u7518\u30b4\u30fc\u30eb\u30c9\u304c\u3044\u3063\u3071\u3044\u306e\u30df\u30c7\u30a3\u30a2\u30e0\u8caf\u91d1\u7bb1!",
ko: "\ub3d9\uc804\uc774 \uac00\ub4dd\ud55c \uc911\ud615 \uc800\uae08\ud1b5!",
tr: "Madeni paralarla dolu Orta Boy Kumbara!",
zh: "\u4e2d\u578b\u5b58\u94b1\u7f50\u88c5\u6ee1\u4e86\u91d1\u5e01\uff01",
pl: "\u015arednia skarbonka pe\u0142na monet!",
lv: "Vid\u0113ja C\u016bci\u0146a banka, pilna ar mon\u0113t\u0101m!"
},
price: 9.99,
image: "https://woodenblock.cleverappssg.com/res/fbproducts/piggy_bank.png",
id: {
amazon: "com.cleverapps.woodenblock.piggybank1800",
ios: "com.cleverapps.woodenblock.piggybank1800",
wortal: "jp.rgames.testcrocword.purchase.piggybank1800",
mymailru: 13,
mbga: 13,
draugiem: null,
microsoft: "9NMSTFW84Z8C",
discord: null
}
},
piggybank6000: {
title: {
en: "Large Piggy Bank",
fr: "Grande tirelire",
ru: "\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430",
de: "Gro\u00dfes Sparschwein",
es: "Gran hucha",
pt: "Grande cofrinho",
it: "Grande salvadanaio",
nl: "Groot spaarvarken",
ar: "\u0627\u0644\u0628\u0646\u0643 \u0623\u0635\u0628\u0639 \u0643\u0628\u064a\u0631",
ja: "\u5927\u578b\u8caf\u7518\u30b4\u30fc\u30eb\u30c9\u7bb1",
ko: "\ub300\ud615 \ub3fc\uc9c0 \uc800\uae08\ud1b5",
tr: "B\u00fcy\u00fck kumbara",
zh: "\u5927\u5b58\u94b1\u7f50",
pl: "Du\u017cy Piggy Bank",
lv: "Liela c\u016bci\u0146a banka"
},
description: {
en: "Large Piggy Bank full of coins!",
fr: "Grande tirelire pleine de pi\u00e8ces!",
ru: "\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430 \u0441 \u043c\u043e\u043d\u0435\u0442\u0430\u043c\u0438!",
de: "Gro\u00dfes Sparschwein voller M\u00fcnzen!",
es: "\u00a1Alcanc\u00eda grande llena de monedas!",
pt: "Cofrinho grande cheio de moedas!",
it: "Grande salvadanaio pieno di monete!",
nl: "Grote spaarpot vol munten!",
ar: "\u062d\u0635\u0627\u0644\u0629 \u0646\u0642\u0648\u062f \u0643\u0628\u064a\u0631\u0629 \u0645\u0644\u064a\u0626\u0629 \u0628\u0627\u0644\u0639\u0645\u0644\u0627\u062a \u0627\u0644\u0645\u0639\u062f\u0646\u064a\u0629!",
ja: "\u7518\u30b4\u30fc\u30eb\u30c9\u304c\u3044\u3063\u3071\u3044\u306e\u5927\u304d\u306a\u8caf\u91d1\u7bb1!",
ko: "\ub3d9\uc804\uc774 \uac00\ub4dd\ud55c \ub300\ud615 \uc800\uae08\ud1b5!",
tr: "Madeni paralarla dolu b\u00fcy\u00fck Kumbara!",
zh: "\u5927\u5b58\u94b1\u7f50\u88c5\u6ee1\u4e86\u91d1\u5e01\uff01",
pl: "Du\u017ca skarbonka pe\u0142na monet!",
lv: "Liela C\u016bci\u0146a banka, pilna ar mon\u0113t\u0101m!"
},
price: 29.99,
image: "https://woodenblock.cleverappssg.com/res/fbproducts/piggy_bank.png",
id: {
amazon: "com.cleverapps.woodenblock.piggybank6000",
ios: "com.cleverapps.woodenblock.piggybank6000",
wortal: "jp.rgames.testcrocword.purchase.piggybank6000",
mymailru: 14,
mbga: 14,
draugiem: null,
microsoft: "9P1NL0RVQWM1",
discord: null
}
},
piggybank25000: {
title: {
en: "Huge Piggy Bank",
fr: "\u00c9norme tirelire",
ru: "\u041e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430",
de: "Riesiges Sparschwein",
es: "Enorme hucha",
pt: "Cofrinho enorme",
it: "Enorme salvadanaio",
nl: "Enorm spaarvarken",
ar: "\u0627\u0644\u0628\u0646\u0643 \u0623\u0635\u0628\u0639 \u0636\u062e\u0645",
ja: "\u5de8\u5927\u306a\u8caf\u7518\u30b4\u30fc\u30eb\u30c9\u7bb1",
ko: "\uac70\ub300\ud55c \ub3fc\uc9c0 \uc800\uae08\ud1b5",
tr: "Devasa kumbara",
zh: "\u5de8\u5927\u7684\u5b58\u94b1\u7f50",
pl: "Ogromny Piggy Bank",
lv: "Milz\u012bga c\u016bci\u0146a banka"
},
description: {
en: "Huge Piggy Bank full of coins!",
fr: "\u00c9norme tirelire pleine de pi\u00e8ces!",
ru: "\u041e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u043b\u043a\u0430 \u0441 \u043c\u043e\u043d\u0435\u0442\u0430\u043c\u0438!",
de: "Riesiges Sparschwein voller M\u00fcnzen!",
es: "\u00a1Enorme hucha llena de monedas!",
pt: "Enorme Cofrinho cheio de moedas!",
it: "Enorme salvadanaio pieno di monete!",
nl: "Enorme spaarpot vol munten!",
ar: "\u062d\u0635\u0627\u0644\u0629 \u0646\u0642\u0648\u062f \u0636\u062e\u0645\u0629 \u0645\u0644\u064a\u0626\u0629 \u0628\u0627\u0644\u0639\u0645\u0644\u0627\u062a \u0627\u0644\u0645\u0639\u062f\u0646\u064a\u0629!",
ja: "\u7518\u30b4\u30fc\u30eb\u30c9\u3067\u3044\u3063\u3071\u3044\u306e\u5de8\u5927\u306a\u8caf\u91d1\u7bb1!",
ko: "\ub3d9\uc804\uc774 \uac00\ub4dd\ud55c \uac70\ub300\ud55c \ub3fc\uc9c0 \uc800\uae08\ud1b5!",
tr: "Madeni paralarla dolu devasa Kumbara!",
zh: "\u5de8\u5927\u7684\u5b58\u94b1\u7f50\u91cc\u88c5\u6ee1\u4e86\u786c\u5e01\uff01",
pl: "Ogromna skarbonka pe\u0142na monet!",
lv: "Milz\u012bga C\u016bci\u0146a banka, pilna ar mon\u0113t\u0101m!"
},
price: 99.99,
image: "https://woodenblock.cleverappssg.com/res/fbproducts/piggy_bank.png",
id: {
amazon: "com.cleverapps.woodenblock.piggybank25000",
ios: "com.cleverapps.woodenblock.piggybank25000",
wortal: "jp.rgames.testcrocword.purchase.piggybank25000",
mymailru: 15,
mbga: 15,
draugiem: null,
microsoft: "9N4KLBZKLJTF",
discord: null
}
},
cheapProduct: {
title: {
en: "1 ruby",
fr: "1 rubis",
ru: "1 \u0440\u0443\u0431\u0438\u043d",
de: "1 Rubin",
es: "1 rub\u00ed",
pt: "1 rubi",
it: "1 rubino",
nl: "1 robijn",
ar: "1 \u0631\u0648\u0628\u064a",
ja: "\u30eb\u30d3\u30fc1\u500b",
ko: "\ub8e8\ube44 1\uac1c",
tr: "1 yakut",
zh: "1 \u7ea2\u5b9d\u77f3",
pl: "1 rubin",
lv: "1 rub\u012bns"
},
description: {
en: "Cheap product - 1 ruby!",
fr: "Produit bon march\u00e9 - 1 rubis !",
ru: "\u0414\u0435\u0448\u0435\u0432\u044b\u0439 \u0442\u043e\u0432\u0430\u0440 - 1 \u0440\u0443\u0431\u0438\u043d!",
de: "G\u00fcnstiges Produkt \u2013 1 Rubin!",
es: "Producto barato: \u00a11 rub\u00ed!",
pt: "Produto barato - 1 rubi!",
it: "Prodotto economico - 1 rubino!",
nl: "Goedkoop product - 1 robijn!",
ar: "\u0645\u0646\u062a\u062c \u0631\u062e\u064a\u0635 - 1 \u0631\u0648\u0628\u064a!",
ja: "\u683c\u5b89\u5546\u54c1 - \u30eb\u30d3\u30fc1\u500b!",
ko: "\uc800\ub834\ud55c \uc81c\ud488 - \ub8e8\ube44 1\uac1c!",
tr: "Ucuz \u00fcr\u00fcn - 1 yakut!",
zh: "\u4fbf\u5b9c\u4ea7\u54c1-1 \u9897\u7ea2\u5b9d\u77f3!",
pl: "Tani produkt - 1 rubin!",
lv: "L\u0113ta prece - 1 rub\u012bns!"
},
price: .01,
id: {
android: "cheapproduct",
amazon: "com.cleverapps.woodenblock.cheapproduct",
ios: null,
instant: "cheapproduct",
yandex: "cheapproduct",
samsung: "cheapproduct",
facebook: "cheapproduct",
rustore: "cheapproduct",
wortal: "jp.rgames.testcrocword.purchase.cheapproduct",
mymailru: 92,
mbga: 92,
draugiem: null,
microsoft: "9NK3LZSNTNM3",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/cheapproduct.png"
},
gold500: {
title: {
en: "Stack of rubies",
fr: "Pile de rubis",
ru: "\u0413\u043e\u0440\u0441\u0442\u044c \u0440\u0443\u0431\u0438\u043d\u043e\u0432",
de: "Stapel Rubine",
es: "Pila de rub\u00edes",
pt: "Pilha de rubis",
it: "Pila di rubini",
nl: "Stapel robijnen",
ar: "\u0643\u0648\u0645\u0629 \u0627\u0644\u064a\u0627\u0642\u0648\u062a",
ja: "\u30eb\u30d3\u30fc\u306e\u30b9\u30bf\u30c3\u30af",
ko: "\ub8e8\ube44 \uc2a4\ud0dd",
tr: "Yakut y\u0131\u011f\u0131n\u0131",
zh: "\u4e00\u5806\u94bb\u77f3",
pl: "Stos rubin\u00f3w",
lv: "Rub\u012bnu kaudze"
},
description: {
en: "Stack of rubies - 200 rubies!",
fr: "Pile de rubis - 200 rubis\u00a0!",
ru: "\u0413\u043e\u0440\u0441\u0442\u044c \u0440\u0443\u0431\u0438\u043d\u043e\u0432 - 200 \u0440\u0443\u0431\u0438\u043d\u043e\u0432!",
de: "Stapel Rubine - 200 Rubine!",
es: "Pila de rub\u00edes - \u00a1200 rub\u00edes!",
pt: "Pilha de rubis - 200 rubis!",
it: "Pila di rubini - 200 rubini!",
nl: "Stapel robijnen - 200 robijnen!",
ar: "\u0643\u0648\u0645\u0629 \u0627\u0644\u064a\u0627\u0642\u0648\u062a - 200 \u064a\u0627\u0642\u0648\u062a\u0629!",
ja: "\u30eb\u30d3\u30fc\u306e\u30b9\u30bf\u30c3\u30af - 200\u30eb\u30d3\u30fc!",
ko: "\ub8e8\ube44 \uc2a4\ud0dd - 200\ub8e8\ube44!",
tr: "Yakut y\u0131\u011f\u0131n\u0131 - 200 yakut!",
zh: "\u4e00\u5806\u94bb\u77f3 - 200 \u9897\u94bb\u77f3!",
pl: "Stos rubin\u00f3w - 200 rubin\u00f3w!",
lv: "Rub\u012bnu kaudze - 200 rub\u012bni!"
},
price: 2.99,
id: {
amazon: "com.cleverapps.woodenblock.gold500",
ios: "com.cleverapps.woodenblock.gold500",
wortal: "jp.rgames.testcrocword.purchase.gold500",
mymailru: 21,
mbga: 21,
draugiem: null,
microsoft: "9P1PK36XD4D8",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/gold500.png"
},
gold1800: {
title: {
en: "Pile of rubies",
fr: "Tas de rubis",
ru: "\u0413\u0440\u0443\u0434\u0430 \u0440\u0443\u0431\u0438\u043d\u043e\u0432",
de: "Haufen Rubine",
es: "Mont\u00f3n de rub\u00edes",
pt: "Pilha de rubis",
it: "Mucchio di rubini",
nl: "Stapel robijnen",
ar: "\u0643\u0648\u0645\u0629 \u0645\u0646 \u0627\u0644\u064a\u0627\u0642\u0648\u062a",
ja: "\u30eb\u30d3\u30fc\u306e\u5c71\u76db\u308a",
ko: "\ub8e8\ube44 \ub354\ubbf8",
tr: "Yakut y\u0131\u011f\u0131n\u0131",
zh: "\u4e00\u5806\u94bb\u77f3",
pl: "Stos rubin\u00f3w",
lv: "Rub\u012bnu kaudze"
},
description: {
en: "Pile of rubies - 900 rubies!",
fr: "Tas de rubis - 900 rubis !",
ru: "\u0413\u0440\u0443\u0434\u0430 \u0440\u0443\u0431\u0438\u043d\u043e\u0432 - 900 \u0440\u0443\u0431\u0438\u043d\u043e\u0432!",
de: "Haufen Rubine - 900 Rubine!",
es: "Mont\u00f3n de rub\u00edes - \u00a1900 rub\u00edes!",
pt: "Pilha de rubis - 900 rubis!",
it: "Pila di rubini - 900 rubini!",
nl: "Stapel robijnen - 900 robijnen!",
ar: "\u0643\u0648\u0645\u0629 \u0645\u0646 \u0627\u0644\u064a\u0627\u0642\u0648\u062a - 900 \u064a\u0627\u0642\u0648\u062a\u0629!",
ja: "\u30eb\u30d3\u30fc\u306e\u5c71\u76db\u308a - 900\u30eb\u30d3\u30fc!",
ko: "\ub8e8\ube44 \ub354\ubbf8 - 900\ub8e8\ube44!",
tr: "Yakut y\u0131\u011f\u0131n\u0131 - 900 yakut!",
zh: "\u4e00\u5806\u94bb\u77f3 - 900 \u9897\u94bb\u77f3!",
pl: "Stos rubin\u00f3w - 900 rubin\u00f3w!",
lv: "Rub\u012bnu kaudze - 900 rub\u012bni!"
},
price: 9.99,
id: {
amazon: "com.cleverapps.woodenblock.gold1800",
ios: "com.cleverapps.woodenblock.gold1800",
wortal: "jp.rgames.testcrocword.purchase.gold1800",
mymailru: 22,
mbga: 22,
draugiem: null,
microsoft: "9N6XQNRRZK2J",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/gold1800.png"
},
gold3800: {
title: {
en: "Heap of rubies",
fr: "Tas de rubis",
ru: "\u041a\u0443\u0447\u0430 \u0440\u0443\u0431\u0438\u043d\u043e\u0432",
de: "Haufen Rubine",
es: "Mont\u00f3n de rub\u00edes",
pt: "pilha de rubis",
it: "Mucchio di rubini",
nl: "Hoop robijnen",
ar: "\u0643\u0648\u0645\u0629 \u0645\u0646 \u0627\u0644\u064a\u0627\u0642\u0648\u062a",
ja: "\u30eb\u30d3\u30fc\u306e\u8ca1\u7523",
ko: "\ub8e8\ube44 \ub354\ubbf8",
tr: "yakut y\u0131\u011f\u0131n\u0131",
zh: "\u94bb\u77f3\u5806",
pl: "Kupie rubiny",
lv: "Rub\u012bnu kaudze"
},
description: {
en: "Heap of rubies - 2,100 rubies!",
fr: "Tas de rubis - 2 100 rubis !",
ru: "\u041a\u0443\u0447\u0430 \u0440\u0443\u0431\u0438\u043d\u043e\u0432 - 2,100 \u0440\u0443\u0431\u0438\u043d\u043e\u0432!",
de: "Haufen Rubine - 2.100 Rubine!",
es: "Mont\u00f3n de rub\u00edes: \u00a12100 rub\u00edes!",
pt: "Pilha de rubis - 2.100 rubis!",
it: "Mucchio di rubini - 2.100 rubini!",
nl: "Hoop robijnen - 2.100 robijnen!",
ar: "\u0643\u0648\u0645\u0629 \u0645\u0646 \u0627\u0644\u064a\u0627\u0642\u0648\u062a - 2100 \u064a\u0627\u0642\u0648\u062a!",
ja: "\u30eb\u30d3\u30fc\u306e\u8ca1\u7523 - 2,100\u30eb\u30d3\u30fc!",
ko: "\ub8e8\ube44 \ub354\ubbf8 - 2,100\ub8e8\ube44!",
tr: "Yakut y\u0131\u011f\u0131n\u0131 - 2.100 yakut!",
zh: "\u94bb\u77f3\u5806 - 2,100 \u9897\u94bb\u77f3!",
pl: "Stos rubin\u00f3w - 2100 rubin\u00f3w!",
lv: "Rub\u012bnu kaudze - 2100 rub\u012bni!"
},
price: 19.99,
id: {
amazon: "com.cleverapps.woodenblock.gold3800",
ios: "com.cleverapps.woodenblock.gold3800",
wortal: "jp.rgames.testcrocword.purchase.gold3800",
mymailru: 39,
mbga: 39,
draugiem: null,
microsoft: "9NP897Q6MDG4",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/gold3800.png"
},
gold6000: {
title: {
en: "Mountain of rubies",
fr: "Montagne de rubis",
ru: "\u0413\u043e\u0440\u0430 \u0440\u0443\u0431\u0438\u043d\u043e\u0432",
de: "Berg aus Rubinen",
es: "monta\u00f1a de rub\u00edes",
pt: "Montanha de rubis",
it: "Montagna di rubini",
nl: "Berg van robijnen",
ar: "\u062c\u0628\u0644 \u0627\u0644\u064a\u0627\u0642\u0648\u062a",
ja: "\u30eb\u30d3\u30fc\u306e\u5c71",
ko: "\ub8e8\ube44 \uc0b0",
tr: "yakut da\u011f\u0131",
zh: "\u94bb\u77f3\u5c71",
pl: "G\u00f3ra rubin\u00f3w",
lv: "Rub\u012bnu kalns"
},
description: {
en: "Mountain of rubies - 3,500 rubies!",
fr: "Montagne de rubis - 3 500 rubis !",
ru: "\u0413\u043e\u0440\u0430 \u0440\u0443\u0431\u0438\u043d\u043e\u0432 - 3,500 \u0440\u0443\u0431\u0438\u043d\u043e\u0432!",
de: "Rubinberg - 3.500 Rubine!",
es: "Monta\u00f1a de rub\u00edes - \u00a13500 rub\u00edes!",
pt: "Montanha de rubis - 3.500 rubis!",
it: "Montagna di rubini - 3.500 rubini!",
nl: "Berg van robijnen - 3.500 robijnen!",
ar: "\u062c\u0628\u0644 \u0627\u0644\u064a\u0627\u0642\u0648\u062a - 3500 \u064a\u0627\u0642\u0648\u062a\u0629!",
ja: "\u30eb\u30d3\u30fc\u306e\u5c71 - 3,500\u30eb\u30d3\u30fc!",
ko: "\ub8e8\ube44 \uc0b0 - 3,500\ub8e8\ube44!",
tr: "Yakut Da\u011f\u0131 - 3.500 yakut!",
zh: "\u94bb\u77f3\u5c71 - 3,500 \u9897\u94bb\u77f3!",
pl: "G\u00f3ra rubin\u00f3w - 3500 rubin\u00f3w!",
lv: "Rub\u012bnu kalns - 3500 rub\u012bnu!"
},
price: 29.99,
id: {
amazon: "com.cleverapps.woodenblock.gold6000",
ios: "com.cleverapps.woodenblock.gold6000",
wortal: "jp.rgames.testcrocword.purchase.gold6000",
mymailru: 23,
mbga: 23,
draugiem: null,
microsoft: "9NBQGG3K48VH",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/gold6000.png"
},
gold25000: {
title: {
en: "Ruby treasure",
fr: "Tr\u00e9sor de rubis",
ru: "\u0420\u0443\u0431\u0438\u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0435",
de: "Rubinschatz",
es: "Tesoro de rub\u00ed",
pt: "tesouro de rubi",
it: "Tesoro di rubino",
nl: "Ruby schat",
ar: "\u0643\u0646\u0632 \u0631\u0648\u0628\u064a",
ja: "\u30eb\u30d3\u30fc\u306e\u5b9d\u7269",
ko: "\ub8e8\ube44 \ubcf4\ubb3c",
tr: "Yakut hazinesi",
zh: "\u94bb\u77f3\u5b9d\u7269",
pl: "Rubinowy skarb",
lv: "Rub\u012bna d\u0101rgums"
},
description: {
en: "Ruby treasure - 14,000 rubies!",
fr: "Tr\u00e9sor de rubis - 14 000 rubis !",
ru: "\u0420\u0443\u0431\u0438\u043d\u043e\u0432\u043e\u0435 \u0421\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0435 - 14,000 \u0440\u0443\u0431\u0438\u043d\u043e\u0432!",
de: "Rubinschatz - 14.000 Rubine!",
es: "Tesoro de rub\u00edes: \u00a114 000 rub\u00edes!",
pt: "Tesouro de rubis - 14.000 rubis!",
it: "Tesoro di rubini: 14.000 rubini!",
nl: "Ruby schat - 14.000 robijnen!",
ar: "\u0643\u0646\u0632 \u064a\u0627\u0642\u0648\u062a - 14000 \u064a\u0627\u0642\u0648\u062a!",
ja: "\u30eb\u30d3\u30fc\u306e\u5b9d\u7269 - 14,000\u30eb\u30d3\u30fc!",
ko: "\ub8e8\ube44 \ubcf4\ubb3c - 14,000\ub8e8\ube44!",
tr: "Yakut hazinesi - 14.000 yakut!",
zh: "\u94bb\u77f3\u5b9d\u7269\u2014\u201414000\u94bb\u77f3!",
pl: "Rubinowy skarb - 14 000 rubin\u00f3w!",
lv: "Rub\u012bnu d\u0101rgums - 14 000 rub\u012bnu!"
},
price: 99.99,
id: {
amazon: "com.cleverapps.woodenblock.gold25000",
ios: "com.cleverapps.woodenblock.gold25000",
wortal: "jp.rgames.testcrocword.purchase.gold25000",
mymailru: 24,
mbga: 24,
draugiem: null,
microsoft: "9P0XCW37XKCF",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/gold25000.png"
},
starterPack0: {
title: {
en: "Starter pack",
fr: "Kit de d\u00e9part",
ru: "\u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440",
de: "Anf\u00e4nger Packet",
es: "Paquete de inicio",
pt: "Pacote de iniciante",
it: "Pacchetto iniziale",
nl: "Starterspakket",
ar: "\u062d\u0632\u0645\u0629 \u0627\u0644\u0645\u0628\u062a\u062f\u0626\u064a\u0646",
ja: "\u30b9\u30bf\u30fc\u30bf\u30fc\u30d1\u30c3\u30af",
ko: "\uc2a4\ud0c0\ud130 \ud329",
tr: "Ba\u015flang\u0131\u00e7 paketi",
zh: "\u5165\u95e8\u793c\u5305",
pl: "Pakiet startowy",
lv: "Starta komplekts"
},
description: {
en: "Must-Have pack for the beginner!",
fr: "Pack incontournable pour le d\u00e9butant!",
ru: "\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u0430!",
de: "Must-Have Pack f\u00fcr den Anf\u00e4nger!",
es: "\u00a1Debe tener paquete para el principiante!",
pt: "Pacote obrigat\u00f3rio para o iniciante!",
it: "Pacchetto indispensabile per il principiante!",
nl: "Must-Have-pakket voor de beginner!",
ar: "\u064a\u062c\u0628 \u0623\u0646 \u064a\u0643\u0648\u0646 \u0644\u062f\u064a\u0643 \u062d\u0632\u0645\u0629 \u0644\u0644\u0645\u0628\u062a\u062f\u0626\u064a\u0646!",
ja: "\u521d\u5fc3\u8005\u306b\u306f\u5fc5\u8981\u306a\u30d1\u30c3\u30af!",
ko: "\ubc18\ub4dc\uc2dc - \ucd08\ubcf4\uc790\ub97c\uc704\ud55c \ud329!",
tr: "Yeni ba\u015flayanlar i\u00e7in paket olmal\u0131!",
zh: "\u5165\u95e8\u5fc5\u5907\uff01",
pl: "Must-Have pack dla pocz\u0105tkuj\u0105cych!",
lv: "Oblig\u0101ts iepakojums ies\u0101c\u0113jam!"
},
price: .99,
id: {
android: "starterpack0",
amazon: "com.cleverapps.woodenblock.starterpack0",
ios: "com.cleverapps.woodenblock.starterpack0",
instant: "starterpack0",
yandex: "starterpack0",
samsung: "starterpack0",
facebook: "starterpack0",
rustore: "starterpack0",
wortal: "jp.rgames.testcrocword.purchase.starterpack0",
mymailru: 25,
mbga: 25,
draugiem: null,
microsoft: "9NKJDVX0JVKQ",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/starterpack0.png"
},
starterPack: {
title: {
en: "Super pack",
fr: "Super pack",
ru: "\u0421\u0443\u043f\u0435\u0440 \u043d\u0430\u0431\u043e\u0440",
de: "Super Pack",
es: "Super pack",
pt: "Super pack",
it: "Pacchetto eccellente",
nl: "Super pakket",
ar: "\u062d\u0632\u0645\u0629 \u0633\u0648\u0628\u0631",
ja: "\u30b9\u30fc\u30d1\u30fc\u30d1\u30c3\u30af",
ko: "\uc288\ud37c \ud329",
tr: "S\u00fcper paket",
zh: "\u9ad8\u7ea7\u793c\u5305",
pl: "Super paczka",
lv: "Superpakete"
},
description: {
en: "Super pack for the good player!",
fr: "Super pack pour le bon joueur!",
ru: "\u0421\u0443\u043f\u0435\u0440 \u043d\u0430\u0431\u043e\u0440 \u0434\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430!",
de: "Superpack f\u00fcr den guten Spieler!",
es: "S\u00faper pack para el buen jugador!",
pt: "Super pack para o bom jogador!",
it: "Super pack per il buon giocatore!",
nl: "Super pack voor de goede speler!",
ar: "\u062d\u0632\u0645\u0629 \u0633\u0648\u0628\u0631 \u0644\u0644\u0627\u0639\u0628 \u062c\u064a\u062f!",
ja: "\u4e0a\u624b\u306a\u30d7\u30ec\u30fc\u30e4\u30fc\u306e\u305f\u3081\u306b\u4f5c\u3089\u308c\u305f\u30b9\u30fc\u30d1\u30fc\u30d1\u30c3\u30af!",
ko: "\uc88b\uc740 \uc120\uc218\ub97c\uc704\ud55c \uc288\ud37c \ud329!",
tr: "\u0130yi oyuncu i\u00e7in s\u00fcper paket!",
zh: "\u4f18\u79c0\u73a9\u5bb6\u9700\u8981\u7684\u9ad8\u7ea7\u793c\u5305\uff01",
pl: "Super paczka dla dobrego gracza!",
lv: "Superpakete labam sp\u0113l\u0113t\u0101jam!"
},
price: 4.99,
id: {
android: "starterpack",
amazon: "com.cleverapps.woodenblock.starterpack",
ios: "com.cleverapps.woodenblock.starterpack",
instant: "starterpack",
yandex: "starterpack",
samsung: "starterpack",
facebook: "starterpack",
rustore: "starterpack",
wortal: "jp.rgames.testcrocword.purchase.starterpack",
mymailru: 26,
mbga: 26,
draugiem: null,
microsoft: "9P0CPBVQVSJ5",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/starterpack.png"
},
starterPack2: {
title: {
en: "Mega pack",
fr: "Mega pack",
ru: "\u041c\u0435\u0433\u0430 \u043d\u0430\u0431\u043e\u0440",
de: "Mega Pack",
es: "Mega Pack",
pt: "Mega pack",
it: "Mega pack",
nl: "Mega pakket",
ar: "\u062d\u0632\u0645\u0629 \u0636\u062e\u0645\u0629",
ja: "\u30e1\u30ac\u30d1\u30c3\u30af",
ko: "\uba54\uac00 \ud329",
tr: "Mega paket",
zh: "\u8d85\u7ea7\u793c\u5305",
pl: "Mega paczka",
lv: "Mega iepakojums"
},
description: {
en: "Great deal for the great player!",
fr: "Bonne affaire pour le grand joueur!",
ru: "\u041c\u0435\u0433\u0430 \u043d\u0430\u0431\u043e\u0440 \u0434\u043b\u044f \u0432\u0435\u043b\u0438\u043a\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430!",
de: "Tolles Angebot f\u00fcr den gro\u00dfartigen Spieler!",
es: "\u00a1Gran oferta para el gran jugador!",
pt: "Grande neg\u00f3cio para o grande jogador!",
it: "Ottimo affare per il grande giocatore!",
nl: "Geweldige deal voor de geweldige speler!",
ar: "\u0635\u0641\u0642\u0629 \u0631\u0627\u0626\u0639\u0629 \u0644\u0644\u0627\u0639\u0628 \u0639\u0638\u064a\u0645!",
ja: "\u5049\u5927\u306a\u30d7\u30ec\u30fc\u30e4\u30fc\u306e\u305f\u3081\u306b\u5927\u30d1\u30c3\u30af!",
ko: "\ud6cc\ub96d\ud55c \uc120\uc218\uc5d0\uac8c \ud070 \ub3c4\uc6c0\uc774\ub429\ub2c8\ub2e4!",
tr: "B\u00fcy\u00fck oyuncu i\u00e7in b\u00fcy\u00fck f\u0131rsat!",
zh: "\u8d85\u7ea7\u73a9\u5bb6\u9002\u7528\u7684\u8d85\u7ea7\u793c\u5305\uff01",
pl: "\u015awietna oferta dla \u015bwietnego gracza!",
lv: "Liela da\u013ca lieliskajam sp\u0113l\u0113t\u0101jam!"
},
price: 29.99,
id: {
android: "starterpack2",
amazon: "com.cleverapps.woodenblock.starterpack2",
ios: "com.cleverapps.woodenblock.starterpack2",
instant: "starterpack2",
yandex: "starterpack2",
samsung: "starterpack2",
facebook: "starterpack2",
rustore: "starterpack2",
wortal: "jp.rgames.testcrocword.purchase.starterpack2",
mymailru: 27,
mbga: 27,
draugiem: null,
microsoft: "9N5J4PXBTV1N",
discord: null
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/starterpack2.png"
},
kit3: {
title: {
en: "Boost Bundle",
fr: "Pack Boost",
ru: "\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0439 \u041d\u0430\u0431\u043e\u0440",
de: "Boost-Paket",
es: "Paquete de impulso",
pt: "Pacote de refor\u00e7o",
it: "Pacchetto potenziamento",
nl: "Boost-bundel",
ar: "\u062d\u0632\u0645\u0629 \u0627\u0644\u062a\u0639\u0632\u064a\u0632",
ja: "\u30d6\u30fc\u30b9\u30c8\u30d0\u30f3\u30c9\u30eb",
ko: "\ubd80\uc2a4\ud2b8 \ubc88\ub4e4",
tr: "Takviye Paketi",
zh: "\u589e\u5f3a\u5305",
pl: "Pakiet wzmocnie\u0144",
lv: "Boost Bundle"
},
description: {
en: "Enhance your play!",
fr: "Am\u00e9liorez votre jeu\u00a0!",
ru: "\u0423\u0441\u043a\u043e\u0440\u0442\u044c\u0435 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441!",
de: "Verbessern Sie Ihr Spiel!",
es: "\u00a1Mejora tu juego!",
pt: "Melhore o seu jogo!",
it: "Migliora il tuo gioco!",
nl: "Verbeter uw spel!",
ar: "\u062a\u0639\u0632\u064a\u0632 \u0627\u0644\u0644\u0639\u0628 \u0627\u0644\u062e\u0627\u0635 \u0628\u0643!",
ja: "\u30d7\u30ec\u30a4\u3092\u5f37\u5316\u3057\u307e\u3057\u3087\u3046!",
ko: "\ub2f9\uc2e0\uc758 \ud50c\ub808\uc774\ub97c \ud5a5\uc0c1\uc2dc\ud0a4\uc138\uc694!",
tr: "Oyununuzu geli\u015ftirin!",
zh: "\u589e\u5f3a\u4f60\u7684\u53d1\u6325!",
pl: "Ulepsz swoj\u0105 gr\u0119!",
lv: "Uzlabojiet savu sp\u0113li!"
},
image: "https://woodenblock.cleverappssg.com/res/fbproducts/kit.png",
price: 2.99,
id: {
amazon: "com.cleverapps.woodenblock.kit3",
ios: "com.cleverapps.woodenblock.kit3",
wortal: "jp.rgames.testcrocword.purchase.kit3",
mymailru: 82,
mbga: 82,
draugiem: null,
microsoft: "9N6R077MF2X8",
discord: null
}
}
};
var bundles = {
abtest: {
urls: {},
jsons: {
abtest_json: {
data: '{"remote":"firebase://cleverapps/abtest_json","tsearch":{"available":{"feature":"treasure_search"}},"stickers":{"AWeight":0.8,"available":{"feature":"stickers_book"}},"prizecal":{"AWeight":0.7,"available":{"projectName":["riddles","runes","heroes"],"debugMode":true,"feature":"prize_calendar"}},"moneyFog1":{"available":{"projectName":["mergecraft"]}},"bfMoneyFog1":{"available":{"projectName":["mergecraft"]}},"lowMonet":{"available":{"projectName":["crocword","scramble","woodenblock"]}},"lowMonetOld":{"available":{"projectName":["crocword","scramble","woodenblock"],"crocword":{"registeredBefore":"2024-10-15"},"woodenblock":{"registeredBefore":"2024-10-15"},"scramble":{"registeredBefore":"2024-10-15"}}},"lowMonetNew":{"available":{"projectName":["crocword","scramble","woodenblock"],"crocword":{"registeredDate":"2024-10-15"},"woodenblock":{"registeredDate":"2024-10-15"},"scramble":{"registeredDate":"2024-10-15"}}},"pinball":{"available":{"feature":"pinball"}},"welcome":{"available":{"discord":{"disabled":true}}},"dcnotifications":{"available":{"source":"discord"},"groups":[0,1,2]},"starchest":{"available":{"feature":"star_chest"}}}',
inline: !0
}
}
},
achievements: {
virtual: !0,
injectTo: ["dailytasks"]
},
adblock_window: {
urls: {
png: "@df76d05c83.png",
json: "@8fb2241a7c.json"
},
jsons: {
atlas: "0"
},
frames: {
adblock_icon_png: "0"
}
},
adjust: {
urls: {},
jsons: {
adjust_json: {
data: '{"remote":"firebase://woodenblock/adjust_json","token":"2b9340kxx9xc","purchaseToken":"afd75x"}',
inline: !0
}
}
},
ads_bubble: {
virtual: !0,
injectTo: ["tile_shop", "main"],
jsonIds: ["#_json"]
},
ads_limits_data: {
urls: {},
jsons: {
ads_limits_json: {
data: '{"adslimits":{"preroll":{"nonpayer":{"available":{"level":0.4},"limit":1,"timeout":"10 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"interstitial":{"nonpayer":{"available":{"level":0.4},"limit":1,"timeout":"8 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"lives":{"nonpayer":{"available":{},"limit":3,"timeout":"1 minutes"},"undecided":{"available":{},"limit":1,"timeout":"1 minutes"},"payer":{"available":{},"limit":1,"timeout":"24 hours"}},"hard":{"nonpayer":{"available":{},"limit":2,"timeout":"1 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"booster_before":{"nonpayer":{"available":{},"limit":3,"timeout":"24 hours"},"undecided":{"disabled":true},"payer":{"disabled":true}},"flying_hard_soft":{"nonpayer":{"available":{"level":2.5},"limit":4,"timeout":"1 hour"},"undecided":{"available":{"level":2.5},"limit":4,"timeout":"22 hours"},"payer":{"available":{"level":2.5},"limit":4,"timeout":"22 hours"}},"toolbar":{"nonpayer":{"available":{"level":2.5},"limit":10,"timeout":"3 hour"},"undecided":{"available":{"level":2.5},"limit":1,"timeout":"22 hours"},"payer":{"available":{"level":2.5},"limit":1,"timeout":"22 hours"}},"third_element_points":{"nonpayer":{"available":{},"limit":1,"timeout":"30 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"third_element_animals":{"nonpayer":{"available":{},"limit":1,"timeout":"30 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"product":{"nonpayer":{"available":{},"limit":"unlimited","timeout":"0"},"undecided":{"available":{},"limit":"unlimited","timeout":"0"},"payer":{"available":{},"limit":"unlimited","timeout":"0"}},"extend":{"nonpayer":{"available":{"level":2},"limit":3,"timeout":"10 minutes"},"undecided":{"available":{"level":2},"limit":1,"timeout":"22 hours"},"payer":{"available":{"level":2},"limit":1,"timeout":"22 hours"}},"booster_1":{"nonpayer":{"available":{},"limit":1,"timeout":"5 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"booster_2":{"nonpayer":{"available":{},"limit":1,"timeout":"10 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"booster_3":{"nonpayer":{"available":{},"limit":1,"timeout":"30 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"shovel":{"nonpayer":{"available":{},"limit":5,"timeout":"1 minutes"},"undecided":{"available":{},"limit":3,"timeout":"1 minutes"},"payer":{"available":{},"limit":1,"timeout":"1 minutes"}},"chain":{"nonpayer":{"available":{},"limit":3,"timeout":"10 minutes"},"undecided":{"available":{},"limit":3,"timeout":"10 minutes"},"payer":{"available":{},"limit":3,"timeout":"10 minutes"}},"third_element":{"nonpayer":{"available":{"types":["merge"],"level":7},"limit":2,"timeout":"10 minutes"},"undecided":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"30 minutes"},"payer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"1 minutes"}},"speedup":{"nonpayer":{"available":{"types":["merge"]},"limit":2,"timeout":"30 minutes"},"undecided":{"available":{"types":["merge"]},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"]},"limit":1,"timeout":"1 minutes"}},"pixel":{"nonpayer":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"5 minutes"},"undecided":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"1 minutes"}},"chest":{"nonpayer":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"5 minutes"},"undecided":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"3 hour"},"payer":{"disabled":true}},"barrel":{"nonpayer":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"1 hour"},"undecided":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"5 hour"},"payer":{"disabled":true}},"energy_short":{"nonpayer":{"available":{"types":["merge"],"level":8},"limit":10,"timeout":"3 hour"},"undecided":{"available":{"types":["merge"],"level":8},"limit":1,"timeout":"3 hour"},"payer":{"disabled":true}},"freex2":{"nonpayer":{"available":{"types":["merge"]},"limit":"unlimited","timeout":"0"},"undecided":{"available":{"types":["merge"]},"limit":"unlimited","timeout":"0"},"payer":{"available":{"types":["merge"]},"limit":"unlimited","timeout":"0"}},"worker":{"nonpayer":{"available":{"types":["merge"],"level":6},"limit":3,"timeout":"24 hours"},"undecided":{"available":{"types":["merge"],"level":6},"limit":1,"timeout":"24 hours"},"payer":{"disabled":true}},"bank":{"nonpayer":{"available":{"types":["merge"]},"limit":"unlimited","timeout":"0"},"undecided":{"available":{"types":["merge"]},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"]},"limit":1,"timeout":"22 hours"}},"cinema":{"nonpayer":{"available":{"types":["merge"]},"limit":"unlimited","timeout":"0"},"undecided":{"available":{"types":["merge"]},"limit":"unlimited","timeout":"0"},"payer":{"available":{"types":["merge"]},"limit":"unlimited","timeout":"0"}},"energy":{"nonpayer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"1 hour"},"undecided":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"22 hours"}},"energy_2":{"nonpayer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"1 hour"},"undecided":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"22 hours"}},"energy_short_2":{"nonpayer":{"available":{"types":["merge"],"level":8},"limit":10,"timeout":"3 hour"},"undecided":{"disabled":true},"payer":{"disabled":true}},"energy_1":{"nonpayer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"1 hour"},"undecided":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"22 hours"}},"energy_short_1":{"nonpayer":{"available":{"types":["merge"],"level":8},"limit":10,"timeout":"3 hour"},"undecided":{"disabled":true},"payer":{"disabled":true}},"energy_3":{"nonpayer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"1 hour"},"undecided":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"22 hours"}},"energy_short_3":{"nonpayer":{"available":{"types":["merge"],"level":8},"limit":10,"timeout":"3 hour"},"undecided":{"disabled":true},"payer":{"disabled":true}},"energy_4":{"nonpayer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"1 hour"},"undecided":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"3 hour"},"payer":{"available":{"types":["merge"],"level":7},"limit":1,"timeout":"22 hours"}},"energy_short_4":{"nonpayer":{"available":{"types":["merge"],"level":8},"limit":10,"timeout":"3 hour"},"undecided":{"disabled":true},"payer":{"disabled":true}},"choice":{"nonpayer":{"available":{"meta":["homefix"]},"limit":"unlimited","timeout":"0"},"undecided":{"available":{"meta":["homefix"]},"limit":"unlimited","timeout":"0"},"payer":{"available":{"meta":["homefix"]},"limit":"unlimited","timeout":"0"}},"flying_hint":{"nonpayer":{"available":{"types":["board"]},"limit":1,"timeout":"15 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"flying_discover":{"nonpayer":{"available":{"types":["differences"]},"limit":1,"timeout":"15 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"flying_booster":{"nonpayer":{"available":{"types":["match3"],"level":0.67},"limit":1,"timeout":"15 minutes"},"undecided":{"disabled":true},"payer":{"disabled":true}},"flying_moves":{"nonpayer":{"available":{"types":["match3","solitaire"],"level":3},"limit":1,"timeout":"1 hour"},"undecided":{"disabled":true},"payer":{"disabled":true}},"flying_star":{"nonpayer":{"available":{"meta":["simple"]},"limit":1,"timeout":"1 hour"},"undecided":{"disabled":true},"payer":{"disabled":true}},"banner":{"nonpayer":{"available":{},"limit":"unlimited","timeout":"0"},"undecided":{"disabled":true},"payer":{"disabled":true}},"prize_calendar":{"nonpayer":{"available":{},"limit":1,"timeout":"20 minutes"},"undecided":{"available":{},"limit":1,"timeout":"20 minutes"},"payer":{"available":{},"limit":1,"timeout":"20 minutes"}},"piggy_bank":{"nonpayer":{"available":{},"limit":5,"timeout":"12"},"undecided":{"available":{},"limit":3,"timeout":"12"},"payer":{"available":{},"limit":1,"timeout":"12"}},"booster_ads":{"nonpayer":{"available":{},"limit":"unlimited","timeout":"0"},"undecided":{"available":{},"limit":"unlimited","timeout":"0"},"payer":{"available":{},"limit":"unlimited","timeout":"0"}},"pinball_chips":{"nonpayer":{"available":{},"limit":5,"timeout":"1 minutes"},"undecided":{"available":{},"limit":3,"timeout":"1 minutes"},"payer":{"available":{},"limit":1,"timeout":"1 minutes"}}}}',
inline: !0
}
}
},
animations_library: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: ["animations_coin"],
jsonIds: ["rays_json", "hovering_json", "coins_reward_json", "show_up_json", "complete_json"]
},
attention: {
virtual: !0,
injectTo: ["dailytasks", "game", "starter_pack", "tile_shop", "main"],
frameIds: ["#_png"]
},
avatar: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: "#_frame #_frame2 android_# ios_# user_# default_#".split(" ")
},
backgrounds_window_0: {
urls: {
background: "@e8157ce611.jpg"
}
},
backgrounds_window_1: {
urls: {
background: "@60b46ca303.jpg"
}
},
backgrounds_window_10: {
urls: {
background: "@22a962abbb.jpg"
}
},
backgrounds_window_11: {
urls: {
background: "@c103112297.jpg"
}
},
backgrounds_window_12: {
urls: {
background: "@8a09c90d39.jpg"
}
},
backgrounds_window_13: {
urls: {
background: "@df9c11a0f2.jpg"
}
},
backgrounds_window_14: {
urls: {
background: "@55c0c7bcae.jpg"
}
},
backgrounds_window_15: {
urls: {
background: "@e686e019e2.jpg"
}
},
backgrounds_window_16: {
urls: {
background: "@018509a5b4.jpg"
}
},
backgrounds_window_17: {
urls: {
background: "@c188570e45.jpg"
}
},
backgrounds_window_18: {
urls: {
background: "@db6e965322.jpg"
}
},
backgrounds_window_19: {
urls: {
background: "@492531813d.jpg"
}
},
backgrounds_window_2: {
urls: {
background: "@93fa8a551e.jpg"
}
},
backgrounds_window_3: {
urls: {
background: "@278f6da996.jpg"
}
},
backgrounds_window_4: {
urls: {
background: "@3f1689c506.jpg"
}
},
backgrounds_window_5: {
urls: {
background: "@2b615f5544.jpg"
}
},
backgrounds_window_6: {
urls: {
background: "@11a0f50478.jpg"
}
},
backgrounds_window_7: {
urls: {
background: "@5ef828c490.jpg"
}
},
backgrounds_window_8: {
urls: {
background: "@5386497e4b.jpg"
}
},
backgrounds_window_9: {
urls: {
background: "@4a533dfed3.jpg"
}
},
backgrounds_window_vertical_0: {
urls: {
background: "@b9e7f66875.jpg"
}
},
backgrounds_window_vertical_1: {
urls: {
background: "@05f44b12d6.jpg"
}
},
backgrounds_window_vertical_10: {
urls: {
background: "@c36243b862.jpg"
}
},
backgrounds_window_vertical_11: {
urls: {
background: "@0da1093802.jpg"
}
},
backgrounds_window_vertical_12: {
urls: {
background: "@004359f0cc.jpg"
}
},
backgrounds_window_vertical_13: {
urls: {
background: "@ae334f4d0a.jpg"
}
},
backgrounds_window_vertical_14: {
urls: {
background: "@a2b5f1baf0.jpg"
}
},
backgrounds_window_vertical_15: {
urls: {
background: "@1d7ccde0da.jpg"
}
},
backgrounds_window_vertical_16: {
urls: {
background: "@38985b570b.jpg"
}
},
backgrounds_window_vertical_17: {
urls: {
background: "@c20733295f.jpg"
}
},
backgrounds_window_vertical_18: {
urls: {
background: "@79e8a3ba76.jpg"
}
},
backgrounds_window_vertical_19: {
urls: {
background: "@fd48f8894a.jpg"
}
},
backgrounds_window_vertical_2: {
urls: {
background: "@3fb7f85b4d.jpg"
}
},
backgrounds_window_vertical_3: {
urls: {
background: "@033fbf5154.jpg"
}
},
backgrounds_window_vertical_4: {
urls: {
background: "@9d741f5ff1.jpg"
}
},
backgrounds_window_vertical_5: {
urls: {
background: "@5d9aa6f531.jpg"
}
},
backgrounds_window_vertical_6: {
urls: {
background: "@efdfeaee2d.jpg"
}
},
backgrounds_window_vertical_7: {
urls: {
background: "@281d4f322e.jpg"
}
},
backgrounds_window_vertical_8: {
urls: {
background: "@3fe6d1a529.jpg"
}
},
backgrounds_window_vertical_9: {
urls: {
background: "@d9bbc0a165.jpg"
}
},
badge: {
virtual: !0,
injectTo: ["tile_shop", "noads_window", "choosesave_window"],
frameIds: ["#_png", "#_off_png"]
},
big_buttons: {
urls: {}
},
big_digits: {
virtual: !0,
injectTo: ["game", "starter_pack"],
frameIds: "#72pt_0 #72pt_1 #72pt_2 #72pt_3 #72pt_4 #72pt_5 #72pt_6 #72pt_7 #72pt_8 #72pt_9 #72pt_colon #72pt_slash #72pt_plus #72pt_minus #72pt_x #72pt_space #72pt_asterisk #72pt_percent #72pt_point #97pt_0 #97pt_1 #97pt_2 #97pt_3 #97pt_4 #97pt_5 #97pt_6 #97pt_7 #97pt_8 #97pt_9 #97pt_colon #97pt_slash #97pt_plus #97pt_minus #97pt_x #97pt_space #97pt_asterisk #97pt_percent #97pt_point".split(" ")
},
big_timer: {
virtual: !0,
injectTo: ["dailytasks", "piggy_bank_window"],
frameIds: ["#_png", "#_bg_png"]
},
blocks: {
virtual: !0,
injectTo: ["game"],
frameIds: "grid_cell_bg_png cell_bg_red_png cell_bg_green_png cell_bg_blue_png cell_bg_yellow_png cell_bg_purple_png cell_bg_cyan_png cell_bg_orange_png cell_bg_gray_png grid_border_png hint_border_png hint_bg_png score_bg high_score_bg cell_crystal_blue_png cell_crystal_pink_png cell_crystal_orange_png cell_crystal_blue_disable_png cell_crystal_pink_disable_png cell_crystal_orange_disable_png".split(" "),
jsonIds: "mode_frame appear_json take_json explode_hint_json explode_hint_vertical_json explode_combo_json sparks_json cell_remove_json line_explode_json clear_bang_json clear_bang_explode_json crystal_blue_goal_json crystal_pink_goal_json crystal_orange_goal_json score_goal_json explode_goal_json letter_mark_json cell_light_json ice_json".split(" "),
soundIds: "tile_set_effect explode_line_effect wrong_effect drag_effect lose_animation_effect nomoves_exclamation_effect prolongation_effect message_effect booster_bomb_effect booster_replace_effect booster_undo_effect explosion_piece_effect explode_mark_effect explode_letter_effect blue_mark_collect_effect orange_mark_collect_effect pink_mark_collect_effect letter_mark_collect_effect fly_to_goal goal_is_completed ice_stage_effect".split(" ")
},
bomb_moves_window: {
urls: {}
},
booster_offer: {
urls: {
booster_offer_effect: "$e92115946e.mp3",
png: "@d05ad6a91f.png",
json: "@231033bbc8.json"
},
jsons: {
atlas: "0",
booster_offer_json: "1"
}
},
boosters_before: {
virtual: !0,
injectTo: ["main"],
frameIds: "booster_before_bg_png booster_before_bg_off_png booster_before_bg_on_png booster_before_green_button_png booster_before_purple_button_png booster_before_check_icon_png booster_before_lock_png booster_before_lantern_icon_png booster_before_level_bg".split(" "),
soundIds: ["booster_before_selection_effect", "booster_before_cancel_effect", "appear_sfx"]
},
buttons: {
virtual: !0,
injectTo: ["dailytasks", "game", "starter_pack", "tile_shop", "main"],
frameIds: "button_png button_on_png button_disabled_png small_button small_button_on small_button_off blue_button_png blue_button_on_png small_blue_button small_blue_button_on red_button red_button_on help_button_png help_button_on_png help_button_off_png sign_in_button_png sign_in_button_on_png clear_pieces_png".split(" "),
jsonIds: ["replace_all_json", "undo_json"]
},
buttons_inlined_icons: {
virtual: !0,
injectTo: ["dailytasks", "game", "starter_pack", "tile_shop", "main"],
frameIds: ["gold_icon_png", "coin_icon_png", "ad_icon_png", "ok_icon_png", "kred_icon_png"]
},
buttons_main: {
virtual: !0,
injectTo: ["main"],
frameIds: "window_close_png window_close_on_png close_band_icon scene_exit_button music_off_png music_on_png sound_off_png sound_on_png close_small close_small_on community_icon copyid_icon delete_icon exit_icon giveup_icon language_icon support_icon home_icon promocode_icon zen_png".split(" ")
},
chat: {
urls: {
window_bg: "@82fa04f9bd.jpg",
strict_font_ttf: {
type: "font",
name: "Rubic",
srcs: ["~fonts/font-0764ffd638.eot", "~fonts/font-0764ffd638.ttf"]
},
png: "@461a1ffe72.png",
json: "@3903f78dcb.json"
},
jsons: {
atlas: "0"
},
frames: {
accept_button_on: "0",
accept_button: "1",
category_bg_on: "2",
active_category_bg: "3",
category_bg: "4",
checkmark_tmp: "5",
checkmark_sent: "6",
checkmark_read: "7",
checkmark_gift: "8",
active_category_close: "9",
dialog_box_white: "a",
dialog_box_green: "b",
dialogue_separator: "c",
gift_bg: "d",
icon_back: "e",
panel_off: "f",
panel_on: "g",
paneldown: "h",
panelup: "i",
textbox: "j",
scrollbar_png: "k"
}
},
checkbox: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: ["background_png", "check_mark_png"]
},
choosesave_window: {
urls: {
png: "@b2b713463d.png",
json: "@0d517319d2.json"
},
jsons: {
atlas: "0",
progress: "1"
},
frames: {
nostroke56pt_0: "0",
nostroke56pt_1: "1",
nostroke56pt_2: "2",
nostroke56pt_3: "3",
nostroke56pt_4: "4",
nostroke56pt_5: "5",
nostroke56pt_6: "6",
nostroke56pt_7: "7",
nostroke56pt_8: "8",
nostroke56pt_9: "9",
nostroke56pt_asterisk: "a",
nostroke56pt_colon: "b",
nostroke56pt_minus: "c",
nostroke56pt_percent: "d",
nostroke56pt_plus: "e",
nostroke56pt_point: "f",
nostroke56pt_slash: "g",
nostroke56pt_space: "h",
nostroke56pt_x: "i",
default41pt_0: "j",
default41pt_1: "k",
default41pt_2: "l",
default41pt_3: "m",
default41pt_4: "n",
default41pt_5: "o",
default41pt_6: "p",
default41pt_7: "q",
default41pt_8: "r",
default41pt_9: "s",
default41pt_asterisk: "t",
default41pt_colon: "u",
default41pt_minus: "v",
default41pt_percent: "w",
default41pt_plus: "x",
default41pt_point: "y",
default41pt_slash: "z",
default41pt_space: "A",
default41pt_x: "B",
default56pt_0: "C",
default56pt_1: "D",
default56pt_2: "E",
default56pt_3: "F",
default56pt_4: "G",
default56pt_5: "H",
default56pt_6: "I",
default56pt_7: "J",
default56pt_8: "K",
default56pt_9: "L",
default56pt_asterisk: "M",
default56pt_colon: "N",
default56pt_minus: "O",
default56pt_percent: "P",
default56pt_plus: "Q",
default56pt_point: "R",
default56pt_slash: "S",
default56pt_space: "T",
default56pt_x: "U",
underline_png: "V",
badge_icon: "W",
local: "X",
save_bg: "Y",
server: "Z",
level_bg: "10",
tile_bg: "11",
bonussale_gift: "12",
shop_coin_png: "13",
coin_small_png: "14",
reward_coin_png: "15",
life_small_png: "16",
life_unlim_small: "17",
life_unlim: "18",
life_png: "19",
noads_png: "1a",
shop_gold_png: "1b",
gold_small_png: "1c",
reward_gold_png: "1d",
simple_star_png: "1e",
badge_off_png: "1f",
badge_png: "1g",
booster_clear_pieces_png: "1h",
booster_replace_all_png: "1i",
booster_undo_piece_png: "1j"
}
},
combo_digits: {
virtual: !0,
injectTo: ["game"],
frameIds: "#90pt_0 #90pt_1 #90pt_2 #90pt_3 #90pt_4 #90pt_5 #90pt_6 #90pt_7 #90pt_8 #90pt_9 #90pt_colon #90pt_slash #90pt_plus #90pt_minus #90pt_x #90pt_space #90pt_asterisk #90pt_percent".split(" ")
},
confirmexit_window: {
urls: {}
},
controlbuttons: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: "menu_icon_png control_button_png control_button_on_png back_button_png back_button_on_png back_icon_png switch_icon_png".split(" ")
},
crosspromo: {
urls: {},
jsons: {
crosspromo_json: {
data: '{"remote":"firebase://cleverapps/crosspromo_json","priorities":{"hustlemerge":43,"fairy":42,"wondermerge":41,"mergecraft":40,"riddles":31,"heroes":30,"woodenblock":23,"zenmatch":22,"tripeaks":21,"spades":20,"magicwords":14,"crocword":13,"wordsoup":12,"olympics":11,"differences":10,"runes":3,"adventure":2,"scramble":1},"hustlemerge":{"name":"hustlemerge","deployment":"https://hustlemerge.cleverappssg.com","business":"cleverapps","yandex":{"appId":"335914"},"xsolla":{"appId":"265270"},"instant":{"appId":"789325453330203","business":"zareef"},"microsoft":{"appId":"9NH461D0TPV7"},"ok":{"appId":"512002651307","shortname":"hustlemerge"},"android":{"package":"com.cleverapps.hustlemerge","business":"slimmerbits"},"msstart":{"appId":"9N55DD3DZTD2","name":"Castle Craft"},"ios":{"package":"com.cleverapps.hustlemerge","id":"6670314553","business":"cleverapps"},"release":{"deployment":"https://hustlemerge.cleverappssg.com"},"staging":{"deployment":"https://hustlemerge.labsystech.ru"},"localhost":{"deployment":"https://hustlemerge.labsystech.ru"}},"fairy":{"name":"fairy","deployment":"https://fairy.cleverappssg.com","business":"zareef","xsolla":{"appId":"198577"},"instant":{"appId":"364648672526634"},"facebook":{"appId":"1152275768461536","shortname":"cleverappsfairy"},"vk":{"appId":"8207300","shortname":"cleverappsfairy"},"mm":{"appId":"786315"},"ok":{"appId":"512001461494","shortname":"cleverappsfairy"},"android":{"package":"com.cleverapps.fairy","business":"slimmerbits"},"ios":{"package":"com.cleverapps.fairy","id":"1637090783","business":"cleverapps"},"yandex":{"appId":"193645"},"rustore":{"appId":"62853311"},"microsoft":{"appId":"9PM92ZN1W9SD"},"msstart":{"appId":"9NW8M0C50K4W","name":"Fairyland"},"wechat":{"appId":"wxd3cc1f757d2ee522"},"plinga":{"appId":"2deee771bf534191bc4071fa571a53a3"}},"wondermerge":{"name":"wondermerge","deployment":"https://wondermerge.cleverappssg.com","business":"cleverapps","instant":{"appId":"852666995406371","business":"zareef"},"facebook":{"appId":"699542957221997","shortname":"cleverwondermerge"},"vk":{"appId":"7967808","shortname":"tropicalmerge"},"mm":{"appId":"784709"},"ok":{"appId":"512001029650","shortname":"wondermerge"},"android":{"package":"com.cleverapps.wondermerge","business":"slimmerbits"},"amazon":{"package":"com.cleverapps.wondermerge","id":"B09MD2ZSPZ"},"ios":{"package":"com.cleverapps.wondermerge","id":"1597691481"},"mbga":{"appId":"12026992"},"draugiem":{"appId":"wondermerge"},"yandex":{"appId":"179757"},"rustore":{"appId":"87806399"},"microsoft":{"appId":"9PL2ZQTL33W8"},"kongregate":{"appId":"324163","name":"tropical-merge"},"xsolla":{"appId":"191184"},"msstart":{"appId":"9N5TK2SN4464","name":"Tropical Merge"},"spmbga":{"appId":"12026992-4"}},"mergecraft":{"name":"mergecraft","deployment":"https://mergecraft.cleverappssg.com","business":"cleverapps","instant":{"appId":"126844939376182","business":"zareef"},"facebook":{"appId":"365815270676633","shortname":"mergecraft"},"mbga":{"appId":"12026923"},"vk":{"appId":"7776586","shortname":"mergecraft"},"ok":{"appId":"512000742814","shortname":"mergecraft"},"android":{"package":"com.cleverapps.mergecraft","business":"slimmerbits"},"amazon":{"package":"com.cleverapps.mergecraft","id":"B0922VXRPZ"},"ios":{"package":"com.cleverapps.mergecraft","id":"1562149254"},"mm":{"appId":"783650"},"fotostrana":{"appId":"mergecraft"},"yandex":{"appId":"171361"},"draugiem":{"appId":"mergecraft"},"mygames":{"appId":"16836"},"rustore":{"appId":"87802303"},"microsoft":{"appId":"9PGVXWXRWX7S"},"kongregate":{"appId":"324134","name":"mergest-kingdom"},"msstart":{"appId":"9PLXKMCM96Q9","name":"Mergest Kingdom"},"xsolla":{"appId":"134757"},"wechat":{"appId":"wxd3cc1f757d2ee522"},"wortal":{"appId":239},"spmbga":{"appId":"12026923-4"},"discord":{"appId":"1276646101914615872"}},"riddles":{"name":"riddles","deployment":"https://riddles.labsystech.ru","business":"zareef","xsolla":{"appId":"191229"},"instant":{"appId":"169228177248519"},"facebook":{"appId":"1996120880405386","shortname":"candyriddles"},"android":{"package":"com.cleverapps.candyriddles","business":"slimmerbits"},"amazon":{"package":"com.cleverapps.candyriddles","id":"B078YB7FBX"},"ios":{"package":"com.cleverapps.riddles","id":"1340236132","business":"slimmerbits"},"ok":{"appId":"1269377792","shortname":"candyriddles"},"vk":{"appId":"6745237","shortname":"candy_riddles"},"mm":{"appId":"763558"},"mbga":{"appId":"12026417"},"draugiem":{"appId":"riddles"},"fotostrana":{"appId":"candyriddles"},"yandex":{"appId":"173174"},"rustore":{"appId":"87807935"},"msstart":{"appId":"9P1GCMDN4FBN","name":"Candy Riddles"},"microsoft":{"appId":"9N8BQ1RJBRLM"},"spmbga":{"appId":"12026417-4"}},"heroes":{"name":"heroes","deployment":"https://heroes.cleverappssg.com","business":"cleverapps","xsolla":{"appId":"191314"},"instant":{"appId":"2096828893670802"},"facebook":{"appId":"205918406663140","shortname":"sugarheroes"},"android":{"package":"com.cleverapps.heroes"},"amazon":{"package":"com.cleverapps.heroes","id":"B07JMZLTV7"},"ios":{"package":"com.cleverapps.heroes","id":"1439884631"},"ok":{"appId":"1271685376","shortname":"sugarheroes"},"vk":{"appId":"6830710","shortname":"sugar_heroes"},"mm":{"appId":"763582"},"mbga":{"appId":"12026480"},"draugiem":{"appId":"sugarheroes"},"fotostrana":{"appId":"sugarheroes"},"yandex":{"appId":"173183"},"rustore":{"appId":"87808703"},"microsoft":{"appId":"9NJL3JWM89BQ"},"kongregate":{"appId":"324221","name":"sugar-heroes"},"msstart":{"appId":"9NKZMT283DZC","name":"Sugar Heroes"},"spmbga":{"appId":"12026480-4"}},"woodenblock":{"name":"woodenblock","deployment":"./","business":"zareef","instant":{"appId":"1440383360100912"},"android":{"package":"com.cleverapps.woodenblock","business":"slimmerbits"},"yandex":{"appId":"230625","debug":true},"vk":{"appId":"51647351","shortname":"woodenblockgame"},"ok":{"appId":"512001974110","shortname":"woodenblock"},"microsoft":{"appId":"9PDQHXCJKH15"},"msstart":{"appId":"9P83G3B4H340","name":"BlockBuster Puzzle"},"xsolla":{"appId":"226855"},"ios":{"package":"com.cleverapps.woodenblock","id":"6449209833","business":"cleverapps"}},"zenmatch":{"name":"zenmatch","deployment":"https://zenmatch.cleverappssg.com","business":"cleverapps","instant":{"appId":"758370645292118"},"android":{"package":"com.cleverapps.zenmatch","business":"slimmerbits"},"ok":{"appId":"512001589692","shortname":"tileguru"},"vk":{"appId":"51614608","shortname":"tileguru"},"draugiem":{"appId":"15021150"},"yandex":{"appId":"230597","debug":true},"fotostrana":{"appId":"tileguru"},"mm":{"appId":"787786"},"mbga":{"appId":"12027091"},"microsoft":{"appId":"9NKSPNFTR2NP"},"kongregate":{"appId":"324225","name":"tile-guru-match-fun"},"xsolla":{"appId":"212487"},"msstart":{"appId":"9PLZMG4B7Q7V","name":"Tile Guru"},"ios":{"package":"com.cleverapps.zenmatch","id":"6449207675","business":"cleverapps"},"spmbga":{"appId":"12027091-4"}},"tripeaks":{"name":"tripeaks","deployment":"https://tripeaks.cleverappssg.com","business":"cleverapps","xsolla":{"appId":"191315"},"instant":{"appId":"582264172486698"},"facebook":{"appId":"1079919015696954","shortname":"tripeakscard"},"android":{"package":"com.cleverapps.tripeaks"},"amazon":{"package":"com.cleverapps.tripeaks","id":"B08CNK8GSB"},"ios":{"package":"com.cleverapps.tripeaks","id":"1523134029"},"ok":{"appId":"512000516286","shortname":"tripeaks"},"vk":{"appId":"7522400","shortname":"tripeaks"},"mm":{"appId":"779517"},"mbga":{"appId":"12026813"},"fotostrana":{"appId":"tripeaks"},"yandex":{"appId":"173184"},"rustore":{"appId":"87811519"},"microsoft":{"appId":"9N0Q2287357F"},"kongregate":{"appId":"324223","name":"kings-and-queens"},"msstart":{"appId":"9PLVT8QK4HM5","name":"Kings and Queens Start Game"},"spmbga":{"appId":"12026813-4"}},"spades":{"name":"spades","deployment":"https://spades.cleverappssg.com","business":"zareef","instant":{"appId":"3255116861409850"},"facebook":{"appId":"299923727721026","shortname":"cleverspades"},"vk":{"appId":"51499008"}},"magicwords":{"name":"magicwords","deployment":"https://magicwords.labsystech.ru","business":"cleverapps","xsolla":{"appId":"191474"},"instant":{"appId":"635365383471881"},"facebook":{"appId":"116453995539327","shortname":"magic_words_puzzle"},"android":{"package":"com.cleverapps.magicwords"},"amazon":{"package":"com.cleverapps.magicwords","id":"B071KKB243"},"ios":{"package":"com.cleverapps.magicwords","id":"1256304845"},"ok":{"appId":"512000565237","shortname":"magic_words"},"vk":{"appId":"7803436","shortname":"cleverapps_magic_words"},"mm":{"appId":"783608"},"fotostrana":{"appId":"magicwords"},"msstart":{"appId":"9NX77LJ8V3B0","name":"Circus Words"},"yandex":{"appId":"260485"}},"crocword":{"name":"crocword","deployment":"https://crocword.labsystech.ru","business":"cleverapps","xsolla":{"appId":"191467"},"instant":{"appId":"156455286289887"},"facebook":{"appId":"480756825591552","shortname":"crocword"},"android":{"package":"com.cleverapps.crocword"},"amazon":{"package":"com.cleverapps.crocword","id":"B074JB1CB3"},"ios":{"package":"com.cleverapps.crocword","id":"1269673961"},"ok":{"appId":"512000231014","shortname":"crocword"},"vk":{"appId":"7234712","shortname":"crocword"},"mm":{"appId":"768269"},"fotostrana":{"appId":"crocword"},"mbga":{"appId":"12026781"},"yandex":{"appId":"260466"},"microsoft":{"appId":"9PN546S70Z7D"},"msstart":{"appId":"9PMQ1JW17DBR","name":"Crocword Start Game"},"wortal":{"appId":240},"spmbga":{"appId":"12026781-4"}},"wordsoup":{"name":"wordsoup","deployment":"https://wordsoup.labsystech.ru","business":"cleverapps","xsolla":{"appId":"191416"},"instant":{"appId":"177170139576790"},"facebook":{"appId":"1839614776298283","shortname":"word_soup"},"android":{"package":"org.cocos2dx.wordsoup"},"amazon":{"package":"org.cocos2dx.wordsoup","id":"B07192HTZ9"},"ios":{"package":"org.cocos2dx.wordsoup","id":"1236153570"},"ok":{"appId":"512000025924","shortname":"wordsoup"},"vk":{"appId":"7139277","shortname":"wordsoup"},"mm":{"appId":"766829"},"fotostrana":{"appId":"wordsoup"},"msstart":{"appId":"9P2MW8CP8FX8","name":"Word Sauce"},"yandex":{"appId":"260445"}},"olympics":{"name":"olympics","deployment":"https://olympics.labsystech.ru","business":"cleverapps","xsolla":{"appId":"191468"},"instant":{"appId":"403603626714071"},"facebook":{"appId":"404908173269801","shortname":"word_olympics"},"android":{"package":"com.cleverapps.olympics"},"amazon":{"package":"com.cleverapps.olympics","id":"B07DGGRN8K"},"ios":{"package":"com.cleverapps.olympics","id":"1394966990"},"ok":{"appId":"512000487372","shortname":"olympics"},"vk":{"appId":"7394144","shortname":"wordolympics"},"mm":{"appId":"771991"},"fotostrana":{"appId":"olympics"},"msstart":{"appId":"9NF1720Z8C3H","name":"Crossword Online"},"yandex":{"appId":"260484"}},"differences":{"name":"differences","deployment":"https://differences.cleverappssg.com","business":"zareef","xsolla":{"appId":"191476"},"instant":{"appId":"466070618121604"},"facebook":{"appId":"278637090036923","shortname":"cleverdifferences"},"android":{"package":"com.cleverapps.differences","business":"cleverapps"},"amazon":{"package":"com.cleverapps.differences","id":"B08R7PCC89"},"ios":{"package":"com.cleverapps.differences","id":"1546227822","business":"cleverapps"},"ok":{"appId":"512000594608","shortname":"cleverdifferences"},"vk":{"appId":"7605538","shortname":"cleverdifferences"},"mm":{"appId":"782111"},"fotostrana":{"appId":"differences"},"yandex":{"appId":"192768"},"msstart":{"appId":"9NRGLLVFNMBS","name":"Rachel Holmes"}},"runes":{"name":"runes","deployment":"https://runes.cleverappssg.com","business":"cleverapps","xsolla":{"appId":"191473"},"instant":{"appId":"346516946289630","business":"zareef"},"facebook":{"appId":"582954732182317","shortname":"heroesofmatch"},"android":{"package":"com.cleverapps.runes"},"amazon":{"package":"com.cleverapps.runes","id":"B07WPW533K"},"ios":{"package":"com.cleverapps.runes","id":"1476535667"},"ok":{"appId":"1279575808","shortname":"heroesofmatch"},"vk":{"appId":"7016437","shortname":"heroesofmatch"},"mm":{"appId":"765770"},"yandex":{"appId":"177666"},"mbga":{"appId":"12026637"},"msstart":{"appId":"9NRFRSJPZHQN","name":"Heroes of Match 3"},"kongregate":{"appId":"324162","name":"heroes-of-match-3"},"spmbga":{"appId":"12026637-4"}},"adventure":{"name":"adventure","deployment":"https://adventure.cleverappssg.com","business":"cleverapps","xsolla":{"appId":"191471"},"instant":{"appId":"228942985416996"},"facebook":{"appId":"1311019545689756","shortname":"secretsofcharmland"},"android":{"package":"com.cleverapps.adventure"},"amazon":{"package":"com.cleverapps.adventure","id":"B08NXG74BD"},"ios":{"package":"com.cleverapps.adventure","id":"1541304616"},"ok":{"appId":"512000026303","shortname":"secretsofcharmland"},"vk":{"appId":"7139584","shortname":"thesecretsofcharmland"},"mm":{"appId":"766832"},"yandex":{"appId":"194873"},"msstart":{"appId":"9NZ3NT01X8GJ","name":"Secrets of Charmland"}},"scramble":{"name":"scramble","deployment":"https://scramble.labsystech.ru","business":"cleverapps","xsolla":{"appId":"191319"},"instant":{"appId":"170256430308082"},"facebook":{"appId":"229294690917786","shortname":"kittyscramble"},"android":{"package":"com.cleverapps.scramble"},"amazon":{"package":"com.cleverapps.scramble","id":"B073RHS2TQ"},"ios":{"package":"com.cleverapps.scramble","id":"1256286028"},"ok":{"appId":"512000595430","shortname":"kittyscramble"},"vk":{"appId":"7559026","shortname":"kittyscramble"},"mm":{"appId":"781640"},"mbga":{"appId":"12026922"},"fotostrana":{"appId":"scramble"},"yandex":{"appId":"173180"},"kongregate":{"appId":"324164","name":"kitty-scramble"},"msstart":{"appId":"9PM1VJLZ459J","name":"Kitty Scramble Start Game"},"spmbga":{"appId":"12026922-4"}}}',
inline: !0
}
}
},
crosspromo_adventure_en: {
urls: {
image: "@942f5bed1c.jpg"
}
},
crosspromo_adventure_ru: {
urls: {
image: "@0b5b5f5af5.jpg"
}
},
crosspromo_crocword_de: {
urls: {
image: "@ccd98533ee.jpg"
}
},
crosspromo_crocword_en: {
urls: {
image: "@6c936de59d.jpg"
}
},
crosspromo_crocword_es: {
urls: {
image: "@2ba73c6b08.jpg"
}
},
crosspromo_crocword_fr: {
urls: {
image: "@5867731206.jpg"
}
},
crosspromo_crocword_it: {
urls: {
image: "@ab74d3a8fd.jpg"
}
},
crosspromo_crocword_ja: {
urls: {
image: "@0e4351a208.jpg"
}
},
crosspromo_crocword_nl: {
urls: {
image: "@6e82de9c20.jpg"
}
},
crosspromo_crocword_ru: {
urls: {
image: "@7a0987b628.jpg"
}
},
crosspromo_differences_en: {
urls: {
image: "@7fb4281f92.jpg"
}
},
crosspromo_differences_ru: {
urls: {
image: "@cba6b3106f.jpg"
}
},
crosspromo_fairy_en: {
urls: {
image: "@d7ecff221f.jpg"
}
},
crosspromo_heroes_en: {
urls: {
image: "@98b394f62a.jpg"
}
},
crosspromo_heroes_ru: {
urls: {
image: "@112ff24c45.jpg"
}
},
crosspromo_hustlemerge_en: {
urls: {
image: "@c0eb445a6e.jpg"
}
},
crosspromo_hustlemerge_ru: {
urls: {
image: "@94a26fdbb6.jpg"
}
},
crosspromo_magicwords_de: {
urls: {
image: "@330d161377.jpg"
}
},
crosspromo_magicwords_en: {
urls: {
image: "@5196ff56b6.jpg"
}
},
crosspromo_magicwords_es: {
urls: {
image: "@db23af1222.jpg"
}
},
crosspromo_magicwords_fr: {
urls: {
image: "@9f6aa802bd.jpg"
}
},
crosspromo_magicwords_it: {
urls: {
image: "@39f89dfb3c.jpg"
}
},
crosspromo_magicwords_ru: {
urls: {
image: "@335b789f88.jpg"
}
},
crosspromo_mergecraft_en: {
urls: {
image: "@1b1f76bbf9.jpg"
}
},
crosspromo_mergecraft_ru: {
urls: {
image: "@ad18aa4695.jpg"
}
},
crosspromo_olympics_de: {
urls: {
image: "@50272d61b6.jpg"
}
},
crosspromo_olympics_en: {
urls: {
image: "@a6d1525987.jpg"
}
},
crosspromo_olympics_es: {
urls: {
image: "@dfd72ea224.jpg"
}
},
crosspromo_olympics_fr: {
urls: {
image: "@668019de5b.jpg"
}
},
crosspromo_olympics_it: {
urls: {
image: "@27fc816d50.jpg"
}
},
crosspromo_olympics_ru: {
urls: {
image: "@cb2e567aa2.jpg"
}
},
crosspromo_riddles_en: {
urls: {
image: "@f3cfae0719.jpg"
}
},
crosspromo_riddles_ru: {
urls: {
image: "@2a7336fc48.jpg"
}
},
crosspromo_runes_en: {
urls: {
image: "@281c56f068.jpg"
}
},
crosspromo_runes_ru: {
urls: {
image: "@2b1e993512.jpg"
}
},
crosspromo_scramble_en: {
urls: {
image: "@5eb4ea26ed.jpg"
}
},
crosspromo_scramble_fr: {
urls: {
image: "@5764fcd1b3.jpg"
}
},
crosspromo_scramble_ru: {
urls: {
image: "@3516002370.jpg"
}
},
crosspromo_spades_en: {
urls: {
image: "@b37e2c680f.jpg"
}
},
crosspromo_tripeaks_de: {
urls: {
image: "@ec772ff6d1.jpg"
}
},
crosspromo_tripeaks_en: {
urls: {
image: "@f518273582.jpg"
}
},
crosspromo_tripeaks_es: {
urls: {
image: "@01f7449192.jpg"
}
},
crosspromo_tripeaks_fr: {
urls: {
image: "@7e58e4a967.jpg"
}
},
crosspromo_tripeaks_it: {
urls: {
image: "@f438de5c0e.jpg"
}
},
crosspromo_tripeaks_ru: {
urls: {
image: "@764836be61.jpg"
}
},
crosspromo_window: {
virtual: !0,
injectTo: ["main"],
frameIds: ["badge"]
},
crosspromo_wondermerge_en: {
urls: {
image: "@b97c52bdeb.jpg"
}
},
crosspromo_woodenblock_en: {
urls: {
image: "@1c2d4eb0a5.jpg"
}
},
crosspromo_woodenblock_ru: {
urls: {
image: "@c685756c9d.jpg"
}
},
crosspromo_wordsoup_de: {
urls: {
image: "@b0729a6cae.jpg"
}
},
crosspromo_wordsoup_en: {
urls: {
image: "@5bc7266d66.jpg"
}
},
crosspromo_wordsoup_es: {
urls: {
image: "@3b08115596.jpg"
}
},
crosspromo_wordsoup_fr: {
urls: {
image: "@49b0de92fe.jpg"
}
},
crosspromo_wordsoup_it: {
urls: {
image: "@6ac183c30f.jpg"
}
},
crosspromo_wordsoup_ru: {
urls: {
image: "@ccdb2a9775.jpg"
}
},
crosspromo_zenmatch_en: {
urls: {
image: "@187b6accc8.jpg"
}
},
crosspromo_zenmatch_ru: {
urls: {
image: "@7701458a6d.jpg"
}
},
cryptex: {
urls: {}
},
custom_digits: {
urls: {
png: "@fe2abe9fa7.png",
json: "@bcba28445a.json"
},
jsons: {
atlas: "0"
},
frames: {
custom_digits38pt_0: "0",
custom_digits38pt_1: "1",
custom_digits38pt_2: "2",
custom_digits38pt_3: "3",
custom_digits38pt_4: "4",
custom_digits38pt_5: "5",
custom_digits38pt_6: "6",
custom_digits38pt_7: "7",
custom_digits38pt_8: "8",
custom_digits38pt_9: "9",
custom_digits38pt_asterisk: "a",
custom_digits38pt_colon: "b",
custom_digits38pt_minus: "c",
custom_digits38pt_percent: "d",
custom_digits38pt_plus: "e",
custom_digits38pt_slash: "f",
custom_digits38pt_space: "g",
custom_digits38pt_x: "h"
}
},
custom_reward: {
virtual: !0,
injectTo: ["main"],
frameIds: ["icon_bg", "tooltip_bubble", "tooltip_arrow"],
jsonIds: ["piggybank_icon_json"],
soundIds: ["piggybank_coins_effect", "piggybank_coins_full_effect", "piggy_reward_open", "piggy_reward_close"]
},
dailytasks: {
urls: {
prize_view_created_effect: "$2ab1bf8cfb.mp3",
png: "@d90319355b.png",
json: "@4e23fa2fc8.json"
},
jsons: {
atlas: "0",
flash_json: "1",
prize_json: "2",
replace_all_json: "3",
undo_json: "4"
},
frames: {
ad_icon_png: "0",
kred_icon_png: "1",
ok_icon_png: "2",
sign_in_button_on_png: "3",
sign_in_button_png: "4",
swap_task_icon: "5",
nostroke56pt_0: "6",
nostroke56pt_1: "7",
nostroke56pt_2: "8",
nostroke56pt_3: "9",
nostroke56pt_4: "a",
nostroke56pt_5: "b",
nostroke56pt_6: "c",
nostroke56pt_7: "d",
nostroke56pt_8: "e",
nostroke56pt_9: "f",
nostroke56pt_asterisk: "g",
nostroke56pt_colon: "h",
nostroke56pt_minus: "i",
nostroke56pt_percent: "j",
nostroke56pt_plus: "k",
nostroke56pt_point: "l",
nostroke56pt_slash: "m",
nostroke56pt_space: "n",
nostroke56pt_x: "o",
default41pt_0: "p",
default41pt_1: "q",
default41pt_2: "r",
default41pt_3: "s",
default41pt_4: "t",
default41pt_5: "u",
default41pt_6: "v",
default41pt_7: "w",
default41pt_8: "x",
default41pt_9: "y",
default41pt_asterisk: "z",
default41pt_colon: "A",
default41pt_minus: "B",
default41pt_percent: "C",
default41pt_plus: "D",
default41pt_point: "E",
default41pt_slash: "F",
default41pt_space: "G",
default41pt_x: "H",
default56pt_0: "I",
default56pt_1: "J",
default56pt_2: "K",
default56pt_3: "L",
default56pt_4: "M",
default56pt_5: "N",
default56pt_6: "O",
default56pt_7: "P",
default56pt_8: "Q",
default56pt_9: "R",
default56pt_asterisk: "S",
default56pt_colon: "T",
default56pt_minus: "U",
default56pt_percent: "V",
default56pt_plus: "W",
default56pt_point: "X",
default56pt_slash: "Y",
default56pt_space: "Z",
default56pt_x: "10",
underline_png: "11",
attention_png: "12",
coin_icon_png: "13",
gold_icon_png: "14",
delimiter_blue: "15",
bar_blue_large: "16",
bar_blue_small: "17",
bar_blue: "18",
bar_green_large: "19",
bar_green: "1a",
delimiter_orange: "1b",
bar_orange_large: "1c",
bar_orange_small: "1d",
bar_orange: "1e",
delimiter_red: "1f",
bar_red_large: "1g",
bar_red_small: "1h",
bar_red: "1i",
bg_dark_large: "1j",
bg_dark_small: "1k",
bg_dark: "1l",
bg_green_large: "1m",
bg_green: "1n",
bonussale_gift: "1o",
shop_coin_png: "1p",
coin_small_png: "1q",
reward_coin_png: "1r",
life_small_png: "1s",
life_unlim_small: "1t",
life_unlim: "1u",
life_png: "1v",
noads_png: "1w",
shop_gold_png: "1x",
gold_small_png: "1y",
reward_gold_png: "1z",
simple_star_png: "1A",
bg_simple: "1B",
bar_simple: "1C",
bg_vip: "1D",
bar_vip: "1E",
blue_button_on_png: "1F",
blue_button_png: "1G",
button_disabled_png: "1H",
button_on_png: "1I",
button_png: "1J",
help_button_off_png: "1K",
help_button_on_png: "1L",
help_button_png: "1M",
red_button_on: "1N",
red_button: "1O",
small_blue_button_on: "1P",
small_blue_button: "1Q",
small_button_off: "1R",
small_button_on: "1S",
small_button: "1T",
daily_task_icon_daily_cup_png: "1U",
bg_dailytask: "1V",
bar_dailytask: "1W",
daily_task_bg_completed_png: "1X",
daily_task_bg_png: "1Y",
daily_task_mark_png: "1Z",
mark_png: "1Z",
daily_task_icon_bg_png: "20",
daily_task_icon_frame_completed_png: "21",
daily_task_icon_frame_png: "22",
daily_task_icon_complete_all_png: "23",
daily_task_icon_spend_coins_png: "24",
daily_task_icon_spend_gold_png: "25",
complete_all_bg_png: "26",
big_timer_bg_png: "27",
big_timer_png: "28",
scrollbar_png: "29",
daily_task_icon_watch_ads_png: "2a",
daily_task_icon_use_booster_png: "2b",
daily_task_burn_lines_png: "2c",
daily_task_icon_hard_level_png: "2d",
daily_task_icon_pass_level_png: "2e",
daily_task_icon_mini_game_png: "2f",
daily_task_score_points_png: "2g",
booster_clear_pieces_png: "2h",
booster_replace_all_png: "2i",
booster_undo_piece_png: "2j",
clear_pieces_png: "2k"
}
},
dev_buttons: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: "plus orangery_bg_light orangery_bg_dark snapshot_rec snapshot_stop snapshots_create_clip snapshot label_rec label_playback icon_edit icon_error icon_report icon_stages".split(" ")
},
dialogues: {
virtual: !0,
injectTo: ["main"],
frameIds: ["dialogue_arrow_png", "bg_png", "dialogue_name"]
},
dialogues_minimal: {
virtual: !0,
injectTo: ["main"],
frameIds: ["bg_minimal_png", "mini_arrow_bg_png"],
jsonIds: ["bg_person"]
},
digits: {
virtual: !0,
injectTo: "choosesave_window dailytasks game starter_pack tile_shop main".split(" "),
frameIds: "underline_png nostroke56pt_0 nostroke56pt_1 nostroke56pt_2 nostroke56pt_3 nostroke56pt_4 nostroke56pt_5 nostroke56pt_6 nostroke56pt_7 nostroke56pt_8 nostroke56pt_9 nostroke56pt_colon nostroke56pt_slash nostroke56pt_plus nostroke56pt_minus nostroke56pt_x nostroke56pt_space nostroke56pt_asterisk nostroke56pt_percent nostroke56pt_point default41pt_0 default41pt_1 default41pt_2 default41pt_3 default41pt_4 default41pt_5 default41pt_6 default41pt_7 default41pt_8 default41pt_9 default41pt_colon default41pt_slash default41pt_plus default41pt_minus default41pt_x default41pt_space default41pt_asterisk default41pt_percent default41pt_point default56pt_0 default56pt_1 default56pt_2 default56pt_3 default56pt_4 default56pt_5 default56pt_6 default56pt_7 default56pt_8 default56pt_9 default56pt_colon default56pt_slash default56pt_plus default56pt_minus default56pt_x default56pt_space default56pt_asterisk default56pt_percent default56pt_point".split(" ")
},
episode_0: {
urls: {
json: "~#/02da2d3d3d.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 0,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_1: {
urls: {
json: "~#/9cbac7dfa2.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 1,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}]
}
}
},
episode_10: {
urls: {
json: "~#/ad69e6b6db.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 10,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}]
}
}
},
episode_11: {
urls: {
json: "~#/d4c8873008.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 11,
levelsAmount: 15,
levels: [{}, {
tag: "hard"
}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_12: {
urls: {
json: "~#/8727914971.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 12,
levelsAmount: 15,
levels: [{}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_13: {
urls: {
json: "~#/3374347c00.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 13,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_14: {
urls: {
json: "~#/d246103ba5.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 14,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_15: {
urls: {
json: "~#/e8ae752b0b.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 15,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_16: {
urls: {
json: "~#/33e03c2e7f.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 16,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_17: {
urls: {
json: "~#/4407e63f9b.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 17,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_18: {
urls: {
json: "~#/64c7d835bb.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 18,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_19: {
urls: {
json: "~#/331e811db6.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 19,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_2: {
urls: {
json: "~#/fad54c175a.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 2,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}]
}
}
},
episode_20: {
urls: {
json: "~#/fc64ff5312.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 20,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {
tag: "hard"
}]
}
}
},
episode_3: {
urls: {
json: "~#/b773adad36.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 3,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {
tag: "hard"
}, {}, {}]
}
}
},
episode_4: {
urls: {
json: "~#/f29f217f98.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 4,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}]
}
}
},
episode_5: {
urls: {
json: "~#/bee625d3bc.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 5,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}]
}
}
},
episode_6: {
urls: {
json: "~#/b42bae1405.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 6,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}]
}
}
},
episode_7: {
urls: {
json: "~#/560e539570.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 7,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}]
}
}
},
episode_8: {
urls: {
json: "~#/f96fb4f311.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 8,
levelsAmount: 15,
levels: [{}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}, {}]
}
}
},
episode_9: {
urls: {
json: "~#/386e8c104f.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: 9,
levelsAmount: 15,
levels: [{}, {}, {
tag: "hard"
}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {
tag: "hard"
}, {}, {}]
}
}
},
episode_score_mode: {
urls: {
json: "~#/ccba510200.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: "score_mode",
levelsAmount: 1,
levels: [{}]
}
}
},
episode_test: {
urls: {
json: "~#/f04b606210.json"
},
jsons: {
levels: "0"
},
meta: {
episode: {
episodeNo: "test",
levelsAmount: 9,
levels: [{}, {}, {}, {}, {}, {}, {}, {}, {}]
}
}
},
episodes_resources: {
urls: {}
},
exclamations: {
virtual: !0,
injectTo: ["game"],
jsonIds: ["#_json"]
},
extend_unlimited_lives_window: {
urls: {
lives_effect: "$22fbb93ed3.mp3",
png: "@ebb8b2b82a.png",
json: "@5215954c02.json"
},
jsons: {
atlas: "0",
lives_json: "1"
},
important: ["lives_effect"]
},
extrawindow: {
urls: {}
},
fallsale: {
urls: {
sale_showup_effect: "$864440672b.mp3",
png: "@9005e34bc5.png",
json: "@e6d7e4c8e9.json"
},
jsons: {
atlas: "0",
sale_bg: "1"
},
important: ["sale_showup_effect"],
debug: !0
},
finger: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: ["tutorial_click_png", "tutorial_hand_png"],
jsonIds: ["arrow_json"],
soundIds: ["press_effect"]
},
fireworks: {
urls: {
confetti_effect: "$15eb33fbd5.mp3",
png: "@b6700ed89e.png",
json: "@0f495b8c23.json"
},
jsons: {
atlas: "0",
confetti_json: "1"
},
important: ["confetti_effect"]
},
flying_ad: {
virtual: !0,
injectTo: ["main"],
jsonIds: ["#_json"],
soundIds: ["fly_effect", "show_up_effect"]
},
flying_hint: {
urls: {}
},
game: {
urls: {
task_done_sfx: "$c8ff12607c.mp3",
reward_gold_effect: "$4ee31e6446.mp3",
timer_start: "$5640ec4b29.mp3",
timer_tick: "$583e39617d.mp3",
press_effect: "$de043d48db.mp3",
game_message_effect: "$d6bfd65732.mp3",
openlevel_hard_effect: "$d43daddcb6.mp3",
win_effect: "$1f90a63415.mp3",
coins_effect: "$8e71c0d2cf.mp3",
lives_fly_finish_effect: "$158e7e348d.mp3",
booster_bomb_effect: "$bbbc0442e9.mp3",
booster_replace_effect: "$3dffe04d33.mp3",
booster_undo_effect: "$c39faca4e8.mp3",
letter_mark_collect_effect: "$3ba70fbab4.mp3",
explode_letter_effect: "$8296db6bbd.mp3",
drag_effect: "$42abe59fad.mp3",
continue_effect: "$93664e8419.mp3",
explode_mark_effect: "$fa40682914.mp3",
explosion_piece_effect: "$fe23a0046f.mp3",
ice_stage_effect: "$229399976c.mp3",
lose_animation_effect: "$3ea085d63f.mp3",
lose_effect: "$16d8b147ca.mp3",
blue_mark_collect_effect: "$c941230d0a.mp3",
orange_mark_collect_effect: "$3a8ac8481b.mp3",
background_music_game: "$9980eb3c23.mp3",
pink_mark_collect_effect: "$ef93f23a8f.mp3",
message_effect: "$61c10ee6a4.mp3",
goal_is_completed: "$088dae15b0.mp3",
fly_to_goal: "$546d53e60b.mp3",
nomoves_exclamation_effect: "$afdd55f4e5.mp3",
openlevel_effect: "$9fad20a18a.mp3",
prolongation_effect: "$e1d57fc2be.mp3",
explode_line_effect: "$e99933c389.mp3",
tile_set_effect: "$37270f570c.mp3",
wrong_effect: "$58d88e37c5.mp3",
png: "@681a355a74.png",
json: "@bb69bf9d0f.json"
},
jsons: {
appear_json: "1",
arrow_json: "2",
atlas: "0",
bonus_json: "3",
cell_light_json: "4",
cell_remove_json: "5",
clear_bang_explode_json: "6",
clear_bang_json: "7",
coins_animation_json: "8",
coins_reward_json: "9",
complete_json: "a",
crystal_blue_goal_json: "b",
crystal_orange_goal_json: "c",
crystal_pink_goal_json: "d",
exclamations_json: "e",
explode_combo_json: "f",
explode_goal_json: "g",
explode_hint_json: "h",
explode_hint_vertical_json: "i",
flash_json: "j",
hovering_json: "k",
ice_json: "l",
label_moves_json: "m",
letter_mark_json: "n",
level_failed_small_hearts_json: "o",
line_explode_json: "p",
lose_json: "q",
mode_frame: "r",
piggy_bank_reward_json: "s",
rays_json: "t",
replace_all_json: "u",
score_goal_json: "v",
show_up_json: "w",
sparks_json: "x",
take_json: "y",
timer_json: "z",
undo_json: "A"
},
frames: {
android_avatar: "0",
ios_avatar: "1",
ad_icon_png: "2",
kred_icon_png: "3",
ok_icon_png: "4",
sign_in_button_on_png: "5",
sign_in_button_png: "6",
snapshots_create_clip: "7",
icon_edit: "8",
icon_error: "9",
snapshot_rec: "a",
icon_report: "b",
snapshot: "c",
icon_stages: "d",
snapshot_stop: "e",
label_playback: "f",
label_rec: "g",
line_png: "h",
foreground_png: "i",
nostroke56pt_0: "j",
nostroke56pt_1: "k",
nostroke56pt_2: "l",
nostroke56pt_3: "m",
nostroke56pt_4: "n",
nostroke56pt_5: "o",
nostroke56pt_6: "p",
nostroke56pt_7: "q",
nostroke56pt_8: "r",
nostroke56pt_9: "s",
nostroke56pt_asterisk: "t",
nostroke56pt_colon: "u",
nostroke56pt_minus: "v",
nostroke56pt_percent: "w",
nostroke56pt_plus: "x",
nostroke56pt_point: "y",
nostroke56pt_slash: "z",
nostroke56pt_space: "A",
nostroke56pt_x: "B",
default41pt_0: "C",
default41pt_1: "D",
default41pt_2: "E",
default41pt_3: "F",
default41pt_4: "G",
default41pt_5: "H",
default41pt_6: "I",
default41pt_7: "J",
default41pt_8: "K",
default41pt_9: "L",
default41pt_asterisk: "M",
default41pt_colon: "N",
default41pt_minus: "O",
default41pt_percent: "P",
default41pt_plus: "Q",
default41pt_point: "R",
default41pt_slash: "S",
default41pt_space: "T",
default41pt_x: "U",
default56pt_0: "V",
default56pt_1: "W",
default56pt_2: "X",
default56pt_3: "Y",
default56pt_4: "Z",
default56pt_5: "10",
default56pt_6: "11",
default56pt_7: "12",
default56pt_8: "13",
default56pt_9: "14",
default56pt_asterisk: "15",
default56pt_colon: "16",
default56pt_minus: "17",
default56pt_percent: "18",
default56pt_plus: "19",
default56pt_point: "1a",
default56pt_slash: "1b",
default56pt_space: "1c",
default56pt_x: "1d",
big_digits72pt_0: "1e",
big_digits72pt_1: "1f",
big_digits72pt_2: "1g",
big_digits72pt_3: "1h",
big_digits72pt_4: "1i",
big_digits72pt_5: "1j",
big_digits72pt_6: "1k",
big_digits72pt_7: "1l",
big_digits72pt_8: "1m",
big_digits72pt_9: "1n",
big_digits72pt_asterisk: "1o",
big_digits72pt_colon: "1p",
big_digits72pt_minus: "1q",
big_digits72pt_percent: "1r",
big_digits72pt_plus: "1s",
big_digits72pt_point: "1t",
big_digits72pt_slash: "1u",
big_digits72pt_space: "1v",
big_digits72pt_x: "1w",
big_digits97pt_0: "1x",
big_digits97pt_1: "1y",
big_digits97pt_2: "1z",
big_digits97pt_3: "1A",
big_digits97pt_4: "1B",
big_digits97pt_5: "1C",
big_digits97pt_6: "1D",
big_digits97pt_7: "1E",
big_digits97pt_8: "1F",
big_digits97pt_9: "1G",
big_digits97pt_asterisk: "1H",
big_digits97pt_colon: "1I",
big_digits97pt_minus: "1J",
big_digits97pt_percent: "1K",
big_digits97pt_plus: "1L",
big_digits97pt_point: "1M",
big_digits97pt_slash: "1N",
big_digits97pt_space: "1O",
big_digits97pt_x: "1P",
underline_png: "1Q",
pixel_png: "1R",
orangery_bg_dark: "1S",
orangery_bg_light: "1T",
plus: "1U",
attention_png: "1V",
avatar_frame: "1W",
avatar_frame2: "1X",
default_avatar: "1Y",
user_avatar: "1Z",
animations_coin: "20",
coin_icon_png: "21",
gold_icon_png: "22",
delimiter_blue: "23",
bar_blue_large: "24",
bar_blue_small: "25",
bar_blue: "26",
bar_green_large: "27",
bar_green: "28",
delimiter_orange: "29",
bar_orange_large: "2a",
bar_orange_small: "2b",
bar_orange: "2c",
delimiter_red: "2d",
bar_red_large: "2e",
bar_red_small: "2f",
bar_red: "2g",
bg_dark_large: "2h",
bg_dark_small: "2i",
bg_dark: "2j",
bg_green_large: "2k",
bg_green: "2l",
goals_bg_png: "2m",
text_bg_png: "2n",
bonussale_gift: "2o",
shop_coin_png: "2p",
coin_small_png: "2q",
reward_coin_png: "2r",
life_small_png: "2s",
life_unlim_small: "2t",
life_unlim: "2u",
life_png: "2v",
noads_png: "2w",
shop_gold_png: "2x",
gold_small_png: "2y",
reward_gold_png: "2z",
simple_star_png: "2A",
bg_simple: "2B",
bar_simple: "2C",
bg_vip: "2D",
bar_vip: "2E",
xmas_menubar: "2F",
blue_button_on_png: "2G",
blue_button_png: "2H",
button_disabled_png: "2I",
button_on_png: "2J",
button_png: "2K",
help_button_off_png: "2L",
help_button_on_png: "2M",
help_button_png: "2N",
red_button_on: "2O",
red_button: "2P",
small_blue_button_on: "2Q",
small_blue_button: "2R",
small_button_off: "2S",
small_button_on: "2T",
small_button: "2U",
background_png: "2V",
check_mark_png: "2W",
back_button_on_png: "2X",
back_button_png: "2Y",
back_icon_png: "2Z",
control_button_on_png: "30",
control_button_png: "31",
menu_icon_png: "32",
switch_icon_png: "33",
bg_dailytask: "34",
bar_dailytask: "35",
icon: "36",
notification_bg: "37",
gamemessage_bg_png: "38",
game_moves_icon: "39",
high_score_icon: "3a",
new_high_score_icon: "3b",
level_failed_heart_empty_png: "3c",
level_failed_heart_png: "3d",
moves_icon: "3e",
menubar_bg_png: "3f",
bar_timer_png: "3g",
coin_png: "3h",
menubar_life_png: "3i",
plus_button_on_png: "3j",
plus_button_png: "3k",
gold_png: "3l",
unlim_png: "3m",
reward_element_bg_png: "3n",
piggy_bank_reward_icon: "3o",
timer_bg_png: "3p",
timer_png: "3q",
tooltip_shadow_arrow_png: "3r",
tooltip_arrow_png: "3s",
tooltip_bg_png: "3t",
tutorial_click_png: "3u",
tutorial_hand_png: "3v",
grid_border_png: "3w",
cell_bg_blue_png: "3x",
cell_bg_cyan_png: "3y",
cell_bg_gray_png: "3z",
cell_bg_green_png: "3A",
cell_bg_orange_png: "3B",
cell_bg_purple_png: "3C",
cell_bg_red_png: "3D",
cell_bg_yellow_png: "3E",
high_score_bg: "3F",
hint_bg_png: "3G",
hint_border_png: "3H",
cell_crystal_blue_png: "3I",
cell_crystal_blue_disable_png: "3J",
cell_crystal_orange_disable_png: "3K",
cell_crystal_pink_disable_png: "3L",
cell_crystal_orange_png: "3M",
cell_crystal_pink_png: "3N",
pieces_bg: "3O",
grid_cell_bg_png: "3P",
score_bg: "3Q",
label_moves_png: "3R",
booster_clear_pieces_png: "3S",
booster_replace_all_png: "3T",
booster_undo_piece_png: "3U",
clear_pieces_png: "3V",
combo_digits90pt_0: "3W",
combo_digits90pt_1: "3X",
combo_digits90pt_2: "3Y",
combo_digits90pt_3: "3Z",
combo_digits90pt_4: "40",
combo_digits90pt_5: "41",
combo_digits90pt_6: "42",
combo_digits90pt_7: "43",
combo_digits90pt_8: "44",
combo_digits90pt_9: "45",
combo_digits90pt_asterisk: "46",
combo_digits90pt_colon: "47",
combo_digits90pt_minus: "48",
combo_digits90pt_percent: "49",
combo_digits90pt_plus: "4a",
combo_digits90pt_slash: "4b",
combo_digits90pt_space: "4c",
combo_digits90pt_x: "4d",
mission_letter_png: "4e"
},
important: "timer_start timer_tick win_effect drag_effect lose_effect explode_line_effect tile_set_effect wrong_effect".split(" ")
},
game_background_horizontal: {
urls: {
background: "@6eff052c6c.png"
},
meta: {
horizontal: !0
}
},
game_background_vertical: {
urls: {
background: "@21373abbac.png"
},
meta: {
vertical: !0
}
},
gamemessage: {
virtual: !0,
injectTo: ["game"],
frameIds: ["#_bg_png"],
soundIds: ["game_message_effect"]
},
growth_fund: {
urls: {}
},
guidewindow_arrows: {
virtual: !0,
injectTo: ["piggybankruleswindow", "lettertournamentguidewindow"],
jsonIds: ["arrows"]
},
help_button: {
virtual: !0,
injectTo: ["tile_shop", "main"],
frameIds: ["#_png", "#_on_png", "#_off_png"]
},
highscore: {
virtual: !0,
injectTo: ["game"],
frameIds: ["high_score_icon", "new_high_score_icon"]
},
language_ar: {
urls: {
json: "~#/e24b2fea0e.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_de: {
urls: {
json: "~#/877ec479a7.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_en: {
urls: {},
jsons: {
type_json: {
data: '{"AddMovesWindow.nearlyDoneGiveUp":"You\'re have a new score!","Blocks.TutorialMessage1":"Drag and drop blocks to complete rows and clear them!","Blocks.TutorialMessage2":"Destroy lines to earn crystals and conquer the challenge!","Blocks.TutorialMessage.Ice":"Burn lines to break the ice.","ProlongationWindow.addMoves":"Snap 3 perfect blocks together. Watch your score soar!","LocalPushes.LETS_PLAY.Title":["Block Pro Adventure starts HERE! \ud83d\udca5","Blast Blocks with Friends! \ud83d\udd14","Unleash Your unique Skills! \ud83e\udde9","Experience Block-Blowing Thrills! \ud83d\ude80","Dominate the Block Blasting Arena! \ud83d\udcaa","Join the Block Pro Fun \u2013 Don\'t Wait! \u23f0","Blast Blocks, Beat Friends! \ud83c\udfc6"],"LocalPushes.LETS_PLAY":["Charge Up! New Block Blasting Adventures Are Live! \ud83c\udf0a","New challenge: Destory more blocks! \ud83e\udde9","Prove your block-blasting mastery NOW! \ud83d\udcaa","Tap to unlock infinite block-blasting fun! \u2013 Don\'t miss it! \u231b","Solve every block blast puzzle and claim your glory! \ud83c\udfc5","Dominate the leaderboards and humble your rivals! \ud83d\udd79\ufe0f","Think you\'re the best? Prove it on the block blast leaderboards! \ud83c\udfc1"],"ProlongationWindow.title":"No more moves!","ReplaceAllBooster.force":"Replace the blocks!","ClearPiecesBooster.force":"Clear all Blocks","UndoPieceBooster.force":"Undo it!","GameMessage.text":"Target","GameMessage.highScoreMode.text":"Collected points","Blocks.score":"SCORE:","Missions.LetterTournament.Title":"Winged Spectacles","Missions.LetterTournament.Rules1":"Match blocks to catch all butterflies in your sight!","LetterTournamentGuideWindow.firstStage":"Catch butterflies","Claim.Button":"Claim","DailyTask.61.Title":"Score Points","DailyTask.62.Title":"Explode Lines"}',
inline: !0
},
common_json: {
data: '{"en":"English","de":"Deutsch","es":"Espa\u00f1ol","pt":"Portugu\u00eas","fr":"Fran\u00e7ais","it":"Italiano","nl":"Nederlands","ar":"\u0639\u0631\u0628\u0649","ja":"\u65e5\u672c\u8a9e","ko":"\ud55c\uad6d\uc5b4","ru":"\u0420\u0443\u0441\u0441\u043a\u0438\u0439","tr":"T\u00fcrk\u00e7e","zh":"\u4e2d\u6587","pl":"Polskie","lv":"Latvijas","RestartWindow.LocalStorageCorrupted":"Your locally saved game is corrupted, please reload the game to restore the data from our server","RestartWindow.ButtonMessage":"Reload","RestartWindow.AnErrorOccured":"Please check your internet connection","RestartWindow.NewVersionAvailable":"New version is available. Please reload the game.","RestartWindow.NewVersionTitle":"Upgrade available!","RestartWindow.OnError":"An error occurred","RestartWindow.OnChangeLoginStatus":"You have changed the login status of your Samsung account. Need to restart the game","RestartWindow.Title":"Error","ChooseSaveWindow.Title":"Save progress","ChooseSaveWindow.level":"Level","ChooseSaveWindow.text":"Cloud and device save do not match, please select which save file to use","ChooseSaveWindow.local":"Current status","ChooseSaveWindow.server":"%{time} ago","ChooseSaveWindow.acceptServer":"Accept cloud","ChooseSaveWindow.acceptLocal":"Accept device","dayTimeString":"%{day}d.%{hr}h.","hoursMinutesString":"%{hr}h.%{min}m.","daysString":"%{day}d.","hoursString":"%{hr}h.","minutesString":"%{min}m.","minutesFullString":"%{min} minutes","daysFullString":"%{day} days","hoursFullString":"%{hr} hours","TimePeriod.1 day":"1 day","TimePeriod.2 day":"2 days","TimePeriod.3 day":"3 days","TimePeriod.5 day":"5 days","TimePeriod.7 day":"7 days","TimePeriod.9 day":"9 days","TimePeriod.10 day":"10 days","TimePeriod.6 hours":"6 hours","TimePeriod.12 hours":"12 hours","TimePeriod.OneHour":"1 hour","TimePeriod.TwoHours":"2 hours","TimePeriod.ThreeHours":"3 hours","TimePeriod.45 minutes":"45 minutes","TimePeriod.30 minutes":"30 minutes","TimePeriod.15 minutes":"15 minutes","TimePeriod.10 minutes":"10 minutes","Hint":"Hint","Help":"Community","Loading":"Loading","Wait":"Wait...","HelpButton.text1":"Ask","HelpButton.text2":"for Help","Shop":"Gold shop","Shop.Coins.Title":"Gold Shop","Shop.Energy.Title":"Energy Shop","Language":"Language","Finished":"Finished","Ready":"Ready","GameMessage.Victory":"ALL DONE!","VictoryWindow.Victory":"LEVEL CLEARED!","AboutWindow.title":"About","AboutWindow.text":"%{gameTitle}. All rights reserved. Build version %{version}","AboutWindow.terms":"Terms of Use","AboutWindow.privacy":"Privacy Policy","SettingsWindow.title":"Settings","SettingsWindow.InviteFriends":"Invite Friends","InviteFriends.message":"Join this fabulous game!","SignIn":"Sign in","SettingsWindow.SignIn.Footnote":"To save progress:","SettingsWindow.UserID.copy":"Copy ID","SettingsWindow.UserID.copied":"Copied game ID to clipboard","SettingsWindow.Logout":"Logout","SettingsWindow.RedeemCode":"Redeem code","FakeLoginWindow.title":"Fake Login","FakeLoginWindow.Login":"Login","FakeLoginWindow.CustomID":"Or enter a custom ID:","FakeLoginWindow.ChooseUser":"Choose user:","FakeLoginWindow.CurrentUserID":"Current user ID: %{id}","RateWindow.title":"Rate the game!","RateWindow.text":"If you love playing %{gameTitle}, please take a moment to rate it!","helpInviteFriends.title":"Lets play","helpInviteFriends.message":"Thanks for help! join this game, let\'s play together!","ClaimPrize.Button.text":"Claim the prize","Friends.You":"You","FriendRequestsWindow.title":"Messages","sentHelpRequest.title":"I sent you help","sentHelpRequest.message":"Let\'s play together!","thanksForHelpRequest.title":"Thanks for you help","thanksForHelpRequest.message":"Thank you very much!","sendCoinsRequest.title":"Catch gold!","sendCoinsRequest.message":"I sent you gold, launch the game to get them!","askCoinsRequest.title":"Send me gold, please!","askCoinsRequest.message":"I need your help, start the game and send me gold!","thanksForCoinsRequest.title":"Thank you for gold!","thanksForCoinsRequest.message":"Thank you for sending me gold, you helped me a lot!","stuckHelpGold.title":"Catch gold!","stuckHelpGold.message":"I sent you gold, launch the game to get them!","Soon":"Soon!","Now":"Now!","Next":"Next","Close":"Close","Play":"Play","Replay":"Replay","GotIt":"Got it!","Select":"Select","Take":"Take","GetIt":"Get it!","Unlock":"Unlock","Locked":"Locked","Share":"Share","Bought":"Bought","WatchAd":"Watch Ad","AdError.rewarded_not_supported":"Ads unavailable.","AdError.rewarded_unknown_error":"Play ad error.","AdError.rewarded_not_found":"No video to show now - it can happen sometimes.","AdError.rewarded_ad_block":"AdBlock prevents ad to show.","AdError.rewarded_throttled":"Too many ad requests. Please try again later.","AdError.ad_already_running":"Another ad already opened.","Cancelled":"Request Cancelled","GameScene.AskedHelp":"You asked for help!","facebook":"Facebook","ok":"Odnoklassniki","vk":"Vkontakte","xsolla":"Xsolla","mbga":"Yahoo Mobage","yandex":"Yandex","plinga":"Game Distribution","msstart":"MSN","androidsocial-facebook":"Google or Facebook","androidsocial":"Google","applesocial-facebook":"Apple or Facebook","applesocial":"Apple","SignInWindow.text":"To restore or save your progress, please connect your account!","SignInWindow.TryAgain":"Failed login. Try again.","FakePayments.Buying":"Buying?","FakePayments.Cancelled":"Fake payment cancelled","Product.YouBought":"You bought %{coins} rubies!","Product.SoftCurrencyBought":"You bought %{coins} coins!","PurchaseError.purchase_already_open":"Purchase in processing. Try again later","PurchaseError.product_not_found":"This product is not available","PurchaseError.invalid_email":"Provided email is invalid.","PurchaseError.purchase_timeout":"Purchase request timed out.","PurchaseError.purchase_unknown_error":"Error occurred during purchase.","PurchaseError.login_required":"To make a payment, you need to login","PurchaseError.email_required":"Need email to make a payment","Share.ShareFailed":"Sharing failed, error #","SocialManager.FailedLogging":"Failed logging in!","SocialManager.Connected":"Successfully connected!","SocialManager.Welcome":"Welcome, %{userName}!","SocialManager.Initialization":"Connecting in progress...","Synchronizer.LoadingFailed":"Loading update failed!","ReloadWindow.UpdateLoaded":"Update loaded!","ReloadWindow.YouHaveSavedGame":"You have a more advanced Saved game on our server.","ReloadWindow.WeStoreGames":"We store games in the cloud, so You can enjoy %{gameTitle} on any device!","ReloadWindow.Title":"Saved game found!","ReloadWindow.Downloading":"Downloading...","ReloadWindow.UpdateNow":"Update now!","TutorialFinishWindow.title":"Well done!","TutorialFinishWindow.text":"Tutorial completed! Guess the last word and have fun!","Bonus!":"Bonus!","Cancel":"Cancel","Submit":"Submit","OK":"OK","TimeLeft":"Time left: ","Shop.Gold500.Title":"Stack of rubies","Shop.Gold500.Description":"Stack of rubies - 200 rubies!","Shop.Gold1800.Title":"Pile of rubies","Shop.Gold1800.Description":"Pile of rubies - 900 rubies!","Shop.Gold3800.Title":"Heap of rubies","Shop.Gold3800.Description":"Heap of rubies - 2,100 rubies!","Shop.Gold6000.Title":"Mountain of rubies","Shop.Gold6000.Description":"Mountain of rubies - 3,500 rubies!","Shop.Gold25000.Title":"Ruby treasure","Shop.Gold25000.Description":"Ruby treasure - 14,000 rubies!","Shop.CheapProduct.Title":"1 ruby","Shop.CheapProduct.Description":"Cheap product - 1 ruby!","Shop.Coins350.Title":"Stack of Coins","Shop.Coins350.Description":"Stack of Coins - 350 coins!","Shop.Coins1100.Title":"Pile of Coins","Shop.Coins1100.Description":"Pile of Coins - 1100 coins!","Shop.Coins3000.Title":"Heap of Coins","Shop.Coins3000.Description":"Heap of Coins - 3,000 coins!","Shop.Coins7000.Title":"Mountain of Coins","Shop.Coins7000.Description":"Mountain of Coins - 7,000 coins!","Shop.SubsWeek.Title":"Premium Subscription 1 day Trial","Shop.SubsWeek.Description":"Premium Subscription on two weeks and one day FREE!","Shop.SubsWeek.ThreeDays.Title":"Premium Subscription 3 days Trial","Shop.SubsWeek.ThreeDays.Description":"Premium Subscription on week and three days FREE!","Shop.SubsWeek.BoughtMessage":"You bought Premium Subscription!","Shop.SubsMonth.Title":"Monthly Premium","Shop.SubsMonth.Description":"Monthly Premium Subscription","Shop.SubsMonth.BoughtMessage":"You bought monthly subscription!","Shop.growthFund.title":"Growth fund","Shop.growthFund.description":"Level up and deposit rubies to buy them with a discount!","Shop.growthFund.boughtMessage":"You bought Growth fund!","LoadingEpisode":"Loading episode","LoadingPromo":"Loading promo","SelectFriendWindow.askLives.title":"Ask lives","SelectFriendWindow.askLives.noFriendsText":"You need at least one friend in the game to ask for lives!","SelectFriendWindow.askStars.title":"Ask stars","SelectFriendWindow.askStars.noFriendsText":"You need at least one friend in the game to ask for stars!","TryAgain":"Try again","Quit":"Quit","Buy":"Buy","Back":"Back","Exit":"Exit","Home":"Home","Watch":"Watch","Remove":"Remove","Boost":"Boost","PlayOn":"Play On","Yes":"Yes","No":"No","GiveUp":"Give up","Accept":"Accept","ask":"ask","Ask":"Ask","AskCoins":"Ask %{coins}","ASK":"ASK","Send":"Send","EXIT":"EXIT","OPEN":"OPEN","FREE":"FREE","Refill":"Refill","Claim":"Claim","Claimed":"Claimed","Compete":"Compete","Join":"Join","Edit":"Edit","Create":"Create","Selected":"Selected:","on":"on","off":"off","high":"high","low":"low","done":"Done","Sell":"Sell","SoldOut":"Sold out","ONE_DAY":"1 day","AMOUNT_HOURS":"%{amount} hours","YouHaveAmount":"You have:","SendLiveRequest":"Sent a life","AskLiveRequest":"Asks for a life","SendStarRequest":"Sent a key","AskStarRequest":"Asks for a key","SendCoinsRequest":"Sent gold","SendStuckHelpRequest":"Sent help","AskCoinsRequest":"Asks for gold","SentHelpRequest":"Helped you","AskHelpRequest":"Needs your help","AdminGiftsHeroes":"Game administrators sent you new Heroes!","AdminGiftsText":"Game administrators sent special present for You!","ItemsFromCompletedExpedition":"Game administrators sent special present for You! Unfortunately, the present cannot be received as the event is completed.","IsUnknownUnitGift":"Game administrators sent special present for You! Please update your game version to get it!","AdminSetProgress.Title":"Progress update","AdminSetProgress.Text":"Game administrators have changed your progress to level %{levelNo}. \\nAccept the changes?","AdminRestoreProgress.Text":"Game administrators have transferred your progress from ID: %{userId}. \\nAccept the changes?","AdminSetProgress":"Progress update","ExitGame":"Exit game","congratulations":["Excellent!","Wonderful!","Perfect!","Well done!","Good job!","Super!","Nice work!","Great!","Fantastic!","Brilliant!"],"message.yeah":"YEAH!","message.super":"SUPER!","message.yay":"YAY!","message.lets_go":"LET\'S GO!","message.ohyeah":"OH YEAH!","message.oh":"OH!","message.wow":"WOW!","message.good":"GOOD!","message.excellent":"EXCELLENT!","message.great":"GREAT!","message.noMoves":"No moves!","message.newHighscore":"New highscore!","message.hardLevel":"Hard level!","message.regularLevel":"Regular level","message.trickyLevel":"Tricky Level!","message.bonusLevel":"Bonus level","message.Letsgo":"Let\'s go!","message.KeepGoing":"Keep Going!","message.MovesLeft":"5 moves left!","message.Shuffle":"No moves. Shuffle","message.YouWin":"You Win!","Collect":"Collect","LocalPushes.LIVES.Title":["Are you ready to play?","Have you been dying to play?","Used up all your lives?","Everyone deserves a second chance","Do you miss the game?"],"LocalPushes.LIVES":["\u2764\ufe0fYour lives have been refilled!","You can play now! Your lives were restored!\ud83d\ude07","Don\'t worry! You have more lives available now!\ud83d\udc9c","Take what\'s yours!\ud83e\udd32 Put those lives to a good use!","Mourn no more! Your lives are here!\ud83d\udc96"],"LocalPushes.MINI_GAME.Title":["Don\'t miss your prizes!","Give it a try!","Come and try your luck","There is nothing easier","Can it be more simple?"],"LocalPushes.MINI_GAME":["Daily game is available for playing!\ud83c\udf6d","Play the daily game and collect your prizes!\ud83c\udfc6","Pick the prize and enjoy its benefits!\ud83d\udc8c","Simply take what you like and be amazed!\ud83e\udd29","Just choose a prize and see it become yours!\ud83d\ude4c"],"LocalPushes.LETS_PLAY.Title":["Epic Gaming Adventure Awaits! \ud83d\udd79\ufe0f","Boredom Ends with Our Game! \ud83d\udd14","Ready for a Thrilling Challenge? \ud83e\udde9","Unleash Your Gaming Skills! \ud83d\ude80","Master the Art of Gaming! \ud83d\udcaa","The Fun Begins \u2013 Don\'t Miss Out! \u23f0","Achieve Gaming Victory and Glory! \ud83c\udfc6"],"LocalPushes.LETS_PLAY":["Dive back into the game and face new exciting challenges! \ud83c\udf0a","New levels and gaming fun await \u2013 come explore the latest updates! \ud83c\udf1f","Are you up for a challenge? Put your skills to the ultimate test! \ud83d\udcaa","Endless gaming enjoyment is just a tap away \u2013 don\'t miss out! \u231b","Conquer challenges and celebrate your gaming triumphs! \ud83c\udfc5","Show off your gaming skills and impress your friends! \ud83d\udd79\ufe0f","Competitive spirit? Jump back in and dominate the leaderboards! \ud83c\udfc1"],"VKMassSender.online_invite":["Hi there! What happened while you were away?","Things have changed... Find out what happened!"],"LocalPushes.FREE_CHEST.Title":"Presents time!","LocalPushes.FREE_CHEST":"Visit the game to open the bonus chest!\ud83d\udd11","LocalPushes.LIVES_LOTTERY.Title":"Time to win!","LocalPushes.LIVES_LOTTERY":"Visit the game to win some free energy!\ud83c\udfaf","LocalPushes.FRUIT_RIPE.Title":"Harvest time - your crops are ripe!","LocalPushes.FRUIT_RIPE":"\ud83c\udf3eVisit the game to harvest your crops!","LocalPushes.CASTLE_PRIZE.Title":"The prizes are ready!","LocalPushes.CASTLE_PRIZE":"Visit the game to collect the rewards from your building!","LocalPushes.ORDER_READY.Title":"Your order is ready!","LocalPushes.ORDER_READY":"Collect the fulfilled orders and exchange them for rewards!","LocalPushes.TREE_CHOPPED.Title":"The obstacle is chopped!","LocalPushes.TREE_CHOPPED":"Visit the game and collect the rewards for the job well done!","LocalPushes.EXPEDITION_TREE_CHOPPED.Title":"The job is done!","LocalPushes.EXPEDITION_TREE_CHOPPED":"It\'s time to visit the game and collect the goods!","LocalPushes.BUILDING_BUILT.Title":"The building is erected!","LocalPushes.BUILDING_BUILT":"\ud83c\udfe0Visit the game to check out your newly erected building!","LocalPushes.MAGIC_PLANT_READY.Title":"Some magic awaits!","LocalPushes.MAGIC_PLANT_READY":"Claim your newly made magic item now!\ud83d\udd2e","LocalPushes.MINI_GAME_PRIZE.Title":"Are you up for a challenge?","LocalPushes.MINI_GAME_PRIZE":"Dragon\'s Den is open again!\ud83d\udc09 Beat it to claim your rewards!","LocalPushes.DAILY_TASKS_UNCOMPLETED.Title":"You\'re almost there!","LocalPushes.DAILY_TASKS_UNCOMPLETED":"Few more tasks and the reward is yours!","LocalPushes.PASS_UNCOMPLETED.Title":"The season is almost over!","LocalPushes.PASS_UNCOMPLETED":"Push a little harder to win your prizes before it ends!","LocalPushes.PUMPKIN_RIPE.Title":"Time to collect!","LocalPushes.PUMPKIN_RIPE":"\ud83d\udd31 Visit the game to collect your tridents!","halloween.LocalPushes.PUMPKIN_RIPE":"\ud83c\udf83 Visit the game to collect your lanterns!","LocalPushes.UNITLOCK_OPEN.Title":"It\'s unlock o\'clock!","LocalPushes.UNITLOCK_OPEN":"Visit the game to take advantage of the new objects!","LocalPushes.EXPEDITION.Title":"It\'s time for an adventure!","LocalPushes.EXPEDITION":"Another epic journey awaits!","LocalPushes.EXPEDITION_PERIODIC.Title":"Your greatest story awaits!\ud83c\udf0a","LocalPushes.EXPEDITION_PERIODIC":"\ud83c\udf33It\'s time to write another chapter of your amazing story!","LocalPushes.WELCOME.Title":"Welcome to the game!","LocalPushes.WELCOME":"Get ready to explore and conquer new challenges.","RateUs":"Rate Us","LastChanceToBuy":"Last chance to buy:","InternetConnectionError":"Internet connection error","ShareError":"Share error","InviteFriendsError":"Invite friends error","SendRequestError":"Send request error","StarterPack0.Title":"Starter pack","StarterPack1.Title":"Super pack","StarterPack2.Title":"Mega pack","StarterPack.Bought":"You bought %{title}!","StarterPack0.Description":"Must-Have pack for the beginner!","StarterPack1.Description":"Super pack for the good player!","StarterPack2.Description":"Great deal for the great player!","PackWindow.Text":"Forest spirits encouraged me to help you on your journey. I tried my best to make your life easier!","Versions":"Versions:","TournamentVictoryWindow.place.1":"1st place","TournamentVictoryWindow.place.2":"2nd place","TournamentVictoryWindow.place.3":"3rd place","TournamentVictoryWindow.place.4":"4th place","LivesShopWindow.products.refillLives":"Classic pack","LivesShopWindow.products.buyLive":"Lives for coins","LivesShopWindow.products.unlimitedLives":"Best value","LivesShopWindow.products.askLives":"Helping hand","LivesShopWindow.products.livesForVideo":"Lives for ads","LivesShopWindow.products.buyEnergy":"%{restoreAmount}","LivesShopWindow.products.energyForVideo":"%{restoreAmount}","LivesShopWindow.products.energyForVideoShort":"%{restoreAmount}","LeadersLoadFailed":"Loading leaders failed!","League0":"Wooden League","League1":"Bronze League","League2":"Silver League","League3":"Gold League","League4":"Platinum League","League5":"Ruby League","League6":"Diamond League","WorldTopName":"World","LeadersWindow.rank":"rank","LeadersWindow.player":"player","LeadersWindow.rating":"rating","NewLeagueWindow.Title":"New League!","Forces.LeaderBoard":"Here you may find top players of every league! Try this now!","NewLeagueWindow.text":"Congratulations! You have entered the %{league}!","Forces.DailyTasks":"Get rewards for achieving daily goals!","DailyTasksWindow.title":"Daily Goals","DailyTasksWindow.finished.title":"Results","DailyTasksWindow.TimeToRefresh":"Time to refresh:","DailyTasksWindow.CTA":"Complete tasks and earn rewards!","DailyTasksWindow.Refresh":"Get new","DailyTasksWindow.tooltip":"Task reward","DailyTasksWindow.swapTooltip":"Replace task","Forces.MiniGame":"Here you can find a bonus! Free gifts every day!","DailyTask.4.Title":"Pass a Level","DailyTask.7.Title":"Watch Ads","DailyTask.8.Title":"Use the Rainbow Cake","DailyTask.9.Title":"Use a booster on the level","DailyTask.10.Title":"Collect %{color} Elements","DailyTask.13.Title":"Spend rubies","DailyTask.14.Title":"Spend rubies","DailyTask.16.Title":"Guess words with a letter \'%{letter}\'","DailyTask.24.Title":"Activate %{heroes}","DailyTask.24.a":"Blue Heroes","DailyTask.24.b":"Green Heroes","DailyTask.24.c":"Purple Heroes","DailyTask.24.d":"Red Heroes","DailyTask.24.e":"Yellow Heroes","DailyTask.24.w":"White Heroes","DailyTask.28.Title":"Defeat evil creatures","rapunzel.DailyTask.28.Title":"Extract ingredients","DailyTask.29.Title":"Make order in the tavern","DailyTask.30.Title":"Merge items with liquid rainbow","DailyTask.31.Title":"Merge keys","DailyTask.32.Title":"Harvest crops","DailyTask.33.Title":"Use man power","rapunzel.DailyTask.33.Title":"Use energy","DailyTask.34.Title":"Open chest","DailyTask.35.Title":"Collect magic bugs","DailyTask.36.Title":"Merge %{amount} objects at once","DailyTask.37.Title":"Shop at any market located on your lands","DailyTask.38.Title":"Explore Dragon\'s Den","DailyTask.39.Title":"Spend coins","DailyTask.40.Title":"Spawn evil creatures","DailyTask.41.Title":"Complete all tasks","DailyTask.42.Title":"Launch an ad on tv or radio","DailyTask.43.Title":"Erect any structure","DailyTask.44.Title":"Get a plant","ColorCell.a.Title":"Blue","ColorCell.b.Title":"Green","ColorCell.c.Title":"Purple","ColorCell.d.Title":"Red","ColorCell.e.Title":"Yellow","ColorCell.w.Title":"White","DailyTask.45.Title":"Pass daily cup level","DailyTask.46.Title":"Pass hard level","DailyTask.47.Title":"Guess words with 7 or more letters","DailyTask.48.Title":"Level up combo to max level","DailyTask.49.Title":"Use a pre-level booster","DailyTask.50.Title":"Win tournament","DailyTask.51.Title":"Play daily game","DailyTask.52.Title":"Win energy in a lottery","DailyTask.53.Title":"Clear fog","DailyTask.54.Title":"Finish quests","DailyTaskView.Get":"Claim","Go":"Go","FBLoginOrInvite.invite":"Invite a friend to compete with them!","InviteButton.Text":"Invite","FBLoginOrInvite.Button.Login":"Login","Missions.finished":"finished","Missions.windowRunning":"Current standings","Missions.windowFinished":"Tournament is finished","Missions.windowStarting":"Tournament starting...","Missions.RulesTitle":"Rules","Missions.Rules2":"%{header} Only on new levels or levels with less than 3 stars. Compete with players around the World and win prizes.","Missions.BoardGame.Rules2":"%{header} Only on new levels. Compete with other players around the World and win prizes. Good luck!","Missions.CommonText":"Prove that you deserve to win a prize in this competition! Only Top Five players will get it!","Missions.BoardgameTournament.Title":"Tournament","RewardWindow.title":"Your reward","DailyTaskRewardWindow.title":"Task completed!","DailyTaskRewardWindow.text":"Congratulations!","SubscriptionWindow.Title":"PREMIUM","SubscriptionWindow.MainText":"Get a ton of bonuses every day with Premium! Enter the game each day to claim rewards!","SubscriptionWindow.Free":"FREE","SubscriptionWindow.iosWeekButton":"%{price} / Week","SubscriptionWindow.iosMonthButton":"%{price} / Month","SubscriptionWindow.iOSThreeDaysAdditional":"Start with a 3 days free trial.\\nAfter %{price} per week","SubscriptionWindow.OneDayAdditional":"Give it a try!%{newline}One day","SubscriptionWindow.ThreeDaysAdditional":"Give it a try!%{newline}Three days","SubscriptionWindow.MonthlyAdditional":"PER MONTH","SubscriptionRewardsList.subtitle":"EVERY DAY YOU WILL GET:","SubscriptionWindow.RewardTimerText":"Time remaining until next reward:","SubscriptionWindow.RewardTwoHours":"2 hours","SubscriptionWindow.UnlimitedLivesTwoHourText":"2h of unlimited lives","RestorePurchases":"Restore Purchases","Terms.TermsOfService":"Terms of Service","Terms.and":"and","Terms.PrivacyPolicy":"Privacy Policy","SubscriptionRewardWindow.title":"Subscription bonus","SubscriptionRewardWindow.subtitle":"See you tomorrow!","SubscriptionRewardLaterButton.text":"Ok","Shop.PiggyBank1.Title":"Small Piggy Bank","Shop.PiggyBank1.Description":"Small Piggy Bank full of coins!","Shop.PiggyBank2.Title":"Medium Piggy Bank","Shop.PiggyBank2.Description":"Medium Piggy Bank full of coins!","Shop.PiggyBank3.Title":"Large Piggy Bank","Shop.PiggyBank3.Description":"Large Piggy Bank full of coins!","Shop.PiggyBank4.Title":"Huge Piggy Bank","Shop.PiggyBank4.Description":"Huge Piggy Bank full of coins!","Shop.BuyExp10.Title":"10 lollipops","Shop.BuyExp10.Description":"Small lollipops pack - 10 lollipops","Shop.BuyExp10.BoughtMessage":"You bought 10 lollipops","Shop.BuyExp150.Title":"150 lollipops","Shop.BuyExp150.Description":"Huge lollipops pack - 150 lollipops","Shop.BuyExp150.BoughtMessage":"You bought 150 lollipops","Balance":"Balance:","NewVersionWindow.Title":"Upgrade available!","NewVersionWindow.text1":"New version %{version} of %{title} is available.","NewVersionWindow.text2":"Please update now!","scramblePromo":"Try the word finding game for free! Find all scrambled words!","scramblePromoTitle":"Kitty Scramble","wordsoupPromo":"Try the smartest word puzzle game! Challenging brain puzzles for free!","wordsoupPromoTitle":"Word Sauce","tripeaksPromo":"Try solving the most challenging solitaire puzzles for free!","tripeaksPromoTitle":"Kings & Queens","spadesPromo":"Master solitaire puzzles in a tropical haven!","spadesPromoTitle":"Solitaria","woodenblockPromo":"Solve captivating puzzles, and blast blocks in this thrilling, addictive game.","woodenblockPromoTitle":"BlockBuster Puzzle","magicwordsPromo":"Try the word spelling game for free! Swipe and connect words!","magicwordsPromoTitle":"Circus Words","crocwordPromo":"Try challenging crossword puzzle for free! Find and spell every word there is!","crocwordPromoTitle":"Crocword","olympicsPromo":"Try mind working puzzle game with real players for free!","olympicsPromoTitle":"Crossword Online","riddlesPromo":"Try the sweetest match 3 Game! Cute sweeties will get you hooked!","riddlesPromoTitle":"Candy Riddles","heroesPromo":"Try the new amazing match 3 game! Join other players around the world and be the best!","heroesPromoTitle":"Sugar Heroes","runesPromo":"Try our new epic game! The real medieval and funny heroes will not leave you indifferent!","runesPromoTitle":"Heroes of Match 3","adventurePromo":"No game has ever been so sweet! Dive into the world of Charmland and start enjoying it\'s beauty!","adventurePromoTitle":"Secrets of Charmland","differencesPromo":"Try this mind working puzzle out and compete with real players for free!","differencesPromoTitle":"Rachel Holmes","mergecraftPromo":"Try this amazing merge puzzle game! Build your own world!","mergecraftPromoTitle":"Mergest Kingdom","wondermergePromo":"Merge and farm on an island! Create your own Tropical paradise!","wondermergePromoTitle":"Tropical Merge","fairyPromo":"Merge magic on a fairy island!","fairyPromoTitle":"Fairyland","hustlemergePromo":"Unravel the mysteries of time and create your own settlement!","hustlemergePromoTitle":"Castle Craft","zenmatchPromo":"One of the best tile-matching games for triple-match fun! Become a tile master!","zenmatchPromoTitle":"Tile Guru","ExpInfoWindow.Title":"Lollipops","ExpInfoWindow.Message":"Pass levels, play daily games, achieve daily goals and win tournaments to collect lollipops. Hard levels give you more lollipops!","ExpInfoWindow.BuyMessage":"Or You can buy lollipops right now!","Skip":"Skip","SkipButton":"Skip >>","TapToSkip":"Tap to Skip >>","waitPlayers":"Searching tournament players","Rewards.list":"Rewards:","VictoryWindowBase.piggyBankFull":"Full","PiggyBank.Full":"Full","Christmas.Title":"Christmas","Heroes.CanActivateByDblClick":"You can activate the Hero by double clicking on it!","Heroes.CanActivateByDblClickNoMove":"You won\'t lose your moves when activating the Hero by double clicking on it!","LocalStorageDisabledWindow.title":"Can\'t save progress!","LocalStorageDisabledWindow.text1":"It seems your browser blocks our cookies!","LocalStorageDisabledWindow.text2":"Please update your settings, or your game progress might be lost!","mobileNotAvailable":"Not available on mobile!","Cups.daily.title":"Daily cup!","Cups.daily.reward":"Your prize:","Cups.daily.finished":"Daily cup is finished","Cups.daily.force":"Partake in the daily cup every hour to get prizes!","PurchaseRewardWindow.title":"Your purchase","DailyCupRulesWindow.title":"How does it work?","DailyCupRulesWindow.firstStage":"Beat levels","DailyCupRulesWindow.secondStage":"Collect stars","DailyCupRulesWindow.thirdStage":"Become a champion!","DailyCupLeadersWindow.Title":"The best of the best!","Minigame.items.pickaxe":"pickaxes","NotEnoughWindow.Title":"Not enough %{minigameItem}","NotEnoughWindow.text":"Play more","NotEnoughCoins":"Not enough coins","PassProduct.Title":"Season Pass","BuildPassWindow.title":"Tasty tasks","PassWindow.timer":"Time remaining","PassWindow.finished":"Season finished","ExpeditionPassWindow.header":"You will receive a reward in the main world!","rapunzel3.ExpeditionPassWindow.header":"Merge items to increase your score. You will receive a reward in the main world!","collections.ExpeditionPassWindow.header":"Merge critters to increase your score!","PassWindow.progress":"Next reward","PassWindow.completed":"Stages completed!","PassWindow.ticket.hint":"Golden ticket","PassWindow.ticket.freeHint":"Free ticket","PassWindow.ticket.hint.active":"Golden ticket is Active!","PassWindow.moreItemsToolTip.star":"You need more stars!","PassWindow.moreItemsToolTip.crystal":"You need more crystals!","PassRulesWindow.title":"Construction Season","PassRulesWindow.firstStage":"Erect buildings","PassRulesWindow.secondStage":"Collect stars","PassRulesWindow.thirdStage":"Get prizes","PassBuyTicketWindow.title":"Golden ticket","PassBuyTicketWindow.lowerText":"Purchase golden ticket to obtain premium rewards!","PlayNow":"Play now","tournament_Jim":"Jim","tournament_Bob":"Bob","tournament_Jack":"Jack","tournament_Dave":"Dave","tournament_Charlie":"Charlie","tournament_Bill":"Bill","tournament_Chris":"Chris","ShopWindow.showMore":"More offers","ShopWindow.title":"SHOP","Badge.bestSeller":"BEST\\nSELLER","Badge.save":"SAVE!","Badge.discount":"%{amount}\\nFREE","Lottery.info":"Visit our community for lottery details","Lottery.infoSaleDay":"Partake in 100 000 votes give-away from Vkontakte!","Lottery.iconText":"Win","BuildingLockedWindow.text":"This building is too dangerous right now, try going to the %{currentBuilding}","inviteFriends.noUsers":"Friends are in the game","ConfirmExitWindow.title":"Exit game?","ConfirmExitWindow.message":"You will lose one life","ConfirmExitWindow.BonusRound.message":"Are you sure you want to exit this Bonus Round? You won\'t be able to re-enter it.","AreYouSure":"Are you sure?","QuestWindow.text2":"To gather:","Complete":"Complete","ProvidesComponent.maybe.text":"You can get:","ProvidesComponent.have.text":"You\'ve got:","BuildingStartWindow.subTitle":"Level %{level}","AllDoneWindow.title":"Chapter completed","AllDoneWindow.text":"The chapter is over but the story is yet to be continued. Stay tuned for more!","BuildingInfoWindow.redoButton":"Change","RoundCountdownComponent.text":"Returning to tournament...","ClientSessionExpired.title":"Attention","ClientSessionExpired.message":"You cannot play in two tabs!","NoConnectionWindow.title":"Connection lost","BoostersBeforeComponent.Title":"Select Boosters:","BuildingStartWindow.itemTitle":"Reward:","message.lastRound":"Final Round","message.round":"Round %{roundId}","UnlockOnLevel":"Level %{level}","Shop.sweetPack.boughtMessage":"You bought a Newbie Pack!","Shop.jamPack.boughtMessage":"You bought an Apprentice Pack!","Shop.tastyPack.boughtMessage":"You bought a Pro Pack!","Shop.honeyPack.boughtMessage":"You bought a Master Pack!","Shop.epicPack.boughtMessage":"You bought a Champion Pack!","PlayButton.text":"Level %{levelNo}","CloversTooltip":"Collected tournament items","PassLevelRewardTooltip":"Complete level to get this reward","ProvidedItemTooltip":"Get this item upon level completion","LevelNotPassedTooltip":"You have not reached this level yet","PrizeTooltip":"Reward upon tournament completion","ResultTooltip":"Tournament items collected","TileShop.sweetPack.Title":"Newbie Pack","TileShop.jamPack.Title":"Apprentice Pack","TileShop.tastyPack.Title":"Pro Pack","TileShop.honeyPack.Title":"Master Pack","TileShop.epicPack.Title":"Champion Pack","TileShop.sweetPack.Description":"Wonderful pack full of coins and boosters!","TileShop.jamPack.Description":"Lots of coins and boosters for fun playing!","TileShop.tastyPack.Description":"Incredible mix of coins and various boosters!","TileShop.honeyPack.Description":"Ideal combination of coins and multiple boosters!","TileShop.epicPack.Description":"Extraordinary blend of gold coins and fascinating boosters!","PhotoClover.force":"Press on garnets to collect them and participate in the tournament.","PaintAreaTooltip":"This area has no differences.","ShovelsTooltip":"Collect shovels by completing levels","BackgroundsWindow.title":"Cruise","BackgroundsWindow.text":"Collect stars to unlock new locations","BackgroundsWindow.tapeText":"Completed","BackgroundsWindow.ComingSoonTitle":"Coming soon","Cup1PlaceTooltip":"First place reward","Cup2PlaceTooltip":"Second place reward","Cup3PlaceTooltip":"Third place reward","CupRewardTooltip":"Reward","OpenBackgroundTooltip":"Housewarming gift","StarsProgressBar.prizeTooltip":"Prize upon completing","SupportButton":"Support","LoseWindow.title":"Level failed","LoseWindow.livesLeft":"Lives left:","LoseWindow.livesLeftUnlimited":"Lives left: Unlimited","ChatTitle":"CleverApps Support","BetBonus.ClosedText":"Bonus is not available!","Forces.BetBonus":"Here you can find a bonus to play next level","BonusWorldNotPassedLevelTooltip":"You have not reached this level yet","BonusWorldPassedLevelTooltip":"This level is completed","IconLocked.TextDefault":"Level %{levelNo}","IconLocked.TipDefault":"Available from level %{level}","IconLocked.TipTimer":"Available soon!","WordsAmount":"%{amount} words","RewardsListComponent.rewardTitle":"Reward:","ChatGreetingMessage":"Hi there! Thank you for reaching out to us. Kindly describe the problem you\'re facing so we could start working on it.","Activity.DailyTask.title":"You are capable of anything!","Activity.DailyTask.body1":"%{userName} showed his skills once again by completing the task!","Activity.DailyTask.body2":"The task was easily executed by the master %{userName}!","Activity.PassLevel.title":"Going through levels is as easy as shelling peas!","Activity.PassLevel.body1":"%{userName} proficiency at %{levelNo} level scored %{score} points!","Activity.PassLevel.body2":"I am a master of %{levelNo} level! Can you beat my %{score} score?","Activity.PassLevel.body3":"My journey will not stop the %{levelNo} level! He was left behind with a score of %{score}!","PassLastChanceWindow.title":"So close","PassLastChanceWindow.upperText":"This reward is almost yours!","PassLastChanceWindow.lowerText":"This is your last chance to claim this reward!","PassLastChanceWindow.badgeText":"Last chance","PassRewardIcon.ribbonText":"Golden ticket","ChatConsoleStreamSwitchOn":"A special mode of collecting information about an error was turned on for you for 24 hours","ChatConsoleStreamSwitchOff":"Special mode of collecting information about an error was turned off","or":"or","TileShop.tile.left":"Left: %{amount}","TileShop.tile.leftTime":"Available in:","TileShop.tile.level":"%{level} level","TileShop.subscription.next":"Next reward","TileShop.subscription.title":"Premium","TileShop.subscription.details":"More details","TileShop.subscription.reachLvl":"Get valuable prizes every day!","TileShop.growthFund.button":"More details","TileShop.growthFund.ready":"Rewards are ready!","TileShop.growthFund.reachLevel":"Reach level %{level}","TileShop.growthFund.allReceived":"All rewards received","TileShop.growthFund.info":"Get up to 22150 rubies!","GrowthFundWindow.reach":"Reach level %{level}","GrowthFundWindow.reached":"Level %{level}","GrowthFundWindow.insufficient":"Insufficient level","GrowthFundWindow.getPrevious":"Get level %{level} reward first","GrowthFundWindow.title":"Growth Fund","GrowthFundWindow.cta1":"800% value!","GrowthFundWindow.cta2":"Grand total of 22 150 rubies!","GrowthFundBuyWindow.title":"Purchase Fund","GrowthFundBuyWindow.text1":"Get now:","GrowthFundBuyWindow.text2":"Every next level:","RewardAutoClose":"Automatically close in %{timeout}","ProcessingInProgress":"Processing in progress","Window.TapToContinue":"Tap to continue","Window.ClickToClaim":"Tap to claim","AdsRunning":"Advertising is running","VIPRewardedWindow.title":"VIP","VIPRewardedWindow.description":"You are a Very Important Player.\\nTherefore, we will watch ads for you.","VIPRewardedWindow.note":"VIP status activates if last month\'s payments exceed %{price} and lasts 30 days. Time left: %{remaining}","TileShop.products.hardForVideo":"%{minAmount}-%{maxAmount}","LivesForVideoProduct.description":"Bonus lives for ads!","EnergyForVideoProduct.description":"Bonus energy for ads!","AskLivesProduct.description":"Ask friends for lives","ChatCategory.Select":"Select a category for your inquiry:","ChatCategory.ProblemWithPayment":"I didn\'t receive my purchase","ChatCategory.QuestionAboutTheRules":"Question about the rules","ChatCategory.ReportABag":"Report a bug","ChatCategory.AdsProblem":"I can\'t watch adverts","ChatCategory.Suggestions":"Suggestions about the game","ChatCategory.OtherQuestions":"Other question","ChatCategory.ProblemWithPaymentPlaceholder":"Please let us know about the problem and payment details (date, price and product name)","ChatCategory.QuestionAboutTheRulesPlaceholder":"Please write your question","ChatCategory.ReportABagPlaceholder":"Please describe the problem and the actions that led to it","ChatCategory.AdsProblemPlaceholder":"Please describe your problem","ChatCategory.SuggestionsPlaceholder":"Please let us know how we can make the game better","ChatCategory.OtherQuestionsPlaceholder":"Please describe your problem","Boosters.8.Title":"Brush","Boosters.9.Title":"Magnifier","Boosters.10.Title":"Magnet","Boosters.11.Title":"Dice","Boosters.12.Title":"Two jokers","Boosters.13.Title":"Flashlight","Boosters.14.Title":"Glasses","Boosters.15.Title":"Magnifier","GiveUpAlert.text1":"Do you really want to give up?","GiveUpAlert.text2":"You will lose:","Continue":"Continue","wysiwyg.PlayFree":"Play free!","wysiwyg.PlayNow":"Play now!","cantCollectBuilding":"To collect this, you need to build: %{target}!","Shop.expeditionPack.title":"Ruby sale","Shop.expeditionPack.description":"Get rubies with a discount and take you game to the next level!","Shop.expeditionPack.boughtMessage":"You bought rubies with a discount","RestoreProgress":"Restore progress","RestoreProgress.progressNotFound":"Higher progress not found","Delete":"Delete","DeleteAccount":"Delete account","Caravan.Title0":"Warrior\'s pack","Caravan.Title1":"Sultan\'s pack","Caravan.Title2":"Princess\' pack","Caravan.ItemsAmount":"Items: %{amount}","CaravanMissionWindow.Title":"Eastern caravan","Badge.Value":"%{amount}\\nvalue!","OrdersWindow.title":"Orders","ConfirmMergeWindow.text":"Use %{used} to get %{amount} %{received}?","ConfirmMergeWindow.title":"Use %{unit}","LivesShopWindow.products.energyLottery":"Energy lottery","Find":"Find","Explode":"Explode","BuyFogWindow.mainWorldBonus":"Main world bonus:","BuyFogWindow.valuables":"Main world bonus","BuyFogWindow.tiles":"%{tiles} extra pieces of land","MissionOfferWindow.BuildPassOffer.badge1":"50%\\nSALE","MissionOfferWindow.SalePassOffer.badge1":"50%\\nSALE","MissionOfferWindow.CollectionsPassOffer.btnLabel":"30%\\nOFF","ExpeditionProgressHint.remaining":"Hurry up! You only have %{remaining} days left to complete your journey.","ExpeditionProgressHint.completed":"%{name} expedition is over","MissionOfferWindow.RapunzelPack.reward.unit":"Free","MissionOfferWindow.RapunzelPack.title":"Ruby Sale","ExpeditionFinishWindow.text":"Thank you for sharing this exciting adventure with us. Let\'s hope that there are many endeavours like it ahead of us. Now, it is time to collect your well-deserved rewards!","ExpeditionFinishWindow.title":"Journey is complete","Customer.Orders":"Rewards","Customer.Ingredients":"Ingredients","Customer.FindIngredients":"Find ingredients to make special items","Customer.Buy":"Buy","Customer.Exchange":"Exchange","Customer.BuyAll":"Buy missing ingredients","Customer.Upgrade":"Upgrade","Customer.Stage":"Stage: %{stage}","Customer.UpgradeToStage":"Upgrade to stage %{stage}","Customer.NoMore":"You have completed this quest","DeleteAccountWindow.title":"Delete account","DeleteAccountWindow.text1":"You are requesting to delete your account.%{newline}If you tap \\"Continue\\", all your account data will be deleted, including your:%{newline}1. Purchases.%{newline}2. Game progress.%{newline}3. Account info.","DeleteAccountWindow.text2":"The deletion process takes %{days} days. After that, you won\'t be able to restore any of your account data.","DeleteAccountWindow.text3":"If you return to the game before %{days} days expire, you\'ll be able to revert the process, restore your progress, and keep enjoying the game.","DeleteAccountConfirmationWindow.title":"Delete account confirmation","DeleteAccountConfirmationWindow.text1":"Are you sure you want to delete your account?","DeleteAccountConfirmationWindow.text2":"If you tap \\"Delete\\", the app will close. The deletion process takes %{days} days. After that, you won\'t be able to restore any of your account data.","DeleteAccountConfirmationWindow.text3":"If you return after %{days} days expire:%{newline}1. You won\'t be able to cancel the account deletion.%{newline}2. You\'ll lose all of your account data, including game progress and purchases.%{newline}3. You\'ll have to start the game from the beginning.","DeleteAccountInformationWindow.title":"Your account is being deleted","DeleteAccountInformationWindow.time":"Your account will be deleted within %{days} days.","DeleteAccountInformationWindow.text1":"The account you used to log in is undergoing the deletion process. Cancel the deletion to save all of your account data.%{newline}To do that, simply press on the \\"Cancel\\" button to restore your progress and purchases.","DeleteAccountInformationWindow.text2":"If you decide to proceed with deletion, kindly make sure that you don\'t have any active subscriptions related to the account. Billing for an auto-renewable subscription continues through your provider regardless of whether you delete your game account.","DeleteAccountInformationWindow.revoke.apple":"You need to revoke permissions granted to the app via the device account settings.","DeleteAccountRestartWindow.title":"Restart app","DeleteAccountRestartWindow.text1":"Your account data was deleted. If you wish to start a new game kindly restart the app.","Units.LandmarkSpot.stage1.name":"How does it work?","LandmarkGuideWindow.description":"Explore many unforgettable worlds to get a chance to decorate your home lands!","LandmarkGuideWindow.firstStage":"Complete expeditions","LandmarkGuideWindow.secondStage":"Receive landmarks","LandmarkGuideWindow.thirdStage":"Decorate your world","LandmarkGuideWindow.title":"How does it work?","Forces.Landmark.1":"Decorate the island with your stunning landmark!","LandMarkDonorWindow.title":"%{family} Landmark Reward","LandMarkDonorWindow.description":"Collect the full \\"%{code}\\" line to get this landmark. You can only obtain it during this event! Once the event concludes, \\"%{code}\\" line will vanish but the landmark is yours forever.","LandMarkDonorWindow.description.multidonors":"Upgrade all special items to get this landmark. You can only obtain it during this event!","LandMarkDonorWindow.items":"Items left:","LandMarkDonorWindow.title.landmark_15":"Cheesemonger Landmark Reward","LandMarkDonorWindow.title.landmark_17":"Sanctuary Landmark Reward","LandMarkDonorWindow.title.landmark_18":"Halloween Tree Landmark Reward","Merge.MaxStage":"The item is already at the highest level and cannot be merged","FeastMissionWindow.KrakenFeast.offerBadge":"-33%","FeastMissionWindow.SoftFeast.offer":"Golden pack","FeastMissionWindow.SoftFeast.offerBadge":"-33%","FeastMissionWindow.LivesFeast.offer":"Energy pack","FeastMissionWindow.LivesFeast.offerBadge":"-33%","FeastMissionWindow.SnailFeast.offer":"Snail pack","FeastMissionWindow.SnailFeast.offerBadge":"-33%","CenterHint.merge.unmergeableUnit":"These items can\'t be merged","SnailFeastWindow.title":"Snail\'s race","SnailFeastWindow.finished":"Snail\'s race finished","SnailFeastGuideWindow.title":"Snail race","SnailFeastGuideWindow.firstStage":"Chop resources!","SnailFeastGuideWindow.secondStage":"Get and merge snails!","SnailFeastGuideWindow.thirdStage":"Get points to win the race!","MissionNotStarted.SnailFeast":"Tournament has not started yet","MissionNotStarted.ExpeditionPass":"Season has not started yet","MissionOfferWindow.SnailPack.title":"Snail-quarters","MissionOfferWindow.SnailPack.footnote":"Snail house contains 5 random snails","WheelLotteryWindow.play":"Spin","Landmarks.force":"Look! It seems we can unlock a new landmark!","ABTest.disabled":"This unit is under maintenance","Quest.find.title":"Find %{name}","MissionOfferWindow.periodicOffer.title":"RUBY SALE","PromotionSaleWindow.title":"Sales promotion","PromotionSaleWindow.PrPromotionSale.title":"Holiday Sale","PromotionSaleWindow.description":"Get the best bundle to unlock even greater value!","MissionOfferWindow.periodicOffer.badge1":"-50%","OrangeryView.title":"Orangery","Creatable.info.title":"Create","Prolongation.force":"Out of moves? No problem! Claim your free refill now!","SpeedUpWindow.coinsText":"Accelerate your constructions with our limited-time offer by using coins!","BoostTimeMissionWindow.description":"Use coins to speed up work.","LivesShopWindow.products.softCurrencySmall":"%{amount}","LivesShopWindow.products.softCurrencyVerySmall":"%{amount}","LivesShopWindow.products.softCurrencyMedium":"%{amount}","LivesShopWindow.products.softCurrencyLarge":"%{amount}","LivesShopWindow.products.softCurrencyRange":"%{minAmount} %{maxAmount}","Bank.waitAd":"We\'re looking for ads. You can claim the reward in 10 minutes if we do not find any!","ExpeditionPassWindow.title":"Adventure Season","Fog.explore":"I\'ve been dying to explore new territorries. Let\'s find out what\'s hidden under the mist!","LandmarkUnavailable":"Landmark is unavailable. Explore live worlds to win unique decorations.","MissionUnavailable":"This event is not yet available","Reward":"Reward","EmailWindow.title":"Provide Email","EmailWindow.text":"We will send a receipt for the payment of the purchase","EmailWindow.error":"Please, provide correct email","PurchaseCancelled.InvalidEmail":"Purchase cancelled. Invalid email","Dialogue.person.noName":"Alex Doe","BonusSalePlus":"+BONUS","BonusSaleTooltip":"Bonus","Feedable.hint1":"You need","Feedable.hint2":"for feeding","ReplaceOldMissionWindow.title":"New version available!","ReplaceOldMissionWindow.text":"An update has been released for the expedition: %{name}. Check out the update from the very beginning!","ReplaceOldMissionWindow.restart":"Update now","TilesUnlockWindow.text":"New tiles unlocked!","ReturnBonusRewardWindow.title":"Welcome back","PromoBonusRewardWindow.title":"Gift from VK","Kit1.Title":"Dream Force","Kit1.Description":"Unleash your potential!","Kit1.Bought":"You bought Dream Force!","Kit3.Title":"Boost Bundle","Kit3.Description":"Enhance your play!","Kit3.Bought":"You bought Boost Bundle!","Kit10.Title":"Adventure Pack","Kit10.Description":"Elevate your game!","Kit10.Bought":"You bought Adventure Pack!","Kit50.Title":"Legend\'s Arsenal","Kit50.Description":"Ultimate game upgrade!","Kit50.Bought":"You bought Legend\'s Arsenal!","Island1.Title":"Fortune Isle","Island1.Description":"Explore Prize Paradise!","Island1.Bought":"You bought Fortune Isle!","Island2.Title":"Emerald Isle","Island2.Description":"Improve your gameplay!","Island2.Bought":"You bought Emerald Isle!","Island5.Title":"Crimson Cove","Island5.Description":"Reveal secret sanctuary!","Island5.Bought":"You bought Crimson Cove!","Island10.Title":"Azure Bay","Island10.Description":"Boost your experience!","Island10.Bought":"You bought Azure Bay!","Island15.Title":"Jewel Oasis","Island15.Description":"Claim Reward Oasis!","Island15.Bought":"You bought Jewel Oasis!","Island20.Title":"Serene Island","Island20.Description":"Optimal game enhancement!","Island20.Bought":"You bought Serene Island!","Island30.Title":"Gold Haven","Island30.Description":"Start Treasure Trail!","Island30.Bought":"You bought Gold Haven!","Island45.Title":"Sapphire Bay","Island45.Description":"Elevate Fantasy Realm!","Island45.Bought":"You bought Sapphire Bay!","Supplies.windowTitle":"Week-long Supplies","Supplies.bowWindowText":"Buy it to get 7-day rewards","Supplies.rewardWindowText":"7 day rewards","Supplies.gotAllRewards":"You received all rewards!","Supplies.comeBackWindowText":"Next day reward in:","Supplies.oldPrice":"Old price: %{price}","Supplies.dayN":"Day%{separator}%{day}","Supplies.N_day":"%{day}%{separator}Day","Supplies.dayNRewards":"Day %{day} rewards","RedeemCodeWindow.title":"Redeem code","RedeemCodeWindow.cta":"Redeem a gift code","RedeemCodeWindow.button":"Confirm","RedeemCodeWindow.nocode":"Unknown gift code","ScoreModeButton.text":"Classic","NoAds.Title":"Disable Ads","NoAds.Description":"No pop-up ads or banner ads","NoAds.Bought":"You bought NoAds!","NoAdsWindow.title":"No ADS","NoAdsWindow.note.soft":"Play with no in-game ADS and get %{amount} bonus coins!","NoAdsWindow.note.hard":"Play with no in-game ADS and get %{amount} bonus rubies!","NoAdsWindow.footnote":"Continue with ADS","TradeWindow.Title":"Zoovillage Exchange","TradeWindow.ButtonTitle":"Exchange","TradeWindow.HintSelectTradeable":"To exchange select pet below","TradeWindow.HintSelectAvailable":"Choose pet to receive","TradeWindow.HintSelectNotAvailable":"No pets available ","TradeWindow.Rarity.Regular":"Common","TradeWindow.Rarity.Rare":"Rare","TradeWindow.Rarity.Legendary":"Legendary","TradeGuideWindow.title":"How does it work?","TradeGuideWindow.firstStage":"Get a pet of maximum level","TradeGuideWindow.secondStage":"Exchange it for a rarer one","TradeGuideWindow.thirdStage":"Watch your collection grow!","AdBlockDetected":"Please turn off Ad Block to get this reward","AdBlockWindow.Title":"AdBlock detected","AdBlockWindow.TurnOffAdblock":"Watch ads to get a lot of bonuses!","PixelOfferWindow.name":"Exclusive Offer","PixelOfferWindow.description.first":"Get this special package with","PixelOfferWindow.description.second":"and","PixelOfferWindow.description.reward.energy":"energy","PixelOfferWindow.description.reward.hard":"rubies","PixelOfferWindow.description.reward.wands":"keys","LevelStartWindow.Button.Invite":"Invite","LevelStartWindow.title":"Level %{levelNo}","LevelStartWindow.YourScore":"Your score:","LevelStartWindow.ComingSoonTitle":"Extra level","LevelStartWindow.Lantern.riddles":"Candy\\nMachine","LevelStartWindow.Lantern.heroes":"The\\nTransmitter","LevelStartWindow.Lantern.wooden":"Sacred\\nLight","LevelStartWindow.BonusLabel":"BONUS LEVEL!","FallSaleWindow.title":"Fall sale","FallSaleWindow.shoptitle":"Big sale","FallSaleWindow.description":"We\u2019re excited to announce that the IAP shop is now open on iOS!\\nTo celebrate, enjoy 30% off on any purchase and boost your progress with our limited-time autumn offers.","FallSaleWindow.Button.text":"Open shop","Customer.requiredUnit1":"You need","Customer.requiredUnit2":"to unlock"}',
inline: !0
},
highscore_localization_json: {
data: '{"time":"Time","besttime":"Best Time","score":"Score","highscore":"Highest Score","moves":"Moves","bestmoves":"Best Moves","games":"Games played","wins":"Wins","VictoryWindow.Victory":"Excellent Game!","NewGame":"New game","LoseWindow.title":"Game Over","TryAgain":"Play Again","VictoryScoreComponent.newRecord":"New Record","VictoryScoreComponent.yourScore":"Your Score","VictoryScoreComponent.bestScore":"Highest Score","AddMovesWindow.mission.LetterTournament":"All points will be cleared"}',
inline: !0
},
letter_tournament_localization_json: {
data: '{"Missions.LetterTournament.Title":"Candy Catcher","Missions.LetterTournament.Rules1":"Guess words to catch as many candies as you can!","AddMovesWindow.mission.LetterTournament":"You will lose all the items","LetterTournamentGuideWindow.title":"How does it work?","LetterTournamentGuideWindow.firstStage":"Catch candies","LetterTournamentGuideWindow.secondStage":"Beat others","LetterTournamentGuideWindow.thirdStage":"Get prizes!"}',
inline: !0
},
lives_localization_json: {
data: '{"ExtendUnlimitedLivesWindow.title":"Time\'s up!","ExtendUnlimitedLivesWindow.unlimitedLivesText":"The time of Unlimited Lives is over! Extend it for another 3 days now!","sendLiveRequest.title":"Catch a life!","sendLiveRequest.message":"I sent you a life, launch the game to get it!","askLiveRequest.title":"Send me a life, please!","askLiveRequest.message":"I need your help, start the game and send me a life!","thanksForLiveRequest.title":"Thank you for the life!","thanksForLiveRequest.message":"Thank you for sending me the life, you helped me a lot!","UnlimitedLives.Title":"Unlimited lives","UnlimitedLives.Description":"Unlimited Lives for 3 days!","UnlimitedLivesBought":"You bought Unlimited Lives!","FreeUnlimitedLivesWindow.title":"No lives left","FreeUnlimitedLivesWindow.unlimitedLivesText":"Lives are over! Get unlimited lives for another 3 hours now!","FreeUnlimitedLivesWindow.force":"Do not stop playing now! Try beating the levels with unlimited lives!"}',
inline: !0
},
minigame_localization_json: {
data: '{"MiniGameWindow.Text":"Choose one of the boxes!","MiniGameWindow.Title":"Daily game","MiniGameRewardWindow.title":"Your prize","MiniGameRewardWindow.text":"See you tomorrow!","MiniGame.ClosedText":"Daily game is not ready!"}',
inline: !0
},
piggybank_localization_json: {
data: '{"PiggyBankWindow.Title":"Kitty Bank","PiggyBankWindow.Title.Full":"Kitty Bank is full!","PiggyBankWindow.ok":"ok","PiggyBankWindow.bottom_button_hint":"Not enough coins","PiggyBankWindow.desc1":"Complete levels and collect coins. Collect %{value} coins to open the Kitty Bank.","PiggyBankWindow.desc2":"You can open the Kitty Bank! Or continue collecting coins to open the Kitty Bank for the best price.","PiggyBankWindow.text1.Full":"Kitty Bank is full! Open it to get coins for the best price.","PiggyBankWindow.text2":"Offer ends in:","PiggyBankRulesWindow.title":"How does it work?","PiggyBankRulesWindow.thirdStage":"Buy the Kitty Bank","PiggyBankRulesWindow.firstStage":"Beat levels","PiggyBankRulesWindow.secondStage":"Collect coins"}',
inline: !0
},
shares_json: {
data: '{"Share.victory.Name":"Level completed!","Share.victory.Description":"I passed a level! It\'s an amazing game, you should try it!","Share.tournament.Name":"Victory!","Share.tournament.Description":"Look what I\'ve won in a tournament!","Share.reward.Name":"Amazing prize!","Share.reward.Description":"I\'ve got a valuable prize, check it out!","Share.achievement.Name":"A New Achievement!","Share.achievement.Description":"Look at what I\'ve achieved!","Share.bonus_world.Name":"Expedition finished!","Share.bonus_world.Description":"I went on a glorious adventure!","Share.default.Name":"Amazing Game!","Share.default.Description":"Join this exciting game, let\'s play together!"}',
inline: !0
},
meta_json: {
data: '{"background_name_0":"San Francisco","background_name_1":"Paris","background_name_2":"Moscow","background_name_3":"Rome","background_name_4":"Venice","background_name_5":"Barcelona","background_name_6":"Tokyo","background_name_7":"London","background_name_8":"Oberstdorf","background_name_9":"Amsterdam","background_name_10":"Cairo","background_name_11":"Capetown","background_name_12":"Sydney","background_name_13":"Lisbon","background_name_14":"Rio de Janeiro","background_name_15":"Santorini","background_name_16":"Agra","background_name_17":"Pisa","background_name_18":"Cappadocia","background_name_19":"Paro","background_name_20":"Bangkok","background_name_21":"Berlin","background_name_22":"Stonehenge","background_name_23":"Singapore","background_name_24":"Copenhagen","background_name_25":"Casablanca","background_name_26":"Frankfurt","background_name_27":"Hong Kong","background_name_28":"Marsaxlokk","background_name_29":"Bergen","background_name_30":"Amalfi","background_name_31":"Abu Dhabi","background_name_32":"Manama","background_name_33":"Seattle","background_name_34":"Kyoto","background_name_35":"Dubai","background_name_36":"Valencia","background_name_37":"Ottawa","background_name_38":"Kotor","background_name_39":"Florence","background_name_40":"Kaneohe","background_name_41":"Mexico City","background_name_42":"Budapest","background_name_43":"Bora Bora","background_name_44":"Maldives","background_name_45":"New York","background_name_46":"Bavaria","background_name_47":"Prague","background_name_48":"Los Angeles","background_name_49":"Chicago","background_name_50":"Petergof","background_name_51":"Saint Petersburg","background_name_52":"Washington, D.C.","background_name_53":"Kazan","background_name_54":"Meteora","background_name_55":"Helsinki","background_name_56":"Graz","background_name_57":"Vienna","background_name_58":"Venice","background_name_59":"Istanbul","background_name_60":"Sault","background_name_61":"Niangjiguan","background_name_62":"Seoul","background_name_63":"Chiapas","background_name_64":"Laguna Beach","background_name_65":"New Delhi","background_name_66":"Beijing","Simple.Force":"Collect stars to open new locations and get helpful rewards!","AdminSetMethaProgress.Text":"Game administrators have changed your background number to %{bgIndex}. \\nAccept the changes?","AdminSetMethaProgress.Text.Unavailable":"Game administrators have changed your background number. Update your game version to apply new progress."}',
inline: !0
},
project_json: {
data: '{"woodenblock":"Wooden blocks: brain puzzle","BoosterOffer.title":"Bomb Stash","BoosterOffer.description":"More BOOM for your buck! Bomb booster bundle deal!"}',
inline: !0
}
}
},
language_es: {
urls: {
json: "~#/510baa0b5c.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_fr: {
urls: {
json: "~#/00da86a8da.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_it: {
urls: {
json: "~#/135ab50e56.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_ja: {
urls: {
json: "~#/19d89cb76b.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_ko: {
urls: {
json: "~#/fd133f1a17.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_lv: {
urls: {
json: "~#/064d125f61.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_nl: {
urls: {
json: "~#/e0abed4acb.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_pl: {
urls: {
json: "~#/138885665d.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_pt: {
urls: {
json: "~#/8121190be0.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_ru: {
urls: {
json: "~#/8f374a0279.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_tr: {
urls: {
json: "~#/61241a0249.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
language_zh: {
urls: {
json: "~#/4db3d458ba.json"
},
jsons: {
common_json: "0",
highscore_localization_json: "1",
letter_tournament_localization_json: "2",
lives_localization_json: "3",
meta_json: "4",
minigame_localization_json: "5",
piggybank_localization_json: "6",
project_json: "7",
shares_json: "8",
type_json: "9"
}
},
lantern: {
virtual: !0,
injectTo: ["game"]
},
letter_tournament: {
urls: {}
},
lettertournamentguidewindow: {
urls: {
png: "@ad9aef693a.png",
json: "@44c3cc37d4.json"
},
jsons: {
arrows: "1",
atlas: "0",
rules_stages_1: "2",
rules_stages_2: "3",
rules_stages_3: "4"
}
},
level: {
virtual: !0,
injectTo: ["main"],
jsonIds: ["#_json"]
},
level_start_window: {
urls: {
png: "@4e555c753b.png",
json: "@648fd658ef.json"
},
jsons: {
atlas: "0"
},
frames: {
coins_bg_png: "0",
pot_coins_png: "1"
}
},
loading_scene: {
urls: {
png: "@f68386eb37.png",
json: "@273029a9d9.json"
},
jsons: {
atlas: "0",
logo_json: "1"
}
},
loading_scene_images: {
urls: {
bar_loading: "~#/bar_loading.png",
bg_loading: "~#/bg_loading.png"
}
},
loading_scene_images_horizontal: {
urls: {
background: "@f9de75fbbe.jpg"
},
meta: {
horizontal: !0
}
},
loading_scene_images_vertical: {
urls: {
background: "@e60294eac9.jpg"
},
vertical: !0
},
lose_window: {
virtual: !0,
injectTo: ["game"],
frameIds: ["level_failed_heart_png", "level_failed_heart_empty_png"],
jsonIds: ["level_failed_small_hearts_json", "lose_json"],
soundIds: ["lose_effect"]
},
lottery: {
virtual: !0,
injectTo: ["tile_shop", "main"],
frameIds: ["#_en", "#_ru", "ok_#", "ok_#_10k", "vk_#"]
},
main: {
urls: {
task_done_sfx: "$c8ff12607c.mp3",
show_up_effect: "$3498a985b4.mp3",
fly_effect: "$727b5c2529.mp3",
piggy_reward_close: "$2700cf10d9.mp3",
piggy_reward_open: "$17f1b14382.mp3",
appear_sfx: "$4c0b6fe03d.mp3",
press_effect: "$de043d48db.mp3",
booster_before_selection_effect: "$38ae3b0c9b.mp3",
booster_before_cancel_effect: "$50243dfc84.mp3",
coins_drop_effect: "$887037b04e.mp3",
piggybank_coins_full_effect: "$3ff92c9a0e.mp3",
piggybank_coins_effect: "$31d3bb65a8.mp3",
prize_view_created_effect: "$2ab1bf8cfb.mp3",
win_reward_box_effect: "$6bd60080a4.mp3",
win_reward_effect: "$01b4008f40.mp3",
reward_window_effect: "$0b4efab43c.mp3",
background_music_map: "$0cb0d3d327.mp3",
click_effect: "$1a1813bfae.mp3",
coins_effect: "$8e71c0d2cf.mp3",
congratulate_sfx: "$7d66286d37.mp3",
notification_effect: "$f05bae6a79.mp3",
opening_lock_effect: "$564e8ed8cb.mp3",
play_button_effect: "$0caa47ecd1.mp3",
lives_fly_finish_effect: "$158e7e348d.mp3",
simple_complete_bg_effect: "$0e34c2da05.mp3",
simple_transition_effect: "$0907b81eda.mp3",
simple_win_effect: "$a3e89cda23.mp3",
star_collect_effect: "$ddae201591.mp3",
window_effect: "$ec6d9dacb8.mp3",
basefont_ttf: {
type: "font",
name: "BryndanWrite_fix",
srcs: ["~fonts/bryndan_write_fix-a77c2f0f7a.eot", "~fonts/bryndan_write_fix-a77c2f0f7a.ttf"]
},
png: "@7b7bd854be.png",
json: "@a56c77e4c0.json"
},
jsons: {
friday_schedule: {
data: '[{"features":["periodic_sale"],"start":"2023-11-24T00:00:00.000Z","finish":"2023-11-27T23:59:00.000Z"},{"features":["halloween"],"start":"2023-09-18T00:00:00.000Z","finish":"2023-10-29T23:59:00.000Z","debug":true},{"features":["xmas"],"start":"2023-12-18T00:00:00.000Z","finish":"2024-01-10T23:59:00.000Z"}]',
inline: !0
},
ads_bubble_json: "1",
arrow_json: "2",
atlas: "0",
avatar_spark_json: "3",
bg_person: "4",
booster_offer_icon_json: "5",
coins_reward_json: "6",
complete_json: "7",
dailycup_icon_json: "8",
flash_json: "9",
flying_ad_json: "a",
hero_json: "b",
hero_minimal_json: "c",
hovering_json: "d",
invite_icon_json: "e",
level_json: "f",
minigame_json: "g",
mission_letter_icon_json: "h",
noads_icon_json: "i",
pack1_icon_json: "l",
pack2_icon_json: "l",
pack_icon_json: "l",
piggybank_icon_json: "m",
play_button_transition_json: "n",
present_json: "o",
prize_json: "p",
progress_bar_spark_json: "q",
rays_json: "r",
replace_all_json: "s",
reward_spine_json: "t",
show_up_json: "u",
sparks_json: "v",
star_json: "w",
transition_curtains_json: "x",
transition_person_json: "y",
treasurebag_json: "z",
undo_json: "A",
vk_json: "B",
wait_json: "C",
wait_transition_json: "D",
xmas_window: "E",
xmas_window_title: "F"
},
frames: {
push_icon: "0",
revert_icon: "1",
delete_button: "2",
scroll_content_bg: "3",
loading: "4",
regular_button_on: "5",
regular_button: "6",
scroll_bg: "6",
android_avatar: "7",
ios_avatar: "8",
ad_icon_png: "9",
kred_icon_png: "a",
ok_icon_png: "b",
sign_in_button_on_png: "c",
sign_in_button_png: "d",
snapshots_create_clip: "e",
icon_edit: "f",
icon_error: "g",
snapshot_rec: "h",
icon_report: "i",
snapshot: "j",
icon_stages: "k",
snapshot_stop: "l",
label_playback: "m",
label_rec: "n",
lock: "o",
editbox_bg_png: "p",
nostroke56pt_0: "q",
nostroke56pt_1: "r",
nostroke56pt_2: "s",
nostroke56pt_3: "t",
nostroke56pt_4: "u",
nostroke56pt_5: "v",
nostroke56pt_6: "w",
nostroke56pt_7: "x",
nostroke56pt_8: "y",
nostroke56pt_9: "z",
nostroke56pt_asterisk: "A",
nostroke56pt_colon: "B",
nostroke56pt_minus: "C",
nostroke56pt_percent: "D",
nostroke56pt_plus: "E",
nostroke56pt_point: "F",
nostroke56pt_slash: "G",
nostroke56pt_space: "H",
nostroke56pt_x: "I",
default41pt_0: "J",
default41pt_1: "K",
default41pt_2: "L",
default41pt_3: "M",
default41pt_4: "N",
default41pt_5: "O",
default41pt_6: "P",
default41pt_7: "Q",
default41pt_8: "R",
default41pt_9: "S",
default41pt_asterisk: "T",
default41pt_colon: "U",
default41pt_minus: "V",
default41pt_percent: "W",
default41pt_plus: "X",
default41pt_point: "Y",
default41pt_slash: "Z",
default41pt_space: "10",
default41pt_x: "11",
default56pt_0: "12",
default56pt_1: "13",
default56pt_2: "14",
default56pt_3: "15",
default56pt_4: "16",
default56pt_5: "17",
default56pt_6: "18",
default56pt_7: "19",
default56pt_8: "1a",
default56pt_9: "1b",
default56pt_asterisk: "1c",
default56pt_colon: "1d",
default56pt_minus: "1e",
default56pt_percent: "1f",
default56pt_plus: "1g",
default56pt_point: "1h",
default56pt_slash: "1i",
default56pt_space: "1j",
default56pt_x: "1k",
login_draugiem_icon_png: "1l",
login_fs_icon_png: "1m",
login_kongregate_icon_png: "1n",
login_mm_icon_png: "1o",
login_mobage_icon_png: "1p",
login_ok_icon_png: "1q",
login_plinga_icon_png: "1r",
login_vk_icon_png: "1s",
white_button_png: "1t",
white_outline_button_on_png: "1u",
white_outline_button_png: "1v",
underline_png: "1w",
pixel_png: "1x",
button_off: "1y",
button_on: "1z",
button: "1A",
plus_button: "1B",
lottery_en: "1C",
lottery_ru: "1D",
ok_lottery_10k: "1E",
ok_lottery: "1F",
vk_lottery: "1G",
orangery_bg_dark: "1H",
orangery_bg_light: "1I",
plus: "1J",
attention_png: "1K",
avatar_frame: "1L",
avatar_frame2: "1M",
default_avatar: "1N",
user_avatar: "1O",
animations_coin: "1P",
booster_before_bg_off_png: "1Q",
booster_before_bg_on_png: "1R",
booster_before_bg_png: "1S",
booster_before_check_icon_png: "1T",
booster_before_green_button_png: "1U",
booster_before_lantern_icon_png: "1V",
booster_before_level_bg: "1W",
booster_before_lock_png: "1X",
booster_before_purple_button_png: "1Y",
coin_icon_png: "1Z",
gold_icon_png: "20",
dialogue_arrow_png: "21",
bg_png: "22",
dialogue_name: "23",
mini_arrow_bg_png: "24",
bg_minimal_png: "25",
fallsale_badge: "26",
fallsale_title: "27",
delimiter_blue: "28",
bar_blue_large: "29",
bar_blue_small: "2a",
bar_blue: "2b",
bar_green_large: "2c",
bar_green: "2d",
delimiter_orange: "2e",
bar_orange_large: "2f",
bar_orange_small: "2g",
bar_orange: "2h",
delimiter_red: "2i",
bar_red_large: "2j",
bar_red_small: "2k",
bar_red: "2l",
bg_dark_large: "2m",
bg_dark_small: "2n",
bg_dark: "2o",
bg_green_large: "2p",
bg_green: "2q",
bonussale_gift: "2r",
shop_coin_png: "2s",
coin_small_png: "2t",
reward_coin_png: "2u",
life_small_png: "2v",
life_unlim_small: "2w",
life_unlim: "2x",
life_png: "2y",
noads_png: "2z",
shop_gold_png: "2A",
gold_small_png: "2B",
reward_gold_png: "2C",
simple_star_png: "2D",
arrow_png: "2E",
bg_simple: "2F",
bar_simple: "2G",
closed_bg_vertical_png: "2H",
closed_bg_png: "2I",
frame_gold_png: "2J",
frame_silver_png: "2K",
lock_png: "2L",
star_png: "2M",
tape_png: "2N",
bg_vip: "2O",
bar_vip: "2P",
xmas_menubar: "2Q",
xmas_sidebar_bg: "2R",
xmas_window_top: "2S",
blue_button_on_png: "2T",
blue_button_png: "2U",
button_disabled_png: "2V",
button_on_png: "2W",
button_png: "2X",
close_band_icon: "2Y",
window_close_on_png: "2Z",
close_small_on: "30",
close_small: "31",
window_close_png: "32",
community_icon: "33",
copyid_icon: "34",
delete_icon: "35",
exit_icon: "36",
giveup_icon: "37",
help_button_off_png: "38",
help_button_on_png: "39",
help_button_png: "3a",
home_icon: "3b",
language_icon: "3c",
promocode_icon: "3d",
red_button_on: "3e",
red_button: "3f",
scene_exit_button: "3g",
small_blue_button_on: "3h",
small_blue_button: "3i",
small_button_off: "3j",
small_button_on: "3k",
small_button: "3l",
music_off_png: "3m",
music_on_png: "3n",
sound_off_png: "3o",
sound_on_png: "3p",
support_icon: "3q",
background_png: "3r",
check_mark_png: "3s",
back_button_on_png: "3t",
back_button_png: "3u",
back_icon_png: "3v",
control_button_on_png: "3w",
control_button_png: "3x",
menu_icon_png: "3y",
switch_icon_png: "3z",
icon_bg: "3A",
tooltip_arrow: "3B",
tooltip_bubble: "3C",
bg_dailytask: "3D",
bar_dailytask: "3E",
mark_png: "3F",
icon: "3G",
notification_bg: "3H",
friend_message_bg_png: "3I",
send_coins_icon: "3J",
accept_stuck_coins_icon: "3K",
send_life_icon: "3L",
menubar_bg_png: "3M",
bar_timer_png: "3N",
coin_png: "3O",
menubar_life_png: "3P",
plus_button_on_png: "3Q",
plus_button_png: "3R",
gold_png: "3S",
unlim_png: "3T",
badge: "3U",
scrollbar_png: "3V",
friend_bg_png: "3W",
treasurebag_bg_png: "3X",
icon_text_bg: "3Y",
amount_bg_you_png: "3Z",
amount_bg_png: "40",
badge_1: "41",
badge_2: "42",
badge_3: "43",
prize_1: "44",
prize_2: "45",
prize_3: "46",
prize_4: "47",
prize_5: "48",
row_player_png: "49",
row_you_png: "4a",
table_bg_png: "4b",
shop_tab_off: "4c",
shop_tab_on: "4d",
dailytasks_icon: "4e",
vertical_shop_tab_off: "4f",
vertical_shop_tab_on: "4g",
round_tab_bg_selected: "4h",
round_tab_bg: "4i",
timer_bg_png: "4j",
timer_png: "4k",
toolbar_daily_tasks_icon_png: "4l",
toolbar_dailybonus_icon_png: "4m",
toolbar_leader_board_icon_png: "4n",
toolbar_mail_icon_png: "4o",
toolbar_rewarded_video_icon_png: "4p",
toolbar_bg_png: "4q",
tooltip_shadow_arrow_png: "4r",
tooltip_arrow_png: "4s",
tooltip_bg_png: "4t",
tutorial_click_png: "4u",
tutorial_hand_png: "4v",
decor_league_png: "4w",
decor_shop_png: "4x",
league_arrow_png: "4y",
window_bg_png: "4z",
windows_details_bg_png: "4A",
windows_group_bg_png: "4B",
window_title_bg_secondary_png: "4C",
booster_clear_pieces_png: "4D",
booster_replace_all_png: "4E",
booster_undo_piece_png: "4F",
clear_pieces_png: "4G",
jewel_png: "4H",
zen_png: "4I",
letter_mission: "4J"
},
important: ["click_effect", "window_effect"]
},
menubar: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: "coin_png gold_png #_bg_png bar_timer_png plus_button_png plus_button_on_png #_life_png unlim_png xmas_#".split(" "),
jsonIds: ["sparks_json"],
soundIds: ["lives_fly_finish_effect", "coins_effect"]
},
metha_top_layer_0: {
urls: {}
},
minigame: {
virtual: !0,
injectTo: ["main"],
jsonIds: ["#_json"]
},
moves: {
virtual: !0,
injectTo: ["game"],
frameIds: ["#_icon", "game_#_icon"]
},
noads_window: {
urls: {
png: "@a033adbde5.png",
json: "@166df435f8.json"
},
jsons: {
atlas: "0",
noads_gift_json: "1"
},
frames: {
noads_bonus_bg_png: "0",
tile_icon: "1",
badge_off_png: "2",
badge_png: "3"
}
},
noconnection_window: {
urls: {
png: "@561537821c.png",
json: "@241d8974b9.json"
},
jsons: {
atlas: "0",
no_connection_json: "1"
}
},
notification: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: ["icon", "#_bg"],
soundIds: ["task_done_sfx"]
},
passruleswindow: {
urls: {}
},
path: {
virtual: !0,
injectTo: ["game"],
frameIds: ["line_png"]
},
person_hero: {
virtual: !0,
injectTo: ["main"],
jsonIds: ["hero_json"]
},
person_minimal_hero: {
virtual: !0,
injectTo: ["main"],
jsonIds: ["hero_minimal_json"]
},
persons_main: {
virtual: !0,
injectTo: ["main"]
},
piggy_bank: {
virtual: !0,
injectTo: ["#_window"],
jsonIds: ["#_json", "button_light", "coin_light"],
soundIds: ["coins_light_effect", "jump_effect", "piggy_load_coins", "piggy_progress_update"]
},
piggy_bank_reward: {
virtual: !0,
injectTo: ["game"],
frameIds: ["#_icon"],
jsonIds: ["#_json", "coins_animation_json"]
},
piggy_bank_window: {
urls: {
piggy_load_coins: "$d71bda24df.mp3",
piggy_progress_update: "$ef32c75450.mp3",
coins_light_effect: "$c16f978ddc.mp3",
jump_effect: "$8ef99acb7c.mp3",
png: "@19b05e5e5c.png",
json: "@ef635e6f3a.json"
},
jsons: {
atlas: "0",
button_light: "1",
coin_light: "2",
piggy_bank_json: "3"
},
frames: {
big_timer_bg_png: "0",
big_timer_png: "1"
},
important: ["piggy_progress_update"]
},
piggybankruleswindow: {
urls: {
png: "@2b40c8abea.png",
json: "@87c77b689a.json"
},
jsons: {
arrows: "1",
atlas: "0",
guide_stages_1: "2",
guide_stages_2: "3",
guide_stages_3: "4"
}
},
pixel: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: ["#_png"]
},
play_button: {
virtual: !0,
injectTo: ["main"],
frameIds: ["jewel_png"],
jsonIds: ["#_transition_json"],
soundIds: ["#_effect"]
},
prize: {
virtual: !0,
injectTo: ["dailytasks", "main"],
frameIds: ["mark_png"],
jsonIds: ["#_json"],
soundIds: ["#_view_created_effect"]
},
progress_bar: {
virtual: !0,
injectTo: ["dailytasks", "game", "vip_window", "main"],
frameIds: "bar_dailytask bg_dailytask bg_vip bar_vip bg_dark_small bg_dark bg_dark_large bg_green bg_green_large bar_red_small bar_orange_small bar_blue_small bar_red bar_orange bar_blue bar_green bar_red_large bar_orange_large bar_blue_large bar_green_large bar_simple bg_simple delimiter_red delimiter_orange delimiter_blue".split(" "),
jsonIds: ["flash_json"]
},
prolongation_window: {
virtual: !0,
injectTo: ["game"],
frameIds: ["goals_bg_png", "label_moves_png", "text_bg_png", "foreground_png"],
jsonIds: ["bonus_json", "label_moves_json", "timer_json"],
soundIds: ["continue_effect", "timer_tick", "timer_start"]
},
rate_window: {
urls: {
png: "@4f541d1141.png",
json: "@bd56747d18.json"
},
jsons: {
atlas: "0"
},
frames: {
stars_png: "0",
text_bg_png: "1"
}
},
request_center: {
virtual: !0,
injectTo: ["main"],
frameIds: ["send_coins_icon", "accept_stuck_coins_icon", "friend_message_bg_png", "send_life_icon"]
},
reward_element: {
virtual: !0,
injectTo: ["game"],
frameIds: ["#_bg_png"],
soundIds: ["reward_gold_effect"]
},
reward_icons: {
virtual: !0,
injectTo: ["dailytasks", "game", "tile_shop", "choosesave_window", "main"],
frameIds: "gold_small_png coin_small_png reward_gold_png reward_coin_png shop_gold_png shop_coin_png bonussale_gift noads_png life_png life_small_png life_unlim life_unlim_small simple_star_png booster_replace_all_png booster_clear_pieces_png booster_undo_piece_png".split(" ")
},
scrollbar: {
virtual: !0,
injectTo: ["dailytasks", "chat", "main"],
frameIds: ["#_png"]
},
select_friend_window: {
virtual: !0,
injectTo: ["main"],
frameIds: ["friend_bg_png"]
},
shares: {
urls: {
default: "~#/default.jpg",
default_en_1: "~#/d4ceec8a8a.jpg",
victory_en_1: "~#/6e8cef6f3a.jpg",
victory_en_2: "~#/cfc9d4d160.jpg",
victory_en_3: "~#/d82150e0a8.jpg"
}
},
sidebar: {
virtual: !0,
injectTo: ["main"],
frameIds: ["icon_bg", "lock", "icon_text_bg", "xmas_#_bg"],
jsonIds: "dailycup_icon_json pack_icon_json pack1_icon_json pack2_icon_json invite_icon_json noads_icon_json piggybank_icon_json mission_letter_icon_json booster_offer_icon_json".split(" ")
},
sign_in_window: {
urls: {
png: "@1dbb141bac.png",
json: "@aa67961aac.json"
},
jsons: {
atlas: "0",
sign_in_icon_json: "1"
}
},
simple: {
virtual: !0,
injectTo: ["main"],
frameIds: "arrow_png frame_gold_png frame_silver_png star_png tape_png lock_png closed_bg_png closed_bg_vertical_png".split(" "),
jsonIds: ["present_json", "star_json", "avatar_spark_json", "progress_bar_spark_json"],
soundIds: ["star_collect_effect", "#_win_effect", "#_transition_effect", "opening_lock_effect", "#_complete_bg_effect"]
},
simple_background_horizontal_0: {
urls: {
background: "@2b1aa87595.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_1: {
urls: {
background: "@db0a210fe6.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_10: {
urls: {
background: "@8ea530f30b.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_11: {
urls: {
background: "@5de2b0cc94.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_12: {
urls: {
background: "@076bc90efa.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_13: {
urls: {
background: "@2bf7ccd670.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_14: {
urls: {
background: "@79bdb28b1d.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_15: {
urls: {
background: "@af40c9f874.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_16: {
urls: {
background: "@0286aebd6d.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_17: {
urls: {
background: "@f419370fe2.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_18: {
urls: {
background: "@403a15e948.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_19: {
urls: {
background: "@d895dfa6b6.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_2: {
urls: {
background: "@c3d14b39d0.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_3: {
urls: {
background: "@ade5b2ea08.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_4: {
urls: {
background: "@29fc6cc5b0.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_5: {
urls: {
background: "@c0d8ecd4dc.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_6: {
urls: {
background: "@e25bef172d.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_7: {
urls: {
background: "@4033d122d8.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_8: {
urls: {
background: "@a0f22be5ec.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_horizontal_9: {
urls: {
background: "@4405f71965.jpg"
},
meta: {
horizontal: !0
}
},
simple_background_icon_0: {
urls: {
icon: "@18b4627402.png"
}
},
simple_background_icon_1: {
urls: {
icon: "@484835f518.png"
}
},
simple_background_icon_10: {
urls: {
icon: "@e46fc2295b.png"
}
},
simple_background_icon_11: {
urls: {
icon: "@7927a80768.png"
}
},
simple_background_icon_12: {
urls: {
icon: "@d24b9d1b1d.png"
}
},
simple_background_icon_13: {
urls: {
icon: "@35422ba8de.png"
}
},
simple_background_icon_14: {
urls: {
icon: "@ad187c373a.png"
}
},
simple_background_icon_15: {
urls: {
icon: "@4cf2809645.png"
}
},
simple_background_icon_16: {
urls: {
icon: "@a97deca8e3.png"
}
},
simple_background_icon_17: {
urls: {
icon: "@062fc590e7.png"
}
},
simple_background_icon_18: {
urls: {
icon: "@c8fc06b76f.png"
}
},
simple_background_icon_19: {
urls: {
icon: "@b2c6937ad9.png"
}
},
simple_background_icon_2: {
urls: {
icon: "@9daffc69f3.png"
}
},
simple_background_icon_3: {
urls: {
icon: "@35f3e9c1d5.png"
}
},
simple_background_icon_4: {
urls: {
icon: "@ebecede3d0.png"
}
},
simple_background_icon_5: {
urls: {
icon: "@848c716fff.png"
}
},
simple_background_icon_6: {
urls: {
icon: "@16df25e9a3.png"
}
},
simple_background_icon_7: {
urls: {
icon: "@1543a63b41.png"
}
},
simple_background_icon_8: {
urls: {
icon: "@5516e2dfba.png"
}
},
simple_background_icon_9: {
urls: {
icon: "@d59828a6d3.png"
}
},
simple_background_icon_coming_soon: {
urls: {
icon: "@945a05d429.png"
}
},
simple_background_vertical_0: {
urls: {
background: "@f65809f7d5.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_1: {
urls: {
background: "@744ba3e6f3.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_10: {
urls: {
background: "@5c2acadb00.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_11: {
urls: {
background: "@7329c4c461.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_12: {
urls: {
background: "@8cf30deace.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_13: {
urls: {
background: "@c79effc31a.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_14: {
urls: {
background: "@9d41fd81d0.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_15: {
urls: {
background: "@0499e82dbb.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_16: {
urls: {
background: "@33fe6d4e72.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_17: {
urls: {
background: "@91d3b3d091.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_18: {
urls: {
background: "@1bfc461c3b.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_19: {
urls: {
background: "@2d999d7df4.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_2: {
urls: {
background: "@09cdf3f456.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_3: {
urls: {
background: "@6480eee25a.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_4: {
urls: {
background: "@22b12d23d9.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_5: {
urls: {
background: "@27a7ce252c.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_6: {
urls: {
background: "@1d9a580ae8.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_7: {
urls: {
background: "@9715da53ab.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_8: {
urls: {
background: "@1077bfde50.jpg"
},
meta: {
vertical: !0
}
},
simple_background_vertical_9: {
urls: {
background: "@d829d132e3.jpg"
},
meta: {
vertical: !0
}
},
social_buttons: {
urls: {
png: "@07d859b8c1.png",
json: "@043658b21f.json"
},
jsons: {
atlas: "0"
},
frames: {
sign_in_apple: "0",
sign_in_facebook: "1",
sign_in_google: "2"
}
},
socialicons: {
virtual: !0,
injectTo: ["main"],
frameIds: "login_ok_icon_png login_vk_icon_png login_mm_icon_png login_fs_icon_png login_draugiem_icon_png login_mobage_icon_png login_plinga_icon_png login_kongregate_icon_png".split(" ")
},
sounds: {
urls: {}
},
starter_pack: {
urls: {
starter_pack_effect: "$f97881fb75.mp3",
png: "@09d39433d4.png",
json: "@ee5ec9a0c4.json"
},
jsons: {
atlas: "0",
pack_json: "1",
replace_all_json: "2",
undo_json: "3"
},
frames: {
ad_icon_png: "0",
kred_icon_png: "1",
ok_icon_png: "2",
sign_in_button_on_png: "3",
sign_in_button_png: "4",
nostroke56pt_0: "5",
nostroke56pt_1: "6",
nostroke56pt_2: "7",
nostroke56pt_3: "8",
nostroke56pt_4: "9",
nostroke56pt_5: "a",
nostroke56pt_6: "b",
nostroke56pt_7: "c",
nostroke56pt_8: "d",
nostroke56pt_9: "e",
nostroke56pt_asterisk: "f",
nostroke56pt_colon: "g",
nostroke56pt_minus: "h",
nostroke56pt_percent: "i",
nostroke56pt_plus: "j",
nostroke56pt_point: "k",
nostroke56pt_slash: "l",
nostroke56pt_space: "m",
nostroke56pt_x: "n",
default41pt_0: "o",
default41pt_1: "p",
default41pt_2: "q",
default41pt_3: "r",
default41pt_4: "s",
default41pt_5: "t",
default41pt_6: "u",
default41pt_7: "v",
default41pt_8: "w",
default41pt_9: "x",
default41pt_asterisk: "y",
default41pt_colon: "z",
default41pt_minus: "A",
default41pt_percent: "B",
default41pt_plus: "C",
default41pt_point: "D",
default41pt_slash: "E",
default41pt_space: "F",
default41pt_x: "G",
default56pt_0: "H",
default56pt_1: "I",
default56pt_2: "J",
default56pt_3: "K",
default56pt_4: "L",
default56pt_5: "M",
default56pt_6: "N",
default56pt_7: "O",
default56pt_8: "P",
default56pt_9: "Q",
default56pt_asterisk: "R",
default56pt_colon: "S",
default56pt_minus: "T",
default56pt_percent: "U",
default56pt_plus: "V",
default56pt_point: "W",
default56pt_slash: "X",
default56pt_space: "Y",
default56pt_x: "Z",
big_digits72pt_0: "10",
big_digits72pt_1: "11",
big_digits72pt_2: "12",
big_digits72pt_3: "13",
big_digits72pt_4: "14",
big_digits72pt_5: "15",
big_digits72pt_6: "16",
big_digits72pt_7: "17",
big_digits72pt_8: "18",
big_digits72pt_9: "19",
big_digits72pt_asterisk: "1a",
big_digits72pt_colon: "1b",
big_digits72pt_minus: "1c",
big_digits72pt_percent: "1d",
big_digits72pt_plus: "1e",
big_digits72pt_point: "1f",
big_digits72pt_slash: "1g",
big_digits72pt_space: "1h",
big_digits72pt_x: "1i",
big_digits97pt_0: "1j",
big_digits97pt_1: "1k",
big_digits97pt_2: "1l",
big_digits97pt_3: "1m",
big_digits97pt_4: "1n",
big_digits97pt_5: "1o",
big_digits97pt_6: "1p",
big_digits97pt_7: "1q",
big_digits97pt_8: "1r",
big_digits97pt_9: "1s",
big_digits97pt_asterisk: "1t",
big_digits97pt_colon: "1u",
big_digits97pt_minus: "1v",
big_digits97pt_percent: "1w",
big_digits97pt_plus: "1x",
big_digits97pt_point: "1y",
big_digits97pt_slash: "1z",
big_digits97pt_space: "1A",
big_digits97pt_x: "1B",
underline_png: "1C",
attention_png: "1D",
coin_icon_png: "1E",
gold_icon_png: "1F",
blue_button_on_png: "1G",
blue_button_png: "1H",
button_disabled_png: "1I",
button_on_png: "1J",
button_png: "1K",
help_button_off_png: "1L",
help_button_on_png: "1M",
help_button_png: "1N",
red_button_on: "1O",
red_button: "1P",
small_blue_button_on: "1Q",
small_blue_button: "1R",
small_button_off: "1S",
small_button_on: "1T",
small_button: "1U",
clear_pieces_png: "1V"
},
important: ["starter_pack_effect"]
},
table: {
virtual: !0,
injectTo: ["main"],
frameIds: "#_bg_png amount_bg_png amount_bg_you_png row_player_png row_you_png badge_1 badge_2 badge_3 prize_1 prize_2 prize_3 prize_4 prize_5".split(" ")
},
tablerow_icons: {
virtual: !0,
injectTo: ["main"],
frameIds: ["letter_mission"]
},
tabs: {
virtual: !0,
injectTo: ["tile_shop", "main"],
frameIds: "vertical_shop_tab_off vertical_shop_tab_on shop_tab_off shop_tab_on round_tab_bg round_tab_bg_selected dailytasks_icon".split(" ")
},
tile_shop: {
urls: {
badge_appear_effect: "$7102ce72e2.mp3",
png: "@61a57d6964.png",
json: "@3502e2dc3f.json"
},
jsons: {
ads_bubble_json: "1",
atlas: "0",
replace_all_json: "2",
shop_sparkles_large_json: "3",
undo_json: "4"
},
frames: {
ad_icon_png: "0",
kred_icon_png: "1",
ok_icon_png: "2",
sign_in_button_on_png: "3",
sign_in_button_png: "4",
nostroke56pt_0: "5",
nostroke56pt_1: "6",
nostroke56pt_2: "7",
nostroke56pt_3: "8",
nostroke56pt_4: "9",
nostroke56pt_5: "a",
nostroke56pt_6: "b",
nostroke56pt_7: "c",
nostroke56pt_8: "d",
nostroke56pt_9: "e",
nostroke56pt_asterisk: "f",
nostroke56pt_colon: "g",
nostroke56pt_minus: "h",
nostroke56pt_percent: "i",
nostroke56pt_plus: "j",
nostroke56pt_point: "k",
nostroke56pt_slash: "l",
nostroke56pt_space: "m",
nostroke56pt_x: "n",
default41pt_0: "o",
default41pt_1: "p",
default41pt_2: "q",
default41pt_3: "r",
default41pt_4: "s",
default41pt_5: "t",
default41pt_6: "u",
default41pt_7: "v",
default41pt_8: "w",
default41pt_9: "x",
default41pt_asterisk: "y",
default41pt_colon: "z",
default41pt_minus: "A",
default41pt_percent: "B",
default41pt_plus: "C",
default41pt_point: "D",
default41pt_slash: "E",
default41pt_space: "F",
default41pt_x: "G",
default56pt_0: "H",
default56pt_1: "I",
default56pt_2: "J",
default56pt_3: "K",
default56pt_4: "L",
default56pt_5: "M",
default56pt_6: "N",
default56pt_7: "O",
default56pt_8: "P",
default56pt_9: "Q",
default56pt_asterisk: "R",
default56pt_colon: "S",
default56pt_minus: "T",
default56pt_percent: "U",
default56pt_plus: "V",
default56pt_point: "W",
default56pt_slash: "X",
default56pt_space: "Y",
default56pt_x: "Z",
underline_png: "10",
lottery_en: "11",
lottery_ru: "12",
ok_lottery_10k: "13",
ok_lottery: "14",
vk_lottery: "15",
attention_png: "16",
coin_icon_png: "17",
gold_icon_png: "18",
bonussale_gift: "19",
shop_coin_png: "1a",
coin_small_png: "1b",
reward_coin_png: "1c",
life_small_png: "1d",
life_unlim_small: "1e",
life_unlim: "1f",
life_png: "1g",
noads_png: "1h",
shop_gold_png: "1i",
gold_small_png: "1j",
reward_gold_png: "1k",
simple_star_png: "1l",
blue_button_on_png: "1m",
blue_button_png: "1n",
button_disabled_png: "1o",
button_on_png: "1p",
button_png: "1q",
help_button_off_png: "1r",
help_button_on_png: "1s",
help_button_png: "1t",
red_button_on: "1u",
red_button: "1v",
small_blue_button_on: "1w",
small_blue_button: "1x",
small_button_off: "1y",
small_button_on: "1z",
small_button: "1A",
shop_tab_off: "1B",
shop_tab_on: "1C",
dailytasks_icon: "1D",
vertical_shop_tab_off: "1E",
vertical_shop_tab_on: "1F",
badge_off_png: "1G",
badge_png: "1H",
gold_for_video_png: "1I",
refillLives_5_png: "1J",
askLives_png: "1K",
unlimitedLives_png: "1L",
lives_for_video_png: "1M",
blackfridaypack: "1N",
prem_rewards_bg: "1O",
prem_crown: "1P",
prem_tile_icon: "1Q",
prem_tile_bg: "1R",
shop_tile_bg_png: "1S",
shop_coins_large_png: "1T",
shop_coins_medium_png: "1U",
shop_coins_small_png: "1V",
shop_coins_very_small_png: "1W",
offer_description_bg: "1X",
icon_bg: "1X",
description_bg: "1Y",
shop_gold_huge_png: "1Z",
shop_gold_large_png: "20",
shop_gold_medium_png: "21",
shop_gold_small_png: "22",
shop_gold_very_small_png: "23",
shop_title_off: "24",
shop_title: "25",
round_tab_bg_selected: "26",
round_tab_bg: "27",
timer_bg_png: "28",
timer_png: "29",
boosteroffer: "2a",
pack: "2b",
booster_clear_pieces_png: "2c",
booster_replace_all_png: "2d",
booster_undo_piece_png: "2e",
clear_pieces_png: "2f"
},
important: ["badge_appear_effect"]
},
timer: {
virtual: !0,
injectTo: ["game", "tile_shop", "main"],
frameIds: ["#_png", "#_bg_png"]
},
toolbar: {
virtual: !0,
injectTo: ["main"],
frameIds: "#_bg_png #_dailybonus_icon_png #_daily_tasks_icon_png #_mail_icon_png #_leader_board_icon_png #_rewarded_video_icon_png".split(" ")
},
tooltip: {
virtual: !0,
injectTo: ["game", "main"],
frameIds: ["#_bg_png", "#_shadow_arrow_png", "#_arrow_png"]
},
tournament_icon: {
virtual: !0,
injectTo: ["game"],
frameIds: ["mission_letter_png"]
},
transition: {
virtual: !0,
injectTo: ["main"],
jsonIds: ["#_curtains_json", "#_person_json"]
},
treasurebag: {
virtual: !0,
injectTo: ["main"],
frameIds: ["#_bg_png"],
jsonIds: ["#_json"]
},
victory_window: {
virtual: !0,
injectTo: ["game"],
soundIds: ["win_effect"]
},
vip_window: {
urls: {
ads_slapstick: "$d5bb2e748d.mp3",
ads_timer1: "$67c1f8ee84.mp3",
ads_timer2: "$b65d4bc9a9.mp3",
png: "@3280060595.png",
json: "@32622648be.json"
},
jsons: {
atlas: "0",
flash_json: "1",
vip_icon_json: "2"
},
frames: {
delimiter_blue: "0",
bar_blue_large: "1",
bar_blue_small: "2",
bar_blue: "3",
bar_green_large: "4",
bar_green: "5",
delimiter_orange: "6",
bar_orange_large: "7",
bar_orange_small: "8",
bar_orange: "9",
delimiter_red: "a",
bar_red_large: "b",
bar_red_small: "c",
bar_red: "d",
bg_dark_large: "e",
bg_dark_small: "f",
bg_dark: "g",
bg_green_large: "h",
bg_green: "i",
bg_simple: "j",
bar_simple: "k",
bg_vip: "l",
bar_vip: "m",
bg_dailytask: "n",
bar_dailytask: "o"
},
important: ["ads_slapstick", "ads_timer1", "ads_timer2"]
},
windows: {
virtual: !0,
injectTo: ["main"],
frameIds: "window_bg_png window_title_bg_secondary_png #_group_bg_png #_details_bg_png editbox_bg_png xmas_window_top".split(" "),
jsonIds: ["xmas_window", "xmas_window_title"]
}
}
, resolutions = {
high: {
scale: 1,
id: "high",
height: 1334,
webp: !0
},
high: {
scale: 1,
id: "high",
height: 1334,
webp: !0
},
// h1000webp: {
// scale: .75,
// id: "h1000webp",
// height: 1E3,
// webp: !0
// },
h1000: {
scale: .75,
id: "h1000",
height: 1E3,
depth: 6
}
};
var Bundle = function(a, b) {
this.name = a;
this.parse(b)
};
Bundle.prototype.parse = function(a) {
this.virtual = a.virtual;
if (this.injectTo = a.injectTo)
this.injectToSet = cleverapps.createSet(a.injectTo);
this.meta = a.meta;
this.frames = a.frames;
this.regions = {};
this.jsons = a.jsons;
this.urls = a.urls;
a.important && (this.important = a.important);
a.originalPaths && (this.originalPaths = a.originalPaths);
a.unused && (this.unused = a.unused);
for (var b in this.frames)
this.frames[b] = new VirtualFrame(this.name,b,this.frames[b]);
for (var c in this.jsons)
this.jsons[c] = new VirtualJson(this.name,c,this.jsons[c]);
for (var d in this.urls)
this.urls[d] = new VirtualUrl(this.name,d,this.urls[d])
}
;
Bundle.prototype.save = function() {
var a = {
virtual: this.virtual,
injectTo: this.injectTo,
meta: this.meta,
originalPaths: this.originalPaths,
urls: this.urls,
important: this.important
}, b = {}, c;
for (c in this.frames)
b[c] = this.frames[c].save();
a.frames = b;
b = {};
for (var d in this.jsons)
b[d] = this.jsons[d].save();
a.jsons = b;
d = {};
for (var e in this.urls)
d[e] = this.urls[e].save();
a.urls = d;
return JSON.parse(JSON.stringify(a))
}
;
Bundle.prototype.onLoad = function(a) {
a = a || function() {}
;
var b;
if (this.urls.json) {
var c = cc.loader.getRes(this.urls.json);
for (b in this.jsons) {
var d = this.jsons[b]
, e = d.inline ? d.data : c[d.name];
cleverapps.config.debugMode && cleverapps.git && (e = cleverapps.git.urls[d.originalPath()] || e);
d.setJsonData(e)
}
}
if (this.jsons.atlas) {
var f = this.jsons.atlas.getJson();
this.jsons.atlas.onUnload();
try {
var g = BundleUtils.parseAtlas(f)
} catch (m) {
throw console.error("cant parse parseMinifiedAtlas - " + this.name, f),
m;
}
}
for (b in this.frames)
c = this.frames[b],
void 0 === g.frames[c.name] ? console.error(c.name, f) : (d = g.frames[c.name],
d.spriteFrame = !0,
c.setFrameData(d));
if (g) {
this.atlas = {};
if ("cocos2d" === engine) {
var h = BundleUtils.createPage(g, cc.textureCache.getTextureForKey(this.urls.png)), k;
for (k in g.frames)
c = g.frames[k],
c.spriteFrame || (this.regions[k] = BundleUtils.createRegion(k, c, h));
this.atlas.dispose = function() {
h && h.texture.dispose()
}
;
this.atlas.findRegion = function(m) {
return this.regions[m]
}
.bind(this)
} else
this.atlas.text = BundleUtils.getAtlasText(g),
this.atlas.bundleName = this.name;
g = void 0
}
cc.loader.release(this.urls.json);
for (b in this.urls)
if (g = cc.textureCache.getTextureForKey(this.urls[b]))
g.bundleName = this.name;
this.loaded = !0;
a()
}
;
Bundle.prototype.onUnload = function() {
this.loaded = !1;
delete this.atlas;
for (var a in this.frames)
this.frames[a].onUnload();
for (var b in this.jsons)
this.jsons[b].onUnload();
this.regions = {}
}
;
Bundle.prototype.listSoundUrls = function(a) {
return cc.sys.isWebViewAudio || cleverapps.environment.isLoaderScene() || this.virtual || cleverapps.config.debugMode && "important_only" === cleverapps.dataLoader.load(DataLoader.TYPES.TEST_SOUNDS) ? [] : Object.values(this.urls).filter(function(b) {
return b.isSound() && b.getUrl() && !b.isImportant() && (a || !b.isLazy())
}).map(function(b) {
return b.getUrl()
})
}
;
Bundle.prototype.listUrls = function() {
return this.virtual ? [] : Object.values(this.urls).filter(function(a) {
return "playable" === connector.info.source && ("string" === typeof a.getUrl() && (void 0 !== cc.loader.cache[a.getUrl()] || -1 !== a.getUrl().indexOf(".json")) || a.getUrl() && "font" === a.getUrl().type) || a.isSound() && (cc.sys.isWebViewAudio || !a.isImportant() || a.isLazy()) ? !1 : a
}).map(function(a) {
return a.getUrl()
}).filter(Boolean)
}
;
Bundle.prototype.isInjectTo = function(a) {
return Array.isArray(a) ? a.some(this.isInjectTo.bind(this)) : this.name === a || this.injectTo && this.injectTo.includes(a)
}
;
Bundle.prototype.getBundleName = function() {
return this.name
}
;
Bundle.prototype.isLoaded = function() {
return cleverapps.bundleLoader.isLoaded(this.name)
}
;
var BundleUtils = {
createRegion: function(a, b, c) {
var d = new spine.TextureAtlasRegion;
d.name = a;
d.page = c;
d.rotate = b.rotated;
d.u = b.rect.x / c.width;
d.v = b.rect.y / c.height;
d.rotate ? (d.u2 = (b.rect.x + b.rect.height) / c.width,
d.v2 = (b.rect.y + b.rect.width) / c.height) : (d.u2 = (b.rect.x + b.rect.width) / c.width,
d.v2 = (b.rect.y + b.rect.height) / c.height);
d.x = b.rect.x;
d.y = b.rect.y;
d.width = b.rect.width;
d.height = b.rect.height;
d.originalWidth = b.size.width;
d.originalHeight = b.size.height;
d.offsetX = b.offset.x;
d.offsetY = b.offset.y;
d.index = -1;
d.texture = c.texture;
return d
},
createPage: function(a, b) {
var c = new sp.SkeletonTexture({
width: b.getPixelsWide(),
height: b.getPixelsHigh()
});
c.setRealTexture(b);
b = new spine.TextureAtlasPage;
b.name = a.meta.image;
b.width = a.meta.size.w;
b.height = a.meta.size.h;
b.minFilter = spine.Texture.filterFromString("Linear");
b.magFilter = spine.Texture.filterFromString("Linear");
b.uWrap = spine.TextureWrap.ClampToEdge;
b.vWrap = spine.TextureWrap.ClampToEdge;
b.texture = c;
b.texture.setFilters(b.minFilter, b.magFilter);
b.texture.setWraps(b.uWrap, b.vWrap);
b.width = b.texture.getImage().width;
b.height = b.texture.getImage().height;
return b
},
parseAtlas: function(a) {
a = a.replace(/\r\n/g, "\n").split("\n");
var b = {
frames: {},
animations: {},
meta: {
app: "https://www.codeandweb.com/texturepacker",
version: "1.0"
}
}
, c = a[0].split(";");
b.meta.image = c[0];
b.meta.size = {
w: +c[1].split(",")[0],
h: +c[1].split(",")[1]
};
b.meta.format = c[2];
for (c = 1; c < a.length; c++) {
var d = a[c].split(";")
, e = {}
, f = d[0];
e.rect = cc.rect(+d[1].split(",")[0], +d[1].split(",")[1], +d[2].split(",")[0], +d[2].split(",")[1]);
e.rotated = !!d[3];
e.offset = cc.p(d[5] ? +d[5].split(",")[0] : 0, d[5] ? +d[5].split(",")[1] : 0);
e.size = cc.size(d[4] ? +d[4].split(",")[0] : e.rect.width, d[4] ? +d[4].split(",")[1] : e.rect.height);
e.trimmed = e.size.width !== e.rect.width || e.size.height !== e.rect.height;
e.spriteOffset = cc.p(e.offset.x + e.rect.width / 2 - e.size.width / 2, e.offset.y + e.rect.height / 2 - e.size.height / 2);
b.frames[f] = e
}
return b
}
};
var VirtualResource = function(a, b) {
this.bundleName = a;
this.key = b
};
cc.VirtualResource = VirtualResource;
VirtualResource.prototype.onUnload = function() {}
;
VirtualResource.prototype.toString = function() {
return this.bundleName + "[" + this.key + "]"
}
;
VirtualResource.prototype.getInjectTo = function(a) {
var b = bundles[this.bundleName];
if (!b.virtual)
return [this.bundleName];
var c = b.injectToSet;
return cc.rendererBundle && c[cc.rendererBundle] && bundles[cc.rendererBundle].loaded ? [cc.rendererBundle] : a && 0 < a.length && (a = a.filter(function(d) {
var e = bundles[d];
if (cleverapps.config.debugMode && e && e.virtual)
throw "Virtual bundle " + d + " shouldn't be preferred";
return c[d] && e.loaded
}),
0 < a.length) ? a : b.injectTo
}
;
VirtualResource.prototype.resolve = function(a) {
if (!bundles[this.bundleName].virtual)
return this;
var b = "frames";
this instanceof VirtualJson ? b = "jsons" : this instanceof VirtualUrl && (b = "urls");
a = this.getInjectTo(a);
for (var c = !1, d = 0; d < a.length; ++d) {
var e = a[d];
if (cleverapps.bundleLoader.isLoaded(e) || cleverapps.lazyAssets.isPreferredBundle(e)) {
if (c = bundles[e][b][this.key])
return c;
c = !0
}
}
if (!c) {
b = this.toString() + " not loaded - " + a.join(";");
if (cleverapps.config.debugMode)
throw Error(b);
cleverapps.throwAsync(b)
}
}
;
VirtualResource.prototype.originalPath = function() {
var a = bundles[this.bundleName];
return a.originalPaths && a.originalPaths[this.key]
}
;
VirtualResource.prototype.isLazy = function() {
var a = bundles[this.bundleName].meta;
return a && a.lazy && a.lazy[this.key]
}
;
VirtualResource.prototype.getBundleName = function() {
return this.bundleName
}
;
VirtualResource.prototype.isLoaded = function() {
return bundles[this.bundleName].isLoaded()
}
;
VirtualResource.prototype.getDimensions = function() {
var a = bundles[this.bundleName].meta;
if (a = a && a.sizes && a.sizes[this.key])
return cc.size(a.width * resolutionScale, a.height * resolutionScale)
}
;
VirtualResource.prototype.getAnchors = function() {
var a = bundles[this.bundleName].meta;
return a && a.anchors && a.anchors[this.key]
}
;
VirtualResource.prototype.save = function() {}
;
var VirtualFrame = function(a, b, c) {
VirtualResource.call(this, a, b);
c && (this.name = c)
};
VirtualFrame.prototype = Object.create(VirtualResource.prototype);
VirtualFrame.prototype.constructor = VirtualFrame;
cc.VirtualFrame = VirtualFrame;
VirtualFrame.prototype.setFrameData = function(a) {
var b = cc.textureCache.getTextureForKey(bundles[this.bundleName].urls.png);
if ("cocos2d" === engine)
var c = new cc.SpriteFrame(b,cc.rect(a.rect),a.rotated,a.offset,a.size);
else
c = new cc.SpriteFrame,
c.texture = b,
c.rect = a.rect,
c.originalSize = a.size,
c.offset = a.offset,
a.rotated && (c.rotated = !0,
c.flipUVX = !0,
c.flipUVY = !0);
c.bundleName = this.bundleName;
this.spriteFrame = c
}
;
VirtualFrame.prototype.onUnload = function() {
delete this.spriteFrame
}
;
VirtualFrame.prototype.getSpriteFrame = function() {
return this.spriteFrame
}
;
VirtualFrame.prototype.save = function() {
return this.name
}
;
var VirtualJson = function(a, b, c) {
VirtualResource.call(this, a, b);
c && c.inline ? (this.inline = !0,
this.setJsonData(JSON.parse(c.data))) : this.name = c
};
VirtualJson.prototype = Object.create(VirtualResource.prototype);
VirtualJson.prototype.constructor = VirtualJson;
cc.VirtualJson = VirtualJson;
VirtualJson.prototype.setJsonData = function(a) {
this.data = a
}
;
VirtualJson.prototype.getJson = function() {
return this.data
}
;
VirtualJson.prototype.onUnload = function() {
this.inline || (delete this.data,
delete this.cachedData)
}
;
VirtualJson.prototype.getCachedData = function() {
return this.cachedData
}
;
VirtualJson.prototype.setCachedData = function(a) {
this.cachedData = a
}
;
VirtualJson.prototype.save = function() {
return this.inline ? {
inline: !0,
data: JSON.stringify(this.data)
} : this.name
}
;
var VirtualUrl = function(a, b, c) {
VirtualResource.call(this, a, b);
this.parse(c)
};
VirtualUrl.prototype = Object.create(VirtualResource.prototype);
VirtualUrl.prototype.constructor = VirtualUrl;
cc.VirtualUrl = VirtualUrl;
VirtualUrl.prototype.parse = function(a) {
a.type ? (this.type = a.type,
this.name = a.name,
this.srcs = a.srcs) : this.url = a
}
;
VirtualUrl.prototype.isSound = function() {
return "string" === typeof this.url && (this.url.includes("/sfx/") || this.url.endsWith(".mp3"))
}
;
VirtualUrl.prototype.isImportant = function() {
var a = bundles[this.bundleName];
return a.important && a.important[this.key] || cleverapps.config.debugMode && "wait_all" === cleverapps.dataLoader.load(DataLoader.TYPES.TEST_SOUNDS)
}
;
VirtualUrl.prototype.getUrl = function() {
return this.type ? this : this.url
}
;
VirtualUrl.prototype.save = function() {
return this.type ? {
type: this.type,
name: this.name,
srcs: this.srcs
} : {
url: this.url
}
}
;
var unmifiyBundlesRec = function(a, b, c) {
var d = a[b];
if ("object" === typeof d)
for (var e in d) {
if ("meta" !== e || b !== c)
"jsons" === b && d[e] && d[e].inline || unmifiyBundlesRec(d, e, c)
}
else
"string" === typeof d && (d = d.replace("$", "res/packed/sounds/"),
d = d.replace("@", "~#/%r/"),
d = d.replace("~", "res/packed/"),
d = d.replace(/#/g, c),
a[b] = d)
}
, unminifyBundles = function(a) {
a = a || Object.keys(bundles);
var b;
for (b in a) {
var c = a[b];
var d = bundles[c];
d.frames || (d.frames = {});
d.jsons || (d.jsons = {});
d.urls || (d.urls = {});
d.meta || (d.meta = {});
unmifiyBundlesRec(bundles, c, c)
}
for (b in a)
c = a[b],
d = bundles[c],
d.injectTo && d.frameIds && (d.frameIds.forEach(function(e) {
d.frames[e] = ""
}),
delete d.frameIds),
d.jsonIds && (d.jsonIds.forEach(function(e) {
d.jsons[e] = ""
}),
delete d.jsonIds),
d.injectTo && d.soundIds && (d.soundIds.forEach(function(e) {
d.urls[e] = ""
}),
delete d.soundIds),
d.injectTo && d.unpackedIds && (d.unpackedIds.forEach(function(e) {
d.urls[e] = ""
}),
delete d.unpackedIds);
ResourceProcessor.addStaticUrl();
for (b in a)
c = a[b],
d = bundles[c],
d.important && (d.important = cleverapps.createSet(d.important)),
d.meta.lazy && (d.meta.lazy = cleverapps.createSet(d.meta.lazy)),
bundles[c] = new Bundle(c,d)
};
unminifyBundles();
var BundleLoader = function() {
this.handles = {};
this.loadedBundles = [];
this.blockedCounter = 0;
this.unusedResources = {};
this.unusedBundles = {};
this.onceWaitWindowClosed = this.waitWindow = void 0
};
BundleLoader.prototype.addBlockWindow = function() {
0 === this.blockedCounter && (!cleverapps.scenes.getRunningScene() || cleverapps.environment.isLoaderScene() || this.waitWindow || cleverapps.config.wysiwygMode || cleverapps.focusManager.display({
stack: !0,
focus: "LoadBundles",
action: function(a) {
this.waitWindow = new WaitWindow;
this.onceWaitWindowClosed = a
}
.bind(this)
}));
this.blockedCounter++
}
;
BundleLoader.prototype.removeBlockWindow = function(a) {
this.blockedCounter--;
if (0 >= this.blockedCounter || a)
this.waitWindow && (this.waitWindow.close(),
this.waitWindow = void 0),
this.onceWaitWindowClosed && (this.onceWaitWindowClosed(),
this.onceWaitWindowClosed = void 0)
}
;
BundleLoader.prototype.onFailure = function(a, b) {
var c = this.getHandle(a)
, d = c && c.onFailures;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.FAIL_BUNDLE + a);
c && c.blocked ? (this.removeBlockWindow(!0),
new RestartWindow) : this.deleteBundle(a, !0);
cleverapps.versionChecker.isClientVersionActual() && !cleverapps.config.debugMode && cleverapps.checkStatus(b, 404) && setTimeout(function() {
throw "load actual bundle " + a + " 404 error";
}, 0);
d && d.forEach(function(e) {
e(b)
})
}
;
BundleLoader.prototype.loadBundles = function(a, b) {
b = b || {};
var c = b.onFailure
, d = cleverapps.wait(a.length || 0, b.onSuccess || function() {}
);
c && (c = cleverapps.once(c));
for (var e = 0; e < a.length; e++)
this.loadBundle(a[e], {
onSuccess: d,
onFailure: c,
blocked: b.blocked
})
}
;
BundleLoader.prototype.getHandle = function(a) {
return this.handles[a]
}
;
BundleLoader.prototype.countLoaded = function(a) {
return Array.isArray(a) ? a.filter(function(b) {
return this.countLoaded(b)
}
.bind(this)).length : bundles[a] && bundles[a].injectTo ? this.isVirtualLoaded(a) ? 1 : 0 : (a = this.getHandle(a)) && a.loaded ? 1 : 0
}
;
BundleLoader.prototype.isLoaded = function(a) {
Array.isArray(a) || (a = [a]);
return this.countLoaded(a) === a.length
}
;
BundleLoader.prototype.isVirtualLoaded = function(a) {
a = bundles[a];
for (var b in a.injectTo)
if (cleverapps.bundleLoader.isLoaded(a.injectTo[b]))
return !0;
return !1
}
;
BundleLoader.prototype.loadBundle = function(a, b) {
var c = bundles[a]
, d = this.getHandle(a);
b = b || {};
var e = b.onSuccess
, f = b.onFailure;
b = b.blocked;
cleverapps.resolution.isInitialized() || cleverapps.throwAsync("Can't load urls while resolution is not defined");
if (c.virtual || c.stored)
e && e(c);
else if (d)
d.counter++,
d.loaded ? e && e(c) : (e && d.onSuccesses.push(e),
f && d.onFailures.push(f),
!d.blocked && b && (d.blocked = !0,
this.addBlockWindow()));
else {
var g = [];
e && (g = Array.isArray(e) ? e : [e]);
d = [];
f && (d = Array.isArray(f) ? f : [f]);
var h = {
loaded: !1,
counter: 1,
onSuccesses: g,
onFailures: d,
blocked: b
};
this.handles[a] = h;
b && this.addBlockWindow();
h.onLoadedUrls = cleverapps.once(function() {
h.loaded = !0;
h.blocked && this.removeBlockWindow();
c.onLoad(function() {
for (var l = 0; l < h.onSuccesses.length; l++)
g[l].call(this, c);
delete h.onSuccesses;
delete h.onFailures;
delete h.blocked
})
}
.bind(this));
var k = 3
, m = function() {
if (this.getHandle(a)) {
var l = c.listUrls()
, n = c.listSoundUrls();
cc.loader.load(l, function(p) {
p ? (console.log("load failed", p, JSON.stringify(c.listUrls())),
1 >= k || cleverapps.checkStatus(p, 404) ? cleverapps.versionChecker.loadClientVersion(function() {
this.onFailure(a, p)
}
.bind(this)) : (k--,
m())) : (h.onLoadedUrls(),
n.length && cc.loader.load(n, function() {
cleverapps.audio.onSoundsLoaded(n)
}))
}
.bind(this))
}
}
.bind(this);
m()
}
}
;
BundleLoader.prototype.cacheBundles = function(a) {
a = cleverapps.toArray(a).filter(function(b) {
return b && bundles[b]
});
cleverapps.bundleLoader.loadBundles(a, {
onSuccess: function() {
cleverapps.bundleLoader.deleteBundles(a)
}
})
}
;
BundleLoader.prototype.checkUrlUseInLoadedBundles = function(a) {
for (var b in this.handles) {
var c = bundles[b];
c = c.listUrls().concat(c.listSoundUrls(!0));
for (var d in c)
if (c[d] === a)
return !0
}
return !1
}
;
BundleLoader.prototype.deleteBundles = function(a) {
if (a)
for (var b = 0; b < a.length; b++)
this.deleteBundle(a[b])
}
;
BundleLoader.prototype.deleteBundle = function(a, b) {
var c = this.handles[a];
if (void 0 !== c && -1 === ["main", "episodes_resources"].indexOf(a) && (c.counter--,
!(0 < c.counter || (0 === a.indexOf("enemy") && (this.deleteStack || (this.deleteStack = {}),
this.deleteStack[a] = Error().stack),
bundles[a].stored)))) {
b || c.loaded || !c.blocked || console.log("Remove blocked loading bundle (maybe error!)", a);
c.loaded && this.clearOverrides(c);
var d = bundles[a];
b = d.listUrls().concat(d.listSoundUrls(!0));
c.onLoadedUrls = function() {}
;
delete this.handles[a];
d.loaded = !1;
for (var e in b)
c = b[e],
this.checkUrlUseInLoadedBundles(c) || (this.unusedResources[c] = !0);
this.unusedBundles[a] = !0
}
}
;
BundleLoader.prototype.override = function(a, b, c, d) {
a.overrides = a.overrides || new OverridesContainer;
a.overrides.override(b, c, d)
}
;
BundleLoader.prototype.clearOverrides = function(a) {
a.overrides && (a.unoverride(),
delete a.overrides)
}
;
BundleLoader.prototype.isUnused = function(a) {
return !this.isLoaded(a) && this.unusedBundles[a]
}
;
BundleLoader.prototype.clearUnusedResources = function() {
if (0 !== Object.keys(this.unusedBundles).length) {
var a = this.unusedResources, b;
for (b in a)
this.checkUrlUseInLoadedBundles(b) || (cc.textureCache.getTextureForKey(b) && cc.textureCache.removeTextureForKey(b),
cc.loader.release(b));
this.unusedResources = {};
Object.keys(this.unusedBundles).forEach(function(c) {
if (!bundles[c].injectTo && !this.handles[c])
bundles[c].onUnload()
}
.bind(this));
this.unusedBundles = {}
}
}
;
BundleLoader.prototype.isAllLoaded = function(a) {
var b = function(c) {
var d = bundles[c];
if (this.isLoaded(c) || !d)
return !0;
c = d.listUrls();
return c.filter(function(e) {
return cc.loader.cache[e]
}).length === c.length
}
.bind(this);
return a.filter(b).length === a.length
}
;
BundleLoader.prototype.ensureSoundsLoaded = function(a) {
cc.sys.isWebViewAudio || (a = cleverapps.toArray(a).map(function(b) {
return b instanceof VirtualUrl ? b.resolve().getUrl() : b
}).filter(function(b) {
return b && !cc.loader.getRes(b)
}),
cc.loader.load(a, function() {
cleverapps.audio.onSoundsLoaded(a)
}))
}
;
cleverapps.RestClient = {
METHODS: {
GET: "GET",
POST: "POST"
},
getDefaultTimeout: function() {
return connector.platform.oneOf(connector.WECHAT) ? 2E4 : 1E4
},
getXMLHttpRequest: function() {
return "undefined" !== typeof XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("MSXML2.XMLHTTP")
},
get: function(a, b, c, d, e) {
this.send(this.METHODS.GET, a, b, c, d, e)
},
post: function(a, b, c, d, e) {
this.send(this.METHODS.POST, a, b, c, d, e)
},
send: function(a, b, c, d, e, f) {
f = f || {};
if (!cleverapps.flags || !cleverapps.flags.norest || f.ignoreNoRest) {
c = c || {};
var g = f.timeout || this.getDefaultTimeout()
, h = 0 === b.indexOf("http") || 0 === b.indexOf("/.proxy/") || f.fullPath ? b : cleverapps.config.restApiURL + b
, k = this.getXMLHttpRequest()
, m = setTimeout(function() {
l.call({
status: -1,
responseText: "our timeout"
})
}, g + 1E3);
var l = function() {
void 0 !== m && (clearTimeout(m),
m = void 0);
if (200 <= this.status && 300 > this.status) {
if (d) {
var n = !0;
try {
var p = this.responseText && JSON.parse(this.responseText)
} catch (q) {
n = !1,
cleverapps.throwAsync("parse json error path - " + b + " error - " + q.message + " text - " + this.responseText)
}
n ? d(p) : e && e(this)
}
} else
this.responseText && (this.errorMessage = (this.responseText.split("\n")[0] || "").trim()),
console.log("XMLHttpRequest FAILED", a, this.status, this.errorMessage, h),
e && e(this);
d = function() {}
;
e = function() {}
}
.bind(k);
k.ontimeout = l;
k.onload = l;
k.onerror = l;
k.onabort = l;
k.open(a, h);
k.timeout = g;
k.setRequestHeader("Content-Type", "application/json");
f.authorization ? k.setRequestHeader("authorization", f.authorization) : k.setRequestHeader("Cache-Control", "no-cache");
k.send(JSON.stringify(c))
}
},
sendRaw: function(a, b, c) {
var d = this.getXMLHttpRequest();
d.open(a, b);
d.timeout = this.getDefaultTimeout();
d.send(c)
},
standsWeb: function(a) {
return cleverapps.config.deployment + (a || "")
},
standsRest: function(a) {
return cleverapps.config.deployment + "/" + cleverapps.config.name + "-rest" + (a || "")
}
};
cleverapps.ErrorHandler = {
SEND_INTERVAL: "1 hour",
SEND_STORAGE_INTERVAL: "1 minute",
lastSend: 0,
formatMessage: function(a) {
var b = [new Date + ""];
cleverapps.environment && b.push("Screen: " + cleverapps.environment.getScreen());
connector.info && b.push("Source: " + connector.info.source);
cleverapps.config && (b.push("Name: " + cleverapps.config.name),
b.push("Title: " + cleverapps.config.title),
b.push("Version: " + cleverapps.config.version),
b.push("WebpSupport: " + cleverapps.config.webpSupport));
"undefined" !== typeof levels && levels.user && (cleverapps.environment && (b.push("Episode: " + cleverapps.environment.episodeNo),
b.push("Level: " + cleverapps.environment.levelNo)),
cleverapps.config && "merge" === cleverapps.config.type ? b.push("User Level: " + levels.user.level) : cleverapps.config && "match3" === cleverapps.config.type ? b.push("User Level: " + levels.user.getHumanReadableNumber()) : b.push("User Level: " + levels.user.episode),
b.push("User id: " + connector.platform.getUserID()));
cleverapps.paymentsHistory && b.push("Payer: " + cleverapps.paymentsHistory.classify());
cleverapps.settings && b.push("Language: " + cleverapps.settings.language);
cleverapps.focusManager && (b.push("Focus: " + cleverapps.focusManager.focus),
b.push("Focus history: " + cleverapps.focusManager.focusHistory.join(", ")));
cleverapps.synchronizer && cleverapps.synchronizer.lastSyncIn && b.push("Last syncin: " + cleverapps.synchronizer.lastSyncIn);
"undefined" !== typeof $msstart && b.push("Last $msstart: " + $msstart.lastCalled + " " + $msstart.lastCalledTime);
b.push(window && window.navigator ? window.navigator.userAgent : "???");
b = b.concat(a);
b = b.join(" - ");
b = b.replace(/(?:\r\n|\r|\n)/g, " - ") + " ";
window && window.assetsFolder && (b = b.replace(new RegExp(window.assetsFolder,"g"), ""));
return b
},
onerror: function(a, b, c, d, e) {
var f = connector.info.source
, g = [];
e && e.arguments && g.push("Arguments: " + e.arguments);
b || (b = window.location.href);
if (!(0 === c && 0 === d && ["gdcom", "coolmath"].includes(f) || 1 === c && 49 === d && "samsung" === f))
return e && e.stack ? (g.push("Message: " + a),
g.push("Line: " + c),
g.push("Column: " + d),
g.push(e.stack)) : (g.push("Message: " + a),
g.push("URL: " + b),
g.push("Line: " + c),
g.push("Column: " + d),
g.push("Error: " + JSON.stringify(e))),
cleverapps.ErrorHandler.getLastConsoleMessages(function(h) {
h && g.unshift("Console: " + h);
h = cleverapps.ErrorHandler.formatMessage(g);
cleverapps.ErrorHandler.showErrorNotification(e || a, g);
if (cleverapps.ErrorHandler.needIgnore(h))
return console.log("ignore", h),
!1;
cleverapps.ErrorHandler._onerror(h)
}),
!1
},
needIgnore: function(a) {
return cleverapps.ErrorHandler.IGNORED_ERRORS.some(function(b) {
return a && -1 !== a.indexOf(b)
})
},
_onerror: function(a) {
this.send(a);
if (connector.info.isNative) {
console.log("_onerror - " + JSON.stringify(a));
var b = cc.director.getTotalFrames()
, c = function() {
if (b !== cc.director.getTotalFrames() && cleverapps.focusManager) {
var d = {
focus: "OnErrorRestartWindow",
action: function(e) {
cleverapps.eventLogger && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.WEBVIEW_ONERROR_RELOAD_WINDOW);
cleverapps.throwAsync && cleverapps.throwAsync("WebView error location reload window - " + JSON.stringify(a));
new RestartWindow({
contentMessage: "RestartWindow.OnError"
});
cleverapps.focusManager.onceNoWindowsListener = e
}
};
cleverapps.focusManager.isFocused() ? cleverapps.focusManager.distract(d) : cleverapps.focusManager.display(d)
} else
cleverapps.eventLogger && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.WEBVIEW_ONERROR_RELOAD_SILENT),
cleverapps.throwAsync && cleverapps.throwAsync("WebView error location reload silent - " + JSON.stringify(a)),
window.location.reload()
};
setTimeout(function() {
b === cc.director.getTotalFrames() && (cc.game.pause(),
cc.game.resume(),
setTimeout(c, 500))
}, 500)
}
},
send: function(a) {
// if (!(Date.now() < cleverapps.ErrorHandler.lastSend + cleverapps.parseInterval(this.SEND_INTERVAL))) {
// var b = cleverapps.dataLoader && cleverapps.dataLoader.load(DataLoader.TYPES.LAST_ONERROR) || 0;
// b = Math.min(b, Date.now());
// Date.now() < b + cleverapps.parseInterval(this.SEND_STORAGE_INTERVAL) || (cleverapps.ErrorHandler.lastSend = Date.now(),
// cleverapps.dataLoader && (cleverapps.dataLoader.save(DataLoader.TYPES.LAST_ONERROR, Date.now()),
// cleverapps.dataLoader.processSaveQueue()),
// b = cleverapps.config.deployment + cleverapps.LOG_ERROR_URL,
// console.log(a),
// cleverapps.RestClient.sendRaw(cleverapps.RestClient.METHODS.POST, b, a),
// cleverapps.eventLogger && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.ERROR_AMOUNT))
// }
},
getLastConsoleMessages: function(a) {
if (connector.platform.oneOf(connector.RUSTORE, connector.AMAZON, connector.ANDROID, connector.GPG, connector.PLIEGA))
try {
connector.platform.callNative("AppActivityPlugin.getLastConsoleMessages", function(b, c) {
a(c && c.consoleMessages)
})
} catch (b) {
console.log("ErrorHandler.getLastConsoleMessages error", b),
a()
}
else
a()
},
showErrorNotification: function(a, b) {
cleverapps.config.debugMode && cleverapps.bundleLoader && cleverapps.notification && (a = "string" === typeof a ? a : a && a.message ? a.message : JSON.stringify(a),
a = a.substr(0, 60),
cleverapps.notification.create(a, {
defer: !0,
image: bundles.dev_buttons.frames.icon_error,
debugInfo: b.join("\n"),
toReplace: {
ignoreWarning: !0
}
}),
cleverapps.resolution && cleverapps.resolution.isInitialized() && cleverapps.bundleLoader.loadBundle("main", {
onSuccess: function() {
cleverapps.resolution.showCanvas();
cleverapps.notification.processQueue();
cleverapps.bundleLoader.deleteBundle("main")
}
}))
}
};
window.onerror = cleverapps.ErrorHandler.onerror;
cleverapps.LOG_ERROR_URL = "/log/";
cleverapps.ErrorHandler.IGNORED_ERRORS = "html5.api.gamedistribution.com;hadronid.net/hadron.js;app.mbga-platform.jp/gadgets/js/auth-refresh;safari-extension://;eval (eval at anonymous (eval at buildCode (:606:31));Message: Uncaught SyntaxError: missing ) after argument list - Line: 1 - Column: 49".split(";");
var LogTimeStart = function() {
this.started = Date.now();
this.timeout = setTimeout(this.stop.bind(this), 6E4)
};
LogTimeStart.prototype.save = function() {
if (cleverapps.user && cleverapps.eventLogger) {
var a = Math.round((Date.now() - this.started) / 1E3);
60 < a && (a = 60);
var b = cleverapps.user.registered + cleverapps.parseInterval("1 day") > Date.now();
b = cleverapps.EVENTS.STATS.TIMESTART + (b ? "_new" : "_old");
cleverapps.eventLogger.logEvent(b + "_count");
cleverapps.eventLogger.logEvent(b, {
value: a
})
} else
console.log("Skip logging time start, no user or eventLogger found after timeout")
}
;
LogTimeStart.prototype.stop = function() {
void 0 !== this.timeout && (clearTimeout(this.timeout),
this.timeout = void 0,
this.save())
}
;
LogTimeStart.active = new LogTimeStart;
cc.getCenter = function(a) {
if (a && 0 !== a.length) {
var b = 0
, c = 0;
a.forEach(function(d) {
b += d.x;
c += d.y
});
return cc.p(b / a.length, c / a.length)
}
}
;
cc.getCenterPoint = function(a) {
if (a && 0 !== a.length) {
var b = 0
, c = 0;
a.forEach(function(g) {
b += g.x;
c += g.y
});
var d = cc.p(b / a.length, c / a.length)
, e = a[0]
, f = cc.pDistance(e, d);
a.forEach(function(g) {
var h = cc.pDistance(g, d);
h < f && (e = g,
f = h)
});
return e
}
}
;
cc.getDistanceChebyshev = function(a, b) {
return Math.max(Math.abs(a.x - b.x), Math.abs(a.y - b.y))
}
;
cc.rectScale = function(a, b) {
return cc.rect(a.x + a.width / 2 * (1 - b), a.y + a.height / 2 * (1 - b), a.width * b, a.height * b)
}
;
cc.rectGetCenter = function(a) {
return cc.p(a.x + a.width / 2, a.y + a.height / 2)
}
;
cc.padding = function(a, b, c, d) {
if ("object" === typeof b) {
a = cc.padding(a);
var e = cc.padding(b);
b = e.right || a.right;
c = e.bottom || a.bottom;
d = e.left || a.left;
a = e.top || a.top
} else
void 0 === b && "number" === typeof a ? d = c = b = a : void 0 === b && "object" === typeof a ? (b = a.right || a.x,
c = a.bottom || a.y,
d = a.left || a.x,
a = a.top || a.y) : void 0 === c && void 0 !== b && void 0 !== a && (c = a,
d = b);
return {
top: a || 0,
right: b || 0,
bottom: c || 0,
left: d || 0
}
}
;
cc.rectAddPadding = function(a, b) {
return cc.rect(a.x - b.left, a.y - b.bottom, a.width + b.left + b.right, a.height + b.bottom + b.top)
}
;
cc.rectSubPadding = function(a, b) {
return cc.rect(a.x + b.left, a.y + b.bottom, Math.max(a.width - b.left - b.right, 0), Math.max(a.height - b.bottom - b.top, 0))
}
;
cc.multPadding = function(a, b) {
return {
top: a.top * b,
right: a.right * b,
bottom: a.bottom * b,
left: a.left * b
}
}
;
cc.paddingAddPadding = function(a, b) {
return {
top: a.top + b.top,
right: a.right + b.right,
bottom: a.bottom + b.bottom,
left: a.left + b.left
}
}
;
cc.paddingsEqual = function(a, b) {
return a.left === b.left && a.right === b.right && a.top === b.top && a.bottom === b.bottom
}
;
cc.mergePaddings = function(a) {
return a.reduce(function(b, c) {
return {
top: Math.max(b.top, c.top),
right: Math.max(b.right, c.right),
bottom: Math.max(b.bottom, c.bottom),
left: Math.max(b.left, c.left)
}
}, cc.padding())
}
;
cc.rotatePadding = function(a) {
return cc.padding(a.left, a.top, a.right, a.bottom)
}
;
cc.nearestToRect = function(a, b) {
return cc.p(b.x <= a.x ? a.x : b.x >= a.x + a.width ? a.x + a.width : b.x, b.y <= a.y ? a.y : b.y >= a.y + a.height ? a.y + a.height : b.y)
}
;
cc.convertRectToNodeSpace = function(a, b) {
a = a.getWorldToNodeTransform();
return cc.rectApplyAffineTransform(b, a)
}
;
var cleverappsEvents = {
GENERAL: {
TUTORIAL_COMPLETE: "tutorial_complete",
LEVEL_UP: "level_up"
},
CONVERSIONS: {
VISIT: [{
conversion_window: 1,
accumulate: "sum"
}, {
conversion_window: 2,
accumulate: "sum"
}, {
conversion_window: 3,
accumulate: "sum"
}, {
conversion_window: 7,
accumulate: "sum"
}, {
conversion_window: 14,
accumulate: "sum"
}, {
conversion_window: 30,
accumulate: "sum"
}, {
conversion_window: 180,
accumulate: "sum"
}],
AD: [{
old_name: "day1_watch",
conversion_window: 1,
reach: [5, 10, 20, 30]
}, {
conversion_window: 3,
reach: [5, 10, 20, 30]
}, {
old_name: "day7_watch",
conversion_window: 7,
reach: [5, 10, 20, 30]
}, {
conversion_window: 14,
reach: [5, 10, 20, 30]
}, {
conversion_window: 30,
reach: [5, 10, 20, 30]
}, {
conversion_window: 180,
reach: [5, 10, 20, 30]
}],
EVERY_5_AD: [{
conversion_window: 1,
accumulate: "count"
}, {
conversion_window: 3,
accumulate: "count"
}, {
old_name: "day7_every_ad_5",
conversion_window: 7,
accumulate: "count"
}, {
conversion_window: 14,
accumulate: "count"
}, {
conversion_window: 30,
accumulate: "count"
}, {
conversion_window: 180,
accumulate: "count"
}],
LEVEL: [{
conversion_window: 1,
reach: [1, 2, 3, 4, 5, 6, 7, 8, 10, 13, 15, 20, 22, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100]
}, {
conversion_window: 3,
reach: [1, 2, 3, 4, 5, 6, 7, 8, 10, 13, 15, 20, 22, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100]
}, {
old_name: "day7_reach",
conversion_window: 7,
reach: [1, 2, 3, 4, 5, 6, 7, 8, 10, 13, 15, 20, 22, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100]
}, {
conversion_window: 14,
reach: [1, 2, 3, 4, 5, 6, 7, 8, 10, 13, 15, 20, 22, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100]
}, {
conversion_window: 30,
reach: [1, 2, 3, 4, 5, 6, 7, 8, 10, 13, 15, 20, 22, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100]
}, {
old_name: "day180_reach",
conversion_window: 180,
reach: [1, 2, 3, 4, 5, 6, 7, 8, 10, 13, 15, 20, 22, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100]
}, {
conversion_window: 30,
accumulate: "count"
}],
PAYMENTS: [{
conversion_window: 1,
accumulate: "sum"
}, {
conversion_window: 3,
accumulate: "sum"
}, {
old_name: "day7_payment",
conversion_window: 7,
accumulate: "sum"
}, {
conversion_window: 14,
accumulate: "sum"
}, {
conversion_window: 30,
accumulate: "sum"
}, {
conversion_window: 180,
accumulate: "sum"
}],
TOTAL: [{
conversion_window: 1,
accumulate: "sum"
}, {
conversion_window: 3,
accumulate: "sum"
}, {
conversion_window: 7,
accumulate: "sum"
}, {
conversion_window: 14,
accumulate: "sum"
}, {
conversion_window: 30,
accumulate: "sum"
}, {
conversion_window: 180,
accumulate: "sum"
}]
},
EARN: {
HARD: "ehard",
SOFT: "esoft",
FLYING: "flying",
PROMO: "promo",
GROWTH_FUND: "fund",
COOKIE_JAR: "cookie",
CHEST: "chest",
BOARD_COIN: "board",
CLAN: "clan",
MAGNIFIER: "magnifier",
FRIEND_REQUEST: "request",
RETURN: "return",
CRYPTEX: "cryptex",
SLOTMACHINE: "slotmachine",
TSEARCH: "tsearch_mission",
LEVEL_REWARD: "reward",
LIVES: "lives",
BONUS_LEVEL_REWARD: "bonus_level",
PURCHASE: "purchase",
DAILY: "daily",
MISSION: "mission",
VIDEO: "video",
OTHER: "other",
STAR_CHEST: "star_chest"
},
SPENT: {
HARD: "shard",
BOOSTER: "booster",
BOOSTER_BEFORE: "before",
BARREL: "barrel",
RUIN: "ruin",
THIRD_ELEMENT: "third_element",
PIXEL_OFFER: "pixel_offer",
PAY_ISLAND: "island",
WORKER: "worker",
SKIP_VIP: "skip_vip",
MAGNET: "magnet",
DYNAMITE: "dynamite",
LIVES: "lives",
SOFT: "ssoft",
UNIT: "unit",
PAID_UNIT: "paid_unit",
REFRESH: "refresh",
SEASON: "season",
CLAN: "clan",
STICKERS_1: "stickerspack1",
STICKERS_2: "stickerspack2",
STICKERS_3: "stickerspack3",
CONTINUE: "continue",
TACTICAL_EXTEND: "tactical_extend",
HERO_UPGRADE: "upgrade",
BOMB_MOVES: "bomb",
SLOT_MACHINE: "slot",
HOMEFIX_CHOICE: "choice",
INGREDIENT: "ingredient",
OFFER: "offer",
FOG: "fog",
FOGBUY: "fogbuy",
REFILL_TANK: "tank",
GENIE_ENERGY: "genie",
MINESWEEPER: "miner",
PACK: "pack_",
ORDER: "order",
ENERGY_LOTTERY: "lottery",
BATTLE_PASS: "battlepass",
LAST_CHANCE: "lastchance",
SPEED_UP: "speedup",
FRUIT: "fruit",
RESET: "reset",
UNLOCK: "unlock",
CARAVAN: "caravan",
CUSTOMER: "customer",
RECIPE_INGREDIENT: "ingred",
RECIPE_INGREDIENT_ALL: "ingredall",
FACTORY: "factory",
WAREHOUSE: "warehouse",
TROOP_CARDS: "troop",
PIGGY_BANK: "piggy",
LUCKY_BONUS: "lucky_bonus",
PRIZE_CALENDAR: "prize_calendar",
OCTOPUS_HUNT: "octopus_hunt"
},
ADS: {
START: "ad_start",
FINISH: "ad_finish",
SESSION_FINISH_REWARDED: "ad_session_finish_rewarded",
COST: "ad_cost",
COST_COUNTRY: "adcost_country_",
COUNTRY: "ad_country_",
CACHE: "ad_cache",
READY: "ad_ready",
AD_BLOCK_WINDOW_DAU: "ad_block_window_dau",
AD_BLOCK_REWARDED_SUCCESS: "ad_block_r_success",
AD_BLOCK_REWARDED_FAIL: "ad_block_r_fail",
AD_BLOCK_STICKY_SUCCESS: "ad_block_s_success",
AD_BLOCK_STICKY_FAIL: "ad_block_s_fail",
TYPE: "ad-",
ERROR_REWARDED: "ad_error-r-",
ERROR_INTERSTITIAL: "ad_error-i-"
},
EXPEDITIONS: {
PLAY: "play_",
SPEND: "payments_",
TOTAL: "total_"
},
WEBGL: {
CONTEXT_LOST: "context_lost",
CONTEXT_LOST_INACTIVE: "context_lost_inactive",
CONTEXT_LOST_PAYER: "context_lost_payer",
CONTEXT_LOST_PAYER_INACTIVE: "context_lost_payer_inactive",
CONTEXT_LOST_DAU: "context_lost_dau",
CONTEXT_LOST_INACTIVE_DAU: "context_lost_inactive_dau",
CONTEXT_LOST_PAYER_DAU: "context_lost_payer_dau",
CONTEXT_LOST_PAYER_INACTIVE_DAU: "context_lost_payer_inactive_dau",
CONTEXT_LOST_MULTIPLE: "context_lost_2"
},
STATS: {
APP_INITIALIZE: "app_initialize",
LOADER_PROGRESS: "loader_progress_",
LEVEL_START: "level_start",
SHOP_OPEN: "shop_open",
SHOP_CLOSE: "shop_close",
PRODUCT_BUY: "product_bought",
BUY_VIRTUAL_ITEM: "buy_virtual_item",
BUY_ITEM: "buy_item",
BUY: "buy-",
PAYMENTS: "payments",
PAYMENTS_TERMINATED: "payments_terminated",
PAYMENTS_COUNTRY: "payments_country_",
PAYMENTS_CHANNEL: "payments_channel_",
PAYMENTS_PLATFORM: "payments_platform_",
PAYMENTS_COUNTRY_PLATFORM: "payments_cplatform_",
VIDEO_PRODUCT_BUY: "video_product_buy",
RATE_WINDOW: "rate_window",
RATE_SEND: "rate_send",
SOCIAL_REVIEW: "social_review_",
NATIVE_REVIEW: "native_review_",
TUTORIAL_BEGIN: "tutorial_begin",
TUTORIAL_STEP: "tutorial_step_",
LEVEL_FINISH: "level_finish",
LEVEL_LEFT_MOVES: "level_left_moves",
LEVEL_PASSED_TIME: "level_passed_time",
LEVEL_STARS: "level_stars",
UNIQUE_FINISH: "lev_finish",
UNIQUE_START: "lev_start",
USE_ENERGY: "use_energy",
PROMO: "promo_",
PROMO_SHOW: "promo_show_",
PROMO_ERROR: "promo_error_",
LOGIN: "login",
REGISTERED: "registered",
CHANNEL: "channel_",
CHANNEL_OS: "channel_os_",
CHANNEL_UA: "channel_ua_",
CHANNEL_COUNTRY: "channel_country_",
CHANNEL_ACTIVE_TIME: "channel_atime_",
CHANNEL_APP_INITIALIZE: "channel_appinit_",
TIMESTART: "timestart",
DAU: "dau",
DAU_COUNTRY: "dau_country_",
DAU_PLATFORM: "dau_platform_",
DAU_COUNTRY_PLATFORM: "dau_cplatform_",
DAU30_COUNTRY_PLATFORM: "dau30_cplatform_",
DAU_VERSION: "dau_version_",
PAYER_DAU: "payer_dau",
NEW_USERS_DAU: "day_1_dau",
REWARDED_AVAILABLE_DAU: "rewarded_available_dau",
REWARDED_LOADED_DAU: "rewarded_loaded_dau",
REWARDED_NOADS_DAU: "rewarded_noads_dau",
NOADS_ERROR: "noads_error-",
REWARDED_DAU: "rewarded_dau",
REWARDED_ERROR_DAU: "rewarded_error_dau",
VIP_REWARDED_WATCHED: "vip_rewarded_watched",
VIP_REWARDED_DAU: "vip_rewarded_dau",
RETENTION_0: "retention_0",
RETENTION_1: "retention_1",
RETENTION_2: "retention_2",
RETENTION_3: "retention_3",
RETENTION_7: "retention_7",
RETENTION_14: "retention_14",
RETENTION_30: "retention_30",
ACTIVE_TIME: "active_time",
ACTIVE_TIME_DAU: "active_time_dau",
GAME_LEVEL_CONVERSION_DAYS: "gamelevel_conversion_d",
USER_WANDS_DAU: "user_wands_dau",
USER_WANDS_DAU_AMOUNT: "user_wands_dau_amount",
RETURNS: "returns_",
ERROR_AMOUNT: "error_amount",
FPS_RATE: "fps_rate",
FPS_COUNT: "fps_count",
RESOLUTION: "resolution_",
WEBP: "webp_",
OS: "os_",
PLATFORM: "platform_",
ANDROID_VERSION: "androidv_",
APP_TRACKING: "app_tracking_",
APP_LOVIN_ADS: "app_lovin_ads",
ADMOB_ADS: "admob_ads",
YANDEX_APP_ADS: "yandex_app_ads",
INSTANT: {
BOT_WANT: "instabot_want",
BOT_SHOW: "instabot_show",
BOT: "instabot",
REQUEST: "instant_request",
PAYMENT: "instant_payment-",
CATALOG: "instant_catalog-",
SUBSCRIPTION_CATALOG: "instant_subs_cat-",
CONSUME: "instant_consume-",
LIST_PURCHASES: "instant_list-",
SUBSCRIPTION: "instant_subscr-",
SUBSCRIPTION_LIST: "instant_sublist-",
SUBSCRIPTION_API: "instant_subscr_api",
LOCALE: "instant_locale-",
PLATFORM: "instant_platform-",
ENTRY_POINT: "instant_epoint-",
ADS_ERROR_REWARDED: "instantr",
ADS_ERROR_INTERSTITIAL: "instanti"
},
MSSTART: {
ADS_LOAD: "msstart_load-",
ADS_COUNTRY_LOAD: "msstart_cload-",
ADS_PLAY: "msstart_play-",
ADS_COUNTRY_PLAY: "msstart_cplay-"
},
PUSHES: {
SEND: "push_send-",
CLICK: "push_click-",
PERMITTED_DAU: "push_permitted_dau"
},
PRODUCT: {
OPEN: "product_open",
SUCCESS: "product_success",
RESTORE: "product_restore",
CONSUME_START: "product_consume_start",
CONSUME_SUCCESS: "product_consume_success",
CONSUME_FAILURE: "product_consume_failure"
},
YOOKASSA: {
PAID_COUNT: "yookassa_paid_count",
PAID_AMOUNT: "yookassa_paid_amount"
},
BANNER: {
DAU: "banner_dau",
LOADING: "banner_loading",
SHOWN: "banner_shown",
HIDDEN: "banner_hidden"
},
XSOLLA: {
INIT_WIDGET_FAILED: "xsolla_init_widget_failed",
OPEN_WIDGET: "xsolla_open_widget"
},
CONFIG: {
FETCH_START: "config_f_",
FETCH_SUCCESS: "config_fs_",
FETCH_FAILURE: "config_ff_"
}
},
WECHAT: {
PAY_RESULT: "pay_result"
},
DEBUG: {
CLEARANCE: {
DATALOADER_CHECKSUM_MATCH: "dataloader_checksum_match",
DATALOADER_CHECKSUM_DIFFERENT: "dataloader_checksum_different",
LOCALSTORAGE_CLEARED: "localstorage_cleared",
LOCALSTORAGE_ERROR_SET_ITEM: "localstorage_error_set_item",
LOCALSTORAGE_SESSION_EXPIRED: "localstorage_session_expired"
},
FAIL_BUNDLE: "fail_bundle_",
WEBVIEW_ONERROR_RELOAD_SILENT: "webview_onerror_reload_silent",
WEBVIEW_ONERROR_RELOAD_WINDOW: "webview_onerror_reload_window",
GRAVITY_INIT_ERROR: "gravity_init_error",
GRAVITY_RECONNECT: "gravity_reconnect",
MERGE: {
RESTORE_MULTICELL_BODY: "restore_multicellbody",
RESTORE_KICKOUT: "restore_kickout_",
UNITS_RESET: "units_reset",
UNITS_RESET2: "units_reset2",
UNKNOWN_UNIT_DAU: "uu_dau",
UNKNOWN_UNIT_SOLD: "uu_sold"
},
UNKNOWN_MISSION_DAU: "unknown_mission_dau",
PENDING_REQUESTS_FREEZE: "pending_requests_freeze",
SECOND_LOGIN: "second_login",
RENDER_TYPE: "render_type_",
AUDIO_PLAY_PAUSED_GAME: "audio_play_paused_game",
MISSION_REPLACED: "mission_replaced-",
MISSION_REPLACED_REMOVED: "mission_replaced_removed-",
MISSION_REPLACED_UNAVAILABLE: "mission_replaced_unavailable-",
MISSION_REPLACED_PAST: "mission_replaced_past-",
OK_SESSION_EXPIRED: "ok_session_expired",
OK_SESSION_RESTORED: "ok_session_restored",
AD_FROZEN: "ad_frozen-"
},
MISSION_DAU: "mission_dau",
MISSION_ROUND: "_mission_round",
MISSION_OPEN: "_mission_open",
MISSION_REWARD_COST: "_mission_reward_cost",
MISSION_REWARD: "_mission_reward_received",
MISSION_PROLONGATION: "_mission_prolongation",
OFFER_DAU: "offer_dau",
OFFER_OPEN: "offer_open",
OFFER_LOT: "lot",
OFFER_TILE_PURCHASE: "offer_tile_purchase",
PASS_FINISH_TASK: "pass_finish_task",
PASS_RECEIVED: "pass_received",
PASS_RECEIVED_PREMIUM: "pass_received_premium",
PASS_PURCHASED_TICKET: "pass_ticket_purchased",
MISSION_START: "mission_start",
MISSION_FINISH: "mission_finish",
TOURNAMENT_LEVEL_PLACE: "tournament_level_place",
COLLECTIONS_DAU: "collections_dau",
EXPEDITION_DAU: "expedition_dau",
EXPEDITION_FOG: "exp_",
OPEN_FOG: "fog-",
OPEN_FOG_TIME: "fog_time-",
BONUS_WORLD_LEVEL: "bonus_world_level",
BONUS_WORLD_DAU: "bonus_world_dau",
BONUS_WORLD_LEVEL_DAU: "bonus_world_level_dau",
BONUS_WORLD_REWARD: "BONUS_WORLD_REWARD",
BONUS_WORLD_PAYMENTS: "bonus_world_payments_",
START_LEVEL_DAU: "start_level_dau_",
MOVES10_DAU: "moves10_dau",
COMPLETE_LEVEL_DAU: "complete_level_dau",
TREASURE_SEARCH_WINDOW_OPEN: "tsearch_windowopen",
TREASURE_SEARCH_REWARD: "tsearch_reward",
TREASURE_SEARCH_REWARD_COST: "tsearch_reward_cost",
TREASURE_SEARCH_RECEIVE_SHOVELS: "tsearch_receive_shovels",
PINBALL_OPEN: "pb_open",
PINBALL_REWARD: "pb_reward",
PINBALL_REWARD_COST: "pb_reward_cost",
PINBALL_RECEIVE_CHIPS: "pb_receive_chips",
PINBALL_RECEIVE_TICKETS: "pb_receive_tickets",
PINBALL_PLAYED_GAMES: "pb_played_games",
METHA_ITEM: "metha_item",
METHA_LEVEL: "metha_level",
SIMPLE_METHA_LEVELUP: "simple_metha_background",
MAKE_CHOICE: "make_choice",
REDO_CHOICE: "redo_choice",
WIN_KNOCKOUT: "win_knockout",
LOSE_KNOCKOUT: "lose_knockout",
MINIGAME_FINISH: "minigame_finish",
MINIGAME_REWARD: "minigame_reward",
MINESWEEPER_START: "minesweeper_start",
MINESWEEPER_VICTORY: "minesweeper_victory",
DAILY_BONUS: "daily_bonus",
HELP_BY_FIVE_ATTEMPTS: "help_by_five_attemts",
HELP_BY_ATTEMPTS_DAU: "help_by_attemts_dau",
HELP_BY_ATTEMPTS_ONE_AND_MORE: "help_by_attemts_1_and_more",
HELP_BY_ATTEMPTS_THREE_AND_MORE: "help_by_attemts_3_and_more",
HELP_BY_ATTEMPTS_FIVE_AND_MORE: "help_by_attemts_5_and_more",
TACTICAL_EXTEND_SHOW: "tactical_extend_show",
MESSAGE_SENT_FRIEND: "message_friend",
MESSAGE_SENT_INVITE: "message_invite",
MESSAGE_SENT_PREFIX: "message_sent_",
MESSAGE_CANCEL_PREFIX: "message_cancel_",
MESSAGE_ERROR: "message_error",
INVITE_ICON_INVITE: "invite_icon_invite",
SESSION_DAILY_TASK_AVAILABLE: "session_daily_task_available",
SESSION_DAILY_TASK_FINISH: "session_daily_task_finish",
SESSION_DAILY_TASK_REWARD: "session_daily_task_reward",
SESSION_DAILY_TASK_OPEN_WINDOW: "session_daily_task_open_window",
DAILY_TASK_REWARD: "daily_task_rewarded",
DAILY_TASK_FINISH_AMOUNT: "daily_task_finish_amount",
DAILY_TASKS_OPEN_WINDOW: "daily_tasks_open_window",
DAILY_TASKS_START: "daily_tasks_start",
SUBSCRIPTION_WINDOW_OPEN: "subscription_window_open",
SUBSCRIPTION_REWARD: "subscription_reward",
SUBSCRIPTION_BOUGHT: "subscription_bought",
SUBSCRIPTION_CANCELLED: "subscription_cancelled",
CRYPTEX_FAIL: "cryptex_fail",
CUP_REWARD: "cup_reward_",
CUP_DAU: "cup_dau_",
CUP_PLAYERS: "cup_players_",
FUND_BUY: "bought_fund",
FUND_DAU: "growth_fund_dau",
FUND_GOLD: "growth_fund_gold",
SHARE_PROPOSED: "share_proposed_",
SHARE: "share_",
LEADERS_WINDOW_OPEN: "leaders_window_open",
NEW_LEAGUE: "new_league",
MOVES_SHOW: "moves_show",
MOVES_BOUGHT: "moves_bought",
MOVES_USED_FORCE: "moves_used_force",
BOOSTERS_EXECUTE: "boosters_execute",
HINT_USED: "hint_used",
DAILY_LEVEL_CHANNEL: "daily_level_channel_",
DAILY_LEVEL_PASSED: "daily_level_passed_",
PIGGY_BANK: "pig",
PIGGY_BANK_WINDOW_OPENED: "pig_window_opened",
BUTTERFLY_WINDOW_OPENED: "butterfly_window_opened",
BUTTERFLY_END_COLLECTED: "butterfly_end_collected_",
BUTTERFLY_END_STAGE: "butterfly_end_stage_",
BUTTERFLY_LVLUP: "butterfly_lvlup",
BUTTERFLY_COLLECTED: "butterfly_collected",
PRIZECAL_STAGE: "prizecal_stage",
PRIZECAL_WINDOW: "prizecal_window",
PRIZECAL_COMPLETE: "prizecal_complete",
RETURNBONUS_CHECK: "returnbonus_check",
RETURNBONUS_REWARD: "returnbonus_reward",
PROMO_REWARD: "promo_reward_",
PROMOCODE_REWARD: "promcode_",
STICKERS_COLLECTIONS: "stickers_cl_",
STICKER_OPEN: "sticker_",
STICKERS_BOOK_WINDOW_OPEN: "stickers_window",
STICKERS_SHOP_OPEN: "stickers_shop",
STAR_CHEST_OPEN: "star_chest_open",
PLAY_TIMES: "play_times",
BOOSTER_CELL_ADDED: "booster_cell_added",
BOOSTER_CELL_COLLECTED: "booster_cell_collected",
BOOSTER_CELL_RECEIVED: "booster_cell_recevied",
BOOSTER_COMBO_NO_PLACE: "booster_combo_no_place",
BOOSTER_MULTICOLOR_NO_PLACE: "booster_multicolor_no_place",
USER_EPISODE: "user_episode",
META_LOCATION: "meta_location",
UNDO_USED_FORCE: "undo_force",
MERGE_START: "merge_start",
CURRENT_RESOURCE: "current_resource_",
COMPLETE_RESOURCES: "complete_resources",
CURRENT_ORDER: "current_order_",
COMPLETE_ORDERS: "complete_orders",
SEASON_START: "season_start",
CURRENT_SEASON: "current_season_",
COMPLETE_SEASON: "complete_season_",
CURRENT_HERO: "current_hero_",
COMPLETE_HEROES: "complete_heroes",
CAMPAIGN: "campaign_",
CURRENT_PET: "curr_pet_",
CURRENT_PETRARE: "curr_petr_",
CURRENT_PETLEGEND: "curr_petl_",
COMPLETE_PET: "comp_pet",
COMPLETE_PETRARE: "comp_petr",
COMPLETE_PETLEGEND: "comp_petl",
PET_RATE: "pet_rate_",
CURRENT_EVENT: "curr_event_",
COMPLETE_EVENT: "comp_event_",
UNITS_SHOP_COINS: "units_shop_coins",
UNITS_SHOP_ITEM: "units_shop_item",
SOFT_CURRENCY_BUY: "soft_buy",
SOFT_CURRENCY_COST: "soft_cost",
UNITS_SOLD: "units_sold",
SPEND_WANDS: "spend_wands",
MONSTER_SPAWN: "monster_spawn",
MONSTER_DIE: "monster_die",
BANK_COINS: "bank_coins",
BATTLE_REGULAR: "battle_regular",
BATTLE_BONUS: "battle_bonus",
THIRD_ELEMENT_COUNT: "third_element_count",
UNIT_VALUE: "value_",
CLANS_DAU: "clans_dau",
UNITS_AMOUNT: "units_amount",
UNITS_AMOUNT_DAU: "units_amount_dau",
EARNED_COINSPLANT: "earned_coinsplant",
EARNED_RUBIESPLANT: "earned_rubiesplant",
EARNED_ENERGYPLANT: "earned_energyplant",
EARNED_MAGICPLANT: "earned_magicplant",
CASTLE_PRIZES: "castle_prizes",
TRADE_WINDOW_OPEN: "trade_windowopen",
TRADE_EXCHANGE: "trade_exchange_",
BONUS_LEVEL_FINISH: "bonus_level_finish",
LANDMARKS: {
OPEN: "landmark_open_",
REPLACE: "landmark_replace"
},
NOADS_PRODUCT: {
SIDEBAR_CLICK: "noads_sidebar_click",
WINDOW_OPEN: "noads_window_open",
SIDEBAR_PURCHASE: "noads_sidebar_purchase",
WINDOW_PURCHASE: "noads_window_purchase"
},
PLATFORM: {
CONNECT: "connect",
DISCONNECT: "disconnect"
}
};
(function() {
function a(b, c) {
Array.isArray(b) ? b.forEach(function(d) {
a(d, c)
}) : b.name = c.toLowerCase()
}
Object.keys(cleverappsEvents.CONVERSIONS).forEach(function(b) {
a(cleverappsEvents.CONVERSIONS[b], b.toLowerCase().replace(/_/g, ""))
})
}
)();
"undefined" !== typeof module && (module.exports = cleverappsEvents);
var ResolutionManager = function() {
this.frameWidth = window.innerWidth;
this.frameHeight = window.innerHeight;
this.scale = 1;
this.shown = this.isRotated = !1;
this.containerPadding = cc.padding();
this.paddings = {};
this._calculatedSafePadding = cc.padding();
this.mode = cleverapps.WideMode.VERTICAL;
this.addSafePadding("platform", connector.platform.getSafePadding(), !0);
cc.view.adjustViewPort(!0);
cc.view._devicePixelRatio = Math.min(2, window.devicePixelRatio || 1);
var a = 0
, b = void 0
, c = [50, 100, 200, 300, 500, 1E3, 2E3, 4E3];
this.checkResize = cleverapps.accumulate(connector.platform.oneOf(connector.VK) ? ResolutionManager.RESIZE_THROTTLE_VK : ResolutionManager.RESIZE_THROTTLE, function() {
this.addSafePadding("platform", connector.platform.getSafePadding(), !0);
var k = this.getFrameSize();
k.width === this.frameWidth && k.height === this.frameHeight && cc.paddingsEqual(this._calculateSafePadding(), this._calculatedSafePadding) || (cleverapps.config.wysiwygMode ? console.log("ignore resolution update (controlled by wysiwyg)") : (console.log("update resolution - " + JSON.stringify(k)),
this.setupDesignResolution()))
}
.bind(this));
var d = function() {
a === c.length ? b = void 0 : (b && cleverapps.timeouts.clearTimeout(b),
b = cleverapps.timeouts.setTimeout(function() {
this.checkResize();
a++;
d()
}
.bind(this), c[a]))
}
.bind(this)
, e = function() {
this.checkResize();
a = 0;
d()
}
.bind(this);
if (connector.platform.oneOf(connector.WECHAT)) {
var f = document.createElement("style");
f.innerHTML = ".rotate-container {\n transform: rotate(-90deg);\n -webkit-transform: rotate(-90deg);\n transform-origin: 0px 0px 0px;\n -webkit-transform-origin: 0px 0px 0px;\n}";
document.head.appendChild(f)
}
window.addEventListener("resize", e, !1);
window.addEventListener("orientationchange", e, !1);
connector.platform.on("updateSafePadding", e);
connector.platform.on("updateFrameSize", e);
connector.platform.oneOf(connector.WECHAT) && (wx.onDeviceOrientationChange(e),
wx.onWindowResize(e));
var g = 0
, h = cleverapps.timeouts.setInterval(function() {
this.checkResize();
g++;
60 <= g && cleverapps.timeouts.clearInterval(h)
}
.bind(this), 1E3);
if (cleverapps.config.debugMode)
cleverapps.flags.on("change:showSafeArea", this.updateSafeAreaDebugRect.bind(this))
};
ResolutionManager.prototype.showCanvas = function() {
if (!this.shown) {
this.shown = !0;
if (window.wechatFirstScreen) {
window.wechatFirstScreen.end();
delete window.wechatFirstScreen;
var a = cc.director.getRunningScene();
a && (a._canvas.active = !0)
}
cc.container && (cc.container.style.display = "block");
a = cc.game.canvas;
a.style.display = "block";
a.style.left = null;
a.style.top = null;
(a = document.getElementById("cocosLoading")) && document.body.removeChild(a);
this.setupDesignResolution()
}
}
;
ResolutionManager.prototype.isInitialized = function() {
return void 0 !== this.resolutionName
}
;
ResolutionManager.prototype.setupResolutionScale = function() {
this.resolutionName && resolutions[this.resolutionName] || (this.resolutionName = this._calcResolution());
resolutionScale = resolutions[this.resolutionName].scale;
cleverapps.UI.updateSizes(resolutionScale);
cleverapps.UI.selectSkinResources(this.resolutionName);
cleverapps.farm && cleverapps.farm.setupResolution();
this.setupDesignResolution()
}
;
ResolutionManager.prototype.addSafePadding = function(a, b, c) {
this.paddings[a] = b || cc.padding();
c || this.checkResize()
}
;
ResolutionManager.prototype.removeSafePadding = function(a, b) {
delete this.paddings[a];
b || this.checkResize()
}
;
ResolutionManager.prototype._calculateSafePadding = function() {
var a = this.safePaddingDebug ? [this.safePaddingDebug] : Object.values(this.paddings);
this._needRotate() && (a = a.map(cc.rotatePadding));
return cc.mergePaddings(a)
}
;
cleverapps.config.debugMode && (ResolutionManager.prototype.setSafePaddingDebug = function(a) {
this.safePaddingDebug = a;
this.setupDesignResolution()
}
,
ResolutionManager.prototype.updateSafeAreaDebugRect = function() {
this.safeAreaDebugRect && this.safeAreaDebugRect.removeFromParent();
if (cleverapps.flags.get("showSafeArea")) {
var a = cc.rect(this.sceneRect.x, this.sceneRect.y, this.sceneRect.width, this.sceneRect.height);
this.safeAreaDebugRect = drawDebugRect(a, cc.color(130, 0, 130, 255))
} else
this.safeAreaDebugRect && this.safeAreaDebugRect.removeFromParent()
}
);
ResolutionManager.prototype.setContainerPadding = function(a) {
a = a || {};
this.containerPadding = cc.padding(a);
this.setupDesignResolution()
}
;
ResolutionManager.prototype.getFrameSize = function() {
var a = connector.platform.getFrameSize();
return this.isRotated ? cc.size(a.height, a.width) : a
}
;
ResolutionManager.prototype.isLandscapeOrientation = function() {
return window.innerHeight < window.innerWidth
}
;
ResolutionManager.prototype.isPortraitOrientation = function() {
return window.innerHeight > window.innerWidth
}
;
ResolutionManager.prototype.resizeFont = function(a) {
var b = 1;
this.mode === cleverapps.WideMode.VERTICAL ? b = .625 : this.mode === cleverapps.WideMode.SQUARE && (b = .85);
return {
name: a.name,
size: b * a.size,
color: a.color,
stroke: a.stroke
}
}
;
ResolutionManager.prototype.getSceneSize = function() {
return cc.size(this.sceneRect.width, this.sceneRect.height)
}
;
ResolutionManager.prototype.getBgSize = function() {
return cc.size(this.bgSize)
}
;
ResolutionManager.prototype.getSafePadding = function() {
return cc.padding(this.bgSize.height - this.sceneRect.y - this.sceneRect.height, this.bgSize.width - this.sceneRect.x - this.sceneRect.width, this.sceneRect.y, this.sceneRect.x)
}
;
ResolutionManager.prototype.getBgRect = function() {
return cc.rect(-this.sceneRect.x, -this.sceneRect.y, this.bgSize.width, this.bgSize.height)
}
;
ResolutionManager.prototype.setupDesignResolution = function(a) {
connector.platform.oneOf(connector.WECHAT) || (this._needRotate() ? (cc.container.classList.add("rotate-container"),
this.isRotated = !0) : (cc.container.classList.remove("rotate-container"),
this.isRotated = !1));
var b = a || this.getFrameSize();
this.frameWidth = Math.max(b.width, cleverapps.MIN_FRAME_SIZE);
this.frameHeight = Math.max(b.height, cleverapps.MIN_FRAME_SIZE);
this._calculatedSafePadding = this._calculateSafePadding();
if (Math.min(this.frameWidth, this.frameHeight) < cleverapps.SETUP_RESOLUTION_MIN_FRAME_SIZE)
this.bgSize = this.bgSize || cc.size(this.frameWidth, this.frameHeight),
this.sceneRect = this.sceneRect || cc.rect(0, 0, this.frameWidth, this.frameHeight);
else {
this._updateSceneRect(void 0 !== a);
this._updateEngine();
this.mode = cleverapps.WideMode.VERTICAL;
this.sceneRect.width > cleverapps.styles.SQUARE_MODE_WIDTH && (this.mode = cleverapps.WideMode.SQUARE);
this.sceneRect.width > cleverapps.styles.HORIZONTAL_MODE_WIDTH && (this.mode = cleverapps.WideMode.HORIZONTAL);
cleverapps.bannerAd && cleverapps.bannerAd.onResize();
if (a = cleverapps.scenes.getRunningScene())
a.onResize();
cleverapps.config.debugMode && this.updateSafeAreaDebugRect()
}
}
;
ResolutionManager.prototype._calculateContainerRect = function() {
var a = cc.padding(this.containerPadding);
return this.isRotated ? cc.rect(a.top, a.left, this.frameWidth - a.top - a.bottom, this.frameHeight - a.left - a.right) : cc.rect(a.left, a.top, this.frameWidth - a.left - a.right, this.frameHeight - a.top - a.bottom)
}
;
ResolutionManager.prototype._positionContainer = function(a, b, c) {
var d = cc.padding(this.containerPadding)
, e = cc.view.getDevicePixelRatio();
cc.view._viewPortRect = cc.rect(0, 0, this.frameWidth * e, this.frameHeight * e);
cc.view._visibleRect = cc.rect(0, 0, a, b);
cc.winSize.width = cc.director._winSizeInPoints.width = a;
cc.winSize.height = cc.director._winSizeInPoints.height = b;
b = c.height / b;
cc.view._scaleX = cc.view._scaleY = this.scale = e * b;
a *= b;
b = c.height;
connector.info.isInApp && connector.platform.oneOf(connector.INSTANT) && (document.body.style.width = "100vw",
document.body.style.height = "100vh");
var f = cc.game.container.style;
f.width = cc.game.canvas.style.width = Math.round(a) + "px";
f.height = cc.game.canvas.style.height = b + "px";
f.left = Math.round(d.left) + "px";
f.top = Math.round(d.top + (this.isRotated ? c.width : 0)) + "px";
f.padding = "0 " + Math.round((c.width - a) / 2) + "px";
cc.game.canvas.width = Math.round(a * e);
cc.game.canvas.height = b * e
}
;
ResolutionManager.prototype._updateSceneRect = function(a) {
var b = this._calculateContainerRect()
, c = b.width / b.height
, d = b.height / (b.height - this._calculatedSafePadding.bottom - this._calculatedSafePadding.top)
, e = b.width / (b.width - this._calculatedSafePadding.left - this._calculatedSafePadding.right)
, f = cleverapps.styles.SCENE_HEIGHT * d
, g = f * c;
g < cleverapps.styles.SCENE_MIN_WIDTH && !a && (g = cleverapps.styles.SCENE_MIN_WIDTH,
f = g / c);
g > cleverapps.styles.SCENE_MAX_WIDTH && !a && (g = cleverapps.styles.SCENE_MAX_WIDTH);
this._positionContainer(g, f, b);
g = 2 * Math.round(g / 2);
f = 2 * Math.round(f / 2);
this.bgSize = cc.size(g, f);
this.sceneRect = cc.rect(2 * Math.round(g / b.width * this._calculatedSafePadding.left / 2), 2 * Math.round(f / b.height * this._calculatedSafePadding.bottom / 2), 2 * Math.round(g / e / 2), 2 * Math.round(f / d / 2))
}
;
ResolutionManager.prototype._needRotate = function() {
if (connector.platform.oneOf(connector.YOUTUBE, connector.GAMESNACK, connector.WECHAT))
return !1;
var a = window.innerWidth > window.innerHeight && "horizontal" !== cleverapps.config.orientation || window.innerWidth < window.innerHeight && "horizontal" === cleverapps.config.orientation
, b = this.getFrameSize();
b = Math.min(b.width, b.height) > .65 * Math.max(b.width, b.height);
return connector.info.isMobile && !connector.info.isNative && !b && a
}
;
ResolutionManager.prototype._calcResolution = function() {
var a = this.frameHeight;
window.screen && window.screen.height && (a = Math.max(a, window.screen.height));
connector.platform.oneOf(connector.MOBAGE) && (a = MobageLogic.HEIGHT);
var b = a * cc.view.getDevicePixelRatio();
a = Object.keys(resolutions);
var c = a.filter(function(h) {
return resolutions[h].webp
});
0 < c.length && (cleverapps.config.webpSupport ? a = c : c.length < a.length && (a = cleverapps.substract(a, c)));
a = a.sort(function(h, k) {
return resolutions[h].scale - resolutions[k].scale
});
c = function(h) {
h = h.scale * cleverapps.styles.SCENE_HEIGHT;
return h >= b ? h - b : 100 * (b - h)
}
;
for (var d = 0, e = c(resolutions[a[d]]), f = 1; f < a.length; f++) {
var g = c(resolutions[a[f]]);
g < e && (e = g,
d = f)
}
return a[d]
}
;
ResolutionManager.prototype._updateEngine = function() {
"creator" === engine ? creator.director.root.resizeRoot(cc.game.canvas.width, cc.game.canvas.height, 1) : (cc._renderType === cc.game.RENDER_TYPE_WEBGL ? cc.director.setGLDefaultValues() : cc._renderType === cc.game.RENDER_TYPE_CANVAS && (cc.renderer._allNeedDraw = !0),
cc.visibleRect && cc.visibleRect.init(cc.view._visibleRect),
cc._renderContext.resetCache && cc._renderContext.resetCache(),
cc.view._initFrameSize(),
connector.info.isMobile && cc.view._adjustViewportMeta())
}
;
"cocos2d" === engine && (cc.EGLView.prototype.convertToLocationInView = function(a, b, c) {
a = this.getDevicePixelRatio() * (a - c.left);
b = this.getDevicePixelRatio() * (c.top + c.height - b);
c = cleverapps.resolution ? cleverapps.resolution.containerPadding.left + cleverapps.resolution.containerPadding.right : 0;
c *= this.getDevicePixelRatio();
return cleverapps.resolution && cleverapps.resolution.isRotated ? {
x: b,
y: this._viewPortRect.height - a - c
} : {
x: a,
y: b
}
}
);
cleverapps.WideMode = {
VERTICAL: 0,
SQUARE: 1,
HORIZONTAL: 2
};
ResolutionManager.RESIZE_THROTTLE = 0;
ResolutionManager.RESIZE_THROTTLE_VK = 50;
window.ENABLE_IMAEG_POOL = !1;
cleverapps.EVENTS = cleverappsEvents;
cleverapps.whenAllInitialized = function(a) {
cleverapps.allInitialized && a();
cleverapps.__whenAllInitializedCallbacks || (cleverapps.__whenAllInitializedCallbacks = []);
cleverapps.__whenAllInitializedCallbacks.push(a)
}
;
cleverapps.afterAllLoadingFinish = function() {
cleverapps.allInitialized = !0;
cleverapps.timeStart = Date.now();
cleverapps.__whenAllInitializedCallbacks && cleverapps.__whenAllInitializedCallbacks.forEach(function(a) {
a()
})
}
;
cleverapps.afterResourceLoaded = function() {
"undefined" !== typeof document && (document.title = Messages.get(cleverapps.config.title));
LogTimeStart.active && LogTimeStart.active.stop();
cleverapps.getRequestParameters().testLoadingTime ? cleverapps.notification.create("Loading finished", {
debugInfo: !0
}) : (cleverapps.LocalizationManager.run(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.APP_INITIALIZE),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.RENDER_TYPE + (cc._renderType === cc.game.RENDER_TYPE_CANVAS ? "canvas" : "webgl")),
void 0 !== cleverapps.dataLoader.checksumMatch && cleverapps.eventLogger.logEvent(cleverapps.dataLoader.checksumMatch ? cleverapps.EVENTS.DEBUG.CLEARANCE.DATALOADER_CHECKSUM_MATCH : cleverapps.EVENTS.DEBUG.CLEARANCE.DATALOADER_CHECKSUM_DIFFERENT),
cleverapps.Shaders.initialize(),
cleverapps.flags.update(),
cleverapps.returnBonus = new ReturnBonus,
cleverapps.promoCodes = new PromoCodes,
cleverapps.placements = new Placements,
cc.renderer.assignedZStep = 1E-5,
cleverapps.bannerAd = new BannerAd,
cleverapps.giveUsersGifts(),
cleverapps.focusManager.distract({
focus: "afterAllLoadingFinish",
actions: [function(a) {
cleverapps.resolution.showCanvas();
connector.platform.startGameCallback(a)
}
, function(a) {
cleverapps.afterAllLoadingFinish();
cleverapps.userDelete.checkDeletion(a)
}
, function(a) {
if (cleverapps.loadedSnapshot && cleverapps.loadedSnapshot.scene)
cleverapps.reloadSnapshotScene(cleverapps.loadedSnapshot.scene, function() {
var b = cleverapps.loadedSnapshot.ads;
b && b.running && cleverapps.rewardedAdsManager.showInterstitial();
a()
});
else
cleverapps.Plot.onStartup(a)
}
]
}))
}
;
cleverapps.createGlobalObjects = function() {
[cleverapps.importSnapshot, cleverapps.unitsDemoMode, cleverapps.personDemo].forEach(function(b) {
b && b()
});
cleverapps.bundleLoader = new BundleLoader;
cleverapps.timeouts = new Timeouts;
cleverapps.flags = new cleverapps.Flags;
cleverapps.gameModes = new GameModes;
cleverapps.eventBus = new cleverapps.EventEmitter;
cleverapps.notification = new cleverapps.Notification;
cleverapps.centerHint = new CenterHint;
cleverapps.aims = new Aims;
cleverapps.resolution = new ResolutionManager;
cleverapps.dataLoader = new DataLoader;
cleverapps.gameModes.load();
cleverapps.instantTournament = new InstantTournament;
cleverapps.scoreTracker = new ScoreTracker;
cleverapps.gameManager = new GameManager;
cleverapps.country = new Country;
cleverapps.permissions = new UserPermissions;
cleverapps.userDelete = new UserDelete;
Missions.initialize();
Offers.initialize();
VirtualProducts.initialize();
RewardedAdOverlay.initialize();
cleverapps.PaymentsHistory.initialize();
cleverapps.synchronizer = new cleverapps.Synchronizer;
cleverapps.eventLogger = new EventsLogger;
cleverapps.conversionManager = new ConversionManager;
cleverapps.focusManager = new FocusManager;
cleverapps.playSession = new PlaySession;
cleverapps.persons = new PersonsLibrary;
cleverapps.info = new cleverapps.Information;
cleverapps.expBySlots = {};
Meta.SLOTS.forEach(function(b) {
cleverapps.expBySlots[b] = new Exp(b)
});
cleverapps.exp = cleverapps.expBySlots[Meta.SLOT_MAIN];
var a = !1 === cleverapps.dataLoader.haveSavedData();
a && (console.log("Creating new user"),
cleverapps.synchronizer.reset());
cleverapps.paymentsLogic = new PaymentsLogic;
cleverapps.settings = new cleverapps.Settings(a);
cleverapps.user = levels.user = new levels.User(a);
a || connector.platform.calcPromo(function(b) {
b && (cleverapps.eventLogger.logEvent(b),
cleverapps.user.isReturnedPlayer() && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.RETURNS + b))
});
cleverapps.meta = new Meta;
cleverapps.meta.updateLocations && cleverapps.meta.updateLocations();
cleverapps.consoleStream = new cleverapps.ConsoleStream;
cleverapps.abTest = new cleverapps.ABTest;
cleverapps.lazyAssets = new LazyAssets;
cleverapps.userStatus = new UserStatus;
cleverapps.scenes = new cleverapps.Scenes;
cleverapps.environment = new cleverapps.Environment;
cleverapps.restoreProgress = new RestoreProgress;
cleverapps.skins = new cleverapps.SkinManager;
cleverapps.windows = new Windows;
cleverapps.audio = new cleverapps.Audio;
cleverapps.versionChecker = new VersionChecker;
cleverapps.info.reportPhone();
cleverapps.info.reportUserAgent();
cleverapps.info.reportMaxTextureSize();
cleverapps.info.reportSysLanguage();
ConsentTcfApi.init();
cleverapps.crossPromo = new cleverapps.CrossPromo;
cleverapps.friends = new FriendsCache;
cleverapps.invitalbleFriends = new FriendsCache(!0);
cleverapps.requests = new Requests;
cleverapps.invites = new Invites;
cleverapps.activities = new Activities;
cleverapps.paymentsHistory = new cleverapps.PaymentsHistory;
cleverapps.userIdsHistory = new UserIdsHistory;
cleverapps.localPushes = new cleverapps.LocalPushes;
cleverapps.serverFlags = new cleverapps.ServerFlags;
cleverapps.boosters = new cleverapps.Boosters(a);
cleverapps.forces = new Forces;
levels.friendSorter = new FriendSorter;
levels.friendRequests = new levels.FriendRequests;
cleverapps.eventManager = new EventManager;
cleverapps.missionManager = new MissionManager;
cleverapps.competitionStatistics = new CompetitionStatistics;
cleverapps.leagueLeadersTable = new cleverapps.Table;
cleverapps.cupsLeadersTable = new cleverapps.Table;
cleverapps.cupsTopTable = new cleverapps.Table;
cleverapps.dailyCup = new Cup(CupsConfig.TYPE_DAILY);
cleverapps.weeklyCup = new Cup(CupsConfig.TYPE_WEEKLY);
cleverapps.clanCupInner = new Cup(CupsConfig.TYPE_CLAN_INNER);
cleverapps.clanCup = new Cup(CupsConfig.TYPE_CLAN,cleverapps.clanCupInner);
cleverapps.rewardedAdsManager = new RewardedAdsManager;
cleverapps.travelBook = new TravelBook;
cleverapps.offerManager = new OfferManager;
WebWorker.IsAvailable() && (cleverapps.webWorker = WebWorker.Build());
cleverapps.exclamation = new Exclamation;
cleverapps.tooltipManager = new TooltipManager;
cleverapps.chat = new Chat;
cleverapps.keyboardController = new KeyboardController;
cleverapps.appTracking = new AppTracking;
cleverapps.config.debugMode && cleverapps.createDebugGlobalObjects();
if (cleverapps.InitByType[cleverapps.config.type])
cleverapps.InitByType[cleverapps.config.type](a);
if (cleverapps.InitByMeta[cleverapps.meta.getType()])
cleverapps.InitByMeta[cleverapps.meta.getType()](a);
cleverapps.fallSale = new FallSale;
cleverapps.abTest.updateGroups();
a && cleverapps.user.initializeNewPlayer();
cleverapps.config.features.forEach(function(b) {
if (cleverapps.InitByFeature[b])
cleverapps.InitByFeature[b](a)
});
-1 !== "merge match3 differences solitaire board blocks tile3".split(" ").indexOf(cleverapps.config.type) && (cleverapps.dailyTasks = new DailyTasks(a));
cleverapps.subscription = new Subscription;
cleverapps.adsLimits = new AdsLimits;
cleverapps.toolbar = new Toolbar;
cleverapps.sideBar = new SideBar;
cleverapps.menuBar = new MenuBar;
cleverapps.competitionPlayers = new CompetitionPlayers;
cleverapps.missionManager.init();
cleverapps.travelBook.init();
cleverapps.noAds = new NoAds;
cleverapps.offerManager.initialize();
return a
}
;
cleverapps.InitByType = {};
cleverapps.InitByMeta = {};
cleverapps.InitByFeature = {};
cleverapps.checkWebpSupport = function(a) {
connector.platform.oneOf(connector.WECHAT) && connector.info.os === cc.sys.OS_ANDROID && 11 <= connector.info.androidVersion && (cleverapps.config.webpSupport = !0);
if (void 0 !== cleverapps.config.webpSupport)
a();
else if (connector.platform.oneOf(connector.WECHAT) && connector.info.os === cc.sys.OS_ANDROID) {
var b = document.createElement("canvas");
b.width = 1;
b.height = 1;
var c = b.getContext && b.getContext("2d");
cleverapps.config.webpSupport = c && b.toDataURL("image/webp").startsWith("data:image/webp");
a()
} else {
var d = {
lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",
lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",
alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA=="
}
, e = 0
, f = 0
, g = cleverapps.waitNoMore(5E3, cleverapps.once(function() {
cleverapps.config.webpSupport = f === Object.keys(d).length;
a()
}));
Object.keys(d).forEach(function(h) {
cc.loader.loadImg("data:image/webp;base64," + d[h], function(k, m) {
(k = !k && m && 0 < m.width && 0 < m.height) || console.log("webp " + h + " not supported");
e++;
k && f++;
k && e !== Object.keys(d).length || g()
})
})
}
}
;
cleverapps.onStart = function() {
console.log("game started");
"undefined" !== typeof document && (document.title = cleverapps.config.title);
(new ActionPlayer([function(a) {
cleverapps.config.testPlatform = cleverapps.isLocalhost() || cleverapps.isStaging();
connector.initialize({
config: Object.assign({}, cleverapps.config, {
projectId: cleverapps.config.name
}),
products: cleverapps.products,
manualPermissions: !0,
migrateLocalStorage: !0
}, a)
}
, function(a) {
cc.sys.isNative = connector.info.isNative;
cleverapps.platformLogic = PlatformLogic.create();
cleverapps.platformLogic.onInitialize();
cleverapps.onPlatformStart();
a()
}
])).play();
if (cleverapps.config.debugMode && !cleverapps.isLocalhost() && !connector.info.isNative && "https:" !== window.location.protocol)
throw "https required: " + window.location;
}
;
cleverapps.onPlatformStart = function() {
var a = cleverapps.createGlobalObjects()
, b = -1E3
, c = cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, function() {
b = cc.director.getTotalFrames()
})
, d = cleverapps.wait(5, function() {
a && cleverapps.settings.language !== cleverapps.Settings.getDefaultLanguage() && !cleverapps.config.importMode && cleverapps.settings.setLanguage(cleverapps.Settings.getDefaultLanguage());
Messages.preload(cleverapps.settings.language, function() {
cc.eventManager.removeListener(c);
cleverapps.silentIntro = cc.game.isPaused() || 60 >= cc.director.getTotalFrames() - b || cleverapps.loadedSnapshot;
cleverapps.afterResourceLoaded(a)
})
});
cleverapps.abTest.initialize(cleverapps.waitNoMore(2E3, d));
var e = cleverapps.wait(4, function() {
a && cleverapps.user.isFirstSession() && cleverapps.playSession.reportNewUser()
})
, f = cleverapps.once(d)
, g = cleverapps.once(function() {
d();
e()
})
, h = cleverapps.once(function() {
d();
e()
})
, k = cleverapps.once(d);
a ? cleverapps.user.calcChannel(cleverapps.waitNoMore(1E4, e)) : e();
cleverapps.flags.norest ? (f(),
e()) : cleverapps.synchronizer._onceFirstSyncCompletedListener = cleverapps.once(function() {
f();
e()
});
var m = cleverapps.waitNoMore(5E3, function() {
if (cleverapps.config.importMode || connector.social.isConnected()) {
if (!cleverapps.config.importMode) {
var l = connector.social.isLoggedIn() && 0 === cleverapps.user.level && 0 === cleverapps.user.episode;
setTimeout(f, l ? 1E4 : 3E3)
}
cleverapps.versionChecker.check();
connector.social.isLoggedIn() || (connector.platform.withTmpID() || connector.platform.withDeviceID() || !connector.social.oneOf(connector.CRAZY) ? cleverapps.synchronizer.syncWhenReady() : (connector.dataLoader.cleanAll(),
cleverapps.dataLoader.cleanAll(),
connector.dataLoader.setEnabled(!1),
cleverapps.dataLoader.setEnabled(!1),
window.location.reload()))
} else
f();
h()
});
connector.platform.on("changeStatus", function(l) {
cleverapps.eventLogger.logEvent(l === connector.STATUS_CONNECTED ? cleverapps.EVENTS.PLATFORM.CONNECT : cleverapps.EVENTS.PLATFORM.DISCONNECT)
});
connector.platform.on("pendingRequestsFreeze", function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.PENDING_REQUESTS_FREEZE)
});
connector.social.on("login", function(l) {
cleverapps.SocialManager.onLogin(l)
});
connector.platform.oneOf(connector.INSTANT, connector.SAMSUNG) || a && connector.platform.oneOf(connector.YANDEX) ? connector.platform.whenConnected(g) : g();
if (connector.social.isConnected())
m();
else
connector.social.once("changeStatus", m);
connector.player.on("changed", function() {
cleverapps.SocialManager.onPlayerInfoChanged()
});
connector.platform.whenConnected(function() {
connector.platform.oneOf(connector.SP_MOBAGE) && cleverapps.resolution.setContainerPadding({
bottom: 27
});
connector.platform.oneOf(connector.MM) && !connector.info.isMobile && window.outerHeight && window.innerHeight && cleverapps.resolution.setupDesignResolution(cc.size(window.innerWidth, window.outerHeight - 250));
if (cleverapps.platformLogic.onConnected)
cleverapps.platformLogic.onConnected();
cleverapps.platformLogic.logPushes && cleverapps.platformLogic.logPushes()
});
cleverapps.platformLogic.initGameEvents();
cleverapps.platformLogic.onStart();
g = cleverapps.timeredThrottle(1E4, function() {
cleverapps.flags.disableReconnect || (connector.platform.connect(),
connector.social.connect(),
connector.payments.connect(),
connector.ads.connect())
});
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, g);
cleverapps.timeouts.setInterval(g, cleverapps.parseInterval("30 seconds"));
cleverapps.permissions.queuePermission(function(l) {
connector.ads.askPermission(l)
});
connector.ads.on("pluginChanged", function() {
cleverapps.permissions.queuePermission(function(l) {
connector.ads.askPermission(l)
})
});
cleverapps.permissions.queuePermission(function(l) {
cleverapps.localPushes.askPermission(l)
});
cleverapps.checkWebpSupport(function() {
cleverapps.resolution.setupResolutionScale();
connector.info.isNative && !cleverapps.config.webpSupport && resolutions[cleverapps.resolution.resolutionName].webp && (alert("Error no webp supported"),
cleverapps.throwAsync("Error no webp supported"));
var l = Date.now()
, n = new LoaderScene(ResourceProcessor.calcProbablyNeed(),function() {
cleverapps.bundleLoader.loadBundles(ResourceProcessor.calcAlwaysNeed(), {
onSuccess: function() {
if (cleverapps.dataLoader.load(DataLoader.TYPES.THROWERROR))
throw cleverapps.dataLoader.remove(DataLoader.TYPES.THROWERROR),
"test error on load";
cleverapps.ConsoleStream.sendLoadingTime("loaderScene " + (Date.now() - l) + "ms");
var p = function() {
cleverapps.snapshotToLoad ? (cleverapps.loadSnapshot(cleverapps.snapshotToLoad, k),
delete cleverapps.snapshotToLoad) : k()
}
, q = cleverapps.getRequestParameters(location.hash);
q.clipId && !q.wysiwyg ? (cleverapps.wysiwyg = new Wysiwyg(q.directory),
cleverapps.wysiwyg.loadClipFromUrlParams(p)) : p()
}
})
}
);
cc.director.runScene(n);
cc.director.setNextScene()
})
}
;
var RemoteJson = function(a) {
cleverapps.EventEmitter.call(this);
this.json = a;
if (a.remote) {
var b = a.remote.replace("firebase://", "").split("/")
, c = this.name = b[0];
b = this.key = b[1];
RemoteProject.isAvailable(c) && (c = RemoteProject.GetProject(c),
c.setDefaultValue(b, a),
c.initializeThrottle(),
c.fetchAndActivateThrottle(),
this.project = c,
c.on("update", this.update.bind(this)),
this.update())
}
};
RemoteJson.prototype = Object.create(cleverapps.EventEmitter.prototype);
RemoteJson.prototype.constructor = RemoteJson;
RemoteJson.prototype.getJson = function() {
return this.json
}
;
RemoteJson.prototype.update = function() {
var a = this.project.getValue(this.key);
JSON.stringify(this.json) !== JSON.stringify(a) && (console.log("update " + this.key, a),
this.json = a,
this.trigger("update"))
}
;
RemoteJson.prototype.initialize = function(a) {
!this.project || this.project.initialized ? a() : (this.project.initializeThrottle(),
this.project.once("initialize", a))
}
;
var RemoteProject = function(a) {
cleverapps.EventEmitter.call(this);
this.name = a;
this.remoteConfig = firebase.initializeApp(cleverapps.config.firebaseClientKeys[a], a).remoteConfig();
this.remoteConfig.defaultConfig = {};
cleverapps.config.debugMode && (this.remoteConfig.settings.minimumFetchIntervalMillis = 1E3);
this.initializeThrottle = cleverapps.throttle(1E4, cleverapps.accumulate(0, this.initialize.bind(this)));
this.fetchAndActivateThrottle = cleverapps.throttle(1E4, cleverapps.accumulate(0, this.fetchAndActivate.bind(this)));
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, function() {
this.fetchAndActivateThrottle()
}
.bind(this))
};
RemoteProject.prototype = Object.create(cleverapps.EventEmitter.prototype);
RemoteProject.prototype.constructor = RemoteProject;
RemoteProject.Projects = {};
RemoteProject.GetProject = function(a) {
var b = RemoteProject.Projects[a];
b || (b = RemoteProject.Projects[a] = new RemoteProject(a));
return b
}
;
RemoteProject.isAvailable = function(a) {
var b = "undefined" !== typeof firebase && !cleverapps.flags.norest
, c = cleverapps.config.firebaseClientKeys && cleverapps.config.firebaseClientKeys[a];
if (b && !c)
cleverapps.throwAsync("Firebase key missing - " + a);
else
return b
}
;
RemoteProject.prototype.setDefaultValue = function(a, b) {
"object" === typeof b && (b = JSON.stringify(b));
this.remoteConfig.defaultConfig[a] = b
}
;
RemoteProject.prototype.initialize = function() {
if (!this.initialized) {
var a = this.name;
this.remoteConfig.ensureInitialized().then(function() {
this.initialized = !0;
this.trigger("initialize");
this.trigger("update")
}
.bind(this)).catch(function(b) {
console.log("RemoteJson " + a + " initialize error", b)
})
}
}
;
RemoteProject.prototype.fetchAndActivate = function() {
var a = this.name;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CONFIG.FETCH_START + a);
this.remoteConfig.fetchAndActivate().then(function() {
this.trigger("update");
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CONFIG.FETCH_SUCCESS + a)
}
.bind(this)).catch(function(b) {
console.log("RemoteJson " + a + "fetch error", b);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CONFIG.FETCH_FAILURE + a)
})
}
;
RemoteProject.prototype.getValue = function(a) {
var b = this.remoteConfig.getValue(a);
(b = b && b.asString()) && a.endsWith("_json") && (b = JSON.parse(b));
return b
}
;
var HasInitialized = function() {
this.onInitializedListeners = {};
this.initialized = !1
};
HasInitialized.prototype.setInitialized = function(a) {
if (this.initialized = a) {
for (var b in this.onInitializedListeners)
(0,
this.onInitializedListeners[b])();
this.onInitializedListeners = {}
}
}
;
HasInitialized.prototype.isInitialized = function() {
return this.initialized
}
;
HasInitialized.prototype.whenInitialized = function(a, b) {
this.isInitialized() ? b() : this.onInitializedListeners[a] = b
}
;
cleverapps.styles = {};
cleverapps.styles.ALIGN_BOTTOM = "b";
cleverapps.ASPECT_RATIO = 1920 / 1080;
cleverapps.styles.SCENE_HEIGHT = 1334;
cleverapps.styles.SCENE_MIN_WIDTH = Math.round(cleverapps.styles.SCENE_HEIGHT / cleverapps.ASPECT_RATIO / 1.137);
cleverapps.styles.SCENE_MAX_WIDTH = Math.round(cleverapps.styles.SCENE_HEIGHT * cleverapps.ASPECT_RATIO * 1.644);
cleverapps.styles.SQUARE_MODE_WIDTH = 1.97 * cleverapps.styles.SCENE_MIN_WIDTH;
cleverapps.styles.HORIZONTAL_MODE_WIDTH = .52 * cleverapps.styles.SCENE_MAX_WIDTH;
cleverapps.MIN_FRAME_SIZE = 20;
cleverapps.SETUP_RESOLUTION_MIN_FRAME_SIZE = 150;
cleverapps.SETUP_RESOLUTION_MIN_FRAME_SIZE_FS = 350;
cleverapps.styles.SIDEBAR_WIDTH = 35;
cleverapps.styles.MIN_SIDEBAR_X = 2;
cleverapps.styles.COLORS = {
BLACK: new cc.Color(0,0,0,255),
BLACK_STROKE: new cc.Color(0,0,0,90),
COLOR_GRAY: new cc.Color(200,200,200,255),
COLOR_DARK_GRAY: new cc.Color(150,150,150,255),
COLOR_VERY_DARK_GRAY: new cc.Color(100,100,100,255),
WHITE: new cc.Color(255,255,255,255),
GREEN: new cc.Color(13,119,0,255),
YELLOW: new cc.Color(255,255,0,255),
ORANGE: new cc.Color(255,165,0),
PURPLE: new cc.Color(101,24,143,255),
HOVER: new cc.Color(230,230,230,255),
COLOR_BROWN: new cc.Color(60,45,25,255),
COLOR_RED: new cc.Color(255,0,0,255),
COLOR_BLUE: new cc.Color(0,177,249,255),
COLOR_LIGHT_BLUE: new cc.Color(93,147,213,255),
MESSAGE_GREEN: new cc.Color(4,160,41,255),
MESSAGE_RED: new cc.Color(246,42,71,255),
MESSAGE_PINK: new cc.Color(245,0,138,255),
LIFE_GREEN: new cc.Color(24,200,61,255),
PINK: new cc.Color(255,102,102,255),
COLOR_DARK_BROWN: new cc.Color(120,85,85,255),
HERO_STATS_UPGRADE: new cc.Color(57,237,7,255),
REWARDS_TEXT_STROKE_COLOR: new cc.Color(76,98,109,255),
GRAY_SCALE_COLOR: new cc.Color(135,135,135,255),
GRAY_SCALE_RESTORE_COLOR: new cc.Color(255,255,255,255),
DAILY_TOURNAMENT_TIMER: new cc.Color(130,70,40,255),
DARK_RED: new cc.Color(200,0,0,255),
COLOR_DARK_YELLOW: new cc.Color(255,194,9,255),
COLOR_LIGHT_YELLOW: new cc.Color(255,245,59,255),
COLOR_LIGHT_YELLOW_SHADOW: new cc.Color(181,139,0,255),
COLOR_LIGHT_PURPLE: new cc.Color(207,58,86,255),
COLOR_BROWN_2: new cc.Color(173,61,0,255),
COLOR_WINDOW_TEXT: new cc.Color(130,70,40,255),
COLOR_VERYLIGHTBROWN: new cc.Color(220,191,144,255),
COINS_REWARD_YELLOW: new cc.Color(255,244,55,255),
COINS_REWARD_STROKE_COLOR: new cc.Color(149,67,23,255),
MINIGAME_REWARD_TEXT: new cc.Color(66,68,80),
DARK_TEXT_COLOR: new cc.Color(255,255,255,255),
DRAGGING_UNIT_COLOR: new cc.Color(180,255,180,255),
DRAGG_TARGET_UNIT_COLOR: new cc.Color(255,255,0,255),
CHEST_REWARD_COLOR: new cc.Color(248,233,43,255),
CHEST_REWARD_STROKE_COLOR: new cc.Color(189,102,5),
NOADS_WINDOW_TEXT: new cc.Color(164,65,64,255),
LIGHT_TEXT_STROKE_COLOR: new cc.Color(0,0,0,125),
LIGHT_TEXT_SHADOW_COLOR: new cc.Color(9,0,0,100),
STICKER_REWARD_COLOR: new cc.Color(225,224,224,255),
STICKER_REWARD_SHADOW_COLOR: new cc.Color(99,86,74,255),
STICKER_REWARD_RARE_COLOR: new cc.Color(255,224,0,255),
STICKER_REWARD_RARE_SHADOW_COLOR: new cc.Color(136,74,3,255),
STICKERS_AVAILABLE_COLOR: new cc.Color(191,129,108,1),
STICKERS_COLLECTION_COLOR: new cc.Color(121,75,57,1),
STICKER_LABEL_COLOR: new cc.Color(53,91,130,1),
PIXEL_OFFER_REWARD_COLOR: new cc.Color(158,63,246),
DAILY_TASK_REWARD_COLOR: new cc.Color(185,102,65,1),
DAILY_TASK_TIMER_TEXT_COLOR: new cc.Color(191,130,107,1)
};
cleverapps.styles.DECORATORS = {
WHITE_TEXT_SHADOW: {
color: cleverapps.styles.COLORS.BLACK,
direction: cc.size(0, -4),
blur: 5
},
LIGHT_WHITE_SHADOW: {
color: cleverapps.styles.COLORS.WHITE,
direction: cc.size(0, -2),
blur: 2
},
BROWN_STROKE: {
color: cleverapps.styles.COLORS.COLOR_BROWN_2,
size: 3
},
BUTTON_TEXT_SHADOW: {
color: cleverapps.styles.COLORS.BLACK,
direction: cc.size(0, 0),
blur: 5
},
BUTTON_TEXT_STROKE: {
color: cleverapps.styles.COLORS.BLACK,
size: 2
},
WINDOW_WHITE_TEXT_STROKE: {
color: cleverapps.styles.COLORS.BLACK,
size: 1
},
REWARDS_TEXT_STROKE: {
color: cleverapps.styles.COLORS.REWARDS_TEXT_STROKE_COLOR,
size: 3
},
DAILY_TOURNAMENT_TITLE_STROKE: {
color: new cc.Color(116,17,168,255),
size: 4
},
TILE_SHOP_WINDOW_STROKE: {
color: new cc.Color(150,111,72,255),
size: 2
},
TILE_SHOP_WINDOW_TITLE_SHADOW: {
color: new cc.Color(112,109,109,255),
direction: cc.size(0, -4),
blur: 0
},
IMAGE_FONT_STROKE: {
color: cleverapps.styles.COLORS.BLACK_STROKE,
size: 1
},
IMAGE_FONT_SHADOW: {
color: cleverapps.styles.COLORS.BLACK,
direction: cc.size(0, -1),
blur: 3
},
TRANSPARENT_BLACK_2PX: {
color: cleverapps.styles.COLORS.BLACK_STROKE,
size: 2
},
WHITE_STROKE: {
color: cleverapps.styles.COLORS.WHITE,
size: 2
},
LIGHT_TEXT_STROKE: {
color: cleverapps.styles.COLORS.LIGHT_TEXT_STROKE_COLOR,
size: 1
},
LIGHT_TEXT_SHADOW: {
color: cleverapps.styles.COLORS.LIGHT_TEXT_SHADOW_COLOR,
direction: cc.size(0, -3),
blur: 3
},
RED_STROKE: {
color: cleverapps.styles.COLORS.COLOR_RED,
size: 2
},
BLUE_STROKE: {
color: cleverapps.styles.COLORS.COLOR_BLUE,
size: 2
},
MESSAGE_RED_STROKE: {
color: cleverapps.styles.COLORS.MESSAGE_RED,
size: 4
},
MESSAGE_PINK_STROKE: {
color: cleverapps.styles.COLORS.MESSAGE_PINK,
size: 4
},
MESSAGE_GREEN_STROKE: {
color: cleverapps.styles.COLORS.MESSAGE_GREEN,
size: 4
},
CHEST_REWARD_STROKE: {
color: cleverapps.styles.COLORS.CHEST_REWARD_STROKE_COLOR,
size: 2
},
LIGHT_YELLOW_SHADOW: {
color: cleverapps.styles.COLORS.COLOR_LIGHT_YELLOW_SHADOW,
direction: cc.size(0, -5)
},
STICKER_REWARD_RARE_STROKE: {
color: cleverapps.styles.COLORS.STICKER_REWARD_SHADOW_COLOR,
size: 2
},
STICKER_REWARD_STROKE: {
color: cleverapps.styles.COLORS.STICKER_REWARD_SHADOW_COLOR,
size: 2
},
STICKER_REWARD_RARE_SHADOW: {
color: cleverapps.styles.COLORS.STICKER_REWARD_RARE_SHADOW_COLOR,
direction: cc.size(1, -3),
blur: 0
},
STICKER_REWARD_SHADOW: {
color: cleverapps.styles.COLORS.STICKER_REWARD_SHADOW_COLOR,
direction: cc.size(1, -3),
blur: 0
}
};
cleverapps.styles.FONTS = cleverapps.overrideFonts({}, {
VICTORY_TEXT: {
size: 56,
color: cleverapps.styles.COLORS.WHITE,
shadow: cleverapps.styles.DECORATORS.WHITE_TEXT_SHADOW
},
FBLOGINORINVITE_TEXT: {
size: 28,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
BUTTON_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
shadow: cleverapps.styles.DECORATORS.BUTTON_TEXT_SHADOW,
stroke: cleverapps.styles.DECORATORS.BUTTON_TEXT_STROKE
},
STRICT_TEXT: {
size: 30,
color: new cc.Color(83,97,106,255),
font: bundles.chat.urls.strict_font_ttf
},
STRICT_WHITE_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE,
font: bundles.chat.urls.strict_font_ttf
},
STRICT_BLACK_TEXT: {
size: 18,
color: cleverapps.styles.COLORS.BLACK,
font: bundles.chat.urls.strict_font_ttf
},
STRICT_BLUE_TEXT: {
size: 18,
color: cleverapps.styles.COLORS.COLOR_LIGHT_BLUE,
font: bundles.chat.urls.strict_font_ttf
},
STRICT_RED_TEXT: {
size: 18,
color: cleverapps.styles.COLORS.COLOR_RED,
font: bundles.chat.urls.strict_font_ttf
},
TOURNAMENTSTORY_OFFERS_TEXT: {
size: 16,
color: cleverapps.styles.COLORS.WHITE,
shadow: cleverapps.styles.DECORATORS.BUTTON_TEXT_SHADOW,
stroke: cleverapps.styles.DECORATORS.BUTTON_TEXT_STROKE
},
TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
VICTORY_CHEST_TEXT: {
name: "default",
size: 50
},
SMALL_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
SMALL_TEXT_BROWN: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
WINDOW_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
DAILY_TASKS_TIMER_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
DAILY_TASK_BOOSTER_AMOUNT_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
WINDOW_SMALL_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
REWARDS_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.REWARDS_TEXT_STROKE
},
SMALL_TEXT_ERROR: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_RED
},
EPISODE_TITLE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
WHITE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
RED_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_RED,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
BIG_BROWN_TITLE_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
SMALL_BROWN_TITLE_TEXT: {
size: 15,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
SMALL_WHITE_TEXT: {
name: "default",
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
SMALL_YELLOW_TEXT: {
name: "default",
size: 30,
color: cleverapps.styles.COLORS.YELLOW,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
FORCE_MESSAGE_TEXT: {
name: "nostroke",
size: 40,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
DAILY_TOURNAMENT_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.DAILY_TOURNAMENT_TIMER
},
WHITE_TITLE_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
BOOSTERS_BEFORE_UNLOCK: {
size: 30,
color: cleverapps.styles.COLORS.WHITE
},
UNDERLINE: {
name: "default",
size: 25
},
MESSAGE_TEXT_NORMAL: {
size: 77,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.MESSAGE_GREEN_STROKE
},
MESSAGE_TEXT_WARNING: {
size: 77,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.MESSAGE_RED_STROKE
},
MESSAGE_TEXT_CONGRATS: {
size: 77,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.MESSAGE_PINK_STROKE
},
CHEST_REWARD_TEXT: {
size: 70,
color: cleverapps.styles.COLORS.CHEST_REWARD_COLOR,
stroke: cleverapps.styles.DECORATORS.CHEST_REWARD_STROKE
},
COLLECTION_WINDOW_TEXT: {
name: "default",
size: 25,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
COLLECTION_BADGE_TEXT: {
name: "default",
size: 25,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
DUPLICATE_TEXT: {
size: 42,
color: cleverapps.styles.COLORS.STICKER_REWARD_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.STICKER_REWARD_SHADOW
},
DUPLICATE_TEXT_RARE: {
size: 42,
color: cleverapps.styles.COLORS.STICKER_REWARD_RARE_COLOR,
stroke: cleverapps.styles.DECORATORS.STICKER_REWARD_RARE_STROKE,
shadow: cleverapps.styles.DECORATORS.STICKER_REWARD_RARE_SHADOW
},
STICKER_POINTS_TEXT: {
size: 68,
color: cleverapps.styles.COLORS.STICKER_REWARD_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.STICKER_REWARD_SHADOW
},
STICKER_POINTS_RARE_TEXT: {
size: 68,
color: cleverapps.styles.COLORS.STICKER_REWARD_RARE_COLOR,
stroke: cleverapps.styles.DECORATORS.STICKER_REWARD_RARE_STROKE,
shadow: cleverapps.styles.DECORATORS.STICKER_REWARD_RARE_SHADOW
},
STICKER_REWARD_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
STICKERS_COLLECTION_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
STICKERS_AVAILABLE_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
STICKER_REWARD_AMOUNT: {
size: 45,
color: cleverapps.styles.COLORS.WHITE
},
STICKERS_OPEN_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.STICKERS_AVAILABLE_COLOR
},
STICKERS_PROGRESS_BAR_TEXT: {
name: "default",
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
STICKER_JOKER_BUTTON_TEXT: {
size: 80,
color: cleverapps.styles.COLORS.WHITE,
shadow: cleverapps.styles.DECORATORS.BUTTON_TEXT_SHADOW,
stroke: void 0
},
PRIZE_BAR_TEXT: {
name: "default",
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
PINBALL_CHIPS_TEXT: {
size: 55,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.Environment = function() {
this.episodeNo = levels.user.episode;
this.levelNo = levels.user.level;
this.scene = void 0
}
;
cleverapps.Environment.prototype.setScene = function(a) {
this.scene = a;
cleverapps.eventLogger.onUpdateScreen(this.getScreen(), this.getScene())
}
;
cleverapps.Environment.prototype.isDailyCupScene = function() {
return this.scene === cleverapps.Environment.SCENE_DAILY_CUP
}
;
cleverapps.Environment.prototype.isMainScene = function() {
return this.scene === cleverapps.Environment.SCENE_MAIN
}
;
cleverapps.Environment.prototype.isLoaderScene = function() {
return this.scene === cleverapps.Environment.SCENE_LOADER
}
;
cleverapps.Environment.prototype.isHeroesScene = function() {
return this.scene === cleverapps.Environment.SCENE_HEROES
}
;
cleverapps.Environment.prototype.isGameScene = function() {
return this.scene === cleverapps.Environment.SCENE_GAME
}
;
cleverapps.Environment.prototype.isEditorScene = function() {
return this.scene === cleverapps.Environment.SCENE_EDITOR
}
;
cleverapps.Environment.prototype.isChatScene = function() {
return this.scene === cleverapps.Environment.SCENE_CHAT
}
;
cleverapps.Environment.prototype.isMineScene = function() {
return this.scene === cleverapps.Environment.SCENE_MINE
}
;
cleverapps.Environment.prototype.isAdministratorScene = function() {
return this.scene === cleverapps.Environment.SCENE_ADMINISTRATOR
}
;
cleverapps.Environment.prototype.isSceneWithPreview = function() {
return this.scene === cleverapps.Environment.SCENE_EDITOR || this.scene === cleverapps.Environment.SCENE_ADMINISTRATOR || this.scene === cleverapps.Environment.SCENE_WYSIWYG
}
;
cleverapps.Environment.prototype.isWysiwygScene = function() {
return this.scene === cleverapps.Environment.SCENE_WYSIWYG
}
;
cleverapps.Environment.prototype.isAtlasAnalyzerScene = function() {
return this.scene === cleverapps.Environment.SCENE_ATLAS_ANALYZER
}
;
cleverapps.Environment.prototype.isBonusWorldScene = function() {
return this.scene === cleverapps.Environment.SCENE_BONUS_WORLD
}
;
cleverapps.Environment.prototype.isSlotMachineScene = function() {
return this.scene === cleverapps.Environment.SCENE_SLOT_MACHINE
}
;
cleverapps.Environment.prototype.isComicsScene = function() {
return this.scene === cleverapps.Environment.SCENE_COMICS
}
;
cleverapps.Environment.prototype.isPinballScene = function() {
return this.scene === cleverapps.Environment.SCENE_PINBALL
}
;
cleverapps.Environment.prototype.isOctopusHuntScene = function() {
return this.scene === cleverapps.Environment.SCENE_OCTOPUS_HUNT
}
;
cleverapps.Environment.prototype.onOpenWindow = function() {
cleverapps.eventLogger.onUpdateScreen(this.getScreen(), this.getScene())
}
;
cleverapps.Environment.prototype.onCloseWindow = function() {
cleverapps.eventLogger.onUpdateScreen(this.getScreen(), this.getScene())
}
;
cleverapps.Environment.prototype.getActiveWindow = function() {
var a = cleverapps.windows && cleverapps.windows.currentWindow();
if (a && a.name)
return a.name
}
;
cleverapps.Environment.prototype.getScreen = function() {
return this.getActiveWindow() || this.getScene()
}
;
cleverapps.Environment.prototype.getScene = function() {
return this.scene
}
;
cleverapps.Environment.prototype.hasScene = function(a) {
return -1 !== a.indexOf(this.scene)
}
;
cleverapps.Environment.prototype.hasEpisode = function(a) {
return -1 !== cleverapps.toArray(a).indexOf(String(this.episodeNo))
}
;
cleverapps.Environment.SCENE_LOADER = "loaderScene";
cleverapps.Environment.SCENE_MAIN = "main";
cleverapps.Environment.SCENE_GAME = "game";
cleverapps.Environment.SCENE_EDITOR = "editor";
cleverapps.Environment.SCENE_ADMINISTRATOR = "administrator";
cleverapps.Environment.SCENE_COMICS = "comics";
cleverapps.Environment.SCENE_HEROES = "heroes";
cleverapps.Environment.SCENE_DAILY_CUP = "dailycup";
cleverapps.Environment.SCENE_TRIPEAKS = "tripeaks";
cleverapps.Environment.SCENE_CHAT = "chat";
cleverapps.Environment.SCENE_WYSIWYG = "wysiwyg";
cleverapps.Environment.SCENE_BONUS_WORLD = "bonusworld";
cleverapps.Environment.SCENE_SLOT_MACHINE = "slotmachine";
cleverapps.Environment.SCENE_MINE = "mine";
cleverapps.Environment.SCENE_ATLAS_ANALYZER = "atlasanalyzer";
cleverapps.Environment.SCENE_PINBALL = "pinball";
cleverapps.Environment.SCENE_OCTOPUS_HUNT = "octopusHunt";
var resolutionScale = 1;
cleverapps.UI = {
stableKeys: "SKIP_RESOLUTION descent verticalAlignment opacity scale9 parent scale minScale maxScale rotation baseScale zoomScale mobileScale innerScale squareScale zoom scaleX scaleY anchorX anchorY zIndex zOrder SIDEBAR_WIDTH MIN_SIDEBAR_X duration delay idleDelay type hideDirection number dialogueStages skew anchor factorX factorY smallMargin threshold timeScale timeout fadeIn columns align patternSize tilesInRow windowPadding".split(" "),
needUpdateSizes: function(a, b, c) {
return c instanceof cc.Color || "direction" === b && "object" !== typeof c || 0 <= cleverapps.UI.stableKeys.indexOf(b) ? !1 : !0
},
updateSizes: function(a) {
var b = []
, c = function(d) {
if (!d.isUpdated) {
d.isUpdated = !0;
b.push(d);
for (var e in d) {
var f = d[e];
"number" === typeof f ? !Array.isArray(d) && cleverapps.UI.needUpdateSizes(d, e, f) && (d[e] *= a,
d[e] = Math.round(d[e])) : "object" === typeof f && cleverapps.UI.needUpdateSizes(d, e, f) && c(f)
}
}
};
cleverapps.styles.isUpdated || (c(cleverapps.styles),
cleverapps.config.fonts.forEach(function(d) {
d.originalSize = d.size + ""
}),
c(cleverapps.config.fonts),
Object.values(Forces).forEach(function(d) {
d.style && c(d.style);
d.finger && c(d.finger)
}),
b.forEach(function(d) {
delete d.isUpdated
}),
cleverapps.styles.isUpdated = !0)
},
selectSkinResources: function(a) {
var b = function(f, g, h) {
for (c in f)
-1 !== c.indexOf("/%r/") && (f[c.replace("/%r/", "/" + g + "/")] = f[c],
delete f[c]);
for (var k in f)
"string" === typeof f[k] && (f[k] = f[k].replace("/%r/", "/" + g + "/")),
h && "object" === typeof f[k] && b(f[k], g, h)
}, c;
for (c in bundles) {
var d = bundles[c];
b(d.urls, a);
b(d.frames, a, !0);
b(d.jsons, a, !0);
b(d.urls, a, !0);
b(d.originalPaths, a, !0)
}
for (var e in cleverapps.styles)
b(cleverapps.styles[e], a, !0);
b(cleverapps.persons.data, a, !0);
"object" === typeof HeroesLibrary && b(HeroesLibrary, a, !0)
},
HORIZONTAL: 0,
VERTICAL: 1,
DOCK_RIGHT: 1,
DOCK_LEFT: 2,
DOCK_BOTTOM: 4,
DOCK_TOP: 8,
arrangeWithMargins: function(a, b) {
var c = b.margin || 0
, d = b.offset || 0
, e = b.iterator || function(g, h, k) {
g.setPosition(h, k)
}
, f = b.direction === cleverapps.UI.VERTICAL ? !b.reversed : b.reversed;
a.forEach(function(g, h) {
if (void 0 === b.direction || f)
g = a[a.length - 1 - h];
h = g.baseScaleX || g.baseScale || g.scaleX;
var k = g.baseScaleY || g.baseScale || g.scaleY;
b.direction === cleverapps.UI.HORIZONTAL ? (e(g, d + g.width * Math.abs(h) * g.anchorX, g.y),
d += g.width * Math.abs(h)) : (e(g, g.x, d + g.height * Math.abs(k) * g.anchorY),
d += g.height * Math.abs(k));
d += c
});
return d - c
},
calculateContentSize: function(a) {
var b = 0
, c = 0;
a.children.forEach(function(d) {
b < d.x + d.width * d.scaleX / 2 && (b = d.x + d.width * d.scaleX / 2);
c < d.y + d.height * d.scaleY / 2 && (c = d.y + d.height * d.scaleY / 2)
});
return cc.size(Math.round(b), Math.round(c))
},
fitToBox: function(a, b) {
var c = 0 > a.scaleX ? -1 : 1
, d = 0 > a.scaleY ? -1 : 1
, e = b.maxScale || 1;
b = Math.max(b.minScale || 0, Math.min(c * b.width / a.width || e, d * b.height / a.height || e, e));
a.setScaleX(b * c);
a.setScaleY(b * d)
},
calcBoundaries: function(a, b) {
b = b || {};
var c = cleverapps.scenes.getRunningScene()
, d = cleverapps.resolution.getSceneSize()
, e = b.lovesPosition || b.centerPoint || c.convertToWorldSpace(cc.p(d.width / 2, d.height / 2))
, f = Math.min(d.width / 2, d.height / 2)
, g = cc.rect(e.x - f, e.y - f, 2 * f, 2 * f)
, h = a.map(function(n) {
n = n.getGlobalBoundingBox();
if (cleverapps.config.debugMode && n.x < e.x && e.x < n.x + n.width && n.y < e.y && e.y < n.y + n.height)
throw "Incorrect center point! Should be outside all boxes.";
return n
});
h.forEach(function(n) {
cc.rectIntersectsRect(g, n) && (n = cc.nearestToRect(n, e),
n.x !== e.x && (f = Math.min(Math.abs(n.x - e.x), f)),
n.y !== e.y && (f = Math.min(Math.abs(n.y - e.y), f)),
g = cc.rect(e.x - f, e.y - f, 2 * f, 2 * f))
});
a = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? ["y", "x"] : ["x", "y"];
var k = cc.p(g.x + g.width / 2, g.y + g.height / 2)
, m = cleverapps.resolution.getBgSize()
, l = cleverapps.resolution.getSafePadding();
a.forEach(function(n) {
var p = "x" === n ? "width" : "height";
"x" === n ? (g.x = l.left,
g.width = m.width - l.left - l.right) : (g.y = l.bottom,
g.height = m.height - l.bottom - l.top);
h.forEach(function(r) {
if (cc.rectIntersectsRect(g, r)) {
var u = cc.rectIntersection(g, r);
1E-6 > u.width || 1E-6 > u.height || (r[n] < k[n] ? (g[p] = g[n] + g[p] - (r[n] + r[p]),
g[n] = r[n] + r[p]) : r[n] > k[n] && (g[p] = r[n] - g[n]))
}
});
if ("x" === n) {
var q = Math.min(k.x - g.x, g.x + g.width - k.x);
g.x = k.x - q;
g.width = 2 * q
}
});
(isNaN(g.x) || isNaN(g.y) || isNaN(g.width) || isNaN(g.height)) && cleverapps.throwAsync("NaN available area" + JSON.stringify({
center: k,
boxes: h,
sceneSize: d,
bgSize: m,
avail: g
}));
return g
},
inflateToBoundaries: function(a, b, c) {
b = cleverapps.UI.calcBoundaries(b, c);
c.padding && (b = cc.rectSubPadding(b, cc.padding(c.padding)));
a.setScale(1);
var d = Math.min(b.width / a.width, b.height / a.height, c.maxScale || 100)
, e = cc.rectGetCenter(b);
c.lovesPosition && (e = cc.nearestToRect(cc.rectSubPadding(b, cc.padding(a.height * d / 2, a.width * d / 2)), c.lovesPosition));
e = a.parent.convertToNodeSpace(e);
if (isNaN(e.x) || isNaN(e.y) || isNaN(d)) {
if (cleverapps.config.debugMode)
throw console.log({
newPosition: e,
newScale: d,
availableRect: b,
width: a.width,
height: a.height,
sceneSize: cleverapps.resolution.getSceneSize(),
bgSize: cleverapps.resolution.getBgSize()
}),
"NaN inflate scale";
cleverapps.throwAsync("NaN inflate scale" + JSON.stringify({
newPosition: e,
newScale: d,
availableRect: b,
width: a.width,
height: a.height,
sceneSize: cleverapps.resolution.getSceneSize(),
bgSize: cleverapps.resolution.getBgSize()
}))
} else
a.setScale(d),
a.setPosition(e)
},
fitToBounds: function(a, b, c, d) {
a.map(function(e) {
e.x < c.x && (e.x = c.x + d.x);
e.x + b.width > c.width && (e.x = c.width - b.width - d.x);
e.y < c.y && (e.y = c.y + d.y);
e.y + b.height > c.height && (e.y = c.height - b.height - d.y);
return e
});
return a
},
findPositionsAroundRect: function(a, b, c, d) {
d = d || {
x: 10 * resolutionScale,
y: 10 * resolutionScale
};
var e = [];
e.push({
x: b.x - a.width - d.x,
y: b.y + b.height / 2 - a.height / 2
});
e.push({
x: b.x + b.width + d.x,
y: b.y + b.height / 2 - a.height / 2
});
e.push({
x: b.x + b.width / 2 - a.width / 2,
y: b.y - a.height - d.y
});
e.push({
x: b.x + b.width / 2 - a.width / 2,
y: b.y + b.height + d.y
});
return this.fitToBounds(e, a, c, d)
},
rectsIntersection: function(a, b) {
for (var c = 0; c < b.length; c++)
if (cc.rectIntersectsRect(a, b[c]))
return !0;
return !1
},
checkPositions: function(a, b, c) {
for (var d = 0; d < a.length; d++) {
var e = a[d];
c.x = e.x;
c.y = e.y;
if (!this.rectsIntersection(c, b))
return e
}
},
findPosition: function(a, b) {
var c = b.preferredPositions
, d = b.avoidNodes
, e = function(k) {
return Object.assign(a.parent.convertToNodeSpace({
x: k.x + a.width * a.anchorX,
y: k.y + a.height * a.anchorY
}), {
preferred: k.preferred
})
};
c = c.map(function(k) {
var m = a.calculatePositionRound(k);
return Object.assign(a.parent.convertToWorldSpace({
x: m.x - a.width * (1 - a.anchorX),
y: m.y - a.height * (1 - a.anchorY)
}), {
preferred: k
})
});
d = d.map(function(k) {
return k.getGlobalBoundingBox()
});
var f = a.getGlobalBoundingBox()
, g = cleverapps.resolution.getSceneSize()
, h = cleverapps.resolution.getSafePadding();
d.forEach(function(k) {
c = c.concat(this.findPositionsAroundRect(f, k, {
x: h.left,
y: h.bottom,
width: g.width,
height: g.height
}, b.offset))
}
.bind(this));
if (d = this.checkPositions(c, d, f))
return e(d)
},
getFontName: function(a) {
if ("playable" === connector.info.source)
return "Playable-font";
void 0 === a && (a = bundles.main.urls.basefont_ttf);
return "creator" === engine ? cc.LabelTTF.getCreatorFontName(a.srcs[0]) : a.name
},
generateImageText: function(a, b, c, d) {
if (d && cleverapps.config.debugMode)
throw "deprecated";
if (cleverapps.config.debugMode && !cleverapps.UI.ImageFont.IsApplicable(b, a))
throw console.log(b),
"Not applicable image font: " + a;
return new cleverapps.UI.ImageFont(a,b,c)
},
generateOnlyText: function(a, b, c) {
var d = new cleverapps.UI.LabelTTF("",cleverapps.UI.getFontName(b.font));
d.setString(a, c);
d.setFont(b);
return d
},
__generateNotLocalizedText: function(a, b) {
var c = new cleverapps.UI.LabelTTF("",cleverapps.UI.getFontName(b.font));
cc.LabelTTF.prototype.setString.call(c, a);
c.setFont(b);
return c
},
generateTTFText: function(a, b, c) {
if (cleverapps.UI.ImageFont.IsApplicable(b, a))
var d = new cleverapps.UI.ImageFont(a,b);
else
d = new cleverapps.UI.LabelTTF("",cleverapps.UI.getFontName(b.font)),
d.setString(a, c),
d.setFont(b);
return d
},
drawUnderline: function(a, b) {
var c = new cc.Scale9Sprite(bundles.digits.frames.underline_png);
c.setContentSize2(a.width, b && b.height ? b.height : 1);
c.setPositionRound(b || {
x: a.x + a.width / 10,
y: a.y - a.height / 10
});
c.setAnchorPoint(.5, .5);
c.setColor(a._getFillStyle() || cc.color.BLACK);
return c
},
CheckBox: cc.Node.extend({
ctor: function(a) {
this._super();
a = a || {};
a.styles = a.styles || {};
this.options = a;
this.onChangeCallback = a.onChange || function() {}
;
this.selected = !1;
var b = []
, c = this.createCheckBox();
b.push(c);
a.label && (this.createLabel(),
b.push(this.label));
var d = this.getStyles();
a = new cleverapps.Layout(b,{
margin: d.margin,
padding: d.padding,
direction: void 0 !== a.direction ? a.direction : cleverapps.UI.HORIZONTAL,
reversed: a.direction === cleverapps.UI.VERTICAL
});
this.addChild(a);
this.label && (this.label.y += d.label.offsetY);
this.setAnchorPoint(.5, .5);
this.setContentSize2(a.getContentSize());
a.setPositionRound(this.width / 2, this.height / 2);
cleverapps.UI.applyHover(this);
if (this.options.label && this.options.label.clickable)
cleverapps.UI.onClick(this, this.onClick.bind(this));
else
cleverapps.UI.onClick(c, this.onClick.bind(this));
this.setSelected(this.options.isSelected)
},
createCheckBox: function() {
var a = new cc.Sprite(this.options.bgImage || bundles.checkbox.frames.background_png);
this.icon = new cc.Sprite(this.options.checkImage || bundles.checkbox.frames.check_mark_png);
a.addChild(this.icon);
this.icon.setPositionRound(a.width / 2, a.height / 2);
this.icon.setVisible(!1);
return a
},
createLabel: function() {
this.label = cleverapps.UI.generateTTFText(this.options.label.text, this.options.label.font || cleverapps.styles.FONTS.WINDOW_TEXT)
},
onClick: function() {
this.setSelected(!this.isSelected());
cleverapps.audio.playSound(bundles.main.urls.click_effect)
},
isSelected: function() {
return this.selected
},
setSelected: function(a) {
this.selected !== a && (this.selected = a,
this.icon.setVisible(a),
this.onChangeCallback(this.selected))
},
getStyles: function() {
this.styles || (this.styles = cleverapps.overrideStyles(cleverapps.styles.UI.CheckBox, this.options.styles, !0));
return this.styles
}
}),
wrap: function(a, b) {
b = b || {};
if (0 === a.children.length)
return a;
for (var c, d, e, f, g = 0; g < a.children.length; g++) {
var h = a.children[g]
, k = h.baseScaleX || h.baseScale || h.scaleX
, m = h.baseScaleY || h.baseScale || h.scaleY
, l = h.height
, n = h.width;
b.considerRotation && (l = h.getBoundingBox().height,
n = h.getBoundingBox().width,
m = k = 1);
var p = h.y - l * m * h.anchorY;
m = p + l * m;
if (void 0 === c || c > p)
c = p;
if (void 0 === d || d < m)
d = m;
h = h.x - n * k * h.anchorX;
k = h + n * k;
if (void 0 === e || e > h)
e = h;
if (void 0 === f || f < k)
f = k
}
a.children.forEach(function(q) {
q.alignment = void 0;
q.x -= e;
q.y -= c
});
a.setContentSize2(f - e, d - c);
return a
},
wrapWithPadding: function(a, b, c) {
b = cc.padding(b);
if (c)
return a.children.forEach(function(d) {
d.setPositionRound(d.x + b.left, d.y + b.bottom)
}),
a.width += b.left + b.right,
a.height += b.top + b.bottom,
a;
c = new cc.Node;
c.addChild(a);
c.setContentSize2(a.width * a.scaleX + b.left + b.right, a.height * a.scaleY + b.top + b.bottom);
c.setAnchorPoint(.5, .5);
a.setPosition(b.left + a.width * a.scaleX / 2, b.bottom + a.height * a.scaleY / 2);
return c
},
setDimensions: function(a, b) {
var c = b.width || a.width * a.scaleX;
b = b.height || a.height * a.scaleY;
cleverapps.UI.fitToBox(a, {
width: c,
height: b
});
c = Math.max(0, c - a.width * a.scaleX);
b = Math.max(0, b - a.height * a.scaleY);
(c || b) && cleverapps.UI.wrapWithPadding(a, {
x: c / 2 / a.scaleX,
y: b / 2 / a.scaleY
}, !0)
},
targetContainPoint: function(a, b, c) {
var d = cleverapps.styles.Map2dView.cell.width
, e = cleverapps.styles.Map2dView.cell.height
, f = Math.max(0, .25 * e - a.anchorY * a.height)
, g = Math.max(0, (.5 - (a.sprite && a.sprite.anchorX) || 0) * a.width)
, h = b.x - g;
b = b.y + f;
g = a.width - 2 * g;
f = a.height + f;
c && a.height > 2 * e && (f -= e);
if (0 > h || h > g || 0 > b || b > f)
return !1;
h > g / 2 && (h = g - h);
b > f / 2 && (b = f - b);
return 0 >= g / 2 - d / e * b - h
},
onDrag: function(a, b) {
b = b || {};
return new PointerHandler(a,b)
},
onPressed: function(a, b, c) {
c = c || {};
c.onPressed = b;
return new PointerHandler(a,c)
},
onClick: function(a, b, c) {
c = c || {};
c.onClick = b;
return new PointerHandler(a,c)
},
applyHover: function(a, b) {
b = b || {};
b.hover = !0;
return new PointerHandler(a,b)
},
convertToGrayShape: function(a, b) {
a.setColor(cleverapps.styles.COLORS.BLACK);
a.setOpacity(100);
b && (a.setColor(cleverapps.styles.COLORS.WHITE),
a.setOpacity(255))
},
convertToGrayScale: function(a, b) {
"undefined" !== typeof gl && (a.spine && (a = a.spine),
b ? a.normalShader ? a.setShaderProgram(a.normalShader) : a.opacity = 255 : cc.shaderCache && cleverapps.Shaders && cc.shaderCache._programs[cleverapps.Shaders.GRAYSCALE_SPRITE_KEY] ? (a.normalShader || (a.normalShader = a.getShaderProgram()),
a.setShaderProgram(cc.shaderCache.getProgram(cleverapps.Shaders.GRAYSCALE_SPRITE_KEY))) : a.opacity = 150)
},
outlineSprite: function(a, b) {
"undefined" !== typeof gl && (a.spine && (a = a.spine),
b ? a.normalShader && a.setShaderProgram(a.normalShader) : cc.shaderCache && cleverapps.Shaders && cc.shaderCache._programs[cleverapps.Shaders.OUTLINE_SPRITE_KEY] && (a.normalShader || (a.normalShader = a.getShaderProgram()),
a.setShaderProgram(cc.shaderCache.getProgram(cleverapps.Shaders.OUTLINE_SPRITE_KEY))))
},
_setShaderUpdate: function(a, b, c) {
if (a._superUpdate)
a.update = a._superUpdate.bind(a),
delete a._superUpdate,
a.normalShader && a.setShaderProgram(a.normalShader);
else if (cc.shaderCache && cleverapps.Shaders && cc.shaderCache.getProgram(b)) {
a.normalShader || (a.normalShader = a.getShaderProgram());
a.setShaderProgram(cc.shaderCache.getProgram(b));
var d = a.getShaderProgram();
a._superUpdate = a.update;
a.scheduleUpdate();
a.update = function(e) {
c(e, d)
}
}
},
toggleFlickering: function(a, b) {
if ("undefined" !== typeof gl) {
b = b || {};
var c = b.flickSpeed || 2
, d = b.flickPause || 0
, e = b.color;
if (!e || !Array.isArray(e) || 3 > e.length)
e = [.35, .35, .35];
c *= Math.PI;
var f = 0;
this._setShaderUpdate(a, cleverapps.Shaders.FLICKER_SHADER_KEY, function(g, h) {
a._superUpdate(g);
h.use();
f += g;
h.setUniformLocationWith1f("sineTime", Math.abs(Math.sin(Math.max(f - d, 0) * c)));
h.setUniformLocationWith3f("flickColor", e[0], e[1], e[2])
})
}
},
toggleBlur: function(a, b) {
b = b || {};
b.animate = b.animate || {};
if ("undefined" === typeof gl)
b.animate && b.animate.callback && b.animate.callback();
else {
var c = b.blurLength || .005
, d = b.strength || 1
, e = function(k, m) {
a.blurShader.use();
a.blurShader.setUniformLocationWith1f("u_blurOffset", c);
a.blurShader.setUniformLocationWith1f("u_blurStrength", k);
a.blurShader.setUniformLocationWith1f("u_extent", m)
}
, f = function(k, m) {
m = m || function() {}
;
var l = b.animate.type || cleverapps.UI.BLUR_ANIMATION.FADE
, n = void 0 !== b.animate.time ? b.animate.time : .2
, p = b.animate.steps || 20
, q = k ? d : 0
, r = k ? 1 : 0
, u = d / p
, w = 1 / p;
a.blurAction = a.runAction(new cc.Sequence(new cc.Repeat(new cc.Sequence(new cc.CallFunc(function() {
l === cleverapps.UI.BLUR_ANIMATION.FADE ? (q += k ? -u : u,
e(q, 1)) : (r += k ? -w : w,
e(d, r))
}
),new cc.DelayTime(n / p)),p),new cc.CallFunc(m)));
a.blurAction.whenDone = m
};
a.blurAction && !a.blurAction.isDone() && (a.stopAction(a.blurAction),
a.blurAction.whenDone(),
delete a.blurAction);
if (a.normalShader) {
var g = function() {
a.setShaderProgram(a.normalShader);
delete a.normalShader;
delete a.blurShader
};
b.animate ? f(!0, function() {
g();
b.animate.callback && b.animate.callback()
}) : g()
} else if (cc.shaderCache && cleverapps.Shaders) {
var h = cleverapps.Shaders.BLUR_FADE_KEY;
b.animate.type === cleverapps.UI.BLUR_ANIMATION.CURTAIN && (h = b.animate.reverseCurtain ? cleverapps.Shaders.BLUR_CURTAIN_REVERSE_KEY : cleverapps.Shaders.BLUR_CURTAIN_KEY);
cc.shaderCache.getProgram(h) && (a.normalShader = a.getShaderProgram(),
a.setShaderProgram(cc.shaderCache.getProgram(h)),
a.blurShader = a.getShaderProgram(),
b.animate ? f(!1, b.animate.callback) : e(d, 1))
}
}
},
cutPlayerName: function(a, b) {
if (a.length > b) {
a = a.replace(/^[\s]+/, "");
var c = a.lastIndexOf(" ", b);
0 >= c && (c = b);
a = a.substr(0, c)
}
return a
},
createPatternSprite: function(a, b) {
void 0 === b && (b = cleverapps.resolution.getSceneSize());
a = new cc.Sprite(a);
"auto" === b.width && (b.width = a.width - 2);
"auto" === b.height && (b.height = a.height - 2);
if ("undefined" !== typeof gl && a.getTexture()) {
a.getTexture().setTexParameters({
minFilter: gl.NEAREST,
magFilter: gl.NEAREST,
wrapS: gl.REPEAT,
wrapT: gl.REPEAT
});
var c = a.getTextureRect();
c.width = b.width;
c.height = b.height;
a.setTextureRect(c)
} else
b.width && b.height && a.setScale(b.width / a.width, b.height / a.height);
a.setPositionRound(b.width / 2, b.height / 2);
return a
},
createSprite: function(a) {
if (!a)
return new cc.Sprite;
var b = a && a.image || a;
if (void 0 !== a.scale9 && !1 !== a.scale9) {
b = cleverapps.UI.createScale9Sprite(b, a.scale9);
if (a.sizes) {
var c = a.sizes[cleverapps.resolution.mode].width;
var d = a.sizes[cleverapps.resolution.mode].height
} else
c = a.width,
d = a.height;
var e = a.rotation;
a.rotations && (e = a.rotations[cleverapps.resolution.mode]);
e && (a = d,
d = c,
c = a,
b.setRotation(e));
b.setContentSize2(c, d);
return b
}
c = b;
b = new cc.Sprite(b);
b.scale = a.scale || 1;
b.spriteFrameName = c;
return b
},
getScale9Rect: function(a, b) {
var c;
if (b === cleverapps.UI.Scale9Rect.TwoPixelXY)
var d = c = .5;
else
b === cleverapps.UI.Scale9Rect.TwoPixelX ? c = .5 : b === cleverapps.UI.Scale9Rect.TwoPixelY ? d = .5 : b && (c = b.x,
d = b.y);
a instanceof VirtualResource && (a = a.resolve().getSpriteFrame());
a = a.getOriginalSize();
b = "number" === typeof c;
var e = "number" === typeof d;
return cc.rect(Math.round(b ? (a.width - 2) * c : a.width / 3), Math.round(e ? (a.height - 2) * d : a.height / 3), Math.round(b ? 2 : a.width / 3), Math.round(e ? 2 : a.height / 3))
},
createScale9Sprite: function(a, b) {
return new cc.Scale9Sprite(a,cleverapps.UI.getScale9Rect(a, b))
},
createAnimation: function(a) {
a = a.spine;
var b = new cleverapps.Spine(a.json);
b.setAnimation(0, a.openAnimation, !1);
a.idleAnimation && b.setCompleteListener(function() {
b.setAnimation(0, a.idleAnimation, !0)
});
return b
},
isNodeOnScene: function(a, b, c) {
var d = cleverapps.scenes.getRunningScene()
, e = d.convertToNodeSpace(a.convertToWorldSpace(cc.p(0, 0)));
a = d.convertToNodeSpace(a.convertToWorldSpace(cc.p(a.width, a.height)));
e = cc.rect(e.x, e.y, a.x - e.x, a.y - e.y);
b = e.width < d.width && b || 0;
c = e.height < d.height && c || 0;
return 0 > e.x + (1 - b) * e.width || e.x + b * e.width > d.width || 0 > e.y + (1 - c) * e.height || e.y + c * e.height > d.height ? !1 : !0
}
};
cleverapps.styles.UI = {
Avatar: {
x: 8,
top: 8,
bottom: 8,
frame: {
scale: 1,
dx: 0,
dy: 0
}
},
CheckBox: {
margin: 10,
label: {
offsetY: 0
}
}
};
cleverapps.UI.Scale9Rect = {
Default: 0,
TwoPixelX: 1,
TwoPixelY: 2,
TwoPixelXY: 3
};
cleverapps.UI.BLUR_ANIMATION = {
FADE: 1,
CURTAIN: 2
};
var PointerHandler = cc.Class.extend({
ctor: function(a, b) {
b = b || {};
this.touches = {};
this.target = a;
this.swallowEvents = b.swallowEvents;
this.filter = b.filter || function() {
return !0
}
;
this.onMouseZoom = b.onMouseZoom;
this.onPinchZoom = b.onPinchZoom;
if (this.usesPress = !!b.onPressed)
this.onPressed = b.onPressed;
this.onOuterTouch = b.onOuterTouch;
if (this.usesClick = !!(b.onClick || b.onLongClick || b.onDoubleClick))
this.onClick = b.onClick,
cleverapps.config.debugMode && (this.target.clickPointerHandler = this),
this.onLongClick = b.onLongClick,
this.onDoubleClick = b.onDoubleClick,
this.longClickDuration = PointerHandler.LONG_CLICK_TIMEOUT,
this.doubleClickDuration = PointerHandler.DOUBLE_CLICK_WAIT;
if (this.usesDrag = !!(b.followPointer || b.onDragStart || b.onDragMove || b.onDragEnd))
this.dragControls = b.dragControls,
this.onDragStart = b.onDragStart || function() {
return !0
}
,
this.onDragMove = cleverapps.throttle(PointerHandler.DRAG_THROTTLE, b.onDragMove || function() {}
),
this.onDragEnd = b.onDragEnd || function() {}
,
"function" === typeof b.followPointer ? this.followPointer = b.followPointer : b.followPointer && (this.followPointer = function(c) {
this.target.setPositionRound(this.target.parent.convertTouchToNodeSpace(c))
}
.bind(this)),
this.instantDrag = b.instantDrag,
this.dragHoldTime = b.holdForDrag ? PointerHandler.DRAG_HOLD_TIME : 0;
this.interactiveScale = !this.onPinchZoom && !this.usesDrag && !this.usesPress && !1 !== b.interactiveScale;
if (this.usesPress || this.usesClick || this.usesDrag || this.onPinchZoom || this.swallowEvents)
this.touchListener = cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function(c, d) {
if (this.handleTouchBegan(c, d))
return !0;
if (this.onOuterTouch)
this.onOuterTouch(c, d)
}
.bind(this),
onTouchMoved: function(c, d) {
this.handleTouchMoved(c, d)
}
.bind(this),
onTouchEnded: function(c, d) {
this.handleTouchEnded(c, d)
}
.bind(this),
onTouchCancelled: this.handleTouchCancelled.bind(this)
}, a);
if (this.useHover = !!(b.hover || b.onMouseOver || b.onMouseOut || b.onMouseMove))
this.onMouseOver = b.onMouseOver || function() {
a.applyInteractiveScale()
}
,
this.onMouseOut = b.onMouseOut || function() {
a.applyInteractiveScale()
}
,
this.onMouseMove = b.onMouseMove || function() {}
;
if (this.useHover || this.onMouseZoom || this.swallowEvents)
this.hoverListener = cc.eventManager.addListener({
event: cc.EventListener.MOUSE,
onMouseMove: this.handleMouseMove.bind(this),
onMouseScroll: this.handleMouseScroll.bind(this)
}, a);
this.isLabelTTF = a instanceof cc.LabelTTF
},
remove: function() {
this.touchListener && (cc.eventManager.removeListener(this.touchListener),
this.touchListener = void 0);
this.hoverListener && (cc.eventManager.removeListener(this.hoverListener),
this.hoverListener = void 0);
this.interactiveScale && (this.target.removeInteractiveStates(this.__instanceId + "_"),
this.target.applyInteractiveScale())
},
setEnabled: function(a) {
this.touchListener && this.touchListener.setEnabled(a);
this.hoverListener && this.hoverListener.setEnabled(a);
a || (this.target.removeInteractiveStates(this.__instanceId + "_"),
this.target.applyInteractiveScale())
},
isTouchApplicable: function(a) {
a = this.target.convertToNodeSpace(a.getLocation());
var b = this.target.clickRect ? this.target.clickRect : cc.rect(0, 0, this.target.width, this.target.height);
this.isLabelTTF && (b.x *= cc.view.getDevicePixelRatio(),
b.y *= cc.view.getDevicePixelRatio(),
b.width *= cc.view.getDevicePixelRatio(),
b.height *= cc.view.getDevicePixelRatio());
if (!cc.rectContainsPoint(b, a) || !this.target.isDisplayed() || !cleverapps.focusManager.checkEventNode(this.target))
return !1;
for (b = this.target; b.parent; b = b.parent) {
a = cc.pointApplyAffineTransform(a, b.getNodeToParentTransform());
var c = b.parent.getCropContainer();
if (c && !cc.rectContainsPoint(c, a))
return !1
}
return !0
},
isInClickThreshold: function(a) {
var b = cleverapps.styles.PointerHandler.clickThreshold;
return cc.pDistanceSQ(a.getStartLocation(), a.getLocation()) < b * b
},
bubblesFromInnerNode: function(a) {
if (a.nodes && !a.nodes[this.target.__instanceId])
return !1;
if (!a.nodes) {
a.nodes = {};
a.innermost = this.__instanceId;
for (var b = this.target; b; b = b.parent)
a.nodes[b.__instanceId] = !0
}
return !0
},
captureTouch: function(a) {
a.handler = this.__instanceId
},
canCaptureTouch: function(a) {
return !a.handler || a.handler === this.__instanceId
},
needProcessTouch: function(a) {
return this.canCaptureTouch(a) && this.isTouchApplicable(a) && this.filter(a) ? this.bubblesFromInnerNode(a) : !1
},
handleTouchBegan: function(a, b) {
if (!this.needProcessTouch(a))
return !1;
this.swallowEvents && this.captureTouch(a);
var c = PointerHandler.STATE_NONE;
this.usesDrag ? c = PointerHandler.STATE_DRAG_START : this.usesClick && (c = PointerHandler.STATE_CLICK);
this.onPressed && this.onPressed(a, b) ? (c = PointerHandler.STATE_NONE,
this.captureTouch(a)) : this.onPinchZoom && (b = Object.values(this.touches).find(function(d) {
return this.canCaptureTouch(d.touch) && !d.touch.pinchTouch
}
.bind(this))) && (b = b.touch,
c = PointerHandler.STATE_NONE,
a.pinchTouch = b,
a.pinchPrevPosition = a.getLocation(),
this.captureTouch(a),
b.pinchTouch = a,
b.pinchPrevPosition = b.getLocation(),
this.captureTouch(b));
this.touches[a.__instanceId] = {
touch: a,
state: c,
startTime: cleverapps.timeouts.getTime()
};
!1 !== this.interactiveScale && a.innermost === this.__instanceId && (this.target.setInteractiveState(this.__instanceId + "_" + a.__instanceId, "pressed"),
this.target.applyInteractiveScale());
if (this.usesClick || this.onPinchZoom)
a.useThreshold = !0;
this.instantDrag && this.handleTouchMoved(a);
return !0
},
handleTouchMoved: function(a, b) {
var c = this.touches[a.__instanceId];
if (cleverapps.focusManager.checkEventNode(this.target) && c && this.canCaptureTouch(a))
if (a.pinchTouch)
b = a.pinchTouch,
c = this.calcPinchDistance(a.pinchPrevPosition, b.pinchPrevPosition),
c = this.calcPinchDistance(a.getLocation(), b.getLocation()) - c,
3 < Math.abs(c) && (a.pinchPrevPosition = a.getLocation(),
b.pinchPrevPosition = b.getLocation(),
this.onPinchZoom(8.5E-4 * c));
else {
if (c.state === PointerHandler.STATE_DRAG_START) {
if (c.startTime + this.dragHoldTime > cleverapps.timeouts.getTime() || a.useThreshold && !this.instantDrag && this.isInClickThreshold(a))
return;
this.handleDragStart(a, b, c) ? (c.state = PointerHandler.STATE_DRAG_MOVE,
this.captureTouch(a)) : c.state = PointerHandler.STATE_CLICK
}
c.state === PointerHandler.STATE_DRAG_MOVE && (this.followPointer && this.followPointer(a, b),
this.handleDragMove(a, b))
}
},
handleTouchEnded: function(a, b) {
cleverapps.playSession.notifyActive();
connector.payments.notifyActive();
var c = this.touches[a.__instanceId];
delete this.touches[a.__instanceId];
!1 !== this.interactiveScale && a.innermost === this.__instanceId && (this.target.setInteractiveState(this.__instanceId + "_" + a.__instanceId),
this.target.applyInteractiveScale());
if (cleverapps.focusManager.checkEventNode(this.target) && c && this.canCaptureTouch(a)) {
if (a.pinchTouch) {
var d = a.pinchTouch;
d.pinchTouch = void 0;
d.pinchPrevPosition = void 0;
a.pinchTouch = void 0;
a.pinchPrevPosition = void 0
}
c.state === PointerHandler.STATE_DRAG_START && (c.state = PointerHandler.STATE_CLICK);
c.state === PointerHandler.STATE_DRAG_MOVE && (this.handleDragMove(a, b),
this.handleDragEnd(a, b, c),
this.instantDrag && this.isInClickThreshold(a) ? c.state = PointerHandler.STATE_CLICK : c.state = PointerHandler.STATE_NONE);
c.state !== PointerHandler.STATE_CLICK || this.usesClick || (c.state = PointerHandler.STATE_NONE);
if (c.state === PointerHandler.STATE_CLICK && (c.state = PointerHandler.STATE_NONE,
this.isTouchApplicable(a)))
if (this.captureTouch(a),
this.onLongClick && c.startTime + this.longClickDuration <= cleverapps.timeouts.getTime())
this.onLongClick(a, b);
else if (this.onDoubleClick) {
if (this.lastClick && (c = this.lastClick,
this.lastClick = void 0,
clearTimeout(c.timeout),
this.isInClickThreshold(c.touch))) {
this.onDoubleClick(a, b);
return
}
c = setTimeout(function() {
clearTimeout(this.lastClick.timeout);
this.lastClick = void 0;
this.handleClick(a, b)
}
.bind(this), this.doubleClickDuration);
this.lastClick = {
touch: a,
timeout: c
}
} else
this.handleClick(a, b)
}
},
handleTouchCancelled: function(a, b) {
return this.handleTouchEnded(a, b)
},
handleClick: function(a, b) {
if (this.onClick)
this.onClick(a, b)
},
handleDragStart: function(a, b, c) {
if (this.onDragStart(a, b))
return cleverapps.focusManager.display({
focus: "dragging",
control: this.dragControls,
keepControls: void 0 === this.dragControls,
action: function(d) {
cleverapps.focusManager.setEventNodes([this.target]);
c.freeFocus = d
}
.bind(this)
}),
!0
},
handleDragMove: function(a, b) {
this.onDragMove(a, b)
},
handleDragEnd: function(a, b, c) {
c.freeFocus && (c.freeFocus(),
c.freeFocus = void 0);
this.onDragEnd(a, b)
},
handleMouseMove: function(a) {
if (this.canCaptureTouch(a)) {
this.swallowEvents && this.captureTouch(a);
var b = cleverapps.timeouts.getTime();
this.lastMouseMoveTime !== b && (this.lastMouseMoveTime = b,
this.useHover && this.processMouseMove(a))
}
},
handleMouseScroll: function(a) {
if (this.canCaptureTouch(a)) {
this.swallowEvents && this.captureTouch(a);
var b = cleverapps.timeouts.getTime();
this.lastMouseScrollTime !== b && (this.lastMouseScrollTime = b,
this.onMouseZoom && this.processMouseScroll(a))
}
},
processMouseMove: function(a) {
var b = this.isTouchApplicable(a) && this.filter() ? "mouseover" : void 0;
if (this.target.setInteractiveState(this.__instanceId + "_mouseover", b))
if (b)
this.onMouseOver();
else
this.onMouseOut();
if (b)
this.onMouseMove(a)
},
processMouseScroll: function(a) {
if (this.isTouchApplicable(a) && this.filter(a) && (a = a.getScrollY(),
0 !== a))
this.onMouseZoom(0 < a ? .1 : -.1)
},
calcPinchDistance: function(a, b) {
return Math.abs(a.x - b.x) + Math.abs(a.y - b.y)
}
});
PointerHandler.STATE_NONE = 0;
PointerHandler.STATE_CLICK = 1;
PointerHandler.STATE_DRAG_START = 2;
PointerHandler.STATE_DRAG_MOVE = 3;
PointerHandler.DRAG_THROTTLE = 50;
PointerHandler.LONG_CLICK_TIMEOUT = 400;
PointerHandler.DOUBLE_CLICK_WAIT = 300;
PointerHandler.DRAG_HOLD_TIME = 300;
cleverapps.styles.PointerHandler = {
clickThreshold: 20
};
cc.PlaySound = cc.ActionInstant.extend({
sound: void 0,
ctor: function(a, b) {
cc.ActionInstant.prototype.ctor.call(this);
this.sound = a;
this.options = b
},
update: function() {
cleverapps.audio.playSound(this.sound, this.options)
},
reverse: function() {
return this
},
clone: function() {
return new cc.PlaySound(this.sound,this.options)
}
});
cc.CollectAnimation = cc.BezierBy.extend({
ctor: function(a, b, c) {
this.flyTo = b;
this.endPosition = this.getEndPosition(b);
this.options = c || {};
this._super(a, [])
},
startWithTarget: function(a) {
this._super(a);
this.flyTo.isRunning() && (this.endPosition = this.getEndPosition(this.flyTo));
a = cc.CollectAnimation.calc3Points(a, this.endPosition, this.options);
a[2] = cc.pSub(a[2], a[0]);
a[1] = cc.pSub(a[1], a[0]);
a[0] = cc.p(0, 0);
this._config = a
},
getEndPosition: function(a) {
return a.convertToWorldSpace(cc.p(a.width / 2, a.height / 2))
},
update: function(a) {
if (this.flyTo.isRunning()) {
var b = this.getEndPosition(this.flyTo)
, c = this._config;
c[2] = cc.pAdd(c[2], cc.pSub(this.target.parent.convertToNodeSpace(b), this.target.parent.convertToNodeSpace(this.endPosition)));
this.endPosition = b
}
this._super(a)
}
});
cc.CollectAnimation.calc3Points = function(a, b, c) {
c = c || {};
var d = a.getPosition();
b = a.parent.convertToNodeSpace(b);
if (c.jump)
c = cc.p(d.x, b.y);
else {
var e = cc.pSub(b, d)
, f = Math.min(cleverapps.styles.CollectAnimation.height, 1.5 * cc.pLength(e));
c.randomPath && (f *= Math.random() + .5);
var g = cc.pMidpoint(d, b)
, h = cc.pNormalize(cc.pPerp(e))
, k = cc.pMult(h, Math.min(f, this.calcScaleFactor(g, h, a, 0)));
f = cc.pMult(h, Math.min(f, this.calcScaleFactor(g, h, a, 1)));
var m = cc.pAdd(g, h);
h = cc.pSub(g, h);
var l = cleverapps.scenes.getRunningScene();
l = a.parent.convertToNodeSpace(cc.p(l.width / 2, l.height / 2));
a = cc.pDistance(m, l);
m = cc.pDistance(h, l);
c = c.randomPath ? g : cc.pSub(d, cc.pMult(e, .33));
c = a < m ? cc.pAdd(c, k) : cc.pSub(c, f)
}
return [d, c, b]
}
;
cc.CollectAnimation.calcScaleFactor = function(a, b, c, d) {
b = Math.abs(b.x);
var e = cleverapps.scenes.getRunningScene();
e = [{
x: 0,
y: 0
}, {
x: e.width,
y: e.height
}];
e = e.map(function(f) {
return c.parent.convertToNodeSpace(f)
});
return Math.abs(e[d].x - a.x) / b
}
;
cc.CollectAnimation.calcDuration = function(a) {
var b = a.points;
b || (b = cc.CollectAnimation.prototype.getEndPosition(a.to),
b = cc.CollectAnimation.calc3Points(a.targetNode, b, a));
b = cc.pDistance(b[0], b[1]) + cc.pDistance(b[1], b[2]);
return Math.min(1, Math.max(.3, b / (a.speed || cleverapps.styles.CollectAnimation.speed)))
}
;
cleverapps.styles.CollectAnimation = {
height: 700,
speed: 2600
};
cc.Flicker = cc.ActionInterval.extend({
ctor: function(a, b, c) {
this._super(a);
this._color = b;
this._reverse = c
},
startWithTarget: function(a) {
cc.ActionInterval.prototype.startWithTarget.call(this, a);
this.target.normalShader || (this.target.normalShader = this.target.getShaderProgram(),
this.target.setShaderProgram(cc.shaderCache.getProgram(cleverapps.Shaders.FLICKER_SHADER_KEY)));
this._shader = this.target.getShaderProgram()
},
update: function(a) {
this._shader.use();
this._reverse && (a = 1 - a);
this._shader.setUniformLocationWith1f("sineTime", a);
this._shader.setUniformLocationWith3f("flickColor", this._color[0], this._color[1], this._color[2])
},
stop: function() {
this.target.normalShader && this.target.setShaderProgram(this.target.normalShader);
delete this.target.normalShader;
delete this._shader;
this._super()
}
});
cc.CollectEffect = cc.CallFunc.extend({
ctor: function(a, b) {
var c = a.baseScaleX || a.baseScale || 1
, d = a.baseScaleY || a.baseScale || 1;
this._super(function() {
a.isRunning() && (b = b || 1.1,
a.runAction(new cc.Sequence((new cc.ScaleTo(.15,c * b,d * b)).easing(cc.easeOut(2)),(new cc.ScaleTo(.15,c,d)).easing(cc.easeInOut(2)))))
})
}
});
cleverapps.styles.CollectEffect = {
sparks: {
x: -7,
y: 5
}
};
cc.JumpAnimation = function(a, b, c, d) {
var e = cc.p(b.x, b.y);
b = cc.p(b.x + c.x, b.y + c.y);
c = cc.pMidpoint(e, b);
c.y += d;
return (new cc.BezierTo(a,[e, c, b])).easing(cc.easeIn(1))
}
;
cc.MoveInCircle = cc.ActionInterval.extend({
ctor: function(a, b, c) {
cc.ActionInterval.prototype.ctor.call(this);
this._center = b;
this.position = c;
this.initWithDuration(a, b)
},
initWithDuration: function(a, b) {
return cc.ActionInterval.prototype.initWithDuration.call(this, a) ? (this._center = b,
!0) : !1
},
clone: function() {
cc.log("MoveInCircle.clone(): clone hasn't been supported.");
return null
},
reverse: function() {
cc.log("MoveInCircle.reverse(): reverse hasn't been supported.");
return null
},
startWithTarget: function(a) {
cc.ActionInterval.prototype.startWithTarget.call(this, a);
this._startPosition = a.getPosition();
this._startAngle = Math.atan2(this._startPosition.y - this._center.y, this._startPosition.x - this._center.x);
this._radius = cc.pDistance(this._startPosition, this._center);
this._toAngle = Math.atan2(this.position.y - this._center.y, this.position.x - this._center.x);
0 >= this._toAngle && (this._toAngle += 2 * Math.PI);
this._toAngle += 2 * Math.PI
},
update: function(a) {
a = this._computeEaseTime(a);
a = this._startAngle + (this._toAngle - this._startAngle) * a;
this.target.x = Math.cos(a) * this._radius + this._center.x;
this.target.y = Math.sin(a) * this._radius + this._center.y
}
});
cc.ReplaceParent = cc.CallFunc.extend({
ctor: function(a) {
this._super(function(b) {
b.replaceParentSamePlace(a, {
keepScale: !0
})
})
}
});
cc.SpineAction = cc.CallFunc.extend({
ctor: function(a, b, c, d) {
var e;
a.getAnimationData(b) || cleverapps.throwAsync("no animation '" + b + "' for json '" + a.spine.jsonName + "'");
this._super(function() {
a.setAnimation(0, b, !1);
c && c !== a.getTimeLeft() && (e = a.getTimeScale(),
a.setTimeScale(a.getTimeLeft() / c));
a.setCompleteListener(function() {
a.setCompleteListener();
e && a.setTimeScale(e);
d && d()
})
})
}
});
var Scale9SpriteResizeTo = cc.ActionInterval.extend({
ctor: function(a, b, c) {
cc.ActionInterval.prototype.ctor.call(this);
this._form = cc.size();
this._to = cc.size();
this.initWithDuration(a, cc.size(b, c))
},
initWithDuration: function(a, b) {
return cc.ActionInterval.prototype.initWithDuration.call(this, a) ? (this._to = b,
!0) : !1
},
clone: function() {
return new Scale9SpriteResizeTo(this._duration,this._to)
},
reverse: function() {
cc.log("Scale9SpriteResizeTo.reverse(): reverse hasn't been supported.");
return null
},
startWithTarget: function(a) {
cc.ActionInterval.prototype.startWithTarget.call(this, a);
this._from = a.getContentSize()
},
update: function(a) {
a = this._computeEaseTime(a);
this.target.setContentSize(this._from.width + (this._to.width - this._from.width) * a, this._from.height + (this._to.height - this._from.height) * a)
}
});
cc.TargetedAction.prototype.ctor = cleverapps.extendFunc(cc.TargetedAction.prototype.ctor, function(a, b) {
b && 0 === b._duration && cleverapps.throwAsync("TargetedAction with ActionInstant performs twice!");
this._super.apply(this, arguments)
});
cc.QuadraticBezier = cc.ActionInterval.extend({
ctor: function(a, b) {
cc.ActionInterval.prototype.ctor.call(this);
this._config = [];
this._startPosition = cc.p(0, 0);
this._previousPosition = cc.p(0, 0);
b && this.initWithDuration(a, b)
},
initWithDuration: function(a, b) {
return cc.ActionInterval.prototype.initWithDuration.call(this, a) ? (this._config = b,
!0) : !1
},
clone: function() {
var a = new cc.QuadraticBezier;
this._cloneDecoration(a);
for (var b = [], c = 0; c < this._config.length; c++) {
var d = this._config[c];
b.push(cc.p(d.x, d.y))
}
a.initWithDuration(this._duration, b);
return a
},
startWithTarget: function(a) {
cc.ActionInterval.prototype.startWithTarget.call(this, a);
this._previousPosition.x = a.x;
this._previousPosition.y = a.y;
this._startPosition.x = a.x;
this._startPosition.y = a.y;
this._config[0] = cc.pSub(this._config[0], this._startPosition);
this._config[1] = cc.pSub(this._config[1], this._startPosition);
this._config[2] = cc.pSub(this._config[2], this._startPosition)
},
bezierAt: function(a, b, c, d) {
return a * Math.pow(1 - d, 2) + 2 * b * (1 - d) * d + c * Math.pow(d, 2)
},
update: function(a) {
a = this._computeEaseTime(a);
if (this.target) {
var b = this.bezierAt(this._config[0].x, this._config[1].x, this._config[2].x, a);
a = this.bezierAt(this._config[0].y, this._config[1].y, this._config[2].y, a);
var c = this._startPosition;
if (cc.ENABLE_STACKABLE_ACTIONS) {
var d = this.target.getPositionX()
, e = this.target.getPositionY()
, f = this._previousPosition;
c.x = c.x + d - f.x;
c.y = c.y + e - f.y;
b += c.x;
a += c.y;
f.x = b;
f.y = a;
this.target.setPosition(b, a)
} else
this.target.setPosition(c.x + b, c.y + a)
}
},
reverse: function() {
var a = this._config;
a = [cc.pAdd(a[1], cc.pNeg(a[2])), cc.pAdd(a[0], cc.pNeg(a[2])), cc.pNeg(a[2])];
a = new cc.BezierBy(this._duration,a);
this._cloneDecoration(a);
this._reverseEaseList(a);
return a
}
});
cc.easeOutIn = function(a) {
return {
_rate: a,
easing: function(b) {
b *= 2;
return 1 > b ? .5 - .5 * Math.pow(1 - b, this._rate) : .5 + .5 * Math.pow(b - 1, this._rate)
},
reverse: function() {
return cc.easeOutIn(this._rate)
}
}
}
;
AnimationsLibrary = {
run: function(a, b, c) {
b.runAction(AnimationsLibrary[a].call(b, b, c))
},
click: function(a) {
var b = a.getPosition()
, c = a.height < cleverapps.styles.AnimationsLibrary.click.smallHeight ? .1 : .05;
return new cc.Sequence(new cc.Spawn(new cc.ScaleTo(.1,1 + c,1 - c),new cc.MoveBy(.1,0,-c / 2 * a.height)),new cc.Spawn(new cc.ScaleTo(.1,1,1),new cc.MoveTo(.1,b.x,b.y)))
},
fallDown: function(a, b) {
b = b || bundles.animations_library.jsons.fall_down_json;
var c = Map2d.currentMap.getMapView()
, d = c.alignInIsometricGrid(a.unit.x, a.unit.y);
a.unit.isMultiCell() && (d = c.alignPositionInIsometricGrid(a.unit.x, a.unit.y, MultiCellView.calcCenterPosition(a.unit.findComponent(MultiCell).shape)));
return new cc.Spawn((new cc.MoveBy(.25,d.x - a.x,0)).easing(cc.easeOut(2)),(new cc.MoveBy(.15,0,d.y - a.y)).easing(cc.easeIn(1)),new cc.CallFunc(function() {
var e = new cleverapps.Spine(b);
e.setPositionRound({
x: {
align: "center"
},
y: {
align: "center"
}
});
e.setCompleteListenerRemove();
e.setSafeToRemove();
e.setLocalZOrder(-1);
c.addTile(Map2d.LAYER_UNITS, a.unit.x, a.unit.y, e);
e.setAnimation(0, a.unit.isMultiCell() ? "animation_multicell" : "animation", !1);
cleverapps.audio.playSound(a.unit.isMultiCell() ? bundles.merge.urls.unit_fall_multicell_effect : bundles.merge.urls.unit_fall_effect)
}
))
},
jump: function() {
return new cc.Spawn(new cc.Sequence(new cc.DelayTime(.4),new cc.MoveBy(.2,0,20),new cc.MoveBy(.2,0,-20)),new cc.Sequence((new cc.ScaleTo(.4,1.1,.9)).easing(cc.easeCubicActionOut()),new cc.ScaleTo(.2,.85,1.15),new cc.ScaleTo(.3,1.05,.95),new cc.ScaleTo(.1,1,1)))
},
squeezeJump: function(a, b) {
b = b || {};
var c = b.jumpHeight || cleverapps.styles.AnimationsLibrary.squeezeJump.jumpHeight
, d = 1
, e = 1;
b.baseScale && (d = b.baseScale.x || b.baseScale,
e = b.baseScale.y || b.baseScale);
var f;
return new cc.Sequence(new cc.CallFunc(function() {
f = a.getAnchorPoint();
a.setAnchorPoint(f.x, 0);
a.setPosition(a.getPosition().x, a.getPosition().y - a.height * f.y)
}
),new cc.ScaleTo(.1,1.25 * d,.8 * e),new cc.Spawn(new cc.Sequence(new cc.ScaleTo(.1,.5 * d,1.3 * e),(new cc.ScaleTo(.15,d,e)).easing(cc.easeOut(2))),new cc.Sequence(new cc.DelayTime(.08),(new cc.MoveBy(.5,0,c)).easing(cc.easeBackOut()))),new cc.CallFunc(function() {
a.setAnchorPoint(f);
a.setPosition(a.getPosition().x, a.getPosition().y + a.height * f.y)
}
))
},
shiningLine: function(a, b) {
b = b || bundles.animations_library.jsons.complete_json;
return new cc.CallFunc(function() {
var c = new cleverapps.Spine(b);
c.setCompleteListenerRemove();
c.setSafeToRemove();
c.setPositionRound({
x: {
align: "center"
},
y: {
align: "center"
}
});
a.addChild(c);
c.setScale(a.height / c.height);
c.setAnimation(0, "animation", !1)
}
)
},
rays: function(a, b) {
b = b || {};
var c = b.skin || "yellow";
b = b.size || a.height;
var d = new cleverapps.Spine(bundles.animations_library.jsons.rays_json);
d.setSkin(c);
d.setScale(b / d.height);
a.addChild(d, -1);
d.setPositionRound({
x: {
align: "center"
},
y: {
align: "center"
}
});
d.setAnimationAndIdleAfter("open", "idle");
return d
},
disappear: function(a, b) {
b = b || {};
var c = b.callback || function() {}
, d = [];
b.dust && d.push(new cc.CallFunc(function() {
var f = new cleverapps.Spine(bundles.animations_library.jsons.clean_json);
f.setPositionRound({
x: {
align: "center"
},
y: {
align: "bottom"
}
});
a.addChild(f);
f.replaceParentSamePlace(cleverapps.scenes.getMovingNode(f));
f._setGlobalZOrder(!0);
f.setAnimation(0, "animation", !1);
f.setScale(a.width / f.width);
f.setCompleteListenerRemove(function() {
c()
})
}
));
var e = a.getPosition();
d.push(new cc.Sequence(new cc.Spawn(new cc.ScaleTo(.05,1.05,.95),new cc.MoveBy(.05,0,-.025 * a.height)),new cc.Spawn(new cc.ScaleTo(.05,.95,1.05),new cc.MoveTo(.05,e.x,e.y))));
d.push((new cc.MoveBy(.2,0,25)).easing(cc.easeIn(1)));
(a instanceof cc.Sprite || a instanceof cc.Scale9Sprite) && d.push(new cc.FadeOut(.1));
d.push(new cc.Hide);
b.dust || d.push(new cc.CallFunc(function() {
c()
}
));
return (new cc.Sequence(d)).setFinalize(function() {
a.setPosition(e)
})
},
upgrade: function(a, b, c) {
c = c || {};
var d = c.parent || a.getParent()
, e = .5
, f = c.callback || function() {}
;
b && b !== a && b.setVisible(!1);
if (c.cloud) {
var g = new cleverapps.Spine(bundles.animations_library.jsons.change_stage_cloud_json);
e = Math.max(e, g.getAnimationData("animation").duration);
a.addChild(g);
g.setPosition(a.width / 2, a.height / 2);
g.replaceParentSamePlace(d, {
keepScale: !0
});
cleverapps.UI.fitToBox(g, {
maxScale: 1.6,
minScale: 1,
width: 1.05 * Math.max(a.width, b && b.width || 0),
height: 1.05 * Math.max(a.height, b && b.height || 0)
});
g.setAnimation(0, "animation", !1);
g.setCompleteListenerRemove()
}
g = a === b ? AnimationsLibrary.disappear(a, {
dust: !0
}) : new cc.Sequence(AnimationsLibrary.disappear(a, {
dust: !0
}),new cc.RemoveSelf);
a.runAction(g);
return d.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.CallFunc(function() {
b && AnimationsLibrary.run("showUp", b, {
flash: c.flash
})
}
),new cc.DelayTime(e),new cc.CallFunc(f)))
},
shake: function(a, b) {
b = b || {};
var c = b.delay || 0
, d = b.power || 1
, e = b.moveTime || 0
, f = void 0 !== b.delayTimeAfterMove ? b.delayTimeAfterMove : .05
, g = b.strength;
g || (g = cleverapps.styles.AnimationsLibrary.shake);
var h = b.points || [{
x: 2,
y: 1,
r: 0
}, {
x: -1,
y: -2,
r: -1
}, {
x: -3,
y: 0,
r: 1
}, {
x: 0,
y: 2,
r: 0
}, {
x: 1,
y: -1,
r: 1
}, {
x: 0,
y: 0,
r: 0
}]
, k = b.base;
k || (k = {
x: a.x,
y: a.y,
r: a.rotation
});
a = h.map(function(l) {
return new cc.Spawn(new cc.MoveTo(e,k.x + l.x * g.dx * d,k.y + l.y * g.dy * d),new cc.RotateTo(e,k.r + l.r))
});
var m = [new cc.DelayTime(c / 1E3)];
a.forEach(function(l) {
m.push(l);
m.push(new cc.DelayTime(f))
});
b.afterShakeAction && m.push(b.afterShakeAction);
return new cc.Sequence(m)
},
animateDelta: function(a, b) {
"string" !== typeof a && (a = 0 < a ? "+" + a : "" + a);
b.font = b.font || cleverapps.styles.FONTS.WHITE_TEXT || cleverapps.styles.FONTS.TEXT;
var c = new TextWithIcon(a,b);
c.setCascadeOpacityEnabledRecursively(!0);
b.target.addChild(c);
void 0 !== b.x && void 0 !== b.y ? c.setPositionRound(b) : c.setPositionRound(.5 * b.target.width, .75 * b.target.height);
var d = c.height * (b.moveRate || .3);
c.opacity = 0;
c.visible = !1;
return new cc.CallFunc(function() {
c.replaceParentSamePlace(cleverapps.scenes.getMovingNode(c));
c.runAction(new cc.Sequence(new cc.Show,new cc.FadeIn,new cc.Spawn((new cc.MoveBy(1,cc.p(0, d))).easing(cc.easeIn(.7)),new cc.FadeTo(1,0)),new cc.RemoveSelf))
}
)
},
pulse: function(a, b) {
var c = b.duration || .5;
b = Math.ceil(1 * c);
c /= b;
var d = [];
a = a.baseScale || a.getScale();
for (var e = 0; e < b; e++)
d.push(new cc.Sequence(new cc.ScaleTo(c / 2,1.3 * a),new cc.ScaleTo(c / 2,a)));
return new cc.Sequence(d)
},
countTo: function(a, b, c) {
var d = c.duration || 1
, e = a.getString().split("/")
, f = "/";
" " === e[0][e[0].length - 1] && (f = " / ");
c = +e[0].trim();
var g = e[1] && +e[1].trim();
b -= c;
var h = Math.min(Math.ceil(30 * d), Math.abs(b));
b /= h;
e = function(l) {
return new cc.Sequence(new cc.CallFunc(function() {
a.setString(void 0 !== g ? l + f + g : l)
}
),new cc.DelayTime(d / h))
}
;
for (var k = [], m = 0; m < h; m++)
c += b,
k.push(e(Math.round(c)));
return new cc.Sequence(k)
},
jumpCollect: function(a, b, c) {
c = c || {};
b = cleverapps.aims.getTarget(b);
var d = cleverapps.styles.AnimationsLibrary.jumpCollect
, e = cleverapps.scenes.getMovingNode(a)
, f = c.collectMovingNode || cleverapps.scenes.getMovingNode(b)
, g = c.duration || cc.CollectAnimation.calcDuration({
targetNode: a,
to: b,
jump: !0
})
, h = c.jumpScale || 1.2 * a.scale
, k = c.collectScale || a.scale;
a.replaceParentSamePlace(e, {
keepScale: !0
});
d = c.longJump ? d.longJump : d.jump;
var m = d.both;
c.jumpSide && (m = "left" === c.jumpSide ? d.left : d.right);
c.longJump && (m = d.right);
e = c.jumpOffset || 0;
m = cc.p(m.x1 + (m.x2 - m.x1) * e, m.y1 + Math.random() * (m.y2 - m.y1));
var l = [new cc.CallFunc(function() {
cleverapps.aims.showTarget(b)
}
)];
l.push(new cc.Spawn(c.longJump ? (new cc.JumpTo(.8,a.x + m.x,a.y + m.y,d.height * (.9 + .2 * Math.random()),2)).easing(cc.easeInOut(1.2)) : new cc.JumpAnimation(.4,a,m,d.height),new cc.ScaleTo(.4,h),new cc.Sequence(new cc.DelayTime(.3),new cc.PlaySound(bundles.main.urls.coins_drop_effect))));
c.longJump && (l.push(new cc.CallFunc(function() {
cleverapps.aims.showTarget(b)
}
)),
l.push(new cc.DelayTime((c.collectDelay || 0) + .5 * (1 - e))));
l.push(new cc.ReplaceParent(f));
l.push(new cc.Spawn(new cc.CollectAnimation(g,b,{
jump: !0
}),new cc.ScaleTo(g,k)));
l.push(new cc.PlaySound(c.collectSound));
c.collectEffect && l.push(new cc.CollectEffect(b));
return new cc.Sequence(l)
},
coinCloud: function(a, b) {
b = b || {};
b.cloudSize = b.cloudSize || 0;
var c = b.target || cleverapps.aims.getTarget(["rewardHard", "hard"])
, d = cleverapps.styles.AnimationsLibrary.coinCloud
, e = d.coins[b.cloudSize]
, f = []
, g = [];
g.push(new cc.CallFunc(function() {
var h = new cleverapps.Spine(bundles.animations_library.jsons.coins_reward_json);
h.setPositionRound(d.sparks.position);
a.addChild(h);
h.setAnimation(0, "animation", !1);
h.setCompleteListenerRemove()
}
));
b.reward && g.push(new cc.CallFunc(function() {
var h = cleverapps.UI.generateTTFText("+" + b.reward, cleverapps.styles.FONTS.COINS_REWARD_TEXT);
h.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
h.setScale(d.text.scale / 2);
h.setLocalZOrder(1);
h.setPositionRound(d.text.position);
a.addChild(h);
h.replaceParentSamePlace(cleverapps.scenes.getMovingNode());
h.runAction(new cc.Sequence(new cc.FadeIn(.2),new cc.ScaleTo(d.showTextTime[b.cloudSize],d.text.scale),new cc.FadeOut(.2),new cc.RemoveSelf))
}
));
g.push(new cc.CallFunc(function() {
for (var h = 0; h < e.length; h++)
for (var k = 0; k < e[h].count; k++) {
var m = new cc.Sprite(bundles.animations_library.frames.animations_coin);
m.setRotation(120 * (Math.random() - .5));
m.setScale(0);
a.addChild(m);
var l = 2 * Math.PI * k / e[h].count
, n = (e[h].baseAngle || 0) * Math.PI / 180
, p = e[h].radiusX * Math.cos(l + n);
l = e[h].radiusY * Math.sin(l + n);
p += .5 * (Math.random() - .5) * p;
l += .5 * (Math.random() - .5) * l;
m.setPosition(a.width / 2 + p, a.height / 2 + l);
m.replaceParentSamePlace(cleverapps.scenes.getMovingNode());
m.runAction(new cc.Spawn(new cc.MoveBy(CoinCloud.APPEAR_TIME,cc.p(.2 * p, .2 * l)),new cc.ScaleTo(CoinCloud.APPEAR_TIME,e[h].scale)));
f.push(m)
}
f.sort(function(q, r) {
return q.getPositionX() - r.getPositionX()
}).forEach(function(q, r) {
q.runAction(new cc.Sequence(new cc.DelayTime(CoinCloud.APPEAR_TIME + .01 * r),new cc.CallFunc(function() {
cleverapps.aims.showTarget(c)
}
),new cc.Spawn(new cc.CollectAnimation(CoinCloud.COLLECT_COIN_TIME,c,{
jump: !0
}),new cc.RotateBy(CoinCloud.COLLECT_COIN_TIME,180)),new cc.CallFunc(function() {
0 === r && c.aim && c.aim.animate && c.aim.animate(b.reward)
}
),new cc.RemoveSelf))
})
}
));
return new cc.Sequence(g)
},
shift: function() {
var a = cleverapps.styles.AnimationsLibrary.shift;
return new cc.Sequence((new cc.MoveBy(.2,0,a.shift)).easing(cc.easeOut(1)),(new cc.MoveBy(.2,0,-a.shift)).easing(cc.easeIn(1)))
},
hovering: function(a, b) {
b = b || {};
var c = cleverapps.styles.AnimationsLibrary.hovering
, d = b.animationTime || 7
, e = b.leftAngle || 6
, f = b.rightAngle || 3
, g = c.offsetY;
b = b.delayTime || 0;
var h = a.particles = new cleverapps.Spine(bundles.animations_library.jsons.hovering_json);
h.setScale(a.height / h.height);
a.addChild(h, -1);
h.setPositionRound(c.particles);
return new cc.Sequence(new cc.CallFunc(function() {
h.setAnimation(0, "animation", !0)
}
),new cc.DelayTime(b),new cc.CallFunc(function() {
a.runAction(new cc.RepeatForever(new cc.Spawn(new cc.Sequence((new cc.RotateBy(3 * d / 10,e)).easing(cc.easeInOut(2)),(new cc.RotateBy(4 * d / 10,-(e + f))).easing(cc.easeInOut(2)),new cc.RotateBy(3 * d / 10,f)),new cc.Sequence((new cc.MoveBy(d / 2,0,-g)).easing(cc.easeInOut(2)),(new cc.MoveBy(d / 2,0,g)).easing(cc.easeInOut(2))))))
}
))
},
animateCollect: function(a, b, c) {
c = c || {};
b = cleverapps.aims.getTarget(b);
var d = cleverapps.scenes.getMovingNode(b)
, e = c.duration || cc.CollectAnimation.calcDuration({
targetNode: a,
to: b
})
, f = a.baseScaleX || a.baseScale || 1
, g = a.baseScaleY || a.baseScale || 1
, h = c.adjustToTarget ? Math.min(b.width / a.width, b.height / a.height, 1) : c.scale
, k = [new cc.ReplaceParent(d)];
if (c.path) {
var m = new cleverapps.Particles(bundles.particle.jsons.particles_collect_json,bundles.particle.frames.particle_texture);
k.push(new cc.CallFunc(function() {
d.addChild(m, -1);
m.setPositionRound(d.convertToNodeSpace(a.convertToWorldSpace(cc.p(a.width / 2, a.height / 2))));
m.followTarget(a)
}
))
}
k.push(new cc.CallFunc(function() {
cleverapps.aims.showTarget(b)
}
));
var l = new cc.CollectAnimation(e,b,c);
c.easing && (l = l.easing(c.easing));
k.push(new cc.Spawn(l,new cc.Sequence(new cc.ScaleTo(.4 * e,1.3 * f,1.3 * g),new cc.ScaleTo(.6 * e,h || f,h || g))));
c.sound && k.push(new cc.PlaySound(c.sound,{
throttle: 0
}));
c.collectEffect && k.push(new cc.CollectEffect(b));
m && k.push(new cc.CallFunc(function() {
m.stop()
}
));
return new cc.Sequence(k)
},
showUp: function(a, b) {
b = b || {};
var c = void 0 !== b.fallOffset ? b.fallOffset : 30
, d = void 0 !== b.fallDuration ? b.fallDuration : .25
, e = a.getPosition()
, f = [new cc.MoveBy(0,0,c)];
b.flash && f.push(new cc.CallFunc(function() {
var g = new cleverapps.Spine(bundles.animations_library.jsons.show_up_json);
a.addChild(g);
g.setPositionRound({
align: "center"
}, {
align: "center"
});
g.replaceParentSamePlace(a.parent);
a.replaceParentSamePlace(a.parent);
g.setAnimation(0, "animation", !1);
g.setCompleteListenerRemove()
}
));
a instanceof cc.Sprite || a instanceof cc.Scale9Sprite ? f.push(new cc.Sequence(new cc.DelayTime(.15),new cc.FadeOut(0),new cc.Show,new cc.FadeIn(.1))) : f.push(new cc.Sequence(new cc.DelayTime(.25),new cc.Show));
f.push(new cc.Spawn(new cc.ScaleTo(.05,.95,1.05),(new cc.MoveBy(d,0,-c)).easing(cc.easeIn(1))));
f.push(new cc.ScaleTo(.05,1,1));
return (new cc.Sequence(f)).setFinalize(function() {
a.setPosition(e)
})
},
blinkShader: function(a, b) {
b = b || {};
var c = void 0 !== b.duration ? b.duration : 2
, d = void 0 === b.brightness ? .15 : b.brightness;
d = [d, d, d];
var e = [];
b.action && e.push(b.action);
"undefined" !== typeof gl && e.push(new cc.Sequence((new cc.Flicker(c / 2,d)).easing(cc.easeInOut(2)),(new cc.Flicker(c / 2,d,!0)).easing(cc.easeInOut(2))));
return (new cc.RepeatForever(new cc.Spawn(e))).setFinalize(function() {
a.normalShader && a.setShaderProgram(a.normalShader);
delete a.normalShader
})
},
outline: function(a, b) {
b = b || {};
return new cc.CallFunc(function() {
if (a instanceof cleverapps.Spine) {
var c = new cleverapps.Spine(a.jsonName);
var d;
c.hasAnimation("idle") ? d = "idle" : c.hasAnimation("animation") && (d = "animation");
d = b.animationName || d;
c.hasAnimation(d) && (c.setAnimation(0, d, !0),
b.animationName ? a.setAnimation(0, d, !0) : c.clearTrack(0))
} else
c = new cc.Sprite(a.getSpriteFrame());
c.setScale((c.width + cleverapps.styles.AnimationsLibrary.outline.width) / c.width);
c.setPositionRound(a.width / 2, a.height / 2);
a.addChild(c, -1);
cleverapps.UI.outlineSprite(c);
a.outlineSprite = c
}
)
}
};
cleverapps.styles.AnimationsLibrary = {
squeezeJump: {
jumpHeight: 180
},
shake: {
dx: 1,
dy: 1
},
shift: {
shift: 25
},
outline: {
width: 16
},
hovering: {
offsetY: 25,
particles: {
x: {
align: "center"
},
y: {
align: "center"
}
}
},
jumpCollect: {
jump: {
height: 200,
right: {
x1: 50,
x2: 150,
y1: -50,
y2: -100
},
left: {
x1: -50,
x2: -150,
y1: -50,
y2: -100
},
both: {
x1: -50,
x2: 50,
y1: -50,
y2: -100
}
},
longJump: {
height: 100,
right: {
x1: 550,
x2: 650,
y1: -50,
y2: -100
}
}
},
click: {
smallHeight: 100
},
coinCloud: {
text: {
scale: 1,
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
sparks: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
coins: [[{
radiusX: 80,
radiusY: 80,
count: 6,
scale: 1
}], [{
radiusX: 40,
radiusY: 40,
count: 8,
scale: .8
}, {
radiusX: 15,
radiusY: 15,
count: 3,
scale: 1
}], [{
radiusX: 100,
radiusY: 140,
count: 16,
scale: .8
}, {
radiusX: 70,
radiusY: 98,
count: 12,
scale: 1
}, {
radiusX: 40,
radiusY: 55,
count: 6,
scale: 1.3
}]],
showTextTime: [.6, 1, 1]
}
};
cleverapps.overrideStyles(cleverapps.styles.DECORATORS, {
COINS_TEXT_STROKE: {
size: 3,
color: cleverapps.styles.COLORS.COINS_REWARD_STROKE_COLOR
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
COINS_REWARD_TEXT: {
size: 120,
color: cleverapps.styles.COLORS.COINS_REWARD_YELLOW,
stroke: cleverapps.styles.DECORATORS.COINS_TEXT_STROKE
}
});
var CoinCloud = {
SMALL: 0,
MEDIUM: 1,
BIG: 2,
COLLECT_COIN_TIME: .5,
APPEAR_TIME: .4
};
cleverapps.UI.animateCard = function(a) {
a = a || {};
var b = function() {
var p = a.position;
"function" === typeof p && (p = p());
try {
return p.parent.convertToWorldSpace(p.point)
} catch (q) {
if (!p.parent)
throw p = "Owner is " + a.debugLabel,
p = p + (" left cards: " + (Game.currentGame.table && Game.currentGame.table.cards.length)) + (" open cards: " + (Game.currentGame.open && Game.currentGame.open.cards.length)),
p;
}
}
, c = cleverapps.scenes.getMovingNode(a.cardView);
a.zOrder && c.setLocalZOrder(a.zOrder);
var d = a.cardView;
d.realParent = d.parent === c ? d.realParent : d.parent;
var e = d.animationId = d.animationId + 1 || 1
, f = a.scale || d.card.getScale()
, g = b()
, h = a.duration || .7
, k = a.animation
, m = d.parent.convertToWorldSpace(d).x <= g.x;
k === cleverapps.UI.animateCard.ANIMATIION_BIT && (k = m ? "bit" : "bit2");
var l = [];
d.replaceParentSamePlace(c, {
keepScale: !0
});
k && l.push(new cc.SpineAction(d.animation,k,a.animationTime || h,function() {
d.setIdleAnimation()
}
));
a.delay && l.push(new cc.DelayTime(a.delay));
k = c.convertToNodeSpace(g);
g = [];
if (a.midpoint) {
var n = c.convertToNodeSpace(d.parent.convertToWorldSpace(d));
m = cc.p(n.x + a.midpoint.x * (m ? 1 : -1), n.y + a.midpoint.y);
g.push((new cc.BezierTo(h,[n, m, k])).easing(a.easing || cc.easeIn(1)))
} else
m = new cc.MoveTo(h,k),
g.push(a.easing ? m.easing(a.easing) : m);
a.noAnimateScale || (m = c.adjustScaleTo(d.realParent),
a.dynamicRatioOfParentScale && (m.x /= a.dynamicRatioOfParentScale,
m.y /= a.dynamicRatioOfParentScale),
g.push(cleverapps.UI.animateScale({
scale: {
x: (f.x || f) / m.x,
y: (f.y || f) / m.y
},
duration: h,
overScaling: a.overScaling
})));
l.push(new cc.Spawn(g));
!1 !== a.replaceParentBack && l.push(new cc.CallFunc(function() {
e === d.animationId && (d.replaceParentSamePlace(d.realParent),
d.setScale(f))
}
));
l.push(new cc.CallFunc(function() {
if (d.parent) {
var p = d.parent.convertToNodeSpace(b());
d.setPositionRound(p)
}
a.zOrder && c.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 3)
}
));
return new cc.Sequence(l)
}
;
cleverapps.UI.animateCard.ANIMATIION_BIT = "bit";
cleverapps.UI.animateCube = function(a) {
a = a || {};
var b = cleverapps.scenes.getMovingNode()
, c = a.cubeView;
c.realParent = c.parent === b ? c.realParent : c.parent;
var d = a.position.parent.convertToWorldSpace(a.position.point);
a = a.duration || .7;
var e = [];
e.push(new cc.ReplaceParent(b));
d = b.convertToNodeSpace(d);
b = b.convertToNodeSpace(c.parent.convertToWorldSpace(c));
c = cc.p(b.x + cleverapps.Random.random(-100, 100), b.y + 600);
e.push((new cc.BezierTo(a,[b, c, d])).easing(cc.easeIn(.75)));
return new cc.Sequence(e)
}
;
cleverapps.UI.animateScale = function(a) {
a = a || {};
"object" !== typeof a.scale && (a.scale = {
x: a.scale,
y: a.scale
});
return a.overScaling ? new cc.Sequence((new cc.ScaleTo(4 * a.duration / 5,a.scale.x * a.overScaling,a.scale.y * a.overScaling)).easing(cc.easeIn(1)),(new cc.ScaleTo(a.duration / 5,a.scale.x,a.scale.y)).easing(cc.easeOut(1))) : new cc.ScaleTo(a.duration,a.scale.x,a.scale.y)
}
;
var getRadius = function(a, b) {
var c = 0;
a.forEach(function(d) {
d = cc.pDistance(d, b);
c = Math.max(c, d)
});
return c / 2
}
, getCenter = function(a) {
var b = {
x: 0,
y: 0
};
a.forEach(function(c) {
b.x += c.x;
b.y += c.y
});
b.x /= a.length;
b.y /= a.length;
return b
};
cleverapps.UI.animateShuffle = function(a, b) {
var c = getCenter(a)
, d = getRadius(a, c);
b = b || function() {}
;
a.forEach(function(e) {
var f = (.8 + .4 * Math.random()) * d
, g = e.getShuffleFinishPosition();
f = cc.pAdd(cc.pMult(cc.pNormalize(cc.p(e.x - c.x, e.y - c.y)), f), c);
e.runAction(new cc.Sequence((new cc.MoveTo(.375,f)).easing(cc.easeIn(3)),(new cc.MoveInCircle(.75,c,g)).easing(cc.easeOut(1.1)),new cc.CallFunc(b.bind(e)),(new cc.MoveTo(.375,g)).easing(cc.easeInOut(3))))
})
}
;
cc.Base = cc.Node;
cc.Base.prototype.replaceParent = function(a) {
this.removeTemporarily(!1);
a.addChild(this)
}
;
cc.Base.GetHierarchyRotation = function(a) {
for (var b = {
x: 0,
y: 0
}; a; )
b.x += a.getRotationX(),
b.y += a.getRotationY(),
a = a.parent;
return b
}
;
cc.Base.prototype.adjustRotationTo = function(a) {
a = cc.Base.GetHierarchyRotation(a);
a.x *= -1;
a.y *= -1;
for (var b = this; b; )
a.x += b.getRotationX(),
a.y += b.getRotationY(),
b = b.parent;
return a
}
;
cc.Base.GetHierarchyScale = function(a) {
for (var b = {
x: 1,
y: 1
}; a; )
b.x *= a.scaleX,
b.y *= a.scaleY,
a = a.parent;
return b
}
;
cc.Base.prototype.adjustScaleTo = function(a) {
var b = cc.Base.GetHierarchyScale(this);
a = cc.Base.GetHierarchyScale(a);
b.x /= a.x;
b.y /= a.y;
return b
}
;
cc.Base.prototype.replaceParentSamePlace = function(a, b) {
if (b && b.keepScale) {
var c = this.adjustScaleTo(a);
this.setScaleX(c.x);
this.setScaleY(c.y)
}
b && b.keepRotation && (b = this.adjustRotationTo(a),
this.setRotationX(b.x),
this.setRotationY(b.y));
b = a.convertToNodeSpace(this.parent.convertToWorldSpace(this.getPosition()));
this.replaceParent(a);
this.setPosition(b)
}
;
cc.Base.prototype.createListener = function(a) {
var b = this;
addCleaner(this, function() {
a = b = void 0
});
return function() {
if (a && b && !b.stopListeners)
return a.apply(b, arguments)
}
}
;
cc.Base.prototype.hasTouch = function(a) {
if (!this.visible)
return !1;
a = this.convertTouchToNodeSpace(a);
return cc.rectContainsPoint(cc.rect(0, 0, this.width, this.height), a)
}
;
cc.Base.prototype.createListener_onExitTransitionDidStart = cc.Base.prototype.onExitTransitionDidStart;
cc.Base.prototype.onExitTransitionDidStart = function() {
this.stopListeners = !0;
delete this.preferredBundles;
this.createListener_onExitTransitionDidStart();
if (this.avoidNode || this.updateDynamicPosition) {
var a = cleverapps.scenes.getRunningScene();
this.avoidNode && a.removeAvoidNode && a.removeAvoidNode(this);
this.updateDynamicPosition && a.removeDynamicNode && a.removeDynamicNode(this)
}
}
;
cc.Base.prototype.onEnterTransitionDidFinish = cleverapps.extendFunc(cc.Base.prototype.onEnterTransitionDidFinish, function() {
this.stopListeners = !1;
delete this.preferredBundles;
this._super.apply(this, arguments);
if (this.avoidNode || this.updateDynamicPosition) {
var a = cleverapps.scenes.getRunningScene();
this.avoidNode && a.addAvoidNode && a.addAvoidNode(this);
this.updateDynamicPosition && a.addDynamicNode && a.addDynamicNode(this)
}
});
cc.Base.prototype.cleanup = cleverapps.extendFunc(cc.Base.prototype.cleanup, function() {
this.stopListeners = !0;
runCleaners(this);
this._super()
});
cc.Base.prototype.runAction = cleverapps.extendFunc(cc.Base.prototype.runAction, function() {
this.stopListeners && cleverapps.config.debugMode && !cleverapps.config.wysiwygMode && cleverapps.throwAsync("runAction on stopped node");
this.saveStack && (this.actionStack = Error().stack);
return this._super.apply(this, arguments)
});
cc.Base.prototype.addCleaner = function(a) {
addCleaner(this, a)
}
;
cc.Base.prototype.addChild = cleverapps.extendFunc(cc.Base.prototype.addChild, function(a) {
this._super.apply(this, arguments);
a.alignment && a.doAlignment()
});
cc.Base.prototype.calculatePositionRound = function(a, b, c) {
Array.isArray(a) && (a = a[cleverapps.resolution.mode]);
void 0 === c && (c = "object" === typeof a ? a.options || a : {});
void 0 === b && (b = a.y,
a = a.x);
if ("object" === typeof a || "object" === typeof b) {
var d, e = c.box;
this.parent && (d = this.parent.getContentSize());
e && (d = e);
c.parentSize && (d = c.parentSize);
if (!d)
return {
x: a,
y: b,
options: c
};
"object" === typeof a && (a = this.calculateCoordinate(a, "x", d.width) + (e && e.x || 0));
"object" === typeof b && (b = this.calculateCoordinate(b, "y", d.height) + (e && e.y || 0))
}
return cc.p(Math.floor(a), Math.floor(b))
}
;
cc.Base.prototype.setPositionRound = function(a, b, c) {
this.alignment = void 0 === b ? a : {
x: a,
y: b,
options: c
};
this.parent && this.doAlignment()
}
;
cc.Base.prototype.doAlignment = function() {
var a = this.calculatePositionRound(this.alignment);
this.setPosition(a.x, a.y)
}
;
cc.Base.prototype.setPosition = cleverapps.extendFunc(cc.Base.prototype.setPosition, function(a, b) {
this._super(a, b);
if (isNaN(this.x) || isNaN(this.y)) {
if (cleverapps.config.debugMode)
throw "In setPosition value is NaN or undefined: x = " + this.x + ", y = " + this.y;
cleverapps.throwAsync("In setPosition value is NaN or undefined: x = " + this.x + ", y = " + this.y)
}
});
cc.Base.prototype.calculateCoordinate = function(a, b, c) {
var d = a["d" + b] || 0
, e = "x" === b ? this.getAnchorPoint().x : this.getAnchorPoint().y
, f = "x" === b ? this.width * Math.abs(this.scaleX) : this.height * Math.abs(this.scaleY);
!1 === a.anchor ? f = 0 : void 0 !== a.anchor && ("x" === b ? this.setAnchorPoint(a.anchor, this.anchorY) : this.setAnchorPoint(this.anchorX, a.anchor));
switch (a.align || "center") {
case "left":
case "bottom":
d += e * f;
break;
case "center":
d = d + c / 2 + (e - .5) * f;
break;
case "right":
case "top":
d = d + c + (e - 1) * f
}
return d
}
;
cc.Base.prototype.getRelativeCoordinates = function(a) {
return this.getParent().convertToNodeSpace(a.getParent().convertToWorldSpace(a.getPosition()))
}
;
cc.Node.prototype.getScale = function() {
this.scaleX !== this.scaleY && cleverapps.throwAsync("getScale with different scaleX=" + this.scaleX + " and scaleY=" + this.scaleY);
return this.scaleX
}
;
cc.Base.prototype.setContentSize2 = function(a, b) {
Array.isArray(a) && (a = a[cleverapps.resolution.mode]);
Array.isArray(b) && (b = b[cleverapps.resolution.mode]);
void 0 === b && (b = a.height,
a = a.width);
this.setContentSize(a, b)
}
;
cc.Base.prototype.setContentSize = cleverapps.extendFunc(cc.Base.prototype.setContentSize, function(a, b) {
var c = this.width
, d = this.height;
this._super(a, b);
c === this.width && d === this.height || this.children.forEach(function(e) {
e.alignment && e.doAlignment()
})
});
cc.Base.prototype.setScale2 = function(a) {
Array.isArray(a) && (a = a[cleverapps.resolution.mode]);
this.setScale(a)
}
;
cc.Base.prototype.isDisplayed = function() {
for (var a = this; a.isVisible() && a.parent; )
a = a.parent;
return a.isVisible() && a === cleverapps.scenes.getRunningScene()
}
;
cc.Base.prototype.getCenterPos = function() {
var a = this.getBoundingBox();
a.x += a.width / 2;
a.y += a.height / 2;
return {
x: Math.round(a.x),
y: Math.round(a.y)
}
}
;
cc.Base.prototype.getBoundingBox = function() {
var a = this.scaleX
, b = this.scaleY
, c = this.baseScaleX || this.baseScale || a
, d = this.baseScaleY || this.baseScale || b
, e = a !== c || b !== d;
e && this.setScale(c, d);
c = cc.rect(0, 0, this._contentSize.width, this._contentSize.height);
c = cc.rectApplyAffineTransform(c, this.getNodeToParentTransform());
e && this.setScale(a, b);
return c
}
;
cc.Base.prototype.getNodeToSceneTransform = function() {
for (var a = this.getNodeToParentTransform(), b = this.parent; null !== b; b = b.parent) {
if (b instanceof cleverapps.FixedWidthScene)
return a;
a = cc.affineTransformConcat(a, b.getNodeToParentTransform())
}
}
;
cc.Base.prototype.getSceneBoundingBox = function() {
var a = cc.rect(0, 0, this._contentSize.width, this._contentSize.height)
, b = this.getNodeToSceneTransform();
return cc.rectApplyAffineTransform(a, b)
}
;
cc.Base.prototype.getGlobalBoundingBox = function() {
var a = cc.rect(0, 0, this._contentSize.width, this._contentSize.height)
, b = this.getNodeToWorldTransform();
return cc.rectApplyAffineTransform(a, b)
}
;
cc.Base.prototype.setCascadeOpacityEnabledRecursively = function(a) {
this.performRecursive(function(b) {
b.setCascadeOpacityEnabled(a)
})
}
;
cc.Base.prototype.setRecCascadeColorEnabled = function() {
this.performRecursive(function(a) {
a.setCascadeColorEnabled(!0)
})
}
;
cc.Base.prototype.onResize = function() {
this.children.forEach(function(a) {
a.onResize()
});
this.completeAnimationOnResize && this.completeAnimationOnResize();
this.updateSize && this.updateSize();
this.setupChildren && this.setupChildren()
}
;
cc.Base.prototype.performRecursive = function(a) {
for (var b = [this]; 0 < b.length; ) {
var c = b.pop();
a(c);
Array.prototype.push.apply(b, c.children);
c.iterateTiles && c.iterateTiles(function(d) {
d instanceof cc.Node && b.push(d)
})
}
}
;
cc.Base.prototype.getPreferredBundles = function() {
if (void 0 !== this.preferredBundles)
return this.preferredBundles;
this.preferredBundles = !1;
this.bundles ? this.preferredBundles = this.bundles.reduce(function(a, b) {
return a.concat(bundles[b].injectTo || [b])
}, []) : this.parent && (this.preferredBundles = this.parent.getPreferredBundles());
return this.preferredBundles
}
;
cc.Base.prototype.getCropContainer = function() {}
;
cc.Base.prototype.setInteractiveState = function(a, b) {
this.interactiveStates || (this.interactiveStates = {});
b || (b = void 0);
if (this.interactiveStates[a] === b)
return !1;
b ? this.interactiveStates[a] = b : delete this.interactiveStates[a];
return !0
}
;
cc.Base.prototype.getInteractiveStates = function() {
var a = {};
if (!this.interactiveStates)
return a;
for (var b in this.interactiveStates)
a[this.interactiveStates[b]] = !0;
return a
}
;
cc.Base.prototype.removeInteractiveStates = function(a) {
if (this.interactiveStates)
for (var b in this.interactiveStates)
0 === b.indexOf(a) && delete this.interactiveStates[b]
}
;
cc.Base.prototype.applyInteractiveScale = function() {
if (!1 !== this.interactiveScale) {
var a = this.baseScaleX || this.baseScale || 1
, b = this.baseScaleY || this.baseScale || 1
, c = this.getInteractiveStates();
c.pressed ? this.setScale(.97 * a, .97 * b) : c.mouseover ? this.setScale(1.03 * a, 1.03 * b) : this.setScale(a, b)
}
}
;
cc.Base.prototype.convertTouchToNodeSpaceDisplacement = function(a) {
var b = this.convertToNodeSpace(a.getStartLocation());
a = this.convertToNodeSpace(a.getLocation());
var c = -(Math.PI / 180) * this.getRotation()
, d = function(e) {
return {
x: e.x * Math.cos(c) - e.y * Math.sin(c),
y: e.x * Math.sin(c) + e.y * Math.cos(c)
}
};
b = d(b);
a = d(a);
return cc.p(a.x - b.x, a.y - b.y)
}
;
cc.Base.prototype.removeTemporarily = function() {
"creator" === engine && (this._temporarilyRemoved = !0);
this.removeFromParent.apply(this, arguments)
}
;
cc.Base.CHILDREN_ORDER_FN = function(a, b) {
return a._localZOrder - b._localZOrder || a.arrivalOrder - b.arrivalOrder
}
;
cc.Base.EMPTY_COLOR = cc.color(255, 255, 255, 255);
cc.Sprite.prototype.unuse = function() {
this.removeTemporarily()
}
;
cc.Sprite.prototype.reuse = function() {
this.setScale(1);
this.setRotation(0);
this.setAnchorPoint(.5, .5);
this.setPosition(0, 0);
this.setOpacity(255);
this.setColor(cc.Base.EMPTY_COLOR);
this.setCascadeColorEnabled(!1);
this.setCascadeOpacityEnabled(!1);
this.setVisible(!0, !0)
}
;
cc.Sprite.prototype.visitTextureBundle = function() {
if (!this._spriteFrame)
return !1;
var a = this.getTextureBundle()
, b = this.virtualResource && bundles[this.virtualResource.bundleName]
, c = this.getPreferredBundles();
if (b = cc.rendererBundle && b && cc.rendererBundle !== a && b.isInjectTo(cc.rendererBundle) || a && !cleverapps.bundleLoader.isLoaded(a) || b && c && !c.includes(a) && b.isInjectTo(c))
this.setSpriteFrame(this.virtualResource),
a = this.getTextureBundle();
a && (cc.rendererBundle = a);
return b
}
;
cc.Scale9Sprite.prototype.visitTextureBundle = cc.Sprite.prototype.visitTextureBundle;
cc.pool = {
_pool: {},
putInPool: function(a) {
var b = a.constructor
, c = [b].concat(Array.prototype.slice.call(arguments, 0));
c = this.getPoolId.apply(this, c);
this._pool[c] || (this._pool[c] = []);
a.unuse && a.unuse();
(!b.PoolLimit || this._pool[c].length < b.PoolLimit) && this._pool[c].push(a)
},
getPoolId: function(a) {
var b = a.prototype.__pid;
if (!b) {
var c = {
writable: !0,
enumerable: !1,
configurable: !0
};
c.value = ClassManager.getNewID();
Object.defineProperty(a.prototype, "__pid", c)
}
a.GetPoolId && (b = Array.prototype.slice.call(arguments, 1),
b = a.GetPoolId.apply(a, b));
return b
},
hasObject: function() {
var a = this.getPoolId.apply(this, arguments);
return this._pool[a] && 0 < this._pool[a].length
},
getFromPool: function() {
if (this.hasObject.apply(this, arguments)) {
var a = this.getPoolId.apply(this, arguments)
, b = this._pool[a];
a = Array.prototype.slice.call(arguments, 1);
b = b.pop();
b.reuse && b.reuse.apply(b, a);
delete b.stopListeners;
delete b.alignment;
return b
}
},
drainAllPools: function() {
this._pool = {}
}
};
cc.spriteFrameCache = {
getSpriteFrame: function(a) {
a = "spriteFrameCache use - " + a;
if (cleverapps.config.debugMode)
throw Error(a);
cleverapps.throwAsync(a)
}
};
cleverapps.UI.ScrollBarContainer = cc.Node.extend({});
cleverapps.UI.ScrollView = ccui.Layout.extend({
ctor: function(a, b) {
this.options = b || {};
this.dir = cleverapps.UI.ScrollView.DIR_NONE;
this.min = cc.p(0, 0);
this.max = cc.p(0, 0);
this.onUpdatePositionListener = function() {}
;
this.onUpdateZoomListener = function() {}
;
this.options.childrenVisibility = void 0 === this.options.childrenVisibility ? cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_FULLCHECK : this.options.childrenVisibility;
this.options.childrenVisibilityPadding = this.options.childrenVisibilityPadding || 0;
switch (this.options.childrenVisibility) {
case cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_LINEAR:
this.childrenVisibility = new ScrollChildrenLinearVisibility(this);
break;
case cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_FULLCHECK:
this.childrenVisibility = new ScrollChildrenFullCheckVisibility(this)
}
this._super();
(void 0 === this.options.clipping || this.options.clipping) && this.setClippingEnabled(!0);
this.setAnchorPoint(.5, .5);
this.centerNode = new cc.Node;
this.addChild(this.centerNode);
!1 !== this.options.scrollBarEnabled && (this.barContainer = new cleverapps.UI.ScrollBarContainer,
this.addChild(this.barContainer, 2),
this.barContainer.setCascadeOpacityEnabled(!0),
this.barContainer.setOpacity(0),
this.barContainer.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.FadeTo(.3,255))),
this.barHandler = new ScrollBarHandler(this));
this.zoomScale = this.zoom = 1;
this.options.zoom && (this.zoomHandler = new cleverapps.UI.ZoomHandler(this,this.options.zoom));
this.scrollHandler = new (b && b.scrollHandler || cleverapps.UI.ScrollHandler)(this,{
mouseScroll: !this.options.zoom && !1 !== this.options.mouseScroll,
outOfBoundaryScale: this.options.outOfBoundaryScale,
inertialScrollFactor: this.options.inertialScrollFactor,
snapHandler: this.options.snapHandler
});
a && this.setInnerContent(a);
this.scheduleUpdate()
},
isEmpty: function() {
return !this.innerContent || !this.innerContent.children.length
},
setContentSize: function(a, b) {
var c = this.width
, d = this.height
, e = this.innerContent && this.innerContent.getPosition();
this._super(a, b);
if (c !== this.width || d !== this.height)
this.barContainer && this.barContainer.setContentSize(this.getContentSize()),
this.centerNode && this.centerNode.setPosition(this.width / 2, this.height / 2),
this.innerContent && (this.calcBorders(),
this.scrollToPoint(cc.p(-e.x, -e.y)))
},
updateVisibility: function() {
this.innerContent.setVisibleRect && this.innerContent.setVisibleRect(this.getVisibleRect());
if (this.childrenVisibility && this.currentVisibleChildIds && !this.isEmpty() && 0 !== this.width + this.height) {
var a = this.childrenVisibility.visibleIds(), b;
for (b = 0; b < this.currentVisibleChildIds.length; b++)
this.visibilityCheckList[this.currentVisibleChildIds[b]].hideDirty = !0;
for (b = 0; b < a.length; b++) {
var c = this.visibilityCheckList[a[b]];
delete c.hideDirty;
delete c.beyondScroll;
c.visible = !0
}
for (b = 0; b < this.currentVisibleChildIds.length; b++)
c = this.visibilityCheckList[this.currentVisibleChildIds[b]],
c.hideDirty && (delete c.hideDirty,
c.visible = !1,
c.beyondScroll = !0);
this.currentVisibleChildIds = a
}
},
getVisibleRect: function() {
return cc.rect(Math.round(this.innerContent.width / 2 - this.width / this.zoomScale / 2 - this.innerContent.x), Math.round(this.innerContent.height / 2 - this.height / this.zoomScale / 2 - this.innerContent.y), Math.round(this.width / this.zoomScale), Math.round(this.height / this.zoomScale))
},
isVisiblePoint: function(a) {
var b = this.getVisibleRect();
return cc.rectContainsPoint(b, a)
},
calcBorders: function() {
this.isEmpty() ? (this.min = cc.p(0, 0),
this.max = cc.p(0, 0)) : (this.min = cc.p(Math.floor(-this.innerContent.width / 2 + this.width / this.zoomScale / 2), Math.floor(-this.innerContent.height / 2 + this.height / this.zoomScale / 2)),
0 < this.min.x && (this.min.x = 0),
0 < this.min.y && (this.min.y = 0),
this.max = cc.p(Math.ceil(this.innerContent.width / 2 - this.width / this.zoomScale / 2), Math.ceil(this.innerContent.height / 2 - this.height / this.zoomScale / 2)),
0 > this.max.x && (this.max.x = 0),
0 > this.max.y && (this.max.y = 0),
this.setDirection(),
this.barHandler && this.barHandler.reset())
},
setInnerContent: function(a) {
this.innerContent && this.innerContent.removeFromParent();
this.innerContent = a;
this.innerContent.setAnchorPoint(.5, .5);
this.innerContent.setPositionRound(0, 0);
this.centerNode.addChild(a);
this.visibilityCheckList = a.visibilityCheckList || a.children;
this.width && this.height ? (this.updateInnerContent(),
this.scrollToDefault()) : this.initChildrenVisibility()
},
scrollToDefault: function() {
this.innerContent && this.scrollTo(cleverapps.UI.ScrollView.SCROLLS.UPPER_LEFT)
},
initChildrenVisibility: function() {
if (this.childrenVisibility) {
this.currentVisibleChildIds = [];
for (var a = 0; a < this.visibilityCheckList.length; a++)
this.currentVisibleChildIds.push(a)
}
},
updateInnerContent: function() {
this.calcBorders();
this.initChildrenVisibility();
this.scrollToPoint(this.normalizePoint(this.getContainerPosition()))
},
borderTouchScrollIteration: function(a, b, c) {
c *= .01;
var d = this.width / this.zoomScale / 2 * c;
c *= this.height / this.zoomScale / 2;
b /= this.zoom;
var e = cleverapps.bannerAd.getGlobalBoundingBox()
, f = 0
, g = a.getLocation();
e && e.x <= g.x && g.x <= e.x + e.width && (f = this.centerNode.convertToNodeSpace(cc.p(0, e.height)).y - this.centerNode.convertToNodeSpace(cc.p(0, 0)).y);
a = this.centerNode.convertTouchToNodeSpace(a);
g = e = 0;
var h = this.getContainerPosition();
a.x < -d && (e = h.x - b >= this.min.x ? -b : this.min.x - h.x);
a.x > d && (e = h.x + b <= this.max.x ? b : this.max.x - h.x);
a.y < -c + f && (g = h.y - b >= this.min.y ? -b : this.min.y - h.y);
a.y > c && (g = h.y + b <= this.max.y ? b : this.max.y - h.y);
return e || g ? (this.scrollToPoint(cc.p(h.x + e, h.y + g)),
!0) : !1
},
calcNodeDelta: function(a, b) {
var c = Object.assign({
left: 1,
right: 1,
top: 1,
bottom: 1
}, b.visibleBox)
, d = this.zoom;
this.zoomHandler && b.zoom && this.zoomHandler.setZoom(b.zoom, !0);
var e = a.getBoundingBox()
, f = cc.p(e.x, e.y);
e = cc.p(e.x + e.width, e.y + e.height);
f = this.centerNode.convertToNodeSpace(a.getParent().convertToWorldSpace(f));
e = this.centerNode.convertToNodeSpace(a.getParent().convertToWorldSpace(e));
a = cc.p(-this.width / this.zoomScale / 2 * c.left, -this.height / this.zoomScale / 2 * c.bottom);
c = cc.p(this.width / this.zoomScale / 2 * c.right, this.height / this.zoomScale / 2 * c.top);
var g = cc.p(0, 0);
f.x < a.x && (g.x = -(a.x - f.x));
e.x > c.x && (g.x = e.x - c.x);
f.y < a.y && (g.y = -(a.y - f.y));
e.y > c.y && (g.y = e.y - c.y);
g = cc.pAdd(g, this.scrollHandler.getHowMuchOutOfBoundary(g));
this.zoomHandler && b.zoom && this.zoomHandler.setZoom(d, !0);
return g
},
targetToPoint: function(a, b) {
var c = b && b.x || 0;
b = b && b.y || 0;
switch (a) {
case cleverapps.UI.ScrollView.SCROLLS.UPPER_LEFT:
a = cc.p(this.min.x + c, this.max.y + b);
break;
case cleverapps.UI.ScrollView.SCROLLS.CENTER:
a = cc.p(c, b);
break;
case cleverapps.UI.ScrollView.SCROLLS.LOWER_RIGHT:
a = cc.p(this.max.x + c, this.min.y + b);
break;
default:
"undefined" !== typeof Map2dCellView && a instanceof Map2dCellView ? a = this.innerContent.convertToNodeSpace(a.getParent().convertToWorldSpace(a.getPosition())) : a instanceof cc.Node && (a = this.innerContent.convertToNodeSpace(cc.rectGetCenter(a.getGlobalBoundingBox()))),
a.x -= this.innerContent.width / 2 + c,
a.y -= this.innerContent.height / 2 + b
}
return a
},
scrollTo: function(a, b, c) {
c = c || {};
var d = c.callback || function() {}
;
void 0 === a ? d() : (a = this.normalizePoint(this.targetToPoint(a, c.padding)),
b ? (c.duration = b,
c.targetPoint = !0,
b = c.easing || cc.easeBackInOut(),
this.runAction(new cc.Sequence((new cc.ScrollAction(a,c)).easing(b),new cc.CallFunc(d)))) : (this.scrollToPoint(a),
d()))
},
scrollBy: function(a, b, c) {
a = cc.pAdd(a, this.getContainerPosition());
a.x += this.innerContent.width / 2;
a.y += this.innerContent.height / 2;
this.scrollTo(a, b, c)
},
update: function(a) {
this._super(a);
this.scrollHandler.processAutoScroll(a)
},
getCurrentScroll: function() {
if (!this.innerContent)
return {
x: 0,
y: 0
};
var a = this.max.x - this.min.x
, b = this.max.y - this.min.y;
return {
x: 0 !== a ? (this.innerContent.x - this.min.x) / a : 0,
y: 0 !== b ? (this.innerContent.y - this.min.y) / b : 0
}
},
normalizePoint: function(a) {
return {
x: Math.max(this.min.x, Math.min(this.max.x, a.x)),
y: Math.max(this.min.y, Math.min(this.max.y, a.y))
}
},
getContainerPosition: function() {
return cc.p(-this.innerContent.x, -this.innerContent.y)
},
getCurrentPosition: function() {
var a = this.innerContent.getPosition();
return {
x: -a.x + this.innerContent.width / 2,
y: -a.y + this.innerContent.height / 2
}
},
scrollToPoint: function(a) {
this.innerContent.setPositionRound(-a.x, -a.y);
this.updateVisibility();
this.barHandler && this.barHandler.updatePos();
this.options.containerMovedListener && this.options.containerMovedListener();
this.onUpdatePositionListener()
},
scrollToPercent: function(a, b) {
a = Math.min(100, Math.max(0, a));
a = this.dir & cleverapps.UI.ScrollView.DIR_VERTICAL ? cc.p(this.innerContent.x, (this.max.y - this.min.y) * a / 100 + this.min.y) : cc.p((this.max.x - this.min.x) * a / 100 + this.min.x, this.innerContent.y);
b ? this.runAction((new cc.ScrollAction(a,{
duration: b,
targetPoint: !0
})).easing(cc.easeBackInOut())) : this.scrollToPoint(a)
},
stopScrollAction: function() {
this._scrollActionRunning && (cc.ScrollAction._UID++,
this._scrollActionRunning = !1,
this.scrollHandler.afterContainerMove())
},
stopAutoScroll: function() {
this.stopScrollAction();
this.scrollHandler.stopAutoScroll()
},
setDirection: function() {
this.options.direction ? this.dir = this.options.direction : (this.dir = cleverapps.UI.ScrollView.DIR_BOTH,
this.min.y === this.max.y && (this.dir ^= cleverapps.UI.ScrollView.DIR_VERTICAL),
this.min.x === this.max.x && (this.dir ^= cleverapps.UI.ScrollView.DIR_HORIZONTAL))
},
getInnerContainer: function() {
return this.innerContent
},
setBarPadding: function(a) {
this.barHandler && this.barHandler.setPadding(a)
},
getCropContainer: function() {
return cc.rect(0, 0, this.width, this.height)
}
});
cleverapps.UI.ScrollView.SCROLLS = {
UPPER_LEFT: 0,
CENTER: 1,
LOWER_RIGHT: 2
};
cleverapps.UI.ScrollView.DIR_NONE = 0;
cleverapps.UI.ScrollView.DIR_VERTICAL = 1;
cleverapps.UI.ScrollView.DIR_HORIZONTAL = 2;
cleverapps.UI.ScrollView.DIR_BOTH = cleverapps.UI.ScrollView.DIR_VERTICAL | cleverapps.UI.ScrollView.DIR_HORIZONTAL;
cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_NONE = 0;
cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_LINEAR = 1;
cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_FULLCHECK = 2;
var ScrollBarHandler = function(a) {
this.scroll = a
};
ScrollBarHandler.prototype.reset = function() {
var a = this.scroll.dir & cleverapps.UI.ScrollView.DIR_HORIZONTAL && this.scroll.min.x !== this.scroll.max.x
, b = this.scroll.dir & cleverapps.UI.ScrollView.DIR_VERTICAL && this.scroll.min.y !== this.scroll.max.y;
!this.barY && b && (this.barY = new ScrollBar(this.scroll,cleverapps.UI.ScrollView.DIR_VERTICAL));
!this.barX && a && (this.barX = new ScrollBar(this.scroll,cleverapps.UI.ScrollView.DIR_HORIZONTAL));
this.barX && this.barX.setVisible(a);
this.barY && this.barY.setVisible(b);
this.updatePos()
}
;
ScrollBarHandler.prototype.setAutoHide = function(a) {
this.barX && this.barX.setAutoHideEnabled(a);
this.barY && this.barY.setAutoHideEnabled(a)
}
;
ScrollBarHandler.prototype.setPadding = function(a) {
this.barPadding = a;
this.barX && this.barX.setPadding(this.barPadding);
this.barY && this.barY.setPadding(this.barPadding)
}
;
ScrollBarHandler.prototype.updatePos = function() {
var a = this.scroll.scrollHandler.getHowMuchOutOfBoundary();
if (this.barY)
this.barY.onScrolled(a);
if (this.barX)
this.barX.onScrolled(a)
}
;
ScrollBarHandler.prototype.onTouchBegan = function() {
if (this.barY)
this.barY.onTouchBegan();
if (this.barX)
this.barX.onTouchBegan()
}
;
ScrollBarHandler.prototype.onTouchEnded = function() {
if (this.barY)
this.barY.onTouchEnded();
if (this.barX)
this.barX.onTouchEnded()
}
;
var ScrollBar = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.scroll = a;
this.dir = b;
this._touching = !1;
this._autoHideRemainingTime = 0;
this._marginForLength = this._marginFromBoundary = ScrollBar.DEFAULT_MARGIN;
this.opacity = 255 * ScrollBar.DEFAULT_SCROLLBAR_OPACITY;
this.autoHideTime = ScrollBar.DEFAULT_AUTO_HIDE_TIME;
this._autoHideEnabled = !0;
this.init();
this.setCascadeColorEnabled(!0);
this.setCascadeOpacityEnabled(!0);
a.barContainer.addChild(this);
this.setAutoHideEnabled(!1);
this.setPadding(this.scroll.barHandler.barPadding);
this.addControls();
this.setWidth(cleverapps.styles.ScrollBar.barWidth)
},
init: function() {
this.bar = new cc.Scale9Sprite(bundles.scrollbar.frames.scrollbar_png);
this.bar.setAnchorPoint(.5, 0);
this.addChild(this.bar);
this.setColor(ScrollBar.DEFAULT_COLOR);
this.onScrolled(cc.p(0, 0));
cc.Node.prototype.setOpacity.call(this, 0);
this._autoHideRemainingTime = 0;
this.dir === cleverapps.UI.ScrollView.DIR_HORIZONTAL && this.setRotation(90)
},
setPositionFromCorner: function(a) {
this.dir === cleverapps.UI.ScrollView.DIR_VERTICAL ? (this._marginForLength = a.y,
this._marginFromBoundary = a.x) : (this._marginForLength = a.x,
this._marginFromBoundary = a.y)
},
onEnter: function() {
cc.Node.prototype.onEnter.call(this);
this.scheduleUpdate()
},
getPositionFromCorner: function() {
return this.dir === cleverapps.UI.ScrollView.DIR_VERTICAL ? cc.p(this._marginFromBoundary, this._marginForLength) : cc.p(this._marginForLength, this._marginFromBoundary)
},
setWidth: function(a) {
this.bar.width = a
},
setAutoHideEnabled: function(a) {
this._autoHideEnabled = a;
!this._autoHideEnabled && !this._touching && 0 >= this._autoHideRemainingTime ? cc.Node.prototype.setOpacity.call(this, this.opacity) : cc.Node.prototype.setOpacity.call(this, 0)
},
isAutoHideEnabled: function() {
return this._autoHideEnabled
},
setOpacity: function(a) {
this._opacity = a
},
getOpacity: function() {
return this._opacity
},
_updateLength: function(a) {
this.bar.height = a
},
_processAutoHide: function(a) {
!this._autoHideEnabled || 0 >= this._autoHideRemainingTime || this._touching || (this._autoHideRemainingTime -= a,
this._autoHideRemainingTime <= this.autoHideTime && (this._autoHideRemainingTime = Math.max(0, this._autoHideRemainingTime),
cc.Node.prototype.setOpacity.call(this, this._autoHideRemainingTime / this.autoHideTime * this._opacity)))
},
update: function(a) {
this._processAutoHide(a)
},
onTouchBegan: function() {
this._autoHideEnabled && (this._touching = !0)
},
onTouchEnded: function() {
this._autoHideEnabled && (this._touching = !1,
0 >= this._autoHideRemainingTime || (this._autoHideRemainingTime = this.autoHideTime))
},
_calculateLength: function(a, b, c) {
0 !== c && (a += 20 * (0 < c ? c : -c));
return b / a * Math.abs(b - 2 * this._marginForLength)
},
_calculatePosition: function(a, b, c, d, e) {
a -= b;
0 !== d && (a += Math.abs(d));
d = 0;
0 !== a && (d = Math.max(c / a, 0),
d = Math.min(d, 1));
b = (b - e - 2 * this._marginForLength) * d + this._marginForLength;
return this.dir === cleverapps.UI.ScrollView.DIR_VERTICAL ? cc.p(this.scroll.width - this._marginFromBoundary, b) : cc.p(b, this._marginFromBoundary)
},
setPadding: function(a) {
a = a || {};
var b = cleverapps.styles.ScrollBar
, c = void 0 !== a.cornerPadding ? a.cornerPadding : b.cornerPadding;
a = void 0 !== a.sidePadding ? a.sidePadding : b.sidePadding;
c = cc.p(this.dir === cleverapps.UI.ScrollView.DIR_VERTICAL ? a : c, this.dir === cleverapps.UI.ScrollView.DIR_VERTICAL ? c : a);
this.setPositionFromCorner(c);
this.onScrolled(this.scroll.scrollHandler.getHowMuchOutOfBoundary())
},
onScrolled: function(a) {
this._autoHideEnabled && (this._autoHideRemainingTime = this.autoHideTime,
cc.Node.prototype.setOpacity.call(this, this.opacity));
var b = this.scroll.getInnerContainer()
, c = 0
, d = 0
, e = 0
, f = 0;
this.dir === cleverapps.UI.ScrollView.DIR_VERTICAL ? (c = b.height,
d = this.scroll.height,
e = a.y,
f = -b.getPositionY() + (this.scroll.max.y - this.scroll.min.y) / 2) : this.dir === cleverapps.UI.ScrollView.DIR_HORIZONTAL && (c = b.width,
d = this.scroll.width,
e = a.x,
f = -b.getPositionX() + (this.scroll.max.x - this.scroll.min.x) / 2);
a = this._calculateLength(c, d, e);
c = this._calculatePosition(c, d, f, e, a);
this._updateLength(a);
this.setPosition(c)
},
getActualContentSize: function() {
return this.bar.getContentSize()
},
addControls: function() {
cleverapps.UI.onDrag(this.bar, {
instantDrag: !0,
onDragStart: function() {
this.scroll.scrollHandler.stopAutoScroll();
return !0
}
.bind(this),
followPointer: function(a) {
var b = this.convertToNodeSpace(a.getLocation());
a = this.convertToNodeSpace(a.getPreviousLocation());
b = cc.pSub(b, a);
b = this.getPosToPercent(b);
this.scroll.scrollToPercent(b)
}
.bind(this)
})
},
getPosToPercent: function(a) {
if (this.dir === cleverapps.UI.ScrollView.DIR_VERTICAL) {
var b = this.scroll.height - 2 * this.getPositionFromCorner().y - this.getActualContentSize().height;
return (this.y + a.y - this.getPositionFromCorner().y) / b * 100
}
b = this.scroll.width - 2 * this.getPositionFromCorner().x - this.getActualContentSize().height;
return (this.x + a.y - this.getPositionFromCorner().x) / b * 100
}
});
Object.defineProperty(ScrollBar.prototype, "opacity", {
get: function() {
return this.getOpacity()
},
set: function(a) {
this.setOpacity(a)
}
});
cleverapps.styles.ScrollBar = {
barWidth: 12,
cornerPadding: 20,
sidePadding: 20
};
ScrollBar.DEFAULT_COLOR = new cc.Color(52,65,87);
ScrollBar.DEFAULT_MARGIN = 20;
ScrollBar.DEFAULT_AUTO_HIDE_TIME = .2;
ScrollBar.DEFAULT_SCROLLBAR_OPACITY = .4;
ScrollBar.BASE_WIDTH = 12;
var ScrollChildrenLinearVisibility = function(a) {
this.scroll = a
};
ScrollChildrenLinearVisibility.prototype.visibleIds = function() {
var a = this.scroll.visibilityCheckList;
if (1 >= a.length) {
var b = 0;
var c = a.length
} else {
var d = a.length - 1;
c = this.getChildRect(a[0]);
var e = this.getChildRect(a[d]);
b = c.getPosition();
e = e.getPosition();
e.x -= b.x;
e.x /= d;
e.y -= b.y;
e.y /= d;
0 !== e.y ? (d = e.y,
e = c.height / 2,
b = (-this.scroll.innerContent.y - b.y + this.scroll.innerContent.height / 2 - this.scroll.height / 2) / d,
c = (this.scroll.height + 2 * e) / d) : (d = e.x,
e = c.width / 2,
b = (-this.scroll.innerContent.x - b.x + this.scroll.innerContent.width / 2 - this.scroll.width / 2) / d,
c = (this.scroll.width + 2 * e) / d);
0 > c && (c = -c,
b -= c);
b = Math.ceil(b - e / Math.abs(d));
c = Math.floor(c + 2 * e / Math.abs(d))
}
d = [];
for (e = 0; e < c; e++)
a[b + e] && d.push(b + e);
return d
}
;
ScrollChildrenLinearVisibility.prototype.getChildRect = function(a) {
if (a.parent && a.parent !== this.scroll.innerContent) {
var b = a.getBoundingBox()
, c = cc.p(b.x + b.width / 2, b.y + b.height / 2);
a = this.scroll.innerContent.convertToNodeSpace(a.parent.convertToWorldSpace(c));
return cc.rect(a.x, a.y, b.width, b.height)
}
return a
}
;
var ScrollChildrenFullCheckVisibility = function(a) {
this.scroll = a
};
ScrollChildrenFullCheckVisibility.prototype.visibleIds = function() {
for (var a = [], b = this.scroll.visibilityCheckList, c = 0; c < b.length; c++) {
var d = b[c];
if (d.parent && d.parent !== this.scroll.innerContent) {
var e = d.getBoundingBox();
var f = cc.p(e.x + e.width / 2, e.y + e.height / 2);
d = this.scroll.innerContent.convertToNodeSpace(d.parent.convertToWorldSpace(f));
e = cc.rect(d.x, d.y, e.width, e.height)
} else
e = d;
this.isRectVisible(e) && a.push(c)
}
return a
}
;
ScrollChildrenFullCheckVisibility.prototype.isRectVisible = function(a) {
var b = this.scroll.zoom
, c = this.scroll.options.childrenVisibilityPadding || 0
, d = a.x - this.scroll.innerContent.width / 2
, e = a.y - this.scroll.innerContent.height / 2;
return -this.scroll.innerContent.x - this.scroll.width / b / 2 - a.width / 2 - c <= d && d <= -this.scroll.innerContent.x + this.scroll.width / b / 2 + a.width / 2 + c && -this.scroll.innerContent.y - this.scroll.height / b / 2 - a.height / 2 - c <= e && e <= -this.scroll.innerContent.y + this.scroll.height / b / 2 + a.height / 2 + c ? !0 : !1
}
;
var HidingNode = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.target = a;
a.avoidNode && (this.avoidNode = a.avoidNode,
a.avoidNode = void 0);
this.direction = void 0 !== b ? b : HidingNode.DIR.AUTO;
this.alignment = a.alignment;
delete a.alignment;
this.setPosition(a.getPosition());
this.setLocalZOrder(a.getLocalZOrder());
this.setAnchorPoint(a.getAnchorPoint());
this.updateSize();
a.getParent().addChild(this);
a.replaceParent(this);
a.setPosition(this.getOriginalPosition());
this.target.setVisible(!1);
this.isShown = !1
},
updateSize: function() {
var a = this.target.getContentSize();
this.setContentSize2(a.width * Math.abs(this.target.getScaleX()), a.height * Math.abs(this.target.getScaleY()))
},
setupChildren: function() {
this.target.setPosition(this.isShown ? this.getOriginalPosition() : this.calcHidePosition());
this.target.setVisible(this.isShown)
},
completeAnimationOnResize: function() {
this.animating && !this.animating.isDone() && (this.target.stopAction(this.animating),
delete this.animating)
},
calcHidePosition: function() {
var a = this.direction;
if (a === HidingNode.DIR.NONE)
return this.getOriginalPosition();
var b = this.getParent().convertToWorldSpace(this.getPosition())
, c = cleverapps.resolution.getBgSize();
if (a === HidingNode.DIR.AUTO) {
var d = this.getBoundingBox();
a = Math.max(0, Math.min(d.x, c.width - d.x - d.width)) > Math.max(0, Math.min(d.y, c.height - d.y - d.height)) ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL
}
d = this.width * this.scaleX;
var e = this.height * this.scaleY
, f = cc.p(b.x + d * (.5 - this.anchorX), b.y + e * (.5 - this.anchorY));
a === cleverapps.UI.VERTICAL ? (b = b.y > c.height / 2 ? c.height - f.y : -f.y,
b = cc.p(f.x, f.y + 2 * b)) : (b = b.x > c.width / 2 ? c.width - f.x : -f.x,
b = cc.p(f.x + 2 * b, f.y));
return this.convertToNodeSpace(cc.p(b.x + d * (this.anchorX - .5), b.y + e * (this.anchorY - .5)))
},
getOriginalPosition: function() {
return cc.p(this.width / 2, this.height / 2)
},
toggle: function(a, b) {
a ? this.show(b) : this.hide(b)
},
show: function(a) {
if (!0 !== this.isShown) {
this.isShown = !0;
if (this.target.onShow)
this.target.onShow(a);
cleverapps.scenes.onAvoidNodeVisibilityChanged();
this.target.showAnimation ? this.target.showAnimation(a) : (this.animating && !this.animating.isDone() && (this.target.stopAction(this.animating),
delete this.animating),
a ? (this.target.setPosition(this.getOriginalPosition()),
this.target.setVisible(!0)) : (this.target.setPosition(this.calcHidePosition()),
this.animating = this.target.runAction(new cc.Sequence(new cc.Show,(new cc.MoveTo(.4,this.getOriginalPosition())).easing(cc.easeBackOut(2))))))
}
},
hide: function(a) {
if (!1 !== this.isShown) {
this.isShown = !1;
if (this.target.onHide)
this.target.onHide(a);
cleverapps.scenes.onAvoidNodeVisibilityChanged();
this.target.hideAnimation ? this.target.hideAnimation(a) : (this.animating && !this.animating.isDone() && (this.target.stopAction(this.animating),
delete this.animating),
a ? (this.target.setPosition(this.calcHidePosition()),
this.target.setVisible(!1)) : this.animating = this.target.runAction(new cc.Sequence((new cc.MoveTo(.15,this.calcHidePosition())).easing(cc.easeBackIn(2)),new cc.Hide)))
}
}
});
HidingNode.DIR = {
AUTO: 2,
NONE: 3
};
cleverapps.UI.ScrollHandler = function(a, b) {
b = b || {};
this.target = a;
this.bounceEnabled = !0;
this.outOfBoundaryScale = void 0 === b.outOfBoundaryScale ? .5 : b.outOfBoundaryScale;
this.inertialScrollFactor = b.inertialScrollFactor || 1;
this.snapHandler = b.snapHandler;
this.initAutoScrollParams();
!1 !== b.mouseScroll && this.enableMouseWheelScroll();
this.enableTouchScroll()
}
;
cleverapps.UI.ScrollHandler.prototype.enableMouseWheelScroll = function() {
"mouse"in cc.sys.capabilities && cc.eventManager.addListener({
event: cc.EventListener.MOUSE,
onMouseScroll: function(a) {
this.target.isDisplayed() && cc.rectContainsPoint(cc.rect(0, 0, this.target.width, this.target.height), this.target.convertToNodeSpace(a.getLocation())) && cleverapps.focusManager.checkEventNode(this.target) && (this.handleMouseWheel(a.getScrollY()),
a.stopPropagation())
}
.bind(this)
}, this.target)
}
;
cleverapps.UI.ScrollHandler.prototype.handleMouseWheel = function(a) {
if (0 !== (this.target.dir & cleverapps.UI.ScrollView.DIR_VERTICAL)) {
var b = this.getHowMuchOutOfBoundary({
y: 0 < a ? 1 : -1
});
if (!(!this.fltEqualZero(b) && (0 > b.y && 0 < a || 0 < b.y && 0 > a) || this.lastMouseWheelTime && this.lastMouseWheelTime > Date.now() - 100)) {
if (!this.mouseWheelSpeed || this.lastMouseWheelTime < Date.now() - 500 || 0 > a * this.mouseWheelSpeed)
this.mouseWheelSpeed = 0;
65 > Math.abs(a) && this.lastMouseWheelTime && this.lastMouseWheelTime > Date.now() - 2E3 || (this.mouseWheelSpeed += cleverapps.styles.ScrollHandler.mouseWheelAcceleration * cleverapps.sign(a),
Math.abs(this.mouseWheelSpeed) > cleverapps.styles.ScrollHandler.mouseWheelMaxSpeed && (this.mouseWheelSpeed = cleverapps.sign(this.mouseWheelSpeed) * cleverapps.styles.ScrollHandler.mouseWheelMaxSpeed),
Math.abs(this.mouseWheelSpeed) < cleverapps.styles.ScrollHandler.mouseWheelMinSpeed && (this.mouseWheelSpeed = cleverapps.sign(this.mouseWheelSpeed) * cleverapps.styles.ScrollHandler.mouseWheelMinSpeed),
this.startInertialScroll(cc.p(0, this.mouseWheelSpeed)),
this.lastMouseWheelTime = Date.now())
}
}
}
;
cleverapps.UI.ScrollHandler.prototype.enableTouchScroll = function() {
cleverapps.UI.onDrag(this.target, {
onPressed: function() {
this.stopAutoScroll()
}
.bind(this),
onDragStart: this.onTouchBegan.bind(this),
followPointer: this.onTouchMoved.bind(this),
onDragEnd: this.onTouchEnded.bind(this)
})
}
;
cleverapps.UI.ScrollHandler.prototype.onTouchBegan = function(a) {
if (this.target.touchScrollDisabled)
return !1;
this.target.stopScrollAction();
this.handlePress(a);
return !0
}
;
cleverapps.UI.ScrollHandler.prototype.onTouchMoved = function(a) {
this.target.touchScrollDisabled || this.handleMove(a)
}
;
cleverapps.UI.ScrollHandler.prototype.onTouchEnded = function(a) {
this.target.touchScrollDisabled || this.handleRelease(a)
}
;
cleverapps.UI.ScrollHandler.prototype.getTouchDelta = function(a, b) {
var c = this.target.convertToNodeSpace(a.getLocation());
a = this.target.convertToNodeSpace(a.getPreviousLocation());
b && !cc.rectContainsPoint(cc.rect(0, 0, this.target.width, this.target.height), c) && (c = a);
b = cc.pMult(cc.pSub(a, c), 1 / this.target.zoom);
0 === (this.target.dir & cleverapps.UI.ScrollView.DIR_HORIZONTAL) && (b.x = 0);
0 === (this.target.dir & cleverapps.UI.ScrollView.DIR_VERTICAL) && (b.y = 0);
return b
}
;
cleverapps.UI.ScrollHandler.prototype.initAutoScrollParams = function() {
this._outOfBoundaryAmountDirty = !0;
this._outOfBoundaryAmount = cc.p(0, 0)
}
;
cleverapps.UI.ScrollHandler.prototype.afterContainerScale = function() {
this._outOfBoundaryAmountDirty = !0;
var a = this.getHowMuchOutOfBoundary();
this.fltEqualZero(a) || this.startAutoScroll(a, 0)
}
;
cleverapps.UI.ScrollHandler.prototype.afterContainerMove = function() {
this._outOfBoundaryAmountDirty = !0;
this.target.barHandler && this.target.barHandler.updatePos();
!this.bounceEnabled || this.inTouch || this._autoScrolling || this.startBounceBackIfNeeded()
}
;
cleverapps.UI.ScrollHandler.prototype.startBounceBackIfNeeded = function() {
if (!this.bounceEnabled)
return !1;
var a = this.getHowMuchOutOfBoundary();
if (this.fltEqualZero(a))
return !1;
this.startAutoScroll(a, 1);
return !0
}
;
cleverapps.UI.ScrollHandler.prototype.handlePress = function(a) {
this.inTouch = !0;
this.stopAutoScroll();
this._touchMovePreviousTimestamp = a.getLastModified();
this._touchMoveDisplacements = [];
this._touchMoveTimeDeltas = [];
if (this.target.barHandler)
this.target.barHandler.onTouchBegan()
}
;
cleverapps.UI.ScrollHandler.prototype.handleMove = function(a) {
var b = this.getTouchDelta(a);
if (this.bounceEnabled) {
var c = this.getHowMuchOutOfBoundary(b);
b.x *= 0 === c.x ? 1 : this.outOfBoundaryScale;
b.y *= 0 === c.y ? 1 : this.outOfBoundaryScale
} else
c = this.getHowMuchOutOfBoundary(b),
b.x += c.x,
b.y += c.y;
this.gatherMoveData(b, a);
a = cc.pAdd(this.target.getContainerPosition(), b);
this.moveContainer(a)
}
;
cleverapps.UI.ScrollHandler.prototype.gatherMoveData = function(a, b) {
for (; 5 <= this._touchMoveDisplacements.length; )
this._touchMoveDisplacements.splice(0, 1),
this._touchMoveTimeDeltas.splice(0, 1);
this._touchMoveDisplacements.push(a);
a = b.getLastModified();
this._touchMoveTimeDeltas.push((a - this._touchMovePreviousTimestamp) / 1E3);
this._touchMovePreviousTimestamp = a
}
;
cleverapps.UI.ScrollHandler.prototype.handleRelease = function(a) {
this.inTouch = !1;
var b = this.getTouchDelta(a, !0);
this.gatherMoveData(b, a);
this.snapHandler ? this.startAutoScroll(this.snapHandler(this.target.getContainerPosition(), 0 < this.calcTouchVelocity().y), .5) : this.startBounceBackIfNeeded() || (a = this.calcTouchVelocity(),
0 === a.x && 0 === a.y || this.startInertialScroll(a));
if (this.target.barHandler)
this.target.barHandler.onTouchEnded()
}
;
cleverapps.UI.ScrollHandler.prototype.calcAutoScrollPercentage = function() {
var a = this._autoScrollAccumulatedTime < this._autoScrollTotalTime ? this._autoScrollAccumulatedTime / this._autoScrollTotalTime : 1;
this._autoScrollAttenuate && (--a,
a = a * a * a * a * a + 1);
return a
}
;
cleverapps.UI.ScrollHandler.prototype.processAutoScroll = function(a) {
if (this._autoScrolling && !this.inTouch) {
var b = 1
, c = this.calcAutoScrollPercentage();
0 <= c && 1 >= c && this.isNecessaryAutoScrollBrake() && (b = .05);
this._autoScrollAccumulatedTime += 1 / b * a;
c = this.calcAutoScrollPercentage();
1E-4 >= Math.abs(c - 1) && (c = 1,
this.stopAutoScroll());
a = cc.pAdd(this._autoScrollStartPosition, cc.pMult(this._autoScrollTargetDelta, c));
a = cc.pAdd(this._autoScrollBrakingStartPosition, cc.pMult(cc.pSub(a, this._autoScrollBrakingStartPosition), b));
this.moveContainer(a)
}
}
;
cleverapps.UI.ScrollHandler.prototype.moveContainer = function(a) {
this.target.scrollToPoint(a);
this.afterContainerMove()
}
;
cleverapps.UI.ScrollHandler.prototype.isOutOfBoundary = function() {
var a = this.getHowMuchOutOfBoundary();
return !this.fltEqualZero(a)
}
;
cleverapps.UI.ScrollHandler.prototype.calcTouchVelocity = function() {
var a = this._touchMoveTimeDeltas.reduce(function(c, d) {
return c + d
}, 0);
if (0 === a || .5 <= a)
return cc.p(0, 0);
var b = cc.p(0, 0);
this._touchMoveDisplacements.forEach(function(c) {
b.x += c.x;
b.y += c.y
});
return cc.pMult(b, 1 / a)
}
;
cleverapps.UI.ScrollHandler.prototype.isNecessaryAutoScrollBrake = function() {
if (this._autoScrollBraking)
return !0;
if (this.isOutOfBoundary()) {
if (!this._autoScrollCurrentlyOutOfBoundary)
return this._autoScrollBraking = this._autoScrollCurrentlyOutOfBoundary = !0,
this._autoScrollBrakingStartPosition = this.target.getContainerPosition(),
!0
} else
this._autoScrollCurrentlyOutOfBoundary = !1;
return !1
}
;
cleverapps.UI.ScrollHandler.prototype.startInertialScroll = function(a) {
var b = cc.pMult(a, .7 * this.inertialScrollFactor);
a = this.calculateAutoScrollTimeByInitialSpeed(cc.pLength(a));
this.startAutoScroll(b, a)
}
;
cleverapps.UI.ScrollHandler.prototype.calculateAutoScrollTimeByInitialSpeed = function(a) {
return Math.sqrt(Math.sqrt(a / 5)) * this.inertialScrollFactor
}
;
cleverapps.UI.ScrollHandler.prototype.fltEqualZero = function(a) {
return 1E-4 >= Math.abs(a.x) && 1E-4 >= Math.abs(a.y)
}
;
cleverapps.UI.ScrollHandler.prototype.startAutoScroll = function(a, b) {
this._autoScrolling = !0;
this._autoScrollTargetDelta = a;
this._autoScrollAttenuate = !0;
this._autoScrollStartPosition = this.target.getContainerPosition();
this._autoScrollTotalTime = b;
this._autoScrollAccumulatedTime = 0;
this._autoScrollBraking = !1;
this._autoScrollBrakingStartPosition = cc.p(0, 0);
b = this.getHowMuchOutOfBoundary();
!this.fltEqualZero(b) && (this._autoScrollCurrentlyOutOfBoundary = !0,
a = this.getHowMuchOutOfBoundary(a),
0 < b.x * a.x || 0 < b.y * a.y) && (this._autoScrollBraking = !0,
this._autoScrollBrakingStartPosition = this.target.getContainerPosition())
}
;
cleverapps.UI.ScrollHandler.prototype.stopAutoScroll = function() {
this._autoScrolling = !1
}
;
cleverapps.UI.ScrollHandler.prototype.getHowMuchOutOfBoundary = function(a) {
void 0 === a && (a = cc.p(0, 0));
if (0 === a.x && 0 === a.y && !this._outOfBoundaryAmountDirty)
return this._outOfBoundaryAmount;
var b = cc.p(0, 0)
, c = this.target.getContainerPosition();
c.x + a.x > this.target.max.x ? b.x = this.target.max.x - (c.x + a.x) : c.x + a.x < this.target.min.x && (b.x = this.target.min.x - (c.x + a.x));
c.y + a.y < this.target.min.y ? b.y = this.target.min.y - (c.y + a.y) : c.y + a.y > this.target.max.y && (b.y = this.target.max.y - (c.y + a.y));
0 === a.x && 0 === a.y && (this._outOfBoundaryAmount = b,
this._outOfBoundaryAmountDirty = !1);
return b
}
;
cleverapps.UI.ScrollHandler.prototype.isProcessing = function() {
return this.inTouch || this._autoScrolling
}
;
cleverapps.styles.ScrollHandler = {
mouseWheelAcceleration: 200,
mouseWheelMinSpeed: 500,
mouseWheelMaxSpeed: 2E3
};
cc.ScrollAction = cc.ActionInterval.extend({
ctor: function(a, b) {
cc.ActionInterval.prototype.ctor.call(this);
this._params = b || {};
b = void 0 === this._params.duration ? cc.ScrollAction.SCROLL_TO_DURATION : this._params.duration;
this._params.silent && (b = 0);
this._creationStack = Error().stack;
this._targetNode = a;
cc.ActionInterval.prototype.initWithDuration.call(this, b)
},
startWithTarget: function(a) {
cc.ActionInterval.prototype.startWithTarget.call(this, a);
this._startPosition = this.target.getContainerPosition();
a.isMapScroll && cleverapps.focusManager.isFocused() && !this._params.allowScrollWithFocus && !Game.currentGame.tutorial.isActive() ? this._params.skipFocusReport || cleverapps.throwAsync("Trying to scroll with focus, stack - " + this._creationStack) : this._targetNode instanceof cc.Node && !this._targetNode.isRunning() || (a.stopAutoScroll(),
cc.ScrollAction._UID++,
this._UID = cc.ScrollAction._UID,
"number" === typeof this._targetNode ? this._targetPosition = this.target.normalizePoint(this.target.targetToPoint(this._targetNode, this._params.padding)) : !this._targetNode || "object" === typeof this._targetNode && this._targetNode.stopListeners ? this._targetPosition = this._startPosition : this._params.targetPoint ? this._targetPosition = this._targetNode : this._params.visibleBox ? (a = this.target.calcNodeDelta(this._targetNode, this._params),
this._targetPosition = cc.pAdd(this._startPosition, a)) : this._targetPosition = this.target.normalizePoint(this.target.targetToPoint(this._targetNode, this._params.padding)))
},
clone: function() {
return new cc.ScrollAction(this._targetNode,this._params)
},
stop: function() {
cc.ScrollAction._UID === this._UID && (this.target._scrollActionRunning = !1)
},
update: function(a) {
cc.ScrollAction._UID === this._UID && (a = this._computeEaseTime(a),
this.target.scrollToPoint(cc.pAdd(this._startPosition, cc.pMult(cc.pSub(this._targetPosition, this._startPosition), a))),
this.target._scrollActionRunning = !0)
}
});
cc.ScrollAction._UID = 0;
cc.ScrollAction.SCROLL_TO_DURATION = 1;
cc.CellScrollAction = cc.ScrollAction.extend({
ctor: function(a, b) {
this._cellPos = {
x: a.x,
y: a.y
};
a = Map2d.currentMap.getMapView().getCell(this._cellPos.x, this._cellPos.y);
this._super(a, b)
},
clone: function() {
return new cc.CellScrollAction(this._cellPos,this._params)
}
});
cleverapps.UI.MapScrollHandler = function(a) {
this.target = a;
this.bounceEnabled = !1;
this.initAutoScrollParams()
}
;
cleverapps.UI.MapScrollHandler.prototype.initAutoScrollParams = function() {
this._outOfBoundaryAmountDirty = !0;
this._outOfBoundaryAmount = cc.p(0, 0)
}
;
cleverapps.UI.MapScrollHandler.prototype.afterContainerMove = function() {
this._outOfBoundaryAmountDirty = !0
}
;
cleverapps.UI.MapScrollHandler.prototype.handlePress = function() {
this._autoScrolling = !1;
this._touchMovePreviousTimestamp = Date.now();
this._touchMoveDisplacements = [];
this._touchMoveTimeDeltas = []
}
;
cleverapps.UI.MapScrollHandler.prototype.gatherMoveData = function(a) {
var b = this.getHowMuchOutOfBoundary(a);
a.x += b.x;
for (a.y += b.y; 5 <= this._touchMoveDisplacements.length; )
this._touchMoveDisplacements.splice(0, 1),
this._touchMoveTimeDeltas.splice(0, 1);
this._touchMoveDisplacements.push(a);
a = Date.now();
this._touchMoveTimeDeltas.push((a - this._touchMovePreviousTimestamp) / 1E3);
this._touchMovePreviousTimestamp = a
}
;
cleverapps.UI.MapScrollHandler.prototype.handleRelease = function(a) {
this.gatherMoveData(a);
a = this.calcTouchVelocity();
0 === a.x && 0 === a.y || this.startInertialScroll(a)
}
;
cleverapps.UI.MapScrollHandler.prototype.processAutoScroll = function(a) {
if (this._autoScrolling) {
var b = this.isNecessaryAutoScrollBrake() ? .05 : 1;
this._autoScrollAccumulatedTime += 1 / b * a;
b = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime);
this._autoScrollAttenuate && (--b,
b = b * b * b * b * b + 1);
a = cc.pAdd(this._autoScrollStartPosition, cc.pMult(this._autoScrollTargetDelta, b));
b = 1E-4 >= Math.abs(b - 1);
var c = cc.pSub(a, this.target.getContainerPosition());
c = this.getHowMuchOutOfBoundary(c);
this.fltEqualZero(c) || (a.x += c.x,
a.y += c.y,
b = !0);
b && (this._autoScrolling = !1);
this.target.moveContainer(cc.pSub(a, this.target.getContainerPosition()))
}
}
;
cleverapps.UI.MapScrollHandler.prototype.isOutOfBoundary = function() {
var a = this.getHowMuchOutOfBoundary();
return !this.fltEqualZero(a)
}
;
cleverapps.UI.MapScrollHandler.prototype.calcTouchVelocity = function() {
var a = this._touchMoveTimeDeltas.reduce(function(c, d) {
return c + d
}, 0);
if (0 === a || a >= this._touchTotalTimeThreshold)
return cc.p(0, 0);
var b = cc.p(0, 0);
this._touchMoveDisplacements.forEach(function(c) {
b.x += c.x;
b.y += c.y
});
return cc.pMult(b, 1 / a)
}
;
cleverapps.UI.MapScrollHandler.prototype.isNecessaryAutoScrollBrake = function() {
if (this._autoScrollBraking)
return !0;
if (this.isOutOfBoundary()) {
if (!this._autoScrollCurrentlyOutOfBoundary)
return this._autoScrollBraking = this._autoScrollCurrentlyOutOfBoundary = !0,
this._autoScrollBrakingStartPosition = this.getContainerPosition(),
!0
} else
this._autoScrollCurrentlyOutOfBoundary = !1;
return !1
}
;
cleverapps.UI.MapScrollHandler.prototype.startInertialScroll = function(a) {
var b = cc.pMult(a, .7);
a = this.calculateAutoScrollTimeByInitialSpeed(cc.pLength(a));
this.startAutoScroll(b, a, !0)
}
;
cleverapps.UI.MapScrollHandler.prototype.calculateAutoScrollTimeByInitialSpeed = function(a) {
return Math.sqrt(Math.sqrt(a / 5))
}
;
cleverapps.UI.MapScrollHandler.prototype.fltEqualZero = function(a) {
return 1E-4 >= Math.abs(a.x) && 1E-4 >= Math.abs(a.y)
}
;
cleverapps.UI.MapScrollHandler.prototype.startAutoScroll = function(a, b) {
this._autoScrolling = !0;
this._autoScrollTargetDelta = a;
this._autoScrollAttenuate = !0;
this._autoScrollStartPosition = this.target.getContainerPosition();
this._autoScrollTotalTime = b;
this._autoScrollAccumulatedTime = 0;
this._autoScrollBraking = !1;
this._autoScrollBrakingStartPosition = cc.p(0, 0);
b = this.getHowMuchOutOfBoundary();
!this.fltEqualZero(b) && (this._autoScrollCurrentlyOutOfBoundary = !0,
a = this.getHowMuchOutOfBoundary(a),
0 < b.x * a.x || 0 < b.y * a.y) && (this._autoScrollBraking = !0)
}
;
cleverapps.UI.MapScrollHandler.prototype.stopAutoScroll = function() {
this._autoScrolling = !1
}
;
cleverapps.UI.MapScrollHandler.prototype.getHowMuchOutOfBoundary = function(a) {
void 0 === a && (a = cc.p(0, 0));
if (0 === a.x && 0 === a.y && !this._outOfBoundaryAmountDirty)
return this._outOfBoundaryAmount;
var b = cc.p(0, 0)
, c = this.target.container.getBoundingBox();
0 < c.x + a.x ? b.x = -(c.x + a.x) : c.width + c.x + a.x < this.target.width && (b.x = this.target.width - (c.width + c.x + a.x));
c.height + c.y + a.y < this.target.height ? b.y = this.target.height - (c.height + c.y + a.y) : 0 < c.y + a.y && (b.y = -(c.y + a.y));
0 === a.x && 0 === a.y && (this._outOfBoundaryAmount = b,
this._outOfBoundaryAmountDirty = !1);
return b
}
;
cleverapps.UI.Button = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.settings = a;
!a.type && cleverapps.environment.isEditorScene() && (a.type = cleverapps.styles.UI.Button.Images.editor);
!a.textVariant && cleverapps.environment.isEditorScene() && (a.textVariant = "strict");
a.type && a.type.button_png || (a.type = cleverapps.styles.UI.Button.Images.button_green);
this.bright = !0;
this.createBackground();
if (a.text || a.textOff)
this.font = this.workFont(a.textVariant);
if (a.text && a.type.widthByContent) {
a.content = this.createText(a.text, a);
var b = this.calcPadding();
b = Math.min(a.content.width + b.left + b.right, .9 * cleverapps.resolution.getSceneSize().width);
this.resize(b, a.content.height);
delete a.text
}
this.content = a.content;
this.contentOff = a.contentOff;
var c = this.calcInnerRect();
[this.content, this.contentOff].forEach(function(d) {
d && cleverapps.UI.fitToBox(d, {
width: c.width,
height: c.height
})
}, this);
a.text && (this.content = this.createText(a.text, a, c));
a.textOff && (this.contentOff = this.createText(a.textOff, a, c));
[this.content, this.contentOff].forEach(function(d) {
d && (this.addChild(d),
d.setPosition(c.x + c.width / 2, c.y + c.height / 2))
}, this);
this._toggleContent(!0);
this.content instanceof cleverapps.UI.LabelTTF && (this.text = this.content);
this.contentOff instanceof cleverapps.UI.LabelTTF && (this.textOff = this.contentOff);
this.hoverHandler = cleverapps.UI.applyHover(this, {
filter: a.filter,
onMouseOver: this.onMouseOver.bind(this),
onMouseOut: this.onMouseOut.bind(this)
});
this.clickHandler = cleverapps.UI.onClick(this, function() {
this.action()
}
.bind(this), {
filter: a.filter
});
a.mark && this.setAttention(!0);
a.disabled && this.disable()
},
setAttention: function(a) {
a && this.mark || (a ? (this.mark = new Attention,
this.mark.setPositionRound(this.settings.type.mark || cleverapps.styles.UI.Button.mark),
this.addChild(this.mark)) : this.mark && (this.mark.removeFromParent(),
delete this.mark))
},
calcInnerRect: function() {
var a = this.calcPadding();
return cc.rect(a.left, a.bottom, this.width - a.left - a.right, this.height - a.bottom - a.top)
},
calcPadding: function() {
var a = this.settings.type.SKIP_RESOLUTION ? this.settings.type.SKIP_RESOLUTION.padding : cleverapps.styles.UI.Button.SKIP_RESOLUTION.padding;
return {
left: Math.floor(this.height * a.left),
right: Math.floor(this.height * a.right),
bottom: Math.floor(this.height * a.bottom),
top: Math.floor(this.height * a.top)
}
},
createText: function(a, b, c) {
if (TextWithIcon.IsApplicable(a, b.icons))
return new TextWithIcon(a,{
font: this.font,
width: c && c.width,
height: c && c.height,
icons: b.icons
});
a = cleverapps.UI.generateOnlyText(a, this.font);
c && a.fitTo(c.width, c.height);
return a
},
guessFontSize: function() {
var a = cleverapps.styles.UI.Button;
return Math.min(a.maxFontSize, Math.round(this.height * cleverapps.styles.FONTS.BUTTON_TEXT.size / a.defaultSize))
},
showAlert: function() {
!this.disabled && this.settings.spine && this.background.hasAnimation("alert") && this.background.addAnimation(0, "alert", !1)
},
setMarkVisible: function(a) {
this.mark && this.mark.setVisible(a)
},
showHint: function(a) {
var b = new cc.Sequence(new cc.DelayTime(1),new cc.CallFunc(function() {
this.isDisplayed() && !this.hint && (this.hint = new cleverapps.UI.Tooltip(this.background,{
text: a,
size: cleverapps.styles.UI.Button.tooltipSize,
location: this.settings.hintLocation
}),
cleverapps.scenes.getMovingNode(this).addChild(this.hint))
}
.bind(this)));
b.setTag(cleverapps.UI.Button.HINT_ACTION_TAG);
this.runAction(b)
},
hideHint: function() {
this.stopActionByTag(cleverapps.UI.Button.HINT_ACTION_TAG);
this.hint && (this.hint.removeFromParent(),
this.hint = void 0)
},
createBackground: function() {
if (this.settings.noBg)
this.setContentSize2(this.settings.width, this.settings.height);
else {
if (this.settings.spine) {
var a = this.settings.width;
var b = this.settings.height;
var c = new cleverapps.Spine(this.settings.spine);
this.settings.skin && c.setSkin(this.settings.skin);
c.setAnimation(0, "idle", !0)
} else
c = cleverapps.UI.createScale9Sprite(this.settings.type.button_png, void 0 !== this.settings.scale9Rect ? this.settings.scale9Rect : cleverapps.UI.Scale9Rect.TwoPixelX),
a = this.settings.width || c.width,
b = this.settings.height || c.height;
this.background = c;
this.addChild(c);
this.resize(a, b)
}
},
workFont: function(a) {
a = cleverapps.clone(cleverapps.UI.Button.WorkFont(a));
var b = this.guessFontSize();
b && (a.size = b);
return a
},
setString: function(a) {
this._setString(this.content, this.text, a)
},
setStringOff: function(a) {
this._setString(this.contentOff, this.textOff, a)
},
_setString: function(a, b, c) {
var d = this.calcInnerRect();
a instanceof TextWithIcon ? (a.textOptions.width = d.width,
a.textOptions.height = d.height,
a.setString(c)) : (b.setFont(this.font),
b.setString(c),
b.fitTo(d.width, d.height))
},
setTextVariant: function(a) {
this.text && (this.font = this.workFont(a),
this.text.setFont(this.font),
this.setString(this.text.getString()));
this.content instanceof TextWithIcon && (this.font = this.workFont(a),
this.content.setFont(this.font))
},
setType: function(a) {
a && a.button_png || (a = cleverapps.styles.UI.Button.Images.button_green);
this.settings.type = a;
this._innerUpdateBgContent()
},
resize: function(a, b) {
if (a !== this.width || b !== this.height) {
this.setContentSize2(a, b);
var c = this.calcInnerRect();
[this.content, this.contentOff].forEach(function(d) {
d && d.setPosition(c.x + c.width / 2, c.y + c.height / 2)
}, this);
this.background.setPosition(this.width / 2, this.height / 2);
this.settings.spine || (this.settings.type.keepRadius || cleverapps.styles.UI.Button.keepRadius && !1 !== this.settings.type.keepRadius || this.settings.keepRadius ? (this.background.setScale(b / this.background.height),
this.background.setContentSize2(a / this.background.scale, this.background.height)) : this.background.setContentSize2(a, b))
}
},
applyInteractiveScale: function() {
if (!this.disabled) {
var a = this.baseScaleX || this.baseScale || 1
, b = this.baseScaleY || this.baseScale || 1
, c = this.getInteractiveStates();
c.mouseover || c.pressed ? this.setScale(1.03 * a, 1.03 * b) : this.setScale(a, b);
this._innerUpdateBgContent()
}
},
action: function() {
!this.disabled && this._isAncestorsVisible(this) && (cleverapps.audio.playSound(this.settings.click_effect || bundles.main.urls.click_effect),
this.settings.onClicked(),
this.settings.selectOnClick && (this.selected = !this.selected,
this._innerUpdateBgContent()))
},
setBright: function(a) {
this.bright = a;
this._innerUpdateBgContent()
},
disable: function() {
this.disabled || (this.onMouseOut(),
this.setMarkVisible(!1),
this.disabled = !0,
this.clickHandler.setEnabled(!1),
this._innerUpdateBgContent())
},
enable: function() {
this.disabled && (this.disabled = !1,
this.setMarkVisible(!0),
this.clickHandler.setEnabled(!0),
this._innerUpdateBgContent())
},
onMouseOver: function() {
if (this.disabled)
this.settings.onDisableHint && this.showHint(this.settings.onDisableHint);
else if (this.settings.onMouseOver)
this.settings.onMouseOver();
else
this.applyInteractiveScale(),
this.settings.hint && this.showHint(this.settings.hint)
},
onMouseOut: function() {
if (this.disabled)
this.settings.onDisableHint && this.hideHint();
else if (this.settings.onMouseOut)
this.settings.onMouseOut();
else
this.applyInteractiveScale(),
this.settings.hint && this.hideHint()
},
_toggleContent: function(a) {
this.content && this.contentOff && (a ? (this.content.setVisible(!0),
this.contentOff.setVisible(!1)) : (this.content.setVisible(!1),
this.contentOff.setVisible(!0)))
},
_innerUpdateBgContent: function() {
var a = this.bright && !this.disabled
, b = this.getInteractiveStates();
if (this.settings.spine) {
var c = "idle";
b.pressed && this.background.hasAnimation("idle_on") ? c = "idle_on" : !a && this.background.hasAnimation("idle_off") && (c = "idle_off");
this.background.setAnimation(0, c, !0)
} else
this.background && (c = this.settings.type.button_off_png,
b.pressed || this.selected ? c = this.settings.type.button_on_png : a && (c = this.settings.type.button_png),
this.background.setSpriteFrame(c)),
this._toggleContent(a)
},
_isAncestorsVisible: function(a) {
return null == a ? !0 : (a = a.getParent()) && !a.isVisible() ? !1 : this._isAncestorsVisible(a)
}
});
cleverapps.UI.Button.HINT_ACTION_TAG = 2;
cleverapps.UI.Button.TEXT_REGULAR = "regular";
cleverapps.UI.Button.TEXT_EMPHASIS = "emphasis";
cleverapps.UI.Button.WorkFont = function(a) {
cleverapps.UI.Button.Fonts || (cleverapps.UI.Button.Fonts = {
regular: {
size: 0
},
emphasis: {
size: 0
},
strict: {
size: 0
},
strict_white: {
size: 0
},
strict_black: {
size: 0
},
strict_blue: {
size: 0
},
strict_red: {
size: 0
}
},
cleverapps.overrideFonts(cleverapps.UI.Button.Fonts, {
regular: cleverapps.styles.FONTS.BUTTON_TEXT,
emphasis: cleverapps.styles.FONTS.BUTTON_TEXT,
strict: cleverapps.styles.FONTS.STRICT_TEXT,
strict_white: cleverapps.styles.FONTS.STRICT_WHITE_TEXT,
strict_black: cleverapps.styles.FONTS.STRICT_BLACK_TEXT,
strict_blue: cleverapps.styles.FONTS.STRICT_BLUE_TEXT,
strict_red: cleverapps.styles.FONTS.STRICT_RED_TEXT
}),
cleverapps.UI.Button.Fonts.emphasis.color = cleverapps.styles.COLORS.COLOR_RED);
return a && cleverapps.UI.Button.Fonts[a] || cleverapps.UI.Button.Fonts.regular
}
;
cleverapps.styles.UI.Button = {
keepRadius: !1,
maxFontSize: 65,
SKIP_RESOLUTION: {
padding: {
left: .3,
right: .3,
top: .05,
bottom: .05
}
},
defaultSize: 90,
tooltipSize: {
width: 300,
height: 80
},
mark: {
x: {
align: "right",
dx: 15
},
y: {
align: "top",
dy: 10
}
}
};
cleverapps.styles.UI.Button.Images = cleverapps.overrideTemplates({}, {
button_green: {
button_png: bundles.buttons.frames.button_png,
button_on_png: bundles.buttons.frames.button_on_png,
button_off_png: bundles.buttons.frames.button_disabled_png
},
button_blue: {
button_png: bundles.buttons.frames.blue_button_png,
button_on_png: bundles.buttons.frames.blue_button_on_png,
button_off_png: bundles.buttons.frames.button_disabled_png
},
button_red: {
button_png: bundles.buttons.frames.red_button,
button_on_png: bundles.buttons.frames.red_button_on,
button_off_png: bundles.buttons.frames.button_disabled_png
},
button_purple: {
button_png: bundles.buttons.frames.purple_button_png,
button_on_png: bundles.buttons.frames.purple_button_on_png,
button_off_png: bundles.buttons.frames.button_disabled_png
},
small_button_blue: {
button_png: bundles.buttons.frames.small_blue_button,
button_on_png: bundles.buttons.frames.small_blue_button_on,
button_off_png: bundles.buttons.frames.small_button_off
},
small_button_green: {
button_png: bundles.buttons.frames.small_button,
button_on_png: bundles.buttons.frames.small_button_on,
button_off_png: bundles.buttons.frames.small_button_off
},
chat: {
button_png: bundles.chat.frames.accept_button,
button_on_png: bundles.chat.frames.accept_button_on
},
chat_categories: {
button_png: bundles.chat.frames.category_bg,
button_on_png: bundles.chat.frames.category_bg_on,
button_off_png: bundles.chat.frames.active_category_bg,
widthByContent: !0
},
field_button_green: {
button_png: bundles.buttons.frames.field_green_button,
button_on_png: bundles.buttons.frames.field_green_button_on,
button_off_png: bundles.buttons.frames.field_button_off
},
field_button_blue: {
button_png: bundles.buttons.frames.field_blue_button,
button_on_png: bundles.buttons.frames.field_blue_button_on,
button_off_png: bundles.buttons.frames.field_button_off
}
});
bundles.stickers_collection_window && cleverapps.overrideTemplates(cleverapps.styles.UI.Button.Images, {
wildcard_button_green: {
button_png: bundles.stickers_collection_window.frames.wild_card_button_png,
button_on_png: bundles.stickers_collection_window.frames.wild_card_button_on_png,
button_off_png: bundles.stickers_collection_window.frames.wild_card_button_off_png,
keepRadius: !1,
SKIP_RESOLUTION: {
padding: {
left: .15,
right: .15,
top: .12,
bottom: .18
}
}
}
});
cleverapps.config.debugMode && cleverapps.overrideTemplates(cleverapps.styles.UI.Button.Images, {
git: {
button_png: bundles.git.frames.button,
button_on_png: bundles.git.frames.button_on,
button_off_png: bundles.git.frames.button_off,
SKIP_RESOLUTION: {
padding: {
left: .1,
right: .1,
top: .1,
bottom: .1
}
}
},
editor: {
button_png: bundles.editor_buttons.frames.button,
button_on_png: bundles.editor_buttons.frames.button_on,
button_off_png: bundles.editor_buttons.frames.button_off,
SKIP_RESOLUTION: {
padding: {
left: .1,
right: .1,
top: .1,
bottom: .1
}
}
},
editor_plus: {
button_png: bundles.admin.frames.plus_button,
button_on_png: bundles.admin.frames.plus_button,
button_off_png: bundles.admin.frames.plus_button
},
wysiwyg: {
button_png: bundles.wysiwyg.frames.button_on,
button_on_png: bundles.wysiwyg.frames.button_on,
button_off_png: bundles.wysiwyg.frames.button_off,
SKIP_RESOLUTION: {
padding: {
left: .05,
right: .05,
top: .05,
bottom: .05
}
}
}
});
cleverapps.UI.HelpButton = cleverapps.UI.Button.extend({
ctor: function(a) {
this._super({
type: {
button_png: bundles.help_button.frames.help_button_png,
button_on_png: bundles.help_button.frames.help_button_on_png,
button_off_png: bundles.help_button.frames.help_button_off_png
},
onClicked: a
})
}
});
cleverapps.UI.LabelTTF = cc.LabelTTF.extend({
ctor: function(a, b, c) {
this._strokeOpacity = this._wrapWidth = 0;
this._super("", b);
this.setWrapWidth(c)
},
fitTo: function(a, b) {
cleverapps.UI.ImageFont.prototype.fitTo.apply(this, arguments);
this.debugRegionForFitTo = {
width: a,
height: b
}
},
canAttachLastLine: function() {
var a = this._renderCmd._strings;
if (!a || 1 >= a.length)
return !1;
var b = a[a.length - 1];
return this._string.slice(this._string.length - b.length - 1) === "\n" + b ? !1 : 10 <= a[a.length - 2].length && 2 >= b.length
},
setWrapWidth: function(a) {
a = 0 < a ? Math.min(a, this.maxWidth()) : Math.min(cleverapps.styles.UI.TTFText.wrapWidth, this.maxWidth());
this._wrapWidth !== a && (this._wrapWidth = a,
a = this.getString(),
cc.LabelTTF.prototype.setString.call(this, ""),
cc.LabelTTF.prototype.setString.call(this, a))
},
setDimensions: function(a, b) {
void 0 === b && (b = a.height,
a = a.width);
0 < a || (a = 0);
0 < b || (b = 0);
a = Math.min(a, this.maxWidth());
this._super(a, b)
},
setFontSize: function(a) {
cleverapps.styles.UI.glyphScale && -1 !== ["ja", "zh", "ko"].indexOf(cleverapps.settings.language) && (a = Math.round(a * cleverapps.styles.UI.glyphScale.scale));
this._super(a)
},
setFont: function(a) {
this.setFontFillColor(a.color || cleverapps.styles.COLORS.WHITE);
this.setFontSize(a.size);
a.shadow ? this.enableShadow(a.shadow.color, a.shadow.direction, a.shadow.blur) : this.disableShadow();
a.stroke ? this.enableStroke(a.stroke.color, a.stroke.size) : this.disableStroke();
a.lineHeight && this.setLineHeight(a.lineHeight);
a = this.getString();
cc.LabelTTF.prototype.setString.call(this, "");
cc.LabelTTF.prototype.setString.call(this, a)
},
enableStroke: function(a, b) {
this._super(a, b);
a = a.a / 255;
this._strokeOpacity !== a && (this._strokeOpacity = a,
this._renderCmd._setColorsString())
},
byLetterAnimation: function(a) {
a = a || {};
var b = a.speed || .03
, c = a.delay || .1;
if (connector.info.isMobile && !connector.info.isNative)
this.setOpacity(0),
this.runAction(new cc.Sequence(new cc.DelayTime(c),new cc.FadeIn(.3))),
a.callback && a.callback();
else {
this._fullString = this.getString();
var d = 0;
this._byLetterAnimationRunning && this.stopAllActions();
this._byLetterAnimationRunning = !0;
this._byLetterAnimationDone = function(g) {
this._byLetterAnimationRunning && (this.stopAllActions(),
this._byLetterAnimationRunning = !1,
cc.LabelTTF.prototype.setString.call(this, this._fullString),
this._byLetterAnimationDone = void 0,
a.callback && a.callback(g))
}
.bind(this);
cc.LabelTTF.prototype.setString.call(this, "");
var e = void 0
, f = function(g) {
this.runAction(new cc.Sequence(new cc.DelayTime(g),new cc.CallFunc(function() {
var h = 0 < d ? this._fullString[d - 1] : void 0;
d++;
var k = this._fullString[d - 1];
if (" " === h && " " !== k) {
for (h = d; h < this._fullString.length && " " !== this._fullString[h]; )
h++;
cc.LabelTTF.prototype.setString.call(this, this._fullString.substr(0, h));
e && this.height !== e && (this._fullString = this._fullString.substr(0, d - 2) + "\n" + this._fullString.substr(d - 1))
}
cc.LabelTTF.prototype.setString.call(this, this._fullString.substr(0, d));
d < this._fullString.length ? (f(b),
e = this.height) : this._byLetterAnimationDone && this._byLetterAnimationDone()
}
.bind(this))))
}
.bind(this);
f(c)
}
},
byLetterAnimationFinish: function() {
this._byLetterAnimationRunning && this._byLetterAnimationDone(!0)
},
setString: function(a, b) {
a = cleverapps.UI.LabelTTF.GetLocalizedText(a, b);
cc.LabelTTF.prototype.setString.call(this, a);
cleverapps.config.debugMode && (this.debugTextCode = Messages.debugTextCodes[a.toLowerCase().replace(/\s/g, ".")])
},
maxWidth: function() {
return cc._renderType !== cc.game.RENDER_TYPE_CANVAS ? cc.configuration.getMaxTextureSize() / cc.view.getDevicePixelRatio() : cleverapps.styles.UI.TTFText.wrapWidth
},
visitTextureBundle: function() {
cc.rendererBundle = "LabelTTF"
}
});
cleverapps.UI.LabelTTF.GetLocalizedText = function(a, b) {
return "number" === typeof a ? a + "" : "string" !== typeof a ? (a || "") + "" : Messages.get(a, b)
}
;
(function() {
"cocos2d" === engine && (cc.LabelTTF.prototype.setLineHeight = function(a) {
this._lineHeight = a;
this._setUpdateTextureDirty()
}
,
cc.LabelTTF.prototype._setUpdateTextureDirty = function() {
this._needUpdateTTF = this._needUpdateTexture = !0;
this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.textDirty)
}
,
cc.LabelTTF.RenderCmd.prototype._setColorsString = function() {
var a = this._displayedColor
, b = this._node
, c = b._shadowColor || this._displayedColor
, d = b._strokeColor
, e = b._textFillColor
, f = a.r / 255
, g = a.g / 255;
a = a.b / 255;
this._shadowColorStr = "rgba(" + (0 | f * c.r) + "," + (0 | g * c.g) + "," + (0 | a * c.b) + "," + b._shadowOpacity + ")";
this._fillColorStr = "rgba(" + (0 | f * e.r) + "," + (0 | g * e.g) + "," + (0 | a * e.b) + ", 1)";
this._strokeColorStr = "rgba(" + (0 | f * d.r) + "," + (0 | g * d.g) + "," + (0 | a * d.b) + "," + b._strokeOpacity + ")"
}
,
cc.LabelTTF.WebGLRenderCmd.prototype._setColorsString = cc.LabelTTF.RenderCmd.prototype._setColorsString,
cc.LabelTTF.CacheRenderCmd.prototype._setColorsString = cc.LabelTTF.RenderCmd.prototype._setColorsString,
cc.LabelTTF.CanvasRenderCmd.prototype._setColorsString = cc.LabelTTF.RenderCmd.prototype._setColorsString,
cc.LabelTTF.CacheCanvasRenderCmd.prototype._setColorsString = cc.LabelTTF.RenderCmd.prototype._setColorsString,
cc.LabelTTF.RenderCmd.prototype._updateTTF = function() {
var a = this._node;
if (a._needUpdateTTF) {
a._needUpdateTTF = !1;
var b = cc.view.getDevicePixelRatio()
, c = a._wrapWidth * b || 0
, d = a._dimensions.width * b || 0
, e = a._dimensions.height * b || 0;
this._measureConfig();
var f = 0
, g = 0;
a._strokeEnabled && (f = g = 2 * a._strokeSize);
a._shadowEnabled && (f += 2 * Math.abs(a._shadowOffset.x),
g += 2 * Math.abs(a._shadowOffset.y));
f *= b;
g *= b;
var h = f + 2 * b;
"normal" !== a._getFontStyle() && (h += Math.ceil(.3 * a._fontSize));
var k = this._strings = a._string.split("\n")
, m = d || c;
if (0 < m) {
var l = Math.max(h, m - h);
for (c = 0; c < k.length; ++c)
k[c] = k[c].trim(),
this._checkWarp(k, c, l);
m = d
}
this._isMultiLine = 1 < k.length;
if (!m) {
for (c = 0; c < k.length; ++c)
l = Math.ceil(this._measure(k[c])),
l > m && (m = l);
0 === m && (h = 0);
m += h
}
d = m;
cc._renderType !== cc.game.RENDER_TYPE_CANVAS && (d = Math.min(d, cc.configuration.getMaxTextureSize()));
b = e ? e : a.getLineHeight() * b * k.length + g;
a.setContentSize(d, b);
a._strokeShadowOffsetX = f;
a._strokeShadowOffsetY = g;
a = a._anchorPoint;
this._anchorPointInPoints.x = .5 * h + (d - h) * a.x;
this._anchorPointInPoints.y = .5 * g + (b - g) * a.y
}
}
,
cc.LabelTTF.WebGLRenderCmd.prototype._updateTTF = cc.LabelTTF.RenderCmd.prototype._updateTTF,
cc.LabelTTF.CacheRenderCmd.prototype._updateTTF = cc.LabelTTF.RenderCmd.prototype._updateTTF,
cc.LabelTTF.CanvasRenderCmd.prototype._updateTTF = cc.LabelTTF.RenderCmd.prototype._updateTTF,
cc.LabelTTF.CacheCanvasRenderCmd.prototype._updateTTF = cc.LabelTTF.RenderCmd.prototype._updateTTF,
cc.LabelTTF.RenderCmd.prototype._setFontStyle = function(a, b, c, d) {
this._fontStyleStr = a instanceof cc.FontDefinition ? a._getCanvasFontStr() : c + " " + d + " " + cc.view.getDevicePixelRatio() * b + "px '" + a + "'";
this._fontProperties = cc.LabelTTF.__getFontProperties(a, b);
this._fontClientHeight = this._fontProperties.ascent + this._fontProperties.descent
}
,
cc.LabelTTF.WebGLRenderCmd.prototype._setFontStyle = cc.LabelTTF.RenderCmd.prototype._setFontStyle,
cc.LabelTTF.CacheRenderCmd.prototype._setFontStyle = cc.LabelTTF.RenderCmd.prototype._setFontStyle,
cc.LabelTTF.CanvasRenderCmd.prototype._setFontStyle = cc.LabelTTF.RenderCmd.prototype._setFontStyle,
cc.LabelTTF.CacheCanvasRenderCmd.prototype._setFontStyle = cc.LabelTTF.RenderCmd.prototype._setFontStyle,
cc.LabelTTF._textBaseline = ["alphabetic", "alphabetic", "alphabetic"],
cc.LabelTTF.RenderCmd.prototype._saveStatus = function() {
var a = this._node
, b = a._strokeShadowOffsetX
, c = a._strokeShadowOffsetY
, d = a._contentSize.height - c
, e = a._vAlignment
, f = a._hAlignment
, g = .5 * b;
c = d + .5 * c;
var h = []
, k = a._contentSize.width - b
, m = cc.view.getDevicePixelRatio();
a = a.getLineHeight() * m;
b = this._fontProperties.ascent * m;
m *= this._fontProperties.descent;
b = b * a / (b + m);
m = m * a / (b + m);
f = f === cc.TEXT_ALIGNMENT_RIGHT ? k : f === cc.TEXT_ALIGNMENT_CENTER ? k / 2 : 0;
if (this._isMultiLine)
for (k = this._strings.length,
d = e === cc.VERTICAL_TEXT_ALIGNMENT_TOP ? -d + b : e === cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM ? -a * (k - 1) - m : -d / 2 - a * (k - 1) / 2 - (m - b) / 2,
e = 0; e < k; e++)
h.push(a * e + d | 0);
else
d = e === cc.VERTICAL_TEXT_ALIGNMENT_TOP ? -d + b : e === cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM ? -m : -d / 2 - (m - b) / 2,
h.push(d | 0);
g = {
contextTransform: cc.p(g, c),
xOffset: f,
OffsetYArray: h
};
this._status.push(g)
}
,
cc.LabelTTF.WebGLRenderCmd.prototype._saveStatus = cc.LabelTTF.RenderCmd.prototype._saveStatus,
cc.LabelTTF.CacheRenderCmd.prototype._saveStatus = cc.LabelTTF.RenderCmd.prototype._saveStatus,
cc.LabelTTF.CanvasRenderCmd.prototype._saveStatus = cc.LabelTTF.RenderCmd.prototype._saveStatus,
cc.LabelTTF.CacheCanvasRenderCmd.prototype._saveStatus = cc.LabelTTF.RenderCmd.prototype._saveStatus);
cc.LabelTTF.METRICS_STRING = "|\u00c9\u00c5\u00c7\u0639\u0631";
cc.LabelTTF.BASELINE_SYMBOL = "M";
cc.LabelTTF.__labelPropertiesCanvas = document.createElement("canvas");
cc.LabelTTF.__labelPropertiesContext = cc.LabelTTF.__labelPropertiesCanvas.getContext("2d");
cc.LabelTTF.__fontPropertiesCache = {};
cc.LabelTTF.__getFontProperties = function(a, b) {
if (a instanceof cc.FontDefinition) {
b = a.fontSize;
var c = a._getCanvasFontStr();
var d = a.fontStyle + " " + a.fontWeight + " " + a.fontSize + "px '" + a.fontName + "'"
} else
void 0 === b ? d = c = a : (c = a + "." + b,
d = b + "px '" + a + "'");
if (a = cc.LabelTTF.__fontPropertiesCache[c])
return a;
a = {
ascent: 0,
descent: 0
};
var e = cc.LabelTTF.__labelPropertiesCanvas
, f = cc.LabelTTF.__labelPropertiesContext;
f.font = d;
var g = cc.LabelTTF.METRICS_STRING + cc.LabelTTF.BASELINE_SYMBOL
, h = f.measureText(g);
if (h.actualBoundingBoxAscent && h.actualBoundingBoxDescent)
return cc.LabelTTF.__fontPropertiesCache[c] = a = {
ascent: h.actualBoundingBoxAscent,
descent: h.actualBoundingBoxDescent
};
var k = Math.ceil(h.width)
, m = f.measureText(cc.LabelTTF.BASELINE_SYMBOL);
h = Math.ceil(2 * m.width);
m = Math.ceil(1.4 * m.width);
if (!k || !h)
return {
ascent: Math.round(1.06 * b),
descent: Math.round(.3 * b)
};
e.width = k;
e.height = h;
f.fillStyle = "#f00";
f.fillRect(0, 0, k, h);
f.font = d;
f.textBaseline = "alphabetic";
f.fillStyle = "#000";
f.fillText(g, 0, m);
b = f.getImageData(0, 0, k, h).data;
d = 4 * k;
e = 0;
f = !1;
for (g = 0; g < m; ++g) {
for (k = 0; k < d; k += 4)
if (255 !== b[e + k]) {
f = !0;
break
}
if (f)
break;
e += d
}
a.ascent = m - g;
e = b.length - d;
f = !1;
for (g = h; g > m; --g) {
for (k = 0; k < d; k += 4)
if (255 !== b[e + k]) {
f = !0;
break
}
if (f)
break;
e -= d
}
a.descent = g - m;
return cc.LabelTTF.__fontPropertiesCache[c] = a
}
}
)();
cleverapps.overrideStyles(cleverapps.styles.UI, {
TTFText: {
wrapWidth: 1E3
}
});
cleverapps.Layout = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.options = b || {};
this.setAnchorPoint(.5, .5);
a.length && this.setItems(a)
},
setItems: function(a, b) {
this.removeAllChildren(b);
a.forEach(function(c) {
c && this.addChild(c)
}, this);
this.reshape()
},
reshape: function() {
this.children.forEach(function(a) {
a.setPosition(0, 0)
});
cleverapps.UI.arrangeWithMargins(this.children, this.options);
cleverapps.UI.wrap(this, {
considerRotation: !0
});
this.options.padding && cleverapps.UI.wrapWithPadding(this, this.options.padding, !0);
this.options.dimensions && cleverapps.UI.setDimensions(this, this.options.dimensions);
return this
},
setOptions: function(a) {
cleverapps.override(this.options, a);
this.reshape()
}
});
cleverapps.Layout.AsyncChild = cc.Node.extend({
ctor: function() {
this._super();
this.setAnchorPoint(.5, .5)
}
});
cleverapps.Layout.AsyncChild.prototype.reshape = function(a) {
this.setContentSize2(a.width * a.scaleX, a.height * a.scaleY);
this.addChild(a);
a.setPositionRound(this.width / 2, this.height / 2);
this.alignment && this.setPositionRound(this.alignment);
this.parent && this.parent.reshape && this.parent.reshape()
}
;
cleverapps.GridLayout = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.items = a.slice();
this.setAnchorPoint(.5, .5);
this.prepareOptions(b);
b.fitToBox && "auto" === this.options.columns && this.autoColumns();
this.reshape()
},
autoColumns: function() {
for (var a = 0, b = 1, c = 1; c <= Math.min(this.items.length, 3); c++) {
this.options.columns = Math.ceil(this.items.length / c);
this.splitItemsInRows();
this.calcCellsSize();
this.calcContentSize();
var d = Math.min(this.options.fitToBox.width / this.width, this.options.fitToBox.height / this.height);
d > a && (a = d,
b = this.options.columns)
}
this.options.columns = b
},
prepareOptions: function(a) {
a = a || {};
a.padding = a.padding || {};
a.margin = a.margin || {};
a.align = a.align || {};
a.separator = a.separator || {};
this.options = {
columns: a.columns || 1,
reverseRows: a.reverseRows || !1,
margin: {
x: a.margin.x || 0,
y: a.margin.y || 0
},
padding: {
left: a.padding.left || a.padding.x || 0,
right: a.padding.right || a.padding.x || 0,
top: a.padding.top || a.padding.y || 0,
bottom: a.padding.bottom || a.padding.y || 0
},
align: {
x: a.align.x || cleverapps.GridLayout.ALIGN_CENTER,
y: a.align.y || cleverapps.GridLayout.ALIGN_CENTER
},
cell: a.cell && {
width: a.cell.width || 0,
height: a.cell.height || 0
},
separator: {
horizontal: a.separator.horizontal,
map: a.separator.map
},
ascZOrder: a.ascZOrder,
fitToBox: a.fitToBox
}
},
setItems: function(a) {
this.items = a.slice();
this.reshape(!1)
},
calcCellsSize: function() {
var a = this.columnsWidth = []
, b = this.rowsHeight = [];
if (this.options.cell) {
for (var c = 0; c < this.rows.length; ++c)
b[c] = this.options.cell.height;
for (c = 0; c < this.options.columns; ++c)
a[c] = this.options.cell.width
} else
for (c = 0; c < this.rows.length; ++c)
for (var d = 0, e = this.rows[c]; d < e.length; ++d) {
var f = e[d];
a[d] = Math.max(Math.abs(f.width * f.scaleX), a[d] || 0);
b[c] = Math.max(Math.abs(f.height * f.scaleY), b[c] || 0)
}
},
splitItemsInRows: function() {
for (var a = this.rows = [], b = 0; b < this.items.length; b += this.options.columns)
a.push(this.items.slice(b, b + this.options.columns));
this.options.reverseRows || a.reverse()
},
calcContentSize: function() {
var a = this.options
, b = this.columnsWidth.reduce(function(d, e) {
return d + e + a.margin.x
}, 0) + a.padding.left + a.padding.right - a.margin.x
, c = this.rowsHeight.reduce(function(d, e) {
return d + e + a.margin.y
}, 0) + a.padding.bottom + a.padding.top - a.margin.y;
this.setContentSize(b, c)
},
reshape: function(a) {
this.removeAllChildren(a);
this.splitItemsInRows();
this.calcCellsSize();
this.calcContentSize();
a = this.options;
for (var b, c = a.padding.bottom, d = 0; d < this.rows.length; ++d) {
b = a.padding.left;
for (var e = this.rows[d], f = 0; f < e.length; ++f)
this.insertChild(e[f], b, c, d, f),
a.separator.horizontal && f !== e.length - 1 && (e[f].skipSeparator || this.addSeparator(a.separator.horizontal, b + this.columnsWidth[f], c, a.margin.x, this.rowsHeight[d])),
b += this.columnsWidth[f] + a.margin.x;
c += this.rowsHeight[d] + a.margin.y
}
},
insertChild: function(a, b, c, d, e) {
switch (this.options.align.x) {
case cleverapps.GridLayout.ALIGN_START:
var f = 0;
e = b;
break;
case cleverapps.GridLayout.ALIGN_END:
f = 1;
e = b + this.columnsWidth[e];
break;
default:
f = .5,
e = b + this.columnsWidth[e] / 2
}
switch (this.options.align.y) {
case cleverapps.GridLayout.ALIGN_START:
b = 0;
break;
case cleverapps.GridLayout.ALIGN_END:
b = 1;
c += this.rowsHeight[d];
break;
default:
b = .5,
c += this.rowsHeight[d] / 2
}
this.addChild(a);
a.setAnchorPoint(f, b);
a.setPositionRound(e, c);
this.options.ascZOrder && a.setLocalZOrder(this.rows.length - d)
},
addSeparator: function(a, b, c, d, e) {
var f = new cc.Sprite(a.icon || bundles.merge.frames.next_arrow);
f.setAnchorPoint(.5, .5);
f.setPositionRound(b + (a.x ? f.calculateCoordinate(a.x, "x", d) : d / 2), c + (a.y ? f.calculateCoordinate(a.y, "y", e) : e / 2));
this.addChild(f)
}
});
cleverapps.GridLayout.ALIGN_CENTER = 0;
cleverapps.GridLayout.ALIGN_START = 1;
cleverapps.GridLayout.ALIGN_END = 2;
cleverapps.WrapGridLayout = cleverapps.GridLayout.extend({
reshape: function() {
this.items.forEach(function(b) {
b.removeTemporarily(!1)
});
this.removeAllChildren();
this.splitItemsInRows();
var a = this.rows.map(function(b, c) {
b = new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: this.options.margin.x
});
this.options.ascZOrder && b.setLocalZOrder(this.rows.length - c);
return b
}, this);
a = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: this.options.margin.y,
padding: this.options.padding,
reversed: !0
});
this.setContentSize(a.getContentSize());
this.addChild(a);
a.setPositionRound(this.width / 2, this.height / 2);
this.options.fitToBox && cleverapps.UI.fitToBox(this, this.options.fitToBox)
}
});
cleverapps.UI.CarouselView = cc.Node.extend({
ctor: function(a, b) {
this._super(a, b);
this.items = a;
this.items.forEach(function(d, e) {
cleverapps.UI.onClick(d, function() {
this.setCurrent(e)
}
.bind(this))
}, this);
this.amount = a.length;
this.direction = b.direction;
this.onChange = b.onChange;
this.content = new cleverapps.Layout(a,b);
this.setAnchorPoint(.5, .5);
a = this.content.getContentSize();
b = cleverapps.resolution.getSceneSize();
this.direction === cleverapps.UI.HORIZONTAL ? a.width = Math.min(b.width, 2 * a.width) : a.height = Math.min(b.height, 2 * a.height);
this.setContentSize2(a);
this.addChild(this.content);
this.content.setPositionRound(this.width / 2, this.height / 2);
this.content.setAnchorPoint(0, .5);
var c = !1;
cleverapps.UI.onDrag(this, {
onDragStart: function() {
c = !1;
return !0
},
onDragMove: function(d) {
if (!c) {
var e = cleverapps.styles.CarouselView;
d = this.convertTouchToNodeSpaceDisplacement(d);
d = this.direction === cleverapps.UI.HORIZONTAL ? d.x : d.y;
Math.abs(d) > e.minDist && (this.setCurrent(this.current - cleverapps.sign(d)),
c = !0)
}
}
.bind(this)
});
this.setCurrent(0, !0)
},
setCurrent: function(a, b) {
if (!(a > this.amount - 1 || 0 > a) && this.current !== a) {
var c = this.items[a]
, d = cc.p(this.width / 2, this.height / 2);
this.direction === cleverapps.UI.HORIZONTAL ? d.x = this.width / 2 - c.x : d.y = this.height / 2 - c.y;
b ? (this.content.setPositionRound(d),
void 0 !== this.current && (this.items[this.current].setScale(1),
this.items[this.current].baseScale = 1),
this.items[a].setScale(1.2)) : (c = cc.pDistance(d, this.content.getPosition()),
c = Math.min(c / cleverapps.styles.CarouselView.speed, .3),
this.content.runAction(new cc.MoveTo(c,d)),
this.items[this.current].runAction(new cc.ScaleTo(c,1)),
this.items[this.current].baseScale = 1,
this.items[a].runAction(new cc.ScaleTo(c,1.2)));
this.items[a].baseScale = 1.2;
this.current = a;
this.onChange(a, b)
}
}
});
cleverapps.styles.CarouselView = {
minDist: 100,
speed: 1500
};
cleverapps.Shaders = {
GRAYSCALE_SPRITE_KEY: "grayscaleSprite",
OUTLINE_SPRITE_KEY: "outlineSprite",
FLICKER_SHADER_KEY: "flicker",
BLUR_FADE_KEY: "blur_fade",
BLUR_CURTAIN_KEY: "blur_curtain",
BLUR_CURTAIN_REVERSE_KEY: "blur_curtain_reverse",
VERTEX_SRC: " attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = CC_PMatrix * a_position; \n v_fragmentColor = a_color; \n v_texCoord = a_texCoord; \n}",
GRAYSCALE_SRC: "varying vec2 v_texCoord;\nvarying vec4 v_fragmentColor; \nvoid main(){ vec4 col = texture2D(CC_Texture0, v_texCoord);\n float gray = dot(col.rgb, vec3(0.25, 0.25, 0.25));\n gl_FragColor = v_fragmentColor * vec4(gray, gray, gray, col.a);\n}\n",
OUTLINE_SRC: " varying vec2 v_texCoord;\nvoid main()\n{\n vec4 color = texture2D(CC_Texture0, v_texCoord);\n vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n vec4 outlineColor = vec4(1, 0.96, 0.0, 1);\n gl_FragColor = color.a < 0.8 ? transparent : outlineColor;\n}\n",
OUTLINE_SINGLE_NODE_SRC: " varying vec2 v_texCoord;\nvoid main()\n{\n float d = 0.005;\n vec2 v_texCoord = v_texCoord;\n vec2 uvRight = vec2(v_texCoord.x + d, v_texCoord.y);\n vec2 uvTop = vec2(v_texCoord.x, v_texCoord.y - d);\n vec2 uvTopRight = vec2(v_texCoord.x + d, v_texCoord.y - d);\n vec4 color = texture2D(CC_Texture0, v_texCoord);\n float alpha = -4.0 * color.a;\n alpha += texture2D(CC_Texture0, v_texCoord).a;\n alpha += texture2D(CC_Texture0, uvTop).a;\n alpha += texture2D(CC_Texture0, uvRight).a;\n alpha += texture2D(CC_Texture0, uvTopRight).a;\n vec4 outlineColor = vec4(1, 0.96, 0.0, 1);\n gl_FragColor = color.a < 0.9 && alpha > 0.8 ? outlineColor : color;\n}\n",
FLICKER_FRAGM: "precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform float sineTime; \nuniform vec3 flickColor; \nvoid main() \n{ \n vec4 c = texture2D(CC_Texture0, v_texCoord); \n vec3 deltacolor = c.rgb * flickColor * sineTime;\n vec3 color = clamp(c.rgb + deltacolor, 0.0, 1.0);\n gl_FragColor = v_fragmentColor * vec4(color, c.a); \n}",
BLUR_TEMPLATE: "precision lowp float;\nvarying vec4 v_fragmentColor;\nvarying vec2 v_texCoord;\nuniform float u_blurOffset;\nuniform float u_extent;\nuniform float u_blurStrength;\n#define MAX_BLUR_WIDTH 4\nbool skipPixel(float y)\n{\n %{skipFunction}}\nvoid main()\n{\n vec2 u_blurOffset1 = vec2(0.0, float(u_blurOffset));\n vec2 u_blurOffset2 = vec2(float(u_blurOffset), 0.0);\n vec2 u_blurOffset3 = vec2(float(u_blurOffset) * sqrt(2.0), float(u_blurOffset) * sqrt(2.0));\n vec2 u_blurOffset4 = vec2(float(u_blurOffset) * sqrt(2.0), -float(u_blurOffset) * sqrt(2.0));\n vec4 color = texture2D(CC_Texture0, v_texCoord);\n if (skipPixel(v_texCoord.y)) {\n gl_FragColor = color;\n } else {\n float blurWidth = u_blurStrength * float(MAX_BLUR_WIDTH);\n vec4 blurColor = vec4(color.rgb, 1.0);\n for (int i = 1; i < MAX_BLUR_WIDTH; ++ i)\n {\n if ( float(i) >= blurWidth ) break; float weight = 1.0 - float(i) / blurWidth;\n weight = weight * weight * (3.0 - 2.0 * weight); // smoothstep\n vec4 sampleColor1 = texture2D(CC_Texture0, v_texCoord + u_blurOffset1 * float(i));\n vec4 sampleColor2 = texture2D(CC_Texture0, v_texCoord - u_blurOffset1 * float(i));\n vec4 sampleColor3 = texture2D(CC_Texture0, v_texCoord + u_blurOffset2 * float(i));\n vec4 sampleColor4 = texture2D(CC_Texture0, v_texCoord - u_blurOffset2 * float(i));\n vec4 sampleColor5 = texture2D(CC_Texture0, v_texCoord + u_blurOffset3 * float(i));\n vec4 sampleColor6 = texture2D(CC_Texture0, v_texCoord - u_blurOffset3 * float(i));\n vec4 sampleColor7 = texture2D(CC_Texture0, v_texCoord + u_blurOffset4 * float(i));\n vec4 sampleColor8 = texture2D(CC_Texture0, v_texCoord - u_blurOffset4 * float(i));\n blurColor += vec4(sampleColor1.rgb + sampleColor2.rgb + sampleColor3.rgb + sampleColor4.rgb + sampleColor5.rgb + sampleColor6.rgb + sampleColor7.rgb + sampleColor8.rgb, 8.0) * weight; \n }\n gl_FragColor = vec4(blurColor.rgb / blurColor.w, color.a);\n }\n}",
BLUR_FADE_FRAGM: "",
BLUR_CURTAIN_FRAGM: "",
BLUR_CURTAIN_REVERSE_FRAGM: "",
BLUR_FADE_SKIP: " return false;\n",
BLUR_CURTAIN_SKIP: " return y > u_extent;\n",
BLUR_CURTAIN_REVERSE_SKIP: " return y < (1. - u_extent);\n",
initialize: function() {
if ("undefined" !== typeof gl) {
var a = function(b, c, d) {
try {
var e = new cc.GLProgram;
e.initWithString(c, d);
e.addAttribute(cc.ATTRIBUTE_NAME_POSITION, cc.VERTEX_ATTRIB_POSITION);
e.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD, cc.VERTEX_ATTRIB_TEX_COORDS);
e.addAttribute(cc.ATTRIBUTE_NAME_COLOR, cc.VERTEX_ATTRIB_COLOR);
e.link();
e.updateUniforms();
cc.shaderCache.addProgram(e, b)
} catch (f) {
cleverapps.Shaders[b] = void 0,
console.log(f)
}
};
cleverapps.Shaders.initializing = !0;
a(cleverapps.Shaders.GRAYSCALE_SPRITE_KEY, cleverapps.Shaders.VERTEX_SRC, cleverapps.Shaders.GRAYSCALE_SRC);
a(cleverapps.Shaders.OUTLINE_SPRITE_KEY, cleverapps.Shaders.VERTEX_SRC, cleverapps.Shaders.OUTLINE_SRC);
a(cleverapps.Shaders.FLICKER_SHADER_KEY, cleverapps.Shaders.VERTEX_SRC, cleverapps.Shaders.FLICKER_FRAGM);
cleverapps.Shaders.BLUR_FADE_FRAGM = cleverapps.Shaders.BLUR_TEMPLATE.replace("%{skipFunction}", cleverapps.Shaders.BLUR_FADE_SKIP);
cleverapps.Shaders.BLUR_CURTAIN_FRAGM = cleverapps.Shaders.BLUR_TEMPLATE.replace("%{skipFunction}", cleverapps.Shaders.BLUR_CURTAIN_SKIP);
cleverapps.Shaders.BLUR_CURTAIN_REVERSE_FRAGM = cleverapps.Shaders.BLUR_TEMPLATE.replace("%{skipFunction}", cleverapps.Shaders.BLUR_CURTAIN_REVERSE_SKIP);
a(cleverapps.Shaders.BLUR_FADE_KEY, cleverapps.Shaders.VERTEX_SRC, cleverapps.Shaders.BLUR_FADE_FRAGM);
a(cleverapps.Shaders.BLUR_CURTAIN_KEY, cleverapps.Shaders.VERTEX_SRC, cleverapps.Shaders.BLUR_CURTAIN_FRAGM);
a(cleverapps.Shaders.BLUR_CURTAIN_REVERSE_KEY, cleverapps.Shaders.VERTEX_SRC, cleverapps.Shaders.BLUR_CURTAIN_REVERSE_FRAGM);
cleverapps.Shaders.initializing = !1
}
}
};
cleverapps.UI.Avatar = cc.Node.extend({
ctor: function(a, b, c) {
var d = a;
a && (a.avatar || a.id) && (d = a.avatar,
b = a.id);
this._super();
var e = b === connector.platform.getUserID()
, f = new cc.Sprite(e ? bundles.avatar.frames.user_avatar : bundles.avatar.frames.default_avatar);
this.addChild(f);
this.avatar = f;
a = a && !(a instanceof cc.SpriteFrame) && a.frame;
a || (a = cleverapps.skins.getSlot("avatarFramesBundle") || "avatar",
a = e ? bundles[a].frames.avatar_frame2 : bundles[a].frames.avatar_frame);
e = this.frame = new cc.Sprite(a);
e.setLocalZOrder(1);
this.addChild(e);
this.styles = c || cleverapps.styles.UI.Avatar;
this.setAnchorPoint(.5, .5);
this.setContentSize2(e.getContentSize());
f.setPositionRound(this.width / 2, this.height / 2 + (this.styles.bottom - this.styles.top) / 2);
e.setPositionRound(this.width / 2, this.height / 2);
this.adjustSize();
(this.image = d) && "string" === typeof d && connector.social.isLoggedIn() && b && 0 <= d.indexOf("fbsbx.com") && connector.social.oneOf(connector.FACEBOOK) && (this.avatarFBUserId = b,
this.onImageLoadErrorListener = this.createListener(this.onImageLoadError.bind(this)));
this.onImageLoadListener = this.createListener(this.onImageLoad.bind(this))
},
onImageLoadError: function() {
connector.social.aboutUser(this.avatarFBUserId, this.createListener(this.onFBUserLoaded.bind(this)))
},
onFBUserLoaded: function(a) {
if (a && a.avatar) {
this.image = a.avatar;
this.onImageLoadErrorListener = void 0;
this.setImage(this.image);
var b = {
avatar: this.image
};
cleverapps.RestClient.post("/info/" + this.avatarFBUserId, b, function() {}, function() {
console.log("Failed updating user avatar: " + b.avatar)
})
}
},
onEnter: function() {
this._super();
if (this.image) {
var a = !0;
["stub_128x128.gif", "camera_200.png"].forEach(function(b) {
"string" === typeof this.image && -1 !== this.image.indexOf(b) && (a = !1)
}
.bind(this));
a && this.setImage(this.image)
}
},
adjustSize: function() {
this.avatar.setScale((this.width - 2 * this.styles.x) / this.avatar.width, (this.height - this.styles.top - this.styles.bottom) / this.avatar.height)
},
onImageLoad: function(a, b) {
if (a) {
if (this.onImageLoadErrorListener)
this.onImageLoadErrorListener();
console.log("Error loading avatar image!")
} else
try {
var c = new cc.Sprite(b);
c.setPositionRound(this.width / 2, this.height / 2);
this.avatar.removeFromParent();
this.addChild(c);
this.avatar = c;
this.adjustSize()
} catch (d) {
console.log("Cross-domain??", d)
}
},
loadGif: function(a) {
connector.info.isNative || (a = a.replace("https:", "").replace("http:", ""));
if (a !== this.imageUrl) {
this.imageUrl = a;
try {
var b = new SuperGif;
b.load_url(a, this.createListener(function() {
if (a === this.imageUrl) {
var c = b.getFrames();
if (Array.isArray(c) && 0 < c.length) {
var d = new cc.Sprite(c[0]);
d.setPositionRound(this.width / 2, this.height / 2);
this.avatar.removeFromParent();
this.addChild(d);
this.avatar = d;
this.adjustSize();
var e = [];
c.forEach(function(f) {
e.push((new cc.Sprite(f)).getSpriteFrame())
});
c = new cc.Animation(e,.075);
this.avatar.runAction(new cc.RepeatForever(new cc.Animate(c)))
}
}
}
.bind(this)))
} catch (c) {
if (a === this.imageUrl && delete this.imageUrl,
console.log("Cross-domain??", c),
this.onImageLoadErrorListener)
this.onImageLoadErrorListener()
}
}
},
setImage: function(a) {
if (a)
if (a instanceof VirtualResource && (a = a.resolve().getSpriteFrame()),
a instanceof cc.SpriteFrame)
this.avatar.setSpriteFrame(a),
this.adjustSize();
else if ("string" !== typeof a)
console.log("avatar", a),
cleverapps.throwAsync("avatar image type error " + typeof a);
else if (a.startsWith("#") || a.startsWith("@"))
a = a.replace("#", "").replace("@", "").split("/"),
this.setImage(bundles[a[0]] && bundles[a[0]].frames[a[1]]);
else if (-1 !== a.indexOf(".gif"))
this.loadGif(a);
else {
a = decodeURIComponent(a);
var b = cleverapps.UI.Avatar.cache.get(a);
if (b)
this.onImageLoadListener(0, b);
else
cc.loader.loadImg(a, function(c, d) {
this.onImageLoadListener(c, d)
}
.bind(this))
}
}
});
cleverapps.UI.Avatar.cache = new cleverapps.Cache;
cleverapps.UI.Avatar.preload = function(a, b) {
b = b || function() {}
;
if (Array.isArray(a)) {
var c = cleverapps.wait(a.length, b);
a.forEach(function(e) {
cleverapps.UI.Avatar.preload(e.avatar || e, c)
})
} else if ("string" !== typeof a || 0 === a.indexOf("#") || -1 !== a.indexOf(".gif"))
b();
else {
a = decodeURIComponent(a);
var d = cleverapps.UI.Avatar.cache.get(a);
d ? b(d) : cc.loader.loadImg(a, function(e, f) {
e || cleverapps.UI.Avatar.cache.set(a, f);
b(!e && f)
})
}
}
;
cleverapps.Spine = cc.Node.extend({
ctor: function(a, b) {
this._super();
a = a instanceof VirtualJson ? a.resolve() : a;
cleverapps.config.wysiwygMode && "object" === typeof a && a.atlas && (b = a.atlas,
a = a.json);
this.jsonName = a;
var c = a instanceof VirtualJson ? a.bundleName : void 0
, d = cleverapps.bundleLoader.isLoaded(c);
if (!d && "loading_scene" !== c && a && c)
throw "Json " + a + " bundle " + c + " not loaded stack" + (cleverapps.bundleLoader.deleteStack && cleverapps.bundleLoader.deleteStack[c]);
if (void 0 === c && !b)
throw "Can't find bundle for json - " + a + " in bundles cache ";
var e = a;
b = b || bundles[c].atlas;
if ("string" === typeof b ? !cc.loader.getRes(b) : !b)
throw "Atlas " + e + " bundle " + c + " not loaded " + d;
if (c = cleverapps.Spine.getCachedData(a))
e = c.data,
b = c.atlas;
try {
var f = this.spine = sp.SkeletonAnimation.createWithJsonFile(e, b, a)
} catch (g) {
throw console.error(g),
cleverapps.config.debugMode ? (f = cleverapps.Spine.getGitPath(a) || {},
g.message = f.name + "\n" + f.link + "\n" + g) : g.message = a + "\n" + g,
Error(g.message);
}
f.jsonName = a;
e = {
data: f._skeletonData,
atlas: b
};
"cocos2d" === engine && (e.atlas = !0);
cleverapps.Spine.setCachedData(e, a, f.getSkin && f.getSkin());
this.data = cc.loader.getRes(a);
a = this.data.skeleton;
this.setContentSize2(a.width * resolutionScale, a.height * resolutionScale);
f.setPositionRound(this.width / 2, this.height / 2);
this.addChild(f);
(f = this.getAnchorBone()) ? this.setAnchorPoint((this.width / 2 + f.x) / this.width, (this.height / 2 + f.y) / this.height) : this.setAnchorPoint(.5, .5);
this.setCascadeOpacityEnabledRecursively(!0);
this.setRecCascadeColorEnabled(!0);
this.runningAnimation = void 0;
this.initialize();
cleverapps.config.debugMode && !cleverapps.config.wysiwygMode && ["highstaging", "highstagingpng", "highlocal"].includes(cleverapps.resolution.resolutionName) && this._checkProps();
cleverapps.Spine.debugSlots && this.setDebugSlots(!0);
cleverapps.Spine.debugBones && this.setDebugBones(!0)
},
initialize: function() {
this.setVisible(!1);
this.startVisibleListener = void 0
},
getAnchorBone: function() {
return this.data.bones.find(function(a) {
return "anchor" === a.name
})
},
setStartVisibleListener: function(a) {
this.startVisibleListener = a
},
setIdle: function(a) {
a !== this.idle && (this.idle = a,
this.setAnimation(0, this.idle, !0))
},
setIdleSet: function(a) {
var b = 0;
Object.values(a).forEach(function(d) {
b += d
});
var c = function() {
var d = this.setAnimation;
a: {
var e = Math.random() * b;
for (var f in a)
if (e -= a[f],
0 >= e) {
e = f;
break a
}
e = void 0
}
d.call(this, 0, e, !1);
this.setCompleteListener(c);
this.setSafeToRemove()
}
.bind(this);
c()
},
hasAnimation: function(a) {
return this.data.animations[a]
},
getAnimationData: function(a) {
return this.spine.findAnimation(a)
},
getAnimationDuration: function(a) {
if (a = this.getAnimationData(a))
return a.duration
},
hasSkin: function(a) {
return void 0 !== this.data.skins[a]
},
listAnimations: function() {
return Object.keys(this.data.animations)
},
setAnimation: function(a, b, c) {
this.getCurrentAnimationName() && this.setCompleteListener();
this.spine.setAnimation(a, b, c);
this.idle && (this.idle = void 0);
a = this.spine.jsonName;
this.data.animations[b] || cleverapps.throwAsync("Not found animation " + b + " in json " + a);
this.visible || (this.visible = !0,
this.startVisibleListener && this.startVisibleListener())
},
createAction: function(a, b, c) {
return new cc.SpineAction(this,a,b,c)
},
addAnimation: function(a, b, c, d) {
this.spine.addAnimation(a, b, c, d);
a = this.spine.jsonName;
this.data.animations[b] || cleverapps.throwAsync("Not found animation " + b + " in json " + a)
},
getCurrentState: function(a) {
return this.spine.getCurrent(a || 0)
},
getTimeLeft: function(a) {
a = this.getCurrentState(a);
return Math.max(0, ((a && a.animation && a.animation.duration || 0) - (a && a.trackTime || 0)) / this.getTimeScale())
},
getCurrentAnimationName: function(a) {
return (a = this.spine.getCurrent(a)) && a.animation && a.animation.name
},
setTimeScale: function(a) {
this.spine.setTimeScale(a)
},
getTimeScale: function() {
return this.spine.getTimeScale()
},
clearTrack: function(a) {
this.spine.clearTrack(a)
},
setSkin: function(a) {
this.spine.setSkin(a)
},
setStartListener: function(a) {
this.spine.setStartListener(a)
},
setCompleteListener: function(a) {
this.spine.setCompleteListener(a || function() {}
);
this._cantBeRemoved = !!a;
this.saveStack && this._cantBeRemoved && (this.actionStack = Error().stack)
},
setCompleteListenerRemove: function(a) {
this.setCompleteListener(function() {
a && a();
this.runAction(new cc.RemoveSelf)
}
.bind(this));
this.setSafeToRemove()
},
setCompleteListenerOnce: function(a) {
this.setCompleteListener(function() {
a();
this.setCompleteListener()
}
.bind(this))
},
setAnimationAndIdleAfter: function(a, b) {
this.setAnimation(0, a, !1);
this.addAnimation(0, b, !0)
},
setDebugSlots: function(a) {
this.spine.setDebugSolots(a)
},
setDebugBones: function(a) {
this.spine.setDebugBones(a)
},
_checkProps: function() {
if (cleverapps.UI.ImageFont.IsApplicable(cleverapps.styles.FONTS.WHITE_TEXT, "*")) {
var a = []
, b = this.data.bones[0];
if (b.scaleX && 1 !== b.scaleX || b.scaleY && 1 !== b.scaleY) {
var c = Math.max(b.scaleX ? Math.abs(1 - Math.abs(b.scaleX)) : 0, b.scaleY ? Math.abs(1 - Math.abs(b.scaleY)) : 0);
b = cleverapps.styles.COLORS.YELLOW;
.25 <= c ? b = cleverapps.styles.COLORS.COLOR_RED : .1 < c && (b = cleverapps.styles.COLORS.ORANGE);
c = cleverapps.UI.generateImageText("*", cleverapps.styles.FONTS.WHITE_TEXT);
c.setColor(b);
a.push(c)
}
c = 0;
for (var d in this.data.skins)
for (var e in this.data.skins[d])
for (var f in this.data.skins[d][e])
this.data.skins[d][e][f].vertices && (c += this.data.skins[d][e][f].vertices.length);
this._verts = c;
800 <= c && (d = cleverapps.UI.generateImageText("%", cleverapps.styles.FONTS.WHITE_TEXT),
a.push(d),
b = cc.color(255, 0, 0),
5E3 > c && (b = cc.color(185 * (c - 800) / 4200 + 70, -181 * (c - 800) / 4200 + 255, 11 * (c - 800) / 4200 + 63)),
d.setColor(b));
a = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: -20
});
a.setPosition(this.width, this.height);
this.addChild(a);
cleverapps.UI.onClick(a, function() {
cleverapps.sceneDebugger.selectNode(this)
}
.bind(this))
}
},
setSafeToRemove: function() {
this._cantBeRemoved = !1;
delete this.actionStack
},
isSaveToRemove: function() {
return !this._cantBeRemoved
},
getCurSkin: function() {
return this.spine._skeleton.skin ? this.spine._skeleton.skin.name : "default"
},
getBoundingBoxToWorld: function() {
var a = cc.rect(0, 0, this._contentSize.width, this._contentSize.height)
, b = this.getNodeToWorldTransform();
return cc.rectApplyAffineTransform(a, b)
},
_getBoundingBoxToCurrentNode: function(a) {
var b = cc.rect(0, 0, this._contentSize.width, this._contentSize.height);
a = void 0 === a ? this.getNodeToParentTransform() : cc.affineTransformConcat(this.getNodeToParentTransform(), a);
return cc.rectApplyAffineTransform(b, a)
},
unuse: function() {
this.removeTemporarily(!1);
this.setStartListener(void 0);
this.setCompleteListener(void 0);
this.clearTrack(0)
},
reuse: function() {
this.initialize()
},
getSkeletonData: function() {
return cc.loader.getRes(this.jsonName)
},
listSkins: function() {
var a = this.getSkeletonData();
return Object.keys(a.skins).filter(function(b) {
return "default" !== b
})
},
visitTextureBundle: function() {
this.jsonName instanceof VirtualJson && (cc.rendererBundle = this.jsonName.bundleName)
}
});
cleverapps.Spine.getCachedData = function(a, b) {
if (a instanceof VirtualJson)
return a = a.getCachedData(),
"creator" === engine && (a = a && a[b || "default"]),
a
}
;
cleverapps.Spine.setCachedData = function(a, b, c) {
if (b instanceof VirtualJson)
if ("cocos2d" === engine)
b.setCachedData(a);
else if ("creator" === engine) {
var d = b.getCachedData() || {};
d[c] || (d[c] = a);
b.setCachedData(d)
}
}
;
cleverapps.Spine.processJson = function(a) {
a = cleverapps.skins.getSlot("spine", {
json: a
});
return a instanceof VirtualJson ? a.resolve() : a
}
;
cleverapps.Spine.hasAnimation = function(a, b) {
return (b = cleverapps.Spine.getSkeletonData(b)) && b.animations && void 0 !== b.animations[a]
}
;
cleverapps.Spine.hasSkin = function(a, b) {
return (b = cleverapps.Spine.getSkeletonData(b)) && b.skins && void 0 !== b.skins[a]
}
;
cleverapps.Spine.getSkeletonData = function(a) {
return cc.loader.getRes(a.resolve())
}
;
cleverapps.Spine.isAnimationLoaded = function(a) {
if (a instanceof VirtualJson)
return a = cleverapps.skins.getSlot("spine", {
json: a
}).resolve(),
cleverapps.bundleLoader.isLoaded(a.bundleName)
}
;
cleverapps.Spine.removeSlot = function(a, b) {
a = a.resolve();
a = cleverapps.skins.getSlot("spine", {
json: a
});
a = cc.loader.getRes(a);
a.slots = a.slots.filter(function(c) {
return c.name !== b
});
Object.values(a.skins).forEach(function(c) {
delete c[b]
});
Object.values(a.animations).forEach(function(c) {
delete c.slots[b]
})
}
;
cleverapps.Spine.getGitPath = function(a) {
var b;
a instanceof VirtualResource && (b = a.resolve().originalPath());
if (b) {
var c = b.indexOf("/")
, d = b.substring(0, c);
"res" === d && (d = cleverapps.config.name,
c = -1);
b = "https://github.com/rvvslv/" + d + "/tree/master/" + b.substring(c + 1, b.lastIndexOf("/"));
return {
name: a.toString(),
link: b
}
}
}
;
cleverapps.Spine.cache = {};
cleverapps.Spine.GetPoolId = function(a) {
a instanceof cleverapps.Spine && (a = a.jsonName);
return "spine_" + a
}
;
cleverapps.Spine.GetFromPool = function(a) {
a = a instanceof VirtualJson ? a.resolve() : a;
return cc.pool.getFromPool(cleverapps.Spine, a) || new cleverapps.Spine(a)
}
;
var LazyAsset = cc.Node.extend({
ctor: function(a, b) {
this.options = b = b || {};
this.asset = void 0;
this.virtualResource = a.resolve();
this._pendingCalls = [];
this._super();
this.setAnchorPoint(.5, .5);
(b = this.virtualResource.getDimensions()) ? this.setContentSize2(b) : cleverapps.throwAsync("Empty dimensions for lazy asset " + this.virtualResource + " " + a);
this.createPreview();
cleverapps.lazyAssets.isLoaded(this.virtualResource) || cleverapps.lazyAssets.isPreferredBundle(this.virtualResource.getBundleName()) ? (this.loaded = !0,
cleverapps.lazyAssets.loadResource(this.virtualResource, this.createListener(this.createAsset.bind(this))),
this.options.keepLazy && cleverapps.lazyAssets.keepResource(this.virtualResource)) : cleverapps.throwAsync("Image is not allowed to be load " + this.virtualResource + " " + a)
},
cleanup: function() {
this._super();
this.loaded && (this.loaded = !1,
cleverapps.lazyAssets.deleteResource(this.virtualResource))
},
whenAssetLoaded: function(a) {
this.asset ? a() : this._pendingCalls.push(a)
},
isSpine: function() {
return this.virtualResource instanceof VirtualJson
},
createPreview: function() {
this.preview = this.options.preview || new cc.Sprite(bundles.merge.frames.unit_unknown);
this.preview.setPosition(this.width / 2, this.height / 2);
this.addChild(this.preview);
this.preview.setVisible(!1);
this.preview.runAction(new cc.Sequence(new cc.DelayTime(.2),new cc.Show))
},
createAsset: function() {
this.asset || (this.asset = this.virtualResource instanceof VirtualFrame ? new cc.Sprite(this.virtualResource) : new cleverapps.Spine(this.virtualResource),
this.asset.setPosition(this.width / 2, this.height / 2),
this.addChild(this.asset),
this.preview && (this.preview.isDisplayed() ? AnimationsLibrary.upgrade(this.preview, this.asset) : this.preview.removeFromParent(),
this.preview = void 0),
this._callPending())
},
_callPending: function() {
var a = !0;
this.addCleaner(function() {
a = !1
});
for (var b = 0; b < this._pendingCalls.length && a; b++) {
var c = this._pendingCalls[b];
"function" === typeof c ? c() : this.asset[c.method] && this.asset[c.method].apply(this.asset, c.args)
}
},
getAnimationData: function() {
return this.asset && this.asset.getAnimationData ? this.asset.getAnimationData.apply(this.asset, arguments) : void 0
},
getAnimationDuration: function() {
return this.asset && this.asset.getAnimationDuration ? this.asset.getAnimationDuration.apply(this.asset, arguments) : 0
},
getTimeLeft: function() {
return this.asset && this.asset.getTimeLeft ? this.asset.getTimeLeft.apply(this.asset, arguments) : 0
},
isSaveToRemove: function() {
return this.asset && this.asset.isSaveToRemove ? this.asset.isSaveToRemove.apply(this.asset, arguments) : !0
},
getTimeScale: function() {
return this.asset && this.asset.getTimeScale ? this.asset.getTimeScale.apply(this.asset, arguments) : 1
},
hasAnimation: function() {
return this.isSpine() ? this.asset ? this.asset.hasAnimation.apply(this.asset, arguments) : (cleverapps.throwAsync("using hasAnimation while resource not loaded " + this.virtualResource),
!1) : !1
},
setCompleteListener: function(a) {
this.asset && this.asset.setCompleteListener ? this.asset.setCompleteListener(a) : a && a()
},
setCompleteListenerRemove: function(a) {
this.asset && this.asset.setCompleteListenerRemove ? this.asset.setCompleteListenerRemove(a) : (a && a(),
this.removeFromParent())
},
setCompleteListenerOnce: function(a) {
this.asset && this.asset.setCompleteListenerOnce ? this.asset.setCompleteListenerOnce(a) : a && a()
},
_processMethodCall: function(a, b) {
this.asset ? this.asset[a] && this.asset[a].apply(this.asset, b) : this._pendingCalls.push({
method: a,
args: b
})
},
setIdle: function() {
this._processMethodCall("setIdle", arguments)
},
setIdleSet: function() {
this._processMethodCall("setIdleSet", arguments)
},
setAnimation: function() {
this._processMethodCall("setAnimation", arguments)
},
addAnimation: function() {
this._processMethodCall("addAnimation", arguments)
},
setTimeScale: function() {
this._processMethodCall("setTimeScale", arguments)
},
clearTrack: function() {
this._processMethodCall("clearTrack", arguments)
},
setSkin: function() {
this._processMethodCall("setSkin", arguments)
},
setAnimationAndIdleAfter: function() {
this._processMethodCall("setAnimationAndIdleAfter", arguments)
},
setSafeToRemove: function() {
this._processMethodCall("setSafeToRemove", arguments)
},
isLoaded: function() {
return !!this.asset
}
});
LazyAsset.TRY_LOAD_TIMEOUT = cleverapps.parseInterval("20 seconds");
var LazyAssets = function() {
cleverapps.EventEmitter.call(this);
this.kept = {};
this.preferred = {}
};
LazyAssets.prototype.unload = function() {
Object.values(this.kept).forEach(function(a) {
this.deleteResource(a)
}
.bind(this));
this.kept = {};
this.preferred = {}
}
;
LazyAssets.prototype.keepResource = function(a) {
this.kept[a] || (this.kept[a] = a,
this.loadResource(a))
}
;
LazyAssets.prototype.loadResource = function(a, b) {
cleverapps.bundleLoader.loadBundle(a.getBundleName(), {
onSuccess: b
})
}
;
LazyAssets.prototype.deleteResource = function(a) {
cleverapps.bundleLoader.deleteBundle(a.getBundleName())
}
;
LazyAssets.prototype.isLoaded = function(a) {
return cleverapps.bundleLoader.isLoaded(a.getBundleName())
}
;
LazyAssets.prototype.setPreferredBundles = function(a) {
cleverapps.toArray(a).forEach(function(b) {
bundles[b] && (this.preferred[b] = !0)
}
.bind(this))
}
;
LazyAssets.prototype.isPreferredBundle = function(a) {
return !!this.preferred[a]
}
;
cleverapps.FixedWidthScene = cc.Scene.extend({
listBundles: function() {
return []
},
cachedBundles: function() {
return []
},
lazyBundles: function() {
return []
},
destructor: function() {
Game.currentGame && (Game.currentGame.stop(),
Game.currentGame = void 0);
cleverapps.sideBar.clearListeners();
cleverapps.centerHint.destructor();
cleverapps.menuBar.clean();
cleverapps.aims.clear();
cleverapps.focusManager.clearTempControls();
this.updateDynamicNodesThrottled = this.updateDynamicNodes = cleverapps.EMPTY_FUNCTION;
this.performRecursive(function(a) {
cc.eventManager.removeListeners(a);
a.stopAllActions();
a instanceof cleverapps.Spine && a.setCompleteListener()
})
},
listBaseBundles: function() {
cleverapps.eventManager.setCurrentFeatures();
cleverapps.skins.update(this);
var a = ["main"];
cleverapps.config.debugMode && (a.push("dev_resources"),
a.push("orangery"));
cleverapps.skins.getBundles() && (a = a.concat(cleverapps.skins.getBundles()));
return a
},
ctor: function(a) {
this._super();
this.avoidNodes = {};
this.dynamicNodes = {};
this.level = a && a.level;
a = this.screen = new cc.Node;
a.setLocalZOrder(-10);
this.addChild(a);
this.updateDynamicNodesThrottled = cleverapps.accumulate(0, this.createListener(this.updateDynamicNodes.bind(this)))
},
closeAction: function() {
cleverapps.focusManager.isFocused() || (!cleverapps.git || cleverapps.git.handleSceneClose()) && this._closeAction()
},
_closeAction: function() {
cleverapps.focusManager.display({
focus: "closeScene",
action: function(a) {
cleverapps.travelBook.gotoMainScene(a)
}
})
},
prepareBundles: function() {
this.bundles = this.listBundles().concat(this.listBaseBundles());
this.bundles = cleverapps.unique(this.bundles.filter(function(a) {
return a && bundles[a]
}))
},
load: function(a) {
a = cleverapps.wait(2, a);
this.level ? this.level.load(a) : a();
cleverapps.lazyAssets.setPreferredBundles(this.lazyBundles());
var b = cleverapps.substract(this.bundles, this.prevSceneBundles);
cleverapps.bundleLoader.loadBundles(b, {
onSuccess: a,
onFailure: function() {
var c = {
focus: "loadSceneBundlesFailure",
action: function() {
new RestartWindow
}
};
cleverapps.focusManager.isFocused() ? cleverapps.focusManager.distract(c) : cleverapps.focusManager.display(c)
}
})
},
unload: function(a) {
this.level && this.level.unload();
a.prevSceneBundles = this.bundles;
a = cleverapps.substract(this.bundles, a.bundles);
cleverapps.bundleLoader.deleteBundles(a);
cleverapps.bundleLoader.clearUnusedResources();
cc.pool.drainAllPools()
},
onSceneLoaded: function(a) {
cleverapps.environment.setScene(a);
"undefined" !== typeof Map2d && Map2d.resetChessLayerVisible && Map2d.resetChessLayerVisible();
this.movingNode = new cc.Node;
this.movingNode.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 3);
this.addChild(this.movingNode);
a = new ShadowLayer;
a.setLocalZOrder(BaseWindow.WINDOWS_ZORDER - 3);
a.subscribeToWindows();
a = new LoadingAnimation;
a.visible = !1;
a.setLocalZOrder(1E3);
a.subscribeToWindows();
a.setPositionRound(cleverapps.styles.FixedWidthScene.loading);
this.addChild(a);
this.backgroundStyles = this.getBackgroundStyles();
this.setBackground();
this.addTreasureBag();
this.upMenuContainer = new UpMenuContainer;
this.addChild(this.upMenuContainer);
this.upMenuContainer.addMenuBar();
this.upMenuContainer.addControlButtons();
this.addSideBar();
this.addToolbar();
this.addDebugToolsBar();
this.addChild(new CenterHintView(cleverapps.centerHint));
a = this.getAudioStyles();
"playable" !== connector.info.source && this.startOrRestartMusic(a);
cleverapps.flyingAd && cleverapps.flyingAd.reset();
cleverapps.userStatus.initTimeouts();
cc.director.setClearColor(cleverapps.styles.FixedWidthScene.clearColor || cc.color.BLACK);
this.debugId = "Scene";
cleverapps.restoreProgress.isAvailable() && (a = new RestoreProgressButton,
this.addChild(a));
cleverapps.scenes.onAvoidNodeVisibilityChanged = this.updateDynamicNodesThrottled.bind(this)
},
startOrRestartMusic: function(a) {
this.startMusicAction = this.runAction(new cc.Sequence(new cc.DelayTime(a.delay || 0),new cc.CallFunc(function() {
cleverapps.audio.insertDisk(a.res);
cleverapps.audio.fadeIn(a.fadeIn || 0)
}
)))
},
getAudioStyles: function() {
return cleverapps.styles.FixedWidthScene.sound
},
introControls: function() {},
playIntro: function(a) {
var b = cleverapps.silentIntro;
(new ActionPlayer([function(c) {
this.playIntroActions(c, b)
}
.bind(this), function(c) {
cleverapps.restoreProgress.update();
cleverapps.silentIntro = !1;
c()
}
])).play(a)
},
ensureSoundsLoaded: function() {
var a = [];
this.bundles.forEach(function(b) {
a.push.apply(a, bundles[b].listSoundUrls())
});
cleverapps.bundleLoader.ensureSoundsLoaded(a)
},
playIntroActions: function(a) {
a()
},
addSideBar: function() {
this.sideBar && (this.sideBar.removeFromParent(),
delete this.sideBar);
if (!cleverapps.gameModes.noSidebar) {
var a = this.sideBar = new SideBarView;
this.addChild(a)
}
},
addToolbar: function() {
if (cleverapps.environment.isMainScene() && !cleverapps.gameModes.noControls && !cleverapps.gameModes.noToolbar) {
var a = new ToolbarView;
a.setLocalZOrder(1);
this.addChild(a);
this.downToolBarControl = new HidingNode(a,cleverapps.UI.VERTICAL);
cleverapps.focusManager.registerControl("toolbar", this.downToolBarControl)
}
},
addTreasureBag: function() {
this.treasureBag && (this.treasureBag.removeFromParent(),
this.treasureBag = void 0);
var a = new TreasureBagIcon;
this.addChild(a);
this.treasureBag = new HidingNode(a,cleverapps.styles.TreasureBag.hideVertical ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL);
cleverapps.focusManager.registerControl("treasureBag", this.treasureBag, Object.values(cleverapps.Environment))
},
addDebugToolsBar: function() {
if (cleverapps.config.debugMode && !cleverapps.config.wysiwygMode && (cleverapps.environment.isGameScene() || cleverapps.environment.isMainScene())) {
var a = cleverapps.styles.FixedWidthScene;
this.snapshotBar = new SnapshotBarView;
this.screen.addChild(this.snapshotBar);
this.gitButtons = new GitButtonsView({
hiddenByDefault: !0
});
this.gitButtons.setLocalZOrder(1E3);
this.gitButtons.setPositionRound(a.gitButtons);
this.addChild(this.gitButtons)
}
},
getBackgroundStyles: function() {
return cleverapps.skins.getSlot("sceneBg") || cleverapps.styles.FixedWidthScene.background
},
setBackground: function() {
var a = this.backgroundStyles;
if (a && !cleverapps.gameModes.noBg) {
if (a.patternId) {
var b = cleverapps.resolution.getSceneSize();
b.height += 2;
this.background = new cc.Node;
this.background.setAnchorPoint(.5, .5);
this.background.setContentSize(b);
b = cleverapps.UI.createPatternSprite(bundles[a.bundle].urls[a.patternId], b);
this.background.addChild(b)
} else if (a.horizontalPattern) {
b = 0;
var c = [];
do {
var d = new cc.Sprite(a.horizontalPattern);
c.push(d);
b += d.width
} while (b < this.width || 2 > c.length);
this.background = new cleverapps.Layout(c,{
direction: cleverapps.UI.HORIZONTAL,
margin: 0
})
} else if (a.scale9)
this.background = cleverapps.UI.createScale9Sprite(a.scale9, cleverapps.UI.Scale9Rect.TwoPixelXY);
else if (a.movableAnimation)
this.background = new cleverapps.Spine(a.movableAnimation),
this.background.setAnimation(0, "animation", !0);
else if (a.backgroundId)
this.background = new cc.Sprite(bundles[a.bundle].urls[a.backgroundId]);
else
return;
a.animation && (b = this.background.animation = new cleverapps.Spine(a.animation),
b.setAnimation(0, "animation", !0),
a.skin && b.setSkin(a.skin),
this.background.addChild(b));
this.background.transitionBundles = cleverapps.toArray(a.bundle);
this.updateBackgroundScale();
this.updateBackgroundPosition();
this.background.setLocalZOrder(-10);
this.addChild(this.background)
}
},
completeAnimationOnResize: function() {
this.background && this.updateBackgroundScale();
this.removeFilmEffect()
},
updateSize: function() {
var a = cleverapps.resolution.getSafePadding();
this.setContentSize(cleverapps.resolution.getSceneSize());
this.setPosition(a.left, a.bottom);
this.screen.setContentSize(cleverapps.resolution.getBgSize());
this.screen.setPosition(-a.left, -a.bottom)
},
setupChildren: function() {
this.isAllLoaded && (this.updateBackgroundScale(),
this.updateBackgroundPosition())
},
onResize: function() {
this._super();
this.isAllLoaded && this.afterResize()
},
afterResize: function() {
this.scaleGameField && this.scaleGameField();
var a = cleverapps.windows.currentWindow();
a && a.initializedSuccess && a.inflateWindow();
[PointerView.currentPointer, FingerView.currentFinger, cleverapps.forces.getRunningForce(), Game.currentGame && Game.currentGame.tutorial].forEach(function(b) {
var c = b instanceof cc.Node ? b.isRunning() : !0;
b && b.afterResize && c && b.afterResize()
});
this.updateDynamicNodesThrottled(!0)
},
updateBackgroundPosition: function() {
if (this.background && (!this.backgroundStyles || !this.backgroundStyles.movableAnimation)) {
var a = cleverapps.resolution.getBgSize();
this.backgroundStyles && this.backgroundStyles.position ? (this.background.setPositionRound(this.backgroundStyles.position),
this.background.originalPosition = this.backgroundStyles.position) : this.background.setPositionRound(this.convertToNodeSpace(cc.p(a.width / 2, a.height / 2)))
}
},
updateBackgroundScale: function() {
if (this.background && (!this.backgroundStyles || !this.backgroundStyles.movableAnimation)) {
var a = this.backgroundStyles;
this.background instanceof cc.Scale9Sprite ? (a = cleverapps.resolution.getSceneSize(),
this.background.setContentSize2(a.width, a.height)) : "number" === typeof a.scale ? this.background.setScale(a.scale) : (a = a.size || this.background.getContentSize(),
a = Math.max(this.width / a.width, cleverapps.resolution.getBgSize().height / a.height),
this.background.setScale(a),
this.background.stopAllActions());
this.background.animation && this.background.animation.setPositionRound(this.background.width / 2, this.background.height / 2)
}
},
onTransitionAnimationDidStart: function() {
cleverapps.audio.fadeOut(.1)
},
addTransitionBundles: function(a) {
a && (this.bundles = this.bundles.concat(a))
},
getPreferredBundles: function() {
var a = this._super();
return a = cleverapps.substract(a, ["dev_resources"])
},
addDynamicNode: function(a) {
this.dynamicNodes[a.__instanceId] || (this.dynamicNodes[a.__instanceId] = a)
},
removeDynamicNode: function(a) {
this.dynamicNodes[a.__instanceId] && delete this.dynamicNodes[a.__instanceId]
},
addAvoidNode: function(a) {
this.avoidNodes[a.__instanceId] || (this.avoidNodes[a.__instanceId] = a,
this.updateDynamicNodesThrottled())
},
removeAvoidNode: function(a) {
this.avoidNodes[a.__instanceId] && (delete this.avoidNodes[a.__instanceId],
this.updateDynamicNodesThrottled())
},
updateDynamicNodes: function(a) {
Object.values(this.dynamicNodes).forEach(function(b) {
b.updateDynamicPosition(a)
})
},
getAvoidNodes: function(a) {
a = cleverapps.createSet(a);
return Object.values(this.avoidNodes).filter(function(b) {
return a[b.avoidNode]
})
},
createFilmEffect: function(a) {
this.removeFilmEffect();
this.filmEffect = new SceneFilmEffect(a);
this.addChild(this.filmEffect)
},
removeFilmEffect: function(a, b) {
this.filmEffect ? this.filmEffect.hideAnimation(a, function() {
delete this.filmEffect;
b && b()
}
.bind(this)) : b && b()
}
});
cleverapps.styles.FixedWidthScene = {
loading: {
x: {
align: "center"
},
y: {
align: "center"
}
},
sound: {
res: bundles.main.urls.background_music_map,
delay: .5
},
gitButtons: {
x: {
align: "right",
dx: -4
},
y: {
align: "bottom",
dy: 90
}
}
};
var Windows = function() {
cleverapps.EventEmitter.call(this);
this.list = [];
this.bundles = 0;
this.onceNoWindowsListener = void 0
};
Windows.prototype = Object.create(cleverapps.EventEmitter.prototype);
Windows.prototype.constructor = Windows;
Windows.prototype.onHideLoading = function() {
this.trigger("hideShadow");
this.trigger("moveShadowDown");
this.trigger("hideLoading")
}
;
Windows.prototype.onShowLoading = function() {
this.trigger("moveShadowUp");
this.trigger("showLoading");
this.trigger("showShadow", !0)
}
;
Windows.prototype.isActive = function() {
return 0 < this.list.length || 0 < this.bundles
}
;
Windows.prototype.reset = function() {
this.list = [];
this.bundles = 0;
this.trigger("hideShadow")
}
;
Windows.prototype.currentWindow = function() {
return this.list[this.list.length - 1]
}
;
Windows.prototype.findWindow = function(a) {
return this.list.find(function(b) {
return b instanceof a
})
}
;
Windows.prototype.closeBottomWindows = function() {
this.list.slice(0, this.list.length - 1).reverse().forEach(function(a) {
a.closed || a.close()
})
}
;
Windows.prototype.closeAllWindows = function() {
for (; this.list.length; ) {
var a = this.list.pop();
a.closed || a.close()
}
this.reset()
}
;
Windows.prototype.add = function(a) {
cleverapps.focusManager.isFocused() || -1 !== ["promptwindow"].indexOf(a.name) || cleverapps.focusManager.debugMessage("Trying to show window without user focus!");
if (a instanceof WaitWindow)
a.displaySelf();
else {
if (0 < this.list.length) {
var b = this.list[this.list.length - 1];
if (!(a instanceof ForceView) && (b.setVisible(!1),
this.trigger("hideShadow"),
b.initializedSuccess))
b.onHide()
}
this.onShowLoading();
this.list.push(a);
a.focus = cleverapps.focusManager.focus;
a.displaySelf();
(1 === this.list.length && !(this.list[0]instanceof ForceView) || 2 === this.list.length && this.list[0]instanceof ForceView) && this.trigger("openWindow")
}
}
;
Windows.prototype.notifyFocusPop = function() {
var a = this.currentWindow();
if ((!a || a.focus !== cleverapps.focusManager.focus) && cleverapps.focusManager.onceNoWindowsListener) {
var b = cleverapps.focusManager.onceNoWindowsListener;
cleverapps.focusManager.onceNoWindowsListener = void 0;
b()
}
!a && this.onceTutorialNoWindowsListener && (b = this.onceTutorialNoWindowsListener,
this.onceTutorialNoWindowsListener = void 0,
b())
}
;
Windows.prototype.runClose = function(a) {
(new ActionPlayer([function(b) {
a.beforeCloseAnimation(b)
}
, function(b) {
a.isCurrent() ? a.closeAnimation(b) : b()
}
, function(b) {
if (a.shareCheckBox)
a.shareCheckBox.onWindowClose(b);
else
b()
}
, function(b) {
this.delete(a);
a.onClose();
if (cleverapps.environment)
cleverapps.environment.onCloseWindow(a.name);
a.closeAnimationCallbacks && (a.closeAnimationCallbacks.forEach(function(c) {
c()
}),
a.closeAnimationCallbacks = []);
b()
}
.bind(this), function(b) {
a.removeFromParent();
cleverapps.bundleLoader.deleteBundles(a.bundles);
setTimeout(b, 0)
}
, function(b) {
this.notifyFocusPop();
b()
}
.bind(this)])).play()
}
;
Windows.prototype.remove = function(a) {
a.closed || (a.closed = !0,
a.stop(),
a.isCurrent() && cleverapps.focusManager.setEventNodes([]),
this.runClose(a))
}
;
Windows.prototype.delete = function(a) {
var b = a === this.currentWindow()
, c = this.list.indexOf(a);
-1 !== c && this.list.splice(c, 1);
if (b) {
if (!a.initializedSuccess)
this.onHideLoading();
if (0 === this.list.length) {
a instanceof ForceView && this.trigger("moveShadowDown");
this.trigger("hideShadow");
this.onHideLoading();
if ((b = cleverapps.scenes.getRunningScene()) && b.onShow)
b.onShow();
setTimeout(function() {
0 === this.list.length && this.trigger("closeWindows")
}
.bind(this), a.closeDuration())
} else
a instanceof ForceView ? (this.trigger("moveShadowDown"),
setTimeout(function() {
var d = this.currentWindow();
!d || d instanceof ForceView || cleverapps.focusManager.setEventNodes([d])
}
.bind(this), 150)) : (a = this.currentWindow(),
this.onShowLoading(),
a.onResize(),
a.initializedSuccess && (a.inflateWindow(),
cleverapps.scenes.onAvoidNodeVisibilityChanged()),
a.displaySelf(),
1 === this.list.length && this.list[0]instanceof ForceView && this.trigger("closeWindows"))
}
}
;
var LoadingAnimation = cleverapps.Spine.extend({
ctor: function() {
this._super(bundles.main.jsons.wait_json);
this.setAnimation(0, "idle", !0);
var a = cleverapps.styles.LoadingAnimation;
if (a.text) {
var b = Messages.get("Loading") ? cleverapps.UI.generateOnlyText("Loading", cleverapps.styles.FONTS.LOADING_ANIMATION_TEXT) : cleverapps.UI.__generateNotLocalizedText("Loading", cleverapps.styles.FONTS.LOADING_ANIMATION_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.text.width, 0);
b.fitTo(void 0, a.text.height);
b.setPositionRound(a.text);
this.addChild(b, 1)
}
},
subscribeToWindows: function() {
cleverapps.windows.on("hideLoading", this.hideLoading.bind(this), this);
cleverapps.windows.on("showLoading", this.showLoading.bind(this), this)
},
hideLoading: function() {
this.stopAllActions();
this.setVisible(!1)
},
showLoading: function() {
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.Show))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
LOADING_ANIMATION_TEXT: {
size: 45,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.WINDOW_WHITE_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.WHITE_TEXT_SHADOW
}
});
cleverapps.styles.LoadingAnimation = {
text: {
x: {
align: "center"
},
y: {
align: "center"
},
width: 400,
height: 70
}
};
var BaseWindow = cc.Node.extend({
listBundles: function() {
return []
},
ctor: function() {
this._super();
var a = arguments;
cleverapps.scenes.getRunningScene().addChild(this);
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(BaseWindow.WINDOWS_ZORDER);
cleverapps.windows.add(this);
this.openTime = Date.now();
this.bundles = this.listBundles.apply(this, arguments) || [];
cleverapps.skins.getBundles() && (this.bundles = this.bundles.concat(cleverapps.skins.getBundles()));
var b = this.getPersonBundles();
b && (this.bundles = this.bundles.concat(b));
this.bundles.push("windows");
this.bundles = cleverapps.unique(this.bundles);
this.bundles = this.bundles.filter(function(e) {
return bundles[e]
});
if (0 === this.bundles.length)
this.runWindow(a);
else {
var c = Date.now();
b = this.createListener(function() {
this.runWindow(a);
cleverapps.ConsoleStream.sendLoadingTime("window " + this.name + " " + (Date.now() - c) + "ms")
}
.bind(this));
var d = this.createListener(function() {
this.deleteSelf();
new RestartWindow
}
.bind(this));
cleverapps.focusManager.clearUpdateTimeout();
this.load(b, d)
}
},
getPerson: function() {},
getPersonBundles: function() {
var a = []
, b = this.getPerson();
if (b) {
if (b.left || b.right) {
var c = b.left;
var d = b.right
} else
c = b;
[c, d].filter(Boolean).forEach(function(e) {
(e = cleverapps.persons.getRole(e.role || e)) && e.bundle && a.push(e.bundle)
})
}
return a
},
load: function(a, b) {
cleverapps.bundleLoader.loadBundles(this.bundles, {
onSuccess: a,
onFailure: b
})
},
updateSize: function() {
var a = cleverapps.resolution.getSceneSize();
this.setContentSize(a.width, a.height);
this.setPositionRound(a.width / 2, a.height / 2)
},
setupChildren: function() {},
completeAnimationOnResize: function() {
this.window.stopAllActions();
this.window.setScale(1)
},
onPopUpAnimationFinished: function() {},
inflateWindow: function() {},
onResize: function() {
if (cleverapps.windows.currentWindow() === this || this instanceof WaitWindow)
this.children.forEach(function(a) {
a.onResize()
}),
this.updateSize(),
this.initializedSuccess && (this.setupChildren(),
this.completeAnimationOnResize())
},
isCurrent: function() {
return cleverapps.windows.currentWindow() === this
},
runWindow: function(a) {
this.updateSize();
this.onWindowLoaded.apply(this, a);
this.setupChildren();
this.inflateWindow();
this.initializedSuccess = !0;
this.closeWhenLoaded ? this.close() : this.displaySelf()
},
hideSelf: function() {
cleverapps.windows.currentWindow() === this && (this.setVisible(!1),
this.styles.shadow && cleverapps.windows.trigger("hideShadow"),
this.onHide())
},
getEventNodes: function() {
return [this]
},
displaySelf: function() {
if (this.initializedSuccess && cleverapps.windows.currentWindow() === this) {
cleverapps.windows.onHideLoading();
cleverapps.focusManager.updateControlsVisibility();
this.setVisible(!0);
cleverapps.focusManager.setEventNodes(this.getEventNodes());
cleverapps.windows.trigger(this.styles.shadow ? "showShadow" : "hideShadow");
this instanceof ForceView && cleverapps.windows.trigger("moveShadowUp");
if (cleverapps.environment)
cleverapps.environment.onOpenWindow();
this.popUpAnimation();
this.onShow();
cleverapps.windows.trigger("showUpWindow")
}
},
deleteSelf: function() {
cleverapps.windows.delete(this);
this.removeFromParent()
},
stop: function() {
cc.eventManager.removeListeners(this, !0)
},
beforeCloseAnimation: function(a) {
a()
},
close: function() {
!0 === this.closed && cleverapps.throwAsync("Closing already closed window: " + this.name);
this.closed || (this.initializedSuccess ? (this.closeButton instanceof BandButton && this.closeButton.hide(),
this.shareCheckBox && !this.withBg && this.shareCheckBox.hide(),
this.tapToContinue && this.tapToContinue.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.Hide)),
this.homeButton && this.homeButton.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.Hide)),
this.windowFooter && this.windowFooter.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.Hide)),
this.windowTitle && this.windowTitle.hide(),
this.decors && this.decors.hideAll(),
this.content && this.content.children.forEach(function(a) {
a.hide && a.hide()
}),
cleverapps.windows.remove(this)) : this.closeWhenLoaded = !0)
},
onClose: function() {}
});
BaseWindow.WINDOWS_ZORDER = 22;
var WINDOW_ANIMATIONS = {
default: {
open: function(a) {
var b = this.window.scale;
this.window.setScale(.8 * b);
this.window.runAction(new cc.Sequence((new cc.ScaleTo(.3,b)).easing(cc.easeBackOut()),new cc.CallFunc(a)))
},
close: function(a) {
a()
}
},
fallIn: {
open: function(a) {
var b = this.window.scale;
this.window.setScale(3.2 * b);
this.performRecursive(function(c) {
c !== this && c.setCascadeOpacityEnabled(!0)
});
this.window.setOpacity(30);
this.window.runAction(new cc.Sequence(new cc.Spawn((new cc.ScaleTo(.5,b)).easing(cc.easeIn(1.5)),(new cc.FadeIn(.5)).easing(cc.easeIn(2))),new cc.CallFunc(a)))
},
close: function(a) {
a()
}
},
fromLeft: {
open: function(a) {
var b = this.window.basePosition;
this.window.setPositionX(-b.x);
this.window.runAction(new cc.Sequence((new cc.MoveTo(.3,b.x,b.y)).easing(cc.easeBackOut()),new cc.CallFunc(a)))
},
close: function(a) {
this.window.runAction(new cc.Sequence((new cc.MoveTo(.3,-this.window.x,this.window.y)).easing(cc.easeBackIn()),new cc.CallFunc(a)))
}
},
fromBelow: {
open: function(a) {
this.window.setVisible(!1);
this.window.runAction(new cc.Sequence(new cc.MoveBy(0,0,-this.window.height),new cc.Show,(new cc.MoveBy(.3,0,this.window.height)).easing(cc.easeBackOut()),new cc.CallFunc(a)))
},
close: function(a) {
this.window.runAction(new cc.Sequence((new cc.MoveBy(.4,0,-this.window.height)).easing(cc.easeBackIn()),new cc.Hide,new cc.CallFunc(a)))
}
},
fromLeftToRight: {
open: function(a) {
var b = this.window.basePosition;
this.window.setPositionX(-this.window.width / 2);
this.window.runAction(new cc.Sequence((new cc.MoveTo(.3,b.x,b.y)).easing(cc.easeBackOut()),new cc.CallFunc(a)))
},
close: function(a) {
this.window.runAction(new cc.Sequence((new cc.MoveTo(.3,this.width + this.window.width / 2,this.window.y)).easing(cc.easeBackIn()),new cc.CallFunc(a)))
}
},
bezierCircle: {
open: function(a) {
var b = cc.p(this.window.basePosition.x, this.window.basePosition.y)
, c = cc.p(b.x + .2 * this.width, this.height - this.window.height / 2)
, d = cc.p(b.x + .35 * this.width, b.y - this.window.height / 6)
, e = this.window.scale;
this.window.setScale(.3 * e);
this.window.setPosition(c);
this.window.runAction(new cc.Sequence(new cc.Spawn(new cc.BezierTo(.25,[c, d, b]),(new cc.ScaleTo(.25,e)).easing(cc.easeIn(3))),new cc.CallFunc(a)))
},
close: function(a) {
var b = cc.p(this.window.basePosition.x, this.window.basePosition.y)
, c = cc.p(b.x - .2 * this.width, this.height - this.window.height / 2)
, d = cc.p(b.x - .35 * this.width, b.y - this.window.height / 2);
this.window.setPosition(b);
this.window.runAction(new cc.Sequence(new cc.Spawn(new cc.BezierTo(.25,[b, d, c]),(new cc.ScaleTo(.25,.3)).easing(cc.easeOut(.33))),new cc.CallFunc(a)))
}
},
instant: {
open: function(a) {
a()
},
close: function(a) {
a()
}
},
force: {
open: function(a) {
a()
},
close: function(a) {
this.dialogue.close(a)
}
}
};
var CleverappsWindow = BaseWindow.extend({
onWindowLoaded: function(a) {
this.params = a = a || {};
!0 === a.closeButtonDelay && (a.closeButtonDelay = 1.5);
this.params.closeButtonManual = a.closeButtonManual;
this.params.closeButtonDelay = a.closeButtonDelay || 0;
var b = cleverapps.styles.Window;
a.styles && (b = cleverapps.overrideStyles(b, a.styles, !0));
this.styles = b;
this.name = a.name || a.title || "window";
this.content = a.content;
this.withBg = !a.noBackground && !b.noBackground;
this.buttons = this.createWindowButtons();
a.shareId && Share.isAvailable() && (this.shareCheckBox = new ShareCheckBox(a.shareId,this));
!1 !== a.closeButton && !1 !== b.closeButton && (this.closeButton = this.createCloseButton());
a.loginOrInvite && (this.loginOrInvite = cleverapps.FBLoginOrInvite());
this.withBg ? this.createWindowWithBg() : this.createWindowWithoutBg();
this.debugId = this.name;
this.windowSize = this.window.getContentSize();
this.params.title && this.withBg && (this.windowTitle = this.createWindowTitle(),
this.window.addChild(this.windowTitle));
a.help && !b.HelpButton.lovesTitle && (this.helpButton = this.createHelpButton(a.help),
this.window.addChild(this.helpButton));
a.homeButton && (this.homeButton = this.createHomeButton(),
this.addChild(this.homeButton));
this.closeButton instanceof BandButton ? this.addChild(this.closeButton) : this.closeButton instanceof CloseButton && this.window.addChild(this.closeButton);
if (b = cleverapps.skins.getSlot("windowDecors", {
decors: b.decors,
window: this,
level: a.level
}))
this.decors = new Decors(this,b);
if (!1 !== a.closeButton || a.closeByBackButton)
this.closeByBackButton = this.createListener(function() {
cleverapps.focusManager.checkEventNode(this) && this.close()
}
.bind(this));
a.fireworks && (this.fireworks = new Fireworks(this.window,a.fireworks),
this.fireworks.setPositionRound(this.width / 2, this.height / 2),
this.fireworks.setLocalZOrder(a.fireworks.zOrder || 0),
this.addChild(this.fireworks));
a.offerWindowButton && (a.offerWindowButton.positioningStartOffset = this.window.width / 2,
this.windowOffer = new WindowOffer(this,a.offerWindowButton));
if (b = this.getPerson && this.getPerson())
this.persons = new WindowPersons(b,this);
this.closeAnimationCallbacks = [];
cleverapps.audio.playSound(a.openSound || bundles.main.urls.window_effect)
},
createWindowButtons: function() {
var a = [];
this.params.button && (this.params.button.onClicked = this.params.button.onPressed || this.close.bind(this),
a.push(new BottomButton(this.params.button)));
this.params.buttons && (a = a.concat(this.params.buttons));
if (a.length)
return new Buttons(a)
},
createWindowTitle: function() {
return new WindowTitle(this,this.params.title,this.styles.HelpButton.lovesTitle && this.params.help)
},
createWindowWithoutBg: function() {
var a = [];
this.buttons && a.push(this.buttons);
this.closeButton instanceof TapToContinue && a.push(this.closeButton);
a.length && (this.tapToContinue = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: this.styles.Footer.margin,
padding: this.styles.TapToContinue.padding
}),
this.tapToContinue.setLocalZOrder(2),
this.tapToContinue.setCascadeOpacityEnabledRecursively(!0),
this.addChild(this.tapToContinue));
a = [this.content];
this.params.title && (this.windowTitle = this.createWindowTitle(),
a.unshift(this.windowTitle));
this.window = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: this.styles.titleMargin
});
this.window.setLocalZOrder(1);
this.wrapper = cleverapps.UI.wrapWithPadding(this.window);
this.wrapper.avoidNode = "Window";
this.wrapper.setLocalZOrder(1);
this.addChild(this.wrapper);
a = [];
this.shareCheckBox && (this.shareCheckBox.setOpacity(180),
a.push(this.shareCheckBox));
this.loginOrInvite && a.push(this.loginOrInvite);
a.length && (this.windowFooter = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: this.styles.Footer.margin
}),
this.windowFooter.setPositionRound(this.styles.Footer),
this.windowFooter.setLocalZOrder(2),
this.addChild(this.windowFooter))
},
createWindowWithBg: function() {
var a = [this.content, this.shareCheckBox, this.buttons].filter(Boolean);
this.window = new cleverapps.Layout(a,{
margin: this.styles.margin,
direction: cleverapps.UI.VERTICAL,
padding: !this.params.noPadding && this.styles.padding
});
this.window.setLocalZOrder(1);
a = (void 0 !== this.params.minWidth ? this.params.minWidth : cleverapps.styles.Window.minWidth) - this.window.width;
var b = (void 0 !== this.params.minHeight ? this.params.minHeight : cleverapps.styles.Window.minHeight) - this.window.height;
(0 < a || 0 < b) && cleverapps.UI.wrapWithPadding(this.window, {
x: 0 < a && a,
y: 0 < b && b
}, !0);
this.bg = this.createBackground();
this.window.addChild(this.bg);
this.bg.setLocalZOrder(-1E3);
this.bg.setPositionRound(this.window.width / 2, this.window.height / 2);
this.wrapper = cleverapps.UI.wrapWithPadding(this.window);
this.wrapper.avoidNode = "Window";
this.wrapper.setLocalZOrder(1);
this.addChild(this.wrapper);
this.params.foreground && (this.foreground = this.createForeground(this.params.foreground),
this.window.addChild(this.foreground));
this.loginOrInvite && (this.windowFooter = this.loginOrInvite,
this.windowFooter.setPositionRound(this.styles.Footer),
this.windowFooter.setLocalZOrder(2),
this.addChild(this.windowFooter))
},
adjustWrapper: function() {
var a = this.window.getGlobalBoundingBox()
, b = [this.windowTitle && this.withBg ? this.windowTitle : void 0, this.tabs && this.tabs.isVisible() ? this.tabs : void 0].filter(Boolean).reduce(function(c, d) {
return cc.rectUnion(c, d.getGlobalBoundingBox())
}, a);
this.wrapper.setContentSize2(b.width || 1, b.height || 1);
this.window.setPosition(this.window.width / 2 + a.x - b.x, this.window.height / 2 + a.y - b.y)
},
adjustTapToContinue: function() {
if (this.tapToContinue) {
var a = this.windowFooter ? this.windowFooter.getBoundingBox() : void 0;
a = a ? a.y + a.height : 0;
this.tapToContinue.setScale(1);
this.tapToContinue.setPositionRound(this.wrapper.x, a + this.tapToContinue.height / 2)
}
},
inflateWindow: function() {
this._super();
this.windowScale = 1;
this.wrapper.setScale(1);
this.wrapper.setPositionRound(this.width / 2, this.height / 2);
this.windowTitle && this.windowTitle.adjustPosition();
this.adjustWrapper();
this.adjustTapToContinue();
if (!this.params.noScaleAdjustment) {
var a = cleverapps.resolution.getSceneSize();
a = cc.p(a.width / 2, a.height / 2);
this.windowTitle && !this.withBg && (a.y += this.styles.titleMargin);
cleverapps.UI.inflateToBoundaries(this.wrapper, this.getOverlappingNodes(), {
padding: this.getContentPadding(),
lovesPosition: this.convertToWorldSpace(a),
maxScale: 1
})
}
this.windowTitle && this.windowTitle.adjustPosition();
this.persons && this.persons.update();
this.windowScale = this.wrapper.getScale();
this.wrapper.basePosition = this.wrapper.getPosition();
a = cleverapps.scenes.getRunningScene();
var b = cleverapps.resolution.getSafePadding();
b = a.convertToNodeSpace(cc.p(a.width / 2 + b.left, a.height / 2 + b.bottom));
a = 1 / a.getScale();
this.setScale(a);
this.setPosition(b.x, b.y)
},
isShowTitle: function() {
return !!this.windowTitle
},
getOverlappingNodes: function() {
var a = cleverapps.scenes.getRunningScene();
return [cleverapps.focusManager.isControlEnabled("MenuBarGoldItem MenuBarGameLevelItem MenuBarLivesItem MenuBarCoinsItem MenuBarWandsItem MenuBarWorkersItem".split(" ")) ? a.upMenuContainer : void 0, this.goldInfo, this.bottomLine, this.windowFooter, this.tapToContinue, this.windowOffer && this.windowOffer.getOverlapNode()].filter(Boolean)
},
getContentPadding: function() {
var a = cleverapps.resolution.getSceneSize()
, b = this.params.contentPadding;
b === cleverapps.UI.DOCK_RIGHT ? b = {
left: a.width / 2
} : b === cleverapps.UI.DOCK_LEFT ? b = {
right: a.width / 2
} : b === cleverapps.UI.DOCK_BOTTOM ? b = {
top: a.height / 2
} : b === cleverapps.UI.DOCK_TOP && (b = {
bottom: a.height / 2
});
return cc.paddingAddPadding(cc.padding(b), this.getBackgroundPadding())
},
getBackgroundPadding: function() {
return cc.padding((this.styles || cleverapps.styles.Window).Background.padding)
},
setupChildren: function() {
this._super();
this.decors && this.decors.updateAll();
this.fireworks && this.fireworks.setPositionRound(this.width / 2, this.height / 2);
this.windowFooter && this.windowFooter.setPositionRound(this.styles.Footer);
this.windowOffer && this.windowOffer.update()
},
createCloseButton: function() {
var a = BandButton
, b = {
onClicked: this.close.bind(this),
styles: this.styles.CloseButton
};
this.params.bandButton || (this.withBg ? a = CloseButton : this.params.notCloseByTouchInShadow || (a = TapToContinue,
b = {
text: this.params.tapToContinueText || "Window.TapToContinue"
}));
return new a(b)
},
createHelpButton: function(a) {
var b = this.styles.HelpButton;
a = new cleverapps.UI.HelpButton(a);
a.setPositionRound(b);
a.setLocalZOrder(b.zOrder);
return a
},
createHomeButton: function() {
var a = new cleverapps.UI.Button({
type: {
button_png: bundles.controlbuttons.frames.back_button_png,
button_on_png: bundles.controlbuttons.frames.back_button_on_png
},
onClicked: function() {
var b = Game.currentGame && Game.currentGame.boatswain;
b && b.setIntent(Boatswain.RETURN_INTENT);
this.close()
}
.bind(this),
content: new cc.Sprite(bundles.buttons_main.frames.home_icon)
});
a.avoidNode = "HomeButton";
a.setupChildren = function() {
a.setPositionRound(this.styles.HomeButton.position)
}
.bind(this);
a.setupChildren();
return a
},
onShow: function() {
this.windowTitle && !this.params.customTitle && this.windowTitle.show();
this.shareCheckBox && this.shareCheckBox.updateState();
this.fireworks && this.fireworks.start();
this.persons && this.persons.showUp();
this.windowOffer && this.windowOffer.show();
this.hideBeforeDelayedShowUp();
this.params.closeButtonManual ? this.params.closeButtonManual = !1 : this.delayedShowUp();
this.params.showSound && cleverapps.audio.playSound(this.params.showSound)
},
hideBeforeDelayedShowUp: function() {
this.homeButton && (this.homeButton.stopAllActions(),
this.homeButton.setCascadeOpacityEnabledRecursively(!0),
this.homeButton.setVisible(!1),
this.homeButton.setOpacity(0));
this.closeButton && this.closeButton.hide(!0);
this.windowFooter && (this.windowFooter.setCascadeOpacityEnabledRecursively(!0),
this.windowFooter.setVisible(!1),
this.windowFooter.setOpacity(0))
},
delayedShowUp: function() {
var a = this.params.closeButtonDelay;
this.homeButton && this.homeButton.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.Show,(new cc.FadeIn(.4)).easing(cc.easeOut(1.2))));
this.closeButton && this.closeButton.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.CallFunc(function() {
this.closeButton.show();
this.enableTouchInShadow()
}
.bind(this))));
this.windowFooter && this.windowFooter.runAction(new cc.Sequence(new cc.DelayTime(a + .5),new cc.Show,(new cc.FadeIn(.4)).easing(cc.easeOut(1.2))))
},
onHide: function() {
this.fireworks && this.fireworks.stop();
this.touchListener && (cc.eventManager.removeListener(this.touchListener),
this.touchListener = void 0)
},
createBackground: function() {
var a = this.styles.Background
, b = cleverapps.skins.getSlot("windowBg", {
image: a.image,
level: this.params.level
});
b = cleverapps.UI.createScale9Sprite(b, a.scale9);
b.setContentSize2(this.window.getContentSize());
a.opacity && b.setOpacity(a.opacity);
b.setLocalZOrder(-1E3);
b.setPositionRound(this.window.width / 2, this.window.height / 2);
return b
},
createForeground: function(a) {
this.foreground = cleverapps.UI.createScale9Sprite(a, cleverapps.UI.Scale9Rect.TwoPixelXY);
cleverapps.config.debugMode && (this.foreground._debugExclude = !0);
this.foreground.setAnchorPoint(0, 0);
this.foreground.setLocalZOrder(1);
a = cc.rect(0, 0, this.window.width, this.window.height);
a = cc.rectSubPadding(a, cc.padding(this.styles.Foreground && this.styles.Foreground.padding));
this.foreground.setPositionRound(a.x, a.y);
this.foreground.setContentSize2(a.width, a.height);
return this.foreground
},
onTouchInShadow: function() {
this.params.notCloseByTouchInShadow || (cleverapps.audio.playSound(bundles.main.urls.click_effect),
this.close())
},
setTitle: function(a, b) {
this.windowTitle && this.windowTitle.setTitle(a, b)
},
getMinimalDialogueRects: function() {
var a = cleverapps.styles.Window
, b = [cc.rectSubPadding(this.window.getSceneBoundingBox(), cc.padding(a.BoundingBoxPadding))];
this.windowTitle && b.push(cc.rectSubPadding(this.windowTitle.getSceneBoundingBox(), cc.padding(a.BoundingBoxPadding.Title)));
return b
},
enableTouchInShadow: function() {
cleverapps.UI.onClick(this, function(a) {
if (this.window && !(this.closeButton instanceof TapToContinue)) {
var b = this.window.getContentSize();
b = cc.rect(0, 0, b.width, b.height);
if (cc.rectContainsPoint(b, this.window.convertToNodeSpace(a.getLocation())) || cc.rectContainsPoint(b, this.window.convertToNodeSpace(a.getStartLocation())))
return
}
this.onTouchInShadow()
}
.bind(this), {
interactiveScale: !1
})
},
popUpAnimation: function() {
var a = this.chooseAnimation();
if (a)
this.window && this.window.stopAllActions(),
a.open.call(this, this.onPopUpAnimationFinished.bind(this));
else
this.onPopUpAnimationFinished()
},
stop: function() {
this._super();
this.window && this.window.stopAllActions()
},
closeAnimation: function(a) {
cleverapps.audio.playSound(bundles.main.urls.close_window_effect || bundles.main.urls.window_effect);
var b = this.chooseAnimation();
!b || 1 < cleverapps.windows.list.length && !this.styles.windowShowUpAnimation.force ? a() : b.close.call(this, a)
},
chooseAnimation: function() {
var a = this.styles || cleverapps.styles.Window;
if (a.windowShowUpAnimation && (this.window || this instanceof ForceView))
return this.bg || a.windowShowUpAnimation.force ? WINDOW_ANIMATIONS[a.windowShowUpAnimation.name] : WINDOW_ANIMATIONS.default
},
closeDuration: function() {
return (this.styles || cleverapps.styles.Window).closeAnimation.duration
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CLOSE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
cleverapps.styles.Window = {
shadow: !0,
margin: 30,
padding: {
x: 85,
top: 160,
bottom: 50
},
titleMargin: 30,
HelpButton: {
zOrder: 1,
x: {
align: "left",
dx: 70
},
y: {
align: "top",
dy: -45
}
},
BottomButton: {
width: 200,
height: 90
},
HomeButton: {
position: {
x: {
align: "right",
dx: -40
},
y: {
align: "top",
dy: -15
}
}
},
minHeight: 200,
minWidth: 240,
windowShowUpAnimation: {
name: "default",
force: !1
},
Background: {
image: bundles.windows.frames.window_bg_png,
scale9: cleverapps.UI.Scale9Rect.TwoPixelXY,
padding: {
x: 15,
y: 70
}
},
closeAnimation: {
duration: 200
},
Footer: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 60
},
margin: 20
},
BoundingBoxPadding: {
x: 30,
y: 30,
Title: {
x: 30,
y: 30
}
},
TapToContinue: {
padding: {
bottom: 60
}
}
};
var WindowTitle = cc.Node.extend({
ctor: function(a, b, c) {
this._super();
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(2);
this.setVisible(!1);
this.window = a;
this.type = this.window.withBg ? cleverapps.styles.WindowTitle.Types.bg_window : cleverapps.styles.WindowTitle.Types.nobg_window;
this.help = c;
this.type.background && (this.background = cleverapps.UI.createScale9Sprite(this.type.background.image),
this.addChild(this.background),
this.window.decors && this.window.decors.initTitleDecorators());
this.text = cleverapps.UI.generateOnlyText("", this.window.withBg ? cleverapps.styles.FONTS.WINDOW_TITLE_TEXT : cleverapps.styles.FONTS.NOBG_WINDOW_TITLE_TEXT);
this.maxTextHeight = 1.5 * this.text.getFontSize();
this.addChild(this.text, 1);
a = b;
b.text && (a = b.text);
c = {};
b.toReplace && (c = b.toReplace);
this.help && (this.helpButton = new cleverapps.UI.HelpButton(this.help),
this.addChild(this.helpButton));
this.setTitle(a, c);
this.setCascadeOpacityEnabledRecursively(!0)
},
adjustPosition: function() {
this.window.withBg && (this.setAnchorPoint(.5, .5),
this.setPositionRound(this.type.position.x, this.type.position.y))
},
setTitle: function(a, b) {
this.text.setString(a, b);
a = cleverapps.resolution.getSceneSize().width;
this.window.withBg ? (a = this.window.window.width - 2 * this.type.titleSideOffset.x,
this.help && (a -= 2 * this.type.helpButton.padding.x)) : a -= 2 * this.type.scenePaddingX;
this.text.fitTo(a, this.maxTextHeight);
this.background ? (a = 2 * this.type.padding.x,
this.helpButton && (a += 2 * this.type.helpButton.padding.x),
this.background.setContentSize2(Math.max(this.text.width + a, this.type.background.minWidth), this.type.background.height),
this.setContentSize2(this.background.getContentSize()),
this.background.setPositionRound(this.width / 2, this.height / 2),
this.window.decors && this.window.decors.updateAll()) : this.setContentSize2(this.text.getContentSize());
this.text.setPositionRound(this.type.textPosition);
this.helpButton && (this.text.setPositionRound(this.text.x + this.type.helpButton.padding.x, this.text.y),
this.helpButton.setPositionRound(this.type.helpButton))
},
animateNoBgShow: function() {
return [new cc.Hide, new cc.FadeOut(0), new cc.ScaleTo(0,.6), new cc.DelayTime(.1), new cc.Show, new cc.Spawn((new cc.ScaleTo(.4,1)).easing(cc.easeBackOut()),new cc.FadeIn(.4),new cc.Sequence(new cc.MoveBy(.21,0,-this.type.offsetY),new cc.MoveBy(.23,0,this.type.offsetY)))]
},
show: function() {
this.window.withBg ? this.setVisible(!0) : this.runAction(new cc.Sequence(this.animateNoBgShow()))
},
hide: function() {
this.window.withBg ? this.setVisible(!1) : this.runAction(new cc.Spawn((new cc.ScaleTo(.4,.6)).easing(cc.easeBackIn()),new cc.FadeOut(.4)))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
WINDOW_TITLE_TEXT: {
size: 70,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
NOBG_WINDOW_TITLE_TEXT: {
size: 70,
color: cleverapps.styles.COLORS.COLOR_BROWN
}
});
cleverapps.styles.WindowTitle = {
Types: {
bg_window: {
background: {
image: bundles.windows.frames.window_title_bg_png,
height: 147,
minWidth: 350
},
titleSideOffset: {
x: 190
},
padding: {
x: 60
},
textPosition: {
x: {
align: "center"
},
y: {
align: "center",
dy: 12
}
},
position: {
x: {
align: "center"
},
y: {
align: "top",
anchor: !1,
dy: -2
}
},
helpButton: {
x: {
align: "left",
dx: 20
},
y: {
align: "center",
dy: 3
},
padding: {
x: 30
}
}
},
nobg_window: {
background: {
image: bundles.windows.frames.window_title_bg_secondary_png,
height: 122,
minWidth: 600
},
padding: {
x: 195
},
textPosition: {
x: {
align: "center"
},
y: {
align: "center",
dy: 8
}
},
scenePaddingX: 150,
offsetY: 23
}
}
};
var WindowPersons = function(a, b) {
this.window = b;
this.visible = !0;
if (a.left || a.right) {
b = a.left;
var c = a.right
} else
b = a;
b && (this.leftPerson = this.createPerson(b));
c && ("string" === typeof c && (c = {
role: c
}),
c.orientation = "right",
this.rightPerson = this.createPerson(c))
};
WindowPersons.prototype.update = function() {
var a = this.positionPersons();
this.toggleVisible(a)
}
;
WindowPersons.prototype.positionPersons = function() {
for (var a = cleverapps.styles.WindowPersons, b = [this.window.wrapper, this.window.tapToContinue].filter(Boolean), c = b[0], d = 1; d < b.length; ++d) {
var e = b[d];
e.width * e.scale > c.width * c.scale && (c = e)
}
var f = !0;
[this.leftPerson, this.rightPerson].filter(Boolean).forEach(function(g) {
g.stopAllActions();
var h = g.getOrientation();
g.setPositionRound(a.position[h]);
if (c) {
var k = (g.width + c.width * c.scale) / 2 + a.offset;
Math.abs(g.x - c.x) < k && (g.x = c.x + k * ("left" === h ? -1 : 1))
}
g.originalPosition = g.getPosition();
f = f && g.x >= .2 * g.width && g.x <= cleverapps.resolution.getSceneSize().width - .2 * g.width
}, this);
return f
}
;
WindowPersons.prototype.createPerson = function(a) {
a = new Person(a);
a.setVisible(this.visible);
a.setAnchorPoint(.5, 0);
a.setLocalZOrder(3);
this.window.addChild(a);
return a
}
;
WindowPersons.prototype.getHidePosition = function(a) {
return "left" === a.getOrientation() ? cc.p(-a.width, a.y) : cc.p(cleverapps.scenes.getRunningScene().width + a.width, a.y)
}
;
WindowPersons.prototype.showPerson = function(a) {
a.stopAllActions();
a.setPositionRound(this.getHidePosition(a));
a.runAction((new cc.MoveTo(.6,a.originalPosition)).easing(cc.easeBackOut()))
}
;
WindowPersons.prototype.hidePerson = function(a) {
a.stopAllActions();
a.runAction(new cc.Sequence((new cc.MoveTo(.6,this.getHidePosition(a))).easing(cc.easeBackIn()),new cc.RemoveSelf))
}
;
WindowPersons.prototype.showUp = function() {
[this.leftPerson, this.rightPerson].forEach(function(a) {
a && this.showPerson(a)
}, this)
}
;
WindowPersons.prototype.hide = function() {
[this.leftPerson, this.rightPerson].forEach(function(a) {
a && this.hidePerson(a)
}, this)
}
;
WindowPersons.prototype.toggleVisible = function(a) {
this.visible !== a && (this.visible = a,
[this.leftPerson, this.rightPerson].forEach(function(b) {
b && (b.setVisible(a),
b.isShown = a,
cleverapps.scenes.onAvoidNodeVisibilityChanged())
}))
}
;
WindowPersons.prototype.setLeftPerson = function(a) {
a = Person.ParseOptions(a);
this.leftPerson && this.leftPerson.getRole() === a.role || (this.leftPerson && this.hidePerson(this.leftPerson),
this.leftPerson = this.createPerson(a),
this.positionPersons(),
this.showPerson(this.leftPerson))
}
;
WindowPersons.prototype.setRightPerson = function(a) {
a = Person.ParseOptions(a);
a.orientation = "right";
this.rightPerson && this.rightPerson.getRole() === a.role || (this.rightPerson && this.hidePerson(this.rightPerson),
this.rightPerson = this.createPerson(a),
this.showPerson(this.rightPerson))
}
;
cleverapps.styles.WindowPersons = {
offset: 50,
position: {
left: {
x: {
align: "left",
dx: 50
},
y: {
align: "bottom",
dy: -240
}
},
right: {
x: {
align: "right",
dx: -50
},
y: {
align: "bottom",
dy: -240
}
}
}
};
var WindowOffer = function(a, b) {
this.options = b || {};
this.parentNode = a;
this.positioningStartOffset = b.positioningStartOffset || 0;
PackOfferComponent.checkBundles(b.bundle) && (b = this.packView = new PackOfferComponent(b),
a.addChild(b, 2))
};
WindowOffer.prototype.createOfferButton = function() {
return this.offerButton = new OfferButtonComponent(this.options)
}
;
WindowOffer.prototype.removeOfferButton = function() {
this.offerButton && this.offerButton.removeFromParent();
this.offerButton = void 0
}
;
WindowOffer.prototype.addOfferButton = function() {
this.offerButton || (this.offerButton = this.createOfferButton(),
this.parentNode.addChild(this.offerButton, 2),
this.offerButton.show())
}
;
WindowOffer.prototype.updatePackPosition = function() {
var a = this.packView.getStyles()
, b = cleverapps.resolution.getSceneSize().width / 2 + this.positioningStartOffset;
this.packView.setPositionRound({
x: {
align: "left",
dx: b + a.offsetX
},
y: {
align: "bottom",
dy: a.offsetY - cleverapps.resolution.getSafePadding().bottom
}
})
}
;
WindowOffer.prototype.isPackVisible = function() {
if (!this.packView)
return !1;
var a = this.packView.getStyles()
, b = cleverapps.resolution.getSceneSize();
return this.packView.x + this.packView.pack.width / 2 * (a.spaceRequired / 100) < b.width && -1 !== a.visibleResolutionModes.indexOf(cleverapps.resolution.mode)
}
;
WindowOffer.prototype.update = function(a) {
this.packView && this.updatePackPosition();
this.shown && (this.isPackVisible() ? (this.packView.show(a),
this.removeOfferButton()) : (this.packView && this.packView.hide(a),
this.addOfferButton()))
}
;
WindowOffer.prototype.show = function() {
this.shown = !0;
this.update(!0)
}
;
WindowOffer.prototype.hide = function() {
this.shown = !1;
this.isPackVisible() ? this.packView && this.packView.hide(!0) : (this.offerButton && this.offerButton.remove(),
this.offerButton = void 0)
}
;
WindowOffer.prototype.getOverlapNode = function() {
return this.offerButton || this.packView && this.packView.getOverlapNode()
}
;
WindowOffer.prototype.expireOffer = function() {
this.removeOfferButton();
this.packView && this.packView.removeFromParent()
}
;
var BottomButton = cleverapps.UI.Button.extend({
ctor: function(a) {
var b = cleverapps.styles.Window.BottomButton;
a.width = a.width || b.width;
a.height = a.height || b.height;
this._super(a)
}
});
cleverapps.NodeDebugCommands = {
parentCell: {
description: "Parent cell",
key: cc.KEY.c,
filter: function() {
return "undefined" !== typeof EditorMap2dDecoratorView && this instanceof EditorMap2dDecoratorView
},
action: function(a) {
var b = Map2d.currentMap.getMapView();
b.getCell(this.decorator.x, this.decorator.y);
switch (a) {
case cc.KEY.down:
a = b.getCell(this.decorator.x, this.decorator.y + 1);
break;
case cc.KEY.left:
a = b.getCell(this.decorator.x - 1, this.decorator.y);
break;
case cc.KEY.up:
a = b.getCell(this.decorator.x, this.decorator.y - 1);
break;
case cc.KEY.right:
a = b.getCell(this.decorator.x + 1, this.decorator.y);
break;
default:
return
}
b.addTile(this.decorator.getLayerId(), a.cell.x, a.cell.y, this);
this.decorator.updateCell(a.cell.x, a.cell.y, Math.round((this.x - a.x) / resolutionScale), Math.round((this.y - a.y) / resolutionScale));
this.unselect();
this.select()
}
},
anchor: {
description: "Anchor",
noDisplayUpdate: !0,
filter: function() {
return cleverapps.flags.keyboardAnchorsMode || this.debugEditUnitAnchorsMode
},
action: function(a) {
switch (a) {
case cc.KEY.left:
(this.sprite || this).anchorX += .01;
this.debugBorderDx += .01;
break;
case cc.KEY.right:
(this.sprite || this).anchorX -= .01;
this.debugBorderDx -= .01;
break;
case cc.KEY.down:
this.anchorY += .01;
this.debugBorderDy += .01;
break;
case cc.KEY.up:
this.anchorY -= .01,
this.debugBorderDy -= .01
}
console.log("anchors: " + Math.floor(100 * (this.sprite || this).anchorX) / 100 + " x " + Math.floor(100 * this.anchorY) / 100 + "\toffsets: " + Math.floor(100 * this.debugBorderDx) / 100 + " x " + Math.floor(100 * this.debugBorderDy) / 100);
"undefined" !== typeof UnitView && this instanceof UnitView && cleverapps.git.edit("anchors", {
code: this.unit.code,
stage: this.unit.stage,
anchorX: Math.floor(100 * (this.sprite || this).anchorX) / 100,
anchorY: Math.floor(100 * this.anchorY) / 100,
urls: Families[this.unit.code].units.map(function(b, c) {
b = UnitView.UnitIconJson({
code: this.unit.code,
stage: c
}) || UnitView.UnitIconFrame({
code: this.unit.code,
stage: c
});
return {
bundle: b.getBundleName(),
key: b.key
}
}
.bind(this))
})
}
},
rotate: {
description: "Rotate",
key: cc.KEY.r,
action: function(a) {
switch (a) {
case cc.KEY.down:
case cc.KEY.left:
--this.rotation;
break;
case cc.KEY.up:
case cc.KEY.right:
++this.rotation
}
this.onChangeRotation && this.onChangeRotation(this.rotation)
}
},
scale: {
description: "Scale",
key: cc.KEY.s,
action: function(a) {
var b = 0
, c = 0;
switch (a) {
case cc.KEY.up:
case cc.KEY.right:
b = 0 < this.scaleX ? .05 : -.05;
c = 0 < this.scaleY ? .05 : -.05;
break;
case cc.KEY.down:
case cc.KEY.left:
b = 0 < this.scaleX ? -.05 : .05,
c = 0 < this.scaleY ? -.05 : .05
}
this.scaleX = +(this.scaleX + b).toFixed(2);
this.scaleY = +(this.scaleY + c).toFixed(2);
this.onChangeScale && this.onChangeScale(b, c)
}
},
mirror: {
description: "Mirror",
key: cc.KEY.m,
action: function(a) {
var b = 0
, c = 0;
switch (a) {
case cc.KEY.up:
case cc.KEY.down:
b = 0;
c = 2 * -this.scaleY;
break;
case cc.KEY.left:
case cc.KEY.right:
b = 2 * -this.scaleX,
c = 0
}
this.scaleX = +(this.scaleX + b).toFixed(2);
this.scaleY = +(this.scaleY + c).toFixed(2);
this.onChangeScale && this.onChangeScale(b, c)
}
},
width: {
description: "Width",
key: cc.KEY.w,
filter: function() {
return "undefined" === typeof EditorMap2dDecoratorView || !(this instanceof EditorMap2dDecoratorView)
},
action: function(a) {
switch (a) {
case cc.KEY.up:
this.width++;
break;
case cc.KEY.down:
this.width--
}
}
},
height: {
description: "Height",
key: cc.KEY.h,
filter: function() {
return "undefined" === typeof EditorMap2dDecoratorView || !(this instanceof EditorMap2dDecoratorView)
},
action: function(a) {
switch (a) {
case cc.KEY.up:
this.height++;
break;
case cc.KEY.down:
this.height--
}
}
},
fontSize: {
description: "Font size",
key: cc.KEY.f,
filter: function() {
return this instanceof cc.LabelTTF
},
action: function(a) {
switch (a) {
case cc.KEY.up:
this.setFontSize(this.getFontSize() + 1);
break;
case cc.KEY.down:
this.setFontSize(this.getFontSize() - 1)
}
}
},
textDimensions: {
description: "Text dimensions",
key: cc.KEY.d,
filter: function() {
return this instanceof cc.LabelTTF
},
action: function(a) {
var b = this.getDimensions();
switch (a) {
case cc.KEY.up:
this.setDimensions(b.width, b.height + 1);
break;
case cc.KEY.down:
this.setDimensions(b.width, b.height - 1);
break;
case cc.KEY.left:
this.setDimensions(b.width - 1, b.height);
break;
case cc.KEY.right:
this.setDimensions(b.width + 1, b.height)
}
}
},
move: {
description: "Move",
key: void 0,
action: function(a) {
var b = cleverapps.keyboardController.isPressed(cc.KEY.shift) ? 10 : 1;
switch (a) {
case cc.KEY.left:
this.x -= b;
this.debugBorderDx -= b;
break;
case cc.KEY.right:
this.x += b;
this.debugBorderDx += b;
break;
case cc.KEY.down:
this.y -= b;
this.debugBorderDy -= b;
break;
case cc.KEY.up:
this.y += b,
this.debugBorderDy += b
}
"undefined" !== typeof EditorMap2dDecoratorView && this instanceof EditorMap2dDecoratorView && (a = Map2d.currentMap.getMapView().getCell(this.decorator.x, this.decorator.y),
this.decorator.setupChildren(Math.round((this.x - a.x) / resolutionScale), Math.round((this.y - a.y) / resolutionScale), this.decorator.rotation))
}
}
};
cleverapps.styles.FONTS.SYSTEM = {
type: {
name: "Arial"
},
size: 20,
color: cleverapps.styles.COLORS.BLACK
};
cc.checkGLErrorDebug = function(a, b) {
if (cc._renderType === cc.game.RENDER_TYPE_WEBGL) {
var c = cc._renderContext.getError();
c || "afterCreateProgramObj" !== b || a._programObj instanceof WebGLProgram || (c = "notWebGLProgram");
c && (b = ["error: " + c],
a && (b.push("glProgram._programObj isUndefined: " + ("undefined" === typeof a._programObj)),
b.push("glProgram._programObj is WebGLProgram: " + (a._programObj instanceof WebGLProgram))),
connector.info.isNative && connector.info.os === cc.sys.OS_ANDROID && b.push("info: " + JSON.stringify(cleverapps.info && cleverapps.info.data)),
a = "WebGL error: " + b.join(" - "),
cleverapps.Shaders.initializing ? console.log(a) : cleverapps.throwAsync(a))
}
}
;
cc.Base.prototype.debugGetName = function() {
if (this.debugId)
return this.debugId;
var a = this.constructor
, b = "[unknown]";
[window, cc, ccui, cleverapps, cleverapps.UI, sp, levels].forEach(function(c) {
for (var d in c)
if (c[d] === a) {
b = d;
break
}
});
return b
}
;
cc.Base.prototype.debugParents = function() {
for (var a = [], b = this; b; )
a.push(b.debugGetName()),
b = b.parent;
console.log("cleverapps.sceneDebugger.selectedNode -> " + a.join("->"))
}
;
cc.Base.prototype.debugBorder = function(a) {
if (cleverapps.config.debugMode) {
cleverapps.sceneDebugger.selectedNode = this;
a = a || {};
"object" !== typeof selectedNode || "function" !== typeof selectedNode.unselect || selectedNode === this || selectedNode.stopListeners || selectedNode.unselect();
selectedNode = this;
cleverapps.toolModel.isOpened() && cleverapps.toolModel.refresh();
cleverapps.nodeAttributesPannel && (cleverapps.nodeAttributesPannel.remove(),
cleverapps.nodeAttributesPannel = void 0);
this.debugBorderDx = this.debugBorderDx || 0;
this.debugBorderDy = this.debugBorderDy || 0;
"undefined" !== typeof EditorMap2dDecoratorView && this instanceof EditorMap2dDecoratorView && (this.debugBorderDx = this.decorator.dx || 0,
this.debugBorderDy = this.decorator.dy || 0);
var b = function(l) {
var n = this.getBoundingBox();
if ("undefined" !== typeof UnitView && this instanceof UnitView) {
var p = " " + this.unit.getType() + " " + Unit.GetKey(this.unit)
, q = this.unit.components.map(function(r) {
return r.constructor.name
}).join(" ");
p += q ? "\n" + q : ""
}
n = [this.debugGetName() + (this instanceof cc.LabelTTF ? " " + this.getFontSize() : "") + (p || "") + (this instanceof cleverapps.Spine && this._verts ? " " + this._verts + " verts" : ""), +n.width.toFixed(2) + "x" + +n.height.toFixed(2) + " (" + this.width + "x" + this.height + ")", "scale: " + Math.ceil(100 * this.scaleX) / 100 + " x " + Math.ceil(100 * this.scaleY) / 100, "pos: " + Math.floor(100 * this.x) / 100 + " x " + Math.floor(100 * this.y) / 100, "offset: " + Math.floor(100 * this.debugBorderDx) / 100 + " x " + Math.floor(100 * this.debugBorderDy) / 100, "rotation " + this.rotation];
(p = this.decorator) && void 0 !== p.x && void 0 !== p.y && n.push("cell: " + p.x + " x " + p.y);
console.log(n.join(l));
return n.join(l)
}
.bind(this)
, c = function() {
console.log(b("\t"));
this.labelSavedPtr && a.showPosition && this.labelSavedPtr.setString(b("\n"))
}
.bind(this);
this.debugBorderKeyboardListener = cc.EventListener.create({
event: cc.EventListener.KEYBOARD,
onKeyPressed: function(l) {
for (var n in cleverapps.NodeDebugCommands) {
var p = cleverapps.NodeDebugCommands[n];
if (!p.filter || p.filter.call(this)) {
if (p.key === l && p.toggle) {
p.toggle.call(this);
break
}
if (-1 !== [cc.KEY.up, cc.KEY.down, cc.KEY.right, cc.KEY.left].indexOf(l) && (void 0 === p.key || cleverapps.keyboardController.isPressed(p.key))) {
p.action.call(this, l);
p.noDisplayUpdate || c();
this.spriteSavedPtr && this.spriteSavedPtr.setContentSize(this.getContentSize());
break
}
}
}
}
.bind(this)
});
cc.eventManager.addListener(this.debugBorderKeyboardListener, this);
if (!this.spriteSavedPtr) {
var d = cleverapps.UI.createScale9Sprite(bundles.dev_resources.frames.border, cleverapps.UI.Scale9Rect.TwoPixelY);
d.setAnchorPoint(0, 0);
d.setContentSize(this.getContentSize());
this.spriteSavedPtr = d;
var e = [new cc.Color(255,0,0,255), new cc.Color(255,0,255,0), new cc.Color(255,255,0,0)];
d.setColor(a.color || cleverapps.Random.choose(e, this.debugGetName().length));
e = cc.view.getDevicePixelRatio();
var f = "cocos2d" === engine && 1 < e ? e : 1;
this instanceof cleverapps.Spine && d.setColor(new cc.Color(255,255,0,0));
if (this instanceof cc.LabelTTF && (d.setScale(f),
this.debugRegionForFitTo)) {
d.setColor(new cc.Color(255,255,255,255));
e = this.debugRegionForFitTo.width || this.getContentSize().width;
var g = this.debugRegionForFitTo.height || this.getContentSize().height
, h = 0;
this.debugRegionForFitTo.width && (h = (this.debugRegionForFitTo.width - this.getContentSize().width) / 2);
var k = 0;
this.debugRegionForFitTo.height && (k = this.debugRegionForFitTo.height - this.getContentSize().height,
this.verticalAlign === cc.VERTICAL_TEXT_ALIGNMENT_CENTER && (k /= 2));
d.setContentSize(e, g);
d.x -= h * f;
d.y -= k * f
}
if (e = this.debugButtons = this.createEditButtons(a))
e.setAnchorPoint(0, 1),
e.setPositionRound(d.width, d.height),
d.addChild(e);
this.addChild(d);
d.setLocalZOrder(10)
}
if (!this.labelSavedPtr) {
d = a.labelText ? a.labelText : a.showZOrder ? this.getLocalZOrder() : a.showPosition ? b("\n") : this.getContentSize().width + " x " + this.getContentSize().height + " " + this.debugGetName();
var m = this.labelSavedPtr = cleverapps.UI.generateOnlyText("", cleverapps.styles.FONTS.SYSTEM);
m.setAnchorPoint(0, 0);
m.setLocalZOrder(10);
this.addChild(m);
m._super_setString = m.setString;
m.setString = function() {
m._super_setString.apply(m, arguments);
m.setPosition(0 > this.scaleX ? this.width : 0, 0 > this.scaleY ? 0 : this.height * f);
m.setScaleX(1 / (this.scaleX / f));
m.setScaleY(1 / (this.scaleY / f))
}
.bind(this);
m.setString(d, {
ignoreWarning: !0
})
}
a.showAttributes && cleverapps.flags.nodeDebugPanelMode && this.showNodeDebugPanel()
}
}
;
cc.Base.prototype.showNodeDebugPanel = function() {
this.setCascadeOpacityEnabledRecursively(!0);
this.setRecCascadeColorEnabled(!0);
this.debugButtons && this.debugButtons.setCascadeColorEnabled(!1);
var a = cleverapps.nodeAttributesPannel = document.createElement("div");
Object.assign(a.style, {
position: "absolute",
padding: "3px",
backgroundColor: "rgb(0, 0, 34)",
bottom: "0px",
right: "0px",
display: "grid",
"grid-template-columns": "auto auto",
"justify-items": "center",
"align-items": "center"
});
a.ondragstart = function() {
return !1
}
;
a.onmousedown = function(c) {
function d(h) {
a.style.bottom = "";
a.style.right = "";
a.style.left = h.pageX - f + "px";
a.style.top = h.pageY - g + "px"
}
var e = function(h) {
h = h.getBoundingClientRect();
return {
top: h.top,
left: h.left
}
}(a)
, f = c.pageX - e.left
, g = c.pageY - e.top;
d(c);
document.onmousemove = function(h) {
d(h)
}
;
document.onmouseup = function() {
document.onmousemove = null;
document.onmouseup = null
}
}
;
var b = function(c, d, e, f, g, h) {
var k = document.createElement("input");
k.type = "range";
k.min = String(d);
k.max = String(e);
k.step = String(f);
k.value = String(g || e);
k.style.width = "200px";
k.style.height = "40px";
k.oninput = k.onchange = function() {
h(parseFloat(k.value))
}
;
k.onmousedown = function(m) {
m.stopPropagation()
}
;
k.onwheel = function(m) {
m.preventDefault();
k.value = String(parseFloat(k.value) + (0 <= m.deltaY ? -1 : 1) * f);
h(parseFloat(k.value))
}
;
d = document.createElement("div");
d.innerText = c;
a.appendChild(d);
a.appendChild(k)
};
b("red", 0, 255, 1, this.color.r, function(c) {
var d = this.color;
d.r = c;
cleverapps.sceneDebugger.selectedNode.setColor(d)
}
.bind(this));
b("green", 0, 255, 1, this.color.g, function(c) {
var d = this.color;
d.g = c;
cleverapps.sceneDebugger.selectedNode.setColor(d)
}
.bind(this));
b("blue", 0, 255, 1, this.color.b, function(c) {
var d = this.color;
d.b = c;
cleverapps.sceneDebugger.selectedNode.setColor(d)
}
.bind(this));
b("opacity", 0, 255, 1, this.opacity, function(c) {
this.opacity = c
}
.bind(this));
cc.container.appendChild(a)
}
;
cc.Base.prototype.showUnpackedRes = function() {
var a = 0
, b = void 0
, c = function(d) {
10 > a++ && d.getChildren().forEach(function(k) {
c(k)
});
if (d instanceof cc.Sprite || d instanceof cc.Scale9Sprite) {
var e = d.virtualResource;
if (e) {
var f = e.resolve().originalPath();
if (f) {
var g = f.substring(0, f.indexOf("/"))
, h = f.substring(g.length);
"res" === g && (g = cleverapps.config.name,
h = "/" + f);
h.includes("dev_resources") || (f = "https://github.com/rvvslv/" + g + "/tree/master" + h,
b = b || f,
console.log(e.toString() + "\n" + f))
}
}
}
d.constructor === sp.SkeletonAnimation && (d = cleverapps.Spine.getGitPath(d.jsonName)) && (b = b || d.link,
console.log(d.name + "\n" + d.link))
};
c(this);
return b
}
;
cc.Base.prototype.createEditButtons = function(a) {
delete this.debugEditUnitAnchorsMode;
if (!a.noResLinks) {
var b = cleverapps.styles.NodeDebug.button;
a = function(h) {
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.small_button_green,
content: h.content,
onClicked: h.onClicked,
hint: h.hint,
width: b.width,
height: b.height
})
}
;
var c = this instanceof cc.LabelTTF ? this.showLinkToLocalization() : this.showUnpackedRes();
if (c)
var d = a({
content: new cc.Sprite(bundles.dev_buttons.frames.icon_edit),
hint: "Open link to git",
onClicked: function() {
this.debugTextCode && cleverapps.copyToClipboard(this.debugTextCode);
connector.platform.openUrl(c)
}
.bind(this)
});
if (!cleverapps.git.checkAvailableErrors() && "undefined" !== typeof UnitView && this instanceof UnitView) {
var e = a({
content: cleverapps.UI.generateOnlyText("A", cleverapps.UI.Button.WorkFont()),
hint: "Toggle edit anchors mode",
onClicked: function() {
cleverapps.flags.keyboardAnchorsMode ? cleverapps.notification.create("Disable anchors mode in debug tool (or press 'a').") : (this.debugEditUnitAnchorsMode = !this.debugEditUnitAnchorsMode,
f(),
cleverapps.notification.create("Edit anchors mode " + (this.debugEditUnitAnchorsMode ? "activated" : "switched off")))
}
.bind(this)
})
, f = function() {
e.setType(cleverapps.flags.keyboardAnchorsMode || this.debugEditUnitAnchorsMode ? cleverapps.styles.UI.Button.Images.small_button_blue : cleverapps.styles.UI.Button.Images.small_button_green)
}
.bind(this);
cleverapps.flags.on("change:keyboardAnchorsMode", f, e);
f()
}
if (this.unit && Families[this.unit.code].units[0].mission)
var g = a({
content: new cc.Sprite(bundles.dev_buttons.frames.icon_stages),
hint: "Open unit demo",
onClicked: function() {
var h = cleverapps.RestClient.standsWeb("/?unitsDemo=" + cleverapps.travelBook.currentPage.id + "&code=" + this.unit.code);
connector.platform.openUrl(h)
}
.bind(this)
});
d = [d, e, g].filter(Boolean);
if (d.length)
return new cleverapps.Layout(d,{
direction: cleverapps.UI.HORIZONTAL,
margin: b.margin
})
}
}
;
cc.Base.prototype.showGitLink = function() {
if (this instanceof cc.LabelTTF)
return this.showLinkToLocalization()
}
;
cc.Base.prototype.showLinkToLocalization = function() {
if ("undefined" !== typeof Messages && Messages.debugMapping) {
var a = this.debugTextCode;
var b = Messages.debugMapping[a]
, c = (b = b && b.resolve()) && b.originalPath && b.originalPath();
c ? (b = c.substring(0, c.indexOf("/")),
"res" === b ? (b = cleverapps.config.name,
c = "/" + c) : c = c.substring(c.indexOf("/")),
a = "https://github.com/rvvslv/" + b + "/edit/master" + (c + ("?key=" + a))) : a = void 0;
b = this.debugTextCode || this.getString();
c = Messages.get(b, {
ignoreWarning: !0
}) || b;
console.log(b + "\n" + c + "\n" + (a || "no link found"));
return a
}
}
;
cc.Base.prototype.cleanupBorder = function() {
this.spriteSavedPtr && (this.spriteSavedPtr.removeFromParent(),
delete this.spriteSavedPtr);
this.labelSavedPtr && (this.labelSavedPtr.removeFromParent(),
delete this.labelSavedPtr);
cc.eventManager.removeListener(this.debugBorderKeyboardListener);
"object" === typeof selectedNode && selectedNode === this && (selectedNode = void 0);
cleverapps.sceneDebugger.selectedNode === this && (cleverapps.sceneDebugger.selectedNode = void 0,
cleverapps.toolModel.isOpened() && cleverapps.toolModel.refresh());
cleverapps.nodeAttributesPannel && (cleverapps.nodeAttributesPannel.remove(),
cleverapps.nodeAttributesPannel = void 0)
}
;
cc.Base.prototype.drawRects = function(a) {
this.drawRectsNode && (this.drawRectsNode.removeFromParent(),
this.drawRectsNode = void 0);
this.drawRectsNode = new cc.DrawNode;
this.drawRectsNode.setAnchorPoint(0, 0);
this.drawRectsNode.setContentSize2(this.width, this.height);
this.drawRectsNode.setLocalZOrder(1E4);
this.addChild(this.drawRectsNode);
this.drawRectsNode.getBoundingBoxToWorld = function() {
return cc.rect()
}
;
a.forEach(function(b) {
var c = this.getWorldToNodeTransform();
c = cc.rectApplyAffineTransform(b, c);
this.drawRectsNode.drawRect(cc.p(c.x, c.y), cc.p(c.x + c.width, c.y + c.height), null, 4, cc.color(255, 0, 0, 255));
c = [{
x: c.x,
y: c.y + c.height,
anchorX: 0,
anchorY: 0
}, {
x: c.x + c.width,
y: c.y + c.height,
anchorX: 1,
anchorY: 0
}, {
x: c.x,
y: c.y,
anchorX: 0,
anchorY: 1
}, {
x: c.x + c.width,
y: c.y,
anchorX: 1,
anchorY: 1
}];
b = cleverapps.UI.generateOnlyText(b.name || "Noname", cleverapps.styles.FONTS.SYSTEM);
this.drawRectsNode.addChild(b);
for (var d = 0; d < c.length; ++d) {
var e = c[d];
b.setAnchorPoint(e.anchorX, e.anchorY);
b.setPosition(e.x, e.y);
if (cleverapps.UI.isNodeOnScene(b))
break
}
}
.bind(this))
}
;
var previewRes = function(a) {
var b = function(d) {
var e = cleverapps.scenes.getRunningScene();
e.addChild(d);
d.setPositionRound(e.width / 2, e.height / 2)
};
if (a instanceof VirtualJson) {
var c = function() {
var d = new cleverapps.Spine(a)
, e = Object.keys(d.data.animations);
d.setAnimation(0, e[0], !0);
d.setSkin(d.listSkins()[0] || "default");
d.debugBorder();
b(d);
console.log(e)
};
a = cleverapps.skins.getSlot("spine", {
json: a
}).resolve();
cleverapps.bundleLoader.isLoaded(a.bundleName) ? c() : cleverapps.bundleLoader.loadBundle(a.bundleName, {
onSuccess: c
})
} else
a instanceof VirtualFrame && b(cleverapps.UI.createScale9Sprite(a))
}
, checkFonts = function(a) {
var b = [];
a = a || {};
for (var c = 15; 90 > c; c += 5) {
var d = {
name: a.name || "default",
size: c,
fnt: !0,
stroke: a.stroke,
shadow: a.shadow
}
, e = cleverapps.UI.generateOnlyText("1235", d);
d = cleverapps.UI.generateImageText("1235", d);
e = new cleverapps.Layout([e, d],{
direction: cleverapps.UI.HORIZONTAL,
margin: 5
});
b.push(e)
}
a = new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: 5
});
cleverapps.scenes.getRunningScene().addChild(a);
a.setPositionRound(cleverapps.resolution.getSceneSize().width / 2, cleverapps.resolution.getSceneSize().height / 2)
}
, drawDebugRect = function(a, b) {
var c = new cc.Color(0,0,0,0);
b = b || new cc.Color(255,0,0,255);
var d = cleverapps.scenes.getRunningScene()
, e = d.convertToNodeSpace(cc.rect(a));
a = cc.rect(e.x, e.y, a.width, a.height);
e = new cc.DrawNode;
e.setContentSize2(a.width, a.height);
e.setPositionRound(a.x, a.y);
e.drawRect(cc.p(0, 0), cc.p(a.width, a.height), c, 3, b);
e.setLocalZOrder(1E3);
d.addChild(e);
return e
};
cleverapps.styles.NodeDebug = {
button: {
x: {
align: "right",
dx: 50
},
y: {
align: "top"
},
width: 50,
height: 50,
margin: 5
}
};
cleverapps.Particles = cc.ParticleSystem.extend({
ctor: function(a, b) {
a = a.resolve().getJson();
this._super(Object.assign({}, a, {
spriteFrame: b
}))
},
stop: function(a) {
a = a || function() {}
;
delete this.target;
this.setAutoRemoveOnFinish(!0);
this.stopSystem();
this.runAction(new cc.Sequence(new cc.DelayTime(3),new cc.CallFunc(a),new cc.RemoveSelf))
},
followTarget: function(a) {
this.setPositionType(cc.ParticleSystem.TYPE_RELATIVE);
this.target = a;
this.updateRelativePosition();
addCleaner(a, this.createListener(function() {
this.target === a && this.stop()
}
.bind(this)))
},
updateRelativePosition: function() {
if (this.target && this.getParent() && this.target.getParent()) {
var a = this.getRelativeCoordinates(this.target);
this.setPositionRound(a)
}
},
update: function(a) {
this.updateRelativePosition();
this._super(a)
},
visitTextureBundle: function() {
this._texture && (cc.rendererBundle = this._texture.bundleName)
}
});
var TextWithIcon = cleverapps.Layout.extend({
ctor: function(a, b) {
this._super([], {
direction: b && b.direction || cleverapps.UI.HORIZONTAL,
margin: b && b.margin || cleverapps.styles.TextWithIcon.margin,
align: b && b.align
});
this.textOptions = b || {};
this.customIcons = this.textOptions.icons || {};
this.font = this.textOptions.font || cleverapps.styles.FONTS.BUTTON_TEXT;
this.fontSize = this.font.size;
this.setString(a)
},
calcCurrentSize: function() {
var a = cleverapps.styles.TextWithIcon;
return this.items.reduce(function(b, c, d) {
b.width += c.width * c.scale;
0 < d && (b.width += a.margin);
b.height = Math.max(b.height, c.height * c.scale);
return b
}, cc.size(0, 0))
},
setFontSize: function(a) {
this.fontSize = a;
this._updateFontSize()
},
_updateFontSize: function() {
this.items.forEach(function(a) {
a.isIcon ? a.setScale(this.getIconScale(a)) : a.isSpace ? a.width = this.getSpaceWidth() : a.setFontSize(this.fontSize);
a.setPosition(0, 0)
}, this);
this.reshape()
},
getFontSize: function() {
return this.fontSize
},
fitTo: function(a, b) {
for (var c = 0; 10 > c; c++) {
var d = this.calcCurrentSize();
if (!(a && d.width > a || b && d.height > b))
break;
var e = 1
, f = 1;
a && d.width > a && (e = a / d.width);
b && d.height > b && (f = b / d.height);
d = .9;
e = Math.min(e, f);
.9 < e && 1 > e && (d = e);
e = Math.floor(this.getFontSize() * d);
f = !1;
e < cleverapps.UI.ImageFont.getFontSizeThreshold() && (f = !0,
e = cleverapps.UI.ImageFont.getFontSizeThreshold());
this.setFontSize(e);
if (f)
break
}
},
createItems: function(a) {
return a.map(function(b) {
return TextWithIcon.ICONS[b] || Product.CURRENCY_ICONS[b] || this.customIcons[b] ? this.createIcon(b) : " " === b ? this.createSpace() : this.createText(b)
}, this)
},
getIconScale: function(a) {
if (this.textOptions.iconScale)
return this.textOptions.iconScale;
var b = this.fontSize * (this.textOptions.iconMinHeight || 1)
, c = this.fontSize * (this.textOptions.iconMaxHeight || 1);
return a.height && a.height < b ? b / a.height : a.height && a.height > c ? c / a.height : 1
},
getSpaceWidth: function() {
return .2 * this.fontSize
},
createIcon: function(a) {
a = this.chooseImage(a);
a instanceof cc.Node || (a = new cc.Sprite(a));
a.setScale(this.getIconScale(a));
a.isIcon = !0;
return a
},
createSpace: function() {
var a = new cc.Node;
a.setAnchorPoint(.5, .5);
a.setContentSize(this.getSpaceWidth(), 1);
a.isSpace = !0;
return a
},
createText: function(a) {
a = this.textOptions.notLocalized ? cleverapps.UI.__generateNotLocalizedText(a, this.font) : cleverapps.UI.ImageFont.IsApplicable(this.font, a) ? cleverapps.UI.generateImageText(a, this.font) : cleverapps.UI.generateOnlyText(a, this.font);
a.setFontSize(this.fontSize);
return a
},
parseText: function(a) {
a = a.trim();
a = a.replace(/ +/, " ");
for (var b = [], c = [].concat(Object.keys(TextWithIcon.ICONS), Object.keys(Product.CURRENCY_ICONS), Object.keys(this.customIcons)), d = 0; ; ) {
for (var e = a.length, f = void 0, g = 0; g < c.length && e !== d; ++g) {
var h = c[g]
, k = a.indexOf(h, d);
0 <= k && k < e && (e = k,
f = h)
}
b.push(a.slice(d, e));
if (!f)
break;
b.push(f);
d = e + f.length
}
a = [];
for (c = 0; c < b.length; ++c)
d = b[c],
0 !== d.length && (1 === d.length ? a.push(d) : (" " === d[0] && a.push(" "),
a.push(d.trim()),
" " === d[d.length - 1] && a.push(" ")));
return a
},
chooseImage: function(a) {
var b = this.customIcons[a];
if (b)
return b;
if (b = Product.CURRENCY_ICONS[a])
return b.url;
b = TextWithIcon.ICONS[a].filter(function(c) {
return cleverapps.bundleLoader.isLoaded(c.bundle)
}).sort(function(c, d) {
return Math.abs(1 - this.fontSize / c.size) - Math.abs(1 - this.fontSize / d.size)
})[0];
return cleverapps.skins.getSlot(b.name) || bundles[b.bundle].frames[b.name]
},
setString: function(a) {
this.originalString = a;
a = this.parseText("" + a);
this.items = this.createItems(a);
this.textOptions.width && this.fitTo(this.textOptions.width, this.textOptions.height);
this.removeAllChildren();
this.items.forEach(function(b) {
this.addChild(b)
}, this);
this.reshape()
},
getString: function() {
return this.originalString
},
setFont: function(a) {
this.font = a;
this.fontSize = a.size;
this.setString(this.originalString)
}
});
TextWithIcon.IsApplicable = function(a, b) {
if (b)
return !0;
var c;
a += "";
for (c in TextWithIcon.ICONS)
if (-1 !== a.indexOf(c))
return !0;
for (c in Product.CURRENCY_ICONS)
if (-1 !== a.indexOf(c))
return !0;
return !1
}
;
TextWithIcon.ICONS_BY_NAME = {
rubies: "$$",
hard: "$$",
gold: "$$",
energy: "%%",
coins: "@@",
soft: "@@",
wands: "++",
speedup: ">>",
ads: "##"
};
TextWithIcon.ICONS = {
$$: [{
name: "gold_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}, {
name: "big_gold_icon_png",
bundle: "big_buttons",
size: 90
}],
"@@": [{
name: "coin_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}, {
name: "big_coin_icon_png",
bundle: "big_buttons",
size: 90
}],
"##": [{
name: "ad_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}, {
name: "big_ad_icon_png",
bundle: "big_buttons",
size: 90
}],
"%%": [{
name: "energy_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}],
"^^": [{
name: "instant_worker_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}],
"++": [{
name: "wand_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}],
"--": [{
name: "worker_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}],
">>": [{
name: "speedup_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}],
"<<": [{
name: "feed_icon_png",
bundle: "buttons_inlined_icons",
size: 50
}]
};
cleverapps.styles.TextWithIcon = {
margin: 0
};
var ShadowLayer = cc.Scale9Sprite.extend({
ctor: function() {
this._super(bundles.pixel.frames.pixel_png);
this.setColor(cleverapps.styles.COLORS.BLACK);
this.setAnchorPoint(0, 0);
this.setOpacity(0);
this.setVisible(!1);
this.show = !1;
this.updateSize();
cleverapps.scenes.getRunningScene().addChild(this)
},
subscribeToWindows: function() {
cleverapps.windows.on("hideShadow", this.deleteShadow.bind(this), this);
cleverapps.windows.on("showShadow", this.createShadow.bind(this), this);
cleverapps.windows.on("moveShadowUp", this.moveUp.bind(this), this);
cleverapps.windows.on("moveShadowDown", this.moveDown.bind(this), this)
},
updateSize: function() {
var a = cleverapps.styles.ShadowLayer.padding
, b = cleverapps.resolution.getBgRect();
this.setContentSize(b.width + 2 * a, b.height + 2 * a);
this.setPositionRound(b.x - a, b.y - a)
},
createShadow: function(a) {
this.show || (this.show = !0,
this.stopAllActions(),
this.visible = !0,
this.updateSize(),
this.runAction(new cc.Sequence(new cc.DelayTime(a ? 1 : 0),new cc.FadeTo(.3,150))))
},
deleteShadow: function() {
this.show && (this.show = !1,
this.stopAllActions(),
this.runAction(new cc.Sequence(new cc.FadeTo(.2,0),new cc.Hide)))
},
moveUp: function() {
this.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 8)
},
moveDown: function() {
this.setLocalZOrder(BaseWindow.WINDOWS_ZORDER - 3)
}
});
cleverapps.styles.ShadowLayer = {
padding: 10
};
cc.eventManager._sortEventListenersOfSceneGraphPriorityDes = function(a, b) {
var c = cc.eventManager._nodePriorityMap
, d = a._getSceneGraphPriority()
, e = b._getSceneGraphPriority();
if (!b || !e || !c[e.__instanceId])
return -1;
if (!a || !d || !c[d.__instanceId])
return 1;
c = c[b._getSceneGraphPriority().__instanceId] - c[a._getSceneGraphPriority().__instanceId];
return 0 === c ? b.__instanceId - a.__instanceId : c
}
;
if ("cocos2d" === engine) {
cc.KEYBOARD_RETURNTYPE_DEFAULT = 0;
cc.KEYBOARD_RETURNTYPE_DONE = 1;
cc.KEYBOARD_RETURNTYPE_SEND = 2;
cc.KEYBOARD_RETURNTYPE_SEARCH = 3;
cc.KEYBOARD_RETURNTYPE_GO = 4;
cc.EDITBOX_INPUT_MODE_ANY = 0;
cc.EDITBOX_INPUT_MODE_EMAILADDR = 1;
cc.EDITBOX_INPUT_MODE_NUMERIC = 2;
cc.EDITBOX_INPUT_MODE_PHONENUMBER = 3;
cc.EDITBOX_INPUT_MODE_URL = 4;
cc.EDITBOX_INPUT_MODE_DECIMAL = 5;
cc.EDITBOX_INPUT_MODE_SINGLELINE = 6;
cc.EDITBOX_INPUT_FLAG_PASSWORD = 0;
cc.EDITBOX_INPUT_FLAG_SENSITIVE = 1;
cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD = 2;
cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE = 3;
cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS = 4;
cc.EditBoxDelegate = cc.Class.extend({
editBoxEditingDidBegin: function() {},
editBoxEditingDidEnd: function() {},
editBoxTextChanged: function() {},
editBoxReturn: function() {}
});
cc.EditBox = cc.Node.extend({
_backgroundSprite: null,
_delegate: null,
_editBoxInputMode: cc.EDITBOX_INPUT_MODE_ANY,
_editBoxInputFlag: cc.EDITBOX_INPUT_FLAG_SENSITIVE,
_keyboardReturnType: cc.KEYBOARD_RETURNTYPE_DEFAULT,
_maxLength: 50,
_text: "",
_textColor: null,
_placeholderText: "",
_placeholderFontName: "",
_placeholderFontSize: 14,
_placeholderColor: null,
_className: "EditBox",
_touchListener: null,
_touchEnabled: !0,
ctor: function(a, b, c) {
cc.Node.prototype.ctor.call(this);
this._anchorPoint = cc.p(.5, .5);
this._textColor = cc.color.WHITE;
this._placeholderColor = cc.color.GRAY;
this._oneLine = c;
this._renderCmd._createLabels();
this.createDomElementIfNeeded();
this.initWithSizeAndBackgroundSprite(a, b);
this._touchListener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: !0,
onTouchBegan: this._onTouchBegan.bind(this),
onTouchEnded: this._onTouchEnded.bind(this)
});
cc.eventManager.addListener(this._touchListener, this);
this.setInputFlag(this._editBoxInputFlag)
},
setTouchEnabled: function(a) {
this._touchEnabled !== a && ((this._touchEnabled = a) ? cc.eventManager.addListener(this._touchListener, this) : cc.eventManager.removeListener(this._touchListener))
},
_createRenderCmd: function() {
return cc._renderType === cc.game.RENDER_TYPE_CANVAS ? new cc.EditBox.CanvasRenderCmd(this) : new cc.EditBox.WebGLRenderCmd(this)
},
setContentSize: function(a, b) {
void 0 !== a.width && void 0 !== a.height && (b = a.height,
a = a.width);
cc.Node.prototype.setContentSize.call(this, a, b);
this._updateEditBoxSize(a, b)
},
setVisible: function(a) {
cc.Node.prototype.setVisible.call(this, a);
this._renderCmd.updateVisibility()
},
createDomElementIfNeeded: function() {
this._renderCmd._edTxt || this._renderCmd._createDomTextArea()
},
setTabIndex: function(a) {
this._renderCmd._edTxt && (this._renderCmd._edTxt.tabIndex = a)
},
getTabIndex: function() {
if (this._renderCmd._edTxt)
return this._renderCmd._edTxt.tabIndex;
cc.warn("The dom control is not created!");
return -1
},
setFocus: function() {
this._renderCmd._edTxt && (this.previousActive = document.activeElement,
this._renderCmd._edTxt.focus())
},
setBlur: function() {
this._renderCmd._edTxt && (this._renderCmd._edTxt.blur(),
this.previousActive && (this.previousActive.focus(),
this.previousActive = void 0))
},
isFocused: function() {
if (this._renderCmd._edTxt)
return document.activeElement === this._renderCmd._edTxt;
cc.warn("The dom control is not created!");
return !1
},
stayOnTop: function(a) {
this._alwaysOnTop !== a && (this._alwaysOnTop = a,
this._renderCmd.stayOnTop(this._alwaysOnTop))
},
cleanup: function() {
this._super();
this._renderCmd._removeDomFromGameContainer()
},
_isAncestorsVisible: function(a) {
return null == a ? !0 : (a = a.getParent()) && !a.isVisible() ? !1 : this._isAncestorsVisible(a)
},
_onTouchBegan: function(a) {
if (this.isVisible() && this._isAncestorsVisible(this)) {
a = a.getLocation();
var b = cc.rect(0, 0, this._contentSize.width, this._contentSize.height);
if (cc.rectContainsPoint(b, this.convertToNodeSpace(a)))
return !0;
this._renderCmd._endEditing();
return !1
}
},
_onTouchEnded: function() {
this.isVisible() && this._isAncestorsVisible(this) && this._renderCmd._beginEditing()
},
_updateBackgroundSpriteSize: function(a, b) {
this._backgroundSprite && this._backgroundSprite.setContentSize(a, b)
},
_updateEditBoxSize: function(a, b) {
var c = "number" === typeof a.width ? a.width : a;
a = "number" === typeof a.height ? a.height : b;
this._updateBackgroundSpriteSize(c, a);
this._renderCmd.updateSize(c, a)
},
setLineHeight: function(a) {
this._renderCmd.setLineHeight(a)
},
setFont: function(a, b) {
this._renderCmd.setFont(a, b)
},
_setFont: function(a) {
this._renderCmd._setFont(a)
},
getBackgroundSprite: function() {
return this._backgroundSprite
},
setFontName: function(a) {
this._renderCmd.setFontName(a)
},
setFontSize: function(a) {
this._renderCmd.setFontSize(a)
},
setString: function(a) {
a.length >= this._maxLength && (a = a.slice(0, this._maxLength));
this._text = a;
this._renderCmd.setString(a)
},
setFontColor: function(a) {
this._textColor = a;
this._renderCmd.setFontColor(a)
},
setMaxLength: function(a) {
isNaN(a) || (0 > a && (a = 65535),
this._maxLength = a,
this._renderCmd.setMaxLength(a))
},
getMaxLength: function() {
return this._maxLength
},
setPlaceHolder: function(a) {
null !== a && (this._renderCmd.setPlaceHolder(a),
this._placeholderText = a)
},
setPlaceholderFont: function(a, b) {
this._placeholderFontName = a;
this._placeholderFontSize = b;
this._renderCmd._updateDOMPlaceholderFontStyle()
},
_setPlaceholderFont: function(a) {
if (a = cc.LabelTTF._fontStyleRE.exec(a))
this._placeholderFontName = a[2],
this._placeholderFontSize = parseInt(a[1]),
this._renderCmd._updateDOMPlaceholderFontStyle()
},
setPlaceholderFontName: function(a) {
this._placeholderFontName = a;
this._renderCmd._updateDOMPlaceholderFontStyle()
},
setPlaceholderFontSize: function(a) {
this._placeholderFontSize = a;
this._renderCmd._updateDOMPlaceholderFontStyle()
},
setPlaceholderFontColor: function(a) {
this._placeholderColor = a;
this._renderCmd.setPlaceholderFontColor(a)
},
setInputFlag: function(a) {
this._editBoxInputFlag = a;
this._renderCmd.setInputFlag(a)
},
getString: function() {
return this._text
},
initWithSizeAndBackgroundSprite: function(a, b) {
this._backgroundSprite && this._backgroundSprite.removeFromParent();
this._backgroundSprite = b;
this.setContentSize(a);
this._backgroundSprite && !this._backgroundSprite.parent && (this._backgroundSprite.setAnchorPoint(cc.p(0, 0)),
this.addChild(this._backgroundSprite),
this._updateBackgroundSpriteSize(a.width, a.height));
this.y = this.x = 0;
return !0
},
setDelegate: function(a) {
this._delegate = a
},
getPlaceHolder: function() {
return this._placeholderText
},
setInputMode: function(a) {
if (this._editBoxInputMode !== a) {
var b = this.getString();
this._editBoxInputMode = a;
this._renderCmd.setInputMode(a);
this._renderCmd.transform();
this.setString(b);
this._renderCmd._updateLabelPosition(this.getContentSize())
}
},
setReturnType: function(a) {
this._keyboardReturnType = a;
this._renderCmd._updateDomInputType()
},
initWithBackgroundColor: function(a, b) {
this._edWidth = a.width;
this.dom.style.width = this._edWidth.toString() + "px";
this._edHeight = a.height;
this.dom.style.height = this._edHeight.toString() + "px";
this.dom.style.backgroundColor = cc.colorToHex(b)
}
});
var _editBoxPrototype = cc.EditBox.prototype;
_editBoxPrototype.font;
cc.defineGetterSetter(_editBoxPrototype, "font", null, _editBoxPrototype._setFont);
_editBoxPrototype.fontName;
cc.defineGetterSetter(_editBoxPrototype, "fontName", null, _editBoxPrototype.setFontName);
_editBoxPrototype.fontSize;
cc.defineGetterSetter(_editBoxPrototype, "fontSize", null, _editBoxPrototype.setFontSize);
_editBoxPrototype.fontColor;
cc.defineGetterSetter(_editBoxPrototype, "fontColor", null, _editBoxPrototype.setFontColor);
_editBoxPrototype.string;
cc.defineGetterSetter(_editBoxPrototype, "string", _editBoxPrototype.getString, _editBoxPrototype.setString);
_editBoxPrototype.maxLength;
cc.defineGetterSetter(_editBoxPrototype, "maxLength", _editBoxPrototype.getMaxLength, _editBoxPrototype.setMaxLength);
_editBoxPrototype.placeHolder;
cc.defineGetterSetter(_editBoxPrototype, "placeholder", _editBoxPrototype.getPlaceHolder, _editBoxPrototype.setPlaceHolder);
_editBoxPrototype.placeHolderFont;
cc.defineGetterSetter(_editBoxPrototype, "placeholderFont", null, _editBoxPrototype._setPlaceholderFont);
_editBoxPrototype.placeHolderFontName;
cc.defineGetterSetter(_editBoxPrototype, "placeholderFontName", null, _editBoxPrototype.setPlaceholderFontName);
_editBoxPrototype.placeHolderFontSize;
cc.defineGetterSetter(_editBoxPrototype, "placeholderFontSize", null, _editBoxPrototype.setPlaceholderFontSize);
_editBoxPrototype.placeHolderFontColor;
cc.defineGetterSetter(_editBoxPrototype, "placeholderFontColor", null, _editBoxPrototype.setPlaceholderFontColor);
_editBoxPrototype.inputFlag;
cc.defineGetterSetter(_editBoxPrototype, "inputFlag", null, _editBoxPrototype.setInputFlag);
_editBoxPrototype.delegate;
cc.defineGetterSetter(_editBoxPrototype, "delegate", null, _editBoxPrototype.setDelegate);
_editBoxPrototype.inputMode;
cc.defineGetterSetter(_editBoxPrototype, "inputMode", null, _editBoxPrototype.setInputMode);
_editBoxPrototype.returnType;
cc.defineGetterSetter(_editBoxPrototype, "returnType", null, _editBoxPrototype.setReturnType);
_editBoxPrototype = null;
cc.EditBox.create = function(a, b, c, d) {
return new cc.EditBox(a,b,c,d)
}
;
(function(a) {
a._polyfill = {
zoomInvalid: !1
};
cc.sys.OS_ANDROID !== cc.sys.os || cc.sys.browserType !== cc.sys.BROWSER_TYPE_SOUGOU && cc.sys.browserType !== cc.sys.BROWSER_TYPE_360 || (a._polyfill.zoomInvalid = !0)
}
)(cc.EditBox);
(function(a) {
function b(f) {
var g = f.convertToWorldSpace(cc.p(0, 0))
, h = cc.visibleRect.height
, k = .5;
cc.visibleRect.width > h && (k = .7);
setTimeout(function() {
if (40 > window.scrollY && g.y < h * k) {
var m = h * k - g.y - window.scrollY;
35 > m && (m = 35);
320 < m && (m = 320);
window.scrollTo(m, m)
}
}, 400)
}
var c = function(f) {
return f.replace(/(?:^|\s)\S/g, function(g) {
return g.toUpperCase()
})
}
, d = function() {}
.prototype = Object.create(Object.prototype);
d.updateMatrix = function() {
if (this._edTxt) {
var f = this._node
, g = cc.view._scaleX
, h = cc.view._scaleY
, k = cc.view._devicePixelRatio
, m = this._worldTransform;
g /= k;
h /= k;
var l = cc.game.container;
k = m.a * g;
var n = m.b
, p = m.c
, q = m.d * h
, r = l && l.style.paddingLeft && parseInt(l.style.paddingLeft);
l = l && l.style.paddingBottom && parseInt(l.style.paddingBottom);
g = m.tx * g + r;
h = m.ty * h + l;
a.zoomInvalid && (this.updateSize(f._contentSize.width * k, f._contentSize.height * q),
q = k = 1);
f = "matrix(" + k + "," + -n + "," + -p + "," + q + "," + g + "," + -h + ")";
this._edTxt.style.transform = f;
this._edTxt.style["-webkit-transform"] = f;
this._edTxt.style["transform-origin"] = "0px 100% 0px";
this._edTxt.style["-webkit-transform-origin"] = "0px 100% 0px"
}
}
;
d.updateVisibility = function() {
this._edTxt && (this._edTxt.style.visibility = this._node.visible ? "visible" : "hidden")
}
;
d.stayOnTop = function(f) {
f ? (this._removeLabels(),
this._edTxt.style.display = "") : (this._createLabels(),
this._edTxt.style.display = "none",
this._showLabels())
}
;
d._beginEditingOnMobile = function(f) {
this.__orientationChanged = function() {
b(f)
}
;
window.addEventListener("orientationchange", this.__orientationChanged);
cc.view.isAutoFullScreenEnabled() ? (this.__fullscreen = !0,
cc.view.enableAutoFullScreen(!1),
cc.screen.exitFullScreen()) : this.__fullscreen = !1;
this.__autoResize = cc.view.__resizeWithBrowserSize;
cc.view.resizeWithBrowserSize(!1)
}
;
d._endEditingOnMobile = function() {
if (this.__rotateScreen) {
var f = cc.game.container.style;
f["-webkit-transform"] = "rotate(90deg)";
f.transform = "rotate(90deg)";
f = cc.view;
var g = f._originalDesignResolutionSize.width
, h = f._originalDesignResolutionSize.height;
0 < g && f.setDesignResolutionSize(g, h, f._resolutionPolicy);
this.__rotateScreen = !1
}
window.removeEventListener("orientationchange", this.__orientationChanged);
window.scrollTo(0, 0);
this.__fullscreen && cc.view.enableAutoFullScreen(!0);
this.__autoResize && cc.view.resizeWithBrowserSize(!0)
}
;
d._onFocusOnMobile = function(f) {
if (cc.view._isRotated) {
var g = cc.game.container.style;
g["-webkit-transform"] = "rotate(0deg)";
g.transform = "rotate(0deg)";
g.margin = "0px";
window.scrollTo(35, 35);
this.__rotateScreen = !0
} else
this.__rotateScreen = !1;
b(f)
}
;
d._createDomInput = function() {
this._removeDomFromGameContainer();
var f = this
, g = this._edTxt = document.createElement("input");
g.type = "text";
g.style.fontFamily = this._edFontName;
g.style.fontSize = this._edFontSize + "px";
g.style.color = "#000000";
g.style.border = 0;
g.style.background = "transparent";
g.style.width = "100%";
g.style.height = "100%";
g.style.active = 0;
g.style.outline = "medium";
g.style.padding = "0";
g.style.textTransform = "uppercase";
g.style.display = "none";
g.style.position = "absolute";
g.style.bottom = "0px";
g.style.left = "2px";
g.style.className = "cocosEditBox";
this.setMaxLength(f._editBox._maxLength);
g.addEventListener("input", function() {
var h = f._editBox;
this.value.length > this.maxLength && (this.value = this.value.slice(0, this.maxLength));
h._delegate && h._delegate.editBoxTextChanged && h._text !== this.value && (h._text = this.value,
f._updateDomTextCases(),
h._delegate.editBoxTextChanged(h, h._text))
});
g.addEventListener("keypress", function(h) {
var k = f._editBox;
h.keyCode === cc.KEY.enter && (h.stopPropagation(),
h.preventDefault(),
"" === this.value && (this.style.fontSize = k._placeholderFontSize + "px",
this.style.color = cc.colorToHex(k._placeholderColor)),
k._text = this.value,
f._updateDomTextCases(),
f._endEditing(),
k._delegate && k._delegate.editBoxReturn && k._delegate.editBoxReturn(k),
cc._canvas.focus())
});
g.addEventListener("focus", function() {
var h = f._editBox;
this.style.fontSize = f._edFontSize + "px";
this.style.color = cc.colorToHex(h._textColor);
f._hiddenLabels();
cc.sys.isMobile && f._onFocusOnMobile(h);
h._delegate && h._delegate.editBoxEditingDidBegin && h._delegate.editBoxEditingDidBegin(h)
});
g.addEventListener("blur", function() {
var h = f._editBox;
h._text = this.value;
f._updateDomTextCases();
h._delegate && h._delegate.editBoxEditingDidEnd && h._delegate.editBoxEditingDidEnd(h);
"" === this.value && (this.style.fontSize = h._placeholderFontSize + "px",
this.style.color = cc.colorToHex(h._placeholderColor));
f._endEditing()
});
this._addDomToGameContainer();
return g
}
;
d._createDomTextArea = function() {
this._removeDomFromGameContainer();
var f = this
, g = this._edTxt = document.createElement("textarea");
g.type = "text";
g.style.fontFamily = this._edFontName;
g.style.fontSize = this._edFontSize + "px";
g.style.color = "#000000";
g.style.border = 0;
g.style.background = "transparent";
g.style.width = "100%";
g.style.height = "100%";
g.style.active = 0;
g.style.outline = "medium";
g.style.padding = "0";
g.style.resize = "none";
this._node._oneLine ? (g.wrap = "off",
g.style.overflow = "hidden") : g.style.overflow_y = "scroll";
g.style.textTransform = "uppercase";
g.style.display = "none";
g.style.position = "absolute";
g.style.bottom = "0px";
g.style.left = "2px";
g.style.className = "cocosEditBox";
this.setMaxLength(f._editBox._maxLength);
g.addEventListener("input", function() {
this.value.length > this.maxLength && (this.value = this.value.slice(0, this.maxLength));
var h = f._editBox;
h._delegate && h._delegate.editBoxTextChanged && h._text.toLowerCase() !== this.value.toLowerCase() && (h._text = this.value,
f._updateDomTextCases(),
h._delegate.editBoxTextChanged(h, h._text))
});
g.addEventListener("focus", function() {
var h = f._editBox;
f._hiddenLabels();
this.style.fontSize = f._edFontSize + "px";
this.style.color = cc.colorToHex(h._textColor);
cc.sys.isMobile && f._onFocusOnMobile(h);
h._delegate && h._delegate.editBoxEditingDidBegin && h._delegate.editBoxEditingDidBegin(h)
});
g.addEventListener("keypress", function(h) {
var k = f._editBox;
h.keyCode === cc.KEY.enter && (h.stopPropagation(),
k._delegate && k._delegate.editBoxReturn && k._delegate.editBoxReturn(k))
});
g.addEventListener("keyup", function(h) {
var k = f._editBox;
k._delegate && k._delegate.editBoxOnKeyUp && (h.stopPropagation(),
k._delegate.editBoxOnKeyUp(h.keyCode))
});
g.addEventListener("blur", function() {
var h = f._editBox;
h._text = this.value;
f._updateDomTextCases();
h._delegate && h._delegate.editBoxEditingDidEnd && h._delegate.editBoxEditingDidEnd(h);
"" === this.value && (this.style.fontSize = h._placeholderFontSize + "px",
this.style.color = cc.colorToHex(h._placeholderColor));
f._endEditing()
});
this._addDomToGameContainer();
return g
}
;
d._createLabels = function() {
var f = this._editBox.getContentSize();
this._textLabel || (this._textLabel = new cc.LabelTTF,
this._textLabel.setAnchorPoint(cc.p(0, 1)),
this._editBox.addChild(this._textLabel, 100));
this._placeholderLabel || (this._placeholderLabel = new cc.LabelTTF,
this._placeholderLabel.setAnchorPoint(cc.p(0, 1)),
this._placeholderLabel.setColor(cc.color.GRAY),
this._editBox.addChild(this._placeholderLabel, 100));
this._updateLabelPosition(f)
}
;
d._removeLabels = function() {
this._textLabel && (this._editBox.removeChild(this._textLabel),
this._textLabel = null)
}
;
d._updateLabelPosition = function(f) {
if (this._textLabel && this._placeholderLabel) {
var g = cc.size(f.width - 2, f.height);
this._textLabel.setContentSize(g);
this._textLabel.setDimensions(g);
this._placeholderLabel.setLineHeight(f.height);
g = this._placeholderLabel.getContentSize();
var h = Math.round(.08 * g.height);
this._editBox._editBoxInputMode === cc.EDITBOX_INPUT_MODE_ANY ? (this._textLabel.setPosition(2, f.height),
this._placeholderLabel.setPosition(2, f.height + h),
this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP),
this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP)) : (this._textLabel.setPosition(2, f.height),
this._placeholderLabel.setPosition(2, (f.height + g.height) / 2 + h),
this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),
this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER))
}
}
;
d.setLineHeight = function(f) {
this._textLabel && this._textLabel.setLineHeight(f)
}
;
d._hiddenLabels = function() {
this._textLabel && this._textLabel.setVisible(!1);
this._placeholderLabel && this._placeholderLabel.setVisible(!1)
}
;
d._updateDomTextCases = function() {
var f = this._editBox._editBoxInputFlag;
if (f === cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS)
this._editBox._text = this._editBox._text.toUpperCase();
else if (f === cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD)
this._editBox._text = c(this._editBox._text);
else if (f === cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE) {
f = this._editBox;
var g = this._editBox._text;
g = g.charAt(0).toUpperCase() + g.slice(1);
f._text = g
}
}
;
d._updateLabelStringStyle = function() {
if ("password" === this._edTxt.type) {
for (var f = "", g = this._editBox._text.length, h = 0; h < g; ++h)
f += "\u25cf";
this._textLabel && this._textLabel.setString(f)
} else
this._updateDomTextCases(),
this._textLabel && this._textLabel.setString(this._editBox._text)
}
;
d._showLabels = function() {
this._hiddenLabels();
"" === this._edTxt.value ? this._placeholderLabel && (this._placeholderLabel.setVisible(!0),
this._placeholderLabel.setString(this._editBox._placeholderText)) : this._textLabel && (this._textLabel.setVisible(!0),
this._textLabel.setString(this._editBox._text));
this._updateLabelStringStyle()
}
;
d._beginEditing = function() {
this._editBox._alwaysOnTop || "none" !== this._edTxt.style.display || (this._edTxt.style.display = "",
this._edTxt.focus());
cc.sys.isMobile && !this._editingMode && this._beginEditingOnMobile(this._editBox);
this._editingMode = !0
}
;
d._endEditing = function() {
this._editBox._alwaysOnTop || (this._edTxt.style.display = "none");
this._showLabels();
if (cc.sys.isMobile && this._editingMode) {
var f = this;
setTimeout(function() {
f._endEditingOnMobile()
}, 400)
}
this._editingMode = !1
}
;
d._setFont = function(f) {
f = cc.LabelTTF._fontStyleRE.exec(f);
var g = f[2]
, h = parseInt(f[1]);
f && this.setFont(g, h)
}
;
d.setFont = function(f, g) {
this._edFontName = f || this._edFontName;
this._edFontSize = g || this._edFontSize;
this._updateDOMFontStyle()
}
;
d.setFontName = function(f) {
this._edFontName = f || this._edFontName;
this._updateDOMFontStyle()
}
;
d.setFontSize = function(f) {
this._edFontSize = f || this._edFontSize;
this._updateDOMFontStyle()
}
;
d.setFontColor = function(f) {
this._edTxt && (this._edTxt.value !== this._editBox._placeholderText && (this._edTxt.style.color = cc.colorToHex(f)),
this._textLabel && this._textLabel.setColor(f))
}
;
d.setPlaceHolder = function(f) {
this._placeholderLabel.setString(f)
}
;
d.setMaxLength = function(f) {
this._edTxt && (this._edTxt.maxLength = f)
}
;
d._updateDOMPlaceholderFontStyle = function() {
this._placeholderLabel.setFontName(this._editBox._placeholderFontName);
this._placeholderLabel.setFontSize(this._editBox._placeholderFontSize)
}
;
d.setPlaceholderFontColor = function(f) {
this._placeholderLabel.setColor(f)
}
;
d._updateDomInputType = function() {
var f = this._editBox._editBoxInputMode;
f === cc.EDITBOX_INPUT_MODE_EMAILADDR ? this._edTxt.type = "email" : f === cc.EDITBOX_INPUT_MODE_DECIMAL || f === cc.EDITBOX_INPUT_MODE_NUMERIC ? this._edTxt.type = "number" : f === cc.EDITBOX_INPUT_MODE_PHONENUMBER ? (this._edTxt.type = "number",
this._edTxt.pattern = "[0-9]*") : f === cc.EDITBOX_INPUT_MODE_URL ? this._edTxt.type = "url" : (this._edTxt.type = "text",
this._editBox._keyboardReturnType === cc.KEYBOARD_RETURNTYPE_SEARCH && (this._edTxt.type = "search"));
this._editBox._editBoxInputFlag === cc.EDITBOX_INPUT_FLAG_PASSWORD && (this._edTxt.type = "password")
}
;
d.setInputFlag = function(f) {
this._edTxt && (this._updateDomInputType(),
this._edTxt.style.textTransform = "none",
f === cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS ? this._edTxt.style.textTransform = "uppercase" : f === cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD && (this._edTxt.style.textTransform = "capitalize"),
this._updateLabelStringStyle())
}
;
d.setInputMode = function(f) {
f === cc.EDITBOX_INPUT_MODE_ANY ? this._createDomTextArea() : this._createDomInput();
this._updateDomInputType();
f = this._node.getContentSize();
this.updateSize(f.width, f.height)
}
;
d.setString = function(f) {
this._edTxt && null !== f && (this._edTxt.value = f,
"" === f ? (this._placeholderLabel && (this._placeholderLabel.setString(this._editBox._placeholderText),
this._placeholderLabel.setColor(this._editBox._placeholderColor)),
this._editingMode || (this._placeholderLabel && this._placeholderLabel.setVisible(!0),
this._textLabel && this._textLabel.setVisible(!1))) : (this._edTxt.style.color = cc.colorToHex(this._editBox._textColor),
this._textLabel && this._textLabel.setColor(this._editBox._textColor),
this._editingMode || (this._placeholderLabel && this._placeholderLabel.setVisible(!1),
this._textLabel && this._textLabel.setVisible(!0)),
this._updateLabelStringStyle()))
}
;
d._updateDOMFontStyle = function() {
this._edTxt && (this._edTxt.style.fontFamily = this._edFontName,
this._edTxt.style.fontSize = this._edFontSize + "px",
this._textLabel && (this._textLabel.setFontSize(this._edFontSize),
this._textLabel.setFontName(this._edFontName)))
}
;
d.updateSize = function(f, g) {
var h = this._edTxt;
h && (h.style.width = f + "px",
h.style.height = g + "px",
this._updateLabelPosition(cc.size(f, g)))
}
;
d._addDomToGameContainer = function() {
cc.game.container.appendChild(this._edTxt)
}
;
d._removeDomFromGameContainer = function() {
var f = this._edTxt;
f && ("contains"in cc.game.container ? cc.game.container.contains(f) : cc.game.container.compareDocumentPosition(f) % 16) && cc.game.container.removeChild(f);
this._edTxt = null
}
;
d.initializeRenderCmd = function(f) {
this._editBox = f;
this._edFontSize = 14;
this._edFontName = "Arial";
this._placeholderLabel = this._textLabel = null;
this.__rotateScreen = this.__autoResize = this.__fullscreen = this._editingMode = !1;
this.__orientationChanged = null
}
;
cc.EditBox.CanvasRenderCmd = function(f) {
this._rootCtor(f);
this.initializeRenderCmd(f)
}
;
var e = cc.EditBox.CanvasRenderCmd.prototype = Object.create(cc.Node.CanvasRenderCmd.prototype);
cc.inject(d, e);
e.constructor = cc.EditBox.CanvasRenderCmd;
e.transform = function(f, g) {
this.originTransform(f, g);
this.updateMatrix()
}
;
cc.EditBox.WebGLRenderCmd = function(f) {
this._rootCtor(f);
this.initializeRenderCmd(f)
}
;
e = cc.EditBox.WebGLRenderCmd.prototype = Object.create(cc.Node.WebGLRenderCmd.prototype);
cc.inject(d, e);
e.constructor = cc.EditBox.WebGLRenderCmd;
e.transform = function(f, g) {
this.originTransform(f, g);
this.updateMatrix()
}
}
)(cc.EditBox._polyfill)
}
;cleverapps.Plot = {
ReturnToMainScene: function(a, b) {
var c = this.isEpisodeFinished(b) && cleverapps.meta.getType() === Meta.HOSE && !cleverapps.Plot.isPassedAllEpisodes
, d = []
, e = "undefined" !== typeof match3 && match3.heroes.readyToOpen();
if (e) {
d.push(function(l) {
match3.heroes.incLevel(e);
new HeroWindow({
color: e,
type: "unlocked"
});
cleverapps.focusManager.onceNoWindowsListener = l
});
var f = match3.heroes.getComics(e);
f && d.push(function(l) {
ComicsScene.showComics(l, f)
})
}
if (cleverapps.meta.getType() === Meta.SIMPLE ? cleverapps.meta.getMainObject().checkCompleted() : this.isEpisodeFinished(b) && !cleverapps.Plot.isPassedAllEpisodes) {
var g = cleverapps.meta.getType() === Meta.SIMPLE ? cleverapps.meta.selectedLocationId : levels.user.episode - 1
, h = cleverapps.styles.comicses["finishEpisode" + g] || cleverapps.styles.comicses.finishEpisode;
h && d.push(function(l) {
ComicsScene.showComics(l, h)
})
}
cleverapps.isKnockoutGame() && b.isRegular() ? (g = cleverapps.meta.getRumble(),
g.outcome === Rumble.OUTCOME_UNKNOWN ? d.push(function(l) {
cleverapps.meta.wantsToPlay(l)
}) : (g.outcome === Rumble.OUTCOME_WIN && (d.push(function(l) {
cleverapps.meta.knockoutGame.openWindow(l)
}),
d.push(function(l) {
new KnockoutVictoryWindow;
cleverapps.focusManager.onceNoWindowsListener = l
})),
d.push(function(l) {
cleverapps.meta.stopRumble();
l()
}),
d.push(function(l) {
cleverapps.travelBook.gotoMainScene(l)
}))) : d.push(function(l) {
var n = cleverapps.missionManager.getMissionWithIntent();
!c && n && n.logic.willUseIntent(b) ? n.useMissionIntent(l) : cleverapps.travelBook.gotoMainScene(l)
});
if (c) {
cleverapps.hose.changeEpisodeAnimation = !0;
var k = cleverapps.hose.getLocation()
, m = k + 1;
d.push(function(l) {
cleverapps.focusManager.compound(l, [function(n) {
cleverapps.Plot.onFinishEpisode(n, {
episodeNo: k
})
}
, function(n) {
cleverapps.hose.changeEpisodeAnimation = !1;
cleverapps.hose.gotoNextLocation(n)
}
, function(n) {
cleverapps.Plot.onStartEpisode(n, {
episodeNo: m
})
}
])
})
}
b.isRegular() && b.isPassed && b.isCurrentLevel() && cleverapps.Plot.getDialogueAfterLevel(b) && d.push(function(l) {
cleverapps.Plot.finishLevelDialogue(l, b)
});
cleverapps.focusManager.compound(a, d)
},
onFinishEpisode: function(a, b) {
cleverapps.focusManager.compound(a, [function(c) {
new FinishEpisodeWindow(b.episodeNo);
cleverapps.focusManager.onceNoWindowsListener = c
}
, function(c) {
cleverapps.hose.animateClose(c, b.episodeNo)
}
])
},
onStartup: function(a, b) {
if (0 === levels.user.episode && 0 === levels.user.level)
return this.onFirstInit(a, b);
if (b)
return cleverapps.meta.getMainScene();
cleverapps.dailyLevel && cleverapps.dailyLevel.isStartFromPortlet() ? (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DAILY_LEVEL_CHANNEL + cleverapps.dailyLevel.getCurrentEvent()),
cleverapps.dailyLevel.start(a)) : cleverapps.travelBook.gotoMainScene(a)
},
onFirstInit: function(a, b) {
var c = [];
if (cleverapps.styles.comicses && cleverapps.styles.comicses.begin && "playable" !== connector.info.source) {
if (b)
return {
scene: ComicsScene,
options: [cleverapps.styles.comicses.begin]
};
c.push(function(d) {
ComicsScene.showComics(d, cleverapps.styles.comicses.begin)
})
} else if (this.hasStartEpisodeWindow()) {
if (b)
return cleverapps.meta.getMainScene();
c.push(function(d) {
cleverapps.travelBook.gotoMainScene(d)
});
c.push(function(d) {
this.onStartEpisode(d, {
episodeNo: cleverapps.hose.getLocation()
})
}
.bind(this));
cleverapps.focusManager.compound(a, c);
return
}
if (cleverapps.meta.getType() !== Meta.HOSE && cleverapps.meta.getType() !== Meta.SIMPLE || "playable" === connector.info.source) {
if (b)
return cleverapps.meta.getMainScene();
c.push(function(d) {
cleverapps.travelBook.gotoMainScene(d)
})
} else {
if (b)
return GameScene;
c.push(function(d) {
cleverapps.lives && cleverapps.lives.reset();
cleverapps.meta.wantsToPlay(d)
})
}
cleverapps.focusManager.compound(a, c)
},
hasStartEpisodeWindow: function() {
return cleverapps.meta.getType() === Meta.HOSE && "riddles" === cleverapps.config.name && "playable" !== connector.info.source
},
onStartEpisode: function(a, b) {
if (cleverapps.hose.isPassedAll())
new FinisherWindow,
cleverapps.focusManager.onceNoWindowsListener = a;
else {
var c = [];
c.push(function(d) {
cleverapps.hose.animateOpen(d, b.episodeNo)
});
this.hasStartEpisodeWindow() && c.push(function(d) {
new StartEpisodeWindow(b.episodeNo);
cleverapps.focusManager.onceNoWindowsListener = d
});
cleverapps.focusManager.compound(a, c)
}
},
isEpisodeFinished: function(a) {
return a.isRegular() && a.isPassed && a.isLastLevelOnEpisode() && a.isCurrentLevel()
},
getDialogueAfterLevel: function(a) {
if (!cleverapps.styles.dialogues || !a.isRegular())
return !1;
a = cleverapps.user.getHumanReadableNumber() - 1;
return cleverapps.styles.dialogues["finishLevel" + a]
},
finishLevelDialogue: function(a, b) {
var c = this.getDialogueAfterLevel(b);
if (c) {
var d = cleverapps.scenes.getRunningScene();
cleverapps.focusManager.compound(a, [function(e) {
c.bundles ? cleverapps.bundleLoader.loadBundles(c.bundles, {
onSuccess: function() {
e()
},
blocked: !0
}) : e()
}
, function(e) {
d.createFilmEffect({
scale: 1.2,
layerTimeout: .3,
scaleTimeout: 1,
moveBy: {
y: d.height * (1.2 - 1)
},
onShow: e
})
}
, function(e) {
var f = new Dialogue(c.dialogue,{
autoClose: !0,
autoScroll: 3,
parentScene: !0,
showUp: !0
});
f.on("afterClose", e);
(new DialogueView(f)).setLocalZOrder(51)
}
, function(e) {
d.removeFilmEffect(.4, e)
}
])
}
}
};
cleverapps.styles.comicses = {};
var Dialogue = function(a, b) {
cleverapps.EventEmitter.call(this);
this.options = b || {};
this.parentScene = b.parentScene;
this.autoScroll = 3;
void 0 !== this.options.autoScroll && (this.autoScroll = this.options.autoScroll);
this.data = Array.isArray(a) ? a : [a];
this.stage = -1;
this.stageData = this.data[0];
this.personSlots = [void 0, void 0];
var c = [];
a.forEach(function(d) {
["person", "person2"].forEach(function(e) {
d[e] && (e = cleverapps.persons.getRole(d[e].role || d[e]),
c.push(e && e.bundle))
})
});
this.bundlesToLoad = cleverapps.unique(["dialogues"].concat(c)).filter(function(d) {
return bundles[d]
})
};
Dialogue.prototype = Object.create(cleverapps.EventEmitter.prototype);
Dialogue.prototype.constructor = Dialogue;
Dialogue.prototype.run = function() {
cleverapps.focusManager.isFocused() || (console.log("Dialogue:", this.data),
cleverapps.focusManager.debugMessage("Trying to show dialogue without user focus!"));
this.focus = cleverapps.focusManager.focus;
this.next()
}
;
Dialogue.prototype.isStarted = function() {
return -1 !== this.stage
}
;
Dialogue.prototype.finishClose = function() {
this.closeCallback && (this.closeCallback(),
delete this.closeCallback);
this.trigger("afterClose")
}
;
Dialogue.prototype.close = function(a) {
this.closing || (this.closing = !0,
this.closeCallback = a,
this.trigger("close", !this.options.showUp))
}
;
Dialogue.prototype.next = function(a) {
clearTimeout(this.nextTimeout);
if (!1 === cleverapps.focusManager.focus || cleverapps.focusManager.focus === this.focus)
a ? this.nextTimeout = this.createTimeout(this.next.bind(this), 1E3 * a) : this.typing ? this.finishTyping() : this.stage < this.data.length - 1 ? this.incStage() : this.options.autoClose && this.close()
}
;
Dialogue.prototype.incStage = function() {
this.stage++;
this.stageData = this.data[this.stage];
this.onChangeStage()
}
;
Dialogue.prototype.createTimeout = function(a, b) {
return new cleverapps.CountDown(b,{
onFinish: function() {
this.closing || a()
}
.bind(this)
})
}
;
Dialogue.prototype.onChangeStage = function() {
void 0 === this.stageData.person && (this.stageData.person = "hero");
var a = this.stageData.person && Person.ParseOptions(this.stageData.person);
a && (a.active = !0);
var b = this.stageData.person2 && Person.ParseOptions(this.stageData.person2);
b && (b.active = !1);
b = "left" === a.orientation ? [a, b] : [b, a];
b.forEach(function(c, d) {
d = this.personSlots[d];
this.areSamePersons(c, d) || (d && this.trigger("hidePerson", d.orientation),
c && this.trigger("addPerson", c, 0 === this.stage))
}, this);
this.trigger("updateActive", a && a.orientation);
this.trigger("changedStage");
this.personSlots = b;
if (0 === this.stage)
this.trigger("showUp", !this.options.showUp, this.onTyping.bind(this));
else
this.onTyping()
}
;
Dialogue.prototype.onTyping = function(a) {
this.typing = !0;
this.trigger("changeText", this.stageData.text, a)
}
;
Dialogue.prototype.areSamePersons = function(a, b) {
return a && b && a.orientation === b.orientation && a.role === b.role
}
;
Dialogue.prototype.finishTyping = function(a) {
this.typing = !1;
this.trigger("finishTyping", a);
this.autoScroll && this.next(this.autoScroll)
}
;
Dialogue.prototype.screenClicked = function() {
this.trigger("screenClicked");
this.next()
}
;
Dialogue.POSITIONS = {
TOP: "top",
TOP_LOWER: "top_lower",
BOTTOM: "bottom",
CENTER: "center"
};
var PointerView = cleverapps.Spine.extend({
avoidNode: "PointerView",
ctor: function(a) {
this._super(bundles.finger.jsons.arrow_json);
this.options = a || {};
this.target = this.options.target;
this.targetOffset = this.options.targetOffset || 0;
this.setLocalZOrder(14);
cleverapps.scenes.getRunningScene().addChild(this);
this.afterResize();
cleverapps.windows.on("openWindow", this.createListener(this.setVisible.bind(this, !1)), this);
cleverapps.windows.on("closeWindows", this.createListener(this.setVisible.bind(this, !0)), this)
},
afterResize: function() {
var a = this.target.getSceneBoundingBox()
, b = cc.rectGetCenter(a)
, c = this.guessDirection(cc.rectGetCenter(b));
this.direction !== c && (this.direction = c,
this.setAnimation(0, this.direction, !0));
c = [PointerView.DIRECTIONS.DOWN, PointerView.DIRECTIONS.LEFT].includes(this.direction) ? 1 : -1;
[PointerView.DIRECTIONS.UP, PointerView.DIRECTIONS.DOWN].includes(this.direction) ? b.y += ((a.height + this.height) / 2 + this.targetOffset) * c : b.x += ((a.width + this.width) / 2 + this.targetOffset) * c;
this.setPosition(b)
},
guessDirection: function(a) {
if (this.options.direction)
return this.options.direction;
if (this.target instanceof MenuBarItemView)
return PointerView.DIRECTIONS.RIGHT;
if ("undefined" !== typeof CardView && this.target instanceof CardView)
return PointerView.DIRECTIONS.DOWN;
if (!this.target.getParent())
return PointerView.DIRECTIONS.UP;
var b = cleverapps.resolution.getSceneSize();
return a.y > 4 * b.height / 5 ? PointerView.DIRECTIONS.UP : a.x < b.width / 5 ? PointerView.DIRECTIONS.LEFT : a.x > 4 * b.width / 5 ? PointerView.DIRECTIONS.RIGHT : PointerView.DIRECTIONS.DOWN
}
});
PointerView.create = function(a) {
a = a || {};
var b = new PointerView(a);
PointerView.remove(PointerView.currentPointer);
PointerView.currentPointer = b;
addCleaner(b, function() {
PointerView.remove(b)
});
return b
}
;
PointerView.remove = function(a) {
a && PointerView.currentPointer === a && (PointerView.currentPointer = void 0,
a.removeFromParent())
}
;
PointerView.DIRECTIONS = {
UP: "up",
DOWN: "down",
LEFT: "left",
RIGHT: "right"
};
var ForceView = CleverappsWindow.extend({
ctor: function(a, b, c) {
this.forceConfig = b;
this.options = c || {};
this.force = b;
this.element = a;
this.actives = this.options.actives || [];
a !== ForceView.NO_ELEMENT && this.actives.push(a);
this.highlights = (this.options.highlights || []).concat(this.actives);
this._super(a, b)
},
getEventNodes: function() {
return this.actives
},
afterResize: function() {
this.text && this.createDialogue()
},
upNodesForForce: function() {
this.highlights.forEach(function(a) {
a._setGlobalZOrder(!0)
}, this)
},
backNodesFromForce: function() {
this.highlights.forEach(function(a) {
a._setGlobalZOrder(!1)
}, this)
},
listRects: function() {
var a = [];
this.options.importantNodes && this.options.importantNodes.forEach(function(b) {
a.push(b.getSceneBoundingBox())
});
this.pointer && a.push(this.pointer.getSceneBoundingBox());
this.actives.forEach(function(b) {
a.push(b.getSceneBoundingBox())
});
return a
},
onWindowLoaded: function(a, b) {
this.id = b.id;
this._super({
content: new cc.Node,
noBackground: !0,
name: "forcewindow" + this.id,
closeButton: !1,
styles: cleverapps.styles.Force
});
b.controls && cleverapps.focusManager.showControlsWhileFocused(b.controls, !0);
this.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 9);
cleverapps.toolbar.freezeUpdates();
this.element = a;
if (a !== ForceView.NO_ELEMENT && !1 !== b.finger) {
if (b.finger) {
var c = b.finger;
"function" === typeof c && (c = c());
c.mobile && cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && (c = c.mobile);
if (c.delay)
var d = c.delay
}
this.finger = FingerView.hintClick(a, {
delay: d,
repeatDelay: d
})
}
a !== ForceView.NO_ELEMENT && b.pointer && (this.pointer = PointerView.create({
target: a,
direction: this.options.pointerDirection
}),
this.highlights.push(this.pointer));
this.upNodesForForce();
this.text = "function" === typeof b.text ? b.text(b, a) : b.text;
(a === ForceView.NO_ELEMENT || this.forceConfig.closeByTouchInShadow) && this.addCloseByTouchInShadow();
a !== ForceView.NO_ELEMENT && (this.watchElementInterval = cleverapps.timeouts.setInterval(function() {
this.element.parent && this.element.visible && !this.forceConfig.timeout || (cleverapps.forces.isRunningForce() ? cleverapps.forces.closeRunningForce() : (this.close(),
cleverapps.forces.clearForce(this.id)))
}
.bind(this), this.forceConfig.timeout || 5E3));
this.text && this.createDialogue()
},
createDialogue: function() {
this.dialogue && this.dialogue.removeFromParent();
this.dialogue = new MinimalDialogue({
text: this.text,
person: this.force.person,
targetRect: this.element && this.element !== ForceView.NO_ELEMENT && this.element.getSceneBoundingBox(),
rects: this.listRects(),
forcePosition: "function" === typeof this.force.position ? this.force.position() : this.force.position
});
this.dialogue._globbbb = !0;
this.addChild(this.dialogue);
this.dialogue.display()
},
onClose: function() {
this.watchElementInterval && cleverapps.timeouts.clearInterval(this.watchElementInterval);
this.backNodesFromForce();
FingerView.remove(this.finger);
PointerView.remove(this.pointer);
this.finger = this.pointer = void 0;
cleverapps.toolbar.unfreezeUpdates()
},
addCloseByTouchInShadow: function() {
this.clickArea = new cc.Node;
this.clickArea.setContentSize(this.getContentSize());
this.addChild(this.clickArea);
cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: !0,
onTouchBegan: function() {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce()
}
}, this.clickArea)
},
stop: function() {},
inflateWindow: function() {}
});
cleverapps.styles.Force = {
windowShowUpAnimation: {
name: "instant",
force: !0
}
};
ForceView.NO_ELEMENT = "emptyForceElement";
var FragileForceView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.force = b;
this.setLocalZOrder(31);
this.pointer = PointerView.create({
target: a
});
this.dialogue = new MinimalDialogue({
text: this.force.text,
person: this.force.person,
forcePosition: Dialogue.POSITIONS.TOP_LOWER
});
this.addChild(this.dialogue);
this.dialogue.display();
this.runAction(new cc.Sequence(new cc.DelayTime(15),new cc.CallFunc(this.closeForce.bind(this))));
cleverapps.eventBus.on("changeFocus", this.closeForce.bind(this), this);
cleverapps.scenes.getRunningScene().addChild(this)
},
close: function() {
this.stopAllActions();
this.dialogue && (this.dialogue.remove(),
this.dialogue = void 0);
PointerView.remove(this.pointer);
this.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.RemoveSelf))
},
closeForce: function() {
cleverapps.forces.isRunningForce(this.force) && cleverapps.forces.closeRunningForce()
}
});
var Forces = function() {
this.shownForces = [];
this.load();
this.onceForceClosed = this.forceView = void 0
};
Forces.prototype.isRunningForce = function(a) {
return void 0 !== this.forceView && (void 0 === a || this.forceView.force.id === a.id)
}
;
Forces.prototype.getRunningForce = function() {
return this.forceView
}
;
Forces.prototype.whenForceClosed = function(a) {
this._whenForceClosedCallbacks || (this._whenForceClosedCallbacks = []);
this._whenForceClosedCallbacks.push(a)
}
;
Forces.prototype._runForceClosedCallbacks = function() {
this._whenForceClosedCallbacks && (this._whenForceClosedCallbacks.forEach(function(a) {
a()
}),
delete this._whenForceClosedCallbacks)
}
;
Forces.prototype.closeRunningForce = function() {
this.forceView.close();
this._runForceClosedCallbacks(this.forceView.force.id);
void 0 !== this.forceView.force.id && this.saveForce(this.forceView.force.id);
this.forceView = void 0;
if (this.onceForceClosed) {
var a = this.onceForceClosed;
this.onceForceClosed = void 0;
a()
}
}
;
Forces.prototype.reset = function() {
this.shownForces = [];
this.save()
}
;
Forces.prototype.load = function() {
this.shownForces = cleverapps.dataLoader.load(DataLoader.TYPES.FORCES) || []
}
;
Forces.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.FORCES, this.shownForces);
a || cleverapps.synchronizer.addUpdateTask("forces")
}
;
Forces.prototype.getInfo = function() {
return {
forces: cleverapps.toBit(this.shownForces)
}
}
;
Forces.prototype.updateInfo = function(a, b) {
this.shownForces = cleverapps.fromBit(a.forces || 0);
this.save(b)
}
;
Forces.prototype.isAvailable = function(a, b) {
return !a || a && a !== ForceView.NO_ELEMENT && !a.isRunning() || void 0 !== b.id && -1 !== this.shownForces.indexOf(b.id) ? !1 : !0
}
;
Forces.prototype.isShown = function(a) {
return void 0 === a ? !1 : this.shownForces && 0 <= this.shownForces.indexOf(a)
}
;
Forces.prototype.saveForce = function(a) {
a && !this.isShown(a) && (this.shownForces.push(a),
this.save())
}
;
Forces.prototype.clearForce = function(a) {
a = this.shownForces.indexOf(a);
-1 !== a && (this.shownForces.splice(a, 1),
this.save())
}
;
Forces.prototype.create = function(a, b, c) {
!a && b.target && (a = cleverapps.aims.getTarget(b.target));
if (this.isAvailable(a, b))
return this.forceView = new (b.fragile ? FragileForceView : ForceView)(a,b,c)
}
;
Forces.prototype.checkMainForces = function() {
return this.checkDailyTasksForce() || this.checkPeriodicBonusForce() || this.checkHeroesForce()
}
;
Forces.prototype.checkDailyTasksForce = function() {
return cleverapps.dailyTasks && cleverapps.dailyTasks.isAvailable() && !this.isShown(Forces.DAILY_TASKS_FORCE.id)
}
;
Forces.prototype.checkPeriodicBonusForce = function() {
return cleverapps.miniGame && cleverapps.miniGame.isAvailable() && !this.isShown(Forces.MINIGAME_FORCE.id)
}
;
Forces.prototype.checkHeroesForce = function() {
return "undefined" !== typeof match3 && match3.heroes.available() && !this.isShown(Forces.HEROES_AVAILABLE.id)
}
;
Forces.PRIZE_CALENDAR = {
id: 1,
text: "PrizeCalendar.force"
};
Forces.FREE_UNDO_FORCE = {
id: 2,
text: "UndoTutorialMessage"
};
Forces.FREE_HINT_FORCE = {
id: 3,
text: "hintTutorialMessage"
};
Forces.FIRST_BOOSTERS_BEFORE = {
id: 4,
text: "FirstBoostersBefore.force"
};
Forces.SECOND_BOOSTERS_BEFORE = {
id: 5,
text: "SecondBoostersBefore.force"
};
Forces.THIRD_BOOSTERS_BEFORE = {
id: 6,
text: "ThirdBoostersBefore.force"
};
Forces.FREE_REPLACE_ALL_FORCE = {
id: 7,
text: "ReplaceAllBooster.force"
};
Forces.FREE_PAINT_FORCE = {
id: 8,
text: "Paint.force"
};
Forces.FREE_BOMB_FORCE = {
id: 9,
text: "outOfBombMovesHint"
};
Forces.DAILY_TASKS_FORCE = {
id: 10,
text: "Forces.DailyTasks"
};
Forces.COOLDOWN_FORCE = {
id: 11,
text: "CoolDownNode.force",
button: {
text: "SkipButton"
},
finger: !1
};
Forces.MINIGAME_FORCE = {
id: 12,
text: "Forces.MiniGame"
};
Forces.FOG_EXPLORE = {
id: 13
};
Forces.TROOP_CARDS_FORCE = {
id: 14,
text: "TroopCards.force"
};
Forces.MENU_BAR_SOFT_FORCE = {
id: 15,
text: "SoftForce",
finger: {
useForceTarget: !0
},
available: {
level: 1.6
},
productKey: "softCurrencyVerySmall",
productOptions: {
price: 0
}
};
Forces.FREE_NEXT_PIECES_FORCE = {
id: 16,
text: "ClearPiecesBooster.force"
};
Forces.HEROES_AVAILABLE = {
id: 17,
text: "Forces.HeroesAvailable"
};
Forces.DAILY_CUP = {
id: 18,
text: "Cups.daily.force"
};
Forces.FREE_UNDO_PIECE = {
id: 19,
text: "UndoPieceBooster.force"
};
Forces.LANTERN = {
id: 20,
text: "LanternWindow.force"
};
Forces.TRADE_WINDOW_FORCE = {
id: 21,
text: "TradeWindow.force"
};
Forces.TRADE_SELECT_SOURCE = {
text: "Forces.TradeSelectLeft"
};
Forces.TRADE_SELECT_TARGET = {
text: "Forces.TradeSelectRight"
};
Forces.UNLOCK_HEROES = {
text: "Forces.UnlockHero"
};
Forces.UPGRADE_HEROES = {
text: "Forces.UpgradeFirstHero"
};
Forces.FREE_VACUUM_FORCE = {
id: 22,
text: "VacuumBooster.force"
};
Forces.METHA_PLAY_BUTTON = {
id: 23,
controls: ["play_button"],
text: function() {
return cleverapps.meta.getType() === Meta.SIMPLE ? "SimpleMethaPlayButton.force" : "MethaPlayButton.force"
}
};
Forces.KNOCKOUT_PLAYERS = {
id: 24,
text: "KnockoutPlayers.force",
button: {
text: "SkipButton"
},
finger: !1,
closeByTouchInShadow: !0
};
Forces.KEYPAD = {
id: 25,
text: "Keypad.force",
button: {
text: "SkipButton"
},
finger: !1
};
Forces.PINBALL = {
id: 26,
text: "Pinball.Force"
};
Forces.COOKIEJAR = {
id: 27,
text: "Cookiejar.force",
button: {
text: "OK"
},
closeByTouchInShadow: !0
};
Forces.CRYPTEX = {
id: 28,
text: "Cryptex.force",
fragile: !0
};
Forces.FREE_SHUFFLE_FORCE = {
id: 29,
text: "ShuffleBooster.force"
};
Forces.PHOTO_CLOVER = {
id: 30,
text: "PhotoClover.force"
};
Forces.TRICKY_LEVEL = {
id: 31,
text: "TrickyLevelForce",
finger: !1
};
Forces.SIMPLE = {
id: 32,
text: "Simple.Force"
};
Forces.BONUS_WORLD = {
id: 33
};
Forces.SLOT_MACHINE_ICON = {
id: 34,
text: "SlotMachine.IconForce"
};
Forces.SLOT_MACHINE = {
id: 35,
text: "SlotMachine.Force"
};
Forces.BUY_ENERGY_ICON = {
id: 36,
text: "BuyEnergy.IconForce",
productKey: "buyEnergy350",
productOptions: {
price: 0,
reward: 30
}
};
Forces.UNITS_SHOP_ICON = {
id: 37,
text: "UnitsShop.IconForce"
};
Forces.SLOT_MACHINE_HELP = {
id: 38,
text: "SlotMachine.HelpForce"
};
Forces.TRAVEL_BOOK = {
id: 40,
text: function() {
return cleverapps.travelBook.chosenForForce.forceText
},
person: "king"
};
Forces.PINBALL_ICON = {
id: 41,
text: "Pinball.IconForce"
};
Forces.CLANS_ICON = {
id: 42,
text: "Clans.force"
};
Forces.OFFER_ICON_SLOT1 = {
id: 43,
text: "Offer.IconForce"
};
Forces.OFFER_ICON_SLOT2 = {
id: 44,
text: "Offer.IconForce"
};
Forces.LEVELPASS = {
id: 45,
text: "LevelPass.force"
};
Forces.SECOND_LANDMARK = {
id: 46
};
Forces.LANDMARK_DONOR_SLOT1 = {
id: 47,
text: "Landmarks.force"
};
Forces.LANDMARK_DONOR_SLOT2 = {
id: 48,
text: "Landmarks.force"
};
Forces.STICKERS_BOOK_FORCE = {
id: 49,
text: "StickersBook.force"
};
Forces.FREE_UNLIMITED_LIVES_FORCE = {
id: 50,
text: "FreeUnlimitedLivesWindow.force"
};
Forces.FREE_PROLONGATION_FORCE = {
id: 51,
text: "Prolongation.force"
};
Forces.STORAGE_FORCE = {
target: "warehouse",
controls: ["WarehouseIcon"]
};
Forces.FREE_EXTRA_SLOT_FORCE = {
id: 51,
finger: {
useForceTarget: !0
},
person: "fairy_dwarf_violet",
text: "ExtraSlotTutorial.force"
};
var AdsLimits = function() {
cleverapps.EventEmitter.call(this);
AdsLimits.initialize();
this.load();
this.dirty = !1;
this.volumeControl = {
general: 1
};
this.updateVolume();
this.update();
cleverapps.rewardedAdsManager.onRewardedRefresh(this.notifyUpdated.bind(this));
new cleverapps.Interval(this.update.bind(this),cleverapps.parseInterval(AdsLimits.CHECK_INTERVAL));
cleverapps.flags.on("change:highMonetization", this.updateVolume.bind(this));
cleverapps.flags.on("change:lowMonetization", this.updateVolume.bind(this));
connector.platform.on("changeStatus", this.updateVolume.bind(this))
};
AdsLimits.prototype = Object.create(cleverapps.EventEmitter.prototype);
AdsLimits.prototype.constructor = AdsLimits;
AdsLimits.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.ADS_LIMITS_DATA, this.data)
}
;
AdsLimits.prototype.load = function() {
this.data = cleverapps.dataLoader.load(DataLoader.TYPES.ADS_LIMITS_DATA) || {};
var a = Object.values(AdsLimits.TYPES);
Object.keys(this.data).forEach(function(b) {
-1 === a.indexOf(b) && delete this.data[b]
}, this)
}
;
AdsLimits.prototype._updateType = function(a) {
var b = this.data[a];
if (this.getLimit(a).disabled || b && 0 < b.watchCount && 0 === this.getLimitLeftTime(a))
delete this.data[a],
this.save(),
this.dirty = !0
}
;
AdsLimits.prototype.setVolume = function(a, b) {
b ? this.volumeControl[b] = void 0 !== this.volumeControl[b] ? this.volumeControl[b] * a : a : this.volumeControl.general = a
}
;
AdsLimits.prototype.getVolume = function(a) {
return void 0 !== this.volumeControl[a] ? this.volumeControl[a] : this.volumeControl.general
}
;
AdsLimits.prototype.getLimitTimeout = function(a) {
var b = this.getLimit(a);
if (b && b.timeout)
return cleverapps.parseInterval(b.timeout) / this.getVolume(a)
}
;
AdsLimits.prototype.notifyUpdated = function() {
this.trigger("update")
}
;
AdsLimits.prototype.updateVolume = function() {
this.volumeControl = {
general: 1
};
cleverapps.config.debugMode && this.setVolume(10);
connector.platform.oneOf(connector.YANDEX) && this.setVolume(2.665, AdsLimits.TYPES.INTERSTITIAL);
connector.platform.oneOf(connector.OK, connector.VK, connector.TEST) && this.setVolume(2, AdsLimits.TYPES.INTERSTITIAL);
connector.platform.oneOf(connector.CRAZY) && cleverapps.flags.highMonetization && (this.setVolume(0, AdsLimits.TYPES.INTERSTITIAL),
this.setVolume(0, AdsLimits.TYPES.BANNER));
connector.platform.oneOf(connector.INSTANT) && !connector.info.isMobile && cleverapps.flags.highMonetization && this.setVolume(0, AdsLimits.TYPES.INTERSTITIAL);
connector.ads.oneOf(connector.YANDEX_WEB_ADS, connector.VK) && this.setVolume(0, AdsLimits.TYPES.PREROLL);
cleverapps.flags.lowMonetization && this.setVolume(4, AdsLimits.TYPES.INTERSTITIAL)
}
;
AdsLimits.prototype.update = function() {
for (var a in AdsLimits.TYPES)
this._updateType(AdsLimits.TYPES[a]);
this.dirty && (this.dirty = !1,
this.notifyUpdated())
}
;
AdsLimits.prototype.state = function(a) {
this._updateType(a);
var b = this.getLimit(a);
if (b.disabled)
return AdsLimits.STATE_DISABLED;
if (cleverapps.flags.lowMonetization && a === AdsLimits.TYPES.INTERSTITIAL) {
if (!cleverapps.user.checkAvailable({
level: .13
}))
return AdsLimits.STATE_UNAVAILABLE
} else if (!cleverapps.user.checkAvailable(b.available) || 0 === this.getVolume(a))
return AdsLimits.STATE_UNAVAILABLE;
if (0 === this.getLimitLeftCount(a))
return AdsLimits.STATE_LIMITED;
if (a === AdsLimits.TYPES.BANNER) {
if (!connector.ads.isStickyAvailable)
return AdsLimits.STATE_NOADS
} else if (-1 !== [AdsLimits.TYPES.INTERSTITIAL, AdsLimits.TYPES.PREROLL].indexOf(a)) {
if (!connector.ads.isInterstitialAvailable)
return AdsLimits.STATE_NOADS
} else if (!cleverapps.rewardedAdsManager.isRewardedAvailable())
return AdsLimits.STATE_NOADS;
return AdsLimits.STATE_READY
}
;
AdsLimits.prototype.getLimit = function(a) {
var b = AdsLimits.LIMITS[a];
b || (cleverapps.config.debugMode && console.error("No ads limit for type: " + a),
b = {
disabled: !0
});
return b && b.nonpayer ? (a = cleverapps.paymentsHistory.classify(),
a === cleverapps.PaymentsHistory.BRACKET_NONE ? b.nonpayer : a === cleverapps.PaymentsHistory.BRACKET_UNDECIDED ? b.undecided : b.payer) : b
}
;
AdsLimits.prototype.getLimitLeftTime = function(a) {
return Math.max(0, (this.data[a] || {
lastRefresh: 0
}).lastRefresh + this.getLimitTimeout(a) - Date.now())
}
;
AdsLimits.prototype.getWatchCount = function(a) {
return this.data[a] && this.data[a].watchCount || 0
}
;
AdsLimits.prototype.getLimitLeftCount = function(a) {
var b = this.getLimit(a);
return b.limit === AdsLimits.UNLIMITED ? 1 : Math.max(0, b.limit - (this.data[a] || {
watchCount: 0
}).watchCount)
}
;
AdsLimits.prototype.getLimitLevel = function(a) {
a = this.getLimit(a);
return cleverapps.humanReadableNumber({
floatLevel: a.available.level
})
}
;
AdsLimits.prototype.watch = function(a) {
this.data[a] ? this.data[a].watchCount++ : this.data[a] = {
watchCount: 1,
lastRefresh: Date.now()
};
this.save();
cleverapps.timeouts.setTimeout(this.update.bind(this), this.getLimitTimeout(a));
this.notifyUpdated()
}
;
AdsLimits.prototype.reset = function(a) {
delete this.data[a];
this.save()
}
;
AdsLimits.STATE_UNAVAILABLE = 0;
AdsLimits.STATE_LIMITED = 1;
AdsLimits.STATE_NOADS = 2;
AdsLimits.STATE_READY = 3;
AdsLimits.STATE_DISABLED = 4;
AdsLimits.CHECK_INTERVAL = "1 minute";
AdsLimits.TYPES = {
HARD: "hard",
WORKER: "worker",
LIVES: "lives",
ENERGY_SHORT: "energy_short",
BARREL: "barrel",
SPEEDUP: "speedup",
THIRD_ELEMENT: "third_element",
PIXEL: "pixel",
OPEN_CHEST: "chest",
BOOSTERS_BEFORE: "booster_before",
FLYING_HINT: "flying_hint",
FLYING_STAR: "flying_star",
FLYING_BOOSTER: "flying_booster",
FLYING_DISCOVER: "flying_discover",
FLYING_MOVES: "flying_moves",
FLYING_HARD_SOFT: "flying_hard_soft",
TOOLBAR: "toolbar",
POINTS_THIRD_ELEMENT: "third_element_points",
ANIMALS_THIRD_ELEMENT: "third_element_animals",
BANK: "bank",
FREEX2: "freex2",
PRODUCT: "product",
CINEMA: "cinema",
PROLONGATION: "extend",
CHOICE: "choice",
ENERGY: "energy",
ENERGY_2: "energy_2",
ENERGY_2_SHORT: "energy_short_2",
ENERGY_1: "energy_1",
ENERGY_1_SHORT: "energy_short_1",
ENERGY_3: "energy_3",
ENERGY_3_SHORT: "energy_short_3",
ENERGY_4: "energy_4",
ENERGY_4_SHORT: "energy_short_4",
BOOSTER_1: "booster_1",
BOOSTER_2: "booster_2",
BOOSTER_3: "booster_3",
BOOSTER_ADS: "booster_ads",
INTERSTITIAL: "interstitial",
PREROLL: "preroll",
SHOVEL: "shovel",
BANNER: "banner",
CHAIN: "chain",
PRIZE_CALENDAR: "prize_calendar",
PINBALL_CHIPS: "pinball_chips"
};
AdsLimits.UNLIMITED = "unlimited";
AdsLimits.LIMITS = {};
AdsLimits.initialize = function() {
var a = bundles.ads_limits_data.jsons.ads_limits_json.getJson();
AdsLimits.LIMITS = a.adslimits
}
;
var Actor = cc.Node.extend({
ctor: function(a) {
this._super();
this.options = a;
this.setAnchorPoint(.5, .5);
this.updateSize();
this.spine = new cleverapps.Spine(a.spine);
this.currSpine = a.spine;
this.currSpineId = a.spineId;
this.currSfx = a.sfx;
this.addChild(this.spine);
a.skin && (this.spine.setSkin(a.skin),
this.currSkin = a.skin);
this.spine.setAnimation(0, a.animation || Actor.ANIMATIONS.IDLE, !0);
this.alive = !0;
this.positionStyles = a.boostersAmountPosition ? a.boostersAmountPosition[Game.currentGame.boosters.amountAvailable()] : a;
this.setupChildren()
},
updateSize: function() {
this.setContentSize(this.options.size);
this.baseScale = this.options.scale || 1;
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && this.options.mobileScale && (this.baseScale = this.options.mobileScale);
this.setScale(this.baseScale)
},
setupChildren: function() {
this.setPositionRound(this.getBasePosition());
this.options.spinePosition ? this.spine.setPositionRound(this.options.spinePosition) : this.spine.setPositionRound(this.width / 2, 0)
},
getBasePosition: function() {
var a = cleverapps.clone(this.positionStyles, !0);
return a = a.wideModePositions ? a.wideModePositions[cleverapps.resolution.mode] : a.position
},
shake: function() {
this.stopAllActions();
var a = this.baseScale;
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && this.options.mobileScale && (a = this.options.mobileScale);
this.setScale(a);
this.runAction(new cc.Sequence(new cc.ScaleTo(.1,1.07 * a,.93 * a),new cc.ScaleTo(.05,a,a)))
},
moveAnimation: function() {
this.stopAllActions();
this.basePosition = this.getBasePosition();
this.showUpAction = (new cc.MoveTo(.8,this.calculatePositionRound(this.basePosition))).setFinalize(function() {
this.setPositionRound(this.basePosition);
delete this.showUpAction
}
.bind(this));
this.runAction(this.showUpAction)
},
completeAnimationOnResize: function() {
this.showUpAction && this.stopAction(this.showUpAction)
},
showUpAnimation: function() {},
animate: function(a, b) {
b = b || {};
if (!this.alive)
if (a === Actor.ANIMATIONS.REVIVE)
this.alive = !0;
else
return;
-1 !== [Actor.ANIMATIONS.DIE, Actor.ANIMATIONS.DIE_IDLE].indexOf(a) && (this.alive = !1);
-1 !== [Actor.ANIMATIONS.HURT, Actor.ANIMATIONS.HURT2].indexOf(a) && (-1 !== [Actor.ANIMATIONS.ATTACK1, Actor.ANIMATIONS.ATTACK2, Actor.ANIMATIONS.ATTACK3, Actor.ANIMATIONS.ATTACK4].indexOf(this.animationRunning) && (this.animationRunning = !1),
-1 !== [Actor.ANIMATIONS.HURT, Actor.ANIMATIONS.HURT2].indexOf(this.animationRunning) && this.animationStarted < Date.now() - 300 && (this.animationRunning = !1));
-1 !== [Actor.ANIMATIONS.DIE, Actor.ANIMATIONS.DIE_IDLE, Actor.ANIMATIONS.REVIVE, Actor.ANIMATIONS.HEAL, Actor.ANIMATIONS.ENEMY_ATTACK].indexOf(a) && (this.animationRunning = !1);
if (!this.animationRunning) {
var c;
this.currSfx && !b.noSFX && (c = this.currSfx[a]);
c && this.runAction(new cc.Sequence(new cc.DelayTime(b.sfxDelay || cleverapps.styles.Actor.sfx.delay),new cc.CallFunc(function() {
cleverapps.audio.playSound(c)
}
)));
this.animationRunning = a;
this.animationStarted = Date.now();
this.spine.setAnimation(0, a, !1);
this.spine.setCompleteListener(function() {
this.animationRunning = !1;
this.spine.setCompleteListener();
var d = b.idleAnimation ? b.idleAnimation : -1 !== [Actor.ANIMATIONS.DIE, Actor.ANIMATIONS.DIE_IDLE].indexOf(a) ? Actor.ANIMATIONS.DIE_IDLE : Actor.ANIMATIONS.IDLE;
this.spine.setAnimation(0, d, !0);
b.callback && b.callback()
}
.bind(this))
}
},
getHidingPosition: function() {
var a = cleverapps.scenes.getRunningScene()
, b = this.getPosition();
switch (cleverapps.resolution.mode) {
case cleverapps.WideMode.HORIZONTAL:
case cleverapps.WideMode.SQUARE:
b.x = a.width + this.width + 2;
break;
case cleverapps.WideMode.VERTICAL:
b.y = -this.width - 2
}
return b
},
hide: function() {
this.runAction(new cc.Sequence((new cc.MoveTo(.15,this.getHidingPosition())).easing(cc.easeIn(2)),new cc.CallFunc(function() {
this.setVisible(!1)
}
.bind(this))))
}
});
Actor.ANIMATIONS = {};
Actor.ANIMATIONS.ENEMY_ATTACK = "attack";
Actor.ANIMATIONS.ATTACK1 = "attack1";
Actor.ANIMATIONS.ATTACK2 = "attack2";
Actor.ANIMATIONS.ATTACK3 = "attack3";
Actor.ANIMATIONS.ATTACK4 = "attack4";
Actor.ANIMATIONS.IDLE = "idle";
Actor.ANIMATIONS.HAPPY = "happy";
Actor.ANIMATIONS.HURT = "hurt";
Actor.ANIMATIONS.HURT2 = "hurt2";
Actor.ANIMATIONS.DIE = "die";
Actor.ANIMATIONS.DIE_IDLE = "die_idle";
Actor.ANIMATIONS.HEAL = "heal";
Actor.ANIMATIONS.REVIVE = "revive";
cleverapps.styles.Actor = {
sfx: {
delay: .7
},
animation: {
mobileOffsetX: 180,
playerPositions: {
x: 350,
y: -20
}
},
showDelay: void 0
};
var Competition = function(a) {
this.type = a.type;
this.options = a;
var b = void 0;
a.store && ((b = cleverapps.dataLoader.load(DataLoader.TYPES.COMPETITION + "_" + this.type)) || -1 === [Mission.TYPE_RAINBOW, Mission.TYPE_COLLECT_MARK, Mission.TYPE_BURN_NEARBY, Mission.TYPE_LETTER].indexOf(this.type) || (b = cleverapps.dataLoader.load(DataLoader.TYPES.COMPETITION)),
cleverapps.dataLoader.remove(DataLoader.TYPES.COMPETITION));
b ? (this.results = b.results,
a.algo.lastProcessed = b.algorithm) : this.results = a.players ? a.players : cleverapps.competitionPlayers.listFakePlayers(a.amount);
this.player = this.getPlayerById(connector.platform.getUserID());
this.player || (this.player = {
player: !0,
id: connector.platform.getUserID(),
name: cleverapps.user.getPlayerInfo().name,
amount: 0
},
this.results.push(this.player));
this.player.avatar = cleverapps.user.getPlayerInfo().avatar;
void 0 !== a.playerResult && (this.player.amount = a.playerResult);
this.running = !0;
this.onChangeResultsListeners = {};
this.onLoseListener = function() {}
;
this.onChangePlaceListener = function() {}
;
this.updateShownPlace();
this.algorithm = new CompetitionAlgorithm(this,this.options.algo);
if (0 < this.countFakePlayers())
this.onPlayersAvailable();
this.onAnimateResults = function() {}
;
this.onGetOpponent = function() {}
;
this.onGetUserView = function() {}
};
Competition.prototype.start = function() {
this.algorithm.start()
}
;
Competition.optionsForTournament = function(a) {
var b = cleverapps.dataLoader.load(DataLoader.TYPES.COMPETITION + "_tournament") || {};
if (a.emptySave || b.level === a.level.getHumanReadableNumber()) {
b = b.results || [];
if (a.emptySave) {
Competition.CLEAN_SAVED("tournament");
var c = [.5, .8, 1.1].sort(function() {
return .5 > Math.random() ? -1 : 1
});
b = cleverapps.competitionPlayers.listPlayers(3) || [];
b.forEach(function(e, f) {
e.amount = 0;
e.force = c[f]
})
}
if (!(3 > b.length)) {
cleverapps.UI.Avatar.preload(b);
var d = cleverapps.competitionStatistics.getBoardGameWordOpenByKeypadLengthTime(a.keypad.amountKeys());
return {
type: "tournament",
amount: 3,
level: a.level,
store: !0,
lose: !1,
players: b,
algo: {
noPlayerEpisodeCoef: !0,
averageProcessTimeout: cleverapps.parseInterval(d + " seconds"),
botAheadPlayerCoef: .25,
botAheadPlayerBigDifferenceCoef: .3,
bigDistanceLength: 1,
offlineProcess: !0,
useRealForce: !0,
duration: cleverapps.parseInterval("3 hour"),
maxResult: a.totalItemsToSolve()
}
}
}
}
}
;
Competition.optionsForKnockoutGame = function(a) {
var b = 10;
"board" === cleverapps.config.type ? b = cleverapps.competitionStatistics.getBoardGameWordOpenByKeypadLengthTime(a.keypad.amountKeys()) : "differences" === cleverapps.config.type && (b = cleverapps.competitionStatistics.getOneDifferenceFindTime());
var c = cleverapps.meta.getRumble()
, d = c.getCurrentRound().getOpponent(connector.platform.getUserID());
d.force = [.6, .8, 1][c.rounds.length - 1];
d.amount = 0;
if (c = cleverapps.dataLoader.load(DataLoader.TYPES.COMPETITION + "_knockout"))
d.savedPoints = c,
d.amount = c.length;
c = .3;
var e = 1.5
, f = .5;
switch (cleverapps.meta.knockoutGame.calcTournamentType()) {
case KnockoutGame.BOT_CANNOT_WIN_TOURNAMENT:
f = 0;
e = 2;
b = Math.floor(.8 * b);
break;
case KnockoutGame.VERY_EASY_TOURNAMENT:
c = .3;
e = 2;
b = Math.floor(2.5 * b);
break;
case KnockoutGame.EASY_TOURNAMENT:
c = .4;
e = 1;
f = .3;
b = Math.floor(1.3 * b);
break;
case KnockoutGame.NORMAL_TOURNAMENT:
c = .5;
e = 1.2;
f = .3;
b = Math.floor(1.1 * b);
break;
case KnockoutGame.DIFFICULT_TOURNAMENT:
c = .6;
e = 1.5;
b = Math.floor(.8 * b);
break;
case KnockoutGame.VERY_DIFFICULT_TOURNAMENT:
c = .8,
e = 1.5,
b = Math.floor(.5 * b)
}
return {
type: "knockout",
amount: 1,
players: [d],
algo: {
noPlayerEpisodeCoef: !0,
averageProcessTimeout: cleverapps.parseInterval(b + " seconds"),
botAheadPlayerCoef: c,
botAheadPlayerBigDifferenceCoef: .5,
playerAheadBotCoef: e,
playerAheadBotBigDifferenceCoef: 2,
bigDistanceLength: 1,
offlineProcess: !1,
useRealForce: !0,
duration: cleverapps.parseInterval("3 hour"),
maxResult: a.totalItemsToSolve(),
botFinishCoef: f
}
}
}
;
Competition.optionsByMission = function(a) {
var b = {
store: !0,
type: a.type,
playerResult: a.result,
amount: Array.isArray(a.competition.amount) ? cleverapps.Random.random(a.competition.amount[0], a.competition.amount[1], !1) : a.competition.amount
};
b.algo = {
start: a.started,
finish: a.finishTime()
};
Object.assign(b.algo, a.competition);
return b
}
;
Competition.prototype.changePlayerId = function(a, b) {
this.player.id === a && (this.player.id = b);
for (var c = 0; c < this.results.length; ++c)
this.results[c].id === a && (this.results[c].id = b)
}
;
Competition.prototype.calcPlace = function() {
this.results.sort(function(a, b) {
return b.amount !== a.amount ? b.amount - a.amount : "tournament" === this.type && a.event && b.event && a.event !== b.event ? a.event - b.event : a === this.player ? -1 : b === this.player ? 1 : 0
}
.bind(this));
return this.results.indexOf(this.player)
}
;
Competition.prototype.updatePlayerResult = function(a, b) {
this.options.algo.maxResult && b > this.options.algo.maxResult && (b = this.options.algo.maxResult);
for (var c = 0; c < this.results.length; c++)
if (this.results[c].id === a && this.results[c].amount !== b) {
this.results[c].amount = b;
this.results[c].event = Date.now();
this.runChangeResultsListeners(a);
break
}
if (this.hasPlaceChanged())
this.onChangePlaceListener();
if (this.getFinishedOpponents().length === this.options.amount && !1 !== this.options.lose)
this.onLoseListener()
}
;
Competition.prototype.hasPlaceChanged = function() {
return this.lastShownPlace ? this.lastShownPlace !== this.calcPlace() : (this.lastShownPlace = this.calcPlace(),
!1)
}
;
Competition.prototype.updateShownPlace = function() {
this.lastShownPlace = this.calcPlace()
}
;
Competition.prototype.getFinishedOpponents = function() {
return this.results.filter(function(a) {
return a.id !== connector.platform.getUserID() && a.amount === this.options.algo.maxResult
}
.bind(this))
}
;
Competition.prototype.runChangeResultsListeners = function(a) {
Object.values(this.onChangeResultsListeners).forEach(function(b) {
b(a)
})
}
;
Competition.prototype.stop = function() {
this.running = !1;
delete cleverapps.competitionPlayers.onAvailableListeners[this.type];
this.algorithm.stop()
}
;
Competition.prototype.onPlayersAvailable = function() {
delete cleverapps.competitionPlayers.onAvailableListeners[this.type];
if (this.running) {
var a = cleverapps.competitionPlayers.listPlayers(Math.min(this.countFakePlayers(), cleverapps.competitionPlayers.getAmount()));
this.replaceFakePlayers(a);
0 < this.countFakePlayers() && (cleverapps.competitionPlayers.onAvailableListeners[this.type] = this.onPlayersAvailable.bind(this))
}
}
;
Competition.CLEAN_SAVED = function(a) {
cleverapps.dataLoader.remove(DataLoader.TYPES.COMPETITION + "_" + a)
}
;
Competition.prototype.countFakePlayers = function() {
var a = 0;
this.results.forEach(function(b) {
b.fake && a++
});
return a
}
;
Competition.prototype.replaceFakePlayers = function(a) {
for (var b = 0, c = 0; c < this.results.length && b < a.length; c++) {
var d = this.results[c];
d.fake && (d.id = a[b].id,
d.name = a[b].name,
d.avatar = a[b].avatar,
delete d.fake,
b++)
}
this.save()
}
;
Competition.prototype.getPlayerById = function(a) {
return this.results.filter(function(b) {
return b.id === a
})[0]
}
;
Competition.prototype.getResults = function() {
return this.results.slice()
}
;
Competition.prototype.save = function() {
if (this.options.store) {
var a = this.results.map(function(b) {
"string" !== typeof b.avatar && (b = Object.assign({}, b, {
avatar: void 0
}));
return b
});
cleverapps.dataLoader.save(DataLoader.TYPES.COMPETITION + "_" + this.type, {
results: a,
algorithm: this.algorithm.getData(),
level: this.options.level ? this.options.level.getHumanReadableNumber() : void 0
})
}
}
;
Competition.prototype.onUserInfoChanged = function() {
var a = cleverapps.user.getPlayerInfo();
this.player.name = a.name;
this.player.avatar = a.avatar;
this.player.id = connector.platform.getUserID();
this.save()
}
;
var CompetitionPlayers = function() {
this.players = [];
this.onAvailableListeners = {};
if ("undefined" !== typeof Rumble || cleverapps.missionManager.hasCompetitions())
this.load(),
this.reload(),
cleverapps.timeouts.setInterval(this.reload.bind(this), cleverapps.parseInterval(CompetitionPlayers.RELOAD_INTERVAL))
};
CompetitionPlayers.prototype.reload = function() {
// if (!this.reloading) {
// this.reloading = !0;
// var a = function(d) {
// this.reloading = !1;
// this.players = [];
// for (var e = 0; e < d.length; e++)
// d[e].id !== connector.platform.getUserID() && d[e].name && 0 < d[e].name.length && this.players.push({
// id: d[e].id,
// name: d[e].name,
// avatar: d[e].avatar
// });
// this.save();
// if (0 < this.players.length)
// for (var f in this.onAvailableListeners)
// this.onAvailableListeners[f]()
// }
// .bind(this)
// , b = function() {
// this.reloading = !1
// }
// .bind(this)
// , c = "/competitionplayers/?locale=" + cleverapps.settings.language;
// connector.platform.oneOf(connector.MICROSOFT) && (c += "&amountPlayers=30");
// cleverapps.config.debugMode && (c = "https://riddles.labsystech.ru/riddles-rest" + c);
// cleverapps.RestClient.get(c, {}, a, b)
// }
}
;
CompetitionPlayers.prototype.getAmount = function() {
return this.players.length
}
;
CompetitionPlayers.prototype.listFakePlayers = function(a) {
for (var b = [], c = 0; c < a; c++)
b.push({
id: Math.round(1E6 * Math.random()),
name: "player" + c,
fake: !0
});
return b
}
;
CompetitionPlayers.prototype.listPlayers = function(a) {
a = this.players.splice(0, a);
this.save();
this.reload();
return a
}
;
CompetitionPlayers.prototype.load = function() {
this.players = cleverapps.dataLoader.load(DataLoader.TYPES.COMPETITION_PLAYERS) || []
}
;
CompetitionPlayers.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.COMPETITION_PLAYERS, this.players)
}
;
CompetitionPlayers.RELOAD_INTERVAL = "30 minutes";
var CompetitionStatistics = function() {
this.load()
};
CompetitionStatistics.prototype.onGameStop = function(a) {
if ("board" === cleverapps.config.type && a.outcome !== GameBase.OUTCOME_UNKNOWN) {
var b = Math.floor(a.timer.getTime() / a.board.countTotalWords() / 1E3);
this.saveBoardGameWordOpenByKeypadLengthTime(a.keypad.amountKeys(), b)
}
}
;
CompetitionStatistics.prototype._newData = function(a, b) {
this.data[a] && this._isAppropriateValue(a, b) && (this.data[a] = Math.round(.9 * this.data[a] + .1 * b),
this.save())
}
;
CompetitionStatistics.prototype._isAppropriateValue = function(a, b) {
return b > CompetitionStatistics.DEFAULTS[a] / 5 && b < 5 * CompetitionStatistics.DEFAULTS[a]
}
;
CompetitionStatistics.prototype.saveBoardGameWordOpenByKeypadLengthTime = function(a, b) {
this._newData("brd_l" + a, b)
}
;
CompetitionStatistics.prototype.getBoardGameWordOpenByKeypadLengthTime = function(a) {
a = Math.min(Math.max(a, 4), 9);
return this.data["brd_l" + a]
}
;
CompetitionStatistics.prototype.saveOneDifferenceFindTime = function(a) {
console.log("save diff time", a);
this._newData("diff_time", a)
}
;
CompetitionStatistics.prototype.getOneDifferenceFindTime = function() {
return this.data.diff_time
}
;
CompetitionStatistics.prototype.load = function() {
this.updateInfo(cleverapps.dataLoader.load(DataLoader.TYPES.COMPETITION_STATISTICS) || {})
}
;
CompetitionStatistics.prototype.updateInfo = function(a, b) {
this.data = {};
for (var c in CompetitionStatistics.DEFAULTS)
this.data[c] = a[c] && this._isAppropriateValue(c, a[c]) ? a[c] : CompetitionStatistics.DEFAULTS[c];
b && this.save(!0)
}
;
CompetitionStatistics.prototype.getInfo = function() {
var a = {}, b;
for (b in CompetitionStatistics.DEFAULTS)
CompetitionStatistics.DEFAULTS[b] !== this.data[b] && (a[b] = this.data[b]);
return a
}
;
CompetitionStatistics.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.COMPETITION_STATISTICS, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("competitionstatistics")
}
;
CompetitionStatistics.DEFAULTS = {
brd_l4: 8,
brd_l5: 15,
brd_l6: 20,
brd_l7: 30,
brd_l8: 40,
brd_l9: 50,
diff_time: 30
};
var CompetitionAlgorithm = function(a, b) {
this.competition = a;
this.options = b;
void 0 === b.start && (b.start = Date.now(),
b.finish = b.start + b.duration);
this.lastProcessed = b.lastProcessed || b.start
};
CompetitionAlgorithm.prototype.start = function() {
this.isPrepared() || this.prepareFromScratch();
this.competition.running && (this.intervalProcess(),
this.runInterval = cleverapps.timeouts.setInterval(function() {
this.competition.running ? this.intervalProcess() : this.stop()
}
.bind(this), this.intervalTimeout()))
}
;
CompetitionAlgorithm.prototype.stop = function() {
this.runInterval && (cleverapps.timeouts.clearInterval(this.runInterval),
this.runInterval = void 0)
}
;
CompetitionAlgorithm.prototype.getData = function() {
return this.lastProcessed
}
;
CompetitionAlgorithm.prototype.process = function(a) {
for (var b = [], c = 0; c < this.competition.results.length; c++) {
var d = this.competition.results[c];
if (!d.player && Math.random() < this.botProcessProb(d, a) && (!this.options.maxResult || d.amount !== this.options.maxResult)) {
var e = d.amount + this.processAmount();
this.options.maxResult && e > this.options.maxResult && (e = this.options.maxResult);
d.amount !== e && b.push({
id: d.id,
amount: e
})
}
}
if (0 < b.length) {
for (c = 0; c < b.length; c++)
this.competition.updatePlayerResult(b[c].id, b[c].amount);
this.competition.save()
}
}
;
CompetitionAlgorithm.prototype.isPrepared = function() {
for (var a = 0; a < this.competition.results.length; a++)
if (!this.competition.results[a].player)
return void 0 !== this.competition.results[a].force;
return !0
}
;
CompetitionAlgorithm.prototype.prepareFromScratch = function() {
this.competition.results.forEach(function(a) {
a.player || (a.amount = 0,
a.force = Math.floor(Math.random() * (CompetitionAlgorithm.BOT_MAX_FORCE + 1)),
this.options.minBotForce && (a.force = Math.max(a.force, this.options.minBotForce)),
a.sleep = this.generateSleepPeriod())
}, this);
this.competition.save()
}
;
CompetitionAlgorithm.prototype.generateSleepPeriod = function() {
var a = this.options.finish - this.options.start;
if (!(a < cleverapps.parseInterval("1 hour"))) {
var b = Math.floor(a / 4 + Math.random() * a / 4);
a = this.options.start + Math.floor(Math.random() * (a - b));
return {
s: a,
f: a + b
}
}
}
;
CompetitionAlgorithm.prototype.offlineCoef = function() {
return void 0 !== this.options.offlineCoef ? this.options.offlineCoef : .3
}
;
CompetitionAlgorithm.prototype.playerAheadBotCoef = function() {
return void 0 !== this.options.playerAheadBotCoef ? this.options.playerAheadBotCoef : 1
}
;
CompetitionAlgorithm.prototype.playerAheadBot5AmountCoef = function() {
return void 0 !== this.options.playerAheadBotBigDifferenceCoef ? this.options.playerAheadBotBigDifferenceCoef : 2
}
;
CompetitionAlgorithm.prototype.botAheadPlayerCoef = function() {
return void 0 !== this.options.botAheadPlayerCoef ? this.options.botAheadPlayerCoef : .3
}
;
CompetitionAlgorithm.prototype.botAheadPlayer5AmountCoef = function() {
return void 0 !== this.options.botAheadPlayerBigDifferenceCoef ? this.options.botAheadPlayerBigDifferenceCoef : .1
}
;
CompetitionAlgorithm.prototype.mediumAmount = function() {
var a = this.options.step;
return a && 0 < a.length ? a.reduce(function(b, c) {
return b + c
}, 0) / a.length : 1
}
;
CompetitionAlgorithm.prototype.processAmount = function() {
var a = this.options.step;
return a ? 2 < a.length ? cleverapps.Random.choose(a, !1) : cleverapps.Random.random(a[0], a[1], !1) : 1
}
;
CompetitionAlgorithm.prototype.getBotForceCoef = function(a) {
if (this.options.useRealForce)
return a;
var b = [0, .03, .08, .15, .25, .35, .5, .7, 1, 1.5, 2];
return (void 0 !== b[a] ? b[a] : 2) * (this.options.forceCoef || 1)
}
;
CompetitionAlgorithm.prototype.sleepNow = function(a) {
return a.sleep ? a.sleep.s <= this.lastProcessed && this.lastProcessed <= a.sleep.f : !1
}
;
CompetitionAlgorithm.prototype.bigDistanceLength = function() {
return this.options.bigDistanceLength ? this.options.bigDistanceLength : 5
}
;
CompetitionAlgorithm.prototype.calcFromBotAmountCoef = function(a) {
if (!this.options.maxResult || 2 > this.options.maxResult)
return 1;
var b = (this.options.maxResult - 1) / 2;
return 1.25 - .75 * (a.amount - b) / b
}
;
CompetitionAlgorithm.prototype.botProcessProb = function(a, b) {
if (this.sleepNow(a))
return 0;
var c = this.competition.player.amount;
b = this.perIntervalProb(b);
a.amount >= c ? (b *= this.botAheadPlayerCoef(a),
a.amount > c + this.bigDistanceLength() * this.mediumAmount() && (b *= this.botAheadPlayer5AmountCoef(a))) : (b *= this.playerAheadBotCoef(a),
c > a.amount + this.bigDistanceLength() * this.mediumAmount() && (b *= this.playerAheadBot5AmountCoef(a)));
void 0 !== this.options.botFinishCoef && this.options.maxResult && a.amount + this.mediumAmount() >= this.options.maxResult && (b *= this.options.botFinishCoef);
b *= this.calcFromBotAmountCoef(a);
return b * this.playerEpisodeCoef() * this.getBotForceCoef(a.force)
}
;
CompetitionAlgorithm.prototype.perIntervalProb = function(a) {
if (a)
return this.offlinePerIntervalProb || (this.offlinePerIntervalProb = this.offlineCoef() * this.intervalTimeout(a) / this.maxForceBotAverageProcessTimeout()),
this.offlinePerIntervalProb;
this.onlinePerIntervalProb || (this.onlinePerIntervalProb = this.intervalTimeout(a) / this.maxForceBotAverageProcessTimeout());
return this.onlinePerIntervalProb
}
;
CompetitionAlgorithm.prototype.intervalTimeout = function(a) {
return cleverapps.parseInterval(a ? "10 minutes" : "5 seconds")
}
;
CompetitionAlgorithm.prototype.freeze = function(a) {
var b = Date.now();
this.lastProcessed = this.lastProcessed > b ? this.lastProcessed + a : b + a
}
;
CompetitionAlgorithm.prototype.intervalProcess = function() {
var a = Math.min(Date.now(), this.options.finish);
if (!(this.lastProcessed > a)) {
var b = this.intervalTimeout(!0)
, c = this.intervalTimeout();
if (!1 !== this.options.offlineProcess)
for (; this.lastProcessed < a - 2 * b; )
this.lastProcessed += b,
this.process(!0);
for (; this.lastProcessed < a - c / 2; )
this.lastProcessed += c,
this.process();
this.lastProcessed = a;
this.competition.save()
}
}
;
CompetitionAlgorithm.prototype.maxForceBotAverageProcessTimeout = function() {
return this.options.averageProcessTimeout ? this.options.averageProcessTimeout : cleverapps.parseInterval("3 minutes")
}
;
CompetitionAlgorithm.prototype.playerEpisodelevel = function() {
return 10 <= levels.user.episode ? 2 : 5 <= levels.user.episode ? 1 : 0
}
;
CompetitionAlgorithm.prototype.playerEpisodeCoef = function() {
return this.options.noPlayerEpisodeCoef ? 1 : [.1, .13, .15][this.playerEpisodelevel()]
}
;
CompetitionAlgorithm.BOT_MAX_FORCE = 10;
cleverapps.Notification = function() {
this.queue = [];
this.current = void 0;
this.onRemove = function() {}
;
this.onUpdateProgress = function() {}
}
;
cleverapps.Notification.prototype.create = function(a, b) {
b = b || {};
if (b.debugInfo || a)
if (this.current && a === this.current.msg) {
if (b.progress)
this.onUpdateProgress(b.progress.newAmount ? b.progress.newAmount : b.progress.amount, b.progress.total)
} else {
var c = !1;
this.queue.forEach(function(d) {
d.msg === a && (b.progress && d.options.progress && (b.progress.newAmount ? d.options.progress.newAmount = b.progress.newAmount : d.options.progress = b.progress),
c = !0)
});
c || (this.queue.push({
msg: a,
options: b
}),
this.queue.length > cleverapps.Notification.MAX_QUEUE && this.queue.shift(),
b.defer || this.processQueue())
}
}
;
cleverapps.Notification.prototype.processQueue = function() {
if (!this.current && this.queue.length) {
var a = cleverapps.scenes.getRunningScene();
if (a && this.canShow(this.queue[0])) {
var b = this.queue.shift();
this.current = {
msg: b.msg
};
b = new NotificationView(this,b.msg,b.options);
a.addChild(b);
b.show()
}
}
}
;
cleverapps.Notification.prototype.reset = function() {
this.onRemove();
this.current = void 0
}
;
cleverapps.Notification.prototype.clear = function() {
this.reset();
this.queue = []
}
;
cleverapps.Notification.prototype.canShow = function(a) {
return cleverapps.gameModes.noNotifications ? !1 : cleverapps.allInitialized && !cleverapps.environment.isLoaderScene() && cleverapps.scenes.isSceneReady() && "playable" !== connector.info.source || a.options.debugInfo
}
;
cleverapps.Notification.MAX_QUEUE = 3;
var NotificationView = cc.Scale9Sprite.extend({
ctor: function(a, b, c) {
var d = bundles.notification.frames.notification_bg;
this._super(d, cleverapps.UI.getScale9Rect(d, cleverapps.UI.Scale9Rect.TwoPixelXY));
this.model = a;
a = cleverapps.styles.NotificationView;
this.setLocalZOrder(UpMenuContainer.ZORDER + 11);
b = cleverapps.UI.generateOnlyText(b, cleverapps.styles.FONTS.NOTIFICATION_TEXT, c.toReplace);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d = Math.min(.85 * cleverapps.resolution.getSceneSize().width, a.maxWidth);
var e = a.text.height;
c.progress && (this.bar = this.createBar(c.progress),
e -= this.bar.height * this.bar.scale + a.progress.margin);
if (c.image) {
var f = c.image instanceof cc.Node ? c.image : new cc.Sprite(c.image);
cleverapps.UI.fitToBox(f, a.image);
d -= f.width * f.scale + a.image.margin
}
b.setDimensions(d, 0);
b.fitTo(void 0, e);
this.content = b;
this.bar && (this.content = new cleverapps.Layout([b, this.bar],{
margin: a.progress.margin,
direction: cleverapps.UI.VERTICAL
}));
f && (this.content = new cleverapps.Layout([f, this.content],{
margin: a.image.margin,
direction: cleverapps.UI.HORIZONTAL
}));
this.addChild(this.content);
this.updateSize();
this.setPositionRound(this.getHidePosition());
c.noSound || cleverapps.audio.playSound(bundles.main.urls.notification_effect);
this.onShowListener = function() {
this.isRunning() && (c.progress && c.progress.newAmount ? this.updateProgress(c.progress.newAmount, c.progress.total, .5) : this.delayAndHide())
}
.bind(this);
this.model.onRemove = this.createListener(function() {
this.removeFromParent()
}
.bind(this));
this.model.onUpdateProgress = this.createListener(this.updateProgress.bind(this));
c.debugInfo && (this.setLocalZOrder(1E4),
this.model.onRemove = function() {}
,
this.alwaysOn = !0,
cleverapps.UI.onPressed(this, function() {
cleverapps.focusManager.display({
stack: !0,
focus: "ErrorWindow",
action: function(g) {
new ErrorWindow(c);
cleverapps.focusManager.onceNoWindowsListener = g
}
})
}))
},
createBar: function(a) {
var b = cleverapps.styles.NotificationView.progress
, c = new ScaledProgressBar({
type: ScaledProgressBar.Types[b.type],
barText: {
font: cleverapps.styles.FONTS.NOTIFICATION_PROGRESS_FONT
}
});
c.setLength(b.width);
c.setGoal(a.total);
c.setPercentage(a.amount);
c.setAnchorPoint(.5, .5);
cleverapps.UI.fitToBox(c, {
height: b.height
});
return c
},
updateSize: function() {
var a = cleverapps.styles.NotificationView
, b = .85 * cleverapps.resolution.getSceneSize().width;
b = Math.min(1, b / this.content.width);
this.setContentSize(Math.max(a.minWidth, this.content.width * b + 2 * a.padding.x), Math.max(a.minHeight, 2 * (this.content.height * b + a.padding.y)));
this.content.setScale(b);
this.content.setPositionRound({
x: {
align: "center"
},
y: {
align: "bottom",
dy: a.padding.y
}
})
},
getHidePosition: function() {
return {
x: {
align: "center"
},
y: {
align: "top",
dy: this.height
}
}
},
getShownPosition: function() {
return {
x: {
align: "center"
},
y: {
align: "top",
dy: -cleverapps.styles.NotificationView.offsetY + this.height / 2
}
}
},
completeAnimationOnResize: function() {
this.stopAllActions();
this.delayAndHide()
},
show: function() {
if (!this.shown && this.isRunning()) {
this.shown = !0;
var a = this.getShownPosition();
this.runAction(new cc.Sequence(new cc.MoveTo(.2,this.calculatePositionRound(a)),new cc.CallFunc(function() {
this.onShowListener()
}
.bind(this)))).setFinalize(function() {
this.setPositionRound(a)
}
.bind(this))
}
},
hide: function() {
if (this.shown && this.isRunning()) {
this.shown = !1;
var a = this.getHidePosition();
this.runAction(new cc.Sequence(new cc.MoveTo(.5,this.calculatePositionRound(a)),new cc.CallFunc(function() {
this.model.reset();
this.model.processQueue()
}
.bind(this)))).setFinalize(function() {
this.setPositionRound(a)
}
.bind(this))
}
},
delayAndHide: function() {
this.isRunning() && (this.delayAndHideAction = this.runAction(new cc.Sequence(new cc.DelayTime(3),new cc.CallFunc(this.hide.bind(this)))))
},
updateProgress: function(a, b, c) {
this.bar && this.shown && (this.stopAction(this.delayAndHideAction),
this.stopAction(this.updateProgressAction),
this.isRunning() && (this.updateProgressAction = this.runAction(new cc.Sequence(new cc.DelayTime(c || 0),new cc.CallFunc(function() {
this.delayAndHide();
this.bar.setGoal(b);
this.bar.setPercentage(a, {
animated: !0
});
if (a >= b && (this.bar.updateBarText(Messages.get("done")),
cleverapps.audio.playSound(bundles.notification.urls.task_done_sfx),
bundles.notification.jsons.bar_flash_json)) {
var d = new cleverapps.Spine(bundles.notification.jsons.bar_flash_json);
this.bar.addChild(d);
d.setPositionRound(cleverapps.styles.NotificationView.progress.animation);
d.setAnimation(0, "animation", !1);
d.setCompleteListenerRemove()
}
}
.bind(this)))).setFinalize(function() {
this.bar.setGoal(b);
this.bar.setPercentage(a);
a >= b && this.bar.updateBarText(Messages.get("done"))
}
.bind(this))))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
NOTIFICATION_TEXT: {
name: "nostroke",
size: 50,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
}
});
cleverapps.styles.NotificationView = {
offsetY: 10,
text: {
height: 100
},
image: {
margin: 20,
width: 200,
height: 100,
maxScale: 1.5
},
minWidth: 300,
minHeight: 200,
maxWidth: 750,
padding: {
x: 30,
y: 40
},
progress: {
margin: 10,
width: 350,
height: 30,
type: "green",
animation: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -2
}
}
}
};
NotificationView.ZORDER = BaseWindow.WINDOWS_ZORDER + 2;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
NOTIFICATION_PROGRESS_FONT: {
name: "default",
size: 26
}
});
var CenterHint = function() {
this.onShowHint = function() {}
;
this.onHideHint = function() {}
};
CenterHint.prototype.createTextHint = function(a, b) {
this.create({
message: a,
toReplace: b
})
}
;
CenterHint.prototype.listAvailableHints = function() {
return "merge" === cleverapps.config.type ? [CustomerHintContent, MissionTreeHintContent, ProducerHintContent, UnmergeableUnitHintContent, MergeBonusHintContent, FeedableHintContent, TextHintContent] : [TextHintContent]
}
;
CenterHint.prototype.create = function(a) {
if (this.content && this.content.hasSameContent(a))
this.hideWaitComplete = !1,
this.contentWasShown && this.schedule(CenterHint.DURATION, this.finishCenterHint.bind(this));
else {
var b = this.listAvailableHints().filter(function(d) {
return d.isApplicable(a)
})[0];
if (b) {
this.hideHint();
this.contentWasShown = this.hideWaitComplete = !1;
this.content = new b(a);
b = this.content.getMessages();
var c = Dialogue.POSITIONS.TOP;
this.content.doNotBlock && (c = Map2d.currentMap.getScreenCenterCell(),
c = Map2dInnerView.IsoToScreen(this.content.doNotBlock.x, this.content.doNotBlock.y).y > Map2dInnerView.IsoToScreen(c.x, c.y).y ? Dialogue.POSITIONS.BOTTOM : Dialogue.POSITIONS.TOP);
a.wrongMerged ? this.schedule(CenterHint.WRONG_MERGED_DELAY, this.showHint.bind(this, b, c)) : this.showHint(b, c)
}
}
}
;
CenterHint.prototype.finishCenterHint = function() {
this.content && (this.hideWaitComplete = !0,
this.contentWasShown && this.schedule(CenterHint.DELAY_BEFORE_HIDING, this.hideHint.bind(this)))
}
;
CenterHint.prototype.onCompleteAnimation = function() {
this.content && this.hideWaitComplete && this.hideHint()
}
;
CenterHint.prototype.showHint = function(a, b) {
cleverapps.gameModes.silentCenterHint || (this.hideWaitComplete ? this.hideHint() : (this.contentWasShown = !0,
this.onShowHint(a, b),
this.schedule(CenterHint.DURATION, this.finishCenterHint.bind(this))))
}
;
CenterHint.prototype.hideHint = function() {
this.content && this.content.onComplete && this.content.onComplete();
this.clearTimeout();
this.onHideHint();
this.content = void 0
}
;
CenterHint.prototype.destructor = function() {
this.clearTimeout()
}
;
CenterHint.prototype.clearTimeout = function() {
void 0 !== this.timeout && (cleverapps.timeouts.clearTimeout(this.timeout),
this.timeout = void 0)
}
;
CenterHint.prototype.schedule = function(a, b) {
this.clearTimeout();
this.timeout = cleverapps.timeouts.setTimeout(b, a)
}
;
CenterHint.DURATION = 2500;
CenterHint.WRONG_MERGED_DELAY = 600;
CenterHint.DELAY_BEFORE_HIDING = 200;
var CenterHintView = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.centerHint = a;
this.updateSize();
this.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 1);
a.onShowHint = this.createListener(this.showHint.bind(this));
a.onHideHint = this.createListener(this.hideHint.bind(this))
},
updateSize: function() {
var a = cleverapps.resolution.getSceneSize();
this.setContentSize2(a.width, a.height);
this.setPosition(a.width / 2, a.height / 2)
},
showHint: function(a, b) {
var c = cleverapps.styles.CenterHintView;
a = a.map(this.convertMessageItem.bind(this));
this.current = new MinimalDialogue({
items: a,
forcePosition: c.positions[b],
direction: cleverapps.UI.HORIZONTAL,
delay: 0,
person: "worker",
shortAnimations: !0
});
this.addChild(this.current);
this.current.display();
cleverapps.UI.fitToBox(this.current, {
width: cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL ? .8 * this.width : Math.max(c.minWidth, this.width - c.maxPaddingX),
height: this.current.height
})
},
convertMessageItem: function(a) {
return a.icon ? (this.maxIconHeight || (this.maxIconHeight = 1.8 * cleverapps.UI.generateOnlyText("12345", cleverapps.styles.FONTS.FORCE_MESSAGE_TEXT).height),
cleverapps.UI.fitToBox(a.icon, {
width: a.icon.width,
height: this.maxIconHeight
}),
a.icon.clearTrack && a.icon.clearTrack(0),
a.icon.setLocalZOrder(1),
a.icon) : cleverapps.UI.LabelTTF.GetLocalizedText(a.text || "", a.toReplace)
},
hideHint: function() {
if (this.current) {
var a = this.current;
delete this.current;
a.remove()
}
}
});
cleverapps.styles.CenterHintView = {
minWidth: 500,
maxPaddingX: 300,
maxTextWidth: 1E3,
positions: {}
};
cleverapps.styles.CenterHintView.positions[Dialogue.POSITIONS.TOP] = {
x: {
align: "center"
},
y: {
align: "top",
dy: -200
}
};
cleverapps.styles.CenterHintView.positions[Dialogue.POSITIONS.BOTTOM] = {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 160
}
};
var TextHintContent = function(a) {
this.message = a.message;
this.toReplace = a.toReplace
};
TextHintContent.isApplicable = function(a) {
return void 0 !== a.message
}
;
TextHintContent.prototype.hasSameContent = function(a) {
return a.message ? this.message === a.message && cleverapps.cmp(this.toReplace, a.toReplace) : !1
}
;
TextHintContent.prototype.getMessages = function() {
return Array.isArray(this.message) ? this.message : [{
text: this.message,
toReplace: this.toReplace,
align: !0
}]
}
;
var MapScrollView = cc.Node.extend({
ctor: function() {
this._super();
this.container = new cc.Node;
this.addChild(this.container);
this.scheduleUpdate();
this.scrollHandler = new cleverapps.UI.MapScrollHandler(this);
this.zoom = 1;
this.updateChildren = cleverapps.throttle(25, this.checkChildrenVisibility.bind(this))
},
zoomTo: function(a) {
var b = this.zoom
, c = Date.now()
, d = (a.zoom - b) / a.timeout;
this._zoomInterval = cleverapps.timeouts.setInterval(this.createListener(function() {
var e = Date.now() - c;
if (e >= a.timeout) {
if (this.setZoom(a.zoom),
cleverapps.timeouts.clearInterval(this._zoomInterval),
a.onComplete)
a.onComplete()
} else
this.setZoom(b + d * e, a.centerPoint)
}), 13)
},
setZoom: function(a, b) {
this.scrollHandler.stopAutoScroll();
var c = cleverapps.resolution.getBgSize()
, d = this.getContainerSize();
a = Math.max(a, cleverapps.styles.WorldMap.zoom.minScale, c.width / d.width, c.height / d.height);
a = Math.min(a, 1.1);
var e = this.zoom;
this.zoom = a;
this.setScale(this.zoom);
a = this.getContainerPosition();
this.setContentSize2(Math.ceil(c.width / this.zoom), Math.ceil(c.height / this.zoom));
var f = 0
, g = 0;
e && (f = Math.ceil(c.width / this.zoom) - Math.ceil(c.width / e),
g = Math.ceil(c.height / this.zoom) - Math.ceil(c.height / e));
if (b) {
var h = Math.abs(b.x) + c.width / 2 - d.width / 2;
0 < h && (f = 0 < b.x ? f - h : f + h);
c = Math.abs(b.y) + c.height / 2 - d.height / 2;
0 < c && (g = 0 < b.y ? g - c : g + c)
}
this.setContainerPosition(this.availableScrollPosition({
x: a.x + f / 2,
y: a.y + g / 2
}), this.zoom < e)
},
setContainerSize: function(a) {
this.innerWidth = a.width;
this.innerHeight = a.height;
this.container.setContentSize2(a)
},
getContainerSize: function() {
return this.container.getContentSize()
},
getContainerPosition: function() {
return this.container.getPosition()
},
setContainerPosition: function(a, b) {
if (a.x !== this.container.getPositionX() || a.y !== this.container.getPositionY() || b)
this.container.setPosition(a),
this.updateChildren(),
this.scrollHandler.afterContainerMove()
},
update: function(a) {
this._super(a);
this.scrollHandler.processAutoScroll(a)
},
onEnter: function() {
this._super();
this.addControls()
},
checkChildrenVisibility: function() {
this.container.getChildren().forEach(function(a) {
!a.visible && this.isInContainer(a) ? a.visible = !0 : a.visible && !this.isInContainer(a) && (a.visible = !1)
}, this)
},
isInContainer: function(a) {
var b = cleverapps.styles.MapScrollView.visiblePadding
, c = this.getContainerPosition()
, d = this.getContentSize();
c = cc.rect(-c.x, -c.y, d.width, d.height);
a = a.getBoundingBox();
a.x -= b.width / 2;
a.y -= b.height / 2;
a.width += b.width / 2;
a.height += b.height / 2;
b = cc.rectIntersection(c, a);
return 0 < b.width && 0 < b.height
},
addControls: function() {
cleverapps.UI.onDrag(this, {
onMouseZoom: function(a) {
var b = 1;
.3 >= this.zoom ? b = .3 : .5 >= this.zoom && (b = .5);
this.setZoom(this.zoom + a * b)
}
.bind(this),
onPinchZoom: cc.sys.capabilities.touches && function(a) {
this.setZoom(this.zoom + a)
}
.bind(this),
onPressed: function() {
this.scrollHandler.stopAutoScroll()
}
.bind(this),
onClick: this.onClick && this.onClick.bind(this),
onDragStart: this.onTouchBegan.bind(this),
followPointer: this.onTouchMoved.bind(this),
onDragEnd: this.onTouchEnded.bind(this)
})
},
onTouchBegan: function() {
this.container.stopAllActions();
this.scrollHandler.handlePress();
return !0
},
onTouchMoved: function(a) {
var b = this.convertToNodeSpace(a.getLocation());
a = this.convertToNodeSpace(a.getPreviousLocation());
b = cc.pSub(b, a);
this.scrollHandler.gatherMoveData(b);
this.moveContainer(b)
},
onTouchEnded: function(a) {
var b = this.convertToNodeSpace(a.getLocation());
a = this.convertToNodeSpace(a.getPreviousLocation());
b = cc.pSub(b, a);
this.scrollHandler.handleRelease(b)
},
moveContainer: function(a) {
a = cc.pAdd(this.getContainerPosition(), a);
this.setContainerPosition(a)
}
});
cleverapps.styles.MapScrollView = {
visiblePadding: {
width: 40,
height: 40
}
};
var PagesViewParallax = function(a, b, c) {
this.parallaxBackgrounds = [];
this.direction = c;
if (a && a.layers) {
c = cleverapps.resolution.getSceneSize();
var d = "scene" === a.width ? c.width : a.width
, e = "scene" === a.height ? c.height : a.height;
for (c = 0; c < a.layers[cleverapps.resolution.mode]; c++) {
var f = bundles.main.urls["episodes_bg_jpg_" + c];
if (f) {
var g = new ParallaxBackground(a.speed[c],this.direction,function() {
var h = new cc.Node;
h.setContentSize2(d, e);
h.setAnchorPoint(.5, .5);
if (f) {
var k = new cc.Sprite(f);
k.setPositionRound(h.width / 2, h.height / 2);
this.parallaxBackgrounds.push(k);
h.addChild(k)
}
return h
}
.bind(this));
g.setLocalZOrder(a.zIndex[c]);
b.addChild(g)
}
}
this.updateScale()
}
};
PagesViewParallax.prototype.updateScale = function() {
var a = cleverapps.resolution.getSceneSize();
this.parallaxBackgrounds.forEach(function(b) {
b.setScale(Math.max(a.width / b.width, a.height / b.height))
})
}
;
var ParallaxBackground = cc.Node.extend({
ctor: function(a, b, c) {
this._super();
this.ratio = a;
this.direction = b;
a = this.frame1 = new ParallaxFrame(c(0),cc.p(0, 0),b);
this.addChild(a);
b = this.frame2 = new ParallaxFrame(c(1),cc.p(a.width - 2, a.height - 2),b);
this.addChild(b);
this.scheduleUpdate()
},
onEnterTransitionDidFinish: function() {
this._super();
this.setupChildren()
},
update: function(a) {
this._super(a);
this.setupChildren()
},
setupChildren: function() {
this.y = -this.parent.y * (1 - this.ratio);
this.x = -this.parent.x * (1 - this.ratio);
this.frame1.setupChildren();
this.frame2.setupChildren()
}
})
, ParallaxFrame = cc.Node.extend({
ctor: function(a, b, c) {
this._super();
this.direction = c;
this.offset = b;
this.frame = a;
this.addChild(a);
this.setContentSize2(a.getContentSize());
this.setAnchorPoint(.5, .5);
this.setPositionRound(this.width / 2, this.height / 2)
},
setupChildren: function() {
var a = cleverapps.resolution.getSceneSize()
, b = this.frame
, c = b.width
, d = b.height;
if (this.direction === cleverapps.UI.HORIZONTAL) {
var e = -(this.parent.parent.x + this.parent.x);
b.x = Math.floor(e / c) * c + c / 2 + this.offset.x;
b.y = d / 2;
b.visible = 0 <= -e + b.x + c / 2 && -e + b.x - c / 2 < a.width
} else
e = -(this.parent.parent.y + this.parent.y),
b.x = c / 2,
b.y = Math.floor(e / d) * d + d / 2 + this.offset.y,
b.visible = 0 <= -e + b.y + d / 2 && -e + b.y - d / 2 < a.height
}
});
var Fireworks = cc.Node.extend({
ctor: function(a, b) {
this._super();
b = b || {};
this.count = 0;
this.state = Date.now();
this.window = a;
this.type = b.type || "confetti";
switch (this.type) {
case "fireworks":
this.sound = b.sound || bundles.fireworks.urls.fireworks_effect;
this.json = b.json || bundles.fireworks.jsons.fireworks_json;
break;
case "confetti":
this.sound = b.sound || bundles.fireworks.urls.confetti_effect,
this.json = b.json || bundles.fireworks.jsons.confetti_json
}
this.setAnchorPoint(.5, .5);
this.ready = this.started = !1;
this.updateSize();
this.setupChildren()
},
start: function(a) {
this.started || (this.started = !0,
this.ready = !1,
this.stopAllActions(),
this.runAction(new cc.Sequence(new cc.DelayTime(a || 0),new cc.CallFunc(function() {
this.ready = !0;
this.process()
}
.bind(this)))))
},
stop: function() {
this.started && (this.stopAllActions(),
this.started = !1)
},
onEnter: function() {
this._super();
cleverapps.bundleLoader.loadBundle("fireworks", {
onSuccess: function() {
this.process()
}
.bind(this)
})
},
onExit: function() {
this._super();
cleverapps.bundleLoader.deleteBundle("fireworks")
},
updateSize: function() {
var a = cleverapps.resolution.getSceneSize()
, b = (a.width - this.width) / 2
, c = (a.height - this.height) / 2;
this.setContentSize(a);
this.children.forEach(function(d) {
d.setPosition(d.x + b, d.y + c)
})
},
setupChildren: function() {
var a = cleverapps.resolution.getSceneSize();
this.setPositionRound(a.width / 2, a.height / 2)
},
process: function() {
if (this.started && this.ready && cleverapps.bundleLoader.isLoaded("fireworks")) {
var a;
"confetti" === this.type ? a = this.confettiAnimation() : "fireworks" === this.type && (a = this.fireworksAnimation());
this.count += 1;
a && (this.stopAllActions(),
this.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.CallFunc(this.process.bind(this)))))
}
},
confettiAnimation: function() {
var a = new cleverapps.Spine(this.json);
-1 === ["heroes", "tropical"].indexOf(cleverapps.config.ui) && cleverapps.UI.fitToBox(a, {
minScale: .6,
width: this.parent.width
});
a.setAnimation(0, "animation1", !1);
a.setCompleteListenerRemove();
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a);
cleverapps.audio.playSound(this.sound)
},
fireworksAnimation: function() {
var a = cleverapps.styles.Fireworks.fireworks
, b = cleverapps.Random.state;
cleverapps.Random.seed(this.state);
this.delays && this.delays.length || (this.delays = cleverapps.arrayFill(cleverapps.Random.random(5, 10), 0).map(function(g, h) {
return 0 === h ? Fireworks.DELAYS.intermission + cleverapps.Random.random(0, 2E3) : Fireworks.DELAYS.sequentBase + cleverapps.Random.random(0, Fireworks.DELAYS.sequentRandom)
}));
var c = this.delays.pop();
c *= cleverapps.Random.random(.8, 1.1, .1);
c /= 1E3;
var d = cc.rect(this.count % 2 ? (this.width + this.window.width) / 2 : 0, this.height / 2 - a.bottom, (this.width - this.window.width) / 2, a.bottom + a.top);
if (d.width < a.minWidth)
return c;
a = new cleverapps.Spine(this.json);
a.setCascadeColorEnabled(!0);
a.setColor(cleverapps.Random.choose(Fireworks.COLORS));
a.setAnimation(0, cleverapps.Random.choose(a.listAnimations()), !1);
a.setCompleteListenerRemove();
this.addChild(a);
d = cc.rectSubPadding(d, cc.padding(a.height / 2, a.width / 2));
var e = cleverapps.Random.choose([-1, 1])
, f = cleverapps.Random.random(d.x, d.x + d.width);
d = cleverapps.Random.random(d.y, d.y + d.height);
a.setScaleX(e);
a.setAnchorPoint(.5, .5);
a.setPositionRound(f, d);
this.state = cleverapps.Random.state;
cleverapps.Random.state = b;
cleverapps.audio.playSound(this.sound, {
throttle: 0
});
return c
}
});
Fireworks.DELAYS = {
sequentBase: 500,
sequentRandom: 1E3,
intermission: 12E3
};
Fireworks.COLORS = [cc.color(50, 245, 247, 255), cc.color(160, 255, 114, 255), cc.color(255, 255, 0, 255), cc.color(255, 54, 54, 255), cc.color(255, 164, 248, 255)];
cleverapps.styles.Fireworks = {
fireworks: {
top: 500,
bottom: 150,
minWidth: 400
}
};
var FingerView = cc.Node.extend({
ctor: function(a) {
a = a || {};
this._super();
this.setAnchorPoint(.5, .5);
this.finger = new cc.Sprite(a.image || bundles.finger.frames.tutorial_hand_png);
this.finger.setPositionRound(0, 0);
this.addChild(this.finger);
var b = cleverapps.styles.FingerView;
a = b[a.name] || b.default;
this.finger.setAnchorPoint(a.anchorX, a.anchorY);
cleverapps.gameModes.showFingerAnchor && this.showAnchorPoint();
this.setCascadeOpacityEnabledRecursively(!0);
this.scheduleUpdateWithPriority(2)
},
clear: function() {
delete this.actions;
delete this.options
},
updateSize: function() {
this.reset()
},
reset: function() {
this.finger.stopAllActions();
this.finger.setVisible(!1);
this.pressed = !1;
this.pathNode && this.pathNode.reset();
this.payload && (this.payload.stopAllActions(),
this.payload.setVisible(!1));
if (this.path)
for (var a = 0; a < this.path.length; ++a) {
var b = this.path[a];
b.unselect && b.unselect()
}
this.play(this.options)
},
update: function() {
var a = this.target;
if (a)
if (a.node.isRunning()) {
if (!this.skipLoop) {
var b = cleverapps.focusManager.checkEventNode(a.node) && a.node.isDisplayed();
this.setVisible(b)
}
a = this.parent.convertToNodeSpace(a.node.convertToWorldSpace(a.position));
this.setPosition(a.x + this.targetOffset.x, a.y + this.targetOffset.y)
} else
FingerView.remove(this)
},
rotateIfDoesNotFit: function(a) {
for (var b = a.node; b; b = b.parent)
if ("undefined" !== typeof Map2dInnerView && b instanceof Map2dInnerView)
return;
b = cleverapps.scenes.getRunningScene();
a = b.convertToNodeSpace(a.node.convertToWorldSpace(a.position));
a.x + this.finger.width > b.width && this.setScaleX(-Math.abs(this.scaleX));
a.y -= this.finger.height * this.finger.anchorY;
b = 0;
0 >= a.y && (b = -80);
this.finger.setRotation(b)
},
enablePath: function(a) {
this.pathNode = new cleverapps.Path(cc.color(a.r, a.g, a.b, FingerView.PATH_BASE_ALPHA));
this.pathNode.lineWidth = FingerView.PATH_LINE_WIDTH;
this.pathNode.setLocalZOrder(-2);
this.addChild(this.pathNode);
this.pathNode.runAction(new cc.RepeatForever(new cc.Sequence(new cc.DelayTime(.02),new cc.CallFunc(function() {
this.pathNode.draw(this.finger.getPosition())
}
.bind(this)))))
},
fadeIn: function() {
var a = cleverapps.styles.FingerView;
this.finger.setOpacity(0);
this.finger.setScale(1);
return new cc.Spawn(new cc.Show,new cc.MoveBy(0,0,a.offsetY),new cc.FadeIn(.3),new cc.MoveBy(.3,0,-a.offsetY))
},
fadeOut: function() {
var a = cleverapps.styles.FingerView;
return new cc.Sequence(new cc.Spawn(new cc.FadeOut(.3),new cc.MoveBy(.3,0,a.offsetY)),new cc.Hide)
},
press: function() {
return new cc.Sequence(new cc.Spawn(new cc.RotateBy(.2,FingerView.FINGER_CLICKED_ANGLE),new cc.ScaleTo(.2,.9)),new cc.CallFunc(function() {
this.pressed = !0;
this.pathNode && (this.pathNode.reset(),
this.pathNode.push(this.finger.getPosition()))
}
.bind(this)))
},
release: function() {
return new cc.Sequence(new cc.Spawn(new cc.RotateBy(.2,-FingerView.FINGER_CLICKED_ANGLE),new cc.ScaleTo(.2,1)),new cc.CallFunc(function() {
this.pressed = !1;
this.pathNode && this.pathNode.animateFadeOut(.4)
}
.bind(this)))
},
moveTo: function(a, b) {
"number" !== typeof a && (a = this.getMoveDuration(a, b));
return new cc.Sequence(new cc.CallFunc(function() {
var c = this.convertToNodeSpace(b.node.convertToWorldSpace(b.position));
0 === a && this.rotateIfDoesNotFit(b);
this.setTarget(b);
this.payload && this.payload.runAction(new cc.MoveTo(a,c));
this.finger.runAction(new cc.MoveTo(a,c))
}
.bind(this)),new cc.DelayTime(a),new cc.CallFunc(function() {
this.pathNode && this.pressed && this.pathNode.push(this.finger.getPosition())
}
.bind(this)))
},
prepareTarget: function(a) {
if (a.node && a.position)
return {
node: a.node,
position: a.position
};
if (a instanceof FingerView)
return {
node: this,
position: this.finger.getPosition()
};
if (a instanceof cc.Node)
return {
node: a,
position: cc.p(a.width / 2, a.height / 2)
};
if ("undefined" !== typeof BaseBlock && a instanceof BaseBlock)
return {
node: cleverapps.scenes.getRunningScene().keypadView,
position: BaseBlockView.alignInTheGrid(a.x, a.y),
select: function() {
a.highlight()
},
unselect: function() {
a.unhighlight()
}
};
if ("undefined" !== typeof DifferenceArea && a instanceof DifferenceArea)
return {
node: cleverapps.scenes.getRunningScene().photos.imageB,
position: PhotoViews.FrameSizeAndPos(a)
};
var b = "undefined" !== typeof Map2d && Map2d.currentMap && Map2d.currentMap.getMapView();
if (b)
return {
node: b.animations,
position: b.getUnitCenterPos(a.x, a.y)
};
if (b = Game.currentGame && Game.currentGame.battlefield && Game.currentGame.battlefield.onGetView())
return {
node: b,
position: a
};
if (b = Game.currentGame && Game.currentGame.field && Game.currentGame.field.onGetView())
return {
node: b,
position: Array.isArray(a) ? BaseCellView.alignInTheGrid(a[0], a[1]) : BaseCellView.alignInTheGrid(a.col, a.row)
};
if (b = Game.currentGame && Game.currentGame.grid && Game.currentGame.grid.getView())
return {
node: b,
position: GridView.cellToPosition(a)
};
if (cleverapps.config.debugMode)
throw "unknown finger target";
return a
},
setTarget: function(a) {
this.target = a;
this.targetOffset = cc.pSub(this.getPosition(), this.parent.convertToNodeSpace(a.node.convertToWorldSpace(a.position)))
},
zigzagTo: function(a) {
var b = this.finger.getPosition();
a instanceof cc.Node && (a = this.convertToNodeSpace(a.convertToWorldSpace(cc.p(a.width / 2, a.height / 2))));
var c = function(g, h, k) {
var m = cc.p((g.x + h.x) / 2, (g.y + h.y) / 2);
g = -1 / ((h.y - g.y) / (h.x - g.x));
return cc.p(m.x + Math.cos(Math.atan(g)) * k, m.y + Math.sin(Math.atan(g)) * k)
}
, d = .618 * Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2))
, e = .618 * -d
, f = cc.p((b.x + a.x) / 2, (b.y + a.y) / 2);
d = c(b, f, d);
c = c(f, a, e);
return new cc.Sequence((new cc.BezierTo(1.3,[b, d, f])).easing(cc.easeSineIn()),(new cc.BezierTo(.8,[f, c, a])).easing(cc.easeQuinticActionOut()))
},
relax: function(a) {
return (new cc.MoveBy(a,cc.p(80, -80))).easing(cc.easeBackOut())
},
dislodge: function(a, b) {
return (new cc.MoveBy(a,b)).easing(cc.easeBackOut(3))
},
circle: function() {
return new cc.CallFunc(function() {
if (this.visible) {
var a = new cc.Sprite(bundles.finger.frames.tutorial_click_png);
a.setPosition(this.finger.x, this.finger.y);
a.setScale(0);
a.setLocalZOrder(-1);
this.addChild(a);
a.runAction(new cc.Sequence(new cc.PlaySound(bundles.finger.urls.press_effect),new cc.DelayTime(.2),new cc.FadeOut(.3),new cc.RemoveSelf));
a.runAction(new cc.ScaleTo(.5,1))
}
}
.bind(this))
},
showPayload: function(a) {
var b = this.payload = a.payload;
b.replaceParentSamePlace(this, {
keepScale: !0
});
b.setVisible(!1);
b.setLocalZOrder(-1);
var c = b.getScale();
return new cc.TargetedAction(b,new cc.Sequence(new cc.ScaleTo(0,c),new cc.Show,new cc.ScaleTo(.2,a.payloadScale || 1.3 * c)))
},
hidePayload: function(a) {
return new cc.CallFunc(function() {
a.setVisible(!1)
}
)
},
calculateActions: function(a) {
return a.map(function(b) {
return "function" === typeof b ? b() : b
})
},
play: function(a) {
a = a || {};
if (this.actions = a.actions || this.actions) {
var b = this.calculateActions(this.actions);
(a.callback || a.runOnce) && b.push(new cc.CallFunc(function() {
a.keepShown || FingerView.remove(this);
a.callback && a.callback()
}
.bind(this)));
b = new cc.Sequence(b);
this.finger.stopAllActions();
this.finger.runAction(new cc.Sequence(new cc.DelayTime(a.delay || 0),b,new cc.CallFunc(function() {
if (!a.callback && !a.runOnce) {
var c = Object.assign({}, a);
c.delay = void 0 !== a.repeatDelay ? a.repeatDelay : .8;
this.play(c)
}
}
.bind(this))))
}
},
hintClick: function(a, b) {
this.options = b = b || {};
a = cleverapps.toArray(a).map(function(c) {
return this.prepareTarget(c)
}
.bind(this));
this.actions = [];
this.setTarget(a[0]);
b.loopFilter && this.actions.push(new cc.CallFunc(function() {
(this.skipLoop = !b.loopFilter()) && this.setVisible(!1)
}
.bind(this)));
a.forEach(function(c, d) {
this.actions.push(new cc.DelayTime(.2));
this.actions.push(this.moveTo.bind(this, 0, c));
this.actions.push(this.fadeIn());
for (c = 0; 2 > c; c++)
this.actions.push(new cc.DelayTime(.1)),
this.actions.push(this.press()),
this.actions.push(this.circle()),
this.actions.push(new cc.DelayTime(.1)),
this.actions.push(this.release());
this.actions.push(this.fadeOut());
d !== a.length - 1 && this.actions.push(new cc.DelayTime(1.4))
}
.bind(this));
this.play(b)
},
hintDrag: function(a, b) {
this.options = b = b || {};
a = this.path = a.map(function(e) {
return this.prepareTarget(e)
}, this);
this.actions = [];
var c = a[0];
this.setTarget(c);
this.actions.push(new cc.DelayTime(.2));
this.actions.push(this.moveTo.bind(this, 0, c));
this.actions.push(new cc.DelayTime(.1));
this.actions.push(this.fadeIn());
b.quick || (this.actions.push(this.press()),
this.actions.push(this.circle()));
c.select && this.actions.push(new cc.CallFunc(c.select));
b.quick || this.actions.push(new cc.DelayTime(.2));
b.payload && this.actions.push(this.showPayload(b));
for (var d = 1; d < a.length; ++d)
c = a[d],
this.actions.push(this.moveTo.bind(this, a[d - 1], c)),
c.select && this.actions.push(new cc.CallFunc(c.select));
b.quick || this.actions.push(this.release());
b.payload && this.actions.push(this.hidePayload(b.payload));
for (d = 0; d < a.length; ++d)
c = a[d],
c.unselect && this.actions.push(new cc.CallFunc(c.unselect));
this.actions.push(this.fadeOut());
this.play(b)
},
getMoveDuration: function(a, b, c) {
a = this.convertToNodeSpace(a.node.convertToWorldSpace(a.position));
b = this.convertToNodeSpace(b.node.convertToWorldSpace(b.position));
a = cc.pDistance(a, b) / (c || cleverapps.styles.FingerView.speed);
a = Math.pow(2, 3 * a);
return (a - 1) / (a + 1)
},
showAnchorPoint: function() {
var a = new cc.Sprite(bundles.wysiwyg.frames.pixel_png);
a.setColor(cc.color(0, 255, 0, 0));
a.setScale(15);
this.finger.addChild(a);
a.setPositionRound(this.finger.width * this.finger.anchorX * this.finger.scaleX, this.finger.height * this.finger.anchorY * this.finger.scaleY)
}
});
FingerView.isRunning = function(a) {
return a && FingerView.currentFinger === a
}
;
FingerView.remove = function(a, b) {
FingerView.isRunning(a) && (FingerView.currentFinger = void 0,
a.isRunning() && (a.clear(),
a.stopAllActions(),
a.finger.stopAllActions(),
b ? a.removeFromParent() : a.runAction(new cc.Sequence(new cc.FadeOut(.2),new cc.RemoveSelf))))
}
;
FingerView.create = function(a) {
a = a || {};
var b = new FingerView(a);
FingerView.remove(FingerView.currentFinger);
FingerView.currentFinger = b;
cleverapps.scenes.getRunningScene().addChild(b);
b.setRotation(a.rotation || 0);
"object" === typeof a.scale ? (b.setScaleX(a.scale.x || 1),
b.setScaleY(a.scale.y || 1)) : b.setScale(a.scale || 1);
b.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 1E4);
b._setGlobalZOrder(!0);
addCleaner(b, function() {
FingerView.remove(b)
});
return b
}
;
FingerView.hintClick = function(a, b) {
b = b || {};
var c = FingerView.create(b);
c.hintClick(a, b);
return c
}
;
FingerView.hintDrag = function(a, b) {
b = b || {};
var c = FingerView.create();
b.pathColor && c.enablePath(b.pathColor);
c.hintDrag(a, b);
return c
}
;
FingerView.PATH_BASE_ALPHA = 255;
FingerView.PATH_LINE_WIDTH = 15;
FingerView.FINGER_CLICKED_ANGLE = 7;
cleverapps.styles.FingerView = {
speed: 500,
offsetY: 5,
"default": {
anchorX: .12,
anchorY: .95
}
};
var Timeouts = function() {
"cocos2d" === engine ? this.__instanceId = classManager.getNewInstanceId() : cc.director.getScheduler().enableForTarget(this);
this.time = 0;
this.uid = 1;
this.listeners = Object.create(null);
cc.director.getScheduler().scheduleUpdate(this, cc.Scheduler.PRIORITY_SYSTEM, !1)
};
Timeouts.prototype.getTime = function() {
return this.time
}
;
Timeouts.prototype.update = function(a) {
a *= 1E3;
0 > a && (a = 0);
this.time += a;
for (var b in this.listeners) {
var c = this.listeners[b];
if (c) {
if (0 >= c.timeLeft) {
void 0 === c.interval ? delete this.listeners[b] : c.timeLeft = c.interval;
try {
c.callback()
} catch (d) {
cleverapps.throwAsync(d, d)
}
}
c.timeLeft -= a
} else
cleverapps.throwAsync("empty listener for timeout " + b),
delete this.listeners[b]
}
}
;
Timeouts.prototype.setTimeout = function(a, b, c) {
a = {
uid: this.uid,
callback: a,
timeLeft: b || 0
};
c && c.interval && (a.interval = b || 0);
this.listeners[this.uid] = a;
this.uid += 1;
return a
}
;
Timeouts.prototype.setInterval = function(a, b) {
return this.setTimeout(a, b, {
interval: !0
})
}
;
Timeouts.prototype.clearTimeout = function(a) {
a && a.uid && delete this.listeners[a.uid]
}
;
Timeouts.prototype.clearInterval = function(a) {
this.clearTimeout(a)
}
;
cleverapps.CountDownView = cc.Node.extend({
ctor: function(a, b) {
this.style = b || {};
this._super();
this.setAnchorPoint(.5, .5);
this.countDown = "number" === typeof a ? this.createStaticCountdown(a) : a;
if (this.style.bar)
var c = this.createBar();
else
this.style.background_content ? c = this.style.background_content : this.style.background && (c = cleverapps.UI.createScale9Sprite(this.style.background.frame, cleverapps.UI.Scale9Rect.TwoPixelXY),
c.setContentSize2(this.style.background.width || c.width, this.style.background.height || c.height));
c && (c.setCascadeOpacityEnabled(!0),
c.setCascadeColorEnabled(!0),
c.setAnchorPoint(.5, .5),
c.setPositionRound(0, 0),
this.addChild(c));
a = this.leftTimeText = new cc.Node;
a.setCascadeOpacityEnabled(!0);
a.setCascadeColorEnabled(!0);
a.setAnchorPoint(.5, .5);
this.addChild(a);
this.refresh();
b = this.style.timerPosition || {
x: 0,
y: 0
};
a.setPositionRound(b.x, b.y);
this.style.icon && (this.style.icon.json ? (b = new cleverapps.Spine(this.style.icon.json),
b.setAnimation(0, this.style.icon.animation, !0),
this.style.icon.stopped && b.clearTrack(0)) : b = new cc.Sprite(this.style.icon.frame || this.style.icon),
c ? (b.setPositionRound(-c.width * c.scaleX / 2, 0),
a.setPositionRound(a.x + b.width / 4 + cleverapps.styles.CountDownView.textOffsetX, a.y)) : (b.setPositionRound(-a.width * a.scaleX / 2, 0),
a.setPositionRound(a.x + b.width * (this.style.icon.offsetMultiplier || .65), a.y)),
this.icon = b,
this.addChild(b));
cleverapps.UI.wrap(this);
this.countDown.onSecond = this.createListener(this.refresh.bind(this))
},
createBar: function() {
var a = this.bar = new ScaledProgressBar({
type: this.style.bar.type
});
a.setLength(this.style.bar.width);
var b = this.countDown.getTimeLeft();
a.setGoal(this.style.bar.fullValue || b);
a.setPercentage(this.calcBarPercentage(b, a.to));
return a
},
calcBarPercentage: function(a, b) {
return this.style.bar.reversed ? b - a : a
},
createStaticCountdown: function(a) {
return {
onSecond: function() {},
onFinish: function() {},
getTimeLeft: function() {
return a
},
stop: function() {},
remove: function() {}
}
},
fitTo: function(a, b) {
this.fitToSize = {
width: a,
height: b
};
this.text && this.text.fitTo(a, b)
},
recreateText: function(a) {
this.text && this.text.removeFromParent(!0);
cleverapps.UI.ImageFont.IsApplicable(this.style.font, a) ? this.text = new cleverapps.UI.ImageFont(a,this.style.font,{
fixedNumberWidth: !0
}) : this.text = cleverapps.UI.generateOnlyText(a, this.style.font);
this.leftTimeText.width && this.leftTimeText.height || this.leftTimeText.setContentSize2(this.text.width * this.text.scaleX, this.text.height * this.text.scaleY);
this.text.setPositionRound(this.leftTimeText.width / 2, this.leftTimeText.height / 2);
this.leftTimeText.addChild(this.text)
},
setString: function(a) {
this.text ? cleverapps.UI.ImageFont.intertypeSetString({
textObj: this.text,
string: a,
font: this.style.font,
recreateFunc: this.recreateText.bind(this)
}) : this.recreateText(a)
},
updateBar: function() {
this.bar.setPercentage(this.calcBarPercentage(this.countDown.getTimeLeft(), this.bar.to), {
animated: this.bar.to < cleverapps.CountDownView.BAR_ANIMATION_LIMIT,
time: 1,
easing: !1
})
},
refresh: function() {
var a = cleverapps.intervalToString(this.countDown.getTimeLeft(), this.style.showHours);
this.setString(a);
this.text && this.fitToSize && this.text.fitTo(this.fitToSize.width, this.fitToSize.height);
this.bar && this.updateBar()
},
whatToDoOnStop: function() {
this.countDown.permanent ? this.countDown.onSecond = function() {}
: this.countDown.remove()
},
cleanup: function() {
this._super();
this.whatToDoOnStop()
}
});
cleverapps.CountDown = function(a, b) {
this.onSecond = function() {}
;
b = b || {};
this.onFinish = b.onFinish || function() {}
;
this.onTick = b.onTick || function() {}
;
this.permanent = b.permanent;
this.ignorePaused = b.ignorePaused;
if (0 >= a)
this.onFinish();
else
this.resetTimeLeft(a)
}
;
cleverapps.CountDown.prototype.remove = function() {
void 0 !== this.interval && cleverapps.CountDownManager.removeListener(this.interval);
this.interval = void 0;
this.onFinish = function() {}
;
this.onTick = function() {}
;
this.onSecond = function() {}
}
;
cleverapps.CountDown.prototype.stop = function() {
this.remove();
this.timeStop = Date.now()
}
;
cleverapps.CountDown.prototype.isRunning = function() {
return void 0 !== this.interval
}
;
cleverapps.CountDown.prototype.getTimeLeft = function() {
return this.timeFinish ? this.timeStop ? this.timeFinish - this.timeStop : Math.max(this.timeFinish - Date.now(), 0) : 0
}
;
cleverapps.CountDown.prototype.resetTimeLeft = function(a) {
this.timeStart = Date.now();
this.timeFinish = this.timeStart + a;
void 0 === this.interval && (this.interval = cleverapps.CountDownManager.addListener(this))
}
;
cleverapps.CountDown.prototype.nextSecond = function(a) {
a = this.timeFinish - a;
0 > a && (a = 0);
this.onTick(a);
this.onSecond(a);
0 === a && (cleverapps.CountDownManager.removeListener(this.interval),
this.interval = void 0,
this.onFinish())
}
;
cleverapps.Interval = function(a, b, c) {
c = c || {};
c.onTick = cleverapps.accumulate(b, a);
cleverapps.CountDown.call(this, cleverapps.parseInterval("120 months"), c)
}
;
cleverapps.Interval.prototype = Object.create(cleverapps.CountDown.prototype);
cleverapps.Interval.prototype.constructor = cleverapps.Interval;
cleverapps.LongTimeout = function(a, b, c) {
b <= cleverapps.LongTimeout.THRESHOLD ? (0 > b && (b = 0),
this.timeout = cleverapps.timeouts.setTimeout(a, b)) : (c = c || {},
c.onFinish = a,
cleverapps.CountDown.call(this, b, c))
}
;
cleverapps.LongTimeout.prototype = Object.create(cleverapps.CountDown.prototype);
cleverapps.LongTimeout.prototype.constructor = cleverapps.LongTimeout;
cleverapps.LongTimeout.prototype.remove = function() {
void 0 !== this.timeout ? cleverapps.timeouts.clearTimeout(this.timeout) : cleverapps.CountDown.prototype.remove.apply(this, arguments)
}
;
cleverapps.CountDownManager = {
listeners: {},
uid: 0,
interval: !1,
onTick: function() {
var a = Date.now(), b;
for (b in this.listeners) {
var c = this.listeners[b];
c && c.nextSecond(a)
}
},
addListener: function(a) {
var b = this.uid;
this.listeners[b] = a;
this.uid++;
!1 === this.interval && (this.interval = cleverapps.timeouts.setInterval(this.onTick.bind(this), cleverapps.CountDown.INTERVAL));
return b
},
removeListener: function(a) {
delete this.listeners[a]
}
};
cleverapps.CountDown.INTERVAL = 1E3;
cleverapps.LongTimeout.THRESHOLD = cleverapps.CountDown.INTERVAL;
cleverapps.CountDownView.BAR_ANIMATION_LIMIT = cleverapps.parseInterval("5 minutes");
cleverapps.styles.CountDownView = {
textOffsetX: -2
};
clearTimeout = cleverapps.extendFunc(clearTimeout, function(a) {
a instanceof cleverapps.CountDown ? a.remove() : this._super(a)
});
clearInterval = cleverapps.extendFunc(clearInterval, function(a) {
a instanceof cleverapps.CountDown ? a.remove() : this._super(a)
});
var UpMenuContainer = cc.Node.extend({
ctor: function() {
this._super();
this.setLocalZOrder(UpMenuContainer.ZORDER);
this.updateSize();
this.setupChildren()
},
addMenuBar: function() {
cleverapps.environment.isWysiwygScene() || cleverapps.environment.isAtlasAnalyzerScene() || cleverapps.environment.isComicsScene() || (this.menuBar = new MenuBarView,
this.addChild(this.menuBar))
},
addControlButtons: function() {
var a = new ControlButtonsView;
this.addChild(a);
this.controlButtons = new HidingNode(a,cleverapps.UI.VERTICAL);
cleverapps.focusManager.registerControl("ControlButtonsView", this.controlButtons);
this.updateSize();
this.setupChildren()
},
isOutsideMenu: function() {
return -1 !== ["heroes", "riddles"].indexOf(cleverapps.config.name) && cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && cleverapps.environment.isGameScene() && Game.currentGame && !Game.currentGame.hasDanger()
},
updateControlButtonsPosition: function() {
var a = cleverapps.styles.UpMenuContainer.controlButtons;
this.isOutsideMenu() ? (this.controlButtons.parent !== this.parent && this.controlButtons.replaceParent(this.parent),
this.controlButtons.setScale(a.outsideMenu.scale),
this.controlButtons.setPositionRound(a.outsideMenu)) : (this.controlButtons.parent !== this && this.controlButtons.replaceParent(this),
this.controlButtons.setScale(1),
this.controlButtons.setPositionRound(a))
},
updateSize: function() {
var a = [this.controlButtons, this.menuBar].filter(Boolean)
, b = cleverapps.styles.UpMenuContainer
, c = b.scale[cleverapps.resolution.mode]
, d = cleverapps.resolution.getSceneSize().width;
d -= 2 * b.padding.x;
if (this.menuBar) {
var e = d;
if (this.controlButtons) {
var f = this.controlButtons.width + b.margin;
e -= f
}
this.menuBar.reshape(e / c, d / c / 2);
this.menuBar.width * c > e && (c = d / (this.menuBar.width + f))
}
this.setScale(c);
for (e = b = 0; e < a.length; e++)
b = Math.max(b, a[e].height);
this.setContentSize(d / c, b / c)
},
setupChildren: function() {
var a = cleverapps.styles.UpMenuContainer
, b = {
x: {
align: "left",
dx: a.padding.x
},
y: {
align: "top",
dy: -a.padding.y
}
};
if (this.parent) {
var c = this.calculatePositionRound(b);
if (isNaN(c.x) || isNaN(c.y))
cleverapps.throwAsync("NaN alignment position " + JSON.stringify({
alignment: b,
position: c,
size: this.getContentSize(),
parentSize: this.parent && this.parent.getContentSize()
})),
b = cc.p(0, 0)
}
this.setPositionRound(b);
this.menuBar && this.menuBar.setPositionRound(a.menuBar);
this.controlButtons && this.updateControlButtonsPosition()
}
});
UpMenuContainer.ZORDER = BaseWindow.WINDOWS_ZORDER + 1;
cleverapps.styles.UpMenuContainer = {
scale: [.8, .8, 1],
margin: 14,
padding: {
x: 20,
y: 10
},
menuBar: {
x: {
align: "left"
},
y: {
align: "center"
}
},
controlButtons: {
x: {
align: "right"
},
y: {
align: "center",
dy: -5
},
outsideMenu: {
x: {
align: "left",
dx: 10
},
y: {
align: "bottom",
dy: 10
},
scale: .8
}
}
};
var ExitControlButton = {
onClicked: function() {
cleverapps.config.demoMode ? window.location.search = "" : cleverapps.scenes.getRunningScene().closeAction()
},
isAvailableInEpisode: function() {
return cleverapps.environment.isMainScene() ? connector.platform.oneOf(connector.SP_MOBAGE, connector.MOBAGE) ? !1 : cleverapps.administrator && AdministratorScene.IsAvailable() : "battlefield" === cleverapps.config.type && Game.currentGame && Game.currentGame.mode === Epicart.MODE_BATTLE ? !1 : cleverapps.environment.hasScene([cleverapps.Environment.SCENE_ATLAS_ANALYZER]) || cleverapps.config.adminMode ? !0 : cleverapps.environment.hasScene([cleverapps.Environment.SCENE_CHAT]) || cleverapps.environment.isGameScene() && -1 !== ["riddles", "heroes", "zenmatch"].indexOf(cleverapps.config.name) ? !1 : levels && levels.user && levels.user.checkAvailable("merge" === cleverapps.config.type ? {
level: 1
} : {
level: .07
})
}
};
var MenuControlButton = {
onClicked: function() {
cleverapps.focusManager.display({
focus: "SettingsWindowFromMenu",
action: function(a) {
new SettingsWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
},
isAvailableInEpisode: function() {
return "battlefield" === cleverapps.config.type && Game.currentGame && Game.currentGame.mode === Epicart.MODE_BATTLE || cleverapps.environment.hasScene([cleverapps.Environment.SCENE_EDITOR, cleverapps.Environment.SCENE_CHAT, cleverapps.Environment.SCENE_MINE]) ? !1 : !0
},
onUpdateAttention: function() {},
updateAttention: function() {
this.onUpdateAttention(cleverapps.chat.hasUnread && ("merge" === cleverapps.config.type || !Game.currentGame))
}
};
var PauseControlButton = {
onClicked: function() {
Game.currentGame.pause();
new PauseWindow
},
isAvailableInEpisode: function() {
return "battlefield" === cleverapps.config.type && Game.currentGame && Game.currentGame.mode === Epicart.MODE_BATTLE
}
};
var SwitchAdminButton = {
onClicked: function() {
var a = cleverapps.scenes.getRunningScene()instanceof AdministratorScene ? AdminLocationsScene : AdministratorScene;
cleverapps.focusManager.display({
focus: "SwitchAdminButton",
action: function(b) {
a.open(b)
}
})
},
isAvailableInEpisode: function() {
var a = cleverapps.scenes.getRunningScene();
return cleverapps.administrator && cleverapps.administrator.adminLocations && cleverapps.oneOf(a, AdminLocationsScene, AdministratorScene)
}
};
var ControlButton = cleverapps.UI.Button.extend({
ctor: function(a) {
a = a || {};
this._super({
type: cleverapps.styles.ControlButton[a.type],
onClicked: a.logic.onClicked.bind(this),
content: new cc.Sprite(a.icon)
});
SceneDecors.add(this, cleverapps.skins.getSlot("controlButton", {
target: this
}));
a.logic.updateAttention && (a.logic.onUpdateAttention = this.createListener(this.setAttention.bind(this)),
a.logic.updateAttention())
}
});
cleverapps.styles.ControlButton = {
"default": {
button_png: bundles.controlbuttons.frames.control_button_png,
button_on_png: bundles.controlbuttons.frames.control_button_on_png,
mark: {
x: {
align: "right",
dx: 5
},
y: {
align: "top",
dy: -5
}
}
},
alternate: {
button_png: bundles.controlbuttons.frames.back_button_png,
button_on_png: bundles.controlbuttons.frames.back_button_on_png,
mark: {
x: {
align: "right",
dx: 5
},
y: {
align: "top",
dy: -5
}
}
}
};
var ControlButtonsView = cleverapps.Layout.extend({
ctor: function() {
var a = cleverapps.styles.ControlButtonsView;
this.buttons = ControlButtonsView.controlButtons.filter(function(b) {
return b.logic.isAvailableInEpisode()
}).map(function(b) {
return new ControlButton(b)
});
this._super(this.buttons, {
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
}
});
ControlButtonsView.controlButtons = [{
type: "default",
logic: SwitchAdminButton,
icon: bundles.controlbuttons.frames.switch_icon_png
}, {
type: "alternate",
logic: ExitControlButton,
icon: bundles.controlbuttons.frames.back_icon_png
}, {
type: "default",
logic: MenuControlButton,
icon: bundles.controlbuttons.frames.menu_icon_png
}, {
type: "default",
logic: PauseControlButton,
icon: bundles.controlbuttons.frames.pause_png
}];
cleverapps.styles.ControlButtonsView = {
margin: 16
};
var MenuBar = function() {
this.items = MenuBar.listItems().map(function(a) {
var b = a.modelClass;
return a.modelClass ? new b(a) : new MenuBarItem(a)
})
};
MenuBar.listItems = function() {
if (cleverapps.config.demoMode)
return [];
var a = [];
"undefined" !== typeof GameLevelMenuBarItem && a.push(GameLevelMenuBarItem);
-1 === ["klondike"].indexOf(cleverapps.config.type) && a.push(GoldMenuBarItem);
"undefined" !== typeof LivesMenuBarItem && a.push(LivesMenuBarItem);
cleverapps.config.soft && a.push(SoftMenuBarItem);
"undefined" !== typeof WandsMenuBarItem && a.push(WandsMenuBarItem);
"undefined" !== typeof WorkersMenuBarItem && a.push(WorkersMenuBarItem);
"undefined" !== typeof MethaStarsMenuBarItem && a.push(MethaStarsMenuBarItem);
"undefined" !== typeof ExpMenuBarItem && a.push(ExpMenuBarItem);
"undefined" !== typeof CryptexMenuBarItem && a.push(CryptexMenuBarItem);
return a
}
;
MenuBar.prototype.getSceneItems = function() {
if (cleverapps.environment.isEditorScene())
return [];
var a = [];
this.items.forEach(function(b) {
b.isAvailableOnScene() ? (b.init(),
a.push(b)) : b.clean()
});
return a
}
;
MenuBar.prototype.stopItems = function() {
this.items.forEach(function(a) {
a.stop()
})
}
;
MenuBar.prototype.showForce = function(a) {
var b, c = this.items.find(function(d) {
return d.name === a
});
cleverapps.focusManager.display({
focus: a + "MenuBarItemForce",
control: "MenuBar" + a,
actions: [function(d) {
b = !0;
cleverapps.timeouts.setTimeout(d, 500)
}
, function(d) {
c.onShowForce(c.config.force);
cleverapps.forces.onceForceClosed = d
}
]
});
return b
}
;
MenuBar.prototype.clean = function() {
this.items.forEach(function(a) {
a.clean()
})
}
;
var MenuBarItem = function(a) {
this.config = a;
this.timerShowHours = !1;
this.onRemove = function() {}
;
this.onChangeText = function() {}
;
this.onShowForce = function() {}
;
this.onUpdateSticker = function() {}
;
this.onAttentionOnListener = function() {}
;
this.onAttentionOffListener = function() {}
;
this.onFingerOnListener = function() {}
;
this.onFingerOffListener = function() {}
;
this.onUpdateClickable = function() {}
;
this.onUpdatePlusButton = function() {}
};
MenuBarItem.prototype.isAvailableOnScene = function() {
var a = this.config.availableOnScenes;
"function" === typeof a && (a = a());
return cleverapps.environment.hasScene(a || [])
}
;
MenuBarItem.prototype.init = function() {
this.stopped = !1;
Object.assign(this, this.config);
this.plusButton = this.withPlusButton();
this.canActionNow = function() {
return this.config.force && cleverapps.forces.isRunningForce(this.config.force) ? !0 : !cleverapps.focusManager.isFocused()
}
.bind(this);
this.action = function() {
if (!this.config.filter || this.config.filter()) {
var a = this.config.force && cleverapps.forces.isRunningForce(this.config.force);
a && cleverapps.forces.closeRunningForce();
if (this.onAction)
this.onAction();
cleverapps.focusManager.display({
focus: "MenuBar" + this.getName() + "Window",
control: this.getControlName(),
action: function(b) {
var c = this.config.onClickWindow
, d = "function" === typeof this.config.onClickOptions ? this.config.onClickOptions() : this.config.onClickOptions;
d = d || {};
a && this.config.force.productKey && (d.force = this.config.force);
new c(d);
cleverapps.focusManager.onceNoWindowsListener = b
}
.bind(this)
})
}
}
.bind(this);
this.config.updater && (this.config.updater.call(this, this.changeText.bind(this)),
this.updater = void 0);
this.config.attentionUpdater && this.config.attentionUpdater.call(this, this.updateAttention.bind(this));
this.config.clickableUpdater && this.config.clickableUpdater.call(this, function() {
this.updateClickable();
this.updatePlusButton()
}
.bind(this));
this.updateClickable();
this.updateAttention();
this.customInit()
}
;
MenuBarItem.prototype.updateClickable = function() {
var a = this.action && (!this.config.isClickable || this.config.isClickable());
a !== this.clickable && (this.clickable = a,
this.onUpdateClickable())
}
;
MenuBarItem.prototype.changeText = function() {
this.onChangeText()
}
;
MenuBarItem.prototype.updateAttention = function() {
if (!this.stopped && this.config.attention) {
var a = this.config.attention();
if (this.attention !== a)
if (this.attention = a)
this.onAttentionOnListener();
else
this.onAttentionOffListener()
}
}
;
MenuBarItem.prototype.updatePlusButton = function() {
var a = this.withPlusButton();
a !== this.plusButton && (this.plusButton = a,
this.onUpdatePlusButton())
}
;
MenuBarItem.prototype.withPlusButton = function() {
return this.config.plusButton && (!this.config.isClickable || this.config.isClickable())
}
;
MenuBarItem.prototype.customInit = function() {}
;
MenuBarItem.prototype.getName = function() {
return this.config.name
}
;
MenuBarItem.prototype.getTargetTypes = function() {
return this.config.targets
}
;
MenuBarItem.prototype.getControlName = function() {
return "MenuBar" + this.getName()
}
;
MenuBarItem.prototype.getCurrentValue = function() {
return {
amount: this.config.value && this.config.value() || 0
}
}
;
MenuBarItem.prototype.getViewClass = function() {
return this.config.viewClass || MenuBarItemView
}
;
MenuBarItem.prototype.getTimerString = function() {
return cleverapps.intervalToString(this.timer.getTimeLeft(), this.timerShowHours)
}
;
MenuBarItem.prototype.calcTimerTTF = function() {
var a = this.timer && this.timer.getTimeLeft() || 0;
return a >= MenuBarItem.ONE_DAY - 1E3 || !this.timerShowHours && a > MenuBarItem.ONE_HOUR - 1E3
}
;
MenuBarItem.prototype.timerRefresh = function() {
if (this.timerTTF !== this.calcTimerTTF())
this.updateTimer();
else if (this.onRefreshTimer)
this.onRefreshTimer()
}
;
MenuBarItem.prototype.updateTimer = function() {
var a = this.timer;
this.stopTimer();
if (this.onChangeTimer)
this.onChangeTimer(!!this.timer === !!a);
if (this.onRefreshTimer)
this.onRefreshTimer()
}
;
MenuBarItem.prototype.stop = function() {
this.stopped = !0;
this.stopTimer()
}
;
MenuBarItem.prototype.clean = function() {
this.stop();
runCleaners(this)
}
;
MenuBarItem.prototype.stopTimer = function() {
this.timer && (this.timer.stop(),
this.timer = !1)
}
;
MenuBarItem.prototype.setTimer = function(a) {
this.timer = a;
this.timer.onSecond = this.timerRefresh.bind(this);
this.timerTTF = this.calcTimerTTF()
}
;
MenuBarItem.prototype.getSticker = function() {
return this.config.sticker && this.config.sticker()
}
;
MenuBarItem.prototype.setFinger = function(a) {
a = !!a;
if (this.finger !== a)
if (this.finger = a)
this.onFingerOnListener();
else
this.onFingerOffListener()
}
;
MenuBarItem.ONE_HOUR = cleverapps.parseInterval("1 hour");
MenuBarItem.ONE_DAY = cleverapps.parseInterval("1 day");
var MenuBarItemView = cc.Node.extend({
avoidNode: "MenuBarItemView",
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.styles = cleverapps.styles.MenuBarItem;
this.item = a;
this.centerAlign = this.item.centerAlign;
this.reset(!0);
this.item.onRemove = this.createListener(this.remove.bind(this));
this.item.onChangeText = this.createListener(this.onChangeText.bind(this));
this.item.onShowForce = this.createListener(this.showForce.bind(this));
this.item.onAttentionOnListener = this.createListener(this.turnOnAttention.bind(this));
this.item.onAttentionOffListener = this.createListener(this.turnOffAttention.bind(this));
this.item.onSetAnimationAndHide = this.createListener(this.setAnimationAndHide.bind(this));
this.item.onUpdatePlusButton = this.createListener(this.updatePlusButton.bind(this));
this.item.onUpdateLotteryIcon = this.createListener(this.updateLotteryIcon.bind(this));
this.item.onUpdateSticker = this.createListener(this.updateSticker.bind(this));
this.item.onFingerOnListener = this.createListener(this.turnOnFinger.bind(this));
this.item.onFingerOffListener = this.createListener(this.turnOffFinger.bind(this));
this.item.onUpdateClickable = this.createListener(this.updateClickable.bind(this));
(a = this.item.getTargetTypes()) && cleverapps.aims.registerTarget(a, this.getIcon(), {
controls: this.item.getControlName(),
animate: function(b) {
this.text && this.onChangeText(.15 * Math.ceil(b / 1.5));
this.animateIcon(b)
}
.bind(this)
});
this.item.tooltip && cleverapps.tooltipManager.create(this, {
text: this.item.tooltip,
location: cleverapps.UI.Tooltip.LOCATION_BELOW,
control: this.item.getControlName() + "Tooltip"
})
},
getIcon: function() {
return this.icon
},
updatePlusButton: function() {
!!this.item.plusButton !== !!this.plusButton && (this.item.plusButton ? this.addPlusButton() : (this.plusButton.removeFromParent(),
delete this.plusButton))
},
updateLotteryIcon: function() {
!!this.item.lottery !== !!this.lotteryIcon && (this.item.lottery ? -1 !== ["board", "differences"].indexOf(cleverapps.config.type) && cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && cleverapps.environment.isGameScene() || Lottery.addIcon(this, LotteryIcon.POSITION_MENU) : (this.lotteryIcon.removeFromParent(),
delete this.lotteryIcon))
},
updateFallSaleIcon: function() {
"GoldItem" === this.item.getName() && (cleverapps.fallSale.isAvailable() && !this.fallSaleIcon && (this.fallSaleIcon = new FallSaleIcon(FallSaleIcon.POSITION_MENUBAR),
this.addChild(this.fallSaleIcon)),
!cleverapps.fallSale.isAvailable() && this.fallSaleIcon && (this.fallSaleIcon.removeFromParent(),
delete this.fallSaleIcon))
},
setAnimationAndHide: function(a) {
this.icon instanceof cleverapps.Spine && this.icon.setAnimation(0, a, !1);
this.runAction(new cc.Sequence(new cc.DelayTime(.8),new cc.CallFunc(function() {
cleverapps.focusManager.hideControlsWhileFocused(this.item.getControlName())
}
.bind(this))))
},
reset: function() {
this.turnOffAttention();
this.removeAllChildren();
this.addBg();
this.addIcon();
this.bg.setPositionRound(this.bg.width / 2 + this.iconRealWidth / 2, this.styles.bg.height / 2);
this.setContentSize2(this.bg.width + this.iconRealWidth / 2, this.bg.height);
this.updatePlusButton();
this.addHelpButton();
this.addText();
this.updateClickable();
SceneDecors.add(this.bg, cleverapps.skins.getSlot("menuBarItem", {
name: this.item.getName()
}));
this.updateLotteryIcon();
this.updateFallSaleIcon();
this.item.attention && this.turnOnAttention();
this.updateSticker(!0)
},
remove: function() {
cleverapps.focusManager.removeControl(this.item.getControlName());
this.runAction(new cc.Sequence(new cc.ScaleTo(.3,0),new cc.RemoveSelf))
},
showForce: function(a) {
cleverapps.forces.create(this, a, {
importantNodes: [this]
})
},
onChangeText: function(a) {
(a = this.text.updateValue(a)) && this.isVisible() && this.runAction(AnimationsLibrary.animateDelta(a, {
target: this,
x: this.bg.width / 2 + this.iconRealWidth / 2,
y: this.styles.deltaAnimation.dy,
font: cleverapps.styles.FONTS.MENUBAR_TEXT_DELTA || cleverapps.styles.FONTS.MENUBAR_TEXT
}))
},
animateIcon: function(a) {
if (this.icon) {
this.icon.stopAllActions();
this.icon.setScale(this.icon.baseScale);
for (var b = 0; b < Math.ceil(a / 1.5); b++)
this.icon.runAction(new cc.Sequence(new cc.DelayTime(.15 * b),new cc.Sequence((new cc.ScaleTo(.075,.9 * this.icon.baseScale)).easing(cc.easeIn(1)),(new cc.ScaleTo(.075,this.icon.baseScale)).easing(cc.easeOut(1)))))
}
this.item.sparks && this.icon && (b = new cleverapps.Spine(bundles.menubar.jsons.sparks_json),
b.setSkin("yellow"),
b.setAnimation(0, 1 < a ? "multiple" : "single", !1),
b.setCompleteListenerRemove(),
this.addChild(b, 0),
b.setPositionRound(this.icon.getPositionX() + this.styles.sparks.x, this.icon.getPositionY() + this.styles.sparks.y))
},
addIcon: function() {
this.item.animation ? (this.icon = new cleverapps.Spine(this.item.animation),
this.icon.setAnimation(0, "idle", !0)) : this.icon = new cc.Sprite("function" === typeof this.item.icon ? this.item.icon() : this.item.icon);
this.icon.baseScale = this.icon.getScale();
this.iconRealWidth = this.styles.icon.fullInsideBg ? 0 : this.icon.getBoundingBox().width;
this.addChild(this.icon);
this.icon.setLocalZOrder(1);
this.icon.setPositionRound({
x: this.iconRealWidth / 2 + this.styles.icon.x,
y: this.styles.bg.height / 2 + this.styles.icon.y
})
},
addBg: function() {
this.bg = cleverapps.UI.createScale9Sprite(bundles.menubar.frames.menubar_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
this.bg.setContentSize2(this.styles.bg.width, this.styles.bg.height);
this.addChild(this.bg)
},
getTextWidth: function() {
var a = 0;
this.item.helpButton && (a = this.styles.helpButton.width);
return this.width - this.iconRealWidth - this.styles.icon.x - this.styles.bg.padding.right - a
},
getTextPosition: function() {
var a = this.styles.bg.padding.bottom;
return cc.p(this.iconRealWidth + this.styles.icon.x + this.getTextWidth() / 2, this.height / 2 + a)
},
addText: function() {
this.text && this.text.parent && this.text.removeFromParent();
var a = new MenuBarTextView(this.item);
this.addChild(a);
this.text = a;
this.text.updateValue();
this.text.fitTo(this.getTextWidth());
a.setPositionRound(this.getTextPosition())
},
updateClickable: function() {
this.item.clickable ? (this.clickHandler = cleverapps.UI.onClick(this, this.onPressed.bind(this), {
filter: this.item.canActionNow
}),
this.hoverHandler = cleverapps.UI.applyHover(this, {
filter: this.item.canActionNow
})) : this.clickHandler && (this.clickHandler.remove(),
delete this.clickHandler,
this.hoverHandler.remove(),
delete this.hoverHandler)
},
onPressed: function() {
this.item.action()
},
addPlusButton: function() {
var a = this.plusButton = new cleverapps.UI.Button({
type: {
button_png: bundles.menubar.frames.plus_button_png,
button_on_png: bundles.menubar.frames.plus_button_on_png
},
onClicked: this.item.action,
filter: this.item.canActionNow
});
this.addChild(a);
a.setLocalZOrder(1);
cleverapps.focusManager.registerControl(this.item.getControlName() + ".Plus", this.plusButton.createListener(function(c, d) {
this.plusButton && (this.plusButton.stopAllActions(),
c = c ? 1 : 0,
d ? this.plusButton.setScale(c) : this.plusButton.runAction(new cc.ScaleTo(.2,c)))
}
.bind(this)));
cleverapps.focusManager.isControlEnabled(this.item.getControlName() + ".Plus") && cleverapps.focusManager.showControlsWhileFocused(this.item.getControlName() + ".Plus", !0);
var b = cc.p(this.icon.x + this.iconRealWidth / 2, 0);
b.x += this.styles.plusButton.offset.x;
b.y += this.styles.plusButton.offset.y;
a.setPositionRound(b)
},
addHelpButton: function() {
if (this.item.helpButton) {
var a = this.helpButton = new cleverapps.UI.Button({
type: {
button_png: bundles.buttons.frames.help_button_png,
button_on_png: bundles.buttons.frames.help_button_on_png
},
onClicked: this.item.action,
filter: this.item.canActionNow
});
this.addChild(a);
cleverapps.focusManager.registerControl(this.item.getControlName() + ".HelpButton", this.createListener(function(b) {
a.stopAllActions();
b ? a.runAction(new cc.ScaleTo(.2,1)) : a.runAction(new cc.ScaleTo(.2,0))
}));
a.setPositionRound(this.styles.helpButton)
}
},
turnOnAttention: function() {
if (!this.attention) {
var a = cleverapps.styles.MenuBarItem.attention
, b = this.attention = new Attention;
b.setPositionRound(a);
this.addChild(b)
}
},
turnOffAttention: function() {
this.attention && (this.attention.removeFromParent(),
delete this.attention)
},
updateSticker: function(a) {
var b = this.item.getSticker();
if (!this.sticker === !b)
this.sticker && (this.sticker.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.4 * this.sticker.scale),new cc.ScaleTo(.2,this.sticker.scale))),
this.text.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.4 * this.text.baseScale),new cc.ScaleTo(.2,this.text.baseScale))));
else
switch (this.sticker && (a ? this.sticker.removeFromParent() : this.sticker.runAction(new cc.Sequence(new cc.FadeOut(.6),new cc.RemoveSelf)),
this.sticker = void 0),
b) {
case "premium":
this.showPremiumSticker(a)
}
},
showPremiumSticker: function(a) {
var b = cleverapps.styles.MenuBarItem.premiumSticker
, c = this.sticker = new cc.Sprite(bundles.menubar.frames.premium_sticker);
c.setAnchorPoint(.5, .5);
c.setPositionRound(b);
this.addChild(c);
var d = cleverapps.UI.generateOnlyText("WorkersMenuBarItem.subscription", cleverapps.styles.FONTS.MENUBAR_TIMER_TEXT);
d.setAnchorPoint(.5, .5);
d.setPositionRound(b.text);
d.fitTo(b.text.width);
d.setRotation(b.text.rotation);
c.addChild(d);
c.setCascadeOpacityEnabled(!0);
a || (c.setOpacity(0),
c.runAction(new cc.FadeIn(.6)))
},
turnOnFinger: function() {
this.finger = FingerView.hintClick(this, {
delay: 1.6
})
},
turnOffFinger: function() {
FingerView.remove(this.finger);
this.finger = void 0
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
MENUBAR_TEXT: {
name: "default",
size: 40
}
});
cleverapps.styles.MenuBarItem = {
noPlusDx: 14,
bg: {
width: 200,
minWidth: 170,
padding: {
right: 20,
bottom: 0
}
},
deltaAnimation: {
dy: -40
},
icon: {
fullInsideBg: !1,
x: -10,
y: 0
},
sparks: {
x: -3,
y: 5
},
plusButton: {
offset: {
x: 0,
y: 0
}
},
attention: {
x: {
align: "right",
dx: 0
},
y: {
align: "bottom",
dy: -17
}
},
premiumSticker: {
x: {
align: "center",
dx: 45
},
y: {
align: "center",
dy: 58
},
text: {
x: {
align: "center",
dx: -21
},
y: {
align: "center",
dy: 8
},
width: 140,
rotation: -7
}
},
helpButton: {
width: 50,
x: {
align: "right",
dx: 5
},
y: {
align: "center"
}
}
};
var MenuBarTextView = cc.Node.extend({
ctor: function(a, b) {
this.options = b || {};
this._super();
this.item = a;
this.baseScale = 1;
this.lastValue = a.getCurrentValue();
this.withTotal = void 0 !== this.lastValue.total;
this.amountText = cleverapps.UI.generateImageText("", cleverapps.styles.FONTS.MENUBAR_TEXT);
this.withTotal ? (this.totalText = cleverapps.UI.generateImageText("", cleverapps.styles.FONTS.MENUBAR_TEXT),
this.totalLayout = this.createTotalLayout(),
this.addChild(this.totalLayout)) : this.addChild(this.amountText);
this.setString(this.getString())
},
createTotalLayout: function() {
var a = cleverapps.UI.generateImageText(" / ", cleverapps.styles.FONTS.MENUBAR_TEXT);
return new cleverapps.Layout([this.amountText, a, this.totalText],{
direction: cleverapps.UI.HORIZONTAL
})
},
setString: function(a) {
a = String(a);
this.updateTotalIcon();
if (!this.item.totalIcon) {
if (this.withTotal) {
var b = a.split("/");
a = +b[0].trim();
b = +b[1].trim();
this.updateAmountText(a, b);
this.updateTotalText(b);
this.totalLayout.reshape();
this.totalLayout.setPositionRound(this.width / 2, this.height / 2)
} else
this.updateAmountText(a),
this.amountText.setPositionRound(this.width / 2, this.height / 2);
this._applyFitTo()
}
},
updateTotalIcon: function() {
var a = cleverapps.styles.MenuBarTextView
, b = !!this.item.totalIcon;
b ? this.totalIcon || (this.totalIcon = new cc.Sprite(this.item.totalIcon),
this.totalIcon.setPositionRound(a.totalIcon),
this.addChild(this.totalIcon)) : this.totalIcon && (this.totalIcon.removeFromParent(),
delete this.totalIcon);
this.withTotal ? this.totalLayout.visible = !b : this.amountText.visible = !b
},
updateAmountText: function(a, b) {
this.amountText.setString(a);
this.withTotal && !cleverapps.styles.MenuBarTextView.noColoredText && (a >= b ? this.amountText.setColor(cleverapps.styles.COLORS.GREEN) : a < .1 * b ? this.amountText.setColor(cleverapps.styles.COLORS.COLOR_RED) : this.amountText.setColor(this.amountText.font.color || cleverapps.styles.COLORS.WHITE))
},
updateTotalText: function(a) {
this.totalText.setString(a);
this.item.highlightTotal && this.item.highlightTotal() ? this.totalText.setColor(cleverapps.styles.COLORS.COLOR_BONUS) : this.totalText.setColor(this.amountText.font.color || cleverapps.styles.COLORS.WHITE)
},
valueToString: function(a) {
return this.withTotal ? a.amount + " / " + a.total : "" + a.amount
},
getString: function() {
return this.valueToString(this.lastValue)
},
animateAmountChange: function(a, b) {
this.changeTextAction && !this.changeTextAction.isDone() && this.stopAction(this.changeTextAction);
this.item.deltaSound && cleverapps.audio.playSound(this.item.deltaSound);
b = 0 > a - this.lastValue.amount ? .3 : b;
this.changeTextAction = this.runAction(new cc.Spawn(AnimationsLibrary.countTo(this, a, {
duration: b
}),AnimationsLibrary.pulse(this, {
duration: b
})))
},
updateValue: function(a) {
var b = this.item.getCurrentValue()
, c = b.amount - this.lastValue.amount
, d = void 0 !== this.lastValue.total && this.lastValue.total !== b.total
, e = b.time - (void 0 === this.lastValue.time ? Date.now() : this.lastValue.time);
e && (e = 0 < e ? "+" + Product.FormatTimePeriod(e).title : Product.FormatTimePeriod(e).title);
e = e || c;
c && !d ? this.animateAmountChange(b.amount, a) : this.setString(this.valueToString(b));
this.lastValue = b;
return e
},
_applyFitTo: function() {
this.maxWidth && (this.withTotal ? this.totalLayout.scale = Math.min(this.maxWidth / this.totalLayout.width, 1) : this.amountText.fitTo(this.maxWidth))
},
fitTo: function(a) {
this.maxWidth = a;
this._applyFitTo()
}
});
cleverapps.styles.MenuBarTextView = {
totalIcon: {
x: {
align: "center",
dx: -15
},
y: {
align: "center"
}
}
};
var MenuBarWithTimeoutView = MenuBarItemView.extend({
ctor: function(a) {
this._super(a);
this.item.onChangeTimer = this.createListener(this.onChangeTimer.bind(this));
this.item.onRefreshTimer = this.createListener(this.onRefreshTimer.bind(this))
},
onChangeTimer: function(a) {
this.timer && (this.timer instanceof cleverapps.UI.ImageFont && this.item.timerTTF && this.removeTimer(a),
this.timer instanceof cleverapps.UI.ImageFont || this.item.timerTTF || this.removeTimer(a));
this.item.timer ? this.createTimer(a) : this.removeTimer(a)
},
reset: function(a) {
this._super(a);
this.timerBlock = void 0;
this.onChangeTimer(!0)
},
createTimer: function(a) {
if (!this.timerBlock && !connector.platform.oneOf(connector.PLIEGA)) {
this.timerBlock = cleverapps.UI.createScale9Sprite(bundles.menubar.frames.bar_timer_png);
this.timerBlock.setCascadeOpacityEnabled(!0);
this.timerBlock.setContentSize2(this.bg.width - 2 * this.styles.timer.padding.x, this.styles.timer.height);
this.timerBlock.setPositionRound(this.styles.timer.position);
this.addChild(this.timerBlock, -1);
if (this.styles.timer.icon) {
var b = new cc.Sprite(bundles.timer.frames.timer_png);
b.setPositionRound(this.styles.timer.icon);
this.timerBlock.addChild(b)
}
this.timer = this.item.timerTTF ? cleverapps.UI.generateOnlyText("", cleverapps.styles.FONTS.MENUBAR_TIMER_TEXT) : cleverapps.UI.generateImageText("", cleverapps.styles.FONTS.MENUBAR_TIMER_TEXT, {
fixedNumberWidth: !0
});
this.timer.baseScale = 1;
this.timerBlock.addChild(this.timer);
if (a)
this.onRefreshTimer();
else
this.timerBlock.setOpacity(0),
this.timerBlock.runAction(new cc.Sequence(new cc.FadeIn(.3),new cc.CallFunc(this.onRefreshTimer.bind(this))))
}
},
removeTimer: function(a) {
this.timerBlock && (a ? this.timerBlock.removeFromParent() : this.timerBlock.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.RemoveSelf)),
this.timerBlock = void 0)
},
onRefreshTimer: function() {
this.timerBlock && this.item.getTimerString() !== this.timer.getString() && (this.timer.setString(this.item.getTimerString()),
this.timer.setFont(cleverapps.styles.FONTS.MENUBAR_TIMER_TEXT),
this.timer.setScale(this.timer.baseScale),
this.timer.fitTo(cleverapps.styles.MenuBarItem.timer.text.width),
this.timer.setPositionRound(this.styles.timer.text))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
MENUBAR_TIMER_TEXT: {
name: "default",
size: 32,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.overrideStyles(cleverapps.styles.MenuBarItem, {
timer: {
icon: {
x: {
align: "left",
dx: 31
},
y: {
align: "center",
dy: 1
}
},
text: {
x: {
align: "left",
dx: 68
},
y: {
align: "center",
dy: 0
},
width: 125
},
position: {
x: {
align: "center",
dx: 16
},
y: {
align: "bottom",
dy: -49
}
},
padding: {
x: 40
},
height: 59
}
});
var MenuBarView = cc.Node.extend({
ctor: function() {
this._super();
var a = cleverapps.styles.MenuBar
, b = cleverapps.menuBar.getSceneItems().filter(function(c) {
return "CoinsItem" === c.name && cleverapps.gameModes.hideMenuBarCoinsItem ? !1 : !0
}).map(function(c) {
return new (c.getViewClass())(c)
});
a = this.layout = new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
});
a.setAnchorPoint(0, 0);
this.addChild(a);
this.views = b.map(function(c) {
var d = new HidingNode(c,cleverapps.UI.VERTICAL)
, e = c.item.hiddenByDefault;
"GoldItem" === c.item.name && cleverapps.gameModes.showMenuBarGoldItem && (e = void 0);
cleverapps.focusManager.registerControl(c.item.getControlName(), d, e);
return d
});
this.updateSize();
this.updateContentSize()
},
updateSize: function() {
connector.info.isMobile && this.layout.setScale(cleverapps.styles.MenuBar.mobileScale[cleverapps.resolution.mode])
},
reshape: function(a, b) {
var c = this.layout
, d = this.views[1];
a /= c.scale;
b /= c.scale;
c.setOptions({
margin: cleverapps.styles.MenuBar.margin
});
c.width < a && d && d.target && d.target.centerAlign && d.x < b && b + d.width / 2 <= a && (d.setPosition(b, d.y),
c.width = d.x + d.width / 2);
this.updateContentSize()
},
updateContentSize: function() {
this.setContentSize2(this.layout.width * this.layout.scale, this.layout.height * this.layout.scale)
}
});
cleverapps.styles.MenuBar = {
mobileScale: [.75, .9, .9],
margin: 0
};
var Attention = cc.Sprite.extend({
ctor: function() {
this._super(bundles.attention.frames.attention_png);
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(2)
},
pulse: function() {
void 0 === this.baseScale && (this.baseScale = this.scale);
this.runAction(new cc.RepeatForever(new cc.Sequence((new cc.ScaleTo(.2,1.3 * this.baseScale)).easing(cc.easeOut(2)),(new cc.ScaleTo(.15,this.baseScale)).easing(cc.easeIn(2)),(new cc.ScaleTo(.2,1.2 * this.baseScale)).easing(cc.easeOut(2)),(new cc.ScaleTo(.15,this.baseScale)).easing(cc.easeIn(2)),new cc.DelayTime(3))))
},
jump: function() {
void 0 === this.baseScale && (this.baseScale = this.scale);
this.runAction(new cc.Repeat(new cc.Sequence((new cc.ScaleTo(.4,1.15 * this.baseScale)).easing(cc.easeOut(2)),(new cc.ScaleTo(.3,this.baseScale)).easing(cc.easeIn(2))),3))
}
});
cleverapps.UI.ImageFont = cc.Node.extend({
ctor: function(a, b, c) {
this._super();
this.params = c || {};
this.letters = new cc.Node;
this.letters.setAnchorPoint(0, 0);
this.letters.setCascadeOpacityEnabled(!0);
this.letters.setCascadeColorEnabled(!0);
this.addChild(this.letters);
this.setFont(b);
this.setAnchorPoint(.5, .5);
this.setCascadeOpacityEnabled(!0);
this.setString(a);
this.setCascadeColorEnabled(!0)
},
setHorizontalAlignment: function() {},
setVerticalAlignment: function() {},
setDimensions: function() {},
fitTo: function(a, b) {
for (var c = 0; 10 > c; ) {
var d = this.width
, e = this.height
, f = this.canAttachLastLine();
if (a && d > a || b && e > b || f) {
c++;
var g = f = 1;
a && d > a && (f = a / d);
b && e > b && (g = b / e);
d = .9;
e = Math.min(f, g);
.9 < e && 1 > e && (d = e);
this.setFontSize(Math.floor(this.getFontSize() * d))
} else
break;
if (this.getFontSize() < cleverapps.UI.ImageFont.getFontSizeThreshold()) {
this.setFontSize(cleverapps.UI.ImageFont.getFontSizeThreshold());
break
}
}
},
countToAnimation: function(a, b) {
this.runAction(AnimationsLibrary.countTo(this, b, {
duration: a
}))
},
canAttachLastLine: function() {
return !1
},
setFont: function(a) {
var b = a.name ? a.name : "default"
, c = cleverapps.config.fonts.filter(function(d) {
return d.name === b
}).sort(function(d, e) {
return Math.abs(1 - a.size / d.size) - Math.abs(1 - a.size / e.size)
})[0];
if (void 0 === c)
throw console.log(a),
"No image font";
this.font = a;
this.baseFont = c;
this.bundle = c.bundle;
this.prefix = c.name + c.originalSize + "pt_";
this.strokeSize = a.stroke ? a.stroke.size : 0;
this.shadowOffset = a.shadow ? cc.size(a.shadow.direction.width || a.shadow.direction.x || 0, a.shadow.direction.height || a.shadow.direction.y || 0) : cc.size(0, 0);
this.setColor(a.color || cleverapps.styles.COLORS.WHITE);
this.setFontSize(a.size);
(c = this.getString()) && this.setString(c)
},
setString: function(a) {
if (!this.stopListeners) {
this.string = "" + a;
this.letters.getChildrenCount() !== a.length && this.letters.removeAllChildren(!0);
var b = function(f) {
return void 0 !== f && 48 <= f.charCodeAt(0) && 57 >= f.charCodeAt(0)
}
, c = cleverapps.styles.UI.ImageFont
, d = void 0
, e = cc.size(0, 0);
this.string.split("").forEach(function(f, g, h) {
if (b(f)) {
if (void 0 === d)
if ("." === h[g - 1])
d = g - 1;
else
for (var k = g; k < h.length && b(h[k]); ++k)
d = k + 1
} else
d = void 0;
void 0 !== d && 0 === (d > g ? d - g : g - d - 1) % 3 && b(h[g - 1]) && (e.width += c.thousandsOffset * this.baseFont.size / c.thousandsFontSize);
this.createLetter(f, e, g)
}, this);
this.letters.setContentSize2(e);
this.setFontSize(this.getFontSize())
}
},
createLetter: function(a, b, c) {
var d = cleverapps.styles.UI.ImageFont.lettersOffset;
0 === c && (d = 0);
cleverapps.UI.ImageFont.LETTERS_MAP[a] && (a = cleverapps.UI.ImageFont.LETTERS_MAP[a]);
var e = bundles[this.bundle].frames[this.prefix + a];
e || (console.log(this),
console.log("No image for letter: ", a),
cleverapps.throwAsync("No image for letter: " + a + ", bundle - " + this.bundle + ", prefix - " + this.prefix));
this.letters.getChildrenCount() <= c ? (c = new cc.Sprite(e),
this.letters.addChild(c)) : (c = this.letters.getChildren()[c],
c.setSpriteFrame(e));
e = 2 * Math.round(c.width / 2);
this.params.fixedNumberWidth && "0" <= a && "9" >= a && (this.baseFont.zeroLetterWidth || (a = (new cc.Sprite(bundles[this.bundle].frames[this.prefix + "0"])).width,
this.baseFont.zeroLetterWidth = 2 * Math.round(a / 2)),
e = this.baseFont.zeroLetterWidth);
c.setAnchorPoint(.5, 0);
c.setPositionRound(b.width + e / 2 + d, 0);
b.width += e + d;
b.height = Math.max(b.height, c.height)
},
getString: function() {
return this.string
},
getFontSize: function() {
return Math.floor(this.letters.scale * this.baseFont.size)
},
setFontSize: function(a) {
var b = this.properties = cc.LabelTTF.__getFontProperties(cleverapps.UI.getFontName(this.font.font), a);
this.letters.setScale(a / this.baseFont.size);
this.letters.setPosition(0, b.descent - Math.ceil(a * cleverapps.styles.UI.ImageFont.SKIP_RESOLUTION.DESCENTS[this.baseFont.folder]) + this.strokeSize + Math.abs(this.shadowOffset.height));
this.setContentSize2(this.letters.width * this.letters.scale, b.ascent + b.descent + 2 * this.strokeSize + 2 * Math.abs(this.shadowOffset.height))
}
});
cleverapps.UI.ImageFont.MAX_MAGNITUDE = 1.25;
cleverapps.UI.ImageFont.LETTERS_MAP = {
"/": "slash",
"+": "plus",
"-": "minus",
":": "colon",
"#": "sharp",
".": "point",
" ": "space",
"[": "left_square_bracket",
"]": "right_square_bracket",
"*": "asterisk",
"%": "percent"
};
cleverapps.UI.ImageFont.getFontSizeThreshold = function() {
var a = 8;
connector.info.isMobile || (a = 5);
return a * resolutionScale
}
;
cleverapps.UI.ImageFont.IsApplicable = function(a, b) {
if (!b)
return !0;
a = a.name ? a.name : "default";
for (var c, d, e = 0; e < cleverapps.config.fonts.length; e++) {
var f = cleverapps.config.fonts[e];
f.name === a && cleverapps.bundleLoader.isLoaded(f.bundle) && (c = f.bundle,
d = f.name + f.originalSize + "pt_")
}
if (!c)
return !1;
for (e = 0; e < b.length; e++)
if (!bundles[c].frames[d + (cleverapps.UI.ImageFont.LETTERS_MAP[b[e]] || b[e])])
return !1;
return !0
}
;
cleverapps.UI.ImageFont.intertypeSetString = function(a) {
var b = a.textObj instanceof cleverapps.UI.ImageFont
, c = cleverapps.UI.ImageFont.IsApplicable(a.font, a.string);
b === c ? a.textObj.setString(a.string) : a.recreateFunc(a.string)
}
;
cleverapps.styles.UI.ImageFont = {
SKIP_RESOLUTION: {
DESCENTS: {
"fonts/marvin-round": .1,
"fonts/marvin-round-nostroke": .1,
"fonts/formal": 0,
"fonts/custom/custom_digits": .15,
"fonts/bryndanwrite": .1,
"fonts/bryndanwrite-nostroke": .1,
"fonts/custom/heroes_custom_digits": 0,
"fonts/combo_digits": 0
}
},
lettersOffset: -4,
thousandsOffset: 6,
thousandsFontSize: 41
};
var ScaledProgressBar = cc.Node.extend({
ctor: function(a) {
this._super();
this.options = a = Object.assign({}, a.type, a);
this.progressFrames = a.progressFrames;
this.layout = a.layout || ScaledProgressBar.HORIZONTAL;
this.from = a.from || 0;
this.to = a.to || 100;
this.sizeDirty = !0;
a.background && (this.background = cleverapps.UI.createScale9Sprite(a.background),
connector.platform.oneOf(connector.WECHAT) && (this.background._creationStack = Error().stack),
this.background.setAnchorPoint(0, 0),
this.addChild(this.background),
this.applyCapInsets(this.background));
this.progress = cleverapps.UI.createScale9Sprite(a.progress);
connector.platform.oneOf(connector.WECHAT) && (this.progress._creationStack = Error().stack);
this.progress.setAnchorPoint(0, 0);
this.addChild(this.progress);
this.applyCapInsets(this.progress);
var b = a.background ? cc.size(this.background.width, this.background.height) : cc.size(this.progress.width, this.progress.height);
this.setContentSize2(b.width, b.height);
this.setAnchorPoint(.5, .5);
a.barText && this.createText(a.barText);
this.onChange()
},
createText: function(a) {
a.font = a.font || cleverapps.styles.FONTS.SMALL_WHITE_TEXT;
a.text = a.text || "%from%/%to%";
this.barText = new TextWithIcon("",a);
this.addChild(this.barText)
},
applyCapInsets: function(a) {
this.layout === ScaledProgressBar.HORIZONTAL ? a.setCapInsets(cc.rect(a.width / 2 - 1, a.height / 3, 2, a.height / 3)) : a.setCapInsets(cc.rect(a.width / 3, a.height / 2 - 1, a.width / 3, 2))
},
onChange: function(a) {
this.background && this.sizeDirty && this.background.setContentSize2(this.width, this.height);
this.options.onChange && this.options.onChange.call(this, a);
this.barText && this.sizeDirty && this.updateBarTextPosition();
this.barText && this.barText.setString(this.options.barText.text.replace("%from%", Math.round(this.from)).replace("%to%", Math.round(this.to)));
this.updateProgressFrame();
a = cc.size(this.width, this.height);
var b = this.options.minSize || cc.size(this.progress.getSpriteFrame().getOriginalSize());
this.layout === ScaledProgressBar.HORIZONTAL ? a.width = 0 < this.from ? Math.max(b.width, a.width * this.getPercentage() / 100) : 0 : a.height = 0 < this.from ? Math.max(b.height, a.height * this.getPercentage() / 100) : 0;
this.progress.setContentSize(a.width, a.height);
this.sizeDirty = !1
},
getPercentage: function() {
return 100 * this.from / this.to
},
updateProgressFrame: function() {
if (this.progressFrames) {
var a, b;
for (b in this.progressFrames)
this.getPercentage() >= b && (a = this.progressFrames[b]);
a && this.currentFrame !== a && (this.currentFrame = a,
this.progress.setSpriteFrame(a))
}
},
setLength: function(a, b) {
this.layout === ScaledProgressBar.VERTICAL ? this.setContentSize2(this.width, a) : this.setContentSize2(a, this.height);
this.sizeDirty = !0;
this.onChange(b)
},
setLayout: function(a) {
this.layout = a;
this.onChange()
},
stopChangeAction: function() {
this.changeAction && !this.changeAction.isDone() && (this.stopAction(this.changeAction),
delete this.changeAction)
},
_animatedChange: function(a, b) {
if (a !== this.from) {
a = Math.max(Math.min(a, this.to), 0);
var c = a - this.from;
b = b || {};
this.stopChangeAction();
this.updateProgressFrame();
var d = new ScaledProgressBarProgressTo(void 0 !== b.time ? b.time : .8,a);
!1 !== b.easing && d.easing(b.easing || cc.easeCubicActionOut());
b.callback && (d = new cc.Sequence(d,new cc.CallFunc(b.callback)));
this.changeAction = this.runAction(d);
b.delta && this.runAction(AnimationsLibrary.animateDelta(c, {
target: this.getParent(),
x: this.width * a / this.to,
y: this.height,
font: cleverapps.styles.FONTS.MENUBAR_TEXT_DELTA || cleverapps.styles.FONTS.MENUBAR_TEXT
}))
}
},
setGoal: function(a, b) {
this.to = a;
this.onChange(b)
},
getGoal: function() {
return this.to
},
setPercentage: function(a, b) {
b = b || {};
this.stopChangeAction();
a = Math.max(Math.min(a, this.to), 0);
this.from !== a && (b.animated ? this._animatedChange(a, b) : (this.from = a,
this.onChange(!0),
b.callback && b.callback()))
},
updateBarTextPosition: function() {
this.barText.setPositionRound(this.width / 2 + (this.options.barText.dx || 0), this.height / 2 + (this.options.barText.dy || 0))
},
updateBarText: function(a) {
this.options.barText.text = a;
this.barText.setString(a);
this.onChange()
},
getDelimiter: function() {
var a, b;
for (b in this.options.delimiters)
this.getPercentage() >= b && (a = this.options.delimiters[b]);
if (a)
return cleverapps.UI.createSprite(a)
}
})
, ScaledProgressBarProgressTo = cc.ProgressTo.extend({
update: function(a) {
if (!(this.target instanceof ScaledProgressBar))
throw console.log(this.target, a),
"Usage exception: ScaledProgressBarProgressTo should be used with ScaledProgressBar only.";
this.target.from = this._to < this._from ? Math.max(Math.min(this._from + (this._to - this._from) * a, this._from), this._to) : Math.max(Math.min(this._from + (this._to - this._from) * a, this._to), this._from);
this.target.onChange()
},
startWithTarget: function(a) {
cc.ActionInterval.prototype.startWithTarget.call(this, a);
this._from = a.from
}
});
ScaledProgressBar.HORIZONTAL = 0;
ScaledProgressBar.VERTICAL = 1;
ScaledProgressBar.Types = cleverapps.overrideTemplates({}, {
blue: {
progress: bundles.progress_bar.frames.bar_blue,
background: bundles.progress_bar.frames.bg_dark
},
blue_with_frames: {
progress: bundles.progress_bar.frames.bar_blue,
background: bundles.progress_bar.frames.bg_dark,
progressFrames: {
0: bundles.progress_bar.frames.bar_red,
30: bundles.progress_bar.frames.bar_orange,
70: bundles.progress_bar.frames.bar_blue
},
delimiters: {
0: bundles.progress_bar.frames.delimiter_red,
30: bundles.progress_bar.frames.delimiter_orange,
70: bundles.progress_bar.frames.delimiter_blue
}
},
blue_small: {
progress: bundles.progress_bar.frames.bar_blue_small,
background: bundles.progress_bar.frames.bg_dark_small
},
blue_small_with_frames: {
progress: bundles.progress_bar.frames.bar_blue_small,
background: bundles.progress_bar.frames.bg_dark_small,
progressFrames: {
0: bundles.progress_bar.frames.bar_red_small,
30: bundles.progress_bar.frames.bar_orange_small,
70: bundles.progress_bar.frames.bar_blue_small
}
},
blue_large_with_frames: {
progress: bundles.progress_bar.frames.bar_blue_large,
background: bundles.progress_bar.frames.bg_dark_large,
progressFrames: {
0: bundles.progress_bar.frames.bar_red_large,
30: bundles.progress_bar.frames.bar_orange_large,
70: bundles.progress_bar.frames.bar_blue_large
}
},
green: {
progress: bundles.progress_bar.frames.bar_green,
background: bundles.progress_bar.frames.bg_green
},
green_large: {
progress: bundles.progress_bar.frames.bar_green_large,
background: bundles.progress_bar.frames.bg_green_large
},
red: {
progress: bundles.progress_bar.frames.bar_red,
background: bundles.progress_bar.frames.bg_dark
},
red_small: {
progress: bundles.progress_bar.frames.bar_red_small,
background: bundles.progress_bar.frames.bg_dark_small
},
blue_large_round: {
progress: bundles.progress_bar.frames.bar_blue_large_round,
background: bundles.progress_bar.frames.bg_green_large
}
});
cleverapps.Chest = function(a) {
this.locked = !1;
this.changeLockedListener = function() {}
;
this.storage = a.storage;
this.serverTaskName = a.serverTaskName;
a.isNewUser ? (this.initializeForNewUser(),
this.save()) : this.load()
}
;
cleverapps.Chest.prototype.fromJSON = function(a) {
this.locked = a
}
;
cleverapps.Chest.prototype.toJSON = function() {
return this.locked
}
;
cleverapps.Chest.prototype.load = function() {
var a = cleverapps.dataLoader.load(this.storage);
void 0 === a ? (this.initializeForNewUser(),
this.save()) : this.fromJSON(a)
}
;
cleverapps.Chest.prototype.save = function(a) {
cleverapps.dataLoader.save(this.storage, this.toJSON());
this.serverTaskName && !1 !== a && cleverapps.synchronizer.addUpdateTask(this.serverTaskName)
}
;
cleverapps.Chest.prototype.initializeForNewUser = function() {
this.locked = !1
}
;
cleverapps.Chest.prototype.unlock = function() {
this.locked = !1;
this.changeLockedListener()
}
;
cleverapps.Chest.prototype.open = function() {
this.locked = !0;
this.changeLockedListener()
}
;
var SideBar = function() {
this.icons = [];
this.availableIcons = this.loadAvailable();
this.savePositions();
this.clearListeners()
};
SideBar.prototype.loadAvailable = function() {
var a = [];
"merge" === cleverapps.config.type ? ("undefined" !== typeof QuestsGroupIcon && a.push(QuestsGroupIcon),
"undefined" !== typeof ExitExpeditionIcon && a.push(ExitExpeditionIcon),
"undefined" !== typeof WarehouseIcon && a.push(WarehouseIcon),
"undefined" !== typeof ClansCupIcon && a.push(ClansCupIcon),
a.push(InviteIcon),
"undefined" !== typeof LandmarkDonorIcon && a.push(LandmarkDonorIcon),
"undefined" !== typeof PawBoxIcon && a.push(PawBoxIcon),
"undefined" !== typeof UnitTradeIcon && a.push(UnitTradeIcon)) : ("undefined" !== typeof DailyLevelIcon && a.push(DailyLevelIcon),
"undefined" !== typeof StarChestIcon && a.push(StarChestIcon),
"undefined" !== typeof HeroesIcon && a.push(HeroesIcon),
a.push(DailyCupIcon),
a.push(InviteIcon));
return a.map(function(b) {
return new b
})
}
;
SideBar.prototype.savePositions = function() {
this.availableIcons.forEach(function(a, b) {
a.availableIndex = b
})
}
;
SideBar.PRIORITY_NORMAL = 1;
SideBar.PRIORITY_REDUNDANT = 0;
SideBar.prototype.clearListeners = function() {
this.onAddIcon = function() {}
;
this.onMoveIcon = function() {}
;
this.onRemoveIcon = function(b) {}
;
this.onForceIcon = function(b) {}
;
for (var a = 0; a < this.icons.length; a++)
this.icons[a].clearListeners()
}
;
SideBar.prototype.getDefaultIconByClassName = function(a) {
for (var b = 0; b < this.availableIcons.length; b++)
if (this.availableIcons[b]instanceof a)
return this.availableIcons[b]
}
;
SideBar.prototype.getIconByClassName = function(a) {
for (var b = 0; b < this.icons.length; b++)
if (this.icons[b]instanceof a)
return this.icons[b]
}
;
SideBar.prototype.resetByClassName = function(a) {
(a = this.getDefaultIconByClassName(a)) && this.resetIcon(a)
}
;
SideBar.prototype.resetIcon = function(a) {
a.resetState();
a.available && -1 === this.icons.indexOf(a) && this.addIcon(a);
a.available || -1 === this.icons.indexOf(a) || this.removeIcon(a)
}
;
SideBar.prototype.resetOnFreeFocus = function() {
for (var a = [], b = 0; b < this.availableIcons.length; b++)
this.availableIcons[b].resetOnFreeFocus && a.push(this.availableIcons[b]);
a.forEach(this.resetIcon.bind(this))
}
;
SideBar.prototype.refreshAllIcons = function() {
var a = this.availableIcons;
a.forEach(function(b) {
b.resetState()
});
a.forEach(function(b) {
b.available || -1 === this.icons.indexOf(b) || this.removeIcon(b)
}, this);
a.forEach(function(b) {
if (b.available && -1 === this.icons.indexOf(b))
for (var c = 0; c < b.countOfSlots(); c++)
this.addIcon(0 === c ? b : new FakeSideBarIcon(b))
}, this)
}
;
SideBar.prototype.anyIconWithForceIndex = function() {
for (var a = 0; a < this.icons.length; a++) {
var b = this.icons[a];
if (!b.locked && a < SideBar.SLOTS.length && (b = b.getForce()) && !cleverapps.forces.isShown(b.id))
return a
}
}
;
SideBar.prototype.showAnyForce = function() {
var a = this.anyIconWithForceIndex();
void 0 === a || cleverapps.gameModes.noSidebar || cleverapps.focusManager.display({
focus: "sidebarIconForce",
control: this.icons[a].name,
actions: [function(b) {
cleverapps.timeouts.setTimeout(b, 1100)
}
, function(b) {
a = this.anyIconWithForceIndex();
void 0 === a ? b() : (this.onForceIcon(a),
cleverapps.forces.onceForceClosed = b)
}
.bind(this)]
})
}
;
SideBar.prototype.addTemporaryIcon = function(a) {
this.availableIcons.push(a);
for (var b = this.availableIcons.length - 2; 0 <= b && a.priority > this.availableIcons[b].priority; b--)
this.availableIcons[b + 1] = this.availableIcons[b],
this.availableIcons[b] = a;
this.savePositions();
a.available && this.addIcon(a)
}
;
SideBar.prototype.removeTemporaryIcon = function(a) {
var b = this.availableIcons.indexOf(a);
-1 !== b && (this.availableIcons.splice(b, 1),
this.savePositions());
this.removeIcon(a)
}
;
SideBar.prototype.addIcon = function(a) {
for (var b = this.icons.length, c = this.icons.length - 1; 0 <= c && !(this.icons[c].availableIndex < a.availableIndex); c--)
b--;
for (c = this.icons.length - 1; c >= b; c--)
this.icons[c + 1] = this.icons[c],
this.onMoveIcon(c + 1, c);
this.icons[b] = a;
this.onAddIcon(b)
}
;
SideBar.prototype.findMissionIcon = function(a) {
for (var b = 0; b < this.availableIcons.length; b++) {
var c = this.availableIcons[b];
if (c instanceof MissionIcon && c.mission.type === a)
return c
}
}
;
SideBar.prototype.findExpeditionIcon = function(a) {
for (var b = 0; b < this.availableIcons.length; b++) {
var c = this.availableIcons[b];
if (c instanceof ExpeditionIcon && c.pageId === a)
return c
}
}
;
SideBar.prototype.findOfferIcon = function(a) {
for (var b = 0; b < this.availableIcons.length; b++) {
var c = this.availableIcons[b];
if (c instanceof OfferIcon && c.offer.type === a)
return c
}
}
;
SideBar.prototype.findIconByClassName = function(a) {
for (var b = 0; b < this.availableIcons.length; b++) {
var c = this.availableIcons[b];
if (c instanceof a)
return c
}
}
;
SideBar.prototype.getTeaserIcon = function() {
return this.availableIcons.filter(function(a) {
return a instanceof TeaserIcon
})[0]
}
;
SideBar.prototype.removeIcon = function(a) {
var b = this.icons.indexOf(a);
if (-1 !== b) {
for (this.onRemoveIcon(b); b < this.icons.length - 1; b++)
this.icons[b] = this.icons[b + 1],
this.onMoveIcon(b, b + 1);
this.icons.pop();
this.icons.filter(function(c) {
return c instanceof FakeSideBarIcon && c.parentIcon === a
}).forEach(function(c) {
this.removeIcon(c)
}
.bind(this))
}
}
;
SideBar.LEFT_COLUMN = 0;
SideBar.RIGHT_COLUMN = 1;
SideBar.SLOTS = [{
row: 0,
col: SideBar.LEFT_COLUMN
}, {
row: 1,
col: SideBar.LEFT_COLUMN
}, {
row: 2,
col: SideBar.LEFT_COLUMN
}, {
row: 0,
col: SideBar.RIGHT_COLUMN
}, {
row: 1,
col: SideBar.RIGHT_COLUMN
}, {
row: 2,
col: SideBar.RIGHT_COLUMN
}, {
row: 3,
col: SideBar.LEFT_COLUMN
}, {
row: 3,
col: SideBar.RIGHT_COLUMN
}, {
row: 4,
col: SideBar.LEFT_COLUMN
}, {
row: 4,
col: SideBar.RIGHT_COLUMN
}];
SideBar.ICONS = [];
var SideBarIcon = function(a) {
this.available = !1;
this.animation = void 0;
this.attention = this.lottery = this.disabled = this.locked = !1;
this.leftTime = this.titleIcon = this.title = void 0;
this.fallSale = !1;
this.priority = SideBar.PRIORITY_NORMAL;
Object.assign(this, a);
this.clearListeners()
};
SideBarIcon.prototype.clearListeners = function() {
this.onShowIconListener = function() {}
;
this.onUnlockListener = function() {}
;
this.onEnableListener = function() {}
;
this.onDisableListener = function() {}
;
this.onAddLotteryListener = function() {}
;
this.onRemoveLotteryListener = function() {}
;
this.onAttentionOnListener = function() {}
;
this.onAttentionOffListener = function() {}
;
this.onFingerOnListener = function() {}
;
this.onFingerOffListener = function() {}
;
this.onChangeTitleListener = function() {}
;
this.onStartTimerListener = function() {}
;
this.onRemoveTimerListener = function() {}
}
;
SideBarIcon.prototype.getTargetTypes = function() {
return this.targets
}
;
SideBarIcon.prototype.getAnimation = function() {
return "function" === typeof this.animation ? this.animation() : this.animation
}
;
SideBarIcon.prototype.setAnimation = function(a, b) {
this.animation !== a && (this.animation = a,
this.skin = b,
this.onShowIconListener())
}
;
SideBarIcon.prototype.setIcon = function(a) {
this.icon !== a && (this.icon = a,
this.onShowIconListener())
}
;
SideBarIcon.prototype.setDisabled = function(a) {
a = !!a;
if (this.disabled !== a)
if (this.disabled = a)
this.onDisableListener();
else
this.onEnableListener()
}
;
SideBarIcon.prototype.setLocked = function(a) {
a = !!a;
if (this.locked !== a && (this.locked = a,
!this.locked))
this.onUnlockListener()
}
;
SideBarIcon.prototype.setLottery = function(a) {
a = !!a;
if (this.lottery !== a)
if (this.lottery = a)
this.onAddLotteryListener();
else
this.onRemoveLotteryListener()
}
;
SideBarIcon.prototype.setAttention = function(a) {
a = !!a;
if (this.attention !== a)
if (this.attention = a)
this.onAttentionOnListener();
else
this.onAttentionOffListener()
}
;
SideBarIcon.prototype.setFinger = function(a) {
a = !!a;
if (this.finger !== a)
if (this.finger = a)
this.onFingerOnListener();
else
this.onFingerOffListener()
}
;
SideBarIcon.prototype.setTitle = function(a) {
this.title !== a && (this.title = a,
this.onChangeTitleListener())
}
;
SideBarIcon.prototype.setLeftTime = function(a) {
this.leftTime !== a && (this.leftTime = a);
if (0 < this.leftTime)
this.onStartTimerListener();
else
this.onRemoveTimerListener()
}
;
SideBarIcon.prototype.resetState = function() {}
;
SideBarIcon.prototype.getLockedTipData = function() {}
;
SideBarIcon.prototype.onPressed = function() {}
;
SideBarIcon.prototype.getForce = function() {}
;
SideBarIcon.prototype.removeFromSideBar = function() {
cleverapps.sideBar.removeIcon(this)
}
;
SideBarIcon.prototype.getTitle = function() {
return this.locked ? this.locked.lockedEvent ? Messages.get("Soon") : Messages.get("IconLocked.TextDefault", {
levelNo: cleverapps.humanReadableNumber({
floatLevel: this.locked.level
})
}) : this.title
}
;
SideBarIcon.prototype.getToolTip = function() {
if (this.locked)
return {
text: Messages.get("IconLocked.TipDefault", {
level: this.getLockedTipData()
})
}
}
;
SideBarIcon.prototype.getView = function() {
return SideBarIconView
}
;
SideBarIcon.prototype.countOfSlots = function() {
return 1
}
;
var SideBarIconView = cc.Node.extend({
ctor: function(a) {
this.model = a;
this._super();
this.setAnchorPoint(.5, .5);
this.show();
a.onShowIconListener = this.createListener(this.showIcon.bind(this));
a.onUnlockListener = this.createListener(this.unlock.bind(this));
a.onEnableListener = this.createListener(this.enable.bind(this));
a.onDisableListener = this.createListener(this.disable.bind(this));
a.onAttentionOnListener = this.createListener(this.turnOnAttention.bind(this));
a.onAttentionOffListener = this.createListener(this.turnOffAttention.bind(this));
a.onFingerOnListener = this.createListener(this.turnOnFinger.bind(this));
a.onFingerOffListener = this.createListener(this.turnOffFinger.bind(this));
a.onChangeTitleListener = this.createListener(this.addTitle.bind(this));
a.onAddLotteryListener = this.createListener(this.addLotteryIcon.bind(this));
a.onRemoveLotteryListener = this.createListener(this.removeLotteryIcon.bind(this));
a.onStartTimerListener = this.createListener(this.runTimer.bind(this));
a.onRemoveTimerListener = this.createListener(this.hideTimer.bind(this));
(this.model.getAnimation() || this.model.icon) && this.showIcon();
this.model.locked && this.setLocked();
this.model.disabled && this.disable();
this.model.attention && this.turnOnAttention();
this.model.finger && this.turnOnFinger();
this.model.title && this.addTitle();
0 < this.model.leftTime && this.runTimer();
this.model.lottery && this.addLotteryIcon();
cleverapps.UI.onClick(this, function() {
this.onPressed()
}
.bind(this));
cleverapps.UI.applyHover(this);
(a = this.model.getTargetTypes()) && cleverapps.aims.registerTarget(a, this, {
controls: this.model.control,
noTargetDelta: this.model.noTargetDelta
})
},
addLotteryIcon: function() {
this.removeLotteryIcon();
this.timerView ? Lottery.addIcon(this.timerView, LotteryIcon.POSITION_ICON_TIMER) : Lottery.addIcon(this, LotteryIcon.POSITION_ICON)
},
removeLotteryIcon: function() {
this.lotteryIcon && this.lotteryIcon.removeFromParent()
},
onPressed: function() {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
cleverapps.audio.playSound(bundles.main.urls.click_effect);
var a = this.model.getToolTip();
if (a)
cleverapps.tooltipManager.onClick(this, a);
else
this.model.onPressed()
},
showForce: function() {
cleverapps.forces.create(this, this.model.getForce())
},
setSize: function(a) {
this.setContentSize2(a);
this.setContentSize2(a);
this.setPositionRound(this.width / 2, this.height / 2)
},
showIcon: function() {
this.icon && this.icon.removeFromParent();
if (this.model.icon) {
var a = this.model.icon;
a = this.icon = a();
cleverapps.UI.fitToBox(a, {
width: .7 * this.width,
height: .7 * this.height,
maxScale: 1.2
});
a.setPositionRound(this.iconNode.width / 2, this.iconNode.height / 2);
this.iconNode.addChild(a)
} else if (this.model.getAnimation()) {
var b = this.icon = new cleverapps.Spine(this.model.getAnimation());
b.setPositionRound(this.iconNode.width / 2, this.iconNode.height / 2);
this.iconNode.addChild(b);
a = function() {
b.runAction(new cc.Sequence(new cc.DelayTime(cleverapps.Random.mathChoose(SideBarIconView.RANDOM_ANIMATION_INTERVALS)),new cc.CallFunc(function() {
b.setAnimation(0, "animation", !1)
}
)))
}
;
this.model.skin && b.hasSkin(this.model.skin) && b.setSkin(this.model.skin);
b.setAnimation(0, "animation", !1);
this.model.locked || b.setCompleteListener(a);
this.model.fallSale && this.addChild(new FallSaleIcon(FallSaleIcon.POSITION_SIDEBAR))
}
},
show: function() {
if (!this.model.isFake) {
var a = cleverapps.styles.SideBarIconView
, b = cleverapps.skins.getSlot("sidebarBg") || bundles.sidebar.frames.icon_bg;
b = this.bg = cleverapps.UI.createScale9Sprite(b);
a.bg && a.bg.width && b.setContentSize(a.bg);
SceneDecors.add(b, cleverapps.skins.getSlot("sidebarIcon"));
this.addChild(b);
b.setPositionRound(b.width / 2, b.height / 2);
this.setSize(b.getContentSize());
a = this.iconNode = new cc.Node;
a.setAnchorPoint(.5, .5);
a.setContentSize2(this.getContentSize());
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a)
}
},
setLocked: function() {
var a = cleverapps.styles.SideBarIconView;
a.lock.color ? this.icon && this.icon.spine && this.icon.spine.setColor(a.lock.color) : a.lock.greyscale && this.icon && this.icon.spine && cleverapps.UI.convertToGrayScale(this.icon.spine);
var b = this.lock = new cc.Sprite(bundles.sidebar.frames.lock);
this.addChild(b, 1);
b.setPositionRound(a.lock)
},
unlock: function() {
this.lock.removeFromParent();
this.bg.setColor(cleverapps.styles.COLORS.WHITE);
this.icon && this.icon.spine && (this.icon.spine.setColor(cleverapps.styles.COLORS.WHITE),
cleverapps.UI.convertToGrayScale(this.icon.spine, !0))
},
enable: function() {
this.icon && this.icon.spine && this.icon.spine.setColor(cleverapps.styles.COLORS.WHITE)
},
disable: function() {
this.icon && this.icon.spine && this.icon.spine.setColor(new cc.Color(130,130,130,200))
},
addTitle: function() {
this.text && (this.text.removeFromParent(),
delete this.text);
this.textBg && (this.textBg.removeFromParent(),
delete this.textBg);
if (void 0 !== this.model.title) {
var a = cleverapps.styles.SideBarIconView.text
, b = this.textBg = this.getTitleBg();
b.setPositionRound(a);
this.addChild(b);
TextWithIcon.IsApplicable(this.model.title) ? this.text = new TextWithIcon(this.model.title,{
font: cleverapps.styles.FONTS.SIDEBAR_ICON_TEXT
}) : this.text = cleverapps.UI.generateTTFText(this.model.title, cleverapps.styles.FONTS.SIDEBAR_ICON_TEXT);
this.text.setPositionRound(b.width / 2, b.height / 2 + a.offsetY);
a = this.getTitleTextSize();
this.text.fitTo(a.width, a.height);
this.text.baseScale = this.text.scale;
b.addChild(this.text)
}
},
runTimer: function() {
this.hideTimer();
var a = this.timer = new cleverapps.CountDown(this.model.leftTime,{
onFinish: function() {
this.model.resetState()
}
.bind(this)
})
, b = cleverapps.styles.SideBarIconView.text
, c = {
font: cleverapps.styles.FONTS.SIDEBAR_ICON_TEXT,
timerPosition: {
x: 0,
y: b.offsetY
}
}
, d = this.getTitleBg();
d && (c.background_content = d);
a = this.timerView = new cleverapps.CountDownView(a,c);
c = this.getTitleTextSize();
a.fitTo(c.width, c.height);
a.baseScale = a.scale;
this.addChild(a);
a.setPositionRound(b)
},
getTitleBg: function() {
var a = cleverapps.styles.SideBarIconView.text
, b = cleverapps.UI.createScale9Sprite(bundles.sidebar.frames.icon_text_bg, cleverapps.UI.Scale9Rect.TwoPixelXY);
b.setContentSize2(a.width, a.height);
if (this.model.titleIcon) {
var c = new cc.Sprite(this.model.titleIcon);
b.addChild(c);
c.setPositionRound(a.titleIcon)
}
return b
},
getTitleTextSize: function() {
var a = cleverapps.styles.SideBarIconView.text;
return {
width: a.width * a.factorX,
height: a.height * a.factorY
}
},
hideTimer: function() {
this.timer && (this.timer.remove(),
delete this.timer);
this.timerView && (this.timerView.removeFromParent(),
delete this.timerView)
},
showAttentionAnimation: function() {
!this.mark || this.attentionJumped || cleverapps.focusManager.isFocused() || (this.mark.jump(),
this.attentionJumped = !0)
},
turnOnAttention: function() {
if (!this.mark) {
var a = this.mark = new Attention;
a.setPositionRound(cleverapps.styles.SideBarIconView.mark);
this.addChild(a)
}
this.attentionJumped = !1;
this.showAttentionAnimation()
},
turnOffAttention: function() {
this.mark.removeFromParent();
delete this.mark
},
turnOnFinger: function() {
this.finger = FingerView.hintClick(this, {
delay: 1.6
})
},
turnOffFinger: function() {
FingerView.remove(this.finger);
this.finger = void 0
},
getModel: function() {
return this.model
},
onShow: function() {},
onHide: function() {}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
SIDEBAR_ICON_TEXT: {
name: "default",
size: 40
}
});
cleverapps.styles.SideBarIconView = {
lock: {
color: new cc.Color(130,130,130,200),
x: {
align: "right",
dx: 0
},
y: {
align: "bottom",
dy: 0
}
},
text: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 0
},
width: 148,
height: 56,
offsetY: 0,
factorX: .86,
factorY: .86,
titleIcon: {
x: {
align: "left",
dx: -45
},
y: {
align: "center",
dy: 0
}
}
},
mark: {
x: {
align: "right",
dx: -5
},
y: {
align: "top",
dy: -5
}
}
};
SideBarIconView.RANDOM_ANIMATION_INTERVALS = [5, 7, 9, 11, 12];
var SideBarView = cc.Node.extend({
ctor: function() {
this._super();
this.updateSize();
this.slots = SideBar.SLOTS.map(function(b) {
b = new SideBarSlotView(b,this);
this.addChild(b);
return b
}, this);
cleverapps.sideBar.refreshAllIcons();
cleverapps.sideBar.onAddIcon = this.createListener(this.insert.bind(this));
cleverapps.sideBar.onMoveIcon = this.createListener(this.move.bind(this));
cleverapps.sideBar.onRemoveIcon = this.createListener(this.eject.bind(this));
cleverapps.sideBar.onForceIcon = this.createListener(this.onForce.bind(this));
for (var a = 0; a < cleverapps.sideBar.icons.length; a++)
this.insert(a);
this.updateZOrder()
},
updateSize: function() {
var a = cleverapps.resolution.getSceneSize()
, b = a.height;
this.setAnchorPoint(.5, .5);
this.setContentSize2(a.width, b);
this.setPositionRound(a.width / 2, b / 2)
},
onForce: function(a) {
this.slots[a].showForce()
},
insert: function(a) {
if (this.slots[a]) {
var b = cleverapps.sideBar.icons[a].getView();
this.slots[a].insert(new b(cleverapps.sideBar.icons[a]))
}
},
eject: function(a) {
this.slots[a] && this.slots[a].eject()
},
move: function(a, b) {
if (this.slots[a]) {
var c;
this.slots[b] && (c = this.slots[b].release());
c || (b = cleverapps.sideBar.icons[a],
c = new (b.getView())(b));
this.slots[a].insert(c)
} else
this.slots[b] && this.slots[b].eject()
},
updateZOrder: function() {
this.setLocalZOrder(cleverapps.focusManager.isFocused() ? BaseWindow.WINDOWS_ZORDER + 1 : SideBarView.ZORDER)
}
});
SideBarView.ZORDER = 1;
var SideBarSlotView = cc.Node.extend({
ctor: function(a, b) {
this._super();
var c = this.styles = this.getStyles();
this.setAnchorPoint(.5, .5);
this.setContentSize2(c.width, c.height);
var d = this.showNode = new cc.Node;
d.setAnchorPoint(.5, .5);
d.setContentSize2(c.width, c.height);
b.addChild(d);
d = this.hideNode = new cc.Node;
d.setAnchorPoint(.5, .5);
d.setContentSize2(c.width, c.height);
b.addChild(d);
this.sideBar = b;
this.row = a.row;
this.col = a.col;
this.setupChildren();
this.debugId = "SideBarSlot" + this.row + this.col
},
setupChildren: function() {
this.stopAllActions();
this.visible = !0;
this.setScale(connector.info.isMobile ? this.styles.mobileScale[cleverapps.resolution.mode] : this.styles.scale[cleverapps.resolution.mode]);
this.showNode.setScale(this.scale);
this.hideNode.setScale(this.scale);
var a = this.styles.wideModePadding && this.styles.wideModePadding[cleverapps.resolution.mode] || this.styles.padding
, b = this.width * this.scale
, c = a.horizontal * this.scale;
a = {
align: "top",
dy: -a.top - this.row * (this.styles.margin + this.height * this.scale)
};
this.col === SideBar.LEFT_COLUMN ? (this.hidePosition = cc.p({
align: "left",
dx: -b
}, a),
this.showPosition = cc.p({
align: "left",
dx: c
}, a)) : (this.hidePosition = cc.p({
align: "right",
dx: b
}, a),
this.showPosition = cc.p({
align: "right",
dx: -c
}, a));
this.showNode.setPositionRound(this.showPosition);
this.hideNode.setPositionRound(this.hidePosition);
b = this.iconView && (this.iconView.model.control || this.getControlName());
cleverapps.focusManager.lastControlsVisible[b] ? (this.isShown = !0,
this.setPositionRound(this.showPosition)) : (this.visible = this.isShown = !1,
this.setPositionRound(this.hidePosition))
},
getStyles: function() {
return cleverapps.styles.SideBarSlot
},
getControlName: function() {
return "sideBarSlot_" + this.row + "_" + this.col
},
insert: function(a) {
this.iconView = a;
this.addChild(a);
a.setPositionRound(1 < this.iconView.model.countOfSlots() ? this.styles.iconsGroup : this.styles.icon);
cleverapps.focusManager.registerControl(a.model.control || this.getControlName(), this, Object.values(cleverapps.Environment).filter(function(b) {
return b !== cleverapps.Environment.SCENE_MAIN
}))
},
eject: function() {
cleverapps.focusManager.removeControl(this.iconView.model.control || this.getControlName());
this.iconView.removeFromParent();
this.iconView = void 0
},
release: function() {
cleverapps.focusManager.removeControl(this.iconView.model.control || this.getControlName());
this.iconView.removeTemporarily(!1);
var a = this.iconView;
this.iconView = void 0;
return a
},
showForce: function() {
cleverapps.focusManager.showControlsWhileFocused(this.iconView.model.control || this.getControlName(), !0);
this.iconView.showForce()
},
toggle: function(a, b) {
a ? this.show(b) : this.hide(b)
},
show: function(a) {
this.isShown = !0;
this.sideBar.updateZOrder();
this.iconView ? this.iconView.showAttentionAnimation && this.iconView.showAttentionAnimation() : a = !0;
this.stopAllActions();
a ? (this.visible = !0,
this.setPositionRound(this.showPosition)) : this.runAction(new cc.Sequence(new cc.DelayTime(.3 + .1 * this.row),new cc.Show,(new cc.MoveTo(1,this.showNode.getPosition())).easing(cc.easeElasticOut(.6))));
if (this.iconView)
this.iconView.onShow();
cleverapps.scenes.onAvoidNodeVisibilityChanged()
},
hide: function(a) {
this.isShown = !1;
this.iconView || (a = !0);
this.stopAllActions();
a ? (this.visible = !1,
this.setPositionRound(this.hidePosition)) : this.runAction(new cc.Sequence((new cc.MoveTo(.15,this.hideNode.getPosition())).easing(cc.easeBackIn()),new cc.Hide));
if (this.iconView)
this.iconView.onHide();
cleverapps.scenes.onAvoidNodeVisibilityChanged()
}
});
cleverapps.styles.SideBarSlot = {
width: 200,
height: 200,
margin: 20,
scale: [.8, 1, 1],
mobileScale: [.65, .9, .9],
padding: {
top: 120,
horizontal: 15
},
icon: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
iconsGroup: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -6
}
}
};
var DailyCupIcon = function() {
SideBarIcon.call(this, {
animation: bundles.sidebar.jsons.dailycup_icon_json
});
cleverapps.dailyCup.onChangedIcon = function() {
cleverapps.sideBar.resetByClassName(DailyCupIcon)
}
};
DailyCupIcon.prototype = Object.create(SideBarIcon.prototype);
DailyCupIcon.prototype.constructor = DailyCupIcon;
DailyCupIcon.prototype.getForce = function() {
return cleverapps.dailyCup.getForce()
}
;
DailyCupIcon.prototype.resetState = function() {
var a = (this.available = cleverapps.dailyCup.isAvailable({
future: !0
})) && !cleverapps.dailyCup.isAvailable();
this.available && !a && (this.available = cleverapps.dailyCup.isActive());
a ? (this.setLocked(!0),
this.setAttention(!1),
this.setTitle(Messages.get("IconLocked.TextDefault", {
levelNo: this.getLockedTipData()
}))) : (this.setLocked(!1),
this.setAttention(!this.locked && cleverapps.dailyCup.isFinished()),
a = cleverapps.dailyCup.getTimeLeft(),
0 < a ? (this.setLeftTime(a),
this.setTitle(void 0)) : (this.setLeftTime(0),
this.setTitle("Finished")))
}
;
DailyCupIcon.prototype.onPressed = function() {
cleverapps.focusManager.display({
focus: "DailyCupSceneFromIcon",
action: function(a) {
cleverapps.scenes.replaceScene(new DailyCupScene, a)
}
})
}
;
DailyCupIcon.prototype.getLockedTipData = function() {
return cleverapps.humanReadableNumber({
floatLevel: CupsConfig.TYPES[CupsConfig.TYPE_DAILY].available.level
})
}
;
var FakeSideBarIcon = function(a) {
this.parentIcon = a;
SideBarIcon.call(this);
this.isFake = this.available = !0
};
FakeSideBarIcon.prototype = Object.create(SideBarIcon.prototype);
FakeSideBarIcon.prototype.constructor = FakeSideBarIcon;
FakeSideBarIcon.prototype.resetState = function() {
this.available = this.parentIcon.available
}
;
var InviteIcon = function() {
SideBarIcon.call(this, {
animation: bundles.sidebar.jsons.invite_icon_json,
priority: SideBar.PRIORITY_REDUNDANT
})
};
InviteIcon.prototype = Object.create(SideBarIcon.prototype);
InviteIcon.prototype.constructor = InviteIcon;
InviteIcon.prototype.onPressed = function() {
connector.social.isLoggedIn() || !connector.social.isNeedsLoginForInvite ? this.performInvite() : cleverapps.focusManager.display({
focus: "InviteIcon",
action: this.performInvite.bind(this)
})
}
;
InviteIcon.prototype.performInvite = function(a) {
cleverapps.invites.invite(function(b) {
b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.INVITE_ICON_INVITE);
a && a()
})
}
;
InviteIcon.prototype.resetState = function() {
(this.available = levels.user.checkAvailable(cleverapps.Availables.INVITE_FRIENDS_ICON) && connector.social.isSupportsNativeInvite) && "merge" === cleverapps.config.type && (this.available = cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition())
}
;
var OfferIcon = function(a) {
SideBarIcon.call(this, {
animation: a.sideBarJson,
priority: SideBar.PRIORITY_REDUNDANT
});
this.offer = a;
this.resetState()
};
OfferIcon.prototype = Object.create(SideBarIcon.prototype);
OfferIcon.prototype.constructor = OfferIcon;
OfferIcon.prototype.resetState = function() {
if (cleverapps.config.editorMode)
this.available = !1;
else {
var a = this.offer.logic;
this.fallSale = cleverapps.fallSale.isAvailable();
if (this.available = a.isIconAvailable())
this.setLeftTime(a.getTimeLeft()),
this.setAttention(a.hasIconAttention()),
this.setTitle(a.hasIconAttention() ? "Ready" : void 0)
}
}
;
OfferIcon.prototype.onPressed = function() {
cleverapps.offerManager.showOfferWindow(this.offer)
}
;
OfferIcon.prototype.getForce = function() {
return this.offer.force
}
;
var NoAdsIcon = function() {
SideBarIcon.call(this);
this.fallSale = cleverapps.fallSale.isAvailable()
};
NoAdsIcon.prototype = Object.create(SideBarIcon.prototype);
NoAdsIcon.prototype.constructor = NoAdsIcon;
NoAdsIcon.prototype.resetState = function() {
this.available = cleverapps.noAds && cleverapps.noAds.needToNudge();
this.setTitle(Product.CreateById("noAds").getCurrentPrice());
this.available && this.setAnimation(bundles.sidebar.jsons.noads_icon_json)
}
;
NoAdsIcon.prototype.onPressed = function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.NOADS_PRODUCT.SIDEBAR_CLICK);
cleverapps.focusManager.display({
focus: "NoAdsIcon",
action: function(a) {
var b = Product.CreateById("noAds");
b.buy(function(c) {
c ? (b.logBuyItem(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.NOADS_PRODUCT.SIDEBAR_PURCHASE),
new RewardWindow({
noAds: 1
}),
cleverapps.focusManager.onceNoWindowsListener = a) : a()
}, {
noRewardWindow: !0
})
}
})
}
;
var TeaserIcon = function(a) {
SideBarIcon.call(this, {
animation: Missions[a].sideBarJson,
priority: SideBar.PRIORITY_REDUNDANT,
progressIconJson: Missions[a].sideBarProgressIconJson
});
this.type = a;
this.available = !0;
this.resetState()
};
TeaserIcon.prototype = Object.create(SideBarIcon.prototype);
TeaserIcon.prototype.constructor = TeaserIcon;
TeaserIcon.prototype.resetState = function() {
if (this.available = MissionManager.hasProperParent(Missions[this.type]))
this.setLocked(!0),
this.setAttention(!1),
this.setFinger(!1),
this.setTitle(Messages.get("IconLocked.TextDefault", {
levelNo: this.getLockedTipData()
}))
}
;
TeaserIcon.prototype.getLockedTipData = function() {
if (Missions[this.type].available)
return cleverapps.humanReadableNumber({
floatLevel: Missions[this.type].available.level
})
}
;
var ExpeditionIcon = function(a) {
this.pageId = a;
SideBarIcon.call(this, {
animation: cleverapps.travelBook.getPageById(this.pageId).getSidebarIcon(),
priority: SideBar.PRIORITY_REDUNDANT
});
this.resetState()
};
ExpeditionIcon.prototype = Object.create(SideBarIcon.prototype);
ExpeditionIcon.prototype.constructor = ExpeditionIcon;
ExpeditionIcon.prototype.onPressed = function() {
cleverapps.focusManager.display({
focus: "ExpeditionIconClicked",
action: function(a) {
cleverapps.travelBook.getPageById(this.pageId).gotoExpedition(a)
}
.bind(this)
})
}
;
ExpeditionIcon.prototype.resetState = function() {
var a = cleverapps.travelBook.listAvailablePages().filter(function(b) {
return !b.isMain() && b.isActive() && !b.isCurrent()
}).sort(function(b, c) {
return b.slot - c.slot
})[0];
if (this.available = a && a.id === this.pageId)
a = cleverapps.travelBook.getPageById(this.pageId),
this.setAttention(a.attention),
a.isCompleted() ? (this.setLeftTime(0),
this.setTitle("Finished")) : (this.setLeftTime(a.getTimeLeft()),
this.setTitle(void 0))
}
;
var TreasureBagIcon = cc.Node.extend({
ctor: function() {
this._super();
var a = cleverapps.styles.TreasureBag;
if (a.background) {
var b = new cc.Sprite(bundles.treasurebag.frames.treasurebag_bg_png);
b.setPositionRound(b.width / 2, b.height / 2);
this.addChild(b)
}
this.setAnchorPoint(.5, .5);
this.setContentSize2(a);
b = this.animation = new cleverapps.Spine(bundles.treasurebag.jsons.treasurebag_json);
b.setPositionRound(a.animation);
this.addChild(b);
cleverapps.aims.registerTarget("default", this, {
withoutDelta: !0,
controls: ["treasureBag"]
});
this.setLocalZOrder(TreasureBagIcon.ZORDER);
this.updateSize();
this.setupChildren()
},
setupChildren: function() {
this.setPositionRound(cleverapps.styles.TreasureBag.position)
},
updateSize: function() {
var a = cleverapps.styles.TreasureBag;
this.setScale(connector.info.isMobile ? a.mobileScale[cleverapps.resolution.mode] : a.scale[cleverapps.resolution.mode]);
this.baseScale = this.scale
},
onShow: function() {
this.animation.setAnimation(0, "animation", !1)
}
});
TreasureBagIcon.ZORDER = BaseWindow.WINDOWS_ZORDER + 1;
cleverapps.styles.TreasureBag = {
width: 210,
height: 210,
scale: [.8, 1, 1],
mobileScale: [.65, .8, .8],
animation: {
x: {
align: "center",
dx: -2
},
y: {
align: "center",
dy: -8
}
},
position: {
x: {
align: "right",
dx: -10
},
y: {
align: "bottom",
dy: 200
}
},
hideVertical: !1,
offsetY: 60,
background: !0
};
var ChestVictoryAnimation = cc.Node.extend({
ctor: function() {
this._super();
this.setAnchorPoint(.5, .5);
var a = cleverapps.styles.ChestVictoryAnimation
, b = this.animation = new cleverapps.Spine(bundles.game.jsons.gold_chest_json);
b.setAnimation(0, "jump", !1);
b.setAnchorPoint(.5, .5);
this.addChild(b);
this.text = cleverapps.UI.generateImageText(Game.currentGame.rewards[GameBase.REWARD_HARD], cleverapps.styles.FONTS.CHEST_REWARD_TEXT);
b = new cc.Sprite(bundles.game.frames.gold_png);
this.reward = new cleverapps.Layout([this.text, b],{
margin: a.reward.margin,
direction: cleverapps.UI.HORIZONTAL
});
this.addChild(this.reward);
this.reward.setPosition(a.reward.position);
this.reward.setCascadeOpacityEnabledRecursively(!0);
this.reward.setOpacity(0);
this.reward.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.FadeIn(.5)));
cleverapps.audio.playSound(bundles.game.urls.chest_victory_effect)
},
getFlyTargetPosition: function() {
var a = cleverapps.styles.ChestVictoryAnimation.targetAlignment;
return {
x: this.animation.width / 2 + a.x,
y: this.animation.height / 2 + a.y
}
},
animationLeave: function(a) {
this.reward.runAction(new cc.Sequence(new cc.PlaySound(bundles.game.urls.end_chest_victory_effect),new cc.ScaleTo(.4,1.8),new cc.ScaleTo(.2,1),new cc.FadeOut(.1),new cc.CallFunc(function() {
this.animation.setAnimation(0, "leaving", !1);
this.animation.setCompleteListener(function() {
cleverapps.audio.playSound(bundles.game.urls.end_collected);
this.removeFromParent();
a()
}
.bind(this))
}
.bind(this))))
},
addGold: function() {
this.animation.setAnimation(0, "cards", !1);
this.text.setString(Game.currentGame.rewards[GameBase.REWARD_HARD]);
this.reward.reshape();
this.reward.stopAllActions();
this.reward.runAction(new cc.Sequence(new cc.PlaySound(bundles.game.urls.fill_chest_victory_effect,{
throttle: 250
}),new cc.ScaleTo(.15,1.3),new cc.ScaleTo(.15,1)))
}
});
cleverapps.styles.ChestVictoryAnimation = {
reward: {
position: {
x: 0,
y: 230
},
margin: 10
},
targetAlignment: {
x: 25,
y: 80
},
chestPosition: {
x: {
align: "center"
},
y: {
align: "center"
}
}
};
var AutoScrollText = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.options = b || {};
this.styles = cleverapps.styles.AutoScrollText;
this.setAnchorPoint(.5, .5);
this.setContentSize2(b.width, b.height);
this.createTexts(a);
this.createArrow();
this.currentTextIndex = 0;
this.texts[this.currentTextIndex].setVisible(!0)
},
createTexts: function(a) {
this.texts = [];
a.forEach(function(b) {
b = cleverapps.UI.generateOnlyText(b, this.options.font || cleverapps.styles.FONTS.WINDOW_TEXT);
this.addChild(b);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(this.width, 0);
b.fitTo(void 0, this.height);
b.setPositionRound(this.width / 2, this.height / 2);
b.setVisible(!1);
this.texts.push(b)
}
.bind(this))
},
createArrow: function() {
var a = cleverapps.UI.generateOnlyText("\u25bc", this.options.font || cleverapps.styles.FONTS.WINDOW_TEXT)
, b = new cc.Node;
b.setContentSize2(this.styles.arrow.width, this.styles.arrow.height);
b.setAnchorPoint(.5, .5);
this.addChild(b);
b.setPositionRound(this.styles.arrow);
b.addChild(a);
a.setPositionRound(b.width / 2, b.height / 2);
cleverapps.UI.onClick(b, function() {
this.next();
this.reinitTimer()
}
.bind(this))
},
next: function() {
this.texts[this.currentTextIndex].setVisible(!1);
this.currentTextIndex = (this.currentTextIndex + 1) % this.texts.length;
this.texts[this.currentTextIndex].setVisible(!0)
},
reinitTimer: function() {
this.stopAllActions();
this.runAction(new cc.RepeatForever(new cc.Sequence(new cc.DelayTime(5),new cc.CallFunc(this.next.bind(this)))))
},
setTextByIndex: function(a) {
this.texts[this.currentTextIndex] && this.texts[this.currentTextIndex].setVisible(!1);
this.currentTextIndex = a;
this.texts[this.currentTextIndex].setVisible(!0)
}
});
cleverapps.styles.AutoScrollText = {
arrow: {
x: {
align: "right",
dx: 0
},
y: {
align: "bottom",
dy: -30
},
width: 40,
height: 40
}
};
var LoginButton = cleverapps.UI.Button.extend({
ctor: function(a) {
this.options = a || {};
this.options.onSuccess = this.options.onSuccess || function() {}
;
this.options.onFailure = this.options.onFailure || function() {}
;
this.source = this.options.source || connector.info.source;
a = cleverapps.styles.LoginButton;
var b = {
type: this.options.type,
width: this.options.width || a.width,
height: this.options.height || a.height,
onClicked: this.onClicked.bind(this),
text: this.getText(),
icons: {
"%%": this.getIcon()
}
};
void 0 !== a.content[this.source] && (b.height = a.customHeight,
b.content = this.getContent(),
b.text = void 0,
b.icons = void 0,
b.type = {
button_png: bundles.buttons.frames.sign_in_button_png,
button_on_png: bundles.buttons.frames.sign_in_button_on_png,
button_off_png: bundles.buttons.frames.sign_in_button_png,
keepRadius: !1
});
this._super(b)
},
getContent: function() {
return new cc.Sprite(cleverapps.styles.LoginButton.content[this.source])
},
getIcon: function() {
return cleverapps.styles.LoginButton.icon.image[this.source]
},
getText: function() {
return (this.getIcon() ? "%% " : "") + "SignIn"
},
onClicked: function() {
if (connector.social.isConnected()) {
var a = function() {
cleverapps.SocialManager.login(function(b) {
if (b)
this.options.onSuccess();
else
this.options.onFailure(),
cleverapps.SocialManager.onFailedLogin()
}
.bind(this), {
source: this.source
})
}
.bind(this);
this.options.multiSocials && connector.info.isNative ? (this.stopAllActions(),
this.setScale(.95),
this.runAction(new cc.Sequence(new cc.DelayTime(.05),new cc.CallFunc(a),(new cc.ScaleTo(.15,1)).easing(cc.easeBackInOut())))) : a()
} else
cleverapps.notification.create("SocialManager.Initialization")
}
});
cleverapps.styles.LoginButton = {
width: 200,
height: 110,
icon: {
image: {
ok: bundles.main.frames.login_ok_icon_png,
vk: bundles.main.frames.login_vk_icon_png,
mbga: bundles.main.frames.login_mobage_icon_png,
sp_mbga: bundles.main.frames.login_mobage_icon_png,
draugiem: bundles.main.frames.login_draugiem_icon_png,
mm: bundles.main.frames.login_mm_icon_png,
fotostrana: bundles.main.frames.login_fs_icon_png,
plinga: bundles.main.frames.login_plinga_icon_png,
kongregate: bundles.main.frames.login_kongregate_icon_png
}
},
customHeight: 100,
content: {
facebook: bundles.social_buttons.frames.sign_in_facebook,
microsoft: bundles.social_buttons.frames.sign_in_facebook,
android: bundles.social_buttons.frames.sign_in_google,
apple: bundles.social_buttons.frames.sign_in_apple
}
};
var InviteButton = cleverapps.UI.Button.extend({
ctor: function(a) {
this.options = a || {};
this.options.onSuccess = this.options.onSuccess || function() {}
;
a = cleverapps.styles.InviteButton;
this._super({
type: this.options.type,
width: this.options.width || a.width,
height: this.options.height || a.height,
onClicked: this.onClicked.bind(this),
text: "InviteButton.Text"
})
},
onClicked: function() {
cleverapps.invites.invite(function(a) {
if (a)
this.options.onSuccess()
}
.bind(this))
}
});
cleverapps.styles.InviteButton = {
width: 200,
height: 110
};
var BandButton = cc.Node.extend({
avoidNode: "BandButton",
ctor: function(a) {
this._super();
this.options = a;
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(3);
a = this.bg = cleverapps.UI.createScale9Sprite(bundles.buttons_main.frames.scene_exit_button, cleverapps.UI.Scale9Rect.TwoPixelXY);
this.addChild(a);
a = this.icon = new cc.Sprite(bundles.buttons_main.frames.close_band_icon);
this.addChild(a);
this.setupChildren();
cleverapps.UI.applyHover(this);
cleverapps.UI.onClick(this, function() {
this.action()
}
.bind(this))
},
setupChildren: function() {
var a = cleverapps.styles.BandButton
, b = cleverapps.resolution.getSafePadding()
, c = a.size[cleverapps.resolution.mode] || a.size;
c = {
width: c.width,
height: c.height + b.top
};
this.setContentSize2(c);
this.updatePosition();
this.bg.setContentSize2(c);
this.bg.setPositionRound(this.width / 2, this.height / 2);
this.icon.setPositionRound(a.icon)
},
completeAnimationOnResize: function() {
this.stopAllActions();
this.setVisible(!0)
},
updatePosition: function() {
var a = cleverapps.styles.BandButton
, b = cleverapps.resolution.getSafePadding();
a = a.position[cleverapps.resolution.mode] || a.position;
a = cleverapps.clone(a, !0);
a.x.dx = a.x.dx || 0;
a.y.dy = (a.y.dy || 0) + b.top;
this.setPositionRound(a)
},
action: function() {
cleverapps.audio.playSound(bundles.main.urls.click_effect);
this.options.onClicked()
},
hide: function(a) {
this.stopAllActions();
a ? this.setVisible(!1) : (this.updatePosition(),
this.runAction(new cc.Sequence((new cc.MoveBy(.3,0,this.height)).easing(cc.easeBackIn()),new cc.Hide)))
},
show: function() {
this.stopAllActions();
this.updatePosition();
this.runAction(new cc.Sequence(new cc.MoveBy(0,0,this.height),new cc.Show,(new cc.MoveBy(.3,0,-this.height)).easing(cc.easeBackOut())))
}
});
cleverapps.styles.BandButton = {
size: {
width: 85,
height: 190
},
position: {
x: {
align: "right",
dx: -40
},
y: {
align: "top",
dy: 10
}
},
icon: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 25
}
}
};
var CloseButton = cleverapps.UI.Button.extend({
ctor: function(a) {
this._super({
type: {
button_png: bundles.buttons_main.frames.window_close_png,
button_on_png: bundles.buttons_main.frames.window_close_on_png
},
onClicked: a.onClicked
});
this.setPositionRound(a.styles || cleverapps.styles.CloseButton);
this.setLocalZOrder(3)
},
hide: function() {
this.setVisible(!1)
},
show: function() {
this.runAction(new cc.Sequence(new cc.ScaleTo(0,.3),new cc.Show,(new cc.ScaleTo(.4,1)).easing(cc.easeBackOut())))
}
});
cleverapps.styles.CloseButton = {
x: {
align: "right",
dx: 20
},
y: {
align: "top",
dy: 20
}
};
var TapToContinue = cc.Node.extend({
ctor: function(a) {
this._super();
a = cleverapps.UI.generateOnlyText(a.text, cleverapps.styles.FONTS.CLOSE_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && a.setWrapWidth(cc.view.getFrameSize().width);
a.setPositionRound(a.width / 2, a.height / 2);
this.setContentSize(a.getContentSize());
this.setAnchorPoint(.5, .5);
this.addChild(a);
this.setCascadeOpacityEnabled(!0);
this.setOpacity(0);
this.setVisible(!1);
this.updateSize()
},
updateSize: function() {
var a = (cleverapps.resolution.getSceneSize().width - cleverapps.styles.TapToContinue.padding) / this.width;
this.setScale(Math.min(a, 1))
},
hide: function(a) {
this.stopAllActions();
a ? this.setVisible(!1) : this.runAction(new cc.Sequence(new cc.FadeOut(.1),new cc.Hide))
},
show: function() {
this.runAction(new cc.Sequence(new cc.FadeOut(0),new cc.DelayTime(.5),new cc.Show,new cc.FadeIn(1)))
}
});
cleverapps.styles.TapToContinue = {
padding: 100
};
var TapToSkip = TapToContinue.extend({
ctor: function() {
this._super.apply(this, arguments);
this.clickHandler = cleverapps.UI.onClick(this, function() {}, {
interactiveScale: !1,
onOuterTouch: cleverapps.once(function() {
Game.currentGame.skipBonusAnimations = !0;
Game.currentGame.trigger("onSkip");
this.hide()
}
.bind(this))
})
},
hide: function() {
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.FadeOut(.1),new cc.CallFunc(this.clickHandler.remove),new cc.RemoveSelf))
}
});
cleverapps.styles.TapToSkip = {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 50
}
};
cleverapps.Path = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.baseColor = a;
this.pathColor = cc.color(this.baseColor);
this.lineWidth = b || cleverapps.styles.Path.lineWidth;
this.segments = [];
for (a = 0; a < cleverapps.Path.MAX_SEGMENTS; ++a)
this.segments.push(cleverapps.UI.createScale9Sprite(bundles.path.frames.line_png)),
this.segments[a].setAnchorPoint(0, .5),
this.segments[a].visible = !1,
this.addChild(this.segments[a]);
this.path = [];
this.drawTrailing = !0;
this.setCascadeOpacityEnabled(!0);
this.setLocalZOrder(-1)
},
clear: function() {
this.segments.forEach(function(a) {
a.visible = !1
})
},
reset: function() {
this.stopFadeOut();
this.path = [];
this.pathColor = cc.color(this.baseColor);
this.opacity = 255;
this.draw()
},
push: function(a) {
this.path.push(a);
this.draw()
},
pop: function() {
this.path.pop();
this.draw()
},
setPath: function(a) {
this.path = a.map(function(b) {
return b
})
},
onExitTransitionDidStart: function() {
this.reset();
this._super()
},
drawSegment: function(a, b, c) {
var d = 15 * resolutionScale / 2 * .9
, e = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2)) + 2 * d;
c = this.segments[c];
c.setColor(this.pathColor);
c.setContentSize2(e, this.lineWidth);
b = Math.round(100 * Math.atan2(b.y - a.y, b.x - a.x)) / 100;
c.setPositionRound(a.x - d * Math.cos(b), a.y - d * Math.sin(b));
c.rotation = 180 * -b / Math.PI;
c.visible = !0
},
draw: function(a) {
this.clear();
if (0 < this.path.length) {
a = this.drawTrailing && a ? this.path.concat(a) : this.path;
for (var b = 0; b < a.length - 1; b++)
this.drawSegment(a[b], a[b + 1], b)
}
},
stopFadeOut: function() {
this.fadeOutAction && (this.fadeOutAction.isDone() || this.stopAction(this.fadeOutAction),
delete this.fadeOutAction)
},
animateFadeOut: function(a) {
this.stopFadeOut();
this.fadeOutAction = this.runAction(new cc.Sequence(new cc.FadeOut(a || .3),new cc.CallFunc(this.reset.bind(this))))
}
});
cleverapps.Path.MAX_SEGMENTS = 10;
cleverapps.styles.Path = {
lineWidth: 17
};
var Product = function(a) {
Object.assign(this, a);
this.title = Messages.getLocalized(this.title);
this.description = Messages.getLocalized(this.description);
cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_ADS && (this.videoProduct = -1 !== "gold500 gold1800 gold3800 gold6000 gold25000 sweetPack jamPack tastyPack honeyPack epicPack".split(" ").indexOf(this.itemId));
this.videoProduct && this.prepareVideoProduct();
this.currencyImage && Product.RegisterCurrencyImage(this.currency, this.currencyImage)
};
Product.FormatTimePeriod = function(a, b) {
if ("object" === typeof a)
return a;
"string" === typeof a && (a = cleverapps.parseInterval(a));
var c = a / 1E3;
if (b) {
var d = {
15: "15 minutes",
10: "10 minutes",
30: "30 minutes",
45: "45 minutes",
60: "OneHour",
120: "TwoHours",
180: "ThreeHours",
360: "6 hours",
720: "12 hours"
};
b = Math.round(c / 60);
var e = Math.floor(c / 86400);
return {
title: "TimePeriod." + ({
1: "1 day",
2: "2 day",
3: "3 day",
5: "5 day",
7: "7 day",
9: "9 day",
10: "10 day"
}[e] || d[b]),
time: a
}
}
e = Math.floor(c / 86400);
c %= 86400;
d = Math.floor(c / 3600);
b = Math.round(c % 3600 / 60);
c = {
day: e,
hr: d,
min: b
};
var f = "minutesString";
0 < e && 0 < d ? f = "dayTimeString" : 0 < e ? f = "daysString" : 0 < d && 0 < b ? f = "hoursMinutesString" : 0 < d && (f = "hoursString");
return {
title: Messages.get(f, c),
time: a
}
}
;
Product.UnlimitedToHours = function(a) {
if (a.unlimitedLives) {
var b = Math.round(a.unlimitedLives / 1E3 / 60 / 60);
a.unlimitedLives = {
title: Messages.get("AMOUNT_HOURS", {
amount: b
}),
interval: b + " hours"
}
}
return a
}
;
Product.prototype.getIcon = function() {
return cleverapps.skins.getSlot(this.icon) || bundles.tile_shop.frames[this.icon] || this.icon
}
;
Product.prototype.prepareVideoProduct = function() {
var a = 1;
this.reward && (a = .25,
["hard", "soft", "energy", "wands"].forEach(function(b) {
this.reward[b] && (this.reward[b] = 10 * Math.ceil(this.reward[b] * a / 10))
}, this),
this.reward.boosters && Object.keys(this.reward.boosters).forEach(function(b) {
this.reward.boosters[b] = Math.ceil(this.reward.boosters[b] * a)
}, this));
this.videoPrice = 5 * Math.ceil(this.priceUSD * a * 2)
}
;
Product.prototype.getCurrentPrice = function() {
var a = this.textPrice;
Object.keys(Product.CURRENCY_ICONS).forEach(function(b) {
a = a.replace(" " + Product.CURRENCY_ICONS[b].currency, b)
});
return a
}
;
Product.prototype.getUsdPrice = function() {
return this.priceUSD
}
;
Product.prototype.showBoughtMessage = function(a) {
if (this.image) {
var b = this.boughtMessage || "Product.YouBought"
, c = this.boughtMessageParams || {};
c.moves = this.moves;
a && (a.hard || a.soft) && (c.coins = a.hard || a.soft);
var d = connector.platform.getExternalUrl(this.image);
cc.loader.load(d, function(e) {
var f = void 0;
e || (f = new cc.Sprite(d));
cleverapps.notification.create(b, {
toReplace: c,
image: f
})
})
}
}
;
Product.prototype.onBuyed = function(a) {
a = a || {};
var b = this.reward;
this.showBoughtMessage(b);
b && !a.noRewardWindow && (cleverapps.focusManager.isFocused() ? RewardWindow.createPurchaseWindow(b) : cleverapps.focusManager.display({
focus: "purchaseRewardWindow",
action: function(c) {
RewardWindow.createPurchaseWindow(b);
cleverapps.focusManager.onceNoWindowsListener = c
}
}));
cleverapps.userClan && void 0 !== cleverapps.userClan.id && this.clanGift && !this.videoProduct && cleverapps.clans.sendGift({
purchase: this.itemId
});
cleverapps.user.incProgressCompare(50);
cleverapps.audio.playSound(bundles.main.urls.shop_buy_effect)
}
;
Product.prototype.logBuyItem = function() {
var a = cleverapps.windows.findWindow(ShopWindow);
a = {
store_type: a && a.getTitle(),
item_name: this.constructor === Product ? this.title : void 0,
item_price: this.price,
cost_type: this.currency
};
var b = Object.keys(this.reward || {})[0];
b && (a.item_id = b,
a.item_num = this.reward[b]);
this.itemId.startsWith("buyEnergy") && (a.item_id = "energy",
a.item_num = this.reward);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.BUY_ITEM, a)
}
;
Product.prototype.buy = function(a, b) {
cleverapps.paymentsLogic.purchase(this, a, b)
}
;
Product.prototype.getRestoreLogic = function(a) {
return Product.RESTORE_LOGIC[a.type] || Product.RESTORE_LOGIC[this.itemId]
}
;
Product.CreateById = function(a, b) {
if (Products[a] && connector.payments.getProduct(a))
return new Product(Object.assign(cleverapps.clone(connector.payments.getProduct(a), !0), cleverapps.clone(Products[a], !0), {
context: b
}));
if (VirtualProducts[a])
return new VirtualProduct(Object.assign(cleverapps.clone(VirtualProducts[a], !0), {
context: b
}))
}
;
Product.CreateByHardPrice = function(a, b, c) {
c = c || ["kit1", "kit3", "kit10", "kit50"];
cleverapps.flags.monetization !== cleverapps.Flags.MONETIZATION_REGULAR && (c = []);
c = c.map(function(m) {
return Product.CreateById(m, b)
}).filter(function(m) {
return m && m.getUsdPrice()
});
for (var d = void 0, e = void 0, f = a * Product.HARD_TO_USD, g = 0; g < c.length; ++g) {
var h = c[g]
, k = Math.abs(1 - f / h.getUsdPrice());
k <= Product.USD_EXCHANGE_THRESHOLD && (!d || k < e) && (d = h,
e = k)
}
d && (d.event = b.type);
return d || new VirtualProduct({
currency: "hard",
price: a,
context: b
})
}
;
Product.RegisterCurrencyImage = function(a, b) {
var c = "${" + a + "}";
Product.CURRENCY_ICONS[c] || (Product.CURRENCY_ICONS[c] = {
currency: a,
url: b,
size: 50
},
"string" === typeof b && cc.loader.load(b))
}
;
Product.USD_EXCHANGE_THRESHOLD = .21;
Product.HARD_TO_USD = .01;
if (-1 !== ["match3", "solitaire"].indexOf(cleverapps.config.type) || "scramble" === cleverapps.config.name)
Product.HARD_TO_USD = .005;
Product.WAIT_NO_MORE = 4E3;
Product.CURRENCY_ICONS = {
"${OK}": {
currency: "OK",
url: bundles.buttons_inlined_icons.frames.ok_icon_png
},
"${KG}": {
currency: "KG",
url: bundles.buttons_inlined_icons.frames.kred_icon_png
}
};
Product.RESTORE_LOGIC = {};
var VirtualProduct = function(a) {
Product.call(this, a)
};
VirtualProduct.prototype = Object.create(Product.prototype);
VirtualProduct.prototype.constructor = VirtualProduct;
VirtualProduct.prototype.getCurrentPrice = function() {
return "hard" === this.currency ? "$$" + this.price : "@@" + this.price
}
;
VirtualProduct.prototype.getUsdPrice = function() {
return 0
}
;
VirtualProduct.prototype.buy = function(a) {
var b = "hard" === this.currency ? levels.user.spendHard : levels.user.spendSoft
, c = this.spentEvent || this.getSpentEventFromContext();
return b.call(levels.user, c, this.price) ? (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.BUY_VIRTUAL_ITEM + "-" + c),
this.reward && new RewardWindow(this.reward,{
event: c
}),
cleverapps.audio.playSound(bundles.main.urls.shop_buy_effect),
a(!0),
!0) : !1
}
;
VirtualProduct.prototype.getSpentEventFromContext = function() {
if (this.context)
switch (this.context.type) {
case "mission_offer":
case "chain_sale":
case "supplies_sale":
case "promotion_sale":
return cleverapps.EVENTS.SPENT.OFFER + Offers[this.context.offer].name;
case "special_offer":
return cleverapps.EVENTS.SPENT.GENIE_ENERGY;
case "third_element":
return cleverapps.EVENTS.SPENT.THIRD_ELEMENT;
case "offers":
return cleverapps.EVENTS.SPENT.PIXEL_OFFER;
case "fogs":
return cleverapps.EVENTS.SPENT.PAY_ISLAND;
case "worker":
return cleverapps.EVENTS.SPENT.WORKER;
case "last_chance":
return cleverapps.EVENTS.SPENT.LAST_CHANCE;
case "pass_ticket":
return cleverapps.EVENTS.SPENT.BATTLE_PASS
}
}
;
var PaymentOverlay = cc.Scale9Sprite.extend({
ctor: function() {
this._super(bundles.pixel.frames.pixel_png);
this.alwaysOn = !0;
this.setColor(cleverapps.styles.COLORS.BLACK);
this.setLocalZOrder(Transition.ZORDER + 1);
cleverapps.UI.onClick(this, function() {
this.closeText.isVisible() && this.startCancel()
}
.bind(this), {
interactiveScale: !1,
swallowEvents: !0
});
this.createText();
this.createCloseText();
this.showLoading();
this.setupChildren();
this.setOpacity(0);
this.runAction(new cc.Sequence(new cc.DelayTime(PaymentOverlay.SHOW_TIMEOUT / 1E3),new cc.CallFunc(function() {
this.hideLoading()
}
.bind(this)),new cc.FadeTo(.3,80)))
},
showLoading: function() {
var a = this.loading = new LoadingAnimation;
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a);
a.setVisible(!1);
a.runAction(new cc.Sequence(new cc.DelayTime(.2),new cc.Show))
},
hideLoading: function() {
this.loading && (this.loading.removeFromParent(),
delete this.loading)
},
setupChildren: function() {
var a = cleverapps.styles.PaymentOverlay
, b = cleverapps.resolution.getBgSize()
, c = cleverapps.resolution.getSafePadding();
this.setContentSize2(b.width, b.height);
this.setAnchorPoint(.5, .5);
this.setPositionRound(b.width / 2 - c.left, b.height / 2 - c.bottom);
this.loading && this.loading.setPositionRound(this.width / 2, this.height / 2);
this.text && (this.text.setDimensions(this.width, 0),
this.text.fitTo(this.width),
this.text.setPositionRound(a.text));
this.closeText && (this.closeText.setDimensions(this.width, 0),
this.closeText.fitTo(this.width),
this.closeText.setPositionRound(a.closeText))
},
createText: function() {
var a = this.text = cleverapps.UI.generateOnlyText("ProcessingInProgress", cleverapps.styles.FONTS.REWARDED_AD_OVERLAY_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.addChild(a);
a.setOpacity(0);
a.runAction(new cc.Sequence(new cc.DelayTime(PaymentOverlay.SHOW_TIMEOUT / 1E3),new cc.FadeIn(.3)))
},
createCloseText: function() {
var a = this.closeText = cleverapps.UI.generateOnlyText("Window.TapToContinue", cleverapps.styles.FONTS.PAYMENT_OVERLAY_CLOSE_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.addChild(a);
a.setOpacity(0);
a.setVisible(!1);
a.runAction(new cc.Sequence(new cc.DelayTime(PaymentOverlay.CLOSE_AVAILABLE / 1E3),new cc.Show,new cc.FadeIn(.3)))
},
startCancel: function() {
this.text.setVisible(!1);
this.closeText.setVisible(!1);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PAYMENTS_TERMINATED);
this.showLoading();
var a = PaymentOverlay.CANCEL_DURATION / 1E3;
"validate" === connector.payments.getPurchaseState() && (a += 5);
this.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.CallFunc(function() {
this.hideLoading();
connector.payments.stopCurrentPurchase()
}
.bind(this))))
},
onEnter: function() {
this._super();
console.log("PaymentsManager overlay created")
},
onExit: function() {
this._super();
console.log("PaymentsManager overlay closed")
}
});
PaymentOverlay.initialize = function() {
var a = "15 seconds"
, b = "10 seconds";
connector.payments.oneOf(connector.MM) && connector.info.os === connector.OS_IOS && (a = "5 seconds");
connector.platform.oneOf(connector.CLEVERAPPS, connector.MSSTART) && (a = "30 seconds");
connector.platform.oneOf(connector.IOS, connector.MACOS) && (a = "30 seconds",
b = "20 seconds");
connector.payments.oneOf(connector.YOOKASSA) && (a = "5 seconds",
b = "2 seconds");
connector.platform.oneOf(connector.DRAUGIEM) && (a = "4 seconds",
b = "5 seconds");
PaymentOverlay.SHOW_TIMEOUT = cleverapps.parseInterval("4 seconds");
PaymentOverlay.CLOSE_AVAILABLE = cleverapps.parseInterval(a);
PaymentOverlay.CANCEL_DURATION = cleverapps.parseInterval(b)
}
;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PAYMENT_OVERLAY_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
PAYMENT_OVERLAY_CLOSE_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.PaymentOverlay = {
text: {
x: {
align: "center"
},
y: {
align: "center"
}
},
closeText: {
x: {
align: "center"
},
y: {
align: "center",
dy: -100
}
}
};
var BaseProductTile = cc.Node.extend({
ctor: function(a, b, c) {
this._super();
this.tileModel = a;
this.styles = b;
this.options = c || {};
this.setAnchorPoint(.5, .5);
this.setContentSize2(b.width, b.height);
this.addBackground();
this.addDecorators();
this.updateTileState();
this.tileModel.onGetView = this.createListener(function() {
return this
}
.bind(this));
this.tileModel.onUpdateTileModel = this.createListener(this.updateTileState.bind(this));
this.tileModel.onBuyVideoProduct = this.createListener(this.buyVideoProduct.bind(this));
this.tileModel.onUpdateAvailability = this.createListener(this.updateAvailability.bind(this))
},
onExit: function() {
if (this.tileModel.onExit)
this.tileModel.onExit()
},
buyVideoProduct: function() {
this.button.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.2),new cc.CallFunc(function() {
this.button.updateText()
}
,this),new cc.ScaleTo(.3,1)))
},
updateAvailability: function() {
this.tileModel.isAvailable() ? (this.button && this.button.enable(),
this.icon && this.icon.enable(),
this.tileBadge && this.tileBadge.enable()) : (this.button && this.button.disable(),
this.icon && this.icon.disable(),
this.tileBadge && this.tileBadge.disable());
this.titleBg && this.titleBg.setSpriteFrame(this.getTitleImage());
this.options.onClicked && !this.options.noTileClick && (this.clickHandler && (this.clickHandler.remove(),
this.clickHandler = void 0),
this.tileModel.isAvailable() && (this.clickHandler = cleverapps.UI.onClick(this, function() {
cleverapps.audio.playSound(bundles.main.urls.click_effect);
this.options.onClicked(this.tileModel)
}
.bind(this))))
},
addFinger: function() {
this.finger = FingerView.hintClick(this.button)
},
removeFinger: function() {
FingerView.remove(this.finger);
this.finger = void 0
},
updateTileState: function() {
this.content && this.content.removeFromParent();
this.content = this.createContent();
this.addChild(this.content);
this.tileBadge && this.tileBadge.removeFromParent();
(this.tileBadge = this.createBadge()) && this.addChild(this.tileBadge);
this.updateAvailability()
},
addBackground: function() {
var a = this.styles.background;
a = cleverapps.UI.createScale9Sprite(a.tileBg || bundles.tile_shop.frames.shop_tile_bg_png, a.adjustBackgroundCapInsets ? cleverapps.UI.Scale9Rect.TwoPixelXY : cleverapps.UI.Scale9Rect.Default);
a.setContentSize2(this.width, this.height);
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a)
},
addDecorators: function() {
var a = this.styles.decorators;
a && a.forEach(function(b) {
if (!b.filter || b.filter(this.tileModel)) {
var c = cleverapps.UI.createScale9Sprite(b.image, cleverapps.UI.Scale9Rect.TwoPixelXY);
b.type === Decors.TYPE_SCALE9 && c.setContentSize2(b.width || c.width, b.height || c.height);
c.setPositionRound(b);
c.setLocalZOrder(b.zOrder || 0);
if (b.content) {
var d = b.content.generator(this.tileModel.product);
c.addChild(d);
d.setPositionRound(b.content)
}
b.fitToBox && cleverapps.UI.fitToBox(c, b.fitToBox);
this.addChild(c)
}
}, this)
},
createBadge: function() {
var a = this.tileModel.getBadge();
if (a)
return a = new TileBadge(a),
a.setPositionRound(this.styles.badge),
a.setLocalZOrder(2),
a.setScale(this.styles.badge.scale),
this.tileModel.isAvailable() || a.disable(),
a
},
createContent: function() {
var a = this.styles
, b = this.createLimit();
this.icon = this.createIcon();
var c = this.wrapIconWithBg(this.icon)
, d = this.wrapTitleWithBg(this.createTitle())
, e = this.createDescription()
, f = this.button = this.createButton()
, g = [b, c, d, e, f];
a.content.order === BaseProductTile.ORDER.TITLE_TOP ? g = [b, d, c, e, f] : a.content.order === BaseProductTile.ORDER.TITLE_BOTTOM && (g = [b, c, e, d, f]);
g = new cleverapps.Layout(g.filter(Boolean),{
direction: cleverapps.UI.VERTICAL,
margin: a.content.margin
});
g.setAnchorPoint(.5, .5);
g.setPositionRound(this.options.contentOffset || a.content);
g.setLocalZOrder(1);
b && b.setPositionRound(b.x, b.y + a.limit.y);
c && c.setPositionRound(c.x, c.y + a.icon.y);
d && d.setPositionRound(d.x + a.title.x, d.y + a.title.y);
e && e.setPositionRound(e.x + a.description.x, e.y + a.description.y);
f && f.setPositionRound(f.x, f.y + a.button.y);
return g
},
createIcon: function() {
var a = new TileIcon(this.tileModel,{
animationOverride: this.options.iconAnimationOverride,
skipScale: this.options.iconSkipScale,
zOrder: this.options.iconZOrder
});
this.tileModel.isAvailable() || a.disable();
return a
},
createLimit: function() {
var a = this.tileModel.getProductLimit();
if (a) {
var b = this.styles.limit
, c = cleverapps.styles.FONTS.PRODUCT_TILE_LIMIT_TEXT;
if (a.countdown) {
var d = cleverapps.UI.generateOnlyText("TileShop.tile.leftTime", c);
a = new cleverapps.CountDownView(new cleverapps.CountDown(a.countdown,{
onFinish: this.tileModel.updateModelState.bind(this.tileModel)
}),{
font: c
});
return new cleverapps.Layout([d, a].filter(Boolean),{
direction: cleverapps.UI.VERTICAL,
dimensions: b
})
}
if (a.left)
return d = cleverapps.UI.generateOnlyText(a.left, c),
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
d.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),
d.setDimensions(b.width, b.height),
d
}
},
createDescription: function() {},
wrapIconWithBg: function(a) {
if (!bundles.tile_shop.frames.icon_bg)
return a;
var b = this.styles.icon.bg
, c = new cc.Scale9Sprite(bundles.tile_shop.frames.icon_bg);
c.setContentSize2(b);
c.setAnchorPoint(.5, .5);
c.setLocalZOrder(-1);
c.addChild(a);
a.setPositionRound(b);
return c
},
getTitleImage: function() {
var a = this instanceof PackProductTile && bundles.tile_shop.frames.pack_shop_title || bundles.tile_shop.frames.shop_title;
this.tileModel.isAvailable() || (a = this instanceof PackProductTile && bundles.tile_shop.frames.pack_shop_title_off || bundles.tile_shop.frames.shop_title_off);
return a
},
createTitle: function() {
if (this.styles.title) {
var a = cleverapps.styles.FONTS.SHOP_WINDOW_SMALL_TILE_TITLE
, b = this.tileModel.getTitle();
cleverapps.UI.ImageFont.IsApplicable(cleverapps.styles.FONTS.SHOP_WINDOW_TILE_TITLE, b) && (a = cleverapps.styles.FONTS.SHOP_WINDOW_TILE_TITLE);
var c = this.tileModel.getRewardsIcon();
return new TextWithIcon((c ? "%%" : "") + b,{
font: a,
icons: {
"%%": c
}
})
}
},
wrapTitleWithBg: function(a) {
if (a) {
var b = this.styles.title
, c = this.titleBg = cleverapps.UI.createScale9Sprite(this.getTitleImage());
c.setAnchorPoint(.5, .5);
c.setLocalZOrder(b.zOrder);
c.setContentSize2(b.width || c.width, b.height || c.height);
a.fitTo && a.fitTo(.9 * c.width);
a.setPositionRound(b.text);
c.addChild(a);
return c
}
},
createRewards: function(a) {
var b = (new RewardsList(this.tileModel.getReward())).listRewards()[0]
, c = b.getText("merge" === cleverapps.config.type ? "" : "x")
, d = TextWithIcon.ICONS_BY_NAME[b.type] || "%%"
, e = this.tileModel.getRewardsIcon();
e && (d = "%%");
return new TextWithIcon(d + c,{
font: a,
icons: {
"%%": e || RewardTypes[b.type].getIcon()
}
})
},
createButton: function() {
if (this.styles.button && !this.options.noButton) {
var a = new TileButton(this.tileModel,{
onClicked: function() {
this.removeFinger();
this.options.onClicked.apply(this, arguments)
}
.bind(this)
});
a.setLocalZOrder(1);
this.tileModel.isAvailable() || a.disable();
return a
}
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
SHOPTILE_LEFT: {
size: 32,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
}
});
BaseProductTile.ORDER = {
DEFAULT: 0,
TITLE_TOP: 1,
TITLE_BOTTOM: 2
};
cleverapps.styles.BaseProductTile = {
width: 444,
height: 747,
background: {},
badge: {
x: {
align: "left",
dx: -30
},
y: {
align: "top",
dy: 30
},
scale: 1
},
content: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
limit: {
width: 370,
height: 70,
y: 0
},
icon: {
y: 0,
bg: {
width: 370,
height: 320,
x: {
align: "center",
dx: 8
},
y: {
align: "center",
dy: 20
}
}
},
title: {
width: 480,
x: 0,
y: 0,
zOrder: 1,
text: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
content: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
description: {
width: 360,
height: 180,
y: 0,
x: 0,
bg: {
width: 494,
height: 120,
x: {
align: "center"
},
y: {
align: "center"
}
}
},
button: {
y: 0
}
};
var CoinsProductTile = BaseProductTile.extend({
ctor: function(a, b) {
var c = CoinsProductTile.styles = CoinsProductTile.styles || cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, cleverapps.styles.CoinsProductTile, !0);
this._super(a, c, b)
},
createTitle: function() {
if (this.styles.title)
return this.createRewards(cleverapps.styles.FONTS.TILE_SHOP_COINS_OFFER)
},
createDescription: function() {
if (this.styles.description)
return this.createRewards(cleverapps.styles.FONTS.TILE_SHOP_COINS_OFFER)
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PRODUCT_TILE_LIMIT_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.CoinsProductTile = {};
var PackProductTile = BaseProductTile.extend({
ctor: function(a, b) {
var c = PackProductTile.styles = PackProductTile.styles || cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, cleverapps.styles.PackProductTile, !0);
b = b || {};
this._super(a, c, b)
},
createDescription: function() {
if (this.styles.description) {
var a = this.styles.description
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a);
if (bundles.tile_shop.frames.description_bg) {
var c = cleverapps.UI.createScale9Sprite(bundles.tile_shop.frames.description_bg, cleverapps.UI.Scale9Rect.TwoPixelY);
c.setContentSize2(a.bg);
b.addChild(c);
c.setPositionRound(a.bg)
}
a = new TileRewardsBlock(this.tileModel,{
size: cc.size(this.styles.description),
font: cleverapps.styles.FONTS.PACK_TILE_REWARDS_TEXT,
icons: {},
paddingY: this.styles.description.paddingY
});
a.setPositionRound(b.width / 2, b.height / 2);
b.addChild(a);
return b
}
}
});
cleverapps.styles.PackProductTile = {};
var OfferProductTile = BaseProductTile.extend({
ctor: function(a, b) {
var c = OfferProductTile.styles = OfferProductTile.styles || cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, cleverapps.styles.OfferProductTile, !0);
b = b || {};
this._super(a, c, b)
},
wrapIconWithBg: function(a) {
if (this.styles.icon.bg)
return this._super(a);
var b = new cc.Node;
b.setContentSize2(a.width, a.height);
b.setAnchorPoint(.5, .5);
b.addChild(a);
a.setPositionRound(b.width / 2, b.height / 2 + this.styles.icon.offsetY);
return b
},
createDescription: function() {
var a = this.styles.description
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a);
if (a.bg) {
var c = cleverapps.UI.createScale9Sprite(bundles.tile_shop.frames.offer_description_bg, cleverapps.UI.Scale9Rect.TwoPixelY);
c.setContentSize2(a.bg);
b.addChild(c);
c.setPositionRound(a.bg)
}
a = new TileRewardsBlock(this.tileModel,{
size: cc.size(this.styles.description),
font: cleverapps.styles.FONTS.OFFER_TILE_REWARDS_TEXT,
icons: {},
paddingY: this.styles.description.paddingY
});
a.setPositionRound(b.width / 2, b.height / 2);
b.addChild(a);
return b
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
OFFER_TILE_REWARDS_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE
}
});
cleverapps.styles.OfferProductTile = {
width: 460,
height: 747,
icon: {
offsetY: -40,
bg: void 0
},
content: {
y: {
align: "bottom",
dy: 75
},
margin: 0
},
description: {
width: 370,
y: 20,
paddingY: -30,
bg: {
width: 370,
height: 174,
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
title: {
y: 20,
text: {
y: {
align: "center",
dy: 6
}
},
size: {
width: 480
}
}
};
var SoftCurrencyTile = BaseProductTile.extend({
ctor: function(a, b) {
var c = SoftCurrencyTile.styles = SoftCurrencyTile.styles || cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, cleverapps.styles.SoftCurrencyTile, !0);
b = b || {};
b.noTileClick = !0;
b.iconSkipScale = !0;
b.iconAnimationOverride = a.product.animation ? {
json: bundles.tile_shop.jsons.shop_lives_animations_json,
delay: 0
} : {};
this._super(a, c, b)
},
createTitle: function() {
return this.createRewards(cleverapps.styles.FONTS.TILE_SHOP_COINS_OFFER)
}
});
cleverapps.styles.SoftCurrencyTile = {};
var SubscriptionTile = BaseProductTile.extend({
ctor: function(a, b) {
var c = SubscriptionTile.styles = SubscriptionTile.styles || cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, cleverapps.styles.SubscriptionTile, !0);
b = b || {};
b.onClicked = this.onClick.bind(this);
b.iconZOrder = c.icon.zOrder;
this._super(a, c, b)
},
createDescription: function() {
var a = this.styles.description
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a);
if (bundles.tile_shop.frames.prem_rewards_bg) {
var c = cleverapps.UI.createScale9Sprite(bundles.tile_shop.frames.prem_rewards_bg, cleverapps.UI.Scale9Rect.TwoPixelY);
c.setContentSize2(a);
b.addChild(c);
c.setPositionRound(b.width / 2, b.height / 2);
this.tileModel.isAvailable() || (c.setOpacity(160),
c.setColor(new cc.Color(200,200,200,255)))
}
c = this.tileModel.getDescription();
var d = cleverapps.subscription.getLeftTime();
c.title ? (c = cleverapps.UI.generateOnlyText(c.title, cleverapps.styles.FONTS.TILE_REWARDS_HEADER),
c.setDimensions(a.NATextWidth, 0),
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
c.fitTo(void 0, .9 * b.height)) : c = d ? this.createTimer(d) : new TileRewardsBlock(this.tileModel,{
size: this.styles.description,
font: cleverapps.styles.FONTS.TILE_REWARDS,
columns: "tripeaks" === cleverapps.config.name ? 3 : 2,
icons: {
treasure: bundles.reward_icons.frames.treasure_chest_png
}
});
c.setPositionRound(a.content);
b.addChild(c);
return b
},
getTitleImage: function() {
return bundles.tile_shop.frames.prem_title_bg || BaseProductTile.prototype.getTitleImage.call(this)
},
createIcon: function() {
var a = this._super();
if (this.tileModel.isAvailable()) {
var b = new cleverapps.Spine(bundles.tile_shop.jsons.shop_sparkles_large_json);
b.setAnimation(0, "animation", !0);
a.icon.addChild(b, cleverapps.styles.SubscriptionTile.icon.animation.zOrder);
b.setPositionRound(a.icon.width / 2, a.icon.height / 2)
}
return a
},
createTimer: function(a) {
var b = this.styles.description;
a = new cleverapps.CountDownView(new cleverapps.CountDown(a,{
onFinish: this.tileModel.updateModelState.bind(this.tileModel)
}),{
font: cleverapps.styles.FONTS.TILE_REWARDS
});
var c = new cc.Sprite(bundles.timer.frames.timer_png);
c.setScale(b.timer.scale);
a = new cleverapps.Layout([c, a],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.timer.margin
});
c = cleverapps.UI.generateOnlyText("TileShop.subscription.next", cleverapps.styles.FONTS.TILE_REWARDS_HEADER);
c.fitTo(b.text.width);
return new cleverapps.Layout([c, a],{
margin: b.margin,
direction: cleverapps.UI.VERTICAL
})
},
onClick: function() {
this.removeFinger();
cleverapps.subscription.isRewardReady() ? cleverapps.subscription.receiveReward() : new SubscriptionWindow;
this.tileModel.onClaim()
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TILE_REWARDS: {
name: "default",
size: 45,
color: cleverapps.styles.COLORS.WHITE
},
TILE_REWARDS_HEADER: {
name: "default",
size: 35,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.styles.SubscriptionTile = {
background: {
adjustBackgroundCapInsets: !0,
tileBg: bundles.tile_shop.frames.prem_tile_bg
},
description: {
width: 360,
height: 180,
margin: 0,
rewardsMargin: {
x: 5,
y: 5
},
amountMargin: 0,
content: {
x: {
align: "center"
},
y: {
align: "center"
}
},
NATextWidth: 300,
timer: {
margin: 10,
scale: 1.3
},
text: {
width: 350
}
},
icon: {
zOrder: -1,
animation: {
zOrder: -1
}
}
};
var GrowthFundTile = BaseProductTile.extend({
ctor: function(a, b) {
var c = GrowthFundTile.styles = GrowthFundTile.styles || cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, cleverapps.styles.GrowthFundTile, !0);
b = b || {};
b.onClicked = this.onClick.bind(this);
b.iconZOrder = c.icon.zOrder;
b.iconSkipScale = !0;
this._super(a, c, b)
},
createDescription: function() {
var a = this.styles.description
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a);
if (bundles.tile_shop.frames.prem_rewards_bg) {
var c = cleverapps.UI.createScale9Sprite(bundles.tile_shop.frames.prem_rewards_bg, cleverapps.UI.Scale9Rect.TwoPixelY);
c.setContentSize2(a);
b.addChild(c);
c.setPositionRound(b.width / 2, b.height / 2);
this.tileModel.isAvailable() || (c.setOpacity(160),
c.setColor(new cc.Color(200,200,200,255)))
}
c = cleverapps.UI.generateOnlyText(this.tileModel.getProductDescription(), cleverapps.styles.FONTS.TILE_REWARDS);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setDimensions(a.text.width, 0);
c.fitTo(void 0, a.text.height);
b.addChild(c);
c.setPositionRound(a.text);
return b
},
getTitleImage: function() {
return bundles.tile_shop.frames.prem_title_bg || BaseProductTile.prototype.getTitleImage.call(this)
},
createIcon: function() {
var a = this._super();
if (this.tileModel.isAvailable()) {
var b = new cleverapps.Spine(bundles.tile_shop.jsons.shop_sparkles_large_json);
b.setAnimation(0, "animation", !0);
a.icon.addChild(b, cleverapps.styles.GrowthFundTile.icon.animation.zOrder);
b.setPositionRound(a.icon.width / 2, a.icon.height / 2)
}
return a
},
onClick: function() {
new GrowthFundWindow
}
});
cleverapps.styles.GrowthFundTile = {
width: 460,
content: {
margin: 10
},
background: {
adjustBackgroundCapInsets: !0,
tileBg: bundles.tile_shop.frames.prem_tile_bg
},
icon: {
zOrder: -1,
animation: {
zOrder: -1
}
},
description: {
height: 130,
width: 380,
text: {
width: 325,
height: 90,
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
button: {
txtWidth: 165,
txtHeight: 75
}
};
var TileModel = function(a) {
this.product = a;
this.onUpdateTileModel = function() {}
;
this.onGetView = function() {}
;
this.onBuyVideoProduct = function() {}
;
this.onUpdateAvailability = function() {}
;
cleverapps.focusManager.showControlsWhileFocused(this.getCurrencyControl());
if (this.product.videoProduct)
cleverapps.rewardedAdsManager.onRewardedRefresh(this.updateAvailability.bind(this), this);
else
cleverapps.paymentsLogic.onChangeStatus(this.updateAvailability.bind(this), this)
};
TileModel.prototype.onExit = function() {
runCleaners(this)
}
;
TileModel.prototype.getCurrencyControl = function() {
return "hard" === this.product.currency ? "MenuBarGoldItem" : "soft" === this.product.currency ? "MenuBarCoinsItem" : []
}
;
TileModel.prototype.currentVideoProgress = function() {
return cleverapps.dataLoader.load(DataLoader.TYPES.PRODUCT_VIDEO_PROGRESS + this.product.itemId) || 0
}
;
TileModel.clearVideoProgress = function(a) {
return cleverapps.dataLoader.remove(DataLoader.TYPES.PRODUCT_VIDEO_PROGRESS + a.itemId)
}
;
TileModel.prototype.updateModelState = function() {
this.onUpdateTileModel()
}
;
TileModel.prototype.updateAvailability = function() {
this.onUpdateAvailability()
}
;
TileModel.prototype.getCurrentPrice = function() {
return this.product.videoProduct ? "##" + this.currentVideoProgress() + "/" + this.product.videoPrice : this.product.getCurrentPrice()
}
;
TileModel.prototype.isAttention = function() {
return this.isAvailable() && this.product.attention
}
;
TileModel.prototype.getTitle = function() {
return this.product.title
}
;
TileModel.prototype.getDescription = function() {
return this.product.description
}
;
TileModel.prototype.getPrice = function() {
return this.product.price
}
;
TileModel.prototype.getItemId = function() {
return this.product.itemId
}
;
TileModel.prototype.getIcon = function() {
return this.product.getIcon()
}
;
TileModel.prototype.getViewClassName = function() {
return this.product.ViewClassName || this.product.getViewClassName && this.product.getViewClassName() || CoinsProductTile
}
;
TileModel.prototype.getProductDescription = function() {}
;
TileModel.prototype.getProductLimit = function() {}
;
TileModel.prototype.getRewardsIcon = function() {
return cleverapps.skins.getSlot(this.product.rewardsIcon) || bundles.reward_icons.frames[this.product.rewardsIcon]
}
;
TileModel.prototype.getReward = function() {
return this.product.reward
}
;
TileModel.prototype.getButtonText = function() {
return 0 === this.getPrice() ? "FREE" : this.getCurrentPrice()
}
;
TileModel.prototype.isEnabled = function() {
return "unlimitedLives" === this.product.itemId ? cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR : "energyLottery" === this.product.itemId ? void 0 !== Game.currentGame.energyLottery : !0
}
;
TileModel.prototype.checkDisabledProducts = function() {
if (this.product.disableProductIds)
for (var a = 0; a < this.product.disableProductIds.length; ++a) {
var b = TileModel.Create(Product.CreateById(this.product.disableProductIds[a]));
if (b.isEnabled() && b.isAvailable())
return !1
}
return !0
}
;
TileModel.prototype.buyVideoProduct = function(a) {
var b = AdsLimits.TYPES.PRODUCT;
"undefined" !== typeof UnitsShopTileModel && this instanceof UnitsShopTileModel && (b = AdsLimits.TYPES.CINEMA);
cleverapps.rewardedAdsManager.playRewarded(b, function() {
this.incVideoProduct(a)
}
.bind(this))
}
;
TileModel.prototype.incVideoProduct = function(a) {
var b = this.currentVideoProgress();
b++;
if (b >= this.product.videoPrice) {
b = 0;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.VIDEO_PRODUCT_BUY);
if (this.product.onBuyed)
this.product.onBuyed();
a()
}
cleverapps.dataLoader.save(DataLoader.TYPES.PRODUCT_VIDEO_PROGRESS + this.product.itemId, b);
this.onBuyVideoProduct()
}
;
TileModel.prototype.buy = function(a) {
if (this.product.videoProduct)
this.buyVideoProduct(a);
else
return this.product.buy(function(b) {
b && (this.product.logBuyItem(),
a())
}
.bind(this))
}
;
TileModel.prototype.isAvailable = function() {
return this.product.videoProduct ? cleverapps.rewardedAdsManager.isRewardedAvailable() : this.product instanceof VirtualProduct ? !0 : connector.payments.isConnected()
}
;
TileModel.prototype.wantsScroll = function() {
return this.badge
}
;
TileModel.prototype.getBadge = function() {
if (cleverapps.clans && Clans.IsAvailable() && this.product.clanGift && !this.product.videoProduct && !(this instanceof SubscriptionTileModel && cleverapps.subscription.isActive() || this instanceof GrowthFundTileModel && cleverapps.growthFund && cleverapps.growthFund.isBought()))
return {
icon: new cc.Sprite(bundles.reward_icons.frames.clan_gift_png),
tooltipText: "ClanGift.Text"
};
if (this.badge)
return this.badge;
if (this.product.discount)
return {
type: "discount",
text: this.product.discount
};
if (this.product.value)
return {
type: "value",
value: this.product.value
};
if (this.product.badge)
return {
text: this.product.badge
}
}
;
TileModel.prototype.getView = function() {
return this.onGetView()
}
;
TileModel.Create = function(a) {
var b = TileModel;
if (a.TileModelClass || a.getTileModelClass)
b = a.TileModelClass || a.getTileModelClass();
return new b(a)
}
;
var SoftCurrencyTileModel = function(a) {
cleverapps.flags.softCurrencyRealProduct && (a = Product.CreateById(a.realProductId),
this.realProduct = !0);
TileModel.call(this, a)
};
SoftCurrencyTileModel.prototype = Object.create(TileModel.prototype);
SoftCurrencyTileModel.prototype.constructor = SoftCurrencyTileModel;
SoftCurrencyTileModel.prototype.getTitle = function() {
return this.realProduct ? this.product.title : Messages.getLocalized(this.product.title, {
amount: this.getReward()
})
}
;
SoftCurrencyTileModel.prototype.buy = function(a) {
if (this.realProduct)
return this.product.buy(function(c) {
c && (this.product.logBuyItem(),
a())
}
.bind(this));
if (levels.user.spendHard(cleverapps.EVENTS.SPENT.SOFT, this.getPrice())) {
var b = this.getReward();
this.product.logBuyItem();
cleverapps.focusManager.display({
stack: !0,
focus: "SoftCurrencyRewardWindow",
action: function(c) {
new RewardWindow(b,{
event: cleverapps.EVENTS.EARN.PURCHASE
});
cleverapps.focusManager.onceNoWindowsListener = c
}
});
a();
return !0
}
return !1
}
;
var BuyEnergyTileModel = function(a) {
TileModel.call(this, a);
this.timeout = this.product.timeout || 0;
this.buyTimeEnergyProducts = cleverapps.dataLoader.load(DataLoader.TYPES.ENERGY_PRODUCTS) || {};
cleverapps.config.debugMode && this.timeout && (this.timeout = cleverapps.parseInterval("5 minutes"))
};
BuyEnergyTileModel.prototype = Object.create(TileModel.prototype);
BuyEnergyTileModel.prototype.constructor = BuyEnergyTileModel;
BuyEnergyTileModel.prototype.getTitle = function() {
return Messages.getLocalized(this.product.title, {
restoreAmount: this.getRestoreAmount()
})
}
;
BuyEnergyTileModel.prototype.isEnabled = function() {
return this.isAvailable() ? this.checkDisabledProducts() : !0
}
;
BuyEnergyTileModel.prototype.getRestoreAmount = function() {
return this.product.reward
}
;
BuyEnergyTileModel.prototype.isAvailable = function() {
return 0 === this.product.price || Date.now() >= this.getNextBuyTime()
}
;
BuyEnergyTileModel.prototype.getBadge = function() {
if (this.badge)
return this.badge;
if (this.product.price && this.product.discount)
return {
type: "discount",
text: this.product.discount
}
}
;
BuyEnergyTileModel.prototype.getProductDescription = function() {
return {
text: "BuyEnergyProduct.description",
countdown: Math.max(0, this.getNextBuyTime() - Date.now())
}
}
;
BuyEnergyTileModel.prototype.getNextBuyTime = function() {
return this.timeout + (this.buyTimeEnergyProducts[this.product.itemId + cleverapps.lives.slot] || 0)
}
;
BuyEnergyTileModel.prototype.buy = function(a) {
return this.isAvailable() ? cleverapps.user.spendSoft(cleverapps.EVENTS.SPENT.LIVES, this.product.price, {
source: this.onGetView()
}) ? (0 !== this.product.price && this.timeout && (this.buyTimeEnergyProducts[this.product.itemId + cleverapps.lives.slot] = Date.now(),
cleverapps.dataLoader.save(DataLoader.TYPES.ENERGY_PRODUCTS, this.buyTimeEnergyProducts)),
this.product.logBuyItem(),
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce(),
new RewardWindow({
energy: this.getRestoreAmount()
},{
event: "buy_soft",
softPrice: this.product.price
}),
a(),
!0) : !1 : !1
}
;
var EnergyLotteryTileModel = function(a) {
TileModel.call(this, a);
Game.currentGame.energyLottery && Game.currentGame.energyLottery.isAvailable() && (Game.currentGame.energyLottery.onLotteryTileChanged = this.updateModelState.bind(this))
};
EnergyLotteryTileModel.prototype = Object.create(TileModel.prototype);
EnergyLotteryTileModel.prototype.constructor = EnergyLotteryTileModel;
EnergyLotteryTileModel.prototype.getTitle = function() {
return Messages.getLocalized(this.product.title, {
restoreAmount: Game.currentGame.energyLottery.maxValue()
})
}
;
EnergyLotteryTileModel.prototype.getCurrentPrice = function() {
return "Claim"
}
;
EnergyLotteryTileModel.prototype.getButtonText = function() {
return Game.currentGame.energyLottery.isAvailable() ? this.isAvailable() ? "Claim" : "Claimed" : Messages.get("TileShop.tile.level", {
level: cleverapps.humanReadableNumber({
floatLevel: EnergyLottery.AVAILABLE.level
})
})
}
;
EnergyLotteryTileModel.prototype.isAvailable = function() {
return Game.currentGame.energyLottery && Game.currentGame.energyLottery.isReady()
}
;
EnergyLotteryTileModel.prototype.getProductDescription = function() {
return {
text: "EnergyLotteryProduct.description",
countdown: Game.currentGame.energyLottery.getTimeLeft()
}
}
;
EnergyLotteryTileModel.prototype.buy = function() {
if (!this.isAvailable())
return !1;
-1 !== ["wondermerge", "fairy", "hustlemerge"].indexOf(cleverapps.config.name) ? new WheelLotteryWindow(Game.currentGame.energyLottery) : new EnergyLotteryWindow(Game.currentGame.energyLottery);
return !0
}
;
var LimitedVideoTileModel = function(a) {
TileModel.call(this, a);
this.baseReward = cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_ADS && this.product.mainMonetizationReward || this.product.reward;
"function" === typeof this.baseReward && (this.baseReward = this.baseReward());
this.adsLimit = this.product.adsLimit();
cleverapps.adsLimits.on("update", this.updateModelState.bind(this), this)
};
LimitedVideoTileModel.prototype = Object.create(TileModel.prototype);
LimitedVideoTileModel.prototype.constructor = LimitedVideoTileModel;
LimitedVideoTileModel.prototype.getTitle = function() {
var a = this.baseReward.hard || this.baseReward.soft || this.baseReward.lives || this.baseReward.energy;
return Array.isArray(a) ? Messages.getLocalized(this.product.title, {
minAmount: a[0],
maxAmount: a[1]
}) : Messages.getLocalized(this.product.title, {
restoreAmount: a
})
}
;
LimitedVideoTileModel.prototype.processReward = function(a) {
return Array.isArray(a) ? cleverapps.Random.random(a[0], a[1]) : a
}
;
LimitedVideoTileModel.prototype.isEnabled = function() {
return this.product.free ? !0 : cleverapps.rewardedAdsManager.isEnabled()
}
;
LimitedVideoTileModel.prototype.isAvailable = function() {
return cleverapps.adsLimits.state(this.adsLimit) === AdsLimits.STATE_READY
}
;
LimitedVideoTileModel.prototype.getReward = function() {
return this.baseReward
}
;
LimitedVideoTileModel.prototype.getButtonText = function() {
return cleverapps.adsLimits.state(this.adsLimit) === AdsLimits.STATE_UNAVAILABLE ? Messages.get("TileShop.tile.level", {
level: cleverapps.adsLimits.getLimitLevel(this.adsLimit)
}) : 0 === this.getPrice() ? "FREE" : this.getCurrentPrice()
}
;
LimitedVideoTileModel.prototype.getCurrentPrice = function() {
return this.product.free ? "FREE" : "##Watch"
}
;
LimitedVideoTileModel.prototype.getProductLimit = function() {
if (-1 === [AdsLimits.STATE_UNAVAILABLE, AdsLimits.STATE_LIMITED].indexOf(cleverapps.adsLimits.state(this.adsLimit)))
var a = Messages.getLocalized("TileShop.tile.left", {
amount: cleverapps.adsLimits.getLimitLeftCount(this.adsLimit)
});
if (cleverapps.adsLimits.state(this.adsLimit) === AdsLimits.STATE_LIMITED)
var b = cleverapps.adsLimits.getLimitLeftTime(this.adsLimit);
return {
left: a,
countdown: b
}
}
;
LimitedVideoTileModel.prototype.getProductDescription = function() {
if ("merge" !== cleverapps.config.type)
return {
reward: !0
};
if (cleverapps.adsLimits.state(this.adsLimit) === AdsLimits.STATE_LIMITED)
var a = cleverapps.adsLimits.getLimitLeftTime(this.adsLimit);
return {
text: this.product.description,
countdown: a
}
}
;
LimitedVideoTileModel.prototype.buy = function() {
var a = function() {
cleverapps.adsLimits.watch(this.adsLimit);
cleverapps.audio.playSound(bundles.main.urls.shop_buy_effect);
var b = {};
this.baseReward.hard && (b.hard = this.processReward(this.baseReward.hard));
this.baseReward.soft && (b.soft = this.processReward(this.baseReward.soft));
this.baseReward.lives && (b.lives = this.processReward(this.baseReward.lives));
this.baseReward.energy && (b.energy = this.processReward(this.baseReward.energy));
cleverapps.focusManager.display({
stack: !0,
focus: "energyRewardWindow",
action: function(c) {
new RewardWindow(b,{
event: cleverapps.EVENTS.EARN.VIDEO
});
cleverapps.focusManager.onceNoWindowsListener = c
}
})
}
.bind(this);
this.product.free ? a() : cleverapps.rewardedAdsManager.playRewarded(this.adsLimit, a)
}
;
var SubscriptionTileModel = function(a) {
TileModel.call(this, a);
this.onClaim = function() {}
;
if (cleverapps.subscription)
cleverapps.subscription.on("update", this.updateModelState.bind(this), this)
};
SubscriptionTileModel.prototype = Object.create(TileModel.prototype);
SubscriptionTileModel.prototype.constructor = SubscriptionTileModel;
SubscriptionTileModel.prototype.getReward = function() {
var a = cleverapps.clone("instant" === connector.info.source && RewardsConfig.SubscriptionInstant || RewardsConfig.Subscription, !0);
a.worker && a.worker.subscription && !a.worker.amount && (a.worker.amount = 1);
return a
}
;
SubscriptionTileModel.prototype.getTitle = function() {
return Messages.get("TileShop.subscription.title")
}
;
SubscriptionTileModel.prototype.getViewClassName = function() {
return SubscriptionTile
}
;
SubscriptionTileModel.prototype.getButtonText = function() {
return cleverapps.user.checkAvailable(Subscription.AVAILABLE) ? cleverapps.subscription.isActive() ? "Claim" : "TileShop.subscription.details" : Messages.get("TileShop.tile.level", {
level: cleverapps.humanReadableNumber({
floatLevel: Subscription.AVAILABLE.level
})
})
}
;
SubscriptionTileModel.prototype.isEnabled = function() {
return Subscription.IsAvailable() && cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition() && (cleverapps.subscription.isActive() || cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR)
}
;
SubscriptionTileModel.prototype.isAvailable = function() {
return cleverapps.subscription.isActive() ? !cleverapps.subscription.getLeftTime() : connector.payments.isConnected()
}
;
SubscriptionTileModel.prototype.isAttention = function() {
return cleverapps.subscription && cleverapps.subscription.needsAttention()
}
;
SubscriptionTileModel.prototype.isSmall = function() {
return !1
}
;
SubscriptionTileModel.prototype.getDescription = function() {
var a = {};
Subscription.IsAvailable() ? a.rewards = this.getReward() : a.title = "TileShop.subscription.reachLvl";
return a
}
;
SubscriptionTileModel.prototype.getRewardsIcon = function() {
return bundles.tile_shop.frames.prem_crown
}
;
var GrowthFundTileModel = function(a) {
TileModel.call(this, a);
cleverapps.growthFund.on("updateState", this.updateModelState.bind(this))
};
GrowthFundTileModel.prototype = Object.create(TileModel.prototype);
GrowthFundTileModel.prototype.constructor = GrowthFundTileModel;
GrowthFundTileModel.prototype.isAttention = function() {
return cleverapps.growthFund && cleverapps.growthFund.needsAttention()
}
;
GrowthFundTileModel.prototype.isEnabled = function() {
return cleverapps.growthFund && cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition() && (cleverapps.growthFund.isBought() || cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR)
}
;
GrowthFundTileModel.prototype.isAvailable = function() {
return connector.payments.isConnected() || cleverapps.growthFund.isBought() ? cleverapps.growthFund && cleverapps.growthFund.isActive() : !1
}
;
GrowthFundTileModel.prototype.getButtonText = function() {
return cleverapps.growthFund.isAvailable() ? cleverapps.growthFund.findFirst(GrowthFund.STATE.READY) && cleverapps.growthFund.isBought() ? "Claim" : "TileShop.growthFund.button" : Messages.get("TileShop.tile.level", {
level: cleverapps.humanReadableNumber({
floatLevel: GrowthFund.LEVELS.available
})
})
}
;
GrowthFundTileModel.prototype.getProductDescription = function() {
var a = void 0;
if (cleverapps.growthFund.isBought())
if (cleverapps.growthFund.findFirst(GrowthFund.STATE.READY))
var b = "TileShop.growthFund.ready";
else {
var c = cleverapps.growthFund.findFirst(GrowthFund.STATE.INSUFFICIENT);
c ? (b = "TileShop.growthFund.reachLevel",
a = {
level: c.levelNo + 1
}) : b = "TileShop.growthFund.allReceived"
}
else
b = "TileShop.growthFund.info";
return Messages.get(b, a)
}
;
GrowthFundTileModel.prototype.isSmall = function() {
return !1
}
;
GrowthFundTileModel.prototype.getRewardsIcon = function() {
if ("mergecraft" === cleverapps.config.name)
return bundles.tile_shop.frames.growth_key
}
;
var OfferTileModel = function(a) {
this.offer = a.offer;
this.shopIcon = a.shopIcon;
this.title = a.title;
this.reward = a.reward;
TileModel.call(this, a.product)
};
OfferTileModel.prototype = Object.create(TileModel.prototype);
OfferTileModel.prototype.constructor = OfferTileModel;
OfferTileModel.prototype.getViewClassName = function() {
return OfferProductTile
}
;
OfferTileModel.prototype.getIcon = function() {
return bundles.tile_shop.frames[this.shopIcon]
}
;
OfferTileModel.prototype.getTitle = function() {
return this.title
}
;
OfferTileModel.prototype.getReward = function() {
return this.reward
}
;
OfferTileModel.prototype.wantsScroll = function() {
return !0
}
;
OfferTileModel.prototype.buy = function(a) {
return this.product.buy(function(b) {
b && (this.product.logBuyItem(),
cleverapps.eventLogger.logEvent(this.offer.name + "_" + cleverapps.EVENTS.OFFER_TILE_PURCHASE),
new RewardWindow(this.getReward(),{
event: cleverapps.EVENTS.EARN.PURCHASE
}),
this.offer.incStage && this.offer.incStage(),
this.offer.complete(),
a())
}
.bind(this), {
noRewardWindow: !0
})
}
;
var VirtualProducts = {
initialize: function() {
cleverapps.config.lives && (VirtualProducts.refillLives = {
icon: "refillLives_5_png",
title: "LivesShopWindow.products.refillLives",
spentEvent: cleverapps.EVENTS.SPENT.LIVES,
currency: "hard",
price: 99,
TileModelClass: RefillLivesTileModel,
ViewClassName: LivesProductTile
},
VirtualProducts.livesForVideo = {
icon: "lives_for_video_png",
title: "LivesShopWindow.products.livesForVideo",
description: "LivesForVideoProduct.description",
reward: {
lives: 1
},
adsLimit: function() {
return AdsLimits.TYPES.LIVES
},
TileModelClass: LimitedVideoTileModel,
ViewClassName: LivesProductTile
},
VirtualProducts.askLives = {
icon: "askLives_png",
title: "LivesShopWindow.products.askLives",
TileModelClass: AskLivesTileModel,
ViewClassName: LivesProductTile
},
"tile3" === cleverapps.config.type && (VirtualProducts.unlimitedLives = {
title: "UnlimitedLives.Title",
description: "UnlimitedLives.Description",
spentEvent: cleverapps.EVENTS.SPENT.LIVES,
currency: "hard",
price: 290,
reward: {
unlimitedLives: "3 days"
},
icon: "unlimitedLives_png",
animation: "animation",
ViewClassName: LivesProductTile,
TileModelClass: BuyLivesTileModel
},
VirtualProducts.buyLife = {
icon: "life_1_png",
title: "LivesShopWindow.products.buyLive",
spentEvent: cleverapps.EVENTS.SPENT.LIVES,
currency: "soft",
price: 249,
reward: {
lives: 1
},
TileModelClass: BuyLivesTileModel,
ViewClassName: LivesProductTile
}));
cleverapps.config.energy && (VirtualProducts.buyEnergy350 = {
icon: "energy_for_coins_png",
title: "LivesShopWindow.products.buyEnergy",
rewardsIcon: "shop_energy_png",
currency: "soft",
price: 350,
reward: 90,
discount: "66%",
timeout: cleverapps.parseInterval("24 hour"),
TileModelClass: BuyEnergyTileModel,
ViewClassName: LivesProductTile
},
VirtualProducts.buyEnergy700 = {
icon: "energy_for_coins_png",
title: "LivesShopWindow.products.buyEnergy",
rewardsIcon: "shop_energy_png",
currency: "soft",
price: 700,
reward: 90,
discount: "33%",
disableProductIds: ["buyEnergy350"],
timeout: cleverapps.parseInterval("24 hour"),
TileModelClass: BuyEnergyTileModel,
ViewClassName: LivesProductTile
},
VirtualProducts.buyEnergy = {
icon: "energy_for_coins_png",
title: "LivesShopWindow.products.buyEnergy",
rewardsIcon: "shop_energy_png",
currency: "soft",
price: 1050,
reward: 90,
disableProductIds: ["buyEnergy350", "buyEnergy700"],
TileModelClass: BuyEnergyTileModel,
ViewClassName: LivesProductTile
},
VirtualProducts.energyLottery = {
icon: "energy_lottery_png",
title: "LivesShopWindow.products.energyLottery",
attention: !0,
TileModelClass: EnergyLotteryTileModel,
ViewClassName: LivesProductTile
},
VirtualProducts.energyForVideo = {
icon: "energy_for_video_png",
title: "LivesShopWindow.products.energyForVideo",
description: "EnergyForVideoProduct.description",
rewardsIcon: "shop_energy_png",
reward: {
energy: 30
},
adsLimit: function() {
switch (cleverapps.lives && cleverapps.lives.slot) {
case CustomSyncers.EXPEDITION_SLOT1:
return AdsLimits.TYPES.ENERGY_1;
case CustomSyncers.EXPEDITION_SLOT2:
return AdsLimits.TYPES.ENERGY_2;
case CustomSyncers.EXPEDITION_SLOT3:
return AdsLimits.TYPES.ENERGY_3;
case CustomSyncers.EXPEDITION_SLOT4:
return AdsLimits.TYPES.ENERGY_4;
default:
return AdsLimits.TYPES.ENERGY
}
},
TileModelClass: LimitedVideoTileModel,
ViewClassName: LivesProductTile
},
VirtualProducts.energyForVideoShort = {
icon: "energy_for_video_png",
title: "LivesShopWindow.products.energyForVideoShort",
description: "EnergyForVideoProduct.description",
rewardsIcon: "shop_energy_png",
reward: {
energy: 5
},
adsLimit: function() {
switch (cleverapps.lives && cleverapps.lives.slot) {
case CustomSyncers.EXPEDITION_SLOT1:
return AdsLimits.TYPES.ENERGY_1_SHORT;
case CustomSyncers.EXPEDITION_SLOT2:
return AdsLimits.TYPES.ENERGY_2_SHORT;
case CustomSyncers.EXPEDITION_SLOT3:
return AdsLimits.TYPES.ENERGY_3_SHORT;
case CustomSyncers.EXPEDITION_SLOT4:
return AdsLimits.TYPES.ENERGY_4_SHORT;
default:
return AdsLimits.TYPES.ENERGY_SHORT
}
},
TileModelClass: LimitedVideoTileModel,
ViewClassName: LivesProductTile
});
VirtualProducts.softCurrencyVerySmall = {
icon: "shop_coins_very_small_png",
title: "LivesShopWindow.products.softCurrencyVerySmall",
rewardsIcon: "shop_coin_png",
realProductId: "coins350",
currency: "hard",
price: 80,
reward: {
soft: 350
},
TileModelClass: SoftCurrencyTileModel,
ViewClassName: SoftCurrencyTile
};
VirtualProducts.softCurrencySmall = {
icon: "shop_coins_small_png",
title: "LivesShopWindow.products.softCurrencySmall",
rewardsIcon: "shop_coin_png",
realProductId: "coins1100",
currency: "hard",
price: 250,
reward: {
soft: 1100
},
TileModelClass: SoftCurrencyTileModel,
ViewClassName: SoftCurrencyTile
};
VirtualProducts.softCurrencyMedium = {
icon: "shop_coins_medium_png",
title: "LivesShopWindow.products.softCurrencyMedium",
rewardsIcon: "shop_coin_png",
realProductId: "coins3000",
currency: "hard",
price: 600,
reward: {
soft: 3E3
},
TileModelClass: SoftCurrencyTileModel,
ViewClassName: SoftCurrencyTile
};
VirtualProducts.softCurrencyLarge = {
icon: "shop_coins_large_png",
title: "LivesShopWindow.products.softCurrencyLarge",
rewardsIcon: "shop_coin_png",
realProductId: "coins7000",
currency: "hard",
price: 1400,
reward: {
soft: 7E3
},
TileModelClass: SoftCurrencyTileModel,
ViewClassName: SoftCurrencyTile
};
VirtualProducts.hardForVideo = {
icon: "gold_for_video_png",
attention: !0,
title: "TileShop.products.hardForVideo",
rewardsIcon: !1 !== cleverapps.config.soft ? "shop_gold_png" : "reward_gold_png",
reward: {
hard: !1 !== cleverapps.config.soft ? [1, 3] : 10
},
mainMonetizationReward: {
hard: !1 !== cleverapps.config.soft ? [3, 8] : 10
},
adsLimit: function() {
return AdsLimits.TYPES.HARD
},
TileModelClass: LimitedVideoTileModel,
ViewClassName: CoinsProductTile
};
["mergecraft", "wondermerge", "fairy"].includes(cleverapps.config.name) && Object.assign(VirtualProducts, {
caravan0: {
order: 0,
title: "Caravan.Title0",
price: 349,
icon: bundles.caravan.frames.caravan_chest_0,
person: bundles.caravan.frames.caravan_person_0,
reward: {
unit: [{
code: "caravanbox",
stage: 0,
amount: 1
}, {
code: "energycup",
stage: 0,
amount: 1
}, {
code: "coinscup",
stage: 0,
amount: 1
}],
energy: 50,
soft: 100,
wands: 20
}
},
caravan1: {
order: 1,
title: "Caravan.Title1",
price: 699,
icon: bundles.caravan.frames.caravan_chest_1,
person: bundles.caravan.frames.caravan_person_1,
value: "+50%",
reward: {
unit: [{
code: "caravanbox",
stage: 1,
amount: 1
}, {
code: "energycup",
stage: 1,
amount: 1
}, {
code: "coinscup",
stage: 1,
amount: 1
}],
energy: 130,
soft: 250,
wands: 50
}
},
caravan2: {
order: 2,
title: "Caravan.Title2",
price: 1499,
icon: bundles.caravan.frames.caravan_chest_2,
person: bundles.caravan.frames.caravan_person_2,
value: "+100%",
reward: {
unit: [{
code: "caravanbox",
stage: 2,
amount: 1
}, {
code: "energycup",
stage: 2,
amount: 1
}, {
code: "coinscup",
stage: 2,
amount: 1
}],
energy: 400,
soft: 750,
wands: 130
}
}
});
"battlefield" === cleverapps.config.type && Object.assign(VirtualProducts, {
troops900: {
probabilities: [.5, .5, 0],
price: 900,
points: 1,
stage: 0
},
troops1900: {
probabilities: [.4, .59, .01],
price: 1900,
points: 2,
stage: 1
},
troops3800: {
probabilities: [.17, .8, .03],
price: 3800,
points: 3,
stage: 2
},
troops7500: {
probabilities: [.01, .93, .06],
price: 7500,
points: 4,
stage: 3
}
});
for (var a in VirtualProducts)
VirtualProducts[a].itemId = a;
"zenmatch" === cleverapps.config.name && (VirtualProducts.hardForVideo = void 0)
}
};
var Terms = cc.Node.extend({
ctor: function() {
this._super();
this.setAnchorPoint(.5, .5);
var a = new cc.Node;
a.setAnchorPoint(.5, .5);
a.addChild(cleverapps.UI.generateTTFText("Terms.TermsOfService", cleverapps.styles.FONTS.TERMS_LINK_TEXT));
cleverapps.UI.wrap(a);
this.addChild(a);
var b = cleverapps.UI.generateTTFText(" " + Messages.get("Terms.and") + " ", cleverapps.styles.FONTS.TERMS_TEXT);
this.addChild(b);
b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.addChild(cleverapps.UI.generateTTFText("Terms.PrivacyPolicy", cleverapps.styles.FONTS.TERMS_LINK_TEXT));
cleverapps.UI.wrap(b);
this.addChild(b);
cleverapps.UI.arrangeWithMargins(this.children, {
direction: cleverapps.UI.HORIZONTAL,
margin: cleverapps.styles.Terms.margin
});
cleverapps.UI.wrap(this);
cleverapps.UI.applyHover(a);
cleverapps.UI.applyHover(b);
cleverapps.UI.onClick(a, function() {
connector.platform.openUrl(Terms.TERMS_URL)
});
cleverapps.UI.onClick(b, function() {
connector.platform.openUrl(Terms.PRIVACY_URL)
})
}
});
cleverapps.overrideColors(cleverapps.styles.COLORS, {
TERMS_LINK_COLOR: new cc.Color(97,167,221,255),
TERMS_TEXT_COLOR: new cc.Color(55,80,58,255)
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TERMS_TEXT: {
size: 25,
color: cleverapps.styles.COLORS.TERMS_TEXT_COLOR
},
TERMS_LINK_TEXT: {
size: 25,
color: cleverapps.styles.COLORS.TERMS_LINK_COLOR
}
});
Terms.TERMS_URL = "https://cleverappssg.com/legal/terms.html";
Terms.PRIVACY_URL = "https://cleverappssg.com/legal/privacy.html";
cleverapps.styles.Terms = {
margin: 6
};
var Restore = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.parentWindow = a;
a = cleverapps.UI.generateOnlyText("RestorePurchases", cleverapps.styles.FONTS.TERMS_LINK_TEXT);
this.addChild(a);
cleverapps.UI.wrap(this);
cleverapps.UI.applyHover(this);
cleverapps.UI.onClick(this, this.onPressed.bind(this))
},
onPressed: function() {
var a, b, c = cleverapps.waitNoMore(5E3, function() {
a && (a.close(),
a = void 0,
b(),
b = void 0)
});
cleverapps.focusManager.focus({
stack: !0,
focus: "WaitRestoreSubscriptions",
action: function(d) {
a = new WaitWindow;
b = d
}
});
connector.payments.restoreSubscriptions();
cleverapps.subscription.on("update", this.createListener(function() {
c && c();
cleverapps.subscription.isActive() && (this.parentWindow.close(),
new SubscriptionWindow)
}
.bind(this)), this)
}
});
var SpPlatformButtons = cleverapps.Layout.extend({
ctor: function(a, b) {
this.buttonWidth = Math.min(a, cleverapps.styles.SpPlatformButtons.maxButtonWidth);
this.onClicked = b;
this._super(this.createItems(), {
direction: cleverapps.UI.VERTICAL,
margin: cleverapps.styles.SpPlatformButtons.buttonsMargin
})
},
createItems: function() {
return -1 === SpPlatformButtons.EASY_REGISTRATION_UNAVAILABLE.indexOf(cleverapps.config.name) ? this.createNewFormItems() : this.createOldFormItems()
},
createNewFormItems: function() {
var a = [];
connector.social.mobagePlatformLogin ? a.push(this.createOneButton("\u30b2\u30fc\u30e0\u3092\u59cb\u3081\u308b", this.createLink("\u540c\u610f\u4e8b\u9805\u7b49\uff08\u5fc5\u8aad)"))) : (a.push(this.createOneButton("\u30e2\u30d0\u30b2\u30fcID\u3067\u59cb\u3081\u308b", this.createLink("\u540c\u610f\u4e8b\u9805\u7b49\uff08\u5fc5\u8aad)"))),
a.push(this.createOneButton("\u65b0\u898f\u304b\u3093\u305f\u3093\u4f1a\u54e1\u3067\u59cb\u3081\u308b", this.createLink("\u4f1a\u54e1\u898f\u7d04\u7b49\uff08\u5fc5\u8aad)", !0), !0)));
return a
},
createOldFormItems: function() {
var a = [];
connector.social.mobagePlatformLogin ? a.push(this.createOneButton("\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb")) : a.push(this.createOneButton("\u30ed\u30b0\u30a4\u30f3"));
var b = cleverapps.UI.__generateNotLocalizedText("\u30b2\u30fc\u30e0\u3092\u30b9\u30bf\u30fc\u30c8\u3059\u308b\u306b\u306f" + (connector.social.mobagePlatformLogin ? "\u30b2\u30fc\u30e0\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb" : "\u30ed\u30b0\u30a4\u30f3") + "\u3057\u3066\u304f\u3060\u3055\u3044\u3002", cleverapps.styles.FONTS.BLACK_LINK_TEXT);
b.setDimensions(Math.min(cleverapps.styles.SpPlatformButtons.maxTextWidth, .7 * cleverapps.resolution.getSceneSize().width), 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.push(b);
return a
},
createOneButton: function(a, b, c) {
a = cleverapps.UI.__generateNotLocalizedText(a, cleverapps.styles.FONTS.BUTTON_TEXT);
a = new cleverapps.UI.Button({
content: a,
width: this.buttonWidth,
onClicked: function() {
this.onClicked({
registration: c
})
}
.bind(this)
});
b = [b, a].filter(function(d) {
d && (d.alwaysOn = !0);
return d
});
return new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: cleverapps.styles.SpPlatformButtons.linkMargin
})
},
createLink: function(a, b) {
a = cleverapps.UI.__generateNotLocalizedText(a, cleverapps.styles.FONTS.BLUE_LINK_TEXT);
var c = cleverapps.UI.__generateNotLocalizedText(" \u306b\u540c\u610f\u3057\u3066", cleverapps.styles.FONTS.BLACK_LINK_TEXT);
a = new cleverapps.Layout([a, c],{
direction: cleverapps.UI.HORIZONTAL,
margin: cleverapps.styles.SpPlatformButtons.textMargin
});
cleverapps.UI.applyHover(a);
cleverapps.UI.onClick(a, function() {
b ? mobage.ui.show("client_agreement_menu", {
isEasyRegistration: !0
}) : mobage.ui.show("client_agreement_menu")
});
return a
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
BLUE_LINK_TEXT: {
size: 40,
color: new cc.Color(62,158,254)
},
BLACK_LINK_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.BLACK
}
});
SpPlatformButtons.EASY_REGISTRATION_UNAVAILABLE = ["riddles", "heroes", "tripeaks", "crocword", "runes"];
cleverapps.styles.SpPlatformButtons = {
buttonsMargin: 50,
linkMargin: 10,
textMargin: 5,
maxButtonWidth: 600,
maxTextWidth: 600
};
var ReloadWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
var b = cleverapps.styles.ReloadWindow
, c = this.createText("ReloadWindow.YouHaveSavedGame")
, d = this.createText("ReloadWindow.WeStoreGames", {
gameTitle: Messages.get(cleverapps.config.title)
});
this.content = new cleverapps.Layout([c, d],{
margin: b.margin,
direction: cleverapps.UI.VERTICAL
});
this.syncInCallback = a || function() {}
;
this._super({
content: this.content,
title: "ReloadWindow.Title",
name: "reloadwindow",
button: {
width: b.button.width,
height: b.button.height,
text: "ReloadWindow.UpdateNow"
},
closeButton: !1
});
cleverapps.windows.list = [this];
this.setLocalZOrder(Transition.ZORDER + 1);
this._setGlobalZOrder(!0)
},
createText: function(a, b) {
var c = cleverapps.styles.ReloadWindow;
a = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.WINDOW_TEXT, b);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.setDimensions(c.text.width, 0);
return a
},
onClose: function() {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
this.syncInCallback()
}
});
cleverapps.styles.ReloadWindow = {
margin: 20,
button: {
width: 400
},
text: {
width: 600
}
};
"horizontal" === cleverapps.config.orientation && (cleverapps.styles.ReloadWindow.text.width *= 1.5);
var LocalStorageDisabledWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.LocalStorageDisabledWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
var c = function(d) {
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setDimensions(cc.size(a.width, 0));
b.addChild(d)
};
c(cleverapps.UI.generateTTFText("LocalStorageDisabledWindow.text2", cleverapps.styles.FONTS.WINDOW_TEXT));
c(cleverapps.UI.generateTTFText("LocalStorageDisabledWindow.text1", cleverapps.styles.FONTS.WINDOW_TEXT));
cleverapps.UI.arrangeWithMargins(b.children, {
direction: cleverapps.UI.VERTICAL,
margin: a.margin
});
cleverapps.UI.wrap(b);
this.content = b = cleverapps.UI.wrapWithPadding(b, a.padding);
this._super({
content: b,
title: "LocalStorageDisabledWindow.title",
name: "localstoragedisabledwindow",
button: {
text: "OK",
width: a.button.width
},
closeButton: !1
})
}
});
cleverapps.styles.LocalStorageDisabledWindow = {
width: 600,
margin: 20,
paddingY: 20,
padding: {
x: 0,
top: 20,
bottom: 50
},
button: {
width: 200
}
};
var RestartWindow = CleverappsWindow.extend({
ctor: function() {
RestartWindow.showed || cleverapps.environment.isSceneWithPreview() || !cleverapps.scenes.getRunningScene() || (RestartWindow.showed = !0,
this._super(),
this.setLocalZOrder(Transition.ZORDER + 1))
},
onWindowLoaded: function() {
var a = "RestartWindow.Title"
, b = "RestartWindow.AnErrorOccured";
cleverapps.versionChecker.isNewClientVersionAvailable() && (a = "RestartWindow.NewVersionTitle",
b = "RestartWindow.NewVersionAvailable");
a = Messages.get(a) || "Try again";
b = Messages.get(b) || "An error occurred";
this.text = cleverapps.UI.generateOnlyText(b, cleverapps.styles.FONTS.WINDOW_TEXT, !1);
this.text.setDimensions(cleverapps.styles.RestartWindow.width, cleverapps.styles.RestartWindow.height);
this.text.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.text.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
this._super({
content: this.text,
name: "RestartWindow",
title: a,
button: {
text: Messages.get("RestartWindow.ButtonMessage") || "Reload",
width: cleverapps.styles.RestartWindow.button.width,
height: cleverapps.styles.RestartWindow.button.height,
onPressed: function() {
connector.platform.locationReload()
}
},
closeButton: !1
});
this.window && 0 === this.window.height && (this.text.removeFromParent(),
this.windowTitle.removeFromParent())
}
});
cleverapps.styles.RestartWindow = {
width: 590,
height: 460,
button: {}
};
"horizontal" === cleverapps.config.orientation && cleverapps.increaseStylesByKoef(cleverapps.styles.RestartWindow, 1.4);
var ChooseSaveWindow = CleverappsWindow.extend({
ctor: function() {
cleverapps.environment.isSceneWithPreview() || (this._super(),
this.setLocalZOrder(Transition.ZORDER + 1))
},
onWindowLoaded: function() {
this._super({
content: this.createContent(),
name: "ChooseSaveWindow",
title: "ChooseSaveWindow.Title"
})
},
getPerson: function() {
return "seller"
},
isServerBetter: function(a, b) {
a = cleverapps.humanReadableNumber(a.episode, a.level);
return cleverapps.humanReadableNumber(b.episode, b.level) >= a
},
createContent: function() {
var a = cleverapps.styles.ChooseSaveWindow
, b = this.text = cleverapps.UI.generateOnlyText("ChooseSaveWindow.text", cleverapps.styles.FONTS.SAVE_WINDOW_TEXT);
b.setDimensions(a.textWidth, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
var c = Object.assign({}, ChooseSaveWindow.DATA.local)
, d = Object.assign({
server: !0
}, ChooseSaveWindow.DATA.server)
, e = []
, f = [];
Object.keys(c).forEach(function(k) {
c[k] > d[k] ? e.push(k) : c[k] < d[k] && f.push(k)
});
c.better = e;
d.better = f;
this.isServerBetter(c, d) ? d.badge = !0 : c.badge = !0;
var g = this.localTile = this.createTile(c)
, h = this.serverTile = this.createTile(d);
g = new cleverapps.Layout([g, h],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.tilesMargin,
padding: {
x: a.paddingX
}
});
return new cleverapps.Layout([g, b],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createTile: function(a) {
var b = cleverapps.styles.ChooseSaveWindow.tiles
, c = cleverapps.UI.createScale9Sprite(bundles.choosesave_window.frames.tile_bg)
, d = this.createSaveData(a);
d.setPositionRound(b.save);
c.setContentSize(d.width + b.paddingX, d.height + b.paddingY);
c.addChild(d);
var e = Messages.get("ChooseSaveWindow.local");
a.server && (e = Messages.get("ChooseSaveWindow.server", {
time: Product.FormatTimePeriod(Date.now() - a.visited).title
}));
e = cleverapps.UI.generateOnlyText(e, cleverapps.styles.FONTS.SAVE_STATUS);
e.fitTo(d.width - b.status.paddingX);
e.setPositionRound(b.status);
c.addChild(e);
a.badge && (d = new TileBadge({
rotation: b.badge.rotation,
icon: new cc.Sprite(bundles.choosesave_window.frames.badge_icon)
}),
d.setScale(b.badge.scale),
d.setPositionRound(b.badge),
c.addChild(d));
a = new cleverapps.UI.Button({
width: b.button.width,
height: b.button.height,
text: a.server ? "ChooseSaveWindow.acceptServer" : "ChooseSaveWindow.acceptLocal",
onClicked: this.onClick.bind(this, a.server)
});
a.setCascadeOpacityEnabled(!0);
b = new cleverapps.Layout([c, a],{
direction: cleverapps.UI.VERTICAL,
margin: b.margin
});
b.button = a;
return b
},
createSaveData: function(a) {
var b = cleverapps.styles.ChooseSaveWindow.tiles.save
, c = cleverapps.UI.createScale9Sprite(bundles.choosesave_window.frames.save_bg);
c.setContentSize(b);
var d = new cc.Sprite(a.server ? bundles.choosesave_window.frames.server : bundles.choosesave_window.frames.local);
d.setPositionRound(b.dataType);
c.addChild(d);
d = this.createSaveItems(a);
d.setPositionRound(b.items);
c.addChild(d);
d = new cc.Sprite(bundles.choosesave_window.frames.level_bg);
d.setPositionRound(b.level);
c.addChild(d);
var e = cleverapps.UI.generateOnlyText("ChooseSaveWindow.level", cleverapps.styles.FONTS.SAVE_LEVEL);
a = cleverapps.UI.generateOnlyText(cleverapps.humanReadableNumber(a.episode, a.level), a.better.includes("level") ? cleverapps.styles.FONTS.SAVE_LEVEL_BETTER : cleverapps.styles.FONTS.SAVE_LEVEL);
a = new cleverapps.Layout([e, a],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.level.margin
});
a.setPositionRound(b.level.text);
d.addChild(a);
return c
},
createSaveItems: function(a) {
var b = cleverapps.styles.ChooseSaveWindow.tiles.save
, c = 0
, d = 0
, e = this.getSafeFields().filter(function(f) {
return void 0 !== a[f]
}).map(function(f) {
var g = new Reward("gold" === f ? "hard" : f,a[f])
, h = g.getSmallIcon();
f = cleverapps.UI.generateImageText(g.getAmount(), a.better.includes(f) ? cleverapps.styles.FONTS.SAVE_ITEMS_BETTER : cleverapps.styles.FONTS.SAVE_ITEMS);
c = f.width > c ? f.width : c;
d = h.width > d ? h.width : d;
return {
icon: h,
value: f
}
}).map(function(f) {
var g = Math.max(0, (d - f.icon.width) / 2);
f.icon = cleverapps.UI.wrapWithPadding(f.icon, {
left: g,
right: g
});
f.icon.setContentSize(d, f.icon.height);
f = new cleverapps.Layout([f.icon, f.value],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.margin
});
f.setContentSize(d + c, f.height);
return f
});
return new cleverapps.Layout(e,{
direction: cleverapps.UI.VERTICAL,
margin: b.itemsMargin
})
},
onClick: function(a) {
[this.localTile, this.serverTile].forEach(function(c) {
c.button.runAction(new cc.Sequence(new cc.ReplaceParent(this.content),new cc.DelayTime(.3),new cc.FadeOut(.2,0)));
c.runAction(new cc.Sequence(new cc.ScaleTo(.3,.2),new cc.Hide))
}
.bind(this));
this.text.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.FadeOut(.2,0)));
var b = new cleverapps.Spine(bundles.choosesave_window.jsons.progress);
this.content.addChild(b);
b.setPositionRound(cleverapps.styles.ChooseSaveWindow.progress);
this._forceError ? b.setAnimationAndIdleAfter("to_server", "locked") : b.setAnimation(0, a ? "to_device" : "to_server", !1)
},
getSafeFields: function() {
switch (cleverapps.config.type) {
case "merge":
return ["exp", "wands", "soft", "gold"];
case "match3":
return ["exp", "soft", "gold"];
default:
return ["soft", "gold"]
}
},
listBundles: function() {
return ["choosesave_window"]
}
});
ChooseSaveWindow.SAVE_FIELDS = ["level", "exp", "soft", "gold", "wands"];
ChooseSaveWindow.DATA = {
local: {
visited: 1716218439339,
gold: 1505,
soft: 10,
wands: 55,
level: 3,
episode: 0,
exp: 4E3
},
server: {
visited: 1716207239339,
gold: 15005,
soft: 56100,
wands: 5,
exp: 200,
level: 6,
episode: 0
}
};
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
SAVE_WINDOW_TEXT: {
name: "nostroke",
size: 40,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
},
SAVE_LEVEL: {
size: 45,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
SAVE_LEVEL_BETTER: {
size: 45,
color: cleverapps.styles.COLORS.GREEN,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
SAVE_ITEMS: {
name: "nostroke",
size: 50,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
},
SAVE_ITEMS_BETTER: {
name: "nostroke",
size: 50,
color: cleverapps.styles.COLORS.GREEN
},
SAVE_STATUS: {
size: 35,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.ChooseSaveWindow = {
tilesMargin: 100,
margin: 30,
textWidth: 900,
paddingX: 50,
progress: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 200
}
},
tiles: {
paddingX: 40,
paddingY: 105,
margin: 20,
button: {
width: 350,
height: 100
},
badge: {
x: {
align: "right",
dx: 45
},
y: {
align: "top",
dy: 45
},
rotation: 0,
scale: .7
},
save: {
width: 390,
height: 540,
itemsMargin: 5,
margin: 5,
x: {
align: "center"
},
y: {
align: "top",
dy: -5
},
level: {
x: {
align: "center",
dx: 8
},
y: {
align: "top",
dy: -140
},
margin: 10,
text: {
x: {
align: "center",
dx: -15
},
y: {
align: "center",
dy: 10
}
}
},
items: {
x: {
align: "center"
},
y: {
align: "center",
dy: -100
}
},
dataType: {
x: {
align: "center"
},
y: {
align: "top",
dy: -30
}
}
},
status: {
paddingX: 40,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 35
}
}
}
};
cc._loadingImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAU2CAMAAAD9CcM0AAADAFBMVEUCAgEDAwIEBAMFBQQGBgUHBwYICAcJCQgKCgkLCwoMDAsNDQwODg0PDw4QEA8RERASEhETExIUFBMVFRQWFhUXFxYYGBcZGRgaGhkbGxocHBsdHRweHh0fHx4gIB8hISAiIiEjIyIkJCMlJSQmJiUnJyYoKCcpKSgqKikrKyosLCstLSwuLi0vLy4wMC8xMTAyMjEzMzI0NDM1NTQ2NjU3NzY4ODc5OTg6Ojk7Ozo8PDs9PTw+Pj0/Pz5AQD9BQUBBQUFCQkJDQ0NERERFRUVGRkZHR0dISEhJSUlKSkpLS0tMTExNTU1OTk5PT09QUFBRUVFSUlJTU1NUVFRVVVVWVlZXV1dYWFhZWVlaWlpbW1tcXFxdXV1eXl5fX19gYGBhYWFiYmJjY2NkZGRlZWVmZmZnZ2doaGhpaWlqampra2tsbGxtbW1ubm5vb29wcHBxcXFycnJzc3N0dHR1dXV2dnZ3d3d4eHh5eXl6enp7e3t8fHx9fX1+fn5/f3+AgICBgYCCgoGDg4KEhIOFhYSGhoWHh4aIiIeJiYiKiomLi4qMjIuNjYyOjo2Pj46QkI+RkZCSkpGTk5KUlJOVlZSWlpWXl5aYmJeZmZiampmbm5qcnJudnZyenp2fn56goJ+hoaCioqGjo6KkpKOlpaSmpqWnp6aoqKepqaiqqqmrq6qsrKutrayurq2vr66wsK+xsbCysrGzs7K0tLO1tbS2trW3t7a4uLe5ubi6urm7u7q8vLu9vby+vr2/v77AwL/AwMDBwcHCwsLDw8PExMTFxcXGxsbHx8fIyMjJycnKysrLy8vMzMzNzc3Ozs7Pz8/Q0NDR0dHS0tLT09PU1NTV1dXW1tbX19fY2NjZ2dna2trb29vc3Nzd3d3e3t7f39/g4ODh4eHi4uLj4+Pk5OTl5eXm5ubn5+fo6Ojp6enq6urr6+vs7Ozt7e3u7u7v7+/w8PDx8fHy8vLz8/P09PT19fX29vb39/f4+Pj5+fn6+vr7+/v8/Pz9/f3+/v7///+xGNHLAABQFUlEQVR4AezSP2vVBxQA0JumCaUpdGpLW1oaCk3JkCUdSraEfoGGDoV2bad2URwE0clVlIc4OIkuDlE3CWRwcVHQVU0IakRDJGAkSv7EdzW+32/U3fvO+QwnEvpGJOgOuoPuoDvoDrqD7qA76A66g+7oDrqD7qA76A66g+6gO+gOuoPu6A66g+6gO+gOuoPuoDvoDrqD7ugOuoPuoDvoDrqD7qA76A66g+7oDrqD7qA76A66g+6gO+gOuoPuoDu6g+6gO+gOuoPuoDvoDrqD7qA7uoPuoDvoDrqD7qA76A66g+6gO7qD7qA76A66g+6gO+gOuoPuoDu6g+6gO+gOuoPuoDvoDrqD7qA7uoPuoDvoDrqD7qA76A66g+6gO+iO7qA76A66g+6gO+gOuoPuoDvoju6gO+gOuoPuoDvoDrqD7qA76I7uoDvoDrqD7qA76A66g+6gO+iO7qA76A66g+6gO+gOuoPuoDvo/g7oDrqD7qA76A66g+6gO+gOuoPu6A66g+6gO+gOuoPuoDvoDrqD7ugOuoPuoDvoDrqD7qA76A66g+7oDrqD7qA76A66g+6gO+gOuoPu6A66g+6gO+gOuoPuoDvoDrqD7qA7uoPuoDvoDrqD7qA76A66g+6gO7qD7qA76A66g+6gO+gOuoPuoDu6g+6gO+gOuoPuoDvoDrqD7qA7uoPuoDvoDrqD7qA76A66g+6gO7qD7qA76A66g+6gO+gOuoPuoDvoju6gO+gOuoPuoDvoDrqD7qA76I7uoDvoDrqD7qA76A66g+6gO+iO7qA76A66g+6gO+gOuoPuoDvoju6gO+gOuoPuoDvoDrqD7qA76A66ozvoDrqD7qA76A66g+6gO+gOuqM76A66g+6gO+gOuoPuoDvoDrqjO+gOuoPuoDvoDrqD7qA76A66ozvoDrqD7qA76A66g+6gO+gOuqM76A66g+6gO+gOuoPuoDvoDrqD7ugOuoPuoDvoDrqD7qA76A66g+7oDrqD7qA76M7La2cvLmU/0J2l2c8ixs7sZnm683Qm9n1yLsvTnU70TK5mcbqzNRs9g/NZnO7cH4/GqSxOd258EY0DWZzuzH8ajT93szbdufxxNKY3sjbdmRuMxsRa1qY7V4ai8cNK1qY78yPR+Ope1qY717+Mxuc3szbduTMWjaG5rE131qaidTxr052d36P1dzdr053/ozW1nrXpzolofXsra9OdqyPR+Oh81qY7y6PROpi16c7Wb9GaeZ616c6xaH29mLXpzsJQNAYXsjbdefZrtDpZnO50ovVvN2vTnccT0Zh5kcXpzumB6BlfzeJ0Z/2X6Bl9kNXpzqXheOv75axOd7pHBnrdH2Z5urP5X+z7cTXr053Nw8MR8fN69gHd2bvwU8TkRvYF3Vk89N0/29kndOfJo1dZn+6gO+gOuoPu7HSzP+jO7aN//HVyJevTne3ON/HG9N1E9/fY28sP32v27sM9qmp9+/i9p6QHEgLSe0ERsABKQbEoFrEAHjlKEdCDRbGIooiooFgURfmJBVCxewRROYigIiAIIohKAQHphBJIQnrJZO73nZk9mT2TMnt6Qp7PlT/he032XnutZ+U9YoDdWAsrIST34ytnPvnU7LUnWbNZphjh0PckheResZ9ubRdrMMS1/c9K1mjz46G6PJdCcq9Iydx2UDX/v2LWXHvPgcrwIiskJPdvWqJM9JQi1lgT4XTpMVZESO67r4RG9IusqTY1hKrDH6yQkNzn1oNWnW9YQz0JVZ15rJCQ3IvvNsBNx02skbLPg2psKYXkXqGM6+BhYD5rok2N4ND1IIXkXrHjV8GDYTprouWJsDN+QiG5VyJvGDylrGEN9Etd2I3Mp5DcKzM1Cp7O2sGa58TZsLlmN4XkXqlV7VDOJYdZ88xpAESPPEghuVcu/3EjyhmWyxrHsvThh/+XSyG5V2XfNShHebyEQnI/Ff3TH+UYX6OQ3E9J+283wVPihwyTkiILheQePvmftIOn0xYwlApTN//24+fTn5n85INjbh1117inZ3yydMPujPyiUgrJPcR2jUmAh+Y/MiSKj/+xYPrd1/VtFacYDdBSohud0feG2x/7vwUbj5QwRAQoCub1gIcz1jPo9i+bMaxPi2gFVTI16T1m5o97Chkikrs48mg83J2zkcGUs2X2bd3rKNAp7szb399ZzNCQ3MXS8+GuxyYGy4mfJl91mhE+ajr0g51WhoLkLo6OVeCmzzYGQ/HqFy9vAL8Yu47/IYehILmLD1rAzUV7GLADn9zYGAFIHvJRBkNAchcbLoKbKw8yILkr7j3dgAAZL5qVThH83MXR+4zQunof/Zf5xY3JCAbjBW+doAh67qJkdlNoXbybfkr76MoYBIv5oo9OUgQ9d/FzX2j13UJ/ZH92SVWxR6c0PuPSm0ffef+kl2dMe/bR+0YOuujsVilxRlQqcfDKUopg5y5S7zRD45y19FnevCuiKy29Yc8xz7y7+p+0zHyWsRYXZB3c/PPX70wec1mbeFSo/oQDFMHOXRTOag6Ndsvom+LlN8WiQjGtB0784s+jxayCZd+iyTd0qYMKdPmwmCLYuYu1l0Cj1Y/0xbax9VGR2PPv/3BHHvUo2j//rjOjUE7s7X9SBDt3cWxcLFzO2UHdMmedgQok9Zq08hB9kTZ/cFOU0/GdXIog5y5KPmoPl+et1GnZNRX9KPd4cuUJ+qx43aNd4Cl+2HaKYOcudvxbgdNN2dRl5yN1UU6z2z87Sj/9/dw58HTuVxTBzl3kT2sA1agc6nDy7a4op8vjv5cwAP9M6wwPSc/lUQQ7d7HkfNhFzbHSu403xcCDqceMfQzUjgeT4M74n0MUwc5dHJ+YAsBwxzF6lftme3gw9HrnKINh9b/NcHfFVoqg5y5WPzx4xHsn6NXOW2PhofurBxkkJ2d0grtzv6cIfu6i0ELvFp4DD82n7GMQbR1hhptWX1BEIneR+lgy3CXdtoHBVfhma7g57Z1ihp3kLn68EO6UixYXMejW9oGbxOmlDC/JXeS/0gTuOrySzlA4dKcZWgmvh7d3yV3sGW2Gm8Q7tjBEil9Nhlbi6xaGj+QuVveFuz7/LWbIWD9oBa06cxgukrso/bg13CSHek/6D2dCq8GnDA/JXWQ/kwQ33b4uZYj9fDa0Wv7IcJDcxb7hcBNz2y6G3m/dodV9C4XkHnrr+sBNu9n5DIdN3aB11WEKyT3U5rWCm+v/ZJis7wqt/+RQSO4hVfB8ErTqTT3JsPm5HTQM06wUknsIZT4UDa1u34Y1uW8bQaPREgrJPXRO3K5A6+a/GV6zE6Fx4SEKyT1UDtwErTqTTzLMip8yQeOxYgrJPTQ2XwmtFh+WMuwyboZG8jcUkntI/NoDWt1XMBJ2dofGhWkUknsILOsErRu2MzIWpcDFMKWUQnIPum/bQCPq4QxGiHUyNJpvoJDcg21+M2ikzLQwYjKvhMbwHArJPbg+agiNlvMYSUtPg0v8JxSSe1B91AAanb9nZE2ExkVpFJJ7EH1yGjR6rmeE7e8GF+MbVgrJPWg+awKNy7Yz4mYb4dIjlUJyD5a59aHxrwOMvPSL4WJ8m0JyD5J3k6Ex/Birg89i4XLRcQrJPSjm1IXGmAxWCycHwCX6YwrJPRg+S4GL8f4sVhPz4uEyMJ9Ccg/c/MZwMT2Uw+oi60q4NFhJIbkHbElLbe1PFLL6mBsDl3ElFJJ7gH7tBJfoCQWsRo5dAJdOf1NI7oHZ0hMuhnF5rFamG1DGNINCcg/I333hYhyXw+plZyu4XJVJIbkHYM+lcDE+nMtqpnAUXFJ+ppDc/XfsWmg8UMhq53MjXJ6hkNz9ljECGqOzWP3s7gqXq3IoJHc/5d0PjZtOsBoqHQOX5usoJHc/vRQFl8GprJa+iEMZwwwKyd0/81Pg0v8Aq6ddXeEyMJtCcvfH8pZw6b2V1VTJCLh03EIhufthVze4nPs7q63XDSgTP5++k9xF9o1wab+G1dfqRLhMttJXkrsoegguDZewGkvtDpfrcukryV28EYsyiXNZnRXcCpf2/9BHkrtY2QxlTC9YWa09A5fk7+gbyV3sPB9llAeKWb19k4wyynT6RHIXhXfAZcARVnPb2sLlwRL6QnIXHyWizLl/sbo73g8u12bSB5K72NIBZZotY7VXPBIuZxygkNz1KxiKMjEzWQOMh0vjPygkd/1mm1Hm3kLWANMVlKm7lEJy1217e5S5+DhrgvnxKGOaSyG561U8FmWar2GNsCIZLtMoam/uWWu+/Pyr5ZuPFFCfhQlwiprOmuH3JnB5uJRVKDyeeqxIcj9VLb+mHqDUaXbuZTcOGz3mnvvGPfrEKx+t2ptVwoplXIMyg7JZM2w7Ey7DClmJg/974Y4repzV/cq7pq/KldxPQUtboTxDfINW3YdM/XZHAct5LxZOLdawhjjY2/t51YwVd7Uywyn+wjfTJPdTTUZ/VKHJNZMXH6WbtPPhZJ7GmiLrMrj0O8ryNj7bHe6ilkjup5oN9VG12LPHL8+hy/+Z4XRxOmuKoqvg0n0vPVjX3NoQngYeltxPNavqwquLd7FMahc4xS1kjVFyPVxO30U3Jd/fEINyrjn1apfc93aCN5ctL2GZN41wuq+YNUbhELi0cs9966gElDcolZL7Kcc6FVVr/WI6XU5cDKcWm1lz5A2DS7Nt1FjQGuVFP5xJyf0UlP1EfVQq+YrXD1Dry7pQKZNKWXPk3gqXJr/TZW4dlNf1Cysl91OS5YdHLm+ZoMCTqf4lz67IoZviUXDqtJU1SOFouDRayTK/1Ec5zZ7cQ0rup6zCI5u//b9xQ6+7vF+f3j179ep1Qf+hT3y0/lAhPW3rBJUygTVJ6Ri4NPiOTiVD4anNhF2k5C7I2VFQtV3PGuUOuCQtotOe9nATffEru2knuYuRcBpezBrldrjELabTlmbQaPvQz9l0kNzF3s5QJSxgzTIcLjHf0ymtD5zqXDvnOAWoEgtjoep+gjVK6WC4xC2jk3WmEXbN711upZDcNabA6QHWLLnXwiVhGctkP9vcqCRdPOsg3UjuonQ4VIlfsmZJvwIuSUvpUrj+g/fX5NKD5C7SL4HqzF2sWY5cDJf6Sygkd282tYfqhmLWLPt6wqXh9xSSuzf/S4bqIdYwO7rCpclyCsndm5lmqKazhvmrLeDLISzJXUyESvkva5i1DeHSbhOF5K77y2T8SoZE4a51f6QzFJYmwuWMPRSSuxeFA6Fqso0Byd/09SdLd+TQ3YmvR56e0nDAKobA5zFwOS+NQnL3Iv1yqE7fxwBkfXpDq4To+Bb9J6/KYpld0/pGwabt9wy+t81wuTSDQnL3IrUPVN2P0H8bB8dClXLhhE9/3JqRl73j67HtAaBhlwZA28V0Z2XAXlDgcn02heTuxT/nQHVJBv2V9mJTIO6ysY/de20LADAktuh8zlktogGYuj+zNXtpW6DFrAw6pc2fOGb4yCdXMyCWR6ExooBCcvdi65lQDcihn5ZdAuCCeVkkCze+dk19lEm84aNDJPlVU8B8+VsbDxaQ2X+92jceNvXv3ccAFP4HGmMtFJK7FxvbQXVzMf1yYsppQKOpR6jK2/zp2CvPP/uss7pd9uSqHDp8dwYAQ8Nzrx16y0VNUKbT11b6LWcgNJ6gkNy92dACqv/QL8v6A8Yb11DLWlxYUFBQWEKXP0YlwaXeoAcGRQNA7CMZ9Fd6P7gor1BI7t5sOC2gPQRHJyYDbWbm0av8pQ92STQBQFSbB1bks3h2fdgM3kc/7e8MF9MHFJK7N5tSoJpEn2V/2BtIvH0L9Tmxad7LT0+a9u0h2n3TADbnr6d/1jeGS8J3FJK7N9vqQfUCfXVylBHGy78ppp8+T4FNp5/ol2/j4dJoDYXk7s3mZKim0lfrEoBJGfTfG2bYNPuG/nhbgUvHzRSSuzcb60P1qJU++i0JeJkBsEyAXdN5VvpuAjR67qOQ3L35oy1UtxXSRxtPAy7MZABy74Ddad/SZ6W3QOPqNArJ3Zt9PaC6voA+2nMWYP6CgcgYDruWvvee0Rcao/MoJHdvci+Aqn8ufZQzCMDAwsB6HwK7tpvoo7/bQmOChUJy96o/VH2O0Ff3A2iwmgFJvQ52Vx2nb36qC403KCR3726Gqs02+uptE4DHShmQg1fA7nn6Zq4CF/PXFJK7D+sb8b/QV7/UBdD5EAOz9TzYdD1In0yFRoPfKCR372ZCZfoffXWgIwDDFwzQr45dwwvoi6I7odHpAIXk7t38aDgYnqOv8gcCwFALA/RhPAC8WHSghLplXguNS3MoJHfv1reCagR99igAtN3OAFmeB4DJX/W5der3+dRnX3dojLBSSO7eHQvkONOn8QCMsxiovFsBvDwAwEV7qc+GptCYSB0kd1E4CKomf9JXG5sDwJASBiq1H+pNSwEwNIv6zIuGi+FN6iG5iyegMiykr470A4B22xiw39oPeQoAnqROk6CR+D/qIbmLj01QPUpfWcYCgHEOA7d26aUAzHOpT9710GjxB/WQ3MX6RlD1L6KvZpgA4LYCBm7daQAaLKM+f58OjfMOUw/JXaT3DOC76up6ANB2DwM33QzgrB3U55s4aNxSQD0kd1E6Dio/djemtgeA6C8ZsLzBAHBjOvV5HlrPUh/JXXyiQPUYfZX/L9jcz4DtbAMAEwupS84t0Ij5kvpI7mJLB6j6ZdFXk2HTJ42B+i4GgHmOlbps7wKNlhupj+Quiq4uy2YDffVZPAAk/8xAvQgAsd9Rn2/qQOPio9RJchdToFLm0Feb2wGA4QUGqOBaADhtsz+r7riniDpJ7uLHOKhuyaePMi+FzcBAg9vWGAA6H6UumVdA6y3qJbmLfV2garKTPrKOh027rQzMwigA6F9AXX5tBo3ktdRLchfWW+E0i776wASbLxmYVxRf5lTOMECj1wnqJrmLuWaobi6gjzY2gc1DVgaiYLQvk8wKhkNrjIW6Se5iRxuoWu+gj052g02vkwzE/u4AEPcFddnSBRrmt6mf5C5KxkBleos+stwBm8a/MhAr6gJAqw3U5b0YyHhIyd1v/42D6vo8+uhN2CizGYh3YNPzCPUouR1afY/QB5K7ONEVqobr6aOlSbC5zcIAjIfNoCLqsaMLtMaV0BeSu3gATlPpo4M9YHPuMfovfzBs7qYuH0ZDwziPQnL3ycJYqLodp28sQwBdO9W9/15PoR5FI6HVejeF5O6To92giplPH70Ku1fov68TAMA4m3ps6QStmy0UkrtvJrnyKaJvfkiAza0F9NtLsEn4hnq8HwUN05sUkruPfk2CKmUdfbO3C2zapNJvd8LmtLXUoWg0tBr/TiG5+yj/RjhNoG8Kr4dNwgr6q2AAbNrupA7bukKrfwb9J7nL0nvX/X4d8VBeor+Od4dN7zTq8HEMNJSnrRSSu6/SesHp/3wsaLEjwOFF9NPWprAZUeT7N6Y631NI7r57Ef7e47GtHWy67A5sYcbwPHXY2Qla5xyikNx9t6MdVHW+pU8KBsEm+Xv6aYoCAAlfUod3jdC6x0IhufvOOgZONxbSJ+PtuRqepX/yh8Cm2W/0Lv8maJnmUUju/vjeDFXdNfTJguiAhhsdOV//w9DaRtDquJdCcvdHzpVwustKX2xvCJtOe+iXra1hc1EavbI+Cze3Wigkd7+8FQ1V4zX0RfqlsDGvoF9W1oPNjbn06tDF0Ip7n0Jy909qNz/fAK13we41+mWeGTZ3ltCrbxKh1XE7heTupzdMUDX/g754Kwo2N1sDuQ3tSXpluRtu7iygkNz9tK8rnO4vpQ/WNIRNj4P0x0TYvenrmGuY51FI7n57Hk6NfqcPDnaHTd2f6If8EbCJ+opevQ03XQ9RSO5+S+0Epwet1K/4P7AxzKAf9veDTf1V9Obk1XDzOIXkHoApcGqxlT6YZoDNsBL67te2sGm/jd78lACtuj9TSO4B2NIKTg9Yqd/KurC5II2+m58Imz6H6UXRQ3BzeRaF5B6A0glwavoX9UttAZvGv9F36gS8wV7j3dQRWoYXrRSSeyB2tILTQ9Qv71rYzaPvHobduGJ6Md0ErUbrKCT3wDyuQNVkA3WzToTd0/RZ6c2wMb9FL473g5sbMykk98BsaQune4qp22wzbK610FdZjooTv6MX8+Lg5h0rheQeoKkKVI1/oW7rWsDmrAP01f7OsGm6iVUrugZu2uygkNwDtbcznO62UK9jPWCTuJS++qs1bLoeZNW+i4ObsRYKyT1gz8Ip+RfqVTgKdu/QV8sbwuaiE6xS3hC4SVpGIbkHbl87OA0tpl7TYHdHMX20oA5sBueySssbw8312QwCyV28oECV/BP1WpTg57UGs6Jgc1sRq1L6oAFa5ncoJPcgP70PKaBOe5rDpuUmP5+dHrOyKn93hptuuxkUkrt4UYEq/gvqlH0BbKLmU+Xj0ZBprNJLJrh5msEhuYvU7nDqd4L6WB6G3cv0TcYA2H3Aqhw+D25a/s4gkdzFXBNUxlnU6W0f325VW8+CTdRSVuU1A9zcaWGQSO4i8xI4nX+Y+nyfApvzTtAnPzWBTf3fWYX9Z8FN0ncMGsldfBULp+eoT2oX2LT4jT75NBY27f5hFabC3TVZDBrJXRQMgVOrTdSl8ArYGD+mT6YrsOlxlJXb0hFuYucyiCR3saYOnMZRF+t42L1InzwGuyuyWamSyXDX8wiDSHIXltFwaryJusyG3ZBC+sA6EnbDilipPzvATfQMBpXkLtY0htNIfQEvTYZNl3T6IP8q2D1sZWVKxxngpncqg0pyF9YJcKq7iHrsPhM2Tf+gD9K7wUZ5mZVa3xoh3j8guYsDXeHU/yR1yLoUNlGf0ge7W8Am/jNWpuQuuOubxmCT3MX/maCKmksdisf5ce/2umTYNFvJyvzUCG6M7zPoJHeReQGczkmlDu/A7t951G9xPGzO2sZKpN8IdxemMfgkd7EgFk4TS+ndD/Vg0y2V+n0cBZv+h1mJ9+LhJuY9hoDkLoqHwanRWnqXeiZsWq7zfcjMiCxW7J/ecHfZEYaC5C5+S4HTkBJ6VXwRbMwf+n45/fgiVsjyBNzFzGVISO6i5CE4xX1Jr6wPwO556ma9G3YvlbJCy5vCXf9jFD4DhW+XmPZMpVdvwe526lZ0E2wM77JCJ6+Fu/gPGCqSu3g3Gk6T6NXXMbDplUe9stVbnf7HCr1mhrvrMhkqkrvI/xecmq6lN5vPgE373dTrcHfY1FnLivzZEu7qLmToSO7il4ZwuimXXmT21r3pQLXtDNg0384K5AyEhzFFDCHJXTwGlY5T10VDYTeTeq1pUcUIselmuOuwmaEkuYv9Z8Pp/KP04gXYPWqhTl/Xh80FJ1jeymZwF/UqQ0tyF5+Y4PQEvfjUCJv+WdTpnTjY3JDDcv65GB4GpDG0JHdRPAROTTayamsawaZDKnV6xgib0cX0lHMHPDRdylCT3MW6RnC6pYBVSu0Imwa/Up/ie2H3YCk9vRQDd8rkEoac5C6eUKCK+y+rlNMfNqaPqc/JQbB7hp4W1oeHaw4z9CR3kdoXTudV3ZxlPOxeYpWyDh7at/LD9//kob6we5se/uoED81WMhwkd7E4EU7jrazKW/B8Fi/KzSu2FmWlpaYe3vrz0qUL35pw13+uP6tRSnKsocuGPZ1hY/qK7vZcCA+G1xgWkruwPgyn5GWsykL1jtRM8thfi2c888zjdw4ddP3g6/tf0K1z5w6NYuDmtjVtYVN3Od0cGQhPg/IYHpK7OHIunK5IZxW2t4NNl9STb/RvkohyTFFxdVv3GjBw1KT3Pr0UTR9vDpumG6l14jZ46riV4SK5i//GQmWczipk94BNs2nXGwC0P+e8vr3O633pNTcOGTx45CMvvz7j/cUbN28+YKHN/2KUNvVgc/pOamTdbYSHOh8zbCR3UTgcTm13sXKWobCJTknomNBi8rb9abnZaalH0ovIooISusu5DgYjbM5LpUvuo1HwoIwvZPhI7mJbWzjdWcrKTYFDhw5XbaQXq5rC4bIMlimaGAVP16YxnCR3MSsWqjqLWbl3DbCLu0NHom8lwm5ALp1yJ8TAU5eNDCvJXeQPh1OfE16vjYyaVEDvcvrB7tyjtLPmrB1ohKd63zDMJHex8ww4TShlZf45EwCazKcemRfDLvq/JHP3LJx0SQLKiXuTYSe5i89joUpZxsqc6Aeg3SrqsqcLHK7+e/Fz/zo93oDyYp4uZNhJ7sJ6D5wuTGdlHgLabqA+21vDxqCYmsQZUCHD+AIKyT0CNNffPZmenlXKCuSMREt9tecf3T6nHrww35tFIblHxI9JUNUddMOND763Zv/JwlJqlK4bYWi5hlUpyfzn168/enPSkJ5tG0ShagbTvZkUknuETDNAK6FJh3P7XD5w5LhJz736+pxPFyxd0AVdluSWWOmp5PjahfPeffbeof1PPy0xxqhAl4Qp2RSSe6Tkj0IlFIPRFB2fFJ9y3nW3j5/62pvvzJ4z543pr097/M6hA3q1a1I/McpoUKCfYlQMxhtyKCT3yDncF05RqIICKAiEIdZojrkqj0Jyj6DNvZPNgKHxxfc8fE40QkeJNZujOh+mkNwjaeedBuC0+XuyCw/OvLyhWUGIGE1mU9NdFJJ7JB24RgHaHqNNxs8zx3RPMikIIkVx9h5lTPmDQnKPpI3tAHRMp5V2RYd+nHFn3yYxioLAKYbo+t2uNMNOMRsT11JI7pH0UwqA07OoUXh0/fwXhp6dYoICfynG+Kbn3vTUvA3HVjUoyz12GYXkHknfxwNok0N31uLsPasXTBvVq2mcCT5RDOaE5j2HTHx36e97M4tJbu0MB5MxagmF5B5J38YCaJLDClgt+ambVn418+F/9WzXqG5clNloUP4/lKPAYDBFxyU3Pf2S4U+8PX/5X4fySum0qz8cjEbzNxSSeyQtiQGQdIBelKT+tmThgi8+nfv+7JkvTbrr31dd1LfPBf36XzP436Pvf/rltz/4/MtFS39ev+N4ET3tGQEHg9E8n0Jyj6QVdQDEzGPI7L/XlfunFJJ7JG1pBUC5toChcnAcHBSjeRaF5B5J6QMAIHZBKUPk0IPO3A1Rr1FI7pFU8pYJAJp8V8zQ2H+XUpb7ixSSe0Qd6AKbuuP+tjAUDgyHyhA9tZRCco8k60exsFHO3hmS3vcPcuU+2UIhuUdU7v1m2BhHZzIE9vWHyhD1RAmF5B5ZJ4YpsGm+myGw5wLXr/vjxRSSe2RZPjbDpv4uhsDubnBQjFETiigk98jKGAa7NkcYAjs7luUePaGQQnKPrPVNYHdVPkNgW0tn7qaox4soJPeIKpljgo3hCYbClnrO3KOinyqhkNwjKn0M7MyfMBT+iivLPeq5UgrJPaL+OQ928csZAqW/msrWIaPfpJDcI2t9Y9glr2cIFH1rKMs95nMKyT2yfk6AXb0NDIHcWYoz9+g6iykk98haFgO7xBUMgcznnbkr0U3XUUjukbU8Fnamjy0MvpNlucNw7n4KyT2y1iTB4ZZ0Bl/+XDOczk6nkNwja1s72CmJ/yti0JVsbAenultKKST3iDo2RFF777nDwmCzZk00QWV4oYhCco+ogvejnDnen1Ya/N53XQSnnpkUkntEWf85H6ro6ekMuqJvjFAlbqaQ3CMr/9NYqOrOzbEyyKy7k6EyfGClkNwjynp8GJza/FnEYDvRBU73llBI7pFV+ldrON2XxmDLuR5O/bIpJPcIy3svHqpmvzPYiu+CU+sMCsk90o5NMsMh+isGm+URBaqkNArJPdJK918KB+O7DLaSsXCKTqWQ3CMu8244KHMYbEVD4GTcSSG5R9yhy+Bg+ozBlt8XToYNFJJ7xG1rBYfohQy2zLZwUlZRSO4R93sCHOJXMNh2JsJJWW6lkNwjba0ZDnXWMdgWGuFkWC25S+6R94sBDskbGWSWUShj2sjqQ3KX3Ov/wSDb1xRlYndRSO4Rt9KZe72g5z7XhDKNj7P6kNwl98TfGFwnL4dL71wKyT3i1hjhELXUyqD6PgZllHuLKCT3iPs9ylnklAIGU87VcDF+YqWQ3CNuRz2oOmy3MIg+i4NLgx0UknvkHekNlWHksRIGTWpfaAzKo5DcIy/vSQNUxtt2FzNISt4ww8U0x0ohuUeeZU1dOCkXbMwNUpc720Gj5d+sDiR3kXkzXFKeOVDMIMgfBQ3lgWJWB5K7sKypDxel++LsUgbs43ho1NvE6kFyF1kvmqGR8srxQHsv2XQWNJRheaweJHdhOXqzARrRD52wBJD64e+mDGoErZQfWF1I7qJk1wAFGlET00vpl4Lfp1/b0KzAjXJ7LqsNyV0U7RtugkbcB9n0mfX46indEw0KPDXbxGpEchclaS/UUeDSYYuFPsnb8f6/20QrqIDp1VJWJ5K7KMlc1FUTqzL2uJU6Fadvmj3yzAQFlei/n9WL5C6sBTvGJqCMecSSQ0Xeiy9K/WHqdW1jFVSu+U8WVjeSu7BkftUILtFnP7p4d26lqRZmHFwxbUiXeiZFQVUS3ypm9SO5C2v+uubQUKJaDXlj+fb9R45n5+YVFBWVlJK05GUdP7Dukwcva1fXqMCrmCmFrJYkd1G8qgXcKab45udePXLsoxMefeS+0Tdd1a9bh0Z1o9XQvYurvrVL7qL4l7NREUWx/fks5XULqy3JXRRtGmxEkJh6L7OyGpPchTX19aTgxH7G9GMUknv1Zs2dEYWAGS76aG++lUJyr+5SbzHAL67ne/MjBawJJHdRevQ2I3xniG3fUs3d8K8jrCEkd3H430b4QjHEnTFs5pKbFDicvZU1huQuDgwy6n5+iWp84dgPt+RZD440wqHpj6w5JHdh3XJlrAIbY4Mks1Jx54opofUV4+ZuOF5CkpmTTXBImFXCGkRyF4U/3xALO0OvN+dOGtK7Q5OUhNgos8lsjoqJS2rcrvdNT3++Zm+OhaqiL+vCIWpyPmsWyV3sfFTtXen4xcn8nIy048ePHTty9MiRtKPHMzJPFtJN0dq2cDAOzWBNI7mLI3cZ1d6TJ6eyatadVyuwU/rvZI0juYvS7QMMcEgYf8DCqmQ8YYRD502sgSR3Ufh7VzgosQ/uL2XlihclwqHFt6yRJHdRvKIRVDH3Hayi952d4JD0WQlrJsldZL4aC1XM2EOshPXg1XBImFFja5fchXX/KCNUxm4/ZlhYkROjFdhFP5fLGktyF5Yt3RSolJT+t97/xMtvfzR/4eJlK9es+6eAJI9+fU9LOEQ9WaNrl9xF8U8pcKdAMZqi4+vWa9CoYePGDRNNUJkfreG1S+4i61kzdDE+mMeaTXIXpfv+ZYAO5kdqfu2Suyje1EOBV8nvFrHmk9xF0S8t4WA0m4yKggp0+KGYQnI/FeQubIAqGfqsKqSQ3E8J1qyZdVCFmJG7Sikk91PF8VmnKaiQYojv9dERCsn91GHN+vb600wK3NhOM7W7esKioxYKyf2UUnxk9dyX7rn63A7NG9avl5zUoHGHnv966PVvDxVRSO6nsNKM339YsnTt4WIKyV0IyV0IyV0IyV0IyV3YSO5CSO5CSO5CSO5CSO5CSO5CSO5CSO5CSO5CSO5CSO5CgDWUWP9Iz/qIanbZMzsoJPdT28a+cFIGbKWobrkfX/Ts7QMuu2LUq7+WMjDC+pIJGtGvUFSn3DPfusQIp0bjDzAAwno3PNxtpaguuWc+mgg3sU8W02/iMZTzGEU1yX1RE5Rz/lH6ScyD6swBCpzmUlSH3AvvQEU6ptEvIrUe7JQnrXwKTnF/U0Q+92N9UbHeFvpBWPvD4X6SBY3g1MtCEencD7WHS5dnFy15Kh6qqfSD+AQOZxaR5DiUeZMiwrkf6YgyyR9bSfKXKDjEpdJnIq85HBbR5ieUSTlJEdHc87qjTNOtdHgIqrHUJ3XGTT3atOly998UZU/r59CuMBZlJlJENPehKJO4iarDMXBIyKYOhQ9FwSH6c9Z6aQlweJcOl6FM3UyKCOY+Cy7vssxwnxbPrkeZGPl9fwwOyfl0eB4uL1NELvc9iShzCV0WQXUDvdsMjRGs5XKS4HAXVT/CpVUpRcRyvwRlDH/QJd8MhzoWevU3NOpYWLvNgGoVVRnQWEIRqdy/gMsganWDajO9i4PGdtZq1tPh0MxKp9ZwuYUiQrnnt4DL79S6E6qP6R20vmetthKq+1hmEFwSCigik/urcOlNN29A9RS9yoHWl6zVRkO1lGWegcZCiojknt8ILp/SzWKobqNXxyX3MoWJcEgoZJl50BhFEZHcZ8AlpZBu/vZhaWY/tBaxNvsGqmvosgkaDUopIpB7aTu43Et3J6C6kl5tgdbPrM1GQDWNLgUGaPxBEYHcv4PGGrqzGuHQl15tgNavrMWKkqDaSI2W0HiJIgK5D4RLEys91IXDFfRqFbQ2sRZbClVyKTUuh8ZVFOHPPTMaLmPoqQEcBtKrRdDaw1rsgYqbvgcaCRaKsOc+q+r3y7pwGE2v5kNrP2uxTlBNptZL0PqLIuy594NLbH6luU+iVx9L7qr9cFpGrc+gNYci3LkfMMBlAD0V+3AA503JXTUHKkM2tVZD63aKcOf+MqrclnrEhz0Br0DrAGuvYVCdTjcHoNWNIty5XwCNdfS0FqpUejUVWidZe7WCajjdlBihEVtKEd7cT5rhklhCT3PhUE//eQbJ/RCcXqO75tDaRRHe3BdA4wqWc58Pi8T3Se4O/4XTSro7H1rfUIQ39zHQmMJyzoXDq/TuP5K7w/1wSqe7gdB6jiK8ubeAxmJ6Ombw4XTHLZK7x/tQU3oYI0szkcx9O7SO0dNsOLSjDjdAq4C1VWlipfvqnoJWP4qw5j4bGi0qL3gqdbgGWqy1dsDpEXqYCa3mFGHN/VZoDKSn7DjYJR73eU0T8qYKfEgPX0JLKaQIZ+5tq35TfR8Ok6lHL8nd7rHKt7SvhpsdFGHM/bCX43aXwK5zIfXoAg2FtdZ1UBkL6WEX3PxAEcbc50FrOz1YO8Om4S7q0gEadVlrtYOqIz2dQOQ2iUnuj0AjuoSeMiacriSOOOzLoqbknm+A6jp6shqg9SRFGHO/EBpdWJFC6pYCjaasrTbC6RGW0wBaoynCl7slARr/ZoDqQKMFa6tP4fQOy+kIrSsowpf7n9CayABBqz1rq8lwWuFt9aorRfhyfxda7zEwOdDqwtpqKJwOsZzroNWAIny5j4XWCgbmqJxdsDsPqgSWNxJuiijClnufoB4/+gdafVlbJUF1ttdN0jhMEa7cSxOgEV3KwPwlb2HuS+tDWN4kuPmDIly574BWBwZoFbQGsJbaUOW7/8vyWTVSuc+D1sVBGb4n4/q/gNMsljcLbj6jCFfuT0NrGAM0H1ojWUu9WOWFDp/DzUyKcOV+I7TGM0AfQOsu1lJ3welvr/8CMZUiXLl3gtZrDNAb0HqEtdSAKnez/wI34ynClHuRCVrzGaDnoPU0a6mzoWrECmyCmzEUYcp9K9ysCcqpBrkntz5UPVmB3XBzE0WYcv8KwZ3xcxe03mTtVFB1yofhpj9FmHJ/AW6yGKBh0PqEtdM/VT+Xn4Sb8yjClPtt0IphoK6D1lesnVbD6Q1WwAo3HSjClPsF0GrJQF0stwi7zRpYwIrEQKsZRZhybwatHgxUN2j9wtrpLTj9xookQ444RiL3IgO0rmKgOshNZG6fqg95P9ALI0V4ct8BNyMYqEY+30RWcHh3aiHDK3P37kyG0J1QGUtYkZZwU0gRltyXwM0DDFQ8tI6xajkf3twSAAxtRnxdzPD4Y2KvOgBQ58Ipexkig6Bqwgp1gQyOjUTu78DNMwyQBW5yWZXMCXXh0uoLhsGynnAx3HqMIdEHqh66cj9KEZbcJ8HN2wxQBtywKosaw93IYoZY5jC4a/gLQ6E9VDfomSyI/RRhyX0U3MxjgPZDqw6rMFWBpxssDKl/ToenuF8ZAnW8bAntK1MiI5J7f7j5kQHaBK3GrNwEVOBphtKuZiiv4XEGXSGcJrNCl0PfAlbWn8t+SWfA9q39YUsxKbl3gpsNDNBqaLVjpabDydj5dANU5i0MnbR2cKrfLQlOwxh0R+A0S88QfGxkhf64wghAOf9TKwNgmdkCABJH7pDck4O8Q2wxtM5iZX40QnXJXvKvhlBdx5CxXApV3LulLLoXKmUjg20bnL7WlfsqVmR5NFTDA+l9OFQJS2t77oVwl8YAfaxv7saRsr7PzyPJGVApOxmI1PceGHrbi3+xIk9CZVxCksVNymJisP0Cp3W6cv+ZFSg5HWW+pN++R5mmJbU89wNwVxTcw0xXshLXQhV/gDbpBqgeZwAWxVR+Gm6dEar7PcZJRecwyBbCaZ+u3Bd56RQ302+D4PIzg8O6d+2i+Ss2F9W03NfDTRwD9Sy0BnudfvCY5ztEJ1asdPuCWZ/t1blhp46FnkrOgirhhOdtMvMYZB94+146WEfuD8Pl3ABvRFPNZuBK1zzRPwl25i5DZ26vSbl/BzeNGahxevYknGwClekQHW6o+nkq+6EkAFCuOsAqWKKgSq9iNMDd5UZS38sgew2qJF23ceJzVuBquLSmv/ZB4/+xd+7xNpdZ/F97n8s5jsPJhUI4CCNOY6RM0qU0/Qq5dElF1CiXDBGhlEwTSiZTNEYNokEuaU4kF5LQxeUkXdwvJ4xcOIdzHOey916/1w/7u/azv+tZz7MP83v5zsz7/zGyP9/nWc9an7XWWLxQjo2sBSp1B232jNzfA4VfXUT7vJB1HgBhHsDz9OLWuhJ3w3mqrpd/Wl2XysEUCPOja5plCxQ4vvuXIApkz35jxOxczSbJBlIwR8w0VV6vQI5TXy2e+8mXe82pMjktum/lR/NWZJ1CM3nDywLD9TMD3pD7eFD4LcaOdEsPRY49ieotrt7cfxZbP+EywXX2mb6a+wd361Au/ZmoIzCqGgCktBihEUP2iHT4f5T7Cz8DsiXy3G2xrqa2XK9b/0xDH5ylSttpeWKqTPg9zky/Lw3O4m/c50uUWVsHNDSY7wm5j4CLPNKxNei2+BG/hzAVitwd3QMNVchWIdRAw7nKup7kSernpModclDDA85BEOBaTnvEQ5hVGEE3OE8HtKqq/tVoEnYlKVtCJKnDdIfzIum2LRhVGSLJWIgCUxNAT7tfPCD3/he7Jb4ZEJqTOjuRGTJGcn+UXw5ATEMdQ52QhzfkqrmSXHO5YZWY1Ph7eXBorNRm25v20LQA83SfWnqv3YG2EM2VqyW582+pD6tBNA+cRB1TfBCBv1nHdo0ggivWXfpyfxQUnsQLpS5EMsmQcZjNyL2DyZZ/+Wn5LGbKW0fLAGV+GLlvMTuK3nLF9OH42wcAKWp+/RbTWKkMUHhFkDvzgP+gArhJmGCW+/1KIN4VGH6lq72ujgMivv/ZId17+8WDQ/KiS17u7UBhIF4oFY1PsNNUvvfTkTgEwrRFjlv1dwbRVNeUNQoc+sci91r6ToDvwruXay7dteCLHFT4tWnOTn1Q6GuUezY6BAYDzx+Ncm+LxK4mwFKV93Hk1gAizQndvr4SHFI2XOpybwkKL+CF4odIMtHNDNZj0Ic9gYi5QFQrQh5nUn0PVAjVAaZV+ohR7keBuBcVFqeGLyMu7k83rf6pbTF542pe7kUPgUPFOx5oWQYcxqCbzzVy30xtZ75GHdo3BIcqO/hAkYhfiQ6HIiR0TfASl3sjUBiDF0gOKCyXz+leXNjQBTlKrjBPrzkAYV7ShuBwiN4QRr/5eiBuVL++xPNKGR4SV3cssAtmfJw1L4OVe3EH+istCSDiCXp/+T6S5u0rct/s/BWTn9l79phuDGEa5aKLokpA9FNyO/eAw6eXuNyrXeTJy3uNI/gO+cFhCjp0AirxszzDS48/yP6mfaimo8MmcDgudDZy5s7MBDiLfxKyOI+6lchzO6hU/8Ig95/CF5Wz4ixxYii6qAVpe2S53+xYoZ3Nrk3CZYjc5lLG4lP9YvWSrhQpXuJyTwaFaRfcB2r0cU8A4jsuVTHW4k/eaWhEXKImzy9nYxL6BZOEJB6X+V6ZJCQQlVfBBnQoOLhtw/IF0yeOGdqna4eqEIWv7ScBSe5bop/0KUvQ4UEavyfLvZXLCn1jLlWbygmOtJHCbujgk3Ceey5tuRfARV4jsQoUmILfLeCQUIwO9SDMLOS5xpTJwEGaz2EF/zqZBmEa2uSsg5QmCnfYjjZWd7cjhnbMGdG1Zc0UMFFrlSx3ZTmxPxOJg2WZOE+Qe+A252zPRWIMXTb5SFAlQVeEDvWlw+RSlvtRkK1KMfORyU982M8uXQ0mGfdyjQCisZxmilM7d54CYhbnZmtvI/cTTgYyfDT2Nq9jyxx9Z3kQ0cvoBrfcf0rl276o47husXQr3hjVSFZeORfOUJZltOR6uB2jCQ2iCYGXsNz3wUXu3ZsKCqdFk87DnBE5rsBmx9kuZGhIAbrCVUBs5l7Hw2W5q4/FUPiral6EGlZDqaghVF7Xnn0vOgnOlgFdXWGyrpuSDphVfk3w+jqlfHI5x7JgMXo9AQCaFV/act8CcldNzLxhGkTwEBAjlFemyaVWlALEm+im2Klxt1YtOkD4C9DhZggzB3k+gQi2RVkry++S7e6xcyMvd/plhjvZlG3aetjVIZPcTzlp0jaokpOsrao9DERNZNg55O6eOZd43v1LUNl84R4cefZhqCoQ/0CHdyHM46jjdoO55wfNNoxJQNRlp2P+LF8oSvScFf6oZsg+09hJXM7KncLMLc73/KLwZlolyL2W4kdNduVxHtR+NQOA8OehzKUq92UgZlJkCrcfN3hwqnOSJL7m/jWnoI4hQJQplCpRY7W71tpxE3FqoyR3dbZpYfgBeQfqCIxNhdhJ7fKjZCObhRhq5RyvriAxWJ31HJHcyfqZFacvKi6Iip6INyGCzz0q949AZR/aM7sKQN2RzAOeqO92VWlmZ1HtaYfdAtjPpTGkC7VTK5/iDsSuVnJfo1xfSTtQdu7ERtvMfLnBbyLiFClf3B3ClCvUD/7xl2DwesctcAqjyU3QlT9WQAQjPCr3f0Cpp1ll+riJ1u0Ngwh6AJEYYgYi1LMsYb2ELh7kpxTthAhGc1b/9+zlviOJwgl5cYdCfMM7Hn321Tcnz/14+fqNGzdu270YVP5k8jO9iCcqORWvEnQxCxyWCt3I/8K/QZjX+Gn//A+RFwdEY4/K/a+gsh9tyS7Lji+/2TCI4Nd8Q9oeq7pceSB+hy4cy1NCiXZl7wzmPPQfRg3fAEQVyO/Un4z0ealc0XXqpjN8jxExwNTg1wMHiz7T/eAwTNiLszHvciewyUU3z4NDthBarfem3F8D8yRa8cZOK3ZLTpgWnx8HxE3c2bQc9fwWiAohfWLman337GdMevJmu8TVosjWoPHSP6ofHNKHfyffG4JRqAtEcEd2svP9FCBDTc0hcxIi+XAk91UQi7TGpHHq7n9Pyv2l0so9y0epLP0ukPsFz5WSdu/rxJMB23mW2/QbMzvp59NRmHNYNdgIcqefvyRsUqx5BgVWOUXOd0JimET8zrTDsE53KXJWetuT1CMIIhnkGAXiDiDDIa0p+Zd4IPybPSn3YSDMp5bopllvnioPIpiu2ajdlHsgyXfR+/qX7HMYSQ2+7rXAUcdxO7lPi3hov2W50iFLfhXIgzWeUqJ/vyO1vcgxUpdf8ynJTnocmzyDraROoLs9KfcBoIKWZMfzjr8SkAcRDOM7+3LiyDQmMAdUE6rKcP4aPqmZSDxQOwuH2AYRjMczNcNhb56l8e4AatgMKjWEs0i6CIh5ujAkDVRka3JrbdFke5wa2nlQ7n0s5C7138XliR6cYeIWymnuPXW3osRXYkdEO/502wh8lamJhXEiW80FvQ3nGWy7Q/iMbTk7yTgi2WSh+16XJ7wMOKoUI8FfKYekjblXnvKg3H8v/KML5IYjwKaosgPkQQRN+FanPjRAVOIgRJBcons2JBRrr4RrKUj1hTtwQpYOuv4lYdemf5/l/N9yUpikwqhnDHCUyTOaW7sJW8+o8MzzZ3D4ClWyU9Sb23tyfwQU0mLNX/aTnqIUrvAnzTpXkqRBECWCiRDBj6hwTDGGEK/xgcD7cmcUk8Tr9gFQQVVkK1dmk715sNO4z9zksa0KfKqpNnAsRZ75ght8NETgW+M9ud9fOrk31wWAy+TVN6chkq2ue3g6ytQWBs2thDCd9Q++zq7xT42kLywEEdzzG3oly3xBni/hAlD5WjhUFGYZfxRooLPNE5WKUe5X5JKthUpDecMznpN7W5PcZTu3/xh3NhAzxa2Wh6PToY0CKKM4wIfrbuFXtP+JlFzLTxHMkEQcEClOiJKPMvOEk5hCD5WPtauIVeJz0TiYrLKuLYboalG6ftEwUfQ5z8n9zlLJvT+FDVFMAYVMFIwXUBzdcr8wpsuovS5Plqn/tV+MtpPdEEKJNAupCP2JvVFLIhjH5s0EFSU9KLlmfHw5VDqIuAv4KTa5TyR86zW5tyqN3AsraZOB4+VukffYpOBG61zuANAPxc3QVL+rqslE9cyPM/xilwPDXGsX9EjUUhVURgo2GGZWhNy7nsfbYAj/cdRRRhrntq+s8vAv+W+Q+xw6R4XZdtzb/hVWro/BWcrtRRNjIQLfKeVUiuev8hI/EI4ZbJffrnO+PhD2yw+eYN8u8p/cSyjoy8uzmEROrhCwUhaXJ110Cqjn2ViPyb2FUe6SUy/hFHPCSPb53lxSMDtRkaLETP1Uj7WaZvx/AUHhUk84S+MCq/UIKm3QREeLvOp1oNJe6qUi0gI2dr9c9udSC9o6MkS5BxTFlNnpLblnlELuh+P13qonZPv8vUows1FJhj4U85yDSXzX4HNC+bJ78Jy9Jv7cr/UdGrgN3ExAE9fTYiYtHUCluWQ0INpYmblzhWSz6ZXUSpB7uKPK4baQl+V+ZUybKWAUbzknjorDhCpmRXhXmp1GMzv0FgXqgZ3vHrVE9AghYtE5PfqoeVAWpcoPaKKORftALzDuTVknhO7y1VfCFkMJ/wnUcrNhPu4LEMk7XpZ7LbSgmeB6vksuFTYDhcprEVeknPvQ9se+J7AVP21gt9qFAiqPFeLpjoJ0pOYs2qMhU8ZisdtIUPEXC5VXYrVVZ5poFDG0Z9xlqJsWKovH0w7+h8uduk2rBk1PX34aNpH4SKe4c2rfjjJcpiSNralWYAewEk1615U2i/A7P2Rnugo1wVZBPX+DKPbId5m5Kfp9TUw6EFx0Rz038o4nYo3y+O/wHy73oXRQmv68JGGEs0K6eiLLUTGRzU1zbC2UJqXuP/nmJiba7xDOQD2Z5nP7IDN83SrIrG/6b3gT9dDh/Qby9IVI5ntI7o1jlnuQGjg+4rNYwsu3ErC0PVY608MiLgP6vJXcU6bHurrKvm9tuY23ZjNE4X5I5AoVLvEmus3kNFsnLy801BfylFOrZp535F4rZrmvEPPPlWUTdxowVHs7hLY8o3u3tdFV4/8MHHftQCveh2iSi+yXqnZDPacgitF6xw7xKuq5SROrvA0uTqKWH7U2HmIhRDLkP1nu3Zj8NpGkxihmufubv1WA9rwJfMdksKJuLOU4cFHpsW/QkmV8gUZmjJUQqoBKb6nASd+yltNJmjhtGqjICbiJ7FwUKaGcsM0zcq8dq9zzU6V++GJQyBA32WSsXTBvXe6FzMXJYN7PV4m2wgmL5y7cGkJrNkE0T8bwvh2PYp85u/RQjv12oZYF4DCPL4ILBxXX2Ss8tPcrPZqdvPpUrR/D7R5/BF0cB4Wm4mXS2Pzme7Z9z5lK8JAFDkofxzsU3Ypyn4cGgjO63P/yD9w4C1bCclF1jn2rAX2n0ss+KSD9vzrsNXgR+qGWA36rdtRREMlar8i9KXMci9wptkxmG9x7dZQ3jrGeleB6d53UmBS6aS320yGSKShz6Hp19dAZiGZZDN0Aq2JJ+iQGdINziIaoZW+87h/2C4jmL6hluPSYIM6kK8unQ560iJnlftAvLnreIstd/bqSQijyKte1VJW3saZrh7pmxuJpOpgevaylHIiDp+TiwPZYBrhBtuxoUgMeKTv4hBSQyVaek5eBwyYUmKsmIz0i91tFuUv9ZImchTQLFO6WNxIdRIk5Pq7N7EZ2Bz3dKuUDovGkH0oUtHB9p41ApQwaKfYL/aeCCj83O3Z6oY5didohAVtBgY4EuRu8dggFQjcpgVixB7uZzHIP1ZeraWtAoa1sqVmHAjvKsc+zx9jTbob+C/sJImmHEr3dBbQ7QaVRDCsiyqFEng9UJsu/juyfbwcO1UuECJPayDh2JFuX4Tb4IYK3vCH3TrHJ/TNw+ETO2/ETXAZKHTUKRc1J0vo0+uWugQpjxFqNrNZ/Ok76DeqoBukLFpxdDVGkJmvKFb2Mb9tERmNN1Sp/AHkCN4NDmSMo011JbRZ5Qu7dBLmL2YTaQe2EQeIRuUg53GKQDcRvFdr/4BApR3djlGdyOSwHKjHZnZdAXm8thbWtUeR3oNJeslPLiaWt5QC0k06LgZAzjMPVyeAyexQn8HQvThFrjiL/SmQHNBOzDHKfL/++xBIfVV+kuU2fRnV8pxYb0hs/oo6g87BI+lmZR68wOoZ9PY+iSD9j2qU/RLEIQ8v/2PWWjhMKkKC1kZpfJgFc1ZXjf3+m/S09V0ddET5wKJsd21HZ0hNy/5Nwuku5s/gDyDHDIPctlkWtI1c40tuPKjUY9b0t5Yo7iWMriDHsCb4UVKagkUGSo1Ao7ieUGKfmfREOBzOOIHHsWiDqFxr7y5vg8erngraRSiyXKPvq5bf2Di/I/Z1Y5F5AjpiHrMbF/x6jKIqHSE4gT6idPni4DyJ5MOpJN9aU334GNax3fuzk/fyUSHqyyHS2fL+thCi2GceIrXHuqtso/t7dGAjfcnO1KgO/YCYnvRsPRJMiNNNQcfN4Qe4LQaGO5XHky7Lau9eHdZcSS4xdl2UPaYe60czH/DLSTtZZYHPp5lE8MNg9NJ7YEEMt40MUOWAcUvqWW+5Pu1oUMysJUznZZGoGFoZj/XLh4C6/J0SQ+iPaWcGJW7wg929j8MwU1TSWO8aY5N5FPzGV+ClFGGX+NSgcUYw0l4eQYEc5JeSb8gwVTkha2YtG6siOQqK8sLCGfTjAknBlw+k83NkZIukYkPrL6YxwxH3V2ago9IHSeJOQiTzF+p8i6QwSHtmaXRkFJgOYquPPm+Q+EZTiM3IUNpW81EWqTTBT2XLQ1Ww9XIwcs5UUspCqPY5GEml9pcz1oNLZOGhmUUQ+J+659WsntYlTH/9FojOYDrVtzv+u3txNi4fXg0gS5yFD3ht3V4O6g/ehQ1B5FHzjAblHFcnjUE9huvkZPoSRu9DUEM/6rp+WBxjdAZEMRCy8TM7kdzC7s/fQD9c0IE6dLkEThyO23Mk8CoaX0yKm+r85AXT4hgaEWiJxBbk2OWqskZr64nvl8D/FZC/I/TqQH4/EOPPhjn1Mcg9ebjRvZPpko+qr0bv9MulrZc/eCcbXeBGds751YrIpBY1kkaoMjDGlZlZxo+7+opWp7hn9ILjHq5xuBho6HDG0o1Tfz3byPusFuXeTkwPEiYpyZZGrQQ7WDdgS2n120EGbtM3Ca7IPHzbMT/zZZ9qU3Af0O7vXxzqIZ7FUxJDbVbegygYgaPLUq35gSH0uz/SrKL6fIy2Ao/GnyFPMvDGUL6+zF+Q+FhRWWBSk4r63XaA7zDQZK60Ao8hvbKq6hqqr/vPjyfw4eeJaw19qKjhUch1tZxJjHMQzRa6iSQtYZ0ivbJrotKalu2V7bI5YS2QisqLRlSGKxHuWhlAHFTwSN3F9Urd7Qe6rQWESatgUpz8AiTuNci+uKv7AgfbgcE2RzTCMa+iI8WXr+9EEp9/KRHCYY/hYasVQueuNBoIpAGJR4JCun/XLXvTNJ2U8PnmbeUIrE7Kefvf/JFKW4rZhH+ciIYVEDfOdBiqimRfkrh5eMBB5AhTqlT8oN6TJcsdnhc5PJaxI3Gz3hVYB0/KA3LJSbmZLGojVs6dilHs/3aYec4awtbj9QR2Ns++TKeMnTp6zemcAGeR2XcquFG6aM3ns5CkLvzmGJmYD0Z0plGV4Qe7YEmyKBaPsvJ6NzHLPVjMLn2l7wv6KGkL1gOct2djLT7bcWQMcGuQafma4Go3cJ/kN5NRMJYwiXva7x1o6F4pxZorSXV6K5d6T+8s2YyXWxFGuXDpNapjljj3U4z3ERx3ShNTXgSXuEGrITtIe74evAoeUb41rZVqgkZZyzVhcvnRAaGUnz0SsfABRrEIZcwNT4lJamEiniAfk/q1FK+YRknGZ7SiQZiH3n5N1Wyve8EXo6jRqySkHHLfbzr5rQH/2rgi1+z409/M+jkbqKnkWkUVgcOSkCytV7VksuhXs6QhE0sLoo7KLB+Tumqvfg7vGWinLxQSSZblzKw/KhlVx6nEgav+CKlLx1my5PlZJHYsavlI+rmo0Aapn2LwY5qEeRRN7gKCtUsJapeuwNKyFKKZiqTheD4iEkbk5DZQUmTfkrnqAL3MXOgP3KSGGBNjIvejXao3v7L2YP6k6ENV2osSJSuCmQoH9ff7I2XpUVke7Msm4sIJ9jwTRxOkYdtSGyhp6pVqBSj20R5gkPA5jhV71hD9O7STwgNypZyPM6y61dwWHjHyUKJTkTmwtDwrX9nn0JsUJU/V7u72uCoNQogcolLu39z3qi7d/CLXkfvrqgJ49h767C83sld2l8gqPiobyf0W0RG5WHY6l5Js00HGrBxyRTEdklROocLoDOFTZhyK5otyJzDiQqL0VDQRugGgSZUNW0e0g8gJeJDbEEnh0hyh2o8LDoOILYSnIAeICF15nVQce31dekfv3fvVCVVIvu68Fh7SNKHPC9hSZnwh6Wh5EI9tcx8wTKHPyVtCT9M5FrNvJJmnZ0P4RypsIjmEpCPnsEzwmDrYElkHoFbnjY6DQlt5YBeNSwSFlFRooApXXUceyVNDg61eEFvzTBwqph9BAQXvQUecimlfXq34gme8Mw+Ofl1bJ21PBPsFjpGQEd1TdG/CO3A9XBoWKQ1flI+Kp1YOrAFF2FRqpZt3YuTUDWNJXoB0vMQP6ZYIvxwOHr8+pi99BYHfeBWvLq5del4bL21NXXnsWI9+77kn/4AB6R+44D1yUvTIFFCp/FXssukF61o66DFykvVKAloTeSwGiUwgt2MgF8LduwItKE6fRzoKx8un+rrudqTQ0c7czXRBL1IaRZusRvSR3HAAm6m+30lOcYjAJypH+i3VAodbLMYWmuzqHT+vEfrZfybJ26lWc0GElXmRmy0O4VM6ozbsp2dKgEmqljpHWoFIBL5RNf7gifEJ1+TyEHpN74H6QaZODVkzwxVST2fCn+xuc1V/cVe1HZ4UwRg5N7dv2jnuHzj2G9uTM6HtT5XM/VIsn5+bixWdiOYCGH6Idu+sBkboQVVZIsb0990EUQbxgQpunvDj0tanf0R/lHblj0UMgkDzeWolLr3as4bYnUeHR3UcD+P+XnJ9/zsN/F6ezdqM1eS9UDB/t3fe4bktQkV2W5qIDFXy9AuC/heDzPtBx11a0J7h8yF3X3dBm8IJCtOJ/FK947emeQ8YtyWfOfiBEg7bMYIhix3+r3Ill6cByy1L0KN7nOETxGJaGVyCKb/4ndzwz3i34Sn3Xo2fxPiGfMDZVRPZcfPpfLHciuPLp3ySQd+uul9aWoJfxPpVBpdWFONWJmf+T+3mKt30+b+7c+St/+L/s3c+Lr2MYx/HLbzqnbJ2zkTjEUqNkyAZLk5rJjvxomB02o1lMGguGklIskKSMjcxSU2NnNQtkhQ2hsaCZiYn0nW4baq57eXvKVV6vv+G9eXquPvdB4z93U2S3tBG70XlN7gVxZ2TnprkA3pA7BT0Q2RVtxH50npJ7QTweneM24M/oPCz3gliLzg+TnETeL/eCeCU6X7QRFyKbl3tBvDvNZsbtkd0s94L4eJrNjIXIrpF7QexF56024tHILpd7QexH5+U2Yj06v8m9HmaXRrbWRrwRne/lXhDnI1tuI7aj85ncC+K2yJam+QT4RO4FsRDZPW3Ej9H5UO4FsRLZrW3E7JLI3pR7QTwf2XXTfAK8JPeCeDuyq9uQucielXtB7ERnNskh8bLcC+Kr6Pw8yW7WktwL4o+LJhlFfTWye+VeEecj25vkP9Oc3Cvirsh224gvI7tR7lT0WGTbbcTvF0dyTu5U9GJk77Uh10ZyVu5U9FFkr7ch90Umdyr6Zprcnwm5U9/JmUg225B3IjuSOxXd0b/eNOTzyA7lTkVPR/JcGzI7E8lPcqeiD6Y57ro7ku/kTkW/nu1f1Jxg4/2yY7lT0kaccuGgjTm+Pk5Zb3KnpJP1q+JvV64ctlHfzsc/bthqcqeqo53NJx9cfGh165f2b3z9/uoji0tPvPDprMkd5A5yB7mD3EHuIHeQO3IHuYPcQe4gd5A7yB3kDnIHuYPckTvIHeQOcge5g9xB7iB3kDvIHeSO3EHuIHeQO8gd5A5yB7mD3EHuIHeIBnIHuYPcQe4gd5A7yB3kDnIHuYPckTvIHeQOcge5g9xB7iB3kDvIHeSO3EHuIHeQO8gd5A5yB7mD3EHuIHfkDnIHuYPcQe4gd5A7yB3kDnIHuSN3kDvIHeQOcge5g9xB7iB3kDvIHeSO3EHuIHeQO8gd5A5yB7mD3EHuIHfkDnIHuYPcQe4gd5A7yB3kDnIHuSN3kDvIHeQOcge5g9xB7iB3kDvIHbmD3EHuIHeQO8gd5A5yB7mD3EHuyP3/7q926VgAAAAAYJC/9Sx2FUPoDrqD7qA76A66g+6gO+gOuoPu6A66g+6gO+gOuoPuoDvoDrqD7ugOuoPuoDvoDrqD7qA76A66g+7oDrqD7qA76A66g+6gO+gOuoPu6A66g+6gO+gOuoPuoDvoDrqD7qA7uoPuoDvoDrqD7qA76A66g+6gO7qD7qA76A66g+6gO+gOuoPuoDu6g+6gO+gOuoPuoDus3UF30B10B91Bd9AddAfdQXfQHd1Bd9AddAfdQXfQHXQH3UF30B3dQXfQHXQH3UF30B10B91Bd9Ad3UF30B10B91Bd9AddAfdQXfQHd1Bd9AddAfdQXfQHXQH3UF30B10R3fQHXQH3UF30B10B91Bd9AddEd30B10B91Bd9AddAfdQXfQHXRHd9AddAfdQXfQHXQH3UF30B10R3fQHXQH3UF30B10B91Bd9AddEd30B10B91Bd9AddAfdQXfQHXQH3dEddAfdQXfQHXQH3UF30B10B93RHXQH3UF30B10B91Bd9AddAfd0R10B91Bd9AddAfdQXfQHXQH3dEddAfdQXfQHXQH3UF30B10B90hcCKiPodek2oAAAAASUVORK5CYII=";
var LoaderScene = cc.Scene.extend({
ctor: function(a, b) {
this._super();
this.debugId = "LoadingScene";
this.bundles = a;
this.screen = new cc.Node;
this.addChild(this.screen, 10);
a = void 0;
b = cleverapps.wait(3, b);
connector.platform.oneOf(connector.SAMSUNG) ? a = function() {
cleverapps.timeouts.setTimeout(b, 3E3)
}
: b();
var c = new LoaderSceneBackground({
onShowAgeRestriction: a
});
this.screen.addChild(c);
var d = cleverapps.waitNoMore(1E3, b);
cleverapps.bundleLoader.loadBundle(c.getBackgroundBundle(), {
onSuccess: this.createListener(function() {
this.background = c;
c.addBackground();
d()
}
.bind(this))
});
cleverapps.bundleLoader.loadBundle(c.getAnimationsBundle(), {
onSuccess: this.createListener(function() {
c.addAnimations()
})
});
this.updateSize();
this.sceneName = cleverapps.Environment.SCENE_LOADER;
cleverapps.environment.setScene(this.sceneName);
var e = connector.platform.oneOf(connector.INSTANT, connector.TON, connector.WORTAL, connector.SAMSUNG);
e || this.loadProgressBar(this.addProgressBar.bind(this));
LoaderScene.startLoading(this.bundles.slice(), {
onSuccess: function() {
b()
},
onFailure: this.onLoadError,
onProgress: function(f) {
e && connector.platform.reportLoadingProgress(f);
connector.platform.oneOf(connector.WECHAT) && this.logLoadingProgress(f);
this.progressBar && this.progressBar.setPercentage(f, {
animated: !0
})
}
.bind(this)
});
window.wechatFirstScreen && (this._canvas.active = !1);
this.bundles = this.bundles.concat([c.getBackgroundBundle(), c.getAnimationsBundle()])
},
logLoadingProgress: cleverapps.accumulate(5E3, function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.LOADER_PROGRESS + a)
}),
addProgressBar: function(a, b) {
b = this.progressBar = new ScaledProgressBar({
progress: (new cc.Sprite(b)).getSpriteFrame(),
background: (new cc.Sprite(a)).getSpriteFrame()
});
a = cleverapps.styles.LoaderScene;
var c = cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL && a.progressBar.scale9.wideWidth ? a.progressBar.scale9.wideWidth : a.progressBar.scale9.width
, d = cleverapps.resolution.getBgSize().width;
c = Math.min(c, d / 2);
b.setLength(c);
b.setLocalZOrder(11);
b.setScale(resolutionScale);
b.setPositionRound(a.progressBar);
this.screen.addChild(b);
b = this.message = cleverapps.UI.__generateNotLocalizedText(LoaderScene.getLoadingText(), cleverapps.styles.FONTS.LOADING_TEXT || cleverapps.styles.FONTS.TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setPositionRound(a.message);
b.setLocalZOrder(11);
b.width < a.progressBar.scale9.width && b.setDimensions(a.progressBar.scale9.width, 0);
this.screen.addChild(b)
},
onLoadError: function(a, b) {
this.message && this.message.setString("Error loading! Retry number: " + b)
},
completeAnimationOnResize: function() {},
loadProgressBar: function(a) {
var b, c, d = cleverapps.wait(2, function() {
a(b, c)
});
if (connector.platform.oneOf(connector.WECHAT)) {
var e = loadingA;
var f = loadingB
} else
e = document.getElementById("loadingA").src,
f = document.getElementById("loadingB").src;
cc.loader.loadImg(e, function(g, h) {
b = h;
d()
});
cc.loader.loadImg(f, function(g, h) {
c = h;
d()
})
},
updateSize: function() {
var a = cleverapps.resolution.getSafePadding();
this.setContentSize(cleverapps.resolution.getSceneSize());
this.setPosition(a.left, a.bottom);
this.screen.setContentSize(cleverapps.resolution.getBgSize());
this.screen.setPosition(-a.left, -a.bottom)
},
unload: function(a) {
a.prevSceneBundles = this.bundles;
a = cleverapps.substract(this.bundles, a.bundles);
cleverapps.bundleLoader.deleteBundles(a);
cleverapps.resolution.showCanvas()
}
});
LoaderScene.startLoading = function(a, b) {
LoaderScene.start = Date.now();
b = b || {};
var c = b.onProgress
, d = [].concat.apply([], a.map(function(f) {
return bundles[f].listUrls()
}))
, e = function(f) {
cc.loader.load(d, function(g, h, k) {
c(Math.min(Math.round(k / h * 100 | 0), 100))
}, function(g) {
g ? (f++,
b.onFailure && b.onFailure(g, f),
10 > f && e(f)) : (c(100),
cleverapps.bundleLoader.loadBundles(a, {
onSuccess: b.onSuccess
}))
})
};
e(0)
}
;
LoaderScene.getLoadingText = function() {
var a = {
en: "Loading",
ru: "\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430",
ja: "\u8aad\u307f\u8fbc\u307f\u4e2d",
zh: "\u8f7d\u5165\u4e2d",
es: "cargando",
de: "Wird geladen",
pt: "Carregando",
it: "Caricamento in corso",
ar: "\u062c\u0627\u0631 \u0627\u0644\u062a\u062d\u0645\u064a\u0644",
ko: "\ub85c\ub4dc \uc911",
tr: "Y\u00fckleniyor",
nl: "bezig met laden",
fr: "chargement"
};
return (a[cleverapps.settings.language] || a.en) + "..."
}
;
cleverapps.styles.LoaderScene = {
progressBar: {
x: {
align: "center"
},
y: 70,
scale9: {
width: 400
}
},
message: {
x: {
align: "center"
},
y: 130
}
};
var LoaderSceneBackground = cc.Node.extend({
ctor: function(a) {
this._super();
this.onShowAgeRestriction = a.onShowAgeRestriction;
a = cleverapps.resolution.getBgSize();
this.horizontalMode = a.width / a.height > 1 / cleverapps.ASPECT_RATIO;
if (a.width < cleverapps.SETUP_RESOLUTION_MIN_FRAME_SIZE || a.height < cleverapps.SETUP_RESOLUTION_MIN_FRAME_SIZE)
this.horizontalMode = !0;
this.setVisible(!1);
this.updateSize();
connector.platform.oneOf(connector.WECHAT) && this.addDescription();
connector.platform.oneOf(connector.SAMSUNG, connector.WECHAT) && this.addAgeRestriction();
this.transitionBundles = [this.getBackgroundBundle(), this.getAnimationsBundle()]
},
getBackgroundBundle: function() {
var a = "loading_scene_images_vertical";
this.horizontalMode && (a = "loading_scene_images_horizontal");
return bundles[a] ? a : "loading_scene_images_" + cleverapps.config.orientation
},
getAnimationsBundle: function() {
return "loading_scene"
},
updateSize: function() {
var a = cleverapps.resolution.getBgSize();
this.setContentSize2(a)
},
addBackground: function() {
var a = cleverapps.styles.LoaderSceneBackground
, b = bundles[this.getBackgroundBundle()].urls.background;
a = this.background = a.pattern ? cleverapps.UI.createPatternSprite(b, cleverapps.resolution.getBgSize()) : new cc.Sprite(b);
this.addChild(a, -1);
this.setVisible(!0);
cleverapps.resolution.showCanvas();
this.addAnimations();
this.setupChildren();
this.triggerShowAgeRestriction();
cc.game.isPaused() && cc.game.step()
},
addDescription: function() {
var a = cleverapps.styles.LoaderSceneBackground
, b = this.description = cleverapps.UI.generateOnlyText("\u5065\u5eb7\u6e38\u620f\u5fe0\u544a\n\u62b5\u5236\u4e0d\u826f\u6e38\u620f,\u62d2\u7edd\u76d7\u7248\u6e38\u620f,\u6ce8\u610f\u81ea\u6211\u4fdd\u62a4,\u8c28\u9632\u53d7\u9a97\u4e0a\u5f53.\n\u9002\u5ea6\u6e38\u620f\u76ca\u8111,\u6c89\u8ff7\u6e38\u620f\u4f24\u8eab,\u5408\u7406\u5b89\u6392\u65f6\u95f4,\u4eab\u53d7\u5065\u5eb7\u751f\u6d3b.\n\u6279\u51c6\u6587\u53f7\uff1a\u65b0\u5e7f\u51fa\u5ba1[2016]4509\u53f7 \u8f6f\u8457\u767b\u8bb0\u53f7\uff1a2016SR194719\n\u8457\u4f5c\u6743\u4eba\uff1a\u5e7f\u5dde\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u9650\u516c\u53f8 \u51fa\u7248\u7269\u53f7\uff1aISBN 978-7-7979-3066-6\n\u51fa\u7248\u5355\u4f4d\u540d\u79f0\uff1a\u5e7f\u5dde\u76c8\u6b63\u4fe1\u606f\u6280\u672f\u6709\u9650\u516c\u53f8 \u8fd0\u8425\u5355\u4f4d\uff1a\u6df1\u5733\u5f69\u82fb\u79d1\u6280\u6709\u9650\u516c\u53f8", cleverapps.styles.FONTS.LOADER_SCENE_DESCRIPTION);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.description.width, 0);
b.setPositionRound(a.description);
this.addChild(b)
},
addAgeRestriction: function() {
cleverapps.isLocalhost() && (ageRestrictionSrc = "cleverapps/res/samsung/age_restriction.png");
cc.loader.loadImg(ageRestrictionSrc, function(a, b) {
a = cleverapps.styles.LoaderSceneBackground;
var c = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL;
b = this.ageRestriction = new cc.Sprite(b);
b.setScale(c ? a.ageRestriction.vert.scale : 1);
b.setPositionRound(a.ageRestriction);
this.addChild(b);
this.triggerShowAgeRestriction()
}
.bind(this))
},
triggerShowAgeRestriction: function() {
this.visible && this.ageRestriction && this.onShowAgeRestriction && (this.onShowAgeRestriction(),
delete this.onShowAgeRestriction)
},
addAnimations: function() {
// uptap logo
if (this.background && cleverapps.bundleLoader.isLoaded(this.getAnimationsBundle())) {
var a = this.logo = new cleverapps.Spine(bundles.loading_scene.jsons.logo_json)
, b = a.hasAnimation("animation_" + cleverapps.settings.language) ? cleverapps.settings.language : cc.sys.LANGUAGE_ENGLISH
, c = a.hasAnimation("animation_" + b + "_" + connector.info.source) ? "_" + connector.info.source : "";
a.setAnimationAndIdleAfter("animation_" + b + c, "animation_" + b + "_idle" + c);
a.setLocalZOrder(10);
// this.addChild(a);
// 替换为静态logo uptap_logo
// var a = this.logo = new cleverapps.Spine("res/spine/uptap_logo.json")
bundles.loading_scene.jsons.bg_json && (a = cleverapps.styles.LoaderSceneBackground,
b = this.customAnimation = new cleverapps.Spine(bundles.loading_scene.jsons.bg_json),
b.setAnimation(0, "animation", !1),
b.setPositionRound(this.horizontalMode ? a.customAnimation.pos : a.customAnimation.posVert),
this.background.addChild(b));
this.setupChildren()
}
},
setupChildren: function() {
if (this.background) {
var a = cleverapps.styles.LoaderSceneBackground
, b = cleverapps.resolution.getBgSize()
, c = this.logo
, d = this.background;
d.setScale(Math.max(b.height / d.height, b.width / d.width));
d.setPosition(this.width / 2, this.height / 2);
if (c) {
d = Math.max(d.scale, 1);
var e = d * c.width
, f = .9 * b.width;
a.logoAnimation.canScale && e > f && (d *= f / e);
c.setScale(d);
a = !this.horizontalMode && a.logoAnimation.posVert || a.logoAnimation.pos;
c.setPosition(b.width * a.factorX, b.height * a.factorY)
}
}
}
});
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
LOADER_SCENE_DESCRIPTION: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: {
size: 4,
color: new cc.Color(116,49,161,200)
}
}
});
cleverapps.styles.LoaderSceneBackground = {
ageRestriction: {
x: {
align: "right",
dx: -30
},
y: {
align: "top",
dy: -30
},
vert: {
scale: .5
}
},
description: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 215
},
width: 1450
},
logoAnimation: {
canScale: !0,
pos: {
factorX: .5,
factorY: .5
}
}
};
var CustomRewardView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.reward = a;
this.index = b;
this.hasAnimation = RewardTypes[a.type].getCustomRewardIcon()instanceof VirtualJson;
this.createIcon();
this.createTooltip();
this.createAnimation();
this.createProgress();
this.setVisible(!1);
this.updateSize()
},
setUpIconSpine: function() {
var a = RewardTypes[this.reward.type]
, b = new cleverapps.Spine(a.getCustomRewardIcon());
a = a.getCustomRewardIconAnimation ? a.getCustomRewardIconAnimation(this.reward.options).before : "animation";
b.setAnimation(0, a, !0);
return b
},
setUpIconSprite: function() {
return new cc.Sprite(RewardTypes[this.reward.type].getCustomRewardIcon())
},
createIcon: function() {
var a = cleverapps.styles.CustomRewardView.icon
, b = cleverapps.skins.getSlot("sidebarBg") || bundles.sidebar.frames.icon_bg;
b = this.bg = cleverapps.UI.createScale9Sprite(b);
this.addChild(b);
b.setPositionRound(b.width / 2, b.height / 2);
this.setContentSize(b.getContentSize());
var c = this.icon = this.hasAnimation ? this.setUpIconSpine() : this.setUpIconSprite();
c.setPositionRound(a.position);
b.addChild(c)
},
createTooltip: function(a) {
if (RewardTypes[this.reward.type].getCustomRewardText) {
var b = cleverapps.styles.CustomRewardView.tooltip
, c = this.tooltip = new cc.Scale9Sprite(bundles.custom_reward.frames.tooltip_bubble);
c.setContentSize2(b);
c.setPositionRound(b);
c.setVisible(!1);
this.addChild(c);
var d = new cc.Sprite(bundles.custom_reward.frames.tooltip_arrow);
d.setPositionRound(b.arrow);
c.addChild(d);
a = this.tooltipText = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.CUSTOM_REWARD_TOOLTIP_TEXT);
a.fitTo(c.width - b.offset);
a.setPositionRound(c.width / 2, c.height / 2);
c.addChild(a)
}
},
createAnimation: function() {
if (RewardTypes[this.reward.type].getCustomRewardAnimation) {
var a = cleverapps.styles.CustomRewardView
, b = this.rewardAnimation = new cleverapps.Spine(RewardTypes[this.reward.type].getCustomRewardAnimation());
b.setPositionRound(a.animation);
b.setVisible(!1);
this.addChild(b)
}
},
createProgress: function() {
var a = RewardTypes[this.reward.type];
if (a.getCustomRewardProgress && a.getCustomRewardProgress()) {
var b = cleverapps.styles.CustomRewardView
, c = a.getCustomRewardProgressAnimation ? a.getCustomRewardProgressAnimation(this.reward.options).before : "animation";
a = this.progress = new cleverapps.Spine(a.getCustomRewardProgress());
a.setAnimation(0, c, !0);
a.setPositionRound(b.progress);
a.setScale(Math.min(1, this.width / a.width));
this.bg.addChild(a)
}
},
collectAnimate: function() {
var a = cleverapps.styles.CustomRewardView
, b = RewardTypes[this.reward.type]
, c = this.index * this.getAnimationDuration();
this.runAction(new cc.Sequence(new cc.DelayTime(c + .1),new cc.Show,new cc.DelayTime(1.4),new cc.CallFunc(function() {
b.getCustomRewardCloseSound && cleverapps.audio.playSound(b.getCustomRewardCloseSound())
}
),(new cc.MoveBy(.5,a.hideOffset,0)).easing(cc.easeInOut(1)),new cc.RemoveSelf));
this.bg.runAction(new cc.Spawn(new cc.Sequence(new cc.DelayTime(c),new cc.MoveBy(0,a.hideOffset,0),new cc.DelayTime(.2),new cc.CallFunc(function() {
b.getCustomRewardOpenSound && cleverapps.audio.playSound(b.getCustomRewardOpenSound())
}
),(new cc.MoveBy(.5,-a.hideOffset,0)).easing(cc.easeBackOut(1))),new cc.Sequence(new cc.DelayTime(c + .1),new cc.CallFunc(function() {
this.rewardAnimation && (this.rewardAnimation.setVisible(!0),
this.rewardAnimation.setAnimation(0, "animation", !1),
this.rewardAnimation.setCompleteListenerRemove());
if (b.getCustomRewardIconAnimation && this.icon) {
var d = b.getCustomRewardIconAnimation(this.reward.options);
this.icon.setAnimationAndIdleAfter(d.during, d.after)
}
b.getCustomRewardIconAnimation && this.progress && (d = b.getCustomRewardProgressAnimation(this.reward.options),
this.progress.setAnimationAndIdleAfter(d.during, d.after))
}
.bind(this)))));
this.tooltip && (this.tooltip.setScale(.2),
this.tooltip.runAction(new cc.Sequence(new cc.DelayTime(c + .1),new cc.Show,new cc.RotateBy(0,a.tooltip.showUpRotation),new cc.Spawn(new cc.Sequence(new cc.MoveBy(0,a.tooltip.xOffset,-a.tooltip.yOffset),new cc.MoveBy(.3,-a.tooltip.xOffset,a.tooltip.yOffset)),new cc.Sequence(new cc.ScaleTo(.4,1.2),new cc.ScaleTo(.2,1)),new cc.Sequence((new cc.RotateBy(.3,-a.tooltip.showUpRotation)).easing(cc.easeOut(2)),new cc.RotateBy(.1,-a.tooltip.afterShowUpRotation),new cc.RotateBy(.1,a.tooltip.afterShowUpRotation))))));
this.tooltipText && (this.tooltipText.setString(b.getCustomRewardText(this.reward.getValue(), !0)),
c = this.tooltipText.getScale(),
this.tooltipText.runAction(new cc.Sequence(new cc.DelayTime(1),new cc.CallFunc(function() {
b.getCustomRewardSound && cleverapps.audio.playSound(b.getCustomRewardSound())
}
),new cc.ScaleTo(.15,1.3 * c),new cc.CallFunc(function() {
this.tooltipText.setString(b.getCustomRewardText(this.reward.getValue()));
this.tooltipText.fitTo(this.tooltip.width - a.tooltip.offset)
}
.bind(this)),new cc.CallFunc(function() {
b.getCustomRewardAfterUpdateSound && cleverapps.audio.playSound(b.getCustomRewardAfterUpdateSound())
}
),new cc.ScaleTo(.15,c))))
},
getAnimationDuration: function() {
return 1.5
},
updateSize: function() {
var a = cleverapps.styles.CustomRewardView;
this.setScale(cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? .8 : 1);
var b = cleverapps.resolution.getSceneSize();
this.setPositionRound(b.width - this.width - a.padding, a.y)
}
});
cleverapps.styles.COLORS.CUSTOM_REWARD_TOOLTIP_COLOR = new cc.Color(148,49,19,255);
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CUSTOM_REWARD_TOOLTIP_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.CUSTOM_REWARD_TOOLTIP_COLOR
}
});
cleverapps.styles.CustomRewardView = {
y: 120,
hideOffset: 500,
padding: 10,
tooltip: {
arrow: {
x: {
align: "right",
dx: 8
},
y: {
align: "bottom",
dy: -8
}
},
x: {
align: "left",
dx: -80
},
y: {
align: "top",
dy: 45
},
width: 125,
height: 75,
offset: 20,
showUpRotation: 150,
afterShowUpRotation: 10,
xOffset: 200,
yOffset: 100
},
animation: {
x: {
align: "center"
},
y: {
align: "center"
}
},
progress: {
x: {
align: "left",
dx: 0
},
y: {
align: "bottom",
dy: -40
}
},
icon: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
text: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -60
}
}
}
};
var VictoryWindow = CleverappsWindow.extend({
ctor: function(a) {
this.game = a;
this.boatswain = a.boatswain;
this.next = void 0;
(this.rewards = new RewardsList(a.rewards,{
event: a.level.isBonus() ? cleverapps.EVENTS.EARN.BONUS_LEVEL_REWARD : cleverapps.EVENTS.EARN.LEVEL_REWARD
})).receiveRewards();
this._super()
},
onWindowLoaded: function() {
var a = cleverapps.styles.VictoryWindow;
if (this.rumble = cleverapps.isRumble() && cleverapps.meta.getRumble())
(this.rumbleRound = this.rumble.getPrevRound()) || cleverapps.throwAsync("can't find round for rumble [" + this.rumble.rounds.map(function(b) {
return b.players && b.players.join(",")
}).join("],[") + "]");
this.content = new cleverapps.Layout(this.listComponents(),{
direction: cleverapps.UI.VERTICAL,
padding: a.padding,
margin: a.margin
});
this._super({
name: "victorywindow",
title: this.getTitleText(),
shareId: !this.rumble && !cleverapps.instantTournament.isInTournament() && "victory",
styles: a,
content: this.content,
homeButton: !this.rumble,
fireworks: !cleverapps.isKnockoutGame() && this.game.outcome === GameBase.OUTCOME_VICTORY,
noBackground: !0,
closeButtonManual: !0
});
this.boatswain && this.boatswain.setIntent(this.boatswain.canNext() ? Boatswain.NEXT_INTENT : Boatswain.RETURN_INTENT);
this.runAction(new cc.Sequence(new cc.DelayTime(a.soundDelay || 0),new cc.PlaySound(bundles.victory_window.urls.win_effect)));
this.rewardsList.showUp(this.delayedShowUp.bind(this));
this.content.children.forEach(function(b) {
b.showUp && b !== this.rewardsList && b.showUp()
}
.bind(this))
},
getPerson: function() {
return {
role: "hero",
emotion: "happy"
}
},
getTitleText: function() {
return this.rumble ? this.rumbleRound && this.rumbleRound.isLast() ? "KnockoutWindow.Title.Final" : Messages.get("KnockoutWindow.Title.Round", {
roundId: (this.rumbleRound && this.rumbleRound.id || 0) + 1
}) : this.game.outcome === GameBase.OUTCOME_LOST ? "LoseWindow.title" : "VictoryWindow.Victory"
},
listComponents: function() {
var a = [];
"battlefield" === cleverapps.config.type && a.push(new BattleStatsComponent);
Game.currentGame.getMode() === GameBase.MODE_HIGHSCORE && (a.push(new VictoryScoreComponent),
a.push(new ScoreStatsComponent));
a.push(this.createRewards());
(this.game.level.isBonus() || this.game.level.isHard()) && bundles.victory_window.jsons.bonus_animation_json && a.push(new PictureComponent(this.game.level));
this.rumbleRound && (a.push(new RoundResultsComponent(this.rumbleRound,{
victory: !0
})),
a.push(new RoundCountdownComponent(function() {
this.closed || this.close()
}
.bind(this))));
return a
},
createRewards: function() {
var a = cleverapps.styles.VictoryWindow.rewards;
a = this.rewardsList = new RewardsListComponent(this.rewards,{
columns: cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? 3 : 5,
iconWrap: a.iconWrap,
textMargin: a.textMargin,
font: cleverapps.styles.FONTS.REWARDWINDOW_VALUE_TEXT,
noShowControls: !1,
event: cleverapps.EVENTS.EARN.LEVEL_REWARD,
shine: a.shine,
filterCustomAnimation: !0
});
a.setLocalZOrder(2);
return a
},
beforeCloseAnimation: function(a) {
this.content.children.forEach(function(b) {
b.beforeWinClose && b.beforeWinClose()
});
this.runAction(new cc.Sequence(new cc.TargetedAction(this.rewardsList,this.rewardsList.receiveRewardsAction()),new cc.CallFunc(function() {
this.persons && (this.persons.hide(),
delete this.persons);
this.rewardText && this.rewardText.runAction(new cc.FadeOut(.3));
this.windowTitle && this.windowTitle.hide()
}
.bind(this)),new cc.CallFunc(function() {
cleverapps.aims.whenAllHidden(a)
}
)))
},
getPreferredBundles: function() {
return ["game"]
},
listBundles: function() {
return ["victory_window"].concat(this.rewards.listBundles())
}
});
cleverapps.styles.VictoryWindow = {
margin: 40,
padding: {
top: 60,
bottom: 100
},
rewards: {
textMargin: 0,
iconWrap: {
width: 130,
height: 130
},
margin: 30,
padding: {
x: 0,
y: 0
}
}
};
var LoseWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.level = a.level;
var b = cleverapps.styles.LoseWindow
, c = cleverapps.once(this.createListener(this.setReplay.bind(this, a.boatswain)))
, d = cleverapps.once(this.createListener(function() {
if (cleverapps.unlimitedLives && cleverapps.unlimitedLives.freeOfferIsAvailable())
return cleverapps.unlimitedLives.showFreeOffer(c),
!0
}))
, e = cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_DISABLED && cleverapps.lives && cleverapps.lives.isEmpty()
, f = [];
cleverapps.isKnockoutGame() || e || (f.push(this.createTryAgainButton(c, d)),
cleverapps.timeouts.setTimeout(function() {
d()
}, 1550));
this._super({
name: "losewindow",
content: this.createContent(a),
title: {
text: "LoseWindow.title",
font: cleverapps.styles.FONTS.LOSE_WINDOW_TITLE_TEXT
},
noBackground: b.noBackground,
openSound: bundles.lose_window.urls.lose_effect,
buttons: f
});
cleverapps.lives && (cleverapps.lives.onChangeAmountListeners.losewindow = this.createListener(this.updateWindow.bind(this)));
b.hardLevel && this.level.isHard() && (a = new HardLevelWindowIcon,
a.setPositionRound(b.hardLevel),
a.pulseAnimation(),
this.window.addChild(a))
},
setReplay: function(a) {
a && a.setIntent(Boatswain.REPLAY_INTENT);
this.close()
},
createTryAgainButton: function(a, b) {
var c = cleverapps.styles.LoseWindow;
return new cleverapps.UI.Button({
text: "TryAgain",
width: c.button.width,
height: c.button.height,
onClicked: function() {
b && b() || (cleverapps.lives && cleverapps.lives.isEmpty() ? new LivesShopWindow({
onClose: function() {
cleverapps.lives.isEmpty() || a()
}
}) : a())
}
})
},
onShow: function() {
var a = 0;
this.content.children.forEach(function(b) {
b.showUp && (a += b.showUp())
});
cleverapps.config.features.includes("lantern_start") && 0 < Lantern.GetPreviousStreak(this.level) && this.runLanternAnimation();
this._super(a / 1E3 + .5)
},
runLanternAnimation: function() {
var a = cleverapps.styles.LoseWindow.lantern
, b = new cc.Node;
b.setVisible(!1);
b.setScale(cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? .8 : 1);
cleverapps.scenes.getMovingNode().addChild(b);
var c = cleverapps.UI.createScale9Sprite(cleverapps.skins.getSlot("sidebarBg") || bundles.sidebar.frames.icon_bg);
b.addChild(c);
c.setPositionRound(c.width / 2, c.height / 2);
b.setContentSize(c.getContentSize());
var d = new cleverapps.Spine(bundles.lantern.jsons.lantern_reward_json);
d.setAnimation(0, "idle_" + String(Lantern.GetPreviousStreak(this.level)), !0);
d.setPositionRound(c.width / 2, c.height / 2);
c.addChild(d);
b.setPositionRound(cleverapps.resolution.getSceneSize().width - b.width - a.padding, a.y);
b.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.Show,new cc.DelayTime(1.4),(new cc.MoveBy(.5,a.hideOffset,0)).easing(cc.easeInOut(1)),new cc.RemoveSelf));
c.runAction(new cc.Spawn(new cc.Sequence(new cc.MoveBy(0,a.hideOffset,0),new cc.DelayTime(.2),(new cc.MoveBy(.5,-a.hideOffset,0)).easing(cc.easeBackOut(1))),new cc.Sequence(new cc.DelayTime(.1),new cc.CallFunc(function() {
d.setAnimationAndIdleAfter("lose_" + String(Lantern.GetPreviousStreak(this.level)), "idle_0");
cleverapps.audio.playSound(bundles.lantern.urls.lantern_lose_effect)
}
.bind(this)))))
},
getPerson: function() {
return {
role: "hero",
emotion: "sad"
}
},
createAnimationNode: function() {
var a = cleverapps.styles.LoseWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.animation);
this.animation = new cleverapps.Spine(bundles.lose_window.jsons.lose_json);
var c = cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed() ? "open_unlim" : "open";
this.animation.setAnimationAndIdleAfter(c, "idle");
b.addChild(this.animation);
this.animation.setPositionRound(a.animation);
return b
},
createLivesLayout: function(a) {
for (var b = cleverapps.styles.LoseWindow, c = [], d = 0; d < cleverapps.lives.getMaxLives(); d++) {
if (d === cleverapps.lives.amount && a) {
var e = new cleverapps.Spine(bundles.lose_window.jsons.level_failed_small_hearts_json);
e.setAnimation(0, "animation", !1)
} else
e = new cc.Sprite(d < cleverapps.lives.amount ? bundles.lose_window.frames.level_failed_heart_png : bundles.lose_window.frames.level_failed_heart_empty_png);
c.push(e)
}
return new cleverapps.Layout(c,{
direction: cleverapps.UI.HORIZONTAL,
margin: b.heartsMargin
})
},
createLivesLeftBlock: function() {
var a = cleverapps.styles.LoseWindow
, b = []
, c = cleverapps.styles.FONTS.LOSE_WINDOW_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT;
cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed() ? (c = cleverapps.UI.generateOnlyText("LoseWindow.livesLeftUnlimited", c),
c.setDimensions(a.livesLeftText.width, 0),
c.fitTo(void 0, a.livesLeftText.height),
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
b.push(c)) : (c = cleverapps.UI.generateOnlyText("LoseWindow.livesLeft", c),
c.fitTo(a.livesLeftText.width, a.livesLeftText.height),
b.push(c),
this.heartsNode = this.createLivesLayout(!0),
b.push(this.heartsNode));
return new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.livesLeftMargin
})
},
createContent: function(a) {
var b = cleverapps.styles.LoseWindow
, c = [];
if (a.useLives()) {
var d = this.createAnimationNode();
c.push(d);
this.livesLeftBlock = this.createLivesLeftBlock();
c.push(this.livesLeftBlock)
}
a.getMode() === GameBase.MODE_HIGHSCORE && (c.push(new VictoryScoreComponent),
c.push(new ScoreStatsComponent));
return new cleverapps.Layout(c,{
direction: cleverapps.UI.VERTICAL,
margin: b.content.margin,
padding: b.content.padding
})
},
updateWindow: function() {
if (this.heartsNode) {
var a = this.createLivesLayout()
, b = this.heartsNode.getPosition()
, c = this.heartsNode.getParent();
this.heartsNode.removeFromParent();
c.addChild(a);
a.setPositionRound(b);
this.heartsNode.debugBorder();
this.heartsNode = a
}
},
listBundles: function() {
return ["lose_window"]
}
});
cleverapps.styles.LoseWindow = {
heartsMargin: 5,
livesLeftMargin: 15,
livesLeftText: {
width: 800,
height: 180
},
content: {
margin: 40,
padding: {
x: 80,
bottom: 50,
top: 50
}
},
animation: {
width: 300,
height: 300,
x: {
align: "center"
},
y: {
align: "center"
}
},
button: {
width: 300,
height: 100
},
lantern: {
hideOffset: 500,
y: 120,
padding: 10
}
};
var LevelStartWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.options = a;
this.level = a.level;
this.isHardLevel = this.level.isHard() && !this.level.isDailyLevel();
a.boostersBefore && (this.boostersBefore = new WindowBoostersBefore(this.level),
cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem"));
a = cleverapps.styles.LevelStartWindow;
var b = this.isLanternStartWindow() ? a.lanternStart : a;
b = new cleverapps.Layout(this.listContent(),{
direction: cleverapps.UI.VERTICAL,
reversed: !0,
margin: b.margin,
padding: b.padding
});
this._super({
title: this.getTitle(),
name: "levelstartwindow",
content: b,
button: this.getButton(),
level: this.level,
closeButton: !cleverapps.environment.isGameScene(),
showSound: this.getShowSound()
});
a.hardLevel && this.isHardLevel && (b = new HardLevelWindowIcon,
b.setPositionRound(a.hardLevel),
"heroes" === cleverapps.config.ui && b.pulseAnimation(),
this.window.addChild(b));
(a = this.createCoinBadge({
danger: this.level.isDanger(),
lantern: this.level.isBonus() && this.isLanternStartWindow()
})) && this.window.addChild(a);
this.setCoinsRain()
},
getPerson: function() {
return "hero"
},
getShowSound: function() {
if (this.level.isBonus())
return bundles.main.urls.levelstartwindow_open_bonus_effect;
if (this.level.isHard())
return bundles.main.urls.levelstartwindow_open_hard_effect
},
onPopUpAnimationFinished: function() {
this.boostersBefore && this.boostersBefore.showTutorialSteps()
},
onClose: function() {
cleverapps.focusManager.hideControlsWhileFocused("MenuBarGoldItem");
this.coinsRain && (this.coinsRain.removeFromParent(),
this.coinsRain = void 0)
},
getTitle: function() {
var a = "";
this.level.isRegular() && (a = cleverapps.meta.getType() !== Meta.HOSE || this.level.isCurrentLevel() ? cleverapps.user.getVirtualDisplayLevel() : this.level.getHumanReadableNumber());
return {
text: this.getTitleText(),
font: cleverapps.styles.FONTS.WINDOW_TITLE_TEXT,
toReplace: {
levelNo: a
}
}
},
getTitleText: function() {
return this.level.isDailyCup() ? "Cups.daily.title" : this.isHardLevel ? "message.hardLevel" : this.level.isTricky() ? "message.trickyLevel" : this.level.isBonus() ? "message.bonusLevel" : this.level.isDailyLevel() ? "DailyLevelWindow.title" : cleverapps.user.isPassedAll() && cleverapps.meta.getType() === Meta.HOSE && this.level.isCurrentLevel() ? "LevelStartWindow.ComingSoonTitle" : "LevelStartWindow.title"
},
getButton: function() {
var a = {
button_png: bundles.buttons_main.frames.play_button_png,
button_on_png: bundles.buttons_main.frames.play_button_on_png
};
this.isHardLevel && (a = {
button_png: bundles.buttons.frames.red_button,
button_on_png: bundles.buttons.frames.red_button_on
});
if (this.level.isTricky() || this.level.isBonus())
a = {
button_png: bundles.buttons.frames.blue_button_png,
button_on_png: bundles.buttons.frames.blue_button_png
};
var b = cleverapps.once(function() {
cleverapps.focusManager.distract({
focus: "LevelStartFromLevelStartWindow",
action: function(c) {
this.close();
var d = [];
this.boostersBefore && (d = d.concat(this.boostersBefore.listActionsBefore()));
this.isLanternStartWindow() && (d = d.concat(Lantern.ListActionsBefore(this.level)));
this.level.play(c, {
actionsBefore: d
})
}
.bind(this)
})
}
.bind(this));
a = {
width: cleverapps.styles.LevelStartWindow.Button.width,
height: cleverapps.styles.LevelStartWindow.Button.height,
type: a,
onPressed: function() {
cleverapps.lives && cleverapps.lives.isEmpty() ? new LivesShopWindow : b()
}
};
a.text = Messages.get("Play").toUpperCase();
return a
},
listContent: function() {
var a = cleverapps.styles.LevelStartWindow
, b = [];
if (this.boostersBefore) {
var c = new BoostersBeforeComponent(this.boostersBefore,this.isLanternStartWindow());
b.push(c);
this.isLanternStartWindow() && (c = new LanternStartComponent(this.level),
b.push(c))
}
this.options.danger && b.push(new cc.Sprite(bundles.level_start_window.frames.start_bg));
"crocword" === cleverapps.config.name && this.level.isHard() ? b = b.concat(this.setCoinsView(bundles.level_start_window.jsons.hard_animation, a.coinsBg)) : this.level.isBonus() && !this.isLanternStartWindow() && (b = b.concat(this.setCoinsView(bundles.level_start_window.jsons.bonus_animation, a.coinsBg)));
return b
},
createCoinBadge: function(a) {
if (a.danger || a.lantern) {
var b = cleverapps.styles.LevelStartWindow.lanternStart.coinBadge
, c = new cc.Node;
c.setPositionRound(b);
var d = this.coinBadgeLabel = new cc.Sprite(bundles.level_start_window.frames.label || bundles.lantern_start.frames.lantern_bonus_label);
d.setAnchorPoint(b.label.anchor.x, b.label.anchor.y);
d.setPositionRound(b.label);
if ("riddles" === cleverapps.config.ui) {
var e = a.danger ? b.label.danger : b.label
, f = new cc.Sprite(a.danger ? bundles.level_start_window.frames.gold_small_png : bundles.level_start_window.frames.reward_gold_png);
e.icon && e.icon.scale && f.setScale(e.icon.scale);
a = e.icon.offset;
f.setPosition(d.width / 2 + a.x, d.height / 2 + a.y);
d.addChild(f);
e.text && (f = cleverapps.UI.generateImageText("+" + GameBase.DANGER_REWARD, cleverapps.styles.FONTS.LABEL_TEXT),
f.setRotation(13),
a = e.text.offset,
f.setPosition(d.width / 2 + a.x, d.height / 2 + a.y),
d.addChild(f));
e = new cc.Sprite(bundles.level_start_window.frames.label_line);
c.addChild(e, 1)
}
b.label.bonusText && (e = cleverapps.UI.generateOnlyText("LevelStartWindow.BonusLabel", cleverapps.styles.FONTS.LABEL_BONUS_TEXT),
e.setPositionRound(d.width / 2, d.height / 2),
e.setDimensions(b.label.bonusText.width, 0),
e.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
e.fitTo(0, b.label.bonusText.height),
d.addChild(e));
["riddles", "heroes"].includes(cleverapps.config.ui) && (d.setRotation(20),
d.runAction(new cc.Sequence(new cc.RotateBy(.8,-35),new cc.RotateBy(.8,25),new cc.RotateBy(.8,-15),new cc.RotateBy(.8,5))).setFinalize(function() {
d.setRotation(0)
}));
c.addChild(d);
return c
}
},
setCoinsView: function(a, b) {
var c = [];
a ? (a = new cleverapps.Spine(a),
a.setAnimationAndIdleAfter("animation", "idle")) : a = new cc.Sprite(bundles.level_start_window.frames.pot_coins_png);
if (b) {
var d = new cc.Scale9Sprite(bundles.level_start_window.frames.coins_bg_png);
d.setContentSize2(b);
d.addChild(a);
a.setPositionRound({
align: "center"
}, {
align: "center"
});
c.push(d)
} else
c.push(a);
return c
},
setCoinsRain: function() {
if (cleverapps.styles.LevelStartWindow.coinsRain && this.level.isBonus()) {
var a = this.coinsRain = new cleverapps.Spine(bundles.level_start_window.jsons.coinsRain)
, b = cleverapps.styles.LevelStartWindow;
a.setAnimationAndIdleAfter("animation", "idle");
cleverapps.scenes.getRunningScene().addChild(a);
a.setPositionRound(b.coinsRain);
a.setLocalZOrder(BaseWindow.WINDOWS_ZORDER - 1)
}
},
isLanternStartWindow: function() {
return this.options.lantern
},
completeAnimationOnResize: function() {
this.coinBadgeLabel && this.coinBadgeLabel.stopAllActions()
}
});
LevelStartWindow.isAvailable = function(a) {
return "crocword" === cleverapps.config.name && (a.isHard() || a.isBonus()) ? !0 : 0 === cleverapps.boosters.listBoostersBefore().length || 0 === a.episodeNo && 0 === a.levelNo ? !1 : "stacks" === cleverapps.config.subtype ? !cleverapps.GameSaver.load(cleverapps.GameSaver.getStoreSlot(a.episodeNo, a.levelNo)) && WindowBoostersBefore.isAvailable() : "solitaire" === cleverapps.config.type ? WindowBoostersBefore.isAvailable() : !0
}
;
LevelStartWindow.prototype.listBundles = function(a) {
var b = ["level_start_window"];
cleverapps.config.features.includes("boosters_before") && WindowBoostersBefore.isAvailable() && Lantern.IsActive(a.level) && (cleverapps.config.features.includes("lantern_start") ? b.push("lantern_start") : b.push("lantern_element"));
return b
}
;
cleverapps.override(cleverapps.styles.FONTS, {
LABEL_TEXT: {
size: 35
},
LABEL_BONUS_TEXT: {
size: 65,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.LevelStartWindow = {
Button: {
width: 300,
height: 100
},
margin: 40,
lanternStart: {
margin: 30,
coinBadge: {
label: {
anchor: {
x: .56,
y: .83
},
x: {
align: "center",
dx: -40
},
y: {
align: "center",
dy: -122
},
icon: {
offset: {
x: -5,
y: -10
},
scale: .7
},
danger: {
icon: {
offset: {
x: 2,
y: 11
}
},
text: {
offset: {
x: -20,
y: -40
}
}
}
},
x: {
align: "left",
dx: 85
},
y: {
align: "top",
dy: -53
}
}
}
};
var ShopWindow = CleverappsWindow.extend({
ctor: function(a) {
this.options = a || {};
this.tab = this.options.tab;
if (this.tab === ShopWindow.TABS.HARD_CURRENCY && cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_DISABLED)
return !1;
if (a.force && a.force.productOptions) {
var b = a.force.productKey;
this.originalProduct = cleverapps.clone(VirtualProducts[b]);
VirtualProducts[b] = Object.assign(VirtualProducts[b], a.force.productOptions)
}
this.onFinishShowUp = function() {}
;
this._super.apply(this, arguments)
},
needGoldInfo: function() {
return ShopUserGoldView.IsAvailable() && !this.isVertical() && this.tab !== ShopWindow.TABS.LIVES
},
updateGoldInfo: function() {
this.needGoldInfo() ? (this.goldInfo = this.goldInfo || new ShopUserGoldView,
this.goldInfo.showUp()) : this.goldInfo && this.goldInfo.hide(void 0, !0)
},
onWindowLoaded: function() {
var a = cleverapps.styles.ShopWindow;
this.windowTitle = new WindowTitle(this,this.getTitle());
this.windowTitle.setPositionRound(a.title.position.x, a.title.position.y);
this.windowTitle.setVisible(!1);
this.addChild(this.windowTitle);
this.needGoldInfo() && (this.goldInfo = new ShopUserGoldView);
Lottery.addText(this);
this._super({
name: "shopwindow_tab" + this.tab,
content: this.createContent(this.tab),
title: !1,
noBackground: !0,
notCloseByTouchInShadow: !0,
closeButtonDelay: !0,
styles: a,
customTitle: !0
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.SHOP_OPEN + this.tab, {
store_type: this.getTitle()
});
this.tiles.forEach(function(b) {
if (b.onReady)
b.onReady()
});
this.isShowTitle() && this.windowTitle.show();
this.tab === ShopWindow.TABS.HARD_CURRENCY && cleverapps.fallSale.isAvailable() && this.windowTitle.addChild(new FallSaleTitleIcon)
},
showTileForce: function() {
var a = this.tiles.find(function(b) {
return b.tileModel.product.itemId === this.options.force.productKey
}, this);
a && cleverapps.forces.create(a.button, {
pointer: !0
}, {
actives: [a]
})
},
getTitle: function() {
var a = "ShopWindow.title";
if ("merge" === cleverapps.config.type)
switch (this.tab) {
case ShopWindow.TABS.HARD_CURRENCY:
a = "ShopWindow.title.ruby";
break;
case ShopWindow.TABS.LIVES:
a = "ShopWindow.title.energy";
break;
case ShopWindow.TABS.SOFT_CURRENCY:
a = "ShopWindow.title.coins";
break;
case ShopWindow.TABS.UNITS_FRUIT:
a = "ShopWindow.title.fruit";
break;
case ShopWindow.TABS.UNITS_RESOURCE:
a = "ShopWindow.title.resource";
break;
case ShopWindow.TABS.UNITS_DISCOUNT:
a = "ShopWindow.title.discount";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_HALLOWEEN:
a = "ShopWindow.title.expedition.halloween";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_BLACKFRIDAY:
a = "ShopWindow.title.expedition.blackfriday";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_XMAS:
a = "ShopWindow.title.expedition.xmas";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_DRAGONIA:
a = "ShopWindow.title.expedition.dragonia";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_DRAGONIA2:
a = "ShopWindow.title.expedition.dragonia";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_DRAGONIA3:
a = "ShopWindow.title.expedition.dragonia";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_UNDERSEA:
a = "ShopWindow.title.expedition.undersea";
break;
case ShopWindow.TABS.UNITS_ADS:
a = "ShopWindow.title.ads";
break;
case ShopWindow.TABS.UNITS_ADS_VIP:
a = "ShopWindow.title.ads_vip";
break;
case ShopWindow.TABS.UNITS_ADS_UNDECIDED:
a = "ShopWindow.title.ads";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_RAPUNZEL:
a = "ShopWindow.title.expedition.rapunzel";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_EASTER:
a = "ShopWindow.title.expedition.easter";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_COLLECTIONS:
a = "ShopWindow.title.expedition.collections";
break;
case ShopWindow.TABS.UNITS_EXPEDITION_CHINA:
a = "ShopWindow.title.expedition.china"
}
return a
},
onHide: function() {
this._super();
this.goldInfo && this.goldInfo.hide(void 0, !0);
this.hidden = !0
},
buyProduct: function(a, b) {
this.hidden || (cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce(),
a.buy(this.close.bind(this, !0), b),
this.originalProduct && (VirtualProducts[this.options.force.productKey] = this.originalProduct))
},
isVertical: function() {
return cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL
},
getOverlappingNodes: function() {
return this._super().concat(this.windowTitle)
},
inflateWindow: function() {
this._super();
if (!this.closingNow) {
var a = cleverapps.styles.ShopWindow;
this.windowTitle && (this.windowTitle.setVisible(!this.isVertical()),
this.windowTitle.setPositionRound(a.title.position));
var b = cleverapps.resolution.getBgSize()
, c = cleverapps.resolution.getSafePadding()
, d = cleverapps.UI.calcBoundaries(this.getOverlappingNodes());
d = cc.rectSubPadding(d, this.getBackgroundPadding());
var e = cc.padding(b.height - d.y - d.height, b.width - d.x - d.width, d.y, d.x);
this.isVertical() ? this.shopLayout.setScale(Math.min(1, d.width / this.shopLayout.width)) : (this.shopLayout.setScale(Math.min(1, d.height / this.shopLayout.height)),
cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL && connector.info.isMobile && this.shopLayout.setScale(this.shopLayout.scale * a.horizontalMobile.scale));
this.isVertical() ? this.contentWrap.setContentSize(b.width, this.shopLayout.height * this.shopLayout.scaleY + e.top + e.bottom) : this.contentWrap.setContentSize(this.shopLayout.width * this.shopLayout.scaleX + e.left + e.right, b.height);
this.scroll.setContentSize2(b);
this.scroll.setPositionRound(b.width / 2 - c.left, b.height / 2 - c.bottom);
this.scroll.updateInnerContent();
a = this.contentWrap.convertToNodeSpace(cc.p(d.x + d.width / 2, d.y + d.height / 2));
this.isVertical() ? this.shopLayout.setPositionRound(a.x, this.shopLayout.height * this.shopLayout.scaleY / 2 + e.bottom) : this.shopLayout.setPositionRound(this.shopLayout.width * this.shopLayout.scaleX / 2 + e.left, a.y);
a = this.convertToNodeSpace(cc.p(d.x + d.width / 2, d.y + d.height / 2));
this.isVertical() ? (this.shopLayoutPlaceholder.setContentSize(this.shopLayout.width * this.shopLayout.scaleX, this.height),
this.shopLayoutPlaceholder.setPositionRound(a.x, this.height / 2)) : (this.shopLayoutPlaceholder.setContentSize(this.width, this.shopLayout.height * this.shopLayout.scaleY),
this.shopLayoutPlaceholder.setPositionRound(this.width / 2, a.y));
this.scrolledToTile || (this.scrollToTile(),
this.scrolledToTile = !0)
}
},
scrollToTile: function() {
this.scroll.scrollTo(cleverapps.UI.ScrollView.SCROLLS.LOWER_RIGHT);
var a = this.selectTileForScroll()
, b = a || cleverapps.UI.ScrollView.SCROLLS.UPPER_LEFT;
this.runAction(new cc.Sequence(new cc.DelayTime(.8),new cc.CallFunc(function() {
this.scroll.scrollTo(b, .8, {
easing: cc.easeBackInOut(),
callback: this.onFinishShowUp
});
this.options.finger && a && this.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.CallFunc(function() {
a.addFinger()
}
)))
}
,this),new cc.CallFunc(function() {
this.options.force && this.showTileForce()
}
,this)))
},
selectTileForScroll: function() {
var a;
this.options.priorityType && (a = this.tiles.find(function(b) {
return b instanceof this.options.priorityType
}
.bind(this)));
return a = (a = a || this.tiles.find(function(b) {
return b.tileModel.isAttention()
})) || this.tiles.find(function(b) {
return b.tileModel.wantsScroll()
})
},
isShowTitle: function() {
return this.windowTitle && !this.isVertical()
},
setupChildren: function() {
this._super();
if (!this.closingNow) {
if (this.scroll.dir === cleverapps.UI.ScrollView.DIR_HORIZONTAL && this.isVertical() || this.scroll.dir === cleverapps.UI.ScrollView.DIR_VERTICAL && !this.isVertical())
this.scroll.removeFromParent(!0),
this.createContent(this.tab);
this.windowTitle.setVisible(this.isShowTitle());
this.updateGoldInfo()
}
},
createTilesLayout: function() {
var a = cleverapps.styles.ShopWindow
, b = this.isVertical() ? 2 : this.tiles.length
, c = a.padding;
cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL && connector.info.isMobile && (c = a.horizontalMobile.padding);
this.shopLayout = new cleverapps.WrapGridLayout(this.tiles,{
columns: b,
margin: a.margin,
padding: c,
ascZOrder: !0
});
this.shopLayoutPlaceholder = new cc.Node;
this.shopLayoutPlaceholder.avoidNode = "Window";
this.shopLayoutPlaceholder.setAnchorPoint(.5, .5);
this.addChild(this.shopLayoutPlaceholder)
},
createTiles: function(a) {
this.tiles = ShopProductSource.listTileModels(a).map(function(b) {
var c = b.getViewClassName();
b instanceof SubscriptionTileModel && (b.onClaim = this.close.bind(this));
return new c(b,{
onClicked: this.buyProduct.bind(this),
cart: this.cart
})
}, this)
},
createContent: function(a) {
this.createTiles(a);
this.createTilesLayout();
this.contentWrap = new cc.Node;
this.contentWrap.setAnchorPoint(.5, .5);
this.contentWrap.addChild(this.shopLayout);
this.contentWrap.visibilityCheckList = this.tiles;
this.scroll = new cleverapps.UI.ScrollView(this.contentWrap,{
childrenVisibilityPadding: cleverapps.styles.ShopWindow.tilesVisibilityPadding,
direction: this.isVertical() ? cleverapps.UI.ScrollView.DIR_VERTICAL : cleverapps.UI.ScrollView.DIR_HORIZONTAL,
clipping: !1,
scrollBarEnabled: !1
});
this.scroll.setLocalZOrder(1);
this.addChild(this.scroll);
return new cc.Node
},
onShow: function() {
this.updateGoldInfo();
this.hidden = void 0;
this.tilesLayoutShowAnimation();
this._super()
},
getEventNodes: function() {
return this.options.force ? [] : [this]
},
onClose: function() {
this.tab !== ShopWindow.TABS.LIVES || "merge" !== cleverapps.config.type || cleverapps.lives.canTake(.2 * cleverapps.lives.getMaxLives()) || !Game.currentGame.specialEnergyOffer.isReady() || cleverapps.windows.currentWindow()instanceof RewardWindow || Game.currentGame.specialEnergyOffer.wantsToShow();
if (this.options.onClose)
this.options.onClose()
},
beforeCloseAnimation: function(a) {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
var b = cleverapps.windows.currentWindow()instanceof RewardWindow || "undefined" !== typeof UnitsShopTab && UnitsShop.cartRewards && 0 < UnitsShop.cartRewards.length;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.SHOP_CLOSE, {
store_type: this.getTitle(),
stay_time: 3E4 >= Date.now() - this.openTime ? "sec0_30" : "sec30_more",
stay_whether_to_buy: b ? 1 : 0
});
a = cleverapps.wait(2, a);
this.goldInfo ? this.goldInfo.remove(a) : a();
this.closeButton instanceof BandButton && this.closeButton.hide();
this.scrollBarBG && this.scrollBarBG.runAction(new cc.FadeOut(.3));
this.windowTitle && this.windowTitle.hide();
this.tilesLayoutCloseAnimation(a)
},
tilesLayoutShowAnimation: function() {
for (var a = .075 * Math.ceil(.5 * (this.tiles.length - 1)) + .5, b = this.tiles.length - 1; 0 <= b; b--) {
var c = .075 * Math.ceil(.5 * b)
, d = this.tiles[b].tileBadge;
d && (d.setVisible(!1),
d.runAction(new cc.Sequence(new cc.ScaleTo(0,0),new cc.DelayTime(a),new cc.PlaySound(bundles.tile_shop.urls.badge_appear_effect),new cc.Show,(new cc.ScaleTo(.4,d.scale)).easing(cc.easeBackOut()))));
if (d = this.tiles[b].adsBubble)
d.setActive(!1),
d.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.CallFunc(d.setActive.bind(d, !0))));
this.tiles[b].setVisible(!1);
this.tiles[b].runAction(new cc.Sequence(new cc.ScaleTo(0,0),new cc.CallFunc(function() {
this.beyondScroll || this.setVisible(!0)
}
.bind(this.tiles[b])),new cc.DelayTime(c),(new cc.ScaleTo(.4,this.tiles[b].scale)).easing(cc.easeBackOut())))
}
},
tilesLayoutCloseAnimation: function(a) {
a = cleverapps.wait(this.tiles.length, a);
for (var b = this.tiles.length - 1; 0 <= b; b--)
this.tiles[b].runAction(new cc.Sequence(new cc.DelayTime(.075 * Math.ceil(.5 * b)),(new cc.ScaleTo(.3,0)).easing(cc.easeBackIn()),new cc.CallFunc(a.bind(this, b))))
},
chooseAnimation: function() {}
})
, LivesShopWindow = ShopWindow.extend({
ctor: function(a) {
a = a || {};
this._super({
tab: ShopWindow.TABS.LIVES,
onClose: a.onClose,
force: a.force
})
}
})
, SoftCurrencyShopWindow = ShopWindow.extend({
ctor: function(a) {
a = a || {};
this._super({
tab: ShopWindow.TABS.SOFT_CURRENCY,
force: a.force
})
}
})
, HardCurrencyShopWindow = ShopWindow.extend({
ctor: function() {
this._super({
tab: ShopWindow.TABS.HARD_CURRENCY
})
}
});
ShopWindow.prototype.listBundles = function() {
return ["tile_shop"]
}
;
ShopWindow.TABS = {
HARD_CURRENCY: 0,
LIVES: 1,
SOFT_CURRENCY: 2,
UNITS_FRUIT: 3,
UNITS_RESOURCE: 4,
UNITS_DISCOUNT: 5,
UNITS_EXPEDITION_HALLOWEEN: 6,
UNITS_EXPEDITION_XMAS: 8,
UNITS_EXPEDITION_DRAGONIA: 10,
UNITS_EXPEDITION_UNDERSEA: 12,
UNITS_ADS: 14,
UNITS_ADS_VIP: 15,
UNITS_ADS_UNDECIDED: 19,
FOGS_VALUABLES: 20,
UNITS_EXPEDITION_DRAGONIA2: 21,
UNITS_EXPEDITION_RAPUNZEL: 22,
UNITS_EXPEDITION_EASTER: 23,
UNITS_EXPEDITION_COLLECTIONS: 24,
UNITS_EXPEDITION_DRAGONIA3: 25,
UNITS_EXPEDITION_CHINA: 26,
UNITS_EXPEDITION_BLACKFRIDAY: 27
};
cleverapps.styles.ShopWindow = {
scrollBarBG: {
height: 24,
paddingX: 20,
y: 20
},
title: {
hideAnimation: {
moveDownY: 30
},
position: {
x: {
align: "center"
},
y: {
align: "top",
dy: -185
}
}
},
margin: {
x: 30,
y: 30
},
padding: {
x: 10,
y: 10
},
tilesVisibilityPadding: 30,
horizontalMobile: {
scale: 1.25,
padding: {
x: 0,
top: 140,
bottom: 90
}
},
mouseScrollSpeed: 400
};
cleverapps.overrideStyles(cleverapps.styles.DECORATORS, {
TILE_SHOP_BADGE_STROKE: {
color: new cc.Color(100,34,22,255),
size: 2
},
TILE_SHOP_SHADOW: {
color: new cc.Color(100,34,22,200),
direction: cc.size(0, -3),
blur: 1
},
TILE_SHOP_STROKE: {
color: new cc.Color(100,34,22,255),
size: 3
}
});
var TileBadge = cc.Sprite.extend({
ctor: function(a) {
a = a || {};
this._super(bundles.badge.frames.badge_png);
var b = cleverapps.styles.TileBadge
, c = void 0 !== a.rotation ? a.rotation : b.rotation
, d = void 0 !== a.textRotation ? a.textRotation : b.text.rotation;
if (a.icon)
a.icon.setPositionRound(b.icon),
a.icon.setRotation(-1 * c),
this.addChild(a.icon);
else {
var e = a.largeFont ? cleverapps.styles.FONTS.TILE_SHOP_BADGE_BIG : cleverapps.styles.FONTS.TILE_SHOP_BADGE_TEXT;
e = cleverapps.UI.generateOnlyText(this.chooseText(a), a.font || e);
e.setPositionRound(b);
e.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
e.fitTo(b.width, b.height);
e.setRotation(d);
this.addChild(e)
}
a.tooltipText && cleverapps.tooltipManager.create(this, {
text: Messages.get(a.tooltipText),
position: b.tooltip.position,
size: b.tooltip.size
});
a.clickAction && (this.createFinger(),
cleverapps.UI.applyHover(this),
cleverapps.UI.onClick(this, a.clickAction));
this.setRotation(c)
},
disable: function() {
this.setSpriteFrame(bundles.badge.frames.badge_off_png)
},
enable: function() {
this.setSpriteFrame(bundles.badge.frames.badge_png)
},
chooseText: function(a) {
return "discount" === a.type ? Messages.get("Badge.discount", {
amount: a.text
}) : "save" === a.type ? "Badge.save" : "bestSeller" === a.type ? "Badge.bestSeller" : "value" === a.type ? Messages.get("Badge.Value", {
amount: a.value
}) : a.text || "default"
},
createIcon: function(a) {
if ("clangift" === a.type)
return new cc.Sprite(bundles.reward_icons.frames.clan_gift_png)
},
createFinger: function() {
FingerView.hintClick(this, {
delay: .8,
runOnce: !0
})
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TILE_SHOP_BADGE_TEXT: {
size: 25,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TILE_SHOP_BADGE_STROKE
},
TILE_SHOP_BADGE_BIG: {
size: 46,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TILE_SHOP_BADGE_STROKE
}
});
cleverapps.styles.TileBadge = {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 10
},
width: 125,
text: {
rotation: 0
},
rotation: 30,
tooltip: {
position: {
x: {
align: "center",
dx: -75
},
y: {
align: "top",
dy: 50
}
},
size: {
width: 500,
height: 100
}
},
icon: {
x: {
align: "center",
dx: -2
},
y: {
align: "center",
dy: 8
}
}
};
var TileButton = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.tileModel = a;
this.options = b || {};
var c = cleverapps.styles.TileButton;
b = this.button = new cleverapps.UI.Button({
text: this.tileModel.getButtonText(),
width: b.width || c.width,
height: b.height || c.height,
type: b.type,
onClicked: b.onClicked.bind(b, a),
mark: this.tileModel.isAttention()
});
a.constructor === TileModel && Lottery.addIcon(b, void 0, "gold25000" === a.product.itemId);
cleverapps.fallSale.isAvailable() && a.product && a.product.productId && b.addChild(new FallSaleIcon);
this.setAnchorPoint(.5, .5);
this.setContentSize2(b.getContentSize());
this.addChild(b);
b.setPositionRound(c)
},
updateText: function() {
this.button.setString(this.tileModel.getButtonText())
},
enable: function() {
this.button.enable();
this.updateText()
},
disable: function() {
this.button.disable();
this.updateText()
}
});
cleverapps.styles.TileButton = {
x: {
align: "center"
},
y: {
align: "center",
dy: -5
},
width: 220,
height: 90
};
var TileIcon = cc.Node.extend({
ctor: function(a, b) {
this._super();
b = b || {};
var c = cleverapps.styles.TileIcon;
this.tileModel = a;
var d = this.icon = new cc.Sprite(a.getIcon())
, e = c[a.product.itemId] && c[a.product.itemId].height || c.height;
b.skipScale || (c.scale ? d.setScale(c.scale) : e && (e /= d.height,
1 > e && d.setScale(e)));
e = {
json: bundles.tile_shop.jsons.shop_sparkles_large_json
};
b.animationOverride && (e = b.animationOverride);
if (e.json) {
var f = this.animation = new cleverapps.Spine(e.json);
f.setPosition(d.width / 2, d.height / 2);
f.setLocalZOrder(e.jsonzOrder || 0);
f.setAnimation(0, "animation", !0);
f.setVisible(!1);
d.addChild(f);
f.runAction(new cc.Sequence(new cc.DelayTime(void 0 !== e.delay ? e.delay : Math.random()),new cc.Show))
}
e = c[a.product.itemId] ? c[a.product.itemId].wrap.dx || 0 : c.wrap.dx;
f = c[a.product.itemId] ? c[a.product.itemId].wrap.dy || 0 : c.wrap.dy;
this.setContentSize2(d.width, c[a.product.itemId] && c[a.product.itemId].wrap.height || c.wrap.height);
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(b.zOrder || 0);
d.setAnchorPoint(.5, 0);
d.setPositionRound(this.width / 2 + e, f);
this.addChild(d)
},
enable: function() {
this.icon.setColor(new cc.Color(255,255,255,255));
this.icon.setOpacity(255);
this.animation && this.animation.setVisible(!0)
},
disable: function() {
this.icon.setColor(new cc.Color(200,200,200,255));
this.icon.setOpacity(180);
this.animation && (this.animation.stopAllActions(),
this.animation.setVisible(!1))
}
});
cleverapps.styles.TileIcon = {
scale: 1,
wrap: {
height: 270,
dx: 0,
dy: -24
}
};
var TileRewardsBlock = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.setAnchorPoint(.5, .5);
this.tileModel = a;
this.options = b || {};
this.styles = cleverapps.styles.TileRewardsBlock;
this.setContentSize2(this.options.size);
this.setLocalZOrder(this.styles.zOrder);
this.createRewards()
},
createRewards: function() {
var a = "merge" === cleverapps.config.type
, b = this.options.font || cleverapps.styles.FONTS.TILE_SHOP_OFFER_TEXT
, c = this.options.paddingX || this.styles.paddingX
, d = this.options.paddingY || 0;
a = new RewardsListComponent(this.tileModel.getReward(),{
wrapGrid: !0,
noPrefix: a,
font: b,
small: !0,
columns: "auto",
fitToBox: {
width: this.options.size.width - c,
height: this.options.size.height - d
},
textDirection: cleverapps.UI.HORIZONTAL,
textMargin: this.styles.amountMargin,
margin: {
x: this.styles.colMargin,
y: this.styles.rowMargin
},
icons: this.options.icons || {
hard: bundles.reward_icons.frames.shop_gold_png
}
});
a.setPositionRound(this.styles.rewardList);
this.addChild(a)
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TILE_SHOP_OFFER_TEXT: {
name: "default",
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.TileRewardsBlock = {
width: 360,
height: 180,
rowMargin: 5,
colMargin: 5,
amountMargin: 5,
zOrder: 0,
paddingX: 0,
bg: {
x: {
align: "center"
},
y: {
align: "center"
}
},
rewardList: {
x: {
align: "center"
},
y: {
align: "center"
}
}
};
var LotteryIcon = cc.Sprite.extend({
ctor: function(a, b, c) {
this._super();
var d = this.styles = cleverapps.styles.LotteryIcon
, e = cleverapps.eventManager.getFeatureEvent("lottery")
, f = connector.platform.oneOf(connector.OK) && !1 !== e.options.okLottery;
c = f && e.options.lottery10k && c;
e = connector.platform.oneOf(connector.VK) && e.options.vkSaleDay;
f ? d = cleverapps.overrideStyles(d, cleverapps.styles.OkLotteryIcon, !0) : e && (d = this.styles = cleverapps.overrideStyles(d, cleverapps.styles.VkLotteryIcon, !0));
e ? (f = bundles.lottery.frames.vk_lottery,
d = cleverapps.overrideStyles(d, cleverapps.styles.VkLotteryIcon, !0)) : f ? (f = c ? bundles.lottery.frames.ok_lottery_10k : bundles.lottery.frames.ok_lottery,
d = cleverapps.overrideStyles(d, cleverapps.styles.OkLotteryIcon, !0)) : f = bundles.lottery.frames["lottery_" + cleverapps.settings.language] || bundles.lottery.frames.lottery_en;
this._super(f);
a.addChild(this);
b = b || LotteryIcon.POSITION_BOTTOM;
this.setScale(d[b].scale || d.scale || 1);
this.baseScale = this.scale;
this.setPositionRound(d[b]);
d.anchor && this.setAnchorPoint(d.anchor.x, d.anchor.y)
}
});
LotteryIcon.POSITION_TOP = "top";
LotteryIcon.POSITION_BOTTOM = "bottom";
LotteryIcon.POSITION_MENU = "menu";
LotteryIcon.POSITION_ICON = "icon";
LotteryIcon.POSITION_ICON_TIMER = "iconTimer";
LotteryIcon.POSITION_ICON_TOP = "icon_top";
LotteryIcon.POSITION_BOTTOM_RIGHT = "bottom_right";
cleverapps.styles.VkLotteryIcon = {
anchor: {
x: 1,
y: 1
},
positions: {
bottom: {
x: {
align: "left",
dx: -22
},
y: {
align: "top",
dy: 45
}
},
menu: {
x: {
align: "left",
dx: 15
},
y: {
align: "bottom",
dy: -20
}
},
icon: {
x: {
align: "center",
dx: -54
},
y: {
align: "bottom",
dy: -6
}
},
iconTimer: {
x: {
align: "left",
dx: -24
},
y: {
align: "bottom",
dy: 28
}
}
}
};
cleverapps.styles.VkLotteryIcon.positions[LotteryIcon.POSITION_BOTTOM] = {
x: {
align: "left",
dx: -22
},
y: {
align: "top",
dy: 45
}
};
cleverapps.styles.VkLotteryIcon.positions[LotteryIcon.POSITION_MENU] = {
x: {
align: "left",
dx: 15
},
y: {
align: "bottom",
dy: -20
}
};
cleverapps.styles.VkLotteryIcon.positions[LotteryIcon.POSITION_ICON] = {
x: {
align: "center",
dx: -54
},
y: {
align: "bottom",
dy: -6
}
};
cleverapps.styles.VkLotteryIcon.positions.iconTimer = {
x: {
align: "left",
dx: -24
},
y: {
align: "bottom",
dy: 28
}
};
cleverapps.styles.OkLotteryIcon = {
positions: {}
};
cleverapps.styles.LotteryIcon = {
positions: {}
};
cleverapps.styles.LotteryIcon[LotteryIcon.POSITION_MENU] = {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -70
}
};
cleverapps.styles.LotteryIcon[LotteryIcon.POSITION_BOTTOM] = {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -70
}
};
cleverapps.styles.LotteryIcon[LotteryIcon.POSITION_TOP] = {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 55
}
};
cleverapps.styles.LotteryIcon[LotteryIcon.POSITION_ICON] = {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -20
}
};
cleverapps.styles.LotteryIcon[LotteryIcon.POSITION_ICON_TIMER] = {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -20
}
};
cleverapps.styles.LotteryIcon[LotteryIcon.POSITION_ICON_TOP] = {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 0
}
};
cleverapps.styles.LotteryIcon[LotteryIcon.POSITION_BOTTOM_RIGHT] = {
x: {
align: "right",
dx: 30
},
y: {
align: "bottom",
dy: -70
}
};
var Lottery = {
isActive: function() {
return cleverapps.eventManager.isActive("lottery") && cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR
},
addIcon: function(a, b, c) {
this.isActive() && (a.lotteryIcon = new LotteryIcon(a,b,c)).runAction(new cc.RepeatForever(new cc.Sequence(new cc.DelayTime(3),new cc.RotateTo(.2,10),new cc.RotateTo(.2,-10),new cc.RotateTo(.2,10),new cc.RotateTo(.2,-10),new cc.RotateTo(.2,0))))
},
addText: function(a) {
if (this.isActive()) {
var b = cleverapps.styles.Lottery
, c = "Lottery.info"
, d = cleverapps.eventManager.getFeatureEvent("lottery");
connector.platform.oneOf(connector.VK) && d.options.vkSaleDay && (c = "Lottery.infoSaleDay");
c = cleverapps.UI.generateTTFText(c, b.text.font);
a.addChild(c);
c.setPositionRound(b.text);
c.fitTo(a.width)
}
}
};
cleverapps.styles.Lottery = {
text: {
font: cleverapps.styles.FONTS.SMALL_WHITE_TEXT,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 5
}
}
};
var ShopProductSource = {
listProducts: function(a) {
var b = ShopProductSource.ITEMS[a] || []
, c = ShopProductSource.ITEMS.CoinsPayer
, d = cleverapps.paymentsHistory.classify();
a === ShopWindow.TABS.HARD_CURRENCY && d > cleverapps.PaymentsHistory.BRACKET_WEAK && (b = c);
a === ShopWindow.TABS.HARD_CURRENCY && (b = b.filter(function(e) {
e = connector.payments.getProduct(e) || VirtualProducts[e];
return !e || e.pack && "merge" === cleverapps.config.type ? !1 : !e.mainSceneOnly || cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition()
}));
return b
},
listTileModels: function(a) {
var b = cleverapps.unitsShop && cleverapps.unitsShop.tabs[a] ? cleverapps.unitsShop.tabs[a].generateProducts() : ShopProductSource.listProducts(a).map(function(e) {
return Product.CreateById(e)
});
b = b.filter(function(e) {
if (!e || e.reward && e.reward.unlimitedLives && cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed())
return !1;
e = e.adsLimit ? e.adsLimit() : void 0;
return !e || cleverapps.adsLimits.state(e) !== AdsLimits.STATE_DISABLED
});
b = b.map(function(e) {
return TileModel.Create(e)
}).filter(function(e) {
return e.isEnabled()
});
if (a === ShopWindow.TABS.HARD_CURRENCY && cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR) {
b = cleverapps.offerManager.getShopTileModels().concat(b);
var c = 0;
b.forEach(function(e) {
e.getPrice && e.getPrice() > c && (c = e.getPrice())
});
for (var d = 0; d < b.length; d++)
if (b[d].getPrice() === c) {
b[d].badge = {
type: "save"
};
break
}
}
d = cleverapps.paymentsHistory.classify();
d === cleverapps.PaymentsHistory.BRACKET_UNDECIDED && (d = cleverapps.PaymentsHistory.BRACKET_NONE);
if (a !== ShopWindow.TABS.HARD_CURRENCY || cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR)
for (a = ShopProductSource.ITEMS.bestSellersByPayerClass[d],
d = 0; d < b.length; d++)
if (-1 !== a.indexOf(b[d].getItemId()) && !b[d].badge) {
b[d].badge = {
type: "bestSeller"
};
break
}
return b
},
ITEMS: {
CoinsPayer: "hardForVideo jamPack tastyPack honeyPack epicPack gold500 gold1800 gold3800 gold6000 gold25000 subsMonth".split(" "),
bestSellersByPayerClass: [["sweetPack", "gold500"], ["jamPack", "gold1800"], ["tastyPack", "gold3800"], ["honeyPack", "gold6000"], ["honeyPack", "gold25000"]]
}
};
// uptap-注释金币商店
// ShopProductSource.ITEMS[ShopWindow.TABS.HARD_CURRENCY] = "hardForVideo sweetPack jamPack tastyPack honeyPack gold500 gold1800 gold3800 gold6000 gold25000 subsMonth".split(" ");
ShopProductSource.ITEMS[ShopWindow.TABS.HARD_CURRENCY] = "hardForVideo".split(" ");
// ShopProductSource.ITEMS[ShopWindow.TABS.LIVES] = ["refillLives", "unlimitedLives", "askLives", "livesForVideo", "buyLife"];
ShopProductSource.ITEMS[ShopWindow.TABS.LIVES] = ["refillLives", "livesForVideo", "buyLife"];
ShopProductSource.ITEMS[ShopWindow.TABS.SOFT_CURRENCY] = ["softCurrencyVerySmall", "softCurrencySmall", "softCurrencyMedium", "softCurrencyLarge"];
"merge" === cleverapps.config.type && (ShopProductSource.ITEMS[ShopWindow.TABS.LIVES] = "energyLottery buyEnergy350 buyEnergy700 buyEnergy energyForVideo energyForVideoShort".split(" "),
ShopProductSource.ITEMS[ShopWindow.TABS.SOFT_CURRENCY] = ["softCurrencyVerySmall", "softCurrencySmall", "softCurrencyMedium", "softCurrencyLarge"],
-1 !== ["mergecraft", "wondermerge", "fairy"].indexOf(cleverapps.config.name) && (ShopProductSource.ITEMS.CoinsPayer = "hardForVideo gold500 gold1800 gold3800 gold6000 gold25000 subsMonth growthFund".split(" "),
ShopProductSource.ITEMS[ShopWindow.TABS.HARD_CURRENCY] = "hardForVideo gold500 gold1800 gold3800 gold6000 gold25000 subsMonth growthFund".split(" ")));
var Tabs = cleverapps.Layout.extend({
ctor: function(a, b) {
this.buttons = {};
var c = cleverapps.styles.Tabs;
this.direction = void 0 === b.direction ? c.direction : b.direction;
this.images = b.type || this.direction === cleverapps.UI.VERTICAL && Tabs.Types.tabs_vertical || Tabs.Types.tabs_horizontal;
this.canChangeIconColor = !("undefined" !== typeof LandMarkDonorWindow && cleverapps.windows.currentWindow()instanceof LandMarkDonorWindow && "fairy" === cleverapps.config.name);
this.onTabChanged = function() {}
;
var d = Object.keys(a).map(function(e, f) {
return this.createButton(e, a[e], -(f + 1), b)
}, this);
this._super(d, {
direction: this.direction,
margin: void 0 === b.margin ? c.margin : b.margin
})
},
createButton: function(a, b, c, d) {
var e = cleverapps.styles.Tabs.buttons
, f = d.width || e.width
, g = d.height || e.height
, h = d.margin || e.margin || 0;
d = cc.rectSubPadding(cc.rect(0, 0, f, g), cc.padding(e.padding, d.padding));
e = this.buttons[a] = cleverapps.UI.createScale9Sprite(this.images.off_png);
e.info = b;
e.baseScale = 1;
e.baseZOrder = c;
e.setLocalZOrder(e.baseZOrder);
e.setContentSize(f, g);
if (b.icon)
var k = e.icon = new cc.Sprite(b.icon);
b.node && (k = b.node);
if (b.text) {
var m = e.text = cleverapps.UI.generateOnlyText(b.text, cleverapps.styles.FONTS.TABS_TEXT_FONT);
m.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
m.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER)
}
if (k) {
if (m) {
m.setDimensions(d.width - k.width - h, 0);
m.fitTo(void 0, d.height);
m.setDimensions(m.width, d.height);
var l = new cleverapps.Layout([k, m],{
direction: cleverapps.UI.HORIZONTAL,
margin: h
})
} else
l = k;
cleverapps.UI.fitToBox(l, d)
} else
m && (l = m,
m.fitTo(d.width, d.height));
m && (m.baseFontSzie = m.getFontSize());
l.setPositionRound(d.x + d.width / 2, d.y + d.height / 2);
e.addChild(l);
b.disabled || (e.clickHandler = cleverapps.UI.onClick(e, function() {
if (this.selectedId !== a)
cleverapps.audio.playSound(bundles.main.urls.click_effect),
this.activateTab(a);
else if (b.content.onClickTab)
b.content.onClickTab()
}
.bind(this)),
cleverapps.UI.applyHover(e));
e.setRecCascadeColorEnabled(!0);
e.setCascadeOpacityEnabledRecursively(!0);
b.disabled && cleverapps.UI.convertToGrayScale(e);
b.tooltip && cleverapps.tooltipManager.create(e, b.tooltip);
b.attention && this.setAttention(a, b.attention);
return e
},
getActive: function() {
return this.selectedId
},
activeTab: function() {
return this.buttons[this.selectedId].info.content
},
activateTab: function(a, b) {
var c;
a = a.toString();
if (this.selectedId === a)
return (c = this.buttons[this.selectedId]) && c.info && c.info.content;
Object.keys(this.buttons).forEach(function(d) {
if (d === a)
this.onSelectTab(d, b);
else
this.onUnSelectTab(d)
}, this);
this.onTabChanged(this.selectedId);
return (c = this.buttons[this.selectedId]) && c.info && c.info.content
},
onSelectTab: function(a, b) {
var c = this.buttons[a]
, d = c.info;
c.interactiveScale = !1;
c.setSpriteFrame(this.images.on_png);
c.setLocalZOrder(1);
c.baseScale = 1.03;
c.applyInteractiveScale();
d.updateTitle && d.updateTitle();
c.text && (c.text.setFont(cleverapps.styles.FONTS.TABS_TEXT_FONT),
c.text.setFontSize(c.text.baseFontSzie),
c.text.setOpacity(255));
c.icon && (this.canChangeIconColor && c.icon.setColor(cleverapps.styles.FONTS.TABS_TEXT_FONT.color),
c.icon.setOpacity(255));
void 0 === d.content && (d.content = d.generator());
d.content.setVisible(!0);
if (d.content.onSelectTab)
d.content.onSelectTab(b);
this.selectedId = a
},
onUnSelectTab: function(a) {
a = this.buttons[a];
var b = a.info;
a.interactiveScale = !0;
a.setSpriteFrame(this.images.off_png);
a.setLocalZOrder(a.baseZOrder);
a.baseScale = 1;
a.applyInteractiveScale();
a.text && (a.text.setFont(cleverapps.styles.FONTS.TABS_TEXT_FONT_DISABLED),
a.text.setFontSize(a.text.baseFontSzie),
a.text.setOpacity(cleverapps.styles.Tabs.buttons.disabled.opacity));
a.icon && (this.canChangeIconColor ? (a.icon.setColor(cleverapps.styles.FONTS.TABS_TEXT_FONT_DISABLED.color),
a.icon.setOpacity(cleverapps.styles.Tabs.buttons.disabled.opacity)) : a.icon.setOpacity(cleverapps.styles.Tabs.buttons.disabled.colorIconOpacity));
if (void 0 !== b.content && (b.content.setVisible(!1),
b.content.stopAllActions(),
b.content.onUnSelectTab))
b.content.onUnSelectTab()
},
setAttention: function(a, b) {
var c = cleverapps.styles.Tabs.attention;
a = this.buttons[a];
a.attention && (a.attention.removeFromParent(),
delete a.attention);
b && (a.attention = new Attention,
a.attention.setPositionRound(c),
a.addChild(a.attention))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TABS_TEXT_FONT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
TABS_TEXT_FONT_DISABLED: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
Tabs.Types = cleverapps.overrideTemplates({}, {
tabs_vertical: {
off_png: bundles.tabs.frames.vertical_shop_tab_off,
on_png: bundles.tabs.frames.vertical_shop_tab_on
},
tabs_horizontal: {
off_png: bundles.tabs.frames.shop_tab_off,
on_png: bundles.tabs.frames.shop_tab_on
},
tabs_custom: {
off_png: bundles.tabs.frames.custom_tab_off,
on_png: bundles.tabs.frames.custom_tab_on
}
});
cleverapps.styles.Tabs = {
margin: 0,
direction: cleverapps.UI.HORIZONTAL,
attention: {
x: 0,
y: 0
},
buttons: {
width: 135,
height: 240,
margin: 5,
padding: {
x: 15,
y: 10
},
disabled: {
opacity: 127,
colorIconOpacity: 127
}
}
};
var RoundTabs = cleverapps.Layout.extend({
ctor: function(a, b) {
this.onClickCallback = b;
this.contentByTab = {};
b = cleverapps.styles.RoundTabs;
this.tabs = {};
for (var c = 0; c < a.length; c++) {
var d = a[c];
this.tabs[d.id] = this.createTab(d)
}
this._super(Object.values(this.tabs), {
margin: b.margin,
direction: cleverapps.UI.HORIZONTAL
})
},
getCurrentTab: function() {
return this.currentTab
},
createTab: function(a) {
var b = new cc.Sprite(bundles.tabs.frames.round_tab_bg)
, c = new cc.Sprite(a.icon);
c.setPositionRound(b.width / 2, b.height / 2);
b.addChild(c);
b.icon = c;
b.hoverHandler = cleverapps.UI.applyHover(b);
b.clickHandler = cleverapps.UI.onClick(b, this.onClick.bind(this, a.id));
b.generator = a.generator;
return b
},
onClick: function(a) {
this.setTab(a);
if (this.onClickCallback)
this.onClickCallback(a)
},
setTab: function(a) {
this.tabs[a] ? (void 0 !== this.currentTab && (this.tabs[this.currentTab].setSpriteFrame(bundles.tabs.frames.round_tab_bg),
this.tabs[this.currentTab].icon.setColor(new cc.Color(255,255,255,255)),
this.tabs[this.currentTab].icon.setOpacity(255),
this.tabs[this.currentTab].clickHandler = cleverapps.UI.onClick(this.tabs[this.currentTab], this.setTab.bind(this, this.currentTab)),
this.tabs[this.currentTab].hoverHandler || (this.tabs[this.currentTab].hoverHandler = cleverapps.UI.applyHover(this.tabs[this.currentTab]))),
this.contentByTab[this.currentTab] && this.contentByTab[this.currentTab].setVisible(!1),
this.currentTab = a,
this.tabs[a].setSpriteFrame(bundles.tabs.frames.round_tab_bg_selected),
this.tabs[a].icon.setColor(new cc.Color(180,180,180,255)),
this.tabs[a].icon.setOpacity(180),
this.tabs[a].clickHandler && (this.tabs[a].clickHandler.remove(),
this.tabs[a].clickHandler = void 0),
this.tabs[a].hoverHandler && (this.tabs[a].hoverHandler.remove(),
this.tabs[a].hoverHandler = void 0),
this.tabs[a].generator && !this.contentByTab[a] && (this.contentByTab[a] = this.tabs[a].generator()),
this.contentByTab[a] && this.contentByTab[a].setVisible(!0)) : cleverapps.throwAsync("wrong tab id " + a + " tabs " + Object.keys(this.tabs))
},
show: function() {
for (var a in this.tabs)
this.tabs[a].setScale(0),
this.tabs[a].runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.ScaleTo(.3,1)))
},
hide: function() {
for (var a in this.tabs)
this.tabs[a].runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.ScaleTo(.2,0)))
}
});
cleverapps.styles.RoundTabs = {
margin: 50
};
var Buttons = cc.Node.extend({
ctor: function(a) {
this._super();
a = Buttons.filter(a);
0 !== a.length && (this.buttons = {},
a.forEach(function(b) {
this.buttons[b.__instanceId] = b;
this.addChild(b)
}, this),
this.arrange())
},
onEnterTransitionDidFinish: function() {
this._super();
this.arrange()
},
disable: function() {
for (var a in this.buttons)
this.buttons[a].disable()
},
enable: function() {
for (var a in this.buttons)
this.buttons[a].enable()
},
arrange: function() {
var a = cleverapps.styles.Buttons
, b = a.margin.x
, c = 0;
if (1 < this.children.length && this.parent) {
var d = this.parent.width - 2 * a.padding.x
, e = 0;
this.children.forEach(function(f) {
e += f.width;
c = Math.max(c, f.height / 2)
});
b = Math.max(b, Math.round((d - e) / (this.children.length - 1)))
}
this.margin = b;
cleverapps.UI.arrangeWithMargins(this.children, {
direction: cleverapps.UI.HORIZONTAL,
margin: b
});
this.children.forEach(function(f) {
f.setPosition(f.x, c + a.padding.y)
});
cleverapps.UI.wrap(this);
this.setAnchorPoint(.5, .5)
},
add: function(a) {
0 !== Buttons.filter([a]).length && (this.buttons[a.__instanceId] = a,
this.addChild(a),
this.arrange())
},
remove: function(a) {
if (a = this.buttons[a.__instanceId])
a.stopAllActions(),
a.runAction(new cc.Sequence(new cc.ScaleTo(.3,0),new cc.RemoveSelf)),
this.children.forEach(function(b) {
b.x > a.x && (b.stopAllActions(),
b.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.MoveBy(.3,-a.width - this.margin,0))))
}),
this.stopAllActions(),
this.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.MoveBy(.3,(a.width + this.margin) / 2,0)))
},
removeAll: function() {
for (var a in this.buttons)
this.buttons[a].removeFromParent()
},
onShow: function() {
this.children.forEach(function(a) {
a.stopAllActions();
var b = a.scale;
a.setScale(0);
a.runAction((new cc.ScaleTo(.7,b)).easing(cc.easeBackOut()))
})
}
});
Buttons.filter = function(a) {
return a.filter(function(b) {
return b && b.onMouseOver
})
}
;
Buttons.choose = function(a) {
a = Buttons.filter(a);
if (0 !== a.length)
return a[Math.floor(Math.random() * a.length)]
}
;
Buttons.remove = function(a) {
if (a.parent instanceof Buttons && a.parent.buttons[a.__instanceId]) {
var b = a.parent;
1 < b.children.length && b.remove(a)
} else
a.removeFromParent()
}
;
cleverapps.styles.Buttons = {
margin: {
x: 20
},
padding: {
x: 70,
y: 60
}
};
var LanguageButton = cleverapps.UI.Button.extend({
ctor: function(a, b) {
this.language = a;
this.callback = b;
a = cleverapps.styles.LanguageButton;
this._super({
type: {
button_png: bundles.buttons.frames.button_png,
button_on_png: bundles.buttons.frames.button_on_png,
button_off_png: bundles.buttons.frames.button_on_png
},
text: this.language,
textOff: "%%" + this.language,
icons: {
"%%": bundles.checkbox.frames.check_mark_png
},
width: a.width,
height: a.height,
onClicked: this.onClicked.bind(this)
});
this.isCurrentLanguage() && this.disable()
},
onClicked: function() {
this.callback(this.language);
this.disable()
},
isCurrentLanguage: function() {
return cleverapps.settings.language === this.language
},
updateEnabled: function() {
this.isCurrentLanguage() ? this.disable() : this.enable()
}
});
cleverapps.styles.LanguageButton = {
width: 260,
height: 100
};
var AboutWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = [{
button: "AboutWindow.terms",
url: Terms.TERMS_URL,
text: termsText[connector.info.source] || termsText.default
}, {
button: "AboutWindow.privacy",
url: Terms.PRIVACY_URL,
text: privacyText[connector.info.source] || privacyText.default
}].map(function(c) {
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_green,
text: c.button,
onClicked: function() {
connector.platform.oneOf(connector.WECHAT, connector.INSTANT, connector.DISCORD) ? new PrivacyWindow(c.button,c.text) : connector.platform.openUrl(c.url)
},
width: cleverapps.styles.AboutWindow.button.width
})
});
a = new cleverapps.Layout(a,{
direction: cleverapps.UI.HORIZONTAL,
margin: cleverapps.styles.AboutWindow.button.margin
});
var b = cleverapps.UI.generateTTFText("AboutWindow.text", cleverapps.styles.FONTS.WINDOW_TEXT, {
version: cleverapps.config.version,
gameTitle: Messages.get(cleverapps.config.title)
});
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b = cleverapps.UI.wrapWithPadding(b, cleverapps.styles.AboutWindow.text.padding);
a = new cleverapps.Layout([b, a],{
direction: cleverapps.UI.VERTICAL
});
this._super({
title: "AboutWindow.title",
name: "aboutwindow",
content: a
})
}
});
cleverapps.styles.AboutWindow = {
text: {
padding: {
left: 50,
right: 50,
top: 80,
bottom: 80
}
},
button: {
width: 450,
margin: 200
}
};
var PrivacyWindow = CleverappsWindow.extend({
onWindowLoaded: function(a, b) {
this._super({
title: a,
name: "privacywindow",
content: this.createContent(this.splitTextIntoChunks(b)),
foreground: bundles.windows.frames.window_foreground_png,
noPadding: !0
})
},
splitTextIntoChunks: function(a) {
a = a.split("\n");
for (var b = [], c = "", d = 0; d < a.length; d++)
c += a[d],
1E3 <= c.length ? (b.push(c),
c = "") : c += "\n";
c && b.push(c);
return b
},
createContent: function(a) {
var b = cleverapps.styles.PrivacyWindow
, c = b.size[cleverapps.resolution.mode];
a = a.map(function(d) {
d = cleverapps.UI.__generateNotLocalizedText(d, cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
d.setDimensions(c.width - 2 * b.text.padding, 0);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_LEFT);
return d
});
a = new cleverapps.Layout(a,{
margin: 0,
padding: b.scroll.padding,
direction: cleverapps.Layout.VERTICAL
});
a = new cleverapps.UI.ScrollView(a,{
direction: cleverapps.UI.ScrollView.DIR_VERTICAL
});
a.setContentSize2(b.size);
a.setBarPadding(b.scroll.barPadding);
a.scrollTo(cleverapps.UI.ScrollView.SCROLLS.UPPER_LEFT);
return cleverapps.UI.wrapWithPadding(a, cc.padding(b.contentPadding))
}
});
cleverapps.styles.PrivacyWindow = {
contentPadding: {
x: 0,
y: 20
},
size: [{
width: 1E3,
height: 1500
}, {
width: 2E3,
height: 1E3
}, {
width: 2E3,
height: 1E3
}],
text: {
padding: 50
},
scroll: {
padding: {
x: 20,
y: 50
},
barPadding: {
cornerPadding: 40,
sidePadding: 40
}
}
};
var privacyText = {
wechat: "\u840c\u732a\u6d88\u6d88\u4e50\uff08\u9762\u5305\u7248\uff09\u6e38\u620f\u9690\u79c1\u534f\u8bae\n\n\u840c\u732a\u6d88\u6d88\u4e50\u9762\u5305\u7248\u6e38\u620f\u9690\u79c1\u534f\u8bae\n\u53d1\u5e03\u65f6\u95f4\uff1a2023\u5e747\u67081\u65e5\n\u66f4\u65b0\u65f6\u95f4\uff1a2023\u5e747\u67081\u65e5\n\u751f\u6548\u65f6\u95f4\uff1a2023\u5e747\u67081\u65e5\n\n\u300a\u840c\u732a\u6d88\u6d88\u4e50\uff08\u9762\u5305\u7248\uff09\u300b\u6e38\u620f\uff08\u4ee5\u4e0b\u79f0\u201c\u672c\u6e38\u620f\u201d\uff09\u7531\u5e7f\u5dde\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u9650\u516c\u53f8\u8d1f\u8d23\u5f00\u53d1\uff0c\u6388\u6743\u6df1\u5733\u5e02\u5f69\u82fb\u79d1\u6280\u6709\u9650\u516c\u53f8\u8d1f\u8d23\u6e38\u620f\u8fd0\u8425\u53ca\u76f8\u5173\u63a8\u5e7f\u6d3b\u52a8\u3002\u5728\u60a8\u6e38\u73a9\u300a\u840c\u732a\u6d88\u6d88\u4e50\uff08\u9762\u5305\u7248\uff09\u300b\u4e4b\u524d\uff0c\u8bf7\u52a1\u5fc5\u8ba4\u771f\u9605\u8bfb\u548c\u7406\u89e3\u672c\u300a\u840c\u732a\u6d88\u6d88\u4e50\uff08\u9762\u5305\u7248\uff09\u6e38\u620f\u9690\u79c1\u534f\u8bae\u300b\uff08\u4ee5\u4e0b\u7b80\u79f0\u201c\u672c\u534f\u8bae\u201d\uff09\u3002\u672c\u534f\u8bae\u4e3a\u300a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\u300b\u4e4b\u8865\u5145\uff0c\u60a8\u5728\u9605\u8bfb\u672c\u534f\u8bae\u7684\u540c\u65f6\uff0c\u5e94\u5f53\u540c\u65f6\u9605\u8bfb\u300a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\u300b\uff0c\u300a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\u300b\u4e0e\u672c\u534f\u8bae\u4e0d\u4e00\u81f4\u7684\uff0c\u4ee5\u672c\u534f\u8bae\u4e3a\u51c6\u3002\u5982\u60a8\u540c\u610f\u300a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\u300b\u548c\u672c\u534f\u8bae\uff0c\u60a8\u53ef\u6e38\u73a9\u672c\u6e38\u620f\u3002\u5982\u679c\u60a8\u5bf9\u672c\u534f\u8bae\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u6709\u4efb\u4f55\u7591\u95ee\u6216\u6295\u8bc9\u3001\u5efa\u8bae\uff0c\u53ef\u901a\u8fc7\u5ba2\u670d\u3001\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5ba2\u670d\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff08\u5c0f\u7a0b\u5e8f\u7248\u672c\uff09\u3001\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5ba2\u670d\u516c\u4f17\u53f7\uff08\u5c0f\u7a0b\u5e8f\u7248\u672c\uff09\u7b49\u65b9\u5f0f\u8054\u7cfb\u6211\u4eec\uff0c\u6211\u4eec\u5c06\u5c3d\u5feb\u8ddf\u8fdb\u5904\u7406\uff0c\u5e76\u5728\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u7684\u671f\u9650\u5185\u56de\u590d\u60a8\u7684\u8bf7\u6c42\u3002\u60a8\u70b9\u51fb\u540c\u610f\u3001\u63a5\u53d7\u6216\u4e0b\u4e00\u6b65\uff0c\u6216\u60a8\u6ce8\u518c\u3001\u6e38\u73a9\u672c\u6e38\u620f\u5747\u89c6\u4e3a\u60a8\u5df2\u9605\u8bfb\u5e76\u540c\u610f\u7b7e\u7f72\u672c\u534f\u8bae\u3002\n\u6211\u4eec\u5c06\u4e25\u683c\u4f9d\u7167\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\uff0c\u4fdd\u62a4\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u53ca\u9690\u79c1\u5b89\u5168\u3002\u672c\u534f\u8bae\u5c06\u5e2e\u52a9\u60a8\u76f4\u89c2\u3001\u7b80\u660e\u5730\u4e86\u89e3\u6211\u4eec\u662f\u5982\u4f55\u6536\u96c6\u3001\u5904\u7406\u548c\u4fdd\u5b58\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u4ee5\u53ca\u5982\u4f55\u4fdd\u62a4\u60a8\u7684\u7a33\u79c1\u5b89\u5168\u3002\n\n\u672c\u534f\u8bae\u5c06\u5e2e\u52a9\u60a8\u4e86\u89e3\u4ee5\u4e0b\u5185\u5bb9\uff1a\n\u4e00\uff0c\u6211\u4eec\u53ef\u80fd\u6536\u96c6\u7684\u4e2a\u4eba\u4fe1\u606f\n\u4e8c\uff0c\u5408\u4f5c\u65b9\u53ef\u80fd\u6536\u96c6\u7684\u4e2a\u4eba\u4fe1\u606f\n\u4e09\uff0c\u6211\u4eec\u53ef\u80fd\u5982\u4f55\u4f7f\u7528\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\n\u56db\uff0c\u6211\u4eec\u5982\u4f55\u50a8\u5b58\u548c\u4fdd\u62a4\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\n\u4e94\uff0c\u6211\u4eec\u5982\u4f55\u5bf9\u5916\u63d0\u4f9b\u4fe1\u606f\n\u516d\uff0c\u672c\u534f\u8bae\u5982\u4f55\u66f4\u65b0\n\u4e03\u3001\u8054\u7cfb\u65b9\u5f0f\n\n\u4e00\u3001\u6211\u4eec\u53ef\u80fd\u6536\u96c6\u7684\u4e2a\u4eba\u4fe1\u606f\n\u60a8\u5728\u4f7f\u7528\u672c\u6e38\u620f\u65f6\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u6536\u96c6\u548c\u4f7f\u7528\u60a8\u7684\u4e00\u4e9b\u4e2a\u4eba\u4fe1\u606f\uff0c\u6211\u4eec\u6536\u96c6\u548c\u4f7f\u7528\u7684\u4e2a\u4eba\u4fe1\u606f\u5305\u62ec\u4e24\u79cd\uff1a\u7b2c\u4e00\u79cd\uff1a\u672c\u6e38\u620f\u7684\u6838\u5fc3\u529f\u80fd\u6240\u5fc5\u8981\u7684\u4fe1\u606f\u3002\u8fd9\u7c7b\u4fe1\u606f\u4e3a\u672c\u6e38\u620f\u6b63\u5e38\u8fd0\u884c\u7684\u5fc5\u5907\u4fe1\u606f\uff1b\u7b2c\u4e8c\u79cd\uff1a\u672c\u6e38\u620f\u9644\u52a0\u4e1a\u52a1\u529f\u80fd\u53ef\u80fd\u6536\u96c6\u7684\u4fe1\u606f\u3002\u8fd9\u7c7b\u4fe1\u606f\u7528\u4ee5\u652f\u6491\u60a8\u5728\u6e38\u620f\u4e2d\u5e0c\u671b\u4f53\u9a8c\u7684\u9644\u52a0\u529f\u80fd\uff0c\u5982\u60a8\u62d2\u7edd\u63d0\u4f9b\uff0c\u5c06\u4f1a\u5bfc\u81f4\u7279\u5b9a\u9644\u52a0\u529f\u80fd\u65e0\u6cd5\u5b9e\u73b0\u6216\u65e0\u6cd5\u8fbe\u5230\u6211\u4eec\u62df\u8fbe\u5230\u7684\u6548\u679c\uff0c\u4f46\u5e76\u4e0d\u4f1a\u5f71\u54cd\u672c\u6e38\u620f\u6838\u5fc3\u529f\u80fd\u7684\u6b63\u5e38\u4f7f\u7528\u3002\n\u6211\u4eec\u9700\u8981\u7279\u522b\u63d0\u9192\u60a8\u7684\u662f\uff1a\u5728\u672c\u6e38\u620f\u4e2d\uff0c\u4e3a\u4e86\u5411\u60a8\u63d0\u4f9b\u66f4\u5168\u9762\u7684\u670d\u52a1\uff0c\u6e38\u620f\u4e2d\u5185\u5d4c\u4e86\u7b2c\u4e09\u65b9SDK\u6216\u7c7b\u4f3c\u5e94\u7528\u7a0b\u5e8f\uff0c\u56e0\u6b64\uff0c\u7b2c\u4e09\u65b9SDK\u6216\u7c7b\u4f3c\u5e94\u7528\u7a0b\u5e8f\u53ef\u80fd\u4e5f\u4f1a\u6536\u96c6\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u3002\n\u9664\u6b64\u4e4b\u5916\uff0c\u60a8\u7406\u89e3\u5e76\u540c\u610f\uff0c\u6211\u4eec\u5e0c\u671b\u63d0\u4f9b\u7ed9\u60a8\u7684\u4ea7\u54c1\u548c\u670d\u52a1\u662f\u5b8c\u5584\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u4f1a\u4e0d\u65ad\u6539\u8fdb\u6211\u4eec\u7684\u4ea7\u54c1\u548c\u670d\u52a1\uff0c\u8fd9\u610f\u5473\u7740\u6211\u4eec\u53ef\u80fd\u4f1a\u7ecf\u5e38\u63a8\u51fa\u65b0\u7684\u4e1a\u52a1\u529f\u80fd\uff0c\u53ef\u80fd\u9700\u8981\u6536\u96c6\u65b0\u7684\u4e2a\u4eba\u4fe1\u606f\u6216\u53d8\u66f4\u4e2a\u4eba\u4fe1\u606f\u4f7f\u7528\u76ee\u7684\u6216\u65b9\u5f0f\u3002\u5982\u679c\u67d0\u4e00\u9700\u8981\u6536\u96c6\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u7684\u529f\u80fd\u672a\u80fd\u5728\u672c\u534f\u8bae\u4e2d\u4e88\u4ee5\u8bf4\u660e\u7684\uff0c\u6211\u4eec\u4f1a\u901a\u8fc7\u66f4\u65b0\u672c\u534f\u8bae\u3001\u5f39\u7a97\u7b49\u65b9\u5f0f\u53e6\u884c\u5411\u60a8\u8bf4\u660e\u8be5\u4fe1\u606f\u6536\u96c6\u7684\u76ee\u7684\u3001\u5185\u5bb9\u3001\u4f7f\u7528\u65b9\u5f0f\u548c\u8303\u56f4\uff0c\u60a8\u53ef\u81ea\u4e3b\u9009\u62e9\u662f\u5426\u540c\u610f\uff0c\u6211\u4eec\u4ec5\u4f1a\u5728\u5f81\u5f97\u60a8\u660e\u793a\u540c\u610f\u540e\u6536\u96c6\u76f8\u5173\u4fe1\u606f\u3002\n\u25c6 \u5f53\u60a8\u8fd0\u884c\u672c\u6e38\u620f\u65f6\uff0c\u4e3a\u6ee1\u8db3\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u653f\u7b56\u53ca\u76f8\u5173\u4e3b\u7ba1\u90e8\u95e8\u7684\u9700\u6c42\uff0c\u786e\u4fdd\u7528\u6237\u8eab\u4efd\u771f\u5b9e\u6027\uff0c\u5b9e\u73b0\u53cd\u6b3a\u8bc8\u7b49\u98ce\u9669\u63a7\u5236\u3001\u4fdd\u969c\u7cfb\u7edf\u548c\u670d\u52a1\u5b89\u5168\uff0c\u60a8\u9700\u8fdb\u884c\u5b9e\u540d\u8ba4\u8bc1\u3002\u6211\u4eec\u4f1a\u5728\u83b7\u5f97\u60a8\u7684\u540c\u610f\u6216\u60a8\u4e3b\u52a8\u63d0\u4f9b\u7684\u60c5\u51b5\u4e0b\uff0c\u6536\u96c6\u60a8\u7684\u5b9e\u540d\u8eab\u4efd\u4fe1\u606f\uff08\u5305\u62ec\u59d3\u540d\u3001\u8eab\u4efd\u8bc1\u53f7\u3001\u624b\u673a\u53f7\u7801\uff09\u3002\u60a8\u5e94\u77e5\u6089\uff0c\u5b9e\u540d\u8eab\u4efd\u4fe1\u606f\u5c5e\u4e8e\u654f\u611f\u4fe1\u606f\uff0c\u8bf7\u60a8\u8c28\u614e\u8003\u8651\u662f\u5426\u63d0\u4f9b\u3002\u6211\u4eec\u4ea6\u4f1a\u9ad8\u5ea6\u5bf9\u5f85\u548c\u8c28\u614e\u5904\u7406\u60a8\u7684\u5b9e\u540d\u8eab\u4efd\u4fe1\u606f\uff08\u5305\u62ec\u9ad8\u5f3a\u5ea6\u52a0\u5bc6\u4fdd\u62a4\uff09\u3002\u62d2\u7edd\u63d0\u4f9b\u5b9e\u540d\u8eab\u4efd\u4fe1\u606f\u53ef\u80fd\u4f1a\u5bfc\u81f4\u60a8\u65e0\u6cd5\u4f7f\u7528\u672c\u6e38\u620f\u3002\n\u25c6 \u5f53\u60a8\u8fd0\u884c\u672c\u6e38\u620f\u65f6\uff0c\u6211\u4eec\u9700\u8981\u6536\u96c6\u60a8\u6240\u4f7f\u7528\u7684\u8bbe\u5907\u4fe1\u606f\uff0c\u5305\u62ec\uff1aMAC\u5730\u5740\u3001\u5e7f\u544a\u6807\u8bc6\u7b26\u3001Serial\u3001\u8bbe\u5907\u673a\u578b\u3001\u8bbe\u5907\u540d\u79f0\u3001\u64cd\u4f5c\u7cfb\u7edf\u53ca\u7248\u672c\u3001\u8bbe\u5907\u5206\u8fa8\u7387\u3001\u8bbe\u5907\u8bbe\u7f6e\u3001\u8f6f\u4ef6\u5b89\u88c5\u5217\u8868\u3001\u8f6f\u786c\u4ef6\u7279\u5f81\u4fe1\u606f\u3001\u8bbe\u5907\u5c4f\u5e55\u5c3a\u5bf8\u3001\u79fb\u52a8\u7f51\u7edc\u4fe1\u606f\u3001\u767b\u5f55IP\u5730\u5740\u3001\u65e5\u5fd7\u4fe1\u606f\u3001CPU\u4fe1\u606f\u3001\u8f6f\u4ef6\u4fe1\u606f\u3002\u7528\u4e8e\u8bc6\u522b\u8d26\u53f7\u5f02\u5e38\u72b6\u6001\uff0c\u4e86\u89e3\u4ea7\u54c1\u9002\u914d\u6027\uff0c\u7ef4\u62a4\u57fa\u7840\u529f\u80fd\u7684\u6b63\u5e38\u8fd0\u884c\uff0c\u5b9e\u73b0\u672c\u6e38\u620f\u7684\u95ee\u9898\u6392\u67e5\u3002\u4e3a\u4e86\u6536\u96c6\u4e0a\u8ff0\u57fa\u672c\u7684\u4e2a\u4eba\u8bbe\u5907\u4fe1\u606f\uff0c\u6211\u4eec\u5c06\u4f1a\u7533\u8bf7\u8bbf\u95ee\u60a8\u7684\u8bbe\u5907\u4fe1\u606f\u6743\u9650\uff0c\u6211\u4eec\u6536\u96c6\u8fd9\u4e9b\u4fe1\u606f\u662f\u4e3a\u4e86\u5411\u60a8\u63d0\u4f9b\u672c\u6e38\u620f\u7684\u6838\u5fc3\u6e38\u620f\u529f\u80fd\u3002\n\u25c6 \u5f53\u60a8\u8fd0\u884c\u672c\u6e38\u620f\u65f6\uff0c\u6211\u4eec\u5c06\u9700\u8981\u83b7\u53d6\u60a8\u7684\u5b58\u50a8\u6743\u9650\uff0c\u7528\u4e8e\u4f7f\u5e94\u7528\u7a0b\u5e8f\u5728\u8fd0\u884c\u65f6\u5bf9\u6e38\u620f\u8d44\u6e90\u8fdb\u884c\u5fc5\u8981\u7684\u7f13\u5b58\u548c\u8bfb\u53d6\u3002\u5b58\u50a8\u6743\u9650\u7684\u5f00\u542f\u662f\u4e3a\u4e86\u5411\u60a8\u63d0\u4f9b\u672c\u6e38\u620f\u6838\u5fc3\u529f\u80fd\u3002\n\u25c6 \u5f53\u60a8\u4f7f\u7528\u672c\u6e38\u620f\u7684\u6d88\u8d39\u529f\u80fd\u65f6\uff0c\u6211\u4eec\u4f1a\u6536\u96c6\u60a8\u7684\u5145\u503c\u8bb0\u5f55\u548c\u6d88\u8d39\u8bb0\u5f55\uff0c\u4ee5\u4fbf\u60a8\u67e5\u8be2\u60a8\u7684\u4ea4\u6613\u4fe1\u606f\uff0c\u540c\u65f6\u5c3d\u6700\u5927\u7a0b\u5ea6\u4fdd\u62a4\u60a8\u7684\u865a\u62df\u7269\u54c1\u5b89\u5168\u3002\u5145\u503c\u8bb0\u5f55\u3001\u6d88\u8d39\u8bb0\u5f55\u5c5e\u4e8e\u654f\u611f\u4fe1\u606f\uff0c\u6536\u96c6\u4e0a\u8ff0\u4fe1\u606f\u4e3a\u5b9e\u73b0\u672c\u6e38\u620f\u6d88\u8d39\u529f\u80fd\u6240\u5fc5\u9700\u7684\uff0c\u5426\u5219\u60a8\u5c06\u65e0\u6cd5\u5b8c\u6210\u4ea4\u6613\u3002\n\u25c6 \u6211\u4eec\u81f4\u529b\u4e8e\u4e3a\u4f60\u63d0\u4f9b\u5b89\u5168\u3001\u53ef\u4fe1\u7684\u4ea7\u54c1\u4e0e\u4f7f\u7528\u73af\u5883\uff0c\u63d0\u4f9b\u4f18\u8d28\u800c\u53ef\u9760\u7684\u670d\u52a1\u4e0e\u4fe1\u606f\u662f\u6211\u4eec\u7684\u6838\u5fc3\u76ee\u6807\u3002\u4e3a\u4e86\u7ef4\u62a4\u76f8\u5173\u4ea7\u54c1\u6216\u670d\u52a1\u7684\u6b63\u5e38\u7a33\u5b9a\u8fd0\u884c\uff0c\u4fdd\u62a4\u4f60\u6216\u5176\u4ed6\u7528\u6237\u6216\u516c\u4f17\u7684\u5b89\u5168\u53ca\u5408\u6cd5\u5229\u76ca\uff0c\u6211\u4eec\u4f1a\u6536\u96c6\u5982\u4e0b\u5fc5\u8981\u4fe1\u606f\uff1a\n1.\u4e3a\u4e86\u4fdd\u969c\u8f6f\u4ef6\u4e0e\u670d\u52a1\u7684\u5b89\u5168\u8fd0\u884c\u3001\u8fd0\u8425\u7684\u8d28\u91cf\u53ca\u6548\u7387\uff0c\u6211\u4eec\u4f1a\u6536\u96c6\u4f60\u7684\u786c\u4ef6\u578b\u53f7\u3001\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u53f7\u3001\u7f51\u7edc\u8bbe\u5907\u786c\u4ef6\u5730\u5740\uff08MAC\u5730\u5740\uff09\u3001\u786c\u4ef6\u5e8f\u5217\u53f7\u3001IP \u5730\u5740\u3001WLAN\u63a5\u5165\u70b9\uff08\u5982SSID\uff0cBSSID\uff09\u3001\u84dd\u7259\uff08Bluetooth\uff09\u3001\u57fa\u7ad9\u3001\u8f6f\u4ef6\u7248\u672c\u53f7\u3001\u7f51\u7edc\u63a5\u5165\u65b9\u5f0f\u3001\u7c7b\u578b\u3001\u72b6\u6001\u3001\u7f51\u7edc\u8d28\u91cf\u6570\u636e\u3001\u64cd\u4f5c\u3001\u4f7f\u7528\u3001\u670d\u52a1\u65e5\u5fd7\u3001\u4f20\u611f\u5668\u4fe1\u606f\u7b49\u6570\u636e\u3002\n2.\u4e3a\u4e86\u9884\u9632\u6076\u610f\u7a0b\u5e8f\u3001\u4fdd\u969c\u8fd0\u8425\u8d28\u91cf\u53ca\u6548\u7387\uff0c\u6211\u4eec\u4f1a\u6536\u96c6\u5b89\u88c5\u7684\u5e94\u7528\u4fe1\u606f\u6216\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u4fe1\u606f\u3001\u5e94\u7528\u7a0b\u5e8f\u7684\u603b\u4f53\u8fd0\u884c\u3001\u4f7f\u7528\u60c5\u51b5\u4e0e\u9891\u7387\u3001\u5e94\u7528\u5d29\u6e83\u60c5\u51b5\u3001\u603b\u4f53\u5b89\u88c5\u4f7f\u7528\u60c5\u51b5\u3001\u6027\u80fd\u6570\u636e\u3001\u5e94\u7528\u6765\u6e90\u3002\n3.\u6211\u4eec\u53ef\u80fd\u4f7f\u7528\u4f60\u7684\u5e10\u53f7\u4fe1\u606f\u3001\u8bbe\u5907\u4fe1\u606f\u3001\u670d\u52a1\u65e5\u5fd7\u4fe1\u606f\uff0c\u4ee5\u53ca\u6211\u4eec\u7684\u5173\u8054\u65b9\u3001\u5408\u4f5c\u65b9\u83b7\u5f97\u4f60\u6388\u6743\u6216\u4f9d\u6cd5\u53ef\u4ee5\u63d0\u4f9b\u7ed9\u6211\u4eec\u7684\u4fe1\u606f\uff0c\u7528\u4e8e\u5224\u65ad\u5e10\u53f7\u5b89\u5168\u3001\u4ea4\u6613\u5b89\u5168\u3001\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u3001\u8bc6\u522b\u8fdd\u6cd5\u8fdd\u89c4\u60c5\u51b5\u3001\u68c0\u6d4b\u53ca\u9632\u8303\u5b89\u5168\u4e8b\u4ef6\uff0c\u5e76\u4f9d\u6cd5\u91c7\u53d6\u5fc5\u8981\u7684\u8bb0\u5f55\u3001\u5206\u6790\u3001\u5904\u7f6e\u63aa\u65bd\u3002\n\n\u25c6 \u5f53\u60a8\u4f7f\u7528\u6e38\u620f\u4e2d\u7684\u5ba2\u670d\u529f\u80fd\u65f6\uff0c\u7b2c\u4e09\u65b9\u5ba2\u670dSDK\u5c06\u4f1a\u542f\u52a8\u5e76\u53ef\u80fd\u6536\u96c6\u60a8\u7684\u8bbe\u5907\u4fe1\u606f\uff0c\u5f81\u6c42\u60a8\u7684\u9ea6\u514b\u98ce\u6743\u9650\u3001\u76f8\u673a\u6743\u9650\u3001\u76f8\u518c\u6743\u9650\u3001\u6216\u7167\u7247\u6743\u9650\u6388\u6743\uff08\u8be6\u60c5\u8bf7\u89c1\u9644\u4ef6\u4e00\uff1a\u300a\u7b2c\u4e09\u65b9SDK\u53ca\u7c7b\u4f3c\u5e94\u7528\u7a0b\u5e8f\u8bf4\u660e\u300b\uff09\u3002\u4e3a\u4e86\u60a8\u7684\u8d26\u53f7\u4e0e\u7cfb\u7edf\u5b89\u5168\uff0c\u4f18\u5316\u670d\u52a1\u8d28\u91cf\uff0c\u6211\u4eec\u53ef\u80fd\u4ece\u7b2c\u4e09\u65b9\u5ba2\u670dSDK\u63a5\u89e6\u5e76\u95f4\u63a5\u6536\u96c6\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\uff0c\u5305\u62ec\u60a8\u7684\u8bbe\u5907\u4fe1\u606f\u548c\u60a8\u4e0e\u5ba2\u670d\u7684\u6c9f\u901a\u5185\u5bb9\uff08\u5305\u62ec\u6587\u672c\u3001\u56fe\u7247\u3001\u97f3\u89c6\u9891\u3001\u901a\u8bdd\u8bb0\u5f55\u5f62\u5f0f\uff09\u3002\u8bf7\u60a8\u77e5\u6089\u5e76\u7406\u89e3\uff0c\u5982\u60a8\u4e0e\u5ba2\u670d\u6c9f\u901a\u4e2d\u6d89\u53ca\u5230\u8d26\u53f7\u6216\u4e2a\u4eba\u654f\u611f\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u8981\u6c42\u60a8\u63d0\u4f9b\u4e2a\u4eba\u654f\u611f\u4fe1\u606f\uff08\u5305\u62ec\u624b\u673a\u53f7\u7801\u3001\u8eab\u4efd\u8bc1\u53f7\u7801\uff09\uff0c\u7528\u4e8e\u4e0e\u8be5\u8d26\u53f7\u5b9e\u540d\u8ba4\u8bc1\u4fe1\u606f\u6838\u5bf9\uff0c\u5224\u65ad\u60a8\u7684\u771f\u5b9e\u8eab\u4efd\uff1b\u4e0a\u8ff0\u654f\u611f\u4fe1\u606f\u4ec5\u505a\u6838\u5bf9\u4e4b\u7528\uff0c\u5ba2\u670d\u4e0d\u4f1a\u4e88\u4ee5\u7559\u5b58\u3002\n\u25c6 \u6839\u636e\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u53ca\u56fd\u5bb6\u6807\u51c6\uff0c\u4ee5\u4e0b\u60c5\u5f62\u4e2d\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u6536\u96c6\u3001\u4f7f\u7528\u60a8\u7684\u76f8\u5173\u4e2a\u4eba\u4fe1\u606f\u4e14\u65e0\u9700\u5f81\u6c42\u60a8\u7684\u6388\u6743\u540c\u610f\uff1a\n1. \u4e0e\u56fd\u5bb6\u5b89\u5168\u3001\u56fd\u9632\u5b89\u5168\u7b49\u56fd\u5bb6\u5229\u76ca\u76f4\u63a5\u76f8\u5173\u7684\uff1b\u4e0e\u516c\u5171\u5b89\u5168\u3001\u516c\u5171\u536b\u751f\u3001\u516c\u5171\u77e5\u60c5\u7b49\u91cd\u5927\u516c\u5171\u5229\u76ca\u76f4\u63a5\u76f8\u5173\u7684\uff1b\n2. \u4e0e\u72af\u7f6a\u4fa6\u67e5\u3001\u8d77\u8bc9\u3001\u5ba1\u5224\u548c\u5224\u51b3\u6267\u884c\u7b49\u76f4\u63a5\u76f8\u5173\u7684\uff1b\n3. \u51fa\u4e8e\u7ef4\u62a4\u7528\u6237\u6216\u5176\u4ed6\u4e2a\u4eba\u7684\u751f\u547d\u3001\u8d22\u4ea7\u3001\u58f0\u8a89\u7b49\u91cd\u5927\u5408\u6cd5\u6743\u76ca\u4f46\u53c8\u5f88\u96be\u5f97\u5230\u672c\u4eba\u540c\u610f\u7684\uff1b\n4. \u6240\u6536\u96c6\u7684\u4e2a\u4eba\u4fe1\u606f\u662f\u7528\u6237\u81ea\u884c\u5411\u793e\u4f1a\u516c\u4f17\u516c\u5f00\u7684\uff1b\n5. \u4ece\u5408\u6cd5\u516c\u5f00\u62ab\u9732\u7684\u4fe1\u606f\u4e2d\u6536\u96c6\u4e2a\u4eba\u4fe1\u606f\u7684\uff0c\u5982\u5408\u6cd5\u7684\u65b0\u95fb\u62a5\u9053\u3001\u653f\u5e9c\u4fe1\u606f\u516c\u5f00\u7b49\u6e20\u9053\uff1b\n6. \u6839\u636e\u7528\u6237\u8981\u6c42\u7b7e\u8ba2\u548c\u5c65\u884c\u5408\u540c\u6240\u5fc5\u9700\u7684\uff1b\n7. \u7528\u4e8e\u7ef4\u62a4\u6240\u63d0\u4f9b\u7684\u4ea7\u54c1\u6216\u670d\u52a1\u7684\u5b89\u5168\u7a33\u5b9a\u8fd0\u884c\u6240\u5fc5\u9700\u7684\uff0c\u4f8b\u5982\u53d1\u73b0\u3001\u5904\u7f6e\u4ea7\u54c1\u6216\u670d\u52a1\u7684\u6545\u969c\uff1b\n8. \u4e3a\u5f00\u5c55\u5408\u6cd5\u7684\u65b0\u95fb\u62a5\u9053\u6240\u5fc5\u9700\u7684\uff1b\n9. \u51fa\u4e8e\u516c\u5171\u5229\u76ca\u5f00\u5c55\u7edf\u8ba1\u6216\u5b66\u672f\u7814\u7a76\u6240\u5fc5\u8981\uff0c\u4e14\u5176\u5bf9\u5916\u63d0\u4f9b\u5b66\u672f\u7814\u7a76\u6216\u63cf\u8ff0\u7684\u7ed3\u679c\u65f6\uff0c\u5bf9\u7ed3\u679c\u4e2d\u6240\u5305\u542b\u7684\u4e2a\u4eba\u4fe1\u606f\u8fdb\u884c\u53bb\u6807\u8bc6\u5316\u5904\u7406\u7684\uff1b\n10. \u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u7684\u5176\u4ed6\u60c5\u5f62\u3002\n\n\n\u4e8c\u3001\u5408\u4f5c\u65b9\u53ef\u80fd\u6536\u96c6\u7684\u4e2a\u4eba\u4fe1\u606f\n\u25c6\u5408\u4f5c\u5e73\u53f0\u7b2c\u4e09\u65b9SDK\uff1a\nQQSDK\uff0c\u817e\u8bafSDK\uff0c\u79fb\u52a8\u5e94\u7528SDK\uff0c\u5b57\u8282\u8df3\u52a8SDK\uff0ccom.sigmob.sdk\uff0ckssdk-ad\uff0ccom.yxcorp.kuaishou\uff0c\u70ed\u4e91TrackingIO\uff0c\u5b57\u8282\u589e\u957f\u8425\u9500SDK\uff0cQuickSDK For Unity 3D\uff0ccom.ss.android,com.reyun.tracking\uff0cyaq.pro.getVresult\uff0cbykvm_19do.bykvm_19do.bykvm_if122\uff0c\u7a7f\u5c71\u7532\uff08\u5934\u6761\uff09SDK\uff0c\u5fae\u4fe1SDK\uff0c\u4f18\u91cf\u6c47\uff08\u5e7f\u70b9\u901a\u79fb\u52a8\u8054\u76df\u7cfb\u7edf\uff09SDK\n\u25c6\u6d89\u53ca\u4e2a\u4eba\u4fe1\u606f\uff1a\n\u8bbe\u5907\u6807\u8bc6\u7b26\uff08Android\u5982IMEI\u3001AndroidID\u3001OAID\u3001IMSI\u3001ICCID\u3001MEID\uff0ciOS\u5982IDFV\u3001IDFA\uff09\uff0c\u8fd0\u884c\u4e2d\u7684\u8fdb\u7a0b\uff0cMAC\u5730\u5740\uff0cIP \u5730\u5740\uff0c\u4f4d\u7f6e\u4fe1\u606f\uff08\u5982GPS\u3001WLAN\u63a5\u5165\u70b9\u3001\u84dd\u7259\u548c\u57fa\u7ad9\uff09\uff0c\u7f51\u7edc\u7c7b\u578b\uff0c\u8bbe\u5907\u4f20\u611f\u5668\uff0c\u8bbe\u5907\u5e8f\u5217\u53f7\uff0c\u8bbe\u5907\u5e10\u6237\u6570\u636e\uff0cSD\u5361\u6570\u636e\uff0c\u672c\u673a\u53f7\u7801\uff0c\u7f51\u7edc\u7c7b\u578b\u3001\u5d29\u6e83\u4fe1\u606f\u3001\u6027\u80fd\u6570\u636e\u3001\u5e7f\u544a\u6570\u636e\uff0c\u8bbe\u5907\u5e8f\u5217\u53f7\uff08SN\u7801\uff09\uff0c\u8bbe\u5907\u578b\u53f7\u3001\u8bbe\u5907\u54c1\u724c\u3001\u8bbe\u5907\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\n\u25c6\u4f7f\u7528\u76ee\u7684\uff1a\n\u63d0\u4f9b\u6e38\u620f\u57fa\u7840\u529f\u80fd\u3001\u5b89\u5168\u98ce\u63a7\u670d\u52a1\u3001\u6e38\u620f\u4f18\u5316\u670d\u52a1\u3001\u6e38\u620f\u8d44\u4ea7\u4fdd\u62a4\u670d\u52a1\u3001\u9884\u9632\u6076\u610f\u7a0b\u5e8f\u3001\u4fdd\u969c\u8fd0\u8425\u8d28\u91cf\u53ca\u6548\u7387\uff0c\u5e7f\u544a\u6295\u653e\u5408\u4f5c\u3001\u5e7f\u544a\u5f52\u56e0\u3001\u53cd\u4f5c\u5f0a\u670d\u52a1\uff0c\u63d0\u4f9b\u8d26\u53f7\u767b\u5f55\u3001\u2f40\u4ed8\u3001\u5e7f\u544a\u53d8\u73b0\uff0c\u5e7f\u544a\u6548\u679c\u5206\u6790\uff0c\u63d0\u4f9b\u901a\u8fc7\u5fae\u4fe1\u767b\u5f55\u3001\u5206\u4eab\u81f3\u5fae\u4fe1\u529f\u80fd\n\u25c6\u4f7f\u7528\u573a\u666f\uff1a\n\u5728\u7528\u6237\u4f7f\u7528\u6e38\u620f\u65f6\u4f7f\u7528\n\u25c6\u5408\u4f5c\u65b9\u4e3b\u4f53\uff1a\n\u5317\u4eac\u6296\u97f3\u4fe1\u606f\u670d\u52a1\u6709\u9650\u516c\u53f8\uff0c\u5317\u4eac\u5de8\u91cf\u5f15\u64ce\u7f51\u7edc\u6280\u672f\u6709\u9650\u516c\u53f8\uff0c\u5317\u4eac\u521b\u667a\u6c47\u805a\u79d1\u6280\u6709\u9650\u516c\u53f8\uff0c\u5317\u4eac\u5feb\u624b\u79d1\u6280\u6709\u9650\u516c\u53f8\uff0c\u817e\u8baf\u79d1\u6280\uff08\u6df1\u5733\uff09\u6709\u9650\u516c\u53f8\uff0c\u5317\u4eac\u70ed\u4e91\u79d1\u6280\u6709\u9650\u516c\u53f8\uff0c\u5317\u4eac\u5b57\u8282\u8df3\u52a8\u79d1\u6280\u6709\u9650\u516c\u53f8\uff0c\u7ef4\u6c83\u79fb\u52a8\u901a\u4fe1\u6709\u9650\u516c\u53f8\uff0c\u5e7f\u4e1c\u6b22\u592a\u79d1\u6280\u6709\u9650\u516c\u53f8\n\n\n\u4e09\u3001\u6211\u4eec\u53ef\u80fd\u5982\u4f55\u4f7f\u7528\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\n\u6211\u4eec\u5c06\u4e25\u683c\u9075\u5b88\u6cd5\u5f8b\u6cd5\u89c4\u7684\u89c4\u5b9a\u4ee5\u53ca\u4e0e\u60a8\u7684\u7ea6\u5b9a\uff0c\u6309\u7167\u672c\u534f\u8bae\u53ca\u300a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\u300b\u4f7f\u7528\u6536\u96c6\u7684\u4fe1\u606f\u3002\n\u25c6 \u4fe1\u606f\u4f7f\u7528\u89c4\u5219\n\u6211\u4eec\u4f1a\u6309\u7167\u5982\u4e0b\u89c4\u5219\u4f7f\u7528\u672c\u534f\u8bae\u7b2c\u4e00\u6761\u6536\u96c6\u7684\u4fe1\u606f\uff1a\n1. \u6211\u4eec\u4f1a\u6839\u636e\u6536\u96c6\u7684\u4fe1\u606f\u5411\u60a8\u63d0\u4f9b\u5404\u9879\u529f\u80fd\u4e0e\u670d\u52a1\uff0c\u5305\u62ec\u57fa\u7840\u6e38\u620f\u529f\u80fd\u3001\u73a9\u5bb6\u4e92\u52a8\u529f\u80fd\u3001\u6d88\u8d39\u529f\u80fd\u3001\u6267\u884c\u8f6f\u4ef6\u9a8c\u8bc1\u3001\u6267\u884c\u8f6f\u4ef6\u5347\u7ea7\u3001\u7f51\u7edc\u540c\u6b65\u7b49\uff1b\n2. \u6211\u4eec\u4f1a\u6839\u636e\u60a8\u4f7f\u7528\u516c\u53f8\u4ea7\u54c1\u7684\u9891\u7387\u548c\u60c5\u51b5\u3001\u6545\u969c\u4fe1\u606f\u3001\u6027\u80fd\u4fe1\u606f\u7b49\u5206\u6790\u672c\u6e38\u620f\u7684\u8fd0\u884c\u60c5\u51b5\uff0c\u4ee5\u786e\u4fdd\u670d\u52a1\u7684\u5b89\u5168\u6027\uff0c\u5e76\u4f18\u5316\u6211\u4eec\u7684\u4ea7\u54c1\uff0c\u63d0\u9ad8\u6211\u4eec\u7684\u670d\u52a1\u8d28\u91cf\u3002\u6211\u4eec\u4e0d\u4f1a\u5c06\u5b58\u50a8\u5728\u5206\u6790\u8f6f\u4ef6\u4e2d\u7684\u4fe1\u606f\u4e0e\u60a8\u63d0\u4f9b\u7684\u4e2a\u4eba\u8eab\u4efd\u4fe1\u606f\u76f8\u7ed3\u5408\u3002\n\u25c6\u4fe1\u606f\u4f7f\u7528\u89c4\u5219\u7684\u53d8\u52a8\u53ca\u518d\u6b21\u540c\u610f\n\u6211\u4eec\u5c06\u4f1a\u5728\u672c\u534f\u8bae\u6240\u6db5\u76d6\u7684\u7528\u9014\u5185\u4f7f\u7528\u6536\u96c6\u5230\u7684\u4fe1\u606f\u3002\u5982\u6211\u4eec\u62df\u4f7f\u7528\u7684\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u8303\u56f4\u8d85\u51fa\u4e86\u672c\u534f\u8bae\u6240\u8ff0\u8303\u56f4\uff0c\u6211\u4eec\u5c06\u5728\u6536\u96c6\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u524d\uff0c\u4fee\u6539\u672c\u534f\u8bae\u5185\u5bb9\uff0c\u5e76\u901a\u8fc7\u5f39\u7a97\u3001\u63a8\u9001\u901a\u77e5\u7b49\u65b9\u5f0f\u53ca\u65f6\u5411\u60a8\u544a\u77e5\uff0c\u5e76\u518d\u6b21\u5f81\u5f97\u60a8\u7684\u660e\u793a\u540c\u610f\u3002\n\n\u56db\u3001\u6211\u4eec\u5982\u4f55\u50a8\u5b58\u548c\u4fdd\u62a4\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\n\u25c6\u4e2a\u4eba\u4fe1\u606f\u7684\u50a8\u5b58\n1. \u4fe1\u606f\u50a8\u5b58\u7684\u65b9\u5f0f\u548c\u671f\u9650\n\u6211\u4eec\u4f1a\u901a\u8fc7\u5b89\u5168\u7684\u65b9\u5f0f\u5b58\u50a8\u60a8\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u672c\u5730\u5b58\u50a8\uff08\u4f8b\u5982\u5229\u7528APP\u8fdb\u884c\u6570\u636e\u7f13\u5b58\uff09\u3001\u6570\u636e\u5e93\u548c\u670d\u52a1\u5668\u65e5\u5fd7\u3002\u6211\u4eec\u53ea\u4f1a\u5728\u4e3a\u5b9e\u73b0\u670d\u52a1\u76ee\u7684\u6240\u5fc5\u9700\u7684\u65f6\u95f4\u5185\u6216\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u7684\u6761\u4ef6\u4e0b\u5b58\u50a8\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u3002\n\u9664\u975e\u6cd5\u5f8b\u53e6\u6709\u89c4\u5b9a\u6216\u60a8\u6839\u636e\u672c\u534f\u8bae\u63d0\u51fa\u8bf7\u6c42\uff0c\u6211\u4eec\u5c06\u5728\u6e38\u620f\u8fd0\u8425\u671f\u95f4\u5185\u4fdd\u5b58\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u3002\n2. \u4fe1\u606f\u50a8\u5b58\u7684\u5730\u57df\n\u6211\u4eec\u4f1a\u6309\u7167\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\uff0c\u5c06\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u5b58\u50a8\u4e8e\u4e2d\u56fd\u5883\u5185\u3002\n3. \u4fe1\u606f\u7684\u5220\u9664\n\u5f53\u672c\u6e38\u620f\u505c\u6b62\u8fd0\u8425\u6216\u6839\u636e\u672c\u534f\u8bae\u6211\u4eec\u4e0d\u518d\u4fdd\u5b58\u60a8\u4fe1\u606f\u65f6\uff0c\u5b58\u50a8\u4e2a\u4eba\u4fe1\u606f\u7684\u7535\u5b50\u6863\u6848\u5c06\u88ab\u6c38\u4e45\u5220\u9664\uff0c\u6211\u4eec\u4f1a\u91c7\u53d6\u5408\u7406\u63aa\u65bd\u786e\u4fdd\u4e2a\u4eba\u4fe1\u606f\u4e0d\u80fd\u88ab\u6062\u590d\u3002\u5982\u6839\u636e\u6cd5\u5f8b\u89c4\u5b9a\u6211\u4eec\u5e94\u7ee7\u7eed\u4fdd\u5b58\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\uff0c\u8fd9\u90e8\u5206\u4e2a\u4eba\u4fe1\u606f\u4e5f\u5c06\u4e0e\u5176\u5b83\u7c7b\u578b\u4fe1\u606f\u9694\u79bb\u4fdd\u5b58\u3002\n\u25c6\u4e2a\u4eba\u4fe1\u606f\u7684\u4fdd\u62a4\n1. \u4fe1\u606f\u5b89\u5168\n\u5728\u73b0\u6709\u8bbe\u5907\u53ca\u6280\u672f\u6761\u4ef6\u4e0b\uff0c\u6211\u4eec\u4e00\u8d2f\u79ef\u6781\u5730\u91c7\u53d6\u6280\u672f\u4e0e\u7ba1\u7406\u7b49\u5408\u7406\u63aa\u65bd\u4fdd\u969c\u60a8\u8d26\u53f7\u4e0e\u4e2a\u4eba\u4fe1\u606f\u7684\u5b89\u5168\uff1b\u6211\u4eec\u5c06\u5584\u610f\u4f7f\u7528\u6536\u96c6\u7684\u4fe1\u606f\uff0c\u91c7\u53d6\u5404\u9879\u6709\u6548\u4e14\u5fc5\u8981\u7684\u63aa\u65bd\u4ee5\u4fdd\u62a4\u60a8\u7684\u9690\u79c1\u5b89\u5168\uff0c\u5e76\u4f7f\u7528\u5546\u4e1a\u4e0a\u5408\u7406\u7684\u5b89\u5168\u6280\u672f\u63aa\u65bd\u6765\u4fdd\u62a4\u60a8\u7684\u9690\u79c1\u4e0d\u88ab\u672a\u7ecf\u6388\u6743\u7684\u8bbf\u95ee\u3001\u4f7f\u7528\u6216\u6cc4\u6f0f\u3002\u76ee\u524d\uff0c\u6211\u4eec\u91c7\u7528\u4e1a\u754c\u9886\u5148\u7684\u6280\u672f\u4fdd\u62a4\u63aa\u65bd\u3002\u6211\u4eec\u4f7f\u7528\u7684\u6280\u672f\u624b\u6bb5\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u9632\u706b\u5899\u3001\u52a0\u5bc6\uff08\u4f8b\u5982SSL\uff09\u3001\u53bb\u6807\u8bc6\u5316\u6216\u533f\u540d\u5316\u5904\u7406\u3001\u8bbf\u95ee\u63a7\u5236\u63aa\u65bd\uff08\u5821\u5792\u673a\u3001\u4e8c\u6b21\u9a8c\u8bc1\u7b49\u65b9\u5f0f\uff09\u7b49\u3002\n\u6211\u4eec\u5efa\u7acb\u4e86\u4fdd\u969c\u4e2a\u4eba\u4fe1\u606f\u5b89\u5168\u4e13\u95e8\u7684\u7ba1\u7406\u5236\u5ea6\u3001\u6d41\u7a0b\u548c\u7ec4\u7ec7\u3002\u6211\u4eec\u4ec5\u5141\u8bb8\u6709\u5fc5\u8981\u77e5\u6653\u8fd9\u4e9b\u4fe1\u606f\u7684\u5458\u5de5\u8bbf\u95ee\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\uff0c\u5e76\u4e3a\u6b64\u8bbe\u7f6e\u4e86\u4e25\u683c\u7684\u8bbf\u95ee\u6743\u9650\u63a7\u5236\u548c\u76d1\u63a7\u673a\u5236\u3002\u6211\u4eec\u540c\u65f6\u8981\u6c42\u53ef\u80fd\u63a5\u89e6\u5230\u60a8\u7684\u4fe1\u606f\u7684\u6240\u6709\u4eba\u5458\u5c65\u884c\u76f8\u5e94\u7684\u4fdd\u5bc6\u4e49\u52a1\u3002\u5982\u679c\u672a\u80fd\u5c65\u884c\u8fd9\u4e9b\u4e49\u52a1\uff0c\u6211\u4eec\u4f1a\u8ffd\u7a76\u5176\u6cd5\u5f8b\u8d23\u4efb\u3002\n2. \u4fe1\u606f\u5b89\u5168\u4e8b\u4ef6\u5904\u7f6e\u63aa\u65bd\n\u82e5\u53d1\u751f\u4e2a\u4eba\u4fe1\u606f\u6cc4\u9732\u7b49\u5b89\u5168\u4e8b\u4ef6\uff0c\u6211\u4eec\u4f1a\u542f\u52a8\u5e94\u6025\u9884\u6848\uff0c\u963b\u6b62\u5b89\u5168\u4e8b\u4ef6\u6269\u5927\u3002\u82e5\u53d1\u751f\u4fe1\u606f\u5b89\u5168\u4e8b\u4ef6\uff0c\u6211\u4eec\u4f1a\u4ee5\u516c\u544a\u3001\u63a8\u9001\u901a\u77e5\u6216\u90ae\u4ef6\u7b49\u5f62\u5f0f\u544a\u77e5\u60a8\u5b89\u5168\u4e8b\u4ef6\u7684\u57fa\u672c\u60c5\u51b5\u3001\u6211\u4eec\u5373\u5c06\u6216\u5df2\u7ecf\u91c7\u53d6\u7684\u5904\u7f6e\u63aa\u65bd\u548c\u8865\u6551\u63aa\u65bd\uff0c\u4ee5\u53ca\u6211\u4eec\u5bf9\u60a8\u7684\u5e94\u5bf9\u5efa\u8bae\u3002\u5982\u679c\u96be\u4ee5\u5b9e\u73b0\u9010\u4e00\u544a\u77e5\uff0c\u6211\u4eec\u5c06\u901a\u8fc7\u516c\u544a\u7b49\u65b9\u5f0f\u53d1\u5e03\u8b66\u793a\u3002\n\n\u4e94\u3001\u6211\u4eec\u5982\u4f55\u5bf9\u5916\u63d0\u4f9b\u4fe1\u606f\n\u9664\u672c\u534f\u8bae\u4ee5\u53ca\u300a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\u300b\u89c4\u5b9a\u7684\u60c5\u5f62\u5916\uff0c\u6211\u4eec\u4e0d\u4f1a\u4e3b\u52a8\u5171\u4eab\u3001\u63d0\u4f9b\u6216\u8f6c\u8ba9\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u81f3\u7b2c\u4e09\u65b9\u3002\u5982\u5b58\u5728\u5176\u4ed6\u5171\u4eab\u3001\u63d0\u4f9b\u6216\u8f6c\u8ba9\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u6216\u60a8\u8981\u6c42\u6211\u4eec\u5c06\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\u5171\u4eab\u3001\u63d0\u4f9b\u6216\u8f6c\u8ba9\u81f3\u6211\u4eec\u5916\u7684\u7b2c\u4e09\u65b9\u7684\u60c5\u5f62\u65f6\uff0c\u6211\u4eec\u4f1a\u76f4\u63a5\u5411\u60a8\u786e\u8ba4\u5e76\u53d6\u5f97\u60a8\u7684\u660e\u793a\u540c\u610f\u3002\n\u6839\u636e\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u53ca\u56fd\u5bb6\u6807\u51c6\uff0c\u5728\u4ee5\u4e0b\u60c5\u5f62\u4e2d\uff0c\u6211\u4eec\u4f1a\u5728\u4e0d\u4e8b\u5148\u5f81\u5f97\u60a8\u7684\u6388\u6743\u540c\u610f\u7684\u524d\u63d0\u4e0b\uff0c\u5171\u4eab\u3001\u8f6c\u8ba9\u3001\u516c\u5f00\u62ab\u9732\u60a8\u7684\u7279\u5b9a\u4e2a\u4eba\u4fe1\u606f\uff1a\n1. \u7ecf\u60a8\u672c\u4eba(\u6216\u672a\u6210\u5e74\u4eba\u7684\u76d1\u62a4\u4eba)\u4e66\u9762\u6388\u6743\u6216\u5e94\u60a8\u672c\u4eba\uff08\u6216\u672a\u6210\u5e74\u4eba\u7684\u76d1\u62a4\u4eba\uff09\u7684\u4e66\u9762\u8981\u6c42\u800c\u6388\u6743\u6211\u4eec\u62ab\u9732\u7684\uff1b\n2. \u6709\u5173\u6cd5\u5f8b\u8981\u6c42\u6211\u4eec\u62ab\u9732\u7684\uff1b\n3. \u53f8\u6cd5\u673a\u5173\u6216\u884c\u653f\u673a\u5173\u57fa\u4e8e\u6cd5\u5b9a\u7a0b\u5e8f\u8981\u6c42\u6211\u4eec\u63d0\u4f9b\u7684\uff1b\n4. \u51fa\u4e8e\u7ef4\u62a4\u4e2a\u4eba\u4fe1\u606f\u4e3b\u4f53\u6216\u5176\u4ed6\u4e2a\u4eba\u7684\u751f\u547d\u3001\u8d22\u4ea7\u7b49\u91cd\u5927\u5408\u6cd5\u6743\u76ca\u4f46\u53c8\u5f88\u96be\u5f97\u5230\u672c\u4eba\u540c\u610f\u7684\uff1b\n5. \u4e2a\u4eba\u4fe1\u606f\u4e3b\u4f53\u81ea\u884c\u5411\u793e\u4f1a\u516c\u4f17\u516c\u5f00\u4e2a\u4eba\u4fe1\u606f\u7684\uff1b\n6. \u4ece\u5408\u6cd5\u516c\u5f00\u62ab\u9732\u7684\u4fe1\u606f\u4e2d\u6536\u96c6\u4e2a\u4eba\u4fe1\u606f\u7684\uff0c\u5982\u5408\u6cd5\u7684\u65b0\u95fb\u62a5\u9053\u3001\u653f\u5e9c\u4fe1\u606f\u516c\u5f00\u7b49\u6e20\u9053\u3002\n\n\u516d\u3001\u672c\u534f\u8bae\u5982\u4f55\u66f4\u65b0\n\u5982\u53d1\u751f\u4e1a\u52a1\u529f\u80fd\u53d8\u66f4\u3001\u4e2a\u4eba\u4fe1\u606f\u51fa\u5883\u60c5\u51b5\u53d8\u66f4\u3001\u4f7f\u7528\u76ee\u7684\u53d8\u66f4\u3001\u4e2a\u4eba\u4fe1\u606f\u4fdd\u62a4\u8054\u7edc\u65b9\u5f0f\u53d8\u66f4\u7b49\u60c5\u5f62\uff0c\u6211\u4eec\u5c06\u5bf9\u672c\u534f\u8bae\u8fdb\u884c\u76f8\u5e94\u7684\u4fee\u8ba2\uff0c\u5e76\u901a\u8fc7\u5f39\u7a97\u3001\u63a8\u9001\u901a\u77e5\u7b49\u65b9\u5f0f\u53ca\u65f6\u5411\u60a8\u544a\u77e5\uff0c\u5e76\u91cd\u65b0\u83b7\u5f97\u60a8\u7684\u540c\u610f\uff0c\u53ea\u6709\u5728\u60a8\u786e\u8ba4\u5e76\u63a5\u6536\u53d8\u66f4\u540e\u7684\u534f\u8bae\u540e\uff0c\u6211\u4eec\u624d\u4f1a\u4f9d\u636e\u53d8\u66f4\u540e\u7684\u534f\u8bae\u6536\u96c6\u3001\u4f7f\u7528\u3001\u5904\u7406\u548c\u5b58\u50a8\u60a8\u7684\u4e2a\u4eba\u4fe1\u606f\uff1b\u5982\u60a8\u4e0d\u540c\u610f\u53d8\u66f4\u540e\u7684\u5185\u5bb9\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u505c\u6b62\u4f7f\u7528\u6211\u4eec\u7684\u670d\u52a1\u3002 \n\n\u4e03\u3001\u8054\u7cfb\u65b9\u5f0f\n\u5982\u60a8\u6709\u5173\u4e8e\u7f51\u7edc\u4fe1\u606f\u5b89\u5168\u7684\u6295\u8bc9\u548c\u4e3e\u62a5\uff0c\u6216\u5bf9\u672c\u534f\u8bae\u6709\u4efb\u4f55\u95ee\u9898\u3001\u610f\u89c1\u6216\u5efa\u8bae\uff0c\u6216\u5bf9\u6211\u4eec\u7684\u9690\u79c1\u63aa\u65bd\u6709\u4efb\u4f55\u7591\u95ee\u7684\uff0c\u60a8\u53ef\u53d1\u9001\u90ae\u4ef6\u81f31121163660@qq.com\n\u6211\u4eec\u5c06\u5c3d\u5feb\u5ba1\u6838\u6240\u6d89\u95ee\u9898\uff0c\u5e76\u5728\u6536\u5230\u90ae\u4ef6\u7684\u5341\u4e94\u4e2a\u5de5\u4f5c\u65e5\u5185\u56de\u590d\u3002\n\n\u5e7f\u5dde\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u9650\u516c\u53f8",
default: 'PRIVACY POLICY\n1. GENERAL\n1.1. Clever Apps Pte. Ltd. ("we" or "us"), of 8 Marina Boulevard #11-00 Marina Bay Financial Centre Singapore is a data controller. We are committed to protecting and respecting your privacy. This policy (together with our terms of service) sets out the basis on which any personal information we collect from you, or you provide to us, will be processed by us. By using our games and applications ("Games"), you consent to the collection and use of your personal information as outlined in this Privacy Policy. The policy may be amended from time to time. You should visit this page periodically to review any changes to the Privacy Policy.\n1.2. Since the Games are only served through social network websites or mobile application stores, it is your responsibility to read and accept their terms and conditions, as well as their privacy policy prior to continuing.\n\n2. WHAT DATA WE ARE COLLECTING\n2.1. We record information regarding the use of the Games, e.g. access time.\n2.2. Information relating to profile of users of the Games on social networking websites, e.g. player name.\n2.3. Other information, like browser name and version and device information.\n2.4. If you contact us, we may keep a record of that correspondence.\n\n3. THE PURPOSE WE ARE COLLECTING PERSONAL DATA\n3.1. Provide and operate Games.\n3.2. Improve our Games and keep them secure.\n3.3. Personalize Games.\n3.4. Promotional activities, including marketing and advertising.\n3.5. Comply with Clever Apps Pte Ltd\'s legal obligations.\n3.6. Prevent and/or detect fraud or fraudulent behavior. \n\n4. REQUEST DATA DELETION\n4.1. Clever Apps Pte Ltd stores Personal Data of users of the Games for as long as users continue to use the Games. Clever Apps Pte Ltd will delete the Personal Data of a user if there is no ongoing legitimate business need to process data or after receiving the corresponding request from a user of the Games via the email address help.cleverapps+privacy@gmail.com within a reasonable time. \n4.2. Alternatively, players could send their requests through our internal CRM system (located in every game via Settings -> Support). \n\n5. DISCLOSURE OF YOUR PERSONAL INFORMATION\n5.1. We will not sell or give your personally identifiable information to others except as provided in this privacy policy.\n5.2. We may disclose your personal information to any member of our group, which means our subsidiaries, our ultimate holding company and its subsidiaries.\n5.3. We may disclose your personal information to third parties:\n5.3.1. in the event that we sell or buy any business or assets, in which case we may disclose your personal data to the prospective seller or buyer of such business or assets;\n5.3.2. if Clever Apps Pte. Ltd., any of its Gamess, or substantially all of its assets are acquired by a third party, in which case personal data held by it about its users or customers may be one of the assets transferred to that third party. In such circumstances we may retain the right to continue to provide marketing communications relating to other Gamess provided by us to you;\n5.3.3. if we are under a duty to disclose or share your personal data in order to comply with any legal obligation, or in order to enforce or apply our Terms and other agreements; or to protect the rights, property, or safety of Clever Apps Pte. Ltd., members of the Clever Apps, our users, or others. This includes exchanging information with other companies and organisations for the purposes of fraud protection and credit risk reduction.\n5.4. As the Games operates within social networking websites, the Games may share information about you with others in the same social networking site who are using the Games as may be necessary to operate the Games.\n5.5. By continuing to use the Games, you expressly consent to this Privacy Policy, including, without limitation, your consent to use and disclose your personally information in the manner described in this Privacy Policy. If you object to your information being used in this way, you should not otherwise use the Games. This Privacy Policy is incorporated into and subject to the Terms..\n\n6. STORAGE OF YOUR PERSONAL DATA\n6.1. The data that we collect from you may be transferred to, and stored at, a destination outside the European Economic Area ("EEA"). It may also be processed by staff operating outside the EEA who work for us or for one of our suppliers. Such staff maybe engaged in, among other things, the processing of your payment details and the provision of support Gamess. By submitting your personal data, you agree to this transfer, storing or processing. We will take all steps reasonably necessary to ensure that your data is treated securely and in accordance with this privacy policy.\n\n7. COOKIES \n7.1. We may store information about you using cookies (files which are sent by us to your computer or other access device) which we can access when you use our Games in the future. We do this to learn about repeat visitors and to find out if we are delivering quality products and Gamess therefore improving our Games further. During your use of the Gamess, third party advertisers or other Games providers may also place cookies on your computer, over which we have no control. Please check their privacy policies for details of how they use the data they collect in this way.\n7.2. If you want to delete any cookies that are already on your computer, please refer to the instructions for your file management software to locate the file or directory that stores cookies.\n7.3. Information on deleting or controlling cookies is available at www.AboutCookies.org . Please note that by deleting our cookies or disabling future cookies you may not be able to access certain areas or features of our Games.\n\n8. GOOGLE ANALYTICS ADVERTISING FEATURES\n8.1. We have implemented the following Google Analytics Advertising Features: services that require Google Analytics to collect data via advertising cookies and identifiers.\n8.2. We and third-party vendors, including Google, use first-party cookies (such as the Google Analytics cookie) and third-party cookies (such as the Google advertising cookies) or other third-party identifiers together to compile data regarding user interactions with ad impressions, and other ad service functions as they relate to our website.\n8.3. You can opt-out of the Google Analytics Advertising Features we use by indicating your preference using the interest-based opt-out link here: https://tools.google.com/dlpage/gaoptout/. Additionally, you can opt-out through Ads Settings, Ad Settings for mobile apps, or any other available means.\n8.4. For more information on how Google processes and collects your information and how you can opt-out, please see the following links: https://policies.google.com/privacy and https://policies.google.com/technologies/partner-sites.\n\n9. CONTACT\n9.1. Questions, comments and requests regarding this privacy policy are welcomed and should be addressed to help.cleverapps+privacy@gmail.com.'
};
var termsText = {
wechat: "\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\n\n\u6b22\u8fce\u60a8\u9009\u62e9\u7531\u5e7f\u5dde\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u9650\u516c\u53f8\uff08\u4ee5\u4e0b\u7b80\u79f0\u201c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u201d\u6216\u201c\u6211\u4eec\u201d\uff09\u63d0\u4f9b\u7684\u6e38\u620f\uff01\n\u672c\u300a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7528\u6237\u534f\u8bae\u300b\uff08\u4ee5\u4e0b\u7b80\u79f0\u201c\u672c\u534f\u8bae\u201d\uff09\u7531\u60a8\u4e0e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5171\u540c\u7f14\u7ed3\uff0c\u672c\u534f\u8bae\u5177\u6709\u5408\u540c\u6548\u529b\u3002\u8bf7\u60a8\u52a1\u5fc5\u5ba1\u614e\u9605\u8bfb\u3001\u5145\u5206\u7406\u89e3\u5404\u6761\u6b3e\u5185\u5bb9\uff0c\u7279\u522b\u662f\u514d\u9664\u6216\u8005\u9650\u5236\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7684\u6761\u6b3e\uff08\u4ee5\u4e0b\u79f0\u201c\u514d\u8d23\u6761\u6b3e\u201d\uff09\u3001\u5bf9\u7528\u6237\u6743\u5229\u8fdb\u884c\u9650\u5236\u7684\u6761\u6b3e\uff08\u4ee5\u4e0b\u79f0\u201c\u9650\u5236\u6761\u6b3e\u201d\uff09\u3001\u7ea6\u5b9a\u4e89\u8bae\u89e3\u51b3\u65b9\u5f0f\u548c\u53f8\u6cd5\u7ba1\u8f96\u7684\u6761\u6b3e\uff0c\u4ee5\u53ca\u5f00\u901a\u6216\u4f7f\u7528\u67d0\u9879\u670d\u52a1\u7684\u5355\u72ec\u534f\u8bae\u3002\u524d\u8ff0\u514d\u8d23\u3001\u9650\u5236\u53ca\u4e89\u8bae\u89e3\u51b3\u65b9\u5f0f\u548c\u7ba1\u8f96\u6761\u6b3e\u53ef\u80fd\u4ee5\u9ed1\u4f53\u52a0\u7c97\u3001\u989c\u8272\u6807\u8bb0\u6216\u5176\u4ed6\u5408\u7406\u65b9\u5f0f\u63d0\u793a\u60a8\u6ce8\u610f\uff0c\u8bf7\u60a8\u5728\u786e\u8ba4\u540c\u610f\u672c\u534f\u8bae\u4e4b\u524d\u6216\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u4e4b\u524d\u518d\u6b21\u9605\u8bfb\u524d\u8ff0\u6761\u6b3e\u3002\n\u8bf7\u60a8\u8be6\u7ec6\u9605\u8bfb\u672c\u534f\u8bae\u6240\u6709\u6761\u6b3e\uff0c\u5982\u60a8\u540c\u610f\u672c\u534f\u8bae\uff0c\u60a8\u53ef\u7ee7\u7eed\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u3002\u5982\u679c\u60a8\u5bf9\u672c\u534f\u8bae\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u6709\u4efb\u4f55\u7591\u95ee\u6216\u6295\u8bc9\u3001\u5efa\u8bae\uff0c\u53ef\u901a\u8fc7\u5ba2\u670d\u3001\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5ba2\u670d\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff08\u5c0f\u7a0b\u5e8f\u7248\u672c\uff09\u3001\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5ba2\u670d\u516c\u4f17\u53f7\uff08\u5c0f\u7a0b\u5e8f\u7248\u672c\uff09\u7b49\u65b9\u5f0f\u8054\u7cfb\u6211\u4eec\uff0c\u6211\u4eec\u5c06\u5c3d\u5feb\u8ddf\u8fdb\u5904\u7406\uff0c\u5e76\u5728\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u7684\u671f\u9650\u5185\u56de\u590d\u60a8\u7684\u8bf7\u6c42\u3002\u60a8\u70b9\u51fb\u540c\u610f\u3001\u63a5\u53d7\u6216\u4e0b\u4e00\u6b65\uff0c\u6216\u60a8\u6ce8\u518c\u3001\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u5747\u89c6\u4e3a\u60a8\u5df2\u9605\u8bfb\u5e76\u540c\u610f\u7b7e\u7f72\u672c\u534f\u8bae\u3002\n\u5982\u679c\u60a8\u672a\u6ee118\u5468\u5c81\uff0c\u8bf7\u5728\u6cd5\u5b9a\u76d1\u62a4\u4eba\u7684\u966a\u540c\u4e0b\u9605\u8bfb\u672c\u534f\u8bae\uff0c\u5e76\u5728\u53d6\u5f97\u6cd5\u5b9a\u76d1\u62a4\u4eba\u540c\u610f\u540e\u624d\u80fd\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\uff0c\u540c\u65f6\u5e94\u7279\u522b\u6ce8\u610f\u672a\u6210\u5e74\u4eba\u4f7f\u7528\u6761\u6b3e\u3002\u5982\u60a8\u4e3a\u672a\u6210\u5e74\u4eba\u6cd5\u5b9a\u76d1\u62a4\u4eba\uff0c\u5e0c\u671b\u5408\u7406\u8bbe\u5b9a\u5b69\u5b50\u5a31\u4e50\u65f6\u95f4\uff0c\u57f9\u517b\u5b69\u5b50\u5065\u5eb7\u6e38\u620f\u4e60\u60ef\u3002\n\n\u4e00\u3001\u5b9a\u4e49\n\u5982\u65e0\u7279\u522b\u8bf4\u660e\uff0c\u4e0b\u5217\u672f\u8bed\u5728\u672c\u534f\u8bae\u4e2d\u7684\u542b\u4e49\u4e3a\uff1a\n1.1\u672c\u534f\u8bae\uff1a\u6307\u672c\u534f\u8bae\u6b63\u6587\u3001\u300a\u9690\u79c1\u534f\u8bae\u300b\u3001\u6e38\u620f\u89c4\u5219\u53ca\u5176\u4fee\u8ba2\u7248\u672c\u3002\u4e0a\u8ff0\u5185\u5bb9\u4e00\u7ecf\u6b63\u5f0f\u53d1\u5e03\uff0c\u5373\u6210\u4e3a\u672c\u534f\u8bae\u4e0d\u53ef\u5206\u5272\u7684\u7ec4\u6210\u90e8\u5206\u3002\u672c\u534f\u8bae\u540c\u65f6\u8fd8\u5305\u62ec\u300a\u7f51\u7edc\u6e38\u620f\u670d\u52a1\u683c\u5f0f\u5316\u534f\u8bae\u5fc5\u5907\u6761\u6b3e\u300b\u3002\n1.2\u6e38\u620f\u89c4\u5219\uff1a\u6307\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e0d\u65f6\u53d1\u5e03\u5e76\u4fee\u8ba2\u7684\u5173\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u7528\u6237\u5b88\u5219\u3001\u73a9\u5bb6\u6761\u4f8b\u3001\u6e38\u620f\u516c\u544a\u3001\u63d0\u793a\u53ca\u901a\u77e5\u7b49\u5185\u5bb9\u3002\n1.3\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\uff1a\u6307\u5411\u60a8\u63d0\u4f9b\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ca\u5176\u4ed6\u670d\u52a1\u7684\u6df1\u5733\u5e02\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u79d1\u6280\u80a1\u4efd\u6709\u9650\u516c\u53f8\u53ca\u5176\u5173\u8054\u516c\u53f8\uff0c\u5728\u672c\u534f\u8bae\u4e2d\u7b80\u79f0\u4e3a\u201c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u201d\u6216\u201c\u6211\u4eec\u201d\u3002\n1.4\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff1a\u6307\u7531\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8d1f\u8d23\u8fd0\u8425\u7684\u6e38\u620f\u7684\u7edf\u79f0\uff0c\u5305\u62ec\u8ba1\u7b97\u673a\u5ba2\u6237\u7aef\u6e38\u620f\u3001\u7f51\u9875\u6e38\u620f\u3001HTML5\u6e38\u620f\uff08H5\u6e38\u620f\uff09\u3001\u79fb\u52a8\u7ec8\u7aef\u6e38\u620f\u3001\u7535\u89c6\u7aef\u6e38\u620f\u4ee5\u53ca\u5176\u4ed6\u5f62\u5f0f\u7684\u6e38\u620f\uff1b\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ef\u80fd\u4ee5\u8f6f\u4ef6\u5f62\u5f0f\u63d0\u4f9b\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u8fd8\u5305\u62ec\u8be5\u76f8\u5173\u8f6f\u4ef6\u53ca\u76f8\u5173\u6587\u6863\u3002\n1.5\u60a8\uff1a\u53c8\u79f0\u201c \u73a9\u5bb6 \u201d\u6216\u201c\u7528\u6237\u201d\uff0c\u6307\u88ab\u6388\u6743\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4ea7\u54c1\u53ca\u5176\u670d\u52a1\u7684\u81ea\u7136\u4eba\u3002\n1.6\u6e38\u620f\u6570\u636e\uff1a\u6307\u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u88ab\u670d\u52a1\u5668\u8bb0\u5f55\u7684\u5404\u79cd\u6570\u636e\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u89d2\u8272\u6570\u636e\u3001\u865a\u62df\u7269\u54c1\u6570\u636e\u3001\u884c\u4e3a\u65e5\u5fd7\u3001\u8d2d\u4e70\u65e5\u5fd7\u7b49\u6570\u636e\u3002\n1.7\u6e38\u620f\u865a\u62df\u9053\u5177\uff1a\u6307\u63d0\u4f9b\u7684\u4ee5\u7535\u78c1\u8bb0\u5f55\u65b9\u5f0f\u5b58\u50a8\u4e8e\u6e38\u620f\u7a0b\u5e8f\u8fd0\u884c\u7684\u670d\u52a1\u5668\u5185\uff0c\u53ef\u5b9e\u73b0\u6e38\u620f\u7a0b\u5e8f\u8bbe\u5b9a\u7684\u7279\u5b9a\u529f\u80fd\u6216\u4f53\u73b0\u6e38\u620f\u7a0b\u5e8f\u8fd0\u884c\u7684\u7279\u5b9a\u7ed3\u679c\u7684\u4e00\u79cd\u670d\u52a1\uff0c\u5176\u53ef\u4ee5\u4ee5\u6587\u5b57\u3001\u56fe\u5f62\u5316\u6216\u5176\u4ed6\u6570\u5b57\u5f62\u5f0f\u8fdb\u884c\u8868\u73b0\u3002\u6e38\u620f\u865a\u62df\u9053\u5177\u662f\u6e38\u620f\u670d\u52a1\u7684\u4e00\u90e8\u5206\u3002\u5e38\u89c1\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\uff1a\n\uff081\uff09\u6e38\u620f\u4ee3\u5e01\u53ca\u5176\u4ed6\u5404\u79cd\u6e38\u620f\u5e01\u3002\u5176\u4e2d\u6e38\u620f\u4ee3\u5e01\uff0c\u6307\u7528\u6237\u4f7f\u7528\u6cd5\u5b9a\u8d27\u5e01\u6309\u4e00\u5b9a\u6bd4\u4f8b\u76f4\u63a5\u6216\u8005\u95f4\u63a5\u8d2d\u4e70\u7684\uff0c\u5b58\u50a8\u4e8e\u8be5\u7279\u5b9a\u6e38\u620f\u670d\u52a1\u5668\u5185\uff0c\u5e76\u4ec5\u80fd\u7528\u4e8e\u6362\u53d6\u8be5\u7279\u5b9a\u6e38\u620f\u4e2d\u6307\u5b9a\u7684\u5176\u4ed6\u865a\u62df\u9053\u5177\u7b49\u589e\u503c\u670d\u52a1\u7684\u4e00\u79cd\u6e38\u620f\u865a\u62df\u9053\u5177\uff1b\n\uff082\uff09\u6e38\u620f\u88c5\u5907\uff0c\u5982\u6b66\u5668\u7b49\uff1b\n\uff083\uff09\u82f1\u96c4\u3001\u76ae\u80a4\u53ca\u5176\u4ed6\u5404\u79cd\u6e38\u620f\u865a\u62df\u9053\u5177\u3002\n\n\u4e8c\u3001\u534f\u8bae\u7684\u53d8\u66f4\u548c\u751f\u6548\n2.1 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5728\u5fc5\u8981\u65f6\u53d8\u66f4\u672c\u534f\u8bae\u6761\u6b3e\uff0c\u60a8\u53ef\u4ee5\u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u76f8\u5173\u9875\u9762\u67e5\u9605\u6700\u65b0\u7248\u672c\u7684\u534f\u8bae\u6761\u6b3e\u3002\n2.2 \u672c\u534f\u8bae\u6761\u6b3e\u53d8\u66f4\u540e\uff0c\u5982\u679c\u60a8\u7ee7\u7eed\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\uff0c\u5373\u89c6\u4e3a\u60a8\u5df2\u63a5\u53d7\u53d8\u66f4\u540e\u7684\u534f\u8bae\u3002\u5982\u679c\u60a8\u4e0d\u63a5\u53d7\u53d8\u66f4\u540e\u7684\u534f\u8bae\uff0c\u5e94\u5f53\u505c\u6b62\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u3002\n\n\u4e09\u3001\u6e38\u620f\u8d26\u53f7\n3.1 \u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u524d\uff0c\u60a8\u5e94\u5f53\u8fdb\u884c\u5b9e\u540d\u6ce8\u518c\u3002\u8fdb\u884c\u5b9e\u540d\u6ce8\u518c\u65f6\uff0c\u60a8\u5e94\u63d0\u4f9b\u6709\u5173\u60a8\u672c\u4eba\u771f\u5b9e\u3001\u5408\u6cd5\u3001\u51c6\u786e\u3001\u6709\u6548\u7684\u8eab\u4efd\u4fe1\u606f\u53ca\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\uff0c\u4e14\u4e0d\u5f97\u4ee5\u4ed6\u4eba\u8eab\u4efd\u8d44\u6599\u8fdb\u884c\u5b9e\u540d\u6ce8\u518c\u3002\u540c\u65f6\uff0c\u4e3a\u4e86\u907f\u514d\u4e2a\u4eba\u4fe1\u606f\u88ab\u6ee5\u7528\u53ca\u9632\u6b62\u7ed5\u8fc7\u9632\u6c89\u8ff7\u63aa\u65bd\uff0c\u540c\u4e00\u8eab\u4efd\u4fe1\u606f\u53ef\u8ba4\u8bc1\u7684\u6e38\u620f\u8d26\u53f7\u6570\u91cf\u53ef\u80fd\u53d7\u5230\u9650\u5236\uff0c\u4e0d\u5f97\u8d85\u8fc7\u5408\u7406\u6570\u91cf\u3002\u5426\u5219\uff0c\u6211\u4eec\u6709\u6743\u91c7\u53d6\u76f8\u5e94\u5904\u7406\u63aa\u65bd\uff0c\u5e76\u53ef\u516c\u5e03\u5904\u7406\u7ed3\u679c\uff0c\u56e0\u6b64\u9020\u6210\u7684\u4e00\u5207\u540e\u679c\u7531\u60a8\u81ea\u884c\u627f\u62c5\uff0c\u4e14\u6211\u4eec\u6709\u6743\u8981\u6c42\u60a8\u8d54\u507f\u56e0\u6b64\u7ed9\u6211\u4eec\u9020\u6210\u7684\u6240\u6709\u635f\u5931\u3002\n3.2 \u4e3a\u6ee1\u8db3\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u653f\u7b56\u53ca\u76f8\u5173\u4e3b\u7ba1\u90e8\u95e8\u7684\u8981\u6c42\uff0c\u60a8\u5e94\u63d0\u4f9b\u771f\u5b9e\u8eab\u4efd\u4fe1\u606f\u8fdb\u884c\u8d26\u53f7\u6ce8\u518c\u548c\u767b\u5f55\u4f7f\u7528\uff0c\u6211\u4eec\u5c06\u901a\u8fc7\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u817e\u8baf\u5065\u5eb7\u6e38\u620f\u7cfb\u7edf\uff09\u9a8c\u8bc1\u60a8\u7684\u771f\u5b9e\u8eab\u4efd\u4fe1\u606f\u3002\u4e3a\u5b9e\u73b0\u524d\u8ff0\u76ee\u7684\uff0c\u60a8\u540c\u610f\u6211\u4eec\u5411\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\u6838\u5b9e\u60a8\u5f53\u524d\u6ce8\u518c\u548c\u767b\u5f55\u6240\u4f7f\u7528\u7684\u6e38\u620f\u8d26\u53f7\u3001\u5fae\u4fe1\u6216QQ\u8d26\u53f7\u7684\u5b9e\u540d\u8ba4\u8bc1\u60c5\u51b5\uff0c\u82e5\u8be5\u8d26\u53f7\u5df2\u5728\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\u5b8c\u6210\u5b9e\u540d\u8ba4\u8bc1\uff0c\u5219\u60a8\u8fdb\u4e00\u6b65\u540c\u610f\u5411\u6211\u4eec\u62ab\u9732\u5e74\u9f84\u4fe1\u606f\uff0c\u4ee5\u786e\u8ba4\u662f\u5426\u5c06\u8be5\u8d26\u53f7\u7eb3\u5165\u9632\u6c89\u8ff7\u7cfb\u7edf\u4ee5\u53ca\u91c7\u53d6\u4f55\u79cd\u9632\u6c89\u8ff7\u63aa\u65bd\uff0c\u540c\u65f6\u60a8\u540c\u610f\u6211\u4eec\u901a\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\u5c06\u60a8\u7684\u59d3\u540d\u548c\u8eab\u4efd\u8bc1\u53f7\u63d0\u4ea4\u81f3\u56fd\u5bb6\u7edf\u4e00\u672a\u6210\u5e74\u4eba\u7f51\u7edc\u6e38\u620f\u7535\u5b50\u8eab\u4efd\u8ba4\u8bc1\u7cfb\u7edf\u8fdb\u884c\u771f\u5b9e\u8eab\u4efd\u9a8c\u8bc1\u3002\n3.3 \u82e5\u60a8\u7684\u8d26\u53f7\u672a\u5728\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\u5b8c\u6210\u5b9e\u540d\u8ba4\u8bc1\uff0c\u5219\u6211\u4eec\u65e0\u6cd5\u4e3a\u60a8\u63d0\u4f9b\u670d\u52a1\uff0c\u82e5\u60a8\u4ecd\u5e0c\u671b\u4f7f\u7528\u6211\u4eec\u7684\u4ea7\u54c1\u548c\u670d\u52a1\uff0c\u5219\u60a8\u5e94\u5728\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\u5bf9\u60a8\u5f53\u524d\u6ce8\u518c\u548c\u767b\u5f55\u6240\u4f7f\u7528\u7684\u6e38\u620f\u8d26\u53f7\u3001\u5fae\u4fe1\u6216QQ\u8d26\u53f7\u5b8c\u6210\u5b9e\u540d\u8ba4\u8bc1\uff0c\u5b9e\u540d\u8ba4\u8bc1\u8fc7\u7a0b\u4e2d\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\u4f1a\u6536\u96c6\u60a8\u7684\u5b9e\u540d\u8eab\u4efd\u4fe1\u606f\uff08\u5305\u62ec\u59d3\u540d\u548c\u8eab\u4efd\u8bc1\u53f7\uff09\u3002\u540c\u65f6\uff0c\u4e3a\u9a8c\u8bc1\u771f\u5b9e\u6027\u4e4b\u76ee\u7684\uff0c\u5b9e\u540d\u8ba4\u8bc1\u7cfb\u7edf\u53ef\u80fd\u4f1a\u6839\u636e\u672a\u6210\u5e74\u4eba\u4fdd\u62a4\u7b56\u7565\uff0c\u5728\u60a8\u5bf9\u5f53\u524d\u6ce8\u518c\u548c\u767b\u5f55\u6240\u4f7f\u7528\u7684\u6e38\u620f\u8d26\u53f7\u3001\u5fae\u4fe1\u6216QQ\u8d26\u53f7\u8fdb\u884c\u5b9e\u540d\u8ba4\u8bc1\u4e4b\u65f6\u6216\u60a8\u4f7f\u7528\u5df2\u5b8c\u6210\u5b9e\u540d\u8ba4\u8bc1\u7684\u5fae\u4fe1\u6216QQ\u8d26\u53f7\u767b\u5f55\u6e38\u620f\u5e76\u4f7f\u7528\u6e38\u620f\u670d\u52a1\u8fc7\u7a0b\u4e2d\uff0c\u4e0d\u65f6\u8981\u6c42\u60a8\u8fdb\u4e00\u6b65\u63d0\u4f9b\u5176\u4ed6\u654f\u611f\u4e2a\u4eba\u4fe1\u606f\uff08\u5305\u62ec\u624b\u673a\u53f7\u7801\u3001\u7167\u7247\u6216\u4eba\u8138\u8bc6\u522b\u4fe1\u606f\u7b49\uff09\u5e76\u5c06\u5176\u4e0e\u60a8\u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5065\u5eb7\u7cfb\u7edf\u7684\u5b9e\u540d\u4fe1\u606f\u8bb0\u5f55\u3001\u7535\u4fe1\u8fd0\u8425\u5546\u5904\u5b9e\u540d\u4fe1\u606f\u8bb0\u5f55\u6216\u516c\u5b89\u6743\u5a01\u6570\u636e\u5e73\u53f0\u6570\u636e\u6e90\u8fdb\u884c\u6bd4\u5bf9\u3002\u82e5\u60a8\u62d2\u7edd\u63d0\u4f9b\u524d\u8ff0\u4fe1\u606f\u6216\u672a\u901a\u8fc7\u6bd4\u5bf9\uff0c\u5219\u60a8\u53ef\u80fd\u65e0\u6cd5\u7ee7\u7eed\u4f7f\u7528\u6211\u4eec\u7684\u4ea7\u54c1\u548c\u670d\u52a1\u6216\u53d7\u5230\u9650\u5236\u3002\u4eba\u8138\u8bc6\u522b\u76f8\u5173\u9a8c\u8bc1\u6570\u636e\uff0c\u5728\u52a0\u5bc6\u540e\u4ec5\u7528\u4e8e\u4e0e\u516c\u5b89\u6743\u5a01\u6570\u636e\u5e73\u53f0\u6570\u636e\u6e90\u8fdb\u884c\u6bd4\u5bf9\uff0c\u6211\u4eec\u4e0d\u4f1a\u5bf9\u5176\u7559\u5b58\u3002\n3.5 \u5728\u60a8\u8fdb\u884c\u8d26\u53f7\u6ce8\u518c\u6216\u4f7f\u7528\u6e38\u620f\u670d\u52a1\u65f6\uff0c\u5982\u53d1\u73b0\u60a8\u8d26\u53f7\u53ef\u80fd\u5b58\u5728\u6d89\u8bc8\u5f02\u5e38\u60c5\u5f62\u6216\u98ce\u9669\u7684\uff0c\u6211\u4eec\u6709\u6743\u6839\u636e\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u91cd\u65b0\u6838\u9a8c\u60a8\u7684\u8d26\u53f7\uff0c\u5e76\u53ef\u6839\u636e\u98ce\u9669\u60c5\u51b5\uff0c\u91c7\u53d6\u9650\u671f\u6539\u6b63\u3001\u9650\u5236\u529f\u80fd\u3001\u6682\u505c\u4f7f\u7528\u3001\u5173\u95ed\u8d26\u53f7\u3001\u7981\u6b62\u91cd\u65b0\u6ce8\u518c\u4ee5\u53ca\u672c\u534f\u8bae\u89c4\u5b9a\u7684\u5176\u4ed6\u5904\u7f6e\u63aa\u65bd\u3002\n3.6 \u60a8\u8fdb\u4e00\u6b65\u77e5\u6089\u5e76\u540c\u610f\uff0c\u60a8\u5728\u6e38\u5ba2\u6a21\u5f0f\u4e0b\u53ef\u80fd\u65e0\u6cd5\u8fdb\u884c\u6e38\u620f\u5145\u503c\u6216\u6d88\u8d39\uff0c\u4e5f\u65e0\u6cd5\u4f7f\u7528\u8ddf\u5e16\u8bc4\u8bba\u670d\u52a1\uff08\u5305\u62ec\u5c40\u5185\u4ea4\u6d41\u3001\u7fa4\u804a\u3001\u804a\u5929\u5ba4\u7b49\u529f\u80fd\uff09\u3002\u4e14\u4e00\u65e6\u60a8\u5378\u8f7d\u6216\u91cd\u88c5\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff0c\u6216\u60a8\u66f4\u6362\u624b\u673a\u3001\u7535\u8111\u7b49\u7ec8\u7aef\u8bbe\u5907\u6216\u8be5\u7b49\u7ec8\u7aef\u8bbe\u5907\u635f\u574f\u7684\uff0c\u60a8\u5728\u8be5\u6e38\u5ba2\u6a21\u5f0f\u4e0b\u6240\u6709\u6e38\u620f\u76f8\u5173\u6570\u636e\u53ef\u80fd\u90fd\u5c06\u4f1a\u88ab\u6e05\u7a7a\uff0c\u4e14\u65e0\u6cd5\u67e5\u8be2\u548c\u6062\u590d\u3002\u5982\u56e0\u6b64\u9020\u6210\u60a8\u4efb\u4f55\u635f\u5931\u7684\uff0c\u5747\u7531\u60a8\u81ea\u884c\u627f\u62c5\u3002\n3.7 \u5982\u60a8\u4f7f\u7528\u7b2c\u4e09\u65b9\u8d26\u53f7\u4f5c\u4e3a\u6e38\u620f\u8d26\u53f7\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u7684\uff0c\u60a8\u8fd8\u5e94\u9075\u5b88\u6709\u5173\u8be5\u7b2c\u4e09\u65b9\u8d26\u53f7\u7684\u534f\u8bae\u3001\u89c4\u5219\uff0c\u4e14\u56e0\u8be5\u7b2c\u4e09\u65b9\u8d26\u53f7\u4ea7\u751f\u7684\u76f8\u5173\u95ee\u9898\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u88ab\u76d7\u7b49\uff0c\u60a8\u5e94\u81ea\u884c\u8054\u7cfb\u8be5\u7b2c\u4e09\u65b9\u8fdb\u884c\u89e3\u51b3\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u89c6\u60c5\u51b5\u63d0\u4f9b\u76f8\u5e94\u7684\u534f\u52a9\u3002\n3.8 \u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff0c\u6211\u4eec\u4f1a\u6309\u7167\u56fd\u5bb6\u76f8\u5173\u8981\u6c42\u5c06\u60a8\u7684\u5b9e\u540d\u6ce8\u518c\u4fe1\u606f\uff08\u5305\u62ec\u76f8\u5173\u5b9e\u540d\u8ba4\u8bc1\u53ca\u5e74\u9f84\u60c5\u51b5\u7b49\uff09\u8fd0\u7528\u4e8e\u9632\u6c89\u8ff7\u7cfb\u7edf\u4e4b\u4e2d\uff0c\u5373\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4f1a\u6839\u636e\u60a8\u7684\u5b9e\u540d\u6ce8\u518c\u4fe1\u606f\u5224\u65ad\u60a8\u662f\u5426\u5e74\u6ee118\u5468\u5c81\u3001\u60a8\u63d0\u4ea4\u7684\u5b9e\u540d\u8eab\u4efd\u4fe1\u606f\u662f\u5426\u89c4\u8303\u6216\u5b9e\u540d\u9a8c\u8bc1\u662f\u5426\u901a\u8fc7\u7b49\uff0c\u4ece\u800c\u51b3\u5b9a\u662f\u5426\u5bf9\u60a8\u7684\u6e38\u620f\u8d26\u53f7\u4e88\u4ee5\u9632\u6c89\u8ff7\u9650\u5236\u3002\n3.9 \u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u6839\u636e\u6cd5\u5f8b\u6cd5\u89c4\u8981\u6c42\u6821\u9a8c\u7528\u6237\u6ce8\u518c\u6240\u63d0\u4f9b\u7684\u8eab\u4efd\u4fe1\u606f\u662f\u5426\u771f\u5b9e\u3001\u6709\u6548\uff0c\u5e76\u5e94\u79ef\u6781\u5730\u91c7\u53d6\u6280\u672f\u4e0e\u7ba1\u7406\u7b49\u5408\u7406\u63aa\u65bd\u4fdd\u969c\u7528\u6237\u8d26\u53f7\u7684\u5b89\u5168\u3001\u6709\u6548\uff1b\u7528\u6237\u6709\u4e49\u52a1\u59a5\u5584\u4fdd\u7ba1\u5176\u8d26\u53f7\u53ca\u5bc6\u7801\uff0c\u5e76\u6b63\u786e\u3001\u5b89\u5168\u5730\u4f7f\u7528\u5176\u8d26\u53f7\u53ca\u5bc6\u7801\u3002\u5982\u53d1\u73b0\u60a8\u7684\u8d26\u53f7\u53ef\u80fd\u5b58\u5728\u5f02\u5e38\u60c5\u5f62\u6216\u98ce\u9669\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u6839\u636e\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u91cd\u65b0\u6838\u9a8c\u60a8\u7684\u8d26\u53f7\u3002\u4efb\u4f55\u4e00\u65b9\u672a\u5c3d\u4e0a\u8ff0\u4e49\u52a1\u5bfc\u81f4\u8d26\u53f7\u5bc6\u7801\u9057\u5931\u3001\u8d26\u53f7\u88ab\u76d7\u7b49\u60c5\u5f62\u800c\u7ed9\u7528\u6237\u548c\u4ed6\u4eba\u7684\u6c11\u4e8b\u6743\u5229\u9020\u6210\u635f\u5bb3\u7684\uff0c\u5e94\u5f53\u627f\u62c5\u7531\u6b64\u4ea7\u751f\u7684\u6cd5\u5f8b\u8d23\u4efb\u3002\n\u82e5\u60a8\u53d1\u73b0\u6709\u4ed6\u4eba\u5192\u7528\u6216\u76d7\u7528\u60a8\u7684\u6e38\u620f\u8d26\u53f7\u53ca\u5bc6\u7801\u3001\u6216\u4efb\u4f55\u5176\u4ed6\u672a\u7ecf\u60a8\u5408\u6cd5\u6388\u6743\u4f7f\u7528\u7684\u60c5\u5f62\u65f6\uff0c\u5e94\u7acb\u5373\u4ee5\u6709\u6548\u65b9\u5f0f\u901a\u77e5\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\uff08\u53ef\u901a\u8fc7\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5ba2\u670d\u4e0e\u6211\u4eec\u8054\u7cfb\uff09\u3002\u60a8\u901a\u77e5\u6cc9\u7f51\u7edc\u79d1\u6280\u65f6\uff0c\u5e94\u63d0\u4f9b\u4e0e\u60a8\u6ce8\u518c\u8eab\u4efd\u4fe1\u606f\u76f8\u4e00\u81f4\u7684\u4e2a\u4eba\u6709\u6548\u8eab\u4efd\u4fe1\u606f\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6536\u5230\u60a8\u7684\u6709\u6548\u8bf7\u6c42\u5e76\u6838\u5b9e\u8eab\u4efd\u540e\uff0c\u4f1a\u7ed3\u5408\u5177\u4f53\u60c5\u51b5\u91c7\u53d6\u76f8\u5e94\u63aa\u65bd\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u6682\u505c\u8be5\u8d26\u53f7\u7684\u767b\u5f55\u548c\u4f7f\u7528\u7b49\uff09\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u56e0\u6839\u636e\u60a8\u7684\u8bf7\u6c42\u91c7\u53d6\u76f8\u5e94\u63aa\u65bd\u800c\u9020\u6210\u60a8\u53ca\u5176\u4ed6\u7528\u6237\u635f\u5931\u7684\uff0c\u7531\u60a8\u81ea\u884c\u627f\u62c5\u3002\u82e5\u60a8\u6ca1\u6709\u63d0\u4f9b\u6709\u6548\u8eab\u4efd\u4fe1\u606f\u6216\u60a8\u63d0\u4f9b\u7684\u4e2a\u4eba\u6709\u6548\u8eab\u4efd\u4fe1\u606f\u4e0e\u6240\u6ce8\u518c\u7684\u8eab\u4efd\u4fe1\u606f\u4e0d\u4e00\u81f4\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u62d2\u7edd\u60a8\u7684\u8bf7\u6c42\uff0c\u56e0\u6b64\u9020\u6210\u60a8\u635f\u5931\u7684\uff0c\u7531\u60a8\u81ea\u884c\u627f\u62c5\u3002\n3.10 \u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff0c\u4e3a\u9ad8\u6548\u5229\u7528\u670d\u52a1\u5668\u8d44\u6e90\uff0c\u5982\u679c\u60a81\u5e74\u5185\u672a\u4f7f\u7528\u6e38\u620f\u8d26\u53f7\u767b\u5f55\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5728\u63d0\u524d\u901a\u77e5\u7684\u60c5\u51b5\u4e0b\uff0c\u5bf9\u8be5\u8d26\u53f7\u53ca\u5176\u8d26\u53f7\u4e0b\u7684\u6e38\u620f\u6570\u636e\u53ca\u76f8\u5173\u4fe1\u606f\u91c7\u53d6\u5220\u9664\u7b49\u5904\u7f6e\u63aa\u65bd\u3002\n3.11 \u6e38\u620f\u8d26\u53f7\u662f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6309\u7167\u672c\u534f\u8bae\u6388\u6743\u60a8\u7528\u4e8e\u767b\u5f55\u3001\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ca\u76f8\u5173\u670d\u52a1\u7684\u6807\u8bc6\u548c\u51ed\u8bc1\uff0c\u5176\u6240\u6709\u6743\u5c5e\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u3002\u60a8\u4ec5\u6839\u636e\u672c\u534f\u8bae\u4ee5\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e3a\u6b64\u53d1\u5e03\u7684\u4e13\u9879\u89c4\u5219\u4eab\u6709\u6e38\u620f\u8d26\u53f7\u7684\u4f7f\u7528\u6743\u3002\u60a8\u4e0d\u5f97\u5c06\u6e38\u620f\u8d26\u53f7\u4ee5\u4efb\u4f55\u65b9\u5f0f\u63d0\u4f9b\u7ed9\u4ed6\u4eba\u4f7f\u7528\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u4e0d\u5f97\u4ee5\u8f6c\u8ba9\u3001\u51fa\u79df\u3001\u501f\u7528\u7b49\u65b9\u5f0f\u63d0\u4f9b\u7ed9\u4ed6\u4eba\u4f5c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u76f4\u64ad\u3001\u5f55\u5236\u3001\u4ee3\u6253\u4ee3\u7ec3\u7b49\u5546\u4e1a\u6027\u4f7f\u7528\u3002\u5426\u5219\uff0c\u56e0\u6b64\u4ea7\u751f\u4efb\u4f55\u6cd5\u5f8b\u540e\u679c\u53ca\u8d23\u4efb\u5747\u7531\u60a8\u81ea\u884c\u627f\u62c5\uff0c\u4e14\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5bf9\u60a8\u7684\u6e38\u620f\u8d26\u53f7\u91c7\u53d6\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u8b66\u544a\u3001\u9650\u5236\u6216\u7981\u6b62\u4f7f\u7528\u6e38\u620f\u8d26\u53f7\u5168\u90e8\u6216\u90e8\u5206\u529f\u80fd\u3001\u5220\u9664\u6e38\u620f\u8d26\u53f7\u53ca\u6e38\u620f\u6570\u636e\u53ca\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\u3001\u5c01\u53f7\u76f4\u81f3\u6ce8\u9500\u7684\u5904\u7406\u63aa\u65bd\uff0c\u56e0\u6b64\u9020\u6210\u7684\u4e00\u5207\u540e\u679c\u7531\u60a8\u81ea\u884c\u627f\u62c5\u3002\n3.11 \u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u63d0\u4f9b\u6e38\u620f\u8d26\u53f7\u6ce8\u9500\u529f\u80fd\u60c5\u5f62\u4e0b\uff0c\u5982\u60a8\u9700\u8981\u6ce8\u9500\u6e38\u620f\u8d26\u53f7\u7684\uff0c\u53ef\u6309\u7167\u8be5\u6e38\u620f\u5b98\u65b9\u63d0\u4f9b\u7684\u8d26\u53f7\u6ce8\u9500\u6307\u5f15\u8fdb\u884c\u64cd\u4f5c\uff0c\u5e76\u5e94\u4fdd\u8bc1\u6ee1\u8db3\u6e38\u620f\u5b98\u65b9\u516c\u5e03\u7684\u6709\u5173\u6e38\u620f\u8d26\u53f7\u6ce8\u9500\u7684\u76f8\u5173\u6761\u4ef6\uff0c\u540c\u65f6\u540c\u610f\u6e38\u620f\u5b98\u65b9\u516c\u5e03\u7684\u6e38\u620f\u8d26\u53f7\u6ce8\u9500\u534f\u8bae\u548c\u5176\u4ed6\u6709\u5173\u89c4\u5219\u3002\n\u540c\u65f6\u4e5f\u7279\u522b\u63d0\u793a\u60a8\uff0c \u5982\u60a8\u6ce8\u9500\u6e38\u620f\u8d26\u53f7\u7684\uff0c\u8be5\u6e38\u620f\u8d26\u53f7\u4e0b\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\uff08\u4e3a\u63cf\u8ff0\u65b9\u4fbf\uff0c\u4ee5\u4e0b\u4e5f\u7edf\u79f0\u201c\u6e38\u620f\u6536\u76ca\u201d\uff09\u4e5f\u5c06\u4f1a\u88ab\u6e05\u9664\u3002\u636e\u6b64\uff0c\u5728\u60a8\u6ce8\u9500\u672c\u6e38\u620f\u8d26\u53f7\u524d\u8bf7\u60a8\u786e\u4fdd\u5df2\u59a5\u5584\u5904\u7406\u8be5\u6e38\u620f\u8d26\u53f7\u4e0b\u7684\u6e38\u620f\u6536\u76ca\u6216\u76f8\u5173\u7684\u6e38\u620f\u6536\u76ca\u5df2\u7ed3\u6e05\u3002\u4e00\u65e6\u60a8\u6ce8\u9500\u672c\u6e38\u620f\u8d26\u53f7\uff0c\u5982\u5c4a\u65f6\u8be5\u6e38\u620f\u8d26\u53f7\u4e0b\u8fd8\u5b58\u5728\u6e38\u620f\u6536\u76ca\u7684\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u5728\u672c\u6e38\u620f\u4f7f\u7528\u671f\u95f4\u5df2\u4ea7\u751f\u4f46\u5c1a\u672a\u5931\u6548\u6216\u672a\u4f7f\u7528\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\uff0c\u53ca\u672a\u6765\u53ef\u80fd\u4ea7\u751f\u7684\u6e38\u620f\u6536\u76ca\uff09\uff0c\u89c6\u4e3a\u60a8\u81ea\u613f\u653e\u5f03\u8be5\u7b49\u6e38\u620f\u6536\u76ca\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5bf9\u8be5\u6e38\u620f\u8d26\u53f7\u4e0b\u7684\u5168\u90e8\u6e38\u620f\u6536\u76ca\u505a\u6e05\u9664\u5904\u7406\uff0c\u56e0\u6b64\u4ea7\u751f\u7684\u540e\u679c\u7531\u60a8\u81ea\u884c\u627f\u62c5\u3002\u524d\u8ff0\u6e38\u620f\u6536\u76ca\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\uff1a\u6e38\u620f\u4f1a\u5458\u6743\u76ca\u3001\u7b49\u7ea7\uff1b\u4e0e\u6e38\u620f\u89d2\u8272\u6210\u957f\u5347\u7ea7\u76f8\u5173\u7684\u6240\u6709\u6570\u636e\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u7ecf\u9a8c\u503c\u3001\u8363\u8a89\u503c\u3001\u58f0\u671b\u503c\u3001\u79f0\u53f7\u7b49\uff09\uff1b\u5c1a\u672a\u4f7f\u7528\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\uff08\u5982\u5361\u5238\u3001\u91d1\u5e01\u3001\u94bb\u77f3\u53ca\u5176\u4ed6\u7b49\uff09\uff1b\u5df2\u7ecf\u8d2d\u4e70\u4f46\u672a\u5230\u671f\u6216\u672a\u4f7f\u7528\u5b8c\u7684\u5176\u4ed6\u589e\u503c\u670d\u52a1\uff1b\u5df2\u4ea7\u751f\u4f46\u672a\u6d88\u8017\u5b8c\u6bd5\u7684\u5176\u4ed6\u6e38\u620f\u6536\u76ca\u6216\u672a\u6765\u9884\u671f\u7684\u6e38\u620f\u6536\u76ca\u7b49\u3002\n\n\u56db\u3001\u7528\u6237\u4fe1\u606f\u6536\u96c6\u3001\u4f7f\u7528\u53ca\u4fdd\u62a4\n4.1\u60a8\u540c\u610f\u5e76\u6388\u6743\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e3a\u5c65\u884c\u672c\u534f\u8bae\u4e4b\u76ee\u7684\u6536\u96c6\u60a8\u7684\u7528\u6237\u4fe1\u606f\uff0c\u8fd9\u4e9b\u4fe1\u606f\u5305\u62ec\u60a8\u5728\u5b9e\u540d\u6ce8\u518c\u7cfb\u7edf\u4e2d\u6ce8\u518c\u7684\u4fe1\u606f\u3001\u60a8\u6e38\u620f\u8d26\u53f7\u4e0b\u7684\u6e38\u620f\u6570\u636e\u4ee5\u53ca\u5176\u4ed6\u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u7684\u8fc7\u7a0b\u4e2d\u5411\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u63d0\u4f9b\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u57fa\u4e8e\u5b89\u5168\u3001\u7528\u6237\u4f53\u9a8c\u4f18\u5316\u7b49\u8003\u8651\u800c\u9700\u6536\u96c6\u7684\u4fe1\u606f\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5bf9\u60a8\u7684\u7528\u6237\u4fe1\u606f\u7684\u6536\u96c6\u5c06\u9075\u5faa\u672c\u534f\u8bae\u53ca\u76f8\u5173\u6cd5\u5f8b\u7684\u89c4\u5b9a\u3002\n4.2\u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff1a\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6216\u5176\u5408\u4f5c\u7684\u7b2c\u4e09\u65b9\u53ef\u4ee5\u6839\u636e\u60a8\u63d0\u4f9b\u7684\u7528\u6237\u4fe1\u606f\uff0c\u901a\u8fc7\u77ed\u4fe1\u3001\u7535\u8bdd\u3001\u90ae\u4ef6\u7b49\u5404\u79cd\u65b9\u5f0f\u5411\u60a8\u63d0\u4f9b\u5173\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u6d3b\u52a8\u4fe1\u606f\u3001\u63a8\u5e7f\u4fe1\u606f\u7b49\u5404\u7c7b\u4fe1\u606f\u3002\n4.3\u60a8\u7406\u89e3\u5e76\u540c\u610f\uff1a\u4e3a\u4e86\u66f4\u597d\u5730\u5411\u60a8\u63d0\u4f9b\u6e38\u620f\u670d\u52a1\uff0c\u6539\u5584\u6e38\u620f\u4f53\u9a8c\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u5bf9\u60a8\u6e38\u620f\u8d26\u53f7\u4e2d\u7684\u6635\u79f0\u3001\u5934\u50cf\u4ee5\u53ca\u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u4e2d\u7684\u76f8\u5173\u64cd\u4f5c\u4fe1\u606f\u3001\u6e38\u620f\u4fe1\u606f\u7b49\u4fe1\u606f\uff08\u4ee5\u4e0b\u79f0\u201c\u8be5\u7b49\u4fe1\u606f\u201d\u3002\u8be5\u7b49\u4fe1\u606f\u5177\u4f53\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u60a8\u7684\u767b\u5f55\u72b6\u6001\u3001\u5bf9\u6218\u4fe1\u606f/\u72b6\u6001\u3001\u6210\u5c31\u4fe1\u606f\u7b49\uff09\u8fdb\u884c\u4f7f\u7528\uff0c\u5e76\u53ef\u5411\u60a8\u672c\u4eba\u6216\u5176\u4ed6\u7528\u6237\u6216\u597d\u53cb\u5c55\u793a\u8be5\u7b49\u4fe1\u606f\u3002\n4.4\u60a8\u5e94\u5bf9\u901a\u8fc7\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ca\u76f8\u5173\u670d\u52a1\u4e86\u89e3\u3001\u63a5\u6536\u6216\u53ef\u63a5\u89e6\u5230\u7684\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u5176\u4ed6\u7528\u6237\u5728\u5185\u7684\u4efb\u4f55\u4eba\u7684\u4e2a\u4eba\u4fe1\u606f\u4e88\u4ee5\u5145\u5206\u5c0a\u91cd\uff0c\u60a8\u4e0d\u5e94\u4ee5\u641c\u96c6\u3001\u590d\u5236\u3001\u5b58\u50a8\u3001\u4f20\u64ad\u6216\u4ee5\u5176\u4ed6\u4efb\u4f55\u65b9\u5f0f\u4f7f\u7528\u5176\u4ed6\u7528\u6237\u7684\u4e2a\u4eba\u4fe1\u606f\uff0c\u5426\u5219\uff0c\u7531\u6b64\u4ea7\u751f\u7684\u540e\u679c\u7531\u60a8\u81ea\u884c\u627f\u62c5\u3002\n4.5\u4fdd\u62a4\u7528\u6237\u4fe1\u606f\u53ca\u9690\u79c1\u662f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7684\u4e00\u9879\u57fa\u672c\u539f\u5219\u3002\u9664\u672c\u534f\u8bae\u53e6\u6709\u89c4\u5b9a\u5916\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u5bf9\u7528\u6237\u4fe1\u606f\u6536\u96c6\u3001\u4f7f\u7528\u53ca\u4fdd\u62a4\u7b49\u5c06\u9075\u5faa\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7edf\u4e00\u516c\u5e03\u7684\u76f8\u5173\u9690\u79c1\u653f\u7b56\uff0c\u8be5\u7b49\u9690\u79c1\u653f\u7b56\u7cfb\u672c\u534f\u8bae\u7684\u8865\u5145\uff0c\u6784\u6210\u672c\u534f\u8bae\u7684\u4e00\u90e8\u5206\u3002\n\n\u4e94\u3001\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\n5.1 \u5728\u60a8\u9075\u5b88\u672c\u534f\u8bae\u53ca\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u7684\u524d\u63d0\u4e0b\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7ed9\u4e88\u60a8\u4e00\u9879\u4e2a\u4eba\u7684\u3001\u4e0d\u53ef\u8f6c\u8ba9\u53ca\u975e\u6392\u4ed6\u6027\u7684\u8bb8\u53ef\uff0c\u4ee5\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u3002\u60a8\u4ec5\u53ef\u4e3a\u975e\u5546\u4e1a\u76ee\u7684\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\uff0c\u5305\u62ec\uff1a\n\uff081\uff09\u63a5\u6536\u3001\u4e0b\u8f7d\u3001\u5b89\u88c5\u3001\u542f\u52a8\u3001\u5347\u7ea7\u3001\u767b\u5f55\u3001\u663e\u793a\u3001\u8fd0\u884c\u548c/\u6216\u622a\u5c4f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff1b\n\uff082\uff09\u521b\u5efa\u6e38\u620f\u89d2\u8272\uff0c\u8bbe\u7f6e\u7f51\u540d\uff0c\u67e5\u9605\u6e38\u620f\u89c4\u5219\u3001\u7528\u6237\u4e2a\u4eba\u8d44\u6599\u3001\u6e38\u620f\u5bf9\u5c40\u7ed3\u679c\uff0c\u5f00\u8bbe\u6e38\u620f\u623f\u95f4\u3001\u8bbe\u7f6e\u6e38\u620f\u53c2\u6570\uff0c\u5728\u6e38\u620f\u4e2d\u8d2d\u4e70\u3001\u4f7f\u7528\u6e38\u620f\u865a\u62df\u9053\u5177\u7b49\uff0c\u4f7f\u7528\u804a\u5929\u529f\u80fd\u3001\u793e\u4ea4\u5206\u4eab\u529f\u80fd\uff1b\n\uff083\uff09\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u652f\u6301\u5e76\u5141\u8bb8\u7684\u5176\u4ed6\u67d0\u4e00\u9879\u6216\u51e0\u9879\u529f\u80fd\u3002\n5.2 \u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u8fc7\u7a0b\u4e2d\u4e0d\u5f97\u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8bb8\u53ef\u4ee5\u4efb\u4f55\u65b9\u5f0f\u5f55\u5236\u3001\u76f4\u64ad\u6216\u5411\u4ed6\u4eba\u4f20\u64ad\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u5185\u5bb9\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u4e0d\u5f97\u5229\u7528\u4efb\u4f55\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u8fdb\u884c\u7f51\u7edc\u76f4\u64ad\u3001\u4f20\u64ad\u7b49\u3002\n5.3 \u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u4ee5\u8f6f\u4ef6\u5f62\u5f0f\u63d0\u4f9b\u7684\u60c5\u51b5\u4e0b\uff0c\u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u65f6\u8fd8\u5e94\u7b26\u5408\u672c\u534f\u8bae\u7b2c\u4e94\u6761\u5173\u4e8e\u8f6f\u4ef6\u8bb8\u53ef\u7684\u89c4\u5b9a\u3002\n5.4 \u672c\u6761\u53ca\u672c\u534f\u8bae\u5176\u4ed6\u6761\u6b3e\u672a\u660e\u793a\u6388\u6743\u7684\u5176\u4ed6\u4e00\u5207\u6743\u5229\u4ecd\u7531\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4fdd\u7559\uff0c\u60a8\u5728\u884c\u4f7f\u8fd9\u4e9b\u6743\u5229\u65f6\u987b\u53e6\u5916\u53d6\u5f97\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7684\u4e66\u9762\u8bb8\u53ef\u3002\n5.5 \u5982\u679c\u60a8\u8fdd\u53cd\u672c\u534f\u8bae\u4efb\u4f55\u7ea6\u5b9a\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u91c7\u53d6\u76f8\u5e94\u5904\u7406\u63aa\u65bd\uff0c\u5e76\u53ef\u516c\u5e03\u5904\u7406\u7ed3\u679c\uff0c\u4e14\uff08/\u6216\uff09\u6709\u6743\u8981\u6c42\u60a8\u8d54\u507f\u56e0\u60a8\u8fdd\u7ea6\u884c\u4e3a\u800c\u7ed9\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u9020\u6210\u7684\u6240\u6709\u635f\u5931\u3002\n5.6 \u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u4f9d\u5408\u7406\u5224\u65ad\u5bf9\u8fdd\u53cd\u6709\u5173\u6cd5\u5f8b\u6cd5\u89c4\u6216\u672c\u534f\u8bae\u89c4\u5b9a\u7684\u884c\u4e3a\u8fdb\u884c\u5904\u7406\uff0c\u5bf9\u8fdd\u6cd5\u8fdd\u89c4\u7684\u4efb\u4f55\u7528\u6237\u91c7\u53d6\u9002\u5f53\u7684\u6cd5\u5f8b\u884c\u52a8\uff0c\u5e76\u4f9d\u636e\u6cd5\u5f8b\u6cd5\u89c4\u4fdd\u5b58\u6709\u5173\u4fe1\u606f\u5411\u6709\u5173\u90e8\u95e8\u62a5\u544a\u7b49\uff0c\u7528\u6237\u5e94\u72ec\u81ea\u627f\u62c5\u7531\u6b64\u800c\u4ea7\u751f\u7684\u4e00\u5207\u6cd5\u5f8b\u8d23\u4efb\u3002\u5728\u5411\u60a8\u63d0\u4f9b\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u8fc7\u7a0b\u4e2d\uff0c\u5982\u53d1\u73b0\u6d89\u8bc8\u8fdd\u6cd5\u72af\u7f6a\u7ebf\u7d22\u3001\u98ce\u9669\u4fe1\u606f\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u4f9d\u7167\u56fd\u5bb6\u6709\u5173\u89c4\u5b9a\uff0c\u6839\u636e\u6d89\u8bc8\u98ce\u9669\u7c7b\u578b\u3001\u7a0b\u5ea6\u60c5\u51b5\u79fb\u9001\u516c\u5b89\u3001\u91d1\u878d\u3001\u7535\u4fe1\u3001\u7f51\u4fe1\u7b49\u6709\u6743\u90e8\u95e8\u3002\n5.7 \u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff0c\u56e0\u60a8\u8fdd\u53cd\u672c\u534f\u8bae\u6216\u76f8\u5173\u670d\u52a1\u6761\u6b3e\u7684\u89c4\u5b9a\uff0c\u5bfc\u81f4\u6216\u4ea7\u751f\u7b2c\u4e09\u65b9\u4e3b\u5f20\u7684\u4efb\u4f55\u7d22\u8d54\u3001\u8981\u6c42\u6216\u635f\u5931\uff0c\u60a8\u5e94\u5f53\u72ec\u7acb\u627f\u62c5\u8d23\u4efb\uff1b\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u56e0\u6b64\u906d\u53d7\u635f\u5931\u7684\uff0c\u60a8\u4e5f\u5e94\u5f53\u4e00\u5e76\u8d54\u507f\u3002\n5.8 \u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff1a\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\u7b49\u5747\u662f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u7684\u4e00\u90e8\u5206\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5728\u6b64\u8bb8\u53ef\u60a8\u4f9d\u672c\u534f\u8bae\u800c\u83b7\u5f97\u5176\u4f7f\u7528\u6743\u3002\u60a8\u8d2d\u4e70\u3001\u4f7f\u7528\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\u7b49\u5e94\u9075\u5faa\u672c\u534f\u8bae\u3001\u6e38\u620f\u5177\u4f53\u89c4\u5219\u7684\u8981\u6c42\u3002\u540c\u65f6\uff0c\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\u7b49\u53ef\u80fd\u53d7\u5230\u4e00\u5b9a\u6709\u6548\u671f\u9650\u7684\u9650\u5236\uff0c\u5373\u4f7f\u60a8\u5728\u89c4\u5b9a\u7684\u6709\u6548\u671f\u5185\u672a\u4f7f\u7528\uff0c\u9664\u4e0d\u53ef\u6297\u529b\u6216\u53ef\u5f52\u8d23\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7684\u539f\u56e0\u5916\uff0c\u4e00\u65e6\u6709\u6548\u671f\u5c4a\u6ee1\uff0c\u5c06\u4f1a\u81ea\u52a8\u5931\u6548\u3002\u5982\u76f8\u5173\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\u6ca1\u6709\u6807\u660e\u4f7f\u7528\u671f\u9650\uff0c\u6216\u8005\u6807\u660e\u7684\u4f7f\u7528\u671f\u9650\u4e3a\u201c\u6c38\u4e45\u201d\u6216\u5176\u4ed6\u5177\u6709\u4e0e\u201c\u6c38\u4e45\u201d\u76f8\u540c\u6216\u7c7b\u4f3c\u610f\u601d\u7684\u5185\u5bb9\u7684\uff08\u5982\u201c\u65e0\u9650\u671f\u201d\u3001\u201c\u65e0\u9650\u5236\u201d\u7b49\uff09\uff0c\u5219\u5176\u4f7f\u7528\u671f\u9650\u4e3a\u81ea\u60a8\u83b7\u5f97\u8be5\u6e38\u620f\u865a\u62df\u9053\u5177\u6216\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\u4e4b\u65e5\u8d77\u81f3\u8be5\u6e38\u620f\u7ec8\u6b62\u8fd0\u8425\u4e4b\u65e5\u6b62\u3002\n\u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff1a\u4e3a\u66f4\u597d\u5730\u5411\u7528\u6237\u63d0\u4f9b\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5bf9\u6e38\u620f\u76f8\u5173\u5185\u5bb9\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u6e38\u620f\u865a\u62df\u9053\u5177\u7684\u8bbe\u8ba1\u3001\u6027\u80fd\u53ca\u76f8\u5173\u6570\u503c\u8bbe\u7f6e\u7b49\uff09\u4f5c\u51fa\u8c03\u6574\u3001\u66f4\u65b0\u6216\u4f18\u5316\u3002\n5.9 \u60a8\u5145\u5206\u7406\u89e3\u5e76\u540c\u610f\uff1a\u4e3a\u4fdd\u969c\u60a8\u6e38\u620f\u8d26\u53f7\u5b89\u5168\uff0c\u4e3a\u8425\u9020\u516c\u5e73\u3001\u5065\u5eb7\u53ca\u5b89\u5168\u7684\u6e38\u620f\u73af\u5883\uff0c\u5728\u60a8\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5728\u4e0d\u8fdd\u53cd\u76f8\u5173\u6cd5\u5f8b\u89c4\u5b9a\u60c5\u51b5\u4e0b\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u4ee5\u901a\u8fc7\u6280\u672f\u624b\u6bb5\u4e86\u89e3\u60a8\u7ec8\u7aef\u8bbe\u5907\u7684\u968f\u673a\u5b58\u50a8\u5185\u5b58\u4ee5\u53ca\u4e0e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u540c\u65f6\u8fd0\u884c\u7684\u76f8\u5173\u7a0b\u5e8f\u3002\u4e00\u7ecf\u53d1\u73b0\u6709\u4efb\u4f55\u672a\u7ecf\u6388\u6743\u7684\u3001\u5371\u5bb3\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u6b63\u5e38\u8fd0\u8425\u7684\u76f8\u5173\u7a0b\u5e8f\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u4ee5\u91c7\u53d6\u5408\u7406\u63aa\u65bd\u4e88\u4ee5\u6253\u51fb\u3002\n5.10 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5c06\u6309\u7167\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u548c\u672c\u534f\u8bae\u7684\u89c4\u5b9a\uff0c\u91c7\u53d6\u5207\u5b9e\u6709\u6548\u7684\u63aa\u65bd\u4fdd\u62a4\u672a\u6210\u5e74\u4eba\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u8fc7\u7a0b\u4e2d\u7684\u5408\u6cd5\u6743\u76ca\uff0c\u5305\u62ec\u53ef\u80fd\u91c7\u53d6\u6280\u672f\u63aa\u65bd\u3001\u7981\u6b62\u672a\u6210\u5e74\u4eba\u63a5\u89e6\u4e0d\u9002\u5b9c\u7684\u6e38\u620f\u6216\u8005\u6e38\u620f\u529f\u80fd\u3001\u9650\u5236\u672a\u6210\u5e74\u4eba\u7684\u6e38\u620f\u65f6\u95f4\u3001\u9884\u9632\u672a\u6210\u5e74\u4eba\u6c89\u8ff7\u7f51\u7edc\u3002\u4f5c\u4e3a\u6e38\u620f\u89c4\u5219\u7684\u4e00\u90e8\u5206\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8fd8\u5c06\u5728\u9002\u5f53\u4f4d\u7f6e\u53d1\u5e03\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7528\u6237\u6307\u5f15\u548c\u8b66\u793a\u8bf4\u660e\uff0c\u5305\u62ec\u6e38\u620f\u5185\u5bb9\u4ecb\u7ecd\u3001\u6b63\u786e\u4f7f\u7528\u6e38\u620f\u7684\u65b9\u6cd5\u4ee5\u53ca\u9632\u6b62\u5371\u5bb3\u53d1\u751f\u7684\u65b9\u6cd5\u3002\u6240\u6709\u672a\u6210\u5e74\u4eba\u7528\u6237\u90fd\u5e94\u5728\u6cd5\u5b9a\u76d1\u62a4\u4eba\u7684\u6307\u5bfc\u4e0b\u4ed4\u7ec6\u9605\u8bfb\u5e76\u9075\u7167\u6267\u884c\u8fd9\u4e9b\u6307\u5f15\u548c\u8bf4\u660e\uff1b\u5176\u4ed6\u73a9\u5bb6\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u7684\u8fc7\u7a0b\u4e2d\u5e94\u907f\u514d\u53d1\u5e03\u3001\u4ea7\u751f\u4efb\u4f55\u6709\u635f\u672a\u6210\u5e74\u4eba\u8eab\u5fc3\u5065\u5eb7\u7684\u5185\u5bb9\uff0c\u5171\u540c\u8425\u9020\u5065\u5eb7\u6e38\u620f\u73af\u5883\u3002\n5.11 \u60a8\u77e5\u6089\u5e76\u540c\u610f\uff0c\u51fa\u73b0\u4ee5\u4e0b\u60c5\u5f62\u4e4b\u4e00\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5c06\u60a8\u7684\u6e38\u620f\u8d26\u53f7\u7eb3\u5165\u76f8\u5e94\u7684\u9632\u6c89\u8ff7\u7cfb\u7edf\uff0c\u91c7\u53d6\u76f8\u5e94\u7684\u9632\u6c89\u8ff7\u63aa\u65bd\uff1a\n\uff081\uff09\u7cfb\u7edf\u5224\u65ad\u60a8\u672a\u6ee118\u5468\u5c81\u7684\uff1b\u6216\n\uff082\uff09\u60a8\u63d0\u4ea4\u7684\u5b9e\u540d\u8eab\u4efd\u4fe1\u606f\u4e0d\u89c4\u8303\u7684\uff1b\u6216\n\uff083\uff09\u60a8\u5b9e\u540d\u9a8c\u8bc1\u672a\u901a\u8fc7\u7684\uff1b\u6216\n\uff084\uff09\u6e38\u5ba2\u6a21\u5f0f\u767b\u5f55\u7684\uff1b\u6216\n\uff085\uff09\u5176\u4ed6\u56fd\u5bb6\u6cd5\u5f8b\u6cd5\u89c4\u653f\u7b56\u8981\u6c42\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u5408\u7406\u7406\u7531\u8ba4\u4e3a\u9700\u8981\u7eb3\u5165\u9632\u6c89\u8ff7\u7cfb\u7edf\u7684\u60c5\u5f62\u7684\u3002\n\u53e6\u5916\uff0c\u4e3a\u4e86\u8fdb\u4e00\u6b65\u63d0\u9ad8\u5b9e\u540d\u8ba4\u8bc1\u7684\u7cbe\u51c6\u5ea6\uff0c\u6700\u5927\u9650\u5ea6\u9632\u6b62\u672a\u6210\u5e74\u4eba\u5192\u7528\u4ed6\u4eba\u8eab\u4efd\u4fe1\u606f\uff0c\u6211\u4eec\u53ef\u80fd\u5728\u90e8\u5206\u6e38\u620f\u6216\u9488\u5bf9\u90e8\u5206\u7528\u6237\u542f\u7528\u4eba\u8138\u8bc6\u522b\u9a8c\u8bc1\uff0c\u6216\u8005\u4ece\u7b2c\u4e09\u65b9\u5e73\u53f0\u83b7\u53d6\u60a8\u7684\u6e38\u620f\u8d26\u53f7\u4fe1\u606f\uff0c\u5e76\u57fa\u4e8e\u672a\u6210\u5e74\u4eba\u4fdd\u62a4\u7b56\u7565\u8bc6\u522b\u8bb0\u5f55\u60a8\u7684\u6e38\u620f\u884c\u4e3a\uff0c\u5e76\u5224\u65ad\u6e38\u620f\u884c\u4e3a\u662f\u5426\u7b26\u5408\u672a\u6210\u5e74\u4eba\u6e38\u620f\u884c\u4e3a\u7279\u5f81\u3002\u5982\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u8981\u6c42\u60a8\u8fdb\u884c\u4eba\u8138\u8bc6\u522b\u9a8c\u8bc1\uff0c\u800c\u60a8\u672a\u901a\u8fc7\u6216\u62d2\u7edd\u7684\uff0c\u6211\u4eec\u4e5f\u4f1a\u5c06\u60a8\u7684\u6e38\u620f\u8d26\u53f7\u7eb3\u5165\u76f8\u5e94\u7684\u9632\u6c89\u8ff7\u7cfb\u7edf\uff0c\u91c7\u53d6\u76f8\u5e94\u7684\u9632\u6c89\u8ff7\u63aa\u65bd\u3002\n\u5bf9\u7eb3\u5165\u76f8\u5e94\u9632\u6c89\u8ff7\u7cfb\u7edf\u7684\u6e38\u620f\u8d26\u53f7\uff0c\u6211\u4eec\u6709\u6743\u4f9d\u636e\u56fd\u5bb6\u6709\u5173\u6cd5\u5f8b\u6cd5\u89c4\u53ca\u653f\u7b56\u89c4\u5b9a\u3001\u672c\u534f\u8bae\u5176\u4ed6\u6761\u6b3e\u89c4\u5b9a\u3001\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u8fd0\u8425\u7b56\u7565\u6216\u6839\u636e\u60a8\u6cd5\u5b9a\u76d1\u62a4\u4eba\u7684\u5408\u7406\u8981\u6c42\u91c7\u53d6\u4ee5\u4e0b\u4e00\u79cd\u6216\u591a\u79cd\u63aa\u65bd\uff1a\n\uff081\uff09\u5c06\u4e0e\u60a8\u6e38\u620f\u76f8\u5173\u7684\u4fe1\u606f\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u60a8\u6e38\u620f\u8d26\u53f7\u7684\u767b\u5f55\u4fe1\u606f\u3001\u5145\u503c\u6d41\u6c34\u4fe1\u606f\u7b49\uff09\u63d0\u4f9b\u7ed9\u60a8\u7684\u6cd5\u5b9a\u76d1\u62a4\u4eba\uff0c\u4f7f\u5f97\u60a8\u6cd5\u5b9a\u76d1\u62a4\u4eba\u53ef\u53ca\u65f6\u6216\u540c\u6b65\u4e86\u89e3\u60a8\u6e38\u620f\u60c5\u51b5\uff1b\n\uff082\uff09\u9650\u5236\u60a8\u6e38\u620f\u8d26\u53f7\u7684\u6d88\u8d39\u989d\u5ea6\uff1b\n\uff083\uff09\u91c7\u53d6\u6280\u672f\u63aa\u65bd\u5c4f\u853d\u67d0\u4e9b\u6e38\u620f\u6216\u6e38\u620f\u7684\u67d0\u4e9b\u529f\u80fd\uff0c\u6216\u9650\u5b9a\u60a8\u6e38\u620f\u65f6\u95f4\u6216\u6e38\u620f\u65f6\u957f\uff1b\n\uff084\uff09\u6ce8\u9500\u6216\u5220\u9664\u60a8\u6e38\u620f\u8d26\u53f7\u53ca\u6e38\u620f\u6570\u636e\u7b49\u76f8\u5173\u4fe1\u606f\uff1b\n\uff085\uff09\u60a8\u6cd5\u5b9a\u76d1\u62a4\u4eba\u8981\u6c42\u91c7\u53d6\u7684\uff0c\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8ba4\u4e3a\u53ef\u91c7\u53d6\u7684\u5176\u4ed6\u5408\u7406\u63aa\u65bd\uff0c\u4ee5\u9650\u5236\u6216\u7981\u6b62\u60a8\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff1b\n\uff086\uff09\u56fd\u5bb6\u6cd5\u5f8b\u6cd5\u89c4\u6216\u653f\u7b56\u8981\u6c42\u7684\u76f8\u5173\u63aa\u65bd\u3002\n5.12 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5411\u7528\u6237\u63d0\u4f9b\u6e38\u620f\u670d\u52a1\u672c\u8eab\u5c5e\u4e8e\u5546\u4e1a\u884c\u4e3a\uff0c\u7528\u6237\u6709\u6743\u81ea\u4e3b\u51b3\u5b9a\u662f\u5426\u6839\u636e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u81ea\u884c\u786e\u5b9a\u7684\u6536\u8d39\u9879\u76ee\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u8d2d\u4e70\u6e38\u620f\u5185\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u7684\u4f7f\u7528\u6743\u4ee5\u53ca\u63a5\u53d7\u5176\u4ed6\u589e\u503c\u670d\u52a1\u7b49\u5404\u7c7b\u6536\u8d39\u9879\u76ee\uff09\u53ca\u6536\u8d39\u6807\u51c6\u652f\u4ed8\u76f8\u5e94\u7684\u8d39\u7528\uff0c\u4ee5\u83b7\u5f97\u76f8\u5e94\u7684\u6e38\u620f\u670d\u52a1\u3002\u5982\u60a8\u4e0d\u6309\u76f8\u5e94\u6807\u51c6\u652f\u4ed8\u76f8\u5e94\u8d39\u7528\u7684\uff0c\u60a8\u5c06\u65e0\u6cd5\u83b7\u5f97\u76f8\u5e94\u7684\u6e38\u620f\u670d\u52a1\u3002\n\u60a8\u77e5\u6089\u5e76\u540c\u610f\uff1a\u6536\u8d39\u9879\u76ee\u6216\u6536\u8d39\u6807\u51c6\u7684\u6539\u53d8\u3001\u8c03\u6574\u662f\u4e00\u79cd\u6b63\u5e38\u7684\u5546\u4e1a\u884c\u4e3a\uff0c\u60a8\u4e0d\u5f97\u56e0\u4e3a\u6536\u8d39\u9879\u76ee\u6216\u6536\u8d39\u6807\u51c6\u7684\u6539\u53d8\u3001\u8c03\u6574\u800c\u8981\u6c42\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8fdb\u884c\u8d54\u507f\u6216\u8865\u507f\u3002\n\u60a8\u77e5\u6089\u5e76\u540c\u610f\uff0c\u60a8\u4f7f\u7528\u6cd5\u5b9a\u8d27\u5e01\u8fdb\u884c\u6e38\u620f\u5145\u503c\u8d2d\u4e70\u6216\u5151\u6362\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u7684\uff0c\u60a8\u6240\u8d2d\u4e70\u6216\u5151\u6362\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u5c06\u4e0d\u80fd\u9000\u8fd8\u6216\u5151\u6362\u6210\u6cd5\u5b9a\u8d27\u5e01\uff0c\u4f46\u6cd5\u5f8b\u53e6\u6709\u5f3a\u5236\u6027\u89c4\u5b9a\u7684\u9664\u5916\u3002\n\u60a8\u77e5\u6089\u5e76\u540c\u610f\uff0c\u5982\u60a8\u8fdb\u884c\u6e38\u620f\u5145\u503c\u8d2d\u4e70\u6216\u5151\u6362\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u7684\u4ea4\u6613\u56e0\u9000\u6b3e\u6216\u6784\u6210\u65e0\u6548\u6c11\u4e8b\u884c\u4e3a\u7b49\u539f\u56e0\u88ab\u53d6\u6d88\u6216\u6062\u590d\u539f\u72b6\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5c31\u8be5\u88ab\u53d6\u6d88\u6216\u6062\u590d\u539f\u72b6\u7684\u4ea4\u6613\u5bf9\u5e94\u4e0b\u53d1\u5230\u60a8\u6e38\u620f\u8d26\u53f7\u4e2d\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u8fdb\u884c\u6263\u9664\u3002\u5982\u524d\u8ff0\u88ab\u53d6\u6d88\u6216\u6062\u590d\u539f\u72b6\u7684\u4ea4\u6613\u6d89\u53ca\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u6216\u5176\u4ed6\u589e\u503c\u670d\u52a1\u5df2\u8d60\u9001\u5176\u4ed6\u7528\u6237\u7684\uff0c\u60a8\u6216\u5f53\u60a8\u4e3a\u53d7\u8d60\u7528\u6237\u65f6\uff0c\u5747\u540c\u610f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u4ece\u53d7\u8d60\u6e38\u620f\u8d26\u53f7\u4e2d\u6263\u9664\u8be5\u6e38\u620f\u865a\u62df\u9053\u5177\u6216\u5176\u4ed6\u589e\u503c\u670d\u52a1\u3002\u5982\u60a8\u6216\u5f53\u60a8\u4e3a\u53d7\u8d60\u7528\u6237\u65f6\u6e38\u620f\u8d26\u53f7\u4e2d\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u4e0d\u8db3\u4ee5\u6263\u9664\u7684\uff0c\u5c31\u4e0d\u8db3\u90e8\u5206\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u5728\u60a8\u6216\u53d7\u8d60\u7528\u6237\u6e38\u620f\u8d26\u53f7\u4e2d\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u540e\u7eed\u589e\u52a0\u65f6\u4f18\u5148\u6263\u9664\u3002\n5.13 \u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e0d\u5bf9\u56e0\u4e0d\u53ef\u6297\u529b\u5bfc\u81f4\u7684\u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u8fc7\u7a0b\u4e2d\u906d\u53d7\u7684\u635f\u5931\u627f\u62c5\u8d23\u4efb\u3002\u8be5\u7b49\u4e0d\u53ef\u6297\u529b\u4e8b\u4ef6\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u56fd\u5bb6\u6cd5\u5f8b\u3001\u6cd5\u89c4\u3001\u653f\u7b56\u53ca\u56fd\u5bb6\u673a\u5173\u7684\u547d\u4ee4\u53ca\u5176\u4ed6\u653f\u5e9c\u884c\u4e3a\u6216\u8005\u5176\u5b83\u7684\u8bf8\u5982\u5730\u9707\u3001\u6c34\u707e\u3001\u96ea\u707e\u3001\u706b\u707e\u3001\u6d77\u5578\u3001\u53f0\u98ce\u3001\u7f62\u5de5\u3001\u6218\u4e89\u7b49\u4e0d\u53ef\u9884\u6d4b\u3001\u4e0d\u53ef\u907f\u514d\u4e14\u4e0d\u53ef\u514b\u670d\u7684\u4e8b\u4ef6\u3002\n5.14 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ef\u80fd\u56e0\u6e38\u620f\u8f6f\u4ef6BUG\u3001\u7248\u672c\u66f4\u65b0\u7f3a\u9677\u3001\u7b2c\u4e09\u65b9\u75c5\u6bd2\u653b\u51fb\u6216\u5176\u4ed6\u4efb\u4f55\u56e0\u7d20\u5bfc\u81f4\u60a8\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u7b49\u8d26\u53f7\u6570\u636e\u6216\u6e38\u620f\u6570\u636e\u53d1\u751f\u5f02\u5e38\u3002\u5728\u6570\u636e\u5f02\u5e38\u7684\u539f\u56e0\u672a\u5f97\u5230\u67e5\u660e\u524d\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u6682\u65f6\u51bb\u7ed3\u8be5\u6e38\u620f\u8d26\u53f7\uff1b\u82e5\u67e5\u660e\u6570\u636e\u5f02\u5e38\u4e3a\u975e\u6b63\u5e38\u6e38\u620f\u884c\u4e3a\u6240\u81f4\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u6062\u590d\u6e38\u620f\u8d26\u53f7\u6570\u636e\u81f3\u5f02\u5e38\u53d1\u751f\u524d\u7684\u539f\u59cb\u72b6\u6001\uff08\u5305\u62ec\u5411\u7b2c\u4e09\u65b9\u8ffd\u56de\u88ab\u8f6c\u79fb\u6570\u636e\uff09\uff0c\u800c\u65e0\u987b\u5411\u60a8\u627f\u62c5\u4efb\u4f55\u8d23\u4efb\u3002\u82e5\u6570\u636e\u5f02\u5e38\u662f\u7531\u4e8e\u60a8\u5b9e\u65bd\u8fdd\u6cd5\u8fdd\u89c4\u884c\u4e3a\u6216\u8fdd\u53cd\u672c\u534f\u8bae\u7ea6\u5b9a\u7684\u884c\u4e3a\u6240\u81f4\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u91c7\u53d6\u76f8\u5e94\u5904\u7406\u63aa\u65bd\u3002\n\u60a8\u7406\u89e3\u5e76\u540c\u610f\uff0c\u5982\u6e38\u620f\u90e8\u7f72\u4e86\u591a\u4e2a\u670d\u52a1\u5668\uff0c\u5728\u6e38\u620f\u8fd0\u8425\u8fc7\u7a0b\u4e2d\uff0c\u4e3a\u4e86\u63d0\u9ad8\u6e38\u620f\u7684\u53ef\u73a9\u6027\u548c\u4e92\u52a8\u6027\uff0c\u521b\u9020\u66f4\u597d\u7684\u6e38\u620f\u73af\u5883\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u7ed3\u5408\u6e38\u620f\u670d\u52a1\u5668\u5185\u6d3b\u8dc3\u7528\u6237\u4eba\u6570\u7b49\u60c5\u51b5\uff0c\u9002\u65f6\u8c03\u6574\u670d\u52a1\u5668\u6570\u91cf\uff0c\u5c06\u5176\u4e2d\u591a\u4e2a\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u7528\u6237\u4e34\u65f6\u6216\u6c38\u4e45\u5730\u5408\u5e76\u6216\u8fc1\u79fb\u5230\u540c\u4e00\u4e2a\u670d\u52a1\u5668\u4e2d\uff08\u5373\u201c\u5408\u670d\u201d\u6216\u201c\u5408\u533a\u201d\uff09\u3002\n\u5982\u6e38\u620f\u5408\u670d\u6216\u5408\u533a\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4f1a\u5728\u5408\u670d\u6216\u5408\u533a\u524d\u901a\u8fc7\u6e38\u620f\u5185\u516c\u544a\u6216\u5176\u4ed6\u65b9\u5f0f\u5411\u60a8\u901a\u77e5\uff0c\u5e76\u4f1a\u516c\u5e03\u6709\u5173\u5408\u670d\u6216\u5408\u533a\u5177\u4f53\u89c4\u5219\u3002\u5408\u670d\u6216\u5408\u533a\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6e38\u620f\u76f8\u5173\u8bbe\u7f6e\u3001\u4f53\u9a8c\u53ca\u6709\u5173\u699c\u5355\u7b49\u7528\u6237\u76f8\u5173\u6e38\u620f\u6570\u636e\u53d1\u751f\u53d8\u5316\uff0c\u4f46\u4e0d\u4f1a\u5bf9\u60a8\u6e38\u620f\u865a\u62df\u9053\u5177\u7684\u529f\u80fd\u8fdb\u884c\u8c03\u6574\uff0c\u5177\u4f53\u89c1\u6e38\u620f\u5b98\u65b9\u516c\u793a\u7684\u6709\u5173\u5408\u670d\u6216\u5408\u533a\u5177\u4f53\u89c4\u5219\u3002\u5982\u5408\u670d\u6216\u5408\u533a\u5bfc\u81f4\u89d2\u8272\u540d\u3001\u6218\u961f\u540d\uff08\u5982\u6709\uff09\u53ca\u5176\u4ed6\u76f8\u5173\u5185\u5bb9\u7b49\u91cd\u540d\u7684\uff0c\u6e38\u620f\u5b98\u65b9\u53ef\u968f\u673a\u5bf9\u91cd\u540d\u5185\u5bb9\u8bbe\u7f6e\u65b0\u540d\u5b57\u4ee5\u4f5c\u533a\u5206\u3002\n5.15 \u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8bb8\u53ef\uff0c\u60a8\u4e0d\u5f97\u64c5\u81ea\u4e0e\u5176\u4ed6\u7528\u6237\u8fdb\u884c\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u7684\u4ea4\u6613\uff0c\u6216\u4ece\u7b2c\u4e09\u65b9\u901a\u8fc7\u8d2d\u4e70\u3001\u63a5\u53d7\u8d60\u4e0e\u6216\u8005\u5176\u4ed6\u5f0f\u83b7\u5f97\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u3002\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e0d\u5bf9\u7b2c\u4e09\u65b9\u4ea4\u6613\u884c\u4e3a\uff08\u7b2c\u4e09\u65b9\u4ea4\u6613\uff0c\u662f\u6307\u60a8\u4ece\u7b2c\u4e09\u65b9\u901a\u8fc7\u8d2d\u4e70\u3001\u63a5\u53d7\u8d60\u4e0e\u6216\u8005\u5176\u4ed6\u7684\u65b9\u5f0f\u83b7\u5f97\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u7684\u884c\u4e3a\uff09\u8d1f\u8d23\uff0c\u5e76\u4e14\u4e0d\u53d7\u7406\u56e0\u4efb\u4f55\u7b2c\u4e09\u65b9\u4ea4\u6613\u53d1\u751f\u7ea0\u7eb7\u800c\u5e26\u6765\u7684\u7533\u8bc9\u3002\n5.16 \u60a8\u5145\u5206\u7406\u89e3\u5230\uff1a\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u95f4\u5b58\u5728\u4e0d\u4e92\u901a\u7684\u5ba2\u89c2\u60c5\u51b5\uff0c\u8be5\u5ba2\u89c2\u60c5\u51b5\u5e76\u975e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u9020\u6210\uff0c\u7531\u6b64\u53ef\u80fd\u5bfc\u81f4\u60a8\u5728\u67d0\u4e00\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u5145\u503c\u548c\u6e38\u620f\u6570\u636e\u4e0d\u80fd\u987a\u5229\u8f6c\u79fb\u5230\u53e6\u4e00\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u3002\u7531\u4e8e\u60a8\u5728\u4e0d\u540c\u7cfb\u7edf\u8fdb\u884c\u5207\u6362\u9020\u6210\u7684\u5145\u503c\u635f\u5931\u548c\u6e38\u620f\u6570\u636e\u4e22\u5931\u98ce\u9669\u5e94\u7531\u60a8\u81ea\u884c\u627f\u62c5\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5bf9\u6b64\u4e0d\u627f\u62c5\u4efb\u4f55\u8d23\u4efb\u3002\n5.17 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u81ea\u884c\u51b3\u5b9a\u7ec8\u6b62\u8fd0\u8425\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u65f6\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u56e0\u5176\u4ed6\u4efb\u4f55\u539f\u56e0\u7ec8\u6b62\u8fd0\u8425\u65f6\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4f1a\u6309\u7167\u56fd\u5bb6\u6709\u5173\u7f51\u7edc\u6e38\u620f\u7ec8\u6b62\u8fd0\u8425\u7684\u76f8\u5173\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u5904\u7406\u6e38\u620f\u7ec8\u6b62\u8fd0\u8425\u76f8\u5173\u4e8b\u5b9c\uff0c\u4ee5\u4fdd\u969c\u7528\u6237\u5408\u6cd5\u6743\u76ca\u3002\n\n\u516d\u3001\u7528\u6237\u884c\u4e3a\u89c4\u8303\n6.1 \u60a8\u5145\u5206\u4e86\u89e3\u5e76\u540c\u610f\uff0c\u60a8\u4e3a\u81ea\u5df1\u6e38\u620f\u8d26\u53f7\u4e0b\u7684\u4e00\u5207\u884c\u4e3a\u8d1f\u8d23\uff0c\u5305\u62ec\u60a8\u6240\u53d1\u8868\u7684\u4efb\u4f55\u5185\u5bb9\u4ee5\u53ca\u7531\u6b64\u4ea7\u751f\u7684\u4efb\u4f55\u540e\u679c\u3002\n6.2 \u60a8\u9664\u4e86\u53ef\u4ee5\u6309\u7167\u672c\u534f\u8bae\u7684\u7ea6\u5b9a\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u4e4b\u5916\uff0c\u4e0d\u5f97\u8fdb\u884c\u4efb\u4f55\u4fb5\u72af\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u77e5\u8bc6\u4ea7\u6743\u7684\u884c\u4e3a\uff0c\u6216\u8005\u8fdb\u884c\u5176\u4ed6\u7684\u6709\u635f\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6216\u5176\u4ed6\u7b2c\u4e09\u65b9\u5408\u6cd5\u6743\u76ca\u7684\u884c\u4e3a\u3002\n6.3 \u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u65f6\u987b\u9075\u5b88\u6cd5\u5f8b\u6cd5\u89c4\uff0c\u4e0d\u5f97\u5229\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u4ece\u4e8b\u8fdd\u6cd5\u8fdd\u89c4\u884c\u4e3a\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u4ee5\u4e0b\u884c\u4e3a\uff1a\n\uff08\u4e00\uff09\u8fdd\u53cd\u5baa\u6cd5\u6240\u786e\u5b9a\u7684\u57fa\u672c\u539f\u5219\u7684\uff1b\n\uff08\u4e8c\uff09\u5371\u5bb3\u56fd\u5bb6\u5b89\u5168\u3001\u6cc4\u9732\u56fd\u5bb6\u79d8\u5bc6\uff0c\u98a0\u8986\u56fd\u5bb6\u653f\u7b56\uff0c\u7834\u574f\u56fd\u5bb6\u7edf\u4e00\u7684\uff1b\n\uff08\u4e09\uff09\u635f\u5bb3\u56fd\u5bb6\u8363\u8a89\u548c\u5229\u76ca\u7684\uff1b\n\uff08\u56db\uff09\u6b6a\u66f2\u3001\u4e11\u5316\u3001\u4eb5\u6e0e\u3001\u5426\u5b9a\u82f1\u96c4\u70c8\u58eb\u4e8b\u8ff9\u548c\u7cbe\u795e\uff0c\u4ee5\u4fae\u8fb1\u3001\u8bfd\u8c24\u6216\u8005\u5176\u4ed6\u65b9\u5f0f\u4fb5\u5bb3\u82f1\u96c4\u70c8\u58eb\u7684\u59d3\u540d\u3001\u8096\u50cf\u3001\u540d\u8a89\u3001\u8363\u8a89\u7684\uff1b\n\uff08\u4e94\uff09\u5ba3\u626c\u6050\u6016\u4e3b\u4e49\u3001\u6781\u7aef\u4e3b\u4e49\u6216\u8005\u717d\u52a8\u5b9e\u65bd\u6050\u6016\u6d3b\u52a8\u3001\u6781\u7aef\u4e3b\u4e49\u6d3b\u52a8\u7684\uff1b\n\uff08\u516d\uff09\u717d\u52a8\u6c11\u65cf\u4ec7\u6068\u3001\u6c11\u65cf\u6b67\u89c6\uff0c\u7834\u574f\u6c11\u65cf\u56e2\u7ed3\u7684\uff1b\n\uff08\u4e03\uff09\u7834\u574f\u56fd\u5bb6\u5b97\u6559\u653f\u7b56\uff0c\u5ba3\u626c\u90aa\u6559\u548c\u5c01\u5efa\u8ff7\u4fe1\u7684\uff1b\n\uff08\u516b\uff09\u6563\u5e03\u8c23\u8a00\uff0c\u6270\u4e71\u793e\u4f1a\u79e9\u5e8f\u548c\u793e\u4f1a\u79e9\u5e8f\u7684\uff1b\n\uff08\u4e5d\uff09\u6563\u5e03\u6deb\u79fd\u3001\u8272\u60c5\u3001\u8d4c\u535a\u3001\u66b4\u529b\u3001\u51f6\u6740\u3001\u6050\u6016\u6216\u8005\u6559\u5506\u72af\u7f6a\u7684\uff1b\n\uff08\u5341\uff09\u4fae\u8fb1\u6216\u8005\u8bfd\u8c24\u4ed6\u4eba\uff0c\u4fb5\u5bb3\u4ed6\u4eba\u540d\u8a89\u3001\u9690\u79c1\u548c\u5176\u4ed6\u5408\u6cd5\u6743\u76ca\u7684\uff1b\n\uff08\u5341\u4e00\uff09\u8fdd\u80cc\u793e\u4f1a\u516c\u5fb7\u7684\uff1b\n\uff08\u5341\u4e8c\uff09\u6cd5\u5f8b\u3001\u884c\u653f\u6cd5\u89c4\u548c\u56fd\u5bb6\u89c4\u5b9a\u7981\u6b62\u7684\u5176\u4ed6\u5185\u5bb9\u7684\u3002\n\u60a8\u4e0d\u5f97\u5229\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u5236\u4f5c\u3001\u590d\u5236\u3001\u53d1\u5e03\u542b\u6709\u4e0b\u5217\u5185\u5bb9\u7684\u4e0d\u826f\u4fe1\u606f\uff1a\n\uff08\u4e00\uff09\u4f7f\u7528\u5938\u5f20\u6807\u9898\uff0c\u5185\u5bb9\u4e0e\u6807\u9898\u4e25\u91cd\u4e0d\u7b26\u7684\uff1b\n\uff08\u4e8c\uff09\u7092\u4f5c\u7eef\u95fb\u3001\u4e11\u95fb\u3001\u52a3\u8ff9\u7b49\u7684\uff1b\n\uff08\u4e09\uff09\u4e0d\u5f53\u8bc4\u8ff0\u81ea\u7136\u707e\u5bb3\u3001\u91cd\u5927\u4e8b\u6545\u7b49\u707e\u96be\u7684\uff1b\n\uff08\u56db\uff09\u5e26\u6709\u6027\u6697\u793a\u3001\u6027\u6311\u9017\u7b49\u6613\u4f7f\u4eba\u4ea7\u751f\u6027\u8054\u60f3\u7684\uff1b\n\uff08\u4e94\uff09\u5c55\u73b0\u8840\u8165\u3001\u60ca\u609a\u3001\u6b8b\u5fcd\u7b49\u81f4\u4eba\u8eab\u5fc3\u4e0d\u9002\u7684\uff1b\n\uff08\u516d\uff09\u717d\u52a8\u4eba\u7fa4\u6b67\u89c6\u3001\u5730\u57df\u6b67\u89c6\u7b49\u7684\uff1b\n\uff08\u4e03\uff09\u5ba3\u626c\u4f4e\u4fd7\u3001\u5eb8\u4fd7\u3001\u5a9a\u4fd7\u5185\u5bb9\u7684\uff1b\n\uff08\u516b\uff09\u53ef\u80fd\u5f15\u53d1\u672a\u6210\u5e74\u4eba\u6a21\u4eff\u4e0d\u5b89\u5168\u884c\u4e3a\u548c\u8fdd\u53cd\u793e\u4f1a\u516c\u5fb7\u884c\u4e3a\u3001\u8bf1\u5bfc\u672a\u6210\u5e74\u4eba\u4e0d\u826f\u55dc\u597d\u7b49\u7684\uff1b\n\uff08\u4e5d\uff09\u5176\u4ed6\u5bf9\u7f51\u7edc\u751f\u6001\u9020\u6210\u4e0d\u826f\u5f71\u54cd\u7684\u5185\u5bb9\u3002\n6.4 \u9664\u975e\u6cd5\u5f8b\u5141\u8bb8\u6216\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e66\u9762\u8bb8\u53ef\uff0c\u60a8\u4e0d\u5f97\u4ece\u4e8b\u4e0b\u5217\u884c\u4e3a\uff1a\n\uff081\uff09\u5220\u9664\u6e38\u620f\u8f6f\u4ef6\u53ca\u5176\u526f\u672c\u4e0a\u5173\u4e8e\u8457\u4f5c\u6743\u7684\u4fe1\u606f\uff1b\n\uff082\uff09\u5bf9\u6e38\u620f\u8f6f\u4ef6\u8fdb\u884c\u53cd\u5411\u5de5\u7a0b\u3001\u53cd\u5411\u6c47\u7f16\u3001\u53cd\u5411\u7f16\u8bd1\u6216\u8005\u4ee5\u5176\u4ed6\u65b9\u5f0f\u5c1d\u8bd5\u53d1\u73b0\u8f6f\u4ef6\u7684\u6e90\u4ee3\u7801\u6216\u5176\u4ed6\u4fdd\u5bc6\u5185\u5bb9\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6682\u672a\u4e3b\u52a8\u516c\u5f00\u5448\u73b0\u4f46\u5df2\u5c01\u5b58\u5728\u6e38\u620f\u5b89\u88c5\u5305\u4e2d\u7684\u6e38\u620f\u5143\u7d20\u7b49\uff1b\n\uff083\uff09\u5bf9\u6e38\u620f\u8f6f\u4ef6\u8fdb\u884c\u626b\u63cf\u3001\u63a2\u67e5\u3001\u6d4b\u8bd5\uff0c\u4ee5\u68c0\u6d4b\u3001\u53d1\u73b0\u3001\u67e5\u627e\u5176\u4e2d\u53ef\u80fd\u5b58\u5728\u7684BUG\u6216\u5f31\u70b9\uff1b\n\uff084\uff09\u5bf9\u6e38\u620f\u8f6f\u4ef6\u6216\u8005\u8f6f\u4ef6\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u91ca\u653e\u5230\u4efb\u4f55\u7ec8\u7aef\u5185\u5b58\u4e2d\u7684\u6570\u636e\u3001\u8f6f\u4ef6\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u7aef\u7684\u4ea4\u4e92\u6570\u636e\uff0c\u4ee5\u53ca\u8f6f\u4ef6\u8fd0\u884c\u6240\u5fc5\u9700\u7684\u7cfb\u7edf\u6570\u636e\uff0c\u8fdb\u884c\u590d\u5236\u3001\u4fee\u6539\u3001\u589e\u52a0\u3001\u5220\u9664\u3001\u6302\u63a5\u8fd0\u884c\u6216\u521b\u4f5c\u4efb\u4f55\u884d\u751f\u4f5c\u54c1\uff0c\u5f62\u5f0f\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u4f7f\u7528\u63d2\u4ef6\u3001\u5916\u6302\u6216\u975e\u7ecf\u5408\u6cd5\u6388\u6743\u7684\u7b2c\u4e09\u65b9\u5de5\u5177/\u670d\u52a1\u63a5\u5165\u8f6f\u4ef6\u548c\u76f8\u5173\u7cfb\u7edf\uff1b\n\uff085\uff09\u4fee\u6539\u6216\u4f2a\u9020\u8f6f\u4ef6\u8fd0\u884c\u4e2d\u7684\u6307\u4ee4\u3001\u6570\u636e\uff0c\u589e\u52a0\u3001\u5220\u51cf\u3001\u53d8\u52a8\u8f6f\u4ef6\u7684\u529f\u80fd\u6216\u8fd0\u884c\u6548\u679c\uff0c\u6216\u8005\u5c06\u7528\u4e8e\u4e0a\u8ff0\u7528\u9014\u7684\u8f6f\u4ef6\u3001\u65b9\u6cd5\u8fdb\u884c\u8fd0\u8425\u6216\u5411\u516c\u4f17\u4f20\u64ad\uff0c\u65e0\u8bba\u4e0a\u8ff0\u884c\u4e3a\u662f\u5426\u4e3a\u5546\u4e1a\u76ee\u7684\uff1b\n\uff086\uff09\u901a\u8fc7\u975e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5f00\u53d1\u3001\u6388\u6743\u7684\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u3001\u63d2\u4ef6\u3001\u5916\u6302\u3001\u7cfb\u7edf\uff0c\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\uff0c\u6216\u5236\u4f5c\u3001\u53d1\u5e03\u3001\u4f20\u64ad\u975e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5f00\u53d1\u3001\u6388\u6743\u7684\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u3001\u63d2\u4ef6\u3001\u5916\u6302\u3001\u7cfb\u7edf\uff1b\n\uff087\uff09\u5bf9\u6e38\u620f\u4e2d\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u62e5\u6709\u77e5\u8bc6\u4ea7\u6743\u7684\u5185\u5bb9\u8fdb\u884c\u4f7f\u7528\u3001\u51fa\u79df\u3001\u51fa\u501f\u3001\u590d\u5236\u3001\u4fee\u6539\u3001\u94fe\u63a5\u3001\u8f6c\u8f7d\u3001\u6c47\u7f16\u3001\u53d1\u8868\u3001\u51fa\u7248\u3001\u5efa\u7acb\u955c\u50cf\u7ad9\u70b9\u7b49\uff1b\n\uff088\uff09\u5efa\u7acb\u6709\u5173\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u955c\u50cf\u7ad9\u70b9\uff0c\u6216\u8005\u8fdb\u884c\u7f51\u9875\uff08\u7edc\uff09\u5feb\u7167\uff0c\u6216\u8005\u5229\u7528\u67b6\u8bbe\u670d\u52a1\u5668\u7b49\u65b9\u5f0f\uff0c\u4e3a\u4ed6\u4eba\u63d0\u4f9b\u4e0e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u5b8c\u5168\u76f8\u540c\u6216\u8005\u7c7b\u4f3c\u7684\u670d\u52a1\uff1b\n\uff089\uff09\u5c06\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u4efb\u610f\u90e8\u5206\u5206\u79bb\u51fa\u6765\u5355\u72ec\u4f7f\u7528\uff0c\u6216\u8005\u8fdb\u884c\u5176\u4ed6\u7684\u4e0d\u7b26\u5408\u672c\u534f\u8bae\u7684\u4f7f\u7528\uff1b\n\uff0810\uff09\u4f7f\u7528\u3001\u4fee\u6539\u6216\u906e\u76d6\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u540d\u79f0\u3001\u5546\u6807\u6216\u5176\u5b83\u77e5\u8bc6\u4ea7\u6743\uff1b\n\uff0811\uff09\u5176\u4ed6\u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u660e\u793a\u6388\u6743\u7684\u884c\u4e3a\u3002\n\u5982\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u5b58\u5728\u53ef\u4f9b\u591a\u4e2a\u7528\u6237\u5728\u7ebf\u4ea4\u6d41\u6e38\u620f\u4fe1\u606f\u7684\u7f51\u7edc\u5e73\u53f0\u7684\uff0c\u7528\u6237\u5e94\u9075\u5b88\u6cd5\u5f8b\u6cd5\u89c4\u3001\u672c\u534f\u8bae\u4ee5\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u57fa\u4e8e\u8be5\u5e73\u53f0\u5236\u5b9a\u7684\u76f8\u5173\u89c4\u5219\uff08\u201c\u5e73\u53f0\u89c4\u5219\u201d\uff09\uff0c\u4e0d\u5f97\u5229\u7528\u8be5\u5e73\u53f0\u5236\u4f5c\u3001\u590d\u5236\u3001\u53d1\u5e03\u3001\u4f20\u64ad\u6cd5\u5f8b\u6cd5\u89c4\u548c\u56fd\u5bb6\u6709\u5173\u89c4\u5b9a\u7981\u6b62\u7684\u4fe1\u606f\u5185\u5bb9\u3002\n\u5982\u7528\u6237\uff08\u201c\u521b\u5efa\u8005\u201d\uff09\u53ef\u4ee5\u6839\u636e\u5e73\u53f0\u89c4\u5219\u81ea\u884c\u521b\u5efa\u76f8\u5e94\u7684\u6e38\u620f\u4ea4\u6d41\u677f\u5757\uff0c\u5e76\u5141\u8bb8\u5176\u4ed6\u7528\u6237\u8fdb\u5165\u8be5\u677f\u5757\u5236\u4f5c\u3001\u590d\u5236\u3001\u53d1\u5e03\u6216\u4f20\u64ad\u4fe1\u606f\u5185\u5bb9\u7684\uff0c\u521b\u5efa\u8005\u4ee5\u53ca\u7ba1\u7406\u8005\uff08\u5373\u521b\u5efa\u8005\u6307\u5b9a\u7684\u5176\u4ed6\u7528\u6237\u4f5c\u4e3a\u7ba1\u7406\u8005\uff09\u5e94\u5f53\u5c65\u884c\u8be5\u677f\u5757\u7684\u7ba1\u7406\u8d23\u4efb\uff0c\u5e76\u4f9d\u636e\u6cd5\u5f8b\u6cd5\u89c4\u3001\u672c\u534f\u8bae\u53ca\u5e73\u53f0\u89c4\u5219\u89c4\u8303\u8be5\u677f\u5757\u5185\u7684\u7f51\u7edc\u884c\u4e3a\u548c\u4fe1\u606f\u53d1\u5e03\u3002\u521b\u5efa\u8005\u53ca\u7ba1\u7406\u8005\u5e94\u89c4\u8303\u677f\u5757\u5185\u5176\u4ed6\u7528\u6237\u7684\u884c\u4e3a\uff0c\u53ca\u65f6\u5236\u6b62\u677f\u5757\u5185\u5bb9\u8fdd\u6cd5\u8fdd\u89c4\u884c\u4e3a\uff0c\u5e76\u5bf9\u5229\u7528\u8be5\u677f\u5757\u7ba1\u7406\u6743\u9650\u6240\u5b9e\u65bd\u7684\u884c\u4e3a\u8d1f\u8d23\u3002\u5bf9\u4e8e\u672a\u5c3d\u5230\u7ba1\u7406\u4e49\u52a1\u5bfc\u81f4\u6e38\u620f\u4ea4\u6d41\u677f\u5757\u51fa\u73b0\u8fdd\u6cd5\u548c\u4e0d\u826f\u4fe1\u606f\u5185\u5bb9\u7684\u521b\u5efa\u8005\u53ca\u7ba1\u7406\u8005\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5c06\u6839\u636e\u5177\u4f53\u60c5\u5f62\u91c7\u53d6\u8b66\u793a\u63d0\u9192\u3001\u5220\u9664\u4fe1\u606f\u3001\u9650\u5236\u6216\u6682\u505c\u5176\u4f7f\u7528\u6e38\u620f\u4ea4\u6d41\u677f\u5757\u529f\u80fd\u3001\u6c38\u4e45\u5173\u95ed\u6e38\u620f\u4ea4\u6d41\u677f\u5757\u4ee5\u53ca\u6709\u6743\u91c7\u53d6\u76f8\u5e94\u5904\u7406\u63aa\u65bd\u3002\n6.5 \u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u8fc7\u7a0b\u4e2d\u5982\u6709\u4ee5\u4e0b\u4efb\u4f55\u884c\u4e3a\uff08\u4ee5\u4e0b\u4e5f\u79f0\u201c\u8fdd\u6cd5\u8fdd\u89c4\u884c\u4e3a\u201d\uff09\u4e4b\u4e00\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u89c6\u60c5\u8282\u4e25\u91cd\u7a0b\u5ea6\uff0c\u4f9d\u636e\u672c\u534f\u8bae\u53ca\u76f8\u5173\u6e38\u620f\u89c4\u5219\u7684\u89c4\u5b9a\uff0c\u5bf9\u60a8\u91c7\u53d6\u672c\u6761\u7b2c\u4e8c\u6b3e\u89c4\u5b9a\u7684\u4e00\u79cd\u6216\u591a\u79cd\u5904\u7406\u63aa\u65bd\uff0c\u5e76\u53ef\u516c\u544a\u5904\u7406\u7ed3\u679c\uff1a\n\uff081\uff09\u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u4e2d\u4f7f\u7528\u3001\u4e0a\u4f20\u8fdd\u6cd5\u6216\u4e0d\u5f53\u8bcd\u8bed\u3001\u5b57\u7b26\u53ca\u5176\u4ed6\u5185\u5bb9\u7684\u884c\u4e3a\uff0c\u5305\u62ec\u7528\u4e8e\u89d2\u8272\u547d\u540d\uff1b\n\uff082\uff09\u4ee5\u4efb\u4f55\u65b9\u5f0f\u7834\u574f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u6216\u5f71\u54cd\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u7684\u6b63\u5e38\u8fdb\u884c\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\uff1a\n1\uff09\u8fdd\u89c4\u53ca\uff08\u6216\uff09\u6076\u610f\u6ce8\u518c\u3001\u767b\u5f55\u6e38\u620f\u7684\u884c\u4e3a\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u6076\u610f\u6279\u91cf\u6ce8\u518c\u6e38\u620f\u8d26\u53f7\uff0c\u4ee5\u53ca\u4ee5\u7834\u574f\u670d\u52a1\u5668\u9274\u6743\u3001\u6076\u610f\u6324\u670d\u7b49\u65b9\u5f0f\u767b\u5f55\u6e38\u620f\u884c\u4e3a\uff1b\n2\uff09\u6076\u610f\u5b9e\u65bd\u53ef\u80fd\u5bfc\u81f4\u6e38\u620f\u670d\u52a1\u5668\u5b95\u673a\u3001\u5361\u987f\uff0c\u6216\u5bfc\u81f4\u5176\u4ed6\u6e38\u620f\u73a9\u5bb6\u6389\u7ebf\u3001\u5ef6\u8fdf\u7b49\u65e0\u6cd5\u6b63\u5e38\u6e38\u620f\u7684\u884c\u4e3a\uff0c\u5982\u5229\u7528DDOS\u5bf9\u6e38\u620f\u670d\u52a1\u5668\u6216\u5176\u4ed6\u73a9\u5bb6\u8fdb\u884c\u7f51\u7edc\u6d41\u91cf\u653b\u51fb\u7684\u884c\u4e3a\u7b49\uff1b\n3)\u5229\u7528\u6e38\u620f\u6f0f\u6d1e\u5b9e\u65bd\u83b7\u76ca\u3001\u7834\u574f\u6e38\u620f\u73af\u5883\u6216\u7ed9\u5176\u4ed6\u73a9\u5bb6\u9020\u6210\u4e0d\u826f\u5f71\u54cd\u7684\u884c\u4e3a\uff1b\n4\uff09\u6d88\u6781\u6e38\u620f\u7834\u574f\u5176\u4ed6\u7528\u6237\u6e38\u620f\u4f53\u9a8c\u7684\u884c\u4e3a\u3002\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u6076\u610f\u4f24\u5bb3\u6216\u8005\u51fb\u6740\u672c\u65b9\u961f\u53cb\uff0c\u6076\u610f\u7ec4\u961f\uff0c\u6076\u610f\u9001\u5206\u3001\u964d\u5206\uff0c\u6d88\u6781\u6302\u673a\u3001\u9003\u8dd1\u3001\u6545\u610f\u9001\u4eba\u5934\uff0c\u4ee5\u53ca\u5176\u4ed6\u6d88\u6781\u6e38\u620f\u7834\u574f\u7528\u6237\u6e38\u620f\u4f53\u9a8c\u7684\u884c\u4e3a\uff1b\n5\uff09\u6e38\u620f\u6570\u636e\u8868\u73b0\u5f02\u5e38\uff0c\u5f71\u54cd\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u516c\u5e73\u7684\u5176\u4ed6\u884c\u4e3a\u3002\n\uff083\uff09\u4f7f\u7528\u5404\u79cd\u79c1\u670d\u3001\u5916\u6302\u884c\u4e3a\uff1b\n\uff084\uff09\u4f7f\u7528\u6e38\u620f\u540c\u6b65\u5668\uff08\u5177\u4f53\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u4f7f\u7528\u952e\u76d8\u3001\u9f20\u6807\u7b49\u786c\u4ef6\u540c\u6b65\u5668\uff0c\u4ee5\u4fbf\u53ef\u4ee5\u4f7f\u7528\u4e00\u5957\u952e\u76d8\u3001\u9f20\u6807\uff0c\u540c\u65f6\u3001\u540c\u6b65\u63a7\u5236\u591a\u53f0\u7535\u8111\u8fdb\u884c\u6e38\u620f\u7684\u884c\u4e3a\uff09\uff0c\u4ee5\u53ca\u4f7f\u7528\u5176\u4ed6\u5404\u79cd\u53ef\u4ee5\u8ba9\u60a8\u5728\u6e38\u620f\u6548\u7387\u6216\u6536\u76ca\u6570\u636e\u4e0a\u8868\u73b0\u5f02\u5e38\u7684\u786c\u4ef6\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u201c\u8fde\u70b9\u5668\u201d\u7b49\uff0c\u4ee5\u4e0b\u7edf\u79f0\u201c\u4f5c\u5f0a\u786c\u4ef6\u201d\uff09\uff1b\n\uff085\uff09\u4f20\u64ad\u975e\u6cd5\u8a00\u8bba\u6216\u4e0d\u5f53\u4fe1\u606f\uff1b\n\uff086\uff09\u76d7\u53d6\u4ed6\u4eba\u6e38\u620f\u8d26\u53f7\u3001\u6e38\u620f\u7269\u54c1\uff1b\n\uff087\uff09\u8fdb\u884c\u6e38\u620f\u8d26\u53f7\u4ea4\u6613\u3001\u8d26\u53f7\u5171\u4eab\u7b49\u5f71\u54cd\u8d26\u53f7\u5b89\u5168\u7684\u884c\u4e3a\uff1b\n\uff088\uff09\u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8bb8\u53ef\uff0c\u64c5\u81ea\u4e0e\u5176\u4ed6\u7528\u6237\u8fdb\u884c\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\u7b49\u4ea4\u6613\uff0c\u6216\u4ece\u7b2c\u4e09\u65b9\u901a\u8fc7\u8d2d\u4e70\u3001\u63a5\u53d7\u8d60\u4e0e\u6216\u8005\u5176\u4ed6\u5f0f\u83b7\u5f97\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\uff1b\n\uff089\uff09\u5728\u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6388\u6743\u6216\u8ba4\u53ef\u7684\u6298\u6263\u6e20\u9053\u8fdb\u884c\u6e38\u620f\u5145\u503c\u3001\u8fdb\u884c\u6298\u6263\u6e38\u620f\u9053\u5177\u4ea4\u6613\uff08\u4f8b\u5982\u5728\u975e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5b98\u65b9\u6e20\u9053\u4f4e\u4ef7\u8d2d\u4e70\u6298\u6263\u76ae\u80a4\uff09\u6216\u59d4\u6258\u672a\u83b7\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6388\u6743\u6216\u8ba4\u53ef\u7684\u7b2c\u4e09\u65b9\u4ee3\u4e3a\u5145\u503c\uff0c\u6216\u8005\u4f7f\u7528\u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6388\u6743\u6216\u8ba4\u53ef\u7684\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u5145\u503c\uff1b\n\uff0810\uff09\u4ee5\u67d0\u79cd\u65b9\u5f0f\u6697\u793a\u6216\u4f2a\u79f0\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5185\u90e8\u5458\u5de5\u6216\u67d0\u79cd\u7279\u6b8a\u8eab\u4efd\uff0c\u4f01\u56fe\u5f97\u5230\u4e0d\u6b63\u5f53\u5229\u76ca\u6216\u5f71\u54cd\u5176\u4ed6\u7528\u6237\u6743\u76ca\u7684\u884c\u4e3a\uff1b\n\uff0811\uff09\u8fdd\u53cd\u672c\u534f\u8bae\u4efb\u4f55\u7ea6\u5b9a\uff0c\u6216\u8fdd\u53cd\u56fd\u5bb6\u6cd5\u5f8b\u6cd5\u89c4\u4efb\u4f55\u89c4\u5b9a\u7684\u884c\u4e3a\uff1b\n\uff0812\uff09\u5176\u4ed6\u5728\u884c\u4e1a\u5185\u88ab\u5e7f\u6cdb\u8ba4\u53ef\u7684\u4e0d\u5f53\u884c\u4e3a\uff0c\u6216\u901a\u8fc7\u6e38\u620f\u89c4\u5219\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u7528\u6237\u5b88\u5219\u3001\u73a9\u5bb6\u6761\u4f8b\u3001\u6e38\u620f\u516c\u544a\u3001\u63d0\u793a\u53ca\u901a\u77e5\uff09\u516c\u5e03\u7684\u5176\u4ed6\u8fdd\u89c4\u884c\u4e3a\u3002\n\u524d\u6b3e\u89c4\u5b9a\u7684\u5904\u7406\u63aa\u65bd\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\uff1a\n\uff081\uff09\u8b66\u544a\uff1b\u53ca/\u6216\n\uff082\uff09\u7981\u8a00\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u6e38\u620f\u5168\u533a\u7981\u8a00\u3001\u5355\u533a\u7981\u8a00\u4ee5\u53ca\u516c\u5171\u9891\u9053\u7981\u8a00\uff1b\u53ca/\u6216\n\uff083\uff09\u5185\u5bb9\u91cd\u7f6e\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u91cd\u7f6e\u6216\u5f3a\u5236\u4fee\u6539\u60a8\u63d0\u4f9b\u6216\u4e0a\u4f20\u7684\u975e\u6cd5\u6635\u79f0\u3001\u623f\u95f4\u540d\u3001\u56fe\u7247\u7b49\u975e\u6cd5\u4fe1\u606f\u6216\u5185\u5bb9\u7b49\uff1b\u53ca/\u6216\n\uff084\uff09\u51cf\u5c11\u6216\u9650\u5236\u60a8\u7684\u6e38\u620f\u6536\u76ca\uff0c\u8be5\u6e38\u620f\u6536\u76ca\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u6e38\u620f\u4e2d\u4e0e\u6e38\u620f\u89d2\u8272\u6210\u957f\u5347\u7ea7\u76f8\u5173\u7684\u6240\u6709\u6570\u636e\uff08\u5982\u7ecf\u9a8c\u503c\u3001\u8363\u8a89\u503c\u3001\u58f0\u671b\u503c\u3001\u79f0\u53f7\u7b49\uff09\u7684\u63d0\u5347\u4ee5\u53ca\u6e38\u620f\u4e2d\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u6e38\u620f\u589e\u503c\u670d\u52a1\u7684\u83b7\u53d6\uff1b\u53ca/\u6216\n\uff085\uff09\u5220\u9664\u6216\u6ce8\u9500\u6e38\u620f\u8d26\u53f7\u3001\u6e38\u620f\u6570\u636e\u6216\u5176\u4ed6\u6e38\u620f\u76f8\u5173\u4fe1\u606f\uff1b\u53ca/\u6216\n\uff086\uff09\u9650\u5236\u6216\u7981\u6b62\u60a8\u8fdb\u5165\u6e38\u620f\u4e2d\u7684\u7279\u5b9a\u573a\u666f\u6216\u4f7f\u7528\u6e38\u620f\u7279\u5b9a\u529f\u80fd\uff1b\u53ca/\u6216\n\uff087\uff09\u5f3a\u5236\u9000\u51fa\u6e38\u620f\uff08\u5373\u201c\u8e22\u51fa\u6e38\u620f\u201d\uff09\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u5f3a\u5236\u9000\u51fa\u6574\u4e2a\u6e38\u620f\uff0c\u6216\u6e38\u620f\u4e2d\u7684\u5355\u5c40\u5bf9\u6218\uff0c\u6216\u60a8\u6b63\u5728\u8fdb\u884c\u4e2d\u7684\u5176\u4ed6\u6e38\u620f\u884c\u4e3a\uff1b\u53ca/\u6216\n\uff088\uff09\u6682\u65f6\u6216\u6c38\u4e45\u6027\u5730\u7981\u6b62\u60a8\u6e38\u620f\u8d26\u53f7\u767b\u5f55\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff08\u4ee5\u4e0b\u79f0\u201c\u5c01\u53f7\u201d\uff09\uff1b\u53ca/\u6216\n\uff089\uff09\u6682\u65f6\u6216\u6c38\u4e45\u6027\u5730\u7981\u6b62\u60a8\u8fdd\u6cd5\u8fdd\u89c4\u884c\u4e3a\u6d89\u53ca\u7684\u7279\u5b9a\u7ec8\u7aef\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8ePC\u7ec8\u7aef\u3001\u79fb\u52a8\u7ec8\u7aef\u7b49\uff09\u767b\u5f55\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff1b\u53ca/\u6216\n\uff0810\uff09\u6682\u505c\u6216\u7ec8\u6b62\u60a8\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ca\u76f8\u5173\u670d\u52a1\uff0c\u6216\u5355\u65b9\u901a\u77e5\u60a8\u7ec8\u6b62\u672c\u534f\u8bae\uff1b\u53ca/\u6216\n\uff0811\uff09\u5c31\u60a8\u7684\u8fdd\u6cd5\u8fdd\u89c4\u884c\u4e3a\u63d0\u8d77\u76f8\u5e94\u6c11\u4e8b\u8bc9\u8bbc\uff0c\u8ffd\u7a76\u60a8\u7684\u4fb5\u6743\u3001\u8fdd\u7ea6\u6216\u5176\u4ed6\u6c11\u4e8b\u8d23\u4efb\uff0c\u5e76\u8981\u6c42\u60a8\u8d54\u507f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u516c\u53f8\u56e0\u60a8\u8fdd\u6cd5\u8fdd\u89c4\u884c\u4e3a\u6240\u53d7\u5230\u7684\u635f\u5931\uff08\u5305\u62ec\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u516c\u53f8\u6240\u53d7\u5230\u7684\u76f4\u63a5\u7ecf\u6d4e\u635f\u5931\u3001\u540d\u8a89\u6216\u5546\u8a89\u635f\u5931\u4ee5\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u516c\u53f8\u5bf9\u5916\u652f\u4ed8\u7684\u8d54\u507f\u91d1\u3001\u548c\u89e3\u8d39\u7528\u3001\u5f8b\u5e08\u8d39\u7528\u3001\u8bc9\u8bbc\u8d39\u7528\u53ca\u5176\u4ed6\u95f4\u63a5\u635f\u5931\uff09\uff0c\u6216\u79fb\u4ea4\u6709\u5173\u884c\u653f\u7ba1\u7406\u673a\u5173\u7ed9\u4e88\u884c\u653f\u5904\u7f5a\uff0c\u6216\u8005\u79fb\u4ea4\u53f8\u6cd5\u673a\u5173\u8ffd\u7a76\u60a8\u7684\u5211\u4e8b\u8d23\u4efb\uff1b\u53ca/\u6216\n\uff0812\uff09\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u901a\u8fc7\u6e38\u620f\u89c4\u5219\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u7528\u6237\u5b88\u5219\u3001\u73a9\u5bb6\u6761\u4f8b\u3001\u6e38\u620f\u516c\u544a\u3001\u63d0\u793a\u53ca\u901a\u77e5\uff09\u516c\u5e03\u7684\u5176\u4ed6\u5904\u7406\u63aa\u65bd\u3002\n\u60a8\u77e5\u6089\u5e76\u540c\u610f\uff0c\u7531\u4e8e\u5916\u6302\u53ca\u6e38\u620f\u540c\u6b65\u5668\u7b49\u4f5c\u5f0a\u786c\u4ef6\u5177\u6709\u9690\u853d\u6027\u6216\u7528\u5b8c\u540e\u5373\u6d88\u5931\u7b49\u7279\u70b9\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u6839\u636e\u60a8\u7684\u6e38\u620f\u6570\u636e\u548c\u8868\u73b0\u5f02\u5e38\u5224\u65ad\u60a8\u6709\u65e0\u4f7f\u7528\u975e\u6cd5\u5916\u6302\u6216\u6e38\u620f\u540c\u6b65\u5668\u7b49\u4f5c\u5f0a\u786c\u4ef6\u884c\u4e3a\u3002\n6.6 \u60a8\u77e5\u6089\u5e76\u540c\u610f\uff0c\u5982\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4f9d\u636e\u672c\u534f\u8bae\u5bf9\u60a8\u7684\u6e38\u620f\u8d26\u53f7\u91c7\u53d6\u5c01\u53f7\u5904\u7406\u63aa\u65bd\u7684\uff0c\u5177\u4f53\u5c01\u53f7\u671f\u95f4\u7531\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6839\u636e\u60a8\u8fdd\u89c4\u884c\u4e3a\u60c5\u8282\u800c\u5b9a\u3002\n\u60a8\u77e5\u6089\u5e76\u540c\u610f\uff1a\uff081\uff09\u5728\u5c01\u53f7\u671f\u95f4\uff0c\u60a8\u6e38\u620f\u8d26\u53f7\u4e2d\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u90fd\u5c06\u65e0\u6cd5\u4f7f\u7528\uff1b\uff082\uff09\u5982\u524d\u8ff0\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u5b58\u5728\u4e00\u5b9a\u6709\u6548\u671f\uff0c\u8be5\u6709\u6548\u671f\u53ef\u80fd\u4f1a\u5728\u5c01\u53f7\u671f\u95f4\u8fc7\u671f\uff0c\u60a8\u6e38\u620f\u8d26\u53f7\u89e3\u5c01\u540e\uff0c\u60a8\u5c06\u65e0\u6cd5\u4f7f\u7528\u8be5\u7b49\u5df2\u8fc7\u671f\u7684\u6e38\u620f\u865a\u62df\u9053\u5177\u53ca\u5176\u4ed6\u589e\u503c\u670d\u52a1\u3002\n\n\u4e03\u3001\u77e5\u8bc6\u4ea7\u6743\n7.1 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u662f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u77e5\u8bc6\u4ea7\u6743\u6743\u5229\u4eba\u3002\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u6574\u4f53\u3001\u6e38\u620f\u5185\u6240\u5305\u542b\u7684\u6240\u6709\u7f8e\u672f\u3001\u97f3\u4e50\u3001\u6587\u5b57\u4f5c\u54c1\u548c\u5176\u4ed6\u6e38\u620f\u6784\u6210\u8981\u7d20\u3001\u7ec4\u6210\u90e8\u5206\uff0c\u4ee5\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u8fd0\u884c\u5448\u73b0\u7684\u8fde\u7eed\u52a8\u6001\u753b\u9762\uff09\u7684\u4e00\u5207\u8457\u4f5c\u6743\u3001\u5546\u6807\u6743\u3001\u4e13\u5229\u6743\u3001\u5546\u4e1a\u79d8\u5bc6\u7b49\u77e5\u8bc6\u4ea7\u6743\u53ca\u5176\u4ed6\u5408\u6cd5\u6743\u76ca\uff0c\u4ee5\u53ca\u4e0e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u76f8\u5173\u7684\u6240\u6709\u4fe1\u606f\u5185\u5bb9\uff08\u5305\u62ec\u6587\u5b57\u3001\u56fe\u7247\u3001\u97f3\u9891\u3001\u89c6\u9891\u3001\u56fe\u8868\u3001\u754c\u9762\u8bbe\u8ba1\u3001\u7248\u9762\u6846\u67b6\u3001\u6709\u5173\u6570\u636e\u6216\u7535\u5b50\u6587\u6863\u7b49\uff09\u5747\u53d7\u4e2d\u534e\u4eba\u6c11\u5171\u548c\u56fd\u6cd5\u5f8b\u6cd5\u89c4\u548c\u76f8\u5e94\u7684\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4eab\u6709\u4e0a\u8ff0\u77e5\u8bc6\u4ea7\u6743\u548c\u5408\u6cd5\u6743\u76ca\uff0c\u4f46\u76f8\u5173\u6743\u5229\u4eba\u4f9d\u7167\u6cd5\u5f8b\u89c4\u5b9a\u5e94\u4eab\u6709\u7684\u6743\u5229\u9664\u5916\u3002\u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e8b\u5148\u4e66\u9762\u540c\u610f\uff0c\u60a8\u4e0d\u5f97\u4ee5\u4efb\u4f55\u65b9\u5f0f\u5c06\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u6574\u4f53\u3001\u6e38\u620f\u5185\u6240\u5305\u542b\u7684\u6240\u6709\u7f8e\u672f\u3001\u97f3\u4e50\u3001\u6587\u5b57\u4f5c\u54c1\u548c\u5176\u4ed6\u6e38\u620f\u6784\u6210\u8981\u7d20\u3001\u7ec4\u6210\u90e8\u5206\uff0c\u4ee5\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u8fd0\u884c\u5448\u73b0\u7684\u8fde\u7eed\u52a8\u6001\u753b\u9762 \uff09\u8fdb\u884c\u5546\u4e1a\u6027\u4f7f\u7528\u6216\u901a\u8fc7\u4fe1\u606f\u7f51\u7edc\u4f20\u64ad\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u5185\u5bb9\u3002\n7.2 \u5982\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u5b58\u5728\u53ef\u4f9b\u60a8\u81ea\u884c\u5236\u4f5c\u3001\u521b\u4f5c\u6216\u4e0a\u4f20\u76f8\u5173\u5185\u5bb9\u7684\u5e73\u53f0\u529f\u80fd\u6216\u670d\u52a1\u7684\uff08\u4ee5\u4e0b\u79f0\u201dUGC\u5e73\u53f0\u201d\uff09\uff0c\u9488\u5bf9\u60a8\u4f7f\u7528UGC\u5e73\u53f0\u5236\u4f5c\u3001\u521b\u4f5c\u3001\u4e0a\u4f20\u6216\u53d1\u5e03\u7684\u5185\u5bb9\uff08\u4ee5\u4e0b\u79f0\u201cUGC\u5185\u5bb9\u201d\uff09\uff0c\u60a8\u5e94\u786e\u4fdd\u5176\u5408\u6cd5\u4e14\u4e0d\u4fb5\u72af\u4ed6\u4eba\u5408\u6cd5\u6743\u76ca\u5e76\u5e94\u9075\u5b88\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5728UGC\u5e73\u53f0\u4e0a\u53d1\u5e03\u7684\u76f8\u5173\u89c4\u5219\uff08\u4ee5\u4e0b\u79f0\u201cUGC\u5e73\u53f0\u89c4\u5219\u201d\uff09\uff0c\u4e14\u60a8\u540c\u610f\uff1a\n\uff081\uff09\u5982UGC\u5185\u5bb9\u542b\u6709\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u5185\u5bb9\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u6574\u4f53\u3001\u6e38\u620f\u5185\u6240\u5305\u542b\u7684\u6240\u6709\u7f8e\u672f\u3001\u97f3\u4e50\u3001\u6587\u5b57\u4f5c\u54c1\u548c\u5176\u4ed6\u6e38\u620f\u6784\u6210\u8981\u7d20\u3001\u7ec4\u6210\u90e8\u5206\uff0c\u4ee5\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u8fd0\u884c\u5448\u73b0\u7684\u8fde\u7eed\u52a8\u6001\u753b\u9762\uff09\u53ca\uff08\u6216\uff09\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u516c\u53f8\u4eab\u6709\u77e5\u8bc6\u4ea7\u6743\u7684\u5176\u4ed6\u5185\u5bb9\u7684\uff0c\u5219\u60a8\u5bf9UGC\u5185\u5bb9\u8fdb\u884c\u5546\u4e1a\u76ee\u7684\u4f7f\u7528\u9700\u8981\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u516c\u53f8\u4e66\u9762\u6388\u6743\u540c\u610f\uff0c\u5e76\u9075\u5b88\u76f8\u5e94\u7684UGC\u5e73\u53f0\u89c4\u5219\u3002\n\uff082\uff09\u9488\u5bf9UGC\u5185\u5bb9\uff0c \u60a8\u540c\u610f\u4e0d\u53ef\u64a4\u9500\u5730\u6388\u6743\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4ee5\u4efb\u4f55\u65b9\u5f0f\u4f7f\u7528\u8be5UGC\u5185\u5bb9\uff08\u524d\u8ff0\u201c\u4f7f\u7528\u201d\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u590d\u5236\u3001\u53d1\u884c\u3001\u51fa\u79df\u3001\u5c55\u89c8\u3001\u8868\u6f14\u3001\u5e7f\u64ad\u3001\u4fee\u6539\u3001\u6539\u7f16\u3001\u4fe1\u606f\u7f51\u7edc\u4f20\u64ad\u53ca\u5176\u4ed6\u65b9\u5f0f\u4f7f\u7528\uff0c\u540c\u65f6\u5305\u62ec\u5546\u4e1a\u76ee\u7684\u548c\u975e\u5546\u4e1a\u76ee\u7684\u4f7f\u7528\uff0c\u672c\u6e38\u620f\u5185\u548c\u672c\u6e38\u620f\u5916\u4f7f\u7528\uff0c\u4e5f\u5305\u62ec\u5728UGC\u5e73\u53f0\u5185\u548cUGC\u5e73\u53f0\u5916\u4f7f\u7528\u3002\u4e3a\u65b9\u4fbf\u63cf\u8ff0\uff0c\u4ee5\u4e0b\u5c06\u524d\u8ff0\u4f7f\u7528\u7684\u6743\u5229\u7edf\u79f0\u201c\u4f7f\u7528\u6743\u201d\uff09\uff0c\u540c\u65f6\u6388\u6743\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u4ee5\u5c06\u524d\u8ff0\u4f7f\u7528\u6743\u8f6c\u6388\u6743\u6216\u5206\u8bb8\u53ef\u7b2c\u4e09\u65b9\u4f7f\u7528\u3002\u60a8\u627f\u8bfa\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u7684\u8be5\u7b49\u4f7f\u7528\u4e0d\u4f1a\u4fb5\u5bb3\u4efb\u4f55\u7b2c\u4e09\u65b9\u77e5\u8bc6\u4ea7\u6743\u53ca\u5176\u4ed6\u5408\u6cd5\u6743\u76ca\u3002\n\uff083\uff09 \u9488\u5bf9UGC\u5185\u5bb9\uff0c\u60a8\u4ec5\u53ef\u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ca\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8ba4\u53ef\u7684\u5176\u4ed6\u5e73\u53f0\u5bf9\u8be5UGC\u5185\u5bb9\u4f5c\u51fa\u5c55\u793a\u6216\u6309\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8ba4\u53ef\u65b9\u5f0f\u4f7f\u7528\uff0c\u4e0d\u5f97\u5728\u672a\u7ecf\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u8bb8\u53ef\u60c5\u51b5\u4e0b\u64c5\u81ea\u6216\u6388\u6743\u7b2c\u4e09\u65b9\u5728\u5176\u4ed6\u5e73\u53f0\u8fdb\u884c\u4f20\u64ad\uff0c\u4e5f\u4e0d\u5f97\u64c5\u81ea\u6216\u6388\u6743\u7b2c\u4e09\u65b9\u8fdb\u884c\u4efb\u4f55\u51fa\u7248\u3001\u5546\u4e1a\u76c8\u5229\u3001\u4e8c\u6b21\u884d\u751f\u53ca\u5176\u4ed6\u4f7f\u7528\u7684\u884c\u4e3a\u3002\u5982\u8fdd\u53cd\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5c06\u4fdd\u7559\u6cd5\u5f8b\u4e0a\u7684\u8ffd\u8bc9\u6743\u5229\u3002\n\uff084\uff09\u9488\u5bf9UGC\u5185\u5bb9\uff0c\u60a8\u4e0d\u53ef\u64a4\u9500\u5730\u6388\u6743\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4ee5\u81ea\u5df1\u7684\u540d\u4e49\u6216\u59d4\u6258\u4e13\u4e1a\u7b2c\u4e09\u65b9\u5bf9\u4fb5\u72afUGC\u5185\u5bb9\u5408\u6cd5\u6743\u76ca\u7684\u884c\u4e3a\u8fdb\u884c\u7ef4\u6743\uff0c\u7ef4\u6743\u5f62\u5f0f\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\uff1a\u76d1\u6d4b\u4fb5\u6743\u884c\u4e3a\u3001\u53d1\u9001\u7ef4\u6743\u51fd\u3001\u63d0\u8d77\u8bc9\u8bbc\u6216\u4ef2\u88c1\u3001\u8c03\u89e3\u3001\u548c\u89e3\u7b49\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5bf9\u7ef4\u6743\u4e8b\u5b9c\u505a\u51fa\u51b3\u7b56\u5e76\u72ec\u7acb\u5b9e\u65bd\u3002\n\uff085\uff09\u5982\u6839\u636e\u8457\u4f5c\u6743\u6cd5\u7b49\u6cd5\u5f8b\u89c4\u5b9a\uff0c\u60a8\u5bf9UGC\u5185\u5bb9\u4eab\u6709\u53d1\u8868\u6743\u3001\u7f72\u540d\u6743\u3001\u4fee\u6539\u6743\u548c\u4fdd\u62a4\u4f5c\u54c1\u5b8c\u6574\u6743\u7b49\u8457\u4f5c\u4eba\u8eab\u6743\u7684\uff0c\u60a8\u540c\u610f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u53ef\u81ea\u884c\u6839\u636eUGC\u7684\u5177\u4f53\u4f7f\u7528\u60c5\u51b5\u6216\u4f7f\u7528\u573a\u666f\u662f\u5426\u4e3a\u60a8\u8fdb\u884c\u7f72\u540d\u4ee5\u53ca\u4ee5\u4ec0\u4e48\u65b9\u5f0f\u8fdb\u884c\u7f72\u540d\uff0c\u4e14\u60a8\u4e0d\u4f1a\u56e0\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6309\u672c\u534f\u8bae\u7ea6\u5b9a\u4f7f\u7528UGC\u5185\u5bb9\u800c\u5411\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e3b\u5f20\u53d1\u8868\u6743\u3001\u7f72\u540d\u6743\u3001\u4fee\u6539\u6743\u548c\u4fdd\u62a4\u4f5c\u54c1\u5b8c\u6574\u6743\u7b49\u8457\u4f5c\u4eba\u8eab\u6743\u3002\n7.3 \u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u4e2d\u4ea7\u751f\u7684\u6e38\u620f\u6570\u636e\u7684\u6240\u6709\u6743\u548c\u77e5\u8bc6\u4ea7\u6743\u5f52\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6240\u6709\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u4fdd\u5b58\u3001\u5904\u7f6e\u8be5\u6e38\u620f\u6570\u636e\uff0c\u4f46\u56fd\u5bb6\u6cd5\u5f8b\u6cd5\u89c4\u53e6\u6709\u89c4\u5b9a\u7684\u4ece\u5176\u89c4\u5b9a\u3002\n\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5bf9\u5176\u5408\u6cd5\u5904\u7406\u6e38\u620f\u6570\u636e\u5f62\u6210\u7684\u76f8\u5173\u6570\u636e\u4ea7\u54c1\u548c\u670d\u52a1\u4eab\u6709\u6cd5\u5f8b\u6cd5\u89c4\u89c4\u5b9a\u7684\u8d22\u4ea7\u6743\u76ca\u3002\n7.4 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u53ef\u80fd\u6d89\u53ca\u7b2c\u4e09\u65b9\u77e5\u8bc6\u4ea7\u6743\uff0c\u800c\u8be5\u7b49\u7b2c\u4e09\u65b9\u5bf9\u60a8\u57fa\u4e8e\u672c\u534f\u8bae\u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u4e2d\u4f7f\u7528\u8be5\u7b49\u77e5\u8bc6\u4ea7\u6743\u6709\u8981\u6c42\u7684\uff0c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5c06\u4ee5\u9002\u5f53\u65b9\u5f0f\u5411\u60a8\u544a\u77e5\u8be5\u8981\u6c42\uff0c\u60a8\u5e94\u5f53\u4e00\u5e76\u9075\u5b88\u3002\n\n\u516b\u3001\u9075\u5b88\u5f53\u5730\u6cd5\u5f8b\u76d1\u7ba1\n8.1 \u60a8\u5728\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u8fc7\u7a0b\u4e2d\u5e94\u5f53\u9075\u5b88\u5f53\u5730\u76f8\u5173\u7684\u6cd5\u5f8b\u6cd5\u89c4\uff0c\u5e76\u5c0a\u91cd\u5f53\u5730\u7684\u9053\u5fb7\u548c\u98ce\u4fd7\u4e60\u60ef\u3002\u5982\u679c\u60a8\u7684\u884c\u4e3a\u8fdd\u53cd\u4e86\u5f53\u5730\u6cd5\u5f8b\u6cd5\u89c4\u6216\u9053\u5fb7\u98ce\u4fd7\uff0c\u60a8\u5e94\u5f53\u4e3a\u6b64\u72ec\u7acb\u627f\u62c5\u8d23\u4efb\u3002\n8.2 \u60a8\u5e94\u907f\u514d\u56e0\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\u800c\u4f7f\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u5377\u5165\u653f\u6cbb\u548c\u516c\u5171\u4e8b\u4ef6\uff0c\u5426\u5219\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u6682\u505c\u6216\u7ec8\u6b62\u5bf9\u60a8\u7684\u670d\u52a1\u3002\n\n\u4e5d\u3001\u7ba1\u8f96\u4e0e\u6cd5\u5f8b\u9002\u7528\n9.1 \u672c\u534f\u8bae\u7b7e\u8ba2\u5730\u4e3a\u4e2d\u534e\u4eba\u6c11\u5171\u548c\u56fd\u5e7f\u4e1c\u7701\u6df1\u5733\u5e02\u5357\u5c71\u533a\u3002\n9.2 \u672c\u534f\u8bae\u7684\u6210\u7acb\u3001\u751f\u6548\u3001\u5c65\u884c\u3001\u89e3\u91ca\u53ca\u7ea0\u7eb7\u89e3\u51b3\uff0c\u9002\u7528\u4e2d\u534e\u4eba\u6c11\u5171\u548c\u56fd\u5927\u9646\u5730\u533a\u6cd5\u5f8b\uff08\u4e0d\u5305\u62ec\u51b2\u7a81\u6cd5\uff09\u3002\n9.3 \u60a8\u548c\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u4e4b\u95f4\u56e0\u672c\u534f\u8bae\u53d1\u751f\u7684\uff08\u548c/\u6216\u4e0e\u672c\u534f\u8bae\u6709\u5173\u7684\uff09\u4efb\u4f55\u7ea0\u7eb7\u6216\u4e89\u8bae\uff0c\u9996\u5148\u53cb\u597d\u534f\u5546\u89e3\u51b3\uff1b\u534f\u5546\u4e0d\u6210\u7684\uff0c\u60a8\u540c\u610f\u5c06\u7ea0\u7eb7\u6216\u4e89\u8bae\u63d0\u4ea4\u81f3\u672c\u534f\u8bae\u7b7e\u8ba2\u5730\u6709\u7ba1\u8f96\u6743\u7684\u4eba\u6c11\u6cd5\u9662\u7ba1\u8f96\u3002\n9.4 \u672c\u534f\u8bae\u6240\u6709\u6761\u6b3e\u7684\u6807\u9898\u4ec5\u4e3a\u9605\u8bfb\u65b9\u4fbf\uff0c\u672c\u8eab\u5e76\u65e0\u5b9e\u9645\u6db5\u4e49\uff0c\u4e0d\u80fd\u4f5c\u4e3a\u672c\u534f\u8bae\u6db5\u4e49\u89e3\u91ca\u7684\u4f9d\u636e\u3002\n9.5 \u672c\u534f\u8bae\u6761\u6b3e\u65e0\u8bba\u56e0\u4f55\u79cd\u539f\u56e0\u90e8\u5206\u65e0\u6548\uff0c\u5176\u4f59\u6761\u6b3e\u4ecd\u6709\u6548\uff0c\u5bf9\u5404\u65b9\u5177\u6709\u7ea6\u675f\u529b\u3002\n\n\u5341\u3001 \u5176\u4ed6\n10.1 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u6743\u5728\u5fc5\u8981\u65f6\u53d8\u66f4\u672c\u534f\u8bae\u6761\u6b3e\uff0c\u60a8\u53ef\u4ee5\u5728\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u7684\u76f8\u5173\u9875\u9762\u67e5\u9605\u6700\u65b0\u7248\u672c\u7684\u534f\u8bae\u6761\u6b3e\u3002\u672c\u534f\u8bae\u6761\u6b3e\u53d8\u66f4\u540e\uff0c\u5982\u679c\u60a8\u7ee7\u7eed\u4f7f\u7528\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6e38\u620f\u670d\u52a1\uff0c\u5373\u89c6\u4e3a\u60a8\u5df2\u63a5\u53d7\u53d8\u66f4\u540e\u7684\u534f\u8bae\u3002\n10.2 \u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u63d0\u9192\u60a8\uff1a\u62b5\u5236\u4e0d\u826f\u6e38\u620f\uff0c\u62d2\u7edd\u76d7\u7248\u6e38\u620f\uff1b\u6ce8\u610f\u81ea\u6211\u4fdd\u62a4\uff0c\u8c28\u9632\u53d7\u9a97\u4e0a\u5f53\uff1b\u9002\u5ea6\u6e38\u620f\u76ca\u8111\uff0c\u6c89\u8ff7\u6e38\u620f\u4f24\u8eab\uff1b\u5408\u7406\u5b89\u6392\u65f6\u95f4\uff0c\u4eab\u53d7\u5065\u5eb7\u751f\u6d3b\u3002\n\n\u5e7f\u5dde\u9053\u6cc9\u7f51\u7edc\u79d1\u6280\u6709\u9650\u516c\u53f8",
default: 'TERMS OF SERVICE\n1. GENERAL\n1.1. These terms and conditions including the privacy policy (altogether, the "Terms") constitute a legally binding agreement between you, as a user of the Service (as defined below) ("you") and Clever Apps Pte. Ltd., the provider of the Service ("we" or "us" or "Clever Apps").\n1.2. By loading, installing, accessing and using our games, applications, content, activities, and services (the "Service") which are made available through third party social networking websites, such as Facebook, and/or by application stores, such as Google Play or Apple AppStore, and/or directly by us, you confirm that you have read, understand and agree to be bound by these Terms. If you do not agree with these Terms, you are prohibited from accessing and using the Service.\n1.3. You must be 13 years or older in order to use the Service. If you are between 13 and 18 you must seek permission of a parent or legal guardian before using the Service. Parents and legal guardians warrant and represent that they have reviewed and agreed to these Terms.\n\n2. INFORMATION ABOUT US\n2.1. We are Clever Apps Pte. Ltd., a company registered in Singapore under registration number 201706967K. Our registered address is 8 Marina Boulevard #11-00 Marina Bay Financial Centre Singapore 018981.\n2.2. If you have any questions, complaints or comments on this Service then please contact us at vtbelo+support@gmail.com.\n\n3. PAYMENT AND CREDITS\n3.1. Depending on the Service you use you may be given tokens to play (without charge) in order to be able to participate ("free credits") or you may otherwise be permitted to play for free. Where applicable, a certain number of free credits may be made available to each user (depending on the Service to be used) on a daily basis. We may also award free credits or permit you to use a Service without charge in connection with promotions and as part of any game. We will clarify to you where in certain games it is not possible to roll over free credits from one day to the next (although this may be subject to change, at our discretion), but you may roll over paid credits in this way (see below).\n3.2. The Service is free to use until you (i) use up your allocation of free credits; (ii) wish to use additional features or functionality or access different levels of the Service, in which case you may be required to purchase additional credits; or (iii) you are otherwise notified that payment is required in order to participate or access different levels of a Service. Credits which you purchase are referred to as "paid credits" in these Terms and free credits and paid credits are together referred to as "credits".\n3.3. You may be able to purchase or otherwise acquire a single form of credit for use across all of our Services ("coins", "gold" etc). Coins may be changed into Service specific (or "in-game") credits. However, once a user changes coins for Service specific credits, those credits cannot be changed back into coins for use in other Services.\n3.4. When you purchase paid credits or otherwise pay to participate you are responsible for paying all fees and charges including any applicable taxes associated with such purchases and payments. Unless otherwise stated, you may only purchase paid credits or pay to participate using a valid PayPal account, or any other payment method approved by us. By paying to participate, purchasing or otherwise acquiring credits as set out above, you obtain a limited license to access and select from content that we expressly make available as part of the Service.\n3.5. Credits, coins and any prizes, awards and achievements ("Prizes") made available in using the Service are notional credits and Prizes and have no monetary value. Prizes cannot be redeemed or exchanged for cash, property or other items. Credits, coins and payments to participate may only be redeemed for service content or Services provided by us. This is the case whether or not you have paid to participate or purchased paid credits in order to use the Service. Credits cannot be withdrawn, sold or transferred. Payments made in order to participate, coins and paid credits are non-refundable. You are not entitled to a refund for any unused payments, coins or credits, including in the event of closed and cancelled accounts. \n\n4. USER CONTENT RULE\n4.1. We may invite you to participate in blogs, message boards, online forums and other functionality through which you will be able to communicate with other users of the Service ("Communication Services") by submitting various material for public display, in particular (without limitation) comments and messages ("User Content").\n4.2. We reserve the right to review and keep a record of all User Content. We are not under any obligation to display User Content. As a condition of your use of any Communication Services, you agree to adhere to the following rules:\n4.2.1. You agree that you will not submit any User Content, email, transmit or otherwise disseminate any material which is:\n4.2.1.1. defamatory, obscene, vulgar or indecent; or\n4.2.1.2. may have the effect of being harassing, threatening, abusive or hateful; or\n4.2.1.3. that otherwise discriminates against, degrades or intimidates an individual or group of individuals on the basis of religion, gender, sexual orientation, race, ethnicity, age or disability;\n4.2.1.4. which breaches the rights of others (including copyright and other intellectual property rights); or\n4.2.1.5. would otherwise cause you to breach of these Terms.\n4.2.2. You shall not submit User Content containing statements that advertise, promote or otherwise relate to any other online sites or ventures, discuss illegal activities or post personal details.\n4.2.3. You shall not submit User Content containing or in order to make statements about Us or any internet site connected to the Clever Apps Pte. Ltd. (as defined in our Privacy Policy) that are untrue and/or malicious and/or damaging to the Us or any member of the Clever Apps Pte. Ltd..\n4.3. We reserve the right to monitor or moderate User Content to check whether it complies with these Terms. You may report a user\'s behaviour using the reporting function provided as part of the Service (if any) or any reporting function provided on the social network website you are using to access the Service. However, we are under no obligation to oversee, monitor or moderate User Content or any Communication Service we provide. We recommend that you use the "mute" feature of a Communication Service or turn off any Communication Service (where these options are made available to you) to stop any unwanted User Content.\n4.4. We may remove or refuse to display your User Content if it causes you to breach these Terms including any of your promises as set out in this paragraph 4 or for any other reason in our reasonable discretion.\n4.5. We expressly exclude our liability for any loss or damage arising from the publication of any User Content or the use of any Communication Service by you in contravention of these Terms, whether the Service is moderated or not.\n\n5. LICENCE OF USER CONTENT\n5.1. You grant us a non-exclusive, worldwide, royalty-free, perpetual licence (with rights to sublicense on identical terms and in multiple tiers) to use, exploit, adapt, perform, display, reproduce, communicate to the public and distribute the User Content through any media now or in future known, which includes the right to display the User Content on and in connection with the Service, the right to display the User Content on any other website or other domain accessible via any internet-enabled device, the right to display the User Content in marketing material in relation to the Service and the right to include the User Content in a book or other publication.\n5.2. You waive in perpetuity in respect of the User Content the benefits of any provision of law known as moral rights or any similar law in any country (moral rights are certain rights that the owner of a copyright work has in relation to how that work is used).\n5.3. You promise to us that you own the User Content and have the right to grant the licence set out in paragraph 5.1 above and that the User Content does not infringe the rights of any third party.\n5.4. You promise that any User Content submitted by you does not cause you to breach these Terms including, in particular (without limitation) the promise made by you at paragraph 5.3.\n\n6. RESTRICTIONS ON USE OF SERVICE\n6.1. By using the Service (including the Communication Services), you agree that:\n6.1.1 you will comply with all applicable local laws, regulations and rules in the country in which you reside when using the Service;\n6.1.2. you will not use the Service for any purpose other than your personal use;\n6.1.3. you will not use the Service in any way that is unlawful or fraudulent or may lead to the encouragement, procurement or carrying out of any criminal activity;\n6.1.4. you will not use the Service in order to distribute unsolicited communications including \'spam\' email or other material in non compliance with these Terms;\n6.1.5. You will not transfer to, or use the Service for the purpose of transferring, files that contain viruses, trojans or other harmful programs or otherwise use the Service in any way that may damage or disrupt another\'s computer; or access or attempt to access the accounts of other users or to penetrate or attempt to penetrate the Service\'s security measures.\n6.2. If we determine, in our sole and absolute discretion, that you have breached, or reasonably believe that you will breach these Terms, we may:\n6.2.1. immediately withdraw your right (on a temporary or permanent basis) to use the Service;\n6.2.2. immediately (on a temporary or permanent basis) remove any User Content posted or uploaded by you;\n6.2.3. issue of a warning to you;\n6.2.4. issue legal proceedings against you for reimbursement of all costs on an indemnity basis (including, but not limited to, reasonable administrative and legal costs) resulting from the breach;\n6.2.5. take further legal action against you; and/or\n6.2.6. disclose such information to law enforcement authorities as we reasonably feel is necessary.\n\n7. TRADE MARKS AND OTHER INTELLECTUAL PROPERTY\n7.1. Your use of the Service and its contents grants no rights to you in relation to our intellectual property rights (including, amongst other things, any copyright, trade marks and other rights in relation to the code, software, logos, designs, images, photographs, animations, videos and text in or on the Service) ("Intellectual Property Rights") or the rights of third parties in the Service or its contents.\n7.2. You may not copy, reproduce, republish, download, post, broadcast, record, transmit, commercially exploit, edit, communicate to the public or distribute in any way the services, web pages or materials on the Service or the computer code of elements comprising the Service, other than for your own personal use. Subject to the foregoing, you may download insubstantial excerpts of this content to your hard disk for the purpose of viewing it provided that no more than one copy of any information is made.\n7.3. Any use other than that permitted under this paragraph 7.2may only be undertaken with our prior express authorisation in writing.\n\n8. LINKS TO AND FROM OTHER WEBSITES\n8.1. We may provide links to third party websites via the Service or permit third party advertisers to display advertisements as part of the Service. Links are provided for your ease of reference and convenience only.\n8.2. We do not control third party websites or third party advertisements and are not responsible for their contents. Our inclusion of links and advertisements does not imply any endorsement of the material contained in such websites or advertisements or any association with their operators.\n8.3. You should read the terms and conditions and privacy policies of any third party websites or applications accessed via links or advertisements displayed via the Service.\n\n9. OUR LEGAL OBLIGATIONS AND LIMITS ON LIABILITY\n9.1. Nothing in these Terms shall exclude or limit our liability for:\n9.1.1. fraud or fraudulent misrepresentation; or\n9.1.2. death or personal injury resulting from our negligence or the negligence by us, our employees or agents;\n9.1.3. or any other matter which cannot be excluded or limited by law.\n9.2. Subject to paragraph 9.1 and to the extent permitted by law, we, other members of our group of companies and third parties connected to us hereby expressly exclude:\n9.2.1. all conditions, warranties and other terms which might otherwise be implied by statute, common law or the law of equity.\n9.2.2. any liability for any direct, indirect or consequential loss or damage incurred by you in connection with the Service (including any materials posted on it) including: \n9.2.2.1. any loss or damage to your computer system;\n9.2.2.2. loss of data;\n9.2.2.3. loss of income or revenue;\n9.2.2.4. loss of business; or\n9.2.2.5. loss of profits or contracts\nwhether caused by tort (including negligence), breach of contract or otherwise, even if foreseeable, provided that this condition shall not prevent claims for loss of or damage to your tangible property or any other claims for direct financial loss that are not excluded by any of the categories set out above.\n9.3. We cannot guarantee that any files that you download are free from viruses, contamination or destructive features.\n9.4. Whilst we use all reasonable endeavours to correct any errors or omissions as soon as practicable once they have been brought to our attention, we do not promise that any information provided as part of the Service itself will be free from errors or omissions.\n9.5. While every effort is made to reliably provide the Service, outages and unexpected downtime will occur. We do not make any guarantee of uninterrupted service. In particular, lost credits, coins and tickets may occur from time to time. Access to the Service may be suspended temporarily and without notice in the case of system failure, maintenance or repair or for reasons reasonably beyond our control (including outages or software errors that result from actions taken by social networking websites).\n9.6. The material displayed through our Service is provided without any guarantees, conditions or warranties as to its accuracy. Commentary and other materials posted as part of the Service are not intended to amount to advice on which reliance should be placed. We therefore disclaim all liability and responsibility arising from any reliance placed on such materials by any user of the Service, or by anyone who may be informed of any of its contents.\n9.7. We reserve the right to discontinue, withdraw, terminate or modify the Service or any part of the Service at any time with or without notice or further liability to you.\n\n10. INDEMNITY\n10.1. You agree to indemnify and hold us and any member of the Clever Apps Pte. Ltd. harmless from any claims, proceedings, actions or demands including reasonable legal fees made by any third party due to or arising out of your breach of these Terms or your violation of the rights of another. You agree that the provisions in this paragraph will survive any termination of your access to the Service.\n\n11. GOVERNING LAW AND JURISDICTION\n11.1. The Singapore courts will have exclusive jurisdiction over any claim arising from, or related to, your use of the Service.\n11.2. These Terms and any dispute or claim arising out of or in connection with them or their subject matter or formation (including non-contractual disputes or claims) shall be governed by and construed in accordance with the law of Singapore.\n\n12. SEVERANCE\n12.1. If any court or competent authority finds that any provision of these Terms (or part of any provision) is invalid, illegal or unenforceable, that provision or part-provision shall, to the extent required, be deemed to be deleted, and the validity and enforceability of the other provisions of this agreement shall not be affected.\n12.2. If any invalid, unenforceable or illegal provision of this agreement would be valid, enforceable and legal if some part of it were deleted, the provision shall apply with the minimum modification necessary to make it legal, valid and enforceable.\n\n13. TERMS AND AMENDMENT\n13.1. These Terms shall be valid from the first time that you become a user of the Service until such time as you cease being a user or until such time as we may amend them at which time the amended Terms shall apply. We reserve the right to change these Terms at any time. Such changes shall have effect immediately upon publication on the Service and you agree to be bound by them and to regularly review these terms for the purposes of monitoring such changes. Your continued use of the Services shall be deemed irrevocable acceptance of those revisions. If you don\'t agree to the changes, you should stop using the Service. These Terms were last updated on 11 April 2017, (Version 1.0). We recommend that you print out a copy of these Terms.\n\n14. APPLE APPLICATION STORE ADDITIONAL TERMS AND CONDITIONS\n14.1. The following additional terms and conditions apply to you if you are using an App from the Apple Application Store. To the extent the other terms and conditions of this Agreement are less restrictive than, or otherwise conflict with, the terms and conditions of this Section 10, the more restrictive or conflicting terms and conditions in this Section 10 apply, but solely with respect to Apps from the Apple Application Store. \n14.1.1. Acknowledgement: Clever Apps and you acknowledge that this Agreement is concluded between Clever Apps and you only, and not with Apple, and Clever Apps, not Apple, is solely responsible for App and the content thereof. To the extent this Agreement provides for usage rules for App that are less restrictive than the Usage Rules set forth for App in, or otherwise is in conflict with, the Application Store Terms of Service, the more restrictive or conflicting Apple term applies. \n14.1.2. Scope of License: The license granted to you for App is limited to a non-transferable license to use App on an iOS Product that you own or control and as permitted by the Usage Rules set forth in the Application Store Terms of Service. \n14.1.3. Maintenance and Support: Clever Apps is solely responsible for providing any maintenance and support services with respect to App, as specified in this Agreement (if any), or as required under applicable law. Clever Apps and you acknowledge that Apple has no obligation whatsoever to furnish any maintenance and support services with respect to App. \n14.1.4. Warranty: Clever Apps is solely responsible for any product warranties, whether express or implied by law, to the extent not effectively disclaimed. In the event of any failure of App to conform to any applicable warranty, you may notify Apple, and Apple may refund the purchase price for App to you; and to the maximum extent permitted by applicable law, Apple will have no other warranty obligation whatsoever with respect to App, and any other claims, losses, liabilities, damages, costs or expenses attributable to any failure to conform to any warranty will be Clever Apps\'s sole responsibility. \n14.1.5. Product Claims: Clever Apps and you acknowledge that Clever Apps, not Apple, is responsible for addressing any claims of you or any third party relating to App or your possession and/or use of App, including, but not limited to: (i) product liability claims; (ii) any claim that App fails to conform to any applicable legal or regulatory requirement; and (iii) claims arising under consumer protection or similar legislation. This Agreement does not limit Clever Apps\'s liability to you beyond what is permitted by applicable law. \n14.1.6. Intellectual Property Rights: Clever Apps and you acknowledge that, in the event of any third party claim that App or your possession and use of App infringes that third party\'s intellectual property rights, Clever Apps, not Apple, will be solely responsible for the investigation, defense, settlement and discharge of any such intellectual property infringement claim. \n14.1.7. Legal Compliance: You represent and warrant that (i) you are not located in a country that is subject to a U.S. Government embargo, or that has been designated by the U.S. Government as a "terrorist supporting" country; and (ii) you are not listed on any U.S. Government list of prohibited or restricted parties. \n14.1.8. Developer Name and Address: Clever Apps\'s contact information for any end-user questions, complaints or claims with respect to App is provided above. \n14.1.9. Third Party Terms of Agreement: You must comply with applicable third party terms of agreement when using App. \n14.1.10. Third Party Beneficiary: Clever Apps and you acknowledge and agree that Apple, and Apple\'s subsidiaries, are third party beneficiaries of this Agreement, and that, upon your acceptance of the terms and conditions of this Agreement, Apple will have the right (and will be deemed to have accepted the right) to enforce this Agreement against you as a third party beneficiary thereof. \n\n15. APPLE SUBSCRIPTIONS TERMS\n15.1. A subscription is valid for 1 week or 1 month, depending on the subscription type selected.\n15.2. Payment will be charged to your iTunes Account upon confirmation of purchase.\n15.3. Your subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period.\n15.4. Your account will be charged for renewal at the price listed within 24-hours prior to the end of the current period.\n15.5. Subscriptions may be managed and auto-renewal my be turned off via Settings > iTunes & App Stores > Apple ID > View Apple ID > Subscriptions.'
};
var SettingsWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = []
, b = [];
// uptap 设置隐藏按钮
// connector.social.isSupportsNativeInvite && a.push(this.createInviteButton());
// connector.platform.oneOf(connector.MOBAGE, connector.SP_MOBAGE, connector.GDCOM, connector.COOLMATHGAMES, connector.PLINGA, connector.AMAZON, connector.PLIEGA, connector.RUSTORE, connector.YANDEX, connector.MICROSOFT, connector.MYGAMES, connector.TON, connector.WORTAL, connector.WECHAT, connector.YOUTUBE, connector.GAMESNACK) || a.push(this.addHelpButton());
connector.platform.oneOf(connector.MOBAGE, connector.SP_MOBAGE, connector.GDCOM, connector.COOLMATHGAMES, connector.PLINGA, connector.AMAZON, connector.PLIEGA, connector.RUSTORE, connector.YANDEX, connector.MICROSOFT, connector.MYGAMES, connector.TON, connector.WORTAL, connector.WECHAT, connector.YOUTUBE, connector.GAMESNACK);
// connector.platform.oneOf(connector.YOUTUBE, connector.GAMESNACK) || a.push(this.createCopyId());
// cleverapps.userDelete.isAvailable() && a.push(this.addDeleteAccountButton());
b.push(this.addSoundIcons());
1 < cleverapps.config.languages.length && ("merge" === cleverapps.config.type || !cleverapps.environment.isGameScene()) && b.push(this.addLanguages());
// -1 === ["merge", "blocks"].indexOf(cleverapps.config.type) && Game.currentGame || !Chat.IsAvailable() || b.push(this.addSupportButton());
// SettingsWindow.IsExitButtonAvailable() && cleverapps.environment.isMainScene() && b.push(this.addExitButton());
Game.currentGame && void 0 === Game.currentGame.outcome && cleverapps.environment.isGameScene() && -1 !== ["match3", "tile3", "blocks"].indexOf(cleverapps.config.type) && b.push(this.addGiveUpButton());
cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition() && cleverapps.promoCodes.hasAvailableCodes() && b.push(this.addPromoCodesButton());
var c = cleverapps.styles.SettingsWindow
, d = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL;
a = this.createGroup(a);
b = this.createGroup(b);
a = new cleverapps.Layout(d ? [b, a] : [a, b],{
direction: d ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL,
margin: c.margin
});
if (!cleverapps.flags.nologin)
if (!connector.social.isLoggedIn())
var e = this.createLoginButtons();
else if (connector.platform.oneOf(connector.TEST))
var f = this.createLogoutButtons();
e = new cleverapps.Layout([a, e, f, this.createVersion()].filter(Boolean),{
direction: cleverapps.UI.VERTICAL,
margin: c.version.margin
});
this._super({
title: "SettingsWindow.title",
name: "settingswindow",
content: e,
styles: c.window,
help: connector.platform.oneOf(connector.TEST, connector.FACEBOOK, connector.ANDROID, connector.IOS, connector.WECHAT, connector.INSTANT, connector.DISCORD, connector.CRAZY) ? function() {
new AboutWindow
}
: void 0
});
this.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 3);
f = new cc.Node;
f.setContentSize(c.cheapProduct);
f.setPositionRound(c.cheapProduct);
e.addChild(f);
cleverapps.UI.onClick(f, function() {
console.log("cheap product click")
}, {
onDoubleClick: function() {
var g = Product.CreateById("cheapProduct");
g ? g.buy(function(h) {
h === connector.CODE_SUCCEED && this.close()
}
.bind(this)) : cleverapps.notification.create("\u0421heapProduct not found, payments - " + connector.payments.getName())
}
.bind(this)
})
},
getPerson: function() {
return cleverapps.styles.SettingsWindow.person
},
createGroup: function(a) {
var b = cleverapps.styles.SettingsWindow.groups;
a = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: b.margin,
padding: b.padding
});
b = cleverapps.UI.createScale9Sprite(bundles.windows.frames.windows_group_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
b.setContentSize(a.width, a.height);
b.setPositionRound(a.width / 2, a.height / 2);
a.addChild(b, -1);
cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL && a.setAnchorPoint(.5, 1);
return a
},
addGiveUpButton: function() {
var a = cleverapps.styles.SettingsWindow;
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_red,
text: "%% GiveUp",
icons: {
"%%": bundles.buttons_main.frames.giveup_icon
},
onClicked: function() {
this.close();
cleverapps.focusManager.whenFreeFocus(function() {
cleverapps.scenes.getRunningScene().closeAction()
})
}
.bind(this),
width: a.button.width,
height: a.button.height
})
},
addPromoCodesButton: function() {
var a = cleverapps.styles.SettingsWindow;
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_blue,
icons: {
"%%": bundles.buttons_main.frames.promocode_icon
},
text: "%% SettingsWindow.RedeemCode",
onClicked: function() {
this.close();
new RedeemCodeWindow
}
.bind(this),
width: a.button.width,
height: a.button.height
})
},
addExitButton: function() {
var a = cleverapps.styles.SettingsWindow;
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_red,
text: "%% Exit",
icons: {
"%%": bundles.buttons_main.frames.exit_icon
},
onClicked: function() {
cleverapps.focusManager.distract({
focus: "ConfirmExitWindow",
action: function(b) {
new ConfirmExitWindow({
action: function() {
connector.platform.closeApplication()
}
});
cleverapps.focusManager.onceNoWindowsListener = b
}
});
this.close()
}
.bind(this),
width: a.button.width,
height: a.button.height
})
},
addHelpButton: function() {
var a = cleverapps.styles.SettingsWindow;
return new cleverapps.UI.Button({
text: "%% Help",
icons: {
"%%": bundles.buttons_main.frames.community_icon
},
onClicked: function() {
connector.social.joinCommunityCallback()
},
width: a.button.width,
height: a.button.height,
type: cleverapps.styles.UI.Button.Images.button_blue
})
},
addSupportButton: function() {
var a = cleverapps.styles.SettingsWindow;
return new cleverapps.UI.Button({
text: "%% SupportButton",
icons: {
"%%": bundles.buttons_main.frames.support_icon
},
onClicked: function() {
cleverapps.focusManager.distract({
focus: "ChatScene",
action: function(b) {
this.close();
cleverapps.scenes.replaceScene(new ChatScene(cleverapps.chat), b)
}
.bind(this)
})
}
.bind(this),
width: a.button.width,
height: a.button.height,
type: cleverapps.styles.UI.Button.Images.button_blue,
mark: cleverapps.chat.hasUnread
})
},
addLanguages: function() {
//去除多语言选择按钮
var a = cleverapps.styles.SettingsWindow;
return new cleverapps.UI.Button({
text: "%% Language",
icons: {
"%%": bundles.buttons_main.frames.language_icon,
"##": bundles.buttons_main.frames.support_icon
},
onClicked: function() {
new LanguagesWindow;
this.close()
}
.bind(this),
width: a.button.width,
height: a.button.height
})
},
addSoundIcons: function() {
var a = [{
icons: {
"%%": bundles.buttons_main.frames.sound_on_png,
"^^": bundles.buttons_main.frames.sound_off_png
},
toggle: cleverapps.settings.toggleSound.bind(cleverapps.settings),
settings: "sound",
listener: "onChangeSoundListener"
}, {
icons: {
"%%": bundles.buttons_main.frames.music_on_png,
"^^": bundles.buttons_main.frames.music_off_png
},
toggle: cleverapps.settings.toggleMusic.bind(cleverapps.settings),
settings: "music",
listener: "onChangeMusicListener"
}]
, b = cleverapps.styles.SettingsWindow
, c = this.getButtonWidth(a);
a = a.map(function(d) {
var e = new cleverapps.UI.Button({
text: "%%",
textOff: "^^",
icons: d.icons,
width: c,
height: b.button.height,
onClicked: d.toggle
});
e.setBright(cleverapps.settings[d.settings]);
cleverapps.settings[d.listener] = e.createListener(function() {
e.setBright(cleverapps.settings[d.settings])
});
return e
});
return new cleverapps.Layout(a,{
direction: cleverapps.UI.HORIZONTAL,
margin: b.button.margin
})
},
getButtonWidth: function(a) {
var b = cleverapps.styles.SettingsWindow.button;
return 3 === a.length ? b.width3 : 2 === a.length ? b.width2 : b.width
},
createLoginButtons: function() {
var a = cleverapps.styles.SettingsWindow
, b = connector.social.listAvailable()
, c = b.map(function(f) {
return new LoginButton({
multiSocials: 1 < b.length,
width: a.loginButton.width,
height: a.loginButton.height,
source: f,
onSuccess: this.closeWindow.bind(this)
})
}
.bind(this))
, d = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL
, e = cleverapps.UI.generateOnlyText("SettingsWindow.SignIn.Footnote", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
e.setOpacity(170);
e.fitTo(cleverapps.styles.SettingsWindow.button.width);
c = new cleverapps.GridLayout(c,{
margin: a.loginButton.margin,
direction: cleverapps.UI.VERTICAL,
columns: d ? 1 : 2
});
return new cleverapps.Layout([e, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.loginButton.text.margin
})
},
createLogoutButtons: function() {
var a = cleverapps.styles.SettingsWindow;
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_blue,
width: a.loginButton.width,
height: a.loginButton.height,
text: "%% SettingsWindow.Logout",
icons: {
"%%": bundles.buttons_main.frames.exit_icon
},
onClicked: function() {
connector.social.logout();
this.closeWindow()
}
.bind(this)
})
},
createInviteButton: function() {
var a = cleverapps.styles.SettingsWindow;
return new InviteButton({
width: a.button.width,
height: a.button.height,
type: cleverapps.styles.UI.Button.Images.button_blue,
onSuccess: this.closeWindow.bind(this)
})
},
createCopyId: function() {
var a = cleverapps.styles.SettingsWindow.button;
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_blue,
width: a.width,
height: a.height,
text: "%% SettingsWindow.UserID.copy",
icons: {
"%%": bundles.buttons_main.frames.copyid_icon
},
onClicked: function() {
cleverapps.copyToClipboard(connector.platform.getUserID(), function() {
cleverapps.notification.create("SettingsWindow.UserID.copied")
})
}
})
},
createVersion: function() {
//去除版本号显示
// var a = cleverapps.UI.generateOnlyText("v" + cleverapps.config.version, cleverapps.styles.FONTS.SETTINGS_WINDOW_ID_TEXT || cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
// a.fitTo(cleverapps.styles.SettingsWindow.button.width);
// a.setOpacity(170);
// return a
},
addDeleteAccountButton: function() {
var a = cleverapps.styles.SettingsWindow.button;
return new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_blue,
text: "%% DeleteAccount",
icons: {
"%%": bundles.buttons_main.frames.delete_icon
},
onClicked: function() {
new DeleteAccountWindow
},
width: a.width,
height: a.height
})
},
closeWindow: function() {
this.closed || this.close()
},
listBundles: function() {
return ["social_buttons"]
}
});
SettingsWindow.IsExitButtonAvailable = function() {
return -1 !== [cc.sys.OS_ANDROID].indexOf(connector.info.os) && connector.info.isNative && connector.platform.hasCloseApplication()
}
;
cleverapps.styles.SettingsWindow = {
margin: 20,
groups: {
margin: 19,
padding: {
x: 30,
y: 30
}
},
button: {
margin: 19,
width: 563,
width2: 269,
width3: 175,
height: 125
},
loginButton: {
height: 100,
width: 475,
margin: {
x: 80,
y: 20
},
text: {
margin: 7
}
},
cheapProduct: {
x: {
align: "right"
},
y: {
align: "bottom"
},
width: 120,
height: 120
},
version: {
margin: 10
}
};
var LanguagesWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this._super({
title: "Language",
name: "languageswindow",
content: this.createContent()
})
},
createContent: function() {
var a = cleverapps.styles.LanguagesWindow
, b = 3;
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && (b = 2);
this.buttonsPerLanguage = {};
var c = cleverapps.config.languages.map(function(d) {
var e = new LanguageButton(d,this.buttonClicked.bind(this));
return this.buttonsPerLanguage[d] = e
}, this);
return new cleverapps.GridLayout(c,{
columns: b,
margin: {
x: a.margin,
y: a.margin
}
})
},
buttonClicked: function(a) {
var b = cleverapps.settings.language;
a !== b && cleverapps.focusManager.distract({
focus: "LanguageChanged",
action: function(c) {
cleverapps.settings.setLanguage(a);
cleverapps.settings.updateDependents();
this.buttonsPerLanguage[b].updateEnabled();
Messages.preload(a, function() {
this.setTitle("Language");
cleverapps.environment.isGameScene() && "merge" !== cleverapps.config.type ? cleverapps.lives ? (c(),
this.close()) : cleverapps.meta.wantsToPlay(c) : (this.close(),
cleverapps.travelBook.gotoMainScene(c))
}
.bind(this))
}
.bind(this)
})
}
});
cleverapps.styles.LanguagesWindow = {
margin: 20
};
var RateWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.RATE_WINDOW);
var a = cleverapps.styles.RateWindow
, b = this.createContent();
this._super({
content: b,
title: "RateWindow.title",
name: "ratewindow",
styles: cleverapps.styles.RateWindow,
button: {
width: a.button.width,
height: a.button.height,
text: "RateUs",
onPressed: function() {
this.openRateUrl();
this.close()
}
.bind(this)
},
contentPadding: a.contentPadding
});
this.addPerson()
},
getPerson: function() {
return "hero"
},
addPerson: function() {
var a = new cc.Sprite(bundles.rate_window.frames.stars_png);
this.window.addChild(a);
a.setPositionRound(cleverapps.styles.RateWindow.stars);
a.setLocalZOrder(20)
},
createContent: function() {
var a = cleverapps.styles.RateWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize(a.width, a.height);
var c = cleverapps.UI.generateOnlyText("RateWindow.text", cleverapps.styles.FONTS.RATE_WINDOW_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT, {
gameTitle: Messages.get(cleverapps.config.title)
});
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setDimensions(a.text.width, 0);
c.fitTo(void 0, a.text.height);
b.addChild(c);
c.setPositionRound(a.text);
if (bundles.rate_window.frames.text_bg_png) {
a = cc.rectAddPadding(cc.rect(0, 0, b.width, a.text.height), cc.padding(a.text.padding));
var d = cleverapps.UI.createScale9Sprite(bundles.rate_window.frames.text_bg_png);
d.setContentSize(a.width, a.height);
b.addChild(d, -1);
d.setPositionRound(c.x, c.y)
}
return b
},
openRateUrl: function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.RATE_SEND);
if (connector.platform.canReview())
connector.platform.requestReviewCallback(function(b) {
connector.platform.oneOf(connector.ANDROID, connector.MICROSOFT) ? cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.NATIVE_REVIEW + b) : cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.SOCIAL_REVIEW + b)
});
else {
var a = connector.platform.getRateUrl();
a && connector.platform.openUrl(a)
}
},
onClose: function() {
cleverapps.dataLoader.save(DataLoader.TYPES.RATED, !0, {
raw: !0
})
},
listBundles: function() {
return ["rate_window"]
}
});
RateWindow.CanRate = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.RATED, {
raw: !0
});
return cleverapps.flags.norest || !levels.user.checkAvailable(RateWindow.AVAILABLE) || a || cleverapps.config.wysiwygMode ? !1 : connector.platform.canReview() || connector.platform.getRateUrl()
}
;
var RateWindowAction = function(a) {
this.game.outcome === GameBase.OUTCOME_VICTORY && RateWindow.CanRate() ? (new RateWindow,
cleverapps.focusManager.onceNoWindowsListener = a) : a()
};
cleverapps.styles.RateWindow = {
width: 650,
height: 300,
stars: {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 240
}
},
text: {
width: 610,
height: 200,
x: {
align: "center"
},
y: {
align: "center"
},
padding: {
x: 10,
y: 20
}
},
button: {
width: 300,
height: 100
},
contentPadding: {
top: 100
}
};
RateWindow.AVAILABLE = {
level: 2.4
};
"merge" === cleverapps.config.type && (RateWindow.AVAILABLE = {
level: 6
});
var ConfirmExitWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
a = a || {};
this.action = a.action || function() {}
;
var b = cleverapps.styles.ConfirmExitWindow
, c = this.createText(a);
if (a.image)
var d = this.createImage(a.image);
else {
var e = bundles.confirmexit_window.jsons.confirmexit_window_json;
e && (d = this.createAnimation(e))
}
if (a.reward)
var f = new RewardsListComponent(a.reward,{
font: cleverapps.styles.FONTS.WINDOW_TEXT,
margin: b.reward.margin
});
if ("undefined" !== typeof BreakViews && Game.currentGame && cleverapps.environment.isGameScene())
var g = new BreakViews;
a = new cleverapps.Layout([d, c, g, f],{
direction: cleverapps.UI.VERTICAL,
margin: b.margin,
padding: a.padding || b.padding
});
this._super({
closeByBackButton: !0,
title: "ConfirmExitWindow.title",
name: "confirmexitwindow",
content: a,
buttons: this.getButtons()
})
},
getPerson: function() {
return {
role: "hero",
emotion: "sad"
}
},
createImage: function(a) {
a = new cc.Sprite(a);
a.setPositionRound(cleverapps.styles.ConfirmExitWindow.view);
return a
},
createAnimation: function(a) {
var b = cleverapps.styles.ConfirmExitWindow.view
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize(b);
a = new cleverapps.Spine(a);
c.addChild(a);
a.hasAnimation("open") ? a.setAnimationAndIdleAfter("open", "idle") : a.setAnimation(0, "sad", !0);
a.setPositionRound(b);
return c
},
createText: function(a) {
var b = cleverapps.styles.ConfirmExitWindow;
a = a.text || "AreYouSure";
cleverapps.environment.isGameScene() && "merge" !== cleverapps.config.type && (Game.currentGame.useLives() && (a = "ConfirmExitWindow.message"),
Game.currentGame.level.isBonusRound() && (a = "ConfirmExitWindow.BonusRound.message"));
a = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.WINDOW_TEXT);
a.setAnchorPoint(.5, .5);
a.setDimensions(b.text.width, 0);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.fitTo(void 0, b.text.height);
return a
},
getButtons: function() {
var a = cleverapps.styles.ConfirmExitWindow
, b = new cleverapps.UI.Button({
text: "PlayOn",
onClicked: function() {
this.close()
}
.bind(this),
width: a.button.width,
height: a.button.height
});
return [new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_red,
text: "Exit",
onClicked: function() {
this.closeAnimationCallbacks.push(this.action);
this.close()
}
.bind(this),
width: a.button.width,
height: a.button.height
}), b]
},
listBundles: function() {
return ["confirmexit_window"]
}
});
cleverapps.styles.ConfirmExitWindow = {
margin: 20,
padding: {
bottom: 40
},
view: {
width: 400,
height: 400,
x: {
align: "center"
},
y: {
align: "center"
}
},
text: {
width: 500
},
button: {
width: 300,
height: 100
},
reward: {
margin: {
x: 100
}
}
};
var NewLeagueWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.NEW_LEAGUE);
var a = cleverapps.styles.NewLeagueWindow
, b = this.createText()
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(a);
c.addChild(b);
b.setPositionRound(c.width / 2, c.height / 2);
this._super({
title: "NewLeagueWindow.Title",
name: "newleaguewindow",
content: c,
closeButton: !1,
fireworks: !0,
button: {
width: a.button.width,
height: a.button.height,
text: "OK",
onClicked: this.close.bind(this)
}
})
},
getPerson: function() {
return {
role: "hero",
emotion: "happy"
}
},
createText: function() {
var a = cleverapps.styles.NewLeagueWindow
, b = cleverapps.UI.generateOnlyText("NewLeagueWindow.text", cleverapps.styles.FONTS.WINDOW_TEXT, {
league: Messages.get("League" + levels.user.league)
});
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.width, 0);
b.fitTo(void 0, a.height);
return b
}
})
, NewLeagueWindowAction = function(a) {
!levels.user.isLeagueChanged || cleverapps.flags.norest || this.game.outcome !== GameBase.OUTCOME_VICTORY ? a() : (delete levels.user.isLeagueChanged,
cleverapps.focusManager.compound(a, [function(b) {
new NewLeagueWindow;
cleverapps.focusManager.onceNoWindowsListener = b
}
, function(b) {
new LeadersWindow;
cleverapps.focusManager.onceNoWindowsListener = b
}
]))
};
cleverapps.styles.NewLeagueWindow = {
width: 550,
height: 500,
button: {
width: 280,
height: 110
}
};
var LeadersLoading = cc.Node.extend({
ctor: function() {
this._super();
var a = cleverapps.styles.WaitWindow
, b = this.loading = new cleverapps.Spine(bundles.main.jsons.wait_json);
b.setScale(1.5);
b.setAnimation(0, "idle", !0);
this.addChild(b);
a.text && (b = this.loadingText = cleverapps.UI.generateTTFText(Messages.get("Loading") || "Loading", cleverapps.styles.FONTS.WINDOW_TEXT),
b.setPositionRound(a.text),
this.addChild(b))
},
remove: function() {
this.loading.runAction(new cc.RemoveSelf);
this.loadingText && this.loadingText.removeFromParent()
}
})
, LeadersWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.LEADERS_WINDOW_OPEN);
this.currentLeague = levels.user.league;
this.leaguesLeaders = {};
this.content = this.createContent();
this.addArrows();
this._super.call(this, {
name: "leaderswindow",
content: this.content,
title: "League" + levels.user.league
});
this.loadData();
this.updateArrows()
},
addArrows: function() {
var a = cleverapps.styles.LeadersWindow;
this.decLeagueButton = new cleverapps.UI.Button({
type: {
button_png: bundles.main.frames.league_arrow_png,
button_on_png: bundles.main.frames.league_arrow_png
},
onClicked: this.decLeague.bind(this)
});
this.decLeagueButton.baseScaleX = -1;
this.decLeagueButton.baseScaley = 1;
this.decLeagueButton.setPositionRound(a.arrows.dec);
this.decLeagueButton.setScaleX(-1);
this.decLeagueButton.setLocalZOrder(1);
this.content.addChild(this.decLeagueButton);
this.incLeagueButton = new cleverapps.UI.Button({
type: {
button_png: bundles.main.frames.league_arrow_png,
button_on_png: bundles.main.frames.league_arrow_png
},
onClicked: this.incLeague.bind(this)
});
this.incLeagueButton.setPositionRound(a.arrows.inc);
this.incLeagueButton.setLocalZOrder(1);
this.content.addChild(this.incLeagueButton)
},
createHead: function() {
var a = cleverapps.styles.LeadersWindow
, b = cleverapps.UI.generateOnlyText("LeadersWindow.rank", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.head.text.width, 0);
var c = cleverapps.UI.generateOnlyText("LeadersWindow.player", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setDimensions(a.head.text.width, 0);
var d = cleverapps.UI.generateOnlyText("LeadersWindow.rating", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setDimensions(a.head.text.width, 0);
return new cleverapps.Layout([b, c, d],{
margin: a.margin,
direction: cleverapps.UI.HORIZONTAL
})
},
createContent: function() {
var a = cleverapps.styles.LeadersWindow
, b = this.createHead();
this.table = this.createTable();
return new cleverapps.Layout([b, this.table],{
margin: a.margin,
direction: cleverapps.UI.VERTICAL,
padding: a.padding
})
},
loadData: function() {
this.loading = new LeadersLoading;
this.loading.setPositionRound(this.content.width / 2, this.content.height / 2);
this.content.addChild(this.loading);
this.loading.setVisible(!1);
this.loading.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.Show));
var a = cleverapps.accumulate(300, this.createListener(function(c) {
this.loading.removeFromParent();
this.loading = void 0;
this.leaguesLeaders = {};
for (var d = 0; d < c.length; d++)
this.leaguesLeaders[c[d].leagueId] = JSON.parse(c[d].data),
this.leaguesLeaders[c[d].leagueId].forEach(function(e) {
e.league = c[d].leagueId
});
for (d = 0; d < this.getAmountLeagues(); d++)
this.leaguesLeaders[d] || (this.leaguesLeaders[d] = []);
this.updateArrows();
this.updateTable()
}
.bind(this)))
, b = "/leaders/" + cleverapps.settings.language + "/";
cleverapps.config.debugMode && (b = "https://wordsoup.labsystech.ru/wordsoup-rest" + b);
cleverapps.RestClient.get(b, {}, a, function() {
cleverapps.notification.create("LeadersLoadFailed")
}, {
ignoreNoRest: cleverapps.config.importMode
})
},
decLeague: function() {
0 < this.currentLeague && (this.currentLeague--,
this.updateArrows(),
this.updateTable(),
this.updateTitle())
},
incLeague: function() {
this.currentLeague < this.getAmountLeagues() - 1 && (this.currentLeague++,
this.updateArrows(),
this.updateTable(),
this.updateTitle())
},
getAmountLeagues: function() {
var a = 1;
cleverapps.config.leagues && (a = cleverapps.config.leagues.length);
return a
},
updateArrows: function() {
this.decLeagueButton && this.decLeagueButton.setVisible(!this.loading && 0 < this.currentLeague);
this.incLeagueButton && this.incLeagueButton.setVisible(!this.loading && this.currentLeague < this.getAmountLeagues() - 1)
},
updateTitle: function() {
this.window && this.setTitle("League" + this.currentLeague)
},
getTop: function() {
var a = this.leaguesLeaders[this.currentLeague] || [];
this.removePlayerFromTop(a);
for (levels.user.league === this.currentLeague && this.addPlayerToTop(a); a.length > LeadersWindow.TOP_LIMIT && a[a.length - 1].id !== connector.platform.getUserID(); )
a.pop();
return a
},
updateTable: function() {
var a = this.currentLeague;
this.runAction(new cc.Sequence(new cc.DelayTime(.01),new cc.CallFunc(function() {
if (a === this.currentLeague) {
var b = this.table.getPosition()
, c = this.table.getParent();
this.table.removeFromParent();
this.table = this.createTable();
c.addChild(this.table);
this.table.setPositionRound(b)
}
}
.bind(this))))
},
removePlayerFromTop: function(a) {
for (var b = 0; b < a.length; b++)
if (a[b].id === connector.platform.getUserID()) {
a.splice(b, 1);
break
}
},
addPlayerToTop: function(a) {
a.push({
id: connector.platform.getUserID(),
rating: levels.user.getVirtualLevel(),
name: cleverapps.user.getPlayerInfo().name,
avatar: cleverapps.user.getPlayerInfo().avatar,
you: !0,
league: levels.user.league
});
a.sort(function(b, c) {
return b.rating === c.rating ? b.id === connector.platform.getUserID() ? -1 : c.id === connector.platform.getUserID() ? 1 : 0 : c.rating - b.rating
})
},
createTable: function() {
for (var a = this.getTop(), b = [], c = 0; c < a.length; c++) {
var d = {
text: a[c].name,
place: c + 1,
id: a[c].id,
avatar: {
id: a[c].id,
avatar: a[c].avatar
},
player: a[c].id === connector.platform.getUserID(),
amount: a[c].rating
};
b.push(d)
}
cleverapps.leagueLeadersTable.resetResults("leadersWindow");
return cleverapps.leagueLeadersTable.createTableView({
id: "leadersWindow",
data: b,
rowConstructor: cleverapps.LeadersRow
})
}
});
cleverapps.styles.LeadersWindow = {
margin: 20,
head: {
text: {
width: 200
}
},
padding: {
x: -30
},
arrows: {
dec: {
x: {
align: "left",
dx: -45
},
y: {
align: "center",
dy: -30
}
},
inc: {
x: {
align: "right",
dx: 45
},
y: {
align: "center",
dy: -30
}
}
},
window: {
decors: {}
}
};
LeadersWindow.TOP_LIMIT = 100;
var RedeemCodeWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this._super({
title: "RedeemCodeWindow.title",
name: "redeemcodewindow",
content: this.createContent(),
styles: cleverapps.styles.RedeemCodeWindow.window,
button: {
text: "RedeemCodeWindow.button",
width: cleverapps.styles.RedeemCodeWindow.button.width,
onPressed: this.processInput.bind(this)
}
})
},
createContent: function() {
var a = cleverapps.UI.generateOnlyText("RedeemCodeWindow.cta", cleverapps.styles.FONTS.WINDOW_TEXT)
, b = this.createInput();
return new cleverapps.Layout([a, b],{
direction: cleverapps.UI.VERTICAL,
margin: cleverapps.styles.RedeemCodeWindow.margin,
padding: cleverapps.styles.RedeemCodeWindow.padding
})
},
createInput: function() {
var a = this.inputBox = new cc.EditBox(cc.size(cleverapps.styles.RedeemCodeWindow.input),new cc.Scale9Sprite(bundles.windows.frames.editbox_bg_png),!0);
a.setInputMode(cc.EDITBOX_INPUT_MODE_SINGLELINE);
a.setMaxLength(10);
a.stayOnTop(!0);
a.setTouchEnabled();
a.setFontColor(cleverapps.styles.FONTS.PROMO_INPUT.color);
a.setFont(cleverapps.UI.getFontName(), cleverapps.styles.FONTS.PROMO_INPUT.size);
return a
},
processInput: function() {
var a = this.inputBox.getString().toUpperCase().trim();
(a = cleverapps.promoCodes.useCode(a)) ? new RewardWindow(a,{
fireworks: !0
}) : cleverapps.notification.create("RedeemCodeWindow.nocode");
this.close()
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PROMO_INPUT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.styles.RedeemCodeWindow = {
margin: 20,
padding: {
x: 30,
top: 0,
bottom: 15
},
button: {
width: 250
},
input: {
width: 350,
height: 70,
x: {
align: "center"
},
y: {
align: "center"
}
},
window: {
padding: {
bottom: 50
}
}
};
cleverapps.CrossPromo = function() {
var a = this.load();
a ? this.processed = a.processed : this.reset();
a = bundles.crosspromo.jsons.crosspromo_json.getJson();
this.remoteJson = new RemoteJson(a)
}
;
cleverapps.CrossPromo.prototype.reset = function() {
this.processed = [];
this.save()
}
;
cleverapps.CrossPromo.prototype.getFirstAvailable = function() {
var a = void 0;
this.listPromotions().forEach(function(b) {
a || -1 !== this.processed.indexOf(b.id) || (a = b)
}, this);
if (void 0 !== a)
return a;
if (0 < this.processed.length)
return this.processed = [],
this.save(),
this.getFirstAvailable()
}
;
cleverapps.CrossPromo.prototype.getPlatformConfig = function(a) {
var b = connector.info.source;
switch (b) {
case "macos":
return a.ios;
case "sp_mbga":
return a.mbga;
default:
return a[b]
}
}
;
cleverapps.CrossPromo.prototype.listPromotions = function() {
var a = []
, b = this.remoteJson.getJson()
, c = b.priorities;
Object.keys(b).filter(function(d) {
return "object" === typeof b[d] && b[d].name
}).sort(function(d, e) {
return (c[e] || 0) - (c[d] || 0) || d.localeCompare(e)
}).forEach(function(d) {
if (d !== cleverapps.config.name) {
var e = b[d]
, f = this.getPlatformConfig(e);
if (f && (cleverapps.config.debugMode || !f.debug) && (f = "crosspromo_" + d + "_" + cc.sys.LANGUAGE_ENGLISH,
bundles[f])) {
var g = "crosspromo_" + d + "_" + cleverapps.settings.language;
d = {
id: d,
title: "" + d + "PromoTitle",
description: "" + d + "Promo",
bundleName: bundles[g] ? g : f,
link: connector.utils.guessPlatformURL({
config: e
}),
payload: void 0
};
if ("instant" !== connector.info.source || (cleverapps.config.instant && cleverapps.config.instant.business || cleverapps.config.business) === (e.instant && e.instant.business || e.business))
"instant" === connector.info.source && (d.link = e.instant && e.instant.appId,
d.payload = {
channel: cleverapps.config.name
}),
"msstart" === connector.info.source && (d.link = e.msstart && e.msstart.appId,
d.payload = {
channel: cleverapps.config.name
}),
d.link && ("facebook" === connector.info.source && (d.link += "?channel=" + cleverapps.config.name),
"android" === connector.info.source && (d.link += "&utm_source=" + cleverapps.config.name),
a.push(d))
}
}
}
.bind(this));
return a
}
;
cleverapps.CrossPromo.prototype.isReady = function() {
return cleverapps.user.checkAvailable(cleverapps.CrossPromo.AVAILABLE) ? void 0 !== this.getFirstAvailable() : !1
}
;
cleverapps.CrossPromo.prototype.setProcessed = function(a) {
this.processed.push(a.id);
this.save()
}
;
cleverapps.CrossPromo.prototype.load = function() {
return cleverapps.dataLoader.load(DataLoader.TYPES.PROMOTION)
}
;
cleverapps.CrossPromo.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.PROMOTION, {
processed: this.processed
})
}
;
cleverapps.CrossPromo.ShowFirstAvailable = function() {
var a = cleverapps.crossPromo.getFirstAvailable();
new CrossPromoWindow(a)
}
;
cleverapps.CrossPromo.BONUS = 10;
cleverapps.CrossPromo.AVAILABLE = {
level: 3.33
};
"merge" === cleverapps.config.type && (cleverapps.CrossPromo.AVAILABLE = {
level: 8.2
});
var CrossPromoWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.promotion = a;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PROMO_SHOW + this.promotion.id);
cleverapps.crossPromo.setProcessed(this.promotion);
var b = cleverapps.styles.CrossPromoWindow
, c = new cc.Sprite(bundles[a.bundleName].urls.image);
cleverapps.UI.onClick(c, this.onPressed.bind(this));
var d = cleverapps.UI.wrapWithPadding(this.createText(), {
bottom: b.text.padding
});
c = new cleverapps.Layout([c, d],{
margin: b.margin,
direction: cleverapps.UI.VERTICAL
});
this._super({
title: a.title,
name: "crosspromowindow",
content: c,
button: {
width: b.button.width,
height: b.button.height,
text: "Play",
onPressed: this.onPressed.bind(this)
}
});
this.addBadge()
},
createText: function() {
var a = cleverapps.styles.CrossPromoWindow
, b = cleverapps.UI.generateOnlyText(this.promotion.description, cleverapps.styles.FONTS.PROMOTION_TEXT);
b.setDimensions(a.text.width, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
return b
},
onPressed: function() {
connector.platform.switchGame(this.promotion.link, this.promotion.payload, function(a) {
a && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PROMO + (a === connector.ERRORS.SWITCH_GAME.CANCEL ? "cancel" : "error") + "_" + this.promotion.id),
a !== connector.ERRORS.SWITCH_GAME.CANCEL && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PROMO_ERROR + cleverapps.config.platform))
}
.bind(this));
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PROMO + this.promotion.id);
new RewardWindow({
hard: cleverapps.CrossPromo.BONUS
},{
event: cleverapps.EVENTS.EARN.PROMO
});
this.close()
},
addBadge: function() {
var a = new cc.Sprite(bundles.crosspromo_window.frames.badge)
, b = new TextWithIcon("+" + cleverapps.CrossPromo.BONUS + "$$",{
font: cleverapps.styles.FONTS.BADGE_TEXT
})
, c = cleverapps.styles.CrossPromoWindow;
b.setPositionRound(a.width / 2 + c.badge.price.dx, a.height / 2 + c.badge.price.dy);
b.setRotation(c.badge.rotation);
a.addChild(b);
a.setPositionRound(this.buttons.width + c.badge.dx, this.buttons.height + c.badge.dy);
this.buttons.addChild(a)
},
listBundles: function(a) {
return [a.bundleName]
}
});
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PROMOTION_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
},
BADGE_TEXT: {
size: 28,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.styles.CrossPromoWindow = {
margin: 40,
text: {
width: 620,
margin: 20,
padding: 60
},
button: {
width: 250,
height: 80,
margin: 0
},
badge: {
dx: 20,
dy: -33,
rotation: 34,
price: {
dx: 10,
dy: 0
}
}
};
var Decors = function(a, b) {
this.styles = b = b || {};
this.decors = {};
this.parent = a;
if (cleverapps.styles.Decorators) {
var c = Object.keys(b).filter(function(d) {
if (!0 !== b[d])
return !1;
d = cleverapps.styles.Decorators[d];
return !d || d.lovesBackground && !a.withBg || d.lovesBackgroundAndForeground && !a.withBg && !a.foreground || d.fearHigh && a.window && .8 < a.window.height * a.window.scale / cleverapps.resolution.getSceneSize().height || d.lovesTitle && (!a.windowTitle || !0 !== d.lovesTitle && a.windowTitle.type !== cleverapps.styles.WindowTitle.Types[d.lovesTitle]) ? !1 : !0
});
this.init(c)
}
};
Decors.prototype.add = function(a) {
var b = cleverapps.styles.Decorators[a];
if (b) {
var c = this.getParent(b);
switch (b.type) {
case Decors.TYPE_IMAGE:
var d = this.addImage(b);
break;
case Decors.TYPE_ANIMATION:
d = this.addAnimation(b);
break;
case Decors.TYPE_SCALE9:
d = this.addScale9(b, c);
break;
case Decors.TYPE_REPEATABLE:
d = this.addPattern(b)
}
if (d)
return b = this.getPos(b),
c.addChild(d),
d.setPositionRound(b),
this.decors[a] = d
}
}
;
Decors.prototype.init = function(a) {
a.forEach(this.add, this)
}
;
Decors.prototype.initTitleDecorators = function() {
var a = Object.keys(this.styles).filter(function(b) {
return !0 === this.styles[b] && cleverapps.styles.Decorators[b] && cleverapps.styles.Decorators[b].lovesTitle
}
.bind(this));
this.init(a)
}
;
Decors.prototype.getDecorById = function(a) {
if (this.decors[a])
return this.decors[a]
}
;
Decors.prototype.setVisible = function(a, b) {
a = this.getDecorById(a);
if (!a)
return !1;
b || a.stopAllActions();
a.setVisible(b);
return !0
}
;
Decors.prototype.getParent = function(a) {
return a.lovesTitle ? this.parent.windowTitle : a.lovesBackground ? this.parent.bg : a.lovesBackgroundAndForeground && (this.parent.foreground || this.parent.bg) ? this.parent.foreground || this.parent.bg : a.lovesWindow ? this.parent : a.lovesButton && this.parent.button ? this.parent.button : this.parent.window
}
;
Decors.prototype.addScale9 = function(a, b) {
var c = cleverapps.UI.createScale9Sprite(bundles.main.frames[a.image] || a.image);
c.setContentSize2("parent" === a.width ? b.width : c.width, "parent" === a.height ? b.height : c.height);
c.setScale(Array.isArray(a.scale) ? a.scale[cleverapps.resolution.mode] : a.scale);
c.baseScale = c.scale;
c.setLocalZOrder(a.zOrder);
void 0 !== a.rotation && c.setRotation(a.rotation);
return c
}
;
Decors.prototype.addImage = function(a) {
var b = new cc.Sprite(bundles.main.frames[a.image] || a.image)
, c = a.scale;
Array.isArray(c) && (c = c[cleverapps.resolution.mode]);
"number" === typeof c ? b.scale = c : (b.scaleX = c.x,
b.scaleY = c.y);
b.baseScale = Math.abs(b.scaleX);
b.baseScaleX = b.scaleX;
b.baseScaleY = b.scaleY;
b.setLocalZOrder(a.zOrder);
void 0 !== a.rotation && b.setRotation(a.rotation);
return b
}
;
Decors.prototype.addAnimation = function(a) {
var b = new cleverapps.Spine(bundles.main.jsons[a.json] || a.json);
a.scale && (a.scale.x ? b.setScale(a.scale.x, a.scale.y) : b.setScale(a.scale));
var c = void 0 !== a.looped ? a.looped : !0;
b.setLocalZOrder(a.zOrder);
b.setVisible(!0);
void 0 !== a.delay ? b.runAction(new cc.Sequence(new cc.DelayTime(a.delay),new cc.CallFunc(function() {
b.setAnimation(0, a.animation, c)
}
))) : a.idle ? b.setAnimationAndIdleAfter(a.animation, a.idle) : b.setAnimation(0, a.animation, c);
return b
}
;
Decors.prototype.addPattern = function(a) {
var b = bundles.main.frames[a.image] || a.image
, c = this.getParent(a);
if (a.direction === cleverapps.UI.HORIZONTAL) {
c = Math.ceil(c.width / a.step) - 1;
var d = a.step;
var e = 0
} else
c = Math.ceil(c.height / a.step) - 1,
d = 0,
e = a.step;
var f = new cc.Node;
f.setAnchorPoint(.5, .5);
f.setLocalZOrder(a.zOrder || 0);
for (a = 0; a < c; ++a) {
var g = new cc.Sprite(b);
g.setAnchorPoint(.5, .5);
g.setPositionRound(a * d, -a * e);
f.addChild(g)
}
return f
}
;
Decors.prototype.getPos = function(a) {
return a.position && Array.isArray(a.position) ? a.position[cleverapps.resolution.mode] : cc.p(a.x, a.y)
}
;
Decors.prototype.updateAll = function() {
for (var a in this.decors) {
var b = this.decors[a]
, c = this.getPos(cleverapps.styles.Decorators[a]);
b.setPositionRound(c.x, c.y)
}
}
;
Decors.prototype.hideAll = function() {
for (var a in this.decors) {
var b = cleverapps.styles.Decorators[a];
if (b && b.type === Decors.TYPE_ANIMATION) {
var c = this.decors[a];
b = b.animation + "_fadeout";
c && c.hasAnimation && c.hasAnimation(b) && (c.setAnimation(0, b, !1),
c.setCompleteListenerRemove())
}
}
}
;
Decors.TYPE_IMAGE = 0;
Decors.TYPE_ANIMATION = 1;
Decors.TYPE_SCALE9 = 2;
Decors.TYPE_REPEATABLE = 3;
cleverapps.styles.Decorators = {};
var GuideWindow = CleverappsWindow.extend({
onWindowLoaded: function(a, b) {
this.stages = [];
this.arrows = [];
this.unit = b;
this.name = a.name;
this.bundle = a.bundle || a.getGuideBundle();
this.listSpines().length ? this.stagesContent = this.createSpineStages() : a.stagesContent ? this.stagesContent = a.stagesContent.call(this, b) : (this.stagesContent = [new cc.Node, new cc.Node, new cc.Node],
cleverapps.throwAsync("no content for guide window " + a.name));
this._super({
name: a.name,
title: this.unit ? cleverapps.unitsLibrary.getUnitName(this.unit) : a.title || a.name + ".title",
content: this.createContent(),
noBackground: !0,
closeButton: !0
});
this.showStages();
this.showArrows()
},
isVertical: function() {
return cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL
},
showStages: function() {
var a = .12;
this.stages.forEach(function(b) {
var c = b.children[1];
c.setOpacity(0);
c.setScale(.8);
b.runAction(new cc.Sequence(new cc.Hide,new cc.ScaleTo(0,.5),new cc.DelayTime(a),new cc.Show,new cc.CallFunc(function() {
c.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.Spawn(new cc.ScaleTo(.2,1),new cc.FadeIn(.4))))
}
),(new cc.ScaleTo(.5,b.scale)).easing(cc.easeBackOut())));
a += .6
}, this)
},
showArrows: function() {
var a = 0;
this.arrows.forEach(function(b, c) {
var d = this.isVertical() ? "vertical" : "horizontal";
1 === c && cleverapps.resolution.mode === cleverapps.WideMode.SQUARE && (d = "diagonal");
b.runAction(new cc.Sequence(new cc.Hide,new cc.DelayTime(a),new cc.CallFunc(function() {
b.spine.setAnimation(0, d)
}
),new cc.Show));
a += .4
}, this)
},
createContent: function() {
var a = cleverapps.styles.GuideWindow
, b = this.createStage(this.stagesContent[0], this.name + ".firstStage")
, c = this.createStage(this.stagesContent[1], this.name + ".secondStage")
, d = this.createStage(this.stagesContent[2], this.name + ".thirdStage");
this.stageSize = cc.size(b.width, b.height);
var e = this.createArrow(1)
, f = this.createArrow(2);
this.stages = [b, c, d];
this.arrows = [e, f];
var g = a.defaultMargin[cleverapps.resolution.mode];
cleverapps.resolution.mode === cleverapps.WideMode.SQUARE ? (a = new cleverapps.Layout([b, e, c],{
direction: cleverapps.UI.HORIZONTAL,
margin: g
}),
b = new cc.Node,
b.setContentSize(f.getContentSize()),
[b, d, f].forEach(function(h) {
h.setAnchorPoint(.5, 1)
}),
d = new cleverapps.Layout([b, d, f],{
direction: cleverapps.UI.HORIZONTAL
}),
g = new cleverapps.Layout([a, d],{
direction: cleverapps.UI.VERTICAL,
margin: g
})) : (cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL && (g = Math.max(g, (.8 * cleverapps.scenes.getRunningScene().width - 3 * b.width - 2 * e.width) / 4)),
g = new cleverapps.Layout([b, e, c, f, d],{
direction: this.isVertical() ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL,
margin: g,
padding: this.isVertical() ? void 0 : a.padding
}));
cleverapps.UI.onClick(g, this.close.bind(this), {
interactiveScale: !1
});
return g
},
createArrow: function(a) {
var b = cleverapps.styles.GuideWindow.stages
, c = new cleverapps.Spine(this.bundle.jsons.arrows);
c.setAnchorPoint(.5, .5);
var d = new cc.Node;
d.spine = c;
cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL && (d.setContentSize(c.width, this.stageSize.height),
c.setPositionRound(d.width / 2, b.description.height + b.margin + this.stagesContent[0].height / 2));
cleverapps.resolution.mode === cleverapps.WideMode.SQUARE && (d.setContentSize(c.width, this.stageSize.height),
b = cc.p(d.width / 2, b.description.height + b.margin + this.stagesContent[0].height / 2),
2 === a && (b.y += this.stagesContent[0].height / 2),
c.setPositionRound(b));
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && (d.setContentSize(this.stageSize.width, c.height),
c.setPositionRound(d.width / 2, d.height / 2));
d.setAnchorPoint(.5, .5);
d.addChild(c);
return d
},
createStage: function(a, b) {
var c = cleverapps.styles.GuideWindow.stages;
b = cleverapps.UI.generateOnlyText(b, cleverapps.styles.FONTS.GUIDE_WINDOW_STAGE_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(this.isVertical() ? c.description.verticalWidth : c.description.width, 0);
b.fitTo(void 0, c.description.height);
b.setAnchorPoint(.5, .5);
var d = cc.size(c.description.width, c.description.height);
this.isVertical() && (d.width = c.description.verticalWidth);
var e = new cc.Node;
e.setContentSize2(d);
e.addChild(b);
e.setAnchorPoint(.5, .5);
b.setPositionRound(e.width / 2, e.height / 2);
return new cleverapps.Layout([a, e],{
direction: cleverapps.UI.VERTICAL,
margin: c.margin
})
},
initStage: function(a, b) {
var c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(cleverapps.styles.GuideWindow.stages);
var d = new cc.Node;
d.setAnchorPoint(.5, .5);
d.setPositionRound(a.container.x, a.container.y);
c.addChild(d);
b(a, d);
return c
},
addUnitIcon: function(a, b, c, d) {
b = UnitView.getUnitImage({
code: b,
stage: c
}, {
alignAnchorX: !0,
preferStatic: !0,
alignAnchorY: d.alignAnchorY
});
b.setPositionRound(d);
c = cc.size(d.width, d.height);
d.padding && (c = cc.rectSubPadding(cc.rect(0, 0, cleverapps.styles.GuideWindow.stages.width, cleverapps.styles.GuideWindow.stages.height), cc.padding(d.padding)));
c.width || c.height ? cleverapps.UI.fitToBox(b, {
width: c.width,
height: c.height,
maxScale: d.scale
}) : d.scale && b.setScale(d.scale);
a.addChild(b);
return b
},
addSprite: function(a, b, c) {
if (!1 === c || !c)
return new cc.Node;
b = new cc.Sprite(b);
b.setAnchorPoint(.5, .5);
b.setPositionRound(c.x, c.y);
c.scale && b.setScale(c.scale);
c.rotation && b.setRotation(c.rotation);
a.addChild(b, c.zOrder);
return b
},
createSpineStages: function(a) {
a = a || this.listSpines();
return a.map(function(b, c) {
b = new cleverapps.Spine(b);
b.setAnimation(0, "stage" + (c + 1), !0);
b.setAnchorPoint(.5, .5);
return b
}, this)
},
listSpines: function() {
return [this.bundle.jsons.guide_stages_1 || this.bundle.jsons.guide_stages, this.bundle.jsons.guide_stages_2 || this.bundle.jsons.guide_stages, this.bundle.jsons.guide_stages_3 || this.bundle.jsons.guide_stages].filter(Boolean)
},
listBundles: function(a, b) {
a = [(a.bundle || a.getGuideBundle()).getBundleName()];
b && (a = a.concat(Families.listLazyBundles(b.code)));
return a
}
});
GuideWindow.createMissionRulesWindow = function(a) {
return new GuideWindow({
name: a.startWindow.name,
getGuideBundle: function() {
return a.startWindow.bundle
},
stagesContent: function() {
return this.createSpineStages([this.bundle.jsons.rules_stages_1 || this.bundle.jsons.rules_json, this.bundle.jsons.rules_stages_2 || this.bundle.jsons.rules_json, this.bundle.jsons.rules_stages_3 || this.bundle.jsons.rules_json])
}
})
}
;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
GUIDE_WINDOW_STAGE_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.WHITE,
lineHeight: 40
},
GUIDE_WINDOW_CLOSE_TEXT: {
size: 26,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
GUIDEWINDOW_DESCRIPTION_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.WHITE,
lineHeight: 40
}
});
cleverapps.styles.GuideWindow = {
stages: {
width: 400,
height: 520,
margin: 50,
description: {
width: 320,
verticalWidth: 500,
height: 156
}
},
defaultMargin: [30, 80, 120],
arrow: {
x: {
align: "center"
},
y: {
align: "center",
dy: 20
}
},
closeText: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -126
}
},
description: {
width: 1160,
verticalWidth: 700
},
padding: {
top: 60,
bottom: 60,
left: 60,
right: 60
}
};
var AdBlockWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this._super({
content: this.createContent(),
name: "AdBlockWindow",
title: "AdBlockWindow.Title",
button: {
text: "OK"
},
styles: cleverapps.styles.AdBlockWindow.window
});
cleverapps.playSession.set(cleverapps.EVENTS.ADS.AD_BLOCK_WINDOW_DAU, !0)
},
getPerson: function() {
return {
role: "hero",
emotion: "sad"
}
},
createContent: function() {
var a = cleverapps.styles.AdBlockWindow
, b = new cc.Sprite(bundles.adblock_window.frames.adblock_icon_png)
, c = cleverapps.UI.generateOnlyText("AdBlockWindow.TurnOffAdblock", cleverapps.styles.FONTS.WINDOW_TEXT, !1);
c.setDimensions(cleverapps.styles.AdBlockWindow.text.width, 0);
c.fitTo(void 0, cleverapps.styles.AdBlockWindow.text.height);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
listBundles: function() {
return ["adblock_window"]
}
});
cleverapps.styles.AdBlockWindow = {
window: {
padding: {
top: 100,
bottom: 100
},
margin: 50
},
margin: 40,
text: {
width: 600,
height: 130
}
};
var HardLevelWindowIcon = cc.Sprite.extend({
ctor: function() {
this._super(bundles.hard_level_icon.frames.hard_level_icon);
var a = cleverapps.styles.HardLevelWindowIcon;
a.rotation && this.setRotation(a.rotation)
},
pulseAnimation: function() {
this.stopAllActions();
this.setScale(.1);
this.setVisible(!1);
this.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.CallFunc(function() {
this.setVisible(!0)
}
.bind(this)),(new cc.ScaleTo(.5,1.1)).easing(cc.easeBackOut()),new cc.CallFunc(function() {
this.runAction(new cc.RepeatForever(new cc.Sequence((new cc.ScaleTo(.5,.9)).easing(cc.easeIn(1)),new cc.ScaleTo(.5,1.1))))
}
.bind(this))))
}
});
cleverapps.styles.HardLevelWindowIcon = {
rotation: -18
};
var RewardsListComponent = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.reward = a instanceof RewardsList ? a : new RewardsList(a,b);
this.options = b || {};
this.createContent();
this.options.noShowControls || cleverapps.focusManager.showControlsWhileFocused(this.reward.listControls())
},
createContent: function() {
var a = cleverapps.styles.RewardsListComponent
, b = this.options.filterCustomAnimation ? this.reward.commonRewards : this.reward.listRewards();
this.options.fitToBox && !this.options.small && this.autoIconSize();
var c = this.targets = [];
b.forEach(function(d) {
d.getAmount() && !RewardTypes[d.type].invisible && c.push(this.createOneReward(d))
}, this);
this.content = new cleverapps.WrapGridLayout(c,{
reverseRows: this.options.reverseRows,
columns: this.options.columns || this.calcColumnsCount(c.length),
fitToBox: this.options.fitToBox,
margin: {
x: this.options.margin && void 0 !== this.options.margin.x ? this.options.margin.x : a.margin.x,
y: this.options.margin && void 0 !== this.options.margin.y ? this.options.margin.y : a.margin.y
}
});
this.addChild(this.content);
this.setContentSize2(this.content);
this.setAnchorPoint(.5, .5);
this.content.setAnchorPoint(.5, .5);
this.content.setPositionRound(this.width / 2, this.height / 2)
},
autoIconSize: function() {
var a = this.options.fitToBox.width * this.options.fitToBox.height
, b = (this.options.filterCustomAnimation ? this.reward.commonRewards : this.reward.listRewards()).reduce(function(c, d) {
d.getAmount() && (d = d.getSmallIcon().getContentSize(),
c += d.width * d.height);
return c
}, 0);
this.options.small = b && 1.5 >= a / b
},
createIcon: function(a) {
return this.options.small ? a.getSmallIcon() : a.getIcon()
},
createOneReward: function(a) {
var b = cleverapps.styles.RewardsListComponent
, c = this.createIcon(a)
, d = cleverapps.UI.generateTTFText(a.getText(this.options.noPrefix ? "" : "x"), this.options.font || cleverapps.styles.FONTS.REWARDS_LIST_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT);
if (this.options.iconWrap) {
cleverapps.UI.fitToBox(c, {
height: this.options.iconWrap.height,
maxScale: c.scale
});
var e = new cc.Node;
e.setAnchorPoint(.5, .5);
e.setContentSize(this.options.iconWrap.width || c.width * c.scale, this.options.iconWrap.height || c.height * c.scale);
e.addChild(c);
c.setPositionRound(e.width / 2, e.height / 2)
}
if (this.options.textWrap) {
var f = new cc.Node;
f.setAnchorPoint(.5, .5);
f.setContentSize(this.options.textWrap);
f.addChild(d);
d.setPositionRound(f.width / 2, f.height / 2)
}
b = new cleverapps.Layout([e || c, f || d],{
direction: void 0 !== this.options.textDirection ? this.options.textDirection : cleverapps.UI.VERTICAL,
margin: void 0 !== this.options.textMargin ? this.options.textMargin : b.textMargin
});
b.icon = c;
b.text = d;
b.reward = a;
this.options.shine && (b.shine = AnimationsLibrary.rays(e || b.icon || b.icon));
return b
},
showUp: function(a) {
var b = cleverapps.styles.RewardsListComponent.showUp.startOffsetY;
a = cleverapps.wait(2, a || function() {}
);
this.targets.length || a();
var c = [];
this.targets.forEach(function(e, f) {
e.shine && e.shine.setVisible(!1);
e.setCascadeOpacityEnabledRecursively(!0);
e.setOpacity(0);
e.setPositionRound(e.x, e.y - b);
c.push(new cc.TargetedAction(e,new cc.Sequence(new cc.Spawn((new cc.MoveBy(.6,0,b)).easing(cc.easeOut(2)),(new cc.FadeIn(.6)).easing(cc.easeIn(2))),new cc.Sequence(new cc.DelayTime(.1),new cc.CallFunc(function() {
e.shine && (e.shine.setVisible(!0),
e.shine.setAnimationAndIdleAfter("open", "idle"))
}
),new cc.CallFunc(function() {
f === this.targets.length - 1 && a()
}
.bind(this))))))
}
.bind(this));
var d = this.reward.customRewards.map(function(e) {
return e.collectRewardsAction()
});
c.push(new cc.Sequence(new cc.DelayTime(.8),new cc.Sequence(d),new cc.CallFunc(a)));
this.runAction(new cc.Spawn(c))
},
receiveRewards: function() {
this.reward.receiveRewards()
},
receiveRewardsAction: function(a) {
a = a || {};
var b = [];
cleverapps.audio.playSound(bundles.main.urls.win_reward_effect);
this.targets.forEach(function(c, d) {
c.shine && b.push(this._shineAction(c, d));
c.text && !a.noFadeOut && b.push(this._textAction(c, d, a));
var e = function() {
return c.reward.collectRewardsAction(c.icon, {
delay: (a.delay || 0) + 300 * d,
beginScale: c.icon.adjustScaleTo(cleverapps.scenes.getMovingNode(c.icon)).y,
hideSource: !a.noFadeOut,
small: !!this.options.small,
sound: RewardTypes[c.reward.type].getCollectRewardSound && RewardTypes[c.reward.type].getCollectRewardSound(),
flyingAnimation: a.flyingAnimation
})
}
.bind(this);
b.push(this._iconAction(c, d, a, e))
}
.bind(this));
b = new cc.Spawn(b);
this.reward.fullScreenRewards.forEach(function(c) {
b = new cc.Sequence(b,c.collectRewardsAction(void 0, {
sound: RewardTypes[c.type].getCollectRewardSound && RewardTypes[c.type].getCollectRewardSound()
}))
});
a.callback && (b = new cc.Sequence(b,new cc.CallFunc(a.callback)));
return b
},
receiveRewardsAnimation: function(a) {
cleverapps.scenes.getRunningScene().runAction(this.receiveRewardsAction(a))
},
_shineAction: function(a, b) {
return new cc.TargetedAction(a.shine,new cc.Sequence(new cc.DelayTime(.3 * b),new cc.CallFunc(a.shine.setAnimation.bind(a.shine, 1, "close", !1))))
},
_textAction: function(a, b, c) {
c = void 0 !== c.fadeDelay ? c.fadeDelay : .3;
a.text.setCascadeOpacityEnabledRecursively(!0);
return new cc.TargetedAction(a.text,new cc.Sequence(new cc.DelayTime(b * c),new cc.FadeOut(.75)))
},
_iconAction: function(a, b, c, d) {
a.icon.setLocalZOrder(this.targets.length - b);
return c.iconAction ? new cc.TargetedAction(a.icon,new cc.Spawn(c.iconAction(a.icon),d())) : d()
},
calcColumnsCount: function(a) {
return 3 >= a ? a : cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL ? 4 : 4 === a && cleverapps.resolution.mode !== cleverapps.WideMode.HORIZONTAL ? 2 : 3
}
});
cleverapps.styles.RewardsListComponent = {
margin: {
x: 30,
y: 30
},
shine: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 40
}
},
showUp: {
startOffsetY: 25,
floatingOffset: 4
},
textMargin: 10
};
var RoundResultsComponent = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.round = a;
b = b || {};
this.setAnchorPoint(.5, .5);
var c = cleverapps.styles.RoundResultsComponent;
a = Game.currentGame.competition.getResults().sort(function(d) {
return d.player ? -1 : 1
});
this.perWordTime = .05;
this.maxWords = Math.max(a[0].amount, a[1].amount);
this.views = a.map(function(d) {
var e = cleverapps.UI.generateTTFText(GridPlayerNameView.FormatName(d.name), b.victory ? cleverapps.styles.FONTS.SMALL_WHITE_TEXT : cleverapps.styles.FONTS.WINDOW_SMALL_TEXT)
, f = new cleverapps.UI.Avatar(d)
, g = d.amount
, h = 0;
0 < g && (h = this.maxWords / g * this.perWordTime);
.2 < h && (h = .2);
var k = this.round.isWinner(d.id);
g = new AnimatedCounterComponent({
from: 0,
to: g,
font: b.victory ? cleverapps.styles.FONTS.WHITE_TEXT : cleverapps.styles.FONTS.WINDOW_TEXT,
time: h,
onFinish: function() {
k ? this.runWinAnimation(m) : this.runLoseAnimation(m)
}
.bind(this)
});
k || (f.setCascadeColorEnabled(!0),
f.runAction(new cc.TintTo(this.perWordTime * this.maxWords,120,120,120)));
var m = new cleverapps.Layout([e, f, g],{
direction: cleverapps.UI.VERTICAL,
margin: c.view.margin
});
m.avatar = f;
m.words = g;
m.name = e;
m.player = d;
return m
}, this);
this.user = this.views[0];
this.opponent = this.views[1];
this.content = new cleverapps.Layout(this.views,{
direction: cleverapps.UI.HORIZONTAL,
margin: c.margin,
padding: c.padding
});
this.setContentSize2(this.content.getContentSize());
this.addChild(this.content);
this.content.setPositionRound(this.width / 2, this.height / 2);
this.runAnimation()
},
runAnimation: function() {
this.views.forEach(function(a) {
a.words.runAnimation()
}, this)
},
runWinAnimation: function(a) {
var b = cleverapps.styles.RoundResultsComponent.animation.user;
a.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.Spawn((new cc.ScaleTo(.4,1.3)).easing(cc.easeOut(2)),new cc.MoveTo(.6,cc.p(this.content.width / 2, a.y + b.dy)))))
},
runLoseAnimation: function(a) {
var b = cleverapps.scenes.getRunningScene()
, c = 0;
0 === a.player.amount && (c = this.perWordTime * this.maxWords);
a.runAction(new cc.Sequence(new cc.DelayTime(c),new cc.CallFunc(function() {
a.name.setVisible(!1);
a.words.setVisible(!1);
a.avatar.replaceParentSamePlace(b);
a.avatar.setLocalZOrder(100);
a.avatar.runAction(new cc.RepeatForever(new cc.RotateBy(1,180)));
a.avatar.runAction(new cc.Sequence((new cc.MoveTo(1.2,cc.p(a.avatar.x, -a.avatar.height / 2))).easing(cc.easeIn(2)),new cc.RemoveSelf));
cleverapps.audio.playSound(bundles.game.urls.tournament_player_lose_effect)
}
)))
}
});
cleverapps.styles.RoundResultsComponent = {
animation: {
user: {
dy: -30
}
},
view: {
margin: 10
},
margin: 90,
padding: {
bottom: 80
}
};
var AnimatedCounterComponent = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.options = a;
this.options.scale = this.options.scale || 1.3;
this.options.onFinish = this.options.onFinish || function() {}
;
this.options.time = this.options.time || .3;
a = this.options.to - this.options.from;
this.increment = 0 < a ? 1 : 0 === a ? 0 : -1;
this.text = cleverapps.UI.generateTTFText(this.options.from, this.options.font);
this.addChild(this.text);
this.setContentSize2(this.text.getContentSize());
this.text.setPositionRound(this.width / 2, this.height / 2);
this.current = this.options.from;
this.started = this.paused = !1
},
runAnimation: function() {
this.started = !0;
this.current = this.options.from;
this.paused || this._animateStep()
},
_animateStep: function() {
if (!this.paused && this.started)
if (this.current === this.options.to + this.increment)
this.options.onFinish();
else
this.text.runAction(new cc.Sequence(new cc.ScaleTo(this.options.time,this.options.scale),new cc.CallFunc(function() {
this.text.setString(this.current);
this.options.sfx && cleverapps.audio.playSound(bundles.main.urls["countdown_effect_" + this.current])
}
.bind(this)),new cc.ScaleTo(this.options.time,1),new cc.DelayTime(this.options.time),new cc.CallFunc(function() {
this.current += this.increment;
this._animateStep()
}
.bind(this))))
}
});
cleverapps.styles.AnimatedCounterComponent = {};
var RoundCountdownComponent = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.text = cleverapps.UI.generateTTFText("RoundCountdownComponent.text", cleverapps.styles.FONTS.WHITE_TEXT);
this.addChild(this.text);
this.countdown = new AnimatedCounterComponent({
from: 3,
to: 1,
font: cleverapps.styles.FONTS.WHITE_TEXT,
scale: 1.5,
sfx: !0,
onFinish: function() {
a();
this.countdown.setVisible(!1)
}
.bind(this)
});
this.addChild(this.countdown);
cleverapps.UI.wrap(this);
cleverapps.UI.wrapWithPadding(this, cleverapps.styles.RoundCountdownComponent.padding, !0)
},
showUp: function() {
this.text.setVisible(!1);
this.countdown.setVisible(!1);
this.runAction(new cc.Sequence(new cc.DelayTime(3),new cc.CallFunc(function() {
this.text.setVisible(!0)
}
.bind(this)),new cc.DelayTime(1.5),new cc.CallFunc(function() {
this.text.setVisible(!1);
this.countdown.setVisible(!0);
this.countdown.runAnimation()
}
.bind(this))))
}
});
cleverapps.styles.RoundCountdownComponent = {
padding: {
bottom: 30
}
};
var WordsListComponent = cc.Node.extend({
ctor: function(a) {
this._super();
this.options = a;
this.setAnchorPoint(.5, .5);
a = cleverapps.styles.WordsListComponent;
var b = this.options.width - 2 * a.word.padding.x
, c = a.word.height
, d = this.options.words
, e = this.options.minimalWordsAmount;
if (d.length < e) {
e -= d.length;
for (var f = 0; f < e; f++)
d.push("")
}
d = d.map(function(g) {
return this.createWord(g, b, c)
}
.bind(this));
d = new cleverapps.GridLayout(d,{
columns: 2,
direction: cleverapps.UI.VERTICAL,
reversed: !0,
margin: a.words.margin,
padding: a.words.padding
});
f = this.createScroll(d);
e = new cc.Node;
e.setAnchorPoint(.5, .5);
e.setContentSize2(f.width, this.options.height);
e.addChild(f);
this.setContentSize2(e.width, e.height + 2 * a.topPadding);
this.addChild(e);
f.setPositionRound(this.width / 2, this.height / 2);
e.setPositionRound(this.width / 2, this.height / 2);
a = new cc.Scale9Sprite(bundles.wordlist.frames.words_border_png);
a.setContentSize(2 * b, Math.min(this.options.height, d.height));
a.setPositionRound(this.width / 2, this.height / 2);
e.addChild(a)
},
createWord: function(a, b, c) {
var d = cleverapps.styles.WordsListComponent
, e = new cc.Node;
e.setAnchorPoint(.5, .5);
e.setContentSize2(b, c);
b = this.createWordBg(b, c);
e.addChild(b);
b.setPositionRound(e.width / 2, e.height / 2);
a = cleverapps.UI.generateOnlyText(a.toUpperCase(), cleverapps.styles.FONTS.WHITE_TEXT);
e.addChild(a);
a.setPositionRound(d.word.text);
return e
},
createScroll: function(a) {
var b = cleverapps.styles.WordsListComponent;
a = new cleverapps.UI.ScrollView(a,{
outOfBoundaryScale: !1
});
a.setBarPadding(b.scroll.barPadding);
a.setContentSize2(2 * this.options.width + b.scroll.barPadding.sidePadding, b.scroll.height);
a.scrollToPercent(100);
return a
},
createWordBg: function(a, b) {
var c = cleverapps.styles.WordsListComponent.word.bg.padding
, d = new cc.Scale9Sprite(bundles.wordlist.frames.words_bg_png);
d.setContentSize2(a - c, b - c);
return d
}
});
cleverapps.styles.WordsListComponent = {
word: {
height: 70,
padding: {
x: 25
},
text: {
x: {
align: "center"
},
y: {
align: "center",
dy: -5
}
},
bg: {
padding: 3
}
},
scroll: {
height: 300,
padding: {
x: 30
},
barPadding: {
sidePadding: 20
}
},
words: {
margin: 200,
padding: {
x: 0,
y: 5
}
},
topPadding: 4
};
var PictureComponent = cc.Node.extend({
ctor: function(a) {
this._super();
this.sound = bundles.victory_window.urls.bonus_animation_effect;
var b = "bonus_animation_json";
a.isHard() && (b = "hard_animation_json",
this.sound = bundles.victory_window.urls.hard_animation_effect);
this.content = new cleverapps.Spine(bundles.victory_window.jsons[b]);
this.content.setPositionRound(cleverapps.styles.PictureComponent);
this.addChild(this.content);
this.setAnchorPoint(.5, .5);
this.setContentSize2(this.content.getContentSize())
},
showUp: function() {
this.setOpacity(0);
this.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.PlaySound(this.sound),new cc.CallFunc(function() {
this.content.setAnimation && this.content.setAnimationAndIdleAfter("showUp", "idle")
}
.bind(this))))
},
beforeWinClose: function() {
this.content.setAnimation && (this.content.setAnimation(0, "hide", !1),
this.content.setCompleteListenerRemove())
}
});
cleverapps.styles.PictureComponent = {
x: {
align: "center"
},
y: {
align: "center",
dy: -50
}
};
var PrizeBarComponent = cc.Node.extend({
ctor: function(a) {
this._super();
this.options = a || {};
this.reward = this.options.reward;
this.canClick = void 0 !== this.options.canClick ? this.options.canClick : !0;
this.addProgressBar();
this.addPrize();
this.setAnchorPoint(.5, .5);
cleverapps.UI.wrap(this);
this.state = PrizeBarComponent.STATE_ACTIVE
},
updateProgress: function(a, b, c) {
this.progressBar.setGoal(b);
if (a >= b) {
c = c || {};
var d = c.callback;
c.callback = function() {
this.setFull();
d && d()
}
.bind(this)
}
this.progressBar.setPercentage(a, c)
},
addProgressBar: function() {
var a = cleverapps.styles.PrizeBarComponent.progressBar
, b = this.options.progressBar || {}
, c = this.progressBar = new ScaledProgressBar({
progress: b.progressImage || bundles.progress_bar.frames.bar_dailytask,
background: b.progressBgImage || bundles.progress_bar.frames.bg_dailytask,
barText: b.removeBarText ? void 0 : Object.assign({
font: cleverapps.styles.FONTS.PRIZE_BAR_TEXT,
dy: a.barText.dy
}, b.barText)
});
c.setLength(b.width || a.length);
c.setPositionRound(c.width / 2, c.height / 2);
this.addChild(c)
},
addPrize: function() {
if (!this.prize && !1 !== this.options.prize) {
var a = this.prize = new cleverapps.Spine(this.options.prize || bundles.prize.jsons.prize_json);
a.setAnimation(0, "idle", !0);
cleverapps.tooltipManager.create(a, {
text: this.options.tooltipText || "Reward",
rewards: this.reward,
location: cleverapps.UI.Tooltip.LOCATION_BELOW,
size: cleverapps.styles.UI.Tooltip.SIZE.short
});
a.setPositionRound(this.options.prizePosition || cleverapps.styles.PrizeBarComponent.prize);
this.progressBar.addChild(a);
a.replaceParentSamePlace(this)
}
},
setFull: function() {
this.prize && this.state !== PrizeBarComponent.STATE_COLLECTED && (this.state = PrizeBarComponent.STATE_FULL,
this.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.CallFunc(function() {
cleverapps.tooltipManager.remove(this.prize);
cleverapps.audio.playSound(bundles.prize.urls.prize_view_created_effect);
this.addLighting();
this.addShine();
this.prize.setAnimation(0, "animation", !0);
this.canClick && (this.addFinger(),
cleverapps.UI.applyHover(this.prize),
cleverapps.UI.onClick(this.prize, this.onClick.bind(this)))
}
.bind(this)))))
},
onClick: function() {
this.animateCollected()
},
animateCollected: function() {
this.stopAllActions();
this.prize.runAction(new cc.Sequence(AnimationsLibrary.disappear(this.prize),new cc.CallFunc(function() {
this.setCollected()
}
.bind(this))))
},
setCollected: function() {
this.state = PrizeBarComponent.STATE_COLLECTED;
this.removeLighting();
this.removePrize();
this.addMark();
this.options.onCollect && this.options.onCollect()
},
addMark: function() {
if (!this.options.noMark) {
var a = this.mark = new cc.Sprite(bundles.prize.frames.mark_png);
this.addChild(a);
a.setPositionRound(cleverapps.styles.PrizeBarComponent.mark)
}
},
addLighting: function() {
var a = this.lightning = new cleverapps.Spine(bundles.progress_bar.jsons.flash_json);
a.setAnimation(0, "animation");
this.progressBar.addChild(a);
a.runAction(new cc.RepeatForever(new cc.Sequence(new cc.CallFunc(function() {
a.setVisible(!0);
a.setPositionRound(a.width / 2, this.progressBar.height / 2);
a.setAnimation(0, "animation")
}
.bind(this)),new cc.MoveTo(.4,this.progressBar.width + this.prize.width / 2 - a.width / 2,this.progressBar.height / 2),new cc.CallFunc(function() {
a.setVisible(!1)
}
),new cc.DelayTime(2))));
return a
},
removeLighting: function() {
this.lightning && (this.lightning.removeFromParent(),
delete this.lightning)
},
removePrize: function() {
this.prize && (this.stopAllActions(),
this.prize.removeFromParent(),
delete this.prize)
},
addFinger: function() {
var a = cleverapps.styles.PrizeBarComponent.prize;
FingerView.hintClick(this.prize, {
delay: 1.6,
scale: a.finger.scale,
rotation: a.finger.rotation
})
},
addShine: function() {
(this.shine = AnimationsLibrary.rays(this.prize, {
skin: "white"
})).setTimeScale(2)
},
showUp: function(a, b) {
this.progressBar.barText.setScale(0);
b = b || .2;
this.progressBar.barText.runAction(new cc.Sequence(new cc.DelayTime(b),(new cc.ScaleTo(.4,1)).easing(cc.easeBackOut())));
this.prize.setScale(0);
this.prize.runAction(new cc.Sequence(new cc.ScaleTo(0,0),new cc.Show,new cc.DelayTime(b),(new cc.ScaleTo(.4,1)).easing(cc.easeBackOut()),new cc.CallFunc(a || function() {}
)))
},
receivePrize: function() {
Object.keys(this.reward).forEach(function(a) {
a = new Reward(a,this.reward[a],{
event: this.options.rewardEvent || cleverapps.EVENTS.EARN.OTHER
});
a.receiveReward();
a.collectRewardsAnimation(this.prize, {
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION
})
}
.bind(this))
}
});
PrizeBarComponent.STATE_ACTIVE = 0;
PrizeBarComponent.STATE_FULL = 1;
PrizeBarComponent.STATE_COLLECTED = 2;
cleverapps.styles.PrizeBarComponent = {
progressBar: {
length: 400,
barText: {
dy: 1
}
},
prize: {
x: {
align: "right",
dx: 50
},
y: {
align: "center",
dy: 0
},
flyY: 10,
finger: {
scale: .7,
rotation: 20
}
},
mark: {
x: {
align: "right",
dx: 80
},
y: {
align: "center",
dy: 0
}
}
};
cleverapps.ConsoleStream = function() {
this.enabled = !1;
if (cleverapps.ConsoleStream.DEBUG_USERS[connector.platform.getUserID()] || connector.platform.oneOf(connector.SAMSUNG, connector.DISCORD) && cleverapps.config.debugMode && !cleverapps.isLocalhost())
this.permanent = !0;
(this.permanent || cleverapps.dataLoader.load(DataLoader.TYPES.CONSOLE_STREAM_START_TIME)) && this.enable()
}
;
cleverapps.ConsoleStream.prototype.enable = function(a) {
var b = cleverapps.castType(cleverapps.dataLoader.load(DataLoader.TYPES.CONSOLE_STREAM_START_TIME, {
raw: !0
}));
b || (b = Date.now(),
cleverapps.dataLoader.save(DataLoader.TYPES.CONSOLE_STREAM_START_TIME, b));
this.permanent || b + cleverapps.ConsoleStream.CONSOLE_STREAM_MAX_DURATION > Date.now() ? this.enabled || (this.enabled = !0,
this.overrideConsole()) : a && a()
}
;
cleverapps.ConsoleStream.prototype.disable = function() {
this.permanent || (cleverapps.dataLoader.remove(DataLoader.TYPES.CONSOLE_STREAM_START_TIME),
this.enabled && (this.enabled = !1,
this.baseConsoleLog && (console.log = this.baseConsoleLog,
this.baseConsoleLog = void 0),
this.baseConsoleError && (console.error = this.baseConsoleError,
this.baseConsoleError = void 0)))
}
;
cleverapps.ConsoleStream.sendMessages = function(a, b) {
// a = cleverapps.ErrorHandler.formatMessage([a].concat(b));
// b = cleverapps.config.deployment + cleverapps.LOG_ERROR_URL;
// cleverapps.isLocalhost() || cleverapps.RestClient.sendRaw(cleverapps.RestClient.METHODS.POST, b, a)
}
;
cleverapps.ConsoleStream.sendLoadingTime = function(a) {
cleverapps.config.sendLoadingTime && (cleverapps.ConsoleStream.sendMessages("LOADING TIME", [a]),
console.log(a))
}
;
cleverapps.ConsoleStream.prototype.overrideConsole = function() {
this.baseConsoleLog = console.log;
this.baseConsoleError = console.error;
console.error = console.log = function() {
var a = cleverapps.ConsoleStream.serialize(arguments);
a && (cleverapps.ConsoleStream.sendMessages("CONSOLE OUTPUT REDIRECT", [a]),
this.baseConsoleLog && this.baseConsoleLog("sended console message"));
this.baseConsoleLog.apply(this, arguments)
}
.bind(this)
}
;
cleverapps.ConsoleStream.serialize = function(a) {
for (var b = 0; b < a.length; b++)
if (cleverapps.isNodeOrElement(a[b]))
return;
return Array.from(a).map(function(c) {
return "string" === typeof c ? c : JSON.stringify(c, cleverapps.ConsoleStream.serializer())
}).join("\n")
}
;
cleverapps.ConsoleStream.serializer = function(a, b) {
var c = []
, d = [];
null == b && (b = function(e, f) {
return c[0] === f ? "[Circular ~]" : "[Circular ~." + d.slice(0, c.indexOf(f)).join(".") + "]"
}
);
return function(e, f) {
f instanceof cc.Node && (f = "[cc.Node " + f.__instanceId + "]");
if (0 < c.length) {
var g = c.indexOf(this);
~g ? c.splice(g + 1) : c.push(this);
~g ? d.splice(g, Infinity, e) : d.push(e);
~c.indexOf(f) && (f = b.call(this, e, f))
} else
c.push(f);
return null == a ? f : a.call(this, e, f)
}
}
;
cleverapps.ConsoleStream.CONSOLE_STREAM_MAX_DURATION = cleverapps.parseInterval("3 day");
cleverapps.ConsoleStream.DEBUG_USERS = cleverapps.createSet("580731438762 577203420866 585959187481 564566964211 573870870859 590442871830 59691942 __259527704018596 399150507756617730".split(" "));
var DataLoader = function() {
this.localStorage = connector.dataLoader.getLocalStorage();
this.clientSession = void 0;
this.enabled = !0;
this.corrupted = !1;
this._onSavedCallbacks = [];
this.checksum = 0;
this._queue = {};
var a = this.getLocalStoragePrefix();
Object.keys(DataLoader.TYPES).forEach(function(d) {
DataLoader.TYPES[d] = a + DataLoader.TYPES[d]
});
this.data = this.localStorage.getData(a);
var b = this.loadChecksum();
for (c in this.data)
this.addChecksum(c, this.data[c]);
var c = this.load(DataLoader.TYPES.ID);
if (this.hasKey(DataLoader.TYPES.CHECKSUM) || 0 > Version.compare("1.237.0", c && c.version))
(this.checksumMatch = this.checksum === b) || (cleverapps.config.debugMode ? console.error("checksum different storage - " + b + ", actual - " + this.checksum) : console.log("checksum different"));
this.saveChecksum();
this.resetClientSession()
};
DataLoader.prototype.setAlerted = function(a) {
this.alerted = a
}
;
DataLoader.prototype.setEnabled = function(a) {
this.enabled = !!a
}
;
DataLoader.prototype.setCorrupted = function(a) {
this.corrupted = a
}
;
DataLoader.prototype.haveSavedData = function() {
var a = this.load(DataLoader.TYPES.ID);
return connector.platform.oneOf(connector.GDCOM, connector.COOLMATHGAMES) && connector._gdComOldId ? !(!a || a.id !== connector._gdComOldId) : void 0 !== a
}
;
DataLoader.prototype.save = function(a, b, c) {
this._queue[a] = {
data: b,
options: c
};
this._runSaveTimeout()
}
;
DataLoader.prototype.onSaved = function(a) {
void 0 === this._saveTimeout ? a() : this._onSavedCallbacks.push(a)
}
;
DataLoader.prototype.processSaveQueue = function() {
for (var a in this._queue)
this._queue[a].data === DataLoader.REMOVE ? this._removeProcess(a, this._queue[a].options) : this._saveProcess(a, this._queue[a].data, this._queue[a].options);
this._queue = {};
this._saveTimeout = void 0;
for (a = 0; a < this._onSavedCallbacks.length; a++)
this._onSavedCallbacks[a]();
this._onSavedCallbacks = [];
this.saveChecksum()
}
;
DataLoader.prototype._runSaveTimeout = function() {
void 0 === this._saveTimeout && (this._saveTimeout = setTimeout(this.processSaveQueue.bind(this), 1E3))
}
;
DataLoader.prototype._saveProcess = function(a, b, c) {
c = c || {};
var d = c.limit || DataLoader.FIFO_LIMIT
, e = c.fifoKey;
c = c.raw;
if (!e || this.hasKey(a)) {
try {
var f = c ? b + "" : JSON.stringify(b)
} catch (g) {
throw console.log("error stringify - " + a, b),
g;
}
this.addChecksum(a, this.data[a]);
this.addChecksum(a, f);
this.data[a] = f;
if (a === DataLoader.TYPES.GIT || this.enabled && !this.corrupted) {
if (a !== DataLoader.TYPES.CLIENT_SESSION && (this.checkClientSession(),
this.corrupted))
return;
try {
if (void 0 !== this.clientSession && a !== DataLoader.TYPES.CLIENT_SESSION && !this.localStorage.getItem(DataLoader.TYPES.CLIENT_SESSION))
throw cleverapps.eventLogger && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.CLEARANCE.LOCALSTORAGE_CLEARED),
1;
f && f.length > DataLoader.VALUE_LENGTH_LIMIT && cleverapps.throwAsync("Attempt to save huge value (" + f.length + ") to localstorage key - " + a);
this.localStorage.setItem(a, f);
if (!connector.info.isNative && this.localStorage.getItem(a) !== f)
throw a !== DataLoader.TYPES.CLIENT_SESSION && cleverapps.eventLogger && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.CLEARANCE.LOCALSTORAGE_ERROR_SET_ITEM),
2;
} catch (g) {
this.localStorage.removeItem(DataLoader.TYPES.SESSION_SAVE_KEY),
this.setCorrupted(!0)
}
}
} else {
for (f = this.load(e) || []; f.length >= d; )
this.remove(f[0], e),
f = this.load(e);
f.push(a);
this._saveProcess(e, f);
this._saveProcess(a, b)
}
}
;
DataLoader.prototype.getCharValues = function(a) {
for (var b = [], c, d = 0; d < a.str.length; d++)
c = a.str.charCodeAt(d),
a.encode ? b.push(65517 >= c ? c + 18 : c) : b.push(65535 >= c ? c - 18 : c);
return b
}
;
DataLoader.prototype.hasKey = function(a) {
this._queue[a] ? a = this._queue[a].data : (this.data.hasOwnProperty(a) || (this.data[a] = this.localStorage.getItem(a)),
a = this.data[a]);
return null !== a && void 0 !== a
}
;
DataLoader.prototype.checkClientSession = function() {
if (cleverapps.isLocalhost())
return !0;
if (void 0 !== this.clientSession) {
var a = this.localStorage.getItem(DataLoader.TYPES.CLIENT_SESSION);
if (a && a !== this.clientSession)
return this.setCorrupted(!0),
cleverapps.eventLogger && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.CLEARANCE.LOCALSTORAGE_SESSION_EXPIRED),
cleverapps.synchronizer && cleverapps.synchronizer.clientSessionExpired(),
!1
}
return !0
}
;
DataLoader.prototype.load = function(a, b) {
if (this._queue[a]) {
var c = this._queue[a].data;
if (c === DataLoader.REMOVE)
return;
a = this._queue[a].options && this._queue[a].options.raw;
b = b && b.raw;
c = a ? c + "" : c;
return b && !a ? JSON.stringify(c) : c
}
this.data.hasOwnProperty(a) || !this.enabled && a !== DataLoader.TYPES.GIT || (this.data[a] = this.localStorage.getItem(a));
c = this.data[a];
if (null !== c && void 0 !== c && "undefined" !== c) {
if (b && b.raw)
return c;
b = JSON.parse(c);
b.dataCodes && (b = this.getCharValues({
str: b.dataCodes
}),
b = JSON.parse(String.fromCharCode.apply(null, b)));
return b
}
}
;
DataLoader.prototype.remove = function(a, b) {
this._queue[a] = {
data: DataLoader.REMOVE,
options: b
};
this._runSaveTimeout()
}
;
DataLoader.prototype._removeProcess = function(a, b) {
this._queue[a] && delete this._queue[a];
this.addChecksum(a, this.data[a]);
delete this.data[a];
this.enabled && !this.corrupted && this.localStorage.removeItem(a);
if (b) {
var c = this.load(b);
c && (a = c.indexOf(a),
0 <= a && (c.splice(a, 1),
this.save(b, c)))
}
}
;
DataLoader.prototype.cleanAll = function() {
clearTimeout(this._saveTimeout);
this._saveTimeout = void 0;
this._queue = {};
this.data = {};
this.checksum = 0;
this.saveChecksum();
this.localStorage.clearData(this.getLocalStoragePrefix());
this.resetClientSession()
}
;
DataLoader.prototype.addChecksum = function(a, b) {
a !== DataLoader.TYPES.CHECKSUM && (this.checksum ^= cleverapps.hashCode(b))
}
;
DataLoader.prototype.loadChecksum = function() {
return cleverapps.castType(this.load(DataLoader.TYPES.CHECKSUM))
}
;
DataLoader.prototype.saveChecksum = function() {
this._saveProcess(DataLoader.TYPES.CHECKSUM, this.checksum)
}
;
DataLoader.prototype.getLocalStoragePrefix = function() {
return cleverapps.config.name + connector.platform.getLocalStoragePrefix()
}
;
DataLoader.prototype.resetClientSession = function() {
this.clientSession = void 0;
this.setEnabled(!0);
this.setCorrupted(!1);
connector.info.isNative || (this.clientSession = Math.floor(1E9 * Math.random()) + 1 + "",
this._saveProcess(DataLoader.TYPES.CLIENT_SESSION, this.clientSession, {
raw: !0
}),
this.saveChecksum(),
this.corrupted && (this.setEnabled(!1),
this.setCorrupted(!1),
this.clientSession = void 0))
}
;
DataLoader.REMOVE = -12345;
DataLoader.FIFO_LIMIT = 10;
DataLoader.VALUE_LENGTH_LIMIT = 1E7;
DataLoader.TYPES = {
ID: "",
CUSTOM_DAU: "_custom_dau",
HISTORY: "_history",
CLIENT_SESSION: "_client_session",
USERS_SYNCS: "_users_syncs",
CHECKSUM: "_checksum",
SETTINGS: "_settings",
DAILY_CHEST: "_periodicBonus",
TUTORIAL: "_tutorial",
LEVEL_HINTS: "_level_hints",
PRODUCT_VIDEO_PROGRESS: "_v_p_",
GAME_SAVE_FIFO: "_game_save_fifo",
USER_IDS_HISTORY: "_ids_history",
PAYMENTS_HISTORY_5_PRICE: "_my_payments_5_price",
SALE_MANAGER: "_sale_manager",
SALE: "_sale",
SERVER_VERSION: "_server_version",
SESSION_SAVE_KEY: "_session",
PROMOTION: "_promotion",
PROMOCODES: "_promocodes",
LOCALIZATION_MANAGER: "_localization_manager",
LIVES: "_lives",
BOOSTERS: "_boosters_counter",
STAR_CHEST: "_star_chest",
BONUS_EPISODES_PROGRESS: "_bonus_episodes_progress",
VIP_LEVEL: "vip_level",
SERVER_FLAGS: "_server_flags",
BUY_MOVES_WINDOW: "_buy_moves_window",
FORCES: "_forces",
FREE_BOMB_MOVES: "_free_bomb_moves",
UNLIMITED_LIVES: "_temp_goods",
SORTER: "_sorter",
FRIEND_REQUESTS: "_friend_requests",
FAKE_REQUESTS: "_fake_request_time",
ASKED_LIVES: "_asked_lives",
ASKED_STARS: "_asked_stars",
PACK: "_pack",
DAILY_TASKS: "_daily_tasks",
ACHIEVEMENTS: "_achievements",
WIN_STREAK: "_win_seria",
LOCAL_PUSHES: "_local_pushes",
TOURNAMENT_COMPETITORS: "_tournament_competitors",
TOURNAMENT_PLAYERS: "_tournament_players",
TOURNAMENT_RECORD: "_tournament_record",
PLAY_SESSION: "_play_session",
AD_ICON: "_adicon",
SPECIAL_LIVES_OFFER_LAST_TIME: "_special_energy_offer_last_time",
THIRD_ELEMENT_LAST_TIME: "_third_element_last_time",
LEVEL_ATTEMPTS: "_level_attempts",
MONSTER_PLANNER: "_monster_planner",
GROWINGS_PLANNER: "_growings_planner",
LAST_VIEWED_FRIEND_REQUEST: "_last_viewed_friend_request",
MISSIONS: "_missions",
OFFERS: "_offers_data",
COMPETITION: "_competition",
COMPETITION_PLAYERS: "_competition_players",
COMPETITION_STATISTICS: "_competition_statistics",
PLACEMENTS: "_placements",
SUBSCRIPTION: "_subscription",
GROWTHFUND: "_growthfund",
INSTANT_BOT_CREATED: "_instant_bot_created",
HEROES: "_heroes",
CUP: "_cup",
CUP_RULES: "cup_rules",
MINI_GAME_RECORD: "_mini_game_record",
INFORMATION: "_info",
SYNC: "_sync",
LAST_SYNC_IN: "_last_sync_in",
FRIDAY_SALE: "_friday_sale",
LANTERN: "_lantern",
FARM: "_clockmaker_a",
FISHDOM: "_fishdom",
HOMEFIX: "_home",
HOMEFIX_LEVEL: "_home_level",
HOSE: "_hose",
META: "_meta",
DAILY_LEVEL: "_daily_level",
KNOCKOUT: "_knockout",
SHORTMETA: "_short",
COOKIE_JAR: "_cookie_jar",
RATED: "_rated",
SIMPLE: "_simple",
HIGHSCORE: "_loop",
JACKPOT_LAST_APPEAR_TIME: "_jackpot_last_appear_time",
ADMIN_CHART: "_admin_chart",
SCROLL: "_scroll",
MAP2D: "_map2d",
QUESTS: "_quests",
QUESTS_LOCAL: "_quests_local",
UNIT_SAVER_KICKOUTS: "_unit_saver_kickouts",
UNITS_LIBRARY: "_units_library",
UNITS_SHOP: "_units_shop",
WORKERS: "_workers",
FREE_WORKER: "_free_worker",
HARVESTED: "_harvested",
FOGS: "_fogs",
POCKET: "_pocket",
ARMY_LIBRARY: "_armylib",
CHAT: "_chat",
CONSOLE_STREAM_START_TIME: "_console_stream_start_time",
RESET_REPORT: "_reset_report",
ADS_LIMITS_DATA: "_ads_limits_data",
ENERGY_PRODUCTS: "_energy_products",
GAME_DATA: "_game_data",
ABTEST: "_abtest",
BARREL_PLANNER: "_barrel_planner",
PIXELS_PLANNER: "_pixels_planner",
THIRDELEMENTS_PLANNER: "_thirdelements_planner",
PIXEL_OFFER_PLANNER: "_pixel_offer_planner",
BUBBLES: "_bubbles",
TRAVEL_BOOK_EVENTS: "_travel_book_events_",
TRAVEL_BOOK_ATTENTION: "_travel_book_attention_",
EXPEDITION_PUSH_PLANNING_TIME: "_expedition_push_planning_time",
UNKNOWN_UNIT_TEST: "_unknown_unit_test",
USER_CLAN: "_user_clan",
SNAPSHOT_TIME_DELTA: "_snapshot_time_delta",
ARMY: "_army",
TROOP_CARDS: "_troop_cards",
TRAVEL_BOOK_HINT_TIME: "_travel_book_hint_time",
USER_DELETE: "_user_delete",
OFFER_PURCHASE_TIME: "_offer_purchase_time_",
GAME_MODES: "_game_modes",
LANDMARK_INFO: "_landmark_info",
INSTANT_TOURNAMENT: "_instcup",
SCORE: "_score",
THROWERROR: "_debug_throwerror",
TEST_SOUNDS: "_test_sounds",
LAST_SUCCESSFUL_SHARE: "_last_successful_share",
AD_OCEAN_TOKEN: "_ad_ocean_token",
GIT: "_git",
LAST_ONERROR: "_last_onerror",
AD_FROZEN: "_ad_frozen",
MULTIPLE_CONVERSIONS_INFO: "_multiple_conversions_info",
STICKERS_BOOK_INFO: "_stickers_book_info",
STICKERS_BOOK_ATTENTION: "_stickers_book_attention",
NO_ADS: "_noads",
NO_ADS_NUDGE_TIME: "_noads_nudge_time",
COUNTRY: "_country",
FRIENDS: "_friends",
INVITABLE_FRIENDS: "_invitable_friends",
PAYMENTS_HISTORY: "_my_payments",
AD_WATCH_COUNTER: "_adviews",
RUMBLE: "_rumble",
LOCATION: "location_"
};
"undefined" === typeof cc && (module.exports = DataLoader);
cleverapps.Availables = {
LEADER_BOARD: {
level: 1.2
},
DAILY_TASKS: {
level: 2.87
},
INVITE_FRIENDS_ICON: {
level: .93
},
CREATE_SHORTCUT: {
level: .33
},
JOIN_GROUP: {
level: 6
},
CLANS: {
level: 8.5,
source: ["facebook", "instant", "android", "amazon", "microsoft"],
projectName: ["mergecraft", "wondermerge", "fairy"],
cleverapps: {
debugMode: !0,
level: 8.5,
projectName: ["mergecraft", "wondermerge", "fairy"]
}
},
EXPEDITIONS: {
level: 7
},
STICKERS_BOOK: {
level: 2.66
}
};
"merge" === cleverapps.config.type && (cleverapps.Availables.DAILY_TASKS = {
level: 6
},
cleverapps.Availables.INVITE_FRIENDS_ICON = {
level: 6.8
},
cleverapps.Availables.CREATE_SHORTCUT = {
level: 3
},
cleverapps.Availables.PIXELS = {
level: 4.5
},
cleverapps.Availables.PIXELOFFER = {
level: 4.5
},
cleverapps.Availables.UNITMAGNET = {
level: 6.5
},
cleverapps.Availables.TRADE = {
gameLevel: 7
});
"tile3" === cleverapps.config.type && (cleverapps.Availables.EXTRA_SLOT = {
level: 2.66,
projectName: ["zenmatch"]
});
"blocks" === cleverapps.config.type && (cleverapps.Availables.FREE_PROLONGATION = {
level: .26,
projectName: ["woodenblock"]
});
cleverapps.Settings = function() {
cleverapps.EventEmitter.call(this);
this.onChangeSoundListener = function() {}
;
this.onChangeMusicListener = function() {}
;
this.load()
}
;
cleverapps.Settings.prototype = Object.create(cleverapps.EventEmitter.prototype);
cleverapps.Settings.prototype.constructor = cleverapps.Settings;
cleverapps.Settings.getDefaultLanguage = function() {
var a = cleverapps.config.languages;
if (1 === a.length)
return a[0];
var b = connector.info.language;
if (-1 === a.indexOf(b) || b === cc.sys.LANGUAGE_ENGLISH) {
b = connector.platform.listSuggestedLanguages();
for (var c = 0; c < b.length; c++) {
var d = b[c];
if (-1 !== a.indexOf(d))
return d
}
return cc.sys.LANGUAGE_ENGLISH
}
return b
}
;
cleverapps.Settings.prototype.getSaveInfo = function() {
return {
sound: this.sound,
music: this.music,
language: this.language
}
}
;
cleverapps.Settings.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.SETTINGS, this.getSaveInfo());
cleverapps.synchronizer.addUpdateTask("settings")
}
;
cleverapps.Settings.prototype.loadData = function(a) {
if (void 0 === a)
this.music = this.sound = !0,
this.language = cleverapps.Settings.getDefaultLanguage(),
this.save();
else if (this.sound = a.sound,
this.music = a.music,
this.language = a.language,
this.manualResolution = a.manualResolution)
cleverapps.resolution.resolutionName = this.manualResolution;
void 0 === this.language && (this.language = cleverapps.Settings.getDefaultLanguage());
connector.info.changeLanguage(this.language);
this.updateTesterCountry()
}
;
cleverapps.Settings.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.SETTINGS);
this.loadData(a)
}
;
cleverapps.Settings.prototype.toggleSound = function() {
this.sound = !this.sound;
console.log("Settings toggle sound", this.sound, cc.game.isPaused());
this.save();
this.onChangeSoundListener()
}
;
cleverapps.Settings.prototype.toggleMusic = function() {
this.music = !this.music;
cleverapps.audio.onChangeMusic();
console.log("Settings toggle music", this.music, cc.game.isPaused());
this.save();
this.onChangeMusicListener()
}
;
cleverapps.Settings.prototype.setLanguage = function(a) {
this.language = a;
this.save();
connector.info.changeLanguage(this.language);
this.updateTesterCountry()
}
;
cleverapps.Settings.prototype.updateTesterCountry = function() {
connector.platform.isTester() && (this.language === connector.LANGUAGE_RUSSIAN ? connector._countryManager.forceCountry("RU") : connector._countryManager.forceCountry("OTHER"))
}
;
cleverapps.Settings.prototype.updateDependents = function() {
this.language === cc.sys.LANGUAGE_RUSSIAN && cleverapps.dailyLevel && !cleverapps.dailyLevel.currentEvent && cleverapps.dailyLevel.load();
"board" === cleverapps.config.type && (levels.user.resetEpisodesAmount(),
cleverapps.hose && (cleverapps.hose.reset(),
cleverapps.hose.updateLocationsAmount()))
}
;
cleverapps.Settings.prototype.setManualResolution = function(a) {
this.manualResolution = a;
a = this.getSaveInfo();
a.manualResolution = this.manualResolution;
cleverapps.dataLoader.save(DataLoader.TYPES.SETTINGS, a);
cleverapps.dataLoader.processSaveQueue();
window.location.reload()
}
;
var Base80 = {
expandNumber: function(a) {
var b = 0
, c = 1;
a.split("").reverse().forEach(function(d) {
void 0 === Base80.DECODE_NUMBERS[d] && (b = NaN);
b += Base80.DECODE_NUMBERS[d] * c;
c *= 80
});
return b
},
compactNumber: function(a, b) {
var c = "";
if (0 === a)
c = Base80.STR.charAt(0);
else
for (; 0 < a || !c; )
c += Base80.ENCODE_NUMBERS[a % 80],
a = Math.floor((a - a % 80) / 80);
if (b)
for (; c.length < b; )
c += Base80.STR.charAt(0);
return c.split("").reverse().join("")
},
STR: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=!#$%&()*-<>?@^|",
ENCODE_NUMBERS: {},
DECODE_NUMBERS: {}
};
(function() {
Base80.STR.split("").forEach(function(a, b) {
Base80.ENCODE_NUMBERS[b] = a;
Base80.DECODE_NUMBERS[a] = b
})
}
)();
"undefined" === typeof cc && (module.exports = Base80);
cleverapps.Event = function(a) {
this.features = a.features || [];
this.options = a.options || {};
this.projects = a.projects;
this.networks = a.networks;
this.start = this.convertTimezone(a.start);
this.finish = this.convertTimezone(a.finish);
this.toolApplicable = a.toolApplicable
}
;
cleverapps.Event.prototype.convertTimezone = function(a) {
a = new Date(a);
a.setMinutes(a.getMinutes() + a.getTimezoneOffset());
return a
}
;
cleverapps.Event.prototype.isRunning = function() {
return this.start.getTime() <= Date.now() && Date.now() <= this.finish.getTime()
}
;
cleverapps.Event.prototype.getTimeBeforeStart = function() {
return Math.max(0, this.start.getTime() - Date.now())
}
;
cleverapps.Event.prototype.getTimeAfterFinish = function() {
return Math.max(0, Date.now() - this.finish.getTime())
}
;
cleverapps.Event.prototype.getTimeLeft = function() {
return this.finish.getTime() - Date.now()
}
;
cleverapps.Event.prototype.getStartTime = function() {
return this.start.getTime()
}
;
cleverapps.Event.prototype.isAvailable = function() {
return this.networks && (Array.isArray(this.networks) && !this.networks.includes(connector.info.source) || this.networks.except && this.networks.except.includes(connector.info.source)) || this.projects && -1 === this.projects.indexOf(cleverapps.config.name) ? !1 : !0
}
;
var EventManager = function() {
this.currentFeatures = {};
this.events = [];
bundles.main.jsons.friday_schedule && (this.events = bundles.main.jsons.friday_schedule.getJson().filter(function(a) {
return !a.debug || cleverapps.config.debugMode
}).map(function(a) {
return new cleverapps.Event(a)
}));
this.setCurrentFeatures()
};
EventManager.prototype.isActive = function(a) {
return this.currentFeatures[a] && this.currentFeatures[a].isRunning()
}
;
EventManager.prototype.listCurrentFeatures = function() {
return Object.keys(this.currentFeatures).filter(function(a) {
return this.currentFeatures[a].isRunning()
}, this)
}
;
EventManager.prototype.getFeatureEvent = function(a) {
return this.currentFeatures[a]
}
;
EventManager.prototype.isEventApplicable = function(a) {
return cleverapps.config.debugMode && void 0 !== a.toolApplicable ? a.toolApplicable : a.isRunning() && a.isAvailable()
}
;
EventManager.prototype.setCurrentFeatures = function() {
var a = this.events.filter(this.isEventApplicable.bind(this));
this.currentFeatures = {};
a.forEach(function(b) {
b.features.forEach(function(c) {
this.currentFeatures[c] = b
}
.bind(this))
}, this)
}
;
EventManager.prototype.listFeatureEvents = function(a) {
return this.events.filter(function(b) {
return b.features.includes(a) && b.isAvailable()
})
}
;
EventManager.prototype.getNextFeatureEvent = function(a) {
return this.listFeatureEvents(a).filter(function(b) {
return 0 < b.getTimeBeforeStart()
}).sort(function(b, c) {
return b.getTimeBeforeStart() - c.getTimeBeforeStart()
})[0]
}
;
EventManager.prototype.getLastFeatureEvent = function(a) {
return this.listFeatureEvents(a).filter(function(b) {
return 0 < b.getTimeAfterFinish()
}).sort(function(b, c) {
return b.getTimeAfterFinish() - c.getTimeAfterFinish()
})[0]
}
;
EventManager.prototype.setCustomFeature = function(a, b) {
var c = {
features: [a],
start: void 0,
finish: void 0
}
, d = new Date;
d.setMinutes(d.getMinutes() - d.getTimezoneOffset());
d.setSeconds(d.getSeconds() - 1);
c.start = d.toISOString();
d.setMilliseconds(d.getMilliseconds() + b);
c.finish = d.toISOString();
b = this.events.filter(function(e) {
return -1 !== e.features.indexOf(a)
});
b.length ? b.forEach(function(e) {
e.start = e.convertTimezone(c.start);
e.finish = e.convertTimezone(c.finish)
}) : this.events.push(new cleverapps.Event(c));
this.setCurrentFeatures()
}
;
var Placements = function() {
this.data = Placements.ENTRIES;
this.sortKeys();
this.load();
cleverapps.whenAllInitialized(function() {
this.run(Placements.STARTUP)
}
.bind(this));
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, cleverapps.throttle(1E3, function() {
this.run(Placements.ONSHOW)
}
.bind(this)))
};
Placements.prototype.onFocusLostListenerPlacements = function() {
cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition() ? this.run(Placements.FREE_FOCUS_MAIN) : cleverapps.environment.isGameScene() ? this.run(Placements.FREE_FOCUS_GAME) : this.run(Placements.FREE_FOCUS_OTHER)
}
;
Placements.prototype.sortKeys = function() {
this.sortedKeys = Object.keys(this.data);
this.sortedKeys.sort(function(a, b) {
a = this.data[a];
b = this.data[b];
return (b.priority || 0) - (a.priority || 0)
}
.bind(this));
this.keysByType = {}
}
;
Placements.prototype.listKeys = function(a) {
if (this.keysByType[a])
return this.keysByType[a];
var b = this.sortedKeys.filter(function(c) {
return 0 !== (this.data[c].type & a)
}, this);
return this.keysByType[a] = b
}
;
Placements.prototype.resetAllPlacements = function() {
this.lastStarts = {};
this.onceStarts = {};
this.save()
}
;
Placements.prototype.run = function(a, b) {
b = b || {};
a = this.listKeys(a);
for (var c = 0; c < a.length; c++) {
var d = a[c]
, e = this.data[d];
if (!(("function" === typeof e.once ? e.once() : e.once) && this.onceStarts[d])) {
if (e.interval) {
var f = cleverapps.parseInterval(e.interval);
if ((this.lastStarts[d] || 0) + f > Date.now())
continue
}
if (e.delayFromStart && !b.skipDelayFromStart && (f = cleverapps.parseInterval(e.delayFromStart),
(cleverapps.user.visited || 0) + f > Date.now()))
continue;
if (!e.filter || e.filter())
if (f = 0 !== (e.type & Placements.FREE_FOCUS),
!f || !cleverapps.focusManager.isFocused()) {
e.action();
this.lastStarts[d] = Date.now();
if ("function" === typeof e.once ? e.once() : e.once)
this.onceStarts[d] = !0;
if (f && cleverapps.focusManager.isFocused())
break
}
}
}
this.save()
}
;
Placements.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.PLACEMENTS) || {};
this.onceStarts = a.onceStarts || {};
this.lastStarts = a.lastStarts || {}
}
;
Placements.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.PLACEMENTS, this.getInfo())
}
;
Placements.prototype.getInfo = function() {
return {
lastStarts: this.lastStarts
}
}
;
Placements.STARTUP = 1;
Placements.ONSHOW = 2;
Placements.INTERMEDIATE = 4;
Placements.AFTER_GAME_FINISH = 16;
Placements.FREE_FOCUS_MAIN = 32;
Placements.FREE_FOCUS_GAME = 64;
Placements.FREE_FOCUS_OTHER = 128;
Placements.ONSHOW_OR_STARTUP = Placements.ONSHOW | Placements.STARTUP;
Placements.INTERMEDIATE_OR_AFTER_FINISH = Placements.INTERMEDIATE | Placements.AFTER_GAME_FINISH;
Placements.FREE_FOCUS = Placements.FREE_FOCUS_MAIN | Placements.FREE_FOCUS_GAME | Placements.FREE_FOCUS_OTHER;
Placements.ENTRIES = {
displaySceneIntro: {
type: Placements.FREE_FOCUS,
priority: 100,
filter: function() {
return !cleverapps.scenes.getRunningScene().introShown
},
action: function() {
var a = cleverapps.scenes.getRunningScene();
cleverapps.focusManager.display({
focus: "Scene.intro",
control: a.introControls(),
action: function(b) {
a.introShown = !0;
a.playIntro(b)
}
})
}
},
recalculateFlags: {
type: Placements.ONSHOW_OR_STARTUP | Placements.INTERMEDIATE_OR_AFTER_FINISH,
action: function() {
cleverapps.flags.update()
}
},
versionCheck: {
type: Placements.ONSHOW_OR_STARTUP,
action: function() {
cleverapps.versionChecker.check()
},
interval: "1 hour"
},
versionCheckAlert: {
type: Placements.FREE_FOCUS,
priority: 11,
filter: function() {
return cleverapps.versionChecker.needUpdate()
},
action: function() {
cleverapps.focusManager.display({
focus: "VersionChecker.Alert",
action: function(a) {
new NewVersionWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
},
snapshotPlayActions: {
type: Placements.FREE_FOCUS,
priority: -1E3,
filter: function() {
return !cleverapps.config.wysiwygMode && cleverapps.loadedSnapshot && cleverapps.loadedSnapshot.actions && cleverapps.loadedSnapshot.actions.length && !cleverapps.loadedSnapshot._played
},
action: function() {
cleverapps.loadedSnapshot._played = !0;
console.log("loaded snapshot played");
cleverapps.snapshots.playActions(cleverapps.loadedSnapshot.actions)
}
},
prefabPlayerRun: {
type: Placements.FREE_FOCUS,
priority: -1E3,
filter: function() {
return cleverapps.prefabPlayer && !cleverapps.prefabPlayer.options.download && !cleverapps.prefabPlayer._played
},
action: function() {
cleverapps.prefabPlayer._played = !0;
console.log("prefabPlayer run");
cleverapps.prefabPlayer.run()
}
},
interstitialNoOutcomeGames: {
type: Placements.FREE_FOCUS,
priority: 0,
filter: function() {
return !cleverapps.config.wysiwygMode && "merge" === cleverapps.config.type && InterstitialAction.checkLastFocus() && cleverapps.adsLimits.state(AdsLimits.TYPES.INTERSTITIAL) === AdsLimits.STATE_READY
},
action: function() {
cleverapps.rewardedAdsManager.showInterstitial()
},
delayFromStart: "3 minutes"
},
createShortcut: {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return connector.platform.canCreateShortcut() && levels.user.checkAvailable(cleverapps.Availables.CREATE_SHORTCUT)
},
action: function() {
connector.platform.createShortcutCallback()
},
interval: "10 minutes"
},
joinGroup: {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return connector.social.isSupportsNativeCommunityJoin && levels.user.checkAvailable(cleverapps.Availables.JOIN_GROUP)
},
action: function() {
connector.social.joinCommunityNativeCallback()
},
interval: "7 days",
delayFromStart: "10 minutes"
},
showRestore: {
type: Placements.FREE_FOCUS,
action: function() {
cleverapps.paymentsLogic.showRestore()
}
},
subscriptionOffer: {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return cleverapps.subscription.needDisplayWindow()
},
action: function() {
cleverapps.focusManager.display({
focus: "SubscriptionWindow",
action: function(a) {
new SubscriptionWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
},
interval: connector.platform.oneOf(connector.OK) ? "1 day" : "3 day",
delayFromStart: "10 minutes"
},
promotion: {
type: Placements.FREE_FOCUS_MAIN,
priority: -1,
filter: function() {
return cleverapps.crossPromo.isReady()
},
action: function() {
cleverapps.focusManager.display({
focus: "CrossPromoWindow",
action: function(a) {
cleverapps.CrossPromo.ShowFirstAvailable();
cleverapps.focusManager.onceNoWindowsListener = a
}
})
},
interval: "3 days",
delayFromStart: "10 seconds"
},
minigameNudge: {
type: Placements.FREE_FOCUS_MAIN,
priority: 4,
filter: function() {
return 0 < cleverapps.missionManager.getPlayableMissions().length
},
action: function() {
for (var a = cleverapps.missionManager.getPlayableMissions(), b = 0; b < a.length; b++) {
var c = a[b];
if (c.nudgeWindow && c.started && (void 0 === c.needShowStartWindow || c.needShowStartWindow)) {
cleverapps.focusManager.display({
focus: "NudgeWindow",
action: function(d) {
new c.nudgeWindow(c);
cleverapps.focusManager.onceNoWindowsListener = d
}
});
break
}
}
},
interval: "10 minutes"
},
missionShowNewState: {
type: Placements.FREE_FOCUS_MAIN,
priority: 1E3,
filter: function() {
return cleverapps.missionManager.getWantToShowNewStateMission()
},
action: function() {
var a = cleverapps.missionManager.getWantToShowNewStateMission();
cleverapps.focusManager.display({
focus: "missionWindow",
action: function(b) {
new a.view(a);
cleverapps.focusManager.onceNoWindowsListener = b
}
})
}
},
localstorageDisabled: {
type: Placements.FREE_FOCUS_MAIN,
priority: 8,
filter: function() {
return !cleverapps.dataLoader.enabled && !cleverapps.dataLoader.alerted
},
action: function() {
cleverapps.dataLoader.setAlerted(!0);
cleverapps.focusManager.display({
focus: "LocalStorageDisabledWindow",
action: function(a) {
new LocalStorageDisabledWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
},
sideBarIcons: {
type: Placements.FREE_FOCUS,
action: function() {
cleverapps.sideBar.resetOnFreeFocus()
}
},
sideBarForce: {
type: Placements.FREE_FOCUS,
priority: 7,
filter: function() {
return !cleverapps.environment.isGameScene() && void 0 !== cleverapps.sideBar.anyIconWithForceIndex()
},
action: function() {
cleverapps.sideBar.showAnyForce()
}
},
triggerGameCounter: {
type: Placements.FREE_FOCUS_GAME,
priority: 0,
filter: function() {
return Game.currentGame
},
action: function() {
Game.currentGame.counter.trigger()
}
},
triggerMap2dCounter: {
type: Placements.FREE_FOCUS_MAIN,
priority: 0,
filter: function() {
return "undefined" !== typeof Map2d && Map2d.currentMap
},
action: function() {
Map2d.currentMap.counter.trigger()
}
},
toolbarForce: {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return cleverapps.toolbar.anyItemWithForce()
},
action: function() {
cleverapps.toolbar.showAnyForce()
}
},
offerManagerProcess: {
type: Placements.FREE_FOCUS,
filter: function() {
return cleverapps.environment.isMainScene() && !cleverapps.config.demoMode
},
action: function() {
cleverapps.offerManager.refreshAll();
var a = cleverapps.offerManager.findOfferWithPendingWindow();
!a || cleverapps.loadedSnapshot || cleverapps.config.wysiwygMode || cleverapps.offerManager.showOfferWindow(a)
}
},
displayPassWindow: {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
var a = cleverapps.missionManager.findLocalPass();
return a && a.logic.needDisplayWindow() && !cleverapps.config.demoMode
},
action: function() {
var a = cleverapps.missionManager.findLocalPass();
a.isRunning() ? a.logic.displayWindow() : cleverapps.focusManager.display({
focus: "missionCompleted" + a.name,
action: function(b) {
a.displayCompleted(b)
}
})
}
},
localPushes: {
type: Placements.ONSHOW_OR_STARTUP,
action: function() {
cleverapps.localPushes.onShow()
}
},
syncClientSessionExpiredWindow: {
type: Placements.FREE_FOCUS,
priority: 1E4,
filter: function() {
return cleverapps.synchronizer.needClientSessionExpiredWindow()
},
action: function() {
cleverapps.synchronizer.showClientSessionExpiredWindow()
}
},
syncReloadWindow: {
type: Placements.FREE_FOCUS,
priority: 10001,
filter: function() {
return cleverapps.synchronizer._syncIn.needShowReloadWindow()
},
action: function() {
cleverapps.synchronizer._syncIn.showReloadWindow()
}
},
syncSocialConnectWindow: {
type: Placements.FREE_FOCUS,
priority: 11,
filter: function() {
return cleverapps.synchronizer.wantsSocialConnectWindow
},
action: function() {
cleverapps.synchronizer.displaySocialConnectWindow()
}
},
sync: {
type: Placements.ONSHOW,
action: function() {
cleverapps.synchronizer.syncWhenReady()
},
interval: "30 seconds"
},
checkConnection: {
type: Placements.FREE_FOCUS,
filter: function() {
var a = {
level: 1.13,
crazy: {
level: .26
},
yandex: {
level: .26
}
};
"merge" === cleverapps.config.type && (a = {
level: 5
});
return !cleverapps.flags.nologin && !connector.social.isLoggedIn() && cleverapps.user.checkAvailable(a)
},
action: function() {
cleverapps.focusManager.display({
focus: "checkConnection",
action: function(a) {
cleverapps.SocialManager.enforceLogin(a, {
withWindow: !0
})
}
})
},
interval: "7 days"
},
mergeRateWindow: {
type: Placements.FREE_FOCUS,
filter: function() {
return "merge" === cleverapps.config.type && RateWindow.CanRate()
},
action: function() {
cleverapps.focusManager.display({
focus: "nativePlacementRate",
action: function(a) {
new RateWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
},
subscriptionReload: {
type: Placements.ONSHOW_OR_STARTUP,
filter: function() {
return cleverapps.subscription
},
action: function() {
cleverapps.subscription.reload()
}
},
runCounterStages: {
type: Placements.FREE_FOCUS,
priority: 1,
action: function() {
"merge" === cleverapps.config.type && Game.currentGame && Game.currentGame.showUpFinished && !Game.currentGame.counter.isActive() && Game.currentGame.counter.trigger()
}
},
missionManagerProcess: {
type: Placements.FREE_FOCUS,
priority: 2,
filter: function() {
return cleverapps.environment.isMainScene() && !cleverapps.config.demoMode
},
action: function() {
cleverapps.missionManager.run();
var a = cleverapps.missionManager.pendingStartWindow();
a && cleverapps.missionManager.showStartWindow(a)
},
delayFromStart: "1 minutes"
},
missionFinished: {
type: Placements.FREE_FOCUS,
priority: 5,
filter: function() {
if (!cleverapps.config.demoMode && (cleverapps.missionManager.removeSilents(),
cleverapps.environment.isMainScene()))
return cleverapps.missionManager.wantsToShowCompleted()
},
action: function() {
var a = cleverapps.missionManager.wantsToShowCompleted();
a && cleverapps.focusManager.display({
focus: "missionCompleted" + a.name,
action: function(b) {
a.displayCompleted(b)
}
})
}
},
missionStartWindow: {
type: Placements.FREE_FOCUS,
priority: 6,
filter: function() {
return cleverapps.environment.isMainScene() && cleverapps.missionManager.pendingStartWindow()
},
action: function() {
cleverapps.missionManager.showStartWindow(cleverapps.missionManager.pendingStartWindow())
}
},
missionReplaceOld: {
type: Placements.FREE_FOCUS,
priority: 7,
filter: function() {
return cleverapps.missionManager.getUnfinishedOldMission()
},
action: function() {
cleverapps.missionManager.replaceOldMission()
}
},
showChatPresents: {
priority: 1,
type: Placements.FREE_FOCUS,
filter: function() {
return void 0 !== cleverapps.chatPresents && (cleverapps.environment.isMainScene() || cleverapps.environment.isGameScene())
},
action: function() {
cleverapps.chat.giveRewards()
}
},
subscriptionReward: {
type: Placements.FREE_FOCUS_MAIN,
interval: "1 day",
filter: function() {
return cleverapps.subscription.isRewardReady() && Subscription.IsAvailable()
},
action: function() {
cleverapps.focusManager.display({
focus: "SubscriptionReward",
action: function(a) {
new ShopWindow({
tab: ShopWindow.TABS.HARD_CURRENCY,
priorityType: SubscriptionTile,
finger: !0
});
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
},
returnBonus: {
type: Placements.FREE_FOCUS,
priority: 50,
filter: function() {
return !cleverapps.loadedSnapshot && cleverapps.returnBonus.shouldReward()
},
action: function() {
cleverapps.returnBonus.giveReward()
}
},
fallSaleWindow: {
type: Placements.FREE_FOCUS_MAIN,
priority: 50,
once: !0,
filter: function() {
return cleverapps.fallSale.needToShowWindow()
},
action: function() {
cleverapps.fallSale.showWindow()
}
},
dailyCupReward: {
type: Placements.FREE_FOCUS,
filter: function() {
return cleverapps.dailyCup.getReward()
},
action: function() {
cleverapps.focusManager.display({
focus: "dailyCupReward",
action: function(a) {
cleverapps.dailyCup.receiveReward(a)
}
})
}
},
weeklyCupReward: {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return cleverapps.weeklyCup.getReward()
},
action: function() {
cleverapps.focusManager.display({
focus: "weeklyCupReward",
action: function(a) {
cleverapps.weeklyCup.receiveReward(a)
}
})
}
},
clanCupReward: {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return cleverapps.clanCup.getReward()
},
action: function() {
cleverapps.focusManager.display({
focus: "clanCupReward",
action: function(a) {
cleverapps.clanCup.receiveReward(a)
}
})
}
},
subscribeBot: {
type: Placements.STARTUP,
filter: function() {
return cleverapps.platformLogic.subscribeBot
},
action: function() {
cleverapps.platformLogic.subscribeBot()
},
interval: "3 days"
},
loadOldUserId: {
type: Placements.ONSHOW_OR_STARTUP,
filter: function() {
return cleverapps.platformLogic.loadOldUserId && !cleverapps.platformLogic.oldUserId
},
action: function() {
cleverapps.platformLogic.loadOldUserId(function(a) {
a && (console.log("old userId loaded", a),
cleverapps.platformLogic.oldUserId = a,
cleverapps.userIdsHistory.add(a))
})
},
interval: "1 hour"
},
syncOldUserId: {
type: Placements.FREE_FOCUS,
priority: 12,
filter: function() {
return cleverapps.platformLogic.oldUserId && cleverapps.synchronizer.isReady()
},
action: function() {
cleverapps.synchronizer.getProgress(cleverapps.platformLogic.oldUserId, {
acceptOnlyIfBetter: !0,
callback: function() {
cleverapps.platformLogic.oldUserId = void 0
}
})
}
},
checkAdBlock: {
type: Placements.FREE_FOCUS_MAIN,
once: !0,
filter: function() {
return cleverapps.config.debugMode
},
action: function() {
connector.ads.checkAdBlockCallback(function(a) {
a && cleverapps.focusManager.display({
focus: "AdBlockWindow",
action: function(b) {
new AdBlockWindow;
cleverapps.focusManager.onceNoWindowsListener = b
}
})
})
}
},
reportScore: {
type: Placements.ONSHOW_OR_STARTUP,
filter: function() {
return !connector.platform.oneOf(connector.GAMESNACK, connector.YOUTUBE)
},
action: function() {
cleverapps.instantTournament.isAvailable() ? cleverapps.instantTournament.reportScore() : cleverapps.scoreTracker.report()
}
},
wechatShutdown: {
type: Placements.FREE_FOCUS,
priority: 1E4,
once: !0,
filter: function() {
return "fairy" === cleverapps.config.name && connector.platform.oneOf(connector.WECHAT)
},
action: function() {
cleverapps.focusManager.display({
focus: "WechatShutdownWindow",
action: function(a) {
new WechatShutdownWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
},
chat: {
type: Placements.ONSHOW,
action: function() {
cleverapps.chat.load()
},
interval: "1 minute"
},
friendRequests: {
type: Placements.ONSHOW_OR_STARTUP,
action: function() {
levels.friendRequests.serverReload(!0);
FakeRequestSender.sendIfNeed()
},
interval: "1 minute"
}
};
var PlaySession = function() {
this.load();
this.onEndSessionListeners = [PlaySession.RewardedReporter, PlaySession.BannerAdReporter, PlaySession.DailyTasksReporter, PlaySession.HelpByAttemptsReporter, PlaySession.SettingsReporter, PlaySession.CupsReporter, PlaySession.MiniGameReporter, PlaySession.MissionReporter, PlaySession.OfferReporter, PlaySession.BonusWorldReporter, PlaySession.GrowthFundReporter, PlaySession.ExpeditionReporter, PlaySession.DebugReporter, PlaySession.ClansReporter, PlaySession.UnitsReporter, PlaySession.ActiveTimeReporter, PlaySession.AbtestReporter, PlaySession.LocalPushesReporter, PlaySession.ContextLostReporter, PlaySession.OkSessionReporter, PlaySession.StickersBookReporter, PlaySession.MetaLocationReporter, PlaySession.FpsReporter, PlaySession.AdBlockReporter];
"blocks" === cleverapps.config.type && this.onEndSessionListeners.push(PlaySession.BlocksGameLevelsReporter);
this.onNotifyActiveListener = function() {}
};
PlaySession.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.PLAY_SESSION);
a || (a = {});
this.data = a
}
;
PlaySession.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.PLAY_SESSION, this.data)
}
;
PlaySession.prototype.endSession = function() {
this.onEndSessionListeners.forEach(function(a) {
a(this.data)
}, this);
this.data = {};
this.save()
}
;
PlaySession.prototype.inc = function(a, b, c) {
void 0 === b && (b = 1);
var d = this.data[a];
void 0 === d && (d = 0);
c && (d = d || {},
d[c] = d[c] ? d[c] + b : b);
this.set(a, c ? d : d + b)
}
;
PlaySession.prototype.set = function(a, b, c) {
void 0 !== c ? (this.data[a] = this.data[a] || {},
this.data[a][c] = b) : this.data[a] = b;
this.save()
}
;
PlaySession.prototype.get = function(a) {
return this.data[a]
}
;
PlaySession.prototype.notifyActive = cleverapps.throttle(cleverapps.parseInterval("1 minute"), function() {
this.inc(cleverapps.EVENTS.STATS.ACTIVE_TIME);
var a = cleverapps.travelBook.getCurrentExpedition();
a && this.inc("expActive", 1, a.id);
this.onNotifyActiveListener()
});
PlaySession.prototype.reportNewUser = function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REGISTERED);
var a = cleverapps.user.channel;
if (a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CHANNEL + a);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CHANNEL_OS + a + "_" + connector.info.os);
var b = cleverapps.info.getUserAgent();
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CHANNEL_UA + a + "_" + b.browser + b.version);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CHANNEL_COUNTRY + a + "_" + c)
});
cleverapps.whenAllInitialized(function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CHANNEL_APP_INITIALIZE + a)
});
this.onNotifyActiveListener = function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.CHANNEL_ACTIVE_TIME + a)
}
;
connector.platform.oneOf(connector.CLEVERAPPS) && a.includes("goo") && cleverapps.consoleStream.enable();
cleverapps.info.reportIP()
}
}
;
PlaySession.AbtestReporter = function(a) {
var b;
for (b in a.expActive) {
var c = (c = TravelBook.findPageById(b)) && c.prefix ? "_" + c.prefix : "";
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.STATS.ACTIVE_TIME + c, {
value: a.expActive[b],
expedition: b
});
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.STATS.ACTIVE_TIME_DAU + c, {
expedition: b
})
}
if (c = a[cleverapps.EVENTS.STATS.ACTIVE_TIME])
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.STATS.ACTIVE_TIME, {
value: c,
expedition: "main"
}),
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.STATS.ACTIVE_TIME_DAU, {
expedition: "main"
});
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.STATS.DAU, {
expedition: "main"
});
for (b in a[cleverapps.EVENTS.EXPEDITION_DAU])
c = (c = TravelBook.findPageById(b)) && c.prefix ? "_" + c.prefix : "",
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.EXPEDITION_DAU + c, {
expedition: b
})
}
;
PlaySession.ActiveTimeReporter = function(a) {
a = a[cleverapps.EVENTS.STATS.ACTIVE_TIME] || 0;
var b = 3 >= cleverapps.user.getDaysSinceRegistration() ? "new" : "old";
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.ACTIVE_TIME + "_" + b, {
value: a
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.ACTIVE_TIME_DAU + "_" + b)
}
;
PlaySession.SettingsReporter = function() {
cleverapps.whenAllInitialized(function() {
var a = !!cleverapps.config.webpSupport;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.RESOLUTION + cleverapps.resolution.resolutionName);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.WEBP + a);
connector.platform.oneOf(connector.WECHAT) && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.OS + connector.info.os),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PLATFORM + connector.info.platform));
connector.info.androidVersion && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.ANDROID_VERSION + connector.info.androidVersion)
})
}
;
PlaySession.RewardedReporter = function(a) {
a[cleverapps.EVENTS.STATS.REWARDED_AVAILABLE_DAU] && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_AVAILABLE_DAU),
cleverapps.country.whenReady(function(b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_AVAILABLE_DAU + "_country_" + b)
}));
a[cleverapps.EVENTS.STATS.REWARDED_NOADS_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_NOADS_DAU);
a[cleverapps.EVENTS.STATS.REWARDED_ERROR_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_ERROR_DAU);
a[cleverapps.EVENTS.STATS.REWARDED_DAU] && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_DAU),
cleverapps.country.whenReady(function(b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_DAU + "_country_" + b)
}));
a[cleverapps.EVENTS.STATS.REWARDED_LOADED_DAU] && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_LOADED_DAU),
cleverapps.country.whenReady(function(b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.REWARDED_LOADED_DAU + "_country_" + b)
}));
a[cleverapps.EVENTS.ADS.SESSION_FINISH_REWARDED] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.SESSION_FINISH_REWARDED, {
value: a[cleverapps.EVENTS.ADS.SESSION_FINISH_REWARDED]
});
if (a = a[cleverapps.EVENTS.STATS.VIP_REWARDED_WATCHED])
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.VIP_REWARDED_WATCHED, {
value: a
}),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.VIP_REWARDED_DAU)
}
;
PlaySession.BannerAdReporter = function(a) {
a[cleverapps.EVENTS.STATS.BANNER.DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.BANNER.DAU);
var b = cleverapps.EVENTS.ADS.TYPE + "banner";
a[b] && cleverapps.eventLogger.logEvent(b, {
value: a[b],
impressions: a[cleverapps.EVENTS.ADS.TYPE + "banner-impressions"]
})
}
;
PlaySession.HelpByAttemptsReporter = function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.HELP_BY_ATTEMPTS_DAU);
a = a[cleverapps.EVENTS.HELP_BY_FIVE_ATTEMPTS];
1 <= a && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.HELP_BY_ATTEMPTS_ONE_AND_MORE);
3 <= a && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.HELP_BY_ATTEMPTS_THREE_AND_MORE);
5 <= a && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.HELP_BY_ATTEMPTS_FIVE_AND_MORE)
}
;
PlaySession.DailyTasksReporter = function(a) {
cleverapps.dailyTasks && cleverapps.dailyTasks.isAvailable() && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SESSION_DAILY_TASK_AVAILABLE),
a[cleverapps.EVENTS.SESSION_DAILY_TASK_OPEN_WINDOW] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SESSION_DAILY_TASK_OPEN_WINDOW),
0 < cleverapps.dailyTasks.getFinishedTasks().length && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SESSION_DAILY_TASK_FINISH + "_" + cleverapps.dailyTasks.getFinishedTasks().length),
(a = a[cleverapps.EVENTS.SESSION_DAILY_TASK_REWARD]) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SESSION_DAILY_TASK_REWARD + "_" + a))
}
;
PlaySession.CupsReporter = function(a) {
Object.keys(a).forEach(function(b) {
a[b] && (0 !== b.indexOf(cleverapps.EVENTS.CUP_DAU) && 0 !== b.indexOf(cleverapps.EVENTS.CUP_PLAYERS) || cleverapps.eventLogger.logEvent(b))
})
}
;
PlaySession.MiniGameReporter = function(a) {
Object.keys(a).forEach(function(b) {
0 === b.indexOf(cleverapps.EVENTS.MINIGAME_FINISH) && a[b] && cleverapps.eventLogger.logEvent(b + "_dau")
})
}
;
PlaySession.MissionReporter = function(a) {
Object.keys(a).forEach(function(b) {
0 === b.indexOf(cleverapps.EVENTS.MISSION_DAU) && a[b] && cleverapps.eventLogger.logEvent(b)
})
}
;
PlaySession.OfferReporter = function(a) {
Object.keys(a).forEach(function(b) {
0 === b.indexOf(cleverapps.EVENTS.OFFER_DAU) && a[b] && cleverapps.eventLogger.logEvent(b)
})
}
;
PlaySession.BonusWorldReporter = function(a) {
a[cleverapps.EVENTS.BONUS_WORLD_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BONUS_WORLD_DAU);
a[cleverapps.EVENTS.BONUS_WORLD_LEVEL_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BONUS_WORLD_LEVEL_DAU)
}
;
PlaySession.GrowthFundReporter = function(a) {
a[cleverapps.EVENTS.FUND_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.FUND_DAU)
}
;
PlaySession.ExpeditionReporter = function(a) {
for (var b in a[cleverapps.EVENTS.EXPEDITION_DAU]) {
var c = TravelBook.findPageById(b);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EXPEDITION_DAU + (c && c.prefix ? "_" + c.prefix : ""))
}
a[cleverapps.EVENTS.COLLECTIONS_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.COLLECTIONS_DAU)
}
;
PlaySession.DebugReporter = function(a) {
for (var b in a[cleverapps.EVENTS.DEBUG.MERGE.UNKNOWN_UNIT_DAU])
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.MERGE.UNKNOWN_UNIT_DAU + "-" + b);
a[cleverapps.EVENTS.DEBUG.UNKNOWN_MISSION_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.UNKNOWN_MISSION_DAU);
for (b in a[cleverapps.EVENTS.DEBUG.MERGE.UNITS_RESET2])
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.MERGE.UNITS_RESET2 + "-" + b)
}
;
PlaySession.ClansReporter = function(a) {
a[cleverapps.EVENTS.CLANS_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.CLANS_DAU)
}
;
PlaySession.BlocksGameLevelsReporter = function(a) {
a[cleverapps.EVENTS.COMPLETE_LEVEL_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.COMPLETE_LEVEL_DAU);
a[cleverapps.EVENTS.COMPLETE_LEVEL_DAU + GameBase.MODE_REGULAR] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.COMPLETE_LEVEL_DAU + GameBase.MODE_REGULAR);
a[cleverapps.EVENTS.COMPLETE_LEVEL_DAU + GameBase.MODE_HIGHSCORE] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.COMPLETE_LEVEL_DAU + GameBase.MODE_HIGHSCORE);
a[cleverapps.EVENTS.START_LEVEL_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.START_LEVEL_DAU);
a[cleverapps.EVENTS.MOVES10_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MOVES10_DAU)
}
;
PlaySession.UnitsReporter = function(a) {
var b = a[cleverapps.EVENTS.UNITS_AMOUNT];
if (b) {
for (var c in b.amount)
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.UNITS_AMOUNT + "_" + c + "_" + b.level, {
value: b.amount[c]
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.UNITS_AMOUNT_DAU + "_" + b.level)
}
if (a[cleverapps.EVENTS.EARNED_MAGICPLANT])
for (var d in a[cleverapps.EVENTS.EARNED_MAGICPLANT])
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EARNED_MAGICPLANT + "_" + d, {
value: a[cleverapps.EVENTS.EARNED_MAGICPLANT][d]
});
[cleverapps.EVENTS.EARNED_COINSPLANT, cleverapps.EVENTS.EARNED_RUBIESPLANT, cleverapps.EVENTS.EARNED_ENERGYPLANT].forEach(function(g) {
for (var h = [0, 1, 2], k = 0; k < h.length; k++)
if (a[g + "_" + k])
for (d in a[g + "_" + k])
cleverapps.eventLogger.logEvent(g + "_" + k + "_" + d, {
value: a[g + "_" + k][d]
})
});
if (a[cleverapps.EVENTS.CASTLE_PRIZES])
for (d in a[cleverapps.EVENTS.CASTLE_PRIZES])
for (var e in a[cleverapps.EVENTS.CASTLE_PRIZES][d])
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.CASTLE_PRIZES + "_" + e + "_" + d, {
value: a[cleverapps.EVENTS.CASTLE_PRIZES][d][e]
});
if (a[cleverapps.EVENTS.PET_RATE])
for (var f in a[cleverapps.EVENTS.PET_RATE])
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.PET_RATE + f.replace("clpet", ""), {
value: a[cleverapps.EVENTS.PET_RATE][f]
})
}
;
PlaySession.LocalPushesReporter = function() {
cleverapps.localPushes.permitted && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PUSHES.PERMITTED_DAU)
}
;
PlaySession.ContextLostReporter = function(a) {
a[cleverapps.EVENTS.WEBGL.CONTEXT_LOST] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_DAU);
2 <= a[cleverapps.EVENTS.WEBGL.CONTEXT_LOST] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_MULTIPLE);
a[cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER_DAU);
a[cleverapps.EVENTS.WEBGL.CONTEXT_LOST_INACTIVE] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_INACTIVE_DAU);
a[cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER_INACTIVE] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER_INACTIVE_DAU)
}
;
PlaySession.OkSessionReporter = function(a) {
a[cleverapps.EVENTS.DEBUG.OK_SESSION_EXPIRED] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.OK_SESSION_EXPIRED);
a[cleverapps.EVENTS.DEBUG.OK_SESSION_RESTORED] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.OK_SESSION_RESTORED)
}
;
PlaySession.StickersBookReporter = function(a) {
a[cleverapps.EVENTS.STICKERS_COLLECTIONS] && cleverapps.stickersBook && (a = cleverapps.stickersBook.getCompletedCollectionsAmount(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STICKERS_COLLECTIONS + cleverapps.user.episode + "_" + a))
}
;
PlaySession.MetaLocationReporter = function(a) {
a = a[cleverapps.EVENTS.META_LOCATION];
void 0 !== a && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.META_LOCATION + "_" + a);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.USER_EPISODE + "_" + cleverapps.user.episode)
}
;
PlaySession.FpsReporter = function(a) {
a[cleverapps.EVENTS.STATS.FPS_RATE] && a[cleverapps.EVENTS.STATS.FPS_COUNT] && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.FPS_RATE, {
value: a[cleverapps.EVENTS.STATS.FPS_RATE]
}),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.FPS_COUNT, {
value: a[cleverapps.EVENTS.STATS.FPS_COUNT]
}))
}
;
PlaySession.AdBlockReporter = function(a) {
a[cleverapps.EVENTS.ADS.AD_BLOCK_WINDOW_DAU] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.AD_BLOCK_WINDOW_DAU)
}
;
PlaySession.ACTIVE_TIME_INTERVAL = "1 minute";
cleverapps.Flags = function() {
cleverapps.EventEmitter.call(this);
this.init();
cleverapps.whenAllInitialized(function() {
cleverapps.paymentsHistory.onAddPaymentListeners.flags = this.update.bind(this)
}
.bind(this))
}
;
cleverapps.Flags.prototype = Object.create(cleverapps.EventEmitter.prototype);
cleverapps.Flags.prototype.constructor = cleverapps.Flags;
cleverapps.Flags.prototype.init = function() {
this.norest = connector.platform.oneOf(connector.PLIEGA, connector.PLAYABLE, connector.YOUTUBE, connector.GAMESNACK) || cleverapps.config.norest;
this.noLogEvents = connector.platform.oneOf(connector.PLIEGA, connector.PLAYABLE);
this.softCurrencyRealProduct = connector.platform.oneOf(connector.MOBAGE, connector.SP_MOBAGE);
this.highMonetization = ["merge"].includes(cleverapps.config.type);
this.lowMonetization = ["crocword", "scramble", "woodenblock"].includes(cleverapps.config.name);
this.monetization = cleverapps.Flags.MONETIZATION_REGULAR;
this._updateMonetization();
var a = function() {
// uptap 禁用登录
this.nologin = true;
this.requestsEnabled = false;
// this.nologin = connector.social.oneOf(connector.NONE) || cleverapps.config.nologin;
// this.requestsEnabled = connector.social.getStatus() !== connector.STATUS_DISABLED && connector.social.isSupportsNativeRequest
}
.bind(this);
connector.social.on("pluginChanged", a);
a()
}
;
cleverapps.Flags.prototype.toggle = function(a) {
this.set(a, !this[a])
}
;
cleverapps.Flags.prototype.get = function(a) {
return this[a]
}
;
cleverapps.Flags.prototype.set = function(a, b) {
this[a] !== b && (this[a] = b,
this.trigger("change:" + a, b))
}
;
cleverapps.Flags.prototype.reset = function() {
this.init();
this.update()
}
;
cleverapps.Flags.prototype._updateMonetization = function() {
var a = cleverapps.Flags.MONETIZATION_REGULAR;
connector.payments.getStatus() === connector.STATUS_DISABLED && (a = connector.ads.getStatus() === connector.STATUS_DISABLED ? cleverapps.Flags.MONETIZATION_DISABLED : cleverapps.Flags.MONETIZATION_ADS);
this.set("monetization", a)
}
;
cleverapps.Flags.prototype.update = function() {
this._updateMonetization();
cleverapps.paymentsHistory.classify() !== cleverapps.PaymentsHistory.BRACKET_NONE && (this.requestsEnabled = !1,
levels.friendRequests.deleteFakeRequests());
this.norest = this.norest || cleverapps.user.cheater;
AdsLimits.initialize()
}
;
cleverapps.Flags.MONETIZATION_DISABLED = "disabled";
cleverapps.Flags.MONETIZATION_ADS = "ads";
cleverapps.Flags.MONETIZATION_REGULAR = "regular";
var GameModes = function() {
cleverapps.config.debugMode && (this.hideMenuBarCoinsItem = this.showMenuBarGoldItem = this.showFingerAnchor = this.showPersonSilhouette = this.showAvoidRects = this.noGamePause = this.noMute = this.noNotifications = this.noBoosters = this.noBg = this.noSidebar = this.noToolbar = this.noControls = !1,
"merge" === cleverapps.config.type ? Object.assign(this, {
skipThirdElement: !1,
skipSpecialOffer: !1,
skipBuildingStage: !1,
skipOpenChestWindow: !1,
skipQuests: !1,
skipUnitStories: !1,
skipRestoreLandmarks: !1,
automerge: !1,
axemerge: !1,
hideGuideAndProgress: !1,
hideFruitParticlesAnimation: !1,
hideUnitPointAnimation: !1,
fastSpawnPrizes: !1,
upgradeInTwoTurns: !1,
customAnimationDidMerged: !1,
unitsPulsingDisabled: !1,
easyChop: !1,
dontCollectWands: !1,
lightUpOnHoveredUnit: !1,
hideGeneratorGuideButton: !1,
silentInfoView: !1,
silentCustomers: !1,
silentCenterHint: !1,
fogBlockerDisabled: !1,
hideTankProgress: !1,
initFruitWithoutPrizes: !1,
initMineableWithPrizes: !1,
multipleHeroes: !1,
clans: !1,
captureToolActions: !1,
skipFlyToUnitsLibrary: !1,
skipUnitCreatePrize: !1,
skipExpPrize: !1,
muteCupsSound: !1,
scrollByFinger: !1
}) : "match3" === cleverapps.config.type ? Object.assign(this, {
silentGoals: !1,
multiColorCellDisabled: !1,
heroesDisabled: !1,
putInPoolDisabled: !1,
newRules: !1
}) : "klondike" === cleverapps.config.type ? Object.assign(this, {
tableAcceptAll: !1
}) : "blocks" === cleverapps.config.type ? Object.assign(this, {
hideGoals: !1,
hideHighScore: !1,
alwaysNoMemorable: !1,
showHint: !1,
piecesAlwaysEnabled: !1,
hideSingleMoveHint: !1,
hideExplodeHint: !1,
hidePieces: !1
}) : "tile3" === cleverapps.config.type ? Object.assign(this, {
threeOpenCards: !1,
skipProlongation: !1,
replaceTiles: !1
}) : "board" === cleverapps.config.type && Object.assign(this, {
noKeypad: !1,
noCurrent: !1,
noCookieJar: !1,
hideKeypadControls: !1
}))
};
GameModes.prototype.load = function() {
if (cleverapps.config.debugMode) {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.GAME_MODES) || {};
Object.assign(this, a)
}
}
;
GameModes.prototype.save = function() {
var a = Object.assign({}, this);
cleverapps.dataLoader.save(DataLoader.TYPES.GAME_MODES, a)
}
;
GameModes.prototype.toggle = function(a) {
this[a] = !this[a];
this.save()
}
;
GameModes.prototype.listModes = function() {
return Object.keys(this)
}
;
var SuccessWait = function(a) {
this.bundles = a = a.filter(function(b) {
return b && bundles[b]
});
this.active = !0;
this.loaded = !1;
this.listeners = [];
this.run()
};
SuccessWait.prototype.isActive = function() {
return this.active
}
;
SuccessWait.prototype.isLoaded = function() {
return this.loaded
}
;
SuccessWait.prototype.whenLoaded = function(a) {
a && (this.active ? this.listeners.push(a) : a())
}
;
SuccessWait.prototype.run = function() {
if (this.bundles.length)
cleverapps.bundleLoader.loadBundles(this.bundles, {
onSuccess: this.onSuccess.bind(this),
onFailure: this.onFailure.bind(this)
});
else
this.onSuccess()
}
;
SuccessWait.prototype.onSuccess = function() {
this.active ? (this.loaded = !0,
this.clear(),
this.listeners.forEach(cleverapps.callFunc),
this.listeners = []) : (cleverapps.bundleLoader.deleteBundles(this.bundles),
this.bundles = [])
}
;
SuccessWait.prototype.onFailure = function(a) {
this.active && (cleverapps.checkStatus(a, 404) ? (console.log("receive 404"),
this.clear()) : (clearTimeout(this.retryTimeout),
this.retryTimeout = setTimeout(this.run.bind(this), SuccessWait.RETRY_TIMEOUT)))
}
;
SuccessWait.prototype.clear = function() {
this.active = !1;
clearTimeout(this.retryTimeout);
this.retryTimeout = void 0
}
;
SuccessWait.prototype.destructor = function() {
this.clear();
this.listeners = [];
this.loaded && (this.loaded = !1,
cleverapps.bundleLoader.deleteBundles(this.bundles),
this.bundles = [])
}
;
SuccessWait.RETRY_TIMEOUT = cleverapps.parseInterval("30 seconds");
cleverapps.Information = function() {
this.data = cleverapps.dataLoader.load(DataLoader.TYPES.INFORMATION);
void 0 === this.data && (this.data = {});
this.diff = {}
}
;
cleverapps.Information.prototype.onChangeUserId = function() {
this.diff = this.data;
this.update()
}
;
cleverapps.Information.prototype.reportMaxTextureSize = function() {
if ("undefined" !== typeof gl) {
var a = gl.getParameter(gl.MAX_TEXTURE_SIZE);
this.setKeyValue("maxTextureSize", a)
}
}
;
cleverapps.Information.prototype.reportPhone = function() {
var a = {};
a[cc.sys.OS_ANDROID] = {
avatar: "#avatars/android_avatar.png",
name: "Android"
};
a[cc.sys.OS_IOS] = {
avatar: "#avatars/ios_avatar.png",
name: "iOS"
};
if (a[connector.info.os] && connector.info.isNative) {
var b = connector.social.isLoggedIn() && !connector.social.oneOf(connector.APPLE);
this.data.avatar || b || cleverapps.info.setKeyValue("avatar", a[connector.info.os].avatar);
this.data.name || connector.social.isLoggedIn() || cleverapps.info.setKeyValue("name", a[connector.info.os].name + "_" + connector.platform.getUserID().substr(-3))
}
connector.platform.oneOf(connector.GDCOM, connector.COOLMATHGAMES) && cleverapps.info.setKeyValue("avatar", "#avatars/game_distribution.png")
}
;
cleverapps.Information.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.INFORMATION, this.data)
}
;
cleverapps.Information.prototype.getValue = function(a) {
return this.data[a]
}
;
cleverapps.Information.prototype.setKeyValue = function(a, b, c) {
try {
var d = JSON.stringify(b)
} catch (e) {
console.log("error stringify - " + a, b);
if (cleverapps.config.debugMode)
throw e;
cleverapps.throwAsync("error stringify - " + a);
return
}
if (JSON.stringify(this.data[a]) !== d || c)
this.data[a] = b,
this.diff[a] = b,
this.update()
}
;
cleverapps.Information.prototype.update = function() {
this.save();
this._updateInner()
}
;
cleverapps.Information.prototype._updateInner = cleverapps.accumulate(5E3, function() {
console.log("Sending information: " + JSON.stringify(this.diff));
cleverapps.RestClient.post("/info/" + encodeURIComponent(connector.platform.getUserID()), this.diff, function() {}, function() {});
this.diff = {}
});
cleverapps.Information.prototype.getUserAgent = function() {
if (connector.platform.oneOf(connector.RUSTORE, connector.AMAZON, connector.ANDROID, connector.GPG, connector.PLIEGA, connector.IOS, connector.MACOS, connector.WECHAT)) {
var a = connector.info.deviceName;
var b = connector.info.deviceVersion
} else
b = (new UAParser).getResult(navigator.userAgent),
a = b.browser.name,
b = b.browser.major;
return {
browser: a,
version: b
}
}
;
cleverapps.Information.prototype.reportUserAgent = function() {
this.setKeyValue("useragent", this.getUserAgent())
}
;
cleverapps.Information.prototype.reportSysLanguage = function() {
this.setKeyValue("syslanguage", connector.info.language)
}
;
cleverapps.Information.prototype.reportIP = function() {
this.setKeyValue("ip", "blank", !0)
}
;
var ActionPlayer = function(a) {
this.options = a = a || {};
Array.isArray(a) ? a = {
actions: a
} : "function" === typeof a && (a = {
actions: [a]
});
this.actions = [];
this.add(a.actions || [])
};
ActionPlayer.prototype.add = function(a) {
Array.isArray(a) ? a.forEach(function(b) {
this.add(b)
}
.bind(this)) : a && this.actions.push(a)
}
;
ActionPlayer.prototype._playNext = function() {
this.actionTimeout && (cleverapps.timeouts.clearTimeout(this.actionTimeout),
this.actionTimeout = void 0);
if (!this._stopped)
if (this.index === this.actions.length)
this._stopped = !0,
this.onCompleteListener && this.onCompleteListener.call(null),
this.onSuccessListener && this.onSuccessListener.call(null);
else {
var a = !0
, b = function() {
a && (a = !1,
this._playNext.apply(this, arguments))
}
.bind(this)
, c = function() {
a && (a = !1,
this.stop.apply(this, arguments))
}
.bind(this);
this.options.actionTimeout && (this.actionTimeout = cleverapps.timeouts.setTimeout(c, this.options.actionTimeout));
this.actions[this.index++](b, c)
}
}
;
ActionPlayer.prototype.onSuccess = function(a) {
this.onSuccessListener = a
}
;
ActionPlayer.prototype.onFailure = function(a) {
this.onFailureListener = a
}
;
ActionPlayer.prototype.onComplete = function(a) {
this.onCompleteListener = a
}
;
ActionPlayer.prototype.play = function(a) {
this.index = 0;
if (a)
this.onSuccess(a);
this._playNext()
}
;
ActionPlayer.prototype.stop = function() {
this._stopped || (this._stopped = !0,
this.onCompleteListener && this.onCompleteListener.call(null),
this.onFailureListener && this.onFailureListener.apply(null, arguments))
}
;
ActionPlayer.prototype.isStopped = function() {
return this._stopped
}
;
ActionPlayer.prototype.isRunning = function() {
return !this.isStopped()
}
;
var NoMetha = {
gamePlayed: function() {}
};
var Meta = function() {};
Meta.prototype.getType = function() {
return "playable" === connector.info.source ? Meta.NONE : cleverapps.config.meta
}
;
Meta.prototype.getMainScene = function() {
if ("playable" === connector.info.source)
return PlayableAdsScene;
switch (this.getType()) {
case Meta.FARM:
return FarmScene;
case Meta.HOMEFIX:
return HomefixScene;
case Meta.FISHDOM:
return FishdomScene;
case Meta.SHORTMETA:
return ShortMetaScene;
case Meta.SIMPLE:
return SimpleMainScene;
case Meta.NONE:
return GameScene;
default:
return HoseScene
}
}
;
Meta.prototype.getRumble = function() {
return this.knockoutGame && this.knockoutGame.rumble
}
;
Meta.prototype.stopRumble = function() {
return this.knockoutGame.stopRumble()
}
;
Meta.prototype.getMainObject = function() {
switch (this.getType()) {
case Meta.FARM:
return cleverapps.farm;
case Meta.FISHDOM:
return cleverapps.fishdom;
case Meta.HOMEFIX:
return cleverapps.home;
case Meta.SHORTMETA:
return cleverapps.shortmeta;
case Meta.SIMPLE:
return cleverapps.simple;
case Meta.HOSE:
return cleverapps.hose;
case Meta.NONE:
return NoMetha
}
}
;
Meta.prototype.wantsToPlay = function(a, b) {
if (cleverapps.lives && cleverapps.lives.isEmpty())
cleverapps.unlimitedLives && cleverapps.unlimitedLives.freeOfferIsAvailable() ? cleverapps.unlimitedLives.showFreeOffer(a) : (new LivesShopWindow,
cleverapps.focusManager.onceNoWindowsListener = a);
else {
var c = this.getMainObject();
this.getType() === Meta.FARM ? (b = b && b.building && b.building.canStillProvideQuestItems() ? b.building : c.findBuildingForActiveItem() || cleverapps.Random.mathChoose(c.listAvailableProvidesBuildings()),
b = MethaHelper.getCurrentLevel(b)) : b = b || MethaHelper.getCurrentLevel();
this.getType() === Meta.HOSE && (cleverapps.Plot.isPassedAllEpisodes = levels.user.isPassedAll());
this.knockoutGame ? this.knockoutGame.wantsToPlay(a, b) : MethaHelper.start(a, b)
}
}
;
Meta.prototype.wantsToReplay = function(a, b) {
MethaHelper.start(a, b)
}
;
Meta.HOSE = "hose";
Meta.FARM = "farm";
Meta.HOMEFIX = "homefix";
Meta.SHORTMETA = "shortmeta";
Meta.SIMPLE = "simple";
Meta.NONE = "none";
Meta.FISHDOM = "fishdom";
Meta.SLOT_MAIN = "";
Meta.SLOTS = [Meta.SLOT_MAIN];
"merge" === cleverapps.config.type && (Meta.EXPEDITION_SLOT1 = "1",
Meta.EXPEDITION_SLOT2 = "2",
Meta.EXPEDITION_SLOT3 = "3",
Meta.EXPEDITION_SLOT4 = "4",
Meta.SLOTS = [Meta.SLOT_MAIN, Meta.EXPEDITION_SLOT1, Meta.EXPEDITION_SLOT2, Meta.EXPEDITION_SLOT3, Meta.EXPEDITION_SLOT4]);
"homefix" === cleverapps.config.meta && (Meta.LOCATION_SLOT0 = "0",
Meta.LOCATION_SLOT1 = "1",
Meta.LOCATION_SLOT2 = "2",
Meta.SLOTS = [Meta.SLOT_MAIN, Meta.LOCATION_SLOT0, Meta.LOCATION_SLOT1, Meta.LOCATION_SLOT2]);
var BaseLocation = function(a) {
cleverapps.EventEmitter.call(this);
this.locationId = a;
this.isCompleted = !1;
a = cleverapps.meta.loadLocation(this.getSlotId());
this.load(a)
};
BaseLocation.prototype = Object.create(cleverapps.EventEmitter.prototype);
BaseLocation.prototype.constructor = Location;
BaseLocation.prototype.load = function() {}
;
BaseLocation.prototype.getInfo = function() {}
;
BaseLocation.prototype.save = function() {
cleverapps.meta.saveLocation(this)
}
;
BaseLocation.prototype.getSlotId = function() {
return Meta.SLOT_MAIN
}
;
BaseLocation.prototype.complete = function() {
this.isCompleted = !0
}
;
BaseLocation.prototype.checkCompleted = function() {
return this.isCompleted
}
;
BaseLocation.prototype.onComplete = function(a) {
a()
}
;
BaseLocation.prototype.onOpen = function(a) {
a()
}
;
BaseLocation.prototype.gamePlayed = function(a, b) {
a === GameBase.OUTCOME_VICTORY && (b.rewards.metaStar = this.amountLevelStars(b.level))
}
;
BaseLocation.prototype.amountLevelStars = function() {
return 0
}
;
BaseLocation.prototype.isCurrentLocation = function() {
return this.locationId === cleverapps.meta.currentLocationId
}
;
BaseLocation.prototype.processChatMessage = function() {}
;
BaseLocation.listLocationsIds = function() {
return [0]
}
;
BaseLocation.listActiveLocationsIds = function(a) {
return [a]
}
;
var FocusManager = function() {
this.stack = [];
this.pushState({
focus: !1,
controls: [],
eventNodes: []
});
this.pushState({
focus: "initialize",
controls: [],
eventNodes: []
});
this.focusHistory = [];
this.tempControls = {};
this.onceNoWindowsListener = this.lastFocus = void 0;
this.lastControlsVisible = {};
this.onControlsListeners = {};
this.controlsOptions = {};
this.pendingListeners = []
};
FocusManager.prototype.showControlsTemporary = function(a) {
cleverapps.toArray(a).forEach(function(b) {
this.tempControls[b] = !0;
!this.lastControlsVisible[b] && this.onControlsListeners[b] && (this.onControlsListeners[b](!0),
this.lastControlsVisible[b] = !0)
}
.bind(this))
}
;
FocusManager.prototype.hideControlsTemporary = function(a) {
cleverapps.toArray(a).forEach(function(b) {
delete this.tempControls[b];
this.lastControlsVisible[b] && this.onControlsListeners[b] && -1 === this.controls.indexOf(b) && (this.onControlsListeners[b](!1),
this.lastControlsVisible[b] = !1)
}
.bind(this))
}
;
FocusManager.prototype.clearTempControls = function() {
this.tempControls = {}
}
;
FocusManager.prototype.registerControl = function(a, b, c) {
"object" === typeof b && (b = b.createListener(b.toggle.bind(b)));
c && (this.controlsOptions[a] = {
hiddenByDefault: c
});
this.onControlsListeners[a] = b;
this.lastControlsVisible[a] = !1;
this.setControlsVisible(!0)
}
;
FocusManager.prototype.removeControl = function(a) {
delete this.onControlsListeners[a];
delete this.lastControlsVisible[a]
}
;
FocusManager.prototype.updateControlsVisibility = function(a) {
for (var b in this.onControlsListeners) {
var c = -1 !== this.controls.indexOf(b) || void 0 !== this.tempControls[b];
this.lastControlsVisible[b] !== c && (this.onControlsListeners[b](c, a),
this.lastControlsVisible[b] = c)
}
}
;
FocusManager.prototype.setControlsVisible = function(a) {
this.clearUpdateTimeout();
this.isFocused() || cleverapps.gameModes.noControls || this.setControls(Object.keys(this.onControlsListeners).filter(function(b) {
return this.shouldBeVisible(b)
}
.bind(this)));
a ? this.updateControlsVisibility(!0) : this.updateTimeout = setTimeout(this.updateControlsVisibility.bind(this), 100)
}
;
FocusManager.prototype.shouldBeVisible = function(a) {
return !this.isFocused() && (!this.controlsOptions[a] || !this.controlsOptions[a].hiddenByDefault || !cleverapps.environment.hasScene(this.controlsOptions[a].hiddenByDefault))
}
;
FocusManager.prototype.clearUpdateTimeout = function() {
this.updateTimeout && (clearTimeout(this.updateTimeout),
this.updateTimeout = void 0)
}
;
FocusManager.prototype.debugMessage = function(a) {
if (cleverapps.config.debugMode && !connector.info.isNative)
throw a;
cleverapps.throwAsync(a)
}
;
FocusManager.prototype.displayWhenFreeFocus = function(a) {
this.isFocused() ? this.whenFreeFocus(this.display.bind(this, a)) : this.display(a)
}
;
FocusManager.prototype.whenFreeFocus = function(a) {
this.isFocused() ? this.pendingListeners.push(a) : a()
}
;
FocusManager.prototype.distract = function(a) {
this.isFocused() || this.debugMessage("Distract without focus! " + a.focus);
if (this.focus === a.focus)
this.debugMessage("Distract same focus!" + a.focus);
else if (!a.filter || a.filter()) {
if (!a.restore)
for (; 1 < this.stack.length; )
this.popState();
this.grabFocus(a.focus, a);
this.compound(this.freeFocus.bind(this, a.focus), a.actions || [a.action])
}
}
;
FocusManager.prototype.display = function(a) {
if (!this.isFocused() || a.stack)
if (!a.filter || a.filter())
this.grabFocus(a.focus, a),
this.compound(this.freeFocus.bind(this, a.focus), a.actions || [a.action])
}
;
FocusManager.prototype.compound = function(a, b, c, d) {
c = c || 0;
d = d || this.stack[this.stack.length - 1];
this.stack[this.stack.length - 1] !== d ? d.action = this.compound.bind(this, a, b, c, d) : b.length === c ? a() : (this.setEventNodes([]),
b[c](cleverapps.once(this.compound.bind(this, a, b, c + 1, d))))
}
;
FocusManager.prototype.showControlsWhileFocused = function(a, b) {
cleverapps.toArray(a).forEach(function(c) {
if (-1 === this.controls.indexOf(c))
this.controls.push(c),
!this.lastControlsVisible[c] && this.onControlsListeners[c] && (this.onControlsListeners[c](!0, b),
this.lastControlsVisible[c] = !0);
else if (b && this.onControlsListeners[c])
this.onControlsListeners[c](!0, b)
}, this)
}
;
FocusManager.prototype.isControlEnabled = function(a) {
return 0 < cleverapps.intersect(this.controls, a).length
}
;
FocusManager.prototype.hideAllControls = function(a) {
this.setControls([]);
this.updateControlsVisibility(a)
}
;
FocusManager.prototype.hideControlsWhileFocused = function(a) {
cleverapps.toArray(a).forEach(function(b) {
var c = this.controls.indexOf(b);
-1 === c || this.shouldBeVisible(b) || (this.controls.splice(c, 1),
this.lastControlsVisible[b] && this.onControlsListeners[b] && !this.tempControls[b] && (this.onControlsListeners[b](!1),
this.lastControlsVisible[b] = !1))
}, this)
}
;
FocusManager.prototype.trigger = cleverapps.accumulate(0, function() {
this.setControlsVisible(cleverapps.silentIntro);
if (!this.isFocused()) {
for (; 0 < this.pendingListeners.length; )
if (this.pendingListeners.shift()(),
this.isFocused())
return;
this.onFocusLostListenerPlacements();
InterstitialAction.showOnLowMonetization()
}
});
FocusManager.prototype.onFocusLostListenerPlacements = function() {
cleverapps.placements.onFocusLostListenerPlacements()
}
;
FocusManager.prototype.checkEventNode = function(a) {
if (a.alwaysOn)
return !0;
var b = cleverapps.scenes.getRunningScene();
if (!this.isFocused())
return !0;
var c = this.eventNodes;
b.toolMenu && (c = c.concat(b.toolMenu, b.toolMenu.opener));
b.snapshotBar && (c = c.concat(b.snapshotBar));
if (!c.length)
return !1;
if (c[0] === b)
return !0;
for (; a; ) {
if (-1 !== c.indexOf(a))
return !0;
a = a.parent
}
return !1
}
;
FocusManager.prototype.setEventNodes = function(a) {
this.stack[this.stack.length - 1].eventNodes = this.eventNodes = a
}
;
FocusManager.prototype.setControls = function(a) {
this.stack[this.stack.length - 1].controls = this.controls = a
}
;
FocusManager.prototype.grabFocus = function(a, b) {
b = b || {};
console.log("Grab focus: " + a);
var c = cleverapps.toArray(b.control || []);
b.keepControls && (c = this.controls);
this.saveHistory("+" + a);
this.pushState({
focus: a,
controls: c.slice(),
eventNodes: []
});
this.setControlsVisible(cleverapps.silentIntro);
this.trigger();
cleverapps.eventBus.trigger("changeFocus")
}
;
FocusManager.prototype.freeFocus = function(a) {
this.focus !== a ? console.log("Wrong focus clearing: " + this.focus + " > " + a) : (console.log("Focus freed: " + this.focus),
this.lastFocus = this.focus,
this.saveHistory("-" + this.focus),
this.popState(),
this.trigger(),
cleverapps.eventBus.trigger("changeFocus"),
this.isFocused() || cleverapps.bundleLoader.clearUnusedResources(),
this.resumeCompound())
}
;
FocusManager.prototype.saveHistory = function(a) {
this.focusHistory.push(a);
this.focusHistory = this.focusHistory.slice(-20)
}
;
FocusManager.prototype.pushState = function(a) {
a.onceNoWindowsListener = this.onceNoWindowsListener;
this.onceNoWindowsListener = void 0;
this.stack.push(a);
this.focus = a.focus;
this.setControls(a.controls);
this.setEventNodes(a.eventNodes)
}
;
FocusManager.prototype.popState = function() {
if (1 === this.stack.length)
this.debugMessage("Attempt to free default state");
else {
var a = this.stack.pop();
a.controls = [];
a.eventNodes = [];
a.action = void 0;
this.onceNoWindowsListener = a.onceNoWindowsListener;
a.onceNoWindowsListener = void 0;
a = this.stack[this.stack.length - 1];
this.focus = a.focus;
this.setControls(a.controls);
this.setEventNodes(a.eventNodes);
setTimeout(function() {
cleverapps.windows.notifyFocusPop()
}, 0)
}
}
;
FocusManager.prototype.resumeCompound = function() {
var a = this.stack[this.stack.length - 1]
, b = a.action;
a.action = void 0;
b && b()
}
;
FocusManager.prototype.isFocused = function() {
return !1 !== this.focus
}
;
FocusManager.prototype.getFocus = function() {
return this.focus
}
;
var Exp = function(a) {
cleverapps.EventEmitter.call(this);
this.slot = a;
this.exp = 0
};
Exp.prototype = Object.create(cleverapps.EventEmitter.prototype);
Exp.prototype.constructor = Exp;
Exp.prototype.isAvailable = function() {
return "undefined" !== typeof match3 && match3.heroes && match3.heroes.available() || "merge" === cleverapps.config.type
}
;
Exp.prototype.load = function(a, b) {
b ? (this.exp = 0,
this.save()) : this.exp = Math.floor(a) || 0
}
;
Exp.prototype.save = function() {
cleverapps.gameLevel && cleverapps.gameLevel.withOwnLevel ? Game.currentGame.storeSave() : cleverapps.user.save()
}
;
Exp.prototype.getExp = function() {
return this.exp
}
;
Exp.prototype.setExp = function(a, b) {
a = Math.floor(a);
if (this.exp !== a)
if (cleverapps.isNumber(this.exp) && !cleverapps.isNumber(a))
cleverapps.throwAsync("Try set non number exp - " + a);
else if (this.exp = a,
this.save(),
!b)
this.onChange()
}
;
Exp.prototype.onChange = function() {
this.trigger("changeExp")
}
;
Exp.prototype.canTakeExp = function(a) {
return this.exp >= a
}
;
Exp.prototype.takeExp = function(a, b) {
return 0 === a ? !0 : this.canTakeExp(a) ? (this.setExp(this.exp - a, b),
!0) : !1
}
;
Exp.Switch = function(a) {
cleverapps.exp = cleverapps.gameLevel.withOwnLevel ? cleverapps.expBySlots[a] : cleverapps.expBySlots[Meta.SLOT_MAIN]
}
;
cleverapps.User = function(a) {
cleverapps.EventEmitter.call(this);
this.soft = this.gold = this.progressCompare = this.progress = this.level = this.episode = 0;
this.registered = Date.now();
this.visited = Date.now();
this.onCantTakeGold = function() {
cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_DISABLED ? cleverapps.notification.create("NotEnoughCoins") : cleverapps.focusManager.display({
stack: !0,
focus: "ShopWindow",
control: "MenuBarGoldItem",
action: function(b) {
new HardCurrencyShopWindow;
cleverapps.focusManager.onceNoWindowsListener = b
}
})
}
;
this.onLeagueChangeListener = function() {}
;
a || (a = cleverapps.dataLoader.load(DataLoader.TYPES.ID),
this.loadData(a),
this.lastReportDAU = this.getDaysSinceRegistration(a.visited));
this.save();
this.updateIDFA();
cleverapps.whenAllInitialized(this.reportDAU.bind(this));
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, function() {
this.visited < Date.now() - cleverapps.parseInterval(cleverapps.User.ON_SHOW_CHANGE_VISITED) && (this.updateVisited(),
cleverapps.whenAllInitialized(this.reportDAU.bind(this)))
}
.bind(this))
}
;
cleverapps.User.prototype = Object.create(cleverapps.EventEmitter.prototype);
cleverapps.User.prototype.constructor = cleverapps.User;
cleverapps.User.prototype.updateVisited = function() {
this.visited = Date.now();
this.save()
}
;
cleverapps.User.prototype.incProgressCompare = function(a, b) {
this.progressCompare += a || 1;
b || this.save()
}
;
cleverapps.User.prototype.reportDAU = function() {
var a = this.getDaysSinceRegistration();
if (void 0 === this.lastReportDAU || this.lastReportDAU !== a) {
this.lastReportDAU = a;
cleverapps.playSession.endSession();
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.DAU);
if ("merge" === cleverapps.config.type) {
var b = cleverapps.GameSaver.load(Meta.SLOT_MAIN);
(b = b && cleverapps.castType(b.wands || 0) || 0) && 5E4 >= b && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.USER_WANDS_DAU_AMOUNT, {
value: b
}),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.USER_WANDS_DAU))
}
connector.info.platform && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.DAU_PLATFORM + connector.info.platform);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.DAU_COUNTRY + c);
connector.info.platform && ["US"].includes(c) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.DAU_COUNTRY_PLATFORM + c + "_" + connector.info.platform)
});
connector.info.isNative && connector.social.isLoggedIn() && cleverapps.eventLogger.logEvent(connector.social.getName() + "_loggedin_dau");
cleverapps.paymentsHistory.isPayer() && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PAYER_DAU);
1 > a && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.NEW_USERS_DAU, !0),
cleverapps.conversionManager.logDay1Dau());
0 < a && (this.reportRetention(),
this.reportCustomDau());
this.reportDauVersion()
}
}
;
cleverapps.User.prototype.reportDauVersion = function() {
var a = cleverapps.config.version.split(".").map(function(b, c) {
2 === c && (b = cleverapps.padZeroes(b, 3));
return b
}).join("_");
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.DAU_VERSION + a)
}
;
cleverapps.User.prototype.reportCustomDau = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.CUSTOM_DAU) || {};
if (!((a.lastReportDau30 || 0) + cleverapps.parseInterval("30 days") > Date.now())) {
var b = connector.info.platform;
b && (cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.DAU30_COUNTRY_PLATFORM + c + "_" + b)
}),
a.lastReportDau30 = Date.now(),
cleverapps.dataLoader.save(DataLoader.TYPES.CUSTOM_DAU, a))
}
}
;
cleverapps.User.prototype.reportRetention = function() {
var a = this.getDaysSinceRegistration();
if (a = cleverapps.EVENTS.STATS["RETENTION_" + a])
cleverapps.eventLogger.logEvent(a),
cleverapps.abTest.allLogEvent(a);
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.VISIT, 1)
}
;
cleverapps.User.prototype.getDaysSinceRegistration = function(a) {
return Math.floor(((a || Date.now()) - this.registered) / 1E3 / 24 / 60 / 60)
}
;
cleverapps.User.prototype.loadData = function(a) {
var b = a.id;
this.lastVersion = a.version;
0 > Version.compare(this.lastVersion, "1.300.0") && connector.platform.oneOf(connector.YANDEX) && (console.log("replace ya id " + b + " -> " + b.replace(/~/g, "/")),
b = b.replace(/~/g, "/"));
b && connector.platform.setUserID(b);
this.gold = a.gold || 0;
this.registered = a.registered;
this.loggedIn = a.loggedIn;
this.channel = a.channel;
this.lastVisited = a.visited;
this.visited = Date.now();
cleverapps.expBySlots[Meta.SLOT_MAIN].load(a.exp);
this.league = this.calcLeague();
this.idfa = a.idfa;
this.progressCompare = a.progressCompare || 0;
this.soft = a.soft || 0;
void 0 === a.soft && "mergecraft" === cleverapps.config.name && (this.soft = cleverapps.GameSaver.loadProperty(Meta.SLOT_MAIN, "coins") || 0)
}
;
cleverapps.User.prototype.isBeginner = function() {
return 1 >= this.episode
}
;
cleverapps.User.prototype.isNovice = function() {
return 3 >= this.episode && 1 < this.episode
}
;
cleverapps.User.prototype.isFirstSession = function() {
return this.registered === this.visited
}
;
cleverapps.User.prototype.checkAvailable = function() {
return !0
}
;
cleverapps.User.prototype.earnHard = function(a, b, c) {
if (0 !== b && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EARN.HARD, {
value: b
}),
void 0 === a && cleverapps.throwAsync("undefined earn hard event"),
cleverapps.eventLogger.logEvent("earn_hard-" + a, {
value: b
}),
cleverapps.abTest.allLogEvent("earn_hard-" + a, {
value: b
}),
this.gold += b,
this.incProgressCompare(3, !0),
this.save(),
!c))
this.onChangeGold()
}
;
cleverapps.User.prototype.onChangeGold = function() {
this.trigger("changeHard")
}
;
cleverapps.User.prototype.canTakeHard = function(a) {
return this.gold >= a
}
;
cleverapps.User.prototype.spendHard = function(a, b) {
if (0 === b)
return !0;
if (this.canTakeHard(b)) {
cleverapps.eventBus.trigger("taskEvent", DailyTasks.SPEND_HARD, b);
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.SPENT.HARD, {
value: b
});
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.SPENT.HARD + "-" + a, {
value: b
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SPENT.HARD + "-" + cleverapps.travelBook.getCurrentPage().id + a, {
value: b
});
Game.currentGame && Game.currentGame.getMode() === GameBase.MODE_HIGHSCORE && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SPENT.HARD + "-" + Game.currentGame.getMode(), {
value: b
});
if (Game.currentGame && Game.currentGame.level && Game.currentGame.level.isBonusWorldLevel && Game.currentGame.level.isBonusWorldLevel() || cleverapps.environment.isBonusWorldScene()) {
var c = cleverapps.missionManager.findByType(Mission.TYPE_BONUS_WORLD);
c && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SPENT.HARD + "-" + c.bonusWorld.type + a, {
value: b
})
}
cleverapps.eventLogger.logEvent("hard-" + a, {
value: b
});
cleverapps.aims.showTarget(cleverapps.aims.getTarget("hard"));
this.gold -= b;
this.incProgressCompare(3, !0);
this.save();
this.trigger("changeHard");
return !0
}
this.onCantTakeGold(b - this.gold);
return !1
}
;
cleverapps.User.prototype.setSoft = function(a, b, c) {
var d = a - this.soft;
0 !== d && (this.soft = a,
this.incProgressCompare(1, !0),
this.save(),
b || this.trigger("changeSoft"));
0 < d && (a = c && c.event,
void 0 === a && cleverapps.throwAsync("undefined earn soft event"),
cleverapps.eventLogger.logEvent("earn_soft-" + a, {
value: d
}),
cleverapps.abTest.allLogEvent("earn_soft-" + a, {
value: d
}),
cleverapps.travelBook.isExpedition() && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EARN.SOFT + "-" + cleverapps.travelBook.getCurrentExpedition().id, {
value: d
}))
}
;
cleverapps.User.prototype.canTakeSoft = function(a) {
return this.soft >= a
}
;
cleverapps.User.prototype.spendSoft = function(a, b, c) {
c = c || {};
if (!this.canTakeSoft(b))
return cleverapps.focusManager.display({
stack: !0,
focus: "ShopWindow",
control: ["MenuBarGoldItem", "MenuBarCoinsItem"],
action: function(d) {
new SoftCurrencyShopWindow;
cleverapps.focusManager.onceNoWindowsListener = d
}
}),
!1;
this.setSoft(this.soft - b);
Game.currentGame && Game.currentGame.getMode() === GameBase.MODE_HIGHSCORE && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SPENT.SOFT + "-" + Game.currentGame.getMode(), {
value: b
});
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.SPENT.SOFT, {
value: b
});
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.SPENT.SOFT + "-" + a, {
value: b
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SPENT.SOFT + "-" + cleverapps.travelBook.getCurrentPage().id + a, {
value: b
});
cleverapps.eventBus.trigger("taskEvent", DailyTasks.SPEND_SOFT, b);
cleverapps.audio.playSound(bundles.main.urls.shop_buy_effect);
a = new RewardsList({
mission: {
amount: b,
missionType: Mission.TYPE_SOFTFEAST
}
});
a.receiveRewards();
cleverapps.travelBook.getCurrentPage().isMain() && a.collectRewardsAnimation(c.source, {
withoutDelta: !0
});
return !0
}
;
cleverapps.User.prototype.setLoggedIn = function(a) {
this.loggedIn = a
}
;
cleverapps.User.prototype.getSaveInfo = function() {
return {
id: connector.platform.getUserID(),
gold: this.gold,
soft: this.soft,
registered: this.registered,
visited: this.visited,
channel: this.channel,
exp: cleverapps.expBySlots[Meta.SLOT_MAIN].getExp(),
idfa: this.idfa,
progressCompare: this.progressCompare,
version: cleverapps.config.version,
loggedIn: this.loggedIn
}
}
;
cleverapps.User.prototype.afterSync = function() {
this.league = this.calcLeague()
}
;
cleverapps.User.prototype.save = function(a) {
!1 === a && this.afterSync();
cleverapps.dataLoader.save(DataLoader.TYPES.ID, this.getSaveInfo());
!1 !== a && cleverapps.synchronizer.addUpdateTask("users")
}
;
cleverapps.User.prototype.setRandomBoostersReward = function(a) {
if (!a.randomBoosters)
return a;
a.boosters = {};
for (var b = 0; b < a.randomBoosters.amount; b++) {
var c = cleverapps.Random.choose(a.randomBoosters.types);
a.boosters[c] = a.boosters[c] ? a.boosters[c] + 1 : 1
}
delete a.randomBoosters;
return a
}
;
cleverapps.User.prototype.prepareRewardByRich = function(a, b) {
if (!a.hard && !a.boosters && !a.randomBoosters)
return a;
a = cleverapps.clone(a, !0);
a = this.setRandomBoostersReward(a);
var c = cleverapps.paymentsHistory.getLastPaymentTime();
if (c && c > Date.now() - cleverapps.parseInterval("1 day"))
return a;
var d = !1;
if (a.hard) {
var e = !0;
c && c > Date.now() - cleverapps.parseInterval("3 day") && (e = !1);
c = 1;
1E3 <= this.gold && e ? (c = .1,
d = !0) : 600 <= this.gold ? (d = !0,
c = .25) : 300 <= this.gold && (c = .5);
a.hard = Math.max(5 * Math.ceil(a.hard * c / 5), b || 0)
}
if (d && (b = [],
"match3" === cleverapps.config.type && (b = cleverapps.starChest ? [{
stars: 3,
exp: 1
}, {
stars: 3
}, {
stars: 2,
exp: 1
}, {
exp: 2
}] : [{
exp: 1
}, {
exp: 1
}, {
exp: 2
}]),
!a.unlimitedLives && cleverapps.lives && (b = b.concat([{
unlimitedLives: "10 minutes"
}, {
unlimitedLives: "15 minutes"
}, {
unlimitedLives: "30 minutes"
}])),
0 < b.length)) {
b = cleverapps.Random.choose(b);
for (var f in b)
a[f] = a[f] ? a[f] + b[f] : b[f]
}
return a
}
;
cleverapps.User.prototype.isReturnedPlayer = function() {
return this.lastVisited && this.lastVisited + cleverapps.parseInterval("2 week") < Date.now()
}
;
cleverapps.User.prototype.calcChannel = function(a) {
var b = [function(c) {
connector.platform.parsePayload(function(d) {
c(d && d.channel)
})
}
, function(c) {
var d = connector.info.platform;
d && connector.platform.oneOf(connector.INSTANT) ? cleverapps.country.whenReady(function(e) {
e = ["US"].includes(e) ? "#" + e + "_" + d : "";
c(e)
}) : c()
}
, function(c) {
connector.platform.calcPromo(c)
}
].map(function(c) {
return function(d, e) {
c(function(f) {
f ? (this.setChannel(f),
e()) : d()
}
.bind(this))
}
.bind(this)
}
.bind(this));
b = new ActionPlayer(b);
b.onComplete(a);
b.play()
}
;
cleverapps.User.prototype.setChannel = function(a) {
a = a.substring(0, 20);
this.channel !== a && (this.channel = a,
this.save())
}
;
cleverapps.User.prototype.updateIDFA = function() {
var a = connector.info.deviceID;
a && this.idfa !== a && (console.log("user set idfa - " + this.idfa),
this.idfa = a,
cleverapps.dataLoader.save(DataLoader.TYPES.ID, this.getSaveInfo()),
cleverapps.RestClient.post("/users/idfa/" + connector.platform.getUserID(), {
idfa: this.idfa
}))
}
;
cleverapps.User.prototype.initializeNewPlayerGold = function() {
this.gold = 100;
"merge" === cleverapps.config.type && (this.gold = 15);
"battlefield" === cleverapps.config.type && (this.gold = 50);
cleverapps.flags.lowMonetization && (this.gold = 0)
}
;
cleverapps.User.prototype.initializeNewPlayerSoft = function() {
this.soft = 0;
"merge" === cleverapps.config.type && (this.soft = 100);
"battlefield" === cleverapps.config.type && (this.soft = 30)
}
;
cleverapps.User.prototype.initializeNewPlayer = function() {
this.initializeNewPlayerGold();
this.initializeNewPlayerSoft();
cleverapps.expBySlots[Meta.SLOT_MAIN].load(0);
this.league = this.calcLeague();
this.save()
}
;
cleverapps.User.prototype.calcLeague = function() {
var a = 0;
if (!cleverapps.config.leagues)
return a;
for (; a < cleverapps.config.leagues.length && cleverapps.config.leagues[a] && this.getHumanReadableNumber() + (this.progress || 0) > cleverapps.config.leagues[a]; )
a++;
return a
}
;
cleverapps.User.ON_SHOW_CHANGE_VISITED = "1 hour";
cleverapps.User.SOFT_CURRENCY = 0;
cleverapps.User.HARD_CURRENCY = 1;
cleverapps.User.HARD_TO_SOFT = 4.17;
cleverapps.giveUsersGifts = function() {
"tripeaks" === cleverapps.config.name && connector.platform.oneOf(connector.MOBAGE, connector.SP_MOBAGE) && ["mbga.jp:63100202", "sb.mbga.jp:63100202"].includes(connector.platform.getUserID()) && 1E3 > cleverapps.user.getHumanReadableNumber() && (cleverapps.user.episode = 66,
cleverapps.user.level = 9,
cleverapps.user.gold += 5E4,
cleverapps.user.save(),
cleverapps.boosters.add(cleverapps.Boosters.TYPE_MAGNET, 20),
cleverapps.boosters.add(cleverapps.Boosters.TYPE_DICE, 20),
cleverapps.boosters.add(cleverapps.Boosters.TYPE_JOKERS, 20),
cleverapps.unlimitedLives.buy("240 hours"))
}
;
var UserDelete = function() {
this.load()
};
UserDelete.prototype.load = function() {
this.planned = (cleverapps.dataLoader.load(DataLoader.TYPES.USER_DELETE) || {}).planned
}
;
UserDelete.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.USER_DELETE, this.getInfo())
}
;
UserDelete.prototype.getInfo = function() {
return {
planned: this.planned
}
}
;
UserDelete.prototype.updateInfo = function(a) {
this.planned = a.planned;
this.save()
}
;
UserDelete.prototype.updateDeleted = function(a) {
this.deleted = a && a.deleted
}
;
UserDelete.prototype.isAvailable = function() {
return connector.platform.oneOf(connector.IOS, connector.MACOS) ? connector.social.isLoggedIn() : cleverapps.config.debugMode
}
;
UserDelete.prototype.startDeletion = function() {
cleverapps.focusManager.distract({
focus: "DeleteAccount",
action: function() {
cleverapps.windows.closeAllWindows();
cleverapps.user.incProgressCompare(100);
cleverapps.synchronizer.addUpdateTask("userdelete");
this.planned = Date.now() + this.getFullTime();
this.save();
cleverapps.dataLoader.processSaveQueue();
connector.platform.locationReload()
}
.bind(this)
})
}
;
UserDelete.prototype.cancelDeletion = function() {
var a;
cleverapps.focusManager.distract({
focus: "CancelDeleteAccount",
actions: [function(b) {
a = new WaitWindow;
cleverapps.synchronizer._onceNextSyncCompletedListener = cleverapps.waitNoMore(15E3, cleverapps.once(b));
cleverapps.synchronizer.syncWhenReady()
}
, function(b) {
a.close();
this.planned = void 0;
this.save();
cleverapps.user.incProgressCompare(100);
cleverapps.synchronizer.addUpdateTask("userdelete");
this.checkDeletion(b)
}
.bind(this), function(b) {
cleverapps.Plot.onStartup(b)
}
]
})
}
;
UserDelete.prototype.checkDeletion = function(a) {
this.isDeleted() ? (connector.dataLoader.cleanAll(),
cleverapps.dataLoader.cleanAll(),
new DeleteAccountRestartWindow) : this.isPlanned() ? new DeleteAccountInformationWindow : a()
}
;
UserDelete.prototype.getFullTime = function() {
return cleverapps.config.debugMode ? cleverapps.parseInterval("5 minutes") : cleverapps.parseInterval("90 days")
}
;
UserDelete.prototype.getTimeLeft = function() {
var a = this.planned - Date.now() || 0;
return Math.max(0, a)
}
;
UserDelete.prototype.isDeleted = function() {
return this.deleted > cleverapps.user.registered || this.planned <= Date.now()
}
;
UserDelete.prototype.isPlanned = function() {
return this.planned > Date.now()
}
;
var DeleteAccountWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.DeleteAccountWindow;
this._super({
name: "DeleteAccountWindow",
title: "DeleteAccountWindow.title",
content: this.createContent(),
styles: a.window
})
},
getPerson: function() {
return cleverapps.styles.DeleteAccountWindow.person
},
createContent: function() {
var a = cleverapps.styles.DeleteAccountWindow
, b = this.createInfo()
, c = this.createButtons();
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createInfo: function() {
var a = cleverapps.styles.DeleteAccountWindow.info
, b = Math.floor(cleverapps.userDelete.getFullTime() / 24 / 60 / 60 / 1E3);
b = [Messages.get("DeleteAccountWindow.text1", {
newline: "\n"
}), Messages.get("DeleteAccountWindow.text2", {
days: b
}), Messages.get("DeleteAccountWindow.text3", {
days: b
})].map(function(d) {
d = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.DELETE_ACCOUNT_TEXT);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setWrapWidth(a.text.size[cleverapps.resolution.mode].width);
return d
});
b = new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
});
b.setPositionRound(b.width / 2, b.height / 2);
var c = cleverapps.UI.createScale9Sprite(bundles.windows.frames.windows_details_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
c.setContentSize(b.width, b.height);
c.addChild(b);
return c
},
createButtons: function() {
var a = cleverapps.styles.DeleteAccountWindow.buttons
, b = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_red,
text: "Continue",
onClicked: function() {
new DeleteAccountConfirmationWindow;
this.close()
}
.bind(this),
width: a.width,
height: a.height
})
, c = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_green,
text: "Cancel",
onClicked: this.close.bind(this),
width: a.width,
height: a.height
});
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
DELETE_ACCOUNT_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
cleverapps.styles.DeleteAccountWindow = {
margin: 20,
info: {
margin: 10,
padding: {
x: 40,
y: 40
},
text: {
size: [{
width: 1E3
}, {
width: 1300
}, {
width: 1300
}]
}
},
buttons: {
width: 340,
height: 110,
margin: 240
}
};
var DeleteAccountConfirmationWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.DeleteAccountWindow;
this._super({
name: "DeleteAccountConfirmationWindow",
title: "DeleteAccountConfirmationWindow.title",
content: this.createContent(),
styles: a.window
})
},
getPerson: function() {
return cleverapps.styles.DeleteAccountWindow.person
},
createContent: function() {
var a = cleverapps.styles.DeleteAccountWindow
, b = this.createInfo()
, c = this.createButtons();
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createInfo: function() {
var a = cleverapps.styles.DeleteAccountWindow.info
, b = Math.floor(cleverapps.userDelete.getFullTime() / 24 / 60 / 60 / 1E3);
b = [Messages.get("DeleteAccountConfirmationWindow.text1"), Messages.get("DeleteAccountConfirmationWindow.text2", {
days: b
}), Messages.get("DeleteAccountConfirmationWindow.text3", {
days: b,
newline: "\n"
})].map(function(d) {
d = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.DELETE_ACCOUNT_TEXT);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setWrapWidth(a.text.size[cleverapps.resolution.mode].width);
return d
});
b = new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
});
b.setPositionRound(b.width / 2, b.height / 2);
var c = cleverapps.UI.createScale9Sprite(bundles.windows.frames.windows_details_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
c.setContentSize(b.width, b.height);
c.addChild(b);
return c
},
createButtons: function() {
var a = cleverapps.styles.DeleteAccountWindow.buttons
, b = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_red,
text: "Delete",
onClicked: function() {
cleverapps.userDelete.startDeletion()
},
width: a.width,
height: a.height
})
, c = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_green,
text: "Cancel",
onClicked: this.close.bind(this),
width: a.width,
height: a.height
});
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
}
});
var DeleteAccountInformationWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.DeleteAccountWindow;
this._super({
name: "DeleteAccountInformationWindow",
title: "DeleteAccountInformationWindow.title",
content: this.createContent(),
styles: a.window,
closeButton: !1
})
},
createContent: function() {
var a = cleverapps.styles.DeleteAccountWindow
, b = this.createInfo()
, c = this.createButtons();
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createInfo: function() {
var a = cleverapps.styles.DeleteAccountWindow.info
, b = Math.floor((cleverapps.userDelete.getTimeLeft() - 1E3) / 24 / 60 / 60 / 1E3) + 1;
b = [Messages.get("DeleteAccountInformationWindow.time", {
days: b
}), Messages.get("DeleteAccountInformationWindow.text1", {
newline: "\n"
}), Messages.get("DeleteAccountInformationWindow.text2", {
newline: "\n"
})];
connector.platform.oneOf(connector.IOS, connector.MACOS) && b.push(Messages.get("DeleteAccountInformationWindow.revoke.apple", {
newline: "\n"
}));
b = b.map(function(d) {
d = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.DELETE_ACCOUNT_TEXT);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setWrapWidth(a.text.size[cleverapps.resolution.mode].width);
return d
});
b = new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
});
b.setPositionRound(b.width / 2, b.height / 2);
var c = cleverapps.UI.createScale9Sprite(bundles.windows.frames.windows_details_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
c.setContentSize(b.width, b.height);
c.addChild(b);
return c
},
createButtons: function() {
var a = cleverapps.styles.DeleteAccountWindow.buttons
, b = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_green,
text: "Cancel",
onClicked: function() {
this.close();
cleverapps.userDelete.cancelDeletion()
}
.bind(this),
width: a.width,
height: a.height
});
if (SettingsWindow.IsExitButtonAvailable())
var c = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_red,
text: "Exit",
onClicked: function() {
connector.platform.closeApplication()
},
width: a.width,
height: a.height
});
return new cleverapps.Layout([b, c].filter(Boolean),{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
}
});
var DeleteAccountRestartWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.DeleteAccountWindow;
this._super({
name: "DeleteAccountRestartWindow",
title: "DeleteAccountRestartWindow.title",
content: this.createContent(),
styles: a.window,
closeButton: !1
})
},
createContent: function() {
var a = cleverapps.styles.DeleteAccountWindow
, b = this.createInfo()
, c = this.createButtons();
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createInfo: function() {
var a = cleverapps.styles.DeleteAccountWindow.info
, b = [Messages.get("DeleteAccountRestartWindow.text1", {
newline: "\n"
})].map(function(d) {
d = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.DELETE_ACCOUNT_TEXT);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setWrapWidth(a.text.size[cleverapps.resolution.mode].width);
return d
});
b = new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
});
b.setPositionRound(b.width / 2, b.height / 2);
var c = cleverapps.UI.createScale9Sprite(bundles.windows.frames.windows_details_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
c.setContentSize(b.width, b.height);
c.addChild(b);
return c
},
createButtons: function() {
var a = cleverapps.styles.DeleteAccountWindow.buttons;
if (SettingsWindow.IsExitButtonAvailable())
var b = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_red,
text: "Exit",
onClicked: function() {
connector.platform.closeApplication()
},
width: a.width,
height: a.height
});
return new cleverapps.Layout([b].filter(Boolean),{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
}
});
cleverapps.Scenes = function() {
this.onAvoidNodeVisibilityChanged = function() {}
}
;
cleverapps.refreshScene = function() {
var a = function(b) {
var c = cleverapps.scenes.getRunningScene();
c.refreshFromTool = !0;
c instanceof MainScene ? cleverapps.travelBook.gotoMainScene(b) : "undefined" !== typeof EditorScene && c instanceof EditorScene ? EditorScene.open({
level: c.level,
callback: b
}) : c instanceof GameScene ? cleverapps.config.editorMode ? (b(),
LevelManager.getInstance().setLevel({
levelNo: cleverapps.environment.levelNo,
episodeNo: cleverapps.environment.episodeNo
}),
LevelManager.getInstance().editLevel()) : "merge" === cleverapps.config.type ? cleverapps.travelBook.gotoMainScene(b) : cleverapps.meta.wantsToPlay(b) : "undefined" !== typeof HeroesScene && c instanceof HeroesScene ? cleverapps.scenes.replaceScene(new HeroesScene, b) : c instanceof DailyCupScene ? cleverapps.scenes.replaceScene(new DailyCupScene, b) : "undefined" !== typeof BonusWorldScene && c instanceof BonusWorldScene ? cleverapps.travelBook.gotoMainScene(function() {
cleverapps.scenes.replaceScene(new BonusWorldScene(cleverapps.missionManager.findRunningMission(Mission.TYPE_BONUS_WORLD)), b)
}) : "undefined" !== typeof OctopusHuntScene && c instanceof OctopusHuntScene && cleverapps.scenes.replaceScene(new OctopusHuntScene(cleverapps.missionManager.findRunningMission(Mission.TYPE_OCTOPUS_HUNT)), b)
};
cleverapps.focusManager.isFocused() ? cleverapps.focusManager.distract({
focus: "sceneRefresh",
action: a
}) : cleverapps.focusManager.display({
focus: "sceneRefresh",
action: a
})
}
;
cleverapps.Scenes.prototype.getMovingNode = function(a) {
for (; a; a = a.parent)
if (a.movingNode)
return a.movingNode;
return cleverapps.scenes.getRunningScene().movingNode
}
;
cleverapps.Scenes.prototype.getRunningScene = function() {
return cc.director.getRunningScene()
}
;
cleverapps.Scenes.prototype.replaceScene = function(a, b) {
cleverapps.focusManager.isFocused() || cleverapps.focusManager.debugMessage("Trying to replace scene without user focus! " + a.sceneName);
b = b || function() {}
;
if (cleverapps.config.editorMode || cleverapps.config.demoMode || cleverapps.config.wysiwygMode)
cleverapps.silentIntro = !0;
cleverapps.notification.clear();
FingerView.remove(FingerView.currentFinger, !0);
PointerView.remove(PointerView.currentPointer);
var c = cleverapps.scenes.getRunningScene()
, d = Date.now()
, e = void 0;
cleverapps.focusManager.compound(b, [function(f) {
a.isAboutToShow = !0;
c.isAboutToRemove = !0;
c.destructor();
a.prepareBundles && a.prepareBundles();
f()
}
, function(f) {
e = new Transition(c,a);
if (c.onTransitionAnimationDidStart)
c.onTransitionAnimationDidStart();
e.show(f, cleverapps.silentIntro)
}
, function(f) {
cleverapps.bannerAd && cleverapps.bannerAd.check(!0);
a.updateSize && a.updateSize();
e.replaceParent(a);
a.addTransitionBundles(e.bundles);
cc.director.runScene(a);
cc.director.setNextScene();
f()
}
, function(f) {
cleverapps.lazyAssets.unload();
c.unload && c.unload(a);
for (var g = [c]; 0 < g.length; ) {
var h = g.pop();
g = g.concat(h.children);
h.iterateTiles && h.iterateTiles(function(k) {
k instanceof cc.Node && g.push(k)
});
h.removeAllChildren()
}
c = void 0;
cleverapps.windows.reset();
"creator" === engine && cc.SkeletonCache.sharedCache.clear();
f()
}
, function(f) {
f = cleverapps.wait(2, f);
cleverapps.rewardedAdsManager.showPreroll(f);
a.load ? a.load(f) : f()
}
, function(f) {
a.isAllLoaded = !0;
if (a.onSceneLoaded)
a.onSceneLoaded();
a.afterResize && a.afterResize();
f()
}
, function(f) {
cleverapps.config.debugMode && LoaderScene.start && (console.log("scene loading time", (Date.now() - LoaderScene.start) / 1E3),
LoaderScene.start = void 0);
cleverapps.toolModel && "undefined" !== typeof ToolView && a.movingNode && (cleverapps.toolModel.reset(),
a.toolMenu = new ToolView,
a.addChild(a.toolMenu),
a.toolMenu.addOpener());
cc.game.isPaused() && cc.game.step();
cleverapps.ConsoleStream.sendLoadingTime("scene " + cleverapps.environment.scene + " " + (Date.now() - d) + "ms");
f()
}
, function(f) {
connector.platform.oneOf(connector.SP_MOBAGE) ? cleverapps.platformLogic.showLoginScreen(f) : f()
}
, function(f) {
e.hide(f)
}
, function(f) {
e.removeFromParent();
a.isAboutToShow = void 0;
cleverapps.notification.processQueue();
connector.platform.notifyGameReady();
cleverapps.bundleLoader.cacheBundles(a.cachedBundles());
a.ensureSoundsLoaded();
f()
}
])
}
;
cleverapps.Scenes.prototype.sceneRefresh = function() {
cleverapps.flags.reset();
cleverapps.hose && cleverapps.hose.reset();
levels.tutorial && levels.tutorial.stop();
if (connector.social.isLoggedIn())
connector.social.getPlugin().onLogin();
else
cleverapps.synchronizer.syncWhenReady();
cleverapps.windows.reset();
cleverapps.isKnockoutGame() && cleverapps.meta.knockoutGame.stopRumble();
cleverapps.focusManager.distract({
focus: "sceneRefresh",
action: function(a) {
cleverapps.travelBook.gotoMainScene(a)
}
})
}
;
cleverapps.Scenes.prototype.isSceneReady = function() {
var a = this.getRunningScene();
return !a.isAboutToRemove && !a.isAboutToShow
}
;
var Transition = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.fromScene = a;
this.toScene = b;
this.setLocalZOrder(Transition.ZORDER);
this.setVisible(!1);
a.addChild(this);
this.type = this.getType();
this.setupChildren();
this.createContent();
this.updateSize()
},
createContent: function() {
this.type === Transition.TYPE_KEEP_BG ? this.createKeepBackground() : [Transition.TYPE_DEFAULT, Transition.TYPE_VICTORY].includes(this.type) && (this.background = new TransitionBackground(this.type),
this.addChild(this.background),
this.content = new TransitionContent(this.type),
this.addChild(this.content),
TransitionLoading.isAvailable() && this.type === Transition.TYPE_DEFAULT && (this.loading = new TransitionLoading,
this.addChild(this.loading)))
},
getType: function() {
var a = Transition.TYPE_DEFAULT;
cleverapps.flags.noTransitionAnimation ? a = Transition.TYPE_EMPTY : this.fromScene.transitionVictory ? a = Transition.TYPE_VICTORY : this.canTransitionKeepBg() && (a = Transition.TYPE_KEEP_BG);
return a
},
setupChildren: function() {
var a = cleverapps.resolution.getSafePadding();
this.setPosition(-a.left, -a.bottom)
},
updateSize: function() {
var a = cleverapps.resolution.getBgSize();
this.setContentSize(a);
this.background && this.background.setScale(Math.max(cleverapps.styles.Transition[this.type].scale * Math.max(a.height / this.background.height, a.width / this.background.width), 1))
},
createKeepBackground: function() {
var a = this.fromScene.background;
this.fromScene.background = void 0;
a.replaceParentSamePlace(this, {
keepScale: !0
});
cleverapps.oneOf(a, LoaderSceneBackground) || delete a.alignment;
this.bundles = a.transitionBundles
},
canTransitionKeepBg: function() {
var a = this.fromScene.background;
if (!a || !a.transitionBundles)
return !1;
if (cc.game.isPaused())
return !0;
if (this.toScene instanceof GameSceneBase && "merge" === cleverapps.config.type || !this.toScene.bundles)
return !1;
a = this.toScene.bundles.filter(function(b) {
return bundles[b].meta && bundles[b].meta.external
});
return cleverapps.bundleLoader.isLoaded(this.toScene.bundles) || connector.info.isNative && 0 === a.league
},
show: function(a, b) {
this.setVisible(!0);
cleverapps.focusManager.compound(a, [function(c) {
this.content && this.content.show(b);
this.background ? this.background.show(c, b) : c()
}
.bind(this), function(c) {
this.loading && this.loading.show(b);
c()
}
.bind(this)])
},
hide: function(a, b) {
(new ActionPlayer([function(c) {
this.loading && this.loading.hide();
this.content && this.content.hide(b);
this.background ? this.background.hide(c, b) : c()
}
.bind(this), function(c) {
this.setVisible(!1);
c()
}
.bind(this)])).play(a)
}
});
Transition.isVictoryTransitionAvailable = function() {
return bundles.transition.jsons.transition_victory_curtains_json
}
;
Transition.ZORDER = 1E3;
Transition.TYPE_DEFAULT = "default";
Transition.TYPE_VICTORY = "victory";
Transition.TYPE_KEEP_BG = "keep_bg";
Transition.TYPE_EMPTY = "empty";
cleverapps.styles.Transition = {};
cleverapps.styles.Transition[Transition.TYPE_DEFAULT] = {
scale: 1.05
};
cleverapps.styles.Transition[Transition.TYPE_VICTORY] = {
scale: 1.2
};
var TransitionBackground = cc.Node.extend({
ctor: function(a) {
this._super();
this.type = a;
this.setAnchorPoint(.5, .5);
this.setPositionRound(cleverapps.styles.TransitionBackground);
a = this.curtains = new cleverapps.Spine(a === Transition.TYPE_DEFAULT ? bundles.transition.jsons.transition_curtains_json : bundles.transition.jsons.transition_victory_curtains_json);
this.addChild(a);
var b = a.listSkins();
0 < b.length && (b = b[levels.user.getVirtualLevel() % b.length],
a.setSkin(b));
this.setContentSize(a.getContentSize());
a.setPosition(this.width / 2, this.height / 2)
},
show: function(a, b) {
b ? (this.curtains.setAnimation(0, "close", !1),
this.curtains.clearTrack(0),
a()) : this.runAction(new cc.Sequence(new cc.DelayTime((cleverapps.styles.TransitionBackground[this.type] || {}).delay || 0),new cc.CallFunc(function() {
this.curtains.setAnimation(0, "close", !1);
this.curtains.setCompleteListener(a)
}
.bind(this))))
},
hide: function(a, b) {
this.stopAllActions();
b ? a() : (this.curtains.setAnimation(0, "open", !1),
this.curtains.setCompleteListener(a))
}
});
cleverapps.styles.TransitionBackground = {
x: {
align: "center"
},
y: {
align: "center"
}
};
cleverapps.styles.TransitionBackground[Transition.TYPE_VICTORY] = {
delay: .9
};
var TransitionLoading = cleverapps.Layout.extend({
ctor: function() {
var a = cleverapps.styles.TransitionLoading
, b = this.animation = new cleverapps.Spine(bundles.main.jsons.wait_transition_json);
b.setAnimation(0, "idle", !0);
var c = this.text = cleverapps.UI.generateOnlyText("Loading", cleverapps.styles.FONTS.TRANSITION_LOADING_TEXT);
this._super([c, b], {
direction: cleverapps.UI.VERTICAL,
padding: a.padding
});
this.setPositionRound(a);
this.setVisible(!1)
},
show: function(a) {
this.setVisible(!0);
a ? this.animation.clearTrack(0) : (this.text.setOpacity(0),
this.text.setScale(.9),
this.runAction(new cc.TargetedAction(this.text,new cc.Spawn(new cc.FadeIn(.3),(new cc.ScaleTo(.3,1)).easing(cc.easeIn(1))))))
},
hide: function() {
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.TargetedAction(this.text,new cc.Spawn(new cc.FadeOut(.2),(new cc.ScaleTo(.2,.9)).easing(cc.easeIn(1)))),new cc.Hide))
}
});
TransitionLoading.isAvailable = function() {
return !!bundles.main.jsons.wait_transition_json
}
;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TRANSITION_LOADING_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.TransitionLoading = {
x: {
align: "center"
},
y: {
align: "center",
dy: -400
},
padding: 30
};
var TransitionContent = cc.Node.extend({
ctor: function(a) {
this._super();
var b = cleverapps.styles.TransitionContent;
this.type = a;
this.setAnchorPoint(.5, .5);
var c = this.person = new cleverapps.Spine(a === Transition.TYPE_DEFAULT ? bundles.transition.jsons.transition_person_json : bundles.transition.jsons.transition_victory_person_json);
c.setScale(b.person[a].scale && b.person[a].scale[cleverapps.resolution.mode] || 1);
c.setPositionRound(b.person[a]);
this.addChild(c);
this.updateSize();
a === Transition.TYPE_VICTORY && (a = this.message = cleverapps.UI.generateTTFText("message.YouWin", cleverapps.styles.FONTS.WIN_TEXT),
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
a.setPositionRound(b.message.position),
a.fitTo(cleverapps.resolution.getBgSize().width),
this.addChild(a))
},
updateSize: function() {
if (this.type === Transition.TYPE_VICTORY) {
var a = cleverapps.resolution.getSafePadding();
this.setContentSize(cleverapps.resolution.getSceneSize());
this.setPositionRound({
align: "center",
dx: -a.left
}, {
align: "center",
dy: -a.bottom
})
} else
this.setContentSize(cleverapps.resolution.getBgSize()),
this.setPositionRound({
align: "center"
}, {
align: "center"
})
},
show: function(a) {
this.person.setAnimation(0, "close", !1);
a ? this.person.clearTrack(0) : this.type === Transition.TYPE_VICTORY && (this.message.setOpacity(0),
this.message.runAction(new cc.Sequence(new cc.DelayTime(.2),new cc.FadeIn(.2),new cc.DelayTime(.5),new cc.PlaySound(bundles.transition.urls.transition_victory_sound),new cc.DelayTime(.6),new cc.FadeOut(.2),new cc.Hide)))
},
hide: function() {
this.person.hasAnimation("open") && this.person.setAnimation(0, "open", !1);
this.message && (this.message.stopAllActions(),
this.message.setVisible(!1))
}
});
cleverapps.styles.TransitionContent = {
person: {},
message: {
position: [{
x: {
align: "center"
},
y: {
align: "center",
dy: 200
}
}, {
x: {
align: "center"
},
y: {
align: "center",
dy: 350
}
}, {
x: {
align: "center"
},
y: {
align: "center",
dy: 350
}
}]
}
};
cleverapps.styles.TransitionContent.person[Transition.TYPE_DEFAULT] = {
x: {
align: "center"
},
y: {
align: "center"
}
};
cleverapps.styles.TransitionContent[Transition.TYPE_VICTORY] = {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 160
},
scale: [.89, 1.3, 1.3]
};
cleverapps.Tutorial = function() {
this.tutorialSteps = new cleverapps.TutorialSteps;
this.steps = this.tutorialSteps.list(this.nextStep.bind(this))
}
;
cleverapps.Tutorial.prototype.setGame = function(a) {
this.game = a;
this.tutorialSteps.setGame(this.game)
}
;
cleverapps.Tutorial.prototype.stop = function() {
this.running && (this.running = !1,
this.step = this.steps.length,
this.finishCallback(),
this.finishCallback = void 0)
}
;
cleverapps.Tutorial.prototype.start = function(a) {
this.running = !0;
this.finishCallback = a;
this.setStep(0)
}
;
cleverapps.Tutorial.prototype.remindStep = function() {
this.isRunning() && this.steps[this.step].call(this, this.game)
}
;
cleverapps.Tutorial.prototype.setStep = function(a) {
this.step = a;
var b = {
step: a
};
this.step >= this.steps.length ? (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.GENERAL.TUTORIAL_COMPLETE, b),
this.stop()) : (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.TUTORIAL_STEP + (a + 1), b),
0 === a && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.TUTORIAL_BEGIN),
this.remindStep())
}
;
cleverapps.Tutorial.prototype.nextStep = function() {
this.isRunning() && this.setStep(this.step + 1)
}
;
cleverapps.Tutorial.prototype.isRunning = function() {
return this.running
}
;
var ConversionManager = function() {
this.load()
};
ConversionManager.prototype.load = function() {
this.data = cleverapps.dataLoader.load(DataLoader.TYPES.MULTIPLE_CONVERSIONS_INFO) || {}
}
;
ConversionManager.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.MULTIPLE_CONVERSIONS_INFO, this.data)
}
;
ConversionManager.prototype.processConversion = function(a, b) {
if (Array.isArray(a))
a.forEach(function(d) {
this.processConversion(d, b)
}, this);
else if (!(cleverapps.user.getDaysSinceRegistration() >= a.conversion_window)) {
var c = "d" + a.conversion_window;
a.reach && a.reach.includes(b) && (this.logReachEvent(a, c + "r_" + a.name + "_" + b),
a.old_name && this.logReachEvent(a, a.old_name + "_" + b));
a.accumulate && (this.logReachEvent(a, c + "a_" + a.name + "#"),
this.logAccumulateEvent(a, c + "a_" + a.name, "count" === a.accumulate ? 1 : b),
a.old_name && this.logAccumulateEvent(a, a.old_name, "count" === a.accumulate ? 1 : b))
}
}
;
ConversionManager.prototype.logReachEvent = function(a, b) {
if (!this.data[b]) {
this.data[b] = 1;
this.save();
a = a.old_name && b.startsWith(a.old_name);
cleverapps.eventLogger.logEvent(b, {
event: cleverapps.user.registered,
channel: cleverapps.user.channel,
value: 1,
conversion: !a
});
var c = cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.lowMonetNew);
void 0 !== c && cleverapps.eventLogger.logEvent(b + "_lm" + c, {
event: cleverapps.user.registered,
channel: cleverapps.user.channel,
value: 1,
conversion: !a
})
}
}
;
ConversionManager.prototype.logAccumulateEvent = function(a, b, c) {
a = a.old_name && b.startsWith(a.old_name);
cleverapps.eventLogger.logEvent(b, {
event: cleverapps.user.registered,
channel: cleverapps.user.channel,
value: c,
conversion: !a
});
c = cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.lowMonetNew);
void 0 !== c && cleverapps.eventLogger.logEvent(b + "_lm" + c, {
event: cleverapps.user.registered,
channel: cleverapps.user.channel,
value: 1,
conversion: !a
})
}
;
ConversionManager.prototype.logDay1Dau = function() {
cleverapps.eventLogger.logEvent("d1_dau", {
event: cleverapps.user.registered,
channel: cleverapps.user.channel,
value: 1,
conversion: !0
});
var a = cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.lowMonetNew);
void 0 !== a && cleverapps.eventLogger.logEvent("d1_dau_lm" + a, {
event: cleverapps.user.registered,
channel: cleverapps.user.channel,
value: 1,
conversion: !0
})
}
;
ConversionManager.EVENTS = Object.values(cleverapps.EVENTS.CONVERSIONS).reduce(function(a, b) {
cleverapps.toArray(b).forEach(function(c) {
var d = "d" + c.conversion_window;
c.reach && c.reach.forEach(function(e) {
a[d + "r_" + c.name + "_" + e] = !0;
c.old_name && "retention" !== c.old_name && (a[c.old_name + "_" + e] = !0)
});
c.accumulate && (a[d + "a_" + c.name] = !0,
c.old_name && "retention" !== c.old_name && (a[c.old_name] = !0))
});
return a
}, {});
var EventsLogger = function() {
this.loggers = this.initLoggers();
this.logPurchase = this.loggersApply.bind(this, "logPurchase");
this.logAdRevenue = this.loggersApply.bind(this, "logAdRevenue");
this.onUpdateUserId = this.loggersApply.bind(this, "onUpdateUserId");
this.onUpdateScreen = this.loggersApply.bind(this, "onUpdateScreen")
};
EventsLogger.prototype.initLoggers = function() {
var a = [];
a.push(new MetricsLogger);
AdjustLogger.isApplicable() && a.push(new AdjustLogger);
InstantLogger.isApplicable() && a.push(new InstantLogger);
SamsungLogger.isApplicable() && a.push(new SamsungLogger);
GoogleAnalyticsLogger.isApplicable() && a.push(new GoogleAnalyticsLogger);
FirebaseLogger.isApplicable() && a.push(new FirebaseLogger);
ThinkingDataLogger.isApplicable() && a.push(new ThinkingDataLogger);
GravityEngineLogger.isApplicable() && a.push(new GravityEngineLogger);
YandexMetricaLogger.isApplicable() && a.push(new YandexMetricaLogger);
FacebookPixelLogger.isApplicable() && a.push(new FacebookPixelLogger);
return a
}
;
EventsLogger.prototype.logEvent = function(a, b) {
cleverapps.flags && cleverapps.flags.noLogEvents || this.loggersApply("logEvent", a, b || {})
}
;
EventsLogger.prototype.loggersApply = function() {
for (var a = arguments[0], b = Array.prototype.slice.call(arguments, 1), c = 0; c < this.loggers.length; c++) {
var d = this.loggers[c];
d[a] && d[a].apply(d, b)
}
}
;
var MetricsLogger = function() {
this.batch = {
names: [],
params: []
};
this.sendEvents = cleverapps.accumulate(0, this._sendEvents.bind(this));
cleverapps.config.metricsApiURL || console.log("Metrics logger disabled - metricsApiURL is not defined")
};
MetricsLogger.prototype.logEvent = function(a, b) {
cleverapps.config.metricsApiURL && (50 < a.length && (cleverapps.throwAsync("Event name length is more than 50 characters: " + a),
a = a.substring(0, 50)),
this.batch.names.push(a),
this.batch.params.push(b),
this.sendEvents())
}
;
MetricsLogger.prototype._sendEvents = function() {
// var a = this.batch.names.join(",");
// console.log("Sending events - " + a);
// var b = this.getBaseParameters();
// b.events = a;
// b.params = this.batch.params;
// cleverapps.RestClient.post(cleverapps.config.metricsApiURL + "/events/", b, function() {}, function() {
// console.log("Failure event - " + a)
// });
// this.batch = {
// names: [],
// params: []
// }
}
;
MetricsLogger.prototype.getBaseParameters = function() {
var a = {};
cleverapps.user && connector.platform.getUserID() && (a.id = connector.platform.getUserID());
cleverapps.environment && (void 0 !== cleverapps.environment.levelNo && (a.level = cleverapps.environment.levelNo),
void 0 !== cleverapps.environment.episodeNo && (a.episode = cleverapps.environment.episodeNo));
cleverapps.config && "merge" === cleverapps.config.type && cleverapps.user && (a.level = cleverapps.user.level);
var b = Game.currentGame && Game.currentGame.level;
b && b.hash && (a.hash = b.hash);
a.source = connector.info.source;
return a
}
;
var InstantLogger = function() {};
InstantLogger.prototype.logEvent = function(a, b) {
InstantLogger.EVENTS[a] && FBInstant.logEvent(a, b.value)
}
;
InstantLogger.isApplicable = function() {
return connector.platform.oneOf(connector.INSTANT)
}
;
InstantLogger.EVENTS = ConversionManager.EVENTS;
var SamsungLogger = function() {};
SamsungLogger.prototype.logEvent = function(a, b) {
SamsungLogger.EVENTS[a] && GSInstant.logEvent(a, "string", JSON.stringify(b))
}
;
SamsungLogger.isApplicable = function() {
return connector.platform.oneOf(connector.SAMSUNG)
}
;
SamsungLogger.EVENTS = ConversionManager.EVENTS;
var ThinkingDataLogger = function() {
window.thinkingdata = new ThinkingAnalyticsAPI({
appId: cleverapps.config.wechat.thinkingData.appId,
serverUrl: cleverapps.config.wechat.thinkingData.serverUrl,
autoTrack: {
appShow: !0,
appHide: !0
}
});
this.queue = [];
thinkingdata.init();
this.totalPriceAmount = 0;
cleverapps.whenAllInitialized(this.initTotalAmount.bind(this));
this.onUpdateUserId()
};
ThinkingDataLogger.prototype.initTotalAmount = function() {
this.totalPriceAmount = cleverapps.paymentsHistory.price.reduce(function(a, b) {
b = connector.payments.convertPrice(b);
return a + b
}, 0)
}
;
ThinkingDataLogger.prototype.onUpdateUserId = function() {
if (!connector.platform.withTmpID())
if (cleverapps.allInitialized) {
this.initialized = !0;
thinkingdata.login(connector.platform.getUserID());
this.send("userSetOnce", {
register_time_v1: new Date(cleverapps.user.registered)
});
cleverapps.user.channel && this.send("userSetOnce", {
channel: cleverapps.user.channel
});
this.send("userSet", {
last_login_time: new Date,
current_coin: cleverapps.user.soft,
current_diamond: cleverapps.user.gold,
current_level: Math.round(cleverapps.user.getFloatLevel()),
current_energy: cleverapps.lives && cleverapps.lives.amount,
current_hero: "undefined" !== typeof UnitsLibrary && UnitsLibrary.getInstance("main").listOpenedOfType("hero").length
});
for (var a = 0; a < this.queue.length; a++)
this.send(this.queue[a].method, this.queue[a].properties);
this.queue = []
} else
cleverapps.whenAllInitialized(this.onUpdateUserId.bind(this))
}
;
ThinkingDataLogger.prototype.logEvent = function(a, b) {
a.startsWith("hard-") ? a = cleverapps.EVENTS.SPENT.HARD : a.startsWith(cleverapps.EVENTS.STATS.SHOP_OPEN) ? a = cleverapps.EVENTS.STATS.SHOP_OPEN : a.startsWith(cleverapps.EVENTS.STATS.TUTORIAL_STEP) && (b.new_guide_id = +a.replace(cleverapps.EVENTS.STATS.TUTORIAL_STEP, ""),
a = cleverapps.EVENTS.STATS.TUTORIAL_STEP);
ThinkingDataLogger.EVENTS[a] && (a = ThinkingDataLogger.RENAME[a] || a,
this.track(a, b))
}
;
ThinkingDataLogger.prototype.track = function(a, b) {
b = Object.assign({}, b || {}, {
cur_level: Math.round(cleverapps.user.getFloatLevel()),
cur_diamond: cleverapps.user.gold,
cur_coin: cleverapps.user.soft,
cur_energy: cleverapps.lives && cleverapps.lives.amount,
total_days: cleverapps.user.getDaysSinceRegistration(),
total_purchase_amount: this.totalPriceAmount
});
b.store_type && (b.store_type = b.store_type.replace("ShopWindow.title.", ""));
b.eventName = a;
this.send("track", b)
}
;
ThinkingDataLogger.prototype.logPurchase = function(a) {
this.totalPriceAmount += a.price;
this.send("userSetOnce", {
first_pay_time: new Date
});
this.send("userSet", {
last_pay_time: new Date
});
this.send("userAdd", {
total_pay_amount: a.price,
total_pay_count: 1
})
}
;
ThinkingDataLogger.prototype.logAdRevenue = function() {
this.send("userAdd", {
total_ad_num: 1
})
}
;
ThinkingDataLogger.prototype.send = function(a, b) {
if (this.initialized)
switch (a) {
case "userSetOnce":
case "userSet":
case "userAdd":
thinkingdata[a](b);
break;
case "track":
a = b.eventName,
delete b.eventName,
thinkingdata.track(a, b)
}
else
this.queue.push({
method: a,
properties: b
}),
this.queue.length > ThinkingDataLogger.QUEUE_LIMIT && this.queue.shift()
}
;
ThinkingDataLogger.isApplicable = function() {
return connector.platform.oneOf(connector.WECHAT) && cleverapps.config.wechat && cleverapps.config.wechat.thinkingData
}
;
ThinkingDataLogger.EVENTS = cleverapps.createSet([].concat(Object.values(cleverapps.EVENTS.STATS), Object.values(cleverapps.EVENTS.WECHAT), cleverapps.EVENTS.SPENT.HARD, cleverapps.EVENTS.EARN.HARD, Object.keys(ConversionManager.EVENTS)));
ThinkingDataLogger.RENAME = {};
ThinkingDataLogger.RENAME[cleverapps.EVENTS.STATS.SHOP_OPEN] = "shop_enter";
ThinkingDataLogger.RENAME[cleverapps.EVENTS.STATS.SHOP_CLOSE] = "shop_stay";
ThinkingDataLogger.RENAME[cleverapps.EVENTS.STATS.TUTORIAL_STEP] = "new_guide";
ThinkingDataLogger.QUEUE_LIMIT = 100;
var GoogleAnalyticsLogger = function() {
this.sendMessage({
type: "config",
trackingId: cleverapps.config.googleAnalytics.measurementId
});
this.onUpdateUserId()
};
GoogleAnalyticsLogger.prototype.logEvent = function(a, b) {
GoogleAnalyticsLogger.EVENTS[a] && this.sendMessage({
type: "event",
name: a,
params: b
})
}
;
GoogleAnalyticsLogger.prototype.onUpdateUserId = function() {
this.sendMessage({
type: "set",
params: {
user_id: connector.platform.getUserID()
}
})
}
;
GoogleAnalyticsLogger.prototype.logPurchase = function(a, b, c) {
this.sendMessage({
type: "event",
name: "purchase",
params: {
currency: c.currency,
value: c.price,
transaction_id: c.transactionId,
items: [{
item_id: a.itemId,
item_name: a.title
}]
}
})
}
;
GoogleAnalyticsLogger.prototype.logAdRevenue = function(a, b) {
this.sendMessage({
type: "event",
name: "ad_" + a,
params: {
value: b,
currency: "USD"
}
})
}
;
GoogleAnalyticsLogger.prototype.sendMessage = function(a) {
window.parent[GoogleAnalyticsLogger.POST_MESSAGE]({
googleAnalytics: !0,
message: a
}, "*")
}
;
GoogleAnalyticsLogger.isApplicable = function() {
return connector.platform.oneOf(connector.CLEVERAPPS) && cleverapps.config.googleAnalytics
}
;
GoogleAnalyticsLogger.EVENTS = ConversionManager.EVENTS;
GoogleAnalyticsLogger.POST_MESSAGE = "postMessage";
var FirebaseLogger = function() {
this.batch = [];
this.sendBatch = cleverapps.accumulate(1E3, this._sendBatch.bind(this));
this.onUpdateUserId()
};
FirebaseLogger.prototype.logEvent = function(a, b) {
FirebaseLogger.EVENTS[a] && (40 < a.length && cleverapps.throwAsync("Invalid event name: " + a + "!. It must be between 1 and 40 characters, and must be contain only alphanumerics, , - or spaces, starting with alphanumeric or _."),
this.send({
method: "logEvent",
name: a,
data: b
}))
}
;
FirebaseLogger.prototype.logPurchase = function(a, b, c) {
this.send({
method: "logEvent",
name: "purchase",
data: {
currency: c.currency,
value: c.price,
transaction_id: c.transactionId
}
})
}
;
FirebaseLogger.prototype.onUpdateUserId = function() {
this.send({
method: "setUserID",
id: connector.platform.getUserID()
})
}
;
FirebaseLogger.prototype.onUpdateScreen = function(a, b) {
this.send({
method: "setScreenName",
screen: a,
scene: b
})
}
;
FirebaseLogger.prototype.send = function(a) {
this.batch.push(a);
this.sendBatch()
}
;
FirebaseLogger.prototype._sendBatch = function() {
0 < this.batch.length && (connector.platform.callNative("FirebasePlugin.sendBatch", {
batch: this.batch
}),
this.batch = [])
}
;
FirebaseLogger.isApplicable = function() {
return connector.platform.oneOf(connector.AMAZON, connector.ANDROID, connector.IOS)
}
;
FirebaseLogger.EVENTS = ConversionManager.EVENTS;
var AdOceanLogger = function() {
this.queue = [];
this.clueToken = cleverapps.dataLoader.load(DataLoader.TYPES.AD_OCEAN_TOKEN)
};
AdOceanLogger.prototype.requestClueToken = function() {
if (!this.clueToken) {
var a = wx.getLaunchOptionsSync().query.clue_token || -1
, b = "/adocean/cluetoken/" + encodeURIComponent(connector.platform.getUserID()) + "/" + encodeURIComponent(a);
cleverapps.RestClient.get(b, {}, function(c) {
if (c.errmsg || c.errcode)
this._logError("AdOcean.requestClueToken error: " + (c.errmsg || c.errcode));
else {
var d = c.clueToken;
console.log("AdOcean.requestClueToken success token: " + d + ", status: " + AdOceanLogger.STATUS[c.status]);
d && this.setClueToken(d)
}
}
.bind(this), function(c) {
this._logError("AdOcean.requestClueToken fail clientToken: " + a + ", response: " + JSON.stringify(c))
}
.bind(this))
}
}
;
AdOceanLogger.prototype.setClueToken = function(a) {
this.clueToken = a;
cleverapps.dataLoader.save(DataLoader.TYPES.AD_OCEAN_TOKEN, a);
for (a = 0; a < this.queue.length; a++)
this.sendEvent(this.queue[a].type, this.queue[a].data);
this.queue = []
}
;
AdOceanLogger.prototype.onUpdateUserId = function() {
this.requestClueToken()
}
;
AdOceanLogger.prototype.logEvent = function(a, b) {
(a = AdOceanLogger.EVENTS_MAP[a]) && this.sendEvent(a, b)
}
;
AdOceanLogger.prototype.sendEvent = function(a, b) {
if (this.clueToken) {
var c = "/adocean/event/" + encodeURIComponent(connector.platform.getUserID()) + "/" + encodeURIComponent(this.clueToken) + "/" + a
, d = {};
a === AdOceanLogger.EVENT_ACTIVE_PAY && (d.pay_amount = Math.floor(100 * b.price));
cleverapps.RestClient.post(c, {
props: d
}, function(e) {
e.errmsg || e.errcode ? this._logError("AdOcean.reportEvent error: " + (e.errmsg || e.errcode) + ", clueToken: " + this.clueToken) : console.log("AdOcean.reportEvent success, type: " + a + ", data: " + JSON.stringify(b) + ", clueToken: " + this.clueToken)
}
.bind(this), function(e) {
this._logError("AdOcean.reportEvent fail clueToken: " + this.clueToken + ", response: " + JSON.stringify(e))
}
.bind(this))
} else
this.queue.length < AdOceanLogger.QUEUE_LIMIT && this.queue.push({
type: a,
data: b
})
}
;
AdOceanLogger.prototype.logPurchase = function(a, b, c) {
this.sendEvent(AdOceanLogger.EVENT_ACTIVE_PAY, {
price: c.price
})
}
;
AdOceanLogger.isApplicable = function() {
return !1
}
;
AdOceanLogger.prototype._logError = function(a) {
console.log(a);
cleverapps.config.debugMode && cleverapps.notification.create(a)
}
;
AdOceanLogger.STATUS = {};
AdOceanLogger.STATUS[0] = "no clue token";
AdOceanLogger.STATUS[1] = "found saved token";
AdOceanLogger.STATUS[2] = "token activated";
AdOceanLogger.EVENT_REGISTRATION = 1;
AdOceanLogger.EVENT_ACTIVE_PAY = 2;
AdOceanLogger.EVENT_NEXT_DAY_OPEN = 2;
AdOceanLogger.EVENTS_MAP = {};
AdOceanLogger.EVENTS_MAP[cleverapps.EVENTS.GENERAL.TUTORIAL_COMPLETE] = AdOceanLogger.EVENT_REGISTRATION;
AdOceanLogger.EVENTS_MAP[cleverapps.EVENTS.STATS.PAYMENTS] = AdOceanLogger.EVENT_ACTIVE_PAY;
AdOceanLogger.EVENTS_MAP[cleverapps.EVENTS.STATS.RETENTION_1] = AdOceanLogger.EVENT_NEXT_DAY_OPEN;
AdOceanLogger.QUEUE_LIMIT = 100;
var AdjustLogger = function() {
var a = bundles.adjust.jsons.adjust_json.getJson();
this.remoteJson = new RemoteJson(a)
};
AdjustLogger.prototype.getConfig = function() {
var a = this.remoteJson.getJson();
return a[connector.info.source] || a
}
;
AdjustLogger.prototype.logEvent = function(a) {
var b = this.getConfig();
(a = b.events && b.events[a]) && connector.platform.callNative("AdjustPlugin.logEvent", {
eventToken: a
})
}
;
AdjustLogger.prototype.logPurchase = function(a, b, c) {
a = this.getConfig();
connector.platform.callNative("AdjustPlugin.logPurchase", {
eventToken: a.purchaseToken,
transactionID: c.transactionId,
amount: c.price,
currency: c.currency
})
}
;
AdjustLogger.prototype.logAdRevenue = function(a, b, c) {
connector.platform.callNative("AdjustPlugin.logAdRevenue", {
revenue: b,
source: c.source
})
}
;
AdjustLogger.isApplicable = function() {
var a = connector.platform.oneOf(connector.ANDROID, connector.AMAZON, connector.IOS, connector.MICROSOFT);
if (bundles.adjust.jsons.adjust_json) {
var b = bundles.adjust.jsons.adjust_json.getJson();
b = b[connector.info.source] && b[connector.info.source] || b
}
return !a || b && b.purchaseToken ? a : (cleverapps.throwAsync("empty adjust config"),
!1)
}
;
var GravityEngineLogger = function() {
this.connected = !1;
this.queue = [];
this.connect();
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, this.connect.bind(this));
cleverapps.timeouts.setInterval(this.connect.bind(this), cleverapps.parseInterval("2 minutes"))
};
GravityEngineLogger.prototype.onUpdateUserId = function() {
this.connected = !1;
this.connect()
}
;
GravityEngineLogger.prototype.connect = function() {
if (!(connector.platform.withTmpID() || this.connected || this.connecting)) {
this.connecting = !0;
var a = {
accessToken: cleverapps.config.wechat.gravityEngine.accessToken,
clientId: connector.platform.getUserID(),
autoTrack: {
appLaunch: !0,
appShow: !0,
appHide: !0
},
name: "ge",
sendTimeout: 2E4,
debugMode: cleverapps.config.debugMode && "debug"
};
this.gravityEngine = new GravityEngineAPI(a);
this.gravityEngine.setupAndStart();
this.gravityEngine.initialize({
name: connector.platform.getUserID(),
version: GravityEngineLogger.VERSION,
openid: connector.platform.getUserID()
}).then(function(b) {
this.connecting = !1;
this.connected = !0;
console.log("GravityEngineLogger.connect success " + JSON.stringify(b));
this.connectionError && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.GRAVITY_RECONNECT);
this.gravityEngine.registerEvent();
for (b = 0; b < this.queue.length; b++)
this.send(this.queue[b].method, this.queue[b].properties);
this.queue = []
}
.bind(this)).catch(function(b) {
this.connecting = !1;
this.connectionError || (this.connectionError = !0,
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.GRAVITY_INIT_ERROR));
console.log("GravityEngine.initialize failed " + JSON.stringify(b));
cleverapps.config.debugMode && cleverapps.notification.create("GravityEngine.initialize failed" + JSON.stringify(b))
}
.bind(this))
}
}
;
GravityEngineLogger.prototype.logPurchase = function(a, b) {
this.send("payEvent", {
product: a,
purchase: b
})
}
;
GravityEngineLogger.prototype.logAdRevenue = function(a) {
this.send("adShowEvent", {
name: a
})
}
;
GravityEngineLogger.prototype.send = function(a, b) {
if (this.connected)
switch (a) {
case "payEvent":
a = b.product || {};
b = b.purchase || {};
console.log("GravityEngine.payEvent", 100 * a.price, "CNY", b.paymentId, "" + a.itemId);
this.gravityEngine.payEvent(100 * a.price, "CNY", b.paymentId, "" + a.itemId, "WeChat");
break;
case "adShowEvent":
console.log("GravityEngine.adShowEvent", b.name, cleverapps.config.wechat.rewarded),
this.gravityEngine.adShowEvent(b.name, cleverapps.config.wechat.rewarded)
}
else
this.queue.push({
method: a,
properties: b
}),
this.queue.length > GravityEngineLogger.QUEUE_LIMIT && this.queue.shift()
}
;
GravityEngineLogger.isApplicable = function() {
return connector.platform.oneOf(connector.WECHAT) && cleverapps.config.wechat && cleverapps.config.wechat.gravityEngine
}
;
GravityEngineLogger.QUEUE_LIMIT = 100;
GravityEngineLogger.VERSION = 475;
var YandexMetricaLogger = function() {
// console.log("YandexMetricaLogger init");
// cleverapps.loadSdk("//mc.yandex.ru/metrika/tag.js", {
// onSuccess: function() {
// console.log("YandexMetricaLogger init success")
// }
// });
// var a = function() {
// window.ym.a.push(arguments)
// };
// a.a = [];
// a.l = 1 * new Date;
// window.ym = a;
// var b = cleverapps.config.yandexMetrica;
// "object" === typeof b && (b = cleverapps.config.debugMode ? b.standId : b.releaseId);
// this.metricaID = b;
// a(b, "init", {
// clickmap: !0,
// trackLinks: !0,
// accurateTrackBounce: !0
// });
// this.onUpdateUserId()
};
YandexMetricaLogger.prototype.logEvent = function(a, b) {
// ConversionManager.EVENTS[a] && (console.log("yandex metrica", a, b),
// ym(this.metricaID, "reachGoal", a, {
// order_price: b && b.value || 1
// }))
}
;
YandexMetricaLogger.prototype.logPurchase = function(a, b, c) {
// ym(this.metricaID, "reachGoal", "purchase", {
// order_price: c.price,
// currency: c.currency
// })
}
;
YandexMetricaLogger.prototype.logAdRevenue = function(a, b) {
// ym(this.metricaID, "reachGoal", "ad", {
// order_price: b,
// currency: "USD"
// })
}
;
YandexMetricaLogger.prototype.onUpdateUserId = function() {
// ym(this.metricaID, "setUserID", connector.platform.getUserID())
}
;
YandexMetricaLogger.isApplicable = function() {
// return connector.platform.oneOf(connector.CLEVERAPPS) && cleverapps.config.yandexMetrica
}
;
var FacebookPixelLogger = function() {
// !function(a, b, c, d, e, f, g) {
// a.fbq || (e = a.fbq = function() {
// e.callMethod ? e.callMethod.apply(e, arguments) : e.queue.push(arguments)
// }
// ,
// a._fbq || (a._fbq = e),
// e.push = e,
// e.loaded = !0,
// e.version = "2.0",
// e.queue = [],
// f = b.createElement(c),
// f.async = !0,
// f.src = d,
// g = b.getElementsByTagName(c)[0],
// g.parentNode.insertBefore(f, g))
// }(window, document, "script", "https://connect.facebook.net/en_US/fbevents.js");
// fbq("init", cleverapps.config.facebookPixel.id);
// fbq("track", "PageView")
};
FacebookPixelLogger.prototype.logEvent = function(a, b) {
// ConversionManager.EVENTS[a] && (console.log("facebook pixel", a, b),
// fbq("trackCustom", a, b))
}
;
FacebookPixelLogger.prototype.logPurchase = function(a, b, c) {
// fbq("track", "Purchase", {
// currency: c.currency,
// value: c.price
// })
}
;
FacebookPixelLogger.isApplicable = function() {
// return connector.platform.oneOf(connector.CLEVERAPPS) && cleverapps.config.facebookPixel
}
;
cleverapps.Random = {
state: 0,
m: 2147483648,
a: 1103515245,
c: 12345,
seed: function(a) {
if ("number" === typeof a)
return cleverapps.Random.state = Math.abs(parseInt(a) || 0) % cleverapps.Random.m,
cleverapps.Random.state;
if ("string" === typeof a)
return cleverapps.Random.seed(cleverapps.hashCode(a));
cleverapps.throwAsync("Expecting string as seed")
},
randomSeed: function() {
cleverapps.Random.state = Math.floor(Math.random() * cleverapps.Random.m);
for (var a = cleverapps.Random.state, b = [], c = 0; 100 > c; c++) {
var d = this.nextInt();
if (0 <= b.indexOf(d)) {
this.randomSeed();
return
}
b.push(d)
}
cleverapps.Random.state = a
},
shuffle: function(a, b) {
var c = [], d, e = [];
for (d = 0; d < a.length; d++)
e.push(d);
if (void 0 !== b) {
var f = cleverapps.Random.state;
cleverapps.Random.seed(b)
}
for (d = 0; d < a.length; d++)
b = cleverapps.Random.random(e.length),
c.push(a[e[b]]),
e.splice(b, 1);
void 0 !== f && cleverapps.Random.seed(f);
return c
},
nextInt: function() {
cleverapps.Random.state = (cleverapps.Random.a * cleverapps.Random.state + cleverapps.Random.c) % cleverapps.Random.m;
return cleverapps.Random.state
},
nextDouble: function() {
return cleverapps.Random.nextInt() / cleverapps.Random.m
},
seededDouble: function(a) {
var b = cleverapps.Random.state;
cleverapps.Random.seed(a);
a = cleverapps.Random.nextDouble();
void 0 !== b && cleverapps.Random.seed(b);
return a
},
mathChoose: function(a) {
if (0 !== a.length)
return a[Math.floor(Math.random() * a.length)]
},
chooseAmount: function(a, b, c) {
var d = [];
if (void 0 !== c) {
var e = cleverapps.Random.state;
cleverapps.Random.seed(!1 !== c ? c : Math.floor(1E6 * Math.random()))
}
for (c = 0; c < b && a.length; c++) {
var f = this.choose(a);
d.push(f);
a.splice(a.indexOf(f), 1)
}
void 0 !== e && cleverapps.Random.seed(e);
return d
},
choose: function(a, b) {
if (0 !== a.length)
return b = cleverapps.Random.random(0, a.length - 1, b),
a[b]
},
probability: function(a, b, c) {
Array.isArray(a) && (a = cleverapps.Random.random(a[0], a[1]));
if (b.length < c.length) {
for (var d = c.length - b.length, e = 0, f = 0; f < b.length; f++)
e += b[f];
for (f = 0; f < d; f++)
b.push((1 - e) / d)
}
d = [];
for (e = 0; e < a; e++)
f = cleverapps.Random.pickOne(b),
void 0 !== f && d.push(f);
d.sort();
return d.map(function(g) {
return c[g]
})
},
pickOne: function(a) {
for (var b = cleverapps.Random.nextDouble(), c = 0; c < a.length; c++)
if (b -= a[c],
0 > b)
return c
},
random: function(a, b, c) {
if (void 0 !== c) {
var d = cleverapps.Random.state;
cleverapps.Random.seed(!1 !== c ? c : Math.floor(1E6 * Math.random()))
}
void 0 === b && (b = a - 1,
a = 0);
b = b - a + 1;
c = cleverapps.Random.nextInt() / cleverapps.Random.m;
a += Math.floor(c * b);
void 0 !== d && cleverapps.Random.seed(d);
return a
}
};
cleverapps.Random.randomSeed();
"undefined" !== typeof module && (module.exports = cleverapps.Random);
cleverapps.Audio = function() {
this.cache = {};
WebViewAudioEngine.IsApplicable() && (cc.sys.isWebViewAudio = !0,
cc.audioEngine = new WebViewAudioEngine);
this.disk = void 0;
this.muted = !1;
this.volume = 1;
this.currentFade = void 0;
this.checkPlatformControls()
}
;
cleverapps.Audio.prototype.checkPlatformControls = function() {
if (connector.platform.hasAudioControls) {
var a = function(b) {
b ? this.unmute() : this.mute()
}
.bind(this);
connector.platform.on("audioToggle", a);
a(connector.platform.isAudioEnabled)
}
}
;
cleverapps.Audio.prototype.insertDisk = function(a) {
this.eject();
this.disk = a && a.resolve();
this.onChangeMusic()
}
;
cleverapps.Audio.prototype.eject = function() {
this.setVolume(1);
this.stopFade();
this.disk && (this.disk = void 0,
this.onChangeMusic())
}
;
cleverapps.Audio.prototype.mute = function() {
this.muted || cleverapps.gameModes.noMute || connector.platform.oneOf(connector.INSTANT) && connector.info.os === cc.sys.OS_IOS && connector.info.isInApp || (console.log("Audio mute"),
this.muted = !0,
this.onChangeMusic(),
cc.Audio.gainNode && (cc.Audio.gainNode.gain.value = 0))
}
;
cleverapps.Audio.prototype.unmute = function() {
!this.muted || cleverapps.gameModes.noMute || connector.platform.oneOf(connector.INSTANT) && connector.info.os === cc.sys.OS_IOS && connector.info.isInApp || (console.log("Audio unmute"),
this.muted = !1,
this.onChangeMusic(),
cc.Audio.gainNode && (cc.Audio.gainNode.gain.value = 1))
}
;
cleverapps.Audio.prototype.onChangeMusic = function() {
if (this.disk && !this.muted && cleverapps.settings.music && !cc.game.isPaused()) {
this.logSound(this.disk);
this.volume !== this.realVolume && this.setVolume(this.volume);
var a = cc.loader.getRes(this.disk.getUrl());
(cc.sys.isWebViewAudio || a && (!a.isLoaded || a.isLoaded())) && cc.audioEngine.playMusic(this.disk.getUrl(), !0)
} else
cc.audioEngine.stopMusic()
}
;
cleverapps.Audio.prototype.onSoundsLoaded = function(a) {
if (this.disk && -1 !== a.indexOf(this.disk.getUrl()))
this.onChangeMusic()
}
;
cleverapps.Audio.prototype.stopFade = function() {
this.currentFade && (cleverapps.timeouts.clearInterval(this.currentFade),
delete this.currentFade)
}
;
cleverapps.Audio.prototype.setVolume = function(a) {
this.volume = a;
cc.audioEngine.canChangeMusicVolume() && !this.muted && cleverapps.settings.music && !cc.game.isPaused() && (this.realVolume = a,
cc.audioEngine.setMusicVolume(a))
}
;
cleverapps.Audio.prototype.fadeOut = function(a) {
this.setVolume(1);
this.stopFade();
this.disk && this._fade(a, -1)
}
;
cleverapps.Audio.prototype.fadeIn = function(a) {
this.stopFade();
a ? (this.setVolume(0),
this.disk && this._fade(a, 1)) : this.setVolume(1)
}
;
cleverapps.Audio.prototype._fade = function(a, b) {
var c = (1E3 * a || 400) / 20
, d = 1 / c * b;
this.currentFade = cleverapps.timeouts.setInterval(function() {
this.setVolume(Math.max(0, Math.min(1, Math.floor(1E3 * (this.volume + d)) / 1E3)));
c--;
0 === c && (0 > b && this.eject(),
this.stopFade())
}
.bind(this), 20)
}
;
cleverapps.Audio.prototype.playSound = function(a, b) {
if (cleverapps.settings.sound && !cc.game.isPaused() && !this.muted && cleverapps.Audio.isAudioContextRunning() && (a && (a = a.resolve()),
a)) {
b = b || {};
this.logSound(a, b);
var c = this.cache[a.getUrl()];
b = void 0 !== b.throttle ? b.throttle : cleverapps.Audio.THROTTLE_AUDIO;
if (!(c && c.getPlaying() && c.startPlaying + b > Date.now())) {
(c = (cc.audioEngine._audioPool[a.getUrl()] || []).filter(function(d) {
return !d.getPlaying()
})[0]) && cc.audioEngine.stopEffect(c);
c = cc.loader.getRes(a.getUrl());
if (cc.sys.isWebViewAudio || c && (!c.isLoaded || c.isLoaded()))
return c = cc.audioEngine.playEffect(a.getUrl()),
c.startPlaying = Date.now(),
this.cache[a.getUrl()] = c;
a.isLazy() && cc.loader.load(a.getUrl())
}
}
}
;
cleverapps.Audio.prototype.stopSound = function(a) {
cc.audioEngine.stopEffect(a)
}
;
cleverapps.Audio.resumeAudioContext = function() {
var a = cc.Audio._context;
a && ("interrupted" === a.state ? a.resume() : "suspended" === a.state && (a.suspend(),
a.resume()))
}
;
cleverapps.Audio.isAudioContextRunning = function() {
if (connector.platform.oneOf(connector.WECHAT))
return !0;
var a = cc.Audio._context;
return a && "running" === a.state
}
;
cleverapps.Audio.THROTTLE_AUDIO = 250;
cleverapps.Audio.prototype.logSound = function(a, b) {
cleverapps.config.debugMode && cleverapps.keyboardController.isPressed(cc.KEY.s) && (console.log("--------------------- sound logging ----------------------"),
console.log("sound file", a.originalPath()),
b && console.log("sound", a.key, "options", b),
console.log("----------------------------------------------------------"))
}
;
cc.audioEngine.canChangeMusicVolume = function() {
return cc.audioEngine._currMusic && cc.audioEngine._currMusic.setVolume
}
;
cc.Audio.prototype.isLoaded = function() {
return !!this._element
}
;
cc.Audio.prototype.play = cleverapps.extendFunc(cc.Audio.prototype.play, function() {
this._super.apply(this, arguments);
cc.game.isPaused() && (cleverapps.throwAsync("Play audio error: game is paused - " + this.src),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.AUDIO_PLAY_PAUSED_GAME))
});
var WebViewAudioEngine = function() {
this._musicVolume = 1;
this._musicUrl = void 0;
this._audioPool = {};
this.batch = {};
this.sendBatch = cleverapps.accumulate(0, this._sendBatch.bind(this))
};
WebViewAudioEngine.prototype._pausePlaying = function() {}
;
WebViewAudioEngine.prototype._resumePlaying = function() {}
;
WebViewAudioEngine.prototype.setMusicVolume = function(a) {
a -= 0;
isNaN(a) && (a = 1);
1 < a && (a = 1);
0 > a && (a = 0);
this._musicVolume = a;
this.batch.setMusicVolume = {
action: "setMusicVolume",
volume: a
};
this.sendBatch()
}
;
WebViewAudioEngine.prototype._sendBatch = function() {
var a = Object.values(this.batch);
connector.platform.callNative("AudioPlugin.sendBatch", {
batch: a
});
this.batch = {}
}
;
WebViewAudioEngine.prototype.getMusicVolume = function() {
return this._musicVolume
}
;
WebViewAudioEngine.prototype.playMusic = function(a, b) {
a && (this._musicUrl = a,
this.batch.musicAction = {
action: "playMusic",
url: a,
loop: !!b
},
this.sendBatch())
}
;
WebViewAudioEngine.prototype.stopMusic = function() {
this._musicUrl = void 0;
this.batch.musicAction = {
action: "stopMusic"
};
this.sendBatch()
}
;
WebViewAudioEngine.prototype.stopEffect = function(a) {
a && a.url && (this.batch["effect_" + a.url] = {
action: "stopEffect",
url: a.url
},
this.sendBatch())
}
;
WebViewAudioEngine.prototype.stopAllEffects = function() {}
;
WebViewAudioEngine.prototype.playEffect = function(a, b) {
if (a)
return this.batch["effect_" + a] = {
action: "playEffect",
url: a,
loop: !!b
},
this.sendBatch(),
new WebViewAudio(a,b)
}
;
WebViewAudioEngine.prototype.canChangeMusicVolume = function() {
return !0
}
;
WebViewAudioEngine.IsApplicable = function() {
return (connector.platform.oneOf(connector.IOS, connector.MACOS) || connector.info.audioPluginAvailable && connector.platform.oneOf(connector.RUSTORE, connector.AMAZON, connector.ANDROID, connector.GPG, connector.PLIEGA)) && connector.info.isNative && !cc.sys.isNativeFlight && connector.info.isMobile
}
;
var WebViewAudio = function(a, b) {
this.url = a;
this.loop = b;
this.startPlaying = Date.now()
};
WebViewAudio.prototype.getPlaying = function() {
return Date.now() < this.startPlaying + cleverapps.parseInterval(WebViewAudio.FAKE_DURATION)
}
;
WebViewAudio.FAKE_DURATION = "1 second";
cleverapps.ABTest = function() {
this.groups = {};
cleverapps.country.on("ready", this.updateGroups.bind(this));
var a = bundles.abtest.jsons.abtest_json.getJson();
this.remoteJson = new RemoteJson(a);
this.remoteJson.on("update", this.updateGroups.bind(this))
}
;
cleverapps.ABTest.A = 0;
cleverapps.ABTest.B = 1;
cleverapps.ABTest.C = 2;
cleverapps.ABTest.D = 3;
cleverapps.ABTest.groupEventNames = {};
Object.keys(cleverapps.ABTest).forEach(function(a) {
var b = cleverapps.ABTest[a];
"number" === typeof b && (cleverapps.ABTest.groupEventNames[b] = a.toLowerCase())
});
cleverapps.ABTest.prototype.initialize = function(a) {
this.remoteJson.initialize(a)
}
;
cleverapps.ABTest.prototype.updateTests = function() {
var a = this.remoteJson.getJson();
cleverapps.ABTest.Tests = JSON.parse(JSON.stringify(a));
for (var b in cleverapps.ABTest.Tests)
"object" !== typeof cleverapps.ABTest.Tests[b] && delete cleverapps.ABTest.Tests[b];
cleverapps.ABTest.initializeTests()
}
;
cleverapps.ABTest.prototype.updateGroups = function() {
this.updateTests();
this.groups = {};
var a = cleverapps.dataLoader.load(DataLoader.TYPES.ABTEST) || {}, b;
for (b in cleverapps.ABTest.Tests) {
var c = cleverapps.ABTest.Tests[b];
cleverapps.user.checkAvailable(c.available) && (void 0 !== a[b] ? this.setGroup(c, a[b]) : this.setGroup(c, cleverapps.ABTest.calcGroup(c)))
}
}
;
cleverapps.ABTest.prototype.forceGroup = function(a, b) {
var c = cleverapps.dataLoader.load(DataLoader.TYPES.ABTEST) || {};
c[a.id] = b;
cleverapps.dataLoader.save(DataLoader.TYPES.ABTEST, c);
this.updateGroups()
}
;
cleverapps.ABTest.prototype.getGroup = function(a) {
if (a)
return this.groups[a.id]
}
;
cleverapps.ABTest.prototype.setGroup = function(a, b) {
this.groups[a.id] = b
}
;
cleverapps.ABTest.prototype.logEvent = function(a, b, c) {
var d = this.getGroup(a);
void 0 !== d && (d = cleverapps.ABTest.groupEventNames[d],
cleverapps.eventLogger.logEvent("ab_" + a.id + "_" + d + "_" + b, c))
}
;
cleverapps.ABTest.prototype.allLogEvent = function(a, b) {
b = b || {};
var c = cleverapps.travelBook.getCurrentExpedition();
c = b.expedition || c && c.id;
for (var d in this.groups) {
var e = cleverapps.ABTest.Tests[d];
if (!e.expeditions || -1 !== e.expeditions.indexOf(c)) {
var f = cleverapps.ABTest.groupEventNames[this.getGroup(e)];
cleverapps.eventLogger.logEvent("ab_" + e.id + "_" + f + "_" + a, b)
}
}
}
;
cleverapps.ABTest.TSEARCH = function() {
var a = cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.tsearch);
return void 0 === a ? !1 : "board" !== cleverapps.config.type || a === cleverapps.ABTest.A
}
;
cleverapps.ABTest.STICKERS_BOOK = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.stickers) === cleverapps.ABTest.A
}
;
cleverapps.ABTest.PRIZECAL = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.prizecal) === cleverapps.ABTest.A
}
;
cleverapps.ABTest.PINBALL = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.pinball) === cleverapps.ABTest.A
}
;
cleverapps.ABTest.MONEY_FOG1 = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.moneyFog1) === cleverapps.ABTest.A
}
;
cleverapps.ABTest.BF_MONEY_FOG1 = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.bfMoneyFog1) === cleverapps.ABTest.A
}
;
cleverapps.ABTest.WELCOME = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.welcome) === cleverapps.ABTest.A
}
;
cleverapps.ABTest.DISCORD_NOTIFICATIONS_ALL = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.dcnotifications) === cleverapps.ABTest.A
}
;
cleverapps.ABTest.DISCORD_NOTIFICATIONS_WELCOME = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.dcnotifications) === cleverapps.ABTest.B
}
;
cleverapps.ABTest.STAR_CHEST = function() {
return cleverapps.abTest.getGroup(cleverapps.ABTest.Tests.starchest) === cleverapps.ABTest.B
}
;
cleverapps.ABTest.ChangeConfigsForAB = function() {}
;
cleverapps.ABTest.calcGroup = function(a, b) {
if (cleverapps.isLocalhost())
return cleverapps.ABTest.A;
b = cleverapps.Random.seededDouble((b || connector.platform.getUserID()) + a.id);
return 2 < a.groups.length ? a.groups[Math.floor(b / (1 / a.groups.length))] : b > a.AWeight ? cleverapps.ABTest.B : cleverapps.ABTest.A
}
;
cleverapps.ABTest.initializeTests = function() {
for (var a in cleverapps.ABTest.Tests) {
var b = cleverapps.ABTest.Tests[a];
b.id = a;
b.groups = b.groups || [cleverapps.ABTest.A, cleverapps.ABTest.B];
b.AWeight = b.AWeight || .5
}
}
;
"undefined" === typeof cc && (cleverapps.ABTest.Tests = require("./abtest.json"),
cleverapps.ABTest.initializeTests(),
module.exports = cleverapps.ABTest);
var Alarm = function() {
this.on = !1;
this.alarms = {};
this.priority = 0;
this.onChangeListeners = {}
};
Alarm.prototype.isOn = function() {
return 0 < this.priority
}
;
Alarm.prototype.start = function(a, b) {
this.alarms[a] = b || 1;
this.onChange()
}
;
Alarm.prototype.stop = function(a) {
delete this.alarms[a];
this.onChange()
}
;
Alarm.prototype.clear = function() {
this.alarms = {};
this.onChange()
}
;
Alarm.prototype.onChange = function() {
var a = 0, b;
for (b in this.alarms)
this.alarms[b] > a && (a = this.alarms[b]);
if (a !== this.priority) {
this.priority = a;
for (var c in this.onChangeListeners)
this.onChangeListeners[c](a)
}
}
;
var Mission = function(a, b, c) {
this.started = void 0;
this.type = a;
this.state = Mission.STATE_RUNNING;
this.details = {};
this.result = 0;
this.needReview = !1;
this.onChangeResults = function() {}
;
Object.assign(this, Missions[this.type]);
this.isMinigameMission() && (this.currency = this.getStartCurrency());
this.type === Mission.TYPE_LANTERN && (this.result = 1);
(a = !b) ? (this.started = Date.now(),
this.needShowStartWindow = !0,
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MISSION_START + "_" + this.type)) : this.load(b);
this.oncePerEvent && (this.eventFinishTime = (b = cleverapps.eventManager.getFeatureEvent(this.feature)) ? b.finish.getTime() : Date.now());
this.startCompetition(a || c);
this.logic && (this.logic = new this.logic(this,a));
this.onUpdateState()
};
Mission.STATE_RUNNING = 0;
Mission.STATE_COMPLETED = 1;
Mission.prototype.displayCompleted = function(a) {
cleverapps.focusManager.compound(a, [function(b) {
this.wasDisplayedCompleted = !0;
this.finishWindow ? (new this.finishWindow(this),
cleverapps.focusManager.onceNoWindowsListener = b) : b()
}
.bind(this), function(b) {
this.logic && this.logic.blowUp ? this.logic.blowUp(b) : b()
}
.bind(this), function(b) {
!this.lastChanceUsed && this.hasLastChance() ? (this.lastChanceUsed = !0,
new this.lastChanceView(this),
cleverapps.focusManager.onceNoWindowsListener = b) : b()
}
.bind(this), function(b) {
for (var c = this.runningCompetition && 3 > this.place, d = this.receiveReward(), e = !1; d; )
RewardWindow.createMissionWindow(d, this, {
shareId: c && "tournament"
}),
e = !0,
d = this.receiveReward();
if (this.canRemove() || this.manualFinish)
this.logic && this.logic.beforeRemove && this.logic.beforeRemove(),
cleverapps.missionManager.remove(this, !1);
e ? cleverapps.focusManager.onceNoWindowsListener = b : b()
}
.bind(this)])
}
;
Mission.prototype.onUpdateState = function() {
this.countdown && (this.countdown.remove(),
delete this.countdown);
if (this.isRunning()) {
var a = this.getTimeLeft();
0 < a && (this.countdown = new cleverapps.CountDown(a,{
onFinish: this.onUpdateState.bind(this),
permanent: !0
}))
} else
this.complete(),
this.runningCompetition && this.runningCompetition.stop(),
this.logic && this.logic.stop && this.logic.stop();
this.updateMissionIcon()
}
;
Mission.prototype.setNeedReview = function(a) {
this.needReview = a;
this.updateMissionIcon()
}
;
Mission.prototype.updateMissionIcon = function() {
var a = cleverapps.sideBar.findMissionIcon(this.type);
a && a.resetState()
}
;
Mission.prototype.userInfoChanged = function() {
this.runningCompetition.onUserInfoChanged();
cleverapps.missionManager.table.resetResults(this.type);
this.resultsChanged()
}
;
Mission.prototype.resultsChanged = function() {
this.onChangeResults();
if (this.logic && this.logic.onChangeResults)
this.logic.onChangeResults()
}
;
Mission.prototype.beforeRemove = function() {
this.countdown && (this.countdown.remove(),
delete this.countdown);
this.runningCompetition && this.runningCompetition.stop();
this.logic && this.logic.stop && this.logic.stop(!0);
this.playerInfoListener && (this.playerInfoListener.clear(),
delete this.playerInfoListener);
this.removeChildMissions()
}
;
Mission.prototype.load = function(a) {
this.started = a.started;
this.result = a.result;
this.details = a.details;
this.currency = a.currency
}
;
Mission.prototype.update = function(a, b, c) {
this.isRunning() || (b = a = void 0);
this.increaseResult(a, b, c)
}
;
Mission.prototype.increaseResult = function(a, b, c) {
if (a || b)
this.result += a,
b && (this.details = b),
cleverapps.user.incProgressCompare();
this.runningCompetition && a && this.runningCompetition.updatePlayerResult(connector.platform.getUserID(), this.result);
cleverapps.missionManager.save();
if (!c)
this.onUpdateMission(a)
}
;
Mission.prototype.onUpdateMission = function(a) {
this.onUpdateState();
this.onChangeResults();
if (this.logic && this.logic.onUpdateMission)
this.logic.onUpdateMission(a)
}
;
Mission.prototype.canRemoveSilently = function() {
return this.logic ? this.logic.canRemoveSilently ? this.logic.canRemoveSilently() : !1 : 0 === this.result ? !0 : "?" === this.getSummary().place
}
;
Mission.prototype.canRemove = function() {
return this.manualFinish ? !1 : this.logic && this.logic.canRemove ? this.logic.canRemove() : this.rewardsReceived
}
;
Mission.prototype.hasLastChance = function() {
return this.lastChanceView && (this.canRemove() || this.manualFinish) ? this.logic && this.logic.hasLastChance ? this.logic.hasLastChance() : !1 : !1
}
;
Mission.prototype.receiveReward = function() {
if (this.logic && this.logic.receiveReward)
return this.logic.receiveReward();
if (!this.rewardsReceived) {
var a = this.getPrize();
if (a && a.unit && !this.mainWorldReward) {
var b = cleverapps.toArray(a.unit).length - Map2d.currentMap.countEmptySlots();
if (0 < b) {
cleverapps.centerHint.createTextHint("Spawn.nospace", {
left: b
});
return
}
}
this.rewardsReceived = !0;
b = a ? "_prize" : "_lost";
this.runningCompetition && 0 === this.place && (b = "_first");
var c = cleverapps.EVENTS.MISSION_FINISH;
cleverapps.travelBook.isExpedition() && (c += "_" + cleverapps.travelBook.getCurrentPage().id);
cleverapps.eventLogger.logEvent(c + b);
cleverapps.eventLogger.logEvent(c + "_" + this.type + b);
this.logic && this.logic.getResult && (cleverapps.eventLogger.logEvent(c + "_" + this.type + "_result", {
value: this.logic.getResult()
}),
cleverapps.eventLogger.logEvent(c + "_" + this.type));
return a
}
}
;
Mission.prototype.skipNext = function() {
return this.logic && this.logic.skipNext && this.logic.skipNext()
}
;
Mission.prototype.useMissionIntent = function(a) {
var b = this.getViewClass();
cleverapps.scenes.replaceScene(new b(this), a)
}
;
Mission.prototype.updateCurrency = function(a, b) {
0 !== a && void 0 !== this.currency && (this.currency += a,
b && (this.details = b),
this.onUpdateState(),
cleverapps.missionManager.save())
}
;
Mission.prototype.getSummary = function() {
return this.runningCompetition ? {
place: this.runningCompetition.calcPlace(),
points: this.runningCompetition.player.amount
} : {
place: "?",
points: this.result
}
}
;
Mission.prototype.getResults = function() {
if (!this.runningCompetition)
return [];
var a = this.runningCompetition.getResults().map(function(b) {
return {
id: b.id,
player: b.player,
text: b.name,
avatar: {
id: b.id,
avatar: b.avatar
},
amount: b.amount
}
});
a.sort(function(b, c) {
return b.amount === c.amount && (b.player || c.player) ? b.player ? -1 : 1 : c.amount - b.amount
});
a.forEach(function(b, c) {
b.place = c + 1
});
return a
}
;
Mission.prototype.save = function() {
this.logic && this.logic.save && this.logic.save(this.details);
return {
started: this.started,
type: this.type,
result: this.result,
currency: this.currency,
details: this.details,
semaphore: this.semaphore
}
}
;
Mission.prototype.getName = function() {
return this.name
}
;
Mission.prototype.getWindowBundleName = function() {
return this.bundle
}
;
Mission.prototype.isMinigameMission = function() {
return void 0 !== this.minigame
}
;
Mission.prototype.isPassMission = function() {
return this.logic && this.logic instanceof PassMissionLogic
}
;
Mission.prototype.isExpedition = function() {
return this.logic && this.logic instanceof ExpeditionMissionLogic
}
;
Mission.prototype.isSlotMachineMission = function() {
return this.logic && "undefined" !== typeof SlotMachineMissionLogic && this.logic instanceof SlotMachineMissionLogic
}
;
Mission.prototype.isTreasureSearchMission = function() {
return this.logic && "undefined" !== typeof TreasureSearchMissionLogic && this.logic instanceof TreasureSearchMissionLogic
}
;
Mission.prototype.isCompetitionMission = function() {
return void 0 !== this.competition
}
;
Mission.prototype.isPinballMission = function() {
return this.logic && "undefined" !== typeof PinballMissionLogic && this.logic instanceof PinballMissionLogic
}
;
Mission.prototype.getViewClass = function() {
return this.view
}
;
Mission.prototype.complete = function() {
if (this.state === Mission.STATE_RUNNING) {
this.state = Mission.STATE_COMPLETED;
if (this.logic && this.logic.onComplete)
this.logic.onComplete();
cleverapps.missionManager.refreshOffer(this)
}
}
;
Mission.prototype.getIcon = function() {
return Mission.getCollectIcon(this.type)
}
;
Mission.prototype.finishTime = function() {
if (this.feature) {
if (this.oncePerEvent)
return this.eventFinishTime;
var a = cleverapps.eventManager.getFeatureEvent(this.feature) || cleverapps.eventManager.getLastFeatureEvent(this.feature);
return a ? a.finish.getTime() : 0
}
return this.manualFinish ? 0 : this.started + cleverapps.parseInterval(this.duration)
}
;
Mission.prototype.getTimeLeft = function() {
return Math.max(0, this.finishTime() - Date.now())
}
;
Mission.prototype.isRunning = function() {
return this.state === Mission.STATE_RUNNING && (this.manualFinish || 0 < this.getTimeLeft()) ? !0 : !1
}
;
Mission.prototype.isCompleted = function() {
return this.state === Mission.STATE_COMPLETED
}
;
Mission.prototype.canPlayMinigame = function() {
return this.isMinigameMission() && this.currency && this.currency >= this.getMinigamePrice()
}
;
Mission.prototype.getMinigamePrice = function() {
return this.minigame.price
}
;
Mission.prototype.isMinigameReadyToFinish = function() {
return this.isMinigameMission() && this.logic && this.logic.isMinigameReadyToFinish && this.logic.isMinigameReadyToFinish()
}
;
Mission.prototype.isMissionReadyToFinish = function() {
return this.isMinigameReadyToFinish() || this.logic && this.logic.isReadyToFinish && this.logic.isReadyToFinish()
}
;
Mission.prototype.openNudgeWindows = function(a) {
this.nudgeWindow ? (new this.nudgeWindow(this),
cleverapps.focusManager.onceNoWindowsListener = a) : a()
}
;
Mission.prototype.getStartCurrency = function() {
return void 0 !== this.startCurrency ? this.startCurrency : this.getMinigamePrice()
}
;
Mission.prototype.getMinigameClass = function() {
return this.minigame.className
}
;
Mission.prototype.getChildMissionTypes = function() {
return (this.childMissions || []).map(function(a) {
return Mission.CompoundType(void 0 !== a.type ? a.type : a, this.type)
}, this)
}
;
Mission.prototype.getChildMissions = function() {
return this.getChildMissionTypes().map(function(a) {
return cleverapps.missionManager.findByType(a)
}).filter(function(a) {
return a
})
}
;
Mission.prototype.removeChildMissions = function() {
this.getChildMissions().forEach(function(a) {
cleverapps.missionManager.remove(a)
})
}
;
Mission.prototype.getLevelReward = function(a) {
return this.logic && this.logic.getLevelReward ? this.logic.getLevelReward(a) : 1
}
;
Mission.prototype.getPrize = function() {
if (this.logic && this.logic.getPrize)
return this.logic.getPrize();
if (this.prize) {
if (this.minigame)
return this.logic.isFinished() ? this.prize : void 0;
this.place = this.getSummary().place;
if (this.place < this.prize.length)
return this.getPrizeByPlace(this.place)
}
}
;
Mission.prototype.getPrizeByPlace = function(a) {
return "merge" !== cleverapps.config.type ? cleverapps.user.prepareRewardByRich(this.prize[a]) : this.prize[a]
}
;
Mission.prototype.updateCompetitionResults = function() {
this.runningCompetition && this.runningCompetition.updatePlayerResult(connector.platform.getUserID(), this.result)
}
;
Mission.prototype.startCompetition = function(a) {
this.isCompetitionMission() && (a && Competition.CLEAN_SAVED(this.type),
a = Competition.optionsByMission(this),
this.runningCompetition = new Competition(a),
this.runningCompetition.onChangeResultsListeners.mission = this.resultsChanged.bind(this),
this.runningCompetition.onChangePlaceListener = this.updateMissionIcon.bind(this),
this.playerInfoListener = connector.player.on("changed", this.userInfoChanged.bind(this)),
this.runningCompetition.start())
}
;
Mission.prototype.getCollectRewardSound = function() {
return this.logic && this.logic.getCollectRewardSound && this.logic.getCollectRewardSound()
}
;
Mission.prototype.isAvailable = function() {
return this.logic && this.logic.isAvailable ? this.logic.isAvailable() : !0
}
;
Mission.ParseCompoundType = function(a) {
a = String(a).split("_");
return {
type: cleverapps.castType(a[0]),
parentType: cleverapps.castType(a[1])
}
}
;
Mission.GetParentType = function(a) {
return Mission.ParseCompoundType(a).parentType
}
;
Mission.GetChildType = function(a) {
return Mission.ParseCompoundType(a).type
}
;
Mission.CompoundType = function(a, b) {
a = Mission.GetChildType(a);
return void 0 !== b ? a + "_" + b : a
}
;
Mission.ParseTypeVersion = function(a) {
a = Mission.ParseCompoundType(a);
return String(a.type).split("v")[1] || 0
}
;
Mission.VersionType = function(a, b) {
a = Mission.ParseCompoundType(a);
a.type = cleverapps.castType(String(a.type).split("v")[0]);
0 < b && (a.type += "v" + b);
return Mission.CompoundType(a.type, a.parentType)
}
;
Mission.getCollectIcon = function(a) {
return cleverapps.skins.getSlot("missionIcon", {
type: a
})
}
;
Mission.logEvent = function(a, b, c) {
c = c || {};
var d = void 0 === c.index ? "" : c.index
, e = {};
void 0 !== c.value && (e.value = c.value);
cleverapps.eventLogger.logEvent(b.toLowerCase() + a + d, e)
}
;
"undefined" === typeof cc && (module.exports = {
Mission: Mission
});
Mission.TYPE_RAINBOW = 0;
Mission.TYPE_COLLECT_MARK = 1;
Mission.TYPE_BURN_NEARBY = 2;
Mission.TYPE_LANTERN = 9;
Mission.TYPE_LEVELPASS = 15;
Mission.TYPE_BUILDPASS = 15;
Mission.TYPE_BONUS_WORLD = 19;
Mission.TYPE_LIVESFEAST = 20;
Mission.TYPE_SLOT_MACHINE = 21;
Mission.TYPE_SOFTFEAST = 22;
Mission.TYPE_BOOSTTIME = 23;
Mission.TYPE_CHESTTIME = 24;
Mission.TYPE_SALEPASS = 25;
Mission.TYPE_KRAKENFEAST = 26;
Mission.TYPE_SLOT2_PASS = 28;
Mission.TYPE_SLOT1_FEAST = 30;
Mission.TYPE_DRAGONIA_EXPEDITION = "32v1";
Mission.TYPE_SLOT2_FEAST = 33;
Mission.TYPE_SLOT1_PASS = 34;
Mission.TYPE_UNDERSEA_EXPEDITION = "40v1";
Mission.TYPE_CARAVAN = 42;
Mission.TYPE_EXPEDITION_PASS = 44;
Mission.TYPE_EXPEDITION_FEAST = 45;
Mission.TYPE_UNDERSEA2_EXPEDITION = "46v1";
Mission.TYPE_SNAIL_FEAST = 47;
Mission.TYPE_RAPUNZEL_EXPEDITION = 48;
Mission.TYPE_DRAGONIA2_EXPEDITION = 49;
Mission.TYPE_RAPUNZEL2_EXPEDITION = 52;
Mission.TYPE_EASTER_EXPEDITION = "55v1";
Mission.TYPE_ADVENTURE_EXPEDITION = 58;
Mission.TYPE_DRAGONIA3_EXPEDITION = 59;
Mission.TYPE_HALLOWEEN_EXPEDITION = "60v1";
Mission.TYPE_RAPUNZEL3_EXPEDITION = 62;
Mission.TYPE_XMAS_EXPEDITION = "61v1";
Mission.TYPE_CHINA_EXPEDITION = 63;
Mission.TYPE_COLLECTIONS_PASS = 66;
Mission.TYPE_PINBALL = 67;
Mission.TYPE_UNDERSEA3_EXPEDITION = 68;
Mission.TYPE_ADVENTURE2_EXPEDITION = 69;
Mission.TYPE_OCTOPUS_HUNT = 70;
Mission.TYPE_BLACKFRIDAY_EXPEDITION = 71;
Mission.OLD_VERSIONS = {};
Object.keys(Mission).forEach(function(a) {
if (0 === a.indexOf("TYPE_") && (a = Mission[a],
String(a).match(/^(\d+)v(\d+)$/)))
for (var b = Mission.ParseTypeVersion(a) - 1; 0 <= b; --b)
Mission.OLD_VERSIONS[Mission.VersionType(a, b)] = a
});
Mission.OBSOLETE_TYPES = [4, 5, 6, 8, 11, 12, 13, 14, 16, 17, 27, 29, 35, 36, 37, 38, 39, 41, 43, 51, 56, 50, 53, 54];
var Missions = {
FEATURES: {},
SEMAPHORE_ALWAYS: 0,
SEMAPHORE_PRIMARY: 1,
SEMAPHORE_SECONDARY: 2,
SEMAPHORE_CUSTOM_LANTERN: 4,
SEMAPHORE_CUSTOM_PIGGY_BANK: 8,
SEMAPHORE_CUSTOM_SALE: 16,
SEMAPHORE_CUSTOM_PRIZE_CALENDAR: 32,
SEMAPHORE_CUSTOM_EXPEDITION_SLOT1: 64,
SEMAPHORE_CUSTOM_EXPEDITION_SLOT2: 128,
SEMAPHORE_CUSTOM_EXPEDITION_SLOT4: 256,
SEMAPHORE_COOLDOWNS: {}
};
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_PRIMARY] = "1 hour";
"board" === cleverapps.config.type && (Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_PRIMARY] = "2 day");
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_SECONDARY] = "2 day";
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_CUSTOM_LANTERN] = "5 day";
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_CUSTOM_PIGGY_BANK] = "2 day";
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_CUSTOM_PRIZE_CALENDAR] = "3 day";
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT1] = "0";
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT2] = "0";
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT4] = "0";
Missions.SEMAPHORE_COOLDOWNS[Missions.SEMAPHORE_CUSTOM_SALE] = "14 day";
Missions.initialize = function() {
var a = {
available: {
level: 3.45
},
view: MissionWindow,
duration: "1 day",
prize: RewardsConfig.Tournament.places,
teaser: !0
};
"match3" === cleverapps.config.type && (Missions[Mission.TYPE_RAINBOW] = Object.assign({}, a, {
available: {
level: 4.93
},
name: "MagicTournament",
collectIcon: bundles.tournament_icon.frames.clover_png,
semaphore: Missions.SEMAPHORE_SECONDARY,
competition: {
step: [1, 2],
amount: [20, 30]
},
bundle: "magic_tournament",
sideBarJson: bundles.sidebar.jsons.tournament_magic_icon_json,
finishWindow: MissionWindow,
startWindow: {
name: "MagicTournamentGuideWindow",
bundle: bundles.magictournamentguidewindow
}
}),
Missions[Mission.TYPE_COLLECT_MARK] = Object.assign({}, a, {
available: {
level: 3.6
},
name: "RoseTournament",
collectIcon: bundles.tournament_icon.frames.rose_png,
semaphore: Missions.SEMAPHORE_SECONDARY,
competition: {
step: [10, 40],
amount: [20, 30]
},
bundle: "rose_tournament",
sideBarJson: bundles.sidebar.jsons.tournament_rose_icon_json,
finishWindow: MissionWindow,
startWindow: {
name: "RoseTournamentGuideWindow",
bundle: bundles.rosetournamentguidewindow
}
}),
Missions[Mission.TYPE_BURN_NEARBY] = Object.assign({}, a, {
available: {
level: 4.4
},
name: "TulpanTournament",
collectIcon: bundles.tournament_icon.frames.tulpan_png,
semaphore: Missions.SEMAPHORE_SECONDARY,
competition: {
step: [3, 6],
amount: [20, 30]
},
bundle: "tulpan_tournament",
sideBarJson: bundles.sidebar.jsons.tournament_tulpan_icon_json,
finishWindow: MissionWindow,
startWindow: {
name: "TulpanTournamentGuideWindow",
bundle: bundles.tulpantournamentguidewindow
}
}));
var b = cleverapps.config.features || [];
Object.values(Missions.FEATURES).forEach(function(c) {
c()
});
"undefined" !== typeof LanternWindow && (Missions[Mission.TYPE_LANTERN] = Object.assign({}, a, {
available: {
level: 8.26
},
name: "Lantern",
view: LanternWindow,
duration: "2 day",
semaphore: Missions.SEMAPHORE_CUSTOM_LANTERN,
startWindow: LanternWindow,
sideBarJson: bundles.sidebar.jsons.lantern_icon_json,
iconForce: Forces.LANTERN,
logic: LanternMissionLogic,
prize: void 0
}));
b.includes("bonus_world") && (Missions[Mission.TYPE_BONUS_WORLD] = Object.assign({}, a, {
name: "BonusWorld",
startWindow: BonusWorldWindow,
view: BonusWorldScene,
semaphore: Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT1,
available: {
level: 4.13
},
logic: BonusWorldMissionLogic,
sideBarJson: BonusWorldConfig.xmas.sideBarJson,
feature: "bonusworld",
oncePerEvent: !cleverapps.config.debugMode,
iconForce: Forces.BONUS_WORLD
}));
"merge" === cleverapps.config.type && (Missions[Mission.TYPE_LIVESFEAST] = Object.assign({}, a, {
available: {
level: 5
},
name: "LivesFeast",
duration: "3 day",
semaphore: Missions.SEMAPHORE_PRIMARY,
competition: {
step: [3, 3, 3, 5, 5, 5, 10, 10, 15, 20, 25],
forceCoef: .45,
amount: [20, 30],
noPlayerEpisodeCoef: !0,
botAheadPlayerCoef: .5,
botAheadPlayerBigDifferenceCoef: .2,
bigDistanceLength: 100
},
logic: LivesFeast,
prize: RewardsConfig.LivesFeast.places,
bundle: "lives_feast",
collectIcon: function() {
return cleverapps.skins.getSlot("reward_energy_png") || bundles.reward_icons.frames.reward_energy_png
},
sideBarJson: bundles.sidebar.jsons.lives_feast_icon_json,
view: LivesFeastMissionWindow,
startWindow: LivesFeastMissionWindow,
finishWindow: LivesFeastMissionWindow
}),
Missions[Mission.TYPE_BUILDPASS] = Object.assign({}, a, {
name: "BuildPass",
view: BuildPassWindow,
semaphore: Missions.SEMAPHORE_PRIMARY,
startWindow: BuildPassWindow,
finishWindow: BuildPassWindow,
rulesOptions: PassRulesOptions,
logic: PassMissionLogic,
sideBarJson: bundles.sidebar.jsons.buildpass_icon_json,
lastChanceView: PassLastChanceWindow,
collectIcon: bundles.reward_icons_pass.frames.pass_star_png,
collectItemName: "star",
duration: "3 days",
cooldown: "28 days",
available: {
level: 5
}
}),
Missions[Mission.TYPE_SALEPASS] = Object.assign({}, a, {
name: "SalePass",
view: SalePassWindow,
semaphore: Missions.SEMAPHORE_PRIMARY,
startWindow: SalePassWindow,
finishWindow: SalePassWindow,
rulesOptions: SalePassRulesOptions,
logic: PassMissionLogic,
sideBarJson: bundles.sidebar.jsons.salepass_icon_json,
lastChanceView: PassLastChanceWindow,
collectIcon: bundles.reward_icons_pass.frames.pass_coin_png,
collectItemName: "crystal",
duration: "3 days",
cooldown: "28 days",
tutorial: MergeTutorials.salepass,
available: {
level: 5
}
}),
Missions[Mission.TYPE_CHESTTIME] = Object.assign({}, a, {
available: {
level: 9.5
},
logic: ChestTime,
name: "ChestTime",
duration: "1 day",
semaphore: Missions.SEMAPHORE_SECONDARY,
bundle: "chesttime",
sideBarJson: bundles.sidebar.jsons.chesttime_icon_json,
view: ChestTimeMissionWindow,
startWindow: ChestTimeMissionWindow,
finishWindow: ChestTimeMissionWindow
}),
Missions[Mission.TYPE_SOFTFEAST] = Object.assign({}, a, {
available: {
level: 5
},
name: "SoftFeast",
duration: "3 day",
semaphore: Missions.SEMAPHORE_PRIMARY,
competition: {
step: [5, 5, 15, 18, 25, 30, 35, 50, 65],
forceCoef: .1,
amount: [20, 30],
noPlayerEpisodeCoef: !0,
botAheadPlayerCoef: .5,
botAheadPlayerBigDifferenceCoef: .2,
bigDistanceLength: 500
},
logic: SoftFeast,
prize: RewardsConfig.SoftFeast.places,
bundle: "lives_feast",
collectIcon: bundles.reward_icons.frames.reward_coin_png,
sideBarJson: bundles.sidebar.jsons.soft_feast_icon_json,
view: SoftFeastMissionWindow,
startWindow: SoftFeastMissionWindow,
finishWindow: SoftFeastMissionWindow
}),
Missions[Mission.TYPE_KRAKENFEAST] = Object.assign({}, a, {
available: {
level: 5
},
name: "KrakenFeast",
duration: "3 day",
semaphore: Missions.SEMAPHORE_PRIMARY,
competition: {
step: [5, 5, 5, 5, 5, 10, 10, 10, 10, 15, 15, 20, 20, 25, 30],
forceCoef: .2,
amount: [20, 30],
noPlayerEpisodeCoef: !0,
botAheadPlayerCoef: .5,
botAheadPlayerBigDifferenceCoef: .2,
bigDistanceLength: 90
},
logic: KrakenFeast,
prize: RewardsConfig.KrakenFeast.places,
bundle: "lives_feast",
collectIcon: bundles.reward_icons.frames.tentacle_png,
sideBarJson: bundles.sidebar.jsons.kraken_feast_icon_json,
view: KrakenFeastMissionWindow,
startWindow: KrakenFeastMissionWindow,
finishWindow: KrakenFeastMissionWindow
}),
Missions[Mission.TYPE_BOOSTTIME] = Object.assign({}, a, {
available: {
level: 9.5
},
name: "BoostTime",
duration: "1 day",
semaphore: Missions.SEMAPHORE_SECONDARY,
bundle: "boosttime",
sideBarJson: bundles.sidebar.jsons.boosttime_icon_json,
view: BoostTimeMissionWindow,
startWindow: BoostTimeMissionWindow,
finishWindow: BoostTimeMissionWindow
}),
Missions[Mission.TYPE_CARAVAN] = Object.assign({}, a, {
available: {
level: 8
},
logic: Caravan,
name: "Caravan",
ship: "caravanship",
duration: "3 day",
semaphore: Missions.SEMAPHORE_SECONDARY,
bundle: "unitssale",
startWindow: CaravanMissionWindow,
view: CaravanMissionWindow,
finishWindow: CaravanMissionWindow,
sideBarJson: bundles.sidebar.jsons.caravan_icon_json
}),
Missions[Mission.TYPE_EXPEDITION_PASS] = {
name: "ExpeditionPass",
view: ExpeditionPassWindow,
startWindow: ExpeditionPassWindow,
finishWindow: ExpeditionPassWindow,
rulesOptions: ExpeditionPassRulesOptions,
sideBarJson: function() {
return cleverapps.skins.getSlot("expedition_buildpass_icon_json")
},
logic: PassMissionLogic,
sideBarSlotName: "expeditionBuildPassSideBarIcon",
lastChanceView: PassLastChanceWindow,
collectIcon: bundles.reward_icons_pass.frames.pass_star_png,
collectItemName: "star",
manualStart: ManualStarters.MissionTreeStarter,
manualFinish: !0,
mainWorldReward: !0
},
Missions[Mission.TYPE_COLLECTIONS_PASS] = {
name: "CollectionsPass",
view: ExpeditionPassWindow,
startWindow: ExpeditionPassWindow,
finishWindow: ExpeditionPassWindow,
sideBarJson: function() {
return cleverapps.skins.getSlot("expedition_buildpass_icon_json")
},
logic: PassMissionLogic,
sideBarSlotName: "expeditionBuildPassSideBarIcon",
lastChanceView: PassLastChanceWindow,
collectIcon: bundles.reward_icons_pass.frames.pass_star_png,
collectItemName: "star",
duration: "10 days",
cooldown: "7 days",
manualStart: ManualStarters.clPassStarter,
expedition: "collections",
available: {
gameLevel: 9
}
},
Missions[Mission.TYPE_EXPEDITION_FEAST] = {
name: "ExpeditionFeast",
view: ExpeditionFeastWindow,
startWindow: ExpeditionFeastWindow,
finishWindow: ExpeditionFeastWindow,
manualStart: ManualStarters.ExpeditionFeastStarter,
logic: FeastExpeditionLogic,
duration: "1 hour",
bundle: "lives_feast",
prize: RewardsConfig.ExpeditionFeast.places,
mainWorldReward: !0,
sideBarJson: function() {
return cleverapps.skins.getSlot("expedition_feast_icon_json") || bundles.sidebar.jsons.expedition_feast_icon_json
},
collectIcon: function() {
return cleverapps.skins.getSlot("expedition_feast_icon") || bundles.reward_icons.frames.expedition_feast_icon
},
sideBarSlotName: "expeditionFeastSideBarIcon",
competition: {
step: [2, 2, 2, 3, 3, 3, 5, 5, 5, 10, 10, 12, 12, 15],
forceCoef: 2,
amount: [20, 30],
noPlayerEpisodeCoef: !0,
botAheadPlayerCoef: .5,
offlineCoef: .8,
botAheadPlayerBigDifferenceCoef: .3,
bigDistanceLength: 50
}
},
Missions[Mission.TYPE_SNAIL_FEAST] = {
name: "SnailFeast",
view: SnailFeastWindow,
startWindow: SnailFeastWindow,
finishWindow: SnailFeastWindow,
manualStart: ManualStarters.SnailFeastStarter,
logic: FeastExpeditionLogic,
duration: "6 hour",
bundle: "snail_feast",
prize: RewardsConfig.SnailFeast.places,
mainWorldReward: !0,
sideBarJson: function() {
return cleverapps.skins.getSlot("snail_feast_icon_json") || bundles.sidebar.jsons.snail_feast_icon_json
},
collectIcon: function() {
return cleverapps.skins.getSlot("snail_feast_icon") || bundles.reward_icons.frames.snail_feast_icon
},
sideBarSlotName: "expeditionFeastSideBarIcon",
competition: {
step: [3, 3, 3, 3, 10, 10, 10, 65, 65],
forceCoef: .45,
amount: 5,
noPlayerEpisodeCoef: !0,
botAheadPlayerCoef: .3,
offlineCoef: .8,
botAheadPlayerBigDifferenceCoef: .1,
bigDistanceLength: 50
}
},
TravelBook.INIT_EXPEDITIONS());
"undefined" !== typeof SlotMachineScene && (Missions[Mission.TYPE_SLOT_MACHINE] = Object.assign({}, a, {
name: "SlotMachine",
startWindow: void 0,
view: SlotMachineScene,
semaphore: Missions.SEMAPHORE_PRIMARY,
available: {
level: 3.85
},
logic: SlotMachineMissionLogic,
sideBarJson: bundles.sidebar.jsons.slot_machine_json,
duration: "3 days",
iconForce: Forces.SLOT_MACHINE_ICON
}));
b.includes("pinball") && (Missions[Mission.TYPE_PINBALL] = Object.assign({}, a, {
name: "Pinball",
startWindow: void 0,
abTest: cleverapps.ABTest.PINBALL,
view: PinballScene,
semaphore: Missions.SEMAPHORE_PRIMARY,
available: {
level: 3.85
},
logic: PinballMissionLogic,
sideBarJson: bundles.sidebar.jsons.pinball_json,
duration: "3 days",
iconForce: Forces.PINBALL_ICON,
collectIcon: bundles.reward_icons.frames.pinball_token_png,
minigame: {
price: 1
},
prize: void 0
}));
b.includes("octopus_hunt") && (Missions[Mission.TYPE_OCTOPUS_HUNT] = Object.assign({}, a, {
name: "OctopusHunt",
startWindow: {
name: "OctopusHuntGuideWindow",
bundle: bundles.octopus_hunt_guide
},
nudgeScene: OctopusHuntScene,
view: OctopusHuntScene,
semaphore: Missions.SEMAPHORE_PRIMARY,
logic: OctopusHuntMissionLogic,
sideBarJson: bundles.sidebar.jsons.barrels_hunt_png,
duration: "3 days",
available: {
debug: !0
},
prize: void 0
}));
"match3" === cleverapps.config.type && (Missions[Mission.TYPE_LEVELPASS] = Object.assign({}, a, {
priority: 4,
name: "LevelPass",
view: LevelPassWindow,
semaphore: Missions.SEMAPHORE_PRIMARY,
iconForce: Forces.LEVELPASS,
startWindow: LevelPassWindow,
finishWindow: LevelPassWindow,
rulesOptions: {
name: "PassRulesWindow",
bundle: bundles.passruleswindow
},
logic: PassMissionLogic,
sideBarJson: bundles.sidebar.jsons.levelpass_icon_json,
sideBarProgressIconJson: bundles.sidebar.jsons.levelpass_star_json,
lastChanceView: PassLastChanceWindow,
collectItemName: "star",
duration: "7 days",
available: {
level: 14
}
}));
Missions.afterInitialize()
}
;
Missions.checkIllegal = function(a) {
return void 0 === a || a.includes && a.includes("undefined")
}
;
Missions.afterInitialize = function() {
var a = Object.keys(Missions).filter(function(b) {
return "object" === typeof Missions[b] && Missions[b] !== Missions.FEATURES
});
a.forEach(function(b) {
b = cleverapps.castType(b);
var c = Missions[b];
c.type = b;
(c.childMissions || []).forEach(function(d) {
var e = void 0 !== d.type ? d.type : d
, f = Mission.CompoundType(e, b)
, g = {
type: f,
parentType: b,
implementations: void 0
};
d.startFog && (g.manualStart = ManualStarters.FogStarter,
g.startFog = d.startFog);
d.startUnit && (g.manualStart = ManualStarters.UnitStarter,
g.startUnit = d.startUnit);
void 0 !== d.rulesOptions && (g.rulesOptions = d.rulesOptions);
Missions[f] = Object.assign({}, Missions[e], g);
Missions[e].implementations || (Missions[e].implementations = []);
Missions[e].implementations.push(f)
})
});
a.forEach(function(b, c) {
Missions.checkIllegal(b) && cleverapps.throwAsync("Undefined mission type " + b + " ind: " + c)
});
Object.keys(PassLevelsConfig).forEach(function(b, c) {
Missions.checkIllegal(b) && cleverapps.throwAsync("Undefined pass config type " + b + " ind: " + c)
})
}
;
"undefined" === typeof cc && (module.exports = {
Missions: Missions,
Mission: Mission
});
var MissionManager = function() {
this.missions = [];
this.teaser = void 0;
this.unknownMissionsData = [];
this.oldMissions = [];
this.lastRemoved = {};
this.table = new cleverapps.Table;
this.semaphoresOnHold = 0
};
MissionManager.REGISTER_MISSION = function(a, b) {
Missions.initialize = cleverapps.extendFunc(Missions.initialize, function() {
this._super();
Missions[a] = b
});
MissionManager.prototype._getExistingTypes = cleverapps.extendFunc(MissionManager.prototype._getExistingTypes, function() {
return this._super().concat(a)
})
}
;
MissionManager.prototype.isObsoleteMissionType = function(a) {
var b = Mission.GetParentType(a);
return void 0 !== b && this.isObsoleteMissionType(b) ? !0 : -1 !== Mission.OBSOLETE_TYPES.indexOf(Mission.GetChildType(a))
}
;
MissionManager.prototype.isPastEventMission = function(a, b) {
return (a = (a = Missions[a].feature) && cleverapps.eventManager.getFeatureEvent(a)) && a.isRunning() && b < a.getStartTime()
}
;
MissionManager.prototype.canCreateType = function(a) {
var b = Missions[a];
if (!b || !cleverapps.createSet(this.getExistingTypes())[a])
return !1;
b = b.available || {};
b = b[cleverapps.config.name] || b;
b = b[connector.info.source] || b;
if (b.projectName && -1 === cleverapps.toArray(b.projectName).indexOf(cleverapps.config.name))
return !1;
if (cleverapps.config.demoMode)
return !0;
if (b.debugMode && !cleverapps.config.debugMode || b.disabled)
return !1;
a = Mission.GetParentType(a);
return void 0 === a || this.canCreateType(a) ? !0 : !1
}
;
MissionManager.prototype.init = function() {
this.reset();
this.load(cleverapps.dataLoader.load(DataLoader.TYPES.MISSIONS))
}
;
MissionManager.prototype.migrateOldData = function(a) {
var b = {};
-1 !== ["wondermerge", "fairy"].indexOf(cleverapps.config.name) && (b[40] = "40v1");
-1 !== ["mergecraft", "fairy"].indexOf(cleverapps.config.name) && (b[32] = "32v1",
b[46] = "46v1");
for (var c = Array.isArray(a) ? a : a.missions || [], d = c.filter(function(h) {
return -1 !== [Mission.TYPE_DRAGONIA_EXPEDITION, Mission.TYPE_UNDERSEA_EXPEDITION].indexOf(h.type) && void 0 === h.lastRemoved
})[0], e = 0; e < c.length; e++) {
var f = c[e];
Mission.TYPE_SLOT2_PASS === f.type && d ? f.type = Mission.CompoundType(Mission.TYPE_EXPEDITION_PASS, d.type) : Mission.TYPE_SLOT2_FEAST === f.type && d && (f.type = Mission.CompoundType(Mission.TYPE_EXPEDITION_FEAST, d.type));
var g = Mission.ParseCompoundType(f.type);
void 0 !== b[g.type] && (f.type = b[g.type]);
void 0 !== b[g.parentType] && (f.type = Mission.CompoundType(g.type, b[g.parentType]))
}
Object.keys(a.lastRemoved || {}).forEach(function(h) {
c.push({
type: cleverapps.castType(h),
lastRemoved: a.lastRemoved[h]
})
});
return c
}
;
MissionManager.prototype.load = function(a, b) {
if (a) {
var c = [];
a = this.migrateOldData(a);
for (var d = 0; d < a.length; d++) {
var e = a[d]
, f = Mission.GetParentType(e.type);
void 0 !== f && c.includes(f) || this.isObsoleteMissionType(e.type) || (this.isOldMission(e.type) ? this.pushToOldMission(e) : this.canCreateType(e.type) ? this.findByType(e.type) || (void 0 !== e.lastRemoved ? this.lastRemoved[e.type] = e.lastRemoved : -1 === e.started ? this.teaser = e.type : this.canUseSemaphore(e.type) ? (this.add(e.type, e, b),
delete this.lastRemoved[e.type]) : c.push(e.type)) : this.handleUnknownType(e))
}
}
}
;
MissionManager.prototype.isOldMission = function(a) {
var b = Mission.GetParentType(a);
return void 0 !== Mission.OLD_VERSIONS[a] || void 0 !== Mission.OLD_VERSIONS[b]
}
;
MissionManager.prototype.pushToOldMission = function(a) {
for (var b = 0; b < this.oldMissions.length && this.oldMissions[b].type !== a.type; ++b)
;
b === this.oldMissions.length && this.oldMissions.push(a);
var c = this.oldMissions[b];
this.oldMissions[b] = void 0 !== a.lastRemoved ? a : void 0 !== c.lastRemoved ? c : Object.assign(c, a)
}
;
MissionManager.prototype.handleUnknownType = function(a) {
this.unknownMissionsData.push(a);
cleverapps.playSession.set(cleverapps.EVENTS.DEBUG.UNKNOWN_MISSION_DAU, !0)
}
;
MissionManager.prototype.getPlayableMissions = function() {
return this.missions.filter(function(a) {
return a.isRunning() && a.canPlayMinigame()
})
}
;
MissionManager.prototype.findLocalExpedition = function() {
for (var a = 0; a < this.missions.length; a++) {
var b = this.missions[a];
if (b.logic instanceof ExpeditionMissionLogic && cleverapps.travelBook.getCurrentPage().id === b.id && b.isRunning())
return b
}
}
;
MissionManager.prototype.findLocalPass = function() {
for (var a = 0; a < this.missions.length; a++) {
var b = this.missions[a];
if (b.logic instanceof PassMissionLogic && MissionManager.hasProperParent(b) && b.isRunning())
return b
}
}
;
MissionManager.prototype.findRunningMission = function(a) {
a = cleverapps.createSet(cleverapps.toArray(a) || []);
for (var b = 0; b < this.missions.length; b++)
if (this.missions[b].isRunning() && a[this.missions[b].type])
return this.missions[b]
}
;
MissionManager.prototype.getRunningMissions = function() {
return this.missions.filter(function(a) {
return a.isRunning()
})
}
;
MissionManager.prototype.findBySemaphore = function(a) {
for (var b = 0; b < this.missions.length; ++b) {
var c = this.missions[b];
if (c.isRunning() && c.semaphore & a)
return c
}
}
;
MissionManager.prototype.findByType = function(a) {
a = cleverapps.castType(a);
for (var b = 0; b < this.missions.length; b++)
if (this.missions[b].type === a)
return this.missions[b]
}
;
MissionManager.prototype.skipNext = function() {
return 0 < this.missions.filter(function(a) {
return a.skipNext()
}).length
}
;
MissionManager.prototype.getMissionWithIntent = function() {
for (var a in this.missions) {
var b = this.missions[a];
if (b.logic && b.logic.hasIntent && b.logic.hasIntent())
return b
}
}
;
MissionManager.prototype.dispatchEvent = function(a, b) {
return (a = "object" === typeof a ? a : this.findByType(a)) && a.isRunning() ? (a.logic.processEvent(b),
!0) : !1
}
;
MissionManager.prototype.reset = function() {
for (var a = 0; a < this.missions.length; ++a) {
var b = this.missions[a]
, c = cleverapps.sideBar.findMissionIcon(b.type);
c && cleverapps.sideBar.removeTemporaryIcon(c);
this.refreshOffer(b)
}
this.table.reset();
this.missions = [];
this.teaser = void 0;
this.unknownMissionsData = [];
this.oldMissions = [];
this.lastRemoved = {};
this.semaphoresOnHold = 0
}
;
MissionManager.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.MISSIONS, this.getInfo());
a || this.addUpdateTask()
}
;
MissionManager.prototype.sendUpdateTask = function() {
void 0 !== MissionManager.sendUpdateTimeout && (clearTimeout(MissionManager.sendUpdateTimeout),
MissionManager.sendUpdateTimeout = void 0);
cleverapps.synchronizer.addUpdateTask("missions")
}
;
MissionManager.prototype.addUpdateTask = function() {
"merge" !== cleverapps.config.type && Game.currentGame && Game.currentGame.outcome === GameBase.OUTCOME_UNKNOWN ? (void 0 !== MissionManager.sendUpdateTimeout || cleverapps.environment.isSceneWithPreview() || (MissionManager.sendUpdateTimeout = setTimeout(this.sendUpdateTask.bind(this), cleverapps.parseInterval("1 minute"))),
Game.currentGame.missionManagerStopHandler || (Game.currentGame.missionManagerStopHandler = Game.currentGame.on("stop", function() {
void 0 !== MissionManager.sendUpdateTimeout && this.sendUpdateTask()
}
.bind(this)))) : this.sendUpdateTask()
}
;
MissionManager.prototype.getInfo = function() {
var a = []
, b = {};
this.missions.forEach(function(c) {
a.push(c.save());
b[c.type] = !0
});
this.unknownMissionsData.forEach(function(c) {
a.push(c)
});
this.oldMissions.forEach(function(c) {
a.push(c)
});
Object.keys(this.lastRemoved).forEach(function(c) {
b[c] || (a.push({
type: cleverapps.castType(c),
lastRemoved: this.lastRemoved[c]
}),
b[c] = !0)
}, this);
return a
}
;
MissionManager.prototype.updateInfo = function(a, b) {
console.log("updateInfo", a);
this.reset();
this.load(a, b);
this.save(b)
}
;
MissionManager.prototype.removeSilents = function() {
for (; ; ) {
for (var a = !1, b = 0; b < this.missions.length; b++) {
var c = this.missions[b];
if (c.isCompleted() && c.canRemoveSilently()) {
a = !0;
this.remove(c);
break
}
}
if (!a)
break
}
}
;
MissionManager.prototype.wantsToShowCompleted = function() {
return this.missions.find(function(a) {
return !a.isCompleted() || a.canRemoveSilently() || a.wasDisplayedCompleted ? !1 : a.logic && a.logic.canShowCompleted ? a.logic.canShowCompleted() : MissionManager.hasProperParent(a)
})
}
;
MissionManager.prototype.getWantToShowNewStateMission = function() {
return this.missions.find(function(a) {
return a.logic && a.logic.wantToShowNewState && a.logic.wantToShowNewState()
})
}
;
MissionManager.prototype.pendingStartWindow = function() {
for (var a = 0; a < this.missions.length; a++) {
var b = this.missions[a];
if (this.hasPendingStartWindow(b) && (!Missions[b.type].available || cleverapps.user.checkAvailable(Missions[b.type].available)))
return b
}
}
;
MissionManager.prototype.hasPendingStartWindow = function(a) {
return a && a.needShowStartWindow && a.startWindow && MissionManager.hasProperParent(a)
}
;
MissionManager.prototype.showStartWindow = function(a) {
cleverapps.focusManager.display({
focus: "missionStartWindow_" + a.type,
actions: [function(b) {
if (a.logic && a.logic.unitStory) {
var c = a.logic.unitStory.story
, d = a.logic.unitStory.unit;
a.logic.unitStory = void 0;
var e = d.findComponent(Ship);
if (e)
e.onCustomSpawn(cc.ScrollAction.SCROLL_TO_DURATION);
Game.currentGame.unitStories.showUnitStory(b, c.dialogue, {
unit: d,
delay: 2E3
})
} else
b()
}
, function(b) {
a.needShowStartWindow = !1;
a.startWindow && a.startWindow.name && a.startWindow.bundle ? cleverapps.focusManager.compound(b, [function(c) {
GuideWindow.createMissionRulesWindow(a);
cleverapps.focusManager.onceNoWindowsListener = c
}
, function(c) {
a.nudgeWindow ? (new a.nudgeWindow(a),
cleverapps.focusManager.onceNoWindowsListener = c) : a.nudgeScene ? cleverapps.scenes.replaceScene(new a.nudgeScene(a), c) : c()
}
]) : cleverapps.focusManager.compound(b, [function(c) {
new a.startWindow(a);
cleverapps.focusManager.onceNoWindowsListener = c
}
, function(c) {
var d = cleverapps.offerManager.findOffer({
mission: a.type
});
d && !a.offerWindowShown ? (new MissionOfferWindow(d),
cleverapps.focusManager.onceNoWindowsListener = c) : c()
}
])
}
, function(b) {
a.tutorial && Game.currentGame && Game.currentGame.tutorial ? Game.currentGame.tutorial.showTutorial(a.tutorial, b) : b()
}
]
})
}
;
MissionManager.prototype.getExistingTypes = function() {
return this._getExistingTypes().filter(function(a) {
var b = Missions[a];
return b.abTest ? b.abTest() : connector.platform.oneOf(connector.GDCOM, connector.COOLMATHGAMES) ? -1 === [Mission.TYPE_LETTER, Mission.TYPE_LIVESFEAST, Mission.TYPE_SOFTFEAST, Mission.TYPE_KRAKENFEAST, Mission.TYPE_SNAIL_FEAST, Mission.TYPE_EXPEDITION_FEAST, Mission.TYPE_SLOT_MACHINE].indexOf(a) : !0
})
}
;
MissionManager.prototype._getExistingTypes = function() {
if (this.existingTypes)
return this.existingTypes;
var a = [];
"solitaire" === cleverapps.config.type ? a.push(Mission.TYPE_PINBALL) : "match3" === cleverapps.config.type ? (a.push(Mission.TYPE_RAINBOW),
a.push(Mission.TYPE_COLLECT_MARK),
a.push(Mission.TYPE_BURN_NEARBY),
a.push(Mission.TYPE_LANTERN)) : "tile3" === cleverapps.config.type && a.push(Mission.TYPE_OCTOPUS_HUNT);
Object.keys(Missions.FEATURES).forEach(function(c) {
a.push(c)
});
-1 !== ["scramble", "riddles", "heroes"].indexOf(cleverapps.config.name) && a.push(Mission.TYPE_BONUS_WORLD);
-1 !== ["scramble"].indexOf(cleverapps.config.name) && a.push(Mission.TYPE_SLOT_MACHINE);
"merge" === cleverapps.config.type && (a = [Mission.TYPE_LIVESFEAST, Mission.TYPE_BUILDPASS, Mission.TYPE_SOFTFEAST, Mission.TYPE_BOOSTTIME, Mission.TYPE_CHESTTIME, Mission.TYPE_SALEPASS, Mission.TYPE_KRAKENFEAST, Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_EXPEDITION_FEAST, Mission.TYPE_CARAVAN, Mission.TYPE_SNAIL_FEAST, Mission.TYPE_COLLECTIONS_PASS].concat(TravelBook.LIST_IN_ORDER_EXPEDITIONS()));
var b = cleverapps.createSet(a);
return this.existingTypes = a = a.reduce(function(c, d) {
Missions[d] && (Missions[d].implementations || [d]).forEach(function(e) {
var f = Mission.GetParentType(e);
(void 0 === f || b[f] && Missions[f]) && c.push(e)
});
return c
}, [])
}
;
MissionManager.prototype.isAvailableByType = function(a, b) {
b = b || {};
if (Missions[a].disableNew)
return !1;
var c = Missions[a].feature;
if (c && !b.skipFeatures && !cleverapps.eventManager.isActive(c))
return !1;
a = cleverapps.clone(Missions[a].available || {}, !0);
b.teaser && ("merge" === cleverapps.config.type ? a.level-- : (a.level -= .66,
0 > a.level && (a.level = 0)));
return cleverapps.user.checkAvailable(a)
}
;
MissionManager.prototype.refreshTeaser = function() {
var a = cleverapps.sideBar.getTeaserIcon();
!a || a.type === this.teaser && MissionManager.hasProperParent(Missions[this.teaser]) || (cleverapps.sideBar.removeTemporaryIcon(a),
a = void 0);
this.teaser && !a && MissionManager.hasProperParent(Missions[this.teaser]) && (a = new TeaserIcon(this.teaser),
cleverapps.sideBar.addTemporaryIcon(a))
}
;
MissionManager.prototype.canUseSemaphore = function(a) {
for (var b = 0, c = 0; c < this.missions.length; c++)
b |= this.missions[c].semaphore;
for (c = 0; c < this.unknownMissionsData.length; c++)
b |= this.unknownMissionsData[c].semaphore || 0;
this.semaphoresOnHold && (b |= this.semaphoresOnHold);
return 0 === (b & Missions[a].semaphore)
}
;
MissionManager.prototype.hasCompetitions = function() {
for (var a = this.getExistingTypes(), b = 0; b < a.length; b++)
if (Missions[a[b]].competition)
return !0;
return !1
}
;
MissionManager.prototype.canCreateTypes = function() {
var a = this.getExistingTypes()
, b = a.filter(function(f) {
return this.isAvailableByType(f)
}
.bind(this));
a = a.filter(function(f) {
return Missions[f].teaser && -1 === b.indexOf(f) && this.isAvailableByType(f, {
teaser: !0
})
}
.bind(this));
var c = cleverapps.competitionPlayers.getAmount()
, d = function(f) {
var g = Missions[f];
if (0 === g.semaphore && this.findByType(f) || g.manualStart || !MissionManager.hasProperParent(g))
return !1;
var h = this.getLastRemoved(f);
if (h) {
if (g.oneShot)
return !1;
var k = g.cooldown && cleverapps.parseInterval(g.cooldown);
if (k && h + k > Date.now())
return !1
}
if (k = Missions.SEMAPHORE_COOLDOWNS[g.semaphore]) {
var m = 0, l;
for (l in this.lastRemoved)
Missions[l].semaphore === g.semaphore && (h = this.getLastRemoved(l),
h > m && (m = h));
if (m + cleverapps.parseInterval(k) > Date.now())
return !1
}
g = g.competition && g.competition.amount[1] || 0;
return this.canUseSemaphore(f) && g <= c
}
.bind(this)
, e = function(f, g) {
return this.teaser === f ? -1 : this.teaser === g ? 1 : (this.lastRemoved[f] || 0) - (this.lastRemoved[g] || 0)
}
.bind(this);
b = b.filter(d);
b.sort(e);
a = a.filter(d);
a.sort(e);
return {
missions: b,
teasers: a
}
}
;
MissionManager.hasProperParent = function(a) {
if (!a || cleverapps.environment.isEditorScene())
return !1;
var b = cleverapps.travelBook.getCurrentExpedition();
if (a.expedition)
return b && b.id === a.expedition;
a = Mission.GetParentType(a.type);
var c = Missions[a];
return a && !c ? !1 : "merge" === cleverapps.config.type && b ? void 0 !== c && c.id && b.id === c.id : void 0 === c
}
;
MissionManager.prototype.planMission = function(a) {
this.next = a
}
;
MissionManager.prototype.run = function() {
var a = this.canCreateTypes()
, b = void 0 === this.next ? a.missions[0] : this.next;
this.next = void 0;
void 0 !== b && (this.add(b),
this.teaser === b && (this.teaser = void 0),
this.save());
!(a = 0 < a.teasers.length && a.teasers[0]) || b && a.semaphore === b.semaphore || (this.teaser = a);
this.refreshTeaser();
this.runManualMissions()
}
;
MissionManager.prototype.runManualMissions = function() {
this.getExistingTypes().forEach(function(a) {
this.manualStart(a)
}, this)
}
;
MissionManager.prototype.manualStart = function(a, b) {
b = b || {};
var c = Missions[a]
, d = c.manualStart;
d && MissionManager.hasProperParent(c) && void 0 === this.findByType(a) && (!c.available || cleverapps.user.checkAvailable(c.available)) && d(a, b) && (this.add(a),
this.save())
}
;
MissionManager.prototype.remove = function(a) {
a.beforeRemove();
var b = this.missions.indexOf(a);
-1 !== b && (a.semaphore && (this.semaphoresOnHold |= a.semaphore,
setTimeout(function() {
this.semaphoresOnHold & a.semaphore && (this.semaphoresOnHold -= a.semaphore)
}
.bind(this), cleverapps.parseInterval("1 minute"))),
this.table.resetResults(a.type),
this.missions.splice(b, 1),
b = a.oncePerEvent ? a.eventFinishTime : Date.now(),
this.lastRemoved[a.type] = b,
this.updateOldMissions(a.type, b),
this.clearChildLastRemoved(a),
this.save(),
(b = cleverapps.sideBar.findMissionIcon(a.type)) && cleverapps.sideBar.removeTemporaryIcon(b),
this.refreshOffer(a),
cleverapps.toolModel && cleverapps.toolModel.refresh())
}
;
MissionManager.prototype.add = function(a, b, c) {
b = new Mission(a,b,c);
this.missions.push(b);
this.updateOldMissions(a, Date.now());
if (b.logic && b.logic.onAdded)
b.logic.onAdded();
!1 !== b.sideBarJson && (a = new MissionIcon(b),
cleverapps.sideBar.addTemporaryIcon(a));
this.refreshOffer(b);
this.clearChildLastRemoved(b);
b.isRunning() && cleverapps.playSession.set(cleverapps.EVENTS.MISSION_DAU + "_" + b.getName(), !0);
cleverapps.toolModel && cleverapps.toolModel.refresh();
return b
}
;
MissionManager.prototype.clearChildLastRemoved = function(a) {
a.getChildMissionTypes().forEach(function(b) {
delete this.lastRemoved[b]
}, this)
}
;
MissionManager.prototype.refreshOffer = function(a) {
cleverapps.offerManager.refreshByMission(a.type)
}
;
MissionManager.prototype.isMissionPassed = function(a) {
return Missions[a] && Missions[a].oneShot && !!this.getLastRemoved(a)
}
;
MissionManager.prototype.getLastRemoved = function(a) {
var b = this.lastRemoved[a];
if (void 0 !== b)
return b;
if (b = Mission.ParseTypeVersion(a)) {
var c = {};
this.oldMissions.forEach(function(e) {
c[e.type] = e
});
for (--b; 0 <= b; --b) {
var d = c[Mission.VersionType(a, b)];
if (d && d.lastRemoved < MissionManager.COMPATIBILITY_DATE)
return d.lastRemoved
}
}
return 0
}
;
MissionManager.prototype.updateOldMissions = function(a, b) {
for (var c = Mission.ParseTypeVersion(a) - 1; 0 <= c; --c)
this.pushToOldMission({
type: Mission.VersionType(a, c),
lastRemoved: MissionManager.COMPATIBILITY_DATE + b
})
}
;
MissionManager.prototype.getUnfinishedOldMission = function() {
return this.oldMissions.find(function(a) {
return void 0 === a.lastRemoved
})
}
;
MissionManager.prototype.replaceOldMission = function() {
var a = this.getUnfinishedOldMission();
if (a) {
var b = Mission.OLD_VERSIONS[a.type];
if (void 0 === b)
this.oldMissions = this.oldMissions.filter(function(d) {
return d !== a
}),
this.save();
else {
var c = this.findByType(b);
c || this.lastRemoved[b] ? (this.updateOldMissions(b, Date.now()),
this.save(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.MISSION_REPLACED_REMOVED + a.type + "-" + b)) : this.isAvailableByType(b) ? this.isPastEventMission(b, a.started) ? (this.updateOldMissions(b, Date.now()),
this.save(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.MISSION_REPLACED_PAST + a.type + "-" + b)) : cleverapps.focusManager.display({
focus: "replaceOldMission" + a.type,
actions: [function(d) {
new ReplaceOldMissionWindow(b);
cleverapps.focusManager.onceNoWindowsListener = d
}
, function(d) {
this.planMission(b);
this.run();
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.MISSION_REPLACED + a.type + "-" + b);
d();
c = this.findByType(b);
this.hasPendingStartWindow(c) && this.showStartWindow(c)
}
.bind(this)]
}) : (this.updateOldMissions(b, Date.now()),
this.save(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.MISSION_REPLACED_UNAVAILABLE + a.type + "-" + b))
}
}
}
;
MissionManager.COMPATIBILITY_DATE = 41024448E5;
var Offers = {
TYPES: {}
};
Offers.TYPES.LIVESFEAST = 1;
Offers.TYPES.SOFTFEAST = 2;
Offers.TYPES.KRAKENFEAST = 3;
Offers.TYPES.BUILDPASS = 4;
Offers.TYPES.SALEPASS = 5;
Offers.TYPES.EXPEDITION = 6;
Offers.TYPES.UNDERSEA = 7;
Offers.TYPES.UNDERSEA2 = 8;
Offers.TYPES.SNAILFEAST_UNDERSEA2 = 9;
Offers.TYPES.HALLOWEEN = 10;
Offers.TYPES.SNAILFEAST = 11;
Offers.TYPES.RAPUNZEL = 12;
Offers.TYPES.XMAS = 13;
Offers.TYPES.RAPUNZEL2 = 14;
Offers.TYPES.EASTER = 16;
Offers.TYPES.DRAGONIA2 = 17;
Offers.TYPES.DRAGONIA3 = 18;
Offers.TYPES.SNAILFEAST_DRAGONIA3 = 19;
Offers.TYPES.CHINA = 20;
Offers.TYPES.CHAIN_SALE = 21;
Offers.TYPES.SUPPLIES_SALE = 22;
Offers.TYPES.PROMOTION_SALE = 23;
Offers.TYPES.RAPUNZEL3 = 24;
Offers.TYPES.CLCHAIN_SALE = 25;
Offers.TYPES.CLSUPPLIES_SALE = 26;
Offers.TYPES.CLPROMOTION_SALE = 27;
Offers.TYPES.PACK = 28;
Offers.TYPES.PIXEL_OFFER = 29;
Offers.TYPES.PERIODIC_PROMOTION_SALE = 30;
Offers.TYPES.CLPASS = 31;
Offers.TYPES.STICKERS_PACK = 32;
Offers.TYPES.SNAILFEAST_UNDERSEA3 = 33;
Offers.TYPES.UNDERSEA3 = 34;
Offers.TYPES.PINBALL_PACK = 35;
Offers.TYPES.SNAILFEAST_HALLOWEEN = 36;
Offers.TYPES.BLACKFRIDAY = 37;
Offers.TYPES.SNAILFEAST_BLACKFRIDAY = 38;
Offers.TYPES.BOOSTER_OFFER = 39;
Offers.initialize = function() {
Offers[Offers.TYPES.PACK] = {
name: "Pack",
cooldown: cleverapps.config.debugMode ? "10 seconds" : "1 day",
logic: PackOfferLogic,
bundle: "starter_pack",
sideBarJson: [bundles.sidebar.jsons.pack_icon_json, bundles.sidebar.jsons.pack1_icon_json, bundles.sidebar.jsons.pack2_icon_json],
view: PackWindow,
pendingWindow: !0,
availableByStages: [{
level: "merge" === cleverapps.config.type ? 6.2 : 2.65
}, {
level: "merge" === cleverapps.config.type ? 8.2 : 4.65
}, {
level: "merge" === cleverapps.config.type ? 10.2 : 6.65
}]
};
cleverapps.config.features.includes("chainsale") && (Offers[Offers.TYPES.CHAIN_SALE] = {
available: {
level: 5.3
},
name: "ChainSale",
duration: cleverapps.config.debugMode ? "5 minutes" : "3 day",
cooldown: cleverapps.config.debugMode ? "5 minutes" : "14 days",
logic: ChainSaleLogic,
bundle: "chain_sale",
sideBarJson: bundles.sidebar.jsons.chain_sale_json,
view: ChainSaleWindow,
pendingWindow: !0
});
cleverapps.config.features.includes("suppliessale") && (Offers[Offers.TYPES.SUPPLIES_SALE] = {
available: {
level: 5.3,
debugMode: ["spades"].includes(cleverapps.config.name)
},
name: "SuppliesSale",
cooldown: cleverapps.config.debugMode ? "10 minutes" : "30 days",
logic: SuppliesSaleLogic,
sideBarJson: bundles.sidebar.jsons.supplies_icon_json,
view: SuppliesWindow,
pendingWindow: !0
});
cleverapps.config.features.includes("promotionsale") && (Offers[Offers.TYPES.PROMOTION_SALE] = {
available: {
level: 4.7,
debugMode: ["solitaire"].includes(cleverapps.config.type)
},
name: "PromotionSale",
duration: cleverapps.config.debugMode ? "5 minutes" : "3 day",
cooldown: cleverapps.config.debugMode ? "5 minutes" : "14 days",
logic: PromotionSaleLogic,
bundle: "promotion_sale",
sideBarJson: bundles.sidebar.jsons.promotion_sale_json,
view: PromotionSaleWindow,
pendingWindow: !0
});
"merge" === cleverapps.config.type && (Offers[Offers.TYPES.LIVESFEAST] = {
mission: Mission.TYPE_LIVESFEAST,
price: 250,
view: MissionOfferWindow,
reward: RewardsConfig.LivesFeast.offer,
sideBarJson: bundles.sidebar.jsons.lives_feast_offer,
name: "LivesFeastOffer",
bundle: "lives_offer"
},
Offers[Offers.TYPES.BUILDPASS] = {
mission: Mission.TYPE_BUILDPASS,
price: 299,
reward: RewardsConfig.BuildPass.offer,
view: MissionOfferWindow,
sideBarJson: bundles.sidebar.jsons.buildpass_offer,
name: "BuildPassOffer",
bundle: "buildpass_offer"
},
Offers[Offers.TYPES.SALEPASS] = {
mission: Mission.TYPE_SALEPASS,
price: 299,
reward: RewardsConfig.SalePass.offer,
view: MissionOfferWindow,
sideBarJson: bundles.sidebar.jsons.salepass_offer,
name: "SalePassOffer",
bundle: "salepass_offer"
},
-1 === ["mbga", "sp_mbga"].indexOf(connector.info.source) && (Offers[Offers.TYPES.SOFTFEAST] = {
mission: Mission.TYPE_SOFTFEAST,
price: 250,
reward: RewardsConfig.SoftFeast.offer,
view: MissionOfferWindow,
sideBarJson: bundles.sidebar.jsons.soft_feast_offer,
name: "SoftFeastOffer",
bundle: "soft_offer"
}),
Offers[Offers.TYPES.KRAKENFEAST] = {
mission: Mission.TYPE_KRAKENFEAST,
reward: RewardsConfig.KrakenFeast.offer,
price: 299,
view: MissionOfferWindow,
sideBarJson: bundles.sidebar.jsons.kraken_offer,
name: "KrakenFeastOffer",
bundle: "kraken_offer"
},
Offers[Offers.TYPES.EXPEDITION] = {
mission: Mission.TYPE_DRAGONIA_EXPEDITION,
hero: {
code: "dragonpack",
stage: 0
},
product: "expeditionPack",
force: Forces.OFFER_ICON_SLOT2,
fog: "fog4",
reward: RewardsConfig.DragoniaPack,
view: MissionOfferWindow,
sideBarJson: bundles.sidebar.jsons.dragonia_offer,
name: "DragoniaPack",
bundle: "dragonia_offer"
},
Offers[Offers.TYPES.SNAILFEAST] = {
mission: Mission.CompoundType(Mission.TYPE_SNAIL_FEAST, Mission.TYPE_DRAGONIA2_EXPEDITION),
price: 99,
view: MissionOfferWindow,
sideBarJson: function() {
return cleverapps.skins.getSlot("snailhouse_offer_json") || bundles.sidebar.jsons.snailhouse_offer_json
},
reward: RewardsConfig.SnailHouseDragoniaPack,
name: "SnailPack",
bundle: "snailhouse_offer"
},
Offers[Offers.TYPES.PIXEL_OFFER] = {
available: {
level: 5.3,
debugMode: ["hustlemerge", "fairy", "wondermerge"].includes(cleverapps.config.name)
},
name: "PixelOffer",
duration: "2 hours",
cooldown: "12 hours",
logic: PixelOfferLogic,
sideBarJson: bundles.sidebar.jsons.pixel_offer_icon_json,
view: PixelOfferWindow,
availableByStages: [{}, {}, {}, {}, {}, {}]
},
Offers[Offers.TYPES.CLPASS] = {
mission: Mission.TYPE_COLLECTIONS_PASS,
price: 999,
view: MissionOfferWindow,
reward: RewardsConfig.CollectionsPass.offer,
sideBarJson: bundles.sidebar.jsons.collections_pass_offer,
name: "CollectionsPassOffer",
bundle: "clpass_offer",
expedition: "collections",
cooldown: "48 hours",
available: {
debugMode: ["hustlemerge"].includes(cleverapps.config.name)
}
},
cleverapps.config.features.includes("chainsale") && (Offers[Offers.TYPES.CLCHAIN_SALE] = Object.assign({}, Offers[Offers.TYPES.CHAIN_SALE], {
name: "ClChainSale",
reward: RewardsConfig.ClChainSale,
expedition: "collections",
available: {
level: !1,
gameLevel: 5.3
}
})),
cleverapps.config.features.includes("suppliessale") && (Offers[Offers.TYPES.CLSUPPLIES_SALE] = Object.assign({}, Offers[Offers.TYPES.SUPPLIES_SALE], {
name: "ClSuppliesSale",
reward: RewardsConfig.ClSupplies.rewards,
expedition: "collections",
available: {
level: !1,
gameLevel: 5.3
}
})),
cleverapps.config.features.includes("promotionsale") && (Offers[Offers.TYPES.CLPROMOTION_SALE] = Object.assign({}, Offers[Offers.TYPES.PROMOTION_SALE], {
name: "ClPromotionSale",
reward: RewardsConfig.ClPromotionSale,
expedition: "collections",
available: {
level: !1,
gameLevel: 4.7
}
}),
Offers[Offers.TYPES.PERIODIC_PROMOTION_SALE] = {
name: "PrPromotionSale",
reward: RewardsConfig.PrPromotionSale,
feature: "periodic_offer",
logic: PromotionSaleLogic,
bundle: "periodic_promotion_offer",
cooldown: "7 days",
sideBarJson: bundles.sidebar.jsons.periodic_promotion_sale_json,
view: PromotionSaleWindow,
pendingWindow: !0,
available: {
level: 4.7,
vk: {
disabled: !0
},
ok: {
disabled: !0
},
mm: {
disabled: !0
},
mygames: {
disabled: !0
},
yandex: {
disabled: !0
},
fotostrana: {
disabled: !0
}
}
}),
TravelBook.PAGES.forEach(function(d) {
(d.offers || []).forEach(function(e) {
if ("object" === typeof e) {
var f = e.id
, g = e.base;
e.type = f;
delete e.id;
delete e.base;
Offers[f] = Object.assign({}, Offers[g], e);
g === Offers.TYPES.SNAILFEAST ? (Offers[f].mission = Mission.CompoundType(Mission.GetChildType(Offers[g].mission), d.missionType),
cleverapps.styles.MissionOfferWindow[f] = cleverapps.styles.MissionOfferWindow[g],
cleverapps.styles.PackOfferComponent[f] = cleverapps.styles.PackOfferComponent[g]) : g === Offers.TYPES.EXPEDITION && (Offers[f].mission = d.missionType,
Offers[f].force = "1" === d.slot ? Forces.OFFER_ICON_SLOT1 : Forces.OFFER_ICON_SLOT2,
Offers[f].sideBarJson = bundles.sidebar.jsons[e.bundle],
Offers[f].name = d.name.replace("Expedition", "Pack"))
}
})
}));
cleverapps.config.features.includes("pinball") && (Offers[Offers.TYPES.PINBALL_PACK] = {
mission: Mission.TYPE_PINBALL,
product: "kit3",
view: MissionOfferWindow,
reward: RewardsConfig.PinballPack,
sideBarJson: bundles.sidebar.jsons.pinball_offer_json,
name: "PinballOffer",
bundle: "pinball_offer"
});
// uptap注釋左側礼包
// "woodenblock" === cleverapps.config.name && (Offers[Offers.TYPES.BOOSTER_OFFER] = {
// sideBarJson: bundles.sidebar.jsons.booster_offer_icon_json,
// name: "BoosterOffer",
// bundle: "booster_offer",
// reward: RewardsConfig.BoosterOffer,
// logic: BoosterOfferLogic,
// view: BoosterOfferWindow
// });
Offers.offerByMission = {};
Offers.noMissionOffer = {};
Offers.offerByHero = {};
Offers.offersByFog = {};
for (var a in Offers.TYPES) {
var b = Offers.TYPES[a]
, c = Offers[b];
c && (c.type = b,
c.mission ? Offers.offerByMission[c.mission] = c : Offers.noMissionOffer[c.name] = c,
c.hero && (Offers.offerByHero[Unit.GetKey(c.hero)] = c),
c.fog && (Offers.offersByFog[c.fog] ? Offers.offersByFog[c.fog].push(c) : Offers.offersByFog[c.fog] = [c]))
}
}
;
"undefined" === typeof cc && (module.exports = Offers);
var Offer = function(a, b) {
a = Offers[a];
this.type = a.type;
this.force = a.force;
this.logic = new (a.mission ? MissionOfferLogic : a.logic)(this);
this.name = a.name;
this.bundle = a.bundle;
this.load(b);
this.started || (this.started = Date.now(),
delete this.finished);
this.sideBarJson = Array.isArray(a.sideBarJson) ? a.sideBarJson[this.stage || 0] : a.sideBarJson;
!b && a.force && cleverapps.forces.clearForce(a.force.id);
this.onUpdateState()
};
Offer.prototype.load = function(a) {
a && (this.started = a.started,
this.finished = a.finished,
this.stage = a.stage,
this.lastRewardTime = a.lastRewardTime)
}
;
Offer.prototype.getInfo = function() {
return {
started: this.started,
finished: this.finished,
lastRewardTime: this.lastRewardTime,
stage: this.stage
}
}
;
Offer.prototype.incStage = function() {
var a = this.stage || 0;
cleverapps.eventLogger.logEvent(this.name + "_" + cleverapps.EVENTS.OFFER_LOT + a);
this.stage = a + 1;
cleverapps.offerManager.save();
cleverapps.offerManager.refreshOffer(this.type)
}
;
Offer.prototype.onUpdateState = function() {
this.countdown && (this.countdown.remove(),
delete this.countdown);
var a = this.logic.getTimeLeft();
0 < a && (this.countdown = new cleverapps.CountDown(a,{
onFinish: this.checkCompletion.bind(this),
permanent: !0
}))
}
;
Offer.prototype.checkCompletion = function() {
!this.checkLeftTime() || this.logic.needWait && this.logic.needWait() || this.complete();
this.logic.checkIfComplete && this.logic.checkIfComplete()
}
;
Offer.prototype.checkLeftTime = function() {
var a = Offers[this.type].duration;
return a && this.started && Date.now() > this.started + cleverapps.parseInterval(a)
}
;
Offer.prototype.complete = function() {
Offers[this.type].availableByStages || delete this.stage;
delete this.started;
this.finished = Date.now();
cleverapps.offerManager.save();
cleverapps.offerManager.refreshOffer(this.type)
}
;
Offer.prototype.beforeRemove = function() {
this.countdown && (this.countdown.remove(),
delete this.countdown)
}
;
var OfferManager = function() {
this.offers = {};
this.inactiveOffersData = {};
cleverapps.flags.on("change:monetization", this.refreshProductOffers.bind(this));
this.shownOfferTypes = [];
this.pendingWindowShowTime = 0
};
OfferManager.prototype.initialize = function() {
this.inited = !0;
var a = cleverapps.dataLoader.load(DataLoader.TYPES.OFFERS);
a || (a = this.loadFromOldFormat());
this.migratePacksData(a);
this.inactiveOffersData = this._expandData(a) || {};
this.refreshAll()
}
;
OfferManager.prototype.loadFromOldFormat = function() {
var a = {}, b;
for (b in Offers.TYPES) {
var c = Offers.TYPES[b]
, d = cleverapps.dataLoader.load(DataLoader.TYPES.OFFER_PURCHASE_TIME + c);
d && (a[c] = {
finished: d
})
}
return a
}
;
OfferManager.prototype.migratePacksData = function(a) {
var b = cleverapps.dataLoader.load(DataLoader.TYPES.PACK);
!a[Offers.TYPES.PACK] && b && b.used && (a[Offers.TYPES.PACK] = {
stage: b.used
})
}
;
OfferManager.prototype.updateInfo = function(a) {
for (var b in this.offers)
this.removeOffer(Number(b), !0);
this.offers = {};
this.inactiveOffersData = this._expandData(a) || {};
this.refreshAll();
this.save(!0)
}
;
OfferManager.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.OFFERS, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("offers")
}
;
OfferManager.prototype.getInfo = function() {
var a = {}, b;
for (b in this.offers)
a[b] = this.offers[b].getInfo();
a = Object.assign({}, this.inactiveOffersData, a);
return this._compactData(a)
}
;
OfferManager.prototype.refreshAll = function() {
for (var a in Offers.TYPES)
this.refreshOffer(Offers.TYPES[a]);
for (var b in this.offers)
this.offers[b].checkCompletion();
for (var c in this.offers)
cleverapps.playSession.set(cleverapps.EVENTS.OFFER_DAU + "_" + this.offers[c].name, !0)
}
;
OfferManager.prototype.refreshProductOffers = function() {
for (var a in Offers.TYPES) {
var b = Offers.TYPES[a];
Offers[b] && Offers[b].product && this.refreshOffer(b)
}
}
;
OfferManager.prototype.refreshOffer = function(a) {
Offers[a] && (this.isOfferAvailable(a) ? this.offers[a] || this.addOffer(a) : this.offers[a] && this.removeOffer(a))
}
;
OfferManager.prototype.addOffer = function(a) {
var b = new Offer(a,this.inactiveOffersData[a]);
delete this.inactiveOffersData[a];
this.offers[a] = b;
cleverapps.sideBar.findOfferIcon(a) || (a = new OfferIcon(b),
cleverapps.sideBar.addTemporaryIcon(a));
this.save()
}
;
OfferManager.prototype.removeOffer = function(a, b) {
this.offers[a].beforeRemove();
var c = this.offers[a].getInfo();
this.inactiveOffersData[a] = c;
delete this.offers[a];
(a = cleverapps.sideBar.findOfferIcon(a)) && cleverapps.sideBar.removeTemporaryIcon(a);
b || this.save()
}
;
OfferManager.prototype.refreshByMission = function(a) {
(a = Offers.offerByMission[a] || Offers.offerByMission[Mission.GetChildType(a)]) && this.refreshOffer(a.type)
}
;
OfferManager.prototype.refreshByHero = function(a) {
(a = Offers.offerByHero[Unit.GetKey(a)]) && this.refreshOffer(a.type)
}
;
OfferManager.prototype.refreshByFog = function(a) {
(a = Offers.offersByFog[a]) && a.forEach(function(b) {
this.refreshOffer(b.type)
}
.bind(this))
}
;
OfferManager.prototype.clearForceByMission = function(a) {
Offers.offerByMission[a] && Offers.offerByMission[a].force && cleverapps.forces.clearForce(Offers.offerByMission[a].force.id)
}
;
OfferManager.prototype.findOffer = function(a) {
if (a.type)
return this.offers[a.type];
var b = a.product, c = void 0 === a.mission ? void 0 : Mission.GetChildType(a.mission), d;
for (d in this.offers) {
var e = this.offers[d];
if (void 0 === b || b === e.logic.product)
if (void 0 === c || c === e.logic.mission || a.mission === e.logic.mission)
return e
}
}
;
OfferManager.prototype.isOfferAvailable = function(a) {
var b = Offers[a];
if (!this.inited || !b || b.available && !levels.user.checkAvailable(b.available))
return !1;
if (b.mission) {
var c = cleverapps.missionManager.findByType(b.mission);
if (!c || c.isCompleted() || (c = Missions[b.mission].id || Missions[b.mission].expedition) && cleverapps.travelBook.getCurrentPage().id !== c)
return !1
} else {
if (cleverapps.flags.monetization !== cleverapps.Flags.MONETIZATION_REGULAR || b.feature && !cleverapps.eventManager.isActive(b.feature))
return !1;
if (b.expedition) {
if (b.expedition && b.expedition !== cleverapps.travelBook.getCurrentPage().id)
return !1
} else if (!cleverapps.environment.isMainScene() && !cleverapps.environment.isGameScene() || cleverapps.travelBook.isExpedition())
return !1
}
if (b.debugMode && !cleverapps.config.debugMode || b.hero && cleverapps.unitsLibrary.isOpened(b.hero) || b.product && (!connector.payments.getProduct(b.product) || cleverapps.flags.monetization !== cleverapps.Flags.MONETIZATION_REGULAR))
return !1;
c = Game.currentGame;
if (b.fog && !(c && c.map && c.map.fogs.isOpened(b.fog)))
return !1;
c = this.inactiveOffersData[a] || {};
this.offers[a] && (c = this.offers[a].getInfo());
return b.cooldown && c.finished && Date.now() <= c.finished + cleverapps.parseInterval(b.cooldown) || b.availableByStages && (a = c.stage || 0,
a >= b.availableByStages.length || !levels.user.checkAvailable(b.availableByStages[a])) ? !1 : !0
}
;
OfferManager.prototype.findOfferWithPendingWindow = function() {
if (!(this.pendingWindowShowTime + OfferManager.SHOW_WINDOW_INTERVAL > Date.now()))
for (var a in this.offers)
if (-1 === this.shownOfferTypes.indexOf(Number(a)) && Offers[a].pendingWindow)
return this.offers[a]
}
;
OfferManager.prototype.showOfferWindow = function(a) {
cleverapps.focusManager.display({
focus: a.name + "IconClicked",
action: function(b) {
-1 === this.shownOfferTypes.indexOf(a.type) && this.shownOfferTypes.push(a.type);
this.pendingWindowShowTime = Date.now();
new Offers[a.type].view(a);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.OFFER_OPEN + "_" + Offers[a.type].name);
cleverapps.focusManager.onceNoWindowsListener = b
}
.bind(this)
})
}
;
OfferManager.prototype.getOfferExpedition = function(a) {
var b = "main";
if (a = Offers[a])
a.expedition ? b = cleverapps.travelBook.getPageById(a.expedition) ? a.expedition : b : a.mission && (a = Mission.ParseCompoundType(a.mission),
a = void 0 !== a.parentType ? a.parentType : a.type,
b = Missions[a] && Missions[a].id || b);
return b
}
;
OfferManager.prototype.getShopTileModels = function() {
if (!cleverapps.environment.isMainScene() && !cleverapps.environment.isGameScene())
return [];
var a = [];
for (e in this.offers) {
var b = this.offers[e]
, c = b.name.toLowerCase().replace(/[0-9]/g, "");
if (bundles.tile_shop.frames[c] && b.logic.isIconAvailable() && b.logic.getProduct()) {
var d = b.logic.getProduct();
a.push(new OfferTileModel({
offer: b,
shopIcon: c,
product: d,
title: Offers[b.type].mission ? "MissionOfferWindow." + b.name + ".title" : d.title,
reward: Offers[b.type].reward || d.reward
}))
}
}
if ("merge" === cleverapps.config.type) {
var e = cleverapps.travelBook.isExpedition() ? "energyofferexp" : "energyoffer";
0 < Game.currentGame.specialEnergyOffer.getIconLeftTime() && bundles.tile_shop.frames[e] && a.push(new OfferTileModel({
offer: {
name: e,
complete: function() {
Game.currentGame.specialEnergyOffer.refreshAfterBought()
}
},
shopIcon: e,
product: Game.currentGame.specialEnergyOffer.getProduct(),
title: "SpecialEnergyOfferWindow.title",
reward: {
energy: Game.currentGame.specialEnergyOffer.getEnergyAmount()
}
}))
}
return a
}
;
OfferManager.prototype._compactData = function(a) {
var b = {}, c;
for (c in a) {
var d = a[c]
, e = Offers[c]
, f = Object.keys(d).filter(function(g) {
return void 0 !== d[g]
}).length;
if (0 !== f) {
if (d.finished && e) {
if (!e.cooldown)
continue;
if (1 === f && Date.now() > d.finished + cleverapps.parseInterval(e.cooldown))
continue
}
b[c] = {
s: cleverapps.compactTime(d.started),
f: cleverapps.compactTime(d.finished),
st: d.stage,
l: cleverapps.compactTime(d.lastRewardTime)
}
}
}
return b
}
;
OfferManager.prototype._expandData = function(a) {
var b = {}, c;
for (c in a) {
var d = a[c];
d && (b[c] = {
started: d.started || cleverapps.expandTime(d.s),
finished: d.finished || cleverapps.expandTime(d.f),
stage: d.stage || d.st,
lastRewardTime: d.lastRewardTime || cleverapps.expandTime(d.l)
})
}
return b
}
;
OfferManager.SHOW_WINDOW_INTERVAL = cleverapps.parseInterval("1 minute");
var MissionOfferWindow = CleverappsWindow.extend({
ctor: function(a) {
this.offer = a;
this.reward = this.offer.logic.reward;
this.bundle = bundles[this.offer.bundle];
this._super(a)
},
onWindowLoaded: function() {
-1 === ["tropical", "heroes"].indexOf(cleverapps.config.ui) && -1 !== [Offers.TYPES.LIVESFEAST, Offers.TYPES.SOFTFEAST].indexOf(this.offer.type) && (this.withCustomTitle = !0);
-1 !== [Offers.TYPES.BLACKFRIDAY].indexOf(this.offer.type) && (this.withCustomTitle = !0);
var a = cleverapps.missionManager.findRunningMission(this.offer.logic.mission);
a && (a.offerWindowShown = !0);
this._super({
name: "MissionOfferWindow",
content: this.createContent(),
noBackground: !0,
notCloseByTouchInShadow: !0,
closeButtonDelay: !0,
title: !this.withCustomTitle && "MissionOfferWindow." + this.offer.name + ".title",
openSound: this.bundle.urls.offer_showup_effect && this.bundle.urls.offer_showup_effect,
customTitle: this.withCustomTitle
});
a = ["MenuBarCoinsItem", "MenuBarLivesItem"];
var b = ["MenuBarGoldItem"];
this.reward.energy && b.push(a.pop());
cleverapps.focusManager.showControlsWhileFocused(b);
cleverapps.focusManager.hideControlsWhileFocused(a);
this.offer.logic.onBought = this.createListener(this.close.bind(this));
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this)
},
updateButton: function() {
connector.payments.isConnected() || this.offer.logic.getProduct()instanceof VirtualProduct ? this.button.enable() : this.button.disable()
},
getPerson: function() {
var a = cleverapps.styles.MissionOfferWindow[this.offer.type].person;
if (a)
return cleverapps.persons.choose(a.role) ? a : {
role: "worker",
emotion: "happy"
}
},
createContent: function() {
var a = cleverapps.styles.MissionOfferWindow[this.offer.type]
, b = this.content = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.width, a.height);
this.createOffer();
this.withCustomTitle && this.createTitle();
this.createBuyButton();
this.createFootnote();
this.createBadges();
return b
},
createTitle: function() {
var a = cleverapps.styles.MissionOfferWindow[this.offer.type];
this.title = cleverapps.UI.generateOnlyText("MissionOfferWindow." + this.offer.name + ".title", a.title.font);
this.title.setPositionRound(a.title);
this.title.fitTo(a.title.width);
this.content.addChild(this.title, 1);
this.title.setOpacity(0);
this.title.runAction(new cc.Spawn(new cc.FadeIn(.7),new cc.Sequence(new cc.ScaleTo(.23,1.1),new cc.ScaleTo(.21,1)),new cc.Sequence(new cc.MoveBy(.21,0,-a.title.offsetY),new cc.MoveBy(.23,0,a.title.offsetY))))
},
createOffer: function() {
var a = cleverapps.styles.MissionOfferWindow[this.offer.type]
, b = this.offerAnimation = new cleverapps.Spine(this.bundle.jsons.offer_json);
this.offer.type === Offers.TYPES.KRAKENFEAST && "mergecraft" === cleverapps.config.name ? b.setSkin("0") : this.offer.type === Offers.TYPES.BLACKFRIDAY && b.setSkin("expedition");
b.setPositionRound(a.offer);
this.content.addChild(b);
b.setLocalZOrder(0);
this.chooseAnimation();
for (var c in this.reward)
if ("unit" === c && a.rewards[c])
this.reward[c].forEach(function(e) {
a.rewards[c][e.code] && this.createReward(c, e)
}, this);
else if ("boosters" === c)
for (var d in this.reward[c])
this.createReward(c + d, this.reward[c][d]);
else
this.createReward(c, this.reward[c])
},
createReward: function(a, b) {
var c = cleverapps.styles.MissionOfferWindow[this.offer.type]
, d = c.rewards[a];
if (d) {
"worker" === a && (b = b.title);
"unit" === a && (d = d[b.code],
b = b.pointsValue || b.amount || 1);
var e = d.delay || c.rewards.delay;
b = "number" === typeof b ? "x" + b : b;
Messages.has("MissionOfferWindow." + this.offer.name + ".reward." + a) && (b = Messages.get("MissionOfferWindow." + this.offer.name + ".reward." + a));
a = cleverapps.UI.ImageFont.IsApplicable(c.rewards.font, b) ? cleverapps.UI.generateImageText(b, c.rewards.font) : cleverapps.UI.generateOnlyText(b, c.rewards.font);
this.content.addChild(a);
a.fitTo(d.width);
a.setRotation(d.rotation);
a.setPositionRound(d);
e && (a.setOpacity(c.rewards.spawn ? 255 : 0),
a.runAction(new cc.Sequence(new cc.DelayTime(e),new cc.FadeIn(.5))))
}
},
createBuyButton: function() {
var a = cleverapps.styles.MissionOfferWindow[this.offer.type].button;
this.button = new cleverapps.UI.Button({
text: this.offer.logic.getPriceText(),
width: a.width,
height: a.height,
onClicked: this.offer.logic.buy.bind(this.offer.logic)
});
this.button.performRecursive(function(d) {
d.setCascadeOpacityEnabled(!0)
});
this.button.setOpacity(0);
this.button.setScale(.3);
this.button.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.Spawn(new cc.FadeIn(.3),(new cc.ScaleTo(.3,1)).easing(cc.easeBackOut()))));
if (a.label) {
var b = new cc.Sprite(this.bundle.frames.btn_label)
, c = Messages.get("MissionOfferWindow." + this.offer.name + ".btnLabel").split("\n");
c = c.map(function(d, e) {
d = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.TILE_SHOP_BADGE_BIG);
d.fitTo(a.label.text.width, 0 === e ? .55 * a.label.text.height : .45 * a.label.text.height);
return d
});
c = new cleverapps.Layout(c,{
direction: cleverapps.UI.VERTICAL,
margin: a.label.text.margin
});
c.setPositionRound(a.label.text);
c.setRotation(a.label.text.rotation);
b.addChild(c);
this.button.addChild(b);
b.setPositionRound(a.label)
}
this.content.addChild(this.button);
this.button.setPositionRound(a);
this.button.setLocalZOrder(1);
this.updateButton();
cleverapps.fallSale.isAvailable() && this.button.addChild(new FallSaleIcon)
},
createFootnote: function() {
var a = "MissionOfferWindow." + this.offer.name + ".footnote";
if (Messages.has(a)) {
var b = cleverapps.styles.MissionOfferWindow[this.offer.type];
a = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.WHITE_TEXT);
a.setPositionRound(b.footNote);
a.setDimensions(b.footNote.width, 0);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.fitTo(void 0, b.footNote.height);
this.content.addChild(a);
a.setOpacity(0);
a.runAction(new cc.Sequence(new cc.DelayTime(b.footNote.delay),new cc.FadeIn(.7)))
}
},
createBadges: function() {
var a = cleverapps.styles.MissionOfferWindow[this.offer.type];
if (a.badges)
for (var b = 0; b < a.badges.length; b++) {
var c = a.badges[b]
, d = new TileBadge({
text: "MissionOfferWindow." + this.offer.name + ".badge" + (b + 1),
rotation: c.rotation,
largeFont: c.largeFont
});
d.setPositionRound(c);
this.content.addChild(d)
}
},
chooseAnimation: function() {
var a = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? "vertical" : ""
, b = this.offerAnimation.hasAnimation("open_" + a) ? "open_" + a : "open";
a = this.offerAnimation.hasAnimation("idle_" + a) ? "idle_" + a : "idle";
this.offerAnimation.setAnimationAndIdleAfter(b, a)
},
listBundles: function(a) {
return [a.bundle]
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
MISSION_OFFER_ENERGY_TITLE: {
size: 75,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.BROWN_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_DESCRIPTION: {
size: 35,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_SOFT_TITLE: {
size: 115,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.BROWN_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_REWARD: {
name: "big_digits",
size: 80,
color: cleverapps.styles.COLORS.COLOR_BROWN_2,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_REWARD2: {
name: "big_digits",
size: 80,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_BF_TITLE: {
size: 115,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.BLUE_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_BF_REWARD: {
name: "big_digits",
size: 50,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.BLUE_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_SALE_REWARD: {
name: "default",
size: 72,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
MISSION_OFFER_CLPASS_REWARD: {
name: "default",
size: 50,
color: cleverapps.styles.COLORS.WHITE
},
MISSION_OFFER_BADGE: {
name: "default",
size: 40,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
LARGE_WHITE_TEXT: {
size: 80,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.MissionOfferWindowTemplate = {
width: 800,
height: 840,
title: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 570
},
width: 480,
offsetY: 23,
font: cleverapps.styles.FONTS.WINDOW_TITLE_TEXT,
background: {
x: {
align: "center",
dx: 10
},
y: {
align: "top",
dy: 120
},
scale: 1.3
}
},
offer: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD
},
button: {
width: 300,
height: 125,
x: {
align: "center",
dx: -5
},
y: {
align: "bottom",
dy: -50
}
},
footNote: {
delay: 2.5,
width: 920,
height: 85,
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -170
}
}
};
cleverapps.styles.MissionOfferWindow = {};
cleverapps.styles.MissionOfferWindow[Offers.TYPES.LIVESFEAST] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1400,
title: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 325
},
width: 600,
font: cleverapps.styles.FONTS.MISSION_OFFER_ENERGY_TITLE,
background: void 0
},
person: {
role: "seller",
emotion: "idle"
},
rewards: {
energy: {
x: {
align: "center",
dx: -535
},
y: {
align: "center",
dy: -195
},
width: 170,
rotation: -5
},
worker: {
x: {
align: "center",
dx: 535
},
y: {
align: "center",
dy: -195
},
width: 170,
rotation: 5
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.SOFTFEAST] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1400,
title: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 325
},
width: 600,
font: cleverapps.styles.FONTS.MISSION_OFFER_SOFT_TITLE,
background: void 0
},
person: {
role: "seller",
emotion: "idle"
},
rewards: {
energy: {
x: {
align: "center",
dx: -535
},
y: {
align: "center",
dy: -195
},
width: 170,
rotation: -5
},
soft: {
x: {
align: "center",
dx: 535
},
y: {
align: "center",
dy: -195
},
width: 170,
rotation: 5
}
},
button: {
x: {
align: "center",
dx: -5
},
y: {
align: "bottom",
dy: -95
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.KRAKENFEAST] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
height: 740,
button: {
y: {
align: "bottom",
dy: -25
}
},
footNote: {
y: {
align: "bottom",
dy: -140
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.BUILDPASS] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
badges: [{
x: {
align: "left",
dx: 66
},
y: {
align: "top",
dy: -11
},
width: 125,
rotation: 10
}]
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.SALEPASS] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
offer: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 210
}
},
badges: [{
x: {
align: "right",
dx: -22
},
y: {
align: "top",
dy: -58
},
width: 125,
rotation: 10
}],
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
unit: {
bppointscrystal: {
x: {
align: "center",
dx: -284
},
y: {
align: "center",
dy: -262
},
width: 250,
font: cleverapps.styles.FONTS.MISSION_OFFER_SALE_REWARD,
rotation: 0
}
},
soft: {
x: {
align: "center",
dx: 273
},
y: {
align: "center",
dy: -262
},
width: 250,
font: cleverapps.styles.FONTS.MISSION_OFFER_SALE_REWARD,
rotation: 0
}
},
person: {
role: "hunter",
emotion: "happy"
},
button: {
x: {
align: "center",
dx: -9
},
y: {
align: "bottom",
dy: -60
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.EXPEDITION] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
button: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -40
}
},
badges: [{
x: {
align: "center",
dx: 613
},
y: {
align: "center",
dy: -250
},
width: 125
}],
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
unit: {
dragonpack: {
delay: .8,
x: {
align: "center",
dx: -440
},
y: {
align: "center",
dy: -370
},
width: 240,
rotation: 4
}
},
hard: {
delay: .8,
x: {
align: "center",
dx: 440
},
y: {
align: "center",
dy: -350
},
width: 240,
rotation: -2
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.DRAGONIA2] = cleverapps.styles.MissionOfferWindow[Offers.TYPES.DRAGONIA3] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
button: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -40
}
},
badges: [{
x: {
align: "center",
dx: 613
},
y: {
align: "center",
dy: -250
},
width: 125
}],
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
unit: {
dr2dragonpack: {
delay: .8,
x: {
align: "center",
dx: -440
},
y: {
align: "center",
dy: -370
},
width: 240,
rotation: 4
}
},
hard: {
delay: .8,
x: {
align: "center",
dx: 440
},
y: {
align: "center",
dy: -350
},
width: 240,
rotation: -2
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.UNDERSEA] = cleverapps.styles.MissionOfferWindow[Offers.TYPES.UNDERSEA2] = cleverapps.styles.MissionOfferWindow[Offers.TYPES.UNDERSEA3] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1600,
button: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -30
}
},
badges: !1,
offer: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 100
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
unit: {
underseapack: {
delay: .8,
x: {
align: "center",
dx: -625
},
y: {
align: "center",
dy: -315
},
width: 240,
rotation: 0
},
sea2pack: {
delay: .8,
x: {
align: "center",
dx: -625
},
y: {
align: "center",
dy: -315
},
width: 240,
rotation: 0
}
},
hard: {
delay: .8,
x: {
align: "center",
dx: 673
},
y: {
align: "center",
dy: -315
},
width: 240,
rotation: 0
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.SNAILFEAST] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1600,
button: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -50
}
},
badges: !1,
offer: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 5
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
unit: {
seasnailhouse: {
delay: .8,
x: {
align: "center"
},
y: {
align: "center",
dy: -325
},
width: 240,
rotation: 0
},
drsnailhouse: {
delay: .8,
x: {
align: "center"
},
y: {
align: "center",
dy: -325
},
width: 240,
rotation: 0
}
}
},
footNote: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -48
},
height: 90
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.BLACKFRIDAY] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1650,
title: {
x: {
align: "center",
dx: 50
},
y: {
align: "center",
dy: 385
},
width: 480,
font: cleverapps.styles.FONTS.MISSION_OFFER_BF_TITLE,
background: void 0
},
offer: {
y: {
align: "center",
dy: 2
}
},
button: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 40
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_BF_REWARD,
unit: {
dr2dragonpack: {
x: {
align: "center"
},
y: {
align: "center",
dy: 20
},
width: 240,
rotation: 0
}
},
hard: {
x: {
align: "center",
dx: 190
},
y: {
align: "center",
dy: -190
},
width: 240,
rotation: 0
},
energy: {
x: {
align: "center",
dx: -190
},
y: {
align: "center",
dy: -190
},
width: 240,
rotation: 0
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.HALLOWEEN] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1650,
offer: {
y: {
align: "center",
dy: 2
}
},
button: {
x: {
align: "center",
dx: -197
},
y: {
align: "bottom",
dy: -20
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
unit: {
dr2dragonpack: {
delay: .8,
x: {
align: "center",
dx: -604
},
y: {
align: "center",
dy: -298
},
width: 240,
rotation: 0
}
},
hard: {
delay: .8,
x: {
align: "center",
dx: 608
},
y: {
align: "center",
dy: -298
},
width: 240,
rotation: 0
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.RAPUNZEL] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1650,
offer: {
y: {
align: "center",
dy: 25
}
},
button: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -50
},
height: 115
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
energy: {
delay: .8,
x: {
align: "center",
dx: -477
},
y: {
align: "center",
dy: -365
},
width: 240,
rotation: 0
},
hard: {
delay: .8,
x: {
align: "center",
dx: 477
},
y: {
align: "center",
dy: -365
},
width: 240,
rotation: 0
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.RAPUNZEL3] = cleverapps.styles.MissionOfferWindow[Offers.TYPES.RAPUNZEL2] = cleverapps.styles.MissionOfferWindow[Offers.TYPES.RAPUNZEL];
cleverapps.styles.MissionOfferWindow[Offers.TYPES.XMAS] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1650,
offer: {
y: {
align: "center",
dy: -70
}
},
button: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -20
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
unit: {
xmpack: {
delay: .8,
x: {
align: "center",
dx: -609
},
y: {
align: "center",
dy: -268
},
width: 240,
rotation: 0
}
},
hard: {
delay: .8,
x: {
align: "center",
dx: 621
},
y: {
align: "center",
dy: -268
},
width: 240,
rotation: 0
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.EASTER] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1650,
offer: {
y: {
align: "center",
dy: 25
}
},
button: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -50
},
height: 115
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
energy: {
delay: .8,
x: {
align: "center",
dx: -477
},
y: {
align: "center",
dy: -365
},
width: 240,
rotation: 0
},
hard: {
delay: .8,
x: {
align: "center",
dx: 477
},
y: {
align: "center",
dy: -365
},
width: 240,
rotation: 0
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.CHINA] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
button: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -40
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_REWARD2,
energy: {
delay: .8,
x: {
align: "center",
dx: -544
},
y: {
align: "center",
dy: -395
},
width: 240,
rotation: 5
},
hard: {
delay: .8,
x: {
align: "center",
dx: 573
},
y: {
align: "center",
dy: -372
},
width: 240,
rotation: -2
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.CLPASS] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: 1400,
title: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 325
},
width: 600,
font: cleverapps.styles.FONTS.MISSION_OFFER_ENERGY_TITLE,
background: void 0
},
person: {
role: "seller",
emotion: "idle"
},
button: {
width: 320,
y: {
align: "bottom",
dy: -80
},
label: {
x: {
align: "right",
dx: 134
},
y: {
align: "top",
dy: 32
},
text: {
x: {
align: "center",
dx: 18
},
y: {
align: "center",
dy: 5
},
margin: -10,
width: 180,
height: 110,
rotation: 34
}
}
},
rewards: {
font: cleverapps.styles.FONTS.MISSION_OFFER_CLPASS_REWARD,
hard: {
x: {
align: "center",
dx: -573
},
y: {
align: "center",
dy: -220
}
},
soft: {
x: {
align: "center",
dx: 195
},
y: {
align: "center",
dy: -340
}
},
unit: {
crystal: {
x: {
align: "center",
dx: 560
},
y: {
align: "center",
dy: -240
}
},
clsack: {
x: {
align: "center",
dx: -213
},
y: {
align: "center",
dy: -340
}
}
}
}
}, !0);
cleverapps.styles.MissionOfferWindow[Offers.TYPES.PINBALL_PACK] = cleverapps.overrideStyles(cleverapps.styles.MissionOfferWindowTemplate, {
width: [800, 1200, 1400],
title: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 325
},
width: 600,
font: cleverapps.styles.FONTS.MISSION_OFFER_ENERGY_TITLE,
background: void 0
},
person: void 0,
button: {
width: 320,
y: {
align: "bottom",
dy: -80
}
},
rewards: {
delay: .45,
font: cleverapps.styles.FONTS.LARGE_WHITE_TEXT,
pinballChips: [{
x: {
align: "center",
dx: 100
},
y: {
align: "center",
dy: 10
}
}, {
x: {
align: "center",
dx: 368
},
y: {
align: "center",
dy: 40
}
}, {
x: {
align: "center",
dx: 368
},
y: {
align: "center",
dy: 40
}
}],
boosters11: [{
x: {
align: "center",
dx: -110
},
y: {
align: "center",
dy: -235
}
}, {
x: {
align: "center",
dx: 160
},
y: {
align: "center",
dy: -190
}
}, {
x: {
align: "center",
dx: 160
},
y: {
align: "center",
dy: -190
}
}],
boosters12: [{
x: {
align: "center",
dx: 125
},
y: {
align: "center",
dy: -250
}
}, {
x: {
align: "center",
dx: 400
},
y: {
align: "center",
dy: -210
}
}, {
x: {
align: "center",
dx: 400
},
y: {
align: "center",
dy: -210
}
}]
}
}, !0);
var MissionOfferLogic = function(a) {
this.offer = a;
a = Offers[a.type];
this.mission = a.mission;
this.hero = a.hero;
this.product = a.product;
this.price = a.price;
this.reward = a.reward;
this.onBought = function() {}
};
MissionOfferLogic.prototype.getProduct = function() {
return this.product ? Product.CreateById(this.product, {
type: "mission_offer",
offer: this.offer.type
}) : Product.CreateByHardPrice(this.price, {
type: "mission_offer",
offer: this.offer.type
})
}
;
MissionOfferLogic.prototype.isIconAvailable = function() {
var a = Mission.GetParentType(this.mission) || Mission.GetChildType(this.mission)
, b = Missions[a];
if (!b)
return !1;
var c = cleverapps.travelBook.getCurrentExpedition();
return c ? c.missionType === a || c.id === b.expedition : !cleverapps.travelBook.getPageById(b.id)
}
;
MissionOfferLogic.prototype.hasIconAttention = function() {
return !1
}
;
MissionOfferLogic.prototype.getPriceText = function() {
return this.getProduct().getCurrentPrice()
}
;
MissionOfferLogic.prototype.getTimeLeft = function() {
var a = cleverapps.missionManager.findByType(this.mission);
return a && a.getTimeLeft() || 0
}
;
MissionOfferLogic.prototype.isAvailable = function() {}
;
MissionOfferLogic.prototype.buy = function() {
if (this.reward.unit) {
var a = this.reward.unit.reduce(function(b, c) {
return b + (c.amount || 0)
}, 0) - Map2d.currentMap.countEmptySlots();
if (0 < a) {
cleverapps.centerHint.createTextHint("Spawn.nospace", {
left: a
});
return
}
}
this.getProduct().buy(this.processBought.bind(this), {
noRewardWindow: !0
})
}
;
MissionOfferLogic.prototype.processBought = function(a) {
a && (new RewardWindow(this.reward,{
event: cleverapps.EVENTS.EARN.PURCHASE
}),
cleverapps.eventLogger.logEvent(this.offer.name + "_" + cleverapps.EVENTS.OFFER_LOT),
this.offer.complete(),
this.onBought())
}
;
MissionOfferLogic.RestoreExpeditionId = function(a) {
return cleverapps.offerManager.getOfferExpedition(a.offer)
}
;
MissionOfferLogic.RestoreActions = function(a, b) {
var c = cleverapps.offerManager.findOffer({
type: a.offer
});
if (c)
return [function(d) {
b();
c.logic.processBought(!0);
cleverapps.focusManager.onceNoWindowsListener = d
}
]
}
;
Product.RESTORE_LOGIC.mission_offer = MissionOfferLogic;
var PackOfferLogic = function(a) {
this.offer = a
};
PackOfferLogic.prototype.getStage = function() {
return this.offer.stage || 0
}
;
PackOfferLogic.prototype.getProduct = function() {
return Product.CreateById(PackOfferLogic.Products[this.getStage()])
}
;
PackOfferLogic.prototype.getTimeLeft = function() {}
;
PackOfferLogic.prototype.isIconAvailable = function() {
return !0
}
;
PackOfferLogic.prototype.hasIconAttention = function() {
return !1
}
;
PackOfferLogic.prototype.processBought = function() {
this.offer.incStage();
this.offer.complete()
}
;
PackOfferLogic.Products = ["starterPack0", "starterPack", "starterPack2"];
var PackWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.logic = a.logic;
a = this.logic.getProduct();
var b = cleverapps.styles.PackWindow
, c = b.button;
c.text = a.getCurrentPrice();
c.onPressed = function() {
this.buyPackProduct()
}
.bind(this);
var d = this.generateContent(a);
this._super({
name: "packwindow",
title: b.title ? {
text: a.title,
margin: {
x: 0,
y: b.title.margin.y
},
font: cleverapps.styles.FONTS.PACKWINDOW_TITLE_TEXT
} : "",
content: d,
button: c,
styles: b,
notCloseByTouchInShadow: !0,
closeButtonDelay: !0
});
Lottery.addIcon(this.buttons);
Lottery.addText(this);
cleverapps.fallSale.isAvailable() && this.buttons.addChild(new FallSaleIcon);
b.button.delay && (this.buttons.setVisible(!1),
this.buttons.setScale(0),
this.buttons.runAction(new cc.Sequence(new cc.DelayTime(b.button.delay),new cc.Show,new cc.ScaleTo(.2,1))));
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this);
this.updateButton()
},
updateButton: function() {
connector.payments.isConnected() ? this.buttons.enable() : this.buttons.disable()
},
getPerson: function() {
return "merge" === cleverapps.config.type && {
role: "king",
emotion: "happy"
}
},
onShow: function() {
this._super();
var a = cleverapps.styles.PackWindow
, b = this.content;
this.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.PlaySound(bundles.starter_pack.urls.starter_pack_effect)));
b.rewards && b.rewards.children.forEach(function(c) {
c.setOpacity(0);
c.runAction(new cc.Sequence(new cc.DelayTime(a.rewards.delay || 0),new cc.FadeIn(a.rewards.duration || 0)))
});
b.discountLabel && (b.discountLabel.setOpacity(0),
b.discountLabel.runAction(new cc.Sequence(new cc.DelayTime(a.discountLabel.delay || 0),new cc.FadeIn(a.discountLabel.duration || 0))));
b.title && (b.title.setOpacity(0),
b.title.runAction(new cc.Sequence(new cc.DelayTime(a.Title.delay || 0),new cc.FadeIn(a.Title.duration || 0))))
},
generateContent: function(a) {
var b = cleverapps.styles.PackWindow
, c = this.content = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setPositionRound({
align: "center"
}, {
align: "center"
});
b.animation && (c.animation = this.generateAnimation(a, b.animation),
c.setContentSize2(c.animation.getContentSize()),
c.addChild(c.animation));
b.rewards && (c.rewards = this.generateRewards(a, b.rewards),
c.addChild(c.rewards));
b.discountLabel && (c.discountLabel = this.generateText("-70%", b.discountLabel),
c.addChild(c.discountLabel));
b.Title && (c.title = this.generateText(a.title, b.Title),
c.addChild(c.title));
return c
},
applyTextStyles: function(a, b) {
b.fitTo && a.fitTo(b.fitTo.width, b.fitTo.height);
b.lineHeight && a.setLineHeight && a.setLineHeight(b.lineHeight)
},
generateAnimation: function(a, b) {
b = Object.assign({}, b["default"] || {}, b[a.itemId] || {});
a = new cleverapps.Spine(bundles.starter_pack.jsons.pack_json);
a.setPositionRound({
align: "center",
dx: b.dx || 0
}, {
align: "center",
dy: b.dy || 0
});
b.introAnimation ? a.setAnimationAndIdleAfter(b.introAnimation, b.idleAnimation) : a.setAnimation(0, b.idleAnimation, !0);
return a
},
generateText: function(a, b) {
a = cleverapps.UI.generateTTFText(a, cleverapps.styles.FONTS.PACKWINDOW_TEXT);
this.applyTextStyles(a, b);
a.setAnchorPoint(.5, .5);
a.setPositionRound({
align: "center",
dx: b.dx || 0
}, {
align: "center",
dy: b.dy || 0
});
return a
},
generateRewards: function(a, b) {
b = cleverapps.clone(b);
var c = Object.assign({}, b.positions["default"] || {}, b.positions[a.itemId] || {})
, d = new cc.Node;
d.setAnchorPoint(.5, .5);
d.setPositionRound({
align: "center"
}, {
align: "center"
});
var e = function(l, n) {
l = cleverapps.UI.generateTTFText(l, cleverapps.styles.FONTS.PACKWINDOW_LABEL_TEXT);
n.rotation && l.setRotation(n.rotation);
this.applyTextStyles(l, b);
l.setAnchorPoint(.5, .5);
l.setPositionRound(n);
d.addChild(l)
}, f;
for (f in a.reward) {
var g = a.reward[f]
, h = c[f];
if (void 0 !== h)
if ("boosters" === f)
for (var k in g) {
var m = h[k];
void 0 !== m && e.call(this, "x" + g[k], m)
}
else
"unlimitedLives" === f || "worker" === f ? e.call(this, Product.FormatTimePeriod(g).title, h) : "troopCards" === f ? e.call(this, "x" + g.amount, h) : e.call(this, "x" + g, h)
}
return d
},
buyPackProduct: function() {
this.logic.getProduct().buy(function(a) {
a && (this.closed || this.close(),
this.logic.processBought())
}
.bind(this))
}
});
PackWindow.prototype.listBundles = function() {
return ["starter_pack"]
}
;
cleverapps.styles.COLORS = cleverapps.overrideColors(cleverapps.styles.COLORS, {
PACKWINDOW_TITLE_SHADOW: new cc.Color(0,0,0,100)
});
cleverapps.styles.DECORATORS = cleverapps.overrideStyles(cleverapps.styles.DECORATORS, {
PACKWINDOW_TITLE_STROKE: {
size: 1,
color: cleverapps.styles.COLORS.PACKWINDOW_TITLE_SHADOW
},
PACKWINDOW_LABEL_STROKE: {
color: cleverapps.styles.COLORS.BLACK,
size: 3
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PACKWINDOW_TITLE_TEXT: {
size: 70,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.PACKWINDOW_TITLE_STROKE
},
PACKWINDOW_LABEL_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.PACKWINDOW_LABEL_STROKE
},
PACKWINDOW_TEXT: {
name: "big_digits",
size: 80,
color: cleverapps.styles.COLORS.WHITE,
stroke: {
color: new cc.Color(85,1,91),
size: 3
},
shadow: {
color: new cc.Color(85,1,91),
direction: cc.size(0, -5),
blur: 1
}
}
});
cleverapps.styles.PackWindow = {
noBackground: !0,
title: void 0,
button: {
width: 300,
height: 100,
x: 0,
y: 50
},
Title: void 0,
discountLabel: void 0,
animation: void 0,
rewards: void 0
};
var BlackFridayOfferLogic = function(a) {
this.offer = a;
this.reward = Offers[a.type].reward;
this.onBought = function() {}
};
BlackFridayOfferLogic.prototype.getStage = function() {
return this.offer.stage || 0
}
;
BlackFridayOfferLogic.prototype.getProduct = function() {
if (0 === this.getStage())
return Product.CreateById("kit10", {
type: "blackfriday_offer",
offer: this.offer.type
})
}
;
BlackFridayOfferLogic.prototype.getPriceText = function() {
var a = this.getProduct();
return a && a.getCurrentPrice()
}
;
BlackFridayOfferLogic.prototype.getTimeLeft = function() {
var a = cleverapps.eventManager.getFeatureEvent("blackfriday_offer_main");
return a && a.getTimeLeft() || 0
}
;
BlackFridayOfferLogic.prototype.isIconAvailable = function() {
return !0
}
;
BlackFridayOfferLogic.prototype.hasIconAttention = function() {
return !1
}
;
BlackFridayOfferLogic.prototype.buy = function() {
if (this.reward.unit) {
var a = this.reward.unit.reduce(function(b, c) {
return b + (c.amount || 0)
}, 0) - Map2d.currentMap.countEmptySlots();
if (0 < a) {
cleverapps.centerHint.createTextHint("Spawn.nospace", {
left: a
});
return
}
}
this.getProduct().buy(this.processBought.bind(this), {
noRewardWindow: !0
})
}
;
BlackFridayOfferLogic.prototype.processBought = function(a) {
a && (new RewardWindow(this.reward,{
event: cleverapps.EVENTS.EARN.PURCHASE
}),
cleverapps.eventLogger.logEvent(this.offer.name + "_" + cleverapps.EVENTS.OFFER_LOT),
this.offer.incStage(),
this.offer.complete(),
this.onBought())
}
;
BlackFridayOfferLogic.RestoreExpeditionId = function(a) {
return cleverapps.offerManager.getOfferExpedition(a.offer)
}
;
BlackFridayOfferLogic.RestoreActions = function(a, b) {
var c = cleverapps.offerManager.findOffer({
type: a.offer
});
if (c)
return [function(d) {
b();
c.logic.processBought(!0);
cleverapps.focusManager.onceNoWindowsListener = d
}
]
}
;
Product.RESTORE_LOGIC.blackfriday_offer = BlackFridayOfferLogic;
var AppTracking = function() {
connector.platform.subscribeNative("AppTracking", this.onNativeEvent.bind(this))
};
AppTracking.prototype.askPermission = function(a) {
AppTracking.isApplicable() ? connector.platform.callNative("AppTrackingPlugin.askPermissions", function(b, c) {
b = c.value;
console.log("AppTracking setStatus " + typeof b + " - " + b);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.APP_TRACKING + b);
a()
}) : a()
}
;
AppTracking.prototype.onNativeEvent = function(a) {
console.log("AppTracking.onNativeEvent - " + a);
switch (a) {
case "inactiveState":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.APP_TRACKING + "inactive")
}
}
;
AppTracking.isApplicable = function() {
return connector.platform.oneOf(connector.IOS, connector.MACOS)
}
;
AppTracking.PERMISSIONS = {
NOT_DETERMINED: 0,
RESTRICTED: 1,
DENIED: 2,
AUTHORIZED: 3
};
var ConsentTcfApi = {
callbacks: {},
cmpFrame: void 0,
queue: [],
init: function() {
cleverapps.isIFrame() && connector.platform.oneOf(connector.CLEVERAPPS) && !window.__tcfapi && (window.__tcfapi = this.__tcfapi.bind(this),
window.addEventListener("message", this.postMessageHandler.bind(this), !1),
this.connect())
},
__tcfapi: function(a, b, c, d) {
cleverapps.config.debugMode && console.log("tcfapi call", a, b, d);
if (this.cmpFrame = this.cmpFrame || this.getCmpFrame()) {
var e = a + Math.floor(1E15 * Math.random());
a = {
__tcfapiCall: {
command: a,
parameter: d,
version: b,
callId: e
}
};
this.callbacks[e] = c;
this.cmpFrame.postMessage(a, "*")
} else
this.queue.push({
command: a,
version: b,
callback: c,
parameter: d
}),
this.queue.length > ConsentTcfApi.QUEUE_LIMIT && this.queue.shift().callback({
msg: "CMP not found"
}, !1)
},
postMessageHandler: function(a) {
var b = {};
try {
b = "string" === typeof a.data ? JSON.parse(a.data) : a.data
} catch (c) {}
b = (a = b.__tcfapiReturn) && this.callbacks[a.callId];
cleverapps.config.debugMode && a && console.log("tcfapi event data", a);
b && b(a.returnValue, a.success)
},
connect: function(a) {
if (this.cmpFrame = this.cmpFrame || this.getCmpFrame()) {
a = this.queue;
this.queue = [];
for (var b = 0; b < a.length; b++)
this.__tcfapi(a[b].command, a[b].version, a[b].callback, a[b].parameter)
} else
a = a || 0,
cleverapps.timeouts.setTimeout(this.connect.bind(this, a + 1), Math.min(Math.pow(2, a), cleverapps.parseInterval("1 minute")))
},
getCmpFrame: function() {
for (var a = window; a; ) {
try {
if (a.frames.__tcfapiLocator)
return a
} catch (b) {}
if (a === window.top)
break;
a = a.parent
}
},
QUEUE_LIMIT: 20
};
cleverapps.LocalPushes = function() {
this.initSender();
this.load();
this.queue = {};
this.initialized = !1;
connector.platform.subscribeNative("LocalPushes", this.onNativeEvent.bind(this));
cleverapps.config.debugMode && this.soonestCheck()
}
;
cleverapps.LocalPushes.prototype.soonestCheck = function() {
var a = {
when: Date.now() + cleverapps.parseInterval("100 days")
};
this._soonestCheck = cleverapps.timeouts.setInterval(function() {
var b = Date.now();
for (c in this.data)
a.when > this.data[c].when && this.data[c].when >= b && (a = Object.assign({
id: c
}, this.data[c]));
if (1E3 >= a.when - b && void 0 !== a.id) {
b = cleverapps.LocalPushes.GetTypeById(a.id);
b = cleverapps.LocalPushes.GetPushData(b);
var c = cleverapps.intervalToString(a.inSessionTime);
var d = cleverapps.intervalToString(a.timeout);
console.log("First push " + a.id + ": " + b.text, c + "@" + d);
cleverapps.timeouts.clearInterval(this._soonestCheck)
}
}
.bind(this), 1E3)
}
;
cleverapps.LocalPushes.prototype.processQueue = function() {
var a = this.queue, b;
for (b in a) {
var c = a[b]
, d = cleverapps.LocalPushes.GetTypeById(b);
d && this.sendPush(d, c)
}
this.queue = {}
}
;
cleverapps.LocalPushes.prototype.askPermission = function(a) {
(new ActionPlayer([this._askPermission.bind(this), function(b) {
a();
cleverapps.whenAllInitialized(b)
}
, function(b) {
this.initialize();
b()
}
.bind(this)])).play()
}
;
cleverapps.LocalPushes.prototype._askPermission = function(a) {
if (this.sender && this.sender.askPermissions) {
var b = {};
this.requestTime + cleverapps.LocalPushes.REQUEST_INTERVAL < Date.now() && (this.requestTime = Date.now(),
this.save(),
b.withRequest = !0);
this.sender.askPermissions(b, function(c, d) {
c === cleverapps.CODE_SUCCEED && this.setPermitted(d);
a()
}
.bind(this))
} else
a()
}
;
cleverapps.LocalPushes.prototype.setPermitted = function(a) {
this.permitted !== a && (this.permitted = a,
this.save())
}
;
cleverapps.LocalPushes.prototype.initialize = function() {
this.initialized = !0;
this.processQueue();
this.onShow();
this.sendWelcome()
}
;
cleverapps.LocalPushes.prototype.sendWelcome = function() {
if (cleverapps.user.isFirstSession() && (connector.platform.oneOf(connector.DISCORD) ? cleverapps.ABTest.DISCORD_NOTIFICATIONS_WELCOME() || cleverapps.ABTest.DISCORD_NOTIFICATIONS_ALL() : cleverapps.ABTest.WELCOME())) {
var a = cleverapps.parseInterval("5 minutes")
, b = 0
, c = function() {
b = Date.now();
this.sendPush(cleverapps.LocalPushes.TYPES.WELCOME, a)
}
.bind(this);
connector.social.on("login", c);
c();
cleverapps.timeouts.setInterval(function() {
b + a > Date.now() && c()
}, cleverapps.parseInterval("2 minutes"))
}
}
;
cleverapps.LocalPushes.prototype.onShow = cleverapps.throttle(1E3, function() {
this.sender && Object.keys(cleverapps.LocalPushes.TYPES).forEach(function(a) {
if (a.startsWith("LETS_PLAY_")) {
var b = a.replace("LETS_PLAY_", "") + " days";
this.sendPush(cleverapps.LocalPushes.TYPES[a], cleverapps.parseInterval(b))
}
}
.bind(this))
});
cleverapps.LocalPushes.prototype.initSender = function() {
var a = [MicrosoftSender, MSStartSender, WebViewSender, SocialSender];
"undefined" !== typeof FakeSender && a.push(FakeSender);
for (var b = 0; b < a.length; b++)
if (a[b].isAppropriate()) {
this.sender = new a[b];
break
}
a = (cleverapps.LocalPushes.GetSenderBySource(connector.info.source) || {}).days || 30;
this.maxTimeout = cleverapps.parseInterval(a + 1 + " days")
}
;
cleverapps.LocalPushes.prototype.reset = function() {
this.onShow();
for (var a in this.data) {
var b = cleverapps.LocalPushes.GetTypeById(a);
b && this.cancelPush(b)
}
}
;
cleverapps.LocalPushes.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.LOCAL_PUSHES) || {};
this.permitted = a.permitted;
this.requestTime = a.requestTime || 0;
a = cleverapps.clone(a);
delete a.permitted;
this.data = a
}
;
cleverapps.LocalPushes.prototype.save = function() {
var a = cleverapps.clone(this.data);
a.permitted = this.permitted;
a.requestTime = this.requestTime;
cleverapps.dataLoader.save(DataLoader.TYPES.LOCAL_PUSHES, a)
}
;
cleverapps.LocalPushes.prototype.sendPush = function(a, b) {
if (this.sender && (!connector.platform.oneOf(connector.DISCORD) || -1 !== [cleverapps.LocalPushes.TYPES.WELCOME, cleverapps.LocalPushes.TYPES.ORDER_READY, cleverapps.LocalPushes.TYPES.BUILDING_BUILT].indexOf(a))) {
var c = a.id;
if (this.initialized) {
this.sender.getId && (c = this.sender.getId(a));
b = b || 0;
var d = this.data[c] ? this.data[c].when : 0
, e = b ? Date.now() + b : 0;
Math.abs(d - e) < cleverapps.LocalPushes.ONE_MINUTE || this.maxTimeout <= b || (b < cleverapps.LocalPushes.TIMEOUT_THRESHOLD ? d && this.cancelPush(a) : (d = {
when: e
},
this._soonestCheck && (d.timeout = b,
d.inSessionTime = Date.now() - cleverapps.user.visited),
this.sender.sendPush(a, b) && (this.data[c] = d,
this.save())))
} else
this.queue[c] = b
}
}
;
cleverapps.LocalPushes.prototype.cancelPush = function(a) {
if (this.sender) {
var b = a.id;
delete this.queue[b];
this.sender.getId && (b = this.sender.getId(a));
this.data[b] && (this.data[b].when && (this.data[b].when > Date.now() ? this.sender.cancelPush(a) : this.logSendEvent(a)),
delete this.data[b],
this.save())
}
}
;
cleverapps.LocalPushes.prototype.logSendEvent = function(a) {
connector.platform.oneOf(connector.RUSTORE, connector.AMAZON, connector.ANDROID, connector.PLIEGA, connector.IOS, connector.MACOS, connector.MSSTART, connector.MICROSOFT) && (a = a && a.code) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PUSHES.SEND + a)
}
;
cleverapps.LocalPushes.prototype.onNativeEvent = function(a, b) {
console.log("LocalPushes.onNativeEvent - " + a);
switch (a) {
case "clickEvent":
this.logClickEvent(b.code)
}
}
;
cleverapps.LocalPushes.prototype.logClickEvent = function(a) {
console.log("LocalPushes.logClickEvent " + a);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PUSHES.CLICK + a);
cleverapps.config.debugMode && cleverapps.timeouts.setTimeout(function() {
cleverapps.notification.create("Source Push: " + a)
}, 5E3)
}
;
cleverapps.LocalPushes.GetPushData = function(a) {
var b = Messages.get(a.message);
a = Messages.get(a.title, {
gameTitle: Messages.get(cleverapps.config.title)
});
Array.isArray(b) || (b = [b]);
Array.isArray(a) || (a = [a]);
var c = cleverapps.Random.random(0, b.length - 1);
return {
text: b[c],
title: a[c] || cleverapps.Random.mathChoose(a),
index: c
}
}
;
cleverapps.LocalPushes.TYPES = {
BONUS_ROUND: {
id: 2,
title: "LocalPushes.BONUS_ROUND.Title",
message: "LocalPushes.BONUS_ROUND"
},
LIVES: {
id: 3,
title: "LocalPushes.LIVES.Title",
message: "LocalPushes.LIVES",
pushImg: "lives.jpg"
},
MINI_GAME: {
id: 4,
title: "LocalPushes.MINI_GAME.Title",
message: "LocalPushes.MINI_GAME"
},
LETS_PLAY_1: 5,
FREE_CHEST: {
id: 6,
title: "LocalPushes.FREE_CHEST.Title",
message: "LocalPushes.FREE_CHEST"
},
ENERGY_LOTTERY: {
id: 7,
title: "LocalPushes.LIVES_LOTTERY.Title",
message: "LocalPushes.LIVES_LOTTERY"
},
FRUIT_RIPE: {
id: 8,
title: "LocalPushes.FRUIT_RIPE.Title",
message: "LocalPushes.FRUIT_RIPE"
},
CASTLE_PRIZE: {
id: 9,
title: "LocalPushes.CASTLE_PRIZE.Title",
message: "LocalPushes.CASTLE_PRIZE"
},
ORDER_READY: {
id: 10,
title: "LocalPushes.ORDER_READY.Title",
message: "LocalPushes.ORDER_READY",
pushImg: "order_ready.jpg"
},
TREE_CHOPPED: {
id: 11,
title: "LocalPushes.TREE_CHOPPED.Title",
message: "LocalPushes.TREE_CHOPPED",
pushImg: "tree_chopped.jpg"
},
BUILDING_BUILT: {
id: 12,
title: "LocalPushes.BUILDING_BUILT.Title",
message: "LocalPushes.BUILDING_BUILT",
pushImg: "building_built.jpg"
},
MAGIC_PLANT_READY: {
id: 13,
title: "LocalPushes.MAGIC_PLANT_READY.Title",
message: "LocalPushes.MAGIC_PLANT_READY"
},
MINI_GAME_PRIZE: {
id: 14,
title: "LocalPushes.MINI_GAME_PRIZE.Title",
message: "LocalPushes.MINI_GAME_PRIZE"
},
DAILY_TASKS_UNCOMPLETED: {
id: 15,
title: "LocalPushes.DAILY_TASKS_UNCOMPLETED.Title",
message: "LocalPushes.DAILY_TASKS_UNCOMPLETED"
},
PASS_UNCOMPLETED: {
id: 16,
title: "LocalPushes.PASS_UNCOMPLETED.Title",
message: "LocalPushes.PASS_UNCOMPLETED"
},
PUMPKIN_RIPE: {
id: 17,
title: "LocalPushes.PUMPKIN_RIPE.Title",
message: "LocalPushes.PUMPKIN_RIPE"
},
UNITLOCK_OPEN: {
id: 18,
title: "LocalPushes.UNITLOCK_OPEN.Title",
message: "LocalPushes.UNITLOCK_OPEN",
pushImg: "unitlock_open.jpg"
},
EXPEDITION: {
id: 19,
title: "LocalPushes.EXPEDITION.Title",
message: "LocalPushes.EXPEDITION",
pushImg: "expedition.jpg"
},
EXPEDITION_TREE_CHOPPED: {
id: 20,
title: "LocalPushes.EXPEDITION_TREE_CHOPPED.Title",
message: "LocalPushes.EXPEDITION_TREE_CHOPPED",
pushImg: "tree_chopped.jpg"
},
EXPEDITION_PERIODIC: {
id: 21,
title: "LocalPushes.EXPEDITION_PERIODIC.Title",
message: "LocalPushes.EXPEDITION_PERIODIC",
pushImg: "expedition.jpg"
},
LETS_PLAY_2: 22,
LETS_PLAY_3: 23,
LETS_PLAY_4: 24,
LETS_PLAY_5: 25,
WELCOME: {
id: 26,
title: "LocalPushes.WELCOME.Title",
message: "LocalPushes.WELCOME"
}
};
(function() {
Object.keys(cleverapps.LocalPushes.TYPES).forEach(function(c) {
c.startsWith("LETS_PLAY_") && (cleverapps.LocalPushes.TYPES[c] = {
id: cleverapps.LocalPushes.TYPES[c],
title: "LocalPushes.LETS_PLAY.Title",
message: "LocalPushes.LETS_PLAY"
})
});
cleverapps.LocalPushes.TypesById = {};
for (var a in cleverapps.LocalPushes.TYPES) {
var b = cleverapps.LocalPushes.TYPES[a];
b.code = a.toLowerCase();
cleverapps.LocalPushes.TypesById[b.id] = b
}
}
)();
cleverapps.LocalPushes.GetTypeById = function(a) {
return cleverapps.LocalPushes.TypesById[a]
}
;
cleverapps.LocalPushes.GetTypeByCode = function(a) {
return a && a.toUpperCase && cleverapps.LocalPushes.TYPES[a.toUpperCase()]
}
;
cleverapps.LocalPushes.ONE_MINUTE = cleverapps.parseInterval("1 minute");
cleverapps.LocalPushes.TIMEOUT_THRESHOLD = cleverapps.parseInterval("3 minutes");
cleverapps.LocalPushes.REQUEST_INTERVAL = cleverapps.parseInterval("7 days");
"undefined" === typeof cc && (module.exports = cleverapps.LocalPushes);
cleverapps.LocalPushes.SENDERS = {
fb: {
sources: ["facebook"],
mass: 1E4,
days: 10,
rate: {
playReset: !0,
limit: 5,
interval: cleverapps.parseInterval("10 days")
}
},
mw: {
sources: ["mm"],
mass: 1E4,
rate: {
limit: 1,
interval: cleverapps.parseInterval("3 days")
}
},
ok: {
sources: ["ok"],
length: 100,
days: 14,
rate: {
limit: 5,
interval: cleverapps.parseInterval("1 day")
}
},
vk: {
sources: ["vk"],
mass: 1E5,
rate: {
limit: 1,
interval: cleverapps.parseInterval("8 hours")
}
},
ya: {
sources: ["yandex"]
},
in: {
sources: ["instant"],
mass: 1E5,
days: 10,
rate: {
playReset: !0,
limit: 5,
interval: cleverapps.parseInterval("10 days")
}
},
mb: {
sources: ["mbga", "sp_mbga"],
mass: 1E4
},
kg: {
sources: ["kongregate"]
},
dc: {
sources: ["discord"]
}
};
(function() {
for (var a in cleverapps.LocalPushes.SENDERS) {
var b = cleverapps.LocalPushes.SENDERS[a];
b.code = a;
b.days = b.days || 30
}
}
)();
cleverapps.LocalPushes.GetSenderBySource = function(a) {
for (var b in cleverapps.LocalPushes.SENDERS) {
var c = cleverapps.LocalPushes.SENDERS[b];
if (c.sources.includes(a))
return c
}
}
;
cleverapps.LocalPushes.GetPushUserId = function(a, b) {
return (b = cleverapps.LocalPushes.GetSenderBySource(b)) ? b.code + "_" + a : a
}
;
"undefined" === typeof cc && (module.exports = cleverapps.LocalPushes.SENDERS);
var WebViewSender = function() {};
WebViewSender.prototype.sendPush = function(a, b) {
var c = cleverapps.LocalPushes.GetPushData(a)
, d = a.id
, e = a.code
, f = c.title
, g = c.text;
if (g && f)
return connector.platform.callNative("LocalPushesPlugin.sendPush", {
id: d,
title: f,
message: g,
timeout: b,
code: e
}),
!0;
cleverapps.throwAsync("empty push - " + d + "\ninfo: " + JSON.stringify(a) + "\ndata: " + JSON.stringify(c) + "\nMessages length: " + Messages && Messages.dictionary && Object.keys(Messages.dictionary).length)
}
;
WebViewSender.prototype.cancelPush = function(a) {
connector.platform.callNative("LocalPushesPlugin.cancelPush", {
id: a.id,
code: a.code
})
}
;
WebViewSender.prototype.askPermissions = function(a, b) {
connector.platform.callNative("LocalPushesPlugin.askPermissions", a, function(c, d) {
b(c, !(!d || !d.permitted))
})
}
;
WebViewSender.isAppropriate = function() {
return connector.platform.oneOf(connector.AMAZON, connector.ANDROID, connector.PLIEGA, connector.RUSTORE, connector.IOS, connector.MACOS)
}
;
var SocialSender = function() {
this.batch = {};
this.sendBatch = cleverapps.accumulate(cleverapps.parseInterval("10 seconds"), this._sendBatch.bind(this))
};
SocialSender.prototype._sendBatch = function() {
var a = cleverapps.config.deployment + "/" + cleverapps.config.name + "-push/sendBatch"
, b = this.batch
, c = {
userId: cleverapps.LocalPushes.GetPushUserId(connector.platform.getUserID(), connector.info.source),
language: cleverapps.settings.language,
batch: b
};
this.batch = {};
console.log("Sending batch - ", b);
cleverapps.RestClient.post(a, c, function() {
console.log("Success push", b)
}, function() {
console.log("Failure push", b)
}, {
fullPath: !0
})
}
;
SocialSender.prototype.sendPush = function(a, b) {
if (!connector.platform.withTmpID()) {
var c = a.code.toUpperCase();
if (!connector.platform.oneOf(connector.YANDEX) || void 0 !== cleverapps.YandexPushesMap[cleverapps.config.name][c])
return this.batch[a.id] = Math.floor(b / 1E3),
this.sendBatch(),
!0
}
}
;
SocialSender.prototype.cancelPush = function(a) {
connector.platform.withTmpID() || (this.batch[a.id] = 0,
this.sendBatch())
}
;
SocialSender.isAppropriate = function() {
return connector.platform.oneOf(connector.YANDEX) ? cleverapps.YandexPushesMap[cleverapps.config.name] : connector.platform.oneOf(connector.OK, connector.FACEBOOK, connector.INSTANT, connector.KONGREGATE, connector.MOBAGE, connector.MM, connector.VK, connector.DISCORD)
}
;
var MicrosoftSender = function() {};
MicrosoftSender.prototype.sendPush = function(a, b) {
var c = cleverapps.LocalPushes.GetPushData(a)
, d = c.title;
c = c.text;
var e = a.id;
if (c)
return connector.platform.callNative("localPushes.send", {
title: d,
message: c,
timeout: b,
id: "" + e
}),
!0;
cleverapps.throwAsync("empty microsoft push - " + a.code)
}
;
MicrosoftSender.prototype.cancelPush = function(a) {
console.log("Cancel push - " + a.code);
connector.platform.callNative("localPushes.cancel", {
id: "" + a.id
})
}
;
MicrosoftSender.isAppropriate = function() {
return connector.platform.oneOf(connector.MICROSOFT)
}
;
var MSStartSender = function() {};
MSStartSender.prototype.sendPush = function(a, b) {
if (connector.platform.isConnected()) {
b > cleverapps.parseInterval("7 days") && (b = cleverapps.parseInterval("7 days"));
var c = cleverapps.LocalPushes.GetPushData(a)
, d = c.title;
c = c.text;
var e = this.getId(a)
, f = JSON.stringify({
push_code: a.code
});
if (c)
return $msstart.scheduleNotificationAsync({
title: d,
description: c,
type: e,
image: void 0,
payload: f,
minDelayInSeconds: Math.round(b / 1E3),
callToAction: void 0
}).then(function(g) {
console.log("MSStartSender - " + g)
}).catch(function(g) {
console.log("MSStartSender error - " + JSON.stringify(g))
}),
!0;
cleverapps.throwAsync("empty msstart push - " + a.code)
}
}
;
MSStartSender.prototype.cancelPush = function() {}
;
MSStartSender.prototype.getId = function(a) {
return a.id % 16
}
;
MSStartSender.isAppropriate = function() {
return connector.platform.oneOf(connector.MSSTART)
}
;
cleverapps.YandexPushesMap = {
mergecraft: {
BONUS_ROUND: void 0,
LIVES: void 0,
MINI_GAME: void 0,
LETS_PLAY_1: void 0,
FREE_CHEST: void 0,
ENERGY_LOTTERY: void 0,
FRUIT_RIPE: 1,
CASTLE_PRIZE: void 0,
ORDER_READY: 3,
TREE_CHOPPED: void 0,
BUILDING_BUILT: 5,
MAGIC_PLANT_READY: void 0,
MINI_GAME_PRIZE: void 0,
DAILY_TASKS_UNCOMPLETED: void 0,
PASS_UNCOMPLETED: void 0,
PUMPKIN_RIPE: void 0,
UNITLOCK_OPEN: void 0,
EXPEDITION: void 0,
EXPEDITION_TREE_CHOPPED: void 0,
EXPEDITION_PERIODIC: void 0
},
wondermerge_debug: {
BONUS_ROUND: void 0,
LIVES: void 0,
MINI_GAME: void 0,
LETS_PLAY_1: 8,
FREE_CHEST: 9,
ENERGY_LOTTERY: void 0,
FRUIT_RIPE: 1,
CASTLE_PRIZE: 2,
ORDER_READY: 3,
TREE_CHOPPED: 4,
BUILDING_BUILT: 5,
MAGIC_PLANT_READY: 6,
MINI_GAME_PRIZE: 7,
DAILY_TASKS_UNCOMPLETED: 10,
PASS_UNCOMPLETED: 11,
PUMPKIN_RIPE: 12,
UNITLOCK_OPEN: 13,
EXPEDITION: 14,
EXPEDITION_TREE_CHOPPED: 15,
EXPEDITION_PERIODIC: 16
},
riddles_debug: {
BONUS_ROUND: void 0,
LIVES: 1,
MINI_GAME: 2,
LETS_PLAY_1: 3,
FREE_CHEST: void 0,
ENERGY_LOTTERY: void 0,
FRUIT_RIPE: void 0,
CASTLE_PRIZE: void 0,
ORDER_READY: void 0,
TREE_CHOPPED: void 0,
BUILDING_BUILT: void 0,
MAGIC_PLANT_READY: void 0,
MINI_GAME_PRIZE: void 0,
DAILY_TASKS_UNCOMPLETED: 4,
PASS_UNCOMPLETED: 5,
PUMPKIN_RIPE: void 0,
UNITLOCK_OPEN: void 0,
EXPEDITION: void 0,
EXPEDITION_TREE_CHOPPED: void 0,
EXPEDITION_PERIODIC: void 0
},
heroes_debug: {
BONUS_ROUND: void 0,
LIVES: 1,
MINI_GAME: 2,
LETS_PLAY_1: 3,
FREE_CHEST: void 0,
ENERGY_LOTTERY: void 0,
FRUIT_RIPE: void 0,
CASTLE_PRIZE: void 0,
ORDER_READY: void 0,
TREE_CHOPPED: void 0,
BUILDING_BUILT: void 0,
MAGIC_PLANT_READY: void 0,
MINI_GAME_PRIZE: void 0,
DAILY_TASKS_UNCOMPLETED: 4,
PASS_UNCOMPLETED: 5,
PUMPKIN_RIPE: void 0,
UNITLOCK_OPEN: void 0,
EXPEDITION: void 0,
EXPEDITION_TREE_CHOPPED: void 0,
EXPEDITION_PERIODIC: void 0
},
scramble_debug: {
BONUS_ROUND: 1,
LIVES: void 0,
MINI_GAME: 2,
LETS_PLAY_1: 3,
FREE_CHEST: void 0,
ENERGY_LOTTERY: void 0,
FRUIT_RIPE: void 0,
CASTLE_PRIZE: void 0,
ORDER_READY: void 0,
TREE_CHOPPED: void 0,
BUILDING_BUILT: void 0,
MAGIC_PLANT_READY: void 0,
MINI_GAME_PRIZE: void 0,
DAILY_TASKS_UNCOMPLETED: 4,
PASS_UNCOMPLETED: void 0,
PUMPKIN_RIPE: void 0,
UNITLOCK_OPEN: void 0,
EXPEDITION: void 0,
EXPEDITION_TREE_CHOPPED: void 0,
EXPEDITION_PERIODIC: void 0
},
tripeaks_debug: {
BONUS_ROUND: void 0,
LIVES: 1,
MINI_GAME: 2,
LETS_PLAY_1: 3,
FREE_CHEST: void 0,
ENERGY_LOTTERY: void 0,
FRUIT_RIPE: void 0,
CASTLE_PRIZE: void 0,
ORDER_READY: void 0,
TREE_CHOPPED: void 0,
BUILDING_BUILT: void 0,
MAGIC_PLANT_READY: void 0,
MINI_GAME_PRIZE: void 0,
DAILY_TASKS_UNCOMPLETED: 4,
PASS_UNCOMPLETED: void 0,
PUMPKIN_RIPE: void 0,
UNITLOCK_OPEN: void 0,
EXPEDITION: void 0,
EXPEDITION_TREE_CHOPPED: void 0,
EXPEDITION_PERIODIC: void 0
}
};
"undefined" === typeof cc && (module.exports = cleverapps.YandexPushesMap);
cleverapps.config.testers = {
draugiem: {
ids: ["5531190", "5531196", "5533303", "5536860", "5720568"]
},
fotostrana: {
ids: ["FS_113127743", "FS_113139202", "FS_113154744"]
},
microsoft: {
deviceIds: "MS_d1005317-92e5-4a83-11a9-d927877edd08 MS_af64328e-3371-73c1-367c-92bb6d560ed5 MS_3c940659-7a68-99e0-0ef2-0e4369a5372f MS_bafafe21-499a-26aa-44dc-f74662bff405 MS_9c82c0be-a17d-a981-11b7-4a85ec0661a4 MS_089e6329-8b28-c5e4-7b60-1f56b5b4b126 MS_52ceef82-d315-9e2d-beef-27fbdfd698ed MS_4f1d23b6-386a-8d55-93d7-c1702d0a5a81 MS_459d1c26-a293-f56b-b56c-84f410e3830b MS_3ff4887f-2eaa-81d3-e99e-d6495ee64e85 MS_13c53147-883c-b6e0-6c56-2aae159ed6d1 MS_c8d2d30b-2a32-573b-219f-eaa7cbbd6f35 MS_3a4afd8a-dd2d-0825-80cd-f934c2532139 MS_23c2dc13-9079-0550-596d-4eed01b6b286".split(" ")
},
mygames: {
ids: ["223914816", "224977482", "224977211", "224977565"]
},
mm: {
ids: ["12485194034381634037", "14225752454745236203"]
},
mbga: {
ids: ["mbga.jp:155776208", "mbga.jp:157478302"]
},
sp_mbga: {
ids: ["mbga.jp:155776208", "mbga.jp:157478302"]
},
msstart: {
ids: "e913873c-3848-4155-a881-edb315e30692 6e83dcbf-29fd-40f9-abed-83cf80d6194a 54de395d-d6e0-4f83-8ed9-7b68e4de19e0 c869c9f1-1729-4247-882e-fc1e0c37fbc6 5fb5e261-5781-4730-ac0e-b5984c8e89d3 ddaa100f-c0e3-4159-ad84-5f24bd0859b1".split(" ")
},
android: {
deviceIds: "45f0caa5-d1ab-4b03-8e09-a0b63b17c181 839d10f8-0da0-40fa-a4e9-02885ff0973a 17ef0ac8-71fa-47d1-941b-70924e8a031e 217ac5d3-6b67-48e8-8fe8-0fff1108c808 75f21832-7a24-47cc-9e88-8c4f461fc06d aca92164-3f00-4115-84c3-2ab54ed7ba7b 1572cd26-1b38-4b85-8346-258e171b388c b1ae8117-ff55-4159-b9ad-18e4d05a9da8 cb3ed72f-c604-4c51-84fa-2ffaa9acb849 85c137ac-0a55-45cd-bd8a-b8be552beea8 d2d82613-36c4-4d5c-aef5-43e62e938a48 f3cac7c8-962e-4ea2-9d08-2ec8a3950f58 2105ba80-4607-4ae3-a3a8-866aa7fb63b9 24280e2d-6603-415e-a064-d794cbda6437 c07beae6-3277-4c72-83ec-26cba72eeb36 9107a111-7da9-4f18-903b-fd7a19d1de0e 57ef186f-eb6c-470a-a8ba-d9575c623c26 d2f4787d-fd18-4414-abec-d01f9a1c72c9 b1b7e593-9557-451f-b8d4-05888173de9c 962ec82c-2f2e-45e9-952b-c1c494436e2e".split(" ")
},
vk: {
ids: "8593874 519644122 559432346 120601236 13506358 662073098 4252816 575473277 512342080 201054870 9938687 241941018 16681526 9933151 122220961 99189882 451315686 244780021 62287676 858300556 493261263 870476180 394324092 3284030 764485912 92285907".split(" ")
},
samsung: {
ids: ["sI+Uq1MmA2LUsgKD9grmbg3TMi1Pe0mqNdDPc1oSTX4="]
}
};
["rustore"].forEach(function(a) {
cleverapps.config.testers[a] = cleverapps.config.testers.android
});
var PaymentsLogic = function() {
connector.payments.on("productsLoaded", this.onProductsLoaded.bind(this));
connector.payments.on("restore", this.onRestore.bind(this));
connector.payments.on("changeStatus", this.updateFlags.bind(this));
connector.payments.on("error:purchase", this.onPurchaseError.bind(this));
connector.payments.on("error:unknownProducts", this.onUnknownProductsError.bind(this));
connector.payments.on("error:unknownSubscriptions", this.onUnknownSubscriptionsError.bind(this));
PaymentOverlay.initialize();
connector.payments.on("pluginChanged", function() {
this.purchaseToRestore && delete this.purchaseToRestore;
PaymentOverlay.initialize()
}
.bind(this));
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, function() {
connector.payments.loadProductsThrottled()
})
};
PaymentsLogic.prototype.updateFlags = function() {
cleverapps.whenAllInitialized(function() {
cleverapps.flags.update()
})
}
;
PaymentsLogic.prototype.onProductsLoaded = function() {
connector.payments.products.forEach(function(a) {
a.currencyImage && Product.RegisterCurrencyImage(a.currency, a.currencyImage)
})
}
;
PaymentsLogic.prototype.onChangeStatus = function(a, b) {
a = connector.payments.on("changeStatus", a);
b && addCleaner(b, a.clear)
}
;
PaymentsLogic.prototype.purchase = function(a, b, c) {
if (this.purchasePlayer && this.purchasePlayer.isRunning())
cleverapps.notification.create("PurchaseError.purchase_already_open"),
b(!1);
else {
var d, e;
this.purchasePlayer = new ActionPlayer([function(f, g) {
connector.payments.isLoginRequired ? cleverapps.SocialManager.enforceLogin(function(h) {
h === cleverapps.CODE_SUCCEED ? f() : g("login_required")
}, {
strict: !0
}) : f()
}
, function(f, g) {
cleverapps.synchronizer._syncIn.needShowReloadWindow() ? g() : f()
}
, function(f, g) {
connector.payments.isEmailRequired ? this.getEmail(function(h) {
h ? (e = h,
f()) : g("email_required")
}) : f()
}
.bind(this), function(f) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PRODUCT.OPEN);
this.createOverlay();
f()
}
.bind(this), function(f, g) {
connector.payments.purchaseCallback({
id: a.itemId,
context: a.context,
email: e
}, function(h) {
h ? (d = h.purchase,
f()) : g()
})
}
]);
this.purchasePlayer.onComplete(function() {
this.removeOverlay()
}
.bind(this));
this.purchasePlayer.onFailure(function(f) {
console.log("PaymentsManager purchase failure", a.productId, a.itemId);
if (f)
this.onPurchaseError(f);
b(!1)
}
.bind(this));
this.purchasePlayer.onSuccess(function() {
console.log("PaymentsManager purchase success", a.productId, a.itemId);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PRODUCT.SUCCESS);
this.logPurchase(a, d);
a.onBuyed(c);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PRODUCT.CONSUME_START);
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.PAYMENTS, a.priceUSD);
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.TOTAL, a.priceUSD);
connector.payments.consumeCallback(d, function(f) {
cleverapps.eventLogger.logEvent(f ? cleverapps.EVENTS.STATS.PRODUCT.CONSUME_SUCCESS : cleverapps.EVENTS.STATS.PRODUCT.CONSUME_FAILURE)
});
b(!0)
}
.bind(this));
this.purchasePlayer.play()
}
}
;
PaymentsLogic.prototype.onPurchaseError = function(a) {
"purchase_canceled_by_user" !== a && ("invalid_email" === a && cleverapps.info.setKeyValue("email", ""),
cleverapps.notification.create("PurchaseError." + a))
}
;
PaymentsLogic.prototype.onUnknownProductsError = function(a) {
(new Date(cleverapps.config.buildTime)).getTime() + PaymentsLogic.UNKNOWN_PRODUCTS_ERRORS_PERIOD > Date.now() && !this.unkonwnProductsLogged ? (this.unkonwnProductsLogged = !0,
cleverapps.throwAsync("platform missed some products " + a)) : console.error("platform missed some products " + a)
}
;
PaymentsLogic.prototype.onUnknownSubscriptionsError = function(a) {
(new Date(cleverapps.config.buildTime)).getTime() + PaymentsLogic.UNKNOWN_PRODUCTS_ERRORS_PERIOD > Date.now() && !this.unkonwnSubscriptionsLogged ? (this.unkonwnSubscriptionsLogged = !0,
cleverapps.throwAsync("platform missed some products " + a)) : console.error("platform missed some products " + a)
}
;
PaymentsLogic.prototype.getEmail = function(a) {
var b = cleverapps.info.getValue("email");
b && cleverapps.validateEmail(b) ? a(b) : new EmailWindow(a)
}
;
PaymentsLogic.prototype.createOverlay = function() {
cleverapps.focusManager.display({
stack: !0,
focus: "PaymentOverlay",
action: function(a) {
this.overlay = new PaymentOverlay;
cleverapps.scenes.getRunningScene().addChild(this.overlay);
this.oncePaymentOverlayClosed = a
}
.bind(this)
})
}
;
PaymentsLogic.prototype.removeOverlay = function() {
this.overlay && (this.overlay.removeFromParent(),
this.overlay = void 0);
this.oncePaymentOverlayClosed && (this.oncePaymentOverlayClosed(),
this.oncePaymentOverlayClosed = void 0)
}
;
PaymentsLogic.prototype.onRestore = function(a) {
this.purchaseToRestore = a;
cleverapps.focusManager.isFocused() || this.showRestore()
}
;
PaymentsLogic.prototype.consumeRestored = function() {
var a = this.purchaseToRestore;
a && (cleverapps.user.incProgressCompare(50),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PRODUCT.CONSUME_START),
delete this.purchaseToRestore,
connector.payments.consumeCallback(a, function(b) {
cleverapps.eventLogger.logEvent(b === cleverapps.CODE_SUCCEED ? cleverapps.EVENTS.STATS.PRODUCT.CONSUME_SUCCESS : cleverapps.EVENTS.STATS.PRODUCT.CONSUME_FAILURE)
}))
}
;
PaymentsLogic.prototype.showRestore = function() {
var a = this.purchaseToRestore;
if (a) {
var b = a.productId && connector.payments.getProduct(a.productId);
if (b && !(!cleverapps.environment.isMainScene() || b.mainSceneOnly && cleverapps.travelBook.isExpedition())) {
var c = Product.CreateById(b.itemId);
b = a.context || {};
var d = c.getRestoreLogic(b)
, e = cleverapps.travelBook.getCurrentPage()
, f = d && d.RestoreExpeditionId && d.RestoreExpeditionId(b);
f = cleverapps.travelBook.getPageById(void 0 === f ? e.id : f);
if (!f || f === e) {
var g;
f && f.isActive() && !f.isCompleted() && d && d.RestoreActions && (g = d.RestoreActions(b, function() {
this.consumeRestored();
this.logPurchase(c, a)
}
.bind(this)));
cleverapps.focusManager.display({
focus: "restorePurchase",
action: function(h) {
if (g)
(new ActionPlayer(g)).play(h);
else {
this.consumeRestored();
this.logPurchase(c, a);
var k = c.restoreReward || c.reward;
k ? (RewardWindow.createPurchaseWindow(k),
cleverapps.focusManager.onceNoWindowsListener = h) : h()
}
}
.bind(this)
})
}
}
}
}
;
PaymentsLogic.prototype.logPurchase = function(a, b) {
var c = {
itemId: a.itemId,
price: this.calcRealUSDPrice(a),
textPrice: b.price + " " + b.currency,
paymentId: b.paymentId
};
if ("subscription" === a.type)
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SUBSCRIPTION_BOUGHT, c);
else {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PAYMENTS, c);
var d = cleverapps.country.getCountry()
, e = connector.info.platform
, f = cleverapps.user.channel || ""
, g = {
value: c.price
};
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PAYMENTS_COUNTRY + d, g);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PAYMENTS_CHANNEL + f, g);
e && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PAYMENTS_PLATFORM + e, g),
["US"].includes(d) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.PAYMENTS_COUNTRY_PLATFORM + d + "_" + e, g));
a.event && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.BUY + a.itemId + "-" + a.event, g);
connector.payments.oneOf(connector.YOOKASSA) && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.YOOKASSA.PAID_COUNT),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.YOOKASSA.PAID_AMOUNT, g));
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.STATS.PAYMENTS, g);
cleverapps.travelBook.isExpedition() && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EXPEDITIONS.SPEND + cleverapps.travelBook.getCurrentPage().id, {
value: 100 * c.price
}),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EXPEDITIONS.TOTAL + cleverapps.travelBook.getCurrentPage().id, g));
(Game.currentGame && Game.currentGame.level && Game.currentGame.level.isBonusWorldLevel() || cleverapps.environment.isBonusWorldScene()) && (d = cleverapps.missionManager.findByType(Mission.TYPE_BONUS_WORLD)) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BONUS_WORLD_PAYMENTS + d.bonusWorld.type, g);
cleverapps.paymentsHistory.addPayment(a);
g = b.price;
d = b.currency;
connector.payments.isVirtualCurrency() && (g = c.price,
d = "USD");
cleverapps.eventLogger.logPurchase(a, b, {
transactionId: b.paymentId,
price: g,
currency: d
})
}
}
;
PaymentsLogic.prototype.calcRealUSDPrice = function(a) {
var b = this.getRealPriceCoef(a);
return 1 === b ? a.priceUSD : Math.round(a.priceUSD * b * 100) / 100
}
;
PaymentsLogic.prototype.getRealPriceCoef = function(a) {
var b = {
OK: 20 / connector.EXCHANGE_RATES.RUB,
VK_GOLOS: 21 / connector.EXCHANGE_RATES.RUB,
MLK: 20 / connector.EXCHANGE_RATES.RUB,
FM: 30 / connector.EXCHANGE_RATES.RUB,
YAN: 20 / connector.EXCHANGE_RATES.RUB
};
return connector.payments.isVirtualCurrency() ? b[a.currency] || 1 : connector.EXCHANGE_RATES[a.currency] ? connector.payments.getExchangeRate() / connector.EXCHANGE_RATES[a.currency] : 1
}
;
PaymentsLogic.UNKNOWN_PRODUCTS_ERRORS_PERIOD = cleverapps.parseInterval("3 month");
cleverapps.PaymentsHistory = function() {
this.ids = [];
this.time = [];
this.price = [];
this.load();
this.onAddPaymentListeners = {}
}
;
cleverapps.PaymentsHistory.prototype.trim = function() {
this.ids.length > cleverapps.PaymentsHistory.STORAGE_LIMIT && (this.ids = this.ids.slice(-cleverapps.PaymentsHistory.STORAGE_LIMIT));
this.time.length > this.ids.length && (this.time = this.time.slice(-this.ids.length));
this.price.length > this.ids.length && (this.price = this.price.slice(-this.ids.length))
}
;
cleverapps.PaymentsHistory.prototype.addPayment = function(a) {
this.ids.push(a.itemId);
this.time.push(Date.now());
this.price.push(a.priceUSD);
this.save();
Object.values(this.onAddPaymentListeners).forEach(cleverapps.callFunc)
}
;
cleverapps.PaymentsHistory.prototype.isPayer = function() {
return 0 < this.ids.length
}
;
cleverapps.PaymentsHistory.prototype.getLastPaymentTime = function() {
return 0 < this.time.length ? this.time[this.time.length - 1] : void 0
}
;
cleverapps.PaymentsHistory.prototype.load = function(a) {
(a = a || cleverapps.dataLoader.load(DataLoader.TYPES.PAYMENTS_HISTORY)) && a.payments || Array.isArray(a) ? (this.migrateOldFormat(a),
this.migratePrice(),
this.trim(),
this.save()) : a && a.ids && (this.ids = a.ids,
this.time = a.time.map(cleverapps.expandTime),
a.price ? this.price = this.ids.map(function(b) {
return (b = connector.payments.getProduct(b)) ? b.priceUSD : 0
}) : this.migratePrice(),
this.trim())
}
;
cleverapps.PaymentsHistory.prototype.migrateOldFormat = function(a) {
a = Array.isArray(a) ? a : a.payments;
var b = function(c) {
c = (c = c && c.productId && c.productId.facebook) && c.substring(c.lastIndexOf("/") + 1);
var d = connector.payments.getProduct(c);
return d ? d.itemId : c
};
a = a.filter(b);
this.time = a.map(function(c) {
return c.time
});
this.ids = a.map(b)
}
;
cleverapps.PaymentsHistory.prototype.migratePrice = function() {
this.price = this.ids.map(function(a) {
return (a = connector.payments.getProduct(a)) ? a.priceUSD : 0
})
}
;
cleverapps.PaymentsHistory.prototype.getInfo = function() {
return {
time: this.time.map(cleverapps.compactTime),
ids: this.ids,
price: this.price.map(function(a) {
return Math.floor(100 * a)
})
}
}
;
cleverapps.PaymentsHistory.prototype.updateInfo = function(a) {
a && (this.load(a),
this.save(!0))
}
;
cleverapps.PaymentsHistory.prototype.save = function(a) {
this.trim();
cleverapps.dataLoader.save(DataLoader.TYPES.PAYMENTS_HISTORY, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("paymentshistory")
}
;
cleverapps.PaymentsHistory.BRACKET_UNDECIDED = -1;
cleverapps.PaymentsHistory.BRACKET_NONE = 0;
cleverapps.PaymentsHistory.BRACKET_WEAK = 1;
cleverapps.PaymentsHistory.BRACKET_MEDIUM = 2;
cleverapps.PaymentsHistory.BRACKET_WHALE = 3;
cleverapps.PaymentsHistory.BRACKET_BIGWHALE = 4;
cleverapps.PaymentsHistory.BRACKETS = [2.99, 9.99, 29.99, 99.99];
cleverapps.PaymentsHistory.STORAGE_LIMIT = 25;
cleverapps.PaymentsHistory.VIP_THRESHOLD = 29.99;
cleverapps.PaymentsHistory.UNDECIDED_LEVEL_THRESHOLD = 6.5;
cleverapps.PaymentsHistory.initialize = function() {
connector.platform.oneOf(connector.WECHAT) && (cleverapps.PaymentsHistory.UNDECIDED_LEVEL_THRESHOLD = 0)
}
;
cleverapps.PaymentsHistory.prototype.isVIP = function() {
return this.getVIPStatus().status
}
;
cleverapps.PaymentsHistory.prototype.getVIPStatus = function() {
if (cleverapps.flags.monetization !== cleverapps.Flags.MONETIZATION_REGULAR)
return {
status: !1
};
if (cleverapps.subscription && cleverapps.subscription.isActive())
return {
status: !0,
end: Date.now() + cleverapps.parseInterval("1 day")
};
for (var a = cleverapps.parseInterval("1 month"), b = Date.now() - a, c = this.ids.length - 1, d = this.ids.length - 1, e = 0; 0 <= c && this.time[c] + a >= b; c--) {
for (e += this.price[c]; this.time[c] + a < this.time[d]; )
e -= this.price[d],
d--;
if (this.time[d] < b)
break;
if (e >= cleverapps.PaymentsHistory.VIP_THRESHOLD)
return {
status: !0,
end: this.time[d] + a
}
}
return {
status: !1
}
}
;
cleverapps.PaymentsHistory.prototype.calculateMinimalVipSum = function() {
var a = connector.payments.getProduct("gold6000");
return connector.payments.getTextPrice(Math.ceil(a.price + .01))
}
;
cleverapps.PaymentsHistory.prototype.classify = function() {
return cleverapps.PaymentsHistory.classify({
ids: this.ids,
price: this.price,
time: this.time,
subscription: cleverapps.subscription && cleverapps.subscription.isActive(),
level: cleverapps.user.getFloatLevel(),
highMonetization: cleverapps.flags.highMonetization && cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR
})
}
;
cleverapps.PaymentsHistory.classify = function(a) {
for (var b = 0, c = Date.now() - cleverapps.parseInterval("1 month"), d = a.ids.length - 1; 0 <= d && !(a.time[d] < c); d--)
b += a.price[d];
a.subscription && (b += 9.99);
for (c = 0; c < cleverapps.PaymentsHistory.BRACKETS.length && !(b < cleverapps.PaymentsHistory.BRACKETS[c] + .001); c++)
;
if (c === cleverapps.PaymentsHistory.BRACKET_NONE && a.level < cleverapps.PaymentsHistory.UNDECIDED_LEVEL_THRESHOLD) {
if (connector.platform.oneOf(connector.YANDEX)) {
b = connector.social.getPlugin().payingStatus;
if ("paying" === b)
return cleverapps.PaymentsHistory.BRACKET_WHALE;
if ("partially_paying" === b)
return cleverapps.PaymentsHistory.BRACKET_WEAK;
if ("not_paying" === b)
return cleverapps.PaymentsHistory.BRACKET_NONE
}
if (a.highMonetization)
return cleverapps.PaymentsHistory.BRACKET_UNDECIDED
}
return c
}
;
"undefined" === typeof cc && (module.exports = cleverapps.PaymentsHistory);
var FriendsCache = function(a) {
this.data = {};
this.lastUpdateTime = 0;
this.isInvitable = a;
this.load()
};
FriendsCache.prototype.getStoreKey = function() {
return this.isInvitable ? DataLoader.TYPES.INVITABLE_FRIENDS : DataLoader.TYPES.FRIENDS
}
;
FriendsCache.prototype.reset = function() {
this.data = {};
this.lastUpdateTime = 0;
this.save()
}
;
FriendsCache.prototype.load = function() {
var a = cleverapps.dataLoader.load(this.getStoreKey());
a && (this.data = a.data,
this.lastUpdateTime = a.when)
}
;
FriendsCache.prototype.save = function() {
var a = {
data: this.data,
when: this.lastUpdateTime
};
cleverapps.dataLoader.save(this.getStoreKey(), a)
}
;
FriendsCache.prototype.setData = function(a) {
this.data = {};
a.forEach(function(b) {
this.data[b.id] = {
id: b.id,
name: b.firstName || b.name,
avatar: b.avatar
}
}, this);
this.lastUpdateTime = Date.now();
this.save()
}
;
FriendsCache.prototype.getById = function(a) {
return this.data[a]
}
;
FriendsCache.prototype.listIds = function() {
return Object.keys(this.data)
}
;
FriendsCache.prototype.listFriends = function() {
return Object.values(this.data)
}
;
FriendsCache.prototype.inApp = function(a) {
return void 0 !== this.data[a]
}
;
FriendsCache.prototype.needReload = function() {
return 0 === this.listIds().length || this.lastUpdateTime + FriendsCache.RELOAD_INTERVAL < Date.now()
}
;
FriendsCache.prototype.reload = function(a) {
var b = function(c, d) {
c === cleverapps.CODE_SUCCEED && this.setData(d);
a()
}
.bind(this);
this.isInvitable ? connector.social.listInvitableFriends(b) : connector.social.listFriends(b)
}
;
FriendsCache.loadFriends = function(a) {
var b;
cleverapps.focusManager.display({
stack: !0,
focus: "LoadFriends",
actions: [function(c) {
b = new WaitWindow;
c()
}
, function(c) {
connector.social.askFriendsPermission(cleverapps.waitNoMore(cleverapps.parseInterval("10 seconds"), c))
}
, function(c) {
cleverapps.friends.needReload() ? cleverapps.friends.reload(c) : c()
}
, function(c) {
cleverapps.invitalbleFriends.needReload() ? cleverapps.invitalbleFriends.reload(c) : c()
}
, function(c) {
b.close();
c();
a()
}
]
})
}
;
FriendsCache.RELOAD_INTERVAL = cleverapps.parseInterval("7 days");
var PlatformLogic = function() {
connector.info.isNative && !connector.platform.oneOf(connector.WECHAT) && (new URLSearchParams(window.location.search)).has("source") && (cc.sys.isNativeFlight = !0);
connector.payments.on("stream:logs", this.logEvent.bind(this));
connector.social.on("stream:logs", this.logEvent.bind(this));
connector.ads.on("stream:logs", this.logEvent.bind(this));
connector.platform.on("stream:logs", this.logEvent.bind(this));
connector.payments.on("stream:error", this.throwError.bind(this));
connector.social.on("stream:error", this.throwError.bind(this));
connector.ads.on("stream:error", this.throwError.bind(this));
connector.platform.on("stream:error", this.throwError.bind(this));
connector.payments.on("stream:debug", this.showDebugNotification.bind(this));
connector.social.on("stream:debug", this.showDebugNotification.bind(this));
connector.ads.on("stream:debug", this.showDebugNotification.bind(this));
connector.platform.on("stream:debug", this.showDebugNotification.bind(this));
connector.payments.on("stream:console", this.consoleStream.bind(this));
connector.social.on("stream:console", this.consoleStream.bind(this));
connector.ads.on("stream:console", this.consoleStream.bind(this));
connector.platform.on("stream:console", this.consoleStream.bind(this))
};
PlatformLogic.prototype.logEvent = function(a, b) {
cleverapps.eventLogger.logEvent(a, b)
}
;
PlatformLogic.prototype.throwError = function(a, b) {
cleverapps.throwAsync(a, b)
}
;
PlatformLogic.prototype.showDebugNotification = function(a) {
cleverapps.config.debugMode && cleverapps.notification.create(a)
}
;
PlatformLogic.prototype.consoleStream = function(a) {
for (var b = [], c = 0; c < arguments.length; c++)
b.push(arguments[c]);
b.shift();
cleverapps.ConsoleStream.sendMessages(a, cleverapps.ConsoleStream.serialize(b))
}
;
PlatformLogic.prototype.onInitialize = function() {}
;
PlatformLogic.prototype.onStart = function() {}
;
PlatformLogic.prototype.initGameEvents = function() {
var a = !1;
cc.eventManager.addCustomListener(cc.game.EVENT_HIDE, function() {
a = !0
});
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, function() {
a = !1
});
cc.game.canvas.addEventListener("webglcontextlost", function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST);
cleverapps.playSession.inc(cleverapps.EVENTS.WEBGL.CONTEXT_LOST);
cleverapps.paymentsHistory.isPayer() && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER),
cleverapps.playSession.inc(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER));
a && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_INACTIVE),
cleverapps.playSession.inc(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_INACTIVE),
cleverapps.paymentsHistory.isPayer() && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER_INACTIVE),
cleverapps.playSession.inc(cleverapps.EVENTS.WEBGL.CONTEXT_LOST_PAYER_INACTIVE)));
setTimeout(function() {
cleverapps.dataLoader.onSaved(function() {
window.location.reload()
})
}, 30)
});
cc.eventManager.addListener(cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: cleverapps.accumulate(100, function() {
cleverapps.Audio.resumeAudioContext()
})
}), -1)
}
;
PlatformLogic.isTmpId = function(a) {
return a && a.startsWith("__")
}
;
PlatformLogic.isDeviceId = function(a) {
var b = connector.info.deviceID;
return b && a === b
}
;
PlatformLogic.create = function() {
return new ({
wechat: WechatLogic,
ios: AppleLogic,
macos: AppleLogic,
instant: InstantLogic,
msstart: MSStartLogic,
ok: OKLogic,
vk: VKLogic,
yandex: YandexLogic,
microsoft: MicrosoftLogic,
kongregate: KongregateLogic,
cleverapps: CleverAppsLogic,
crazy: CrazyLogic,
gdcom: GDComLogic,
coolmath: CoolMathGamesLogic,
mbga: MobageLogic,
sp_mbga: SPMobageLogic,
youtube: YoutubeLogic,
gamesnack: GameSnackLogic,
fotostrana: FotostranaLogic,
samsung: SamsungLogic,
ton: TonLogic,
wortal: WortalLogic
}[connector.info.source] || PlatformLogic)
}
;
cc.sys.LANGUAGE_LATVIAN = "lv";
cc.sys.LANGUAGE_TURKISH = "tr";
cc.sys.LANGUAGE_DUTCH = "nl";
var WechatLogic = function() {
PlatformLogic.call(this)
};
WechatLogic.prototype = Object.create(PlatformLogic.prototype);
WechatLogic.prototype.constructor = WechatLogic;
WechatLogic.prototype.onInitialize = function() {
cleverapps.config.sendLoadingTime = cleverapps.config.debugMode;
cc.sys.isDevTools = "devtools" === wx.getSystemInfoSync().platform;
cc.sys.isDevTools && (cc.assetManager.downloader.register(".png", cc.assetManager.downloader.downloadDomImage),
cc.assetManager.downloader.register(".jpg", cc.assetManager.downloader.downloadDomImage),
cc.assetManager.parser.register(".png", cc.assetManager.parser.parseImage),
cc.assetManager.parser.register(".jpg", cc.assetManager.parser.parseImage));
cc.assetManager.cacheManager.cachedFiles.forEach(function(a, b) {
b.includes(cleverapps.config.version) || cc.assetManager.cacheManager.removeCache(b)
})
}
;
var AppleLogic = function() {
PlatformLogic.call(this)
};
AppleLogic.prototype = Object.create(PlatformLogic.prototype);
AppleLogic.prototype.constructor = AppleLogic;
AppleLogic.prototype.onInitialize = function() {
WebViewConsole.init()
}
;
var InstantLogic = function() {
PlatformLogic.call(this);
SelectFriendWindow.MAX_SELECTED = 1;
connector.payments.on("error:details:instant:getSubscriptionStatus", this.onGetSubscriptionStatusError.bind(this));
connector.payments.on("error:details:instant:loadProducts", this.onLoadProductsError.bind(this));
connector.payments.on("error:details:instant:openSubscription", this.onOpenSubscriptionError.bind(this));
connector.payments.on("error:details:instant:purchase", this.onPurchaseError.bind(this));
connector.payments.on("error:details:instant:loadSubscriptions", this.onLoadSubscriptionsError.bind(this));
connector.payments.on("error:details:instant:consume", this.onConsumeError.bind(this));
connector.payments.on("error:details:instant:restore", this.onRestoreError.bind(this));
connector.ads.on("error:details:instant:showRewarded", this.onRewardedError.bind(this));
connector.ads.on("error:details:instant:showInterstitial", this.onInterstitialError.bind(this));
connector.ads.on("error:details:instant:cacheAd:rewarded", this.onRewardedCacheError.bind(this));
connector.ads.on("error:details:instant:cacheAd:interstitial", this.onInterstitialCacheError.bind(this))
};
InstantLogic.prototype = Object.create(PlatformLogic.prototype);
InstantLogic.prototype.constructor = InstantLogic;
InstantLogic.prototype.onRewardedCacheError = function(a) {
this.needToThrowCacheError(a) && cleverapps.throwAsync({
group: "ads_loading_unknown_instant",
message: "rewarded " + connector.utils.stringify(a)
})
}
;
InstantLogic.prototype.onInterstitialCacheError = function(a) {
this.needToThrowCacheError(a) && cleverapps.throwAsync({
group: "ads_loading_unknown_instant",
message: "interstitial " + connector.utils.stringify(a)
})
}
;
InstantLogic.prototype.onRewardedError = function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.ADS_ERROR_REWARDED + "-" + (a && a.code));
this.needToThrowPlayError(a) && cleverapps.throwAsync({
group: "ads_play_unknown_instant",
message: "rewarded " + connector.utils.stringify(a)
})
}
;
InstantLogic.prototype.onInterstitialError = function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.ADS_ERROR_INTERSTITIAL + "-" + (a && a.code));
this.needToThrowPlayError(a) && cleverapps.throwAsync({
group: "ads_play_unknown_instant",
message: "interstitial " + connector.utils.stringify(a)
})
}
;
InstantLogic.prototype.needToThrowPlayError = function(a) {
switch (a.code) {
case "USER_INPUT":
case "PENDING_REQUEST":
case "ADS_NOT_LOADED":
case "INVALID_PARAM":
case "NETWORK_FAILURE":
case "INVALID_OPERATION":
case "RATE_LIMITED":
case "PAYMENTS_NOT_INITIALIZED":
case "ADS_EXPIRED":
case "UNKNOWN":
return !1
}
return !0
}
;
InstantLogic.prototype.needToThrowCacheError = function(a) {
switch (a.code) {
case "ADS_NO_FILL":
case "INVALID_OPERATION":
case "ADS_FREQUENT_LOAD":
case "ADS_TOO_MANY_INSTANCES":
case "NETWORK_FAILURE":
case "UNKNOWN":
case "CLIENT_UNSUPPORTED_OPERATION":
case "INVALID_PARAM":
return !1
}
return !0
}
;
InstantLogic.prototype.onGetSubscriptionStatusError = function(a) {
switch (a.code) {
case "CLIENT_UNSUPPORTED_OPERATION":
case "NETWORK_FAILURE":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION_LIST + a.code);
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION_LIST + "OTHER"),
cleverapps.throwAsync({
group: "DebugMessage",
message: cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION_LIST + a.code + " message: " + a.message
})
}
}
;
InstantLogic.prototype.onLoadProductsError = function(a) {
if (!this.loadProductsErrorReported) {
switch (a.code) {
case "PENDING_REQUEST":
case "CLIENT_UNSUPPORTED_OPERATION":
case "PAYMENTS_NOT_INITIALIZED":
case "NETWORK_FAILURE":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.CATALOG + a.code);
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.CATALOG + "OTHER"),
cleverapps.throwAsync({
group: "DebugMessage",
message: cleverapps.EVENTS.STATS.INSTANT.CATALOG + a.code + " message: " + a.message
})
}
this.loadProductsErrorReported = !0
}
}
;
InstantLogic.prototype.onOpenSubscriptionError = function(a) {
switch (a.code) {
case "CLIENT_UNSUPPORTED_OPERATION":
case "PAYMENTS_NOT_INITIALIZED":
case "INVALID_PARAM":
case "NETWORK_FAILURE":
case "INVALID_OPERATION":
case "USER_INPUT":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION + a.code);
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION + "OTHER"),
cleverapps.throwAsync({
group: "DebugMessage",
message: cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION + a.code + " message: " + a.message
})
}
}
;
InstantLogic.prototype.onPurchaseError = function(a) {
switch (a.code) {
case "CLIENT_UNSUPPORTED_OPERATION":
case "PAYMENTS_NOT_INITIALIZED":
case "INVALID_PARAM":
case "NETWORK_FAILURE":
case "INVALID_OPERATION":
case "USER_INPUT":
case "PAYMENTS_PURCHASE_CREATION_FAILED":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.PAYMENT + a.code);
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.PAYMENT + "OTHER"),
cleverapps.throwAsync({
group: "DebugMessage",
message: cleverapps.EVENTS.STATS.INSTANT.PAYMENT + a.code + " message: " + a.message
})
}
}
;
InstantLogic.prototype.onLoadSubscriptionsError = function(a) {
if (!this.loadSubscriptionsErrorReported) {
switch (a.code) {
case "CLIENT_UNSUPPORTED_OPERATION":
case "NETWORK_FAILURE":
case "PENDING_REQUEST":
case "PAYMENTS_NOT_INITIALIZED":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION_CATALOG + a.code);
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION_CATALOG + "OTHER"),
cleverapps.throwAsync({
group: "DebugMessage",
message: cleverapps.EVENTS.STATS.INSTANT.SUBSCRIPTION_CATALOG + a.code + " message: " + a.message
})
}
this.loadSubscriptionsErrorReported = !0
}
}
;
InstantLogic.prototype.onConsumeError = function(a, b) {
switch (a.code) {
case "CLIENT_UNSUPPORTED_OPERATION":
case "PAYMENTS_NOT_INITIALIZED":
case "NETWORK_FAILURE":
case "UNKNOWN":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.CONSUME + a.code);
break;
case "INVALID_PARAM":
cleverapps.throwAsync("Instant consume INVALID_PARAM productId: " + b.productId + " paymentId: " + b.paymentId + " purchaseToken: " + b.payload.purchaseToken);
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.CONSUME + "OTHER"),
cleverapps.throwAsync({
group: "DebugMessage",
message: cleverapps.EVENTS.STATS.INSTANT.CONSUME + a.code + " message: " + a.message
})
}
}
;
InstantLogic.prototype.onRestoreError = function(a) {
switch (a.code) {
case "CLIENT_UNSUPPORTED_OPERATION":
case "PAYMENTS_NOT_INITIALIZED":
case "NETWORK_FAILURE":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.CONSUME + a.code);
break;
case "INVALID_PARAM":
cleverapps.throwAsync("Instant consume INVALID_PARAM");
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.CONSUME + "OTHER"),
cleverapps.throwAsync({
group: "DebugMessage",
message: cleverapps.EVENTS.STATS.INSTANT.CONSUME + a.code + " message: " + a.message
})
}
}
;
InstantLogic.prototype.reportScore = function(a, b) {
FBInstant.postSessionScoreAsync(a).then(function() {
b(cleverapps.CODE_SUCCEED)
}).catch(function() {
b(cleverapps.CODE_FAILED)
})
}
;
InstantLogic.prototype.getCurrentTournamentId = function(a) {
FBInstant.getTournamentAsync().then(function(b) {
var c = new Date(1E3 * b.getEndTime()) < new Date;
a(cleverapps.CODE_SUCCEED, c ? void 0 : String(b.getID()))
}).catch(function() {
a(cleverapps.CODE_FAILED)
})
}
;
InstantLogic.prototype.loadOldUserId = function(a) {
var b = cleverapps.config.facebook && cleverapps.config.facebook.appId;
b && FBInstant.graphApi.requestAsync("/me/ids_for_business").then(function(c) {
c = c.data.find(function(d) {
return d.app && d.app.id === b
});
a(c && c.id)
}).catch(function(c) {
console.log("my ids error", c)
})
}
;
InstantLogic.prototype.onConnected = function() {
console.log("Request entrypoint");
FBInstant.getEntryPointAsync().then(function(b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.ENTRY_POINT + (b || "empty"));
cleverapps.config.debugMode && (console.log("Instant entrypoint: " + b),
setTimeout(function() {
cleverapps.notification.create("Instant entrypoint: " + b)
}, 2E3))
});
FBInstant.player.getASIDAsync().then(function(b) {
console.log("Instant ASID: " + b);
b && cleverapps.info.setKeyValue("asid", b, !0)
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.LOCALE + (FBInstant.getLocale() || "empty"));
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.PLATFORM + (FBInstant.getPlatform() || "empty"));
var a = FBInstant.getEntryPointData() || {};
a.push_code && cleverapps.localPushes.logClickEvent(a.push_code)
}
;
InstantLogic.prototype.subscribeBot = function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.BOT_WANT);
FBInstant.player.canSubscribeBotAsync().then(function(a) {
a && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.BOT_SHOW),
FBInstant.player.subscribeBotAsync().then(function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.INSTANT.BOT)
}).catch(function(b) {
console.log(b.code + " " + b.message)
}))
}).catch(function(a) {
console.log("SubsBot " + a.code + " " + a.message)
})
}
;
var OKLogic = function() {
PlatformLogic.call(this);
connector.platform.on("pushPermission", function(a) {
cleverapps.info.setKeyValue("pushPermission", a, !0)
});
connector.info.isMobile || connector.platform.whenConnected(this.updateSize.bind(this))
};
OKLogic.prototype = Object.create(PlatformLogic.prototype);
OKLogic.prototype.constructor = OKLogic;
OKLogic.prototype.updateSize = function() {
connector.platform.getPlugin().listeners.getPageInfo = function(a, b) {
try {
var c = JSON.parse(b).innerHeight
} catch (d) {
c = window && window.innerHeight || document && document.body && document.body.clientHeight || 800
}
a = c - 75;
600 > a && (a = 600);
FAPI.UI.setWindowSize(760, a);
cleverapps.resolution.setupDesignResolution(cc.size(cc.view.getFrameSize().width, a))
}
;
[0, 5, 10, 20, 60].forEach(function(a) {
setTimeout(FAPI.UI.getPageInfo, 1E3 * a)
})
}
;
OKLogic.prototype.reportStatus = function(a, b) {
connector.platform.isConnected() && (console.log("setStatus", a, b),
FAPI.Client.call({
method: "sdk.setStatus",
event: a,
status: b
}, function(c, d, e) {
console.log("sdk.setStatus response", JSON.stringify(arguments));
var f = "set_status_ok";
"ok" !== c && (f = "set_status_error",
e && (e.error_msg || e.error_code) && cleverapps.throwAsync("sdk.setStatus event: '" + a + "' status: '" + b + "' error: " + JSON.stringify(e)));
cleverapps.eventLogger.logEvent(f)
}))
}
;
OKLogic.prototype.getPushCode = function() {
var a = FAPI.Util.getRequestParameters()
, b = cleverapps.getRequestParameters("?" + a.custom_args).push_code;
if (b)
return b;
if (a = cleverapps.LocalPushes.GetTypeById(a.custom_args))
return a.code
}
;
OKLogic.prototype.logPushes = function() {
var a = this.getPushCode();
a && cleverapps.localPushes.logClickEvent(a)
}
;
var VKLogic = function() {
PlatformLogic.call(this)
};
VKLogic.prototype = Object.create(PlatformLogic.prototype);
VKLogic.prototype.constructor = VKLogic;
VKLogic.prototype.logPushes = function() {
var a = connector.utils.getRequestParameters().ref_notification_id
, b = a && cleverapps.LocalPushes.GetTypeById(a);
(a = b && b.code || a) && cleverapps.localPushes.logClickEvent(a)
}
;
var MSStartLogic = function() {
PlatformLogic.call(this);
connector.ads.on("error:details:msstart:cache", this.onAdCacheError.bind(this));
connector.ads.on("error:details:msstart:play", this.onAdPlayError.bind(this))
};
MSStartLogic.prototype = Object.create(PlatformLogic.prototype);
MSStartLogic.prototype.constructor = MSStartLogic;
MSStartLogic.prototype.onAdCacheError = function(a, b) {
switch (a) {
case "FAILURE0":
case "FAILURE100":
case "FAILURE101":
case "FAILURE303":
case "FAILURE403":
case "FAILURE900":
case "FAILURE903":
case "FAILURE10000":
case "API_ACCESS_DENIED":
case "NO_AD_LOADER_FOUND":
case "AD_ALREADY_LOADED":
case "AD_IS_BEING_LOADED":
case "AD_REQUIRES_ACTIVE_TAB":
case "REQUEST_THROTTLED":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.MSSTART.ADS_LOAD + a);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.MSSTART.ADS_COUNTRY_LOAD + c + "-" + a)
});
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.MSSTART.ADS_LOAD + "OTHER"),
cleverapps.throwAsync(cleverapps.EVENTS.STATS.MSSTART.ADS_LOAD + b.code + " message: " + JSON.stringify(b))
}
}
;
MSStartLogic.prototype.onAdPlayError = function(a, b) {
switch (a) {
case "COMPLETED_FAILURE402":
case "COMPLETED_FAILURE900":
case "COMPLETED_FAILURE901":
case "COMPLETED_FAILURE903":
case "NO_LOADED_ADS_WITH_ID":
case "REQUEST_THROTTLED":
case "FAILED_BY_TIMEOUT":
case "USER_CANCELED":
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.MSSTART.ADS_PLAY + a);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.MSSTART.ADS_COUNTRY_PLAY + c + "-" + a)
});
break;
default:
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.MSSTART.ADS_PLAY + "OTHER"),
cleverapps.throwAsync(cleverapps.EVENTS.STATS.MSSTART.ADS_PLAY + b.code + " message: " + JSON.stringify(b))
}
}
;
MSStartLogic.prototype.logPushes = function() {
var a = cleverapps.getRequestParameters();
(a = a && a.notificationPayload && JSON.parse(a.notificationPayload).push_code) && cleverapps.localPushes.logClickEvent(a)
}
;
MSStartLogic.prototype.reportScore = function(a, b) {
connector.social.isLoggedIn() ? $msstart.submitGameResultsAsync(a).then(function(c) {
b(c ? cleverapps.CODE_SUCCEED : cleverapps.CODE_FAILED)
}).catch(function() {
b(cleverapps.CODE_FAILED)
}) : b(cleverapps.CODE_FAILED)
}
;
var YandexLogic = function() {
PlatformLogic.call(this);
connector.ads.on("error:details:yandex:showRewarded", this.onRewardedError.bind(this));
connector.ads.on("error:details:yandex:showInterstitial", this.onInterstitialError.bind(this))
};
YandexLogic.prototype = Object.create(PlatformLogic.prototype);
YandexLogic.prototype.constructor = YandexLogic;
YandexLogic.prototype.onRewardedError = function(a) {
cleverapps.throwAsync({
group: "ads_play_unknown_yandex",
message: "rewarded " + connector.utils.stringify(a)
})
}
;
YandexLogic.prototype.onInterstitialError = function(a) {
cleverapps.throwAsync({
group: "ads_play_unknown_yandex",
message: "interstitial " + connector.utils.stringify(a)
})
}
;
YandexLogic.prototype.logPushes = function() {
var a = ysdk.environment.payload && JSON.parse(ysdk.environment.payload);
a && a.push_code && cleverapps.localPushes.logClickEvent(a.push_code)
}
;
var MicrosoftLogic = function() {
PlatformLogic.call(this)
};
MicrosoftLogic.prototype = Object.create(PlatformLogic.prototype);
MicrosoftLogic.prototype.constructor = MicrosoftLogic;
var KongregateLogic = function() {
PlatformLogic.call(this);
connector.platform.whenConnected(this.resendAchievements.bind(this))
};
KongregateLogic.prototype = Object.create(PlatformLogic.prototype);
KongregateLogic.prototype.constructor = KongregateLogic;
KongregateLogic.prototype.resendAchievements = function() {
cleverapps.achievements && cleverapps.achievements.listCompleted().forEach(function(a) {
connector.social.markAchievement(a.getConfig())
})
}
;
var CleverAppsLogic = function() {
PlatformLogic.call(this)
};
CleverAppsLogic.prototype = Object.create(PlatformLogic.prototype);
CleverAppsLogic.prototype.constructor = CleverAppsLogic;
CleverAppsLogic.prototype.loadOldUserId = function(a) {
try {
var b = cleverapps.dataLoader.localStorage.getItem(cleverapps.config.name + "_xsolla");
a(b && JSON.parse(b).id)
} catch (c) {
console.log("parse old user error - " + b, c)
}
}
;
var CrazyLogic = function() {
PlatformLogic.call(this)
};
CrazyLogic.prototype = Object.create(PlatformLogic.prototype);
CrazyLogic.prototype.constructor = CrazyLogic;
CrazyLogic.prototype.loadOldUserId = function(a) {
cleverapps.getFrameUserId(cleverapps.config.staticUrl, {
key: cleverapps.config.name + "_plinga",
callback: a
})
}
;
var GDComLogic = function() {
PlatformLogic.call(this)
};
GDComLogic.prototype = Object.create(PlatformLogic.prototype);
GDComLogic.prototype.constructor = GDComLogic;
var CoolMathGamesLogic = function() {
PlatformLogic.call(this);
cleverapps.Availables.LEADER_BOARD = {
debugMode: !0
};
delete cleverapps.config.leagues;
"scramble crocword riddles heroes adventure runes".split(" ").forEach(function(a) {
CupsConfig.TYPES[CupsConfig.TYPE_DAILY].available.projectName.splice(CupsConfig.TYPES[CupsConfig.TYPE_DAILY].available.projectName.indexOf(a), 1)
})
};
CoolMathGamesLogic.prototype = Object.create(PlatformLogic.prototype);
CoolMathGamesLogic.prototype.constructor = CoolMathGamesLogic;
var MobageLogic = function() {
PlatformLogic.call(this);
TacticalExtendWindow.AMOUNT = 5
};
MobageLogic.prototype = Object.create(PlatformLogic.prototype);
MobageLogic.prototype.constructor = MobageLogic;
MobageLogic.HEIGHT = 860;
var SPMobageLogic = function() {
PlatformLogic.call(this);
TacticalExtendWindow.AMOUNT = 5;
this.loginScreenShown = !1;
connector.social.on("login", this.closeLoginScreen.bind(this))
};
SPMobageLogic.prototype = Object.create(PlatformLogic.prototype);
SPMobageLogic.prototype.constructor = SPMobageLogic;
SPMobageLogic.prototype.showLoginScreen = function(a) {
if (this.loginScreenShown)
a();
else if (this.loginScreenShown = !0,
connector.social.isLoggedIn())
a();
else {
this.callback = a;
var b = ResourceProcessor.calcAlwaysNeed()
, c = cleverapps.timeouts.setInterval(function() {
cleverapps.bundleLoader.isLoaded(b) && (cleverapps.timeouts.clearInterval(c),
this.createLoginScreen())
}
.bind(this), 300)
}
}
;
SPMobageLogic.prototype.closeLoginScreen = function() {
this.overlay && (this.overlay.removeFromParent(),
delete this.overlay);
this.callback && (this.callback(),
delete this.callback)
}
;
SPMobageLogic.prototype.createLoginScreen = function() {
var a = cleverapps.resolution.getSceneSize();
this.overlay = new cc.LayerColor(cleverapps.styles.COLORS.WHITE,a.width,a.height);
this.overlay.updateSize = function() {
var c = cleverapps.resolution.getSceneSize();
this.overlay.setContentSize2(c);
this.overlay.buttonNode.setPositionRound(c.width / 2, c.height / 2)
}
.bind(this);
cleverapps.scenes.getRunningScene().addChild(this.overlay, 9999);
var b = this.overlay.buttonNode = new SpPlatformButtons(a.width,function(c) {
connector.social.isConnected() ? connector.social.loginCallback(function(d) {
if (d)
this.closeLoginScreen();
else
cleverapps.SocialManager.onFailedLogin()
}
.bind(this), c) : cleverapps.notification.create("SocialManager.Initialization")
}
.bind(this));
this.overlay.addChild(b);
b.setPositionRound(a.width / 2, a.height / 2)
}
;
var YoutubeLogic = function() {
PlatformLogic.call(this)
};
YoutubeLogic.prototype = Object.create(PlatformLogic.prototype);
YoutubeLogic.prototype.constructor = YoutubeLogic;
YoutubeLogic.prototype.reportScore = function(a, b) {
"merge" !== cleverapps.config.type && ytgame.engagement.sendScore({
value: a
}).then(function() {
b(cleverapps.CODE_SUCCEED)
}).catch(function() {
b(cleverapps.CODE_FAILED)
})
}
;
YoutubeLogic.prototype.onStart = function() {
cleverapps.flags.set("largeTextHotfix", !0)
}
;
var GameSnackLogic = function() {
PlatformLogic.call(this)
};
GameSnackLogic.prototype = Object.create(PlatformLogic.prototype);
GameSnackLogic.prototype.constructor = GameSnackLogic;
GameSnackLogic.prototype.reportScore = function(a, b) {
"merge" !== cleverapps.config.type && (GameSnacks.score.update(a),
b(cleverapps.CODE_SUCCEED))
}
;
GameSnackLogic.prototype.reportLevelUp = function(a) {
var b = levels.user.getVirtualLevel() - 1;
GameSnacks.game.levelComplete(b);
a()
}
;
GameSnackLogic.prototype.reportGameOver = function(a) {
GameSnacks.game.gameOver();
a()
}
;
var FotostranaLogic = function() {
PlatformLogic.call(this);
cleverapps.SETUP_RESOLUTION_MIN_FRAME_SIZE = cleverapps.SETUP_RESOLUTION_MIN_FRAME_SIZE_FS
};
FotostranaLogic.prototype = Object.create(PlatformLogic.prototype);
FotostranaLogic.prototype.constructor = FotostranaLogic;
var SamsungLogic = function() {
PlatformLogic.call(this)
};
SamsungLogic.prototype = Object.create(PlatformLogic.prototype);
SamsungLogic.prototype.constructor = SamsungLogic;
SamsungLogic.prototype.reportScore = function(a, b) {
GSInstant.setScoreAsync(a).then(function() {
b(cleverapps.CODE_SUCCEED)
}).catch(function() {
b(cleverapps.CODE_FAILED)
})
}
;
var TonLogic = function() {
PlatformLogic.call(this)
};
TonLogic.prototype = Object.create(PlatformLogic.prototype);
TonLogic.prototype.constructor = TonLogic;
TonLogic.prototype.reportScore = function(a, b) {
connector.platform.callNative("setScore", {
value: a,
isForce: !1
}, b)
}
;
var WortalLogic = function() {
PlatformLogic.call(this)
};
WortalLogic.prototype = Object.create(PlatformLogic.prototype);
WortalLogic.prototype.constructor = WortalLogic;
WortalLogic.prototype.getCurrentTournamentId = function(a) {
Wortal.tournament.getCurrentAsync().then(function(b) {
a(cleverapps.CODE_SUCCEED, new Date(1E3 * b.endTime) < new Date ? void 0 : String(b.id))
}).catch(function() {
a(cleverapps.CODE_FAILED)
})
}
;
WortalLogic.prototype.reportScore = function(a, b) {
Wortal.tournament.postScoreAsync(a).then(function() {
b(cleverapps.CODE_SUCCEED)
}).catch(function() {
b(cleverapps.CODE_FAILED)
})
}
;
cleverapps.SocialManager = {
login: function(a, b) {
var c, d;
connector.platform.oneOf(connector.MICROSOFT) && cleverapps.focusManager.display({
stack: !0,
focus: "WaitLogin",
action: function(e) {
c = new WaitWindow;
d = e
}
});
connector.social.loginCallback(function(e) {
c && (c.close(),
d());
a(e)
}, b)
},
enforceLogin: function(a, b) {
b = b || {};
cleverapps.flags.nologin ? a(cleverapps.CODE_SUCCEED) : connector.social.isConnected() ? connector.social.isLoggedIn({
strict: b.strict
}) ? a(cleverapps.CODE_SUCCEED) : b.withWindow || connector.social.needWindowForLogin ? new SignInWindow({
onSuccess: function() {
a(cleverapps.CODE_SUCCEED)
},
onFailure: function() {
a(cleverapps.CODE_FAILED)
},
errorMessage: b.errorMessage
}) : cleverapps.SocialManager.login(function(c) {
c ? a(cleverapps.CODE_SUCCEED) : a(cleverapps.CODE_FAILED)
}) : (cleverapps.notification.create("SocialManager.Initialization"),
a(cleverapps.CODE_FAILED))
},
onFailedLogin: function() {
cleverapps.notification.create("SocialManager.FailedLogging")
},
onLogin: function(a) {
var b = a.newId
, c = a.oldId;
if (PlatformLogic.isTmpId(c) || PlatformLogic.isDeviceId(c))
cleverapps.RestClient.post("/users/off/" + c, {
newId: b
}, function(d) {
console.log("Success marked off: " + c + ", newId: " + b + ", response " + JSON.stringify(d))
}, function() {
console.log("Failed marking off: " + c + ", newId: " + b)
}),
levels.user.setLoggedIn(Date.now()),
cleverapps.synchronizer.reset(),
cleverapps.info.onChangeUserId(),
cleverapps.userClan && (cleverapps.userClan.changeUserId(c, b),
cleverapps.userClan.load()),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.LOGIN, {
method: connector.info.source
});
else if (c !== b) {
console.log("second login! old - " + c + ", new - " + b);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.SECOND_LOGIN);
cleverapps.config.debugMode && connector.platform.oneOf(connector.WECHAT) && alert("second login! old - " + c + ", new - " + b);
if (!(connector.info.isNative || connector.platform.oneOf(connector.MSSTART, connector.WECHAT) || connector.platform.oneOf(connector.WORTAL) && (cleverapps.config.debugMode || connector.platform.debugMode))) {
connector.dataLoader.cleanAll();
cleverapps.dataLoader.cleanAll();
connector.dataLoader.setEnabled(!1);
cleverapps.dataLoader.setEnabled(!1);
window.location.reload();
return
}
cleverapps.synchronizer.reset();
cleverapps.friends.reset();
cleverapps.invitalbleFriends.reset()
}
cleverapps.dataLoader.processSaveQueue();
cleverapps.synchronizer.syncWhenReady();
cleverapps.whenAllInitialized(this.onLoginRefreshes.bind(this))
},
onLoginRefreshes: function() {
connector.platform.oneOf(connector.VK, connector.GDCOM, connector.COOLMATHGAMES, connector.PLINGA, connector.DISCORD) || cleverapps.notification.create("SocialManager.Connected");
connector.player.whenReady(function() {
var a = connector.player.firstName || connector.player.name;
if (a && !cleverapps.flags.nologin) {
if (connector.player.avatar) {
var b = new cleverapps.UI.Avatar(connector.player.avatar);
b.width && b.height || (b = void 0)
}
cleverapps.notification.create("SocialManager.Welcome", {
toReplace: {
userName: a
},
image: b
})
}
});
cleverapps.returnBonus.checkSocial();
cleverapps.restoreProgress.update();
cleverapps.eventLogger.onUpdateUserId()
},
onPlayerInfoChanged: function() {
if (connector.player.name) {
var a = connector.player.name.substr(0, 50);
cleverapps.info.setKeyValue("name", a)
}
connector.player.avatar && (a = connector.player.avatar,
a instanceof VirtualResource && (a = "#" + a.bundle.name + "/" + a.key),
cleverapps.info.setKeyValue("avatar", a));
cleverapps.miniGame && cleverapps.miniGame.refreshItems()
}
};
var Reward = function(a, b, c) {
this.type = a;
this.value = b;
this.options = c || {};
-1 !== ["unlimitedLives", "worker"].indexOf(this.type) && (this.value = Product.FormatTimePeriod(this.value))
};
Reward.prototype.getValue = function() {
return this.value
}
;
Reward.prototype.receiveReward = function() {
this.getAmount() && (this.handler = RewardTypes[this.type].handler.call(this, this.value, this.options))
}
;
Reward.prototype.updateViewAmount = function() {
this.handler && (this.handler(),
delete this.handler)
}
;
Reward.prototype.onAnimationFinished = function() {
this.updateViewAmount();
if (this.options.onFinish)
this.options.onFinish();
var a = this.getAmount();
if (a) {
var b = cleverapps.aims.getTarget(this.getFlyingTarget());
if (!(b.aim.noTargetDelta || b.aim.controls && 0 === b.aim.controls.indexOf("MenuBar"))) {
var c = new cc.CollectEffect(b);
if (!b.aim.withoutDelta && !this.options.withoutDelta) {
var d = cleverapps.styles.Reward.jumpCollect.delta
, e = this.getSmallIcon();
e.setScale(e.scale * d.scale);
a && (c = new cc.Sequence(c,AnimationsLibrary.animateDelta("+" + a + " **", {
target: b,
icons: {
"**": e
},
font: cleverapps.styles.FONTS.SCENE_ANIMATE_DELTA_TEXT
})))
}
cleverapps.scenes.getRunningScene().runAction(c)
}
}
}
;
Reward.prototype.getAmount = function() {
return Array.isArray(this.value) ? this.value : -1 !== ["units", "battlePass", "kraken", "growthFund", "troop"].indexOf(this.type) ? this.value.amount || 1 : "object" === typeof this.value ? this.value.amount || this.value.level || this.value.time || +this.value.subscription || 0 : this.value || 0
}
;
Reward.prototype.getIcon = function(a) {
var b = cleverapps.styles.Reward
, c = {};
this.options.icons && this.options.icons[this.type] && !a ? c.frame = this.options.icons[this.type] : RewardTypes[this.type].getIcon ? c.frame = RewardTypes[this.type].getIcon(this.value) : RewardTypes[this.type].getAnimation ? c = RewardTypes[this.type].getAnimation(this.value) : "units" === this.type ? c.unit = this.value : "keys" === this.type ? c.key = this.value : "troop" === this.type && (c.troop = this.value);
if (c.troop)
a = WarriorView.getUnitImage(WarriorLines[c.troop.code], c.troop.stage);
else if (c.unit)
a = this.options.unitViewDummy ? new cc.Sprite(bundles.windows.frames.big_prize_png) : UnitView.getUnitImage(c.unit, {
alignAnchorX: !0,
preferStatic: !0
}),
cleverapps.UI.fitToBox(a, b.icon);
else if (c.json)
a = new cleverapps.Spine(c.json),
a.setScale(c.scale || 1),
a.setAnimation(0, c.animation, !0),
c.skin && a.setSkin(c.skin);
else if (c.frame)
a = new cc.Sprite(c.frame);
else if (c.key)
a = new QuestItemView(c.key,!0);
else {
if (cleverapps.config.debugMode)
throw "Reward icon is undefined - " + this.type;
cleverapps.throwAsync("Reward icon is undefined - " + this.type);
a = new cc.Node
}
return a
}
;
Reward.prototype.getSmallIcon = function(a) {
var b = cleverapps.styles.Reward, c;
this.options.icons && this.options.icons[this.type] && !a ? c = this.options.icons[this.type] : RewardTypes[this.type].getSmallIcon && (c = RewardTypes[this.type].getSmallIcon(this.value));
a = c ? new cc.Sprite(c) : this.getIcon(a);
cleverapps.UI.fitToBox(a, b.smallIcon);
return a
}
;
Reward.prototype.getFlyingAmount = function() {
var a = this.getAmount();
if (-1 !== ["unlimitedLives", "worker"].indexOf(this.type))
return 1;
if ("wands" === this.type)
return 3 >= a ? a : Math.min(5, Math.floor(a / 50) + 3);
if ("energy" === this.type)
return Math.min(5, Math.floor(a / 5) + 1);
if ("mission" === this.type) {
if (this.value.missionType === Mission.TYPE_KRAKENFEAST)
return Math.min(3, a);
if (this.value.missionType === Mission.TYPE_SOFTFEAST) {
if (500 <= a)
return 4;
if (150 <= a)
return 3;
if (a)
return 2
}
if (this.value.missionType === Mission.TYPE_LIVESFEAST) {
if (20 <= a)
return 3;
if (10 <= a)
return 2;
if (a)
return 1
}
}
return 100 <= a ? 8 : 50 <= a ? 5 : 3 <= a ? 3 : a
}
;
Reward.prototype.getFlyingTarget = function(a) {
return this.options.target && cleverapps.aims.getTarget(this.options.target, {
noDefault: !0
}) ? this.options.target : "boosters" === this.type ? "boosters" + this.value.id : "mission" === this.type ? cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL ? "mission" + this.value.missionType : void 0 : "clover" === this.type ? cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL ? "mission" + Game.currentGame.secondaryMission.type : void 0 : "units" === this.type && this.options.toMainWorld ? "mainWorld" : "cup" === this.type ? "cup" + this.value.type : "gold" === this.type || "rubies" === this.type ? "hard" : "coins" === this.type ? "soft" : "unlimitedLives" === this.type || "energy" === this.type ? "lives" : "wands" !== this.type || !a || a instanceof cc.Node ? this.type : ["map2dWands", "wands"]
}
;
Reward.prototype.getText = function(a) {
if ("unlimitedLives" === this.type)
return this.value.title;
if ("battlePass" === this.type)
return "PassProduct.Title";
if ("worker" === this.type)
return this.value.subscription ? a + (this.value.amount || 1) : Messages.get(this.value.title, {
amount: this.value.time
});
if ("growthFund" === this.type)
return "Shop.growthFund.title";
a = a ? String(a) : "";
return a = "boosters" === this.type || "keys" === this.type || "randomBoosters" === this.type || "mission" === this.type ? a + this.value.amount : "units" === this.type ? a + (this.value.pointsValue || this.value.amount || 1) : "troop" === this.type ? a + (this.value.amount || 1) : "herolevels" === this.type ? a + Math.max(0, Math.min(Heroes.HEROES_MAX_LEVEL, this.value.level)) : Array.isArray(this.value) ? a + this.value.join("-") : "kraken" === this.type ? a + "3" : a + this.value
}
;
Reward.prototype.listControls = function() {
return cleverapps.toArray(RewardTypes[this.type].controls) || []
}
;
Reward.prototype.listBundles = function() {
var a = RewardTypes[this.type].bundle;
a = "function" === typeof a ? a.call(this) : a;
return cleverapps.toArray(a) || []
}
;
Reward.prototype.collectRewardsAction = function(a, b) {
b = b || {};
if (!this.getAmount())
return b.callback = b.callback || function() {}
,
new cc.CallFunc(b.callback);
var c = cleverapps.scenes.getRunningScene()
, d = cleverapps.aims.getTarget(this.getFlyingTarget(a));
b.sound || ("mission" === this.type && this.value.missionType === Mission.TYPE_SOFTFEAST ? b.sound = bundles.menubar.urls.coins_effect : 0 === cleverapps.intersect(["hard", "soft", "exp", "worker", "wands"], d.aim.types).length && (b.sound = bundles.menubar.urls.exp_fly_finish_effect));
var e = Reward.COLLECT_ANIMATION;
b.flyingAnimation ? e = b.flyingAnimation : RewardTypes[this.type].flyingAnimation ? e = RewardTypes[this.type].flyingAnimation : d.aim.flyingAnimation && (e = d.aim.flyingAnimation);
if (a || Reward.isCustom(e))
switch (e) {
case Reward.SPAWN_UNITS_ANIMATION:
var f = this.spawnUnitsAnimation(this.spawnedUnits, a);
break;
case Reward.SPAWN_CARDS_ANIMATION:
f = this.spawnCardsAnimation(this.spawnedCards, a, d);
break;
case Reward.JUMP_COLLECT_ANIMATION:
f = this.jumpCollectAnimation(a, d, b);
break;
case Reward.COLLECT_ANIMATION:
f = this.collectAnimation(a, d, b);
break;
case Reward.CUSTOM_COLLECT:
f = this.customCollectAnimation(b);
break;
case Reward.FULL_SCREEN_CUSTOM_ANIMATION:
f = this.fullScreenCollectAnimation(b)
}
a = new cc.CallFunc(this.onAnimationFinished.bind(this));
f && (a = new cc.Sequence(f,a));
f = b.delay || 0;
d.aim.scrollsToTarget && d.aim.scrollsToTarget() && (a = new cc.Sequence(new cc.TargetedAction(c.map,new cc.ScrollAction(d,{
skipFocusReport: !0,
duration: .6,
visibleBox: {
left: .4,
right: .4,
top: .4,
bottom: .4
}
})),a),
f += .6);
return new cc.Sequence(new cc.DelayTime(f / 1E3),a,new cc.CallFunc(b.callback))
}
;
Reward.prototype.collectRewardsAnimation = function(a, b) {
var c = cleverapps.scenes.getRunningScene();
a = this.collectRewardsAction(a, b);
c.runAction(a)
}
;
Reward.prototype.collectAnimation = function(a, b, c) {
if (a = a.onGetView ? a.onGetView() : a) {
a.stopAllActions();
var d = c.sound;
!d && b.aim && b.aim.controls && -1 !== b.aim.controls.indexOf("treasureBag") && (d = bundles.main.urls.win_reward_box_effect);
return new cc.TargetedAction(a,new cc.Sequence(AnimationsLibrary.animateCollect(a, b, {
path: c.path,
adjustToTarget: !0,
sound: d
}),new cc.CallFunc(function() {
b.aim && b.aim.animate && b.aim.animate(1)
}
),new cc.RemoveSelf))
}
}
;
Reward.prototype.spawnUnitsAnimation = function(a, b) {
b.replaceParentSamePlace(cleverapps.scenes.getMovingNode(b), {
keepScale: !0
});
return new cc.TargetedAction(b,new cc.Sequence(new cc.CallFunc(function() {
Game.currentGame.spawnAction(a, [], b, {
fromNode: !0,
startScale: b.adjustScaleTo(Map2d.currentMap.getMapView().animations),
startAnchors: {
anchorX: .5,
anchorY: .5
}
})
}
),new cc.DelayTime(.2),new cc.Hide,new cc.DelayTime(.5),new cc.RemoveSelf))
}
;
Reward.prototype.spawnCardsAnimation = function(a, b, c) {
var d = cleverapps.scenes.getRunningScene(b)
, e = d.convertToNodeSpace(b.parent.convertToWorldSpace(b));
cleverapps.aims.showTarget(c);
var f = [];
a.forEach(function(g) {
f.push(new cc.DelayTime(.3));
f.push(new cc.CallFunc(function() {
cleverapps.aims.showTarget(c);
var h = new (g.getViewClass())(g);
h.setPositionRound(e);
h.setScale(.3);
d.addChild(h);
Game.currentGame.hand.push(g, {
insertIndex: cleverapps.Random.random(Game.currentGame.hand.stack.length),
fromTable: !0
});
cleverapps.audio.playSound(bundles.game.urls.plus_card_effect)
}
))
});
return new cc.Sequence(f)
}
;
Reward.prototype.jumpCollectAnimation = function(a, b, c) {
c = c || {};
var d = cleverapps.styles.Reward.jumpCollect;
if (a instanceof cc.Node) {
var e = cleverapps.scenes.getMovingNode(a);
var f = e.convertToNodeSpace(a.parent.convertToWorldSpace(a.getPosition()))
} else {
var g = !0;
e = Map2d.currentMap.getMapView().animations;
f = Map2d.currentMap.getMapView().alignInIsometricGrid(a.x, a.y);
var h = a.findComponent && a.findComponent(MultiCell);
h && (h = h.getCenter(),
f.x += h.x,
f.y += h.y)
}
var k = c.beginScale || .5
, m = c.flyingScale || d.delta.scale
, l = c.finalScale || m
, n = this.getFlyingAmount()
, p = [];
cleverapps.arrayFill(n).forEach(function(q, r) {
q = !1 === c.small ? this.getIcon(!0) : this.getSmallIcon(!0);
var u = q.scale * k
, w = q.scale * m
, v = Math.min(b.getGlobalBoundingBox().width / q.width, l);
q.setScale(u);
q.setPositionRound(f);
e.addChild(q);
q.setLocalZOrder(1 / (1 + r));
q.setVisible(!1);
u = [new cc.DelayTime(0 === r ? 0 : .1 * r + .1 * Math.random()), new cc.Show, new cc.CallFunc(function() {
c.hideSource && a.setVisible(!1)
}
), AnimationsLibrary.jumpCollect(q, b, {
collectMovingNode: g && cleverapps.windows.isActive() && e,
jumpScale: w,
jumpOffset: r / n,
jumpSide: c.jumpSide,
collectScale: v,
collectSound: c.sound,
longJump: g && cleverapps.skins.getSlot("useLongJumpAnimation")
})];
0 === r && u.push(new cc.CallFunc(function() {
cleverapps.aims.showTarget(b);
b.aim && b.aim.animate && b.aim.animate(n)
}
));
u.push(new cc.RemoveSelf);
p.push(new cc.TargetedAction(q,new cc.Sequence(u)))
}
.bind(this));
return 1 === p.length ? p[0] : new cc.Spawn(p)
}
;
Reward.prototype.customCollectAnimation = function(a) {
a = a || {};
var b = cleverapps.scenes.getMovingNode()
, c = new CustomRewardView(this,a.customRewardIndex || 0);
b.addChild(c);
return new cc.Sequence(new cc.CallFunc(function() {
c.collectAnimate()
}
),new cc.DelayTime(c.getAnimationDuration()))
}
;
Reward.prototype.fullScreenCollectAnimation = function() {
var a = cleverapps.scenes.getRunningScene()
, b = new RewardTypes[this.type].viewClass(this);
a.addChild(b);
a = cleverapps.scenes.getMovingNode(b);
b.replaceParentSamePlace(a);
return new cc.TargetedAction(b,b.getCollectAnimation())
}
;
Reward.prototype.isFlyingUnderShadow = function() {
var a = cleverapps.aims.getTarget(this.getFlyingTarget());
return a && a.aim && a.aim.flyingUnderShadow
}
;
Reward.prototype.isEqual = function(a) {
var b = Object.keys(a)[0];
if (b === this.type) {
if ("number" === typeof a[b])
return !0;
a = Object.keys(a[b])[0];
return this.value.id === a
}
return !1
}
;
Reward.prototype.calcPrice = function() {
var a = this.getValue();
return "hard" === this.type ? a : "soft" === this.type ? a / cleverapps.User.HARD_TO_SOFT : "boosters" === this.type ? cleverapps.boosters.getBoosterById(a.id).calcPrice() * a.amount : "unlimitedLives" === this.type ? a.time / 1E3 / 3600 * (cleverapps.config.soft ? 4 : 8) : "lives" === this.type ? (cleverapps.config.soft ? 33 : 20) * a : 0
}
;
Reward.NO_ANIMATION = 1;
Reward.COLLECT_ANIMATION = 2;
Reward.SPAWN_UNITS_ANIMATION = 3;
Reward.SPAWN_CARDS_ANIMATION = 4;
Reward.JUMP_COLLECT_ANIMATION = 5;
Reward.CUSTOM_COLLECT = 6;
Reward.FULL_SCREEN_CUSTOM_ANIMATION = 7;
Reward.isCustom = function(a) {
return a === Reward.CUSTOM_COLLECT || a === Reward.FULL_SCREEN_CUSTOM_ANIMATION
}
;
cleverapps.styles.Reward = {
icon: {
height: 130,
maxScale: 1.5
},
smallIcon: {
height: 70
},
jumpCollect: {
delta: {
dy: 80,
scale: .8
},
jumpRight: {
x1: 50,
x2: 150,
y1: -50,
y2: -100
},
jumpLeft: {
x1: -50,
x2: -150,
y1: -50,
y2: -100
},
jumpBoth: {
x1: -50,
x2: 50,
y1: -50,
y2: -100
}
},
flyHint: {
speed: 3E3
}
};
var RewardsList = function(a, b) {
this.options = b || {};
this.rewards = [];
Object.keys(a).forEach(function(c) {
var d = a[c];
if (RewardTypes[c])
d && (RewardTypes[c].parse ? this.rewards = this.rewards.concat(RewardTypes[c].parse(d, this.options)) : this.rewards.push(new Reward(c,d,this.options)));
else {
if (cleverapps.config.debugMode)
throw "unknown reward type '" + c + "'";
cleverapps.throwAsync("unknown reward type '" + c + "'")
}
}, this);
this.rewards = this.sortRewards();
this.commonRewards = this.rewards.filter(function(c) {
return !Reward.isCustom(RewardTypes[c.type].flyingAnimation)
});
this.customRewards = this.rewards.filter(function(c) {
return RewardTypes[c.type].flyingAnimation === Reward.CUSTOM_COLLECT
});
this.fullScreenRewards = this.rewards.filter(function(c) {
return RewardTypes[c.type].flyingAnimation === Reward.FULL_SCREEN_CUSTOM_ANIMATION
})
};
RewardsList.prototype.sortRewards = function() {
return this.rewards.filter(function(a) {
return !a.isFlyingUnderShadow()
}).concat(this.rewards.filter(function(a) {
return a.isFlyingUnderShadow()
}))
}
;
RewardsList.prototype.updateViewAmount = function() {
this.rewards.forEach(function(a) {
return a.updateViewAmount()
})
}
;
RewardsList.prototype.receiveRewards = function() {
this.received || (this.received = !0,
this.rewards.forEach(function(a) {
a.receiveReward()
}))
}
;
RewardsList.prototype.onAnimationFinished = function() {
this.rewards.forEach(function(a) {
a.onAnimationFinished()
})
}
;
RewardsList.prototype.listRewards = function() {
return this.rewards
}
;
RewardsList.prototype.listControls = function() {
return this.rewards.reduce(function(a, b) {
return a.concat(b.listControls())
}, [])
}
;
RewardsList.prototype.listBundles = function() {
return this.rewards.reduce(function(a, b) {
return a.concat(b.listBundles())
}, [])
}
;
RewardsList.prototype.isBigReward = function() {
return this.rewards.some(function(a) {
return "units" === a.type && ("coinsplant" === a.value.code || "rubiesplant" === a.value.code || "magicplant" === a.value.code && 5 === a.value.stage)
})
}
;
RewardsList.prototype.collectRewardsAnimation = function(a, b) {
b = b || {};
var c = ["left", "right"]
, d = b.delay || 0
, e = b.rewardsInterval
, f = 0
, g = 0
, h = 0;
this.commonRewards.forEach(function(k) {
var m = Object.assign({}, b, {
jumpSide: c[f % c.length],
delay: d,
deltaOffset: g,
customRewardIndex: h
});
k.collectRewardsAnimation(a, m);
RewardTypes[k.type] && RewardTypes[k.type].flyingAnimation === Reward.CUSTOM_COLLECT && h++;
b.allAtOnce || (f += 1,
d += void 0 === e ? 500 + 250 * k.getFlyingAmount() : e,
g += cleverapps.styles.RewardsList.deltaOffset)
});
return d || 0
}
;
RewardsList.prototype.underShadowRewardIndex = function() {
for (var a = 0; a < this.rewards.length; ++a)
if (this.rewards[a].isFlyingUnderShadow())
return a;
return -1
}
;
RewardsList.sumRewards = function(a, b) {
var c = {}
, d = function(e, f, g) {
if ("number" === typeof e[g])
f[g] = e[g] + (f[g] ? f[g] : 0);
else if ("string" === typeof e[g])
e = (cleverapps.parseInterval(e[g]) + (f[g] ? cleverapps.parseInterval(f[g]) : 0)) / 1E3 / 60,
f[g] = e + " minutes";
else {
void 0 === f[g] && (f[g] = {});
for (var h = Object.keys(e[g]), k = 0; k < h.length; k++)
d(e[g], f[g], h[k])
}
};
Object.keys(a).forEach(function(e) {
d(a, c, e)
});
Object.keys(b).forEach(function(e) {
d(b, c, e)
});
return c
}
;
RewardsList.calcCost = function(a) {
return (a instanceof RewardsList ? a : new RewardsList(a)).rewards.reduce(function(b, c) {
return b + c.calcPrice()
}, 0)
}
;
cleverapps.styles.RewardsList = {
deltaOffset: -28
};
var RewardsConfig = {
Packs: [],
Tournament: {},
DailyCup: [],
WeeklyCup: [],
ClanCup: [],
BonusWorld: [{
level: 3,
reward: {
boosters: {
13: 1,
14: 1
}
}
}, {
level: 8,
reward: {
hard: 50,
boosters: {
13: 1,
14: 1
}
}
}, {
level: 15,
reward: {
hard: 200,
boosters: {
13: 1,
14: 1,
15: 1
}
}
}],
ShortMeta: {
5: {
hard: {
factor: 3
}
},
9: {
hard: {
factor: 3
}
}
},
PromotionSale: [{
id: 0,
product: "gold500",
profit: "+60%",
reward: {
hard: 300
}
}, {
id: 1,
product: "gold1800",
profit: "+56%",
reward: {
hard: 1E3
}
}, {
id: 2,
product: "gold3800",
profit: "+53%",
reward: {
hard: 2E3
}
}, {
id: 3,
product: "gold6000",
profit: "+50%",
reward: {
hard: 3E3
}
}, {
id: 4,
product: "gold25000",
profit: "+40%",
reward: {
hard: 1E4
}
}],
ChainSale: [{
reward: {
soft: 300
}
}, {
hardPrice: 300,
reward: {
soft: 300
}
}, {
reward: {
soft: 100
}
}, {
reward: {
soft: 150
}
}, {
hardPrice: 1E3,
reward: {
soft: 2E3
}
}, {
reward: {
hard: 200
}
}, {
reward: {
hard: 500
}
}],
ReturnBonus: {
hard: 150
},
TreasureSearchLevelRewards: {
hard: 4.5,
tricky: 2,
bonus: 2,
default: 1.5
},
StickersBookLevelRewards: {
hard: 3,
default: 1
},
PinballLevelRewards: {
hard: 4.5,
tricky: 2,
bonus: 2,
default: 1.5
}
};
"battlefield" === cleverapps.config.type && (RewardsConfig.ShortMeta = {
5: {
soft: {
factor: 3
}
},
9: {
soft: {
factor: 3
}
}
},
RewardsConfig.Packs = {
0: {
hard: 100,
soft: 500,
troopCards: {
probabilities: [100, 0, 0],
amount: 5
}
},
1: {
hard: 500,
soft: 2500,
troopCards: {
probabilities: [0, 100, 0],
amount: 7
}
},
2: {
hard: 2E3,
soft: 1E4,
troopCards: {
probabilities: [0, 0, 100],
amount: 10
}
}
});
"board" === cleverapps.config.type && (RewardsConfig.Tournament = {
places: [{
hard: 300
}, {
hard: 250
}, {
hard: 200
}, {
hard: 100
}, {
hard: 50
}]
},
RewardsConfig.TreasureSearch = {
stages: [{
hard: 10
}, {
hard: 20
}, {
hard: 30
}, {
hard: 40
}, {
hard: 50
}]
},
RewardsConfig.DailyTask = {
easy: [{
hard: 80
}],
medium: [{
hard: 120
}],
hard: [{
hard: 160
}],
completeAll: [{
hard: 180
}]
},
RewardsConfig.DailyCup = [{
hard: 400
}, {
hard: 250
}, {
hard: 150
}, {
hard: 50
}, {
hard: 50
}, {
hard: 50
}, {
hard: 50
}, {
hard: 50
}, {
hard: 50
}, {
hard: 50
}],
RewardsConfig.Packs = [{
hard: 800
}, {
hard: 2600
}, {
hard: 17E3
}],
RewardsConfig.Subscription = {
hard: 600
},
RewardsConfig.MiniGame = [{
hard: 50
}, {
hard: 100
}],
RewardsConfig.MiniGameNovice = [{
hard: 50
}],
RewardsConfig.CookieJar = {
hard: 50
},
RewardsConfig.PromotionSale = [{
id: 0,
hardPrice: 1E3,
profit: "+60%",
reward: {
hard: 500,
boosters: {
3: 3
}
}
}, {
id: 1,
hardPrice: 300,
profit: "+56%",
reward: {
hard: 800,
boosters: {
3: 5
}
}
}],
RewardsConfig.ChainSale = [{
reward: {
hard: 10
}
}, {
hardPrice: 300,
reward: {
hard: 200,
boosters: {
3: 1
}
}
}, {
reward: {
hard: 100
}
}, {
reward: {
hard: 150
}
}, {
hardPrice: 1E3,
reward: {
hard: 800,
boosters: {
3: 3
}
}
}, {
reward: {
hard: 200
}
}, {
reward: {
hard: 250,
boosters: {
3: 3
}
}
}],
RewardsConfig.Supplies = {
hardPrice: 1E3,
rewards: [{
hard: 50
}, {
hard: 100
}, {
hard: 150,
boosters: {
3: 1
}
}, {
hard: 200
}, {
hard: 250,
boosters: {
3: 3
}
}, {
hard: 350
}, {
hard: 500,
boosters: {
3: 5
}
}]
},
RewardsConfig.StickersBook = [{
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 350
}, {
hard: 350
}, {
hard: 350
}, {
hard: 350
}]);
"match3" === cleverapps.config.type && (RewardsConfig.MiniGame = [{
hard: 50
}, {
boosters: {
5: 1
},
hard: 50
}, {
boosters: {
5: 1
}
}, {
hard: 50
}, {
boosters: {
6: 1
}
}, {
boosters: {
6: 1
},
hard: 50
}, {
hard: 50
}, {
boosters: {
7: 1
}
}, {
boosters: {
7: 1
},
hard: 50
}],
RewardsConfig.MiniGameBeginner = [{
unlimitedLives: "30 minutes"
}],
RewardsConfig.MiniGameNovice = [{
hard: 50
}],
RewardsConfig.Tournament = {
places: [{
boosters: {
5: 2,
6: 2,
7: 2
},
unlimitedLives: "12 hours"
}, {
boosters: {
6: 1,
7: 1
},
unlimitedLives: "6 hour"
}, {
boosters: {
5: 1,
6: 1
},
unlimitedLives: "1 hour"
}, {
boosters: {
6: 1
},
unlimitedLives: "45 minutes",
exp: 5
}, {
boosters: {
5: 1
},
unlimitedLives: "30 minutes",
exp: 3
}]
},
RewardsConfig.DailyTask = {
easy: [{
unlimitedLives: "15 minutes"
}],
medium: [{
boosters: {
6: 1
},
exp: 1
}],
hard: [{
unlimitedLives: "30 minutes"
}],
completeAll: [{
boosters: {
0: 1,
1: 1
},
exp: 5
}]
},
RewardsConfig.TreasureSearch = {
stages: [{
boosters: {
5: 2
}
}, {
boosters: {
5: 2,
6: 1
},
unlimitedLives: "3 hours"
}, {
boosters: {
5: 1,
6: 2,
7: 1
}
}, {
boosters: {
5: 3,
6: 2,
7: 1
}
}, {
boosters: {
5: 3,
6: 3,
7: 3
},
hard: 150
}]
},
RewardsConfig.PrizeCalendar = {
stages: [{
free: !0,
tileIndex: 0,
reward: {
boosters: {
5: 1
}
}
}, {
ads: !0,
tileIndex: 1,
reward: {
boosters: {
6: 1
}
}
}, {
hard: 10,
tileIndex: 2,
reward: {
unlimitedLives: "10 minutes"
}
}, {
ads: !0,
tileIndex: 5,
reward: {
boosters: {
5: 1
}
}
}, {
hard: 30,
reward: {
unlimitedLives: "15 minutes"
}
}, {
ads: !0,
reward: {
boosters: {
6: 1
}
}
}, {
hard: 60,
reward: {
unlimitedLives: "30 minutes"
}
}, {
ads: !0,
reward: {
boosters: {
7: 1
}
}
}, {
hard: 100,
reward: {
boosters: {
7: 2
},
unlimitedLives: "4 hours"
}
}]
},
RewardsConfig.DailyCup = [{
unlimitedLives: "1 day",
boosters: {
5: 5,
6: 5,
7: 5
}
}, {
unlimitedLives: "6 hours",
boosters: {
5: 4,
6: 4,
7: 4
}
}, {
unlimitedLives: "3 hours",
boosters: {
5: 3,
6: 3,
7: 3
}
}, {
unlimitedLives: "2 hour",
boosters: {
5: 1,
6: 1,
7: 1
}
}, {
boosters: {
5: 1,
6: 1
},
unlimitedLives: "2 hour"
}, {
boosters: {
5: 1,
6: 1
},
unlimitedLives: "2 hour"
}, {
boosters: {
5: 1,
6: 1
},
unlimitedLives: "2 hour"
}, {
boosters: {
5: 1
},
unlimitedLives: "1 hour"
}, {
boosters: {
5: 1
},
unlimitedLives: "1 hour"
}, {
boosters: {
5: 1
},
unlimitedLives: "1 hour"
}],
RewardsConfig.Packs = [{
boosters: {
5: 1,
6: 1,
7: 1
},
hard: 500,
unlimitedLives: "1 day"
}, {
boosters: {
5: 2,
6: 2,
7: 2
},
hard: 1800,
unlimitedLives: "3 day"
}, {
boosters: {
5: 14,
6: 14,
7: 14
},
hard: 12E3,
unlimitedLives: "9 day"
}],
RewardsConfig.Subscription = {
hard: 300,
exp: 1,
unlimitedLives: "2 hours",
boosters: {
0: 3
}
},
RewardsConfig.BonusWorld = [{
level: 3,
reward: {
unlimitedLives: "1 hour"
}
}, {
level: 8,
reward: {
unlimitedLives: "1 hours",
exp: 5,
boosters: {
5: 1,
6: 1
}
}
}, {
level: 15,
reward: {
hard: 150,
unlimitedLives: "24 hours",
boosters: {
5: 1,
6: 1,
7: 1
}
}
}],
RewardsConfig.PromotionSale = [{
id: 0,
hardPrice: 2E3,
profit: "150%",
reward: {
hard: 2E3,
unlimitedLives: "48 hours",
boosters: {
7: 2
}
}
}, {
id: 1,
hardPrice: 600,
profit: "300%",
reward: {
hard: 1600,
unlimitedLives: "24 hours",
boosters: {
2: 5
}
}
}],
RewardsConfig.Supplies = {
hardPrice: 2E3,
rewards: [{
unlimitedLives: "12 hours",
hard: 100,
boosters: {
5: 3
}
}, {
unlimitedLives: "12 hours",
hard: 200,
boosters: {
6: 3
}
}, {
unlimitedLives: "12 hours",
hard: 300,
boosters: {
7: 3
}
}, {
unlimitedLives: "12 hours",
hard: 400,
boosters: {
0: 3
}
}, {
unlimitedLives: "12 hours",
hard: 500,
boosters: {
1: 2
}
}, {
unlimitedLives: "12 hours",
hard: 600,
boosters: {
2: 2
}
}, {
unlimitedLives: "72 hours",
hard: 700,
boosters: {
2: 4
}
}]
},
RewardsConfig.ChainSale = [{
reward: {
hard: 30
}
}, {
watchAds: !0,
reward: {
hard: 50,
boosters: {
5: 1
}
}
}, {
hardPrice: 600,
reward: {
hard: 400,
unlimitedLives: "24 hours"
}
}, {
reward: {
boosters: {
6: 1,
7: 1
}
}
}, {
watchAds: !0,
reward: {
boosters: {
0: 1,
1: 1
}
}
}, {
hardPrice: 2E3,
reward: {
hard: 1E3,
unlimitedLives: "24 hours"
}
}, {
reward: {
boosters: {
5: 1,
6: 1,
7: 1
}
}
}, {
watchAds: !0,
reward: {
hard: 1200,
unlimitedLives: "24 hours",
boosters: {
2: 3
}
}
}, {
hardPrice: 1E4,
reward: {
hard: 4500,
unlimitedLives: "72 hours",
exp: 10
}
}, {
reward: {
boosters: {
5: 8,
6: 8,
7: 8
}
}
}, {
watchAds: !0,
reward: {
boosters: {
0: 8,
1: 8,
2: 8
}
}
}],
RewardsConfig.ReturnBonus = {
unlimitedLives: "6 hours",
boosters: {
5: 1,
6: 1
}
},
RewardsConfig.StickersBook = [{
unlimitedLives: "2 hours"
}, {
boosters: {
5: 1
}
}, {
boosters: {
6: 1
}
}, {
hard: 150
}, {
boosters: {
5: 1,
7: 1
}
}, {
unlimitedLives: "4 hours"
}, {
boosters: {
5: 2,
6: 1
}
}, {
boosters: {
7: 1
}
}, {
boosters: {
6: 1,
7: 1
}
}, {
hard: 300,
unlimitedLives: "10 hours"
}]);
"solitaire" === cleverapps.config.type && (RewardsConfig.MiniGame = [{
hard: 50,
randomBoosters: {
types: [10, 11, 12],
amount: 1
}
}, {
hard: 50,
randomBoosters: {
types: [10, 11, 12],
amount: 2
}
}, {
randomBoosters: {
types: [10, 11, 12],
amount: 1
}
}, {
randomBoosters: {
types: [10, 11, 12],
amount: 2
}
}],
RewardsConfig.MiniGameBeginner = [{
hard: 50
}, {
hard: 100
}],
RewardsConfig.MiniGameNovice = [{
hard: 50,
randomBoosters: {
types: [10, 11, 12],
amount: 1
}
}],
RewardsConfig.TreasureSearch = {
stages: [{
boosters: {
10: 1,
11: 1
}
}, {
unlimitedLives: "2 hours",
boosters: {
10: 2,
11: 1
}
}, {
boosters: {
10: 2,
11: 1,
12: 1
}
}, {
unlimitedLives: "6 hours",
boosters: {
10: 2,
11: 2,
12: 1
}
}, {
boosters: {
10: 2,
11: 2,
12: 2
},
hard: 250
}]
},
RewardsConfig.Tournament = {
places: [{
boosters: {
10: 2,
11: 2,
12: 2
},
unlimitedLives: "3 hours"
}, {
boosters: {
11: 2,
12: 2
},
unlimitedLives: "1 hour"
}, {
boosters: {
10: 1,
11: 1,
12: 1
},
unlimitedLives: "30 minutes"
}, {
boosters: {
11: 1,
12: 1
},
unlimitedLives: "15 minutes"
}, {
boosters: {
10: 1,
11: 1
},
unlimitedLives: "15 minutes"
}]
},
RewardsConfig.DailyTask = {
easy: [{
unlimitedLives: "15 minutes"
}],
medium: [{
boosters: {
12: 1
}
}],
hard: [{
unlimitedLives: "30 minutes"
}],
completeAll: [{
boosters: {
10: 1,
11: 1
},
unlimitedLives: "30 minutes"
}]
},
RewardsConfig.DailyCup = [{
unlimitedLives: "1 day",
boosters: {
10: 5,
11: 5,
12: 5
}
}, {
unlimitedLives: "6 hours",
boosters: {
10: 4,
11: 4,
12: 4
}
}, {
unlimitedLives: "3 hours",
boosters: {
10: 3,
11: 3,
12: 3
}
}, {
unlimitedLives: "1 hour",
boosters: {
10: 2,
11: 2,
12: 2
}
}, {
unlimitedLives: "30 minutes",
boosters: {
10: 1,
11: 1,
12: 1
}
}, {
unlimitedLives: "30 minutes",
boosters: {
10: 1,
11: 1,
12: 1
}
}, {
unlimitedLives: "30 minutes",
boosters: {
10: 1,
11: 1,
12: 1
}
}, {
unlimitedLives: "15 minutes",
boosters: {
10: 1,
11: 1,
12: 1
}
}, {
unlimitedLives: "15 minutes",
boosters: {
10: 1,
11: 1,
12: 1
}
}, {
unlimitedLives: "15 minutes",
boosters: {
10: 1,
11: 1,
12: 1
}
}],
RewardsConfig.Packs = [{
boosters: {
10: 2,
11: 2,
12: 2
},
hard: 200
}, {
boosters: {
10: 6,
11: 6,
12: 6
},
hard: 800
}, {
boosters: {
10: 30,
11: 30,
12: 30
},
hard: 8E3
}],
RewardsConfig.Subscription = {
boosters: {
10: 2,
11: 2,
12: 2
},
hard: 250,
unlimitedLives: "3 hours"
},
RewardsConfig.PromotionSale = [{
id: 0,
hardPrice: 2E3,
profit: "30%",
reward: {
boosters: {
10: 7,
12: 5
},
hard: 1500
}
}, {
id: 1,
hardPrice: 600,
profit: "275%",
reward: {
boosters: {
11: 5,
12: 5
},
hard: 1E3
}
}],
RewardsConfig.Supplies = {
hardPrice: 2E3,
rewards: [{
boosters: {
10: 1,
11: 1
},
unlimitedLives: "3 hours"
}, {
hard: 50,
boosters: {
11: 2,
12: 1
}
}, {
hard: 100,
boosters: {
10: 2,
12: 1
}
}, {
boosters: {
10: 2,
11: 2
},
unlimitedLives: "3 hours"
}, {
boosters: {
12: 2,
11: 2
},
unlimitedLives: "6 hours"
}, {
hard: 150,
boosters: {
11: 1,
12: 1
}
}, {
hard: 300,
boosters: {
10: 3,
12: 3,
11: 3
}
}]
},
RewardsConfig.ChainSale = [{
reward: {
hard: 100
}
}, {
watchAds: !0,
reward: {
unlimitedLives: "3 hours",
boosters: {
11: 1
}
}
}, {
hardPrice: 600,
reward: {
boosters: {
12: 3,
11: 3
},
hard: 100
}
}, {
reward: {
boosters: {
12: 1,
10: 1
},
hard: 200
}
}, {
watchAds: !0,
reward: {
unlimitedLives: "6 hours",
boosters: {
11: 1
},
hard: 200
}
}, {
hardPrice: 2E3,
reward: {
boosters: {
12: 5,
10: 5
},
hard: 1E3
}
}, {
reward: {
boosters: {
10: 3,
12: 1
}
}
}, {
watchAds: !0,
reward: {
unlimitedLives: "9 hours",
boosters: {
11: 3,
12: 1
}
}
}],
RewardsConfig.ReturnBonus = {
unlimitedLives: "3 hours",
boosters: {
11: 2,
12: 2
}
},
RewardsConfig.StickersBook = [{
boosters: {
10: 2
}
}, {
hard: 150
}, {
boosters: {
11: 2
}
}, {
boosters: {
12: 1
}
}, {
boosters: {
10: 1,
11: 1
}
}, {
boosters: {
10: 1,
12: 1
}
}, {
hard: 250
}, {
boosters: {
11: 1,
12: 1
}
}, {
boosters: {
10: 1,
11: 1,
12: 1
}
}, {
hard: 300
}],
RewardsConfig.PinballRewards = [{
boosters: {
10: 1,
11: 1,
12: 3
}
}, {
unlimitedLives: "12 hours",
boosters: {
10: 6,
12: 3
}
}, {
hard: 750,
unlimitedLives: "12 hours",
boosters: {
10: 5,
11: 5
}
}],
RewardsConfig.PinballPack = {
pinballChips: 15,
boosters: {
11: 3,
12: 1
}
});
"differences" === cleverapps.config.type && (RewardsConfig.Tournament = {
places: [{
boosters: {
8: 3,
9: 3
},
unlimitedLives: "3 hours"
}, {
boosters: {
8: 2,
9: 2
},
unlimitedLives: "1 hour"
}, {
boosters: {
8: 1,
9: 1
},
unlimitedLives: "30 minutes"
}, {
boosters: {
8: 1
},
unlimitedLives: "15 minutes"
}, {
boosters: {
9: 1
},
unlimitedLives: "15 minutes"
}]
},
RewardsConfig.DailyTask = {
easy: [{
unlimitedLives: "15 minutes"
}],
medium: [{
boosters: {
8: 1
}
}],
hard: [{
unlimitedLives: "30 minutes"
}],
completeAll: [{
unlimitedLives: "15 minutes",
boosters: {
8: 1,
9: 1
}
}]
},
RewardsConfig.MiniGame = [{
hard: 50,
randomBoosters: {
types: [8, 9],
amount: 1
}
}, {
hard: 100
}],
RewardsConfig.MiniGameBeginner = [{
hard: 50,
randomBoosters: {
types: [8, 9],
amount: 1
}
}, {
hard: 100
}],
RewardsConfig.MiniGameNovice = [{
hard: 50,
randomBoosters: {
types: [8, 9],
amount: 1
}
}],
RewardsConfig.TreasureSearch = {
stages: [{
unlimitedLives: "12 hours",
boosters: {
8: 1,
9: 2
}
}, {
unlimitedLives: "12 hours",
boosters: {
8: 1,
9: 2
}
}, {
unlimitedLives: "12 hours",
boosters: {
8: 1,
9: 2
}
}, {
unlimitedLives: "12 hours",
boosters: {
8: 1,
9: 2
}
}, {
unlimitedLives: "12 hours",
boosters: {
8: 1,
9: 2
}
}]
},
RewardsConfig.DailyCup = [{
unlimitedLives: "1 day",
boosters: {
2: 1
}
}, {
unlimitedLives: "6 hours",
boosters: {
1: 1
}
}, {
unlimitedLives: "3 hours",
boosters: {
0: 1
}
}, {
unlimitedLives: "1 hour"
}, {
unlimitedLives: "30 minutes"
}, {
unlimitedLives: "30 minutes"
}, {
unlimitedLives: "30 minutes"
}, {
unlimitedLives: "15 minutes"
}, {
unlimitedLives: "15 minutes"
}, {
unlimitedLives: "15 minutes"
}],
RewardsConfig.Packs = [{
boosters: {
8: 2,
9: 2
},
hard: 200
}, {
boosters: {
8: 6,
9: 6
},
hard: 800
}, {
boosters: {
8: 30,
9: 30
},
hard: 8E3
}],
RewardsConfig.Subscription = {
unlimitedLives: "3 hours",
hard: 250,
boosters: {
8: 3,
9: 3
}
},
RewardsConfig.ReturnBonus = {
unlimitedLives: "3 hours",
boosters: {
8: 2,
9: 2
}
});
"olympics" === cleverapps.config.name && (RewardsConfig.Tournament = {
places: [{
hard: 300,
unlimitedLives: "1 hour"
}, {
hard: 250,
unlimitedLives: "45 minutes"
}, {
hard: 200,
unlimitedLives: "30 minutes"
}, {
hard: 100,
unlimitedLives: "15 minutes"
}, {
hard: 50,
unlimitedLives: "5 minutes"
}]
},
RewardsConfig.Subscription = {
hard: 600,
unlimitedLives: "3 hours"
},
RewardsConfig.TreasureSearch = {
stages: [{
unlimitedLives: "12 hours"
}, {
unlimitedLives: "12 hours"
}, {
unlimitedLives: "12 hours"
}, {
unlimitedLives: "12 hours"
}, {
unlimitedLives: "12 hours"
}]
},
RewardsConfig.WeeklyCup = [{
hard: 3E3
}, {
hard: 2E3
}, {
hard: 1E3
}, {
hard: 200
}, {
hard: 200
}, {
hard: 200
}, {
hard: 200
}, {
hard: 200
}, {
hard: 200
}, {
hard: 200
}],
RewardsConfig.DailyTask = {
easy: [{
hard: 80,
unlimitedLives: "10 minutes"
}],
medium: [{
hard: 120,
unlimitedLives: "15 minutes"
}],
hard: [{
hard: 160,
unlimitedLives: "30 minutes"
}],
completeAll: [{
hard: 180,
unlimitedLives: "30 minutes"
}]
});
"scramble" === cleverapps.config.name && (RewardsConfig.Tournament = {
places: [{
boosters: {
13: 2,
14: 2,
15: 2
}
}, {
boosters: {
14: 2,
15: 2
}
}, {
boosters: {
13: 1,
14: 1,
15: 1
}
}, {
boosters: {
14: 1,
15: 1
}
}, {
boosters: {
13: 1,
14: 1
}
}]
},
RewardsConfig.Packs = [{
boosters: {
13: 2,
14: 2,
15: 2
},
hard: 200
}, {
boosters: {
13: 6,
14: 6,
15: 6
},
hard: 800
}, {
boosters: {
13: 30,
14: 30,
15: 30
},
hard: 8E3
}],
RewardsConfig.DailyTask = {
easy: [{
boosters: {
13: 1
}
}],
medium: [{
boosters: {
14: 1
}
}],
hard: [{
boosters: {
15: 1
},
hard: 15
}],
completeAll: [{
boosters: {
14: 1,
15: 1
},
hard: 25
}]
},
RewardsConfig.DailyCup = [{
boosters: {
13: 5,
14: 5,
15: 5
},
hard: 300
}, {
boosters: {
13: 4,
14: 4,
15: 4
},
hard: 200
}, {
boosters: {
13: 3,
14: 3,
15: 3
},
hard: 100
}, {
boosters: {
13: 2,
14: 2,
15: 2
},
hard: 50
}, {
boosters: {
13: 1,
14: 1,
15: 1
},
hard: 50
}, {
boosters: {
13: 1,
14: 1,
15: 1
},
hard: 50
}, {
boosters: {
13: 1,
14: 1,
15: 1
},
hard: 50
}, {
boosters: {
13: 1,
14: 1,
15: 1
}
}, {
boosters: {
13: 1,
14: 1,
15: 1
}
}, {
boosters: {
13: 1,
14: 1,
15: 1
}
}],
RewardsConfig.MiniGame = [{
hard: 50,
randomBoosters: {
types: [14, 15],
amount: 1
}
}, {
hard: 50,
randomBoosters: {
types: [14, 15],
amount: 2
}
}, {
randomBoosters: {
types: [14, 15],
amount: 1
}
}, {
randomBoosters: {
types: [14, 15],
amount: 2
}
}],
RewardsConfig.MiniGameBeginner = [{
hard: 50
}, {
hard: 100
}],
RewardsConfig.MiniGameNovice = [{
hard: 50,
randomBoosters: {
types: [13, 14, 15],
amount: 1
}
}],
RewardsConfig.Subscription = {
hard: 250,
boosters: {
13: 2,
14: 2,
15: 2
}
},
RewardsConfig.TreasureSearch = {
stages: [{
hard: 10
}, {
boosters: {
13: 1
}
}, {
boosters: {
13: 2
}
}, {
boosters: {
14: 1
}
}, {
boosters: {
15: 1
}
}]
},
RewardsConfig.CookieJar = {
hard: 15
},
RewardsConfig.ReturnBonus = {
boosters: {
13: 1,
14: 1,
15: 1
}
},
RewardsConfig.Butterfly = [{
hard: 10,
boosters: {
13: 1
}
}, {
hard: 30,
boosters: {
14: 1
}
}, {
hard: 50,
boosters: {
15: 1
}
}],
RewardsConfig.PromotionSale = [{
id: 0,
hardPrice: 2E3,
profit: "+60%",
reward: {
hard: 300,
boosters: {
3: 5,
16: 5
}
}
}, {
id: 1,
hardPrice: 600,
profit: "+56%",
reward: {
hard: 300,
boosters: {
14: 3,
15: 3
}
}
}],
RewardsConfig.ChainSale = [{
reward: {
hard: 10
}
}, {
hardPrice: 600,
reward: {
hard: 100,
boosters: {
13: 1
}
}
}, {
reward: {
boosters: {
16: 1
}
}
}, {
reward: {
hard: 50,
boosters: {
13: 1
}
}
}, {
hardPrice: 2E3,
reward: {
hard: 250,
boosters: {
3: 3,
15: 3
}
}
}, {
reward: {
hard: 200,
boosters: {
14: 3
}
}
}, {
reward: {
hard: 250,
boosters: {
16: 1
}
}
}],
RewardsConfig.Supplies = {
hardPrice: 2E3,
rewards: [{
hard: 30
}, {
hard: 80,
boosters: {
13: 1
}
}, {
hard: 100,
boosters: {
14: 1
}
}, {
hard: 150,
boosters: {
16: 1
}
}, {
hard: 200,
boosters: {
15: 1
}
}, {
hard: 300,
boosters: {
3: 1
}
}, {
boosters: {
13: 3,
14: 3,
15: 3
}
}]
},
RewardsConfig.StickersBook = [{
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 350
}, {
hard: 350
}, {
hard: 350
}, {
hard: 350
}]);
"merge" === cleverapps.config.type && (RewardsConfig.ReturnBonus = {
energy: 100,
worker: "6 hour"
},
RewardsConfig.Packs = [{
hard: 50,
energy: 200
}, {
hard: 100,
energy: 350,
wands: 250,
worker: "3 day"
}, {
hard: 1E3,
energy: 1500,
wands: 500,
soft: 3E3,
worker: "5 day"
}],
RewardsConfig.LivesFeast = {
places: [{
unit: [{
code: "treasure",
stage: 2,
amount: 1
}, {
code: "energytree",
stage: 2,
amount: 1
}]
}, {
unit: [{
code: "treasure",
stage: 1,
amount: 1
}, {
code: "energytree",
stage: 1,
amount: 1
}]
}, {
unit: [{
code: "treasure",
stage: 0,
amount: 1
}, {
code: "energytree",
stage: 0,
amount: 1
}]
}],
offer: {
energy: 250,
worker: Product.FormatTimePeriod("1 day", !0)
}
},
RewardsConfig.SoftFeast = {
places: [{
unit: [{
code: "treasure",
stage: 2,
amount: 1
}, {
code: "coinstree",
stage: 2,
amount: 1
}]
}, {
unit: [{
code: "treasure",
stage: 1,
amount: 1
}, {
code: "coinstree",
stage: 1,
amount: 1
}]
}, {
unit: [{
code: "treasure",
stage: 0,
amount: 1
}, {
code: "coinstree",
stage: 0,
amount: 1
}]
}],
offer: {
soft: 1E3,
energy: 100
}
},
RewardsConfig.KrakenFeast = {
places: [{
unit: {
code: "energytree",
stage: 2,
amount: 1
}
}, {
unit: {
code: "energytree",
stage: 1,
amount: 1
}
}, {
unit: {
code: "energytree",
stage: 0,
amount: 1
}
}],
offer: {
kraken: !0,
unit: [{
code: "wands",
stage: 4,
amount: 2
}, {
code: "sacks",
stage: 2,
amount: 3
}]
}
},
RewardsConfig.ExpeditionFeast = {
places: [{
unit: {
code: "treasure",
stage: 2,
amount: 1
}
}, {
unit: {
code: "treasure",
stage: 1,
amount: 1
}
}, {
unit: {
code: "treasure",
stage: 0,
amount: 1
}
}]
},
RewardsConfig.SnailFeast = {
places: [{
unit: [{
code: "worker",
stage: 3,
amount: 2
}, {
code: "sacks",
stage: 2,
amount: 1
}, {
code: "coins",
stage: 5,
amount: 1
}]
}, {
unit: [{
code: "wands",
stage: 2,
amount: 3
}, {
code: "sacks",
stage: 1,
amount: 1
}, {
code: "coins",
stage: 1,
amount: 1
}]
}, {
unit: [{
code: "worker",
stage: 1,
amount: 1
}, {
code: "sacks",
stage: 0,
amount: 1
}]
}]
},
RewardsConfig.BuildPass = {
offer: {
unit: [{
code: "crystal",
stage: 3,
amount: 2
}, {
code: "bppointsstar",
stage: 0,
amount: 1,
pointsValue: 250
}]
}
},
RewardsConfig.SalePass = {
offer: {
unit: [{
code: "bppointscrystal",
stage: 0,
amount: 1,
pointsValue: 250
}],
soft: 1200
}
},
RewardsConfig.CollectionsPass = {
offer: {
hard: 500,
soft: 500,
unit: [{
code: "crystal",
stage: 3,
amount: 3
}, {
code: "clsack",
stage: 0,
amount: 5
}]
}
},
RewardsConfig.Subscription = {
worker: {
subscription: !0
},
energy: 100,
unit: {
code: "treasure",
stage: 2,
amount: 1
}
},
RewardsConfig.SubscriptionInstant = {
energy: 50,
unit: {
code: "treasure",
stage: 1,
amount: 1
}
},
RewardsConfig.DragoniaPack = {
hard: 1200,
unit: [{
code: "dragonpack",
stage: 0,
amount: 1
}]
},
RewardsConfig.Dragonia2Pack = {
hard: 1200,
unit: [{
code: "dr2dragonpack",
stage: 0,
amount: 1
}]
},
RewardsConfig.BlackFridayPack = {
hard: 800,
energy: 300,
unit: [{
code: "dr2dragonpack",
stage: 0,
amount: 1
}]
},
RewardsConfig.BlackFridayPackMain = {
hard: 500,
energy: 500,
unit: [{
code: "herochest",
stage: 2,
amount: 3
}, {
code: "worker",
stage: 3,
amount: 3
}]
},
RewardsConfig.UnderseaPack = {
hard: 1200,
unit: [{
code: "underseapack",
stage: 0,
amount: 1
}]
},
RewardsConfig.Undersea2Pack = {
hard: 1200,
unit: [{
code: "sea2pack",
stage: 0,
amount: 1
}]
},
RewardsConfig.ClanCup = [{
soft: 800
}, {
soft: 400
}, {
soft: 270
}, {
soft: 200
}, {
soft: 130
}],
RewardsConfig.SnailPack = {
unit: [{
code: "seasnailhouse",
stage: 0,
amount: 3
}]
},
RewardsConfig.SnailHouseDragoniaPack = {
unit: [{
code: "drsnailhouse",
stage: 0,
amount: 3
}]
},
RewardsConfig.RapunzelPack = {
hard: 800,
energy: 300
},
RewardsConfig.XmasPack = {
hard: 1200,
unit: [{
code: "xmpack",
stage: 0,
amount: 1
}]
},
RewardsConfig.ChinaPack = {
hard: 600,
energy: 600
},
RewardsConfig.EasterPack = {
hard: 800,
energy: 300
},
RewardsConfig.DailyTask = {
easy: [{
soft: 15
}],
medium: [{
soft: 30
}],
hard: [{
soft: 45
}],
completeAll: [{
unit: {
code: "dailytaskchest",
stage: 0,
amount: 1
}
}]
},
RewardsConfig.PromotionSale = [{
id: 0,
hardPrice: 1E3,
profit: "150%",
reward: {
energy: 500,
hard: 150,
unit: [{
code: "energycup",
stage: 2,
amount: 3
}]
}
}, {
id: 1,
hardPrice: 300,
profit: "300%",
reward: {
energy: 500,
soft: 500,
unit: {
code: "energytree",
stage: 2,
amount: 1
}
}
}],
RewardsConfig.ClPromotionSale = [{
id: 0,
hardPrice: 1E3,
profit: "150%",
reward: {
unit: [{
code: "clstrawberry",
stage: 3,
amount: 5
}, {
code: "clsimplechest",
stage: 2,
amount: 3
}, {
code: "clsack",
stage: 0,
amount: 5
}]
}
}, {
id: 1,
hardPrice: 300,
profit: "300%",
reward: {
hard: 150,
unit: [{
code: "clpaychest",
stage: 2,
amount: 1
}, {
code: "crystal",
stage: 3,
amount: 3
}]
}
}],
RewardsConfig.PrPromotionSale = [{
id: 0,
hardPrice: 1E3,
profit: "150%",
reward: {
energy: 300,
worker: "3 days",
unit: [{
code: "caravanbox",
stage: 2,
amount: 1
}, {
code: "crystal",
stage: 3,
amount: 3
}]
}
}, {
id: 1,
hardPrice: 300,
profit: "300%",
reward: {
unit: [{
code: "worker",
stage: 4,
amount: 3
}, {
code: "magicplant",
stage: 8,
amount: 1
}, {
code: "herochest",
stage: 2,
amount: 5
}],
hard: 500
}
}],
RewardsConfig.Supplies = {
hardPrice: 1E3,
rewards: [{
energy: 90,
soft: 200,
unit: [{
code: "energycup",
stage: 2,
amount: 1
}]
}, {
energy: 90,
hard: 30,
unit: [{
code: "treasure",
stage: 2,
amount: 1
}]
}, {
energy: 90,
soft: 300,
unit: [{
code: "crystal",
stage: 3,
amount: 1
}]
}, {
energy: 90,
hard: 50,
unit: [{
code: "herochest",
stage: 2,
amount: 1
}]
}, {
energy: 90,
soft: 400,
unit: [{
code: "worker",
stage: 4,
amount: 1
}]
}, {
energy: 90,
hard: 70,
unit: [{
code: "seasonchest",
stage: 2,
amount: 1
}]
}, {
energy: 150,
hard: 100,
soft: 500,
worker: "12 hour"
}]
},
RewardsConfig.ClSupplies = {
rewards: [{
soft: 200,
unit: [{
code: "clsack",
stage: 0,
amount: 1
}, {
code: "clsimplechest",
stage: 0,
amount: 1
}]
}, {
unit: [{
code: "clstrawberry",
stage: 3,
amount: 1
}, {
code: "clsimplechest",
stage: 1,
amount: 1
}, {
code: "clsack",
stage: 0,
amount: 2
}]
}, {
soft: 300,
unit: [{
code: "crystal",
stage: 2,
amount: 1
}, {
code: "clstrawberry",
stage: 4,
amount: 3
}]
}, {
hard: 50,
unit: [{
code: "clsimplechest",
stage: 2,
amount: 1
}, {
code: "clsack",
stage: 0,
amount: 3
}]
}, {
soft: 400,
unit: [{
code: "clpaychest",
stage: 0,
amount: 1
}, {
code: "clstrawberry",
stage: 3,
amount: 3
}]
}, {
hard: 70,
unit: [{
code: "clpaychest",
stage: 1,
amount: 1
}, {
code: "clsack",
stage: 0,
amount: 5
}]
}, {
hard: 100,
soft: 500,
unit: [{
code: "clpaychest",
stage: 2,
amount: 1
}, {
code: "clstrawberry",
stage: 3,
amount: 5
}]
}]
},
RewardsConfig.ChainSale = [{
reward: {
soft: 50
}
}, {
watchAds: !0,
reward: {
energy: 10,
soft: 80
}
}, {
hardPrice: 300,
reward: {
energy: 150,
soft: 350
}
}, {
reward: {
hard: 70,
worker: "3 hour"
}
}, {
watchAds: !0,
reward: {
soft: 200,
wands: 50
}
}, {
hardPrice: 1E3,
reward: {
soft: 1E3,
energy: 250,
unit: [{
code: "worker",
stage: 4,
amount: 2
}]
}
}, {
reward: {
wands: 100,
hard: 150
}
}, {
watchAds: !0,
reward: {
worker: "12 hour",
hard: 300,
energy: 300
}
}, {
hardPrice: 5E3,
reward: {
hard: 500,
energy: 500,
unit: [{
code: "worker",
stage: 4,
amount: 5
}]
}
}, {
reward: {
wands: 250,
soft: 500,
unit: [{
code: "crystal",
stage: 3,
amount: 5
}]
}
}, {
watchAds: !0,
reward: {
worker: "7 day",
hard: 1E3,
energy: 550
}
}],
RewardsConfig.ClChainSale = [{
reward: {
unit: [{
code: "clstrawberry",
stage: 0,
amount: 1
}]
}
}, {
watchAds: !0,
reward: {
unit: [{
code: "clsack",
stage: 0,
amount: 1
}, {
code: "clstrawberry",
stage: 4,
amount: 2
}]
}
}, {
hardPrice: 300,
reward: {
soft: 350,
unit: [{
code: "clsimplechest",
stage: 2,
amount: 2
}]
}
}, {
reward: {
unit: [{
code: "clsimplechest",
stage: 2,
amount: 1
}, {
code: "clstrawberry",
stage: 2,
amount: 2
}]
}
}, {
watchAds: !0,
reward: {
unit: [{
code: "clpaychest",
stage: 1,
amount: 1
}, {
code: "clsack",
stage: 0,
amount: 2
}]
}
}, {
hardPrice: 1E3,
reward: {
soft: 1E3,
unit: [{
code: "clstrawberry",
stage: 3,
amount: 3
}, {
code: "crystal",
stage: 3,
amount: 3
}]
}
}, {
reward: {
unit: [{
code: "clsack",
stage: 0,
amount: 3
}, {
code: "clstrawberry",
stage: 3,
amount: 2
}]
}
}, {
watchAds: !0,
reward: {
unit: [{
code: "clsimplechest",
stage: 2,
amount: 3
}, {
code: "clpaychest",
stage: 1,
amount: 1
}, {
code: "clstrawberry",
stage: 3,
amount: 3
}]
}
}, {
hardPrice: 5E3,
reward: {
hard: 300,
unit: [{
code: "clpaychest",
stage: 2,
amount: 3
}, {
code: "crystal",
stage: 3,
amount: 5
}]
}
}, {
reward: {
unit: [{
code: "clsack",
stage: 0,
amount: 5
}, {
code: "clstrawberry",
stage: 3,
amount: 5
}, {
code: "clsimplechest",
stage: 2,
amount: 3
}]
}
}, {
watchAds: !0,
reward: {
unit: [{
code: "clsimplechest",
stage: 2,
amount: 3
}, {
code: "clpaychest",
stage: 2,
amount: 3
}, {
code: "clstrawberry",
stage: 3,
amount: 5
}]
}
}]);
"tile3" === cleverapps.config.type && (RewardsConfig.MiniGame = [{
soft: 100,
randomBoosters: {
types: [17, 18],
amount: 1
}
}, {
soft: 100,
randomBoosters: {
types: [17, 18],
amount: 2
}
}, {
randomBoosters: {
types: [17, 18, 23],
amount: 1
}
}, {
randomBoosters: {
types: [17, 18, 23],
amount: 2
}
}],
RewardsConfig.MiniGameBeginner = [{
soft: 100
}, {
soft: 150
}],
RewardsConfig.MiniGameNovice = [{
soft: 100,
randomBoosters: {
types: [17, 18, 23],
amount: 1
}
}],
RewardsConfig.DailyTask = {
easy: [{
unlimitedLives: "15 minutes"
}],
medium: [{
unlimitedLives: "15 minutes"
}],
hard: [{
unlimitedLives: "15 minutes"
}],
completeAll: [{
unlimitedLives: "15 minutes"
}]
},
RewardsConfig.Tournament = {
places: [{
soft: 300,
unlimitedLives: "3 hours"
}, {
soft: 200,
unlimitedLives: "1 hour"
}, {
soft: 100,
unlimitedLives: "30 minutes"
}, {
unlimitedLives: "15 minutes"
}, {
unlimitedLives: "15 minutes"
}]
},
RewardsConfig.Packs = [{
hard: 200,
soft: 800
}, {
hard: 800,
soft: 2500
}, {
hard: 5E3,
soft: 1E4
}],
RewardsConfig.PromotionSale = [{
id: 0,
hardPrice: 1E3,
profit: "150%",
reward: {
hard: 150,
soft: 2E3,
boosters: {
23: 7
}
}
}, {
id: 1,
hardPrice: 300,
profit: "300%",
reward: {
hard: 400,
soft: 3E3,
boosters: {
18: 10
}
}
}],
RewardsConfig.ChainSale = [{
reward: {
soft: 300
}
}, {
watchAds: !0,
reward: {
boosters: {
18: 1,
17: 1
}
}
}, {
hardPrice: 300,
reward: {
soft: 300,
boosters: {
17: 3,
23: 3
}
}
}, {
reward: {
soft: 100,
boosters: {
18: 1,
23: 1
}
}
}, {
watchAds: !0,
reward: {
soft: 150,
boosters: {
18: 3,
17: 1
}
}
}, {
hardPrice: 1E3,
reward: {
soft: 2E3,
boosters: {
23: 5,
18: 5
}
}
}, {
reward: {
hard: 200,
lives: 3
}
}, {
watchAds: !0,
reward: {
boosters: {
18: 3,
17: 2,
23: 1
}
}
}],
RewardsConfig.Supplies = {
hardPrice: 1E3,
rewards: [{
boosters: {
17: 1,
18: 1
},
unlimitedLives: "3 hours"
}, {
soft: 150,
boosters: {
18: 2,
23: 1
}
}, {
hard: 100,
boosters: {
17: 3,
23: 1
}
}, {
unlimitedLives: "3 hours",
boosters: {
18: 2,
23: 1
}
}, {
unlimitedLives: "6 hours",
boosters: {
17: 2,
18: 1
}
}, {
unlimitedLives: "6 hours",
boosters: {
18: 3,
23: 2
}
}, {
hard: 350,
soft: 1E3,
boosters: {
18: 3,
23: 3
}
}]
},
RewardsConfig.StickersBook = [{
boosters: {
17: 1
}
}, {
soft: 300
}, {
boosters: {
18: 2
}
}, {
boosters: {
23: 1
}
}, {
boosters: {
17: 1,
18: 1
}
}, {
boosters: {
18: 1,
23: 1
}
}, {
soft: 500
}, {
boosters: {
18: 1,
23: 2
}
}, {
boosters: {
23: 2
}
}, {
soft: 700
}],
RewardsConfig.ReturnBonus = {
unlimitedLives: "3 hours",
boosters: {
17: 2,
23: 2
}
});
"blocks" === cleverapps.config.type && (RewardsConfig.PromotionSale = [{
id: 0,
product: "gold500",
profit: "+78%",
reward: {
hard: 50,
soft: 500
}
}, {
id: 1,
product: "gold1800",
profit: "+52%",
reward: {
hard: 150,
soft: 1500
}
}, {
id: 2,
product: "gold3800",
profit: "+45%",
reward: {
hard: 300,
soft: 3E3
}
}, {
id: 3,
product: "gold6000",
profit: "+43%",
reward: {
hard: 550,
soft: 4500
}
}, {
id: 4,
product: "gold25000",
profit: "+40%",
reward: {
hard: 3E3,
soft: 12E3
}
}],
RewardsConfig.TreasureSearch = {
stages: [{
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}, {
hard: 100
}]
},
RewardsConfig.Tournament = {
places: [{
hard: 300
}, {
hard: 250
}, {
hard: 200
}, {
hard: 100
}, {
hard: 50
}]
},
RewardsConfig.ReturnBonus = {
unlimitedLives: "3 hours",
boosters: {
20: 2,
21: 2
}
},
RewardsConfig.StickersBook = [{
boosters: {
22: 1
}
}, {
boosters: {
20: 1
}
}, {
soft: 250
}, {
boosters: {
22: 1,
20: 1
}
}, {
boosters: {
22: 2,
20: 2
}
}, {
soft: 300
}, {
boosters: {
21: 1
}
}, {
boosters: {
20: 2,
21: 1
}
}, {
boosters: {
22: 1,
21: 2
}
}, {
soft: 500
}],
RewardsConfig.DailyTask = {
easy: [{
unlimitedLives: "15 minutes"
}],
medium: [{
unlimitedLives: "15 minutes"
}],
hard: [{
unlimitedLives: "15 minutes"
}],
completeAll: [{
unlimitedLives: "15 minutes"
}]
},
RewardsConfig.MiniGame = [{
soft: 100,
randomBoosters: {
types: [20, 22],
amount: 1
}
}, {
soft: 100,
randomBoosters: {
types: [20, 22],
amount: 2
}
}, {
randomBoosters: {
types: [20, 21, 22],
amount: 1
}
}, {
randomBoosters: {
types: [20, 21, 22],
amount: 2
}
}],
RewardsConfig.MiniGameBeginner = [{
soft: 100
}, {
soft: 150
}],
RewardsConfig.MiniGameNovice = [{
soft: 100,
randomBoosters: {
types: [20, 21, 22],
amount: 1
}
}]);
"wordsoup" === cleverapps.config.name && (RewardsConfig.ReturnBonus = {
homeStar: 10,
hard: 150
});
"woodenblock" === cleverapps.config.name && (RewardsConfig.BoosterOffer = {
boosters: {
21: 10
}
},
RewardsConfig.Packs = {
0: {
hard: 150,
soft: 500,
boosters: {
21: 1,
22: 1
}
},
1: {
hard: 500,
soft: 1500,
unlimitedLives: "48 hours",
boosters: {
20: 1
}
},
2: {
hard: 3500,
soft: 1E4,
boosters: {
20: 15,
21: 15
}
}
});
var UserIdsHistory = function() {
this.ids = [];
this.diff = [];
this.load();
this.sendToServer()
};
UserIdsHistory.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.USER_IDS_HISTORY);
a && (this.ids = a.ids || [],
this.diff = a.diff || [])
}
;
UserIdsHistory.prototype.add = function(a) {
PlatformLogic.isTmpId(a) && 0 === cleverapps.user.getFloatLevel() && !cleverapps.paymentsHistory.isPayer() || a === connector.platform.getUserID() || this.ids.includes(a) || (console.log("UserIdsHistory add", a),
this.ids.push(a),
this.diff.push(a),
this.save(),
this.sendToServer())
}
;
UserIdsHistory.prototype.sendToServer = function() {
this.diff.length && cleverapps.RestClient.post("/useridshistory/" + encodeURIComponent(connector.platform.getUserID()), {
ids: this.diff
}, function() {
console.log("UserIdsHistory send success");
this.diff = [];
this.save()
}
.bind(this), function() {
console.log("UserIdsHistory send failed")
})
}
;
UserIdsHistory.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.USER_IDS_HISTORY, {
ids: this.ids,
diff: this.diff
})
}
;
var CustomSyncers = {
extractors: {
users: function() {
return cleverapps.user.getInfo()
},
tournament: function() {
if (Game.currentGame && Game.currentGame.competition && Game.currentGame.competition.options && "tournament" === Game.currentGame.competition.options.type) {
var a = Game.currentGame.competition.results.filter(function(b) {
return !b.player
});
return {
level: Game.currentGame.competition.options.level.getHumanReadableNumber(),
results: a
}
}
},
userdelete: function() {
return cleverapps.userDelete.getInfo()
},
bonuses: function() {
if (cleverapps.miniGame)
return {
event: cleverapps.miniGame.when
}
},
settings: function() {
return cleverapps.settings.getSaveInfo()
},
serverflags: function() {
return cleverapps.serverFlags.getInfo()
},
tempgoods: function() {
if (cleverapps.unlimitedLives)
return cleverapps.unlimitedLives.getInfo()
},
boosters: function() {
if (cleverapps.boosters)
return cleverapps.boosters.data
},
starchests: function() {
if (cleverapps.starChest)
return {
stars: cleverapps.starChest.stars
}
},
dailytasks: function() {
if (cleverapps.dailyTasks)
return cleverapps.dailyTasks.getInfo()
},
missions: function() {
return cleverapps.missionManager.getInfo()
},
offers: function() {
return cleverapps.offerManager.getInfo()
},
heroes: function() {
if ("undefined" !== typeof match3 && match3 && match3.heroes)
return match3.heroes.getInfo()
},
subscription: function() {
return cleverapps.subscription.getInfo(!0)
},
forces: function() {
return cleverapps.forces.getInfo()
},
metha: function() {
if (cleverapps.meta.getInfo)
return cleverapps.meta.getInfo();
if (cleverapps.meta.getMainObject().getInfo)
return cleverapps.meta.getMainObject().getInfo()
},
cookiejar: function() {
if (levels && levels.cookieJar)
return levels.cookieJar.getCounterValue()
},
competitionstatistics: function() {
return cleverapps.competitionStatistics.getInfo()
},
growthfund: function() {
if (cleverapps.growthFund)
return cleverapps.growthFund.getInfo()
},
unitsshop: function() {
if (cleverapps.unitsShop)
return cleverapps.unitsShop.getInfo()
},
paymentshistory: function() {
return cleverapps.paymentsHistory.getInfo()
},
army: function() {
if (cleverapps.army)
return cleverapps.army.getInfo()
},
armylibrary: function() {
if (cleverapps.armyLibrary)
return cleverapps.armyLibrary.getInfo()
},
achievements: function() {
if (cleverapps.achievements)
return cleverapps.achievements.getInfo()
},
noAds: function() {
return cleverapps.noAds.getState()
},
stickersbook: function() {
if (cleverapps.stickersBook)
return cleverapps.stickersBook.getInfo()
}
},
importerData: {
users: function(a) {
cleverapps.user.updateInfo(a);
cleverapps.hose && cleverapps.hose.reset();
cleverapps.playButton && cleverapps.playButton.update()
},
tournament: function(a) {
a && a.level && a.results && cleverapps.dataLoader.save(DataLoader.TYPES.COMPETITION + "_tournament", a)
},
userdelete: function(a) {
cleverapps.userDelete.updateInfo(a)
},
bonuses: function(a) {
if (cleverapps.miniGame) {
var b = cleverapps.miniGame;
a.event < b.when || a.event > Date.now() + b.interval || (b.locked = !0,
b.setWhenUnlock(a.event),
b.save(!1),
b.changeLockedListener())
}
},
settings: function() {},
boosters: function(a) {
cleverapps.boosters && (cleverapps.boosters.data = a,
cleverapps.boosters.save(!1),
cleverapps.boosters.addInitAmount())
},
serverflags: function(a) {
cleverapps.serverFlags.updateInfo(a, !0)
},
tempgoods: function(a) {
cleverapps.unlimitedLives && cleverapps.unlimitedLives.updateInfo(a, !0)
},
missions: function(a) {
cleverapps.missionManager.updateInfo(a, !0);
cleverapps.travelBook.updatePages()
},
offers: function(a) {
cleverapps.offerManager.updateInfo(a, !0)
},
starchests: function(a) {
cleverapps.starChest && cleverapps.starChest.updateInfo(a, !0)
},
dailytasks: function(a) {
cleverapps.dailyTasks && (cleverapps.dailyTasks.load(a),
cleverapps.dailyTasks.save(!1),
cleverapps.dailyTasks.update())
},
heroes: function(a) {
"undefined" !== typeof match3 && match3 && match3.heroes && match3.heroes.updateInfo(a, !0)
},
subscription: function(a) {
cleverapps.subscription.updateInfo(a, !0)
},
forces: function(a) {
cleverapps.forces.updateInfo(a, !0)
},
metha: function(a) {
cleverapps.meta.updateInfo ? cleverapps.meta.updateInfo(a) : cleverapps.meta.getMainObject().updateInfo && cleverapps.meta.getMainObject().updateInfo(a)
},
cookiejar: function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.COOKIE_JAR, a && void 0 !== a.counterValue ? a.counterValue : a || 0);
levels && levels.cookieJar && levels.cookieJar.load()
},
competitionstatistics: function(a) {
cleverapps.competitionStatistics.updateInfo(a, !0)
},
growthfund: function(a) {
cleverapps.growthFund && cleverapps.growthFund.updateInfo(a)
},
unitsshop: function(a) {
cleverapps.unitsShop && cleverapps.unitsShop.updateInfo(a)
},
paymentshistory: function(a) {
cleverapps.paymentsHistory.updateInfo(a)
},
army: function(a) {
if (cleverapps.army)
return cleverapps.army.updateInfo(a)
},
armylibrary: function(a) {
if (cleverapps.armyLibrary)
return cleverapps.armyLibrary.updateInfo(a)
},
achievements: function(a) {
cleverapps.achievements && (cleverapps.achievements.load(a),
cleverapps.achievements.save(!1))
},
noAds: function(a) {
a && cleverapps.noAds.enable(!0)
},
stickersbook: function(a) {
cleverapps.stickersBook && cleverapps.stickersBook.updateInfo(a)
}
},
registerBySlots: function(a, b, c) {
Meta.SLOTS.forEach(function(d) {
CustomSyncers.extractors[a + d] = function() {
return b(d)
}
;
CustomSyncers.importerData[a + d] = function(e) {
return c(d, e)
}
});
cleverapps.config.debugMode && (CustomSyncers.extractors[a + "_snapshot"] = b,
CustomSyncers.importerData[a + "_snapshot"] = c,
b.useSlots = !0,
c.useSlots = !0)
}
};
cleverapps.Synchronizer = function() {
this._session = "a";
var a = cleverapps.dataLoader.load(DataLoader.TYPES.SESSION_SAVE_KEY, {
raw: !0
});
null !== a && void 0 !== a && (this._session = a);
this._syncIn = new cleverapps.SyncIn;
this._syncOut = new cleverapps.SyncOut;
this._needResync = this._syncInProgress = !1;
this._syncId = 0;
this._clientSessionExpired = !1;
this._clientChecksumDifferent = !1 === cleverapps.dataLoader.checksumMatch;
this.lastSyncIn = cleverapps.dataLoader.load(DataLoader.TYPES.LAST_SYNC_IN) || 0;
(cleverapps.isLocalhost() || cleverapps.config.debugMode) && delete this._clientChecksumDifferent;
this.synced = !1;
cleverapps.dataLoader.checkClientSession() || this.clientSessionExpired()
}
;
cleverapps.Synchronizer.prototype.updateLastSyncIn = function() {
this.lastSyncIn = Date.now();
cleverapps.dataLoader.save(DataLoader.TYPES.LAST_SYNC_IN, this.lastSyncIn)
}
;
cleverapps.Synchronizer.prototype._startCheckInterval = function() {
if (!this._checkIntervalRunned) {
this._checkIntervalRunned = !0;
var a = 0;
cleverapps.timeouts.setInterval(function() {
a++;
this.synced && 0 !== a % 15 || this.syncWhenReady()
}
.bind(this), 6E4);
return !0
}
return !1
}
;
cleverapps.Synchronizer.prototype.needClientSessionExpiredWindow = function() {
return this._clientSessionExpired
}
;
cleverapps.Synchronizer.prototype.showClientSessionExpiredWindow = function() {
cleverapps.focusManager.display({
focus: "clientSessionExpired",
action: function() {
new RestartWindow({
title: "ClientSessionExpired.title",
contentMessage: "ClientSessionExpired.message"
})
}
})
}
;
cleverapps.Synchronizer.prototype.clientSessionExpired = function() {
this._clientSessionExpired || (this.synced = !1,
this._clientSessionExpired = !0,
cleverapps.allInitialized && (cleverapps.focusManager.isFocused() || this.showClientSessionExpiredWindow()))
}
;
cleverapps.Synchronizer.prototype.reset = function() {
this.synced = !1;
this._loadedSync = this._loadedSession = void 0;
this._session = "a";
this._needResync = this._syncInProgress = !1;
cleverapps.dataLoader.remove(DataLoader.TYPES.SESSION_SAVE_KEY);
this._syncOut.reset()
}
;
cleverapps.Synchronizer.prototype.isReady = function() {
return !this._syncIn.isReloadInProcess() && !this._syncInProgress && !this._inGetProgress
}
;
cleverapps.Synchronizer.prototype.syncWhenReady = function() {
this._syncIn.isReloadInProcess() || (cleverapps.dataLoader.checkClientSession(),
this._syncInProgress ? this._needResync = !0 : this._sync())
}
;
cleverapps.Synchronizer.prototype.addUpdateTask = function(a) {
cleverapps.flags.norest || this._syncOut.addUpdateTask(a)
}
;
cleverapps.Synchronizer.prototype.on = function() {
this._clientSessionExpired || (void 0 !== this._loadedSession && (this._session = this._loadedSession,
cleverapps.dataLoader.save(DataLoader.TYPES.SESSION_SAVE_KEY, this._session, {
raw: !0
}),
cleverapps.dataLoader.processSaveQueue()),
this._loadedSync = this._loadedSession = void 0,
this.synced = !0,
this._syncOut.run(),
this._inGetProgress && (this._syncOut.sendAllData(),
this._syncOut.onTasksEmptyListener = function() {
this._syncInProgress = !1;
this._inGetProgress = void 0
}
.bind(this)),
this._onSyncProcessed(),
this.onceSyncCompletedListener && (this.onceSyncCompletedListener(),
this.onceSyncCompletedListener = void 0),
this._needResync && (this._needResync = !1,
this.syncWhenReady()))
}
;
cleverapps.Synchronizer.prototype._getPath = function(a) {
return "/" + a + "/" + encodeURIComponent(connector.platform.getUserID()) + "/" + this._session
}
;
cleverapps.Synchronizer.prototype._syncCallback = function(a) {
var b = this._syncId;
return function() {
this._syncId !== b || this._clientSessionExpired || a.apply(this, arguments)
}
.bind(this)
}
;
cleverapps.Synchronizer.prototype.getProgress = function(a, b) {
a = "/getprogress/" + encodeURIComponent(connector.platform.getUserID()) + "/" + encodeURIComponent(a);
var c = {
version: cleverapps.config.version
};
b = b || {};
this._inGetProgress = this._syncInProgress = !0;
var d = function(f) {
console.log("Error", f);
this._syncInProgress = !1;
this._inGetProgress = void 0;
cleverapps.notification.create("Error load progress")
}
.bind(this)
, e = function(f) {
var g;
if (g = b.acceptOnlyIfBetter)
g = f.sync.users,
g = !(g && (g.episode !== cleverapps.user.episode ? g.episode > cleverapps.user.episode : g.level !== cleverapps.user.level ? g.level > cleverapps.user.level : "merge" === cleverapps.config.type && g.exp !== cleverapps.expBySlots[Meta.SLOT_MAIN].getExp() && g.exp > cleverapps.expBySlots[Meta.SLOT_MAIN].getExp()));
g ? (this._syncInProgress = !1,
this._inGetProgress = void 0) : (this.synced = !1,
this._loadedSync = f.sync,
this._loadedSession = f.key,
b.progressLoadOnly || this._syncIn.process());
b.callback && b.callback()
}
.bind(this);
cleverapps.RestClient.post(a, c, e, d)
}
;
cleverapps.Synchronizer.prototype.getAccessToken = function() {
return connector.platform.getAccessToken()
}
;
cleverapps.Synchronizer.prototype._sync = function() {
// if (!this._syncInProgress && !this._clientSessionExpired) {
// var a = this._startCheckInterval();
// this._syncId++;
// this._syncInProgress = !0;
// var b = this.synced;
// this.synced = !1;
// var c = this.getAccessToken() || "undefined"
// , d = this._getPath("newsync") + "/" + encodeURIComponent(c)
// , e = {
// episode: levels.user.episode,
// level: levels.user.level,
// progress: levels.user.progress,
// source: connector.info.source,
// progressCompare: cleverapps.user.progressCompare,
// exp: cleverapps.expBySlots[Meta.SLOT_MAIN].getExp(),
// registered: levels.user.registered,
// loggedIn: levels.user.loggedIn,
// localStorageEnabled: cleverapps.dataLoader.enabled,
// localStorageCorrupted: cleverapps.dataLoader.corrupted,
// version: cleverapps.config.version,
// clientChecksumDifferent: this._clientChecksumDifferent
// }
// , f = this._syncCallback(function(h) {
// this._syncInProgress = !1;
// delete this._clientChecksumDifferent;
// this._loadedSession = h.key;
// this._loadedSync = h.sync;
// this._zeroSession = h.zeroSession;
// h.cheater && (cleverapps.user.cheater = !0,
// cleverapps.flags.update());
// cleverapps.userDelete.updateDeleted(h.deleted);
// if (void 0 !== this._loadedSession)
// this._loadedSync ? (console.log("sync in"),
// this._syncIn.process(),
// this.updateLastSyncIn()) : this._syncOut.process();
// else
// this.on();
// this._onSyncLoaded()
// }).bind(this)
// , g = this._syncCallback(function(h) {
// this._syncInProgress = !1;
// if (h && 403 === h.status) {
// if ("undefined" === c && this.getAccessToken()) {
// this.syncWhenReady();
// return
// }
// connector.social.invalidateAccessToken();
// connector.social.isLoggedIn() || (this.wantsSocialConnectWindow = !0,
// this.displaySocialConnectWindow())
// } else
// (a || b) && cleverapps.config.debugMode && setTimeout(function() {
// cleverapps.notification.create("Error saving progress")
// }, a ? 2500 : 0);
// this._onSyncProcessed();
// this._onSyncLoaded()
// }).bind(this);
// cleverapps.RestClient.post(d, e, f, g)
// }
}
;
cleverapps.Synchronizer.prototype.overrideProgress = function(a) {
var b = [function(c) {
this.whenSyncCompleted(c)
}
.bind(this), function(c) {
this._syncInProgress = !0;
this._needResync = !1;
new ReloadWindow(c)
}
.bind(this), function(c) {
cleverapps.snapshots.importData(a, c)
}
, function(c) {
a.scene ? cleverapps.reloadSnapshotScene(a.scene, c) : cleverapps.scenes.sceneRefresh();
this._syncInProgress = !1;
this._syncOut.sendAllData()
}
.bind(this)];
cleverapps.focusManager.isFocused() ? cleverapps.focusManager.distract({
focus: "override",
actions: b
}) : cleverapps.focusManager.display({
focus: "override",
actions: b
})
}
;
cleverapps.Synchronizer.prototype.displaySocialConnectWindow = function() {
cleverapps.focusManager.display({
focus: "SynchronizerCheckConnection",
actions: [function(a) {
cleverapps.SocialManager.enforceLogin(function(b) {
a();
b === cleverapps.CODE_SUCCEED && this.syncWhenReady()
}
.bind(this), {
withWindow: !0,
errorMessage: "SignInWindow.TryAgain"
})
}
.bind(this), function(a) {
this.wantsSocialConnectWindow = !1;
a()
}
.bind(this)]
})
}
;
cleverapps.Synchronizer.prototype._onSyncProcessed = function() {
this._onceFirstSyncCompletedListener && (console.log("first sync"),
this._onceFirstSyncCompletedListener(),
this._onceFirstSyncCompletedListener = void 0)
}
;
cleverapps.Synchronizer.prototype._onSyncLoaded = function() {
this._onceNextSyncCompletedListener && (this._onceNextSyncCompletedListener(),
this._onceNextSyncCompletedListener = void 0)
}
;
cleverapps.Synchronizer.prototype._onSyncOutCompleted = function() {
this._onceSyncOutCompleted && (this._onceSyncOutCompleted(),
this._onceSyncOutCompleted = void 0)
}
;
cleverapps.Synchronizer.prototype.whenSyncCompleted = function(a) {
this._syncInProgress ? this.onceSyncCompletedListener = a : a()
}
;
cleverapps.Synchronizer.SESSION_EXPIRED = 99;
cleverapps.SyncIn = function() {}
;
cleverapps.SyncIn.prototype.executeSync = function(a) {
cleverapps.synchronizer._clientSessionExpired && (cleverapps.dataLoader.resetClientSession(),
cleverapps.synchronizer._clientSessionExpired = !1);
cleverapps.synchronizer._syncOut.reset();
for (var b in a) {
var c = a[b]
, d = CustomSyncers.importerData[b];
d ? d(c) : console.log("No importer for " + b)
}
GameDataSaver.Reset();
cleverapps.dataLoader.processSaveQueue();
cleverapps.localPushes.reset();
cleverapps.abTest.updateGroups()
}
;
cleverapps.SyncIn.prototype.needShowReloadWindow = function() {
return cleverapps.synchronizer._loadedSync
}
;
cleverapps.SyncIn.prototype.isReloadInProcess = function() {
return this._reloadInProgress
}
;
cleverapps.SyncIn.prototype.reloadAction = function(a) {
this._reloadInProgress = !0;
new ReloadWindow(function() {
this.needShowReloadWindow() && (this.executeSync(cleverapps.synchronizer._loadedSync),
cleverapps.synchronizer.on(),
cleverapps.scenes.sceneRefresh(),
this._reloadInProgress = !1);
a()
}
.bind(this))
}
;
cleverapps.SyncIn.prototype.distractToReloadWindow = function() {
cleverapps.config.wysiwygMode || cleverapps.focusManager.distract({
focus: "ReloadWindow",
action: function(a) {
this.reloadAction(a)
}
.bind(this)
})
}
;
cleverapps.SyncIn.prototype.showReloadWindow = function() {
cleverapps.config.wysiwygMode || cleverapps.focusManager.display({
focus: "ReloadWindow",
action: function(a) {
this.reloadAction(a)
}
.bind(this)
})
}
;
cleverapps.SyncIn.prototype.process = function() {
cleverapps.allInitialized ? cleverapps.focusManager.isFocused() ? this.isReloadInProcess() || !cleverapps.scenes.isSceneReady() || cleverapps.windows.findWindow(SignInWindow) || this.distractToReloadWindow() : this.showReloadWindow() : (this.executeSync(cleverapps.synchronizer._loadedSync),
cleverapps.synchronizer.on())
}
;
cleverapps.SyncOut = function() {
this.task = {};
this.currentTask = {};
this.onTasksEmptyListener = function() {}
;
this.inProgress = !1;
this.sendNextUpdate = cleverapps.accumulate(cleverapps.SyncOut.FAST_ACCUMULATE_TIMEOUT, this._sendUpdateInner.bind(this));
(cleverapps.dataLoader.load(DataLoader.TYPES.SYNC) || []).forEach(function(a) {
CustomSyncers.extractors[a] && (this.task[a] = !0)
}, this)
}
;
cleverapps.SyncOut.prototype.getAccumulateTimeout = function() {
var a = cleverapps.paymentsHistory.isPayer()
, b = cleverapps.user.registered + cleverapps.parseInterval("3 days") > Date.now()
, c = cleverapps.SyncOut.MEDIUM_ACCUMULATE_TIMEOUT;
if (cleverapps.config.debugMode || a || b)
c = cleverapps.SyncOut.FAST_ACCUMULATE_TIMEOUT;
else if (cleverapps.synchronizer._zeroSession || connector.platform.oneOf(connector.GDCOM, connector.COOLMATHGAMES))
c = cleverapps.SyncOut.SLOW_ACCUMULATE_TIMEOUT;
return c
}
;
cleverapps.SyncOut.prototype.run = function() {
this.sendNextUpdate()
}
;
cleverapps.SyncOut.prototype.save = function() {
var a = Object.assign(this.currentTask, this.task);
cleverapps.dataLoader.save(DataLoader.TYPES.SYNC, Object.keys(a))
}
;
cleverapps.SyncOut.prototype.reset = function() {
this.task = {};
this.currentTask = {};
this.save()
}
;
cleverapps.SyncOut.prototype.nextTask = function() {
this.currentTask = this.task;
this.task = {}
}
;
cleverapps.SyncOut.prototype.addUpdateTask = function(a) {
!CustomSyncers.extractors[a] || this.task[a] || cleverapps.userDelete.isPlanned() || (this.task[a] = !0,
this.save(),
cleverapps.synchronizer.synced && cleverapps.allInitialized && this.sendNextUpdate())
}
;
cleverapps.SyncOut.prototype.onSuccess = function(a) {
this.inProgress = !1;
cleverapps.synchronizer.synced && (a.error && a.error === cleverapps.Synchronizer.SESSION_EXPIRED ? (console.log("onUpdate: session needs renewal"),
cleverapps.synchronizer.reset(),
cleverapps.synchronizer.syncWhenReady()) : (0 === a && console.log("error saving object"),
this.currentTask = {},
this.save(),
cleverapps.synchronizer._onSyncOutCompleted(),
this.sendNextUpdate()))
}
;
cleverapps.SyncOut.prototype.onFailure = function(a) {
this.inProgress = !1;
cleverapps.synchronizer.synced && (console.log("Failure: ", a),
this.task = Object.assign(this.currentTask, this.task),
this.currentTask = {},
cleverapps.synchronizer._onSyncOutCompleted(),
setTimeout(this.sendNextUpdate.bind(this), cleverapps.SyncOut.RETRY_TIMEOUT))
}
;
cleverapps.SyncOut.prototype._sendUpdateInner = function() {
cleverapps.dataLoader.onSaved(function() {
if (!this.inProgress && cleverapps.synchronizer.synced && !cleverapps.userDelete.isDeleted() && (cleverapps.dataLoader.checkClientSession(),
!cleverapps.synchronizer._clientSessionExpired))
if (this.nextTask(),
0 === Object.keys(this.currentTask).length)
this.onTasksEmptyListener();
else {
var a = {};
for (c in this.currentTask) {
var b = CustomSyncers.extractors[c]();
a[c] = b
}
this.inProgress = !0;
console.log("Sending update ", a);
a.version = cleverapps.config.version;
cleverapps.RestClient.post(cleverapps.synchronizer._getPath("sync"), a, this.onSuccess.bind(this), this.onFailure.bind(this));
var c = JSON.stringify(a).length;
65536 < c && (b = Object.keys(a).map(function(d) {
return d + " - " + JSON.stringify(a[d]).length
}).join(", "),
cleverapps.throwAsync("synchronizer sync entity too large - " + c + ", " + b))
}
}
.bind(this));
this.sendNextUpdate = cleverapps.accumulate(this.getAccumulateTimeout(), this._sendUpdateInner.bind(this))
}
;
cleverapps.SyncOut.prototype.sendAllData = function() {
for (var a in CustomSyncers.extractors)
this.addUpdateTask(a)
}
;
cleverapps.SyncOut.prototype.getAllData = function() {
try {
var a = {}, b;
for (b in CustomSyncers.extractors)
a[b] = CustomSyncers.extractors[b] && CustomSyncers.extractors[b]();
return a
} catch (c) {
cleverapps.throwAsync("SyncOut.getAllData error", c)
}
}
;
cleverapps.SyncOut.prototype.process = function() {
if (!cleverapps.userDelete.isPlanned())
for (var a in CustomSyncers.extractors)
this.task[a] = !0;
cleverapps.synchronizer.on()
}
;
cleverapps.SyncOut.RETRY_TIMEOUT = 6E4;
cleverapps.SyncOut.FAST_ACCUMULATE_TIMEOUT = 2E3;
cleverapps.SyncOut.MEDIUM_ACCUMULATE_TIMEOUT = 1E4;
cleverapps.SyncOut.SLOW_ACCUMULATE_TIMEOUT = 6E4;
var NoAds = function() {
this.state = NoAds.STATE_DISABLED;
this.isWindowShown = !1;
this.load();
connector.ads.on("changeStatus", this.updateSideBarIcon.bind(this));
this.updateSideBarIcon()
};
NoAds.prototype.load = function() {
this.state = cleverapps.dataLoader.load(DataLoader.TYPES.NO_ADS) || NoAds.STATE_DISABLED
}
;
NoAds.prototype.getState = function() {
return this.state
}
;
NoAds.prototype.updateSideBarIcon = function() {
var a = cleverapps.sideBar.findIconByClassName(NoAdsIcon);
a && !this.needToNudge() && cleverapps.sideBar.removeTemporaryIcon(a);
!a && this.needToNudge() && (cleverapps.sideBar.addTemporaryIcon(new NoAdsIcon),
cleverapps.sideBar.refreshAllIcons())
}
;
NoAds.prototype.enable = function(a) {
this.state = NoAds.STATE_ENABLED;
cleverapps.bannerAd && cleverapps.bannerAd.check(!0);
this.updateSideBarIcon();
this.save(a)
}
;
NoAds.prototype.reset = function() {
this.state = NoAds.STATE_DISABLED;
cleverapps.bannerAd && cleverapps.bannerAd.check(!0);
this.updateSideBarIcon();
this.save()
}
;
NoAds.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.NO_ADS, this.state);
a || cleverapps.synchronizer.addUpdateTask("noAds")
}
;
NoAds.prototype.needToNudge = function(a) {
if (a && (this.isWindowShown || (a = cleverapps.dataLoader.localStorage.getItem(DataLoader.TYPES.NO_ADS_NUDGE_TIME)) && parseInt(a) + NoAds.NUDGE_TIMEOUT > Date.now()))
return !1;
a = cleverapps.adsLimits.getLimit(AdsLimits.TYPES.INTERSTITIAL);
var b = cleverapps.adsLimits.getWatchCount(AdsLimits.TYPES.INTERSTITIAL);
return a.limit && 0 < b && connector.platform.oneOf(connector.WECHAT, connector.INSTANT, connector.MSSTART, connector.CRAZY, connector.OK, connector.VK, connector.YANDEX, connector.CLEVERAPPS, connector.TEST) && connector.payments.getProduct("noAds") && this.state === NoAds.STATE_DISABLED && connector.ads.isInterstitialSupported
}
;
NoAds.prototype.updateNudgeTime = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.NO_ADS_NUDGE_TIME, Date.now());
this.isWindowShown = !0
}
;
NoAds.STATE_DISABLED = 0;
NoAds.STATE_ENABLED = 1;
NoAds.NUDGE_TIMEOUT = cleverapps.parseInterval("6 hour");
cleverapps.config.debugMode && (NoAds.NUDGE_TIMEOUT = cleverapps.parseInterval("1 minute"));
var RewardedAdsManager = function() {
this.baseWatchCounter = 0;
this.totalWatchCounter = cleverapps.dataLoader.load(DataLoader.TYPES.AD_WATCH_COUNTER) || 0;
this.lastAdStarter = void 0;
this.lastAvailableRewarded = Date.now();
connector.ads.on("changeStatus", this.onChangePluginStatus.bind(this));
connector.ads.on("rewarded:impression", this.onRewardedImpression.bind(this));
connector.ads.on("interstitial:impression", this.onInterstitialImpression.bind(this));
connector.ads.on("sticky:impression", this.onStickyImpression.bind(this));
connector.ads.on("impressionTest", this.onImpressionTest.bind(this));
connector.ads.on("applovin:displayed", this.onApplovinDisplayed.bind(this));
connector.ads.on("rewarded:loading", this.createLoadingOverlay.bind(this));
connector.ads.on("interstitial:loading", this.createLoadingOverlay.bind(this));
connector.ads.on("rewarded:loaded", this.removeLoadingOverlay.bind(this));
connector.ads.on("interstitial:loaded", this.removeLoadingOverlay.bind(this));
connector.ads.on("rewarded:start", this.createAdOverlay.bind(this, "rewarded"));
connector.ads.on("interstitial:start", this.createAdOverlay.bind(this, "interstitial"));
connector.ads.on("rewarded:close", this.removeAdOverlay.bind(this));
connector.ads.on("interstitial:close", this.removeAdOverlay.bind(this));
connector.ads.on("rewarded:reward", this.onReward.bind(this));
connector.ads.on("rewarded:caching", function(b) {
this.logAdCaching("rewarded", b)
}
.bind(this));
connector.ads.on("interstitial:caching", function(b) {
this.logAdCaching("interstitial", b)
}
.bind(this));
connector.ads.on("rewarded:cached", this.onRewardedCached.bind(this));
connector.ads.on("interstitial:cached", this.onInterstitialCached.bind(this));
connector.ads.on("rewarded:start", function(b) {
this.logAdStarted("rewarded", b)
}
.bind(this));
connector.ads.on("interstitial:start", function(b) {
this.logAdStarted("interstitial", b)
}
.bind(this));
connector.ads.on("rewarded:close", function(b, c) {
b && (this.logAdClosed("rewarded", c),
this.logRewardedClosed())
}
.bind(this));
connector.ads.on("interstitial:close", function(b, c) {
b && this.logAdClosed("interstitial", c)
}
.bind(this));
connector.ads.on("rewarded:start:expired", function() {
this.logExpiredStart("rewarded")
}
.bind(this));
connector.ads.on("interstitial:start:expired", function() {
this.logExpiredStart("interstitial")
}
.bind(this));
connector.ads.on("rewarded:close:expired", function(b) {
b && this.logExpiredClose("rewarded")
}
.bind(this));
connector.ads.on("interstitial:close:expired", function(b) {
b && this.logExpiredClose("interstitial")
}
.bind(this));
connector.ads.on("error:showRewarded", this.onRewardedError.bind(this));
connector.ads.on("error:showInterstitial", this.onInterstitialError.bind(this));
var a = cleverapps.dataLoader.load(DataLoader.TYPES.AD_FROZEN);
a && (cleverapps.dataLoader.remove(DataLoader.TYPES.AD_FROZEN),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DEBUG.AD_FROZEN + a.networkName))
};
RewardedAdsManager.prototype.onInterstitialCached = function(a, b) {
a ? cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.ERROR_INTERSTITIAL + a) : this.logAdCached("interstitial", b)
}
;
RewardedAdsManager.prototype.onRewardedCached = function(a, b) {
a ? cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.ERROR_REWARDED + a) : (this.lastAvailableRewarded = Date.now(),
this.logAdCached("rewarded", b),
this.logRewardedCached())
}
;
RewardedAdsManager.prototype.onRewardedError = function(a) {
cleverapps.notification.create("AdError." + a);
cleverapps.playSession.set(cleverapps.EVENTS.STATS.REWARDED_ERROR_DAU, !0);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.ERROR_REWARDED + a)
}
;
RewardedAdsManager.prototype.onInterstitialError = function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.ERROR_INTERSTITIAL + a)
}
;
RewardedAdsManager.prototype.logExpiredClose = function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.START + "_expired");
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.START + "_" + a + "_expired")
}
;
RewardedAdsManager.prototype.logExpiredStart = function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.START + "_expired");
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.START + "_" + a + "_expired")
}
;
RewardedAdsManager.prototype.logRewardedClosed = function() {
cleverapps.playSession.set(cleverapps.EVENTS.STATS.REWARDED_DAU, !0);
cleverapps.playSession.inc(cleverapps.EVENTS.ADS.SESSION_FINISH_REWARDED);
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.ADS.FINISH)
}
;
RewardedAdsManager.prototype.logAdClosed = function(a, b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.FINISH + "_" + a);
b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.FINISH + "_" + a + "_plugin_" + b);
Game.currentGame && Game.currentGame.getMode() === GameBase.MODE_HIGHSCORE && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.FINISH + "_" + a + "_" + Game.currentGame.getMode())
}
;
RewardedAdsManager.prototype.logAdStarted = function(a, b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.START + "_" + a);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.START + "_" + a + "_country_" + c)
});
b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.START + "_" + a + "_plugin_" + b);
"interstitial" === a && cleverapps.eventBus.trigger("taskEvent", DailyTasks.WATCH_ADS)
}
;
RewardedAdsManager.prototype.logRewardedCached = function() {
this.noadsTimeout && (clearTimeout(this.noadsTimeout),
delete this.noadsTimeout);
cleverapps.playSession.set(cleverapps.EVENTS.STATS.REWARDED_LOADED_DAU, !0)
}
;
RewardedAdsManager.prototype.logAdCached = function(a, b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.READY);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.READY + "_" + a);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.READY + "_" + a + "_country_" + c)
});
b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.READY + "_" + a + "_plugin_" + b);
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.ADS.READY)
}
;
RewardedAdsManager.prototype.logAdCaching = function(a, b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.CACHE);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.CACHE + "_" + a);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.CACHE + "_" + a + "_country_" + c)
});
b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.CACHE + "_" + a + "_plugin_" + b);
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.ADS.CACHE)
}
;
RewardedAdsManager.prototype.onChangePluginStatus = function(a) {
a === connector.STATUS_CONNECTED && (cleverapps.playSession.set(cleverapps.EVENTS.STATS.REWARDED_AVAILABLE_DAU, !0),
clearTimeout(this.noadsTimeout),
this.noadsTimeout = new cleverapps.LongTimeout(function() {
cleverapps.playSession.set(cleverapps.EVENTS.STATS.REWARDED_NOADS_DAU, !0)
}
,cleverapps.parseInterval(RewardedAdsManager.REWARDED_NOADS_TIMEOUT)))
}
;
RewardedAdsManager.prototype.onRewardedImpression = function(a, b) {
this.logImpressionCost(a);
cleverapps.eventLogger.logAdRevenue("rewarded", a, {
source: b
});
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.ADS.COST, {
value: a
});
if (!this.lastAdStarter && cleverapps.config.debugMode)
throw "No ad starter placement defined!";
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.TOTAL, a);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(this.lastAdStarter, {
value: a,
country: c
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.COST_COUNTRY + b + "-rewarded-" + c, {
value: a
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.COUNTRY + b + "-rewarded-" + c)
}
.bind(this))
}
;
RewardedAdsManager.prototype.onInterstitialImpression = function(a, b) {
this.logImpressionCost(a);
cleverapps.eventLogger.logAdRevenue("interstitial", a, {
source: b
});
cleverapps.abTest.allLogEvent(cleverapps.EVENTS.ADS.COST, {
value: a
});
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.TOTAL, a);
cleverapps.country.whenReady(function(c) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.TYPE + "interstitial", {
value: a,
country: c
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.COST_COUNTRY + b + "-interstitial-" + c, {
value: a
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.COUNTRY + b + "-interstitial-" + c)
})
}
;
RewardedAdsManager.prototype.onStickyImpression = function(a, b) {
this.logImpressionCost(a);
cleverapps.eventLogger.logAdRevenue("sticky", a, {
source: b
});
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.TOTAL, a);
cleverapps.bannerAd.onPaidEvent(a)
}
;
RewardedAdsManager.prototype.logImpressionCost = function(a) {
connector.ads.oneOf(connector.AD_MOB) ? cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.ADMOB_ADS, {
value: a
}) : connector.ads.oneOf(connector.APP_LOVIN) ? cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.APP_LOVIN_ADS, {
value: a
}) : connector.ads.oneOf(connector.YANDEX_APP_ADS) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.YANDEX_APP_ADS, {
value: a
})
}
;
RewardedAdsManager.prototype.onImpressionTest = function(a, b) {
connector.ads.oneOf(connector.YANDEX_APP_ADS) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.YANDEX_APP_ADS + "_test", {
value: b
})
}
;
RewardedAdsManager.prototype.onApplovinDisplayed = function(a, b) {
connector.ads.oneOf(connector.APP_LOVIN) && cleverapps.dataLoader.save(DataLoader.TYPES.AD_FROZEN, {
networkName: b.networkName
})
}
;
RewardedAdsManager.prototype.onRewardedRefresh = function(a, b) {
a = connector.ads.on("rewarded:refresh", a);
addCleaner(b, a.clear)
}
;
RewardedAdsManager.prototype.isEnabled = function() {
return connector.ads.isRewardedSupported
}
;
RewardedAdsManager.prototype.createLoadingOverlay = function() {
cleverapps.focusManager.display({
stack: !0,
focus: "LoadingAds",
action: function(a) {
this.loadingWaitWindow = new WaitWindow;
this.onceLoadingWaitWindowClosed = a
}
.bind(this)
})
}
;
RewardedAdsManager.prototype.removeLoadingOverlay = function() {
this.loadingWaitWindow && (this.loadingWaitWindow.close(),
this.loadingWaitWindow = void 0);
this.onceLoadingWaitWindowClosed && (this.onceLoadingWaitWindowClosed(),
this.onceLoadingWaitWindowClosed = void 0)
}
;
RewardedAdsManager.prototype.createAdOverlay = function(a) {
cleverapps.audio.mute();
cleverapps.focusManager.display({
stack: !0,
focus: "AdOverlay",
action: function(b) {
this.rewardOverlay = new RewardedAdOverlay(a);
cleverapps.scenes.getRunningScene().addChild(this.rewardOverlay);
this.onceRewardOverlayClosed = b
}
.bind(this)
})
}
;
RewardedAdsManager.prototype.removeAdOverlay = function() {
connector.platform.hasAudioControls && !connector.platform.isAudioEnabled || cleverapps.audio.unmute();
this.rewardOverlay && (this.rewardOverlay.removeFromParent(),
this.rewardOverlay = void 0);
this.onceRewardOverlayClosed && (this.onceRewardOverlayClosed(),
this.onceRewardOverlayClosed = void 0)
}
;
RewardedAdsManager.prototype.adIsRunning = function() {
return this._isAdRunning
}
;
RewardedAdsManager.prototype.getLastAdStarter = function(a) {
a = a || "none";
[AdsLimits.TYPES.ENERGY_SHORT, AdsLimits.TYPES.ENERGY_1_SHORT, AdsLimits.TYPES.ENERGY_2_SHORT].includes(a) && (a = "lives_short");
[AdsLimits.TYPES.ENERGY, AdsLimits.TYPES.ENERGY_1, AdsLimits.TYPES.ENERGY_2].includes(a) && (a = AdsLimits.TYPES.LIVES);
var b = cleverapps.travelBook.isExpedition() ? cleverapps.travelBook.getCurrentPage().id + "_" : "";
return cleverapps.EVENTS.ADS.TYPE + b + a
}
;
RewardedAdsManager.prototype.removeFrozen = function() {
cleverapps.dataLoader.remove(DataLoader.TYPES.AD_FROZEN)
}
;
RewardedAdsManager.prototype.onReward = function() {
this.baseWatchCounter++;
this.totalWatchCounter++;
0 === this.baseWatchCounter % 5 && cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.EVERY_5_AD, this.baseWatchCounter);
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.AD, this.totalWatchCounter);
cleverapps.dataLoader.save(DataLoader.TYPES.AD_WATCH_COUNTER, this.totalWatchCounter);
cleverapps.eventBus.trigger("taskEvent", DailyTasks.WATCH_ADS)
}
;
RewardedAdsManager.prototype.isRewardedAvailable = function() {
console.log('uptap-isRewardedAvailable')
return true;
return connector.ads.isRewardedAvailable || connector.ads.isRewardedSupported && cleverapps.paymentsHistory.isVIP()
}
;
RewardedAdsManager.prototype.playRewarded = function(a, b, c) {
console.log('uptap-playRewarded')
window.uptap.ShowExcitationVideoAdv((n1) => {
switch (n1.type) {
case "1":
// 暂时没有⼴告
// 这⾥执⾏激励播放失败的代码,不发放奖励
console.log('uptap-playAd-1')
break;
case "2":
// 想要奖励,必须看完⼴告(⽤户点击跳过按钮)
// 这⾥执⾏激励播放失败的代码,不发放奖励
console.log('uptap-playAd-2')
break;
case "3":
// ⼴告正常播放完毕
// 这⾥执⾏激励播放成功的代码,发放奖励
console.log('uptap-playAd-3')
b && b();
break;
}
})
// b = b || function() {}
// ;
// c = c || function() {}
// ;
// cleverapps.config.adminMode || cleverapps.config.editorMode ? b() : this.adIsRunning() ? (c(),
// cleverapps.notification.create("AdsRunning")) : (this.lastAdStarter = this.getLastAdStarter(a),
// cleverapps.paymentsHistory.isVIP() ? this.playVipRewarded(b, c) : (this._isAdRunning = !0,
// (new ActionPlayer([function(d) {
// cleverapps.whenGameActive(d)
// }
// , function(d) {
// connector.ads.showRewardedVideoCallback(function(e) {
// this.removeFrozen();
// this._isAdRunning = !1;
// e ? (connector.ads.isAdBlockEnabled && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.AD_BLOCK_REWARDED_SUCCESS),
// b()) : (connector.ads.isAdBlockEnabled && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.AD_BLOCK_REWARDED_FAIL),
// c())
// }
// .bind(this));
// d()
// }
// .bind(this)])).play()))
}
;
RewardedAdsManager.prototype.playVipRewarded = function(a, b) {
this._isAdRunning = !0;
var c = !1
, d = function() {
c = !0
};
cleverapps.focusManager.display({
stack: !0,
focus: "VIPRewardWindow",
actions: [function(e) {
new VIPRewardedWindow(d);
cleverapps.focusManager.onceNoWindowsListener = e
}
, function(e) {
this.removeFrozen();
this._isAdRunning = !1;
e();
c ? (this.onReward(),
a()) : b()
}
.bind(this)]
})
}
;
RewardedAdsManager.prototype.showInterstitial = function(a) {
console.log('uptap-showInterstitial')
a = a || function() {};
window['uptap'].ShowScreenVideo("下一关", function () {
a();
});
// a = a || function() {}
// ;
// cleverapps.config.adminMode || cleverapps.config.editorMode || cleverapps.environment.isAtlasAnalyzerScene() ? a() : cleverapps.adsLimits.state(AdsLimits.TYPES.INTERSTITIAL) !== AdsLimits.STATE_READY ? a() : !this.isEnabled() || this.adIsRunning() ? a() : cleverapps.noAds.getState() === NoAds.STATE_ENABLED ? a() : this._showInterstitial(a)
}
;
RewardedAdsManager.prototype._showInterstitial = function(a) {
this._isAdRunning = !0;
(new ActionPlayer([function(b) {
cleverapps.whenGameActive(b)
}
, function(b) {
connector.ads.showInterstitialCallback(function(c) {
this.removeFrozen();
this._isAdRunning = !1;
cleverapps.adsLimits.watch(AdsLimits.TYPES.INTERSTITIAL);
cleverapps.noAds.needToNudge(!0) && !cleverapps.focusManager.isFocused() && cleverapps.focusManager.display({
focus: "NoAdsWindowAfterInterstitialForNoOutcomeGames",
action: function(d) {
new NoAdsWindow;
cleverapps.focusManager.onceNoWindowsListener = d
}
});
cleverapps.noAds.updateSideBarIcon();
a(c)
}
.bind(this));
b()
}
.bind(this)])).play()
}
;
RewardedAdsManager.prototype.showPreroll = function(a) {
a = a || function() {}
;
if (cleverapps.config.adminMode || cleverapps.config.editorMode || cleverapps.config.wysiwygMode || cleverapps.environment.isAtlasAnalyzerScene())
a();
else {
var b = function(c) {
this.prerollStatus = RewardedAdsManager.PREROL_SHOWN;
a(c);
cleverapps.adsLimits.watch(AdsLimits.TYPES.PREROLL)
}
.bind(this);
this.prerollStatus ? a() : (this.prerollStatus = RewardedAdsManager.PREROL_SHOWING,
cleverapps.adsLimits.state(AdsLimits.TYPES.PREROLL) !== AdsLimits.STATE_READY ? a() : !this.isEnabled() || this.adIsRunning() ? a() : cleverapps.noAds.getState() === NoAds.STATE_ENABLED ? a() : (cleverapps.adsLimits.watch(AdsLimits.TYPES.PREROLL),
this._showInterstitial(b)))
}
}
;
RewardedAdsManager.prototype.getNoRewardedTime = function() {
return Date.now() - this.lastAvailableRewarded
}
;
RewardedAdsManager.REWARDED_NOADS_TIMEOUT = "3 minutes";
RewardedAdsManager.REWARDED = "rewarded";
RewardedAdsManager.PREROL_SHOWING = "showing";
RewardedAdsManager.PREROL_SHOWN = "shown";
var RewardedAdOverlay = cc.Scale9Sprite.extend({
ctor: function(a) {
this._super(bundles.pixel.frames.pixel_png);
this.alwaysOn = !0;
this.setColor(cleverapps.styles.COLORS.BLACK);
this.setOpacity(80);
this.setLocalZOrder(Transition.ZORDER + 1);
this.timeLeft = cleverapps.parseInterval(RewardedAdOverlay.TIMEOUT);
var b = function(d) {
connector.ads.finishAd(a, a !== RewardedAdsManager.REWARDED || d ? "closed_by_user" : connector.CODE_SUCCEED)
}
, c = new cleverapps.CountDown(this.timeLeft,{
onTick: this.onTick.bind(this),
onFinish: function() {
this.isAutoCloseAvailable() && b()
}
.bind(this)
});
addCleaner(this, function() {
c.remove()
});
cleverapps.UI.onClick(this, function() {
this.isCloseAvailable() && b(connector.platform.oneOf(connector.YANDEX, connector.GDCOM, connector.COOLMATHGAMES, connector.FACEBOOK, connector.TEST))
}
.bind(this), {
interactiveScale: !1
});
this.addLoadText();
this.addAutoCloseText();
this.addCloseText();
this.setupChildren()
},
setupChildren: function() {
var a = cleverapps.resolution.getBgSize()
, b = cleverapps.resolution.getSafePadding();
this.setContentSize2(a.width + 4, a.height + 4);
this.setPositionRound(a.width / 2 - b.left, a.height / 2 - b.bottom);
this.setAnchorPoint(.5, .5);
this.autoCloseText && this.autoCloseText.setPositionRound(cleverapps.styles.RewardedAdOverlay.autoClose);
this.loadText && this.loadText.setPositionRound(cleverapps.styles.RewardedAdOverlay.text);
this.closeText && (this.closeText.setDimensions(a.width, 0),
this.closeText.fitTo(a.width),
this.closeText.setPositionRound(cleverapps.styles.RewardedAdOverlay.text))
},
onTick: function(a) {
this.timeLeft = a;
this.isAutoCloseAvailable() && this.autoCloseText && (this.autoCloseText.visible || this.showAutoCloseText(),
this.autoCloseText.setString("RewardAutoClose", {
timeout: Math.ceil(a / 1E3)
}));
this.loadText && this.isCloseAvailable() && (this.loadText.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.CallFunc(this.showCloseText.bind(this)),new cc.RemoveSelf)),
this.loadText = void 0)
},
addAutoCloseText: function() {
var a = cleverapps.UI.generateOnlyText("", cleverapps.styles.FONTS.REWARDED_AD_OVERLAY_AUTO_CLOSE_TEXT);
a.setPositionRound(cleverapps.styles.RewardedAdOverlay.autoClose);
a.visible = !1;
this.autoCloseText = a;
this.addChild(a)
},
showAutoCloseText: function() {
var a = this.autoCloseText;
a && !a.visible && (a.visible = !0,
a.setOpacity(0),
a.runAction(new cc.Sequence(new cc.DelayTime(1),new cc.FadeIn(.3))))
},
addLoadText: function() {
var a = this.loadText = cleverapps.UI.generateOnlyText("Loading", cleverapps.styles.FONTS.REWARDED_AD_OVERLAY_TEXT);
a.setPositionRound(cleverapps.styles.RewardedAdOverlay.text);
this.addChild(a);
a.setOpacity(0);
a.runAction(new cc.FadeIn(.3))
},
addCloseText: function() {
var a = this.closeText = cleverapps.UI.generateOnlyText("Window.TapToContinue", cleverapps.styles.FONTS.REWARDED_AD_OVERLAY_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.setDimensions(cleverapps.resolution.getSceneSize().width, 0);
a.fitTo(cleverapps.resolution.getSceneSize().width);
a.setPositionRound(cleverapps.styles.RewardedAdOverlay.text);
a.visible = !1;
this.addChild(a)
},
showCloseText: function() {
var a = this.closeText;
a && !a.visible && (a.visible = !0,
a.setOpacity(0),
a.runAction(new cc.FadeIn(.3)))
},
isCloseAvailable: function() {
return this.timeLeft <= cleverapps.parseInterval(RewardedAdOverlay.CLOSE_AVAILABLE)
},
isAutoCloseAvailable: function() {
return !connector.platform.oneOf(connector.INSTANT, connector.GDCOM, connector.COOLMATHGAMES, connector.YANDEX) && this.isCloseAvailable()
}
});
RewardedAdOverlay.initialize = function() {
var a = "60 seconds";
connector.platform.oneOf(connector.GDCOM, connector.COOLMATHGAMES) && (a = "50 seconds");
RewardedAdOverlay.TIMEOUT = "65 seconds";
RewardedAdOverlay.CLOSE_AVAILABLE = a
}
;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
REWARDED_AD_OVERLAY_AUTO_CLOSE_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
REWARDED_AD_OVERLAY_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.RewardedAdOverlay = {
text: {
x: {
align: "center"
},
y: {
align: "center"
}
},
autoClose: {
x: {
align: "center"
},
y: {
align: "center",
dy: -100
}
}
};
var VIPRewardedWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.onReward = a;
this.isVertical = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL;
a = cleverapps.dataLoader.load(DataLoader.TYPES.VIP_LEVEL) || {
l: 0,
t: 0
};
this.level = Math.max(a.l - Math.floor(Math.max(Date.now() - a.t, 0) / VIPRewardedWindow.LEVEL_INTERVAL), 0);
this._super({
name: "VIPRewardedWindow",
title: "VIPRewardedWindow.title",
content: this.createContent(),
noBackground: !0,
notCloseByTouchInShadow: !0
});
cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem")
},
getPerson: function() {
return {
role: cleverapps.persons.choose("king", "hero"),
emotion: "happy"
}
},
skip: function(a) {
if (cleverapps.user.spendHard(cleverapps.EVENTS.SPENT.SKIP_VIP, a)) {
if (this.onReward)
this.onReward();
this.incLevel();
this.onReward = void 0;
this.close()
}
},
incLevel: function() {
cleverapps.dataLoader.save(DataLoader.TYPES.VIP_LEVEL, {
l: this.level + 1,
t: Date.now()
})
},
createContent: function() {
var a = cleverapps.styles.VIPRewardedWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.animation);
var c = new cleverapps.Spine(bundles.vip_window.jsons.vip_icon_json);
c.setStartListener(function() {
cleverapps.audio.playSound(bundles.vip_window.urls.ads_slapstick)
});
c.setCompleteListener(function() {
c.setAnimation(0, "animation")
});
c.setAnimation(0, "animation");
b.addChild(c);
c.setPositionRound(b.width / 2, b.height / 2);
var d = cleverapps.UI.generateOnlyText("VIPRewardedWindow.description", cleverapps.styles.FONTS.VIPREWARDEDWINDOW_DESCRIPTION_TEXT);
d.setDimensions(this.isVertical ? a.description.verticalWidth : a.description.width, 0);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
var e = this.createProgress()
, f = new cleverapps.UI.Button({
width: a.button.width,
height: a.button.height,
text: "Cancel",
onClicked: this.close.bind(this),
type: cleverapps.styles.UI.Button.Images.button_red
})
, g = this.calcPrice()
, h = new cleverapps.UI.Button({
width: a.button.width,
height: a.button.height,
text: "Skip$$" + g,
onClicked: this.skip.bind(this, g),
type: cleverapps.styles.UI.Button.Images.button_green
});
cleverapps.user.canTakeHard(g) || h.disable();
f = new cleverapps.Layout([h, f],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.button.margin
});
g = cleverapps.paymentsHistory.getVIPStatus().end;
g = Math.ceil((g - Date.now()) / cleverapps.parseInterval("1 day"));
30 < g && (g = 30);
g = cleverapps.UI.generateOnlyText("VIPRewardedWindow.note", cleverapps.styles.FONTS.VIPREWARDEDWINDOW_NOTE_TEXT, {
price: cleverapps.paymentsHistory.calculateMinimalVipSum(),
remaining: g
});
g.setOpacity(200);
g.setDimensions(this.isVertical ? a.note.verticalWidth : a.note.width, 0);
g.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a = new cleverapps.Layout([b, d, e, f, g],{
direction: cleverapps.UI.VERTICAL,
padding: a.padding,
margin: this.isVertical ? a.verticalMargin : a.margin
});
a.y += 200;
return a
},
onClose: function() {
this.onReward = void 0
},
calcDuration: function() {
return VIPRewardedWindow.BASE_DURATION + VIPRewardedWindow.LEVEL_DURATION * this.level
},
calcPrice: function() {
return Math.round(this.calcDuration() / cleverapps.parseInterval("1 second") * ("merge" === cleverapps.config.type ? VIPRewardedWindow.SKIP_SECOND_PRICE : VIPRewardedWindow.SKIP_WHEN_NO_SOFT_SECOND_PRICE))
},
createProgress: function() {
var a = cleverapps.styles.VIPRewardedWindow.progress
, b = new ScaledProgressBar({
background: bundles.progress_bar.frames.bg_vip,
progress: bundles.progress_bar.frames.bar_vip
});
b.setLength(a.width);
b.setPercentage(10);
var c = this.calcDuration();
b.runAction(new ScaledProgressBarProgressTo(c / 1E3,100));
var d = 0;
c = new cleverapps.CountDown(c,{
onTick: function() {
cleverapps.audio.playSound(0 === d % 2 ? bundles.vip_window.urls.ads_timer1 : bundles.vip_window.urls.ads_timer2);
d++
},
onFinish: function() {
if (this.onReward)
this.onReward();
this.incLevel();
cleverapps.playSession.inc(cleverapps.EVENTS.STATS.VIP_REWARDED_WATCHED);
this.onReward = void 0;
this.close()
}
.bind(this)
});
c = new cleverapps.CountDownView(c,{
font: cleverapps.styles.FONTS.VIPREWARDEDWINDOW_TIMER_TEXT
});
c.setPositionRound(a.timer);
b.addChild(c);
return b
},
listBundles: function() {
return ["vip_window"]
}
});
VIPRewardedWindow.BASE_DURATION = cleverapps.parseInterval("12 seconds");
VIPRewardedWindow.LEVEL_DURATION = cleverapps.parseInterval("2 seconds");
VIPRewardedWindow.SKIP_SECOND_PRICE = 1 / 7;
VIPRewardedWindow.SKIP_WHEN_NO_SOFT_SECOND_PRICE = 1.25;
VIPRewardedWindow.LEVEL_INTERVAL = cleverapps.parseInterval("300 seconds");
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
VIPREWARDEDWINDOW_DESCRIPTION_TEXT: {
size: 42
},
VIPREWARDEDWINDOW_TIMER_TEXT: {
size: 60
},
VIPREWARDEDWINDOW_NOTE_TEXT: {
size: 22
}
});
cleverapps.styles.VIPRewardedWindow = {
margin: 40,
verticalMargin: 80,
padding: {
top: 60
},
animation: {
width: 300,
height: 300
},
description: {
width: 1E3,
verticalWidth: 800
},
progress: {
width: 600,
timer: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 2
}
}
},
button: {
width: 300,
height: 100,
margin: 80
},
note: {
width: 1E3,
verticalWidth: 800
}
};
var NoAdsWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this.product = Product.CreateById("noAds");
this._super({
name: "NoAdsWindow",
title: "NoAdsWindow.title",
content: this.createContent(),
styles: cleverapps.styles.NoAdsWindow.window,
notCloseByTouchInShadow: !0,
closeButtonDelay: !0
});
cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem");
cleverapps.noAds.updateNudgeTime();
this.createFootnote();
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.NOADS_PRODUCT.WINDOW_OPEN)
},
getPerson: function() {
return cleverapps.persons.choose("seller", "worker")
},
createContent: function() {
var a = cleverapps.styles.NoAdsWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize(a);
var c = Messages.get("NoAdsWindow.note." + (cleverapps.config.soft ? "hard" : "soft"), {
amount: this.product.reward.hard
});
c = cleverapps.splitHalfByWord(c).join("\n");
c = cleverapps.UI.generateOnlyText(c, cleverapps.styles.FONTS.NOTE_WINDOW_TEXT);
c.fitTo(a.note.width);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.addChild(c);
c.setPositionRound(a.note);
c = new cleverapps.Spine(bundles.noads_window.jsons.noads_gift_json);
c.setAnimation(0, "animation", !0);
b.addChild(c);
c.setPositionRound(a.gift);
c = new TileBadge({
text: "80%\nOFF",
rotation: a.badge.rotation,
textRotation: a.badge.textRotation,
font: cleverapps.styles.FONTS.NOADS_BADGE
});
c.setScale(a.badge.scale);
b.addChild(c);
c.setPositionRound(a.badge);
c = new TextWithIcon("+ $$" + this.product.reward.hard,{
font: cleverapps.styles.FONTS.NOADS_BONUS_TEXT
});
c.setPositionRound(a.bonusnote);
b.addChild(c);
c = new cleverapps.UI.Button({
text: this.product.getCurrentPrice(),
width: a.button.width,
height: a.button.height,
onClicked: function() {
this.product.buy(function(d) {
this.close();
d && (this.product.logBuyItem(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.NOADS_PRODUCT.WINDOW_PURCHASE))
}
.bind(this))
}
.bind(this)
});
b.addChild(c);
c.setPositionRound(a.button);
return b
},
createFootnote: function() {
var a = cleverapps.styles.NoAdsWindow.footnote
, b = cleverapps.UI.generateOnlyText("NoAdsWindow.footnote", cleverapps.styles.FONTS.WHITE_TEXT);
b.setPositionRound(a);
b.setDimensions(a.width, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.fitTo(void 0, a.height);
this.content.addChild(b);
cleverapps.UI.onClick(b, this.close.bind(this));
cleverapps.UI.applyHover(b);
b.setOpacity(0);
b.runAction(new cc.Sequence(new cc.FadeIn(.7),new cc.CallFunc(function() {
this.content.addChild(cleverapps.UI.drawUnderline(b, a.underline))
}
.bind(this))))
},
listBundles: function() {
return ["noads_window"]
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
NOTE_WINDOW_TEXT: {
name: "nostroke",
size: 50,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
},
NOADS_BADGE: {
size: 40,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
NOADS_BONUS_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
}
});
cleverapps.styles.NoAdsWindow = {
width: 620,
height: 720,
note: {
width: 720,
x: {
align: "center"
},
y: {
align: "top",
dy: -25
}
},
footnote: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -120
},
height: 90,
underline: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -122
},
height: 3
}
},
badge: {
scale: 1.1,
rotation: 0,
x: {
align: "right",
dx: 25
},
y: {
align: "center",
dy: 90
}
},
bonusnote: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 115
}
},
button: {
width: 250,
height: 100,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 10
}
},
gift: {
x: {
align: "center",
dx: -20
},
y: {
align: "center",
dy: -10
}
},
window: {
padding: {
top: 50,
bottom: 50
}
}
};
var BannerAd = function() {
cleverapps.timeouts.setInterval(this.check.bind(this), BannerAd.CHECK_INTERVAL);
connector.ads.on("sticky:start", this.onStart.bind(this));
connector.ads.on("sticky:close", this.onClose.bind(this, !0));
connector.ads.on("error:showSticky", this.onError.bind(this));
connector.ads.on("sticky:render", this.onPaidEvent.bind(this));
connector.ads.on("changeStatus", this.check.bind(this));
this.errorTime = 0
};
BannerAd.prototype.onError = function() {
connector.ads.isAdBlockEnabled && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.AD_BLOCK_STICKY_FAIL);
this.errorTime = Date.now()
}
;
BannerAd.prototype.canShow = function() {
return cleverapps.config.adminMode || cleverapps.config.editorMode || this.errorTime + BannerAd.PAUSE_AFTER_ERROR > Date.now() || cleverapps.adsLimits.state(AdsLimits.TYPES.BANNER) !== AdsLimits.STATE_READY || cleverapps.noAds.getState() === NoAds.STATE_ENABLED || cleverapps.environment.isChatScene() || cleverapps.environment.isAtlasAnalyzerScene() || cleverapps.environment.isSceneWithPreview() || cleverapps.config.adminMode || !connector.platform.oneOf(connector.OK) && connector.info.isMobile && (cleverapps.resolution.isLandscapeOrientation() || "horizontal" === cleverapps.config.orientation) || connector.platform.oneOf(connector.TEST) && "creator" === engine ? !1 : !0
}
;
BannerAd.prototype.onStart = function(a) {
console.log("sticky.onStart", a);
connector.ads.isAdBlockEnabled && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.ADS.AD_BLOCK_STICKY_SUCCESS);
connector.info.isInApp && cleverapps.config.debugMode && cleverapps.notification.create("Show sticky bannerSize: " + JSON.stringify(a));
this.bannerSize = a;
cleverapps.config.wysiwygMode || cleverapps.resolution.addSafePadding("banner", cc.padding({
bottom: this.bannerSize.height
}));
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.BANNER.SHOWN);
cleverapps.playSession.set(cleverapps.EVENTS.STATS.BANNER.DAU, !0);
connector.platform.oneOf(connector.INSTANT, connector.YANDEX, connector.MSSTART) && (this.removePaidEventInterval(),
this.paidEventInterval = cleverapps.timeouts.setInterval(this.onPaidEvent.bind(this), BannerAd.PAID_EVENT_INTERVAL));
this.check()
}
;
BannerAd.prototype.onClose = function() {
console.log("sticky.onClose");
cleverapps.resolution.removeSafePadding("banner");
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.BANNER.HIDDEN);
this.removePaidEventInterval()
}
;
BannerAd.prototype.removePaidEventInterval = function() {
this.paidEventInterval && (cleverapps.timeouts.clearInterval(this.paidEventInterval),
delete this.paidEventInterval)
}
;
BannerAd.prototype.check = function() {
connector.info.isInApp && cleverapps.config.debugMode && cleverapps.notification.create("bannerAd check " + this.canShow());
this.canShow() ? (console.log("sticky.show"),
connector.ads.showStickyCallback()) : (console.log("sticky.close"),
connector.ads.closeStickyCallback())
}
;
BannerAd.prototype.onResize = cleverapps.accumulate(300, function() {
this.check()
});
BannerAd.prototype.getECPM = function() {
return BannerAd.eCPM[connector.info.source] || 1
}
;
BannerAd.prototype.onPaidEvent = function(a) {
console.log("sticky.onPaidEvent");
if (a = a || this.getECPM() / 1E3)
cleverapps.playSession.inc(cleverapps.EVENTS.ADS.TYPE + "banner", a),
cleverapps.playSession.inc(cleverapps.EVENTS.ADS.TYPE + "banner-impressions", 1)
}
;
BannerAd.prototype.getGlobalBoundingBox = function() {
var a = cleverapps.resolution.getBgSize();
if (connector.ads.isStickyPlaying) {
var b = this.bannerSize.width ? Math.round(a.width * this.bannerSize.width / cleverapps.resolution.getFrameSize().width) : a.width;
return cc.rect(a.width / 2 - b / 2, 0, b, this.bannerSize.height)
}
}
;
BannerAd.PAID_EVENT_INTERVAL = cleverapps.parseInterval("1 minute");
BannerAd.CHECK_INTERVAL = cleverapps.parseInterval("1 minute");
BannerAd.PAUSE_AFTER_ERROR = cleverapps.parseInterval("5 minutes");
BannerAd.eCPM = {
ok: 20 / connector.EXCHANGE_RATES.RUB,
vk: 25 / connector.EXCHANGE_RATES.RUB,
instant: .72,
yandex: 30 / connector.EXCHANGE_RATES.RUB,
msstart: 5,
android: 2,
amazon: 2
};
var Share = {
show: function(a, b) {
b = cleverapps.once(b || function() {}
);
var c = this.getData(a);
(new ActionPlayer([function(d) {
cleverapps.SocialManager.enforceLogin(function(e) {
e === cleverapps.CODE_SUCCEED ? d() : b()
})
}
, function(d) {
connector.platform.oneOf(connector.INSTANT, connector.WORTAL, connector.TEST) ? cleverapps.loadBase64Image(c.image, function(e) {
e ? (c.image = e,
d()) : b()
}) : d()
}
, function() {
this._show(a, c, b)
}
.bind(this)])).play()
},
_show: function(a, b, c) {
connector.social.shareCallback(b, function(d) {
d ? (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SHARE + a),
this.save()) : console.log(Messages.get("Share.ShareFailed"));
c()
}
.bind(this))
},
getData: function(a) {
var b = cc.loader.getRes(bundles.main.jsons.vk_json);
b = b[a] || b.default;
var c = a + "_" + cleverapps.settings.language;
bundles.shares.urls[c + "_1"] || (c = a + "_en");
bundles.shares.urls[c + "_1"] || (c = "default_en");
for (var d = [], e = 1; 15 > e; e++) {
var f = bundles.shares.urls[c + "_" + e];
if (!f)
break;
d.push(f.getUrl())
}
a = {
title: Messages.get("Share." + a + ".Name"),
text: Messages.get("Share." + a + ".Description"),
image: cleverapps.Random.mathChoose(d)
};
connector.platform.oneOf(connector.FACEBOOK) && (a.text = Messages.get(cleverapps.config.title));
connector.platform.oneOf(connector.VK) && (a.image = cleverapps.Random.mathChoose(b));
connector.platform.oneOf(connector.PLINGA) && (a.linktext = Messages.get("PlayNow"));
connector.platform.oneOf(connector.DRAUGIEM) && (a.subTitle = Messages.get("PlayNow"));
return a
},
isEnoughTimePassed: function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.LAST_SUCCESSFUL_SHARE) || {};
return !a.date || Date.now() - a.date >= Share.INTERVAL
},
isAvailable: function() {
return connector.social.isSupportsNativeShare ? this.isEnoughTimePassed() && connector.social.isLoggedIn() && cleverapps.user.checkAvailable(Share.AVAILABLE) : !1
},
save: function() {
cleverapps.dataLoader.save(DataLoader.TYPES.LAST_SUCCESSFUL_SHARE, {
date: Date.now()
})
}
};
Share.INTERVAL = cleverapps.parseInterval(cleverapps.config.debugMode ? "3 minute" : "3 days");
Share.AVAILABLE = {
level: .93
};
"merge" === cleverapps.config.type && (Share.AVAILABLE = {
level: 4
});
var ShareCheckBox = cleverapps.UI.CheckBox.extend({
ctor: function(a, b) {
this.window = b;
this.shareId = a;
this._super({
onChange: this.onChange.bind(this),
isSelected: this.isWindowChecked(),
label: {
text: "Share",
font: this.window.withBg ? cleverapps.styles.FONTS.WINDOW_TEXT : cleverapps.styles.FONTS.WHITE_TEXT,
clickable: !0
},
styles: cleverapps.styles.ShareCheckBox
});
this.updateState();
this.setCascadeOpacityEnabledRecursively(!0);
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SHARE_PROPOSED + a)
},
onChange: function(a) {
ShareCheckBox.UNCHECKED[this.window.name] = !a
},
updateState: function() {
this.setSelected(this.isWindowChecked())
},
onWindowClose: function(a) {
this.isWindowChecked() ? Share.show(this.shareId, a) : a && a()
},
isWindowChecked: function() {
return !ShareCheckBox.UNCHECKED[this.window.name]
},
hide: function(a) {
this.stopAllActions();
a ? this.setVisible(!1) : this.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.Hide))
},
show: function() {
this.stopAllActions();
this.setOpacity(0);
this.runAction(new cc.Sequence(new cc.DelayTime(1.5),new cc.Show,new cc.FadeTo(.3,200)))
}
});
ShareCheckBox.UNCHECKED = {};
cleverapps.styles.ShareCheckBox = {
margin: 15,
padding: {
x: 0,
y: 0
}
};
var Messages = {
dictionary: void 0,
debugTextCodes: {},
isInitialized: function() {
return this.dictionary
},
get: function(a, b) {
if (!Messages.dictionary || !a)
return a || "";
var c = cleverapps.travelBook.getCurrentPage().id
, d = cleverapps.skins.getSlot("skinName");
this.has(c + "." + a) ? a = c + "." + a : this.has(d + "." + a) && (a = d + "." + a);
return this._get(a, b)
},
getNotSkinned: function(a, b) {
return Messages.dictionary && a ? this._get(a, b) : a || ""
},
_get: function(a, b) {
b = b || {};
var c = a;
Messages.dictionary[c] ? c = Messages.dictionary[c] : 10 < c.length && cleverapps.config.debugMode && c.includes(".") && Game.currentGame && !b.ignoreWarning && console.log("Non-existent key: ", c);
if (Array.isArray(c))
for (var d = 0; d < c.length; d++)
c[d] = Messages.replace(c[d], b);
else
c = Messages.replace(c, b);
cleverapps.config.debugMode && Messages.dictionary[a] && "string" === typeof c && (Messages.debugTextCodes[c.toLowerCase().replace(/\s/g, ".")] = a);
return c
},
has: function(a) {
return Messages.dictionary ? Messages.dictionary[a] : !1
},
replace: function(a, b) {
b = b || {};
if ("string" === typeof a)
for (var c in b) {
var d = b[c];
"string" === typeof d && (d = Messages.get(d));
for (var e = "%{" + c + "}"; -1 !== a.indexOf(e); )
a = a.replace(e, d)
}
return a
},
getLocalized: function(a, b) {
if ("string" === typeof a)
return Messages.get(a, b);
if ("object" === typeof a && 0 < cleverapps.intersect(Object.keys(a), cleverapps.config.languages).length)
return a = void 0 !== a[cleverapps.settings.language] ? a[cleverapps.settings.language] : a[cc.sys.LANGUAGE_ENGLISH],
Messages.getLocalized(a, b);
if ("object" !== typeof a)
return a;
a = cleverapps.clone(a);
for (var c in a)
a[c] = Messages.getLocalized(a[c], b);
return a
},
preload: function(a, b) {
cleverapps.bundleLoader.loadBundle("language_" + a, {
onSuccess: function(c) {
Messages.dictionary = {};
cleverapps.config.debugMode && (Messages.debugTextCodes = {},
Messages.debugMapping = {});
Object.keys(cleverapps.config.dictionaries).forEach(function(d) {
if (c.jsons[d]) {
var e = c.jsons[d].resolve().getJson();
Object.assign(Messages.dictionary, e);
cleverapps.config.debugMode && Object.keys(e).forEach(function(f) {
Messages.debugMapping[f] = c.jsons[d]
})
}
});
cleverapps.bundleLoader.deleteBundle("language_" + a);
b()
},
blocked: !0
})
}
};
cleverapps.LocalizationManager = {
run: function() {
(void 0 === cleverapps.dataLoader.load(DataLoader.TYPES.LOCALIZATION_MANAGER) && this.hasInconsistentLanguage() || this.hasFirstInitLanguageWindow()) && this.displayLanguageWindow()
},
hasInconsistentLanguage: function() {
var a = cleverapps.settings.language
, b = cleverapps.config.languages
, c = cleverapps.Settings.getDefaultLanguage();
return a !== c && 0 <= b.indexOf(c)
},
hasFirstInitLanguageWindow: function() {
return 0 === levels.user.episode && 0 === levels.user.level && connector.platform.oneOf(connector.GDCOM, connector.COOLMATHGAMES) && "riddles" === cleverapps.config.name
},
displayLanguageWindow: function() {
cleverapps.focusManager.displayWhenFreeFocus({
focus: "displayInconsistentLanguage",
filter: function() {
return "playable" !== connector.info.source && !cleverapps.config.importMode && !cleverapps.config.wysiwygMode
},
action: function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.LOCALIZATION_MANAGER, 1);
new LanguagesWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
};
(function(a, b) {
var c = {
extend: function(p, q) {
var r = {}, u;
for (u in p)
r[u] = q[u] && 0 === q[u].length % 2 ? q[u].concat(p[u]) : p[u];
return r
},
has: function(p, q) {
return "string" === typeof p ? -1 !== q.toLowerCase().indexOf(p.toLowerCase()) : !1
},
lowerize: function(p) {
return p.toLowerCase()
},
major: function(p) {
return "string" === typeof p ? p.replace(/[^\d\.]/g, "").split(".")[0] : b
},
trim: function(p) {
return p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")
}
}
, d = function(p, q) {
for (var r = 0, u, w, v, t, x, y; r < q.length && !x; ) {
var z = q[r]
, B = q[r + 1];
for (u = w = 0; u < z.length && !x; )
if (x = z[u++].exec(p))
for (v = 0; v < B.length; v++)
y = x[++w],
t = B[v],
"object" === typeof t && 0 < t.length ? 2 == t.length ? this[t[0]] = "function" == typeof t[1] ? t[1].call(this, y) : t[1] : 3 == t.length ? this[t[0]] = "function" !== typeof t[1] || t[1].exec && t[1].test ? y ? y.replace(t[1], t[2]) : b : y ? t[1].call(this, y, t[2]) : b : 4 == t.length && (this[t[0]] = y ? t[3].call(this, y.replace(t[1], t[2])) : b) : this[t] = y ? y : b;
r += 2
}
}
, e = function(p, q) {
for (var r in q)
if ("object" === typeof q[r] && 0 < q[r].length)
for (var u = 0; u < q[r].length; u++) {
if (c.has(q[r][u], p))
return "?" === r ? b : r
}
else if (c.has(q[r], p))
return "?" === r ? b : r;
return p
}
, f = {
"Evo Shift 4G": "7373KT"
}
, g = {
HTC: "APA",
Sprint: "Sprint"
}
, h = {
ME: "4.90",
"NT 3.11": "NT3.51",
"NT 4.0": "NT4.0",
2E3: "NT 5.0",
XP: ["NT 5.1", "NT 5.2"],
Vista: "NT 6.0",
7: "NT 6.1",
8: "NT 6.2",
"8.1": "NT 6.3",
10: ["NT 6.4", "NT 10.0"],
RT: "ARM"
}
, k = {
browser: [[/(opera\smini)\/([\w\.-]+)/i, /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, /(opera).+version\/([\w\.]+)/i, /(opera)[\/\s]+([\w\.]+)/i], ["name", "version"], [/(opios)[\/\s]+([\w\.]+)/i], [["name", "Opera Mini"], "version"], [/\s(opr)\/([\w\.]+)/i], [["name", "Opera"], "version"], [/(kindle)\/([\w\.]+)/i, /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i, /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, /(?:ms|\()(ie)\s([\w\.]+)/i, /(rekonq)\/([\w\.]+)*/i, /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser)\/([\w\.-]+)/i], ["name", "version"], [/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i], [["name", "IE"], "version"], [/(edge)\/((\d+)?[\w\.]+)/i], ["name", "version"], [/(yabrowser)\/([\w\.]+)/i], [["name", "Yandex"], "version"], [/(puffin)\/([\w\.]+)/i], [["name", "Puffin"], "version"], [/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i], [["name", "UCBrowser"], "version"], [/(comodo_dragon)\/([\w\.]+)/i], [["name", /_/g, " "], "version"], [/(micromessenger)\/([\w\.]+)/i], [["name", "WeChat"], "version"], [/(QQ)\/([\d\.]+)/i], ["name", "version"], [/m?(qqbrowser)[\/\s]?([\w\.]+)/i], ["name", "version"], [/xiaomi\/miuibrowser\/([\w\.]+)/i], ["version", ["name", "MIUI Browser"]], [/;fbav\/([\w\.]+);/i], ["version", ["name", "Facebook"]], [/headlesschrome(?:\/([\w\.]+)|\s)/i], ["version", ["name", "Chrome Headless"]], [/\swv\).+(chrome)\/([\w\.]+)/i], [["name", /(.+)/, "$1 WebView"], "version"], [/((?:oculus|samsung)browser)\/([\w\.]+)/i], [["name", /(.+(?:g|us))(.+)/, "$1 $2"], "version"], [/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i], ["version", ["name", "Android Browser"]], [/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i], ["name", "version"], [/(dolfin)\/([\w\.]+)/i], [["name", "Dolphin"], "version"], [/((?:android.+)crmo|crios)\/([\w\.]+)/i], [["name", "Chrome"], "version"], [/(coast)\/([\w\.]+)/i], [["name", "Opera Coast"], "version"], [/fxios\/([\w\.-]+)/i], ["version", ["name", "Firefox"]], [/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i], ["version", ["name", "Mobile Safari"]], [/version\/([\w\.]+).+?(mobile\s?safari|safari)/i], ["version", "name"], [/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i], [["name", "GSA"], "version"], [/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i], ["name", ["version", e, {
"1.0": "/8",
"1.2": "/1",
"1.3": "/3",
"2.0": "/412",
"2.0.2": "/416",
"2.0.3": "/417",
"2.0.4": "/419",
"?": "/"
}]], [/(konqueror)\/([\w\.]+)/i, /(webkit|khtml)\/([\w\.]+)/i], ["name", "version"], [/(navigator|netscape)\/([\w\.-]+)/i], [["name", "Netscape"], "version"], [/(swiftfox)/i, /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i, /(mozilla)\/([\w\.]+).+rv:.+gecko\/\d+/i, /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, /(links)\s\(([\w\.]+)/i, /(gobrowser)\/?([\w\.]+)*/i, /(ice\s?browser)\/v?([\w\._]+)/i, /(mosaic)[\/\s]([\w\.]+)/i], ["name", "version"]],
cpu: [[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i], [["architecture", "amd64"]], [/(ia32(?=;))/i], [["architecture", c.lowerize]], [/((?:i[346]|x)86)[;\)]/i], [["architecture", "ia32"]], [/windows\s(ce|mobile);\sppc;/i], [["architecture", "arm"]], [/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i], [["architecture", /ower/, "", c.lowerize]], [/(sun4\w)[;\)]/i], [["architecture", "sparc"]], [/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i], [["architecture", c.lowerize]]],
device: [[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i], ["model", "vendor", ["type", "tablet"]], [/applecoremedia\/[\w\.]+ \((ipad)/], ["model", ["vendor", "Apple"], ["type", "tablet"]], [/(apple\s{0,1}tv)/i], [["model", "Apple TV"], ["vendor", "Apple"]], [/(archos)\s(gamepad2?)/i, /(hp).+(touchpad)/i, /(hp).+(tablet)/i, /(kindle)\/([\w\.]+)/i, /\s(nook)[\w\s]+build\/(\w+)/i, /(dell)\s(strea[kpr\s\d]*[\dko])/i], ["vendor", "model", ["type", "tablet"]], [/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i], ["model", ["vendor", "Amazon"], ["type", "tablet"]], [/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i], [["model", e, {
"Fire Phone": ["SD", "KF"]
}], ["vendor", "Amazon"], ["type", "mobile"]], [/\((ip[honed|\s\w*]+);.+(apple)/i], ["model", "vendor", ["type", "mobile"]], [/\((ip[honed|\s\w*]+);/i], ["model", ["vendor", "Apple"], ["type", "mobile"]], [/(blackberry)[\s-]?(\w+)/i, /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, /(hp)\s([\w\s]+\w)/i, /(asus)-?(\w+)/i], ["vendor", "model", ["type", "mobile"]], [/\(bb10;\s(\w+)/i], ["model", ["vendor", "BlackBerry"], ["type", "mobile"]], [/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i], ["model", ["vendor", "Asus"], ["type", "tablet"]], [/(sony)\s(tablet\s[ps])\sbuild\//i, /(sony)?(?:sgp.+)\sbuild\//i], [["vendor", "Sony"], ["model", "Xperia Tablet"], ["type", "tablet"]], [/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i], ["model", ["vendor", "Sony"], ["type", "mobile"]], [/\s(ouya)\s/i, /(nintendo)\s([wids3u]+)/i], ["vendor", "model", ["type", "console"]], [/android.+;\s(shield)\sbuild/i], ["model", ["vendor", "Nvidia"], ["type", "console"]], [/(playstation\s[34portablevi]+)/i], ["model", ["vendor", "Sony"], ["type", "console"]], [/(sprint\s(\w+))/i], [["vendor", e, g], ["model", e, f], ["type", "mobile"]], [/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i], ["vendor", "model", ["type", "tablet"]], [/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, /(zte)-(\w+)*/i, /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i], ["vendor", ["model", /_/g, " "], ["type", "mobile"]], [/(nexus\s9)/i], ["model", ["vendor", "HTC"], ["type", "tablet"]], [/d\/huawei([\w\s-]+)[;\)]/i, /(nexus\s6p)/i], ["model", ["vendor", "Huawei"], ["type", "mobile"]], [/(microsoft);\s(lumia[\s\w]+)/i], ["vendor", "model", ["type", "mobile"]], [/[\s\(;](xbox(?:\sone)?)[\s\);]/i], ["model", ["vendor", "Microsoft"], ["type", "console"]], [/(kin\.[onetw]{3})/i], [["model", /\./g, " "], ["vendor", "Microsoft"], ["type", "mobile"]], [/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i, /mot[\s-]?(\w+)*/i, /(XT\d{3,4}) build\//i, /(nexus\s6)/i], ["model", ["vendor", "Motorola"], ["type", "mobile"]], [/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i], ["model", ["vendor", "Motorola"], ["type", "tablet"]], [/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i], [["vendor", c.trim], ["model", c.trim], ["type", "smarttv"]], [/hbbtv.+maple;(\d+)/i], [["model", /^/, "SmartTV"], ["vendor", "Samsung"], ["type", "smarttv"]], [/\(dtv[\);].+(aquos)/i], ["model", ["vendor", "Sharp"], ["type", "smarttv"]], [/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i], [["vendor", "Samsung"], "model", ["type", "tablet"]], [/smart-tv.+(samsung)/i], ["vendor", ["type", "smarttv"], "model"], [/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i], [["vendor", "Samsung"], "model", ["type", "mobile"]], [/sie-(\w+)*/i], ["model", ["vendor", "Siemens"], ["type", "mobile"]], [/(maemo|nokia).*(n900|lumia\s\d+)/i, /(nokia)[\s_-]?([\w-]+)*/i], [["vendor", "Nokia"], "model", ["type", "mobile"]], [/android\s3\.[\s\w;-]{10}(a\d{3})/i], ["model", ["vendor", "Acer"], ["type", "tablet"]], [/android.+([vl]k\-?\d{3})\s+build/i], ["model", ["vendor", "LG"], ["type", "tablet"]], [/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i], [["vendor", "LG"], "model", ["type", "tablet"]], [/(lg) netcast\.tv/i], ["vendor", "model", ["type", "smarttv"]], [/(nexus\s[45])/i, /lg[e;\s\/-]+(\w+)*/i, /android.+lg(\-?[\d\w]+)\s+build/i], ["model", ["vendor", "LG"], ["type", "mobile"]], [/android.+(ideatab[a-z0-9\-\s]+)/i], ["model", ["vendor", "Lenovo"], ["type", "tablet"]], [/linux;.+((jolla));/i], ["vendor", "model", ["type", "mobile"]], [/((pebble))app\/[\d\.]+\s/i], ["vendor", "model", ["type", "wearable"]], [/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i], ["vendor", "model", ["type", "mobile"]], [/crkey/i], [["model", "Chromecast"], ["vendor", "Google"]], [/android.+;\s(glass)\s\d/i], ["model", ["vendor", "Google"], ["type", "wearable"]], [/android.+;\s(pixel c)\s/i], ["model", ["vendor", "Google"], ["type", "tablet"]], [/android.+;\s(pixel xl|pixel)\s/i], ["model", ["vendor", "Google"], ["type", "mobile"]], [/android.+(\w+)\s+build\/hm\1/i, /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i, /android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+)?)\s+build/i], [["model", /_/g, " "], ["vendor", "Xiaomi"], ["type", "mobile"]], [/android.+(mi[\s\-_]*(?:pad)?(?:[\s_]*[\w\s]+)?)\s+build/i], [["model", /_/g, " "], ["vendor", "Xiaomi"], ["type", "tablet"]], [/android.+;\s(m[1-5]\snote)\sbuild/i], ["model", ["vendor", "Meizu"], ["type", "tablet"]], [/android.+a000(1)\s+build/i], ["model", ["vendor", "OnePlus"], ["type", "mobile"]], [/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i], ["model", ["vendor", "RCA"], ["type", "tablet"]], [/android.+[;\/]\s*(Venue[\d\s]*)\s+build/i], ["model", ["vendor", "Dell"], ["type", "tablet"]], [/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i], ["model", ["vendor", "Verizon"], ["type", "tablet"]], [/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i], [["vendor", "Barnes & Noble"], "model", ["type", "tablet"]], [/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i], ["model", ["vendor", "NuVision"], ["type", "tablet"]], [/android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i], [["vendor", "ZTE"], "model", ["type", "tablet"]], [/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i], ["model", ["vendor", "Swiss"], ["type", "mobile"]], [/android.+[;\/]\s*(zur\d{3})\s+build/i], ["model", ["vendor", "Swiss"], ["type", "tablet"]], [/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i], ["model", ["vendor", "Zeki"], ["type", "tablet"]], [/(android).+[;\/]\s+([YR]\d{2}x?.*)\s+build/i, /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i], [["vendor", "Dragon Touch"], "model", ["type", "tablet"]], [/android.+[;\/]\s*(NS-?.+)\s+build/i], ["model", ["vendor", "Insignia"], ["type", "tablet"]], [/android.+[;\/]\s*((NX|Next)-?.+)\s+build/i], ["model", ["vendor", "NextBook"], ["type", "tablet"]], [/android.+[;\/]\s*(Xtreme_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i], [["vendor", "Voice"], "model", ["type", "mobile"]], [/android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i], [["vendor", "LvTel"], "model", ["type", "mobile"]], [/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i], ["model", ["vendor", "Envizen"], ["type", "tablet"]], [/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(.*\b)\s+build/i], ["vendor", "model", ["type", "tablet"]], [/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i], ["model", ["vendor", "MachSpeed"], ["type", "tablet"]], [/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i], ["vendor", "model", ["type", "tablet"]], [/android.+[;\/]\s*TU_(1491)\s+build/i], ["model", ["vendor", "Rotor"], ["type", "tablet"]], [/android.+(KS(.+))\s+build/i], ["model", ["vendor", "Amazon"], ["type", "tablet"]], [/android.+(Gigaset)[\s\-]+(Q.+)\s+build/i], ["vendor", "model", ["type", "tablet"]], [/\s(tablet|tab)[;\/]/i, /\s(mobile)(?:[;\/]|\ssafari)/i], [["type", c.lowerize], "vendor", "model"], [/(android.+)[;\/].+build/i], ["model", ["vendor", "Generic"]]],
engine: [[/windows.+\sedge\/([\w\.]+)/i], ["version", ["name", "EdgeHTML"]], [/(presto)\/([\w\.]+)/i, /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, /(icab)[\/\s]([23]\.[\d\.]+)/i], ["name", "version"], [/rv:([\w\.]+).*(gecko)/i], ["version", "name"]],
os: [[/microsoft\s(windows)\s(vista|xp)/i], ["name", "version"], [/(windows)\snt\s6\.2;\s(arm)/i, /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s]+\w)*/i, /(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i], ["name", ["version", e, h]], [/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i], [["name", "Windows"], ["version", e, h]], [/\((bb)(10);/i], [["name", "BlackBerry"], "version"], [/(blackberry)\w*\/?([\w\.]+)*/i, /(tizen)[\/\s]([\w\.]+)/i, /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i, /linux;.+(sailfish);/i], ["name", "version"], [/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i], [["name", "Symbian"], "version"], [/\((series40);/i], ["name"], [/mozilla.+\(mobile;.+gecko.+firefox/i], [["name", "Firefox OS"], "version"], [/(nintendo|playstation)\s([wids34portablevu]+)/i, /(mint)[\/\s\(]?(\w+)*/i, /(mageia|vectorlinux)[;\s]/i, /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]+)*/i, /(hurd|linux)\s?([\w\.]+)*/i, /(gnu)\s?([\w\.]+)*/i], ["name", "version"], [/(cros)\s[\w]+\s([\w\.]+\w)/i], [["name", "Chromium OS"], "version"], [/(sunos)\s?([\w\.]+\d)*/i], [["name", "Solaris"], "version"], [/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i], ["name", "version"], [/(haiku)\s(\w+)/i], ["name", "version"], [/cfnetwork\/.+darwin/i, /ip[honead]+(?:.*os\s([\w]+)\slike\smac|;\sopera)/i], [["version", /_/g, "."], ["name", "iOS"]], [/(mac\sos\sx)\s?([\w\s\.]+\w)*/i, /(macintosh|mac(?=_powerpc)\s)/i], [["name", "Mac OS"], ["version", /_/g, "."]], [/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, /(unix)\s?([\w\.]+)*/i], ["name", "version"]]
}
, m = function(p, q) {
"object" === typeof p && (q = p,
p = b);
if (!(this instanceof m))
return (new m(p,q)).getResult();
var r = p || (a && a.navigator && a.navigator.userAgent ? a.navigator.userAgent : "")
, u = q ? c.extend(k, q) : k;
this.getBrowser = function() {
var w = {
name: b,
version: b
};
d.call(w, r, u.browser);
w.major = c.major(w.version);
return w
}
;
this.getCPU = function() {
var w = {
architecture: b
};
d.call(w, r, u.cpu);
return w
}
;
this.getDevice = function() {
var w = {
vendor: b,
model: b,
type: b
};
d.call(w, r, u.device);
return w
}
;
this.getEngine = function() {
var w = {
name: b,
version: b
};
d.call(w, r, u.engine);
return w
}
;
this.getOS = function() {
var w = {
name: b,
version: b
};
d.call(w, r, u.os);
return w
}
;
this.getResult = function() {
return {
ua: this.getUA(),
browser: this.getBrowser(),
engine: this.getEngine(),
os: this.getOS(),
device: this.getDevice(),
cpu: this.getCPU()
}
}
;
this.getUA = function() {
return r
}
;
this.setUA = function(w) {
r = w;
return this
}
;
return this
};
m.VERSION = "0.7.17";
m.BROWSER = {
NAME: "name",
MAJOR: "major",
VERSION: "version"
};
m.CPU = {
ARCHITECTURE: "architecture"
};
m.DEVICE = {
MODEL: "model",
VENDOR: "vendor",
TYPE: "type",
CONSOLE: "console",
MOBILE: "mobile",
SMARTTV: "smarttv",
TABLET: "tablet",
WEARABLE: "wearable",
EMBEDDED: "embedded"
};
m.ENGINE = {
NAME: "name",
VERSION: "version"
};
m.OS = {
NAME: "name",
VERSION: "version"
};
a.UAParser = m;
var l = a && (a.jQuery || a.Zepto);
if ("undefined" !== typeof l) {
var n = new m;
l.ua = n.getResult();
l.ua.get = function() {
return n.getUA()
}
;
l.ua.set = function(p) {
n.setUA(p);
p = n.getResult();
for (var q in p)
l.ua[q] = p[q]
}
}
}
)("object" === typeof window ? window : this);
(function(a, b) {
"function" === typeof define && define.amd ? define([], b) : "object" === typeof exports ? module.exports = b() : a.SuperGif = b()
}
)(this, function() {
var a = function(f) {
return f.reduce(function(g, h) {
return 2 * g + h
}, 0)
}
, b = function(f) {
for (var g = [], h = 7; 0 <= h; h--)
g.push(!!(f & 1 << h));
return g
}
, c = function(f) {
this.data = f;
this.len = this.data.length;
this.pos = 0;
this.readByte = function() {
if (this.pos >= this.data.length)
throw Error("Attempted to read past end of stream.");
return f instanceof Uint8Array ? f[this.pos++] : f.charCodeAt(this.pos++) & 255
}
;
this.readBytes = function(g) {
for (var h = [], k = 0; k < g; k++)
h.push(this.readByte());
return h
}
;
this.read = function(g) {
for (var h = "", k = 0; k < g; k++)
h += String.fromCharCode(this.readByte());
return h
}
;
this.readUnsigned = function() {
var g = this.readBytes(2);
return (g[1] << 8) + g[0]
}
}
, d = function(f, g) {
for (var h = 0, k = function(v) {
for (var t = 0, x = 0; x < v; x++)
g.charCodeAt(h >> 3) & 1 << (h & 7) && (t |= 1 << x),
h++;
return t
}, m = [], l = 1 << f, n = l + 1, p = f + 1, q = [], r = function() {
q = [];
p = f + 1;
for (var v = 0; v < l; v++)
q[v] = [v];
q[l] = [];
q[n] = null
}, u, w; ; )
if (w = u,
u = k(p),
u === l)
r();
else {
if (u === n)
break;
if (u < q.length)
w !== l && q.push(q[w].concat(q[u][0]));
else {
if (u !== q.length)
throw Error("Invalid LZW code.");
q.push(q[w].concat(q[w][0]))
}
m.push.apply(m, q[u]);
q.length === 1 << p && 12 > p && p++
}
return m
}
, e = function(f, g) {
g || (g = {});
var h = function(n) {
for (var p = [], q = 0; q < n; q++)
p.push(f.readBytes(3));
return p
}
, k = function() {
var n = "";
do {
var p = f.readByte();
n += f.read(p)
} while (0 !== p);
return n
}
, m = function(n) {
var p = function(v) {
f.readByte();
var t = b(f.readByte());
v.reserved = t.splice(0, 3);
v.disposalMethod = a(t.splice(0, 3));
v.userInput = t.shift();
v.transparencyGiven = t.shift();
v.delayTime = f.readUnsigned();
v.transparencyIndex = f.readByte();
v.terminator = f.readByte();
g.gce && g.gce(v)
}
, q = function(v) {
v.comment = k();
g.com && g.com(v)
}
, r = function(v) {
f.readByte();
v.ptHeader = f.readBytes(12);
v.ptData = k();
g.pte && g.pte(v)
}
, u = function(v) {
var t = function(y) {
f.readByte();
y.unknown = f.readByte();
y.iterations = f.readUnsigned();
y.terminator = f.readByte();
g.app && g.app.NETSCAPE && g.app.NETSCAPE(y)
}
, x = function(y) {
y.appData = k();
g.app && g.app[y.identifier] && g.app[y.identifier](y)
};
f.readByte();
v.identifier = f.read(8);
v.authCode = f.read(3);
switch (v.identifier) {
case "NETSCAPE":
t(v);
break;
default:
x(v)
}
}
, w = function(v) {
v.data = k();
g.unknown && g.unknown(v)
};
n.label = f.readByte();
switch (n.label) {
case 249:
n.extType = "gce";
p(n);
break;
case 254:
n.extType = "com";
q(n);
break;
case 1:
n.extType = "pte";
r(n);
break;
case 255:
n.extType = "app";
u(n);
break;
default:
n.extType = "unknown",
w(n)
}
}
, l = function() {
var n = {};
n.sentinel = f.readByte();
switch (String.fromCharCode(n.sentinel)) {
case "!":
n.type = "ext";
m(n);
break;
case ",":
n.type = "img";
n.leftPos = f.readUnsigned();
n.topPos = f.readUnsigned();
n.width = f.readUnsigned();
n.height = f.readUnsigned();
var p = b(f.readByte());
n.lctFlag = p.shift();
n.interlaced = p.shift();
n.sorted = p.shift();
n.reserved = p.splice(0, 2);
n.lctSize = a(p.splice(0, 3));
n.lctFlag && (n.lct = h(1 << n.lctSize + 1));
n.lzwMinCodeSize = f.readByte();
p = k();
n.pixels = d(n.lzwMinCodeSize, p);
if (n.interlaced) {
p = n.pixels;
for (var q = n.width, r = Array(p.length), u = p.length / q, w = [0, 4, 2, 1], v = [8, 8, 4, 2], t = 0, x = 0; 4 > x; x++)
for (var y = w[x]; y < u; y += v[x]) {
var z = y
, B = p.slice(t * q, (t + 1) * q);
r.splice.apply(r, [z * q, q].concat(B));
t++
}
n.pixels = r
}
g.img && g.img(n);
break;
case ";":
n.type = "eof";
g.eof && g.eof(n);
break;
default:
throw Error("Unknown block: 0x" + n.sentinel.toString(16));
}
"eof" !== n.type && setTimeout(l, 0)
};
(function() {
var n = {};
n.sig = f.read(3);
n.ver = f.read(3);
if ("GIF" !== n.sig)
throw Error("Not a GIF file.");
n.width = f.readUnsigned();
n.height = f.readUnsigned();
var p = b(f.readByte());
n.gctFlag = p.shift();
n.colorRes = a(p.splice(0, 3));
n.sorted = p.shift();
n.gctSize = a(p.splice(0, 3));
n.bgColor = f.readByte();
n.pixelAspectRatio = f.readByte();
n.gctFlag && (n.gct = h(1 << n.gctSize + 1));
g.hdr && g.hdr(n)
}
)();
setTimeout(l, 0)
};
return function(f) {
var g = {
vp_l: 0,
vp_t: 0,
vp_w: null,
vp_h: null,
c_w: null,
c_h: null
};
for (ca in f)
g[ca] = f[ca];
g.vp_w && g.vp_h && (g.is_vp = !0);
var h, k, m = null, l = !1, n = null, p = null, q = null, r = null, u = null, w = null, v = null, t = !0, x = !1, y = [], z = [], B = [], A = g.gif;
A || (f = new Image,
f.crossOrigin = "Anonymous",
f.src = "",
A = f);
"undefined" == typeof g.auto_play && (g.auto_play = !A.getAttribute("rel:auto_play") || "1" == A.getAttribute("rel:auto_play"));
var C = g.hasOwnProperty("on_end") ? g.on_end : null
, G = g.hasOwnProperty("loop_delay") ? g.loop_delay : 0
, E = g.hasOwnProperty("loop_mode") ? g.loop_mode : "auto"
, F = g.hasOwnProperty("draw_while_loading") ? g.draw_while_loading : !0
, K = F ? g.hasOwnProperty("show_progress_bar") ? g.show_progress_bar : !0 : !1
, H = g.hasOwnProperty("progressbar_height") ? g.progressbar_height : 25
, L = g.hasOwnProperty("progressbar_background_color") ? g.progressbar_background_color : "rgba(255,255,255,0.4)"
, D = g.hasOwnProperty("progressbar_foreground_color") ? g.progressbar_foreground_color : "rgba(255,0,22,.8)"
, M = function() {
p = n = null;
u = q;
w = q = null
}
, O = function() {
try {
e(h, J)
} catch (I) {
U("parse")
}
}
, Q = function(I, N) {
T.width = I * R();
T.height = N * R();
ea.style.minWidth = I * R() + "px";
da.width = I;
da.height = N;
da.style.width = I + "px";
da.style.height = N + "px";
da.getContext("2d").setTransform(1, 0, 0, 1, 0, 0)
}
, P = function(I, N, S) {
if (S && K) {
S = H;
if (g.is_vp)
if (x) {
var Y = (g.vp_t + g.vp_h - S) / R();
S /= R();
var ba = g.vp_l / R();
I = ba + I / N * (g.vp_w / R());
N = T.width / R()
} else
Y = g.vp_t + g.vp_h - S,
ba = g.vp_l,
I = ba + I / N * g.vp_w,
N = T.width;
else
Y = (T.height - S) / (x ? R() : 1),
I = I / N * T.width / (x ? R() : 1),
N = T.width / (x ? R() : 1),
S /= x ? R() : 1;
V.fillStyle = L;
V.fillRect(I, Y, N - I, S);
V.fillStyle = D;
V.fillRect(0, Y, I, S)
}
}
, U = function(I) {
m = I;
k = {
width: A.width,
height: A.height
};
y = [];
z = []
}
, Z = function() {
if (w) {
y.push({
data: w.getImageData(0, 0, k.width, k.height),
delay: p
});
B.push({
x: 0,
y: 0
});
var I = new Image;
I.addEventListener("load", function() {
z.push(I)
}, !1);
I.src = w.canvas.toDataURL()
}
}
, X = function() {
var I = -1
, N = 0
, S = function(W) {
I += W;
ba()
}
, Y = function() {
var W = !1
, la = function() {
null !== C && C(A);
N++;
!1 !== E || 0 > N ? ha() : t = W = !1
}
, ha = function() {
if (W = t) {
S(1);
var fa = 10 * y[I].delay;
fa || (fa = 100);
0 === (I + 1 + y.length) % y.length ? (fa += G,
setTimeout(la, fa)) : setTimeout(ha, fa)
}
};
return function() {
W || setTimeout(ha, 0)
}
}()
, ba = function() {
I = parseInt(I, 10);
I > y.length - 1 && (I = 0);
0 > I && (I = 0);
var W = B[I];
da.getContext("2d").putImageData(y[I].data, W.x, W.y);
V.globalCompositeOperation = "copy";
V.drawImage(da, 0, 0)
};
return {
init: function() {
m || (g.c_w && g.c_h || V.scale(R(), R()),
g.auto_play ? Y() : (I = 0,
ba()))
},
step: Y,
play: function() {
t = !0;
Y()
},
pause: function() {
t = !1
},
getFrames: function() {
return z
},
playing: t,
move_relative: S,
current_frame: function() {
return I
},
length: function() {
return y.length
},
move_to: function(W) {
I = W;
ba()
}
}
}();
f = function() {}
;
var ca = function(I, N) {
return function(S) {
I(S);
P(h.pos, h.data.length, N)
}
};
var J = {
hdr: ca(function(I) {
k = I;
Q(k.width, k.height)
}),
gce: ca(function(I) {
Z();
M();
n = I.transparencyGiven ? I.transparencyIndex : null;
p = I.delayTime;
q = I.disposalMethod
}),
com: ca(f),
app: {
NETSCAPE: ca(f)
},
img: ca(function(I) {
w || (w = da.getContext("2d"));
var N = y.length
, S = I.lctFlag ? I.lct : k.gct;
0 < N && (3 === u ? null !== r ? w.putImageData(y[r].data, 0, 0) : w.clearRect(v.leftPos, v.topPos, v.width, v.height) : r = N - 1,
2 === u && w.clearRect(v.leftPos, v.topPos, v.width, v.height));
var Y = w.getImageData(I.leftPos, I.topPos, I.width, I.height);
I.pixels.forEach(function(ba, W) {
ba !== n && (Y.data[4 * W] = S[ba][0],
Y.data[4 * W + 1] = S[ba][1],
Y.data[4 * W + 2] = S[ba][2],
Y.data[4 * W + 3] = 255)
});
w.putImageData(Y, I.leftPos, I.topPos);
x || (V.scale(R(), R()),
x = !0);
F && (V.drawImage(da, 0, 0),
F = g.auto_play);
v = I
}, !0),
eof: function(I) {
Z();
P(h.pos, h.data.length, !1);
g.c_w && g.c_h || (T.width = k.width * R(),
T.height = k.height * R());
X.init();
l = !1;
ia && ia(A)
}
}, aa = function() {
var I = A.parentNode;
I || (I = document.createElement("div"),
I.appendChild(A));
var N = document.createElement("div");
T = document.createElement("canvas");
V = T.getContext("2d");
ea = document.createElement("div");
da = document.createElement("canvas");
N.width = T.width = A.width;
N.height = T.height = A.height;
ea.style.minWidth = A.width + "px";
N.className = "jsgif";
ea.className = "jsgif_toolbar";
N.appendChild(T);
N.appendChild(ea);
I.insertBefore(N, A);
I.removeChild(A);
g.c_w && g.c_h && Q(g.c_w, g.c_h);
ja = !0
}, R = function() {
return g.max_width && k && k.width > g.max_width ? g.max_width / k.width : 1
}, T, V, ea, da, ja = !1, ia = !1, ka = function(I) {
if (l)
return !1;
ia = I ? I : !1;
l = !0;
y = [];
z = [];
M();
v = w = u = r = null;
return !0
};
return {
play: X.play,
pause: X.pause,
getFrames: X.getFrames,
move_relative: X.move_relative,
move_to: X.move_to,
get_playing: function() {
return t
},
get_canvas: function() {
return T
},
get_canvas_scale: function() {
return R()
},
get_loading: function() {
return l
},
get_auto_play: function() {
return g.auto_play
},
get_length: function() {
return X.length()
},
get_current_frame: function() {
return X.current_frame()
},
load_url: function(I, N) {
ka(N) && (N = new XMLHttpRequest,
N.open("GET", I, !0),
"overrideMimeType"in N ? N.overrideMimeType("text/plain; charset=x-user-defined") : "responseType"in N ? N.responseType = "arraybuffer" : N.setRequestHeader("Accept-Charset", "x-user-defined"),
N.onloadstart = function() {
ja || aa()
}
,
N.onload = function(S) {
200 != this.status && U("xhr - response");
"response"in this || (this.response = (new VBArray(this.responseText)).toArray().map(String.fromCharCode).join(""));
S = this.response;
0 < S.toString().indexOf("ArrayBuffer") && (S = new Uint8Array(S));
h = new c(S);
setTimeout(O, 0)
}
,
N.onprogress = function(S) {
S.lengthComputable && P(S.loaded, S.total, !0)
}
,
N.onerror = function() {
U("xhr")
}
,
N.send())
},
load: function(I) {
this.load_url(A.getAttribute("rel:animated_src") || A.src, I)
},
load_raw: function(I, N) {
ka(N) && (ja || aa(),
h = new c(I),
setTimeout(O, 0))
},
set_frame_offset: function(I, N) {
B[I] ? ("undefined" !== typeof N.x && (B[I].x = N.x),
"undefined" !== typeof N.y && (B[I].y = N.y)) : B[I] = N
}
}
}
});
/*
JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
@author Jens Taylor
@see http://github.com/homebrewing/brauhaus-diff
@author Gary Court
@see http://github.com/garycourt/murmurhash-js
@author Austin Appleby
@see http://sites.google.com/site/murmurhash/
*/
!function() {
function a(c, d) {
var e = this instanceof a ? this : b;
return e.reset(d),
"string" == typeof c && 0 < c.length && e.hash(c),
e !== this ? e : void 0
}
a.prototype.hash = function(c) {
var d, e, f, g;
switch (g = c.length,
this.len += g,
e = this.k1,
f = 0,
this.rem) {
case 0:
e ^= g > f ? 65535 & c.charCodeAt(f++) : 0;
case 1:
e ^= g > f ? (65535 & c.charCodeAt(f++)) << 8 : 0;
case 2:
e ^= g > f ? (65535 & c.charCodeAt(f++)) << 16 : 0;
case 3:
e ^= g > f ? (255 & c.charCodeAt(f)) << 24 : 0,
e ^= g > f ? (65280 & c.charCodeAt(f++)) >> 8 : 0
}
if (this.rem = 3 & g + this.rem,
g -= this.rem,
0 < g) {
for (d = this.h1; !(e = 4294967295 & 11601 * e + 3432906752 * (65535 & e),
e = e << 15 | e >>> 17,
e = 4294967295 & 13715 * e + 461832192 * (65535 & e),
d ^= e,
d = d << 13 | d >>> 19,
d = 4294967295 & 5 * d + 3864292196,
f >= g); ) {
e = 65535 & c.charCodeAt(f++) ^ (65535 & c.charCodeAt(f++)) << 8 ^ (65535 & c.charCodeAt(f++)) << 16;
var h = c.charCodeAt(f++);
e ^= (255 & h) << 24 ^ (65280 & h) >> 8
}
switch (e = 0,
this.rem) {
case 3:
e ^= (65535 & c.charCodeAt(f + 2)) << 16;
case 2:
e ^= (65535 & c.charCodeAt(f + 1)) << 8;
case 1:
e ^= 65535 & c.charCodeAt(f)
}
this.h1 = d
}
return this.k1 = e,
this
}
;
a.prototype.result = function() {
var c, d;
return c = this.k1,
d = this.h1,
0 < c && (c = 4294967295 & 11601 * c + 3432906752 * (65535 & c),
c = c << 15 | c >>> 17,
c = 4294967295 & 13715 * c + 461832192 * (65535 & c),
d ^= c),
d ^= this.len,
d ^= d >>> 16,
d = 4294967295 & 51819 * d + 2246770688 * (65535 & d),
d ^= d >>> 13,
d = 4294967295 & 44597 * d + 3266445312 * (65535 & d),
d ^= d >>> 16,
d >>> 0
}
;
a.prototype.reset = function(c) {
return this.h1 = "number" == typeof c ? c : 0,
this.rem = this.k1 = this.len = 0,
this
}
;
var b = new a;
this.MurmurHash3 = a
}();
var RecursiveHasher = function(a, b, c) {
if ("object" !== typeof a)
"number" === typeof a ? c.hash("" + a) : c.hash(a);
else {
void 0 === c && (c = new MurmurHash3,
b = cleverapps.createSet(b));
if (Array.isArray(a)) {
c.hash("" + a.length);
for (var d = 0; d < a.length; d++)
RecursiveHasher(a[d], b, c)
} else
Object.keys(a).sort().forEach(function(e) {
!b[e] && a[e] && (c.hash(e),
RecursiveHasher(a[e], b, c))
});
return c.result()
}
};
var Version = {
compare: function(a, b) {
if (!a || !b)
return !!a - !!b;
a = a.split(".");
b = b.split(".");
for (var c = 0; c < Math.min(a.length, b.length); c++) {
var d = parseInt(a[c])
, e = parseInt(b[c]);
if (d !== e)
return d - e
}
return a.length - b.length
},
isVersion: function(a) {
if ("string" !== typeof a)
return !1;
a = a.split(".");
return 3 === a.length && a.every(function(b) {
return /^\d+$/.test(b)
})
},
isMinorEquals: function(a, b) {
return a.split(".").slice(0, 2).join(".") === b.split(".").slice(0, 2).join(".")
},
incPatch: function(a) {
a = a.split(".");
a[2] = +a[2] + 1;
return a.join(".")
},
incMinor: function(a) {
a = a.split(".");
a[1] = +a[1] + 1;
a[2] = 0;
return a.join(".")
},
getMinor: function(a) {
return +a.split(".")[1]
},
getPatch: function(a) {
return +a.split(".")[2]
}
};
"undefined" === typeof cc && (module.exports = Version);
var BaseBooster = function(a) {
cleverapps.EventEmitter.call(this);
this.id = a;
a = cleverapps.Boosters.CONFIG[a];
this.type = a.type;
this.force = a.force;
this.available = a.available;
this.icon = a.icon;
this.limit = a.limit;
this.executeEffect = a.executeEffect;
this.disableForceOnInactive = a.disableForceOnInactive
};
BaseBooster.prototype = Object.create(cleverapps.EventEmitter.prototype);
BaseBooster.prototype.constructor = BaseBooster;
BaseBooster.prototype.onGameStarted = function() {}
;
BaseBooster.prototype.isDisabled = function() {
return !levels.user.checkAvailable(this.available)
}
;
BaseBooster.prototype.calcPrice = function() {
var a = 0;
switch (this.type) {
case cleverapps.Boosters.TYPES.CHEAP:
a = 70;
break;
case cleverapps.Boosters.TYPES.MEDIUM:
a = 150;
break;
case cleverapps.Boosters.TYPES.EXPENSIVE:
a = 200
}
return a
}
;
BaseBooster.prototype.getPrice = function() {
if (this.type) {
var a = this.calcPrice();
return cleverapps.config.soft ? {
soft: !0,
amount: 50 * Math.round(a * cleverapps.User.HARD_TO_SOFT / 2 / 50)
} : {
amount: a
}
}
}
;
BaseBooster.prototype.getAmount = function() {
return cleverapps.boosters.getAmount(this.id)
}
;
BaseBooster.prototype.setAmount = function(a) {
return cleverapps.boosters.setAmount(this.id, a)
}
;
BaseBooster.prototype.buy = function() {
var a = cleverapps.EVENTS.SPENT.BOOSTER
, b = this.getPrice();
(a = b.soft ? cleverapps.user.spendSoft(a, b.amount) : cleverapps.user.spendHard(a, b.amount)) && cleverapps.boosters.add(this.id, 1);
return a
}
;
BaseBooster.prototype.use = function() {
cleverapps.boosters.has(this.id) && (cleverapps.boosters.take(this.id),
this.logUseEvents(),
this.onUsed())
}
;
BaseBooster.prototype.logUseEvents = function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.HINT_USED, {
value: this.getPrice().amount
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BOOSTERS_EXECUTE + "_" + this.id)
}
;
BaseBooster.prototype.onUsed = function() {
cleverapps.eventBus.trigger("taskEvent", DailyTasks.USE_BOOSTER)
}
;
BaseBooster.prototype.execute = function() {
this.use()
}
;
BaseBooster.prototype.canExecute = function() {
return cleverapps.boosters.has(this.id)
}
;
BaseBooster.prototype.isAdsAvailable = function() {
var a = this.getPrice().amount;
a = cleverapps.config.soft ? cleverapps.user.canTakeSoft(a) : cleverapps.user.canTakeHard(a);
return cleverapps.adsLimits.state(this.limit) === AdsLimits.STATE_READY && !a
}
;
BaseBooster.prototype.isForceAvailable = function() {
return this.isAvailable() && !cleverapps.forces.isShown(this.force.id)
}
;
BaseBooster.prototype.isAvailable = function() {
return !cleverapps.gameModes.noBoosters && levels.user.checkAvailable(this.available)
}
;
BaseBooster.prototype.getState = function() {
return this.canExecute() ? BaseBooster.AMOUNT_STATE : this.isAdsAvailable() ? BaseBooster.ADS_STATE : BaseBooster.PRICE_STATE
}
;
BaseBooster.AMOUNT_STATE = 0;
BaseBooster.ADS_STATE = 1;
BaseBooster.PRICE_STATE = 2;
var FieldBooster = function(a) {
BaseBooster.call(this, a);
this.hoverCell = void 0;
a = cleverapps.Boosters.CONFIG[a];
this.icon = a.icon;
this.icon_moving = a.icon_moving;
this.icon_active = a.icon_active;
this.onExecuteListener = function() {}
;
this.onHurtCellsListener = function() {}
;
this.onActivateListener = function() {}
;
this.onDeactivateListener = function() {}
;
this.onStopListener = function() {}
;
this.onGetView = function() {}
};
FieldBooster.prototype = Object.create(BaseBooster.prototype);
FieldBooster.prototype.constructor = FieldBooster;
FieldBooster.prototype.stop = function() {
this.onStopListener()
}
;
FieldBooster.prototype.deactivate = function() {
this.onDeactivateListener();
this.onFieldTouchMoved(void 0)
}
;
FieldBooster.prototype.execute = function(a) {
a = a && this.isAllowedTarget(a) ? a : void 0;
this.onExecuteListener(a);
if (a) {
Game.currentGame && Game.currentGame.field.boosterAdvice && Game.currentGame.field.boosterAdvice.disable();
var b = this.listAffected(a);
a = b.cells;
b = b.tiles;
if (0 < a.length && (this.hurtCells(a),
this.hurtTiles(b),
this.use(),
Game.currentGame))
Game.currentGame.onExecuteBooster()
}
}
;
FieldBooster.prototype.hurtCells = function(a) {
a.forEach(function(b) {
b.willBurn = !0;
b.onBeforeHurtViaBooster(a)
});
this.onHurtCellsListener(a);
delete this.hoverCell
}
;
FieldBooster.prototype.hurtCell = function(a, b, c) {
a.alive && a.hover(!1);
a.hurt({
id: b,
groupSize: c,
boosterId: this.id
})
}
;
FieldBooster.prototype.hurtTiles = function(a) {
a.forEach(function(b) {
b.hurtViaBooster(this.id)
}
.bind(this))
}
;
FieldBooster.prototype.onFieldTouchStarted = function(a) {
this.execute(a)
}
;
FieldBooster.prototype.onFieldTouchMoved = function(a) {
if (this.hoverCell !== a) {
var b = []
, c = [];
this.hoverCell && (b = this.listAffected(this.hoverCell).cells,
this.hoverCell = void 0);
a && this.isAllowedTarget(a) && (this.hoverCell = a,
c = this.listAffected(a).cells);
a = function(d) {
return d.x + "_" + d.y
}
;
cleverapps.substract(b, c, a).forEach(function(d) {
d.hover(!1)
});
cleverapps.substract(c, b, a).forEach(function(d) {
d.hover(!0)
})
}
}
;
FieldBooster.prototype.isAllowedTarget = function(a) {
return a.hurtable
}
;
FieldBooster.prototype.onFieldTouchEnded = function(a) {
a && this.execute(a)
}
;
FieldBooster.prototype.getViewClass = function() {
return FieldBoosterView
}
;
var CellBooster = function(a) {
FieldBooster.call(this, a)
};
CellBooster.prototype = Object.create(FieldBooster.prototype);
CellBooster.prototype.constructor = CellBooster;
CellBooster.prototype.listAffected = function(a) {
this.targetCell = a;
var b = [];
Game.currentGame.field.floor[a.y][a.x] && b.push(Game.currentGame.field.floor[a.y][a.x]);
return {
cells: [a],
tiles: b
}
}
;
CellBooster.prototype.getViewClass = function() {
return CellBoosterView
}
;
CellBooster.prototype.hurtCells = function(a) {
FieldBooster.prototype.hurtCells.call(this, a);
Game.currentGame.counter.setTimeout(function() {
a.forEach(function(b, c) {
this.hurtCell(b, c, a.length)
}
.bind(this));
Game.currentGame && Game.currentGame.shakeField({
power: .5
})
}
.bind(this), CellBooster.HURT_DELAY)
}
;
CellBooster.HURT_DELAY = 500;
-1 !== ["runes", "adventure"].indexOf(cleverapps.config.name) && (CellBooster.HURT_DELAY = 1E3);
var LineBooster = function(a) {
FieldBooster.call(this, a)
};
LineBooster.prototype = Object.create(FieldBooster.prototype);
LineBooster.prototype.constructor = LineBooster;
LineBooster.prototype.listAffected = function(a) {
var b = []
, c = []
, d = 0
, e = Field.SIZE
, f = 1;
LineBooster.DIRECTION === LineBooster.DIRECTIONS.DOWN_UP && (d = Field.SIZE - 1,
f = e = -1);
for (; d !== e; d += f)
Game.currentGame.field.cells[d][a.x] && Game.currentGame.field.cells[d][a.x].hurtable && (b.push(Game.currentGame.field.cells[d][a.x]),
Game.currentGame.field.floor[d][a.x] && c.push(Game.currentGame.field.floor[d][a.x]));
return {
cells: b,
tiles: c
}
}
;
LineBooster.prototype.isAllowedTarget = function(a) {
if (!a)
return !1;
var b = Game.currentGame.tutorial;
return !b || b.finished || b.existInControll(a.x, a.y) ? !0 : !1
}
;
LineBooster.prototype.getViewClass = function() {
return LineBoosterView
}
;
LineBooster.prototype.hurtCells = function(a) {
FieldBooster.prototype.hurtCells.call(this, a);
a.forEach(function(b, c) {
var d = LineBooster.HURT_DELAY + 100 * Math.abs(b.y - a[0].y);
Game.currentGame.counter.setTimeout(function() {
this.hurtCell(b, 0, 1);
Game.currentGame && c === a.length - 1 && Game.currentGame.shakeField()
}
.bind(this), d)
}
.bind(this))
}
;
LineBooster.DIRECTIONS = {
UP_DOWN: 0,
DOWN_UP: 1
};
LineBooster.DIRECTION = LineBooster.DIRECTIONS.UP_DOWN;
"heroes" === cleverapps.config.name && (LineBooster.DIRECTION = LineBooster.DIRECTIONS.DOWN_UP);
LineBooster.HURT_DELAY = 0;
"heroes" === cleverapps.config.name && (LineBooster.HURT_DELAY = 400);
"runes" === cleverapps.config.name && (LineBooster.HURT_DELAY = 600);
var ColorBooster = function(a) {
FieldBooster.call(this, a)
};
ColorBooster.prototype = Object.create(FieldBooster.prototype);
ColorBooster.prototype.constructor = ColorBooster;
ColorBooster.prototype.listAffected = function(a) {
var b = []
, c = [];
this.targetCell = a;
for (var d = a.getColor(), e = 0; e < Field.SIZE; e++)
for (var f = 0; f < Field.SIZE; f++)
Game.currentGame.field.cells[e][f] && Game.currentGame.field.cells[e][f].hurtable && Game.currentGame.field.cells[e][f].getColor() === d && (void 0 !== d || Game.currentGame.field.cells[e][f] === a) && (b.push(Game.currentGame.field.cells[e][f]),
Game.currentGame.field.floor[e][f] && c.push(Game.currentGame.field.floor[e][f]));
return {
cells: b,
tiles: c
}
}
;
ColorBooster.prototype.getViewClass = function() {
return ColorBoosterView
}
;
ColorBooster.prototype.hurtCells = function(a) {
FieldBooster.prototype.hurtCells.call(this, a);
Game.currentGame.counter.setTimeout(function() {
var b = [];
Array.prototype.push.apply(b, a);
cleverapps.shuffle(b).forEach(function(c) {
c.animate(BaseCell.ANIMATION_MULTI_COLOR_SELECT)
});
a.forEach(function(c, d) {
this.hurtCell(c, d, a.length)
}
.bind(this));
Game.currentGame && Game.currentGame.shakeField()
}
.bind(this), ColorBooster.HURT_DELAY)
}
;
ColorBooster.HURT_DELAY = 900;
"adventure" === cleverapps.config.name && (ColorBooster.HURT_DELAY = 1400);
var Booster = function(a) {
BaseBooster.call(this, a);
this.onForceListener = function() {}
;
this.onToggleArrowListener = function() {}
;
this.onToggleTintListener = function() {}
;
this.onExecuteListener = function() {}
;
this.onDisableListener = function() {}
;
this.onEnableListener = function() {}
;
this.alarm = new Alarm;
this.alarm.onChangeListeners.tint = this.toggleTint.bind(this);
this.alarm.onChangeListeners.arrow = this.toggleArrow.bind(this);
cleverapps.eventBus.on("changeFocus", function() {
this.alarm.isOn() && this.stopHint()
}
.bind(this))
};
Booster.prototype = Object.create(BaseBooster.prototype);
Booster.prototype.constructor = Booster;
Booster.prototype.onGameStarted = function() {
if (!this.disableForceOnInactive && this.isForceAvailable())
cleverapps.userStatus.on("inactive_long", this.showForce.bind(this))
}
;
Booster.prototype.clear = function() {
this.alarm.clear()
}
;
Booster.prototype.onUserActive = function() {
this.stopHint()
}
;
Booster.prototype.clearAlarmTimeout = function() {
this.alarmTimeout && (clearTimeout(this.alarmTimeout),
this.alarmTimeout = void 0)
}
;
Booster.prototype.startHint = function(a) {
a && (this.manualAlarm = !0);
this.alarm.start("hint", 1);
this.clearAlarmTimeout()
}
;
Booster.prototype.stopHint = function() {
this.manualAlarm = !1;
this.alarm.stop("hint");
this.clearAlarmTimeout()
}
;
Booster.prototype.onUserInactive = function() {
this.manualAlarm || cleverapps.focusManager.isFocused() || (this.startHint(),
this.alarmTimeout = setTimeout(this.stopHint.bind(this), cleverapps.parseInterval(Booster.StopAlarmTimeout)))
}
;
Booster.prototype.toggleTint = function() {
this.onToggleTintListener(this.alarm.isOn())
}
;
Booster.prototype.toggleArrow = function() {
this.onToggleArrowListener(this.alarm.isOn())
}
;
Booster.prototype.showForce = function() {
return this.onForceListener()
}
;
Booster.prototype.getControls = function() {
return []
}
;
Booster.prototype.onPressed = function(a, b) {
Game.currentGame.outcome !== GameBase.OUTCOME_UNKNOWN ? a() : Game.currentGame.counter.isActive() ? a() : Game.currentGame.open && Game.currentGame.open.counter.isActive() ? a() : (b && (b = this.getAmount() + 1,
this.setAmount(b)),
this.canExecute() ? (this.execute(),
a()) : this.isAdsAvailable() ? cleverapps.rewardedAdsManager.playRewarded(this.limit, function() {
cleverapps.adsLimits.watch(this.limit);
cleverapps.focusManager.showControlsWhileFocused(this.getControls());
Game.currentGame.counter.setTimeout(function() {
this.execute();
a()
}
.bind(this), 400)
}
.bind(this), function() {
a()
}) : (this.buy() && this.execute(),
a()))
}
;
Booster.prototype.execute = function(a) {
this.onExecute(a);
this.use();
this.onExecuteListener()
}
;
Booster.StopAlarmTimeout = "5 seconds";
var HintBooster = function(a) {
Booster.call(this, a)
};
HintBooster.prototype = Object.create(Booster.prototype);
HintBooster.prototype.constructor = HintBooster;
HintBooster.prototype.onGameStarted = function() {
cleverapps.userStatus.on("inactive_long", this.onUserInactive.bind(this));
cleverapps.userStatus.on("active", this.onUserActive.bind(this));
var a = Game.currentGame;
this.isForceAvailable() && (a.on("WrongWord_Booster", this.showForce.bind(this)),
a.on("forceHint", function() {
this.showForce()
}
.bind(this)))
}
;
HintBooster.prototype.isAdsAvailable = function() {
return cleverapps.flags.lowMonetization ? cleverapps.adsLimits.state(AdsLimits.TYPES.BOOSTER_ADS) === AdsLimits.STATE_READY : BaseBooster.prototype.isAdsAvailable.call(this)
}
;
HintBooster.prototype.findHint = function() {
var a = Game.currentGame;
return "klondike" === cleverapps.config.type ? a.selectHint() : "stacks" === cleverapps.config.subtype ? a.keypad.selectHintPosition() : a.board.selectHintPosition()
}
;
HintBooster.prototype.addHint = function(a, b) {
var c = Game.currentGame;
if ("klondike" === cleverapps.config.type)
c.addHint(a),
c.counter.trigger();
else if (b = b || {},
-1 === ["scramble"].indexOf(cleverapps.config.name))
c.board.addHint(a.row, a.column),
c.counter.setTimeout(function() {}, 800);
else if (a.letter) {
a.letter.setHint(!0, {
hintAnimationDuration: b.hintAnimationDuration || .3,
startPos: b.startPos
});
var d = c.board.listWordIndexes(a.word)[a.index];
c.counter.setTimeout(function() {
c.board.addHint(d[0], d[1])
}, 800)
}
}
;
HintBooster.prototype.onExecute = function() {
var a = this.findHint();
a ? (levels.gameHints && levels.gameHints.addHint(),
this.addHint(a)) : this.trigger("noHintFound")
}
;
var OpenLetterBooster = function(a) {
Booster.call(this, a);
this.state = OpenLetterBooster.INACTIVE
};
OpenLetterBooster.prototype = Object.create(Booster.prototype);
OpenLetterBooster.prototype.constructor = OpenLetterBooster;
OpenLetterBooster.prototype.onExecute = function() {
this.state = OpenLetterBooster.ACTIVE;
Game.currentGame.keypad.chooseBoosterLetter()
}
;
OpenLetterBooster.prototype.isActive = function() {
return this.state === OpenLetterBooster.ACTIVE
}
;
OpenLetterBooster.prototype.isAnimating = function() {
return this.state === OpenLetterBooster.ANIMATION
}
;
OpenLetterBooster.prototype.open = function(a) {
Game.currentGame.board.selectLettersPositions(a.symbol).forEach(function(b) {
Game.currentGame.board.addHint(b[0], b[1], cleverapps.Board.SPAWN_LETTER_ANIMATION)
});
this.state = OpenLetterBooster.ANIMATION;
Game.currentGame.counter.setTimeout(function() {
this.state = OpenLetterBooster.INACTIVE
}
.bind(this), 800)
}
;
OpenLetterBooster.INACTIVE = 0;
OpenLetterBooster.ACTIVE = 1;
OpenLetterBooster.ANIMATION = 2;
var WildcardBooster = function(a) {
Booster.call(this, a);
this.onCardCreatedListener = function() {}
;
this.onShowTutorial = function() {}
};
WildcardBooster.prototype = Object.create(Booster.prototype);
WildcardBooster.prototype.constructor = WildcardBooster;
WildcardBooster.prototype.onGameStarted = function() {
this.hintHandler = cleverapps.userStatus.on("inactive_very_short", this.hintAttempt.bind(this), this);
cleverapps.userStatus.on("active", this.onUserActive.bind(this));
Game.currentGame.on("stop", function() {
this.hintHandler && this.hintHandler.clear()
}
.bind(this))
}
;
WildcardBooster.prototype.getControls = function() {
return ["opencards", "hint_4"]
}
;
WildcardBooster.prototype.onExecute = function() {
var a = new Wildcard;
this.onCardCreatedListener(a);
Game.currentGame.shiftWildcard(a);
Game.currentGame.log.push(MovesLog.MOVE_USE_BOOSTER, {
id: this.id
});
this.wildcardTutorial || (a = cleverapps.Random.mathChoose(cleverapps.exclamation.getCongratulations()),
cleverapps.exclamation.show(a))
}
;
WildcardBooster.prototype.activateTutorial = function() {
this.wildcardTutorial = !0;
this.onShowTutorial()
}
;
WildcardBooster.prototype.use = function() {
this.wildcardTutorial || BaseBooster.prototype.use.call(this)
}
;
WildcardBooster.prototype.onPressed = function(a, b) {
Booster.prototype.onPressed.call(this, a, b && !this.wildcardTutorial);
this.wildcardTutorial && Game.currentGame.cardsTutorial && (Game.currentGame.cardsTutorial.finishTutorialStep(),
Game.currentGame.counter.trigger())
}
;
WildcardBooster.prototype.hintAttempt = function() {
if (!cleverapps.environment.isSceneWithPreview() && !cleverapps.config.editorMode) {
var a = 0 === Game.currentGame.table.listMissed().length
, b = Game.currentGame.combo && 0 < Game.currentGame.combo.level;
if (a && b)
this.onUserInactive()
}
}
;
WildcardBooster.prototype.makeUndo = function() {
this.wildcardTutorial || cleverapps.user.earnHard(cleverapps.EVENTS.EARN.RETURN, this.getPrice().amount);
Game.currentGame.open.pop().trigger("makeUndo")
}
;
var UndoBooster = function(a) {
Booster.call(this, a)
};
UndoBooster.prototype = Object.create(Booster.prototype);
UndoBooster.prototype.constructor = UndoBooster;
UndoBooster.prototype.onExecute = function() {
Game.currentGame.log.executeUndo()
}
;
UndoBooster.prototype.onUsed = function() {}
;
UndoBooster.prototype.getControls = function() {
return ["opencards", "hint_18", "hint_4"]
}
;
UndoBooster.prototype.onGameStarted = function() {
Game.currentGame.log.on("change", this.updateState.bind(this))
}
;
UndoBooster.prototype.updateState = function() {
if (Game.currentGame.log.isEmpty())
this.onDisableListener();
else
this.onEnableListener()
}
;
var TileShuffleBooster = function(a) {
Booster.call(this, a)
};
TileShuffleBooster.prototype = Object.create(Booster.prototype);
TileShuffleBooster.prototype.constructor = TileShuffleBooster;
TileShuffleBooster.prototype.onGameStarted = function() {
Game.currentGame.log.on("change", this.updateState.bind(this));
Game.currentGame.pagination.on("changePage", this.updateState.bind(this));
cleverapps.userStatus.on("inactive_very_short", function() {
this.isForceAvailable() && this.showForce()
}
.bind(this))
}
;
TileShuffleBooster.prototype.updateState = function() {
if (1 >= Game.currentGame.table.cards.length)
this.onDisableListener();
else
this.onEnableListener()
}
;
TileShuffleBooster.prototype.onExecute = function() {
Game.currentGame.table.shuffle()
}
;
var ShuffleBooster = function(a) {
Booster.call(this, a)
};
ShuffleBooster.prototype = Object.create(Booster.prototype);
ShuffleBooster.prototype.constructor = ShuffleBooster;
ShuffleBooster.prototype.onExecute = function() {
Game.currentGame.keypad.shuffle()
}
;
var VacuumBooster = function(a) {
Booster.call(this, a);
this.onDisableListener()
};
VacuumBooster.prototype = Object.create(Booster.prototype);
VacuumBooster.prototype.constructor = VacuumBooster;
VacuumBooster.prototype.calcBlowTriads = function() {
var a = Game.currentGame.table.cards.length;
return .6 * a >= 3 * VacuumBooster.DEFAULT_BLOW_TRIADS ? VacuumBooster.DEFAULT_BLOW_TRIADS : .8 * a >= 3 * VacuumBooster.DEFAULT_BLOW_TRIADS ? VacuumBooster.DEFAULT_BLOW_TRIADS - 1 : VacuumBooster.DEFAULT_BLOW_TRIADS - 2
}
;
VacuumBooster.prototype.onExecute = function() {
Game.currentGame.table.blowCards(this.calcBlowTriads())
}
;
VacuumBooster.prototype.onGameStarted = function() {
Game.currentGame.log.on("change", this.updateState.bind(this));
Game.currentGame.table.on("blowCards", this.updateState.bind(this))
}
;
VacuumBooster.prototype.getControls = function() {
return ["hint_23"]
}
;
VacuumBooster.prototype.updateState = function() {
if (Game.currentGame.table.findCardsToBlow())
this.onEnableListener();
else
this.onDisableListener()
}
;
VacuumBooster.DEFAULT_BLOW_TRIADS = 3;
var ReplaceAllBooster = function(a) {
Booster.call(this, a);
this.disableForceOnInactive = !0
};
ReplaceAllBooster.prototype = Object.create(Booster.prototype);
ReplaceAllBooster.prototype.constructor = ReplaceAllBooster;
ReplaceAllBooster.prototype.isAdsAvailable = function() {
return cleverapps.flags.lowMonetization ? cleverapps.adsLimits.state(AdsLimits.TYPES.BOOSTER_ADS) === AdsLimits.STATE_READY : BaseBooster.prototype.isAdsAvailable.call(this)
}
;
ReplaceAllBooster.prototype.onExecute = function() {
var a = Game.currentGame
, b = a.pieces;
a.counter.setTimeout(function() {}, 1E3);
a.applySelectionAlgorithm({
findSolvable: !0,
findMaxExplode: !0,
proposedIndexes: !1,
callback: function(c) {
c = c.items.map(function(d) {
return Forms.ALL_POSSIBLE_VARIANTS[d]
});
c.forEach(function(d, e) {
b.clearHint(e);
b.replacePiece({
index: e,
form: d,
color: b.calcPieceColor()
})
})
}
})
}
;
var ClearPiecesBooster = function(a) {
Booster.call(this, a)
};
ClearPiecesBooster.prototype = Object.create(Booster.prototype);
ClearPiecesBooster.prototype.constructor = ClearPiecesBooster;
ClearPiecesBooster.prototype.getControls = function() {
return ["hint_21"]
}
;
ClearPiecesBooster.prototype.onExecute = function() {
Game.currentGame.grid.runClearBang()
}
;
var UndoPieceBooster = function(a) {
Booster.call(this, a)
};
UndoPieceBooster.prototype = Object.create(Booster.prototype);
UndoPieceBooster.prototype.constructor = UndoPieceBooster;
UndoPieceBooster.prototype.onExecute = function() {
Game.currentGame.counter.setTimeout(function() {}, 1E3);
Game.currentGame.history.undo()
}
;
UndoPieceBooster.prototype.isForceAvailable = function() {
return Booster.prototype.isForceAvailable.call(this) && Game.currentGame.history.hasUndo()
}
;
UndoPieceBooster.prototype.onGameStarted = function() {
Game.currentGame.history.onChangeListener = function(a) {
if (a)
this.onEnableListener();
else
this.onDisableListener()
}
.bind(this)
}
;
var InstantTournament = function() {
this.id = void 0;
this.load();
connector.platform.isConnected() && this.updateId();
connector.platform.on("changeStatus", function(a) {
a === connector.STATUS_CONNECTED && this.updateId()
}
.bind(this))
};
InstantTournament.prototype.updateId = function() {
this.isAvailable() && cleverapps.platformLogic.getCurrentTournamentId(function(a, b) {
a === cleverapps.CODE_SUCCEED && b !== this.id && (this.id = b,
this.save())
}
.bind(this))
}
;
InstantTournament.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.INSTANT_TOURNAMENT);
a && (this.id = a.id)
}
;
InstantTournament.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.INSTANT_TOURNAMENT, {
id: this.id
})
}
;
InstantTournament.prototype.isInTournament = function() {
return void 0 !== this.id
}
;
InstantTournament.prototype.isAvailable = function() {
return cleverapps.platformLogic.getCurrentTournamentId
}
;
InstantTournament.prototype.reportScore = cleverapps.accumulate(1E3, function() {
cleverapps.scoreTracker.needToReport() && connector.platform.isConnected() && cleverapps.platformLogic.getCurrentTournamentId(function(a, b) {
a === cleverapps.CODE_SUCCEED && (this.id !== b && (this.id = b,
this.save()),
this.id && cleverapps.scoreTracker.report())
}
.bind(this))
});
InstantTournament.REPORT_TIMEOUT = 6E5;
"merge" === cleverapps.config.type && (InstantTournament.REPORT_TIMEOUT = cleverapps.parseInterval("2 days"));
var ScoreTracker = function() {
this.lastReport = this.score = 0;
this.load();
(this.withDialog = connector.platform.oneOf(connector.INSTANT, connector.WORTAL)) && "merge" === cleverapps.config.type ? ScoreTracker.REPORT_TIMEOUT = cleverapps.parseInterval("2 days") : connector.platform.oneOf(connector.YOUTUBE, connector.GAMESNACK) && (ScoreTracker.REPORT_TIMEOUT = 0)
};
ScoreTracker.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.SCORE);
a || (a = cleverapps.dataLoader.load(DataLoader.TYPES.INSTANT_TOURNAMENT));
a && (this.score = a.score || 0,
this.lastReport = a.lastReport || 0)
}
;
ScoreTracker.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.SCORE, {
score: this.score,
lastReport: this.lastReport
})
}
;
ScoreTracker.prototype.calcScore = function() {
var a = cleverapps.user.getFloatLevel();
return Math.round(100 * a)
}
;
ScoreTracker.prototype.setScore = function(a) {
this.score = a;
this.save()
}
;
ScoreTracker.prototype.needToReport = function() {
if (Date.now() - this.lastReport < ScoreTracker.REPORT_TIMEOUT)
return !1;
if (this.withDialog) {
var a = cleverapps.user.getFloatLevel();
if (5 > a || void 0 === cleverapps.timeStart || 6E4 > Date.now() - cleverapps.timeStart)
return !1;
var b = this.calcScore()
, c = 10;
9 > a && (c = 50);
if (b < (Math.floor(this.score / c) + 1) * c)
return !1
}
return !0
}
;
ScoreTracker.prototype.report = cleverapps.accumulate(1E3, function() {
if (cleverapps.platformLogic.reportScore && connector.platform.isConnected() && this.needToReport()) {
var a = this.calcScore();
cleverapps.platformLogic.reportScore(a, function(b) {
b === cleverapps.CODE_SUCCEED && (this.lastReport = Date.now(),
this.setScore(a))
}
.bind(this))
}
});
ScoreTracker.REPORT_TIMEOUT = cleverapps.parseInterval("10 minutes");
var BrushBooster = function(a) {
Booster.call(this, a);
this.init();
this.onAfterExecuted = function() {}
};
BrushBooster.prototype = Object.create(Booster.prototype);
BrushBooster.prototype.ctor = BrushBooster;
BrushBooster.prototype.onGameStarted = function() {
if (this.isForceAvailable()) {
var a = Game.currentGame;
a.onMistakeBoosterListeners.brush = function() {
this.isForceAvailable() && !this.used && (1 < a.inflamer.value || 0 < a.inflamer.stage) && this.showForce()
}
.bind(this)
}
}
;
BrushBooster.prototype.canExecute = function() {
return Booster.prototype.canExecute.call(this) && !this.used
}
;
BrushBooster.prototype.onPressed = function(a, b) {
this.used ? a() : Booster.prototype.onPressed.call(this, a, b)
}
;
BrushBooster.prototype.execute = function() {
this.executing || (this.executing = !0,
Booster.prototype.execute.apply(this, arguments),
this.executing = !1)
}
;
BrushBooster.prototype.onExecute = function() {
this.used = !0;
Game.currentGame.showPaint();
this.onAfterExecuted()
}
;
BrushBooster.prototype.init = function() {
this.used = !1
}
;
var DiscoverBooster = function(a) {
Booster.call(this, a)
};
DiscoverBooster.prototype = Object.create(Booster.prototype);
DiscoverBooster.prototype.ctor = DiscoverBooster;
DiscoverBooster.prototype.onGameStarted = function() {
cleverapps.userStatus.on("inactive_short", this.onUserInactive.bind(this));
cleverapps.userStatus.on("active", this.onUserActive.bind(this));
var a = Game.currentGame;
this.isForceAvailable() && (a.onMistakeBoosterListeners.discover = this.showForce.bind(this))
}
;
DiscoverBooster.prototype.onUserInactive = function() {
this.isDisabled() || Booster.prototype.onUserInactive.apply(this, arguments)
}
;
DiscoverBooster.prototype.onPressed = function(a, b) {
0 === Game.currentGame.getAreasWithoutHint().length ? (cleverapps.notification.create("DiscoverBooster.hintsShown"),
a()) : Booster.prototype.onPressed.call(this, a, b)
}
;
DiscoverBooster.prototype.onUserActive = function() {
this.manualAlarm || Booster.prototype.onUserActive.apply(this, arguments)
}
;
DiscoverBooster.prototype.execute = function() {
this.executing = !0;
Booster.prototype.execute.apply(this, arguments);
this.executing = !1
}
;
DiscoverBooster.prototype.onExecute = function(a) {
Game.currentGame.boosterDiscover(a)
}
;
var BaseButtonBooster = cleverapps.UI.Button.extend({
avoidNode: "ButtonBooster",
ctor: function(a) {
this.booster = a.booster;
this.styles = a.styles;
this.content = this.getContent();
this.onChangeAmount();
a = {
onClicked: this.onPressed.bind(this),
content: this.content,
spine: a.spine
};
cleverapps.overrideStyles(a, this.getSize());
this._super(a);
this.setCascadeOpacityEnabled(!0);
this.setCascadeColorEnabled(!0);
this.updateSize();
this.styles.position && this.setPositionRound(this.styles.position);
this.setupChildren();
this.booster.on("changeAmount", this.createListener(this.onChangeAmount.bind(this)), this);
cleverapps.adsLimits.on("update", this.onChangeAmount.bind(this), this);
if (cleverapps.config.soft)
cleverapps.user.on("changeSoft", this.onChangeAmount.bind(this), this);
else
cleverapps.user.on("changeHard", this.onChangeAmount.bind(this), this);
this.booster.onToggleArrowListener = this.createListener(this.toggleArrow.bind(this));
this.booster.onToggleTintListener = this.createListener(this.toggleTint.bind(this));
this.booster.onForceListener = this.createListener(this.showForce.bind(this));
this.booster.onExecuteListener = this.createListener(this.onExecute.bind(this));
this.booster.onEnableListener = this.createListener(this.enable.bind(this));
this.booster.onDisableListener = this.createListener(this.disable.bind(this));
cleverapps.aims.registerTarget("boosters" + this.booster.id, this, {
controls: this.getControlId(),
flyingUnderShadow: !0
})
},
onChangeAmount: function() {
if (!this.free && !this.booster.inRewardAnimation) {
var a = this.getCurrentText();
[this.amount, this.price, this.ads].forEach(function(b) {
b.setVisible(b === a)
});
this.setAmount(this.booster.getAmount())
}
},
getCurrentText: function() {
var a = this.booster.getState();
if (a === BaseBooster.AMOUNT_STATE)
return this.amount;
if (a === BaseBooster.PRICE_STATE)
return this.price;
if (a === BaseBooster.ADS_STATE)
return this.ads
},
setAmount: function(a) {
this.amount.setString("x" + a)
},
setupChildren: function() {
this.content.setPositionRound(this.width / 2, this.height / 2);
this.layout.setPositionRound(this.styles.content.layout)
},
updateSize: function() {
this.baseScale = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? this.styles.phone.scale : 1;
this.setScale(this.baseScale);
var a = this.getSize();
this.resize(a.width || a, a.height);
this.layout.setOptions(this.getLayoutOptions())
},
getSize: function() {
return this.styles.size || {
width: this.styles.width,
height: this.styles.height
}
},
toggleArrow: function(a) {
a ? this.pointer = PointerView.create({
target: this
}) : (PointerView.remove(this.pointer),
this.pointer = void 0);
this.icon instanceof cleverapps.Spine && this.icon.setAnimation(0, a ? "animation" : "idle", !0)
},
toggleTint: function(a) {
this.hintOn = a;
this.runTintAnimation()
},
getForceActions: function() {
return [function(a) {
this.switchToFreePrice();
setTimeout(a, 700)
}
.bind(this), function(a) {
cleverapps.focusManager.showControlsWhileFocused(this.getControlId(), !0);
cleverapps.forces.create(this, this.booster.force);
cleverapps.forces.onceForceClosed = a
}
.bind(this)]
},
getControlId: function() {
return "hint_" + this.booster.id
},
showForce: function() {
if (cleverapps.forces.isAvailable(this, this.booster.force)) {
var a = this.getForceActions();
this.baseZOrder = this.getLocalZOrder();
this.setLocalZOrder(0);
cleverapps.focusManager.display({
focus: "ButtonBoosterForce",
control: [this.getControlId(), "opencards"],
actions: a
});
return !0
}
return !1
},
runTintAnimation: function() {
if (!this.tintRunning && this.hintOn) {
this.tintRunning = !0;
var a = cleverapps.styles.COLORS.WHITE
, b = cleverapps.styles.COLORS.HINT_ALARM_COLOR || cleverapps.styles.COLORS.PLAYER_ALARM_COLOR;
this.background.runAction(new cc.Sequence(new cc.TintTo(.7,b.r,b.g,b.b),new cc.TintTo(.7,a.r,a.g,a.b),new cc.CallFunc(function() {
this.tintRunning = !1;
this.runTintAnimation()
}
.bind(this))))
}
},
createIcon: function() {
if (bundles.game.jsons.hint_icon_json) {
var a = new cleverapps.Spine(bundles.game.jsons.hint_icon_json);
a.setAnimation(0, "idle", !0);
return a
}
return new cc.Sprite(bundles.game.frames.hint_icon_png)
},
getLayoutOptions: function() {
var a = this.styles.content
, b = cleverapps.resolution.mode;
a = [a.margin, a.direction, a.reversed].map(function(c) {
return Array.isArray(c) ? c[b] : c
});
return {
margin: a[0],
direction: a[1],
reversed: a[2]
}
},
getContent: function() {
var a = new cc.Node;
a.setAnchorPoint(.5, .5);
var b = this.getLayoutOptions()
, c = this.price = this.getPriceText();
c.setCascadeOpacityEnabled(!0);
var d = this.amount = cleverapps.UI.generateImageText("x" + this.booster.getAmount(), cleverapps.styles.FONTS.AMOUNT_BOOSTER)
, e = this.ads = new TextWithIcon("## x1",{
font: cleverapps.styles.FONTS.BUTTON_BOOSTER
})
, f = this.icon = this.createIcon()
, g = this.textNode = new cc.Node;
g.setAnchorPoint(.5, .5);
g.setContentSize(c.getContentSize());
g.addChild(c);
c.setPosition(g.width / 2, g.height / 2);
g.addChild(d);
d.setPosition(g.width / 2, g.height / 2);
g.addChild(e);
e.setPosition(g.width / 2, g.height / 2);
this.layout = new cleverapps.Layout([f, g],b);
a.addChild(this.layout);
return a
},
getPriceText: function() {
var a = this.booster.getPrice();
return new TextWithIcon(a.soft && "@@" + a.amount || "$$" + a.amount,{
font: cleverapps.styles.FONTS.BUTTON_BOOSTER
})
},
createFreePrice: function() {
var a = cleverapps.UI.generateTTFText("FREE", cleverapps.styles.FONTS.BUTTON_BOOSTER);
a.fitTo(this.getFreeTextWidth());
a.setPosition(this.textNode.width / 2, this.textNode.height / 2);
this.textNode.addChild(a);
return a
},
switchToFreePrice: function() {
var a = this.getCurrentText()
, b = this.free = this.createFreePrice();
b.setOpacity(0);
b.setVisible(!1);
a.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.Hide));
b.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.Show,new cc.FadeIn(.3)))
},
getFreeTextWidth: function() {
return this.styles.content.freeBlock.textWidth
},
switchToRegularPrice: function() {
this.free.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.FadeOut(.3),new cc.RemoveSelf,new cc.CallFunc(function() {
delete this.free;
this.getCurrentText().runAction(new cc.Sequence(new cc.Show,new cc.FadeIn(.3)))
}
.bind(this))))
},
onPressed: function() {
var a = cleverapps.forces.isRunningForce(this.booster.force);
a && (this.switchToRegularPrice(),
this.baseZOrder && this.setLocalZOrder(this.baseZOrder),
cleverapps.forces.closeRunningForce());
cleverapps.focusManager.display({
focus: "ExecuteButtonBooster",
action: function(b) {
this.booster.onPressed(b, a)
}
.bind(this)
})
},
onExecute: function() {
this.icon instanceof cleverapps.Spine && "crocword" === cleverapps.config.name && this.icon.setAnimationAndIdleAfter("hint", "idle");
cleverapps.audio.playSound(this.booster.executeEffect)
}
});
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
BUTTON_BOOSTER: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
AMOUNT_BOOSTER: {
size: 45,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.ButtonBooster = {
// uptap 底部按钮样式
width: 150,
height: 130,
zOrder: 0,
position: [{
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 200
}
}, {
x: {
align: "right",
dx: -10
},
y: {
align: "bottom",
dy: 360
}
}, {
x: {
align: "right",
dx: -10
},
y: {
align: "bottom",
dy: 360
}
}],
phone: {
scale: .8
},
content: {
margin: 20,
direction: cleverapps.UI.HORIZONTAL,
layout: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
freeBlock: {
textWidth: 120
}
}
};
cleverapps.Boosters = function(a) {
this.boosterBeforeIds = cleverapps.Boosters.listBoostersBeforeIds();
this.boosterIds = cleverapps.Boosters.listBoostersIds();
this.boosters = {};
this.changed = {};
this.createBoosters();
a ? this.initialize() : this.load()
}
;
cleverapps.Boosters.prototype.initialize = function() {
this.data = {};
this.addInitAmount()
}
;
cleverapps.Boosters.prototype.createBoosters = function() {
this.boosterIds.concat(this.boosterBeforeIds).forEach(function(a) {
this.boosters[a] = new cleverapps.Boosters.CONFIG[a].model(a)
}, this)
}
;
cleverapps.Boosters.prototype.addInitAmount = function() {
var a = !1;
this.listAll().forEach(function(b) {
void 0 === this.data[b.id] && (this.data[b.id] = cleverapps.Boosters.INIT_AMOUNT,
a = !0)
}, this);
a && this.save()
}
;
cleverapps.Boosters.prototype.load = function() {
this.data = cleverapps.dataLoader.load(DataLoader.TYPES.BOOSTERS) || {}
}
;
cleverapps.Boosters.prototype.save = function(a) {
cleverapps.Boosters.IsUnlimited() || (cleverapps.dataLoader.save(DataLoader.TYPES.BOOSTERS, this.data),
!1 !== a && cleverapps.synchronizer.addUpdateTask("boosters"))
}
;
cleverapps.Boosters.prototype.getAmount = function(a) {
return this.data[a] ? this.data[a] : 0
}
;
cleverapps.Boosters.prototype.has = function(a) {
return 0 < this.getAmount(a)
}
;
cleverapps.Boosters.prototype.take = function(a, b) {
b = b || 1;
this.has(a) && (b = this.getAmount(a) - b,
0 > b && (b = 0),
this.setAmount(a, b))
}
;
cleverapps.Boosters.prototype.add = function(a, b, c) {
b = b || 1;
this.setAmount(a, this.getAmount(a) + b, c)
}
;
cleverapps.Boosters.prototype.setAmount = function(a, b, c) {
if (this.getAmount(a) !== b && (this.data[a] = b,
this.changed[a] = !0,
this.save(),
!c))
this.onChange()
}
;
cleverapps.Boosters.prototype.onChange = function() {
var a = this.changed;
this.changed = {};
for (var b in a)
this.boosters[b].trigger("changeAmount")
}
;
cleverapps.Boosters.prototype.getBoosterById = function(a) {
return this.boosters[a]
}
;
cleverapps.Boosters.prototype.getIdByType = function(a) {
var b = [], c;
for (c in this.boosters)
this.boosters[c].type === a && b.push(c);
b.length || cleverapps.throwAsync("No found booster with type: " + a);
return cleverapps.Random.choose(b)
}
;
cleverapps.Boosters.prototype.listBoosters = function() {
return this.boosterIds.map(function(a) {
return this.boosters[a]
}, this)
}
;
cleverapps.Boosters.prototype.listBoostersBefore = function() {
return this.boosterBeforeIds.map(function(a) {
return this.boosters[a]
}, this)
}
;
cleverapps.Boosters.prototype.listAll = function() {
return this.listBoostersBefore().concat(this.listBoosters())
}
;
cleverapps.Boosters.listBoostersIds = function() {
return "scramble" === cleverapps.config.name ? [cleverapps.Boosters.TYPE_HINT, cleverapps.Boosters.TYPE_SHUFFLE] : "match3" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_CELL, cleverapps.Boosters.TYPE_LINE, cleverapps.Boosters.TYPE_COLOR] : "board" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_HINT, cleverapps.Boosters.TYPE_OPEN_LETTER] : "solitaire" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_WILDCARD, cleverapps.Boosters.TYPE_UNDO] : "differences" === cleverapps.config.name ? [cleverapps.Boosters.TYPE_BRUSH, cleverapps.Boosters.TYPE_DISCOVER] : "tile3" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_TILE_SHUFFLE, cleverapps.Boosters.TYPE_UNDO, cleverapps.Boosters.TYPE_VACUUM] : "klondike" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_UNDO, cleverapps.Boosters.TYPE_HINT] : "blocks" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_REPLACE_ALL, cleverapps.Boosters.TYPE_CLEAR_PIECES, cleverapps.Boosters.TYPE_UNDO_PIECE] : []
}
;
cleverapps.Boosters.listBoostersBeforeIds = function() {
return "match3" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_COMBO, cleverapps.Boosters.TYPE_MOVES, cleverapps.Boosters.TYPE_MULTICOLOR] : "solitaire" === cleverapps.config.type ? [cleverapps.Boosters.TYPE_MAGNET, cleverapps.Boosters.TYPE_DICE, cleverapps.Boosters.TYPE_JOKERS] : "stacks" === cleverapps.config.subtype ? [cleverapps.Boosters.TYPE_HIGHLIGHT, cleverapps.Boosters.TYPE_EYE, cleverapps.Boosters.TYPE_MAGNIFIER] : []
}
;
cleverapps.Boosters.IsUnlimited = function() {
return "klondike" === cleverapps.config.type
}
;
cleverapps.Boosters.isType = function(a) {
return -1 !== Object.values(cleverapps.Boosters.TYPES).indexOf(a)
}
;
cleverapps.Boosters.INIT_AMOUNT = 1;
cleverapps.Boosters.TYPE_CELL = 0;
cleverapps.Boosters.TYPE_LINE = 1;
cleverapps.Boosters.TYPE_COLOR = 2;
cleverapps.Boosters.TYPE_HINT = 3;
cleverapps.Boosters.TYPE_OPEN_LETTER = 24;
cleverapps.Boosters.TYPE_WILDCARD = 4;
cleverapps.Boosters.TYPE_SHUFFLE = 16;
cleverapps.Boosters.TYPE_BRUSH = 8;
cleverapps.Boosters.TYPE_DISCOVER = 9;
cleverapps.Boosters.TYPE_COMBO = 5;
cleverapps.Boosters.TYPE_MOVES = 6;
cleverapps.Boosters.TYPE_MULTICOLOR = 7;
cleverapps.Boosters.TYPE_MAGNET = 10;
cleverapps.Boosters.TYPE_DICE = 11;
cleverapps.Boosters.TYPE_JOKERS = 12;
cleverapps.Boosters.TYPE_HIGHLIGHT = 13;
cleverapps.Boosters.TYPE_EYE = 14;
cleverapps.Boosters.TYPE_MAGNIFIER = 15;
cleverapps.Boosters.TYPE_TILE_SHUFFLE = 17;
cleverapps.Boosters.TYPE_UNDO = 18;
cleverapps.Boosters.TYPE_VACUUM = 23;
cleverapps.Boosters.TYPE_REPLACE_ALL = 20;
cleverapps.Boosters.TYPE_CLEAR_PIECES = 21;
cleverapps.Boosters.TYPE_UNDO_PIECE = 22;
cleverapps.Boosters.CONFIG = {};
cleverapps.Boosters.TYPES = {
CHEAP: "cheap",
MEDIUM: "medium",
EXPENSIVE: "expensive"
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_CELL] = {
model: CellBooster,
type: cleverapps.Boosters.TYPES.CHEAP,
limit: AdsLimits.TYPES.BOOSTER_1,
icon_moving: bundles.game.frames.cellbooster_moving_png,
icon: bundles.game.frames.cellbooster_png,
icon_active: bundles.game.frames.cellbooster_active_png,
available: {
level: 1.6
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_LINE] = {
model: LineBooster,
type: cleverapps.Boosters.TYPES.MEDIUM,
limit: AdsLimits.TYPES.BOOSTER_2,
icon_moving: bundles.game.frames.linebooster_moving_png,
icon: bundles.game.frames.linebooster_png,
icon_active: bundles.game.frames.linebooster_active_png,
available: {
level: 2.53
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_COLOR] = {
model: ColorBooster,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
limit: AdsLimits.TYPES.BOOSTER_3,
icon_moving: bundles.game.frames.colorbooster_moving_png,
icon: bundles.game.frames.colorbooster_png,
icon_active: bundles.game.frames.colorbooster_active_png,
available: {
level: 3.33
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_HINT] = {
model: HintBooster,
type: "scramble" === cleverapps.config.name ? cleverapps.Boosters.TYPES.EXPENSIVE : cleverapps.Boosters.TYPES.CHEAP,
force: Forces.FREE_HINT_FORCE,
limit: AdsLimits.TYPES.BOOSTER_1,
available: {
level: .07,
olympics: {
level: .25
}
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_OPEN_LETTER] = {
model: OpenLetterBooster,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
force: Forces.FREE_HINT_FORCE,
limit: AdsLimits.TYPES.BOOSTER_1,
available: {
level: .07,
debugMode: !0
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_WILDCARD] = {
model: WildcardBooster,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
limit: AdsLimits.TYPES.BOOSTER_3,
available: {
level: .65
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_SHUFFLE] = {
model: ShuffleBooster,
force: Forces.FREE_SHUFFLE_FORCE,
type: cleverapps.Boosters.TYPES.CHEAP,
limit: AdsLimits.TYPES.BOOSTER_2,
available: {
level: .25,
projectName: ["scramble"]
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_BRUSH] = {
model: BrushBooster,
force: Forces.FREE_PAINT_FORCE,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
limit: AdsLimits.TYPES.BOOSTER_3,
available: {
level: .8
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_DISCOVER] = {
model: DiscoverBooster,
force: Forces.FREE_HINT_FORCE,
limit: AdsLimits.TYPES.BOOSTER_1,
type: cleverapps.Boosters.TYPES.CHEAP,
available: {
level: .8
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_TILE_SHUFFLE] = {
model: TileShuffleBooster,
force: Forces.FREE_SHUFFLE_FORCE,
type: cleverapps.Boosters.TYPES.CHEAP,
executeEffect: bundles.game.urls.shuffle_booster_effect,
limit: AdsLimits.TYPES.BOOSTER_2,
available: {
level: .91,
types: ["tile3"]
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_UNDO] = {
model: UndoBooster,
force: Forces.FREE_UNDO_FORCE,
type: "tile3" === cleverapps.config.type ? cleverapps.Boosters.TYPES.MEDIUM : cleverapps.Boosters.TYPES.CHEAP,
disableForceOnInactive: !0,
executeEffect: bundles.game.urls.undo_booster_effect,
limit: AdsLimits.TYPES.BOOSTER_1,
available: {
level: .4
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_VACUUM] = {
model: VacuumBooster,
force: Forces.FREE_VACUUM_FORCE,
disableForceOnInactive: !0,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
executeEffect: bundles.game.urls.return_booster_effect,
limit: AdsLimits.TYPES.BOOSTER_3,
available: {
level: 1.6,
types: ["tile3"]
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_REPLACE_ALL] = {
model: ReplaceAllBooster,
force: Forces.FREE_REPLACE_ALL_FORCE,
disableForceOnInactive: !0,
type: cleverapps.Boosters.TYPES.MEDIUM,
executeEffect: bundles.game.urls.booster_replace_effect,
limit: AdsLimits.TYPES.BOOSTER_2,
available: {
level: .53,
types: ["blocks"]
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_CLEAR_PIECES] = {
model: ClearPiecesBooster,
force: Forces.FREE_NEXT_PIECES_FORCE,
disableForceOnInactive: !0,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
limit: AdsLimits.TYPES.BOOSTER_2,
available: {
level: .66,
types: ["blocks"]
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_UNDO_PIECE] = {
model: UndoPieceBooster,
force: Forces.FREE_UNDO_PIECE,
disableForceOnInactive: !0,
type: cleverapps.Boosters.TYPES.CHEAP,
executeEffect: bundles.game.urls.booster_undo_effect,
limit: AdsLimits.TYPES.BOOSTER_1,
available: {
level: .4,
types: ["blocks"]
}
};
"klondike" === cleverapps.config.type && (cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_UNDO].price = {
type: cleverapps.Boosters.TYPES.CHEAP
},
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_HINT].price = {
type: cleverapps.Boosters.TYPES.MEDIUM
});
var BoosterAmountView = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.setCascadeOpacityEnabled(!0);
var b = cleverapps.styles.BoosterAmountView;
this.bg = bundles.game.frames.booster_amount_bg_png ? new cc.Sprite(bundles.game.frames.booster_amount_bg_png) : new cc.Sprite;
this.bg.setScale(b.background.scale);
this.bg.setAnchorPoint(.5, .5);
this.addChild(this.bg);
this.amount = cleverapps.UI.generateImageText("", cleverapps.styles.FONTS.WHITE_TEXT);
this.addChild(this.amount);
this.booster = a;
this.setAmount(a.getAmount())
},
setAmount: function(a) {
0 < a ? (this.visible = !0,
this.bg.setVisible(!0),
this.amount.setVisible(!0),
this.amount.setString(a),
this.amount.fitTo(this.bg.width * this.bg.scale * .85)) : (this.visible = !1,
this.bg.setVisible(!1),
this.amount.setVisible(!1));
this.setContentSize2(Math.max(this.bg.width * this.bg.scale, this.amount.width * this.amount.scale), Math.max(this.bg.height * this.bg.scale, this.amount.height * this.amount.scale));
this.amount.setPositionRound(this.width / 2, this.height / 2 + cleverapps.styles.BoosterAmountView.amount.offsetY);
this.bg.setPositionRound(this.width / 2, this.height / 2)
}
});
cleverapps.styles.BoosterAmountView = {
background: {
scale: 1
},
amount: {
offsetY: 0
}
};
var TournamentPlayerView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.player = a;
this.competition = b;
this.game = Game.currentGame;
b = cleverapps.styles.TournamentPlayerView;
this.setContentSize2(b.width, b.height);
this.setAnchorPoint(.5, .5);
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && this.setScale(.8);
this.baseScale = this.getScale();
this.colorNode = new cc.Node;
this.colorNode.setContentSize2(this.getContentSize());
this.colorNode.setAnchorPoint(.5, .5);
this.colorNode.setCascadeColorEnabled(!0);
this.colorNode.setPositionRound(this.width / 2, this.height / 2);
this.addChild(this.colorNode);
a = this.avatar = new cleverapps.UI.Avatar(a);
a.setScale(b.avatar.scale);
a.setCascadeColorEnabled(!1);
this.colorNode.addChild(a);
a.setLocalZOrder(-1);
a.setPositionRound(b.avatar);
this.createName();
this.addAmount();
this.processPlaceAnimation();
this.prevAmount = this.player.amount;
this.setCascadeColorEnabled(!0);
this.addClickProcessing();
this.competition.onChangeResultsListeners["player_" + this.player.id] = this.createListener(this.onChangeResults.bind(this));
this.player.id === connector.platform.getUserID() && (this.competition.onChangeResultsListeners.processPlaceAnimation = this.createListener(this.processPlaceAnimation.bind(this)))
},
createName: function() {
var a = cleverapps.styles.TournamentPlayerView
, b = this.player.name;
b || (cleverapps.throwAsync("No player name " + JSON.stringify(this.player)),
b = "Player_" + this.player.id.substr(-3));
0 < b.indexOf(" ") && (b = b.substring(0, b.indexOf(" ")));
var c = new cc.Sprite(bundles.tournament.frames.tournament_name_bg_png);
this.colorNode.addChild(c);
c.setPositionRound(a.name.bg);
this.name = cleverapps.UI.generateOnlyText(b, cleverapps.styles.FONTS.TOURNAMENT_PLAYER_TEXT);
this.name.fitTo(c.width - 2 * a.name.padding.x);
c.addChild(this.name);
this.name.setPositionRound(a.name)
},
addClickProcessing: function() {
if (cleverapps.config.debugMode)
cleverapps.UI.onClick(this, function() {
Game.currentGame && Game.currentGame.discoverDebug(this.player)
}
.bind(this))
},
addAmount: function() {
var a = cleverapps.styles.TournamentPlayerView.amount
, b = new cc.Sprite(this.player.id === connector.platform.getUserID() ? bundles.game.frames.tournament_mark_1_png : bundles.game.frames.tournament_mark_0_png);
b.setPositionRound(b.width / 2, b.height / 2);
var c = this.score = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(b.getContentSize());
c.addChild(b);
c.setCascadeColorEnabled(!0);
b = this.amountText = cleverapps.UI.generateImageText(this.player.amount + "", cleverapps.styles.FONTS.TOURNAMENT_PLAYER_TEXT);
c.addChild(b);
b.setPositionRound(a.text);
this.colorNode.addChild(c);
c.setPositionRound(a);
c.setScale(a.scale || 1)
},
onChangeResults: function(a) {
a === this.player.id && (a = cleverapps.styles.TournamentPlayerView.amount,
this.score.runAction(new cc.Sequence(new cc.Spawn((new cc.ScaleTo(.4,1.4)).easing(cc.easeOut(3)),new cc.Sequence(new cc.RotateTo(.15,15),new cc.RotateTo(.15,-15),new cc.RotateTo(.1,0))),new cc.ScaleTo(.15,a.scale || 1))),
this.amountText.setString(this.player.amount + ""))
},
processPlaceAnimation: function() {
if (this.player.id === connector.platform.getUserID() && !(3 > this.competition.calcPlace() || this.competition.getFinishedOpponents().length === this.competition.results.length - 1 || this.placeAnimationProcessing)) {
var a = cleverapps.styles.COLORS.PLAYER_ALARM_COLOR
, b = cleverapps.styles.COLORS.WHITE;
this.placeAnimationProcessing = !0;
this.colorNode.runAction(new cc.Sequence(new cc.TintTo(.5,a.r,a.g,a.b),new cc.TintTo(.5,b.r,b.g,b.b),new cc.CallFunc(function() {
this.placeAnimationProcessing = !1;
this.processPlaceAnimation()
}
.bind(this))));
this.framePulsation || (this.framePulsation = new cc.Sprite(bundles.tournament.frames.avatar_frame_red_png),
this.avatar.addChild(this.framePulsation),
this.framePulsation.setPositionRound(this.avatar.width / 2, this.avatar.height / 2),
this.framePulsation.setLocalZOrder(-1),
this.framePulsation.setColor(cc.color.RED),
this.framePulsation.setContentSize2(this.avatar.width, this.avatar.height));
this.framePulsation.runAction(new cc.Sequence(new cc.ScaleTo(.5,1.2),new cc.ScaleTo(.5,1)))
}
},
animateReorder: function(a) {
if (!((cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? 1 > Math.abs(this.x - a.x) : 1 > Math.abs(this.y - a.y)) && this.player.amount === this.prevAmount) || this.reorderAnimationRunning) {
var b = a.y > this.y || this.player.amount > this.prevAmount;
this.prevAmount = this.player.amount;
this.reorderAnimationRunning = !0;
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.Spawn(new cc.ScaleTo(.2,this.baseScale * (b ? 1.2 : .9)),(new cc.MoveTo(.35,a)).easing(cc.easeIn(1)),new cc.Sequence(new cc.CallFunc(function() {
this.rotation = 0
}
.bind(this)),new cc.DelayTime(.08),(new cc.RotateBy(.108,a.y > this.y ? 20 : 0)).easing(cc.easeInOut(.5)),new cc.RotateBy(.135,a.y > this.y ? -30 : 0),new cc.RotateBy(.027,a.y > this.y ? 10 : 0)),new cc.Sequence(new cc.DelayTime(.3),new cc.ScaleTo(.2,this.baseScale))),new cc.CallFunc(function() {
cleverapps.tooltipManager._hide();
this.reorderAnimationRunning = !1
}
.bind(this))))
}
},
animateResult: function(a) {
var b = cleverapps.styles.TournamentPlayerView;
this.runAction(AnimationsLibrary.animateDelta(a, {
target: this,
x: this.width / 2 + b.delta.x,
y: this.height / 2 + b.delta.y,
font: cleverapps.styles.FONTS.TOURNAMENT_PLAYER_TEXT
}))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TOURNAMENT_PLAYER_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_BROWN
}
});
cleverapps.styles.TournamentPlayerView = {
width: 150,
height: 110,
scale: [1, 1, 1],
avatar: {
x: {
align: "center"
},
y: {
align: "center",
dy: 10
},
scale: .7
},
amount: {
x: {
align: "center",
dx: 55
},
y: {
align: "bottom",
dy: 3
},
text: {
x: {
align: "center"
},
y: {
align: "center"
}
}
},
name: {
x: {
align: "center"
},
y: {
align: "center",
dy: 3
},
padding: {
x: 17
},
bg: {
width: 100,
height: 40,
x: {
align: "center"
},
y: {
align: "bottom"
}
}
},
delta: {
x: 55,
y: 0
}
};
var TournamentPlayersView = cc.Node.extend({
ctor: function(a) {
this._super();
this.competition = a;
this.players = a.results;
this.competition.calcPlace();
this.views = this.players.map(function(c) {
return new TournamentPlayerView(c,a)
});
var b = cleverapps.styles.TournamentPlayersView;
b = this.layout = new cleverapps.Layout(this.views,{
direction: cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? cleverapps.UI.HORIZONTAL : cleverapps.UI.VERTICAL,
margin: b.margin,
padding: b.padding
});
this.setContentSize2(b.getContentSize());
this.addChild(b);
this.createBg();
this.setAnchorPoint(.5, .5);
this.positions = {};
this.updateSize();
this.setupChildren();
this.setLocalZOrder(1);
a.onChangeResultsListeners.tournamentPlayers = cleverapps.whenGameActiveListener(this.createListener(cleverapps.timeredThrottle(10, this.onChangeResults.bind(this))));
Game.currentGame.on("stop", this.createListener(this.afterOnChangeOutcome.bind(this)), this);
this.competition.onAnimateResults = this.createListener(this.animateResults.bind(this))
},
updateSize: function() {
this.layout.setOptions({
direction: cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? cleverapps.UI.HORIZONTAL : cleverapps.UI.VERTICAL
});
this.setContentSize2(this.layout.getContentSize());
this.bg.setContentSize2(this.getContentSize())
},
setupChildren: function() {
var a = cleverapps.styles.TournamentPlayersView.position;
this.layout.setPositionRound(this.width / 2, this.height / 2);
this.setPositionRound(a);
this.bg.setPositionRound(this.width / 2, this.height / 2);
this.views.forEach(function(b, c) {
this.positions[c] = b.getPosition()
}
.bind(this));
this.onChangeResults()
},
afterOnChangeOutcome: function() {
var a = cleverapps.resolution.getSceneSize().width;
this.runAction((new cc.MoveBy(1,-a / 2 * .025,0)).easing(cc.easeInOut(1.5)))
},
createBg: function() {
var a = this.bg = new cc.Scale9Sprite(bundles.tournament.frames.tournament_bg_png);
this.addChild(a);
a.setLocalZOrder(-1);
a.setContentSize2(this.getContentSize())
},
onChangeResults: function() {
this.competition.calcPlace();
this.views.sort(function(a, b) {
a = this.competition.results.indexOf(a.player);
b = this.competition.results.indexOf(b.player);
return a - b
}
.bind(this));
this.views.forEach(function(a, b) {
a.setLocalZOrder(b + 1);
a.animateReorder(this.positions[b])
}
.bind(this))
},
animateResults: function(a) {
this.views.forEach(function(b) {
b.player.player && b.animateResult(a)
})
},
withinBoardView: function() {
return cleverapps.isRumble()
}
});
cleverapps.styles.TournamentPlayersView = {
position: [{
x: {
align: "center"
},
y: {
align: "top",
dy: -120
}
}, {
x: {
align: "left",
dx: -20
},
y: {
align: "top",
dy: -165
}
}, {
x: {
align: "left",
dx: -20
},
y: {
align: "top",
dy: -165
}
}],
padding: {
x: 15,
y: 20
},
margin: 10
};
var ExpInfoWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = this.generateContent();
this._super({
title: "ExpInfoWindow.Title",
name: "expinfowindow",
content: a
});
Lottery.addText(this);
cleverapps.paymentsLogic.onChangeStatus(this.updateButtons.bind(this), this);
this.updateButtons()
},
updateButtons: function() {
this.list.forEach(function(a) {
connector.payments.isConnected() ? a.button.enable() : a.button.disable()
})
},
generateProductOption: function(a, b) {
var c = cleverapps.styles.ExpInfoWindow
, d = Product.CreateById(a);
a = new cleverapps.UI.Button({
text: d.getCurrentPrice(),
onClicked: function() {
d.buy(function(f) {
f && this.close()
}
.bind(this))
}
.bind(this),
width: c.button.width,
height: c.button.height
});
Lottery.addIcon(a);
var e = new TextWithIcon(d.reward.exp + "%%",{
font: cleverapps.styles.FONTS.EXP_INFO_WINDOW_AMOUNT_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT,
icons: {
"%%": bundles.reward_icons.frames.reward_exp_png
}
});
b = new cc.Sprite(b);
c = new cleverapps.Layout([b, e, a],{
direction: cleverapps.UI.VERTICAL,
margin: c.button.itemsMargin
});
c.button = a;
c.setAnchorPoint(.5, 0);
return c
},
generateContent: function() {
var a = cleverapps.styles.ExpInfoWindow
, b = cleverapps.UI.generateOnlyText("ExpInfoWindow.Message", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
b.setDimensions(a.text.width, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
var c = cleverapps.UI.generateOnlyText("ExpInfoWindow.BuyMessage", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
c.setDimensions(a.text.width, 0);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.list = [this.generateProductOption("buyExp10", bundles.exp_window.frames.small_exp_box), this.generateProductOption("buyExp150", bundles.exp_window.frames.exp_box)];
var d = new cleverapps.Layout(this.list,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.buttonsMargin
});
return new cleverapps.Layout([b, c, d],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
listBundles: function() {
return ["exp_window"]
}
});
cleverapps.styles.ExpInfoWindow = {
margin: 30,
buttonsMargin: 50,
text: {
width: 600
},
exp: {
width: 400,
height: 200
},
button: {
itemsMargin: 3,
width: 300,
height: 100
}
};
var Chat = function() {
this.messages = [];
cleverapps.EventEmitter.call(this);
this.wasUnreadMessages = this.hasUnread = this.closing = this.editingMode = !1;
this.categoryTag = this.activeDialogueId = void 0;
this.loadSave();
cleverapps.timeouts.setInterval(this.checkReload.bind(this), Chat.CHECK_RELOAD_INTERVAL);
this.load()
};
Chat.prototype = Object.create(cleverapps.EventEmitter.prototype);
Chat.prototype.constructor = Chat;
Chat.IsAvailable = function() {
if (cleverapps.config.wysiwygMode)
return !1;
if (cleverapps.chat.hasUnread)
return !0;
if (connector.platform.oneOf(connector.MOBAGE, connector.SP_MOBAGE, connector.GDCOM, connector.COOLMATHGAMES, connector.PLIEGA, connector.YOUTUBE, connector.GAMESNACK))
return !1;
if (0 < cleverapps.paymentsHistory.classify())
return !0;
var a = {};
if ("merge" === cleverapps.config.type) {
var b = connector.platform.oneOf(connector.INSTANT) ? 6 : 9;
if (Game.currentGame && cleverapps.gameLevel.getLevel() < b)
return !1
} else
a.level = 1;
a.registered = "3 days";
return levels.user.checkAvailable(a)
}
;
Chat.prototype.loadSave = function() {
this.processed = (cleverapps.dataLoader.load(DataLoader.TYPES.CHAT) || {}).processed || {}
}
;
Chat.prototype.storeSave = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.CHAT, {
processed: this.processed
})
}
;
Chat.prototype.load = function(a, b) {
// this.lastLoad = Date.now();
// cleverapps.RestClient.get("/chat/messages/" + encodeURIComponent(connector.platform.getUserID()), {}, function(c) {
// this.processMessages(Array.isArray(c) ? c : []);
// MenuControlButton.updateAttention();
// a && a()
// }
// .bind(this), function(c) {
// MenuControlButton.updateAttention();
// b ? b(c) : this.printConnectionError(c)
// }
// .bind(this))
}
;
Chat.prototype.processMessages = function(a) {
a = a.map(ChatMessage.fromData);
this.messages = [];
this.hasUnread = !1;
var b = void 0
, c = void 0
, d = void 0;
a.forEach(function(e) {
d && e.dialogueId !== d && this.messages.push(ChatMessage.createSeparator(d));
d = e.dialogueId;
try {
var f = (new Date(e.postDate)).toLocaleDateString(cleverapps.settings.language || "en-US", {
year: "numeric",
month: "long",
day: "numeric"
})
} catch (g) {
f = (new Date(e.postDate)).toDateString()
}
f !== b && (b = f,
this.messages.push(ChatMessage.createServiceMessage(f)));
if (1 === e.isResponse && 0 === e.readByUser || e.hasGift() && !e.isGiftTaken() && e.isApplicable())
this.wasUnreadMessages = this.hasUnread = !0;
e.hasGift() && this.processed[e.id] && (e.isGiftTaken() ? (delete this.processed[e.id],
this.storeSave()) : cleverapps.RestClient.post("/chat/acceptGift", {
id: e.id
}));
e.isTurningOnConsoleStream() ? (c = !0,
this.messages.push(ChatMessage.createServiceMessage("ChatConsoleStreamSwitchOn", e.id))) : e.isTurningOffConsoleStream() ? (c = !1,
this.messages.push(ChatMessage.createServiceMessage("ChatConsoleStreamSwitchOff", e.id))) : this.messages.push(e)
}
.bind(this));
void 0 !== c && c ? cleverapps.consoleStream.enable(this.postMessage.bind(this, "Disable console stream", "stream_off", !0)) : void 0 === c || c || cleverapps.consoleStream.disable();
a = !1;
0 === this.messages.length ? (this.messages.push(ChatMessage.createServiceMessage("ChatGreetingMessage")),
a = !this.wasUnreadMessages) : this.getLastMessage() && -1 !== ["resolved", "no answer needed"].indexOf(this.getLastMessage().status) ? (this.messages.push(ChatMessage.createSeparator(d)),
a = !this.wasUnreadMessages) : this.activeDialogueId = d;
a && this.messages.push(ChatMessage.createCategoryButtons());
this.closing || (this.trigger("removeMessagesByType", ChatMessage.MESSAGE_TYPE.TEMPORARY),
this.trigger("messagesUpdated"))
}
;
Chat.prototype.postMessage = function(a, b, c) {
// var d = ChatMessage.createTemporaryMessage(a);
// this.messages.push(d);
// c || this.trigger("messagesUpdated");
// var e = cleverapps.user.getPlayerInfo().name;
// e === Messages.get("Friends.You") && (e = Messages.get("LeadersWindow.player"));
// var f = cleverapps.paymentsHistory.classify();
// f <= cleverapps.PaymentsHistory.BRACKET_NONE && cleverapps.paymentsHistory.isPayer() && (f = cleverapps.PaymentsHistory.BRACKET_WEAK);
// var g = cleverapps.user.getHumanReadableNumber();
// cleverapps.user.isPassedAll() && (g = cleverapps.user.getRandomLevel(),
// g = cleverapps.humanReadableNumber(g.episodeNo, g.levelNo));
// cleverapps.RestClient.post("/chat/message", {
// message: a,
// userid: connector.platform.getUserID(),
// isresponse: 0,
// payerlevel: f,
// name: e,
// language: cleverapps.settings.language,
// source: connector.info.source,
// categoryTag: b || this.categoryTag,
// level: g,
// version: cleverapps.config.version
// }, function() {
// this.categoryTag = void 0;
// this.trigger("updatePlaceholder", void 0);
// this.load(function() {
// this.trigger("removeMessagesByType", ChatMessage.MESSAGE_TYPE.CATEGORIES)
// }
// .bind(this))
// }
// .bind(this), function() {
// var h = this.messages.indexOf(d);
// -1 !== h && this.messages.splice(h, 1);
// c || (this.trigger("removeMessagesByType", ChatMessage.MESSAGE_TYPE.TEMPORARY),
// this.trigger("returnMessageBack", a),
// this.printConnectionError())
// }
// .bind(this))
}
;
Chat.prototype.selectCategory = function(a, b) {
this.categoryTag === a ? (this.categoryTag = void 0,
this.trigger("updatePlaceholder", "")) : (this.categoryTag = a,
this.trigger("updatePlaceholder", b));
this.trigger("messagesUpdated")
}
;
Chat.prototype.getLastMessage = function() {
var a = cleverapps.chat.messages.filter(function(b) {
return b.dialogueId && b.status
});
return a[a.length - 1]
}
;
Chat.prototype.markAsRead = function() {
cleverapps.RestClient.post("/chat/markAsRead", {
userid: connector.platform.getUserID()
})
}
;
Chat.prototype.acceptGift = function(a, b) {
if (this.processed[a.id])
this.load();
else {
var c = !1;
if (b) {
if (a.progress)
cleverapps.user.level = parseInt(a.progress.level),
cleverapps.user.episode = parseInt(a.progress.episode),
cleverapps.user.save(),
cleverapps.hose && (cleverapps.hose.reset(),
cleverapps.hose.location = cleverapps.user.episode,
cleverapps.hose.progress = cleverapps.user.level,
cleverapps.hose.save());
else if (a.restoreProgressId)
cleverapps.synchronizer.getProgress(a.restoreProgressId);
else if (a.presents) {
c = !0;
b = cleverapps.clone(a.presents, !0);
delete b.expedition;
cleverapps.chatPresents = {
reward: b,
callback: function() {
cleverapps.chat.processed[a.id] = !0;
cleverapps.chat.storeSave();
cleverapps.RestClient.post("/chat/acceptGift", {
id: a.id
}, function() {
cleverapps.chat.load()
})
}
};
this.closing = !0;
var d = cleverapps.travelBook.getPageById(a.presents.expedition);
d ? cleverapps.focusManager.display({
focus: "closeScene",
action: function(f) {
d.gotoExpedition(f)
}
}) : cleverapps.scenes.getRunningScene().closeAction()
} else if (a.metha)
cleverapps.meta.getMainObject().processChatMessage && cleverapps.meta.getMainObject().processChatMessage(a);
else if (a.harvested) {
var e = new Harvested(Meta.SLOT_MAIN);
Object.keys(a.harvested).forEach(function(f) {
-1 !== UnitsLibrary.getInstance("main").listAvailableByType("fruit").indexOf(f) && (e.add(f, a.harvested[f]),
cleverapps.user.incProgressCompare())
})
}
cleverapps.audio.playSound(bundles.main.urls.shop_buy_effect)
}
c || (this.processed[a.id] = !0,
this.storeSave(),
cleverapps.RestClient.post("/chat/acceptGift", {
id: a.id
}, function() {
cleverapps.chat.load()
}))
}
}
;
Chat.prototype.printConnectionError = function() {
this.messages.push(ChatMessage.createServiceMessage(Messages.get("RestartWindow.AnErrorOccured"), "error_" + Date.now()));
this.trigger("messagesUpdated")
}
;
Chat.prototype.checkReload = function() {
if (Chat.IsAvailable() && cleverapps.environment.hasScene([cleverapps.Environment.SCENE_MAIN, cleverapps.Environment.SCENE_CHAT])) {
var a = cleverapps.environment.isChatScene() ? Chat.CHAT_RELOAD_INTERVAL : Chat.RELOAD_INTERVAL;
this.lastLoad + a > Date.now() || this.load()
}
}
;
Chat.prototype.giveRewards = function() {
var a = "merge" === cleverapps.config.type && cleverapps.chatPresents.reward.unit;
if (a) {
var b = a.amount - Map2d.currentMap.countEmptySlots();
if (0 < b) {
delete cleverapps.chatPresents;
cleverapps.centerHint.createTextHint("Spawn.nospace", {
left: b
});
return
}
if (!this.canAcceptUnit(a)) {
delete cleverapps.chatPresents;
cleverapps.centerHint.createTextHint("RestartWindow.OnError");
return
}
}
cleverapps.focusManager.display({
focus: "chatPresentsWindow",
action: function(c) {
new RewardWindow(cleverapps.chatPresents.reward,{
event: cleverapps.EVENTS.EARN.OTHER
});
cleverapps.focusManager.onceNoWindowsListener = c;
cleverapps.chatPresents.callback();
delete cleverapps.chatPresents
}
})
}
;
Chat.prototype.canAcceptUnit = function(a) {
return cleverapps.travelBook.isExpedition() && !Families[a.code].expeditions.includes("main") ? !0 : cleverapps.unitsLibrary.isOpened(a) || Families[a.code].units[a.stage].climbable || ["landmark"].includes(a.code)
}
;
Chat.CHECK_RELOAD_INTERVAL = cleverapps.parseInterval("30 seconds");
Chat.CHAT_RELOAD_INTERVAL = cleverapps.parseInterval("1 minute");
Chat.RELOAD_INTERVAL = cleverapps.parseInterval("15 minutes");
Chat.CATEGORIES = [{
message: "ChatCategory.ProblemWithPayment",
tag: "payment",
placeholder: "ChatCategory.ProblemWithPaymentPlaceholder"
}, {
message: "ChatCategory.QuestionAboutTheRules",
tag: "FAQ",
placeholder: "ChatCategory.QuestionAboutTheRulesPlaceholder"
}, {
message: "ChatCategory.ReportABag",
tag: "bug",
placeholder: "ChatCategory.ReportABagPlaceholder"
}, {
message: "ChatCategory.AdsProblem",
tag: "no ads",
placeholder: "ChatCategory.AdsProblemPlaceholder"
}, {
message: "ChatCategory.Suggestions",
tag: "suggestion",
placeholder: "ChatCategory.SuggestionsPlaceholder"
}, {
message: "ChatCategory.OtherQuestions",
tag: "other",
placeholder: "ChatCategory.OtherQuestionsPlaceholder"
}];
var ChatMessage = function() {};
ChatMessage.fromData = function(a) {
var b = new ChatMessage;
b.id = a.id;
b.userId = a.userId;
b.postDate = a.postDate;
b.message = a.message;
b.isResponse = a.isResponse;
b.readByUser = a.readByUser;
b.tag = a.tag;
b.status = a.status;
b.dialogueId = a.dialogueId;
b.type = ChatMessage.MESSAGE_TYPE.CHAT;
return b
}
;
ChatMessage.createServiceMessage = function(a, b) {
var c = new ChatMessage;
c.id = b || "service_" + a;
c.message = a;
c.type = ChatMessage.MESSAGE_TYPE.SERVICE;
return c
}
;
ChatMessage.createSeparator = function(a) {
var b = new ChatMessage;
b.id = "separator_" + a;
b.type = ChatMessage.MESSAGE_TYPE.SEPARATOR;
return b
}
;
ChatMessage.createTemporaryMessage = function(a) {
var b = new ChatMessage;
b.id = "tmp_" + a;
b.message = a;
b.type = ChatMessage.MESSAGE_TYPE.TEMPORARY;
b.postDate = (new Date).toString();
return b
}
;
ChatMessage.createCategoryButtons = function() {
var a = new ChatMessage;
a.id = "category_buttons";
a.type = ChatMessage.MESSAGE_TYPE.CATEGORIES;
return a
}
;
ChatMessage.prototype.hasGift = function() {
return "gift" === this.tag || "takengift" === this.tag
}
;
ChatMessage.prototype.isGiftTaken = function() {
return "takengift" === this.tag
}
;
ChatMessage.prototype.isTurningOnConsoleStream = function() {
return "stream_on" === this.tag
}
;
ChatMessage.prototype.isTurningOffConsoleStream = function() {
return "stream_off" === this.tag
}
;
ChatMessage.prototype.isFromActiveOrUnreadDialogue = function() {
if (cleverapps.chat.activeDialogueId === this.dialogueId)
return !0;
var a = (cleverapps.chat.getLastMessage() || {}).dialogueId;
return cleverapps.chat.wasUnreadMessages && this.dialogueId === a
}
;
ChatMessage.prototype.isApplicable = function() {
this.parseGift();
if (this.metha)
if (this.metha.farm) {
var a = parseInt(this.metha.farm.building);
a = cleverapps.farm.buildings[a];
var b = parseInt(this.metha.farm.quest);
if (!a || b >= a.quests.length)
return !1
} else if (this.metha.simple)
return parseInt(cleverapps.meta.currentLocationId) < cleverapps.meta.listAllLocationIds().length;
return this.harvested ? 0 < Object.keys(this.harvested).filter(function(c) {
return -1 !== UnitsLibrary.getInstance("main").listAvailableByType("fruit").indexOf(c)
}).length : this.presents && (this.presents.expedition && (a = cleverapps.travelBook.getPageById(this.presents.expedition),
!a || !a.isActive()) || this.presents.unit && (a = this.presents.unit,
!Families[a.code] || !Families[a.code].units[a.stage])) ? !1 : !0
}
;
ChatMessage.prototype.parseGift = function() {
if (!this.parsed) {
this.parsed = !0;
var a = JSON.parse(this.message);
if (a.presents) {
var b = this.presents = {};
a.expedition && (b.expedition = a.expedition);
a.presents.forEach(function(c) {
if ("object" === typeof c && void 0 !== c.type && void 0 !== c.amount) {
var d = c.type;
"coins" === d ? d = "soft" : "gold" === d ? d = "hard" : "lives2" === d && (d = "lives");
if (-1 !== "hard unlimitedLives stars exp lives soft wands worker unit growthFund noAds".split(" ").indexOf(d) || 0 === d.indexOf("booster") || 0 === d.indexOf("hl")) {
var e = c.amount;
0 === d.indexOf("booster") ? (void 0 === b.boosters && (b.boosters = []),
b.boosters[parseInt(d.replace("booster", ""))] = e) : "unlimitedLives" === d ? b.unlimitedLives = e + " hour" : "worker" === d ? b.worker = e + " hour" : -1 !== d.indexOf("hl") ? (b.herolevels || (b.herolevels = []),
b.herolevels.push([d.replace("hl", ""), c.amount])) : "unit" === d ? b.unit = {
code: c.code,
stage: c.stage,
amount: e || 1
} : b[d] = e
}
}
})
} else
a.progress ? this.progress = a.progress : a.restoreProgressId ? this.restoreProgressId = a.restoreProgressId : a.metha ? this.metha = a.metha : a.harvested && (this.harvested = a.harvested)
}
}
;
ChatMessage.MESSAGE_TYPE = {
CHAT: 0,
SERVICE: 1,
TEMPORARY: 2,
SEPARATOR: 3,
CATEGORIES: 4
};
var CategoriesView = cc.Node.extend({
ctor: function(a) {
this._super();
this.chatMessage = a;
this.setAnchorPoint(0, .5);
this.captionText = cleverapps.UI.generateOnlyText("ChatCategory.Select", cleverapps.styles.FONTS.STRICT_TEXT);
this.captionText.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.addChild(this.captionText);
this.updateSize()
},
updateSize: function() {
var a = cleverapps.styles.CategoriesView
, b = this.createCategoriesRows();
this.setContentSize2(cleverapps.resolution.getSceneSize().width, this.captionText.height + b.length * (a.margin + a.button.height) + a.padding);
this.categoriesLayout && this.categoriesLayout.removeFromParent();
this.categoriesLayout = new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
});
this.categoriesLayout.setPositionRound(a.categories);
this.addChild(this.categoriesLayout);
this.captionText.setDimensions(cleverapps.resolution.getSceneSize().width - a.padding, 0);
this.captionText.setPositionRound(a.caption)
},
createCategoriesRows: function() {
for (var a = cleverapps.styles.CategoriesView, b = function(g) {
cleverapps.chat.selectCategory(g.tag, Messages.get(g.placeholder))
}, c = Chat.CATEGORIES.map(function(g) {
var h = new cleverapps.UI.Button({
text: g.message,
type: cleverapps.styles.UI.Button.Images.chat_categories,
onClicked: b.bind(this, g),
textVariant: "strict_black",
height: a.button.height
});
h.setBright(g.tag !== cleverapps.chat.categoryTag);
if (g.tag === cleverapps.chat.categoryTag) {
var k = new cc.Sprite(bundles.chat.frames.active_category_close);
k.setPositionRound(a.closeButton);
cleverapps.UI.applyHover(k);
cleverapps.UI.onClick(k, b.bind(this, g));
h.addChild(k)
}
return h
}), d = [], e = [], f = 0; f < c.length; f++)
e.reduce(function(g, h) {
return g + h.width
}, 0) + c[f].width > .8 * cleverapps.resolution.getSceneSize().width && (d.push(e),
e = []),
e.push(c[f]);
d.push(e);
return d.map(function(g) {
return new cleverapps.Layout(g,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
})
}
});
cleverapps.styles.CategoriesView = {
padding: 50,
margin: 14,
caption: {
x: {
align: "center"
},
y: {
align: "top",
dy: -20
}
},
categories: {
x: {
align: "center"
},
y: {
align: "top",
dy: -70
}
},
button: {
height: 80
},
closeButton: {
x: {
align: "right",
dx: 6
},
y: {
align: "top",
dy: 6
}
}
};
var ChatMessageView = cc.Node.extend({
ctor: function(a) {
this._super();
this.chatMessage = a;
this.setAnchorPoint(0, .5);
a = (new Date(a.postDate)).toLocaleTimeString(cleverapps.settings.language, {
hour12: !1,
hour: "2-digit",
minute: "2-digit"
});
a = this.messageTimeText = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.CHAT_MESSAGE_TIME_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_RIGHT);
var b = this.bg = cleverapps.UI.createScale9Sprite(this.chatMessage.isResponse ? bundles.chat.frames.dialog_box_white : bundles.chat.frames.dialog_box_green);
this.addChild(b, -1);
this.content = this.createContent(this.chatMessage);
b.addChild(this.content);
b.addChild(a);
this.chatMessage.isResponse || (this.mark = this.chatMessage.readByUser ? new cc.Sprite(bundles.chat.frames.checkmark_read) : this.chatMessage.type === ChatMessage.MESSAGE_TYPE.TEMPORARY ? new cc.Sprite(bundles.chat.frames.checkmark_tmp) : new cc.Sprite(bundles.chat.frames.checkmark_sent),
b.addChild(this.mark));
this.updateSize()
},
createContent: function(a) {
if (a.hasGift())
return new GiftContentView(a);
this.chatMessage.isFromActiveOrUnreadDialogue() ? (this.messageText = cleverapps.UI.generateOnlyText(a.message, cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT),
this.bg.setColor(new cc.Color(255,255,255,255)),
this.bg.setOpacity(255)) : (this.messageText = cleverapps.UI.generateOnlyText(a.message, cleverapps.styles.FONTS.CHAT_DISABLED_MESSAGE_TEXT),
this.bg.setColor(new cc.Color(200,200,200,255)),
this.bg.setOpacity(150));
this.messageText.setHorizontalAlignment(cc.TEXT_ALIGNMENT_LEFT);
return this.messageText
},
updateContent: function(a) {
this.content && this.content.removeFromParent();
this.content = this.createContent(a);
this.bg.addChild(this.content);
this.updateSize()
},
updateSize: function() {
var a = cleverapps.styles.ChatMessageView
, b = .7 * cleverapps.resolution.getSceneSize().width;
b > a.maxWidth ? b = a.maxWidth : b < a.minWidth && (b = a.minWidth);
this.messageText ? (this.messageText.setDimensions(b, 0),
this.setContentSize2(cleverapps.resolution.getSceneSize().width, this.messageText.height + 2 * a.text.padding)) : this.setContentSize2(cleverapps.resolution.getSceneSize().width, this.content.height + 2 * a.text.padding);
this.bg.setContentSize(b + 2 * a.text.padding, this.height);
this.chatMessage.isResponse ? (this.bg.setAnchorPoint(0, .5),
this.bg.setPosition("horizontal" !== cleverapps.config.orientation ? a.responseBg.verticalOffsetX : a.responseBg.offsetX, this.height / 2)) : this.bg.setPositionRound(a.questionBg);
this.content.setPositionRound(this.bg.width / 2 + (this.chatMessage.isResponse ? a.text.responceOffsetX : 0), this.bg.height / 2 + a.text.offsetY);
this.messageTimeText.setDimensions(a.time.width, a.time.height);
this.messageTimeText.setPositionRound(this.chatMessage.isResponse ? a.time.response : a.time.question);
this.mark && this.mark.setPositionRound(a.mark)
}
});
cleverapps.styles.ChatMessageView = {
minWidth: 500,
maxWidth: 900,
text: {
padding: 30,
responceOffsetX: 5,
offsetY: 2
},
time: {
width: 200,
height: 26,
response: {
x: {
align: "right",
dx: -34
},
y: {
align: "bottom",
dy: 16
}
},
question: {
x: {
align: "right",
dx: -56
},
y: {
align: "bottom",
dy: 16
}
}
},
mark: {
x: {
align: "right",
dx: -22
},
y: {
align: "bottom",
dy: 18
}
},
responseBg: {
offsetX: 32,
verticalOffsetX: 4
},
questionBg: {
x: {
align: "right",
dx: -30
},
y: {
align: "center"
}
}
};
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CHAT_MESSAGE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.BLACK,
font: bundles.chat.urls.strict_font_ttf
},
CHAT_DISABLED_MESSAGE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_DARK_GRAY,
font: bundles.chat.urls.strict_font_ttf
},
CHAT_MESSAGE_TIME_TEXT: {
size: 26,
color: new cc.Color(138,138,138,255),
font: bundles.chat.urls.strict_font_ttf
}
});
var GiftContentView = cleverapps.Layout.extend({
ctor: function(a) {
this.chatMessage = a;
a = cleverapps.styles.GiftContentView;
this.chatMessage.parseGift();
var b = Math.min(.6 * cleverapps.resolution.getSceneSize().width, a.width)
, c = []
, d = cleverapps.UI.createScale9Sprite(bundles.chat.frames.gift_bg)
, e = new cc.Sprite(bundles.chat.frames.checkmark_gift)
, f = this.chatMessage.isGiftTaken() ? e.height : 0
, g = !1;
this.chatMessage.presents && this.chatMessage.presents.expedition && (g = cleverapps.travelBook.getPageById(this.chatMessage.presents.expedition),
g = !g || !g.isActive());
var h = !1;
this.chatMessage.presents && this.chatMessage.presents.unit && (h = this.chatMessage.presents.unit,
h = !(Families[h.code] && Families[h.code].units[h.stage]));
if (this.chatMessage.progress || this.chatMessage.metha || this.chatMessage.restoreProgressId || g || h) {
if (this.chatMessage.metha)
if (this.chatMessage.metha.simple) {
var k = parseInt(this.chatMessage.metha.simple.current);
k = k < cleverapps.meta.listAllLocationIds().length ? cleverapps.UI.generateOnlyText("AdminSetMethaProgress.Text", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT, {
bgIndex: k
}) : cleverapps.UI.generateOnlyText("AdminSetMethaProgress.Text.Unavailable", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT)
} else
this.chatMessage.metha.farm ? (h = parseInt(this.chatMessage.metha.farm.building),
k = cleverapps.farm.buildings[h],
g = parseInt(this.chatMessage.metha.farm.quest),
k && g < k.quests.length ? (h = Messages.get("building." + cleverapps.farm.buildings[h].name),
k = Messages.get(0 < g ? "AdminSetFarmProgress.Text.Quest" : "AdminSetFarmProgress.Text", {
buildingName: h,
questName: Messages.get(k.quests[g].title)
}),
k = cleverapps.UI.generateOnlyText(k, cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT)) : k = cleverapps.UI.generateOnlyText("AdminSetFarmProgress.Text.Unavailable", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT)) : this.chatMessage.metha.home && (k = parseInt(this.chatMessage.metha.home.furniture),
k = cleverapps.meta.getMainObject().furniture[k],
g = parseInt(this.chatMessage.metha.home.stage),
k && g < k.stages.length ? (h = Messages.get("building." + k.name),
k = Messages.get(0 < g ? "AdminSetHomeProgress.Text.Stage" : "AdminSetHomeProgress.Text", {
furnitureName: h,
stageName: Messages.get(k.stages[g].title)
}),
k = cleverapps.UI.generateOnlyText(k, cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT)) : k = cleverapps.UI.generateOnlyText("AdminSetHomeProgress.Text.Unavailable", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT));
else
this.chatMessage.restoreProgressId ? k = cleverapps.UI.generateOnlyText("AdminRestoreProgress.Text", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT, {
userId: this.chatMessage.restoreProgressId
}) : g ? k = cleverapps.UI.generateOnlyText("ItemsFromCompletedExpedition", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT) : h ? k = cleverapps.UI.generateOnlyText("IsUnknownUnitGift", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT) : (k = cleverapps.humanReadableNumber(parseInt(this.chatMessage.progress.episode), parseInt(this.chatMessage.progress.level)),
k = cleverapps.UI.generateOnlyText("AdminSetProgress.Text", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT, {
levelNo: k
}));
k.setDimensions(b, 0);
k.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setContentSize(b + a.bg.padding, Math.max(a.minHeight, k.height + a.bg.padding + f));
d.addChild(k);
k.setPositionRound(d.width / 2, d.height / 2 + f / 2);
c.push(d)
} else if (this.chatMessage.presents || this.chatMessage.harvested)
g = this.chatMessage.presents && this.chatMessage.presents.herolevels && 0 < this.chatMessage.presents.herolevels.length,
k = cleverapps.UI.generateOnlyText(g ? "AdminGiftsHeroes" : "AdminGiftsText", cleverapps.styles.FONTS.CHAT_MESSAGE_TEXT),
k.setDimensions(b, 0),
k.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
c.push(k),
k = cleverapps.clone(this.chatMessage.presents, !0),
this.chatMessage.harvested && (k = {
unit: Object.keys(this.chatMessage.harvested).map(function(l) {
return {
code: l,
amount: this.chatMessage.harvested[l],
stage: 4
}
}
.bind(this))
}),
delete k.expedition,
k = new RewardsListComponent(k,{
columns: g ? 3 : 2,
font: cleverapps.styles.FONTS.CHAT_REWARD_COUNT_TEXT,
textDirection: cleverapps.UI.HORIZONTAL,
iconWrap: a.prizeIcon,
unitViewDummy: !0
}),
d.setContentSize(b + a.bg.padding, Math.max(a.minHeight, k.height + f + a.bg.padding)),
d.addChild(k),
k.setPositionRound(d.width / 2, d.height / 2 + f / 2),
c.push(d);
if (this.chatMessage.isGiftTaken())
e.setPositionRound(a.checkmark),
d.addChild(e);
else if (this.chatMessage.isApplicable()) {
if (void 0 !== this.chatMessage.progress || void 0 !== this.chatMessage.metha)
var m = new cleverapps.UI.Button({
text: "No",
type: cleverapps.styles.UI.Button.Images.chat,
onClicked: function() {
cleverapps.chat.acceptGift(this.chatMessage, !1)
}
.bind(this),
textVariant: "strict_black",
width: a.buttons.width,
height: a.buttons.height
});
b = new cleverapps.UI.Button({
text: void 0 !== this.chatMessage.progress ? "Yes" : "Accept",
type: cleverapps.styles.UI.Button.Images.chat,
onClicked: function() {
cleverapps.chat.acceptGift(this.chatMessage, !0)
}
.bind(this),
textVariant: "strict_black",
width: a.buttons.width,
height: a.buttons.height
});
c.push(new cleverapps.Layout([m, b],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
}))
}
this._super(c, {
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
}
});
cleverapps.styles.GiftContentView = {
width: 840,
minHeight: 220,
margin: 10,
padding: {
x: 10,
y: 10
},
prizeIcon: {
height: 130
},
buttons: {
width: 200,
height: 60
},
checkmark: {
x: {
align: "right",
dx: -6
},
y: {
align: "bottom",
dy: 10
}
},
bg: {
padding: 20
}
};
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CHAT_REWARD_COUNT_TEXT: {
size: 56,
color: cleverapps.styles.COLORS.COLOR_BROWN,
font: bundles.chat.urls.strict_font_ttf,
name: "nostroke"
}
});
var MessageSeparatorView = cc.Node.extend({
ctor: function(a) {
this._super();
this.chatMessage = a;
this.setAnchorPoint(0, .5);
this.line = cleverapps.UI.createScale9Sprite(bundles.chat.frames.dialogue_separator);
this.addChild(this.line);
this.updateSize()
},
updateSize: function() {
var a = cleverapps.styles.MessageSeparatorView;
this.setContentSize2(cleverapps.resolution.getSceneSize().width, a.height);
this.line.setContentSize(cleverapps.resolution.getSceneSize().width - 2 * a.line.padding, a.line.height);
this.line.setPositionRound(this.width / 2, this.height / 2)
}
});
cleverapps.styles.MessageSeparatorView = {
height: 50,
line: {
height: 3,
padding: 40
}
};
var MessageViewFactory = {
create: function(a) {
switch (a.type) {
case ChatMessage.MESSAGE_TYPE.SERVICE:
return new ServiceMessageView(a);
case ChatMessage.MESSAGE_TYPE.SEPARATOR:
return new MessageSeparatorView(a);
case ChatMessage.MESSAGE_TYPE.CATEGORIES:
return new CategoriesView(a);
default:
return new ChatMessageView(a)
}
}
};
var ServiceMessageView = cc.Node.extend({
ctor: function(a) {
this._super();
this.chatMessage = a;
this.setAnchorPoint(0, .5);
this.messageText = cleverapps.UI.generateOnlyText(a.message, cleverapps.styles.FONTS.SERVICE_MESSAGE_TEXT);
this.messageText.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.addChild(this.messageText);
this.updateSize()
},
updateSize: function() {
this.messageText.setDimensions(cleverapps.resolution.getSceneSize().width - cleverapps.styles.ServiceMessageView.padding, 0);
this.setContentSize2(cleverapps.resolution.getSceneSize().width, this.messageText.height + cleverapps.styles.ServiceMessageView.padding);
this.messageText.setPositionRound(this.width / 2, this.height / 2)
}
});
cleverapps.styles.ServiceMessageView = {
padding: 50
};
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
SERVICE_MESSAGE_TEXT: {
size: 30,
color: new cc.Color(83,97,106,255),
font: bundles.chat.urls.strict_font_ttf
}
});
var ChatHeader = cc.Scale9Sprite.extend({
ctor: function(a) {
this._super(bundles.chat.frames.panelup);
this.setAnchorPoint(0, 1);
var b = cleverapps.styles.ChatHeader
, c = cleverapps.UI.generateOnlyText(Messages.get("ChatTitle"), cleverapps.styles.FONTS.CHAT_HEADER_TEXT);
a.closing = !1;
var d = this.backButton = new cleverapps.UI.Button({
noBg: !0,
content: new cc.Sprite(bundles.chat.frames.icon_back),
onClicked: function() {
a.closing = !0;
setTimeout(function() {
cleverapps.scenes.getRunningScene().closeAction()
}, connector.info.isMobile && a.editingMode ? 500 : 100)
},
width: b.back.width,
height: b.back.height
});
c.setPosition(0, b.text.offsetY);
this.content = new cleverapps.Layout([d, c],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.back.margin
});
this.addChild(this.content);
this.updateSize()
},
updateSize: function() {
var a = cleverapps.styles.ChatHeader;
this.setContentSize2(cleverapps.resolution.getSceneSize().width, a.height);
this.setPosition(0, cleverapps.resolution.getSceneSize().height);
this.content.setPositionRound(this.width / 2 + a.content.offsetX, this.height / 2);
cleverapps.UI.fitToBox(this.content, {
width: .8 * cleverapps.resolution.getSceneSize().width,
height: a.height
});
this.backButton.setScale(1 / this.content.scale)
}
});
cleverapps.styles.ChatHeader = {
height: 130,
content: {
offsetX: -50
},
text: {
offsetY: -3
},
back: {
width: 120,
height: 120,
margin: 25
}
};
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CHAT_HEADER_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.BLACK
}
});
var ChatInput = cc.Scale9Sprite.extend({
ctor: function(a) {
this._super(bundles.chat.frames.paneldown);
var b = cleverapps.styles.ChatInput;
this.chat = a;
this.inputHeight = b.height;
this.setAnchorPoint(0, 0);
a = this.sendButton = new cleverapps.UI.Button({
noBg: !0,
text: "``",
textOff: "~~",
icons: {
"``": bundles.chat.frames.panel_on,
"~~": bundles.chat.frames.panel_off
},
onClicked: this.send.bind(this),
width: b.sendButton.width,
height: this.inputHeight,
fitTo: !1
});
a.disable();
this.addChild(a);
this.charsCountText = cleverapps.UI.generateOnlyText("0/500", cleverapps.styles.FONTS.CHAT_CHARS_COUNT_TEXT);
this.charsCountText.setVisible(!1);
this.charsCountText.setDimensions(b.charsCount.width, 0);
this.charsCountText.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.addChild(this.charsCountText);
a = this.textAreaBg = cleverapps.UI.createScale9Sprite(bundles.chat.frames.textbox);
this.addChild(a);
b = this.text = new cc.EditBox(cc.size(a.width - b.textPadding.x, a.height - b.textPadding.y));
b.setDelegate(this);
b.stayOnTop(!0);
b.setTouchEnabled();
b.setMaxLength(500);
b.setFontColor(cleverapps.styles.FONTS.CHAT_INPUT_FIELD_TEXT.color);
this.textAreaBg.addChild(this.text);
this.updateSize();
this.chat.on("returnMessageBack", this.returnMessageBack.bind(this), this);
this.chat.on("updatePlaceholder", this.updatePlaceholder.bind(this), this)
},
updateSize: function() {
var a = cleverapps.styles.ChatInput;
this.setContentSize2(cleverapps.resolution.getSceneSize().width, this.inputHeight + a.padding);
this.setPosition(0, 0);
this.textAreaBg.setContentSize(this.width - a.textArea.rightMargin, this.inputHeight);
this.textAreaBg.setPositionRound(a.textArea);
this.sendButton.setContentSize(a.sendButton.width, this.inputHeight);
this.sendButton.setPositionRound(a.sendButton);
this.text.setContentSize(this.textAreaBg.width - a.textPadding.x, this.textAreaBg.height - a.textPadding.y);
this.text.setPositionRound(this.textAreaBg.width / 2, this.textAreaBg.height / 2);
this.charsCountText.setPositionRound(a.charsCount)
},
send: function() {
var a = this.getMessageText();
0 < a.length && (this.text.setString(""),
this.sendButton.disable(),
this.charsCountText.setVisible(!1),
this.chat.postMessage(a))
},
returnMessageBack: function(a) {
this.text.setString(a);
this.editBoxTextChanged(this.text, a)
},
updatePlaceholder: function(a) {
this.placeholderText = a;
0 < this.getMessageText().length || !a || (this.text.setString(a),
this.text.setFont("Rubik", cleverapps.styles.FONTS.CHAT_INPUT_FIELD_TEXT.size),
this.text.setFontColor(cleverapps.styles.FONTS.CHAT_INPUT_FIELD_TEXT.placeholderColor),
this.placeholderShown = !0)
},
editBoxTextChanged: function(a, b) {
0 < this.getMessageText(b).length ? this.sendButton.enable() : this.sendButton.disable();
this.text.setFont("Rubik", cleverapps.styles.FONTS.CHAT_INPUT_FIELD_TEXT.size);
this.text.setFontColor(cleverapps.styles.FONTS.CHAT_INPUT_FIELD_TEXT.color);
400 <= this.text.getString().length ? (this.charsCountText.setVisible(!0),
this.charsCountText.setString(this.text.getString().length + "/500"),
this.charsCountText.setFont(450 <= this.text.getString().length ? cleverapps.styles.FONTS.CHAT_CHARS_COUNT_RED_TEXT : cleverapps.styles.FONTS.CHAT_CHARS_COUNT_TEXT)) : this.charsCountText.setVisible(!1)
},
editBoxReturn: function() {
setTimeout(this.send.bind(this), 0)
},
getMessageText: function(a) {
if (this.placeholderShown)
return "";
a = a || this.text.getString();
return a.trim().replace(/(?:\r\n|\r|\n)/g, "").replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g, "\ufffd")
},
editBoxEditingDidBegin: function() {
this.chat.editingMode = !0;
this.placeholderShown && (this.text.setString(""),
this.placeholderShown = !1)
},
editBoxEditingDidEnd: function() {
this.chat.editingMode = !1;
this.placeholderText && this.updatePlaceholder(this.placeholderText)
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CHAT_INPUT_FIELD_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.BLACK,
placeholderColor: cleverapps.styles.COLORS.COLOR_DARK_GRAY,
font: bundles.chat.urls.strict_font_ttf
},
CHAT_CHARS_COUNT_TEXT: {
size: 22,
color: cleverapps.styles.COLORS.COLOR_VERY_DARK_GRAY,
font: bundles.chat.urls.strict_font_ttf
},
CHAT_CHARS_COUNT_RED_TEXT: {
size: 22,
color: new cc.Color(243,60,60,255),
font: bundles.chat.urls.strict_font_ttf
}
});
cleverapps.styles.ChatInput = {
height: 150,
padding: 22,
sendButton: {
x: {
align: "right",
dx: -15
},
y: {
align: "center"
},
width: 150
},
charsCount: {
x: {
align: "right",
dx: -40
},
y: {
align: "bottom",
dy: 10
},
width: 100
},
textArea: {
rightMargin: 230,
x: {
align: "left",
dx: 50
},
y: {
align: "center",
dy: -6
}
},
textPadding: {
x: 40,
y: 12
}
};
var ChatScene = cleverapps.FixedWidthScene.extend({
ctor: function(a) {
this._super();
this.chat = a
},
onSceneLoaded: function() {
this._super(cleverapps.Environment.SCENE_CHAT);
var a = new ChatHeader(this.chat);
this.addChild(a);
a = new ChatView(this.chat);
this.addChild(a);
a = new ChatInput(this.chat);
this.addChild(a);
cleverapps.placements.run(Placements.INTERMEDIATE);
this.chat.hasUnread && this.chat.markAsRead()
},
getBackgroundStyles: function() {
return {
bundle: "chat",
patternId: "window_bg"
}
},
listBundles: function() {
var a = ["chat"];
"merge" === cleverapps.config.type && a.push("episode_0");
return a
}
});
var ChatView = cc.Node.extend({
ctor: function(a) {
this.chat = a;
this.messageViews = {};
this._super();
this.setAnchorPoint(.5, .5);
a = this.container = new cc.Node;
a.setAnchorPoint(.5, .5);
this.scroll = new cleverapps.UI.ScrollView(a);
this.scroll.setAnchorPoint(0, 0);
this.scroll.setPositionRound(0, 0);
this.addChild(this.scroll);
this.updateSize();
this.chat.on("messagesUpdated", this.updateMessages.bind(this), this);
this.chat.on("removeMessagesByType", this.removeMessagesByType.bind(this), this)
},
updateMessages: function() {
this.chat.messages.forEach(function(b) {
if (this.messageViews[b.id])
b.tag !== this.messageViews[b.id].chatMessage.tag ? this.messageViews[b.id].updateContent(b) : b.type === ChatMessage.MESSAGE_TYPE.CATEGORIES && this.messageViews[b.id].updateSize();
else {
var c = MessageViewFactory.create(b);
this.container.addChild(c);
this.messageViews[b.id] = c
}
}
.bind(this));
var a = cleverapps.UI.arrangeWithMargins(this.container.getChildren(), {
margin: cleverapps.styles.ChatView.margin,
direction: cleverapps.UI.VERTICAL
});
a < this.scroll.height && (a = this.scroll.height);
this.container.setContentSize2(cleverapps.resolution.getSceneSize().width, a);
this.scroll.updateInnerContent();
this.scroll.scrollToPercent(0)
},
removeMessagesByType: function(a) {
Object.keys(this.messageViews).forEach(function(b) {
this.messageViews[b] && this.messageViews[b].chatMessage && this.messageViews[b].chatMessage.type === a && (this.messageViews[b].removeFromParent(),
this.messageViews[b] = void 0)
}
.bind(this));
this.updateMessages()
},
updateSize: function() {
var a = cleverapps.styles.ChatView
, b = cleverapps.styles.ChatInput.height;
b = cleverapps.resolution.getSceneSize().height - cleverapps.styles.ChatHeader.height - b - a.extraHeight;
this.scroll.setContentSize2(cleverapps.resolution.getSceneSize().width, b);
this.setContentSize2(this.scroll.getContentSize());
this.setPositionRound(a);
this.chat.messages.forEach(function(c) {
this.messageViews[c.id] && this.messageViews[c.id].updateSize()
}
.bind(this));
this.updateMessages()
}
});
cleverapps.styles.ChatView = {
x: {
align: "center"
},
y: {
align: "top",
dy: -128
},
margin: 4,
scrollBarPosition: {
x: 4,
y: 14
},
extraHeight: 8
};
var Aims = function() {
this.targets = {};
this.timeouts = {}
};
Aims.prototype.clear = function() {
for (var a in this.targets)
this.targets[a].forEach(this.clearHideTimeout.bind(this)),
this.targets[a] = [];
this.onceAllHiddenCallback = void 0
}
;
Aims.prototype.registerTarget = function(a, b, c) {
c = Object.assign({}, c);
(a = cleverapps.toArray(a)) && a.length ? b ? b.aim ? cleverapps.throwAsync("target already registered as an aim") : (c.types = a,
c.priority = c.priority || 0,
b.aim = c,
a.forEach(function(d) {
this.targets[d] || (this.targets[d] = []);
d = this.targets[d];
d.push(b);
for (var e = d.length - 1; 0 < e && b.aim.priority < d[e - 1].aim.priority; --e) {
var f = d[e - 1];
d[e - 1] = d[e];
d[e] = f
}
}
.bind(this)),
b.addCleaner(this.removeTarget.bind(this, b))) : cleverapps.throwAsync("no target specified for aim") : cleverapps.throwAsync("no type specified for aim")
}
;
Aims.prototype.removeTarget = function(a) {
a.aim && (a.aim.types.forEach(function(b) {
var c = this.targets[b].indexOf(a);
-1 !== c && this.targets[b].splice(c, 1)
}
.bind(this)),
this.clearHideTimeout(a),
a.aim = void 0)
}
;
Aims.prototype.clearHideTimeout = function(a) {
var b = this.timeouts[a.__instanceId];
b && (cleverapps.timeouts.clearTimeout(b),
delete this.timeouts[a.__instanceId])
}
;
Aims.prototype.getTarget = function(a, b) {
if (a instanceof cc.Node)
return a;
b = b || {};
a = cleverapps.toArray(a) || [];
b.noDefault || a.push("default");
for (b = 0; b < a.length; ++b) {
var c = this.targets[a[b]];
if (c && (c = this.chooseTarget(c)))
return c
}
}
;
Aims.prototype.chooseTarget = function(a) {
for (var b = a.length - 1; 0 <= b; --b) {
var c = a[b]
, d = c.aim;
if (d && (!d.filter || d.filter()) && (cleverapps.UI.isNodeOnScene(c, .3, .3) || d.treasureBag || d.toggle || d.controls || d.scrollsToTarget && d.scrollsToTarget()))
return c
}
}
;
Aims.prototype.showTarget = function(a, b) {
b = b || {};
if (a && a.aim) {
var c = !0;
a.aim.toggle ? (c = !1,
a.aim.toggle(!0, !1)) : a.aim.controls && (c = !1,
cleverapps.focusManager.showControlsTemporary(a.aim.controls));
this.timeouts[a.__instanceId] && (c = !1,
this.clearHideTimeout(a));
c || (this.timeouts[a.__instanceId] = cleverapps.timeouts.setTimeout(this.hideTarget.bind(this, a), b.duration || Aims.SHOW_DURATION))
}
}
;
Aims.prototype.hideTarget = function(a) {
this.clearHideTimeout(a);
this.onceAllHidden();
a.aim && (a.aim.toggle ? a.aim.toggle(!1, !1) : a.aim.controls && cleverapps.focusManager.hideControlsTemporary(a.aim.controls))
}
;
Aims.prototype.hasShownTargets = function() {
return !!Object.keys(this.timeouts).length
}
;
Aims.prototype.whenAllHidden = function(a) {
this.onceAllHiddenCallback = a;
this.onceAllHidden()
}
;
Aims.prototype.onceAllHidden = function() {
this.onceAllHiddenCallback && !this.hasShownTargets() && (cleverapps.timeouts.setTimeout(this.onceAllHiddenCallback, Aims.HIDE_ANIMATION_DURATION),
this.onceAllHiddenCallback = void 0)
}
;
Aims.SHOW_DURATION = 1600;
Aims.HIDE_ANIMATION_DURATION = 200;
var Toolbar = function() {
this.items = [];
this.freezed = !1;
this.onUpdateItemsListener = function() {}
;
this.onAddItemListener = function() {}
;
this.onEnableListener = function() {}
;
this.onGetView = function() {}
;
"merge" === cleverapps.config.type ? ("undefined" !== typeof OrdersToolbarItem && this.addItem(new OrdersToolbarItem),
"undefined" !== typeof UnitsLibraryToolbarItem && this.addItem(new UnitsLibraryToolbarItem),
"undefined" !== typeof UnitShopToolbarItem && this.addItem(new UnitShopToolbarItem),
"undefined" !== typeof TravelBookToolbarItem && this.addItem(new TravelBookToolbarItem),
this.addItem(new DailyTasksToolbarItem),
"undefined" !== typeof ClansToolbarItem && this.addItem(new ClansToolbarItem),
"undefined" !== typeof MagnetToolbarItem && this.addItem(new MagnetToolbarItem),
"undefined" !== typeof DynamiteToolbarItem && this.addItem(new DynamiteToolbarItem)) : "battlefield" === cleverapps.config.type ? "undefined" !== typeof ArmyLibraryToolbarItem && this.addItem(new ArmyLibraryToolbarItem) : ["match3", "differences", "solitaire", "board", "tile3"].includes(cleverapps.config.type) ? (this.addItem(new FriendRequestsToolbarItem),
"undefined" !== typeof MiniGameToolbarItem && this.addItem(new MiniGameToolbarItem),
cleverapps.dailyTasks && this.addItem(new DailyTasksToolbarItem),
this.addItem(new LeaderBoardToolbarItem),
this.addItem(new RewardedVideoToolbarItem)) : ["blocks"].includes(cleverapps.config.type) && ("undefined" !== typeof MiniGameToolbarItem && this.addItem(new MiniGameToolbarItem),
this.addItem(new RewardedVideoToolbarItem),
this.addItem(new LeaderBoardToolbarItem),
this.addItem(new FriendRequestsToolbarItem),
cleverapps.dailyTasks && this.addItem(new DailyTasksToolbarItem));
cleverapps.config.debugMode && cleverapps.config.meta === Meta.HOMEFIX && "undefined" !== typeof TravelMapToolbarItem && this.addItem(new TravelMapToolbarItem);
"undefined" !== typeof StickersBookToolbarItem && this.addItem(new StickersBookToolbarItem)
};
Toolbar.prototype.getSceneItems = function() {
return this.items.filter(function(a) {
return a.isAvailableOnScene()
})
}
;
Toolbar.prototype.anyItemWithForce = function() {
for (var a = 0; a < this.items.length; a++) {
var b = this.items[a].getForce();
if (b && this.items[a].isVisible() && !cleverapps.forces.isShown(b.id))
return this.items[a]
}
}
;
Toolbar.prototype.showAnyForce = function() {
var a = this.anyItemWithForce();
cleverapps.focusManager.display({
focus: "toolbarItemForce",
control: "toolbar",
actions: [function(b) {
this.updateItems();
cleverapps.timeouts.setTimeout(b, 500)
}
.bind(this), function(b) {
cleverapps.focusManager.showControlsWhileFocused("toolbar");
a.showForce();
cleverapps.forces.onceForceClosed = b
}
]
})
}
;
Toolbar.prototype.addItem = function(a) {
if (void 0 === this.getItem(a.type)) {
this.items.push({});
for (var b = this.items.length - 1; 0 < b && this.items[b - 1].type > a.type; )
this.items[b] = this.items[b - 1],
b--;
this.items[b] = a;
this.onAddItemListener(a, b)
}
}
;
Toolbar.prototype.hasVisibleItems = function() {
return 0 < this.items.filter(function(a) {
return a.isVisible()
}).length
}
;
Toolbar.prototype.resetByType = function(a) {
if (a = this.getItem(a.type))
a.resetState(),
this.updateItems()
}
;
Toolbar.prototype.resetItemsState = function() {
this.items.forEach(function(a) {
a.resetState && a.resetState()
})
}
;
Toolbar.prototype.getItem = function(a) {
for (var b = 0; b < this.items.length; ++b)
if (this.items[b].type === a)
return this.items[b]
}
;
Toolbar.prototype.updateItems = function(a) {
if (!this.freezed)
this.onUpdateItemsListener(a)
}
;
Toolbar.prototype.freezeUpdates = function() {
this.freezed = !0
}
;
Toolbar.prototype.unfreezeUpdates = function() {
this.freezed = !1;
this.updateItems()
}
;
Toolbar.prototype.setDragItem = function(a) {
this.dragged !== a && (this.dragged && this.dragged.freeFocus(),
(this.dragged = a) && cleverapps.focusManager.display({
focus: "toolbarItemDrag",
control: a.dragControls,
action: function(b) {
a.freeFocus = b
}
}))
}
;
var ToolbarItem = function(a) {
Object.assign(this, a);
this.marked = this.enabled = !1;
this.onChangeStateListener = function() {}
;
this.showForce = function() {}
;
this.onFingerOnListener = function() {}
;
this.onFingerOffListener = function() {}
;
this.onGetView = function() {}
};
ToolbarItem.prototype.getText = function() {}
;
ToolbarItem.prototype.getPrice = function() {}
;
ToolbarItem.prototype.setFinger = function(a, b) {
a = !!a;
if (this.finger !== a)
if (this.finger = a)
clearTimeout(this.fingerTimeout),
this.onFingerOnListener(),
b && (this.fingerTimeout = setTimeout(function() {
this.setFinger(!1)
}
.bind(this), b));
else
this.onFingerOffListener()
}
;
ToolbarItem.prototype.isVisible = function() {
return this.enabled
}
;
ToolbarItem.prototype.onClick = function() {
this.unmark()
}
;
ToolbarItem.prototype.isAvailableOnScene = function() {
return !0
}
;
ToolbarItem.prototype.enable = function() {
this.enabled || (this.enabled = !0,
this.onChangeStateListener(),
cleverapps.toolbar && cleverapps.toolbar.updateItems())
}
;
ToolbarItem.prototype.disable = function() {
this.enabled && (this.unmark(),
this.enabled = !1,
this.onChangeStateListener(),
cleverapps.toolbar && cleverapps.toolbar.updateItems())
}
;
ToolbarItem.prototype.mark = function() {
this.marked || (this.marked = !0,
this.onChangeStateListener())
}
;
ToolbarItem.prototype.unmark = function() {
this.marked && (this.marked = !1,
this.onChangeStateListener())
}
;
ToolbarItem.prototype.getForce = function() {
return this.force
}
;
ToolbarItem.prototype.getTargetTypes = function() {
return this.targets
}
;
ToolbarItem.prototype.onFollowPointer = function() {}
;
ToolbarItem.prototype.getIcon = function() {
return "function" === typeof this.icon ? this.icon() : this.icon
}
;
ToolbarItem.FRIEND_REQUESTS = {
type: 0,
icon: bundles.toolbar.frames.toolbar_mail_icon_png
};
ToolbarItem.MINIGAME_BONUS = {
type: 2,
icon: bundles.toolbar.frames.toolbar_dailybonus_icon_png,
grayscaleDisabled: !0,
force: Forces.MINIGAME_FORCE
};
ToolbarItem.LEADER_BOARD = {
type: 3,
icon: bundles.toolbar.frames.toolbar_leader_board_icon_png
};
ToolbarItem.DAILY_TASKS = {
type: 4,
icon: bundles.toolbar.frames.toolbar_daily_tasks_icon_png,
force: Forces.DAILY_TASKS_FORCE
};
ToolbarItem.REWARDED_VIDEO = {
type: 5,
icon: bundles.toolbar.frames.toolbar_rewarded_video_icon_png
};
ToolbarItem.ORDERS = {
type: 6,
targets: "harvested",
icon: bundles.toolbar.frames.toolbar_orders_icon_png
};
ToolbarItem.UNITS_LIBRARY = {
type: 7,
targets: "unitsLibrary",
icon: function() {
return cleverapps.skins.getSlot("toolbar_units_library_icon_png") || bundles.toolbar.frames.toolbar_units_library_icon_png
}
};
ToolbarItem.UNIT_SHOP = {
type: 8,
icon: bundles.toolbar.frames.toolbar_unit_shop_icon_png,
force: Forces.UNITS_SHOP_ICON
};
ToolbarItem.TRAVEL_BOOK = {
type: 9,
icon: bundles.toolbar.frames.toolbar_travel_book_icon_png,
force: Forces.TRAVEL_BOOK
};
ToolbarItem.CLANS = {
type: 10,
icon: bundles.toolbar.frames.toolbar_clans_icon_png,
force: Forces.CLANS_ICON
};
ToolbarItem.ARMY_LIBRARY = {
type: 11,
targets: "armyLibrary",
icon: bundles.toolbar.frames.toolbar_units_library_icon_png
};
ToolbarItem.MAGNET = {
type: 13,
icon: bundles.toolbar.jsons.unitmagnet_json,
dragControls: ["toolbar", "MenuBarCoinsItem"]
};
ToolbarItem.STICKERS_BOOK = {
type: 14,
icon: bundles.toolbar.frames.toolbar_stickers_book_png,
force: Forces.STICKERS_BOOK_FORCE
};
ToolbarItem.LOCATIONS = {
type: 15,
icon: bundles.toolbar.frames.toolbar_locations_icon_png
};
ToolbarItem.DYNAMITE = {
type: 16,
icon: bundles.toolbar.jsons.dynamite_json,
dragControls: ["toolbar", "MenuBarGoldItem"]
};
var FriendRequestsToolbarItem = function() {
ToolbarItem.call(this, ToolbarItem.FRIEND_REQUESTS);
this.lastNotProceedId = cleverapps.dataLoader.load(DataLoader.TYPES.LAST_VIEWED_FRIEND_REQUEST, {
raw: !0
});
levels.friendRequests.onNewListener = function() {
this.mark();
cleverapps.toolbar.updateItems()
}
.bind(this);
levels.friendRequests.onChangeListener = function() {
levels.friendRequests.existNotProcessed() || (this.unmark(),
cleverapps.toolbar.updateItems(!0))
}
.bind(this);
this.enable();
this.mark()
};
FriendRequestsToolbarItem.prototype = Object.create(ToolbarItem.prototype);
FriendRequestsToolbarItem.prototype.constructor = FriendRequestsToolbarItem;
FriendRequestsToolbarItem.prototype.mark = function() {
if (0 !== cleverapps.friends.listFriends().concat(cleverapps.invitalbleFriends.listFriends()).length) {
var a = levels.friendRequests.lastNotProcessedId();
!1 !== a && a !== this.lastNotProceedId && ToolbarItem.prototype.mark.apply(this)
}
}
;
FriendRequestsToolbarItem.prototype.isVisible = function() {
return levels.friendRequests.existNotProcessed()
}
;
FriendRequestsToolbarItem.prototype.onClick = function() {
this.lastNotProceedId = levels.friendRequests.lastNotProcessedId();
cleverapps.dataLoader.save(DataLoader.TYPES.LAST_VIEWED_FRIEND_REQUEST, this.lastNotProceedId, {
raw: !0
});
this.unmark();
cleverapps.focusManager.display({
focus: "FriendRequestsWindow",
control: ["MenuBarGoldItem", "MenuBarLivesItem"],
action: function(a) {
cleverapps.SocialManager.enforceLogin(function(b) {
b !== cleverapps.CODE_SUCCEED ? a() : FriendsCache.loadFriends(function() {
new FriendRequestsWindow;
cleverapps.focusManager.onceNoWindowsListener = a
})
})
}
})
}
;
var LeaderBoardToolbarItem = function() {
ToolbarItem.call(this, ToolbarItem.LEADER_BOARD);
this.enable()
};
LeaderBoardToolbarItem.prototype = Object.create(ToolbarItem.prototype);
LeaderBoardToolbarItem.prototype.constructor = FriendRequestsToolbarItem;
LeaderBoardToolbarItem.prototype.onClick = function() {
connector.social.hasLeaderBoard() ? connector.social.showLeaderBoard({
userResult: levels.user.getHumanReadableNumber()
}, function() {}) : cleverapps.focusManager.display({
focus: "LeadersWindow",
action: function(a) {
new LeadersWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
;
LeaderBoardToolbarItem.prototype.isVisible = function() {
return !cleverapps.rewardedAdsManager.isEnabled() || cleverapps.flags.norest && !cleverapps.config.importMode ? !1 : ToolbarItem.prototype.isVisible.call(this) && levels.user.checkAvailable(cleverapps.Availables.LEADER_BOARD)
}
;
var DailyTasksToolbarItem = function() {
ToolbarItem.call(this, ToolbarItem.DAILY_TASKS);
this.countdown = new cleverapps.CountDown(cleverapps.dailyTasks.getTimeLeft(),{
permanent: !0
});
this.enable();
cleverapps.dailyTasks.onChangeStateListener = this.onChangeState.bind(this);
this.onChangeState()
};
DailyTasksToolbarItem.prototype = Object.create(ToolbarItem.prototype);
DailyTasksToolbarItem.prototype.constructor = DailyTasksToolbarItem;
DailyTasksToolbarItem.prototype.onChangeState = function() {
0 < cleverapps.dailyTasks.getNotCollectedTasks().length ? this.mark() : this.unmark();
this.countdown.resetTimeLeft(cleverapps.dailyTasks.getTimeLeft());
this.countdown.nextSecond(Date.now());
this.onChangeStateListener()
}
;
DailyTasksToolbarItem.prototype.isVisible = function() {
return cleverapps.dailyTasks.isAvailable()
}
;
DailyTasksToolbarItem.prototype.onClick = function() {
cleverapps.focusManager.display({
focus: "DailyTasksWindow",
action: function(a) {
cleverapps.dailyTasks.update();
new DailyTasksWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
;
var RewardedVideoToolbarItem = function() {
ToolbarItem.call(this, ToolbarItem.REWARDED_VIDEO);
this.nextTime = 0;
cleverapps.adsLimits.on("update", this.update.bind(this));
this.update()
};
RewardedVideoToolbarItem.prototype = Object.create(ToolbarItem.prototype);
RewardedVideoToolbarItem.prototype.constructor = RewardedVideoToolbarItem;
RewardedVideoToolbarItem.prototype.update = function() {
this.isAvailable() ? this.enable() : this.disable();
var a = cleverapps.adsLimits.getWatchCount(AdsLimits.TYPES.TOOLBAR);
this.watchCount !== a && (this.watchCount = a,
this.onChangeStateListener())
}
;
RewardedVideoToolbarItem.prototype.getText = function() {
var a = this.getReward();
return a.hard ? "+" + a.hard + "$$" : "+" + a.soft + "@@"
}
;
RewardedVideoToolbarItem.prototype.enable = function() {
this.enabled || (ToolbarItem.prototype.enable.apply(this),
this.mark())
}
;
RewardedVideoToolbarItem.prototype.onClick = function() {
this.disable();
cleverapps.rewardedAdsManager.playRewarded(AdsLimits.TYPES.TOOLBAR, this.reward.bind(this))
}
;
RewardedVideoToolbarItem.prototype.isAvailable = function() {
return cleverapps.rewardedAdsManager.isEnabled() && cleverapps.adsLimits.state(AdsLimits.TYPES.TOOLBAR) === AdsLimits.STATE_READY && this.nextTime < Date.now()
}
;
RewardedVideoToolbarItem.prototype.reward = function() {
this.nextTime = Date.now() + cleverapps.parseInterval(RewardedVideoToolbarItem.TIMEOUT);
var a = this.getReward();
cleverapps.adsLimits.watch(AdsLimits.TYPES.TOOLBAR);
cleverapps.focusManager.displayWhenFreeFocus({
focus: "RewardedAdToolbarReward",
action: function(b) {
new RewardWindow(a,{
event: cleverapps.EVENTS.EARN.VIDEO
});
cleverapps.focusManager.onceNoWindowsListener = b
}
})
}
;
RewardedVideoToolbarItem.prototype.getReward = function() {
var a = cleverapps.adsLimits.getWatchCount(AdsLimits.TYPES.TOOLBAR)
, b = {};
b[cleverapps.config.soft ? "soft" : "hard"] = 1 > a ? 10 : 2 > a ? 5 : 2;
return b
}
;
RewardedVideoToolbarItem.TIMEOUT = "1 minute";
var ToolbarView = cc.Node.extend({
ctor: function() {
this._super();
this.toolbar = cleverapps.toolbar;
this.toolbar.resetItemsState();
this.toolbar.updateItems();
var a = cleverapps.styles.ToolbarView;
this.setAnchorPoint(.5, .5);
this.setContentSize(0, a.bg.height);
this.createBg();
this.itemsViews = [];
this.toolbar.getSceneItems().forEach(function(b) {
b = new ToolbarItemView(b);
this.itemsViews.push(b);
this.addChild(b)
}
.bind(this));
this.toolbar.onAddItemListener = this.createListener(this.addItem.bind(this));
this.toolbar.onUpdateItemsListener = this.createListener(this.updateItems.bind(this));
this.toolbar.onGetView = this.createListener(function() {
return this
}
.bind(this));
this.addControls();
this.updateItems(!0);
this.updateSize();
this.setPositionRound(cleverapps.styles.ToolbarView.position)
},
updateScale: function() {
var a = cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL ? 1.2 : 1;
this.setScale(this.bg.width > cleverapps.resolution.getSceneSize().width ? cleverapps.resolution.getSceneSize().width / this.bg.width : a)
},
updateSize: function() {
this.updateScale();
this._updateBg()
},
createBg: function() {
this.bg = new cc.Scale9Sprite(bundles.toolbar.frames.toolbar_bg_png);
var a = cleverapps.styles.ToolbarView.bg.offsetY;
this.addChild(this.bg);
this.bg.height = this.height;
this.bg.setPositionRound(this.width / 2, this.height / 2 + a)
},
addItem: function(a, b) {
a = new (a.getViewClass())(a);
this.addChild(a);
this.itemsViews.splice(b, 0, a);
this.updateItems()
},
updateItems: function(a) {
var b = cleverapps.styles.ToolbarView
, c = []
, d = []
, e = []
, f = 0;
this.itemsViews.forEach(function(h) {
var k = h.visible;
k && f++;
var m = h.model.isVisible();
m !== k && (d.push(h),
m ? h.setVisible(!0) : a ? h.setVisible(!1) : (e.push(h),
h.stopAllActions(),
h.runAction(new cc.Sequence(new cc.ScaleTo(.3,0),new cc.CallFunc(function() {
h.setVisible(!1);
h.setScale(1)
}
)))));
m && c.push(h)
});
var g = (c.length - 1) * b.margin;
c.forEach(function(h) {
h.baseScaleX = 1;
g += h.width
});
0 < c.length && cleverapps.UI.arrangeWithMargins(c, {
direction: cleverapps.UI.HORIZONTAL,
margin: b.margin,
iterator: function(h, k, m) {
k += b.margin + b.bg.padding;
m = b.items.dy;
a ? (h.scale = 1,
h.setPosition(k, m)) : (-1 !== d.indexOf(h) && (h.scale = 0,
h.setPosition(k, m)),
h.stopAllActions(),
h.runAction(new cc.Spawn((new cc.ScaleTo(.6,1)).easing(cc.easeBackOut(.05)),new cc.MoveTo(.6,cc.p(k, m)))))
}
});
g += 2 * b.margin + 2 * b.bg.padding;
this.setContentSize(0 < c.length ? g : 0, this.height);
this.updateBg(f, c.length, a);
this.updateScale()
},
updateBg: function(a, b, c) {
this.bg.stopAllActions();
c || b > a ? this._updateBg() : this.bg.runAction(new cc.Sequence(new cc.DelayTime(.6),new cc.CallFunc(this._updateBg.bind(this))))
},
_updateBg: function() {
this.bg.setContentSize2(this.width, this.height + cleverapps.resolution.getSafePadding().bottom);
this.bg.setPositionRound(this.width / 2, this.height + cleverapps.styles.ToolbarView.bg.offsetY - this.bg.height / 2);
this.decors && (this.decors.forEach(function(a) {
a.removeFromParent()
}),
delete this.decors);
0 < this.width && (this.decors = SceneDecors.add(this.bg, cleverapps.skins.getSlot("toolbarDecors")))
},
addControls: function() {
cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function() {
return !0
},
onTouchMoved: this.onTouchMoved.bind(this),
onTouchEnded: function(a) {
this.dragItem && (this.dragItem.onDragEnd(a),
delete this.dragItem)
}
.bind(this)
}, this);
"mouse"in cc.sys.capabilities && cc.eventManager.addListener({
event: cc.EventListener.MOUSE,
onMouseMove: this.onTouchMoved.bind(this)
}, this)
},
onTouchMoved: function(a) {
this.toolbar.dragged && !this.dragItem && (this.dragItem = this.toolbar.dragged.onGetView(),
this.dragItem.onDragStart());
if (this.dragItem)
this.dragItem.onDragMove(a)
}
});
cleverapps.styles.ToolbarView = {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 0
}
},
bg: {
height: 205,
padding: 0,
offsetY: -90
},
hover: {
margin: 6
},
items: {
dy: 8
},
margin: 30
};
var ToolbarItemView = cc.Node.extend({
ctor: function(a) {
var b = cleverapps.styles.ToolbarItemView;
this._super();
this.model = a;
var c = this.icon = this.createIcon();
c.setPositionRound(b.icon);
var d = this.mark = new Attention;
d.setScale(b.mark.baseScale || 1);
d.setPositionRound(b.mark);
d.pulse();
b = this.content = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(c.getContentSize());
b.setPositionRound(b.width / 2, b.height / 2);
b.addChild(c);
b.addChild(d);
this.setContentSize2(b.getContentSize());
this.addChild(b);
this.setAnchorPoint(.5, 0);
cleverapps.UI.applyHover(this, {
onMouseOver: this.onMouseOver.bind(this)
});
if (a.onUpdateDragState)
cleverapps.UI.onPressed(this, function() {
if (!this.dragIcon)
return cleverapps.toolbar.setDragItem(this.model),
this.onClick(),
!0
}
.bind(this));
else
cleverapps.UI.onClick(this, this.onClick.bind(this));
a.onFingerOnListener = this.createListener(this.turnOnFinger.bind(this));
a.onFingerOffListener = this.createListener(this.turnOffFinger.bind(this));
a.onChangeStateListener = this.createListener(this.onChangeState.bind(this));
a.showForce = this.createListener(this.showForce.bind(this));
a.onGetView = this.createListener(function() {
return this
}
.bind(this));
this.turnOnFinger();
this.onChangeState();
(c = a.getTargetTypes()) && cleverapps.aims.registerTarget(c, this.content, {
controls: "toolbar"
});
this.debugId = "ToolbarItemView" + a.type
},
onClick: function() {
cleverapps.audio.playSound(bundles.main.urls.click_effect);
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
this.model.onClick()
},
onDragStart: function() {
this.price && this.price.runAction(new cc.FadeOut(.2));
this.icon.setVisible(!1);
this.dragIcon = new ToolbarDragIcon(this.createIcon(),this.model);
this.dragIcon.setPositionRound(this.icon.getPosition());
this.addChild(this.dragIcon);
this.dragIcon.replaceParentSamePlace(cleverapps.scenes.getMovingNode(), {
keepScale: !0
})
},
onDragMove: function(a) {
if (this.dragIcon)
this.dragIcon.onDragMove(a)
},
onDragEnd: function(a) {
cleverapps.toolbar.setDragItem(void 0);
var b = cleverapps.scenes.getMovingNode().convertToNodeSpace(this.convertToWorldSpace(this.icon.getPosition()))
, c = function() {
this.dragIcon.runAction(new cc.Sequence(new cc.MoveTo(.2,b),new cc.CallFunc(function() {
this.icon.setVisible(!0);
this.price && this.price.runAction(new cc.FadeIn(.2));
delete this.dragIcon
}
.bind(this)),new cc.RemoveSelf))
}
.bind(this);
this.dragIcon.onDragEnd(a, c)
},
turnOnFinger: function() {
this.model.finger && (this.finger = FingerView.hintClick(this.content, {
delay: 1.6
}))
},
turnOffFinger: function() {
FingerView.remove(this.finger);
this.finger = void 0
},
showForce: function() {
cleverapps.forces.create(this, this.model.getForce(), {
importantNodes: [cleverapps.scenes.getRunningScene().downToolBarControl]
})
},
updateTimer: function() {
this.timer && (this.timer.removeFromParent(),
delete this.timer);
if (this.model.countdown && this.model.countdown.getTimeLeft()) {
var a = cleverapps.styles.ToolbarItemView.timer
, b = this.timer = new cleverapps.CountDownView(this.model.countdown,{
font: cleverapps.styles.FONTS.TOOLBAR_ITEM_TIMER_TEXT,
background: {
frame: bundles.timer.frames.timer_bg_png,
width: a.bg.width,
height: a.bg.height
}
});
b.setPositionRound(a);
this.content.addChild(b)
}
},
updateTextReward: function() {
this.reward && (this.reward.removeFromParent(),
delete this.reward);
var a = this.model.getText();
if (a) {
var b = cleverapps.styles.ToolbarItemView.reward;
a = this.reward = new TextWithIcon(a,{
font: cleverapps.styles.FONTS.TOOLBAR_ITEM_REWARD_TEXT
});
a.setPositionRound(b);
this.content.addChild(a)
}
},
updatePrice: function() {
this.price && (this.price.removeFromParent(),
delete this.price);
var a = this.model.getPrice();
if (a) {
var b = cleverapps.styles.ToolbarItemView.price;
this.price = new TextWithIcon(a,{
font: cleverapps.styles.FONTS.TOOLBAR_ITEM_TIMER_TEXT
});
this.price.setPositionRound(b);
this.content.addChild(this.price);
a = cleverapps.UI.createScale9Sprite(bundles.timer.frames.timer_bg_png);
a.setContentSize2(b.bg);
this.price.addChild(a, -1);
a.setPositionRound(this.price.width / 2, this.price.height / 2);
this.price.setCascadeOpacityEnabledRecursively(!0)
}
},
onChangeState: function() {
this.model.grayscaleDisabled && cleverapps.UI.convertToGrayScale(this.icon, this.model.enabled);
this.mark.setVisible(this.model.marked);
this.model.marked && this.shake();
this.updateTimer();
this.updateTextReward();
this.updatePrice()
},
shake: function() {
this.shakeInProgress || (this.shakeInProgress = !0,
this.content.runAction(new cc.Sequence(new cc.DelayTime(Math.floor(8 * Math.random()) + 8),new cc.Sequence(new cc.ScaleTo(.5,1.2,.8),new cc.Spawn(new cc.ScaleTo(.2,1,1),new cc.MoveBy(.2,0,150)),new cc.MoveBy(.2,0,-150),new cc.MoveBy(.1,0,30),new cc.MoveBy(.1,0,-30),new cc.CallFunc(function() {
this.shakeInProgress = !1
}
.bind(this))))))
},
createIcon: function() {
if (cleverapps.Spine.isAnimationLoaded(this.model.getIcon())) {
var a = new cleverapps.Spine(this.model.getIcon());
a.setAnimation(0, "idle", !0)
} else
a = new cc.Sprite(this.model.getIcon());
return a
},
onMouseOver: function() {
(this.model.enabled || this.model.dragAction) && this.setScale(1.05 * this.baseScale || 1.05)
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TOOLBAR_ITEM_TIMER_TEXT: {
name: "default",
size: 21
},
TOOLBAR_ITEM_REWARD_TEXT: {
size: 26,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.ToolbarItemView = {
timer: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 0
},
bg: {
width: 120,
height: 30
}
},
icon: {
x: {
align: "center"
},
y: {
align: "center"
}
},
mark: {
x: {
align: "center",
dx: -30
},
y: {
align: "center",
dy: 30
}
},
reward: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 12
}
},
price: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 0
},
bg: {
width: 65,
height: 30
}
}
};
var ToolbarDragIcon = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.icon = a;
this.itemModel = b;
this.setAnchorPoint(.5, .5);
this.setContentSize(a.getContentSize());
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a);
b.onUpdateDragState = this.createListener(this.updateState.bind(this))
},
updateState: function(a) {
a = a || {};
a.animation && a.animation !== this.icon.getCurrentAnimationName(0) && this.icon.setAnimation(0, a.animation, !0)
},
onDragMove: function(a) {
this.setPositionRound(this.parent.convertTouchToNodeSpace(a));
this.itemModel.onFollowPointer(a)
},
onDragEnd: function(a, b) {
this.itemModel.dragAction(a) ? (this.icon.setAnimation(0, "use", !1),
this.icon.setCompleteListenerOnce(function() {
this.icon.setAnimation(0, "idle", !0);
b()
}
.bind(this))) : b()
}
});
cleverapps.FBLoginOrInvite = function() {
if (connector.social.isConnected() && !cleverapps.flags.nologin && connector.social.isSupportsNativeInvite) {
var a = new cc.Node;
a.setAnchorPoint(.5, .5);
var b = a.createListener(function() {
a.removeFromParent(!0)
})
, c = new InviteButton({
onSuccess: b
});
c.setPositionRound(c.width / 2, c.height / 2);
a.setContentSize2(c);
a.addChild(c);
b = cleverapps.styles.FBLoginOrInvite;
if (b.images.avatars) {
var d = new cleverapps.UI.Avatar({
avatar: bundles.avatar.frames.default_avatar,
frame: bundles.avatar.frames.avatar_frame2
});
d.setScale(b.images.avatars.scale);
d.setPositionRound(b.images.avatars.right.x, b.images.avatars.right.y);
d.setRotation(b.images.avatars.right.rotation);
c.addChild(d);
d = new cleverapps.UI.Avatar({
avatar: bundles.avatar.frames.default_avatar,
frame: bundles.avatar.frames.avatar_frame2
});
d.setScale(b.images.avatars.scale);
d.setPositionRound(b.images.avatars.left.x, b.images.avatars.left.y);
d.setRotation(b.images.avatars.left.rotation);
c.addChild(d)
}
c = cleverapps.UI.generateTTFText("FBLoginOrInvite.invite", cleverapps.styles.FONTS.FBLOGINORINVITE_TEXT);
c.setPosition(a.width / 2 + b.text.offsetX, a.height + b.text.offsetY);
c.fitTo(b.text.width);
a.addChild(c);
a.setVisible(!1);
a.runAction(new cc.Sequence(new cc.ScaleTo(0,0),new cc.Show,(new cc.ScaleTo(.5,1)).easing(cc.easeBackOut())));
c.setOpacity(0);
c.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.FadeIn(.5)));
cleverapps.UI.wrap(a);
return a
}
}
;
cleverapps.styles.FBLoginOrInvite = {
images: {
avatars: {
scale: .7,
left: {
x: {
align: "left",
dx: -90
},
y: {
align: "center"
},
rotation: -7
},
right: {
x: {
align: "left",
dx: -60
},
y: {
align: "center",
dy: 5
},
rotation: 13
}
}
},
text: {
offsetX: -40,
offsetY: 26,
width: 700
}
};
cleverapps.Row = cc.Scale9Sprite.extend({
ctor: function(a, b) {
this.options = b || {};
this.cup = a.cup;
this.player = !!a.player;
this.leader = !!a.leader;
this.notInTop = a.notInTop;
this.clickableArea = a.clickableArea;
this.currentPlace = a.place;
this._super(this.player ? this.options.row_you_png || bundles.table.frames.row_you_png : this.options.row_player_png || bundles.table.frames.row_player_png);
var c = cleverapps.styles.Row;
this.setContentSize2(this.options.rowWidth || c.width, this.options.rowHeight || c.height);
b = [];
this.placeNode = this.createPlace(a.place);
b.push(this.placeNode);
a.emblem ? b.push(this.createEmblem(a.emblem)) : b.push(this.createAvatar(a.avatar));
var d = b.length;
!1 !== this.options.prizes && (this.prizeNode = this.createPrize(a.place),
b.push(this.prizeNode));
b.push(this.createData(a));
this.options.buttonData && b.push(this.createButton(this.options.buttonData));
var e = b.reduce(function(f, g) {
return f + g.width * g.scaleX + c.content.margin
}, 0);
a = this.createName(a.text, a.id, this.width - e - 2 * c.paddingX);
b.splice(d, 0, a);
this.content = new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: c.content.margin
});
this.addChild(this.content);
this.content.setPositionRound(c.content)
},
createPlace: function(a) {
var b = cleverapps.styles.Row
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
var d = bundles.table.frames["badge_" + a];
a = !1 !== this.options.badges && d ? new cc.Sprite(d) : this.createPlaceText(a);
c.setContentSize2(!1 !== this.options.badges ? b.place.withBadge.width : b.place.width, b.content.height);
c.addChild(a);
a.setPositionRound(c.width / 2, c.height / 2);
return c
},
createPlaceText: function(a) {
var b = this.player ? cleverapps.styles.FONTS.ROW_PLAYER_TEXT : cleverapps.styles.FONTS.ROW_TEXT;
this.notInTop && (a = "-");
return cleverapps.UI.generateImageText(a, b)
},
createAvatar: function(a) {
var b = cleverapps.styles.Row;
a = new cleverapps.UI.Avatar(a);
cleverapps.UI.fitToBox(a, {
height: b.content.height
});
return a
},
createEmblem: function(a) {
var b = cleverapps.styles.Row;
a = new cc.Sprite(bundles.tablerow_icons.frames["emblem_" + a]);
cleverapps.UI.fitToBox(a, {
height: b.emblem.height
});
return a
},
createName: function(a, b, c) {
var d = cleverapps.styles.Row
, e = new cc.Node;
e.setAnchorPoint(.5, .5);
e.setContentSize2(c, d.content.height);
(a = a || "") || "string" !== typeof b || (a = "Player_" + b.substr(-3));
a = cleverapps.UI.cutPlayerName(a, this.getMaxTextLength());
b = cleverapps.UI.generateOnlyText(a, this.player ? cleverapps.styles.FONTS.ROW_PLAYER_TEXT : cleverapps.styles.FONTS.ROW_TEXT);
b.fitTo(c, d.name.height);
e.addChild(b);
b.setPositionRound(d.name);
return e
},
createPrize: function(a) {
var b = cleverapps.styles.Row
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(b.prize.width, b.content.height);
if (a = this.createPrizeIcon(a))
cleverapps.UI.fitToBox(a, {
height: b.content.height
}),
c.addChild(a),
a.setPositionRound(c.width / 2, c.height / 2),
this.addPrizeBannerTooltip(c);
return c
},
createPrizeIcon: function(a) {
if (a <= ("merge" === cleverapps.config.type ? 3 : 5))
return new cc.Sprite(bundles.table.frames["prize_" + a])
},
addPrizeBannerTooltip: function(a) {
var b = this.getPrizeTooltipText();
cleverapps.tooltipManager.create(a, {
rewards: this.getRewards(),
text: b,
clickableArea: this.clickableArea
})
},
getPrizeTooltipText: function() {
return Messages.get("PrizeTooltip")
},
getRewards: function() {},
createData: function(a) {
var b = cleverapps.styles.Row
, c = this.player ? bundles.table.frames.amount_bg_you_png : bundles.table.frames.amount_bg_png
, d = this.createDataContent(a);
c = new cc.Scale9Sprite(c);
c.setContentSize2(d.width + 2 * b.data.paddingX, b.data.bg.height);
this.getTooltipText() && cleverapps.tooltipManager.create(c, {
text: this.getTooltipText(),
location: cleverapps.UI.Tooltip.LOCATION_BELOW,
clickableArea: this.clickableArea
});
c.addChild(d);
d.setPositionRound(b.data.content);
c.y = b.data.offsetY;
this.updateAmount(a.amount, !0);
return c
},
createDataContent: function(a) {
var b = cleverapps.styles.Row.data
, c = [];
if (a = a.dataIcon || this.options.dataIcon) {
var d = new cc.Sprite(a);
b.icon.rotation && d.setRotation(b.icon.rotation);
c.push(d)
}
this.dataTextWidth = a ? b.text.width : b.text.withoutIcon.width;
this.dataTextHeight = b.text.height;
this.dataAmount = cleverapps.UI.generateImageText("222", cleverapps.styles.FONTS.ROW_DATA_TEXT);
this.dataAmount.fitTo(this.dataTextWidth, this.dataTextHeight);
c.push(this.dataAmount);
return new cleverapps.Layout(c,{
margin: b.margin,
direction: cleverapps.UI.HORIZONTAL
})
},
createButton: function(a) {
var b = cleverapps.styles.Row;
return new cleverapps.UI.Button({
type: b.button.type,
text: a.text,
width: b.button.width,
height: b.button.height,
disabled: a.disabled,
onClicked: a.action
})
},
updateParams: function(a) {
this.notInTop = a.notInTop
},
getTooltipText: function() {
return Messages.get("ResultTooltip")
},
updatePlace: function(a, b) {
this.currentPlace !== a && (this.currentPlace = a,
this.refreshPlace(this.currentPlace, b),
this.refreshPrize(this.currentPlace, b))
},
updateAmount: function(a, b) {
this.dataAmount && this.currentAmount !== a && (this.currentAmount = a,
this.dataAmount.stopAllActions(),
this.dataAmount.setString(this.currentAmount),
this.dataAmount.fitTo(this.dataTextWidth, this.dataTextHeight),
b || this.dataAmount.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.5),new cc.ScaleTo(.2,1))))
},
refreshPrize: function(a) {
if (this.prizeNode) {
var b = this.prizeNode.getPosition();
this.prizeNode.removeFromParent(!0);
this.prizeNode = this.createPrize(a);
this.prizeNode.setPositionRound(b);
this.content.addChild(this.prizeNode)
}
},
refreshPlace: function(a) {
var b = this.placeNode.getPosition();
this.placeNode.removeFromParent(!0);
this.placeNode = this.createPlace(a);
this.content.addChild(this.placeNode);
this.placeNode.setPositionRound(b)
},
getMaxTextLength: function() {
return 12
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
ROW_DATA_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
ROW_PLAYER_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
ROW_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.Row = {
width: 700,
height: 82,
paddingX: 15,
content: {
height: 62,
margin: 10,
x: {
align: "center"
},
y: {
align: "center"
}
},
place: {
withBadge: {
width: 100
},
width: 50
},
avatar: {
scale: .6
},
emblem: {
height: 100
},
name: {
height: 50,
x: {
align: "center"
},
y: {
align: "center",
dy: -3
}
},
prize: {
width: 80
},
data: {
paddingX: 10,
offsetY: 0,
bg: {
height: 60
},
margin: 7,
content: {
x: {
align: "center"
},
y: {
align: "center",
dy: 2
}
},
icon: {
rotation: -10
},
text: {
withoutIcon: {
width: 75
},
width: 65,
height: 50
}
},
button: {
width: 196,
height: 75,
type: cleverapps.styles.UI.Button.Images.button_green
}
};
cleverapps.LeadersRow = cleverapps.Row.extend({
ctor: function(a) {
this._super(a, {
prizes: !1
})
}
});
cleverapps.styles.LeadersRow = {};
cleverapps.MissionRow = cleverapps.Row.extend({
ctor: function(a, b) {
this.mission = b.mission;
this._super(a, b)
},
getRewards: function() {
return this.mission.getPrizeByPlace(this.currentPlace - 1)
}
});
FeastMissionRow = cleverapps.MissionRow.extend({
ctor: function(a, b) {
this.amountTooltip = b.amountTooltip;
this.missionName = b.mission.name;
this._super(a, b)
},
getPrizeTooltipText: function() {
var a = this.getRewardUnit(this.currentPlace - 1);
if (a) {
if (Array.isArray(a)) {
var b = [];
a.forEach(function(c) {
b.push(cleverapps.unitsLibrary.getUnitName(c))
});
a = b.join(", ")
} else
a = cleverapps.unitsLibrary.getUnitName(a);
return a
}
return this._super()
},
getTooltipText: function() {
return this.amountTooltip
},
getRewardUnit: function(a) {
var b = RewardsConfig[this.missionName];
if (b && b.places && (a = b.places[a]) && a.unit)
return a.unit
},
getRewards: function() {
return {
units: this.getRewardUnit(this.currentPlace - 1)
}
}
});
cleverapps.styles.FeastMissionRow = {};
cleverapps.DailyCupRow = cleverapps.Row.extend({
ctor: function(a) {
this._super(a, {
dataIcon: bundles.tablerow_icons.frames.dailycup
})
},
createPrizeIcon: function(a) {
return cleverapps.DailyCupRow.choosePrizeIcon(cleverapps.dailyCup, a)
},
getRewards: function() {
return cleverapps.dailyCup.listRewards()[this.currentPlace - 1]
},
getPrizeTooltipText: function() {
return 3 >= this.currentPlace ? "Cup" + this.currentPlace + "PlaceTooltip" : "CupRewardTooltip"
}
});
cleverapps.DailyCupRow.choosePrizeIcon = function(a, b) {
if (a.listRewards()[b - 1])
return new cc.Sprite(bundles.table.frames["prize_" + b] || bundles.table.frames.prize_5)
}
;
cleverapps.DailyCupLeadersRow = cleverapps.Row.extend({
ctor: function(a) {
this._super(a, {
badges: !1,
prizes: !1
})
},
generateMedalAmount: function(a, b) {
var c = cleverapps.styles.DailyCupLeadersRow;
a = new cc.Sprite(bundles.table.frames["badge_" + a]);
a.setScale(.7);
b = cleverapps.UI.generateImageText(b, cleverapps.styles.FONTS.SMALL_WHITE_TEXT);
b.setAnchorPoint(0, .5);
b.fitTo(c.text.width);
var d = new cc.Node;
d.setAnchorPoint(.5, .5);
d.setContentSize2(c.text.width, b.height);
d.addChild(b);
b.setPositionRound(0, b.height / 2);
return new cleverapps.Layout([a, d],{
direction: cleverapps.UI.HORIZONTAL,
margin: c.iconMargin
})
},
createDataContent: function(a) {
var b = cleverapps.styles.DailyCupLeadersRow
, c = [];
c.push(this.generateMedalAmount(1, a.firstPlace));
c.push(this.generateMedalAmount(2, a.secondPlace));
c.push(this.generateMedalAmount(3, a.thirdPlace));
return new cleverapps.Layout(c,{
direction: cleverapps.UI.HORIZONTAL,
margin: b.margin
})
}
});
cleverapps.styles.DailyCupLeadersRow = {
text: {
width: 50
},
iconMargin: 2,
margin: 4
};
cleverapps.Table = function() {
this.results = {}
}
;
cleverapps.Table.prototype.reset = function() {
this.results = {}
}
;
cleverapps.Table.prototype.updateResults = function(a, b) {
this.results[a] = [];
for (var c = 0; c < b.length; c++)
this.results[a].push(cleverapps.clone(b[c]))
}
;
cleverapps.Table.prototype.resetResults = function(a) {
this.results[a] = void 0
}
;
cleverapps.Table.prototype.getResults = function(a) {
return this.results[a]
}
;
cleverapps.Table.prototype.createTableView = function(a) {
var b = this.results[a.id];
b && a.data.length !== b.length && (b = void 0);
b || (b = a.data);
b = new cleverapps.TableView(b,a.rowConstructor,a.dataIcon,a);
b.updateResults(a.data);
this.updateResults(a.id, a.data);
return b
}
;
cleverapps.TableView = cc.Node.extend({
setupRowPosition: function(a, b, c) {
var d = cleverapps.styles.TableView
, e = function() {
a.view.currentPlace === a.data.place && a.data.place > this.amountRows ? (a.view.removeFromParent(),
delete this.rows[a.data.id]) : this.setRowVisibility(a.view);
c && c()
}
.bind(this);
b = this.amountRows - b;
d = cc.p(this.innerPadding, this.innerPadding + (d.margin + a.view.height) * b + a.view.height / 2);
a.view.setLocalZOrder(b);
c && (this.isVisiblePosition(a.view.y, a.view.height) || this.isVisiblePosition(d.y, a.view.height)) ? a.view.runAction(new cc.Sequence(new cc.MoveTo(.2,d),new cc.CallFunc(e))) : (a.view.setPositionRound(d),
e());
return d
},
isVisiblePosition: function(a, b) {
a -= this.container.height / 2;
return -this.container.y - this.scroll.height / 2 - b / 2 <= a && a <= -this.container.y + this.scroll.height / 2 + b / 2
},
finishAnimation: function() {
this.inSwapAnimation--;
this.swapIfNeed()
},
startAnimation: function() {
this.inSwapAnimation += 1
},
swapPairIfNeed: function(a, b) {
var c = a.view.currentPlace
, d = b.view.currentPlace;
this.startAnimation();
this.startAnimation();
a.view.updatePlace(d);
b.view.updatePlace(c);
d = this.setupRowPosition(a, d, this.finishAnimation.bind(this));
c = this.setupRowPosition(b, c, this.finishAnimation.bind(this));
var e;
a.data.player ? e = d : b.data.player && (e = c);
e && this.scroll.scrollTo(e, .2, {
easing: cc.easeInOut(1)
})
},
swapIfNeed: function() {
if (0 === this.inSwapAnimation) {
var a = this.amountRows + 2, b;
Object.values(this.rows).forEach(function(d) {
d.view.currentPlace > d.data.place && d.data.place < a && (a = d.data.place,
b = d)
});
if (b) {
var c = this.findRowWithPlace(b.view.currentPlace - 1);
c && this.swapPairIfNeed(c, b)
}
Object.values(this.rows).forEach(function(d) {
d.view.updateAmount(d.data.amount)
})
}
},
setRowVisibility: function(a) {
a.setVisible(this.isVisiblePosition(a.y, a.height))
},
setRowsVisibility: function() {
Object.values(this.rows).forEach(function(a) {
this.setRowVisibility(a.view)
}
.bind(this))
},
cloneResults: function(a) {
return a.map(function(b) {
return cleverapps.clone(b)
})
},
updateResults: function(a) {
if (this.amountRows !== a.length)
return !1;
a = this.cloneResults(a);
var b = this.amountRows + 1;
Object.values(this.rows).forEach(function(g) {
g.data.place = b
});
for (var c = 0; c < a.length; c++) {
var d = a[c]
, e = this.rows[d.id];
if (e)
e.data = d,
e.view.updateParams(d);
else {
this.dataIcon && (d.dataIcon = this.dataIcon);
var f = cleverapps.clone(d);
f.place = b;
e = this.rows[d.id] = {
view: new this.RowConstructor(f,this.rowOptions),
data: d
};
e.view.setAnchorPoint(0, .5);
this.container.addChild(e.view);
this.setupRowPosition(e, f.place)
}
}
this.swapIfNeed();
return !0
},
findRowWithPlace: function(a) {
return Object.values(this.rows).find(function(b) {
return b.view.currentPlace === a
})
},
findPlayerRow: function() {
return Object.values(this.rows).find(function(a) {
return a.data.player
})
},
ctor: function(a, b, c, d) {
this._super();
this.setAnchorPoint(.5, .5);
var e = cleverapps.styles.TableView;
this.options = d || {};
this.rows = {};
this.inSwapAnimation = this.amountRows = 0;
this.startAnimation();
a = this.cloneResults(a);
this.RowConstructor = b || cleverapps.Row;
this.dataIcon = c;
this.rowOptions = this.options.rowOptions;
this.innerPadding = this.options.innerPadding || e.innerPadding;
b = this.container = new cc.Node;
b.setAnchorPoint(.5, .5);
c = e.width;
for (var f = 0, g = 0; g < a.length; g++) {
var h = a[g];
this.dataIcon && (h.dataIcon = this.dataIcon);
h.clickableArea = this;
var k = new this.RowConstructor(h,this.rowOptions);
k.setAnchorPoint(0, .5);
b.addChild(k);
c = k.width;
f += k.height;
0 < g && (f += e.margin);
this.rows[h.id] = {
view: k,
data: h
};
this.amountRows++
}
b.setContentSize2(c + 2 * this.innerPadding, f + 2 * this.innerPadding);
this.scroll = new cleverapps.UI.ScrollView(b,{
childrenVisibility: cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_NONE,
containerMovedListener: this.createListener(this.setRowsVisibility.bind(this))
});
this.scroll.setBarPadding(e.barPadding);
this.scroll.setAnchorPoint(0, 0);
this.addChild(this.scroll);
!1 !== d.bg && (this.bg = new cc.Scale9Sprite(bundles.table.frames.table_bg_png),
this.bg.setLocalZOrder(-1),
this.addChild(this.bg));
Object.values(this.rows).forEach(function(m) {
this.setupRowPosition(m, m.data.place)
}
.bind(this));
this.updateSize();
this.setRowsVisibility();
this.runAction(new cc.Sequence(new cc.DelayTime(.7),new cc.CallFunc(this.finishAnimation.bind(this))))
},
updateSize: function() {
var a = cleverapps.styles.TableView
, b = this.options.height && this.options.height[cleverapps.resolution.mode] && this.options.height[cleverapps.resolution.mode].height || this.options.height || a.height;
this.setContentSize2(this.container.width + 2 * a.padding, b + 2 * a.padding);
var c = Math.min(b, this.container.height + 1);
this.scroll.setContentSize2(this.container.width, c);
this.scroll.setPosition(a.padding, a.padding + b - c);
this.bg && (this.bg.setContentSize2(this.width, this.height),
this.bg.setPositionRound(this.width / 2, this.height / 2));
if (void 0 !== this.options.scroll)
this.scroll.scrollTo(this.options.scroll);
else if (this.container.height > c && (a = this.findPlayerRow()))
if (b = this.scroll.targetToPoint(a.view),
isNaN(this.container.x) || isNaN(b.x) || isNaN(b.y)) {
c = a.view.x + "_" + a.view.y;
c += " s " + this.scroll.width + "_" + this.scroll.height + " ic " + this.container.width + "_" + this.container.height;
c += " tp " + b.x + "_" + b.y + " m " + this.scroll.min.x + "_" + this.scroll.min.y + " " + this.scroll.max.x + "_" + this.scroll.max.y;
c += " pl " + a.data.place + " cpl " + a.view.currentPlace + " tpl " + this.amountRows;
try {
c += " " + JSON.stringify({
innerContentSize: this.scroll.innerContent && cc.p(this.scroll.innerContent.width, this.scroll.innerContent.height),
rowViewType: typeof a.view,
rowViewPosition: a.view && a.view.getPosition(),
rowViewWorldPos: a.view && a.view.getParent() && a.view.getParent().convertToWorldSpace(a.view.getPosition()),
innerContentPosition: this.scroll.innerContent && this.scroll.innerContent.getPosition(),
targetNodePosition: this.scroll.innerContent && a.view && a.view.getParent() && this.scroll.innerContent.convertToNodeSpace(a.view.getParent().convertToWorldSpace(a.view.getPosition()))
})
} catch (d) {
console.error(d)
}
try {
c += " " + JSON.stringify({
innerContentWorldPosition: this.scroll.innerContent && this.scroll.innerContent.getParent() && this.scroll.innerContent.getParent() && this.scroll.innerContent.getParent().convertToWorldSpace(this.scroll.innerContent.getPosition())
})
} catch (d) {
console.error(d)
}
cleverapps.throwAsync(c)
} else
this.scroll.scrollTo(a.view)
}
});
cleverapps.styles.TableView = {
width: 500,
height: 732,
margin: 4,
padding: 6,
innerPadding: 6,
barPadding: {
cornerPadding: 20,
sidePadding: 5
}
};
var PersonsLibrary = function() {
this.data = {};
Object.keys(cleverapps.config.persons).forEach(function(a) {
Object.keys(cleverapps.config.persons[a]).forEach(function(b) {
this.add(b, {
name: cleverapps.config.persons[a][b],
bundle: "persons_" + a,
json: bundles["person_" + b].jsons[b + "_json"]
});
if (void 0 === bundles["person_" + b] && cleverapps.config.debugMode)
throw "No person for role: " + b;
}, this)
}, this);
Object.keys(cleverapps.config.personsMinimal).forEach(function(a) {
if (!bundles["person_minimal_" + a] && cleverapps.config.debugMode)
throw "No minimalPerson for role: " + a;
})
};
PersonsLibrary.prototype.add = function(a, b) {
this.data[a] = b
}
;
PersonsLibrary.prototype.choose = function(a, b) {
if (void 0 !== this.data[a])
return a;
if (b && void 0 !== this.data[b])
return b
}
;
PersonsLibrary.prototype.getRole = function(a) {
return this.data[a]
}
;
PersonsLibrary.prototype.getMinimalJson = function(a) {
return bundles["person_minimal_" + a] && bundles["person_minimal_" + a].jsons[a + "_minimal_json"]
}
;
var Person = cleverapps.Spine.extend({
ctor: function(a) {
a = Person.ParseOptions(a);
this.role = a.role;
this.person = cleverapps.persons.getRole(this.role);
if (!this.person)
throw "Person is undefined - " + this.role;
this._super(this.person.json);
this.setOrientation(a.orientation);
!a.skin && this.hasSkin("regular") && (a.skin = "regular");
a.skin && this.hasSkin(a.skin) && this.setSkin(a.skin);
this.emotion = a.emotion;
this.setAnimation(0, this.emotion, !0);
cleverapps.config.debugMode && cleverapps.gameModes.showPersonSilhouette && this.addChild(new PersonSilhouette)
},
setSpeaking: function(a, b) {
this.hasAnimation("talk") && this.isSpeaking !== a && ((this.isSpeaking = a) ? (this.setAnimation(0, "talk", !1),
this.setCompleteListener(function() {
this.setAnimation(0, this.isSpeaking ? "talk" : this.emotion, !1)
}
.bind(this))) : b ? (this.setAnimation(0, this.emotion, !0),
this.setCompleteListener()) : this.setCompleteListenerOnce(function() {
this.setAnimation(0, this.emotion, !0)
}
.bind(this)))
},
setActive: function(a) {
this.isActive !== a && (this.isActive = a,
this.setLocalZOrder(this.isActive ? -1 : -2))
},
getRole: function() {
return this.role
},
getOrientation: function() {
return this.orientation
},
setOrientation: function(a) {
this.orientation = a;
this.orientation === Person.ORIENTATION_RIGHT ? this.setScaleX(-1) : this.setScaleX(1)
},
showAnimation: function(a) {
this.setVisible(!0);
this.stopAllActions();
a ? (this.setOpacity(255),
this.setScale(1),
this.clearTrack(1)) : (this.hasAnimation("fadeIn") ? a = new cc.CallFunc(function() {
this.setAnimation(1, "fadeIn")
}
.bind(this)) : (this.setOpacity(0),
a = new cc.FadeIn(.15)),
this.runAction(new cc.Spawn(a,(new cc.ScaleTo(.15,1)).easing(cc.easeBackOut()))))
},
hideAnimation: function(a) {
this.stopAllActions();
a ? (this.setVisible(!1),
this.clearTrack(1)) : (a = this.hasAnimation("fadeOut") ? new cc.CallFunc(function() {
this.setAnimation(1, "fadeOut")
}
.bind(this)) : new cc.FadeOut(.15),
this.runAction(new cc.Spawn(a,(new cc.ScaleTo(.15,.6)).easing(cc.easeBackIn()))))
}
});
Person.ParseOptions = function(a) {
"string" === typeof a && (a = {
role: a
});
a.emotion = a.emotion || "idle";
a.orientation = a.orientation || Person.ORIENTATION_LEFT;
return a
}
;
Person.ORIENTATION_LEFT = "left";
Person.ORIENTATION_RIGHT = "right";
var DialoguePersonTitleView = cc.Scale9Sprite.extend({
ctor: function(a) {
var b = cleverapps.styles.DialoguePersonTitleView;
this._super(b.image, cleverapps.UI.getScale9Rect(b.image, cleverapps.UI.Scale9Rect.TwoPixelXY));
this.setAnchorPoint(.5, .5);
this.setCascadeOpacityEnabled(!0);
this.setVisible(!1);
this.isSnown = !1;
var c = this.getContentSize()
, d = Messages.has("Dialogue.person." + a.role) && Messages.get("Dialogue.person." + a.role);
d || (cleverapps.config.debugMode && console.error("person has no name! Dialogue.person." + a.role + " is missing in localization"),
d = Messages.get("Dialogue.person.noName"));
a = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.DIALOGUE_PERSON_TITLE_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.addChild(a);
this.setContentSize2(Math.max(a.width + 2 * b.text.padding.x, c.width), Math.max(a.height + 2 * b.text.padding.y, c.height));
this.updateSize();
a.setPositionRound(b.text)
},
updateSize: function() {
this.setScale(cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? .6 : 1)
},
show: function() {
this.isShown || (this.stopAllActions(),
this.isSnown = !0,
this.setOpacity(0),
this.setVisible(!0),
this.runAction(new cc.FadeIn(.2)))
},
hide: function() {
this.isSnown && (this.stopAllActions(),
this.isSnown = !1,
this.runAction(new cc.Sequence(new cc.FadeOut(.2),new cc.Hide)))
}
});
cleverapps.styles.DialoguePersonTitleView = {
image: bundles.dialogues.frames.dialogue_name,
text: {
x: {
align: "center"
},
y: {
align: "center",
dy: -3
},
padding: {
x: 5,
y: 0
}
}
};
var DialogueView = CleverappsWindow.extend({
onWindowLoaded: function(a, b) {
this.options = b || {};
this.dialogue = a;
b = cleverapps.styles.DialogueView;
this._super({
name: "DialogueViewWindow",
content: new cc.Node,
closeButton: !1,
closeByBackButton: !1,
noBackground: !0,
styles: cleverapps.overrideStyles(b.Window, this.options.window, !0),
noScaleAdjustment: !0,
openSound: bundles.dialogues.urls.dialogue_effect
});
this.generateContent();
a.on("showUp", this.showUp.bind(this), this);
a.on("close", this.close.bind(this), this);
a.on("addPerson", this.addPerson.bind(this), this);
a.on("hidePerson", this.hidePerson.bind(this), this);
a.on("updateActive", this.updateActive.bind(this), this);
a.on("changeText", this.changeText.bind(this), this);
a.on("finishTyping", this.byLetterAnimationFinish.bind(this), this)
},
onShow: function() {
this.dialogue.isStarted() || this.dialogue.run()
},
setupChildren: function() {
this._super();
var a = cleverapps.resolution.getSceneSize()
, b = cleverapps.styles.DialogueView;
this.contentWrap.setContentSize(a);
var c = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? 0 : b.widthPadding;
this.content.setContentSize2(a.width - 2 * c, b.size[cleverapps.resolution.mode].height);
this.dialogueContent.setContentSize2(a.width, this.content.height);
a = cleverapps.resolution.getSafePadding();
this.background.setContentSize2(this.content.width, this.content.height + a.bottom);
this.background.baseContentSize = this.background.getContentSize();
this.contentWrap.setPositionRound(b.position);
this.content.stopAllActions();
this.content.setOpacity(255);
this.content.setPositionRound(c, b.offsetY);
this.background.setPositionRound({
align: "left"
}, {
align: "top"
});
[this.leftPersonView, this.rightPersonView].filter(Boolean).forEach(function(d) {
d.stopAllActions();
d.setVisible(!0);
this.updatePersonSize(d);
this.updatePersonPosition(d)
}
.bind(this));
this.text && this.text.setupChildren()
},
updatePersonSize: function(a) {
var b = cleverapps.styles.DialogueView.persons
, c = 1;
cleverapps.resolution.mode !== cleverapps.WideMode.HORIZONTAL && (c = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? b.mobileScale : b.squareScale);
b = c;
"left" !== a.getOrientation() && (b = -b);
a.setScale(b, c)
},
updatePersonPosition: function(a) {
var b = cleverapps.styles.DialogueView
, c = Math.abs(a.getScaleX())
, d = b.persons[a.getOrientation()][cleverapps.resolution.mode].x
, e = this.content.height + b.persons.offsetY * c;
a.setPositionRound(d, e);
var f = cc.p(this.contentWrap.width / 2, e);
d = a.getBoundingBox();
cc.rectContainsPoint(d, f) && (c = b.persons.margin / 2 + a.width / 2 * c,
a.setPositionRound("left" === a.getOrientation() ? f.x - c : f.x + c, e));
e = a.getPosition();
a.showPosition = e;
a.hidePosition = cc.p("left" === a.getOrientation() ? -a.width - this.content.x : this.content.x + this.content.width + a.width, e.y);
c = a.title;
c.setPositionRound(a.x, cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? b.title.mobileY : b.title.y);
e = c.getBoundingBox();
f = b.title.offsetX;
(e.x < f || e.x + e.width > c.parent.width - f) && c.setPositionRound("left" === a.getOrientation() ? {
align: "left",
dx: f
} : {
align: "right",
dx: -f
}, c.y);
c = a.arrow;
c.setPositionRound("left" === a.getOrientation() ? Math.max(d.x + d.width, e.x + e.width) + c.width / 2 : Math.min(d.x, e.x) - c.width / 2, b.arrow.y)
},
generateContent: function() {
var a = this.content = new cc.Node;
a.setAnchorPoint(0, 0);
a.setCascadeOpacityEnabled(!0);
var b = this.background = cleverapps.UI.createScale9Sprite(bundles.dialogues.frames.bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
b.setAnchorPoint(0, 0);
b.setCascadeOpacityEnabled(!0);
a.addChild(b);
b = this.dialogueContent = new cc.Node;
b.avoidNode = "DialogueView";
b.setVisible(!1);
b.setAnchorPoint(0, 0);
b.addChild(a);
a = this.contentWrap = new cc.Node;
cleverapps.config.debugMode && (this.contentWrap._debugExclude = !0);
a.setAnchorPoint(0, .5);
a.addChild(b);
cleverapps.UI.onClick(a, function() {
this.dialogue.screenClicked();
return !0
}
.bind(this), {
interactiveScale: !1
});
a.setContentSize(cleverapps.resolution.getSceneSize());
a.setLocalZOrder(1);
this.addChild(a)
},
showUp: function(a, b) {
var c = cleverapps.styles.DialogueView.showAnimation;
a ? (this.dialogueContent.setVisible(!0),
b()) : "fromBelow" === c ? this.showUpFromBelow(b) : this.showUpFromSides(b)
},
showUpFromSides: function(a) {
var b = this.background.baseContentSize;
this.background.setContentSize(.6 * b.width, b.height);
this.content.setOpacity(0);
this.textBgArrow && this.textBgArrow.setVisible(!1);
[this.leftPersonView, this.rightPersonView].filter(Boolean).forEach(function(c) {
var d = c.isActive ? 0 : .25;
c.setPosition(c.hidePosition);
c.setVisible(!1);
c.runAction(new cc.Sequence(new cc.DelayTime(d),new cc.Show,(new cc.MoveTo(.35,c.showPosition)).easing(cc.easeBackOut()),new cc.CallFunc(function() {
cleverapps.scenes.onAvoidNodeVisibilityChanged()
}
)))
});
this.background.runAction(new cc.Sequence(new cc.DelayTime(.25),new Scale9SpriteResizeTo(.25,b)));
this.content.runAction(new cc.Sequence(new cc.DelayTime(.25),new cc.FadeTo(.25,255)));
this.dialogueContent.runAction(new cc.Sequence(new cc.DelayTime(.25),new cc.Show,new cc.DelayTime(.25),new cc.CallFunc(function() {
a();
this.textBgArrow && this.textBgArrow.setVisible(!0)
}
.bind(this))))
},
showUpFromBelow: function(a) {
var b = cleverapps.styles.DialogueView
, c = this.content.getPosition()
, d = cc.p(c.x, -this.content.height);
this.content.setPositionRound(d);
this.content.runAction(new cc.Sequence(new cc.DelayTime(this.options.delay || 0),new cc.MoveTo(.2,c.x,c.y + b.showUp.offset),new cc.MoveTo(.1,c)));
this.dialogueContent.runAction(new cc.Sequence(new cc.DelayTime(this.options.delay || 0),new cc.Show,new cc.DelayTime(.3),new cc.CallFunc(a)));
[this.leftPersonView, this.rightPersonView].filter(Boolean).forEach(function(e) {
var f = e.showPosition;
e.setVisible(!1);
e.setPosition(f.x, d.y + this.content.height);
e.runAction(new cc.Sequence(new cc.DelayTime(this.options.delay || 0),new cc.Show,new cc.MoveTo(.2,cc.p(f.x, f.y + b.showUp.offset)),new cc.MoveTo(.1,f.x,f.y),new cc.CallFunc(function() {
cleverapps.scenes.onAvoidNodeVisibilityChanged()
}
)))
}
.bind(this))
},
addPerson: function(a, b) {
var c = Person.ParseOptions(a).role;
if (cleverapps.persons.getRole(c)) {
c = new Person(a);
c.setAnchorPoint(.5, 0);
c.setActive(a.active);
var d = new DialoguePersonTitleView(a);
c.title = d;
var e = new cc.Sprite(bundles.dialogues.frames.dialogue_arrow_png);
e.setVisible(!1);
c.arrow = e;
"left" === c.getOrientation() ? this.leftPersonView = c : (this.rightPersonView = c,
e.setScaleX(-1));
this.content.addChild(c);
this.content.addChild(e);
this.content.addChild(d);
this.updatePersonSize(c);
this.updatePersonPosition(c);
addCleaner(c, function() {
d.removeFromParent();
e.removeFromParent()
});
b || (c.setPosition(c.hidePosition),
c.setVisible(!1),
c.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.Show,(new cc.MoveTo(.25,c.showPosition)).easing(cc.easeBackOut()))))
} else
cleverapps.throwAsync("Person is undefined - " + c)
},
updateActive: function(a) {
var b = "left" === a;
a = b ? this.leftPersonView : this.rightPersonView;
b = b ? this.rightPersonView : this.leftPersonView;
a && (a.setActive(!0),
a.setSpeaking(!0),
a.title.show(),
a.arrow.setVisible(!0));
b && (b.setActive(!1),
b.setSpeaking(!1),
b.title.hide(),
b.arrow.setVisible(!1))
},
hidePerson: function(a) {
var b = "right" === a ? this.rightPersonView : this.leftPersonView;
b && (b.runAction(new cc.Sequence((new cc.MoveTo(.25,b.hidePosition)).easing(cc.easeIn(5)),new cc.RemoveSelf)),
b.title.hide(),
b.arrow.setVisible(!1));
"right" === a ? this.rightPersonView = void 0 : this.leftPersonView = void 0;
cleverapps.scenes.onAvoidNodeVisibilityChanged()
},
changeText: function(a, b) {
var c = cleverapps.styles.DialogueView;
this.text && this.text.removeFromParent();
this.text = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.DIALOGUE_MESSAGE_TEXT || cleverapps.styles.FONTS.FORCE_MESSAGE_TEXT);
this.text.initTextSize = this.text.getFontSize();
this.content.addChild(this.text, 1);
this.text.setupChildren = function() {
var d = c.text
, e = d.padding
, f = cc.TEXT_ALIGNMENT_LEFT;
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && (e = d.verticalPadding,
f = cc.TEXT_ALIGNMENT_CENTER);
this.text.setHorizontalAlignment(f);
f = this.content.width - e.fromWallX;
var g = e.x;
b && (f = this.content.width - e.x,
g = e.fromWallX);
var h = this.content.height - e.y
, k = 1
, m = f - g;
e = h - e.y;
m > d.optimization.width && (k = 1.5,
m /= k,
e /= k);
this.text.setFontSize(Math.round(this.text.initTextSize / k));
this.text.setDimensions(m, 0);
this.text.fitTo(void 0, e);
this.text.setScale(k);
this.text.setAnchorPoint(.5, 1);
this.text.setPositionRound((g + f) / 2, h);
this.text._byLetterAnimationRunning && (this.text._byLetterAnimationDone(),
this.text.setString(a))
}
.bind(this);
this.text.setupChildren();
this.text.byLetterAnimation({
callback: this.dialogue.finishTyping.bind(this.dialogue)
})
},
close: function(a) {
this.byLetterAnimationFinish();
this.content.stopAllActions();
var b = function() {
this.dialogue.trigger("beforeClose");
CleverappsWindow.prototype.close.apply(this, arguments);
this.dialogue.finishClose()
}
.bind(this);
a ? b() : "fromBelow" === cleverapps.styles.DialogueView.showAnimation ? this.closeToBelow(b) : this.closeToSides(b)
},
closeToSides: function(a) {
this.text && this.text.removeFromParent();
[this.leftPersonView, this.rightPersonView].filter(Boolean).forEach(function(b) {
var c = b.isActive ? .25 : 0;
b.arrow.setVisible(!1);
b.title.setVisible(!1);
b.runAction(new cc.Sequence(new cc.DelayTime(c),new cc.MoveTo(.25,b.hidePosition)))
});
this.background.runAction(new cc.Spawn(new cc.FadeTo(.5,0),new Scale9SpriteResizeTo(.5,.6 * this.background.width,this.background.height)));
this.dialogueContent.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.CallFunc(a)))
},
closeToBelow: function(a) {
var b = cleverapps.styles.DialogueView
, c = cc.p(this.content.x, -this.content.height);
this.content.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.MoveTo(.15,cc.p(this.content.x, this.content.y + b.showUp.offset)),new cc.MoveTo(.15,c),new cc.CallFunc(a),new cc.RemoveSelf));
[this.leftPersonView, this.rightPersonView].filter(Boolean).forEach(function(d) {
d.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.MoveTo(.15,cc.p(d.x, d.y + b.showUp.offset)),new cc.MoveTo(.15,d.x,c.y + this.content.height)))
}
.bind(this))
},
byLetterAnimationFinish: function(a) {
this.text && (this.text.byLetterAnimationFinish(),
this.text.setupChildren());
[this.leftPersonView, this.rightPersonView].forEach(function(b) {
b && b.setSpeaking(!1, a)
})
},
listBundles: function(a) {
return a.bundlesToLoad.slice()
}
});
DialogueView.GRAVITATE = {
BOTTOM: "bottom",
TOP: "top"
};
cleverapps.styles.DialogueView = {
position: {
x: {
align: "left",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
size: [{
height: 240
}, {
height: 280
}, {
height: 280
}],
widthPadding: 0,
offsetY: 20,
showAnimation: "fromSides",
showUp: {
offset: 75
},
arrow: {
y: {
align: "top",
dy: 23
}
},
text: {
padding: {
fromWallX: 30,
x: 30,
y: 30
},
verticalPadding: {
fromWallX: 50,
x: 50,
y: 40
},
optimization: {
width: 1E3
}
},
persons: {
mobileScale: .65,
squareScale: .8,
margin: 100,
offsetY: -450
},
title: {
offsetX: 0,
y: {
align: "top",
anchor: !1,
dy: 0
},
mobileY: {
align: "top",
anchor: !1,
dy: 0
}
},
Window: {
windowShowUpAnimation: !1
}
};
cleverapps.styles.DialogueView.persons[Person.ORIENTATION_LEFT] = [{
x: {
align: "left",
dx: 20
}
}, {
x: {
align: "left",
dx: 75
}
}, {
x: {
align: "left",
dx: 75
}
}];
cleverapps.styles.DialogueView.persons[Person.ORIENTATION_RIGHT] = [{
x: {
align: "right",
dx: -20
}
}, {
x: {
align: "right",
dx: -75
}
}, {
x: {
align: "right",
dx: -75
}
}];
var MinimalDialogue = cc.Node.extend({
avoidNode: "MinimalDialogue",
ctor: function(a) {
this._super();
this.options = a || {};
this.targetRect = this.options.targetRect || this.options.rects && this.options.rects[0];
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(20);
this._setGlobalZOrder(!0);
this.options.text && (this.items = [this.options.text]);
this.options.items && (this.items = this.options.items);
a.control && cleverapps.focusManager.registerControl(a.control, this.createListener(function(b) {
b ? this.showUp() : this.hide(void 0, !0)
}))
},
display: function() {
this.updateSize();
this.debugInfo && this.debugInfo.show();
this.options.hidden || (MinimalDialogue.lastShown && MinimalDialogue.lastShown + 3E4 > Date.now() && (this.options.shortAnimations = !0),
MinimalDialogue.lastShown = Date.now(),
this.showUp())
},
updateSize: function() {
this.stopAllActions();
this.createContent({
person: !0
});
if (!this.calculatePosition()) {
var a = this.calcMaxDimensions();
this.createContent({
person: !0,
maxDimensions: a
});
this.calculatePosition() || (this.createContent({
person: !1,
maxDimensions: a
}),
this.calculatePosition() || this.defaultSlot(a))
}
this.basePosition = this.getPosition()
},
completeAnimationOnResize: function() {
if (this.hideCallback) {
var a = this.hideCallback;
this.hideCallback = void 0;
a()
}
},
updateOrientation: function() {
var a = cleverapps.scenes.getRunningScene()
, b = cleverapps.styles.MinimalDialogue;
this.x > a.width / 2 + 3 ? (this.personNode && (this.textBgArrow.setPositionRound(b.text.arrow.right),
this.textBgArrow.setScaleX(-1),
this.personNode.setScaleX(-Math.abs(this.personNode.getScaleX())),
this.personNode.setPositionRound({
align: "right"
}, {
align: "center"
})),
this.bg.setAnchorPoint(1, .5),
this.bg.setPositionRound({
align: "left"
}, {
align: "center"
})) : (this.personNode && (this.textBgArrow.setPositionRound(b.text.arrow.left),
this.textBgArrow.setScaleX(1),
this.personNode.setScaleX(Math.abs(this.personNode.getScaleX())),
this.personNode.setPositionRound({
align: "left"
}, {
align: "center"
})),
this.bg.setAnchorPoint(0, .5),
this.bg.setPositionRound({
align: "right"
}, {
align: "center"
}))
},
removeContent: function() {
this.options.items && this.options.items.forEach(function(a) {
a.parent && (a.removeFromParent(!0),
a.setPosition(0, 0))
});
this.bg && (this.bg.removeAllChildren(),
this.bg.removeFromParent(!0));
this.personNode && (this.personNode.removeFromParent(),
this.personNode = void 0);
delete this.personBackground;
delete this.personAnimation
},
createContent: function(a) {
this.removeContent();
var b = cleverapps.styles.MinimalDialogue
, c = cc.size(0, 0);
if (a.person) {
var d = this.personNode = this.createPerson();
c = cc.size(d.width * d.scale + b.person.margin, d.height * d.scale)
}
var e = cleverapps.scenes.getRunningScene()
, f = cc.rectSubPadding(e.getBoundingBox(), cc.padding(b.padding));
f.width = Math.min(f.width, b.maxWidth);
e = cc.rect(f.x, f.y, f.width - c.width, Math.min(f.height, b.text.maxHeight));
a.maxDimensions && (e.width = Math.min(f.width, a.maxDimensions.width),
e.height = Math.min(f.height, a.maxDimensions.height));
a = cc.padding(cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? b.text.verticalPadding : b.text.padding);
var g = cc.rectSubPadding(e, a);
e = this.items.map(function(k) {
if ("string" === typeof k) {
var m = cleverapps.resolution.resizeFont(cleverapps.styles.FONTS.FORCE_MESSAGE_TEXT);
k = cleverapps.UI.generateOnlyText(k, m);
k.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
k.width > g.width && k.setDimensions(g.width, 0);
return k
}
cleverapps.UI.fitToBox(k, {
width: g.width,
maxScale: k.scale
});
return k
});
var h = e.reduce(function(k, m) {
return k + m.height * m.scaleY
}, 0);
h > g.height && e.forEach(function(k) {
var m = k.height * g.height / h;
k.fitTo ? k.fitTo(g.width, m) : cleverapps.UI.fitToBox(k, {
width: g.width,
height: m
})
});
this.contentItems = e;
this.content = new cleverapps.Layout(e,{
margin: b.margin,
direction: "undefined" !== this.options.direction ? this.options.direction : cleverapps.UI.VERTICAL
});
e = Math.max(this.content.height, b.text.minHeight);
f = cc.rectAddPadding(cc.rect(0, 0, this.content.width, e), a);
this.bg = cleverapps.UI.createScale9Sprite(bundles.dialogues_minimal.frames.bg_minimal_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
this.bg.setContentSize2(f);
this.bg.addChild(this.content);
b.text.arrow && d && (this.textBgArrow = new cc.Sprite(bundles.dialogues_minimal.frames.mini_arrow_bg_png),
this.bg.addChild(this.textBgArrow));
this.content.setPositionRound(a.left + this.content.width / 2, a.bottom + e / 2);
this.bg.setCascadeOpacityEnabledRecursively(!0);
this.bg.setOpacity(0);
this.content.setCascadeOpacityEnabledRecursively(!0);
this.setContentSize2(c.width + f.width, Math.max(c.height, f.height));
this.addChild(this.bg);
d && this.addChild(d);
this.updateOrientation();
this.setVisible(!1);
this.shown = !1
},
createPerson: function() {
var a = new cc.Node;
a.setAnchorPoint(.5, .5);
var b = this.personBackground = new cleverapps.Spine(bundles.dialogues_minimal.jsons.bg_person);
b.setPositionRound(a.width / 2, a.height / 2);
a.addChild(b);
var c = "hero";
this.options.person && cleverapps.persons.getMinimalJson(this.options.person) && (c = cleverapps.skins.getSlot(this.options.person) || this.options.person);
var d = cleverapps.persons.getMinimalJson(c);
this.personAnimation = new cleverapps.Spine(d);
this.personAnimation.setPositionRound(cleverapps.styles.MinimalDialogue.person);
b.addChild(this.personAnimation);
cleverapps.UI.wrap(a);
(b = cleverapps.skins.getSlot(c + "_minimal")) && this.personAnimation.setSkin(b);
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && a.setScale(.8);
return a
},
calculatePosition: function() {
var a = cleverapps.resolution.getSceneSize()
, b = cleverapps.styles.MinimalDialogue;
if (this.options.forcePosition)
this.options.forcePosition === Dialogue.POSITIONS.TOP ? this.setPositionRound(a.width / 2, a.height - this.height / 2 - b.positions.top.y) : this.options.forcePosition === Dialogue.POSITIONS.TOP_LOWER ? this.setPositionRound(a.width / 2, a.height - this.height / 2 - b.positions.topLower.y) : this.options.forcePosition === Dialogue.POSITIONS.BOTTOM ? this.setPositionRound(a.width / 2, this.height / 2 + b.positions.bottom.y) : this.options.forcePosition === Dialogue.POSITIONS.CENTER ? this.setPositionRound(a.width / 2, a.height / 2) : this.setPositionRound(this.options.forcePosition);
else {
if (this.options.rects && this.options.rects.length)
return this.calcDynamicPosition();
this.setPositionRound(a.width / 2, this.height / 2 + b.positions.bottom.y)
}
return !0
},
listRects: function() {
var a = cleverapps.styles.MinimalDialogue.targetOffset;
return this.options.rects.map(function(b) {
return b !== this.targetRect ? b : cc.rectAddPadding(b, a)
})
},
listAllPositions: function(a) {
var b = cleverapps.resolution.getSceneSize();
b = cc.rect(0, 0, b.width, b.height);
b = cc.rectSubPadding(b, cc.padding(this.height / 2, this.width / 2));
var c = cleverapps.styles.MinimalDialogue;
c = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? c.rectsPaddingMobile : c.rectsPadding;
for (var d = [], e = 0; e < a.length; e++)
for (var f = this.calcPositionSlots(a[e], c), g = 0; g < f.length; g++)
d.push(cc.nearestToRect(b, f[g]));
return d
},
listDialogueRects: function(a) {
a = a || {};
var b = [this.bg.getSceneBoundingBox()];
this.personNode && !a.withoutPerson && b.unshift(this.personNode.getSceneBoundingBox());
return b
},
calcIntersection: function(a, b) {
var c = 0, d;
a.forEach(function(e) {
b.forEach(function(f) {
f = cc.rectIntersection(e, f);
var g = 2 < f.width && 2 < f.height ? f.width * f.height : 0;
g > c && (c = g,
d = f)
}, this)
}, this);
if (0 < c)
return {
area: c,
rect: d
}
},
calcMaxDimensions: function() {
var a = this.listRects()
, b = this.listDialogueRects({
withoutPerson: !0
}).reduce(function(e, f) {
return cc.rectUnion(e, f)
})
, c = cc.size()
, d = cc.rectGetCenter(b);
a.forEach(function(e) {
e = cc.rectIntersection(b, e);
var f = cc.rectGetCenter(e)
, g = e.y - b.y + e.height;
f.y > d.y && (g = b.height - e.y - b.y);
var h = e.x - b.x + e.width;
f.x > d.x && (h = b.width - e.x - b.x);
c.width = h > c.width ? h : c.width;
c.height = g > c.height ? g : c.height
});
c.width / b.width < c.height / b.height ? c.height = 0 : c.width = 0;
return cc.size(b.width - c.width, b.height - c.height)
},
defaultSlot: function(a) {
var b = cleverapps.styles.MinimalDialogue;
this.createContent({
person: !0,
maxDimensions: a
});
this.setPositionRound(this.width / 2 + b.default.leftOffset, 2 * cleverapps.resolution.getSceneSize().height / 3);
this.updateOrientation()
},
pickVariant: function(a) {
var b = cc.rectGetCenter(this.targetRect)
, c = cleverapps.scenes.getRunningScene();
this.options.gravitate === DialogueView.GRAVITATE.BOTTOM ? b = cc.p(c.width / 2, 0) : this.options.gravitate === DialogueView.GRAVITATE.TOP && (b = cc.p(c.width / 2, c.height));
c = a.filter(function(d) {
return d.intersection
});
a = a.filter(function(d) {
return !d.intersection
});
return 0 < a.length ? a.sort(function(d, e) {
return cc.pDistance(d.position, b) - cc.pDistance(e.position, b)
})[0] : c[0]
},
calcDynamicPosition: function() {
var a = this.listRects()
, b = [];
this.listAllPositions(a).forEach(function(d) {
this.setPositionRound(d);
var e = this.listDialogueRects();
b.push({
position: d,
dialogueRects: e,
intersection: this.calcIntersection(e, a)
})
}, this);
var c = this.pickVariant(b);
cleverapps.flags.debugMinimalDialogue && (this.debugInfo || (this.debugInfo = new MinimalDialogueDebug(this)),
this.debugInfo.addVariants(b),
this.debugInfo.setPickedVariant(c));
this.setPositionRound(c.position);
this.updateOrientation();
return !c.intersection
},
calcPositionSlots: function(a, b) {
return [{
x: a.x + a.width / 2,
y: a.y + a.height + this.height / 2 + b
}, {
x: a.x + a.width / 2,
y: a.y - this.height / 2 - b
}, {
x: a.x - this.width / 2 - b,
y: a.y + a.height / 2
}, {
x: a.x + a.width + this.width / 2 + b,
y: a.y + a.height / 2
}]
},
showUp: function() {
this.shown || (this.shown = !0,
this.stopAllActions(),
this.bg.stopAllActions(),
this.content.stopAllActions(),
this.bg.setOpacity(0),
this.bg.setVisible(!0),
this.runAction(new cc.Sequence(new cc.DelayTime(void 0 !== this.options.delay ? this.options.delay : .5),new cc.Show,new cc.CallFunc(function() {
var a = "minimal_showup";
this.options.shortAnimations ? (a = "minimal_short_showup",
this.fadeInShowUp()) : this.bubbleShowUp();
this.personAnimation && (this.personAnimation.setVisible(!0),
this.personAnimation.setAnimationAndIdleAfter(a, "talk_minimal"),
this.personBackground.setVisible(!0),
this.personBackground.setAnimationAndIdleAfter(a, "minimal_idle"));
cleverapps.audio.playSound(bundles.dialogues.urls.dialogue_effect)
}
.bind(this)))))
},
fadeInShowUp: function() {
this.setPosition(this.basePosition.x, this.basePosition.y - cleverapps.styles.MinimalDialogue.moveY);
this.runAction((new cc.MoveTo(.3,this.basePosition.x,this.basePosition.y)).easing(cc.easeOut(2)));
this.bg.runAction(new cc.FadeIn(.3))
},
fadeOutHide: function() {
this.runAction((new cc.MoveBy(.3,0,-cleverapps.styles.MinimalDialogue.moveY)).easing(cc.easeIn(2)));
this.bg.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.Hide))
},
bubbleShowUp: function() {
this.bg.setScale(.46);
this.bg.runAction(new cc.Sequence(new cc.DelayTime(.15),(new cc.ScaleTo(.3,1.16,1.26)).easing(cc.easeIn(1)),(new cc.ScaleTo(.2,1)).easing(cc.easeOut(1))));
this.bg.runAction(new cc.Sequence(new cc.DelayTime(.15),new cc.FadeIn(.17)))
},
bubbleHide: function() {
this.bg.runAction(new cc.Sequence(new cc.DelayTime(.13),(new cc.ScaleTo(.17,1.16,1.26)).easing(cc.easeIn(1)),(new cc.ScaleTo(.17,0)).easing(cc.easeOut(1)),new cc.Hide))
},
hide: function(a, b) {
this.shown ? (this.stopAllActions(),
this.bg.stopAllActions(),
this.content.stopAllActions(),
b ? (this.bg.setOpacity(0),
this.bg.setVisible(!1),
this.personBackground && this.personBackground.setVisible(!1),
this.personAnimation && this.personAnimation.setVisible(!1),
this.shown = !1,
a && a()) : (this.options.shortAnimations ? (this.fadeOutHide(),
this.personAnimation && (this.personAnimation.setAnimation(0, "minimal_short_hide", !1),
this.personBackground.setAnimation(0, "minimal_short_hide", !1))) : (this.bubbleHide(),
this.personAnimation && (this.personAnimation.setAnimation(0, "minimal_hide", !1),
this.personBackground.setAnimation(0, "minimal_hide", !1))),
this.personAnimation && this.personAnimation.setCompleteListenerOnce(function() {
this.personAnimation.setVisible(!1);
this.personBackground.setVisible(!1)
}
.bind(this)),
this.runAction(new cc.Sequence(new cc.DelayTime(.6),new cc.CallFunc(function() {
a && a()
}
))),
this.hideCallback = a,
this.shown = !1)) : a && a()
},
remove: function(a, b) {
this.hide(function() {
this.removeFromParent();
a && a()
}
.bind(this), b)
}
});
cleverapps.styles.MinimalDialogue = {
rectsPadding: 10,
rectsPaddingMobile: 5,
targetOffset: {
left: 15,
right: 20,
top: 15,
bottom: 25
},
maxWidth: 1E3,
margin: 10,
moveY: 20,
padding: {
x: 10,
y: 10
},
person: {
x: {
align: "center"
},
y: {
align: "center"
},
margin: 10
},
text: {
maxHeight: 450,
minHeight: 90,
padding: {
top: 35,
bottom: 35,
left: 40,
right: 40
},
verticalPadding: {
top: 25,
bottom: 25,
left: 30,
right: 30
}
},
positions: {
topLower: {
y: 200
},
top: {
y: 100
},
bottom: {
y: 20
}
},
default: {
leftOffset: 80
}
};
if (cleverapps.config.debugMode) {
var MinimalDialogueDebug = function(a) {
a.addCleaner(this.hide.bind(this));
this.minimal = a;
this.rects = a.listRects();
this.variants = [];
this.pickedVariant = void 0
};
MinimalDialogueDebug.prototype.addVariants = function(a) {
this.variants = this.variants.concat(a)
}
;
MinimalDialogueDebug.prototype.setPickedVariant = function(a) {
this.pickedVariant = a
}
;
MinimalDialogueDebug.prototype.show = function() {
this.currentNodes = [];
this.currentStep = this.variants.indexOf(this.pickedVariant);
this.drawCurrentStep();
this.keyboardListener = cc.eventManager.addListener({
event: cc.EventListener.KEYBOARD,
onKeyPressed: function(a) {
a === cc.KEY.right && this.currentStep < this.variants.length - 1 && (this.currentStep++,
this.drawCurrentStep());
a === cc.KEY.left && 0 < this.currentStep && (this.currentStep--,
this.drawCurrentStep())
}
.bind(this)
}, this.minimal)
}
;
MinimalDialogueDebug.prototype.drawCurrentStep = function() {
this.clearCurrentStep();
var a = this.variants[this.currentStep];
this.rects.forEach(function(b) {
this.currentNodes.push(this.drawRect(b, new cc.Color(0,0,255,255)))
}, this);
a.dialogueRects.forEach(function(b) {
var c = a.intersection && a.intersection.rect ? new cc.Color(255,0,0,255) : new cc.Color(0,255,0,255);
this.currentNodes.push(this.drawRect(b, c))
}, this);
a.intersection && a.intersection.rect && this.currentNodes.push(this.drawRect(a.intersection.rect, new cc.Color(255,0,0,255), new cc.Color(255,0,0,255)))
}
;
MinimalDialogueDebug.prototype.clearCurrentStep = function() {
this.currentNodes.forEach(function(a) {
a.removeFromParent()
});
this.currentNodes = []
}
;
MinimalDialogueDebug.prototype.drawRect = function(a, b, c) {
c = c || new cc.Color(0,0,0,0);
var d = new cc.DrawNode;
d.setAnchorPoint(0, 0);
d.setContentSize2(a.width, a.height);
d.setPositionRound(a.x, a.y);
d.drawRect(cc.p(0, 0), cc.p(a.width, a.height), c, 3, b);
d.setLocalZOrder(1E3);
cleverapps.scenes.getRunningScene().addChild(d);
return d
}
;
MinimalDialogueDebug.prototype.hide = function() {
cc.eventManager.removeListener(this.keyboardListener);
delete this.keyboardListener;
this.clearCurrentStep()
}
}
;var ShopUserGoldView = MinimalDialogue.extend({
ctor: function() {
this._super({
items: this.listItems()
});
cleverapps.scenes.getRunningScene().addChild(this);
this.display();
this.setupChildren()
},
setupChildren: function() {
this.setPositionRound(cleverapps.styles.ShopUserGoldView)
},
listItems: function() {
var a = [this.createGoldBlock()]
, b = ShopUserGoldView.ListBoosters();
0 < b.length && a.push(this.createBoostersBlock(b));
return a
},
createGoldBlock: function() {
var a = cleverapps.UI.generateOnlyText("YouHaveAmount", cleverapps.styles.FONTS.SHOP_USER_GOLD_TEXT);
if ("match3" !== cleverapps.config.type || !cleverapps.environment.isGameScene())
return a;
var b = cleverapps.styles.ShopUserGoldView
, c = this.createItem(levels.user.gold, RewardTypes.hard.getSmallIcon(), b.items.gold);
return new cleverapps.Layout([a, c],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.textNode.goldItemsMargin
})
},
createBoostersBlock: function(a) {
var b = cleverapps.styles.ShopUserGoldView;
a = a.map(function(c) {
return this.createItem(c.getAmount(), RewardTypes.boosters.getSmallIcon(c), b.items.boosters)
}
.bind(this));
return new cleverapps.WrapGridLayout(a,{
direction: cleverapps.UI.HORIZONTAL,
columns: 3,
margin: b.textNode.boostersItemsMargin,
align: {
x: cleverapps.GridLayout.ALIGN_CENTER
}
})
},
createItem: function(a, b, c) {
var d = cleverapps.styles.ShopUserGoldView;
a = cleverapps.UI.generateImageText(cleverapps.formatAmount(a), cleverapps.styles.FONTS.SHOP_USER_GOLD_TEXT);
b = new cc.Sprite(b);
b.y += c.dy || 0;
return new cleverapps.Layout([a, b],{
direction: cleverapps.UI.HORIZONTAL,
margin: d.items.margin
})
},
getPreferredBundles: function() {
return ["tile_shop"]
}
});
ShopUserGoldView.ListBoosters = function() {
return -1 !== ["differences", "match3"].indexOf(cleverapps.config.type) ? cleverapps.boosters.listAll() : cleverapps.boosters.listBoostersBefore()
}
;
ShopUserGoldView.IsAvailable = function() {
return cleverapps.user.checkAvailable(cleverapps.config.features.includes("boosters_before") && WindowBoostersBefore.AVAILABLE, {
ignoreProgress: !0
}) && ShopUserGoldView.ListBoosters().length
}
;
cleverapps.styles.ShopUserGoldView = {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 10
},
textNode: {
margin: 10,
goldItemsMargin: 10,
boostersItemsMargin: {
x: 15,
y: 15
}
},
items: {
margin: 5,
gold: {
dy: 5
},
boosters: {
dy: 5
}
}
};
var RewardGoldView = cc.Node.extend({
ctor: function() {
this._super();
this.setAnchorPoint(.5, .5);
this.createBackground();
this.updateSize();
this.icon = this.createIcon();
this.text = this.createText();
Game.currentGame.on("rewardHard", this.createListener(this.runCollectAnimation.bind(this)));
cleverapps.tooltipManager.create(this, {
text: "RewardGoldTooltip",
location: cleverapps.UI.Tooltip.LOCATION_BELOW
});
cleverapps.aims.registerTarget("rewardHard", this, {
controls: "rewardElementGold",
toggle: this.createListener(function(a, b) {
this.aimVisible = a;
this.toggle(this.controlsVisible, b)
}
.bind(this)),
flyingUnderShadow: !0
});
this.setPositionRound(cleverapps.styles.RewardGoldView);
this.setupChildren()
},
toggle: function(a, b) {
this.controlsVisible = a;
this.aimVisible || cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL || (a = !1);
a ? this.show && this.show(b) : this.hide && this.hide(b)
},
updateSize: function() {
var a = cleverapps.styles.CloversView;
this.setContentSize2(a);
this.background.setContentSize2(a);
this.toggle(this.controlsVisible, !0)
},
setupChildren: function() {
var a = cleverapps.styles.RewardGoldView;
this.icon.setPositionRound(a.icon);
this.background.setPositionRound(this.width / 2, this.height / 2);
this.text.setPositionRound(a.text)
},
createBackground: function() {
var a = this.background = cleverapps.UI.createScale9Sprite(bundles.reward_element.frames.reward_element_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
this.addChild(a);
return a
},
createIcon: function() {
var a = new cleverapps.Spine(bundles.card.jsons.marks_json);
a.setAnimation(0, "coin_idle_counter", !0);
this.addChild(a);
return a
},
createText: function() {
var a = cleverapps.UI.generateImageText(Game.currentGame.rewards[GameBase.REWARD_HARD], cleverapps.styles.FONTS.HARD_REWARD_TEXT);
a.fitTo(cleverapps.styles.RewardGoldView.text.width);
this.addChild(a);
return a
},
runCollectAnimation: function() {
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.PlaySound(bundles.reward_element.urls.reward_gold_effect),new cc.ScaleTo(.15,1.1),new cc.CallFunc(function() {
this.text.setString(Game.currentGame.rewards[GameBase.REWARD_HARD]);
this.text.fitTo(cleverapps.styles.RewardGoldView.text.width)
}
.bind(this)),new cc.ScaleTo(.15,1)))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
HARD_REWARD_TEXT: {
name: "default",
size: 40
}
});
cleverapps.styles.RewardGoldView = {
width: 150,
height: 61,
x: {
align: "left",
dx: 60
},
y: {
align: "top",
dy: -150
},
icon: {
x: 20,
y: 40
},
text: {
x: {
align: "center",
dx: 20
},
y: {
align: "center",
dy: 2
},
width: 70
}
};
var HorizontalBlockerNode = cc.Node.extend({
ctor: function(a) {
this._super();
this.node = a;
a = cleverapps.clone(this.node.alignment, !0);
cleverapps.toArray(a).forEach(function(b) {
b.x = cleverapps.styles.HorizontalBlockerNode.x
});
this.updateSize();
this.setPositionRound(a)
},
updateSize: function() {
var a = cleverapps.resolution.getSceneSize();
this.setContentSize(a.width, this.node.height)
}
});
cleverapps.styles.HorizontalBlockerNode = {
x: {
align: "left"
}
};
var BaseMiniGame = function() {
cleverapps.EventEmitter.call(this);
this.running = !0;
this.paused = !1
};
BaseMiniGame.prototype = Object.create(cleverapps.EventEmitter.prototype);
BaseMiniGame.prototype.constructor = BaseMiniGame;
BaseMiniGame.prototype.pause = function() {
this.paused = !0
}
;
BaseMiniGame.prototype.resume = function() {
this.paused = !1;
this.trigger("resumed")
}
;
BaseMiniGame.prototype.getName = function() {
return ""
}
;
BaseMiniGame.prototype.finish = function(a) {
a = a || {};
this.running && (this.running = !1,
this.trigger("finish", a),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MINIGAME_FINISH + "_" + this.getName()),
cleverapps.playSession.set(cleverapps.EVENTS.MINIGAME_FINISH + "_" + this.getName(), !0))
}
;
var MissionIcon = function(a) {
var b = Missions[a.type].sideBarJson
, c = ["mission" + a.type];
a.logic && a.logic.getTargets && c.concat(a.logic.getTargets());
SideBarIcon.call(this, {
animation: b,
targets: c,
progressIconJson: Missions[a.type].sideBarProgressIconJson,
control: a.name + "MissionIcon"
});
this.mission = a;
this.resetState()
};
MissionIcon.prototype = Object.create(SideBarIcon.prototype);
MissionIcon.prototype.constructor = MissionIcon;
MissionIcon.prototype.resetState = function() {
if (this.available = MissionManager.hasProperParent(this.mission) && !cleverapps.config.editorMode && this.mission.isAvailable())
this.setLocked(!1),
this.setAttention(this.isAttentionRequired()),
this.mission.isCompleted() ? (this.setLeftTime(0),
this.setTitle("Finished")) : (this.setLeftTime(this.mission.getTimeLeft()),
this.setTitle(void 0))
}
;
MissionIcon.prototype.getLockedTipData = function() {
if (Missions[this.mission.type].available)
return cleverapps.humanReadableNumber({
floatLevel: Missions[this.mission.type].available.level
})
}
;
MissionIcon.prototype.isAttentionRequired = function() {
return this.mission.isMinigameMission() ? this.mission.canPlayMinigame() : this.mission.needReview ? !0 : this.mission.logic && this.mission.logic.isAttentionRequired ? this.mission.logic.isAttentionRequired() : this.mission.runningCompetition && this.mission.runningCompetition.hasPlaceChanged() ? !0 : this.mission.type === Mission.TYPE_BONUS_WORLD
}
;
MissionIcon.prototype.getForce = function() {
return this.mission.iconForce
}
;
MissionIcon.prototype.onPressed = function() {
var a = [];
this.mission.logic && this.mission.logic.getControls && a.push(this.mission.logic.getControls());
cleverapps.focusManager.display({
focus: this.mission.name + "MissionIconClicked",
control: a,
action: function(b) {
if (this.mission.isRunning()) {
var c = new (this.mission.getViewClass())(this.mission);
this.mission.needShowStartWindow = !1;
c instanceof cleverapps.FixedWidthScene ? cleverapps.scenes.replaceScene(c, b) : cleverapps.focusManager.onceNoWindowsListener = b
} else
this.mission.displayCompleted(b)
}
.bind(this)
})
}
;
var MissionWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
var b = cleverapps.styles.MissionWindow;
this.mission = a;
if (this.wasFinished = !this.mission.isRunning())
this.prize = this.mission.getPrize();
this.content = this.createContent();
SceneDecors.add(this.content, cleverapps.skins.getSlot("missionWindowDecors"));
this.mission.onChangeResults = this.createListener(function() {
var c = this.mission.getResults();
this.tableView.updateResults(c);
cleverapps.missionManager.table.updateResults(this.mission.type, c)
}
.bind(this));
this._super({
title: {
text: "Missions." + a.getName() + ".Title",
font: cleverapps.skins.getSlot("missionWindowTitleFont")
},
name: " missionwindow",
content: this.content,
button: {
width: b.button.width,
height: b.button.height,
text: this.getButtonText(),
type: b.button.type,
onPressed: this.onButtonPressed.bind(this)
},
help: this.wasFinished ? void 0 : function() {
GuideWindow.createMissionRulesWindow(a)
}
,
styles: b.window
})
},
onButtonPressed: function() {
this.close();
this.wasFinished || cleverapps.focusManager.distract({
focus: "MissionPlayButtonPressed",
action: function(a) {
cleverapps.meta.wantsToPlay(a)
}
})
},
getButtonText: function() {
return this.wasFinished ? Messages.get(this.prize ? "ClaimPrize.Button.text" : "OK") : Messages.get("Play").toUpperCase()
},
createContent: function() {
var a = cleverapps.styles.MissionWindow;
this.tableView = this.createTable();
var b = [this.createTextAndTimer()];
if (a.animationBlock) {
var c = this.createAnimationBlock(this.tableView.width);
b.push(c)
}
b.push(this.tableView);
return new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
},
createTable: function() {
var a = cleverapps.styles.MissionWindow;
return cleverapps.missionManager.table.createTableView({
id: this.mission.type,
data: this.mission.getResults(),
dataIcon: MissionWindow.getTableRowIcon(this.mission.type),
height: a.table.height,
rowConstructor: cleverapps.MissionRow,
rowOptions: {
mission: this.mission
}
})
},
createTextAndTimer: function() {
var a = [cleverapps.UI.generateOnlyText(this.mission.isRunning() ? "Missions.windowRunning" : "Missions.windowFinished", cleverapps.styles.FONTS.WINDOW_TEXT)];
if (this.mission.isRunning()) {
var b = this.createTimer();
a.push(b)
}
return new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL
})
},
createTimer: function() {
var a = cleverapps.styles.MissionWindow
, b = this.mission.getTimeLeft();
0 < b && (b = new cleverapps.CountDown(b,{
onFinish: function() {
if (this.onFinishedSound && "function" === typeof this.onFinishedSound)
this.onFinishedSound(!0);
this.close()
}
.bind(this)
}));
return new cleverapps.CountDownView(b,{
font: cleverapps.styles.FONTS.MISSION_WINDOW_COUNTDOWN_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT,
background: a.timerBackground && {
frame: a.timerBackground
}
})
},
createAnimationBlock: function(a) {
var b = cleverapps.styles.MissionWindow.animationBlock
, c = bundles[this.mission.getWindowBundleName()]
, d = new cc.Scale9Sprite(bundles.table.frames.table_bg_png);
d.setContentSize2(a, b.height);
var e;
this.wasFinished && (e = this.prize ? "Win" : "Lose");
a = "Missions.CommonText";
e && (a = "Missions." + this.mission.getName() + ".AnimationMainText" + e);
e = ["Missions." + this.mission.getName() + ".AnimationMainTextInfo0", "Missions." + this.mission.getName() + ".AnimationMainTextInfo1", a].filter(Messages.has);
this.autoScrollText = new AutoScrollText(e,{
width: b.autoScrollText.width,
height: b.autoScrollText.height,
font: cleverapps.styles.FONTS.WHITE_TEXT
});
d.addChild(this.autoScrollText);
this.autoScrollText.setPositionRound(b.autoScrollText);
e = new cc.Node;
e.setContentSize2(b.width, b.height);
e.setAnchorPoint(0, 0);
c = new cleverapps.Spine(c.jsons.json);
c.setAnimation(0, "finish", !0);
c.setPositionRound(e.width / 2, e.height / 2);
e.addChild(c);
d.addChild(e);
e.setPositionRound(b);
return d
},
onFinishedSound: function(a) {
a && this.mission && !this.mission.finishTimeSoundPlayed && cleverapps.windows.currentWindow() === this && (this.mission.finishTimeSoundPlayed = !0,
cleverapps.audio.playSound(bundles.main.urls.mission_finish_effect))
},
onShow: function() {
this._super();
if (this.onFinishedSound && "function" === typeof this.onFinishedSound)
this.onFinishedSound(this.wasFinished);
this.autoScrollText && (this.autoScrollText.setTextByIndex(0),
this.autoScrollText.reinitTimer())
},
onClose: function() {
this.mission.runningCompetition && (this.mission.runningCompetition.updateShownPlace(),
this.mission.updateMissionIcon())
}
});
MissionWindow.prototype.listBundles = function(a) {
var b = [];
(a = a.getWindowBundleName()) && b.push(a);
return b
}
;
cleverapps.styles.MissionWindow = {
margin: 20,
button: {
width: 260,
height: 100,
type: cleverapps.styles.UI.Button.Images.button_red
},
table: {
height: 725
}
};
MissionWindow.getTableRowIcon = function(a) {
var b = cleverapps.skins.getSlot("missionTableRowIcon", {
type: a
});
if (!b)
switch (Mission.GetChildType(a)) {
case Mission.TYPE_LETTER:
return bundles.tablerow_icons.frames.letter_mission;
case Mission.TYPE_RAINBOW:
return bundles.tablerow_icons.frames.combo;
case Mission.TYPE_COLLECT_MARK:
return bundles.tablerow_icons.frames.collect_mark;
case Mission.TYPE_BURN_NEARBY:
return bundles.tablerow_icons.frames.burn_nearby;
case Mission.TYPE_EXPEDITION_FEAST:
case Mission.TYPE_LIVESFEAST:
return bundles.tablerow_icons.frames.feast_energy;
case Mission.TYPE_SOFTFEAST:
return bundles.tablerow_icons.frames.feast_coin;
case Mission.TYPE_KRAKENFEAST:
return bundles.tablerow_icons.frames.feast_tentacle
}
return b
}
;
var ReplaceOldMissionWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.missionData = Missions[a];
this._super({
title: "ReplaceOldMissionWindow.title",
name: "ReplaceOldMissionWindow",
content: this.createContent(),
buttons: this.createButtons(),
closeButton: !1,
notCloseByTouchInShadow: !0
})
},
getPerson: function() {
return {
role: "king",
emotion: "happy"
}
},
createContent: function() {
var a = cleverapps.styles.ReplaceOldMissionWindow
, b = new cc.Sprite(bundles.replaceoldmissionwindow.urls.banner)
, c = ["TravelBook.title." + this.missionData.id, "Missions." + this.missionData.name + ".Title"].find(function(d) {
return Messages.has(d)
});
c = cleverapps.UI.generateOnlyText("ReplaceOldMissionWindow.text", cleverapps.styles.FONTS.REPLACE_OLD_MISSION_WINDOW_TEXT, {
name: Messages.get(c)
});
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setDimensions(b.width, 0);
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createButtons: function() {
var a = cleverapps.styles.ReplaceOldMissionWindow.button;
return [new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.button_green,
text: "ReplaceOldMissionWindow.restart",
onClicked: this.close.bind(this),
width: a.width,
height: a.height
})]
},
listBundles: function() {
return ["replaceoldmissionwindow"]
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
REPLACE_OLD_MISSION_WINDOW_TEXT: {
name: "nostroke",
size: 35,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR
}
});
cleverapps.styles.ReplaceOldMissionWindow = {
margin: 20,
button: {
width: 300,
height: 100
}
};
var MissionAnimationView = cc.Node.extend({
ctor: function(a) {
this._super();
this.usePool = !0;
var b = this.clover = new cc.Sprite(this.getIcon(a));
b.setScale(cleverapps.styles.MissionAnimationView.scale);
this.addChild(b);
this.setLocalZOrder(100);
this.setCascadeOpacityEnabled(!0);
this.initialize(a)
},
initialize: function(a) {
this.getFieldAlgorithm()(this, a)
},
reuse: function(a) {
this.stopListeners = !1;
this.initialize(a)
},
remove: function() {
this.usePool ? cc.pool.putInPool(this) : this.unuse()
},
unuse: function() {
this.removeFromParent()
}
})
, MissionAnimationCloverView = MissionAnimationView.extend({
getIcon: function() {
return bundles.tournament_icon.frames.fly_clover_png
},
getFieldAlgorithm: function() {
return MissionAnimationView.SimpleFlyAlgorithm
}
})
, MissionAnimationRoseView = MissionAnimationView.extend({
getIcon: function(a) {
return a.icon ? a.icon : cleverapps.skins.getSlot("missionMarkIcon", {
type: Mission.TYPE_COLLECT_MARK
})
},
getFieldAlgorithm: function() {
return MissionAnimationView.flyToAlgorithm
},
reuse: function(a) {
this._super(a);
this.clover.setSpriteFrame(this.getIcon(a))
}
})
, MissionAnimationTulpanView = MissionAnimationView.extend({
getIcon: function() {
return cleverapps.skins.getSlot("missionIcon", {
type: Mission.TYPE_BURN_NEARBY
})
},
getFieldAlgorithm: function() {
return MissionAnimationView.flyToAlgorithm
}
});
MissionAnimationView.flyToAlgorithm = function(a, b) {
var c = cleverapps.styles.MissionAnimationView
, d = c.upY
, e = b.beginPos
, f = b.targetPos;
a.setPosition(e);
e.y += d;
a.setScale(b.beginScale);
a.setOpacity(255);
var g = cc.p(f.x, f.y + c.flyTo.second.y);
g = [cc.p((e.x + g.x) / 2, (e.y + g.y) / 2 + c.flyTo.first.y), g, f];
var h = Math.abs(f.x - e.x);
e = Math.abs(f.y - e.y) + c.flyTo.first.y + c.flyTo.second.y;
e = Math.sqrt(h * h + e * e);
e /= c.flySpeed;
b.targetScale || (b.targetScale = b.beginScale);
b.finalScale || (b.finalScale = b.targetScale);
a.runAction(new cc.Sequence(new cc.Spawn(new cc.ScaleTo(.3,b.targetScale),new cc.MoveBy(.3,cc.p(0, d))),new cc.Spawn(new cc.ScaleTo(e,b.finalScale),(new cc.BezierTo(e,g)).easing(cc.easeIn(1))),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.game.urls.cell_collect_effect, {
throttle: 20
});
a.remove();
b.callback && b.callback()
}
)))
}
;
MissionAnimationView.SimpleFlyAlgorithm = function(a, b) {
var c = b.beginPos;
a.setPosition(c);
a.setScale(0);
a.setOpacity(255);
var d = cleverapps.styles.MissionAnimationView.bezierLength
, e = Math.random() * d;
e < d / 2 && (e -= d);
var f = cc.p(c.x + e, c.y - 2 * d)
, g = cc.p(f.x, f.y + d);
c = [cc.p(c.x, c.y + d * (1.5 + .5 * Math.random())), g, f];
d = .2;
3 < d * b.amount && (d = 3 / b.amount);
a.runAction(new cc.Sequence(new cc.DelayTime(b.id * d),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.game.urls.boom_effect, {
throttle: 20
})
}
),new cc.Spawn(new cc.ScaleTo(.3,.8),new cc.BezierTo(2,c),new cc.RotateBy(2,0 > e ? -360 : 360),new cc.Sequence(new cc.DelayTime(1.5),new cc.FadeOut(.5))),new cc.CallFunc(function() {
a.remove()
}
)))
}
;
MissionAnimationCloverView.factory = function(a) {
return cc.pool.hasObject(MissionAnimationCloverView) ? cc.pool.getFromPool(MissionAnimationCloverView, a) : new MissionAnimationCloverView(a)
}
;
MissionAnimationRoseView.factory = function(a) {
return cc.pool.hasObject(MissionAnimationRoseView) ? cc.pool.getFromPool(MissionAnimationRoseView, a) : new MissionAnimationRoseView(a)
}
;
MissionAnimationTulpanView.factory = function(a) {
return cc.pool.hasObject(MissionAnimationTulpanView) ? cc.pool.getFromPool(MissionAnimationTulpanView, a) : new MissionAnimationTulpanView(a)
}
;
MissionAnimationView.show = function(a, b, c) {
c.amount || (c.amount = 1);
for (var d = 0; d < c.amount; d++)
switch (c.id = d,
a) {
case Mission.TYPE_RAINBOW:
b.addChild(MissionAnimationCloverView.factory(c));
break;
case Mission.TYPE_COLLECT_MARK:
b.addChild(MissionAnimationRoseView.factory(c));
break;
case Mission.TYPE_BURN_NEARBY:
b.addChild(MissionAnimationTulpanView.factory(c))
}
}
;
cleverapps.styles.MissionAnimationView = {
bezierLength: 250,
flySpeed: 1500,
upY: 100,
flyTo: {
first: {
y: 300
},
second: {
y: 300
}
},
scale: 1
};
var CloversView = cc.Node.extend({
avoidView: "CloversView",
ctor: function() {
this._super();
this.mission = Game.currentGame.secondaryMission;
this.setLocalZOrder(10);
this.withinInfoPanel = "match3" === cleverapps.config.type && -1 !== ["riddles", "heroes"].indexOf(cleverapps.config.name);
this.setAnchorPoint(.5, .5);
this.background = this.createBackground();
this.updateSize();
this.setPositionRound(cleverapps.styles.CloversView.position);
this.icon = this.createIcon();
this.text = this.createText();
Game.currentGame.on("rewardClover", this.createListener(this.runCollectAnimation.bind(this)));
Game.currentGame.on("updateCloversTarget", this.createListener(function() {
this.text.setString(this.getTextString())
}
.bind(this)));
cleverapps.tooltipManager.create(this, {
text: "CloversTooltip",
location: "runes" === cleverapps.config.name ? cleverapps.UI.Tooltip.LOCATION_ABOVE : cleverapps.UI.Tooltip.LOCATION_BELOW,
control: "cloversViewTooltip"
});
cleverapps.aims.registerTarget("mission_reward" + this.mission.type, this.icon, {
flyingUnderShadow: !0,
controls: ["rewardElementClover"]
});
var a = cleverapps.styles.CloversView;
this.icon.setPositionRound(a.icon);
this.text.setPositionRound(a.text)
},
completeAnimationOnResize: function() {
this.stopAllActions()
},
updateSize: function() {
var a = cleverapps.styles.CloversView;
this.setContentSize2(a);
this.background.setContentSize2(a)
},
createBackground: function() {
var a = cleverapps.UI.createScale9Sprite(bundles.reward_element.frames.reward_element_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
a.setAnchorPoint(0, 0);
this.addChild(a);
return a
},
createIcon: function() {
var a = cleverapps.styles.CloversView
, b = new cc.Sprite(this.mission.getIcon());
this.addChild(b);
cleverapps.UI.fitToBox(b, a.icon);
b.baseScale = b.scale;
return b
},
createText: function() {
var a = cleverapps.styles.CloversView
, b = this.text = cleverapps.UI.generateImageText(this.getTextString(), cleverapps.styles.FONTS.CLOVERS_TEXT);
this.addChild(b);
b.setPositionRound(a.text);
return b
},
getTextString: function() {
var a = Game.currentGame.rewards[GameBase.REWARD_SECONDARY];
return ["differences"].includes(cleverapps.config.type) && 0 < Game.currentGame.clovers.length ? a + "/" + Game.currentGame.clovers.length : ["tile3"].includes(cleverapps.config.type) && 0 < Game.currentGame.clovers ? a + "/" + Game.currentGame.clovers : a
},
getSparksColor: function() {
return "blocks" === cleverapps.config.type ? "pink" : "yellow"
},
runCollectAnimation: function() {
this.stopAllActions();
if (this.mission.type === Mission.TYPE_RAINBOW && "heroes" !== cleverapps.config.name)
this.rotateAnimation();
else {
var a = cleverapps.styles.CloversView;
this.icon.runAction(new cc.Sequence(new cc.CallFunc(function() {
if (["board", "blocks"].includes(cleverapps.config.type)) {
var b = new cleverapps.Spine(bundles.menubar.jsons.sparks_json);
b.setSkin(this.getSparksColor());
b.setAnimation(0, "single", !1);
b.setCompleteListenerRemove();
this.addChild(b, 0);
b.setPositionRound(this.icon.getPositionX() + a.sparks.x, this.icon.getPositionY() + a.sparks.y)
}
}
.bind(this)),new cc.PlaySound(bundles.game.urls.tournament_element_collected),new cc.ScaleTo(.15,1.1 * this.icon.baseScale),new cc.CallFunc(function() {
this.text.setString(this.getTextString())
}
.bind(this)),new cc.ScaleTo(.15,this.icon.baseScale)))
}
},
rotateAnimation: function() {
this.text.setString(this.getTextString());
0 === this.icon.getRotation() && (this.icon.setScale(this.icon.baseScale),
this.icon.runAction(new cc.Sequence(new cc.Spawn(new cc.Sequence(new cc.ScaleTo(.2,1.2 * this.icon.baseScale),new cc.ScaleTo(.2,this.icon.baseScale)),new cc.RotateBy(.4,360)),new cc.CallFunc(function() {
this.icon.setRotation(0)
}
,this))));
this.text.stopAllActions();
this.text.runAction(new cc.Sequence(new cc.PlaySound(bundles.main.urls.tournament_element_collected),new cc.ScaleTo(.2,1.5),new cc.ScaleTo(.2,1)))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CLOVERS_TEXT: {
name: "default",
size: 40
}
});
cleverapps.styles.CloversView = {
width: 150,
height: 61,
position: [{
x: {
align: "left",
dx: 40
},
y: {
align: "top",
dy: -150
}
}, {
x: {
align: "left",
dx: 236
},
y: {
align: "top",
dy: -150
}
}, {
x: {
align: "left",
dx: 250
},
y: {
align: "top",
dy: -150
}
}],
icon: {
x: {
align: "center"
},
y: {
align: "center"
},
width: 100,
height: 100
},
text: {
x: {
align: "center",
dx: 20
},
y: {
align: "center"
}
},
sparks: {
x: 0,
y: 0
}
};
var MainScene = cleverapps.FixedWidthScene.extend({
onSceneLoaded: function() {
this._super(cleverapps.Environment.SCENE_MAIN);
"undefined" === typeof FlyingAdView || cleverapps.config.wysiwygMode || this.addChild(new FlyingAdView);
cleverapps.environment.levelNo = levels.user.level;
cleverapps.environment.episodeNo = levels.user.episode;
cleverapps.placements.run(Placements.INTERMEDIATE)
},
_closeAction: function() {
cleverapps.administrator && cleverapps.administrator.adminLocations && AdminLocationsScene.IsAvailable() ? AdminLocationsScene.open() : cleverapps.administrator && AdministratorScene.IsAvailable() ? (cleverapps.flags.norest = !1,
cleverapps.dataLoader.setAlerted(!1),
connector.dataLoader.setEnabled(!0),
cleverapps.dataLoader.setEnabled(!0),
cleverapps.setRestDummies(!1),
AdministratorScene.open()) : cleverapps.config.wysiwygMode ? (cleverapps.config.editorMode = !1,
WysiwygScene.open(cleverapps.wysiwyg)) : connector.platform.hasCloseApplication() && cleverapps.focusManager.display({
focus: "ConfirmExitWindow",
action: function(a) {
new ConfirmExitWindow({
action: function() {
connector.platform.closeApplication()
}
});
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
});
var MethaHelper = {
start: function(a, b) {
cleverapps.isLevels() && b.episodeNo >= levels.user.getEpisodesAmount() ? a() : !LevelStartWindow.isAvailable(b) || cleverapps.config.features.includes("boosters_before") && !WindowBoostersBefore.isAvailable() ? b.play(a) : (cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem"),
b.building ? new BuildingStartWindow({
building: b.building,
level: b
}) : new LevelStartWindow(b.getStartWindowOptions()),
cleverapps.focusManager.onceNoWindowsListener = a)
},
getCurrentLevel: function(a) {
if (cleverapps.meta.getType() === Meta.FARM) {
var b = a.label;
cleverapps.playButton.disableIncLevel();
if (void 0 === b || b.episodeNo >= levels.user.getEpisodesAmount())
b = cleverapps.farm.chooseNextLevel(),
b = {
episodeNo: b.episodeNo,
levelNo: b.levelNo
};
a.label !== b && (a.label = b,
cleverapps.farm.save());
cleverapps.playButton.enableIncLevel();
b = MethaHelper.getLevel(b.episodeNo, b.levelNo);
b.building = a;
return b
}
return cleverapps.isKnockoutGame() ? cleverapps.meta.knockoutGame.getNextLevel() : cleverapps.user.getCurrentLevel()
},
getLevel: function(a, b) {
return new Level(a,b)
}
};
var AllDoneWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this._super({
title: "AllDoneWindow.title",
name: "alldonewindow",
content: this.getContent(),
button: {
width: cleverapps.styles.AllDoneWindow.button.width,
height: cleverapps.styles.AllDoneWindow.button.height,
text: "Play",
onPressed: function() {
this.close();
cleverapps.focusManager.distract({
focus: "PlayButton",
action: function(a) {
cleverapps.meta.wantsToPlay(a)
}
})
}
.bind(this)
}
});
AllDoneWindow.showed = !0
},
getPerson: function() {
return {
role: "hero",
emotion: "happy"
}
},
getContent: function() {
return this.getText()
},
getText: function() {
var a = cleverapps.styles.AllDoneWindow
, b = cleverapps.UI.generateOnlyText("AllDoneWindow.text", cleverapps.styles.FONTS.WINDOW_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.text.width, 0);
b.fitTo(void 0, a.text.height);
return b
}
});
cleverapps.styles.AllDoneWindow = {
text: {
width: 550,
height: 400
},
button: {
width: 300,
height: 100
}
};
var WorldMap = MapScrollView.extend({
ctor: function() {
this._super();
this.setContentSize2(cleverapps.resolution.getBgSize());
var a = cc.loader.getRes(bundles.world_map.jsons.mapData);
var b = {
width: a.map.width * resolutionScale,
height: a.map.height * resolutionScale
};
this.setContainerSize(b);
if (bundles.world_map.urls.map) {
var c = new cc.Sprite(bundles.world_map.urls.map);
c.setScale(b.width / c.width);
c.setPositionRound(this.innerWidth / 2, this.innerHeight / 2);
this.container.addChild(c)
}
this.addBgs(a);
this.buildingViews = {};
this.setZoom(cleverapps.styles.WorldMap.zoom.unfocused);
this.animateNewTask = function() {}
},
updateSize: function() {
this.setContentSize2(cleverapps.resolution.getBgSize());
this.setZoom(this.zoom);
this.updateChildren()
},
addBgs: function(a) {
for (var b = 0; 30 >= b; b++) {
var c;
cleverapps.meta.getType() === Meta.FARM ? c = bundles.metha_top_layer_0.jsons["map_json" + b] : cleverapps.meta.getType() === Meta.HOMEFIX && (c = bundles.world_map.jsons[cleverapps.home.getMapJson(b)] || bundles.world_map_nodither.jsons[cleverapps.home.getMapJson(b)]);
if (c) {
var d = new cleverapps.Spine(c);
d.setAnimation(0, "animation", !0);
if (a["map_json" + b]) {
var e = a["map_json" + b]
, f = new cc.Node;
f.setAnchorPoint(.5, .5);
f.setContentSize2(e.width * resolutionScale, e.height * resolutionScale);
d.setPosition(f.width / 2, f.height / 2);
f.addChild(d);
f.setPosition(this.innerWidth / 2 + e.x * resolutionScale, this.innerHeight / 2 + e.y * resolutionScale);
this.container.addChild(f, e.zOrder)
} else
d.setPosition(this.innerWidth / 2, this.innerHeight / 2),
this.container.addChild(d)
}
}
},
highlight: function(a) {
a.addHighlight()
},
unhighlight: function(a) {
a.removeHighlight()
},
onEnter: function() {
this._super();
cleverapps.config.debugMode && cc.eventManager.addListener({
event: cc.EventListener.KEYBOARD,
onKeyPressed: function(a) {
if (a === cc.KEY.b && !this.bordered) {
this.bordered = !0;
for (var b in this.buildingViews) {
this.buildingViews[b].debugBorder();
var c = this.buildingViews[b].building.id;
a = this.buildingViews[b].building.amountStages();
if (cleverapps.meta.getType() === Meta.HOMEFIX)
for (var d = cleverapps.meta.getMainObject().getFurniture(), e = 0; e < d.length; e++)
if (d[e].id === this.buildingViews[b].building.id) {
c = e;
break
}
c = cleverapps.UI.generateImageText(c, cleverapps.styles.FONTS.WINDOW_TEXT);
a = cleverapps.UI.generateOnlyText("Stages: " + a, cleverapps.styles.FONTS.TEXT);
a = new cleverapps.Layout([c, a],{
direction: cleverapps.UI.VERTICAL,
margin: 0
});
this.buildingViews[b].addChild(a, 10);
a.setPositionRound(this.buildingViews[b].width / 2, this.buildingViews[b].height / 2);
a.replaceParentSamePlace(this.buildingViews[b].parent);
this.buildingViews[b].idView = a
}
}
}
.bind(this),
onKeyReleased: function(a) {
if (a === cc.KEY.b) {
this.bordered = !1;
for (var b in this.buildingViews)
this.buildingViews[b].cleanupBorder(),
this.buildingViews[b].idView.removeFromParent()
}
}
.bind(this)
}, this)
},
availableScrollPosition: function(a) {
var b = this.getContainerSize()
, c = b.width - this.width;
b = b.height - this.height;
0 < a.x ? a.x = 0 : a.x < -c && (a.x = -c);
0 < a.y ? a.y = 0 : a.y < -b && (a.y = -b);
return a
},
scrollTo: function(a, b, c) {
if (a) {
b || cleverapps.focusManager.isFocused() || (console.log("Scroll:", a),
cleverapps.focusManager.debugMessage("Trying to scroll without user focus!"));
var d = cleverapps.focusManager.focus
, e = this.buildingViews[a.name].getPosition();
e = {
x: this.width / 2 - e.x,
y: this.height / 2 - e.y
};
e = this.availableScrollPosition(e);
if (b)
this.setContainerPosition({
x: e.x,
y: e.y
}),
c && c();
else {
b = this.getContainerPosition();
b.x -= e.x;
b.y -= e.y;
b = Math.min(.7, Math.max(.3, Math.sqrt(b.x * b.x + b.y * b.y) / 1300));
this.container.stopAllActions();
this.container.runAction(new cc.Spawn((new cc.MoveTo(b,e.x,e.y)).easing(cc.easeInOut(2.5)),new cc.Repeat(new cc.Sequence(new cc.DelayTime(.025),new cc.CallFunc(this.updateChildren.bind(this))),Math.ceil(b / .025))));
var f = Error();
this.runAction(new cc.Sequence(new cc.DelayTime(.45 * b || .5),new cc.CallFunc(function() {
cleverapps.focusManager.isFocused() && cleverapps.focusManager.focus === d || (console.log("Scroll:", a, d, cleverapps.focusManager.focus),
cleverapps.throwAsync("Trying to scroll without user focus! Focus: " + cleverapps.focusManager.focus + " StartFocus: " + d, f));
c && c()
}
)))
}
}
},
showBuildings: function(a) {
var b = [];
a.forEach(function(c, d) {
c.isComplete() && c.throwaway || b.push(d)
});
b.sort(function(c, d) {
return a[d].y - a[c].y
});
b.forEach(function(c) {
c = a[c];
var d = new BuildingView(c,this);
this.buildingViews[c.name] = d;
this.container.addChild(d)
}, this)
},
removeBuilding: function(a) {
var b = this.buildingViews[a.name];
b && (b.runAction(new cc.RemoveSelf),
delete this.buildingViews[a.name])
},
removeTarget: function() {
FingerView.remove(this.finger);
this.finger = void 0
},
addTarget: function(a) {
this.removeTarget();
this.finger = FingerView.hintClick(this.buildingViews[a.name])
},
findClickedBuilding: function(a) {
var b, c;
for (c in this.buildingViews) {
var d = this.buildingViews[c];
d.building.canTouch() && (!b || b.getLocalZOrder() <= d.getLocalZOrder()) && cc.rectContainsPoint(cc.rect(0, 0, d.width, d.height), d.convertTouchToNodeSpace(a)) && (b = d)
}
return b
},
onClick: function(a) {
if ((a = this.findClickedBuilding(a)) && cleverapps.debugMode && cleverapps.keyboardController.isPressed(cc.KEY.j))
cleverapps.meta.getType() === Meta.FARM ? (Farm.Reset(),
a = Farm.GetBuildingProgress(a.building.id, 0),
cleverapps.farm.load(a),
cleverapps.farm.save(),
cleverapps.refreshScene()) : cleverapps.meta.getType() === Meta.HOMEFIX && HomeTool.set(a.building.id, 0, !1, function() {
cleverapps.refreshScene()
});
else if (a)
a.building.onClick()
}
});
cleverapps.styles.WorldMap = {
persons: {},
zoom: {
base: 1,
unfocused: .7,
minScale: .5
}
};
var MissionGame = function(a) {
cleverapps.EventEmitter.call(this);
this.running = !0;
this.paused = !1;
this.mission = a
};
MissionGame.prototype = Object.create(cleverapps.EventEmitter.prototype);
MissionGame.prototype.constructor = MissionGame;
MissionGame.prototype.pause = function() {
this.paused = !0
}
;
MissionGame.prototype.resume = function() {
this.paused = !1;
this.trigger("resumed")
}
;
MissionGame.prototype.getName = function() {
return ""
}
;
MissionGame.prototype.finish = function(a) {
this.running && (0 < this.reward && this.mission.update(this.reward),
this.running = !1,
this.trigger("finish", a),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MINIGAME_FINISH + "_" + this.getName()),
cleverapps.playSession.set(cleverapps.EVENTS.MINIGAME_FINISH + "_" + this.getName(), !0))
}
;
var TellWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
var b = this.createText(a.text);
this._super({
content: b,
name: "tellwindow",
title: a.title,
fireworks: cleverapps.environment.isBonusWorldScene(),
button: {
text: a.buttonText || "OK",
onPressed: function() {
this.close();
if (a.onPressed)
a.onPressed()
}
.bind(this)
}
})
},
getPerson: function() {
return {
role: "hero",
emotion: "talk"
}
},
createText: function(a) {
var b = cleverapps.styles.TellWindow;
a = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.WINDOW_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.setDimensions(b.text.width, 0);
a.fitTo(void 0, b.text.height);
return a
}
});
cleverapps.styles.TellWindow = {
text: {
width: 650,
height: 400
}
};
var FriendRequestsWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = new cc.Node;
a.setAnchorPoint(.5, .5);
this.content = a;
this.createViews();
this._super({
name: "friendrequestswindow",
content: a,
noBackground: !0,
loginOrInvite: !0,
notCloseByTouchInShadow: !0
})
},
createViews: function() {
var a = cleverapps.styles.FriendRequestsWindow;
this.requestsViews = [];
this.requestsIds = [];
this.pendingViews = [];
this.pendingIds = [];
for (var b = [], c = 0; c < levels.friendRequests.notProcessed.length; c++) {
var d = this.createRequestView(levels.friendRequests.notProcessed[c]);
d && b.push(d)
}
b.forEach(function(e) {
e.setPosition(a.width / 2, 0);
this.requestsViews.length < FriendRequestsWindow.MAX_SHOW_REQUESTS ? (this.content.addChild(e),
this.requestsViews.push(e),
this.requestsIds.push(e.model.getId())) : (this.content.addChild(e),
e.setVisible(!1),
this.pendingViews.push(e),
this.pendingIds.push(e.model.getId()))
}, this);
b = cleverapps.UI.arrangeWithMargins(this.requestsViews.slice().reverse(), {
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
offset: a.y
});
this.content.setContentSize2(a.width, b)
},
createRequestView: function(a) {
var b = a.getId()
, c = a.getView();
if (c)
return new c(a,this,function() {
var d = this.getRequestIdViewOrder(b)
, e = this.requestsViews[0].getPosition();
if (!1 !== d) {
for (var f = d - 1; 0 <= f; --f)
this.requestsViews[f].isRunning() && this.requestsViews[f].runAction(new cc.MoveTo(this.getMoveTime(),this.requestsViews[f + 1].getPosition()));
this.requestsIds.splice(d, 1);
this.requestsViews.splice(d, 1)
}
0 === this.requestsViews.length && 0 === this.pendingViews.length ? this.close() : 0 < this.pendingViews.length && (d = this.pendingViews[0],
f = this.pendingIds[0],
this.pendingViews.splice(0, 1),
this.pendingIds.splice(0, 1),
this.requestsViews.splice(0, 0, d),
this.requestsIds.splice(0, 0, f),
d.setVisible(!0),
d.setScale(0),
d.setPosition(e),
d.runAction(new cc.ScaleTo(this.getMoveTime(),1)))
}
.bind(this))
},
getRequestIdViewOrder: function(a) {
for (var b = 0; b < this.requestsIds.length; b++)
if (this.requestsIds[b] === a)
return b;
return !1
},
getMoveTime: function() {
return .3
},
onClose: function() {
cleverapps.toolbar.updateItems()
}
});
FriendRequestsWindow.MAX_SHOW_REQUESTS = 4;
cleverapps.styles.FriendRequestsWindow = {
width: 400,
margin: 15,
y: 0
};
var RewardWindow = CleverappsWindow.extend({
ctor: function(a, b) {
this.options = b = b || {};
this.reward = new RewardsList(a,b);
this.reward.receiveRewards();
cleverapps.dataLoader.processSaveQueue();
this._super()
},
onWindowLoaded: function() {
this._super({
title: this.options.title || "RewardWindow.title",
name: this.options.name || "rewardwindow",
content: this.createContent(),
noBackground: !0,
tapToContinueText: "Window.ClickToClaim",
shareId: this.options.shareId || this.reward.isBigReward() && "reward",
showSound: this.options.sound || bundles.main.urls.reward_window_effect,
fireworks: this.options.fireworks,
closeButtonManual: !0
});
this.adjustRewardList();
this.rewardsList.showUp(this.delayedShowUp.bind(this))
},
adjustRewardList: function() {
var a = this.rewardsList.width * this.rewardsList.scale;
a > this.window.width && this.rewardsList.setScale(this.rewardsList.scale * this.window.width / a)
},
createContent: function() {
var a = cleverapps.styles.RewardWindow;
if (this.options.text) {
var b = this.rewardText = cleverapps.UI.generateTTFText(this.options.text, cleverapps.styles.FONTS.REWARDWINDOW_TITLE_TEXT);
b.setWrapWidth(a.textWidth);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER)
}
this.rewardsList = this.createRewardsList();
return new cleverapps.Layout([b, this.rewardsList].filter(Boolean),{
padding: a.padding,
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
getPerson: function() {
return {
role: "hero",
emotion: "happy"
}
},
createRewardsList: function() {
var a = cleverapps.styles.RewardWindow.rewards;
return new RewardsListComponent(this.reward,{
font: cleverapps.styles.FONTS.REWARDWINDOW_VALUE_TEXT,
iconWrap: a.iconWrap,
margin: a.margin,
textMargin: a.textMargin,
toMainWorld: this.options.toMainWorld,
shine: !0,
columns: "auto",
fitToBox: a.fitToBox[cleverapps.resolution.mode],
filterCustomAnimation: !0
})
},
onClose: function() {
this.reward && (this.reward.onAnimationFinished(),
this.reward = void 0)
},
createReceiveAction: function() {
return new cc.TargetedAction(this.rewardsList,this.rewardsList.receiveRewardsAction())
},
createCloseAction: function() {
return new cc.Sequence(new cc.CallFunc(function() {
this.persons && (this.persons.hide(),
delete this.persons);
this.rewardText && this.rewardText.runAction(new cc.FadeOut(.3));
this.windowTitle && this.windowTitle.hide()
}
.bind(this)),new cc.CallFunc(function() {
this.styles.shadow && cleverapps.windows.trigger("hideShadow")
}
.bind(this)),new cc.DelayTime(.3),new cc.FadeOut(.3),new cc.CallFunc(this.hideSelf.bind(this)))
},
beforeCloseAnimation: function(a) {
if (this.reward) {
var b = this.reward;
this.reward = void 0;
var c = this.createReceiveAction()
, d = this.createCloseAction();
b = b.underShadowRewardIndex();
c = -1 !== b ? new cc.Spawn(c,new cc.Sequence(new cc.DelayTime(.2 + .3 * b),d)) : new cc.Sequence(c,d);
c = new cc.Sequence(c,new cc.CallFunc(a || function() {}
));
this.runAction(c)
} else
a()
},
onPressed: function() {
this.close()
},
listBundles: function() {
return this.reward.listBundles()
},
getPreferredBundles: function() {
return "merge" === cleverapps.config.type ? ["game", "main"] : this._super()
}
});
RewardWindow.createPurchaseWindow = function(a) {
return new RewardWindow(a,{
title: "PurchaseRewardWindow.title",
name: "purchaserewardwindow",
event: cleverapps.EVENTS.EARN.PURCHASE
})
}
;
RewardWindow.createCupsWindow = function(a, b) {
return new RewardWindow(a,{
name: "cupsrewardwindow",
title: "Cups." + b + ".title",
text: "Cups." + b + ".reward",
event: cleverapps.EVENTS.EARN.OTHER
})
}
;
RewardWindow.createDailyTaskWindow = function(a) {
return new RewardWindow(a.getReward(),{
title: "DailyTaskRewardWindow.title",
name: "dailytaskrewardwindow",
text: "DailyTaskRewardWindow.text",
toMainWorld: cleverapps.travelBook.isExpedition(),
event: cleverapps.EVENTS.EARN.DAILY
})
}
;
RewardWindow.createMissionWindow = function(a, b, c) {
c = c || {};
return new RewardWindow(a,{
shareId: c.shareId || b.rewardShareId,
title: b.rewardTitle,
text: b.rewardText,
toMainWorld: b.mainWorldReward,
event: c.event || cleverapps.EVENTS.EARN.MISSION
})
}
;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
REWARDWINDOW_TITLE_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
REWARDWINDOW_VALUE_TEXT: {
size: 56,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
cleverapps.styles.RewardWindow = {
textWidth: 800,
margin: 40,
rewards: {
iconWrap: {
height: 130
},
margin: {
x: 100,
y: 60
},
fitToBox: [{
width: 650,
height: 650
}, {
width: 900,
height: 650
}, {
width: 900,
height: 650
}],
textMargin: 0
},
padding: {
top: 60,
bottom: 60
}
};
var UserStatus = function() {
cleverapps.EventEmitter.call(this);
this.timeouts = []
};
UserStatus.prototype = Object.create(cleverapps.EventEmitter.prototype);
UserStatus.prototype.constructor = UserStatus;
UserStatus.prototype.initTimeouts = function() {
this.destructor();
cleverapps.environment.isSceneWithPreview() || cleverapps.config.wysiwygMode || (this.timeouts = [new UserStatusTimeout(cleverapps.parseInterval("10 seconds"),function(a, b) {
this.trigger("inactive_very_short", b)
}
.bind(this)), new UserStatusTimeout(cleverapps.parseInterval("20 seconds"),function(a, b) {
this.trigger("inactive_short", b)
}
.bind(this)), new UserStatusTimeout(cleverapps.parseInterval("60 seconds"),function(a, b) {
this.trigger("inactive_long", b)
}
.bind(this))])
}
;
UserStatus.prototype.destructor = function() {
this.timeouts.forEach(function(a) {
a.destructor()
});
this.timeouts = []
}
;
UserStatus.prototype.reportUserAction = function() {
this.trigger("active");
this.timeouts.forEach(function(a) {
a.reset()
})
}
;
var UserStatusTimeout = function(a, b) {
this.time = a;
this.callback = b;
this.reset()
};
UserStatusTimeout.prototype.reset = function() {
this.clear();
this.hintTimeout = cleverapps.timeouts.setTimeout(function() {
this.callback();
this.reset()
}
.bind(this), this.time)
}
;
UserStatusTimeout.prototype.clear = function() {
cleverapps.timeouts.clearTimeout(this.hintTimeout)
}
;
UserStatusTimeout.prototype.destructor = function() {
this.clear()
}
;
var Counter = function() {
this.value = 0;
this.onceZero = void 0;
this.stages = [];
this.off = !1;
this.onStageActivatedListener = function() {}
};
Counter.prototype.registerStage = function(a, b) {
for (var c = 0; c < this.stages.length; c++)
if (this.stages[c].handler === b)
return;
cleverapps.config.debugMode && 0 < this.stages.filter(function(d) {
return d.priority === a
}).length && alert("Multiple stages with same priority: " + a);
this.stages.push({
priority: a,
handler: b
});
this.stages.sort(function(d, e) {
return d.priority - e.priority
})
}
;
Counter.prototype.runStages = function() {
if (0 === this.value && !this.off)
for (var a = 0; a < this.stages.length; a++)
if (this.stages[a].handler(),
this.isActive()) {
this.onStageActivatedListener();
break
}
}
;
Counter.prototype.turnOff = function() {
this.off = !0
}
;
Counter.prototype.turnOn = function() {
this.off = !1
}
;
Counter.prototype.isActive = function() {
return 0 < this.value || !0 === this.off
}
;
Counter.prototype.trigger = function(a) {
this.off || (a ? cleverapps.timeouts.setTimeout(this.trigger.bind(this), a) : this.runStages())
}
;
Counter.prototype.inc = function() {
this.value++
}
;
Counter.prototype.dec = function() {
this.value--;
if (0 === this.value && !this.off) {
if (this.onceZero) {
var a = this.onceZero;
this.onceZero = void 0;
a()
}
0 !== this.value || this.off || this.runStages();
InterstitialAction.showOnLowMonetization()
}
}
;
Counter.prototype.playActions = function(a) {
this.inc();
this._playActions(a, this.dec.bind(this))
}
;
Counter.prototype._playActions = function(a, b) {
a.shift()(function() {
this.off || (0 === a.length ? b() : this._playActions(a, b))
}
.bind(this))
}
;
Counter.prototype.createDelayAction = function(a) {
return function(b) {
cleverapps.timeouts.setTimeout(b, a)
}
}
;
Counter.prototype.setTimeout = function(a, b) {
this.playActions([this.createDelayAction(b), function(c) {
a();
c()
}
])
}
;
Counter.prototype.clearStages = function() {
this.stages = []
}
;
cleverapps.GameSaver = {
gamesData: [],
getStoreSlot: function(a, b) {
a = a || 0;
b = b || 0;
if (-1 === ["match3", "board", "merge"].indexOf(cleverapps.config.type) || cleverapps.isRumble()) {
var c = cleverapps.loadedSnapshot && cleverapps.loadedSnapshot.games;
if (!c || c.episode !== a || c.level !== b)
return
}
if ("merge" === cleverapps.config.type) {
c = new Level(a,b);
var d = TravelBook.findPageById(c.meta.expedition);
if (d && String(d.location) === String(c.episodeNo) && String(d.level || 0) === String(c.levelNo))
return d.slot || Meta.SLOT_MAIN
}
return b + "x" + a
},
convertToStoreKey: function(a) {
"merge" === cleverapps.config.type && (a = "0x" + (a || 0));
return cleverapps.config.name + connector.platform.getLocalStoragePrefix() + "_level_" + a
},
findSave: function(a) {
return this.gamesData.filter(function(b) {
return Object.keys(b)[0] === a
})[0]
},
load: function(a) {
var b = this.convertToStoreKey(a)
, c = this.findSave(b);
c = c && JSON.parse(c[b]);
c || (c = cleverapps.dataLoader.load(b)) && this.saveInfo(a, c);
return c
},
loadProperty: function(a, b) {
return (a = cleverapps.GameSaver.load(a)) && a[b]
},
reset: function() {
cleverapps.GameSaver.gamesData = [];
this.listAllLevels().forEach(function(a) {
a = cleverapps.GameSaver.getStoreSlot(a.episodeNo, a.levelNo);
cleverapps.GameSaver.removeSave(a, {});
cleverapps.GameSyncer.addUpdateTask(a)
})
},
saveInfo: function(a, b, c) {
var d = this.convertToStoreKey(a)
, e = this.findSave(d);
if (e)
this.gamesData[this.gamesData.indexOf(e)][d] = JSON.stringify(b);
else {
for (; this.gamesData.length >= DataLoader.FIFO_LIMIT; )
this.gamesData.shift();
e = {};
e[d] = JSON.stringify(b);
this.gamesData.push(e)
}
cleverapps.dataLoader.save(d, b, {
fifoKey: DataLoader.TYPES.GAME_SAVE_FIFO
});
c || cleverapps.GameSyncer.addUpdateTask(a)
},
removeSave: function(a) {
a = this.convertToStoreKey(a);
var b = this.findSave(a);
b && this.gamesData.splice(this.gamesData.indexOf(b), 1);
cleverapps.dataLoader.remove(a, DataLoader.TYPES.GAME_SAVE_FIFO)
},
listAllLevels: function() {
var a = [];
Object.keys(bundles).forEach(function(b) {
var c = bundles[b];
c && (c.meta.episode && c.meta.episode.levels && bundles[Level.BundleId(c.meta.episode.episodeNo)] ? c.meta.episode.levels.forEach(function(d, e) {
a.push({
episodeNo: c.meta.episode.episodeNo,
levelNo: e
})
}) : c.meta.location && a.push({
episodeNo: c.meta.location,
levelNo: 0
}))
});
return a
}
};
var GameBase = function(a, b) {
cleverapps.EventEmitter.call(this);
Game.currentGame = this;
this.levelContent = a.content;
this.level = a;
this.options = b || {};
this.slot = cleverapps.GameSaver.getStoreSlot(this.level.episodeNo, this.level.levelNo);
this.savedGame = this.loadSave();
this.score = new Score(this.savedGame.score);
this.moves = this.savedGame.moves || 0;
this.timer = new GameTimer(this);
this.counter = new Counter;
this.actionsBefore = this.options.actionsBefore || [];
this.level.isRegular() && this.level.isNew() && (this.primaryMission = cleverapps.missionManager.findBySemaphore(Missions.SEMAPHORE_PRIMARY));
this.level.isRegular() && this.level.isNew() && !this.hasDanger() && (b = cleverapps.missionManager.findBySemaphore(Missions.SEMAPHORE_SECONDARY)) && [Mission.TYPE_RAINBOW, Mission.TYPE_COLLECT_MARK, Mission.TYPE_BURN_NEARBY, Mission.TYPE_LETTER, Mission.TYPE_BUTTERFLY].includes(b.type) && (this.secondaryMission = b);
this.rewards = {};
this.secondaryMission && (this.rewards[GameBase.REWARD_SECONDARY] = 0);
this.primaryMission && (this.rewards.mission = {
missionType: this.primaryMission.type,
amount: this.primaryMission.getLevelReward(this.level.getTag())
});
this.level.isRegular() && this.level.isNew() && cleverapps.exp.isAvailable() && (this.rewards[GameBase.REWARD_EXP] = this.level.isHard() ? GameBase.HARD_LEVEL_EXP_PRIZE : GameBase.EXP_PRIZE);
this.level.isRegular() && cleverapps.stickersBook && cleverapps.stickersBook.isAvailable() && !cleverapps.stickersBook.isCompleted() && (this.rewards[GameBase.REWARD_STICKERS] = cleverapps.stickersBook.getLevelReward());
this.setBasicReward();
this.rewards[GameBase.REWARD_HARD] = 0;
if (this.level.isBonus() || this.level.isBonusRound())
this.rewards[GameBase.REWARD_HARD] = GameBase.BONUS_REWARD;
this.level.isDanger() && (this.rewards[GameBase.REWARD_HARD] = GameBase.DANGER_REWARD);
(b = Lantern.Get()) && b.isActive(this.level) && (this.rewards.lantern = b.savedStreak >= Lantern.getMaxStreak() ? 0 : 1,
b.onStart());
cleverapps.missionManager.getRunningMissions().forEach(function(c) {
c.logic && c.logic.addGameReward && c.logic.addGameReward()
});
this.savedGame.rewards && (this.rewards = cleverapps.override(this.rewards, this.savedGame.rewards));
this.levelWithTutorial() && "merge" !== cleverapps.config.type ? cleverapps.Random.seed(this.level.getHumanReadableNumber() - 1) : cleverapps.Random.randomSeed();
this.outcome = GameBase.OUTCOME_UNKNOWN;
cleverapps.flyingAd && cleverapps.flyingAd.setGame();
this.counter.turnOff();
"merge" !== cleverapps.config.type && this.counter.registerStage(-1, this.begin.bind(this));
this.boatswain = new Boatswain(a);
this.counter.registerStage(1E3, this.animateOutcome.bind(this));
"undefined" !== typeof Prolongation && (this.prolongation = new Prolongation,
this.prolongation.on("acceptOffer", this.onAcceptProlongationOffer.bind(this), this));
cleverapps.lives && cleverapps.lives.amount > cleverapps.lives.getMaxLives() && (this.moreThenMaxRegenLife = !0);
"merge" !== cleverapps.config.type && this.takeLife(!0)
};
GameBase.prototype = Object.create(cleverapps.EventEmitter.prototype);
GameBase.prototype.constructor = GameBase;
GameBase.prototype.animateOutcome = function() {
this.outcome === GameBase.OUTCOME_UNKNOWN || cleverapps.focusManager.isFocused() || this.goalCounter && this.goalCounter.isActive() || this.trigger("animateOutcome", this.outcome)
}
;
GameBase.prototype.getMode = function() {
return GameBase.MODE_REGULAR
}
;
GameBase.prototype.levelWithTutorial = function() {
if (cleverapps.config.editorMode)
return !1;
if ("blocks" === cleverapps.config.type)
return BlocksTutorial.isAvailable(this.level);
if ("match3" === cleverapps.config.type) {
if (this.levelContent.tutorial) {
if (this.level.isBonusWorldLevel())
return !0;
if (cleverapps.user.isPassedAll() && this.level.isPassedLevel())
return !1;
if (this.level.isCurrentLevel())
return !0
}
return !1
}
if ("tile3" === cleverapps.config.type || "solitaire" === cleverapps.config.type)
return TilesTutorial.IsAvailable(this.level);
if ("board" === cleverapps.config.type)
return 0 === levels.user.episode && 0 === levels.user.level && this.level.isCurrentLevel() && !cleverapps.isKnockoutGame();
if ("merge" === cleverapps.config.type)
return !0
}
;
GameBase.prototype.displayTutorial = function(a) {
a()
}
;
GameBase.prototype.hasBegan = function() {
return this.hasDanger() || ["battlefield"].includes(cleverapps.config.type) ? !0 : "match3" === cleverapps.config.type ? this.beginMoves !== this.moves : ["tile3", "klondike", "solitaire"].includes(cleverapps.config.type) && this.move ? !0 : 0 < this.moves || 0 < this.getPercentOfCompletion()
}
;
GameBase.prototype.begin = function(a) {
this.began || !this.hasBegan() && !a || (this.began = !0,
(this.level.isRegular() || this.level.isBonusWorldLevel()) && levels.user.isUniqueStart(this.level.episodeNo, this.level.levelNo, this.level.content.version) && this._churnActivated())
}
;
GameBase.prototype.setBasicReward = function() {
this.basicReward = 0;
[Meta.HOMEFIX, Meta.SIMPLE, Meta.SHORTMETA, Meta.HOSE, Meta.FARM].includes(cleverapps.meta.getType()) && "battlefield" !== cleverapps.config.type && !this.rewards[GameBase.REWARD_EXP] && (this.level.isCurrentLevel() || this.level.isDailyCup() || this.level.isDailyLevel() || this.level.isAdsLevel() || this.level.isBonusWorldLevel() || cleverapps.config.editorMode || cleverapps.config.wysiwygMode) && (this.basicReward = 10,
this.level.isTricky() && (this.basicReward = 20),
this.level.isHard() && (this.basicReward = 30))
}
;
GameBase.prototype.addBasicReward = function() {
(cleverapps.config.soft ? GameBase.REWARD_SOFT : GameBase.REWARD_HARD) === GameBase.REWARD_HARD ? this.addHardReward(this.basicReward) : this.addSoftReward(this.basicReward)
}
;
GameBase.prototype.showMessage = function(a, b) {
cleverapps.timeouts.setTimeout(function() {
this.trigger("showMessage", a)
}
.bind(this), 200);
cleverapps.timeouts.setTimeout(b, 1500)
}
;
GameBase.prototype.showStartGameMessage = function(a) {
this.level.isHard() ? this.showMessage("message.hardLevel", a) : a()
}
;
GameBase.prototype._churnActivated = function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.UNIQUE_START, {
hash: this.level.hash
})
}
;
GameBase.prototype.setTimeout = function(a, b) {
return cleverapps.timeouts.setTimeout(function() {
this.stopped || a()
}
.bind(this), b)
}
;
GameBase.prototype.getInfo = function() {
return {
rewards: this.rewards
}
}
;
GameBase.prototype.getInitialInfo = function() {
return {}
}
;
GameBase.prototype.storeSave = function() {
if (void 0 !== this.slot) {
var a = this.getInfo();
console.log("storeSave");
console.log(a);
cleverapps.GameSaver.saveInfo(this.slot, a)
}
}
;
GameBase.prototype.eraseSave = function() {
cleverapps.GameSaver.removeSave(this.slot)
}
;
GameBase.prototype.loadSave = function() {
if (void 0 !== this.slot) {
var a = cleverapps.GameSaver.load(this.slot) || {};
if (0 < Object.keys(a).length)
return a
}
return this.getInitialInfo()
}
;
GameBase.prototype.getDailyCupStars = function() {
return 1
}
;
GameBase.prototype.initPool = function() {}
;
GameBase.prototype.stop = function() {
this.counter.turnOff();
this.timer.stop();
levels.FPS.stop();
runCleaners(this);
cleverapps.userStatus.destructor();
cleverapps.menuBar.stopItems();
cleverapps.exclamation.remove();
this.stopped = !0;
this.trigger("stop")
}
;
GameBase.prototype.bonusByLeftMoves = function(a) {
this.animateBonus(a)
}
;
GameBase.prototype.needBonusByLeftMoves = function() {
return !1
}
;
GameBase.prototype.animateBonus = function(a) {
a()
}
;
GameBase.prototype.leave = function(a) {
this.outcome !== GameBase.OUTCOME_UNKNOWN ? a() : this.stillNoPenalty() ? (a(),
this.giveUp()) : this.level.isBonus() && this.level.isNew() ? (a(),
this.win()) : (new ConfirmExitWindow({
action: this.lose.bind(this)
}),
cleverapps.focusManager.onceNoWindowsListener = a)
}
;
GameBase.prototype.takeLife = function(a) {
!cleverapps.unlimitedLives || cleverapps.unlimitedLives.checkBuyed() || this.level.isDailyCup() && !cleverapps.dailyCup.withLives() || cleverapps.lives.take(a)
}
;
GameBase.prototype.giveLife = function() {
!cleverapps.unlimitedLives || cleverapps.unlimitedLives.checkBuyed() || this.level.isDailyCup() && !cleverapps.dailyCup.withLives() || (this.moreThenMaxRegenLife || cleverapps.lives.amount < cleverapps.lives.getMaxLives()) && cleverapps.lives.give()
}
;
GameBase.prototype.setOutcome = function(a) {
this.outcome === GameBase.OUTCOME_UNKNOWN && (this.outcome = a,
cleverapps.user.incProgressCompare(a === GameBase.OUTCOME_VICTORY ? 30 : 1),
cleverapps.config.debugMode && console.log("OUTCOME: " + a),
BeforeWinAction.call(this),
this.trigger("outcome", a),
this.counter.trigger())
}
;
GameBase.prototype.win = function() {
this.setOutcome(GameBase.OUTCOME_VICTORY)
}
;
GameBase.prototype.lose = function() {
this.setOutcome(GameBase.OUTCOME_LOST)
}
;
GameBase.prototype.giveUp = function() {
this.setOutcome(GameBase.OUTCOME_GAVEUP)
}
;
GameBase.prototype.playIntro = function(a, b) {
cleverapps.config.debugMode && cleverapps.snapshots.extractData(function(d) {
this.introData = d
}
.bind(this));
var c = this.listIntroActions();
b && (c = c.map(function(d) {
return function(e) {
d(e, b)
}
}));
this.introPlaying = !0;
cleverapps.focusManager.compound(function() {
this.introPlaying = !1;
this.introData = void 0;
a();
this.counter.trigger()
}
.bind(this), c)
}
;
GameBase.prototype.incCounter = function(a) {
cleverapps.config.editorMode || this.counter.turnOn();
this.counter.inc();
a()
}
;
GameBase.prototype.decCounter = function(a) {
this.counter.dec();
cleverapps.userStatus.reportUserAction();
a()
}
;
GameBase.prototype.listIntroActions = function() {
return [this.incCounter.bind(this), this.prepareBoosters.bind(this), this.showScreen.bind(this), this.updateRestoreProgress.bind(this), this.beforeGameStart.bind(this), this.showStartGameMessage.bind(this), this.decCounter.bind(this), this.startTutorial.bind(this), this.showDailyLevelWindow.bind(this), this.executeActionsBefore.bind(this), this.runFPS.bind(this)]
}
;
GameBase.prototype.startTutorial = function(a) {
this.levelWithTutorial() ? this.displayTutorial(a) : a()
}
;
GameBase.prototype.prepareBoosters = function(a) {
for (var b in cleverapps.boosters.boosters)
cleverapps.boosters.boosters[b].onGameStarted();
a()
}
;
GameBase.prototype.showScreen = function(a) {
a()
}
;
GameBase.prototype.updateRestoreProgress = function(a) {
cleverapps.restoreProgress.update();
a()
}
;
GameBase.prototype.beforeGameStart = function(a) {
this.competition && this.competition.start();
a()
}
;
GameBase.prototype.runFPS = function(a) {
this.level.isRegular() && levels.FPS.run(this.level.episodeNo, this.level.levelNo);
a()
}
;
GameBase.prototype.showDailyLevelWindow = function(a) {
!cleverapps.config.wysiwygMode && cleverapps.config.features.includes("dailylevel") && !DailyLevelWindow.shown && this.level.isDailyLevel() && ["olympics", "crocword", "tripeaks", "spades"].includes(cleverapps.config.name) ? (DailyLevelWindow.shown = !0,
new DailyLevelWindow,
cleverapps.focusManager.onceNoWindowsListener = a) : a()
}
;
GameBase.prototype.useLives = function() {
return cleverapps.lives
}
;
GameBase.EXP_PRIZE = 1;
GameBase.HARD_LEVEL_EXP_PRIZE = 3;
GameBase.BONUS_REWARD = 10;
GameBase.DANGER_REWARD = 15;
GameBase.REWARD_SECONDARY = "clover";
GameBase.REWARD_EXP = "exp";
GameBase.REWARD_HARD = "hard";
GameBase.REWARD_BOOSTERS = "boosters";
GameBase.REWARD_SOFT = "soft";
GameBase.REWARD_STICKERS = "stickers";
GameBase.OUTCOME_UNKNOWN = void 0;
GameBase.OUTCOME_VICTORY = 1;
GameBase.OUTCOME_LOST = 2;
GameBase.OUTCOME_GAVEUP = 3;
GameBase.MODE_REGULAR = "regular";
GameBase.MODE_HIGHSCORE = "highscore";
GameBase.prototype.stillNoPenalty = function() {
return cleverapps.isRumble() || this.outcome !== GameBase.OUTCOME_UNKNOWN || this.level.isBonusRound() ? !1 : ["board", "battlefield"].includes(cleverapps.config.type) ? !0 : "match3" === cleverapps.config.type ? !this.moveMade : !this.hasBegan()
}
;
GameBase.prototype.getMissionType = function() {
if (this.secondaryMission)
return this.secondaryMission.type
}
;
GameBase.prototype.addClover = function(a, b, c) {
this.getMissionType() === a && (this.rewards[GameBase.REWARD_SECONDARY] = (this.rewards[GameBase.REWARD_SECONDARY] || 0) + b,
c || this.trigger("rewardClover"))
}
;
GameBase.prototype.addHardReward = function(a, b) {
this.rewards[GameBase.REWARD_HARD] = (this.rewards[GameBase.REWARD_HARD] || 0) + a;
b || this.trigger("rewardHard", a)
}
;
GameBase.prototype.addSoftReward = function(a, b) {
this.rewards[GameBase.REWARD_SOFT] = (this.rewards[GameBase.REWARD_SOFT] || 0) + a;
this.trigger("rewardSoft", a, b)
}
;
GameBase.prototype.executeActionsBefore = function(a, b) {
b ? a() : cleverapps.focusManager.compound(a, this.actionsBefore.map(function(c) {
return function(d) {
GameBase.ActionsBefore[c.type](c) && c.source && c.source.execute();
var e = void 0 === c.duration ? .3 : c.duration;
c.getDuration && (e = c.getDuration());
e ? Game.currentGame.counter.setTimeout(d, 1E3 * e) : d()
}
}))
}
;
GameBase.prototype.getPercentOfCompletion = function() {
return 0
}
;
GameBase.prototype.onAcceptProlongationOffer = function(a) {
a.type === Prolongation.TYPES.MOVES && this.setMoves(a.moves)
}
;
GameBase.prototype.getProlongationMovies = function() {
return 5
}
;
GameBase.prototype.getNormalizedLevelReward = function(a, b) {
var c = this.level.getTag();
a = a[c] || a.default;
c = GameBase.AVG_LEVELS_FINISHED[cleverapps.config.type];
if (!c)
return a;
b = GameBase.AVG_LEVELS_FINISHED[b] / c;
b = Math.min(b, 3);
a *= b;
b = Math.floor(a);
return a - b > Math.random() ? b + 1 : b
}
;
GameBase.prototype.hasDanger = function() {
return this.level.isDanger()
}
;
GameBase.LEVEL_WITH_COINS_AVAILABLE = {
level: .93
};
GameBase.AVG_LEVELS_FINISHED = {
board: 5.08,
match3: 4.95,
solitaire: 7.32,
tile3: 3.35,
blocks: 4.95
};
var GameDataSaver = function(a) {
this.key = a
};
GameDataSaver.prototype.save = function(a) {
var b = cleverapps.dataLoader.load(DataLoader.TYPES.GAME_DATA) || {};
b[this.key] = a;
cleverapps.dataLoader.save(DataLoader.TYPES.GAME_DATA, b)
}
;
GameDataSaver.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.GAME_DATA);
return a && a[this.key]
}
;
GameDataSaver.prototype.add = function(a) {
var b = this.load() || {};
b = Object.assign({}, b, a);
this.save(b)
}
;
GameDataSaver.prototype.clear = function() {
this.save()
}
;
GameDataSaver.prototype.loadAndClear = function() {
var a = this.load();
a && this.clear();
return a
}
;
GameDataSaver.Reset = function() {
cleverapps.dataLoader.remove(DataLoader.TYPES.GAME_DATA)
}
;
GameDataSaver.Create = function(a) {
return new GameDataSaver(a + (Game.currentGame && Game.currentGame.slot || Meta.SLOT_MAIN))
}
;
cleverapps.GameSyncer = {
addUpdateTask: function(a) {
"merge" !== cleverapps.config.type && (a = Meta.SLOT_MAIN);
cleverapps.synchronizer.addUpdateTask("games" + a)
},
loadInfo: function(a) {
if (void 0 === a) {
var b = cleverapps.user.getCurrentLevel();
var c = b.episodeNo;
b = b.levelNo;
a = cleverapps.GameSaver.getStoreSlot(c, b)
} else
"merge" !== cleverapps.config.type || "1" !== a && "2" !== a || (c = a);
(a = cleverapps.GameSaver.load(a)) && 0 < Object.keys(a).length && (a = Object.assign(a, {
episode: c || void 0,
level: b || void 0
}));
return a || {}
},
saveInfo: function(a, b) {
if (void 0 !== b) {
var c = b.episode || 0
, d = b.level || 0;
delete b.episode;
delete b.level;
void 0 === a && (a = cleverapps.GameSaver.getStoreSlot(c, d));
cleverapps.GameSaver.saveInfo(a, b, !0)
}
}
};
CustomSyncers.extractors.games = function() {
return cleverapps.GameSyncer.loadInfo(void 0)
}
;
CustomSyncers.importerData.games = function(a) {
cleverapps.GameSyncer.saveInfo(void 0, a)
}
;
"merge" === cleverapps.config.type && CustomSyncers.registerBySlots("games", function(a) {
return cleverapps.GameSyncer.loadInfo(a)
}, function(a, b) {
cleverapps.GameSyncer.saveInfo(a, b)
});
var GameSceneBase = cleverapps.FixedWidthScene.extend({
ctor: function(a) {
this.options = a || {};
this._super(a);
this.styling = this.level ? GameSceneBase.ChooseStyling(this.level) : {}
},
onSceneLoaded: function(a) {
cleverapps.environment.levelNo = this.level.levelNo;
cleverapps.environment.episodeNo = this.level.episodeNo;
cleverapps.environment.setScene(a || cleverapps.Environment.SCENE_GAME);
var b = this.level
, c = this.game = new Game(b,this.options.gameOptions);
this._super(a || cleverapps.Environment.SCENE_GAME);
levels.cookieJar && levels.cookieJar.shouldBeVisible() && levels.cookieJar.setVisible();
this.game.competition && cleverapps.isKnockoutGame() && (this.playersView = new KnockoutPlayersView(this.game.competition,cleverapps.meta.getRumble().getCurrentRound()),
this.addChild(this.playersView));
if (c.combo) {
var d = new ComboBarView(c.combo);
this.addChild(d);
d = new HidingNode(d,cleverapps.UI.HORIZONTAL);
cleverapps.focusManager.registerControl("comboBar", d)
}
-1 !== ["riddles", "heroes"].indexOf(cleverapps.config.name) && (this.infoPanel = new InfoPanel,
this.addChild(this.infoPanel),
b.isTricky() || (this.controlsPanel = new ControlsPanel,
cleverapps.restoreProgress.isAvailable() || (this.addChild(this.controlsPanel),
c.on("outcome", function() {
this.controlsPanel.hide()
}
.bind(this), this))));
c.on("animateOutcome", this.animateOutcome.bind(this), this);
cc.pool.drainAllPools();
this.game.initPool();
if (this.game.levelWithCoins) {
var e = new RewardGoldView;
this.addChild(e);
e = new HidingNode(e,cleverapps.UI.HORIZONTAL);
cleverapps.focusManager.registerControl("rewardElementGold", e)
}
if (this.game.secondaryMission)
if (b = new CloversView,
b.withinInfoPanel)
this.infoPanel.addChild(b);
else {
this.addChild(b);
var f = new HidingNode(b);
cleverapps.focusManager.registerControl("rewardElementClover", f, "match3" !== cleverapps.config.type && cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? [cleverapps.Environment.SCENE_GAME] : void 0)
}
if (d || e || f)
this.horizontalBlocker = new HorizontalBlockerNode(f || d || e),
this.addChild(this.horizontalBlocker);
(this.level.isRegular() || this.level.isBonusWorldLevel()) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.LEVEL_START, {
hash: this.level.hash
});
connector.platform.gameplayStart();
this.game.tournament && (f = new TournamentPlayersView(this.game.competition),
this.addChild(f),
this.playersView = new HidingNode(f,cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL),
cleverapps.focusManager.registerControl("tournamentPlayersView", this.playersView));
c.on("showMessage", this.onGameMessage.bind(this), this);
f = this.exclamationView = ExclamationViewBase.Create();
this.addChild(f, 30);
f.setPositionRound(cleverapps.styles.GameScene.exclamation);
"undefined" === typeof FlyingAdView || cleverapps.config.wysiwygMode || this.addChild(new FlyingAdView);
c.on("stop", this.onStop.bind(this), this);
c.on("outOfMoves", this.outOfMoves.bind(this), this)
},
onGameMessage: function(a) {
a = new GameMessageView(a);
this.addChild(a)
},
onStop: function() {},
outOfMoves: function() {},
calcHash: function() {
return RecursiveHasher(this.level.content, "episodeNo levelNo version hard paint extra gold bundles".split(" "))
},
introControls: function() {
return ["panel_info"]
},
playIntroActions: function(a, b) {
this.game.playIntro(a, b)
},
_closeAction: function() {
!BackToAdminOrEditorAction.call(this) && this.game && cleverapps.focusManager.display({
focus: "GameSceneCloseAction",
action: function(a) {
this.game.leave(a)
}
.bind(this)
})
},
animateOutcome: function() {
cleverapps.focusManager.isFocused() || cleverapps.focusManager.display({
focus: "ChangeOutcome",
control: this.introControls(),
actions: [VictoryMessageAction, function(a) {
this.game.needBonusByLeftMoves() ? (this.tapToSkip = this.createTapToSkip(),
this.game.bonusByLeftMoves(a)) : a()
}
.bind(this), function(a) {
this.tapToSkip && (this.tapToSkip.hide(),
delete this.tapToSkip);
a()
}
.bind(this), function(a) {
this.game.stop();
connector.platform.gameplayStop();
a()
}
.bind(this), SaveFinalResultsAction.bind(this), HideAnimations.bind(this), function(a) {
this.game.boatswain.prepareNext();
a()
}
.bind(this), InterstitialAction.bind(this), ShowOutcomeWindow.bind(this), UpdateScoreAction.bind(this), ReportLevelOutcomeAction.bind(this), RateWindowAction.bind(this), NewLeagueWindowAction.bind(this), MinigameFinishAction.bind(this), BoatswainAction.bind(this), PurgeOldGameAction.bind(this)]
})
},
getBackgroundStyles: function() {
var a = cleverapps.skins.getSlot("gameSceneBg") || this.styling;
a.backgroundId = bundles[a.bundle].urls[a.backgroundId] ? a.backgroundId : "background";
a.animation = bundles[a.bundle].jsons.background_spine || a.animation;
return a
},
getAudioStyles: function() {
return {
res: cleverapps.skins.getSlot("gameAudio") || this.styling.music,
fadeIn: cleverapps.styles.GameScene.sound.fadeIn,
delay: cleverapps.config.wysiwygMode ? 0 : cleverapps.styles.GameScene.sound.delay
}
},
setupChildren: function() {
this._super();
this.exclamationView && this.exclamationView.setPositionRound(cleverapps.styles.GameScene.exclamation)
},
listBundles: function() {
var a = this.level
, b = this.styling
, c = ["game"];
cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL ? c.push("game_background_horizontal") : c.push("game_background_vertical");
b && c.push(b.bundle);
a && (c.push(a.getImageBundle()),
(a = a.getLevelCellSkins()) && Object.values(a).forEach(function(d) {
if (bundles[d]) {
var e = d.substring(0, d.indexOf("_reskin"));
e = c.indexOf(e);
c.splice(e, 0 < e ? 1 : 0, d)
}
}),
cleverapps.config.rpg && c.push("enemies"));
["riddles", "heroes"].includes(cleverapps.config.name) && this.level.isTricky() && c.push("danger_component");
"stacks" === cleverapps.config.subtype && c.push("extra_" + cleverapps.settings.language);
bundles["letters_" + cleverapps.settings.language] && c.push("letters_" + cleverapps.settings.language);
return c.filter(function(d) {
return d && bundles[d]
})
},
createBonusChest: function() {
var a = this.bonusChest = new ChestVictoryAnimation;
a.setPositionRound(cleverapps.styles.ChestVictoryAnimation.chestPosition);
this.addChild(a);
return a
},
createTapToSkip: function() {
var a = new TapToSkip({
text: "TapToSkip"
});
a.setPositionRound(cleverapps.styles.TapToSkip);
a.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 2);
this.game.on("onSkip", function() {
delete this.tapToSkip
}
.bind(this));
a.show();
this.addChild(a);
return a
}
});
GameSceneBase.ChooseStyling = function(a) {
if (bundles[a.bundleId()] && bundles[a.bundleId()].urls.background)
return {
bundle: a.bundleId()
};
if (cleverapps.environment.isEditorScene() && cleverapps.styles.GameScene.STYLING.editor)
return cleverapps.styles.GameScene.STYLING.editor;
var b = cleverapps.styles.GameScene.STYLING
, c = b.regular[Math.abs(a.getHumanReadableNumber()) % b.regular.length];
a.isBonusRound() || a.isBonus() ? c = b.bonus : a.isHard() || cleverapps.isRumble() && cleverapps.meta.getRumble().getCurrentRound().isLast() ? c = b.hard : a.isTricky() && (c = b.tricky);
c = cleverapps.clone(c);
b = c.bundle;
cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL && (b = b.replace("_vertical", "_horizontal"));
c.bundle = bundles[b] ? b : c.bundle.replace("_vertical", "_" + cleverapps.config.orientation);
a.isBonusWorldLevel() && (a = cleverapps.missionManager.findRunningMission(Mission.TYPE_BONUS_WORLD)) && (c.bundle = a.bonusWorld.backgroundBundleId(),
c.music = bundles[c.bundle].urls.game_music || bundles[c.bundle].urls.music,
c.skin = void 0);
return c
}
;
cleverapps.styles.GameScene = {
exclamation: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
actor: void 0,
startAnimation: void 0,
sound: {
delay: 1
},
debugLevelNo: {
x: {
align: "right",
dx: -100
},
y: {
align: "bottom",
dy: 100
}
}
};
cleverapps.styles.GameScene.STYLING = {
bonus: {
backgroundId: "background_bonus",
bundle: "game_background_vertical",
music: bundles.game.urls.background_music_game
},
hard: {
backgroundId: "background_hard",
bundle: "game_background_vertical",
music: bundles.game.urls.background_music_hard
},
regular: [{
bundle: "game_background_vertical",
music: bundles.game.urls.background_music_game
}]
};
-1 !== ["wordsoup", "olympics"].indexOf(cleverapps.config.name) && (cleverapps.styles.GameScene.STYLING.bonus.patternId = "background_bonus");
-1 !== ["wordsoup", "olympics", "differences"].indexOf(cleverapps.config.name) && (cleverapps.styles.GameScene.STYLING.hard.patternId = "background_hard",
cleverapps.styles.GameScene.STYLING.regular[0].patternId = "background");
-1 !== ["hustlemerge"].indexOf(cleverapps.config.name) && (cleverapps.styles.GameScene.STYLING.regular[0].topAnimation = bundles.merge.jsons.bg_animation_top,
cleverapps.styles.GameScene.STYLING.regular[0].parallax = !0,
cleverapps.styles.GameScene.STYLING.regular[0].scale9 = bundles.merge.frames.bgScale9);
(function() {
bundles.editor && bundles.editor.urls.background && (cleverapps.styles.GameScene.STYLING.editor = {
bundle: "editor"
});
for (var a = cleverapps.styles.GameScene.STYLING.regular[0], b = 2; ; b++) {
if (!bundles.game_background_vertical) {
if (!bundles.game_background_horizontal || !bundles.game_background_horizontal.urls["background_" + b])
break
} else if (!bundles.game_background_vertical.urls["background_" + b])
break;
cleverapps.styles.GameScene.STYLING.regular.push({
backgroundId: "background_" + b,
bundle: a.bundle,
music: a.music,
patternId: a.patternId
})
}
}
)();
var NoneMainGameScene = GameSceneBase.extend({
ctor: function(a) {
a = a || {};
a.level || (a.level = new Level(0,0));
this._super(a)
},
onSceneLoaded: function() {
this._super(cleverapps.Environment.SCENE_MAIN)
},
_closeAction: function() {
MainScene.prototype._closeAction.call(this)
}
});
var GameMessageView = cc.Node.extend({
ctor: function(a, b) {
this.options = b || {};
this._super();
this.styles = cleverapps.styles.GameMessageView;
b = this.createBackground();
b.setVisible(!1);
this.addChild(b);
this.updateSize();
this.content = this.options.content || this.createText(a);
b.addChild(this.content);
this.content.setupChildren = function() {
this.content.setPositionRound(this.styles.content)
}
.bind(this);
this.content.setupChildren();
this.setLocalZOrder(17);
this.setupChildren();
this.show()
},
setupChildren: function() {
var a = cleverapps.scenes.getRunningScene();
this.background.setPositionRound(a.width / 2, this.background.y);
this.start = cc.p(a.width / 2, a.height + this.background.height / 2);
this.target = cc.p(a.width / 2, a.height / 2);
this.finish = cc.p(a.width / 2, -this.background.height / 2);
this.pattern && this.createPatternLayer(this.pattern, this.background)
},
updateSize: function() {
var a = cleverapps.resolution.getSceneSize();
this.background.setContentSize2(1.2 * a.width, this.background.height)
},
show: function() {
cleverapps.audio.playSound(bundles.gamemessage.urls.game_message_effect);
this.background.setVisible(!0);
"fromTop" === cleverapps.styles.GameMessageView.showAnimation ? this.showFromTop() : this.showFromCenter()
},
showFromCenter: function() {
this.background.setPositionRound(this.target);
this.background.setScale(1, .6);
this.background.runAction(new cc.Sequence((new cc.ScaleTo(.3,1,1)).easing(cc.easeBackOut()),new cc.DelayTime(.5),new cc.Spawn(new cc.FadeOut(.3),(new cc.ScaleTo(.3,1,.6)).easing(cc.easeBackIn())),new cc.CallFunc(function() {
this.removeFromParent()
}
.bind(this))))
},
showFromTop: function() {
this.background.setPositionRound(this.start);
this.background.runAction(new cc.Sequence((new cc.MoveTo(.3,this.target)).easing(cc.easeBackOut(1.4)),new cc.DelayTime(.8),(new cc.MoveTo(.3,this.finish)).easing(cc.easeBackIn(1.4)),new cc.CallFunc(function() {
this.removeFromParent()
}
.bind(this))))
},
createText: function(a) {
a = Messages.has(a) ? Messages.get(a) : a;
var b = cleverapps.styles.FONTS.GAME_MESSAGE_TEXT;
a = cleverapps.UI.generateTTFText(a.toUpperCase(), b);
a.setLocalZOrder(1);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.fitTo(.9 * cleverapps.resolution.getSceneSize().width);
return a
},
createBackground: function() {
var a = this.background = new cc.Scale9Sprite(bundles.gamemessage.frames.gamemessage_bg_png);
a.setLocalZOrder(-1);
var b = this.pattern = bundles.gamemessage.frames.gamemessage_pattern_png;
b && this.createPatternLayer(b, a);
return a
},
createPatternLayer: function(a, b) {
this.patternLayout && (this.patternLayout.removeFromParent(),
delete this.patternLayout);
var c = (new cc.Sprite(a)).width;
c = Math.ceil(cleverapps.resolution.getSceneSize().width / c) + 1;
for (var d = [], e = 0; e <= c; e++) {
var f = new cc.Sprite(a);
d.push(f)
}
a = this.patternLayout = new cleverapps.Layout(d,{
direction: cleverapps.UI.HORIZONTAL
});
a.setLocalZOrder(0);
a.setPositionRound(cleverapps.scenes.getRunningScene().width / 2, b.height / 2);
b.addChild(a)
}
});
cleverapps.styles.GameMessageView = {
showAnimation: "fromTop",
content: {
x: {
align: "center"
},
y: {
align: "center"
}
}
};
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
GAME_MESSAGE_TEXT: {
size: 86,
color: cleverapps.styles.COLORS.WHITE
}
});
var GameTimer = function(a) {
cleverapps.EventEmitter.call(this);
this.start = a.savedGame.timeStart || Date.now();
this.seconds = a.savedGame.seconds || 0;
this.interval = cleverapps.timeouts.setInterval(function() {
a.outcome === GameBase.OUTCOME_UNKNOWN && a.began && (this.seconds++,
this.trigger("onSecond"))
}
.bind(this), 1E3)
};
GameTimer.prototype = Object.create(cleverapps.EventEmitter.prototype);
GameTimer.prototype.constructor = GameTimer;
GameTimer.prototype.getStartTime = function() {
return this.start
}
;
GameTimer.prototype.getTime = function() {
return Date.now() - this.start
}
;
GameTimer.prototype.getInGameTime = function() {
return this.seconds
}
;
GameTimer.prototype.stop = function() {
cleverapps.timeouts.clearInterval(this.interval)
}
;
GameBase.ActionsBefore = {
combo: function(a) {
var b = a.amount
, c = [0, 120, 250, 360, 500, 620, 750, 860, 1E3, 1100].slice(0, b);
a = Game.currentGame.field.addRandomCombo(b, {
actionBefore: !0,
timeouts: c,
fromLantern: a.lantern
});
a < b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BOOSTER_COMBO_NO_PLACE, {
value: b - a
});
return 0 < a
},
moves: function(a) {
var b = a.amount;
if (-1 === Game.currentGame.moves)
return !1;
Game.currentGame.setMoves(Game.currentGame.moves + b, {
animate: !0,
actionBefore: !0,
fromLantern: a.lantern
});
Game.currentGame.beginMoves += b;
return !0
},
multicolor: function(a) {
var b = a.amount;
a = Game.currentGame.field.addRandomMulticolor(b, {
actionBefore: !0,
fromLantern: a.lantern
});
a < b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BOOSTER_MULTICOLOR_NO_PLACE, {
value: b - a
});
return 0 < a
},
lantern: function(a) {
Game.currentGame.field.showLantern(a.lanternStreak)
},
magnet: function() {
var a = cleverapps.Random.shuffle(Game.currentGame.table.cardsThatCanBeReplacedWithBoosters());
if (0 === a.length)
return !1;
var b = a.filter(function(d) {
return d.isOpen()
});
a = 0 < b.length ? b[0] : a[0];
b = Object.assign(a.toJSON(), {
marks: ["magnet"]
});
b = TileFactory.Create(b);
b.setOwner(a.owner);
Game.currentGame.table.replaceCard(a, b);
Game.currentGame.table.trigger("replaceCardWithAnother", a, b);
a.isOpen() && b.flip();
var c = b.marks[0];
c.hide();
Game.currentGame.table.trigger("demonstrateBoosterBefore", b, function() {
c.show(!0)
});
return !0
},
dice: function() {
Game.currentGame.dice.roll();
Game.currentGame.dice.reward();
return !0
},
jokers: function() {
var a = function(c, d) {
if (c) {
var e = TileFactory.Create({
feature: "wild",
x: c.x,
y: c.y,
rotation: c.getRotation()
});
e.setOwner(c.owner);
Game.currentGame.table.insertBeforeCard(c, e);
Game.currentGame.table.trigger("insertCard", e, d ? -2 * cleverapps.styles.CardView.width : 2 * cleverapps.styles.CardView.width)
}
}
, b = Game.currentGame.table.cardsWithPossibilityOfPlacingUnderThem();
a(b.filter(function(c) {
return 0 > c.x
}).pop(), !0);
a(b.filter(function(c) {
return 0 <= c.x
}).pop(), !1);
return !0
},
highlight: function() {
Game.currentGame.currentHighlighter.enable();
return !0
},
eye: function(a) {
a.source.trigger("giveBonus");
return !0
},
magnifier: function(a) {
Game.currentGame.keypad.addMagnifiers(a.amount);
Game.currentGame.keypad.magnifiersShowUp();
return !0
}
};
var UpdateScoreAction = function(a) {
cleverapps.instantTournament.isAvailable() ? cleverapps.instantTournament.reportScore() : cleverapps.scoreTracker.report();
a()
};
var ReportLevelOutcomeAction = function(a) {
cleverapps.platformLogic.reportGameOver && this.game.outcome !== GameBase.OUTCOME_VICTORY ? cleverapps.platformLogic.reportGameOver(a) : cleverapps.platformLogic.reportLevelUp && this.game.outcome === GameBase.OUTCOME_VICTORY ? cleverapps.platformLogic.reportLevelUp(a) : a()
};
var InterstitialAction = function(a) {
this.game.outcome !== GameBase.OUTCOME_GAVEUP || cleverapps.config.lives ? cleverapps.rewardedAdsManager.showInterstitial(function(b) {
b && cleverapps.noAds.needToNudge(!0) ? (new NoAdsWindow,
cleverapps.focusManager.onceNoWindowsListener = a) : a()
}) : a()
};
InterstitialAction.checkLastFocus = function() {
var a = cleverapps.meta.lastFocus;
return a ? a.startsWith("missionCompleted") || -1 !== "onLevelUp FinishQuest ExitExpeditionIconClicked openChestWindow updateBuildPassUnit GiveRuinReward ConfirmSpeedUpWindowLock StartUnitDialogue StartUnitGreeting".split(" ").indexOf(a) : !1
}
;
InterstitialAction.showOnLowMonetization = function() {
if (cleverapps.flags.lowMonetization) {
if (Game.currentGame && Game.currentGame.counter.isActive() || Game.currentGame && Game.currentGame.goalCounter && Game.currentGame.goalCounter.isActive() || cleverapps.focusManager.isFocused())
return !1;
cleverapps.rewardedAdsManager.showInterstitial()
}
}
;
var VictoryMessageAction = function(a) {
if (Game.currentGame.outcome !== GameBase.OUTCOME_VICTORY)
a();
else {
cleverapps.audio.playSound(bundles.main.urls.congratulate_sfx);
var b = Game.currentGame;
["heroes", "runes", "adventure"].includes(cleverapps.config.name) ? cleverapps.exclamation.show("message.YouWin", Exclamation.Types.Congrats, a) : "board" === cleverapps.config.type ? b.counter.setTimeout(a, 650) : (b.counter.inc(),
b.showMessage("GameMessage.Victory", function() {
console.log("GameMessage.Victory callback");
b.counter.dec();
a()
}))
}
};
var HideAnimations = function(a) {
a()
};
var BeforeWinAction = function() {
var a = cleverapps.scenes.getRunningScene();
a.startMusicAction && !a.startMusicAction.isDone() && (a.stopAction(a.startMusicAction),
delete a.startMusicAction);
cleverapps.audio.fadeOut();
this.level.isPassed = this.outcome === GameBase.OUTCOME_VICTORY;
cleverapps.placements.run(Placements.AFTER_GAME_FINISH);
a = this.outcome;
a !== GameBase.OUTCOME_VICTORY && a !== GameBase.OUTCOME_GAVEUP || this.giveLife();
this.level.isRegular() && cleverapps.isKnockoutGame() && cleverapps.meta.getRumble().moveNextRound(a);
this.addBasicReward();
this.getMode() === GameBase.MODE_HIGHSCORE && cleverapps.highscore.gamePlayed(a, this);
this.level.isRegular() && cleverapps.meta.getMainObject().gamePlayed(a, this);
"KeypadControl" === cleverapps.focusManager.focus && this.keypad.reset();
var b = Lantern.Get();
if (b && b.isActive(this.level))
b.onChangeOutcome(a);
a === GameBase.OUTCOME_VICTORY && BeforeWinVictoryAction.call(this)
}
, BeforeWinVictoryAction = function() {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.LEVEL_PASSED_TIME, {
hash: this.level.hash,
passedTime: this.timer.getTime()
});
if (this.level.isRegular() || this.level.isBonusWorldLevel()) {
void 0 !== this.leftMoves && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.LEVEL_LEFT_MOVES, {
hash: this.level.hash,
leftMoves: this.leftMoves
});
var a = !0;
"board" === cleverapps.config.type && (a = this.timer.getTime() <= cleverapps.parseInterval("5 minutes"));
a && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.LEVEL_FINISH, {
hash: this.level.hash
});
(this.level.isNew() || this.level.isBonusWorldLevel()) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.UNIQUE_FINISH, {
hash: this.level.hash
});
this.level.isBonus() && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BONUS_LEVEL_FINISH)
}
var b = this.level.isCurrentLevel();
this.boatswain.level = this.level = this.level.clone();
this.level.isCurrentLevel = function() {
return b
}
;
if (this.level.isDailyLevel())
cleverapps.dailyLevel.onWin(this.level);
this.level.isBonusWorldLevel() && cleverapps.missionManager.dispatchEvent(Mission.TYPE_BONUS_WORLD, {
level: this.level
});
cleverapps.missionManager.refreshTeaser();
"board" === cleverapps.config.type && BeforeWinVictoryWordAction.call(this);
this.eraseSave()
}
, BeforeWinVictoryWordAction = function() {
levels.gameHints.reset();
if (this.level.isCurrentLevel() && this.tournament) {
var a = this.competition.calcPlace() + 1;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.TOURNAMENT_LEVEL_PLACE + "_" + a)
}
if (this.competition && this.rewards.mission)
this.competition.onAnimateResults(this.rewards.mission.amount)
};
var MinigameFinishAction = function(a) {
var b = this.game.primaryMission;
b && b.isMinigameReadyToFinish() ? (new b.nudgeWindow(b),
cleverapps.focusManager.onceNoWindowsListener = a) : a()
};
var BackToAdminOrEditorAction = function() {
var a = cleverapps.getRequestParameters(location.hash);
return "editor" === a.mode ? (cleverapps.setUrlHash({
playLevel: void 0
}),
this.level.edit(),
!0) : "admin" === a.mode ? (cleverapps.setUrlHash({
playLevel: void 0
}),
AdministratorScene.open(),
!0) : !1
};
var PurgeOldGameAction = function(a) {
this.game && !this.game.stopped && cleverapps.throwAsync("purgeOldGame active game");
this.game = Game.currentGame = void 0;
a()
};
var SaveFinalResultsAction = function(a) {
var b = this.game.outcome;
b === GameBase.OUTCOME_VICTORY && this.level.isDailyCup() && (cleverapps.dailyCup.addAmount(this.game.getDailyCupStars()),
cleverapps.dailyCup.reload(!0),
cleverapps.playSession.set(cleverapps.EVENTS.CUP_PLAYERS + cleverapps.dailyCup.type, !0),
cleverapps.eventBus.trigger("taskEvent", DailyTasks.PASS_DAILY_CUP_LEVEL));
if (b === GameBase.OUTCOME_VICTORY && "match3" === cleverapps.config.type) {
if (!cleverapps.user.isPassedAll()) {
var c = this.level.getHumanReadableNumber();
cleverapps.activities.send(Activities.TYPES.LVL_PASSED, {
userName: cleverapps.user.getPlayerInfo().name,
score: this.game.score.getPoints(),
levelNo: c
})
}
this.level.isRegular() && this.level.isNew() && cleverapps.exp.isAvailable() && !this.game.rewards[GameBase.REWARD_EXP] && (this.game.rewards[GameBase.REWARD_EXP] = this.level.isHard() ? GameBase.HARD_LEVEL_EXP_PRIZE : GameBase.EXP_PRIZE);
cleverapps.starChest && (this.level.isRegular() && this.level.isNew() || this.level.isDailyCup()) && (this.game.rewards.stars = this.game.score.stars);
this.level.isRegular() && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.LEVEL_STARS, {
hash: this.level.hash,
stars: this.game.score.stars
})
}
this.game.rewards[GameBase.REWARD_BOOSTERS] && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.BOOSTER_CELL_RECEIVED);
this.level.isCurrentLevel() && (b === GameBase.OUTCOME_VICTORY && (cleverapps.eventBus.trigger("taskEvent", DailyTasks.PASS_LEVEL, {
level: this.level.getHumanReadableNumber()
}),
this.level.isHard() && cleverapps.eventBus.trigger("taskEvent", DailyTasks.PASS_LEVEL_HARD)),
cleverapps.isKnockoutGame() ? cleverapps.meta.getRumble().outcome === Rumble.OUTCOME_WIN && (this.game.rewards.incLevel = 1) : b === GameBase.OUTCOME_VICTORY && cleverapps.meta.getType() !== Meta.FARM && (this.game.rewards.incLevel = 1));
"tile3" === cleverapps.config.type && cleverapps.eventBus.trigger("taskEvent", DailyTasks.COLLECT_TILES, this.game.collectedTiles);
"blocks" === cleverapps.config.type && (this.game.getMode() === GameBase.MODE_HIGHSCORE && cleverapps.eventBus.trigger("taskEvent", DailyTasks.SCORE_POINTS, this.game.score.points),
cleverapps.eventBus.trigger("taskEvent", DailyTasks.EXPLODE_LINES, this.game.explodedLines));
cleverapps.restoreProgress.update();
a()
};
var ShowOutcomeWindow = function(a) {
var b = this.game.outcome
, c = this.game.boatswain
, d = this.transitionVictory = b === GameBase.OUTCOME_VICTORY && Transition.isVictoryTransitionAvailable() && !this.level.isBonus() && !this.level.isHard() && !LevelStartWindow.isAvailable(MethaHelper.getCurrentLevel()) && 0 === cleverapps.missionManager.getRunningMissions().length && cleverapps.stickersBook && cleverapps.stickersBook.isAvailable() && cleverapps.stickersBook.isCompleted();
b === GameBase.OUTCOME_GAVEUP ? a() : b === GameBase.OUTCOME_LOST && "battlefield" !== cleverapps.config.type ? ShowLoseWindow.call(this, a) : d ? ((new RewardsList(this.game.rewards,{
event: cleverapps.EVENTS.EARN.LEVEL_REWARD
})).receiveRewards(),
c && c.setIntent(c.canNext() ? Boatswain.NEXT_INTENT : Boatswain.RETURN_INTENT),
a()) : ShowVictoryWindow.call(this, a)
}
, ShowVictoryWindow = function(a) {
new VictoryWindow(this.game);
cleverapps.focusManager.onceNoWindowsListener = a
}
, ShowLoseWindow = function(a) {
cleverapps.focusManager.compound(a, [function(b) {
cleverapps.isRumble() && "differences" !== cleverapps.config.name ? (new BeforeLoseWindow(this.game),
cleverapps.focusManager.onceNoWindowsListener = b) : b()
}
.bind(this), function(b) {
new LoseWindow(this.game);
cleverapps.focusManager.onceNoWindowsListener = b
}
.bind(this)])
};
var DailyTask = function() {
cleverapps.EventEmitter.call(this);
this.goal = this.type = void 0;
this.progress = 0;
this.collected = !1;
this.data = this.difficulty = void 0
};
DailyTask.prototype = Object.create(cleverapps.EventEmitter.prototype);
DailyTask.prototype.constructor = DailyTask;
DailyTask.prototype.isSwappable = function() {
return -1 !== [DailyTasks.WATCH_ADS].indexOf(this.type)
}
;
DailyTask.CreateCompleteAll = function() {
var a = new DailyTask;
a.type = DailyTasks.COMPLETE_ALL;
a.goal = 5;
a.icon = "daily_task_icon_complete_all_png";
a.data = {};
return a
}
;
DailyTask.Create = function(a) {
var b = new DailyTask;
b.type = a.type;
b.goal = a.goal;
b.difficulty = a.difficulty;
b.data = {};
Object.keys(a).forEach(function(c) {
-1 === ["type", "goal", "difficulty"].indexOf(c) && (b.data[c] = a[c])
});
return b
}
;
DailyTask.prototype.load = function(a, b) {
this.type = a.type;
this.goal = a.goal;
this.progress = a.progress;
this.lastProgress = a.lastProgress;
this.collected = a.collected;
this.data = a.data || {};
this.data.color && -1 === DailyTasks.CELL_COLORS.indexOf(this.data.color) && (this.data.color = cleverapps.Random.choose(DailyTasks.CELL_COLORS));
this.data.cardValue && -1 === DailyTasks.CARD_VALUES.indexOf(this.data.cardValue) && (this.data.cardValue = cleverapps.Random.choose(DailyTasks.CARD_VALUES));
this.difficulty = this.guessDifficulty(b)
}
;
DailyTask.prototype.guessDifficulty = function(a) {
return 1 >= a ? DailyTask.EASY : 2 <= a && 3 >= a ? DailyTask.MEDIUM : DailyTask.HARD
}
;
DailyTask.prototype.getSaveInfo = function() {
return {
type: this.type,
goal: this.goal,
progress: this.progress,
lastProgress: this.lastProgress,
collected: this.collected,
data: this.data
}
}
;
DailyTask.prototype.addProgress = function(a, b) {
b = "object" === typeof a ? a : b;
a = "number" !== typeof a ? 1 : a;
if (0 < a)
return this.setProgress(this.progress + a, b)
}
;
DailyTask.prototype.isApplicable = function(a) {
switch (this.type) {
case DailyTasks.COLLECT_COLOR_CELLS:
return this.data.color === a.color;
case DailyTasks.GUESS_WORDS_WITH_LETTER:
return this.data.letter === a.letter;
case DailyTasks.COLLECT_CARDS_BY_VALUE:
return this.data.cardValue === a.cardValue;
case DailyTasks.COLLECT_CARDS_BY_SUIT:
return this.data.cardSuit === a.cardSuit;
case DailyTasks.COLLECT_HERO_CELLS:
return this.data.color === a.color;
case DailyTasks.MERGE:
return this.data.mergeAmount <= a.mergeAmount
}
return !0
}
;
DailyTask.prototype.notifyProgress = function() {
if (this.progress !== this.lastProgress) {
void 0 === this.lastProgress && (this.lastProgress = 0);
var a = this.getTitle();
cleverapps.notification.create(a.text, {
toReplace: a.replace,
image: bundles.notification.frames.icon,
progress: {
amount: this.lastProgress,
newAmount: this.progress,
total: this.goal
}
});
this.lastProgress = this.progress
}
}
;
DailyTask.prototype.setProgress = function(a, b) {
this.isApplicable(b) && !this.isFinished() && (a = "number" !== typeof a ? 1 : a,
a > this.goal && (a = this.goal),
a !== this.progress && (this.progress = a,
this.trigger("update"),
this.save(),
this.isFinished() && cleverapps.dailyTasks.taskWasFinished(this),
this.type !== DailyTasks.COMPLETE_ALL && setTimeout(this.notifyProgress.bind(this), 0)))
}
;
DailyTask.prototype.isFinished = function() {
return this.progress >= this.goal
}
;
DailyTask.prototype.collect = function() {
this.isFinished() && !this.collected && (this.collected = !0,
this.save(),
this.trigger("update"),
cleverapps.dailyTasks.onChangeStateListener())
}
;
DailyTask.prototype.givePrize = function() {
this.isFinished() && !this.collected && (cleverapps.dailyTasks.collect(this),
RewardWindow.createDailyTaskWindow(this))
}
;
DailyTask.prototype.save = function() {
cleverapps.dailyTasks.save()
}
;
DailyTask.prototype.getTitle = function() {
var a = {};
DailyTasks.COLLECT_COLOR_CELLS === this.type && (a.color = Messages.get("ColorCell." + this.data.color + ".Title"));
DailyTasks.GUESS_WORDS_WITH_LETTER === this.type && this.data.letter && (a.letter = this.data.letter.toUpperCase());
DailyTasks.COLLECT_HERO_CELLS === this.type && (a.heroes = Messages.get("DailyTask.24." + this.data.color));
if (DailyTasks.COLLECT_CARDS_BY_VALUE === this.type) {
var b = parseInt(this.data.cardValue) || this.data.cardValue;
a.cards = "number" === typeof b ? b : Messages.get("DailyTask.25." + b)
}
DailyTasks.COLLECT_CARDS_BY_SUIT === this.type && (a.cards = Messages.get("DailyTask.26." + this.data.cardSuit));
DailyTasks.MERGE === this.type && (a.amount = this.data.mergeAmount);
-1 !== [DailyTasks.SPEND_HARD, DailyTasks.SPEND_SOFT].indexOf(this.type) && (a.amount = this.goal);
return {
text: "DailyTask." + this.type + ".Title",
replace: a
}
}
;
DailyTask.prototype.getIcon = function() {
if (DailyTasks.GUESS_WORDS_WITH_LETTER === this.type) {
var a = CharView.Create(this.data.letter, {
bgImage: bundles.dailytasks.frames.letter_bg_png
});
"scramble" === cleverapps.config.name && a.setScale(.8);
return a
}
a = DailyTasks.CONFIG[this.type].icon;
"object" === typeof a && (a = a[this.data.color || this.data.cardValue || this.data.cardSuit]);
return new cc.Sprite(bundles.dailytasks.frames[a])
}
;
DailyTask.prototype.getReward = function() {
if (this.data.customReward)
return this.data.customReward;
var a = this.type === DailyTasks.COMPLETE_ALL ? RewardsConfig.DailyTask.completeAll : RewardsConfig.DailyTask[["easy", "medium", "hard"][this.difficulty]];
a = cleverapps.Random.choose(a);
-1 !== ["board", "match3"].indexOf(cleverapps.config.type) && (a = cleverapps.user.prepareRewardByRich(a));
return a
}
;
DailyTask.EASY = 0;
DailyTask.MEDIUM = 1;
DailyTask.HARD = 2;
var DailyTasks = function() {
this.onChangeStateListener = function() {}
;
this.onTaskSwappedOut = function() {}
;
this.tasks = [];
this.whenStart = -1;
this.isAvailable() ? this.load() : this.save();
cleverapps.whenAllInitialized(this.update.bind(this));
cleverapps.user.on("incLevel", this.update.bind(this));
cleverapps.eventBus.on("mapEvent", this.onMapEvent.bind(this));
cleverapps.eventBus.on("taskEvent", this.onTaskEvent.bind(this))
};
DailyTasks.prototype.getInfo = function() {
return {
whenStart: this.whenStart,
tasks: this.tasks.map(function(a) {
return a.getSaveInfo()
})
}
}
;
DailyTasks.prototype.load = function(a) {
this.isAvailable() ? (a = a || cleverapps.dataLoader.load(DataLoader.TYPES.DAILY_TASKS) || {},
this.tasks = [],
this.whenStart = void 0 !== a.whenStart ? a.whenStart : -1,
this.whenStart > this.getStartTime() && (this.whenStart = this.getStartTime()),
a.tasks && 6 === a.tasks.length && a.tasks.every(function(b) {
return DailyTasks.CONFIG[b.type]
}) ? this.tasks = a.tasks.map(function(b, c) {
var d = new DailyTask;
d.load(b, c);
return d
}) : this.whenStart = -1) : (this.tasks = [],
this.whenStart = -1)
}
;
DailyTasks.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.DAILY_TASKS, this.getInfo());
!1 !== a && cleverapps.synchronizer.addUpdateTask("dailytasks")
}
;
DailyTasks.prototype.collect = function(a) {
a.collected || (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DAILY_TASK_REWARD + (a.difficulty || 3)),
cleverapps.playSession.inc(cleverapps.EVENTS.SESSION_DAILY_TASK_REWARD),
a.collect(),
cleverapps.activities.send(Activities.TYPES.DAILY_TASK, {
userName: cleverapps.user.getPlayerInfo().name
}))
}
;
DailyTasks.prototype.collectLastTask = function() {
var a = cleverapps.dailyTasks.getCompleteAllTask();
a.progress !== a.goal || a.collected || 1 !== cleverapps.dailyTasks.getNotCollectedTasks().length || a.givePrize()
}
;
DailyTasks.prototype.pick5Pack = function() {
var a = cleverapps.Random.chooseAmount(this.listTaskByDifficulty(DailyTask.EASY).slice(), 2)
, b = cleverapps.Random.chooseAmount(this.listTaskByDifficulty(DailyTask.MEDIUM).slice(), 2)
, c = cleverapps.Random.chooseAmount(this.listTaskByDifficulty(DailyTask.HARD).slice(), 1);
a = a.concat(b).concat(c);
a.push(DailyTask.CreateCompleteAll());
return a.map(function(d) {
return new DailyTask.Create(d)
})
}
;
cleverapps.config.debugMode && (DailyTasks.GuessName = function(a) {
return Object.keys(DailyTasks).find(function(b) {
return DailyTasks[b] === a
})
}
);
DailyTasks.prototype.listTaskByDifficulty = function(a) {
this._generatedTasks || (this._generatedTasks = this.generateAllTasks());
return this._generatedTasks[a]
}
;
DailyTasks.prototype.generateAllTasks = function() {
var a = [DailyTasks.COMPLETE_ALL]
, b = [[], [], []];
Object.keys(DailyTasks.CONFIG).forEach(function(c) {
var d = +c;
if (-1 !== a.indexOf(d))
return !1;
c = DailyTasks.CONFIG[d].generate();
void 0 !== c && (Array.isArray(c) || (c = [c]),
c.forEach(function(e) {
e.type = d;
b[e.difficulty].push(e)
}))
});
return b
}
;
DailyTasks.prototype.getStartTime = function() {
var a = new Date
, b = 6E4 * a.getTimezoneOffset();
return a.getTime() - (a.getTime() - b) % DailyTasks.INTERVAL
}
;
DailyTasks.prototype.startNewTasks = function() {
this.tasks = this.pick5Pack();
this.whenStart = this.getStartTime();
this.save();
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DAILY_TASKS_START)
}
;
DailyTasks.prototype.getNotCollectedTasks = function() {
return this.tasks.filter(function(a) {
return a.isFinished() && !a.collected
})
}
;
DailyTasks.prototype.isAllTasksFinished = function() {
return 0 === cleverapps.dailyTasks.getActiveTasks().length
}
;
DailyTasks.prototype.getActiveTasks = function() {
return this.tasks.filter(function(a) {
return !a.isFinished()
})
}
;
DailyTasks.prototype.getFinishedTasks = function() {
return this.tasks.filter(function(a) {
return a.isFinished()
})
}
;
DailyTasks.prototype.swapOutTask = function(a, b) {
var c = this.tasks.indexOf(a);
if (!b) {
a = this.listTaskByDifficulty(a.difficulty);
var d = this.tasks.map(function(e) {
return e.type
});
a = a.filter(function(e) {
return -1 === d.indexOf(e.type)
});
b = cleverapps.Random.choose(a)
}
this.tasks[c] = new DailyTask.Create(b);
this.onTaskSwappedOut(c);
this.save()
}
;
DailyTasks.prototype.addProgress = function(a, b, c) {
var d = this.getActiveTasks().filter(function(e) {
return e.type === a
});
0 !== d.length && (a === DailyTasks.SPEND_HARD && (d = [d[0]]),
d.forEach(function(e) {
e.addProgress(b, c)
}))
}
;
DailyTasks.prototype.getTimeLeft = function() {
return Math.max(0, this.whenStart + DailyTasks.INTERVAL - Date.now())
}
;
DailyTasks.prototype.isAvailable = function(a) {
return levels.user.checkAvailable(cleverapps.Availables.DAILY_TASKS, a)
}
;
DailyTasks.prototype.update = function() {
clearTimeout(this.finishTimeout);
this.isAvailable() && (0 === this.getTimeLeft() && (this._generatedTasks = void 0,
this.startNewTasks()),
this.finishTimeout = new cleverapps.LongTimeout(this.update.bind(this),this.getTimeLeft()),
this.onChangeStateListener())
}
;
DailyTasks.prototype.getTasks = function() {
return this.tasks
}
;
DailyTasks.prototype.processDiscoverWord = function(a) {
cleverapps.unique(a.split("")).forEach(function(b) {
cleverapps.dailyTasks.addProgress(DailyTasks.GUESS_WORDS_WITH_LETTER, 1, {
letter: b
})
});
7 <= a.length && cleverapps.dailyTasks.addProgress(DailyTasks.GUESS_LONG_WORDS, 1)
}
;
DailyTasks.prototype.processOpenCard = function(a) {
"solitaire" === cleverapps.config.type && (this.addProgress(DailyTasks.COLLECT_CARDS_BY_VALUE, 1, {
cardValue: a.getRank()
}),
this.addProgress(DailyTasks.COLLECT_CARDS_BY_SUIT, 1, {
cardSuit: a.getSuit()
}))
}
;
DailyTasks.prototype.getCompleteAllTask = function() {
return this.getTasks().filter(function(a) {
return a.type === DailyTasks.COMPLETE_ALL
})[0]
}
;
DailyTasks.prototype.taskWasFinished = function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DAILY_TASK_FINISH_AMOUNT + this.getFinishedTasks().length);
a.type !== DailyTasks.COMPLETE_ALL && this.addProgress(DailyTasks.COMPLETE_ALL);
this.preparePush();
this.onChangeStateListener()
}
;
DailyTasks.prototype.preparePush = function() {
if (!(2 > this.getFinishedTasks().length)) {
var a;
0 < this.getActiveTasks().length && this.getTimeLeft() > DailyTasks.PUSH_UNTIL_RESET_TIME && (a = this.getTimeLeft() - DailyTasks.PUSH_UNTIL_RESET_TIME);
cleverapps.localPushes.sendPush(cleverapps.LocalPushes.TYPES.DAILY_TASKS_UNCOMPLETED, a)
}
}
;
DailyTasks.prototype.onTaskEvent = function(a, b, c) {
cleverapps.dailyTasks.addProgress(a, "number" !== typeof b ? 1 : b, "object" === typeof b ? b : c)
}
;
DailyTasks.prototype.onMapEvent = function(a, b) {
if ("merge" === cleverapps.config.type)
switch (a) {
case Map2d.MINE:
a = b.affected.getData();
a.source && a.mineable && cleverapps.dailyTasks.addProgress(DailyTasks.DESTROY_ENT);
break;
case Map2d.COMPLETE_MINING:
b.task.energy && cleverapps.dailyTasks.addProgress(DailyTasks.USE_WORKER);
break;
case Map2d.BUILD:
cleverapps.dailyTasks.addProgress(DailyTasks.USE_WORKER);
cleverapps.dailyTasks.addProgress(DailyTasks.BUILD);
break;
case Map2d.MERGE:
cleverapps.dailyTasks.addProgress(DailyTasks.MERGE, 1, {
mergeAmount: b.affected.length
});
b.affected.some(function(c) {
return "crystal" === c.code && c.isLast()
}) && cleverapps.dailyTasks.addProgress(DailyTasks.USE_RAINBOW);
break;
case Map2d.PRIZE_HARVESTED:
!0 === b.affected.getData().chest && cleverapps.dailyTasks.addProgress(DailyTasks.OPEN_CHEST);
break;
case Map2d.SPAWN:
a = function(c, d) {
if (Array.isArray(b.affected) && (d = b.affected.filter(d),
0 < d.length))
return c.stage > d[0].stage
}
;
b.unit.getType() === cleverapps.unitsLibrary.getExpeditionUnitType("fruit") && 4 > b.unit.stage ? (!b.affected || !Array.isArray(b.affected) && -1 !== ["chest", "fruit", "source"].map(cleverapps.unitsLibrary.getExpeditionUnitType).indexOf(b.affected.getType())) && cleverapps.dailyTasks.addProgress(DailyTasks.GROW_PLANT) : "source" === b.unit.getType() ? a(b.unit, function(c) {
return "source" === c.getType()
}) && cleverapps.dailyTasks.addProgress(DailyTasks.CREATE_SOURCE) : "wands" === b.unit.code ? a(b.unit, function(c) {
return "wands" === c.code
}) && cleverapps.dailyTasks.addProgress(DailyTasks.MERGE_SOLDIERS) : b.affected instanceof Unit && ("field" === b.affected.getType() || b.affected.getData().fruit && b.affected.getType() === cleverapps.unitsLibrary.getExpeditionUnitType("fruit") && 4 === b.unit.stage) && cleverapps.dailyTasks.addProgress(DailyTasks.HARVEST_FRUITS);
break;
case Map2d.OPENFOG:
cleverapps.dailyTasks.addProgress(DailyTasks.OPEN_FOG)
}
}
;
DailyTasks.INTERVAL = cleverapps.parseInterval(cleverapps.config.debugMode ? "10 minutes" : "1 day");
DailyTasks.PUSH_UNTIL_RESET_TIME = cleverapps.parseInterval("5 hours");
DailyTasks.PASS_LEVEL = 4;
DailyTasks.WATCH_ADS = 7;
DailyTasks.USE_MULTI_COLOR_CELL = 8;
DailyTasks.USE_BOOSTER = 9;
DailyTasks.COLLECT_COLOR_CELLS = 10;
DailyTasks.SPEND_HARD = 13;
DailyTasks.GUESS_WORDS_WITH_LETTER = 16;
DailyTasks.COLLECT_HERO_CELLS = 24;
DailyTasks.COLLECT_CARDS_BY_VALUE = 25;
DailyTasks.COLLECT_CARDS_BY_SUIT = 26;
DailyTasks.DESTROY_ENT = 28;
DailyTasks.MAKE_ORDER = 29;
DailyTasks.USE_RAINBOW = 30;
DailyTasks.MERGE_SOLDIERS = 31;
DailyTasks.HARVEST_FRUITS = 32;
DailyTasks.USE_WORKER = 33;
DailyTasks.OPEN_CHEST = 34;
DailyTasks.COLLECT_PIXEL = 35;
DailyTasks.MERGE = 36;
DailyTasks.BUY_UNITS_SHOP_ITEMS = 37;
DailyTasks.PLAY_MINESWEEPER = 38;
DailyTasks.SPEND_SOFT = 39;
DailyTasks.CREATE_SOURCE = 40;
DailyTasks.COMPLETE_ALL = 41;
DailyTasks.BUILD = 43;
DailyTasks.GROW_PLANT = 44;
DailyTasks.PASS_DAILY_CUP_LEVEL = 45;
DailyTasks.PASS_LEVEL_HARD = 46;
DailyTasks.GUESS_LONG_WORDS = 47;
DailyTasks.GET_FULL_COMBO = 48;
DailyTasks.USE_BOOSTER_BEFORE = 49;
DailyTasks.PASS_KNOCKOUT = 50;
DailyTasks.PLAY_MINI_GAME = 51;
DailyTasks.ENERGY_LOTTERY = 52;
DailyTasks.OPEN_FOG = 53;
DailyTasks.FINISH_QUEST = 54;
DailyTasks.USE_UP_INSTANT_WORKER = 55;
DailyTasks.LEVEL_UP = 56;
DailyTasks.FINISH_EXPEDITION = 57;
DailyTasks.OPEN_STAR_CHEST = 58;
DailyTasks.UPGRADE_HERO = 59;
DailyTasks.COLLECT_TILES = 60;
DailyTasks.SCORE_POINTS = 61;
DailyTasks.EXPLODE_LINES = 62;
DailyTasks.CELL_COLORS = ["a", "b", "d"];
DailyTasks.CARD_VALUES = ["j", "q", "k", "a"];
DailyTasks.CONFIG = {};
DailyTasks.CONFIG[DailyTasks.WATCH_ADS] = {
generate: function() {
if (connector.ads.isRewardedAvailable && !cleverapps.paymentsHistory.isVIP())
return {
goal: cleverapps.Random.random(10, 15),
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_watch_ads_png"
};
DailyTasks.CONFIG[DailyTasks.SPEND_SOFT] = {
generate: function() {
if (cleverapps.config.soft)
return {
goal: 35,
customReward: {
soft: 40
},
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_spend_coins_png"
};
DailyTasks.CONFIG[DailyTasks.SPEND_HARD] = {
generate: function() {
if (!1 !== cleverapps.config.soft)
return {
customReward: {
hard: 18
},
goal: 15,
difficulty: DailyTask.EASY
};
var a = 50 * Math.floor(cleverapps.Random.random(500, 750) / 50);
return [{
goal: 200,
customReward: {
hard: 150
},
difficulty: DailyTask.EASY
}, {
goal: a,
customReward: {
hard: 50 * Math.floor(.75 * a / 50)
},
difficulty: DailyTask.HARD
}]
},
icon: "daily_task_icon_spend_gold_png"
};
DailyTasks.CONFIG[DailyTasks.PASS_LEVEL] = {
generate: function() {
if ("merge" !== cleverapps.config.type)
return {
goal: cleverapps.Random.random(12, 15),
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_pass_level_png"
};
DailyTasks.CONFIG[DailyTasks.PASS_LEVEL_HARD] = {
generate: function() {
if ("merge" !== cleverapps.config.type && !cleverapps.isKnockoutGame())
return {
goal: cleverapps.Random.random(3, 4),
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_hard_level_png"
};
DailyTasks.CONFIG[DailyTasks.GUESS_WORDS_WITH_LETTER] = {
generate: function() {
var a = ["ko"];
if ("board" === cleverapps.config.type && -1 === a.indexOf(cleverapps.settings.language)) {
a = ["e", "o", "a"];
var b = ["p", "c", "t"];
cleverapps.settings.language === cc.sys.LANGUAGE_RUSSIAN ? (a = ["\u0435", "\u043e", "\u0430"],
b = ["\u043f", "\u0441", "\u0442"]) : cleverapps.settings.language === cc.sys.LANGUAGE_JAPANESE && (a = ["\u3042", "\u304b", "\u3061"],
b = ["\u306f", "\u30e9", "\u308f"]);
return [{
letter: cleverapps.Random.choose(a),
goal: 5 * Math.floor(cleverapps.Random.random(50, 75) / 5),
difficulty: DailyTask.MEDIUM
}, {
letter: cleverapps.Random.choose(b),
goal: 5 * Math.floor(cleverapps.Random.random(125, 150) / 5),
difficulty: DailyTask.HARD
}]
}
}
};
DailyTasks.CONFIG[DailyTasks.COLLECT_CARDS_BY_VALUE] = {
generate: function() {
if ("solitaire" === cleverapps.config.type)
return {
goal: 5 * Math.floor(cleverapps.Random.random(25, 50) / 5),
difficulty: DailyTask.HARD,
cardValue: cleverapps.Random.choose(DailyTasks.CARD_VALUES)
}
},
icon: {
j: "daily_task_icon_cards_by_value_j_png",
q: "daily_task_icon_cards_by_value_q_png",
k: "daily_task_icon_cards_by_value_k_png",
a: "daily_task_icon_cards_by_value_a_png"
}
};
DailyTasks.CONFIG[DailyTasks.COLLECT_CARDS_BY_SUIT] = {
generate: function() {
if ("solitaire" === cleverapps.config.type)
return {
goal: 5 * Math.floor(cleverapps.Random.random(50, 75) / 5),
difficulty: DailyTask.MEDIUM,
cardSuit: cleverapps.Random.choose(Card.SUITS)
}
},
icon: {
c: "daily_task_icon_cards_by_suit_c_png",
d: "daily_task_icon_cards_by_suit_d_png",
h: "daily_task_icon_cards_by_suit_h_png",
s: "daily_task_icon_cards_by_suit_s_png"
}
};
DailyTasks.CONFIG[DailyTasks.GET_FULL_COMBO] = {
generate: function() {
if ("solitaire" === cleverapps.config.type)
return {
goal: 30,
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_full_combo_png"
};
DailyTasks.CONFIG[DailyTasks.USE_MULTI_COLOR_CELL] = {
generate: function() {
if ("match3" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(25, 30),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_multi_color_cell_png"
};
DailyTasks.CONFIG[DailyTasks.USE_BOOSTER] = {
generate: function() {
if (0 !== cleverapps.boosters.listBoosters().length)
return {
goal: cleverapps.Random.random(3, 5),
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_use_booster_png"
};
DailyTasks.CONFIG[DailyTasks.USE_BOOSTER_BEFORE] = {
generate: function() {
if (0 !== cleverapps.boosters.listBoostersBefore().length)
return {
goal: cleverapps.Random.random(3, 5),
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_booster_before_png"
};
DailyTasks.CONFIG[DailyTasks.COLLECT_COLOR_CELLS] = {
generate: function() {
if ("match3" === cleverapps.config.type) {
var a = cleverapps.Random.choose(DailyTasks.CELL_COLORS);
return [{
goal: 100 * Math.floor(cleverapps.Random.random(500, 1E3) / 100),
difficulty: DailyTask.MEDIUM,
color: a
}, {
goal: 100 * Math.floor(cleverapps.Random.random(2500, 3E3) / 100),
difficulty: DailyTask.HARD,
color: cleverapps.Random.choose(DailyTasks.CELL_COLORS.filter(function(b) {
return b !== a
}))
}]
}
},
icon: {
a: "daily_task_icon_color_cells_a_png",
b: "daily_task_icon_color_cells_b_png",
d: "daily_task_icon_color_cells_d_png"
}
};
DailyTasks.CONFIG[DailyTasks.COLLECT_HERO_CELLS] = {
generate: function() {
if ("match3" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(25, 30),
difficulty: DailyTask.HARD,
color: cleverapps.Random.choose(DailyTasks.CELL_COLORS)
}
},
icon: {
a: "daily_task_icon_hero_cells_a_png",
b: "daily_task_icon_hero_cells_b_png",
d: "daily_task_icon_hero_cells_d_png"
}
};
DailyTasks.CONFIG[DailyTasks.DESTROY_ENT] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(3, 4),
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_destroy_ent_png"
};
DailyTasks.CONFIG[DailyTasks.MAKE_ORDER] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: 3,
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_make_order_png"
};
DailyTasks.CONFIG[DailyTasks.USE_RAINBOW] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(1, 2),
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_use_rainbow_png"
};
DailyTasks.CONFIG[DailyTasks.MERGE_SOLDIERS] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(10, 15),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_merge_soldiers_png"
};
DailyTasks.CONFIG[DailyTasks.HARVEST_FRUITS] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(30, 40),
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_harvest_fruit_png"
};
DailyTasks.CONFIG[DailyTasks.USE_WORKER] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(25, 50),
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_use_worker_png"
};
DailyTasks.CONFIG[DailyTasks.OPEN_CHEST] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(20, 30),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_open_chest_png"
};
DailyTasks.CONFIG[DailyTasks.COLLECT_PIXEL] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(40, 55),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_collect_pixel_png"
};
DailyTasks.CONFIG[DailyTasks.MERGE] = {
generate: function() {
if ("merge" === cleverapps.config.type) {
var a = cleverapps.Random.choose([9, 17])
, b = cleverapps.Random.random(5, 10);
17 === a && (b = cleverapps.Random.random(3, 4));
return {
mergeAmount: a,
goal: b,
difficulty: DailyTask.MEDIUM
}
}
},
icon: "daily_task_icon_merge_png"
};
DailyTasks.CONFIG[DailyTasks.BUY_UNITS_SHOP_ITEMS] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(1, 2),
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_units_shop_png"
};
DailyTasks.CONFIG[DailyTasks.PLAY_MINESWEEPER] = {
generate: function() {
if ("mergecraft" === cleverapps.config.name)
return {
goal: cleverapps.Random.random(2, 3),
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_minesweeper_png"
};
DailyTasks.CONFIG[DailyTasks.CREATE_SOURCE] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(10, 15),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_create_source_png"
};
DailyTasks.CONFIG[DailyTasks.ENERGY_LOTTERY] = {
generate: function() {
if ("merge" === cleverapps.config.type && 8 >= cleverapps.user.level && Game.currentGame && Game.currentGame.energyLottery && Game.currentGame.energyLottery.isAvailable())
return {
goal: 1,
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_energy_lottery_png"
};
DailyTasks.CONFIG[DailyTasks.OPEN_FOG] = {
generate: function() {
if ("merge" === cleverapps.config.type && 8 >= cleverapps.user.level)
return {
goal: 1,
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_open_fog_png"
};
DailyTasks.CONFIG[DailyTasks.FINISH_QUEST] = {
generate: function() {
if ("merge" === cleverapps.config.type && 8 >= cleverapps.user.level)
return {
goal: cleverapps.Random.random(3, 5),
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_finish_quest_png"
};
DailyTasks.CONFIG[DailyTasks.USE_UP_INSTANT_WORKER] = {
generate: function() {
if ("merge" === cleverapps.config.type && 8 >= cleverapps.user.level)
return {
goal: 1,
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_instant_worker_png"
};
DailyTasks.CONFIG[DailyTasks.BUILD] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(50, 65),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_build_png"
};
DailyTasks.CONFIG[DailyTasks.GROW_PLANT] = {
generate: function() {
if ("merge" === cleverapps.config.type)
return {
goal: cleverapps.Random.random(85, 100),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_grow_plant_png"
};
DailyTasks.CONFIG[DailyTasks.PASS_DAILY_CUP_LEVEL] = {
generate: function() {
if (cleverapps.dailyCup.isAvailable())
return {
goal: cleverapps.Random.random(2, 3),
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_daily_cup_png"
};
DailyTasks.CONFIG[DailyTasks.GUESS_LONG_WORDS] = {
generate: function() {
if ("board" === cleverapps.config.type)
return {
goal: 20,
difficulty: DailyTask.HARD
}
},
icon: "daily_task_icon_long_words_png"
};
DailyTasks.CONFIG[DailyTasks.PASS_KNOCKOUT] = {
generate: function() {
if (cleverapps.isKnockoutGame())
return {
goal: 1,
difficulty: DailyTask.MEDIUM
}
},
icon: "daily_task_icon_knockout_png"
};
DailyTasks.CONFIG[DailyTasks.PLAY_MINI_GAME] = {
generate: function() {
if (void 0 !== bundles.dailytasks.frames.daily_task_icon_mini_game_png)
return {
goal: 1,
difficulty: DailyTask.EASY
}
},
icon: "daily_task_icon_mini_game_png"
};
DailyTasks.CONFIG[DailyTasks.COLLECT_TILES] = {
generate: function() {
if ("tile3" === cleverapps.config.type)
return {
goal: 100 * cleverapps.Random.random(4, 5),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_collect_tiles_png"
};
DailyTasks.CONFIG[DailyTasks.SCORE_POINTS] = {
generate: function() {
if ("blocks" === cleverapps.config.type)
return {
goal: 1E3 * cleverapps.Random.random(3, 4),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_score_points_png"
};
DailyTasks.CONFIG[DailyTasks.EXPLODE_LINES] = {
generate: function() {
if ("blocks" === cleverapps.config.type)
return {
goal: 10 * cleverapps.Random.random(9, 14),
difficulty: DailyTask.HARD
}
},
icon: "daily_task_burn_lines_png"
};
DailyTasks.CONFIG[DailyTasks.COMPLETE_ALL] = {
icon: "daily_task_icon_complete_all_png"
};
var DailyTasksWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this.showMenubar();
this.createContent();
this._super({
name: "dailytaskswindow",
title: cleverapps.dailyTasks.isAllTasksFinished() ? "DailyTasksWindow.finished.title" : "DailyTasksWindow.title",
content: this.content,
foreground: bundles.windows.frames.window_foreground_png,
noPadding: !0
});
this.tabs.activateTab("tasks");
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DAILY_TASKS_OPEN_WINDOW);
cleverapps.playSession.set(cleverapps.EVENTS.SESSION_DAILY_TASK_OPEN_WINDOW, !0)
},
getPerson: function() {
return "merge" === cleverapps.config.type && (cleverapps.unitsLibrary.getActiveHero() || "dwarf")
},
showMenubar: function() {
if ("merge" === cleverapps.config.type) {
var a = [];
cleverapps.dailyTasks.tasks.forEach(function(b) {
(new RewardsList(b.getReward())).rewards.forEach(function(c) {
c.listControls().forEach(function(d) {
-1 === a.indexOf(d) && a.push(d)
})
})
});
cleverapps.focusManager.showControlsWhileFocused(a)
}
},
onClose: function() {
var a = cleverapps.dailyTasks.getCompleteAllTask();
a && a.isFinished() && !a.collected && a.givePrize()
},
createTabs: function() {
var a = function(b) {
b = new b(this);
this.content.addChild(b);
b.setPositionRound(b.width / 2, b.height / 2);
return b
}
.bind(this);
this.dailyTasksTab = a(DailyTasksTab);
this.tabsInfo = {
tasks: {
content: this.dailyTasksTab,
icon: bundles.tabs.frames.dailytasks_icon
}
};
DailyTasksWindow.HasAchievements() && (this.tabsInfo.achievements = {
content: a(AchievementsTab),
icon: bundles.tabs.frames.achievements_icon
})
},
createContent: function() {
var a = cleverapps.styles.DailyTasksWindow
, b = this.content = new cc.Node;
b.setAnchorPoint(.5, .5);
this.createTabs();
b.setContentSize2(this.dailyTasksTab.getContentSize());
var c = this.tabs = new Tabs(this.tabsInfo,a.tabs);
b.addChild(c);
c.setPositionRound(a.tabs);
c.setVisible(1 < Object.keys(this.tabsInfo).length)
},
showHint: function(a) {
this.minimal && (this.stopAction(this.minimalAction),
this.minimal.remove());
this.minimal = new MinimalDialogue({
delay: 0,
text: a,
rects: this.getMinimalDialogueRects()
});
this.addChild(this.minimal);
this.minimal.display();
this.minimalAction = this.runAction(new cc.Sequence(new cc.DelayTime(2),new cc.CallFunc(function() {
this.minimal.remove();
delete this.minimal
}
.bind(this))))
},
listBundles: function() {
return ["dailytasks"]
}
});
DailyTasksWindow.HasAchievements = function() {
return cleverapps.achievements && cleverapps.config.debugMode
}
;
cleverapps.styles.DailyTasksWindow = {
tabs: {
height: 130,
direction: cleverapps.UI.VERTICAL,
x: {
align: "left",
dx: -115
},
y: {
align: "top",
dy: -85
}
}
};
var DailyTasksTab = cleverapps.Layout.extend({
ctor: function(a) {
var b = []
, c = cleverapps.styles.DailyTasksTab
, d = "tropical" === cleverapps.config.ui && "merge" === cleverapps.config.type;
a = new DailyTaskTimer(a.close.bind(a),d);
b.push(new DailyTasksCompleteAllView(d && a));
b.push(this.createScroll());
d || (d = cleverapps.UI.wrapWithPadding(a, c.timer.padding),
c.timer.footer ? b.push(d) : b.unshift(d));
cleverapps.dailyTasks.onTaskSwappedOut = this.createListener(this.animateSwapOut.bind(this));
this._super(b, {
direction: cleverapps.UI.VERTICAL,
margin: c.margin,
padding: c.padding
})
},
createScroll: function() {
var a = cleverapps.styles.DailyTasksTab
, b = this.createTasks()
, c = this.scroll = new cleverapps.UI.ScrollView(b);
c.setContentSize2(b.width + 2 * a.scroll.paddingX, a.scroll.height);
c.setBarPadding(a.scrollBarPadding);
bundles.dailytasks.frames.foreground_png && (b = cleverapps.UI.createScale9Sprite(bundles.dailytasks.frames.foreground_png),
b.setContentSize2("merge" === cleverapps.config.type ? a.foreground.wide.width : a.foreground.width, a.foreground.height),
c.addChild(b),
b.setPositionRound(a.foreground));
return c
},
createTasks: function() {
var a = this.taskViews = [];
cleverapps.dailyTasks.getTasks().filter(function(c) {
return c.type !== DailyTasks.COMPLETE_ALL
}).forEach(function(c) {
c = new DailyTaskView(c);
a.push(c)
}, this);
var b = cleverapps.styles.DailyTasksTab.tasks;
b = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: b.margin,
padding: b.padding
});
b.visibilityCheckList = a;
return b
},
onSelectTab: function() {
cleverapps.dailyTasks.collectLastTask();
this.wasAnimated || (this.wasAnimated = !0,
this.scroll.scrollTo(cleverapps.UI.ScrollView.SCROLLS.LOWER_RIGHT),
this.runAction(new cc.Sequence(new cc.DelayTime(.55),new cc.CallFunc(function() {
for (var a = 0, b = 0; b < this.taskViews.length; b++) {
var c = this.taskViews[b].task;
if (c.isFinished() && !c.collected) {
a = b;
break
}
}
0 === a ? this.scroll.scrollTo(cleverapps.UI.ScrollView.SCROLLS.UPPER_LEFT, 1, {
easing: cc.easeBackInOut()
}) : a === this.taskViews.length - 1 ? this.scroll.scrollTo(cleverapps.UI.ScrollView.SCROLLS.LOWER_RIGHT, 1, {
easing: cc.easeBackInOut()
}) : this.scroll.runAction((new cc.ScrollAction(this.taskViews[a],{
duration: 1,
visibleBox: {
top: .6,
bottom: .6
}
})).easing(cc.easeBackInOut()))
}
.bind(this)))))
},
animateSwapOut: function(a) {
var b = this.taskViews[a]
, c = b.getPosition()
, d = new DailyTaskView(cleverapps.dailyTasks.tasks[a]);
b.parent.addChild(d);
d.setPosition(c.x, c.y + .8 * d.height);
d.setOpacity(0);
d.setScale(1.02);
d.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.Spawn(new cc.MoveTo(.4,c),new cc.FadeIn(.4),new cc.Sequence(new cc.DelayTime(.3),new cc.ScaleTo(.2,1)))));
b.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.035),new cc.DelayTime(.05),new cc.Spawn(new cc.FadeOut(.5),new cc.ScaleTo(.5,.85),new cc.MoveBy(.5,0,-200)),new cc.RemoveSelf));
this.taskViews.splice(a, 1, d)
}
});
cleverapps.styles.DailyTasksTab = {
margin: 0,
padding: {
x: 20,
top: 140,
bottom: 50
},
scroll: {
paddingX: 20,
height: 590
},
scrollBarPadding: {
sidePadding: 8
},
timer: {
padding: {
x: 0,
y: 0
},
footer: !1
},
foreground: {
width: 698,
wide: {
width: 698
},
height: 594,
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
tasks: {
margin: 15,
padding: {
x: 0,
y: 20
}
}
};
var DailyTaskTimer = cleverapps.Layout.extend({
ctor: function(a, b) {
var c = cleverapps.styles.DailyTaskTimer;
b = cleverapps.UI.generateOnlyText("DailyTasksWindow.TimeToRefresh", b ? cleverapps.styles.FONTS.DAILY_TASK_CTA : cleverapps.styles.FONTS.DAILY_TASKS_TIMER_TEXT);
b.fitTo(c.text.width);
a = new Timer(cleverapps.dailyTasks.getTimeLeft(),a);
this._super([b, a], {
direction: cleverapps.UI.HORIZONTAL,
margin: c.margin,
padding: c.padding
});
this.setCascadeOpacityEnabled(!0);
a.setCascadeOpacityEnabled(!0);
a.y += c.offsetY
}
});
cleverapps.styles.DailyTaskTimer = {
margin: 20,
offsetY: 0,
text: {
width: 450
}
};
var DailyTaskView = cc.Node.extend({
ctor: function(a) {
this._super();
this.isWide = "merge" === cleverapps.config.type;
this.task = a;
this.setAnchorPoint(.5, .5);
a = cleverapps.styles.DailyTaskView;
this.icon = this.createIcon();
this.title = this.createTitle();
this.rewards = this.createRewards();
this.title.setAnchorPoint(0, .5);
this.rewards.setAnchorPoint(0, .5);
var b = new cleverapps.Layout([this.title, this.rewards],{
direction: cleverapps.UI.VERTICAL,
margin: a.titleMargin
})
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize(this.isWide ? a.titleAndRewards.wide.width : a.titleAndRewards.width, a.titleAndRewards.height);
c.addChild(b);
b.setPositionRound(a.titleAndRewards);
b = this.createProgressBlock();
this.content = new cleverapps.Layout([this.icon, c, b],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin,
padding: a.padding
});
this.addChild(this.content);
this.background = this.createBackground();
this.setContentSize2(this.background.getContentSize());
this.background.setPositionRound(this.width / 2, this.height / 2);
this.content.setPositionRound(this.width / 2, this.height / 2);
this.createSwapButton();
this.setCascadeOpacityEnabledRecursively(!0);
this.onUpdate();
this.task.on("update", this.onUpdate.bind(this), this)
},
createProgressBlock: function() {
var a = cleverapps.styles.DailyTaskView
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.progressBlock);
this.progressBar = this.createProgressBar();
this.progressBar.setAnchorPoint(.5, .5);
b.addChild(this.progressBar);
this.progressBar.setPositionRound(b.width / 2, b.height / 2);
this.check = new cc.Sprite(bundles.dailytasks.frames.daily_task_mark_png);
b.addChild(this.check);
this.check.setPositionRound(b.width / 2, b.height / 2);
this.rewardButton = new cleverapps.UI.Button({
width: a.button.width,
height: a.button.height,
type: cleverapps.styles.UI.Button.Images.small_button_green,
text: "DailyTaskView.Get",
onClicked: this.onRewardButtonClick.bind(this)
});
this.rewardButton.setCascadeOpacityEnabled(!0);
this.rewardButton.setLocalZOrder(1);
b.addChild(this.rewardButton);
this.rewardButton.setPositionRound(b.width / 2, b.height / 2);
return b
},
createBackground: function() {
var a = cleverapps.UI.createScale9Sprite(bundles.dailytasks.frames.daily_task_bg_png);
a.setContentSize2(this.content.getContentSize());
this.addChild(a, -1);
return a
},
onRewardButtonClick: function() {
this.task.isFinished() && !this.task.collected && (this.rewardsList.receiveRewards(),
this.rewardsList.receiveRewardsAnimation({
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION,
noFadeOut: !0,
callback: cleverapps.dailyTasks.collectLastTask
}),
cleverapps.dailyTasks.collect(this.task))
},
createProgressBar: function() {
var a = cleverapps.styles.DailyTaskView
, b = new ScaledProgressBar({
progress: bundles.progress_bar.frames.bar_dailytask,
background: bundles.progress_bar.frames.bg_dailytask,
progressFrames: a.progressBar.progressFrames,
barText: {
font: cleverapps.styles.FONTS.DAILY_TASK_PROGRESS_FONT,
dy: a.progressBar.text.dy
}
});
b.setAnchorPoint(0, 0);
b.setLength(a.progressBar.width);
b.setPercentage(0);
return b
},
createRewards: function() {
var a = this.task.getReward()
, b = cleverapps.styles.DailyTaskView
, c = cleverapps.UI.generateOnlyText("RewardsListComponent.rewardTitle", cleverapps.styles.FONTS.DAILY_TASK_REWARD_FONT || cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
a = this.rewardsList = new RewardsListComponent(a,{
font: cleverapps.styles.FONTS.DAILY_TASK_REWARD_FONT || cleverapps.styles.FONTS.WINDOW_SMALL_TEXT,
margin: b.reward.margin,
noPrefix: !0,
textDirection: cleverapps.UI.HORIZONTAL,
textMargin: b.reward.textMargin,
small: !0,
iconWrap: b.reward.iconWrap,
noShowControls: !0,
event: cleverapps.EVENTS.EARN.DAILY
});
c = new cleverapps.Layout([c, a],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.reward.margin.x
});
cleverapps.UI.fitToBox(c, {
width: this.isWide ? b.titleAndRewards.wide.width : b.titleAndRewards.width,
height: b.titleAndRewards.height
});
return c
},
createTitle: function() {
var a = cleverapps.styles.DailyTaskView
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(this.isWide ? a.title.wide.width : a.title.width, a.title.height);
b.setCascadeOpacityEnabled(!0);
var c = this.task.getTitle();
c = cleverapps.UI.generateOnlyText(c.text, cleverapps.styles.FONTS.DAILY_TASK_FONT || cleverapps.styles.FONTS.WINDOW_SMALL_TEXT, c.replace);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_LEFT);
c.setDimensions(this.isWide ? a.title.wide.textWidth : a.title.textWidth, 0);
c.fitTo(void 0, b.height);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_LEFT);
b.addChild(c);
c.setPositionRound(c.width / 2, b.height / 2);
return b
},
createIcon: function() {
var a = cleverapps.styles.DailyTaskView.icon
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
var c = this.task.getIcon()
, d = cleverapps.UI.createScale9Sprite(bundles.dailytasks.frames.daily_task_icon_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
a.bg && d.setContentSize2(this.isWide ? a.bg.wide.width : a.bg.width, a.bg.height);
b.addChild(d);
b.setContentSize2(d.getContentSize());
d.setPositionRound(b.width / 2, b.height / 2);
bundles.dailytasks.frames.daily_task_icon_frame_png && (d = this.iconFrame = new cc.Scale9Sprite(bundles.dailytasks.frames.daily_task_icon_frame_png),
d.setPositionRound(b.width / 2, b.height / 2),
d.setLocalZOrder(10),
b.addChild(d),
d.setContentSize2(a.frame));
c.setPositionRound(b.width / 2, b.height / 2);
b.addChild(c);
b.setCascadeOpacityEnabled(!0);
return b
},
updateProgress: function() {
this.progressBar.setGoal(this.task.goal);
this.progressBar.setPercentage(this.task.progress)
},
onUpdate: function() {
this.rewardButton.setVisible(!this.task.collected && !this.task.expired && this.task.isFinished());
var a = cleverapps.styles.DailyTaskView;
this.iconFrame && (this.iconFrame.setSpriteFrame((new cc.Sprite(this.task.isFinished() ? bundles.dailytasks.frames.daily_task_icon_frame_completed_png : bundles.dailytasks.frames.daily_task_icon_frame_png)).getSpriteFrame()),
this.iconFrame.setContentSize2(a.icon.frame));
this.check && (this.check.visible = this.task.isFinished() && this.task.collected);
this.updateProgress();
this.task.isFinished() && (this.progressBar.setVisible(!1),
this.swapBtn && (this.swapBtn.removeFromParent(),
delete this.swapBtn),
this.task.collected && (bundles.dailytasks.frames.daily_task_bg_completed_png && this.background.setSpriteFrame(bundles.dailytasks.frames.daily_task_bg_completed_png),
[this.icon, this.background, this.title, this.rewards].forEach(function(b) {
b.setOpacity(140)
})))
},
createSwapButton: function() {
if (this.task.isSwappable() && !this.task.isFinished()) {
var a = cleverapps.styles.DailyTaskView;
this.swapBtn = new DailytaskSwapButton(this.task,this.isWide);
this.content.addChild(this.swapBtn);
this.isWide ? this.swapBtn.setPositionRound(a.swapButton.wide) : this.swapBtn.setPositionRound(a.swapButton)
}
}
});
cleverapps.styles.DailyTaskView = {
titleMargin: 0,
margin: 10,
padding: {
left: 10,
right: 40,
y: 10
},
titleAndRewards: {
width: 394,
height: 138,
x: {
align: "left"
},
y: {
align: "center"
},
wide: {
width: 606
}
},
content: {
x: {
align: "center"
},
y: {
align: "center"
}
},
reward: {
margin: {
x: 10
},
iconWrap: {
width: 50,
height: 50
},
textMargin: 0
},
progressBlock: {
width: 230,
height: 35
},
icon: {
x: {
align: "left",
dx: 25
},
y: {
align: "center",
dy: 0
},
frame: {
width: 142,
height: 142
}
},
title: {
width: 300,
textWidth: 300,
wide: {
width: 606,
textWidth: 540
},
height: 80
},
button: {
width: 168,
height: 80
},
swapButton: {
wide: {
x: {
align: "right",
dx: -275
},
y: {
align: "center",
dy: 0
}
},
x: {
align: "right",
dx: 0
},
y: {
align: "top",
dy: 0
}
},
progressBar: {
width: 230,
text: {
dy: 0
}
}
};
var DailytaskSwapButton = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.setAnchorPoint(.5, .5);
this.setContentSize2(cleverapps.styles.DailytaskSwapButton);
this.task = a;
this.isWide = b;
this.createButton();
this.createTooltip();
cleverapps.UI.applyHover(this, {
onMouseOver: this.onMouseOver.bind(this),
onMouseOut: this.onMouseOut.bind(this)
})
},
createTooltip: function() {
var a = cleverapps.styles.DailytaskSwapButton.tooltip
, b = this.tooltip = new cc.Scale9Sprite(bundles.tooltip.frames.tooltip_bg_png);
b.setContentSize2(a);
this.isWide ? b.setPositionRound(this.width / 2, -b.height / 2) : b.setPositionRound(this.width - b.width / 2, -b.height / 2);
this.addChild(b);
var c = cleverapps.UI.generateOnlyText("DailyTasksWindow.swapTooltip", cleverapps.styles.FONTS.TOOLTIP_TEXT);
c.fitTo(b.width - a.padding);
b.addChild(c);
c.setPositionRound(b.width / 2, b.height / 2);
b.setVisible(!1)
},
createButton: function() {
this.isWide ? this.button = new cleverapps.UI.Button({
width: cleverapps.styles.DailytaskSwapButton.width,
height: cleverapps.styles.DailytaskSwapButton.height,
content: new cc.Sprite(bundles.dailytasks.frames.swap_task_icon),
type: cleverapps.styles.UI.Button.Images.small_button_blue,
onClicked: this.onClicked.bind(this)
}) : (this.button = new cc.Sprite(bundles.dailytasks.frames.swap_task_icon),
cleverapps.UI.onClick(this.button, this.onClicked.bind(this)),
cleverapps.UI.applyHover(this.button),
this.button.applyInteractiveScale());
this.addChild(this.button);
this.button.setPositionRound(this.width / 2, this.height / 2)
},
onClicked: function() {
cleverapps.dailyTasks.swapOutTask(this.task);
this.tooltip.removeFromParent();
delete this.tooltip;
this.button.removeFromParent();
delete this.button
},
onMouseOver: function() {
this.tooltip && this.tooltip.setVisible(!0)
},
onMouseOut: function() {
this.tooltip && this.tooltip.setVisible(!1)
}
});
cleverapps.styles.DailytaskSwapButton = {
width: 70,
height: 60,
tooltip: {
width: 300,
height: 60,
padding: 50
}
};
var DailyTasksCompleteAllView = cc.Node.extend({
ctor: function(a) {
this._super();
var b = cleverapps.styles.DailyTasksCompleteAllView;
this.timer = a;
this.setAnchorPoint(.5, .5);
this.task = cleverapps.dailyTasks.getCompleteAllTask();
a = cleverapps.UI.createScale9Sprite(bundles.dailytasks.frames.complete_all_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
this.addChild(a);
this.content = this.createContent();
this.addChild(this.content);
a.setContentSize2(b.bg || this.content.getContentSize());
this.setContentSize2(a.getContentSize());
a.setPositionRound(this.width / 2, this.height / 2);
this.content.setPositionRound(this.width / 2, this.height / 2);
this.setLocalZOrder(1);
this.onUpdate();
this.task.on("update", this.onUpdate.bind(this), this)
},
createContent: function() {
var a = cleverapps.styles.DailyTasksCompleteAllView
, b = this.createTextLayout()
, c = this.task.getIcon()
, d = new cc.Node;
d.setContentSize2(c.getContentSize());
d.setAnchorPoint(a.wrapper.anchor.x, a.wrapper.anchor.y);
d.addChild(c);
c.setPositionRound(d.width / 2, d.height / 2 + a.icon.dy);
return new cleverapps.Layout([d, b],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin,
padding: a.padding
})
},
createTextLayout: function() {
var a = cleverapps.styles.DailyTasksCompleteAllView
, b = []
, c = this.createText();
b.push(c);
this.timer && b.push(this.timer);
this.prize = new PrizeBarComponent({
reward: this.task.getReward(),
progressBar: {
width: a.textLayout.width
},
onCollect: this.task.givePrize.bind(this.task),
prizePosition: a.prizePosition
});
this.prize.updateProgress(this.task.progress, this.task.goal);
this.task.collected && this.prize.setCollected();
b.push(this.prize);
return new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.textLayout.margin,
padding: a.textLayout.padding
})
},
createText: function() {
var a = cleverapps.styles.DailyTasksCompleteAllView
, b = cleverapps.UI.generateOnlyText("DailyTasksWindow.CTA", cleverapps.styles.FONTS.DAILY_TASK_CTA || cleverapps.styles.FONTS.WINDOW_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.textLayout.width, 0);
b.fitTo(void 0, a.textLayout.height);
return b
},
onUpdate: function() {
this.prize.updateProgress(this.task.progress, this.task.goal);
this.task.collected && this.prize.setCollected()
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
DAILY_TASKS_BAR: {
name: "default",
size: 35
}
});
cleverapps.styles.DailyTasksCompleteAllView = {
margin: 30,
padding: {
left: 75,
right: 110,
top: 15,
bottom: 30
},
textLayout: {
width: "merge" === cleverapps.config.type ? 700 : 400,
height: 90,
margin: 0,
padding: {
top: 20,
bottom: 20
}
},
prize: {
x: {
align: "right",
dx: -100
},
y: {
align: "bottom",
dy: -24
}
},
prizePosition: {
x: {
align: "right",
dx: 50
},
y: {
align: "center",
dy: 10
}
},
mark: {
x: {
align: "right",
dx: 75
},
y: {
align: "center"
}
},
icon: {
dy: 0
},
bg: void 0,
wrapper: {
anchor: {
x: .5,
y: .5
}
}
};
var PassLevelsConfig = {}
, PassMissionLogic = function(a, b) {
this.mission = a;
this.onShowWindowListeners = {};
this.onUpdateListeners = {};
this.onLevelChangedListeners = {};
this.onProgressChangedListeners = {};
var c = 0;
this.levels = (PassLevelsConfig[a.type] || this.mission.view.LEVELS).map(function(d, e) {
c += d.task.goal;
d = Object.assign({
level: e
}, d);
d.task.goalTotal = c;
return d
});
this.load(this.mission.details);
this.checkComplete() && this.mission.complete();
this.shownAvailableRewards = 0;
Game.currentGame && Game.currentGame.bpPointsPlanner && (Game.currentGame.bpPointsPlanner.removeWrongPoints(!0),
b && Game.currentGame.bpPointsPlanner.start());
if ([Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_COLLECTIONS_PASS].includes(Mission.GetChildType(a.type)))
cleverapps.eventBus.on("mapEvent", this.onMapEvent.bind(this), this);
this.mission.onChangeResults = this.runListeners.bind(this, this.onUpdateListeners);
this.onAnimateAmountChange = function() {}
;
this.onNextAmountStep = function() {}
;
this.onAnimateProgressChange = function() {}
;
this.onNextProgressStep = function() {}
;
this.onShowFinger = function() {}
;
this.onHideFinger = function() {}
;
this.onPremiumBought = function() {}
};
PassMissionLogic.prototype.runListeners = function(a) {
for (var b in a) {
var c = a[b];
c && c()
}
}
;
PassMissionLogic.prototype.showProgress = function() {
if (this.isAllProgressShown())
this.onShowFinger();
else {
var a = this.shownProgress.level >= this.progress.level ? {
level: this.progress.level,
progress: this.progress.progress
} : {
level: this.shownProgress.level,
progress: this.levels[this.shownProgress.level].task.goal
};
cleverapps.focusManager.display({
stack: !0,
focus: "ShowPassProgress",
action: function(b) {
this.onAnimateAmountChange(a, this.shownProgress, this.levels[this.shownProgress.level].task.goal);
this.onAnimateProgressChange(a, function() {
this.shownProgress.level >= this.progress.level ? (this.shownProgress = a,
this.saveProgress(),
this.showProgress(),
b()) : (a = {
level: this.shownProgress.level + 1,
progress: 0
},
this.onNextAmountStep(a),
this.onNextProgressStep(this.shownProgress.level, function() {
this.shownProgress = a;
this.saveProgress();
this.runListeners(this.onLevelChangedListeners);
this.showProgress();
b()
}
.bind(this)))
}
.bind(this))
}
.bind(this)
})
}
}
;
PassMissionLogic.prototype.checkComplete = function() {
return this.isAllTasksCompleted() && this.hasPremium() && 0 === this.countAvailableRewards()
}
;
PassMissionLogic.prototype.saveProgress = function() {
this.mission.details = this.getInfo();
this.mission.update(0, this.getInfo())
}
;
PassMissionLogic.prototype.load = function(a) {
var b = function(c) {
return c.reduce(function(d, e) {
return d | 1 << e
}, 0)
};
this.premium = a.premium || a.boughtPremium || void 0;
this.rewards = a.rewards || 0;
this.premiumRewards = a.premiumRewards || 0;
this.progress = a.progress || 0;
Array.isArray(a.levelsToReward) && (this.rewards = b(a.levelsToReward));
Array.isArray(a.levelsToPremReward) && (this.premiumRewards = b(a.levelsToPremReward));
a.currentTask && (b = Math.min(a.currentTask.level || 0, this.levels.length - 1),
this.progress = this.levels[b].task.goalTotal - this.levels[b].task.goal + (a.currentTask.progress || 0));
this.shownProgress = a.shownProgress || this.progress;
this.progress = this._extract(this.progress);
this.shownProgress = this._extract(this.shownProgress);
a = (1 << this.progress.level) - 1;
this.rewards &= a;
this.premiumRewards &= a
}
;
PassMissionLogic.prototype.getInfo = function() {
return {
premium: this.premium,
rewards: this.rewards,
premiumRewards: this.premiumRewards,
progress: this._compact(this.progress),
shownProgress: this._compact(this.shownProgress)
}
}
;
PassMissionLogic.prototype.completeCurrentTask = function() {
this.progress.level < this.levels.length && this.addProgress(this.levels[this.progress.level].task.goal - this.progress.progress)
}
;
PassMissionLogic.prototype.takeLevelReward = function(a, b) {
if (this.hasReward(a, b)) {
var c = b ? this.levels[a].premiumReward : this.levels[a].reward;
if (c.unit && "merge" === cleverapps.config.type && !this.mission.mainWorldReward) {
var d = cleverapps.toArray(c.unit).reduce(function(e, f) {
return e + f.amount
}, 0) - Map2d.currentMap.countEmptySlots();
if (0 < d) {
cleverapps.centerHint.createTextHint("Spawn.nospace", {
left: d
});
return
}
}
b ? this.premiumRewards ^= 1 << a : this.rewards ^= 1 << a;
this.saveProgress();
this._logEventByType((b ? cleverapps.EVENTS.PASS_RECEIVED_PREMIUM : cleverapps.EVENTS.PASS_RECEIVED) + "_" + a);
this.checkComplete() && this.mission.complete();
return c
}
}
;
PassMissionLogic.prototype.receiveReward = function() {
if (this.mission.manualFinish)
for (var a = 0; a < this.levels.length; ++a) {
var b = this.takeLevelReward(a, !1);
if (b || this.hasPremium() && (b = this.takeLevelReward(a, !0)))
return b
}
}
;
PassMissionLogic.prototype.hasReward = function(a, b) {
return (b ? this.premiumRewards : this.rewards) & 1 << a
}
;
PassMissionLogic.prototype.setPremium = function() {
this.premium = 1;
this.runListeners(this.onUpdateListeners);
this.saveProgress();
this._logEventByType(cleverapps.EVENTS.PASS_PURCHASED_TICKET)
}
;
PassMissionLogic.prototype.isCompletedTaskShown = function() {
return this.progress.level === this.shownProgress.level
}
;
PassMissionLogic.prototype.isAllTasksCompleted = function() {
return this.progress.level >= this.levels.length
}
;
PassMissionLogic.prototype.isAllProgressShown = function() {
return this.progress.level === this.shownProgress.level && this.progress.progress === this.shownProgress.progress
}
;
PassMissionLogic.prototype.countAvailableRewards = function() {
var a = Number(this._getAvailableRewardsSet()).toString(2).match(/1/g);
return a && a.length || 0
}
;
PassMissionLogic.prototype.addProgress = function(a) {
if (a) {
a = this._extract(this._compact(this.progress) + a);
for (var b = this.progress.level; b < a.level; b++) {
this.rewards |= 1 << b;
this.premiumRewards |= 1 << b;
this._logEventByType(cleverapps.EVENTS.PASS_FINISH_TASK + "_" + b);
var c = this.mission.getTimeLeft();
if (c <= cleverapps.parseInterval("3 days")) {
var d;
if (!this.isAllTasksCompleted()) {
var e = new Date;
e.setHours(21, 0, 0);
e -= Date.now();
0 < e && e < c - cleverapps.parseInterval("10 minutes") && (d = e)
}
cleverapps.localPushes.sendPush(cleverapps.LocalPushes.TYPES.PASS_UNCOMPLETED, d)
}
}
this.progress = a;
this.saveProgress();
this.runListeners(this.onProgressChangedListeners)
}
}
;
PassMissionLogic.prototype.hasPremium = function() {
return this.premium
}
;
PassMissionLogic.prototype.canBuyPremium = function() {
return !this.hasPremium() && (this.mission.isRunning() || 0 !== this.progress.level)
}
;
PassMissionLogic.prototype.canRemoveSilently = function() {
return !1
}
;
PassMissionLogic.prototype.canRemove = function() {
return 0 === this.countAvailableRewards()
}
;
PassMissionLogic.prototype.hasLastChance = function() {
return !this.isAllTasksCompleted()
}
;
PassMissionLogic.prototype.processEvent = function(a) {
this.addProgress(a.amount);
this.displayWindow(1E3)
}
;
PassMissionLogic.prototype.handleShowWindow = function() {
this.shownAvailableRewards = this._getAvailableRewardsSet();
this.runListeners(this.onShowWindowListeners)
}
;
PassMissionLogic.prototype.stop = function() {
"merge" === cleverapps.config.type && Game.currentGame && (Map2d.currentMap.listAvailableUnits().forEach(function(a) {
a.points && a.setPoints(0);
var b = a.findComponent(UnitsShopComponent);
b && (b.checkPrizes(),
b.checkCrystals());
(b = a.findComponent(ThirdElement)) && b.type === ThirdElement.TYPE_PASS_POINTS && a.remove()
}),
Game.currentGame && Game.currentGame.bpPointsPlanner && Game.currentGame.bpPointsPlanner.removeWrongPoints());
runCleaners(this)
}
;
PassMissionLogic.prototype.beforeRemove = function() {
"merge" === cleverapps.config.type && cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition() && Game.currentGame.thirdElementPlanner.planNext({
type: ThirdElement.TYPE_PASS_FINISH,
delay: 200,
target: this.levels[this.levels.length - 1].premiumReward.unit
})
}
;
PassMissionLogic.prototype.onMapEvent = function(a, b) {
if (cleverapps.travelBook.isExpedition() && MissionManager.hasProperParent(this.mission) && this.mission.isRunning() && !this.isAllTasksCompleted()) {
switch (a) {
case Map2d.SPAWN:
var c = !Array.isArray(b.affected) && b.unit;
break;
case Map2d.BUILD:
c = b.affected
}
c && c.getData().bpPoints && c.setPoints(c.getData().bpPoints);
(c = a === Map2d.SPAWN && Array.isArray(b.affected) && b.unit) && c.getData().mergeBpPoints && c.setPoints(c.getData().mergeBpPoints)
}
}
;
PassMissionLogic.prototype.getTargets = function() {
return ["battlePass"]
}
;
PassMissionLogic.prototype.isAttentionRequired = function() {
return 0 < this.countAvailableRewards()
}
;
PassMissionLogic.BuildableUnitPoints = function(a) {
var b = [0, 0, 5, 10, 20, 60, 300, 600, 2E3, 2500, 3E3, 4E3];
return b[Math.min(a.stage, b.length - 1)]
}
;
PassMissionLogic.prototype.needDisplayWindow = function() {
var a = this._getAvailableRewardsSet();
return a ^= a & this.shownAvailableRewards
}
;
PassMissionLogic.prototype.displayWindow = function(a) {
this.needDisplayWindow() && (a = a || 0,
cleverapps.focusManager.display({
focus: "PassWindow",
actions: [function(b) {
cleverapps.focusManager.showControlsWhileFocused(this.mission.name + "MissionIcon");
setTimeout(b, a)
}
.bind(this), function(b) {
cleverapps.focusManager.hideControlsWhileFocused(this.mission.name + "MissionIcon");
new this.mission.view(this.mission);
cleverapps.focusManager.onceNoWindowsListener = b
}
.bind(this)]
}))
}
;
PassMissionLogic.prototype._compact = function(a) {
for (var b = 0, c = 0; c < a.level; c++)
b += this.levels[c].task.goal;
return b + a.progress
}
;
PassMissionLogic.prototype.getLevelReward = function(a) {
return {
hard: 6,
tricky: 4
}[a] || 3
}
;
PassMissionLogic.prototype._extract = function(a) {
for (var b = 0, c = 0; c < this.levels.length; c++) {
if (a < b + this.levels[c].task.goal)
return {
level: c,
progress: a - b
};
b += this.levels[c].task.goal
}
return {
level: this.levels.length,
progress: 0
}
}
;
PassMissionLogic.prototype._getAvailableRewardsSet = function() {
return this.hasPremium() ? this.rewards << this.levels.length | this.premiumRewards : this.rewards
}
;
PassMissionLogic.prototype._logEventByType = function(a, b) {
switch (Mission.GetChildType(this.mission.type)) {
case Mission.TYPE_SALEPASS:
a = "purchase_" + a;
break;
case Mission.TYPE_COLLECTIONS_PASS:
case Mission.TYPE_EXPEDITION_PASS:
a = cleverapps.travelBook.getCurrentPage().id + "_" + a
}
cleverapps.eventLogger.logEvent(a, b)
}
;
PassMissionLogic.prototype.buyPremium = function() {
this.getProduct().buy(this.processPremiumBought.bind(this), {
noRewardWindow: !0
})
}
;
PassMissionLogic.prototype.processPremiumBought = function(a) {
a && (this.setPremium(),
this.onPremiumBought(),
new RewardWindow({
battlePass: {
missionType: this.mission.type
}
}))
}
;
PassMissionLogic.prototype.getPriceText = function() {
return this.getProduct().getCurrentPrice()
}
;
PassMissionLogic.prototype.getProduct = function() {
return Product.CreateByHardPrice(PassMissionLogic.GetHardPrice(), {
type: "pass_ticket",
mission: this.mission.type
})
}
;
PassMissionLogic.GetHardPrice = function() {
return 999
}
;
PassMissionLogic.classifyAmount = function(a) {
return 300 < a ? 3 : 80 < a ? 2 : 1
}
;
PassMissionLogic.RestoreExpeditionId = function(a) {
a = Mission.ParseCompoundType(a.mission);
a = void 0 !== a.parentType ? a.parentType : a.type;
return Missions[a] && Missions[a].id || "main"
}
;
PassMissionLogic.RestoreActions = function(a, b) {
var c = cleverapps.missionManager.findByType(a.mission);
if (c && c.isRunning())
return [function(d) {
b();
c.logic.processPremiumBought(!0);
cleverapps.focusManager.onceNoWindowsListener = d
}
]
}
;
Product.RESTORE_LOGIC.pass_ticket = PassMissionLogic;
var PassRewardIcon = cc.Node.extend({
ctor: function(a) {
this._super();
this.options = a;
this.passLogic = a.passLogic;
this.setAnchorPoint(.5, .5);
this.setContentSize2(cleverapps.styles.PassRewardIcon.icon);
this.rewardList = new RewardsList(a.premium ? this.passLogic.levels[a.level].premiumReward : this.passLogic.levels[a.level].reward,{
toMainWorld: this.passLogic.mission.mainWorldReward
});
a = this.rewardList.listRewards()[0];
"units" === a.type && (this.toolTipMsg = cleverapps.unitsLibrary.getUnitName(a.getValue(), !0));
this.createContent(a)
},
createContent: function(a) {
var b = cleverapps.styles.PassRewardIcon
, c = this.icon = a.getIcon();
c.setAnchorPoint(.5, .5);
cleverapps.UI.fitToBox(c, {
width: b.icon.width,
height: b.icon.height,
maxScale: this.options.premium ? b.icon.prem.scale : b.icon.free.scale
});
c.setPositionRound(b.icon);
this.addChild(c);
a = a.getText("x");
c = this.options.font || cleverapps.styles.FONTS.PASS_REWARD_TEXT;
cleverapps.UI.ImageFont.IsApplicable(c, a) ? this.text = cleverapps.UI.generateImageText(a, c) : this.text = cleverapps.UI.generateOnlyText(a, c);
this.options.amountBg ? (a = new cc.Sprite(this.options.amountBg),
a.setPositionRound(b.text),
this.addChild(a),
cleverapps.UI.fitToBox(this.text, a),
this.text.setPositionRound(a.width / 2, a.height / 2),
a.addChild(this.text)) : (this.text.setPositionRound(b.text),
this.addChild(this.text))
},
setDiscolor: function(a) {
a ? (this.icon.setOpacity(120),
this.icon.setColor(new cc.Color(0,150,255,255)),
this.text.setOpacity(120),
this.text.setScale(.8)) : (this.icon.setOpacity(255),
this.icon.setColor(new cc.Color(255,255,255,255)),
this.text.setScale(1),
this.text.setOpacity(255))
},
setAttention: function(a) {
var b = cleverapps.styles.PassRewardIcon.attention;
this.attention && (this.attention.removeFromParent(),
delete this.attention);
a && (a = this.attention = new cc.Sprite(a),
a.setPositionRound(b),
this.addChild(a))
},
setShining: function(a) {
var b = cleverapps.styles.PassRewardIcon.shining;
this.shining && (this.shining.removeFromParent(),
delete this.shining);
a && (this.shining = AnimationsLibrary.rays(this, {
skin: "white",
size: b.size
}),
this.shining.setPositionRound(b))
},
setFlying: function(a) {
var b = cleverapps.styles.PassRewardIcon.flying;
this.flyingAction && (this.stopAction(this.flyingAction),
delete this.flyingAction);
a && (this.flyingAction = this.runAction(new cc.Sequence(new cc.DelayTime(1.5 * Math.random()),new cc.CallFunc(function() {
this.flyingAction = this.runAction(new cc.RepeatForever(new cc.Sequence(new cc.CallFunc(function() {
this.icon.runAction(new cc.Sequence(new cc.MoveBy(3,0,b.offsetY),new cc.CallFunc(function() {
Math.random() < .7 / this.passLogic.countAvailableRewards() && this.icon.runAction(new cc.Sequence(new cc.RotateBy(.25,10),new cc.RotateBy(.25,-10),new cc.RotateBy(.25,10),new cc.RotateBy(.25,-10)))
}
,this),new cc.MoveBy(1.5,0,-b.offsetY)))
}
,this),new cc.DelayTime(4.5))))
}
,this))))
},
setClaimable: function(a, b) {
this.setClaimButton(a, b);
if (a && !b)
cleverapps.UI.onClick(this, this.claimReward.bind(this))
},
setClaimButton: function(a, b) {
this.claimButton && (this.claimButton.removeFromParent(),
this.claimButton = void 0);
if (a) {
a = cleverapps.styles.PassRewardIcon.claimButton;
var c = this.claimButton = new cleverapps.UI.Button({
type: cleverapps.styles.UI.Button.Images.small_button_green,
width: a.width,
height: a.height,
text: "Claim",
onClicked: this.claimReward.bind(this)
});
c.setAnchorPoint(.5, .5);
c.setPositionRound(a);
this.addChild(c);
b && c.disable()
}
},
updateState: function(a) {
var b;
this.options.level < (void 0 !== a ? a : this.passLogic.shownProgress.level) && (b = this.passLogic.hasReward(this.options.level, this.options.premium) ? this.options.premium && !this.passLogic.hasPremium() ? "premium_required" : "fresh" : "gained");
cc.eventManager.removeListeners(this);
this.setDiscolor(!1);
this.setAttention();
this.setShining(!1);
this.setFlying(!1);
this.setClaimable(!1);
switch (b) {
case "premium_required":
this.setClaimable(!0, !1);
break;
case "fresh":
this.setShining(!0);
this.setFlying(!0);
this.setClaimable(!0, !1);
break;
case "gained":
this.setAttention(bundles.reward_icons_pass.frames.prize_checkmark_png);
break;
default:
this.setDiscolor(!0),
cleverapps.tooltipManager.create(this, {
text: "PassWindow.moreItemsToolTip." + this.passLogic.mission.collectItemName
})
}
},
openAnimation: function() {
this.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.2),new cc.ScaleTo(.2,1)));
this.claimButton && (this.claimButton.setVisible(!1),
this.claimButton.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.Show)))
},
claimReward: function() {
if (!(this.passLogic.shownProgress.level < this.options.level))
if (this.options.premium && !this.passLogic.hasPremium())
new PassBuyTicketWindow(this.passLogic);
else {
var a = this.passLogic.takeLevelReward(this.options.level, this.options.premium);
if (a) {
var b = this.rewardList.listRewards()[0].getIcon();
this.addChild(b);
b.setPosition(this.icon.getPosition());
b.setScale(this.icon.getScale());
b.setAnchorPoint(this.icon.anchorX, this.icon.anchorY);
this.rewardList.receiveRewards();
b = Math.max(this.rewardList.collectRewardsAnimation(b) / 1E3, .9);
if (!a.unit || this.passLogic.mission.mainWorldReward)
this.updateState(),
this.passLogic.onHideFinger(),
this.passLogic.onShowFinger();
else {
var c = cleverapps.windows.currentWindow();
c.hideSelf();
c.runAction(new cc.Sequence(new cc.DelayTime(b),new cc.CallFunc(function() {
this.passLogic.checkComplete() ? c.close() : c.displaySelf()
}
.bind(this))))
}
}
}
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PASS_REWARD_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.PassRewardIcon = {
icon: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
},
width: 180,
height: 180,
free: {
scale: 1.1
},
prem: {
scale: 1.2
}
},
text: {
x: {
align: "right",
dx: 0
},
y: {
align: "bottom",
dy: -2
},
bgScale: 3
},
attention: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -60
}
},
shining: {
x: {
align: "center",
dx: -8
},
y: {
align: "center",
dy: 0
},
size: 100
},
flying: {
offsetY: 8
},
claimButton: {
width: 170,
height: 60,
x: {
align: "center"
},
y: {
align: "bottom",
dy: -75
}
}
};
var PassProgress = cc.Node.extend({
ctor: function(a) {
this._super();
this.passLogic = a.passLogic;
var b = cleverapps.styles.PassProgress;
this.setContentSize2(a.width - 2 * b.paddingX, b.height);
a = this.createTasks();
var c = this.progressBar = new ScaledProgressBar({
progress: bundles.progress_bar.frames.bar_passprogress,
background: bundles.progress_bar.frames.bg_passprogress
});
c.setLength(a.content.width - b.tasks.width / 2 - b.progressBar.offsetWidth);
c.setAnchorPoint(0, .5);
c.setPositionRound(b.progressBar);
c.setLocalZOrder(-1);
c.setPercentage(this.calcProgressPercentage(this.passLogic.shownProgress));
a.content.addChild(c);
if (cleverapps.config.debugMode)
cleverapps.UI.onClick(c, function() {
this.passLogic.completeCurrentTask();
this.passLogic.showProgress()
}
.bind(this));
this.addLines();
a = this.progressScroll = new cleverapps.UI.ScrollView(a,{
childrenVisibility: cleverapps.UI.ScrollView.CHILDREN_VISIBILITY_NONE,
direction: cleverapps.UI.ScrollView.DIR_HORIZONTAL,
scrollBarEnabled: !1,
outOfBoundaryScale: .05
});
a.setContentSize2(this.width + b.scroll.offsetWidth, this.height + b.scroll.offsetHeight);
a.scrollTo(cleverapps.UI.ScrollView.SCROLLS.LOWER_RIGHT);
a.setPositionRound(b.scroll);
this.addChild(a);
this.passLogic.onAnimateProgressChange = this.createListener(this.animateProgressChange.bind(this));
this.passLogic.onNextProgressStep = this.createListener(this.animateProgressStep.bind(this));
this.passLogic.onShowFinger = this.createListener(this.showFinger.bind(this));
this.passLogic.onHideFinger = this.createListener(this.hideFinger.bind(this));
this.passLogic.onShowWindowListeners.passProgress = this.createListener(this.onShow.bind(this))
},
createTasks: function() {
var a = cleverapps.styles.PassProgress.tasks
, b = this.passLogic.levels
, c = this.container = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(a.width * b.length + a.contentOffset, a.height);
var d = this.rewardIcons = []
, e = function(g, h) {
var k = new PassRewardIcon({
passLogic: this.passLogic,
level: g,
premium: h
});
k.setPositionRound(a.width * (.5 + g), h ? a.premiumReward.y : a.reward.y);
k.setLocalZOrder(b.length - g);
this.container.addChild(k);
d.push(k)
}
.bind(this);
b.forEach(function(g, h) {
e(h, !1);
e(h, !0)
});
this.updateIcons();
this.createTaskPoints();
this.createTasksBgs();
var f = cleverapps.UI.wrapWithPadding(c, {
left: a.contentOffset
});
f.content = c;
return f
},
createTaskPoints: function() {
this.taskPoints = this.passLogic.levels.map(function(a, b) {
a = this.createTaskPoint(a, b);
this.container.addChild(a);
return a
}, this)
},
createTaskPoint: function(a, b) {
return this.passLogic.shownProgress.level > a.level ? this.createCompletedTaskPoint(a, b) : this.createUncompletedTaskPoint(a, b)
},
createCompletedTaskPoint: function(a, b) {
a = cleverapps.styles.PassProgress.tasks;
var c = this.passLogic.mission.type === Mission.TYPE_SALEPASS
, d = new cc.Sprite(c && bundles.passprogress.frames.sale_task_point_completed || bundles.passprogress.frames.task_point_completed);
d.setPositionRound(a.width * (.5 + b), a.taskPoint.y);
a.completedLevelIcon ? (b = new cc.Sprite(c ? bundles.reward_icons_pass.frames.pass_coin_png : bundles.reward_icons_pass.frames.pass_star_png),
b.setScale(a.completedLevelIcon.scale),
d.addChild(b),
b.setPositionRound(d.width / 2, d.height / 2)) : (b = cleverapps.UI.generateImageText(b + 1, cleverapps.styles.FONTS.PASS_PROGRESS_POINT_COMPLETED),
d.addChild(b),
b.setPositionRound(d.width / 2, d.height / 2 + a.taskPoint.completedNumberDy));
return d
},
createUncompletedTaskPoint: function(a, b) {
a = cleverapps.styles.PassProgress.tasks;
var c = new cc.Sprite(bundles.passprogress.frames.task_point);
c.setPositionRound(a.width * (.5 + b), a.taskPoint.y);
b = cleverapps.UI.generateImageText(b + 1, cleverapps.styles.FONTS.PASS_PROGRESS_POINT);
c.addChild(b);
b.setPositionRound(c.width / 2, c.height / 2 + a.taskPoint.numberDy);
return c
},
createTasksBgs: function() {
var a = cleverapps.styles.PassProgress
, b = function(c, d) {
var e = cleverapps.UI.createScale9Sprite(bundles.passprogress.frames[c ? "prize_bg_orange1" : "prize_bg_blue1"]);
e.setContentSize2(a.tasks.bgs);
e.setPositionRound(a.tasks.width * (.5 + d), c ? a.line.first.y : a.line.second.y);
this.container.addChild(e, -1)
}
.bind(this);
this.passLogic.levels.forEach(function(c, d) {
if (0 !== d % 2 || bundles.passprogress.frames.prize_bg_single)
b(!0, d),
b(!1, d)
}, this)
},
addIcons: function(a, b, c) {
a = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
reversed: !0
});
a.setAnchorPoint(.5, .5);
a.setPositionRound(b, c);
this.container.addChild(a);
return a
},
addLines: function() {
var a = cleverapps.styles.PassProgress.line
, b = function(c, d) {
c = cleverapps.UI.createScale9Sprite(c, a.scale9 ? a.scale9 : void 0);
c.setPositionRound(d);
c.setContentSize2(this.width, a.height);
this.addChild(c, -2)
}
.bind(this);
bundles.passprogress.frames.prize_bg_single ? b(bundles.passprogress.frames.prize_bg_single, a.single) : (b(bundles.passprogress.frames.prize_bg_orange2, a.first),
b(bundles.passprogress.frames.prize_bg_blue2, a.second))
},
calcProgressPercentage: function(a) {
var b = this.passLogic.levels.length;
if (a.level >= b)
return 100;
if (0 === a.level && 0 === a.progress)
return 0;
var c = .5 / b
, d = a.progress / this.passLogic.levels[a.level].task.goal;
return 0 === a.level ? c * d * 100 : 100 * (c + (1 - c) / (b - 1) * (a.level - 1 + d))
},
scrollToLevel: function(a, b, c) {
this.taskPoints[b] && this.progressScroll.scrollTo(this.taskPoints[b].getPosition(), a, c)
},
animateProgressChange: function(a, b) {
this.scrollToLevel(.8, a.level);
a = this.calcProgressPercentage(a);
this.progressBar.runAction((new ScaledProgressBarProgressTo(.8,a)).easing(cc.easeCubicActionOut()));
this.runAction(new cc.Sequence(new cc.DelayTime(.6),new cc.CallFunc(b)))
},
animateProgressStep: function(a, b) {
var c = this.taskPoints[a]
, d = this.createCompletedTaskPoint(this.passLogic.levels[a], a);
this.container.addChild(d);
d.setPositionRound(c.getPosition());
this.taskPoints[a] = d;
c.removeFromParent();
d.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.15),new cc.ScaleTo(.15,1)));
d.runAction(new cc.Sequence(new cc.ScaleTo(.2,1.15),new cc.PlaySound(bundles.passprogress.urls.task_done_sfx),new cc.CallFunc(function() {
this.rewardIcons.filter(function(e) {
return e.options.level === a
}).forEach(function(e) {
e.updateState(a + 1);
e.openAnimation()
});
this.passLogic.levels[a].energy && Game.currentGame.addReward("energy", this.passLogic.levels[a].energy, d)
}
.bind(this)),new cc.ScaleTo(.15,1),new cc.CallFunc(b)))
},
updateIcons: function() {
this.rewardIcons.forEach(function(a) {
a.updateState()
})
},
showFinger: function() {
var a = this.getFirstShownReward();
if (a) {
var b = this.rewardIcons.filter(function(c) {
return c.options.level === a.level && c.options.premium === a.premium
})[0];
this.finger = FingerView.hintClick(b, {
delay: 1.6,
loopFilter: function() {
return cc.rectContainsRect(this.progressScroll.getGlobalBoundingBox(), b.icon.getGlobalBoundingBox())
}
.bind(this)
})
}
},
hideFinger: function() {
FingerView.remove(this.finger);
this.finger = void 0
},
onShow: function() {
var a = this.passLogic.shownProgress.level;
if (this.passLogic.isAllProgressShown()) {
var b = this.getFirstShownReward();
void 0 !== b && (a = b.level)
}
this.hideFinger();
this.updateIcons();
this.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.CallFunc(function() {
this.scrollToLevel(.8, a, {
easing: cc.easeBackInOut(),
callback: function() {
this.passLogic.showProgress()
}
.bind(this)
})
}
.bind(this))))
},
getFirstShownReward: function() {
for (var a = 0, b = this.passLogic.shownProgress.level; a < b; ++a) {
if (this.passLogic.hasPremium() && this.passLogic.hasReward(a, !0))
return {
level: a,
premium: !0
};
if (this.passLogic.hasReward(a))
return {
level: a,
premium: !1
}
}
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PASS_PROGRESS_POINT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
PASS_PROGRESS_POINT_COMPLETED: {
name: "nostroke",
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.PassProgress = {
paddingX: 148,
height: 700,
scroll: {
x: {
align: "center",
dx: -1
},
y: {
align: "center",
dy: 0
},
offsetHeight: 100,
offsetWidth: 0
},
progressBar: {
offsetWidth: 5,
x: {
align: "left",
dx: 0
},
y: {
align: "center",
dy: 1
}
},
line: {
first: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 159
}
},
second: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -151
}
},
height: 311
},
tasks: {
width: 220,
height: 500,
contentOffset: 30,
taskPoint: {
y: {
align: "center"
},
numberDy: 0,
completedNumberDy: 0
},
premiumReward: {
y: {
align: "center",
dy: 208
}
},
reward: {
y: {
align: "center",
dy: -120
}
},
bgs: {
width: 220,
height: 311
}
}
};
var PassHeader = cc.Node.extend({
ctor: function(a) {
this._super();
this.options = a;
this.mission = a.passLogic.mission;
var b = cleverapps.styles.PassHeader;
this.setAnchorPoint(.5, .5);
this.setContentSize2(a.width - 2 * b.paddingX, b.height);
if (a.bg_json) {
var c = new cleverapps.Spine(a.bg_json);
c.setAnimation(0, "animation", !0);
this.addChild(c);
c.setPositionRound(this.width / 2, this.height / 2);
this.createPack(cleverapps.offerManager.findOffer({
mission: this.mission.type
}));
c = new cleverapps.Spine(a.decor_json);
c.setAnimation(0, "animation", !0);
this.addChild(c);
c.setPositionRound(b.decor)
} else
a.json ? (c = new cleverapps.Spine(a.json),
c.setAnimation(0, "animation", !0),
c.setPositionRound(this.width / 2, this.height / 2),
this.addChild(c)) : bundles.passheader.frames.details_background && (c = cleverapps.UI.createScale9Sprite(bundles.passheader.frames.details_background, cleverapps.UI.Scale9Rect.TwoPixelXY),
c.setContentSize2(this.width, this.height),
c.setPositionRound(this.width / 2, this.height / 2),
this.addChild(c));
this.mission.isCompleted() ? (c = cleverapps.UI.generateOnlyText("PassWindow.finished", cleverapps.styles.FONTS.PASS_TITLE_TEXT),
c.setPositionRound(b.timer),
this.addChild(c)) : (c = this.createTimer(),
c.setPositionRound(b.timer),
this.addChild(c));
a = this.amonut = new PassProgressAmount(a);
a.setPositionRound(b.amount);
this.addChild(a)
},
createPack: function(a) {
a && (a = new PassHeaderPack(a,this.options),
this.addChild(a),
a.setPositionRound(cleverapps.styles.PassHeader.pack))
},
createTimer: function() {
var a = cleverapps.styles.PassHeader.timer
, b = [];
if (!a.tooltip) {
var c = cleverapps.UI.generateOnlyText("PassWindow.timer", cleverapps.styles.FONTS.PASS_TITLE_TEXT);
c.setDimensions(a.title.width, 0);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.fitTo(void 0, a.title.height);
b.push(c)
}
c = new cc.Scale9Sprite(bundles.passheader.frames.timer_substrate);
c.setContentSize2(a);
a.tooltip && cleverapps.tooltipManager.create(c, {
text: "PassWindow.timer",
location: cleverapps.UI.Tooltip.LOCATION_BELOW
});
var d = this.mission.getTimeLeft();
0 < d && (d = new cleverapps.CountDown(d));
c = new cleverapps.CountDownView(d,{
font: cleverapps.styles.FONTS.PASS_TIMER_TEXT,
background_content: c,
icon: bundles.passheader.frames.timer_icon
});
c.fitTo(a.countdown.width, 0);
b.push(c);
return new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PASS_TITLE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
PASS_TIMER_TEXT: {
size: 45,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.styles.PassHeader = {
paddingX: 50,
height: 200,
timer: {
tooltip: !0,
width: 250,
height: 66,
margin: 20,
x: {
align: "center"
},
y: {
align: "center",
dy: 22
},
countdown: {
width: 180
},
title: {
width: 450,
height: 60
}
},
decor: {
x: {
align: "center",
dx: -650
},
y: {
align: "center",
dy: 0
}
},
pack: {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: 0
}
},
amount: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -90
}
}
};
var PassHeaderPack = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.setAnchorPoint(.5, .5);
this.offer = a;
this.options = b;
this.createPackAnimation()
},
createPackAnimation: function() {
var a = cleverapps.styles.PassHeaderPack[this.offer.type] || cleverapps.styles.PassHeaderPack
, b = new cleverapps.Spine(this.options.pack_json);
b.setAnimation(0, "animation", !0);
this.addChild(b);
this.setContentSize(b.getContentSize());
b.setPositionRound(this.width / 2, this.height / 2);
var c = new PassPackBadge(this.offer);
b.addChild(c);
c.setPositionRound(a.badge);
a = function() {
new MissionOfferWindow(this.offer);
this.options.close()
}
.bind(this);
cleverapps.UI.onClick(b, a);
cleverapps.UI.onClick(c, a);
cleverapps.UI.applyHover(b)
}
});
cleverapps.styles.PassHeaderPackTemplate = {
badge: {
x: {
align: "right",
dx: 141
},
y: {
align: "center",
dy: 11
}
}
};
cleverapps.styles.PassHeaderPack = cleverapps.overrideStyles(cleverapps.styles.PassHeaderPackTemplate, {}, !0);
cleverapps.styles.PassHeaderPack[Offers.TYPES.SALEPASS] = cleverapps.overrideStyles(cleverapps.styles.PassHeaderPackTemplate, {
badge: {
x: {
align: "right",
dx: 181
},
y: {
align: "center",
dy: -8
}
}
}, !0);
cleverapps.styles.PassHeaderPack[Offers.TYPES.CLPASS] = cleverapps.overrideStyles(cleverapps.styles.PassHeaderPackTemplate, {
badge: {
x: {
align: "right",
dx: 57
},
y: {
align: "center",
dy: -48
}
}
}, !0);
var PassPackBadge = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
var b = new cc.Sprite(bundles.passheader.frames.badge_png);
this.setContentSize(b.getContentSize());
this.addChild(b);
b.setPositionRound(this.width / 2, this.height / 2);
var c = cleverapps.styles.PassPackBadge[a.type] || cleverapps.styles.PassPackBadge;
a = new TextWithIcon(a.logic.getPriceText(),{
font: cleverapps.styles.FONTS.BUTTON_BROWN_TEXT || cleverapps.styles.FONTS.BUTTON_TEXT
});
b.addChild(a);
a.fitTo(c.text.width);
a.setRotation(c.text.rotation);
a.setPositionRound(c.text)
}
});
cleverapps.styles.PassPackBadgeTemplate = {
text: {
x: {
align: "center",
dx: 37
},
y: {
align: "center",
dy: 13
},
rotation: -17,
width: 130
}
};
cleverapps.styles.PassPackBadge = cleverapps.overrideStyles(cleverapps.styles.PassPackBadgeTemplate, {}, !0);
cleverapps.styles.PassPackBadge[Offers.TYPES.CLPASS] = cleverapps.overrideStyles(cleverapps.styles.PassPackBadgeTemplate, {
text: {
x: {
align: "center",
dx: 16
},
y: {
align: "center",
dy: 4
},
rotation: 34
}
}, !0);
var ExpeditionPassHeader = cc.Node.extend({
ctor: function(a) {
this.options = a;
this.passLogic = a.passLogic;
var b = cleverapps.styles.ExpeditionPassHeader;
this._super();
this.setAnchorPoint(.5, .5);
this.setContentSize2(a.width, b.height);
var c = new cleverapps.Spine(bundles["expeditionpass_" + cleverapps.skins.getSlot("skinName")].jsons.top_bg);
c.setAnimation(0, "animation", !0);
c.setPositionRound(a.width / 2, this.height / 2);
this.addChild(c);
c = cleverapps.UI.generateOnlyText("ExpeditionPassWindow.header", cleverapps.styles.FONTS.EXPEDITIONS_PASS_TITLE_TEXT);
c.setDimensions(b.titleWidth, 0);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setPositionRound(b.title);
this.addChild(c);
a = this.amount = new PassProgressAmount(a);
a.setPositionRound(b.amount);
this.addChild(a);
this.createPack(cleverapps.offerManager.findOffer({
mission: this.passLogic.mission.type
}))
},
createPack: function(a) {
a && (a = new PassHeaderPack(a,this.options),
this.addChild(a),
a.setPositionRound(cleverapps.styles.ExpeditionPassHeader.pack))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
EXPEDITIONS_PASS_TITLE_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
cleverapps.styles.ExpeditionPassHeader = {
x: {
align: "center"
},
y: {
align: "top",
dy: -20
},
height: 222,
titleWidth: 900,
title: {
x: {
align: "center"
},
y: {
align: "center",
dy: 10
}
},
amount: {
x: {
align: "center"
},
y: {
align: "center",
dy: -85
}
},
pack: {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: 0
}
}
};
var PassProgressAmount = cleverapps.Layout.extend({
ctor: function(a) {
this.passLogic = a.passLogic;
a = cleverapps.styles.PassProgressAmount;
if (this.passLogic.isAllTasksCompleted() && this.passLogic.isAllProgressShown())
var b = cleverapps.UI.generateOnlyText("PassWindow.completed", cleverapps.styles.FONTS.PASS_PROGRESS_TEXT);
else {
b = cleverapps.UI.generateOnlyText("PassWindow.progress", cleverapps.styles.FONTS.PASS_PROGRESS_TEXT);
var c = new cc.Sprite(bundles.reward_icons_pass.frames[this.passLogic.mission.type === Mission.TYPE_SALEPASS ? "pass_coin_png" : "pass_star_png"]);
var d = this.passLogic.shownProgress;
d = this.amount = cleverapps.UI.generateImageText(d.progress + "/" + this.passLogic.levels[d.level].task.goal, cleverapps.styles.FONTS.PASS_PROGRESS_IMAGE_TEXT);
this.baseAmountScale = d.scale;
d.setAnchorPoint(0, .5)
}
this._super([b, c, d].filter(Boolean), {
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
});
this.passLogic.onAnimateAmountChange = this.createListener(this.animateChange.bind(this));
this.passLogic.onNextAmountStep = this.createListener(this.animateStep.bind(this))
},
animateChange: function(a, b, c) {
var d = AnimationsLibrary.countTo(this.amount, a.progress, {
duration: .8
});
d ? this.amount.runAction(d) : (b = "Empty CountTo " + d + " | " + JSON.stringify(b) + " | " + JSON.stringify(a),
cleverapps.throwAsync(b),
this.amount.setString(a.progress + "/" + c))
},
animateStep: function(a) {
var b = this.passLogic.levels;
if (a.level < b.length) {
var c = 0;
var d = b[a.level].task.goal
} else
c = d = b[b.length - 1].task.goal;
this.amount.runAction(new cc.Spawn(new cc.Sequence(new cc.DelayTime(.2),new cc.CallFunc(function() {
this.amount.setString(c + "/" + d)
}
.bind(this)),new cc.DelayTime(.2)),AnimationsLibrary.pulse(this.amount, {
duration: .4
})))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PASS_PROGRESS_TEXT: {
size: 45,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
PASS_PROGRESS_IMAGE_TEXT: {
size: 45,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
cleverapps.styles.PassProgressAmount = {
margin: 10
};
var PassTickets = cc.Node.extend({
ctor: function(a) {
this.options = a;
var b = cleverapps.styles.PassTickets;
this._super();
this.setAnchorPoint(.5, .5);
if (bundles.passtickets.frames.tickets_layout_background) {
var c = cleverapps.UI.createScale9Sprite(bundles.passtickets.frames.tickets_layout_background, cleverapps.UI.Scale9Rect.TwoPixelXY);
c.setContentSize2(cleverapps.styles.PassTicket.width, c.height);
c.setPositionRound(c.width / 2, c.height / 2);
this.setContentSize2(c.width, c.height);
this.addChild(c)
}
c = new PassTicket(a);
c.setPositionRound(b.free);
this.addChild(c);
this.addPremiumTicket();
a.passLogic.onShowWindowListeners.passTickets = this.createListener(this.addPremiumTicket.bind(this))
},
addPremiumTicket: function() {
this.premium && this.premium.removeFromParent();
this.premium = new PassTicket(Object.assign({}, this.options, {
premium: !0
}));
this.premium.setPositionRound(cleverapps.styles.PassTickets.premium);
this.addChild(this.premium)
}
});
cleverapps.styles.PassTickets = {
free: {
x: {
align: "center",
dx: -20
},
y: {
align: "center",
dy: -170
}
},
premium: {
x: {
align: "center",
dx: -20
},
y: {
align: "center",
dy: 145
}
}
};
var PassTicket = cc.Node.extend({
ctor: function(a) {
this.premium = a.premium;
this.passLogic = a.passLogic;
this._super();
a = cleverapps.styles.PassTicket;
this.setContentSize2(a.width, a.height);
this.setAnchorPoint(.5, .5);
if (bundles.passtickets.frames.ticket_background) {
var b = cleverapps.UI.createScale9Sprite(bundles.passtickets.frames.ticket_background, cleverapps.UI.Scale9Rect.TwoPixelXY);
b.setContentSize2(a.width, a.height);
b.setPositionRound(a.width / 2, a.height / 2);
this.addChild(b)
}
bundles.passtickets.frames.order_rings && a.rings.forEach(function(g) {
var h = new cc.Sprite(bundles.passtickets.frames.order_rings);
h.setPositionRound(g);
this.addChild(h)
}, this);
var c = this.premium && a.premium.text || a.text;
b = cleverapps.UI.generateOnlyText(this.premium ? "PassWindow.ticket.hint" : "PassWindow.ticket.freeHint", this.premium ? cleverapps.styles.FONTS.PASS_TICKET_TEXT : cleverapps.styles.FONTS.PASS_TICKET_SMALL_TEXT);
b.setDimensions(c.width, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.fitTo(void 0, c.height);
c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(this.premium && a.premium.icon || a.icon);
var d = new cleverapps.Spine(bundles.passtickets.jsons[this.passLogic.mission.type === Mission.TYPE_SALEPASS ? "purchase_ticket_json" : "ticket_json"]);
d.setAnimation(0, this.premium ? "animation" : "animation2", !0);
d.setPositionRound(c.width / 2, c.height / 2);
c.addChild(d);
if (this.premium && !this.passLogic.hasPremium()) {
var e = this.createTicketButton();
cleverapps.UI.onClick(c, function() {
this.passLogic.canBuyPremium() && new PassBuyTicketWindow(this.passLogic)
}
.bind(this))
} else {
var f = new cc.Sprite(bundles.passtickets.frames.attention_png);
a.checkmark && (f.setPositionRound(a.checkmark),
c.addChild(f))
}
f = [b, c, e, f];
"tropical" === cleverapps.config.ui && (f = [b, e, c]);
e = new cleverapps.Layout(f,{
margin: a.margin,
direction: cleverapps.UI.VERTICAL
});
e.setPositionRound(a.icon);
this.addChild(e);
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this)
},
createTicketButton: function() {
var a = cleverapps.styles.PassTicket.button;
if (this.passLogic.hasPremium())
return new cc.Sprite(bundles.passtickets.frames.attention_png);
this.button = new cleverapps.UI.Button({
text: this.passLogic.getPriceText(),
type: cleverapps.styles.UI.Button.Images.small_button_green,
width: a.width,
height: a.height,
disabled: !this.passLogic.canBuyPremium(),
onClicked: this.passLogic.buyPremium.bind(this.passLogic)
});
this.updateButton();
return this.button
},
updateButton: function() {
this.button && (connector.payments.isConnected() || this.passLogic.getProduct()instanceof VirtualProduct ? this.button.enable() : this.button.disable())
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PASS_TICKET_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
PASS_TICKET_SMALL_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.PassTicket = {
width: 300,
height: 624,
margin: -50,
text: {
width: 210,
height: 90
},
icon: {
width: 160,
height: 240,
x: {
align: "center"
},
y: {
align: "center"
}
},
premium: {
icon: {
width: 160,
height: 220
}
},
button: {
width: 170,
height: 60,
scale: 1.2
}
};
var PassWindowContent = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.setContentSize2(a.width, a.styles.height);
a.components.forEach(function(b) {
var c = a.styles[b.name]
, d = Object.assign(b.params || {}, {
passLogic: a.passLogic,
width: a.width,
styles: c
});
if (!b.class.IsActive || b.class.IsActive(d))
b = new b.class(d),
b.setPositionRound(c),
this.addChild(b, c.zOrder)
}
.bind(this));
cleverapps.focusManager.showControlsWhileFocused(["MenuBarGoldItem", "MenuBarLivesItem"])
}
});
var BuildPassWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.mission = a;
var b = [{
name: "header",
class: PassHeader,
params: {
bg_json: bundles.pass.jsons.bg_json,
pack_json: bundles.pass.jsons.pack_json,
decor_json: bundles.pass.jsons.decor_json,
close: this.close.bind(this),
passLogic: a.logic
}
}, {
name: "progress",
class: PassProgress
}, {
name: "tickets",
class: PassTickets
}];
this._super({
name: "BuildPassWindow",
title: "BuildPassWindow.title",
content: new PassWindowContent({
components: b,
width: cleverapps.styles.BuildPassWindow.width,
styles: cleverapps.styles.BuildPassWindow,
passLogic: a.logic
}),
help: function() {
new GuideWindow(a.rulesOptions)
},
foreground: bundles.passforeground.frames.window_foreground_png,
contentPadding: cleverapps.styles.BuildPassWindow.contentPadding,
closeButton: !0,
noPadding: !0,
styles: cleverapps.styles.BuildPassWindow.window
})
},
onShow: function() {
this._super();
this.mission.logic.handleShowWindow()
},
listBundles: function() {
return ["pass"]
}
});
BuildPassWindow.LEVELS = [{
energy: 0,
task: {
goal: 30
},
reward: {
unit: {
code: "worker",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "treasure",
stage: 0,
amount: 1
}
}
}, {
energy: 5,
task: {
goal: 75
},
reward: {
unit: {
code: "herochest",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "sacks",
stage: 0,
amount: 2
}
}
}, {
energy: 5,
task: {
goal: 150
},
reward: {
unit: {
code: "seasonchest",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "treasure",
stage: 2,
amount: 2
}
}
}, {
energy: 5,
task: {
goal: 350
},
reward: {
unit: {
code: "sacks",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "worker",
stage: 3,
amount: 2
}
}
}, {
energy: 10,
task: {
goal: 700
},
reward: {
unit: {
code: "crystal",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "sacks",
stage: 2,
amount: 1
}
}
}, {
energy: 10,
task: {
goal: 1500
},
reward: {
unit: {
code: "worker",
stage: 2,
amount: 1
}
},
premiumReward: {
unit: {
code: "worker",
stage: 4,
amount: 1
}
}
}, {
energy: 10,
task: {
goal: 3E3
},
reward: {
unit: {
code: "sacks",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "sacks",
stage: 1,
amount: 2
}
}
}, {
energy: 15,
task: {
goal: 5E3
},
reward: {
unit: {
code: "worker",
stage: 3,
amount: 1
}
},
premiumReward: {
unit: {
code: "crystal",
stage: 3,
amount: 2
}
}
}, {
energy: 15,
task: {
goal: 8E3
},
reward: {
unit: {
code: "treasure",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "coinstree",
stage: 1,
amount: 1
}
}
}, {
energy: 15,
task: {
goal: 12E3
},
reward: {
unit: {
code: "magicplant",
stage: 4,
amount: 1
}
},
premiumReward: {
unit: {
code: "energytree",
stage: 2,
amount: 1
}
}
}];
cleverapps.styles.BuildPassWindow = {
width: 1816,
height: 935,
paddingX: 50,
window: {
Foreground: {
padding: {
top: 300
}
}
},
contentPadding: {
right: 80
},
progress: {
x: {
align: "right",
dx: -26
},
y: {
align: "center",
dy: -122
}
},
header: {
x: {
align: "center",
dx: -2
},
y: {
align: "top",
dy: -30
}
},
tickets: {
x: {
align: "left",
dx: 24
},
y: {
align: "center",
dy: -118
}
}
};
var LevelPassWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.mission = a;
this._super({
name: "LevelPassWindow",
title: "LevelPassWindow.title",
content: this.createContent(),
closeButton: !0,
styles: cleverapps.styles.LevelPassWindow.window,
foreground: bundles.passforeground.frames.window_foreground_png,
help: function() {
new GuideWindow(a.rulesOptions)
}
})
},
onShow: function() {
this._super();
this.mission.logic.handleShowWindow()
},
createContent: function() {
var a = cleverapps.styles.LevelPassWindow
, b = this.calcContentWidth();
return new PassWindowContent({
components: [{
name: "progress",
class: PassProgress
}, {
name: "header",
class: PassHeader
}, {
name: "tickets",
class: PassTickets,
params: {
close: this.close.bind(this)
}
}],
width: b,
styles: a,
passLogic: this.mission.logic
})
},
calcContentWidth: function() {
var a = cleverapps.styles.LevelPassWindow
, b = cleverapps.resolution.getSceneSize().width - 2 * a.paddingX;
b < a.minWidth && (b = a.minWidth);
b > a.maxWidth && (b = a.maxWidth);
return b
},
listBundles: function() {
return ["pass"]
}
});
LevelPassWindow.LEVELS = [{
level: 0,
task: {
goal: 3
},
reward: {
unlimitedLives: "30 minutes"
},
premiumReward: {
unlimitedLives: "12 hours"
}
}, {
level: 1,
task: {
goal: 5
},
reward: {
boosters: {
5: 1
}
},
premiumReward: {
boosters: {
5: 3
}
}
}, {
level: 2,
task: {
goal: 8
},
reward: {
unlimitedLives: "1 hour"
},
premiumReward: {
boosters: {
0: 3
}
}
}, {
level: 3,
task: {
goal: 12
},
reward: {
boosters: {
6: 1
}
},
premiumReward: {
unlimitedLives: "12 hours"
}
}, {
level: 4,
task: {
goal: 15
},
reward: {
unlimitedLives: "2 hours"
},
premiumReward: {
boosters: {
1: 3
}
}
}, {
level: 5,
task: {
goal: 20
},
reward: {
exp: 20
},
premiumReward: {
hard: 300
}
}, {
level: 6,
task: {
goal: 25
},
reward: {
boosters: {
7: 1
}
},
premiumReward: {
boosters: {
2: 3
}
}
}, {
level: 7,
task: {
goal: 30
},
reward: {
boosters: {
6: 2
}
},
premiumReward: {
unlimitedLives: "12 hours"
}
}, {
level: 8,
task: {
goal: 40
},
reward: {
unlimitedLives: "2 hours"
},
premiumReward: {
boosters: {
0: 5
}
}
}, {
level: 9,
task: {
goal: 50
},
reward: {
boosters: {
2: 1
}
},
premiumReward: {
hard: 500
}
}];
cleverapps.styles.LevelPassWindow = {
minWidth: 900,
maxWidth: 1800,
height: 900,
paddingX: 50,
window: {
padding: {
left: 0,
right: 0,
top: 160,
bottom: 50
}
},
progress: {
x: {
align: "right",
dx: -25
},
y: {
align: "top",
dy: -210
}
},
header: {
x: {
align: "center"
},
y: {
align: "top",
dy: -10
}
},
tickets: {
x: {
align: "left",
dx: 10
},
y: {
align: "top",
dy: -243
}
}
};
var SalePassWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.mission = a;
var b = [{
name: "header",
class: PassHeader,
params: {
bg_json: bundles.salepass.jsons.bg_json,
pack_json: bundles.salepass.jsons.pack_json,
decor_json: bundles.salepass.jsons.decor_json,
json: bundles.salepass.jsons.head_json,
close: this.close.bind(this),
passLogic: a.logic
}
}, {
name: "progress",
class: PassProgress
}, {
name: "tickets",
class: PassTickets,
params: {
close: this.close.bind(this)
}
}];
this._super({
name: "SalePassWindow",
title: "SalePassWindow.title",
content: new PassWindowContent({
components: b,
width: cleverapps.styles.SalePassWindow.width,
styles: cleverapps.styles.SalePassWindow,
passLogic: a.logic
}),
help: function() {
new GuideWindow(a.rulesOptions)
},
foreground: bundles.passforeground.frames.window_foreground_png,
contentPadding: cleverapps.styles.SalePassWindow.contentPadding,
closeButton: !0,
noPadding: !0,
styles: cleverapps.styles.SalePassWindow.window
})
},
onShow: function() {
this._super();
this.mission.logic.handleShowWindow()
},
listBundles: function() {
return ["salepass"]
}
});
SalePassWindow.LEVELS = [{
energy: 0,
task: {
goal: 30
},
reward: {
unit: {
code: "crystal",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "crystal",
stage: 0,
amount: 3
}
}
}, {
energy: 5,
task: {
goal: 150
},
reward: {
unit: {
code: "treasure",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "treasure",
stage: 1,
amount: 2
}
}
}, {
energy: 5,
task: {
goal: 275
},
reward: {
unit: {
code: "coins",
stage: 4,
amount: 1
}
},
premiumReward: {
unit: {
code: "coinscup",
stage: 2,
amount: 1
}
}
}, {
energy: 5,
task: {
goal: 325
},
reward: {
unit: {
code: "treasure",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "worker",
stage: 4,
amount: 2
}
}
}, {
energy: 10,
task: {
goal: 355
},
reward: {
unit: {
code: "worker",
stage: 3,
amount: 1
}
},
premiumReward: {
unit: {
code: "treasure",
stage: 2,
amount: 3
}
}
}, {
energy: 10,
task: {
goal: 400
},
reward: {
unit: {
code: "treasure",
stage: 2,
amount: 1
}
},
premiumReward: {
unit: {
code: "crystal",
stage: 3,
amount: 2
}
}
}, {
energy: 10,
task: {
goal: 475
},
reward: {
unit: {
code: "sacks",
stage: 2,
amount: 1
}
},
premiumReward: {
unit: {
code: "coins",
stage: 5,
amount: 3
}
}
}, {
energy: 15,
task: {
goal: 525
},
reward: {
unit: {
code: "coins",
stage: 3,
amount: 1
}
},
premiumReward: {
unit: {
code: "rubies",
stage: 4,
amount: 1
}
}
}, {
energy: 15,
task: {
goal: 600
},
reward: {
unit: {
code: "worker",
stage: 3,
amount: 2
}
},
premiumReward: {
unit: {
code: "coinstree",
stage: 1,
amount: 1
}
}
}, {
energy: 15,
task: {
goal: 750
},
reward: {
unit: {
code: "magicplant",
stage: 5,
amount: 1
}
},
premiumReward: {
unit: {
code: "energytree",
stage: 2,
amount: 1
}
}
}];
cleverapps.styles.SalePassWindow = {
width: 1816,
height: 935,
paddingX: 50,
window: {
Foreground: {
padding: {
top: 300
}
}
},
contentPadding: {
right: 100
},
progress: {
x: {
align: "right",
dx: -26
},
y: {
align: "center",
dy: -122
}
},
header: {
x: {
align: "center",
dx: -2
},
y: {
align: "top",
dy: -30
}
},
tickets: {
x: {
align: "left",
dx: 24
},
y: {
align: "center",
dy: -118
}
}
};
var ExpeditionPassWindow = CleverappsWindow.extend({
ctor: function(a) {
this.mission = a;
this._super.apply(this, arguments)
},
onWindowLoaded: function(a) {
var b = {
name: "ExpeditionPassWindow",
title: "ExpeditionPassWindow.title",
content: new PassWindowContent({
components: [{
name: "progress",
class: PassProgress
}, {
name: "tickets",
class: PassTickets,
params: {
close: this.close.bind(this)
}
}, {
name: "header",
class: ExpeditionPassHeader,
params: {
pack_json: bundles["expeditionpass_" + cleverapps.skins.getSlot("skinName")].jsons.pack_json,
close: this.close.bind(this)
}
}],
width: cleverapps.styles.ExpeditionPassWindow.width,
styles: cleverapps.styles.ExpeditionPassWindow,
passLogic: a.logic
}),
foreground: bundles.passforeground.frames.window_foreground_png,
closeButton: !0,
noPadding: !0,
styles: cleverapps.styles.SalePassWindow.window
};
a.rulesOptions && (b.help = function() {
var c = a.rulesOptions
, d = cleverapps.skins.getSlot("skinName") + "_multipass_guidewindow";
bundles[d] && -1 === ["undersea", "undersea2", "dragonia", "dragonia2"].indexOf(cleverapps.travelBook.getCurrentExpedition().id) && (c = {
name: d,
bundle: bundles[d]
});
new GuideWindow(c)
}
);
this._super(b)
},
getPerson: function() {
if (Mission.ParseCompoundType(this.mission.type).parentType === Mission.TYPE_UNDERSEA2_EXPEDITION)
return "capitannemo"
},
onShow: function() {
this._super();
this.mission.logic.handleShowWindow()
},
onClose: function() {
cleverapps.focusManager.hideControlsWhileFocused(["MenuBarGoldItem", "MenuBarLivesItem"])
},
listBundles: function() {
return ["expeditionpass_" + cleverapps.skins.getSlot("skinName")]
}
});
ExpeditionPassWindow.LEVELS = [{
task: {
goal: 100
},
reward: {
unit: {
code: "worker",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "worker",
stage: 1,
amount: 1
}
}
}, {
task: {
goal: 175
},
reward: {
unit: {
code: "sacks",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "sacks",
stage: 1,
amount: 1
}
}
}, {
task: {
goal: 300
},
reward: {
unit: {
code: "wands",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "wands",
stage: 2,
amount: 1
}
}
}, {
task: {
goal: 750
},
reward: {
unit: {
code: "coins",
stage: 2,
amount: 1
}
},
premiumReward: {
unit: {
code: "rubies",
stage: 3,
amount: 1
}
}
}, {
task: {
goal: 1500
},
reward: {
unit: {
code: "crystal",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "crystal",
stage: 1,
amount: 3
}
}
}, {
task: {
goal: 3500
},
reward: {
unit: {
code: "treasure",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "treasure",
stage: 2,
amount: 1
}
}
}, {
task: {
goal: 4500
},
reward: {
unit: {
code: "sacks",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "sacks",
stage: 2,
amount: 1
}
}
}, {
task: {
goal: 5200
},
reward: {
unit: {
code: "herochest",
stage: 0,
amount: 1
}
},
premiumReward: {
unit: {
code: "herochest",
stage: 1,
amount: 2
}
}
}, {
task: {
goal: 6E3
},
reward: {
unit: {
code: "coins",
stage: 3,
amount: 1
}
},
premiumReward: {
unit: {
code: "rubies",
stage: 3,
amount: 2
}
}
}, {
task: {
goal: 8E3
},
reward: {
unit: {
code: "herochest",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "worker",
stage: 3,
amount: 3
}
}
}, {
task: {
goal: 1E4
},
reward: {
unit: {
code: "worker",
stage: 3,
amount: 1
}
},
premiumReward: {
unit: {
code: "herochest",
stage: 2,
amount: 1
}
}
}, {
task: {
goal: 12E3
},
reward: {
unit: {
code: "magicplant",
stage: 3,
amount: 1
}
},
premiumReward: {
unit: {
code: "sacks",
stage: 2,
amount: 3
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "sacks",
stage: 2,
amount: 1
}
},
premiumReward: {
unit: {
code: "magicplant",
stage: 6,
amount: 1
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "worker",
stage: 3,
amount: 1
}
},
premiumReward: {
unit: {
code: "worker",
stage: 4,
amount: 2
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "herochest",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "herochest",
stage: 2,
amount: 2
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "wands",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "wands",
stage: 3,
amount: 3
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "coins",
stage: 3,
amount: 2
}
},
premiumReward: {
unit: {
code: "rubies",
stage: 4,
amount: 1
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "treasure",
stage: 1,
amount: 1
}
},
premiumReward: {
unit: {
code: "treasure",
stage: 2,
amount: 3
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "crystal",
stage: 2,
amount: 1
}
},
premiumReward: {
unit: {
code: "crystal",
stage: 3,
amount: 2
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "sacks",
stage: 2,
amount: 2
}
},
premiumReward: {
unit: {
code: "herochest",
stage: 2,
amount: 3
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "coins",
stage: 4,
amount: 3
}
},
premiumReward: {
unit: {
code: "rubies",
stage: 4,
amount: 3
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "herochest",
stage: 1,
amount: 2
}
},
premiumReward: {
unit: {
code: "crystal",
stage: 3,
amount: 3
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "worker",
stage: 4,
amount: 1
}
},
premiumReward: {
unit: {
code: "magicplant",
stage: 7,
amount: 1
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "magicplant",
stage: 4,
amount: 1
}
},
premiumReward: {
unit: {
code: "coinstree",
stage: 3,
amount: 1
}
}
}, {
task: {
goal: 15E3
},
reward: {
unit: {
code: "magicplant",
stage: 5,
amount: 1
}
},
premiumReward: {
unit: {
code: "energytree",
stage: 3,
amount: 1
}
}
}];
cleverapps.styles.ExpeditionPassWindow = {
width: 1770,
height: 901,
window: {
Foreground: {
padding: {
top: 300
}
}
},
progress: {
x: {
align: "right",
dx: -27
},
y: {
align: "bottom",
dy: -7
}
},
header: {
x: {
align: "center"
},
y: {
align: "top",
dy: -4
}
},
tickets: {
x: {
align: "left",
dx: 24
},
y: {
align: "center",
dy: -106
}
}
};
var PassLastChanceWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.mission = a;
this.price = this.calcPrice();
this._super({
name: "battlepasslastchancewindow",
title: "PassLastChanceWindow.title",
content: this.createContent(),
buttons: this.createButtons(),
notCloseByTouchInShadow: !0,
closeButtonDelay: !0
});
this.addOfferBadge()
},
createContent: function() {
var a = cleverapps.styles.PassLastChanceWindow
, b = cleverapps.UI.generateOnlyText("PassLastChanceWindow.upperText", cleverapps.styles.FONTS.DARK_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT);
b.setAnchorPoint(.5, .5);
b.setDimensions(a.texts.width, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
var c = this.createRewards();
c.setLocalZOrder(1);
var d = cleverapps.UI.generateOnlyText("PassLastChanceWindow.lowerText", cleverapps.styles.FONTS.DARK_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT);
d.setAnchorPoint(.5, .5);
d.setDimensions(a.texts.width, 0);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
return new cleverapps.Layout([b, c, d],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createRewards: function() {
var a = cleverapps.styles.PassLastChanceWindow.rewards
, b = [this.createReward(!1)];
this.mission.logic.hasPremium() && b.push(this.createReward(!0));
return new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
},
addOfferBadge: function() {
var a = cleverapps.styles.PassLastChanceWindow
, b = new TileBadge({
text: Messages.get("PassLastChanceWindow.badgeText").replace(/ /g, "\n"),
rotation: a.offerBadge.rotation
});
b.setPositionRound(this.mission.details && this.mission.details.premium ? a.premiumOfferBadge : a.offerBadge);
this.window.addChild(b)
},
createButtons: function() {
var a = cleverapps.styles.PassLastChanceWindow.buttons;
a = new cleverapps.UI.Button({
width: a.width,
height: a.height,
text: this.getProduct().getCurrentPrice(),
onClicked: function() {
this.getProduct().buy(function(b) {
b && this.buyReward()
}
.bind(this))
}
.bind(this),
type: cleverapps.styles.UI.Button.Images.button_blue
});
cleverapps.fallSale.isAvailable() && a.addChild(new FallSaleIcon);
return [a]
},
createReward: function(a) {
var b = cleverapps.styles.PassLastChanceWindow.rewards
, c = cleverapps.UI.createScale9Sprite(bundles.passlastchance_window.frames.icon_background, cleverapps.UI.Scale9Rect.TwoPixelXY);
c.setAnchorPoint(.5, .5);
c.setContentSize2(b.background);
var d = new PassRewardIcon({
passLogic: this.mission.logic,
level: this.mission.logic.levels[this.mission.logic.shownProgress.level].level,
premium: a
});
d.setScale(1.3);
d.setAnchorPoint(.5, .5);
d.setPositionRound(b.icon);
c.addChild(d);
a && (a = new cc.Sprite(bundles.passlastchance_window.frames.icon_ribbon),
a.setPositionRound(b.ribbon),
c.addChild(a),
d = cleverapps.UI.generateOnlyText("PassRewardIcon.ribbonText", cleverapps.styles.FONTS.BP_LAST_CHANCE_RIBBON),
d.setPositionRound(b.text),
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
d.setDimensions(b.text.width, 0),
d.fitTo(void 0, b.text.height),
d.setRotation(b.text.rotation),
a.addChild(d),
"heroes" !== cleverapps.config.ui && (a = new cleverapps.Spine(this.mission.type === Mission.TYPE_SALEPASS ? bundles.passlastchance_window.jsons.purchase_ticket_json : bundles.passlastchance_window.jsons.ticket_json),
a.setAnimation(0, "animation", !0),
a.setAnchorPoint(.5, .5),
a.setScale(b.ticket.scale),
a.setPositionRound(b.ticket),
c.addChild(a)));
return c
},
calcPrice: function() {
return 100
},
getProduct: function() {
return Product.CreateByHardPrice(this.calcPrice(), {
type: "last_chance"
})
},
buyReward: function() {
this.mission.logic.completeCurrentTask();
this.close();
new this.mission.view(this.mission)
},
listBundles: function() {
return ["passlastchance_window"]
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
BP_LAST_CHANCE_RIBBON: {
size: 45,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
cleverapps.styles.PassLastChanceWindow = {
margin: 40,
texts: {
width: 800
},
buttons: {
width: 300,
height: 110
},
offerBadge: {
x: {
align: "right",
dx: -190
},
y: {
align: "center",
dy: 220
},
rotation: 15
},
premiumOfferBadge: {
x: {
align: "right",
dx: 0
},
y: {
align: "center",
dy: 220
},
rotation: 15
},
rewards: {
margin: 30,
background: {
width: 416,
height: 416
},
icon: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 10
}
},
ribbon: {
x: {
align: "left",
dx: 1
},
y: {
align: "top",
dy: 4
}
},
text: {
x: {
align: "center",
dx: -26
},
y: {
align: "center",
dy: 36
},
width: 120,
height: 74,
rotation: -45
},
ticket: {
x: {
align: "right",
dx: 109
},
y: {
align: "bottom",
dy: -100
},
scale: 1.3
}
}
};
var PassBuyTicketWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.passLogic = a;
this._super({
name: "PassBuyTicketWindow",
title: "PassBuyTicketWindow.title",
content: this.createContent(),
closeButton: !0,
contentPadding: cleverapps.styles.PassBuyTicketWindow.contentPadding
});
this.createBadge();
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this);
a.onPremiumBought = this.createListener(this.close.bind(this))
},
createContent: function() {
var a = cleverapps.styles.PassBuyTicketWindow
, b = this.createTicket()
, c = Messages.get("PassBuyTicketWindow.lowerText");
c = cleverapps.splitHalfByWord(c).join("\n");
c = cleverapps.UI.generateOnlyText(c, cleverapps.styles.FONTS.GOLDEN_TICKET_TEXT);
c.fitTo(a.texts.width);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
var d = this.createRewards()
, e = this.createButton();
return new cleverapps.Layout([b, d, c, e],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
},
createTicket: function() {
var a = cleverapps.styles.PassBuyTicketWindow.ticket
, b = new cleverapps.Spine(bundles.passbuyticket_window.jsons[this.passLogic.mission.type === Mission.TYPE_SALEPASS ? "purchase_ticket_json" : "ticket_json"]);
b.setScale(1.3);
b.setPositionRound({
align: "center"
}, {
align: "center"
});
b.setAnimation(0, "animation", !0);
var c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(a);
c.addChild(b);
return c
},
createRewards: function() {
var a = cleverapps.styles.PassBuyTicketWindow.rewards
, b = this.passLogic.levels.map(function() {
var d = new cc.Scale9Sprite(bundles.passbuyticket_window.frames.icon_background);
d.setContentSize2(a.background);
return d
})
, c = new cleverapps.GridLayout(b,{
columns: 12 <= b.length ? Math.ceil(b.length / 3) : 5,
margin: a.margin,
padding: a.padding
});
b.forEach(function(d, e) {
e = new PassRewardIcon({
passLogic: this.passLogic,
level: e,
premium: !0,
amountBg: bundles.passbuyticket_window.frames.amount_bg,
font: cleverapps.styles.FONTS.PASS_REWARD_COLORED_TEXT
});
e.setPositionRound(d.x + a.icon.dx, d.y + a.icon.dy);
cleverapps.UI.fitToBox(e, a.icon);
c.addChild(e);
e.toolTipMsg && cleverapps.tooltipManager.create(e, {
text: e.toolTipMsg,
location: cleverapps.UI.Tooltip.LOCATION_BELOW
})
}, this);
bundles.passbuyticket_window.frames.rewards_background_special && (b = cleverapps.UI.createScale9Sprite(bundles.passbuyticket_window.frames.rewards_background_special, cleverapps.UI.Scale9Rect.TwoPixelXY),
b.setContentSize2(c.width, c.height),
b.setPositionRound(c.width / 2, c.height / 2),
c.addChild(b, -1));
return c
},
createButton: function() {
var a = cleverapps.styles.PassBuyTicketWindow.buttons;
this.button = new cleverapps.UI.Button({
text: this.passLogic.getPriceText(),
width: a.width,
height: a.height,
disabled: !this.passLogic.canBuyPremium(),
onClicked: function() {
this.passLogic.buyPremium()
}
.bind(this)
});
this.updateButton();
cleverapps.fallSale.isAvailable() && this.button.addChild(new FallSaleIcon);
return this.button
},
updateButton: function() {
connector.payments.isConnected() || this.passLogic.getProduct()instanceof VirtualProduct ? this.button.enable() : this.button.disable()
},
createBadge: function() {
var a = cleverapps.styles.PassBuyTicketWindow
, b = new TileBadge({
type: "value",
value: "200%",
rotation: a.badge.rotation
});
this.window.addChild(b, 2);
b.setPositionRound(a.badge)
},
listBundles: function() {
return ["passbuyticket_window"]
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
GOLDEN_TICKET_TEXT: {
size: 40,
color: new cc.Color(121,75,57,255)
}
});
cleverapps.styles.PassBuyTicketWindow = {
margin: 40,
padding: {
x: 10,
top: -20
},
texts: {
width: 800
},
buttons: {
width: 300,
height: 110
},
ticket: {
width: 180,
height: 200,
x: {
align: "center"
},
y: {
align: "center"
}
},
badge: {
rotation: -15,
x: {
align: "left",
dx: -60
},
y: {
align: "top",
dy: 50
}
},
rewards: {
width: 1E3,
margin: {
x: 10,
y: 10
},
padding: {
x: 25,
top: 20,
bottom: 30
},
background: {
width: 120,
height: 120
},
icon: {
width: 100,
height: 100,
maxScale: 1,
dx: 0,
dy: 0
}
},
contentPadding: {
left: 50,
right: 50
}
};
var CupTableView = cc.Node.extend({
ctor: function(a, b, c) {
c = c || {};
this._super();
this.cup = a;
this.tableConstructor = b;
this.table = this.tableConstructor();
this.scaleDuration = c.scaleDuration;
this.scaleEasing = c.scaleEasing;
this.updateSize();
this.setAnchorPoint(.5, .5);
this.setupChildren();
this.addChild(this.table);
this.cupStart = this.cup.start;
this.updateState();
this.cup.onChangedTable = this.createListener(this.updateState.bind(this))
},
updateSize: function() {
this.setContentSize2(this.table.getContentSize())
},
setupChildren: function() {
this.table.setPositionRound(this.width / 2, this.height / 2)
},
updateState: function() {
if (!this.animationRunning)
if (this.cup.start === this.cupStart) {
var a = this.cup.listParticipants();
this.table.updateResults(a) ? cleverapps.cupsTopTable.updateResults(this.cup.type, a) : (this.cupStart = void 0,
this.updateState())
} else
this.animationRunning = !0,
this.hideTable(function() {
cleverapps.cupsTopTable.updateResults(this.cup.type, this.cup.listParticipants());
this.cupStart = this.cup.start;
this.recreateTable();
this.showTable(function() {
this.animationRunning = !1
}
.bind(this))
}
.bind(this))
},
recreateTable: function() {
var a = this.table.getPosition();
this.table.removeFromParent();
this.table = this.tableConstructor();
this.table.setPositionRound(a);
this.addChild(this.table)
},
showTable: function(a) {
this.table.setScale(0);
this.table.runAction(new cc.Sequence((new cc.ScaleTo(this.scaleDuration || .5,1)).easing(this.scaleEasing || cc.easeBackOut()),new cc.CallFunc(a)))
},
hideTable: function(a) {
this.table.runAction(new cc.Sequence((new cc.ScaleTo(this.scaleDuration || .5,0)).easing(this.scaleEasing || cc.easeBackIn()),new cc.CallFunc(a)))
}
});
var DailyCupScene = cleverapps.FixedWidthScene.extend({
onSceneLoaded: function() {
this._super(cleverapps.Environment.SCENE_DAILY_CUP);
cleverapps.environment.episodeNo = Level.LevelTypes.DAILYCUP;
var a = new DailyCupView(cleverapps.dailyCup);
this.addChild(a);
cleverapps.focusManager.registerControl("dailyCupButtons", new HidingNode(a.buttonsLayout,cleverapps.UI.VERTICAL));
cleverapps.playSession.set(cleverapps.EVENTS.CUP_DAU + cleverapps.dailyCup.type, !0);
cleverapps.placements.run(Placements.INTERMEDIATE)
},
getBackgroundStyles: function() {
return {
bundle: "daily_cup",
patternId: bundles.daily_cup.urls.daily_cup_pattern && "daily_cup_pattern",
backgroundId: "daily_cup_bg"
}
},
playIntroActions: function(a) {
cleverapps.dataLoader.load(DataLoader.TYPES.CUP_RULES + cleverapps.dailyCup.type) ? a() : (new GuideWindow({
name: "DailyCupRulesWindow",
bundle: bundles.dailycupruleswindow
}),
cleverapps.focusManager.onceNoWindowsListener = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.CUP_RULES + cleverapps.dailyCup.type, !0);
a()
}
)
},
listBundles: function() {
return ["daily_cup"]
}
});
var DailyCupView = cc.Node.extend({
ctor: function() {
this._super();
var a = cleverapps.styles.DailyCupView
, b = this.createTitle()
, c = this.createTimerBlock()
, d = this.createTable();
b = new cleverapps.Layout([b, c, d],{
margin: a.topLayout.margin,
direction: cleverapps.UI.VERTICAL
});
c = this.createHelpButton();
d = this.createLeadersButton();
var e = this.playButton = this.createPlayButton();
c = this.buttonsLayout = new cleverapps.Layout([c, e, d],{
margin: a.buttonsLayout.margin,
direction: cleverapps.UI.HORIZONTAL
});
a = new cleverapps.Layout([b, c],{
margin: a.margin,
direction: cleverapps.UI.VERTICAL
});
this.setAnchorPoint(.5, .5);
this.setContentSize2(a.width, a.height);
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a);
b = this.noConnectionInfo = this.createNoConnectionInfo();
b.setPositionRound(a.width / 2, a.height / 2);
a.addChild(b, 1);
this.updateState();
cleverapps.dailyCup.reload();
cleverapps.dailyCup.onChangedView = this.createListener(this.updateState.bind(this));
this.updateSize();
this.setupChildren()
},
setupChildren: function() {
this.setPositionRound(cleverapps.styles.DailyCupView.position)
},
updateSize: function() {
var a = cleverapps.styles.DailyCupView
, b = cleverapps.resolution.getSceneSize().width;
this.setScale(b < a.baseWidth ? b / a.baseWidth : 1)
},
updateState: function() {
this.animationRunning || (cleverapps.dailyCup.isRunning() ? (this.finishedText.setVisible(!1),
this.timer.setVisible(!0),
this.timer.countDown.resetTimeLeft(cleverapps.dailyCup.getTimeLeft()),
this.playButton.setString("Play"),
this.playButton.enable()) : (this.finishedText.setVisible(!0),
this.timer.setVisible(!1),
cleverapps.dailyCup.getReward() ? (this.playButton.setString("Claim"),
this.playButton.enable()) : cleverapps.dailyCup.isActive() && cleverapps.dailyCup.isFinished() ? (this.playButton.setString("Next"),
this.playButton.enable()) : (this.playButton.setString("Play"),
this.playButton.disable())),
cleverapps.dailyCup.hasConnection() ? this.noConnectionInfo.setVisible(!1) : (this.noConnectionInfo.setVisible(!0),
this.playButton.disable()))
},
createTitle: function() {
var a = cleverapps.styles.DailyCupView.title
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a);
var c = new cc.Scale9Sprite(bundles.daily_cup.frames.daily_cup_title_bg_png);
c.setContentSize2(a);
b.addChild(c);
c.setPositionRound(a.bg);
c = cleverapps.UI.generateOnlyText("Cups.daily.title", cleverapps.styles.FONTS.DAILY_CUP_TITLE_TEXT);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
c.fitTo(a.text.width);
b.addChild(c);
c.setPositionRound(a.text);
return b
},
createTimerBlock: function() {
var a = cleverapps.styles.DailyCupView
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.timerBlock);
this.timer = this.createTimer();
b.addChild(this.timer);
this.timer.setPositionRound(b.width / 2, b.height / 2);
this.finishedText = this.createFinishedText();
b.addChild(this.finishedText);
this.finishedText.setPositionRound(b.width / 2, b.height / 2);
return b
},
createTimer: function() {
var a = cleverapps.styles.DailyCupView
, b = cleverapps.dailyCup.getTimeLeft()
, c = new cc.Scale9Sprite(bundles.timer.frames.timer_bg_png);
c.setContentSize2(a.timer.bg);
return new cleverapps.CountDownView(new cleverapps.CountDown(b),{
font: cleverapps.styles.FONTS.DAILY_CUP_TIMER_TEXT,
background_content: c
})
},
createFinishedText: function() {
var a = cleverapps.styles.DailyCupView
, b = new cc.Scale9Sprite(bundles.timer.frames.timer_bg_png);
b.setContentSize2(a.finishedText);
var c = cleverapps.UI.generateOnlyText("Cups.daily.finished", cleverapps.styles.FONTS.WHITE_TEXT);
b.addChild(c);
c.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
c.fitTo(b.width - 2 * a.finishedText.padding.x, b.height - 2 * a.finishedText.padding.y);
c.setPositionRound(b.width / 2, b.height / 2);
return b
},
createTable: function() {
return new CupTableView(cleverapps.dailyCup,function() {
return cleverapps.cupsTopTable.createTableView({
id: cleverapps.dailyCup.type,
data: cleverapps.dailyCup.listParticipants(),
rowConstructor: cleverapps.DailyCupRow,
height: cleverapps.styles.DailyCupView.height
})
}
)
},
createHelpButton: function() {
return new cleverapps.UI.HelpButton(function() {
cleverapps.focusManager.display({
focus: "DailyCupRulesWindow",
action: function(a) {
new GuideWindow({
name: "DailyCupRulesWindow",
bundle: bundles.dailycupruleswindow,
title: "DailyCupRulesWindow.title"
});
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
)
},
createPlayButton: function() {
var a = cleverapps.styles.DailyCupView;
return new cleverapps.UI.Button({
text: "Play",
width: a.playButton.width,
height: a.playButton.height,
onClicked: function() {
this.animationRunning || cleverapps.focusManager.display({
focus: "PlayDailyCup",
actions: [function(b) {
this.animationRunning = !0;
cleverapps.dailyCup.isRunning() ? cleverapps.dailyCup.wantsToPlay(b) : cleverapps.dailyCup.getReward() ? cleverapps.dailyCup.receiveReward(b) : (cleverapps.dailyCup.isActive() && cleverapps.dailyCup.isFinished() && cleverapps.dailyCup.next(),
b())
}
.bind(this), function(b) {
b();
this.animationRunning = !1;
this.updateState()
}
.bind(this)]
})
}
.bind(this)
})
},
createLeadersButton: function() {
var a = cleverapps.styles.DailyCupView
, b = new cc.Sprite(bundles.daily_cup.frames.daily_cup_leaders_icon_png);
cleverapps.UI.fitToBox(b, a.leadersButton);
b.baseScale = b.scale;
cleverapps.UI.applyHover(b);
cleverapps.UI.onClick(b, function() {
cleverapps.focusManager.display({
focus: "DailyCupLeadersWindow",
action: function(c) {
new DailyCupLeadersWindow;
cleverapps.focusManager.onceNoWindowsListener = c
}
})
});
return b
},
createNoConnectionInfo: function() {
var a = cleverapps.styles.DailyCupView.noConnectionInfo
, b = new cc.Scale9Sprite(bundles.timer.frames.timer_bg_png);
b.setContentSize2(a.bg);
a = cleverapps.UI.generateOnlyText("InternetConnectionError", cleverapps.styles.FONTS.WHITE_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.setPositionRound(b.width / 2, b.height / 2);
a.setDimensions(b.width, 0);
a.fitTo(void 0, b.height);
b.addChild(a);
return b
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
DAILY_CUP_TIMER_TEXT: {
name: "default",
color: cleverapps.styles.COLORS.WHITE,
size: 40,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
DAILY_CUP_TITLE_TEXT: {
name: "default",
color: cleverapps.styles.COLORS.WHITE,
size: 60,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.DailyCupView = {
height: 640,
margin: 40,
baseWidth: 800,
position: {
x: {
align: "center"
},
y: {
align: "center",
dy: -30
}
},
topLayout: {
margin: 20
},
title: {
width: 500,
height: 150,
bg: {
x: {
align: "center"
},
y: {
align: "center",
dy: -30
}
},
text: {
width: 250,
x: {
align: "center"
},
y: {
align: "center",
dy: -10
}
}
},
table: {
height: 650,
paddingX: 20
},
timerBlock: {
width: 300,
height: 100
},
timer: {
bg: {
width: 270,
height: 55
}
},
finishedText: {
width: 400,
height: 80,
padding: {
x: 10,
y: 5
}
},
buttonsLayout: {
margin: 20
},
playButton: {
width: 300,
height: 125
},
leadersButton: {
width: 100,
height: 100
},
noConnectionInfo: {
bg: {
width: 480,
height: 120
}
}
};
var DailyCupLeadersWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.DailyCupLeadersWindow;
this.content = new cc.Node;
this.content.setAnchorPoint(.5, .5);
this.content.setContentSize(a.width, a.height);
this._super({
title: "DailyCupLeadersWindow.Title",
name: "dailycupleaderswindow",
content: this.content
});
(a = cleverapps.cupsLeadersTable.getResults("cache")) ? this.leadersOnLoad(a[0]) : (this.loading = new LeadersLoading,
this.loading.setPosition(this.content.width / 2, this.content.height / 2),
this.content.addChild(this.loading),
cleverapps.RestClient.get("/dailycup/leaders/" + encodeURIComponent(connector.platform.getUserID()), {}, this.createListener(this.leadersOnLoad.bind(this)), function() {
cleverapps.notification.create("LeadersLoadFailed")
}))
},
leadersOnLoad: function(a) {
this.loading && (this.loading.remove(),
cleverapps.cupsLeadersTable.updateResults("cache", [a]));
for (var b = a.leaders, c = !1, d = 0; d < b.length; d++)
if (b[d].id === connector.platform.getUserID()) {
c = !0;
b[d].player = !0;
break
}
c || (a = {
id: connector.platform.getUserID(),
firstPlace: a.playerResult.firstPlace,
secondPlace: a.playerResult.secondPlace,
thirdPlace: a.playerResult.thirdPlace,
player: !0,
avatar: cleverapps.user.getPlayerInfo().avatar,
text: cleverapps.user.getPlayerInfo().name,
notInTop: !0
},
b.push(a));
b.forEach(function(e, f) {
e.place = f + 1
});
b = this.table = cleverapps.cupsLeadersTable.createTableView({
id: "dailyCupLeadersWindow",
data: b,
rowConstructor: cleverapps.DailyCupLeadersRow
});
b.setPositionRound(this.content.width / 2, this.content.height / 2);
this.content.addChild(b)
}
});
cleverapps.styles.DailyCupLeadersWindow = {
width: 650,
height: 750
};
var CupsConfig = {
TYPE_DAILY: "daily",
TYPE_WEEKLY: "weekly",
TYPE_CLAN: "clan",
TYPE_CLAN_INNER: "claninner",
TYPES: {}
};
CupsConfig.TYPES[CupsConfig.TYPE_DAILY] = {
available: {
level: 10,
registered: "7 days",
projectName: "riddles heroes adventure runes wordsoup crocword magicwords olympics scramble tripeaks spades".split(" ")
},
scenes: [cleverapps.Environment.SCENE_MAIN, cleverapps.Environment.SCENE_DAILY_CUP],
rewards: RewardsConfig.DailyCup,
force: Forces.DAILY_CUP,
duration: cleverapps.parseInterval("1 hour"),
cooldown: 0,
topLimit: 25,
statsLimit: 25
};
-1 !== ["wordsoup", "scramble", "magicwords", "crocword"].indexOf(cleverapps.config.name) && (CupsConfig.TYPES[CupsConfig.TYPE_DAILY].duration = cleverapps.parseInterval("3 hours"));
if (cleverapps.config.debugMode || "undefined" === typeof cc && "production" !== process.env.NODE_ENV)
CupsConfig.TYPES[CupsConfig.TYPE_DAILY].duration = cleverapps.parseInterval("3 minutes");
CupsConfig.TYPES[CupsConfig.TYPE_WEEKLY] = {
available: {
level: 0,
projectName: ["olympics"]
},
scenes: [cleverapps.Environment.SCENE_LOADER, cleverapps.Environment.SCENE_MAIN],
rewards: RewardsConfig.WeeklyCup,
duration: cleverapps.parseInterval("1 week"),
cooldown: 0,
restartAfter: cleverapps.parseInterval("1 minute"),
topLimit: 25
};
if (cleverapps.config.debugMode || "undefined" === typeof cc && "production" !== process.env.NODE_ENV)
CupsConfig.TYPES[CupsConfig.TYPE_WEEKLY].duration = cleverapps.parseInterval("3 minutes");
CupsConfig.TYPES[CupsConfig.TYPE_CLAN] = {
available: Object.assign({}, cleverapps.Availables.CLANS, {
projectName: [],
disabled: !0
}),
scenes: [cleverapps.Environment.SCENE_MAIN],
rewards: RewardsConfig.ClanCup,
origin: (new Date("2022-10-06T00:00:00+00:00")).getTime(),
duration: cleverapps.parseInterval("4 days"),
cooldown: cleverapps.parseInterval("10 days"),
restartAfter: cleverapps.parseInterval("1 day"),
participateAsClan: !0,
topLimit: 50
};
if (cleverapps.config.debugMode || "undefined" === typeof cc && "production" !== process.env.NODE_ENV)
CupsConfig.TYPES[CupsConfig.TYPE_CLAN].duration = cleverapps.parseInterval("4 minutes"),
CupsConfig.TYPES[CupsConfig.TYPE_CLAN].cooldown = cleverapps.parseInterval("1 minute"),
CupsConfig.TYPES[CupsConfig.TYPE_CLAN].restartAfter = cleverapps.parseInterval("30 seconds");
CupsConfig.TYPES[CupsConfig.TYPE_CLAN_INNER] = Object.assign({}, CupsConfig.TYPES[CupsConfig.TYPE_CLAN], {
master: CupsConfig.TYPE_CLAN,
rewards: [],
participateAsClan: !1,
topLimit: 50
});
CupsConfig.IsEnabled = function(a) {
return (a = CupsConfig.TYPES[a]) && a.available && a.available.projectName && -1 !== a.available.projectName.indexOf(cleverapps.config.name)
}
;
"undefined" === typeof cc && (module.exports = CupsConfig);
var Cup = function(a, b) {
this.type = a;
this.config = CupsConfig.TYPES[this.type];
this.innerCup = b;
CupsConfig.IsEnabled(this.type) && (this.onChangedView = function() {}
,
this.onChangedTable = function() {}
,
this.onChangedIcon = function() {}
,
this.load(),
this.reload(!0),
cleverapps.timeouts.setInterval(this.reload.bind(this), Cup.RELOAD_INTERVAL))
};
Cup.prototype.runOnChangeListeners = function() {
this.onChangedIcon();
this.onChangedView();
this.onChangedTable()
}
;
Cup.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.CUP + this.type);
a = a || {};
this.participantId = a.participantId;
this.start = a.start || 0;
this.end = a.end || 0;
this.stars = a.stars || 0;
this.delta = a.delta || 0;
this.state = void 0 === a.state ? Cup.STATE_PENDING : a.state;
this.participants = [];
clearTimeout(this.timeout);
if (a = this.getTimeLeft())
this.timeout = new cleverapps.LongTimeout(this.reload.bind(this),a)
}
;
Cup.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.CUP + this.type, {
participantId: this.participantId,
start: this.start,
end: this.end,
stars: this.stars,
delta: this.delta,
state: this.state
})
}
;
Cup.prototype.next = function() {
this.state = Cup.STATE_PENDING;
this.save();
this.runOnChangeListeners();
this.reload();
this.innerCup && this.innerCup.next()
}
;
Cup.prototype.updateCup = function(a) {
a && a.start ? (this.start !== a.start && (this.start = a.start || 0,
this.delta = 0,
this.state = Cup.STATE_RUNNING,
this.wantsToShow = !0,
cleverapps.cupsTopTable.resetResults(this.type),
cleverapps.cupsLeadersTable.resetResults("cache")),
this.participantId = a.participantId,
this.end = Date.now() + a.time || 0,
this.stars = a.stars + this.delta || 0,
this.participants = a.participants || [],
clearTimeout(this.timeout),
(a = this.getTimeLeft()) ? (this.state = Cup.STATE_RUNNING,
this.timeout = new cleverapps.LongTimeout(this.reload.bind(this),a)) : this.state === Cup.STATE_RUNNING && (this.state = Cup.STATE_FINISHED,
this.getReward() || (this.state = Cup.STATE_RECEIVED,
this.wantsToShow = !1),
cleverapps.cupsLeadersTable.resetResults("cache"))) : this.state = Cup.STATE_PENDING;
this.save()
}
;
Cup.prototype.isAvailable = function(a) {
return CupsConfig.IsEnabled(this.type) && cleverapps.user.checkAvailable(this.config.available, a)
}
;
Cup.prototype.isActive = function() {
return this.state !== Cup.STATE_PENDING
}
;
Cup.prototype.isRunning = function() {
return this.state === Cup.STATE_RUNNING && this.getTimeLeft()
}
;
Cup.prototype.isFinished = function() {
return this.state !== Cup.STATE_RUNNING
}
;
Cup.prototype.hasConnection = function() {
return !this.noConnection
}
;
Cup.prototype.getTimeLeft = function() {
return Math.max(0, this.end - Date.now())
}
;
Cup.prototype.reload = function(a) {
if (!this.reloading && this.isAvailable() && (a || cleverapps.environment.hasScene(this.config.scenes)))
if (this.state === Cup.STATE_RECEIVED && this.end + this.config.restartAfter < Date.now())
this.next();
else {
var b = this.delta;
this.delta = 0;
this.save();
a = function() {
this.reloading = !1;
this.noConnection = !0;
this.delta += b;
this.save();
this.runOnChangeListeners()
}
.bind(this);
var c = function(e) {
this.noConnection = this.reloading = !1;
this.updateCup(e);
this.runOnChangeListeners()
}
.bind(this);
this.reloading = !0;
var d = {
type: this.type,
userId: connector.platform.getUserID(),
delta: b
};
this.state !== Cup.STATE_PENDING && (d.start = this.start);
cleverapps.RestClient.post("/dailycup/sync/", d, c, a)
}
}
;
Cup.prototype.addAmount = function(a) {
this.isRunning() && a && (this.stars += a,
this.delta += a,
this.save(),
this.runOnChangeListeners())
}
;
Cup.prototype.listParticipants = function() {
for (var a = this.participants.slice(), b, c = 0; c < a.length; ++c)
a[c].id === this.participantId && (b = a[c]);
c = cleverapps.user.getPlayerInfo();
this.type === CupsConfig.TYPE_CLAN && (c = cleverapps.userClan);
b || (b = {
id: c.id,
avatar: c.avatar || c.emblem,
name: c.name
},
a.push(b));
b.amount = this.stars;
b.player = !0;
a.sort(function(d, e) {
return e.amount - d.amount
});
a.forEach(function(d, e) {
d.cup = this;
d.place = e + 1;
d.text = d.name;
this.config.participateAsClan && (d.emblem = d.avatar)
}
.bind(this));
return a
}
;
Cup.prototype.calcPlace = function() {
if (this.stars) {
for (var a = 0; a < this.participants.length; a++) {
var b = this.participants[a];
if (b.id === this.participantId || b.amount < this.stars)
return a
}
return this.participants.length
}
}
;
Cup.prototype.listRewards = function() {
return this.config.rewards
}
;
Cup.prototype.getReward = function() {
if (this.state === Cup.STATE_FINISHED) {
var a = this.listRewards()
, b = this.calcPlace();
return a[b]
}
}
;
Cup.prototype.receiveReward = function(a) {
var b = this.getReward()
, c = this.calcPlace();
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.CUP_REWARD + this.type + "_" + this.start + "_" + (c + 1));
RewardWindow.createCupsWindow(b, this.type);
cleverapps.focusManager.onceNoWindowsListener = a;
this.state = Cup.STATE_RECEIVED;
this.save();
this.runOnChangeListeners()
}
;
Cup.prototype.withLives = function() {
return cleverapps.lives && "board" !== cleverapps.config.type
}
;
Cup.prototype.wantsToPlay = function(a) {
if (this.withLives() && cleverapps.lives.isEmpty())
new LivesShopWindow,
cleverapps.focusManager.onceNoWindowsListener = a;
else {
var b = cleverapps.user.getRandomLevel(1E3 * (this.start || 0) + (this.stars || 0), Level.LevelTypes.DAILYCUP);
MethaHelper.start(a, b)
}
}
;
Cup.prototype.getForce = function() {
return this.config.force
}
;
Cup.prototype.needsAttention = function() {
var a = this.calcPlace();
return this.getReward() || void 0 !== a && a !== this.lastShownPlace
}
;
Cup.prototype.afterWindowShown = function() {
this.wantsToShow = !1;
this.lastShownPlace = cleverapps.clanCup.calcPlace()
}
;
Cup.STATE_RUNNING = 0;
Cup.STATE_FINISHED = 1;
Cup.STATE_RECEIVED = 2;
Cup.STATE_PENDING = 3;
Cup.RELOAD_INTERVAL = cleverapps.parseInterval("30 seconds");
var Subscription = function() {
cleverapps.EventEmitter.call(this);
this.active = !1;
this.rewardTime = 0;
this.tokens = {};
this.updateInfo(cleverapps.dataLoader.load(DataLoader.TYPES.SUBSCRIPTION) || {}, !1);
this.reload();
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, this.reload.bind(this));
connector.payments.on("subscriptionTokensLoaded", this.addPurchaseTokens.bind(this))
};
Subscription.prototype = Object.create(cleverapps.EventEmitter.prototype);
Subscription.prototype.constructor = Subscription;
Subscription.prototype.getInfo = function(a) {
var b = {
active: this.active,
rewardTime: this.rewardTime,
tokens: this.tokens
};
a && connector.platform.oneOf(connector.IOS, connector.MACOS) && delete b.tokens;
a = {};
a[connector.info.source] = b;
return a
}
;
Subscription.prototype.updateInfo = function(a, b) {
var c = connector.info.source;
if (a = a && a[c])
this.active = !!a.id || a.active,
this.rewardTime = a.rewardTime || a.lastRewardTime || 0,
this.tokens = cleverapps.override({}, a.tokens || {}, this.tokens),
this.save(b)
}
;
Subscription.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.SUBSCRIPTION, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("subscription")
}
;
Subscription.prototype.getLeftTime = function() {
if (this.isActive())
return Math.max(this.rewardTime + cleverapps.parseInterval(Subscription.REWARD_INTERVAL) - Date.now(), 0)
}
;
Subscription.prototype.scheduleReload = function() {
clearTimeout(this.reloadTimeout);
this.reloadTimeout = new cleverapps.LongTimeout(this.reload.bind(this),cleverapps.parseInterval(Subscription.RELOAD_INTERVAL))
}
;
Subscription.prototype.reload = function() {
this.scheduleReload();
connector.platform.oneOf(connector.CLEVERAPPS) && !cleverapps.config.debugMode && this.active && (this.active = !1,
this.save(),
this.trigger("update"));
!Subscription.IsAvailable() || cleverapps.isLocalhost() || connector.platform.oneOf(connector.CLEVERAPPS) || connector.payments.getSubscriptionStatus({
tokens: this.tokens
}, function(a) {
var b = this.isActive();
this.active = a && a.active;
this.save();
this.trigger("update");
b && !this.isActive() && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SUBSCRIPTION_CANCELLED)
}
.bind(this))
}
;
Subscription.prototype.buy = function(a, b) {
var c = function(d) {
d && (connector.platform.oneOf(connector.IOS, connector.MACOS, connector.ANDROID) && Subscription.BUY_RELOADS.forEach(function(e) {
new cleverapps.LongTimeout(this.reload.bind(this),cleverapps.parseInterval(e))
}, this),
this.scheduleReload(),
this.active = !0,
this.rewardTime = 0,
this.save(),
this.trigger("update"),
this.receiveReward(),
b())
}
.bind(this);
connector.platform.oneOf(connector.CLEVERAPPS) ? c(cleverapps.config.debugMode) : a.buy(c)
}
;
Subscription.prototype.addPurchaseTokens = function(a, b) {
Array.isArray(a) || (a = [a]);
var c = !1;
a.forEach(function(d) {
var e = d.name
, f = d.purchaseToken
, g = d.productId;
d = d.packageName;
var h = this.tokens[e] || {};
e && f && g && d && (h.purchaseToken !== f || h.productId !== g || h.packageName !== d) && (this.tokens[e] = {
productId: g,
packageName: d,
purchaseToken: f
},
c = !0)
}
.bind(this));
c && (b && !this.isActive() && (this.lastReloadTime = 0,
this.reload()),
this.save())
}
;
Subscription.prototype.isRewardReady = function() {
return 0 === this.getLeftTime()
}
;
Subscription.prototype.needsAttention = function() {
return this.isRewardReady()
}
;
Subscription.CalcReward = function() {
var a = cleverapps.clone("instant" === connector.info.source && RewardsConfig.SubscriptionInstant || RewardsConfig.Subscription, !0);
return cleverapps.user.setRandomBoostersReward(a)
}
;
Subscription.prototype.receiveReward = function() {
if (this.isRewardReady()) {
var a = Subscription.CalcReward();
if (a.unit) {
var b = -Map2d.currentMap.countEmptySlots();
cleverapps.toArray(a.unit).forEach(function(c) {
b += c.amount
});
if (0 < b) {
cleverapps.centerHint.createTextHint("Spawn.nospace", {
left: b
});
return
}
}
new RewardWindow(a,{
title: "SubscriptionRewardWindow.title",
name: "subscriptionrewardwindow",
text: "SubscriptionRewardWindow.subtitle",
toMainWorld: cleverapps.travelBook.isExpedition(),
event: cleverapps.EVENTS.EARN.PURCHASE
});
this.rewardTime = Date.now();
this.save();
this.trigger("update");
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SUBSCRIPTION_REWARD)
}
}
;
cleverapps.config.debugMode && (Subscription.prototype.reset = function() {
this.active = !1;
this.rewardTime = 0;
this.tokens = {};
this.save()
}
);
Subscription.prototype.isActive = function() {
return this.active
}
;
Subscription.prototype.needDisplayWindow = function() {
return Subscription.IsAvailable() && !this.isActive()
}
;
Subscription.IsAvailable = function() {
return Product.CreateById("subsWeek") && Product.CreateById("subsWeek") ? cleverapps.subscription && cleverapps.subscription.isActive() ? !0 : connector.payments.isSubscriptionsAvailable ? cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR && cleverapps.user.checkAvailable(Subscription.AVAILABLE) : !1 : !1
}
;
Subscription.AVAILABLE = {
level: 6
};
"merge" === cleverapps.config.type && (Subscription.AVAILABLE = {
level: 7.5
});
Subscription.REWARD_INTERVAL = "24 hours";
Subscription.RELOAD_INTERVAL = "30 minutes";
Subscription.BUY_RELOADS = ["1 minute", "3 minutes", "5 minutes", "10 minutes"];
cleverapps.config.debugMode && (Subscription.REWARD_INTERVAL = "20 minutes",
Subscription.RELOAD_INTERVAL = "1 minute",
Subscription.BUY_RELOADS = "5 seconds;10 seconds;15 seconds;20 seconds;30 seconds;40 seconds".split(";"));
var SubscriptionWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this.weekProduct = Product.CreateById("subsWeek");
this.monthProduct = Product.CreateById("subsMonth");
connector.platform.oneOf(connector.MICROSOFT) && cleverapps.config.debugMode && (this.weekProduct = Product.CreateById("subsWeekTest"),
this.monthProduct = Product.CreateById("subsMonthTest"));
this._super({
name: "SubscriptionWindow",
content: this.createContent(),
noBackground: !0,
title: "SubscriptionWindow.Title",
notCloseByTouchInShadow: !0,
closeButtonDelay: !0
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SUBSCRIPTION_WINDOW_OPEN);
Lottery.addText(this)
},
getPerson: function() {
return "merge" !== cleverapps.config.type && {
role: "hero",
emotion: "happy"
}
},
buySubscription: function(a) {
cleverapps.subscription.buy(a, this.createListener(function() {
this.close()
}
.bind(this)))
},
createContent: function() {
var a = cleverapps.styles.SubscriptionWindow
, b = this.prizesView = this.createRewardsList()
, c = [];
c.unshift(this.createFooter());
c.unshift(new SubscriptionButtons({
monthProduct: this.monthProduct,
weekProduct: this.weekProduct,
buySubscription: this.buySubscription.bind(this)
}));
c.unshift(new SubscriptionInfo);
c.unshift(b);
b = cleverapps.UI.generateOnlyText("SubscriptionRewardsList.subtitle", cleverapps.styles.FONTS.SUBSCRIPTION_PRIZE_SUBTITLE);
b.fitTo(a.subtitle.width, a.subtitle.height);
c.unshift(b);
return new cleverapps.Layout(c,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
},
createFooter: function() {
var a = new Terms
, b = cleverapps.styles.SubscriptionWindow;
a.width > .9 * b.width && a.setScale(.9 * b.width / a.width);
if (!cleverapps.subscription.isActive() && connector.platform.oneOf(connector.IOS, connector.MACOS)) {
var c = new Restore(this);
c.setScale(a.getScale())
}
return new cleverapps.Layout([a, c],{
direction: cleverapps.UI.VERTICAL
})
},
onShow: function() {
this._super();
this.prizesView.showUp && this.prizesView.showUp()
},
createRewardsList: function() {
var a = cleverapps.overrideStyles(cleverapps.styles.RewardWindow.rewards, cleverapps.styles.SubscriptionWindow.rewards, !0);
return new RewardsListComponent(Subscription.CalcReward(),{
font: cleverapps.styles.FONTS.REWARDWINDOW_VALUE_TEXT,
iconWrap: a.iconWrap,
margin: a.margin,
textMargin: a.textMargin,
event: cleverapps.EVENTS.EARN.PURCHASE
})
}
});
cleverapps.overrideStyles(cleverapps.styles.DECORATORS, {
SUBSCRIPTION_WINDOW_GOLD_OFFER_STROKE: {
color: new cc.Color(46,83,26,255),
size: 2
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
SUBSCRIPTION_PRIZE_SUBTITLE: {
size: 48,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.SubscriptionWindow = {
width: 600,
margin: 15,
padding: {
top: 20
},
rewards: {
margin: {
y: 20
},
textMargin: -10
},
subtitle: {
width: 600,
height: 70
}
};
var SubscriptionButtons = cleverapps.GridLayout.extend({
ctor: function(a) {
var b = cleverapps.styles.SubscriptionButtons
, c = connector.platform.oneOf(connector.IOS)
, d = c ? Messages.get("SubscriptionWindow.iosMonthButton", {
price: a.monthProduct.textPrice
}) : a.monthProduct.getCurrentPrice();
this.buttonPay = this.createBuyButton(a.monthProduct, a.buySubscription, cleverapps.styles.UI.Button.Images.button_blue, d);
Lottery.addIcon(this.buttonPay);
d = Messages.get(c ? "SubscriptionWindow.iosWeekButton" : "SubscriptionWindow.Free", {
price: a.weekProduct.textPrice
});
this.buttonTryFree = this.createBuyButton(a.weekProduct, a.buySubscription, cleverapps.styles.UI.Button.Images.button_green, d);
d = Messages.get(0 === a.weekProduct.trial.indexOf("3 day") ? "SubscriptionWindow.ThreeDaysAdditional" : "SubscriptionWindow.OneDayAdditional", {
newline: "\n"
});
c && (d = Messages.get("SubscriptionWindow.iOSThreeDaysAdditional", {
price: a.weekProduct.textPrice
}));
d = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.SUBSCRIPTION_BUTTON_TITLE);
d.setDimensions(b.buttonWidth, 0);
d.fitTo(void 0, b.titleHeight);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a = cleverapps.UI.generateOnlyText("SubscriptionWindow.MonthlyAdditional", cleverapps.styles.FONTS.SUBSCRIPTION_BUTTON_TITLE);
a.setDimensions(b.buttonWidth, 0);
a.fitTo(void 0, b.titleHeight);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
cleverapps.paymentsLogic.onChangeStatus(this.updateButtons.bind(this), this);
this.updateButtons();
this._super([d, a, this.buttonTryFree, this.buttonPay], {
columns: 2,
align: {
y: cleverapps.GridLayout.ALIGN_START
},
margin: b.margin
})
},
updateButtons: function() {
connector.payments.isConnected() ? (this.buttonPay.enable(),
this.buttonTryFree.enable()) : (this.buttonPay.disable(),
this.buttonTryFree.disable())
},
createBuyButton: function(a, b, c, d) {
var e = cleverapps.styles.SubscriptionButtons;
return new cleverapps.UI.Button({
text: d || a.getCurrentPrice(),
type: c,
width: e.buttonWidth,
height: e.buttonHeight,
onClicked: function() {
b(a)
}
})
}
});
cleverapps.styles.SubscriptionButtons = {
contentObjectsMargin: 7,
buttonWidth: 270,
buttonHeight: 100,
titleHeight: 70,
margin: {
x: 40,
y: 7
}
};
var SubscriptionInfo = cleverapps.Layout.extend({
ctor: function() {
var a = cleverapps.styles.SubscriptionInfo
, b = cleverapps.UI.generateOnlyText("SubscriptionWindow.MainText", cleverapps.styles.FONTS.SUBSCRIPTION_MAIN_TEXT);
b.setDimensions(cleverapps.styles.SubscriptionWindow.width, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
if (cleverapps.clans && Clans.IsAvailable()) {
var c = new cc.Sprite(bundles.reward_icons.frames.clan_gift_png);
c = new TextWithIcon("** ClanGift.Text",{
font: cleverapps.styles.FONTS.SUBSCRIPTION_MAIN_TEXT,
icons: {
"**": c
},
iconMaxHeight: 2
})
}
this._super([b, c].filter(Boolean), {
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
}
});
cleverapps.styles.SubscriptionInfo = {
margin: 15,
padding: {
x: 0,
y: 10
}
};
var ExpeditionMissionLogic = function(a, b) {
this.mission = a;
this.expedition = Missions[a.type].id;
this.location = Missions[a.type].location;
this.slot = Missions[a.type].slot;
b && (this.clearSavedGames(),
this.clearUnitsLibrary(),
cleverapps.travelBook.onNewExpeditionMission(a.type),
cleverapps.offerManager.clearForceByMission(a.type),
Landmarks.clearForce(this.expedition),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EXPEDITIONS.PLAY + this.expedition))
};
ExpeditionMissionLogic.prototype.stop = function(a) {
a || (cleverapps.travelBookHint.checkMission(this.mission),
cleverapps.travelBook.updatePages())
}
;
ExpeditionMissionLogic.prototype.clearSavedGames = function() {
cleverapps.GameSaver.saveInfo(this.slot, {})
}
;
ExpeditionMissionLogic.prototype.clearUnitsLibrary = function() {
var a = {};
cleverapps.travelBook.listAvailablePages().forEach(function(d) {
if (d.id !== this.expedition) {
var e = cleverapps.missionManager.findRunningMission(d.missionType);
if (d.isMain() || d.isPermanent() || e)
d = new Level(d.location,0),
Object.assign(a, d.families)
}
}
.bind(this));
var b = new Level(this.location,0)
, c = Object.keys(b.families).filter(function(d) {
return !a[d]
});
UnitsLibrary.getInstance(b.meta.expedition).resetFamilies(c)
}
;
ExpeditionMissionLogic.prototype.resetPush = function() {
this.mission.getTimeLeft() >= ExpeditionMissionLogic.ATTENTION_TIMEOUT && cleverapps.localPushes.sendPush(cleverapps.LocalPushes.TYPES.EXPEDITION, ExpeditionMissionLogic.ATTENTION_TIMEOUT)
}
;
ExpeditionMissionLogic.prototype.sendPeriodicPush = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.EXPEDITION_PUSH_PLANNING_TIME) || 0;
Date.now() > a + ExpeditionMissionLogic.PERIODIC_PUSH_TIMEOUT && this.mission.getTimeLeft() >= ExpeditionMissionLogic.PERIODIC_PUSH_TIMEOUT && (cleverapps.localPushes.sendPush(cleverapps.LocalPushes.TYPES.EXPEDITION_PERIODIC, ExpeditionMissionLogic.PERIODIC_PUSH_TIMEOUT),
cleverapps.dataLoader.save(DataLoader.TYPES.EXPEDITION_PUSH_PLANNING_TIME, Date.now()))
}
;
ExpeditionMissionLogic.prototype.getPrize = function() {
var a = cleverapps.travelBook.getPageById(this.expedition);
a = FogSaver.Load(a.slot, FogsConfig[a.id] || FogsConfig[0]);
a = Array.isArray(a) ? cleverapps.createSet(a) : {};
var b, c;
for (c in ExpeditionMissionLogic.REWARDS)
a[c] && (b = ExpeditionMissionLogic.REWARDS[c]);
return b
}
;
ExpeditionMissionLogic.prototype.blowUp = function(a) {
var b = function(c) {
var d = [];
this.mission.getChildMissions().forEach(function(e) {
d.push(e.displayCompleted.bind(e))
});
cleverapps.focusManager.compound(c, d)
}
.bind(this);
cleverapps.focusManager.compound(a, [function(c) {
var d = [{
text: Messages.get("ExpeditionFinishWindow.text"),
person: {
role: "king",
emotion: "happy"
}
}]
, e = new Dialogue(d,{
showUp: !0
});
d = function() {
!e.typing && e.stage >= e.data.length - 1 && e.close()
}
;
e.on("buttonClicked", d);
e.on("screenClicked", d);
e.on("afterClose", c);
new DialogueView(e)
}
, function(c) {
Game.currentGame.collectAndRemoveAllUnits(c)
}
, b, function(c) {
cleverapps.travelBook.isExpedition() ? cleverapps.travelBook.gotoMainScene(c) : c()
}
])
}
;
ExpeditionMissionLogic.prototype.canRemoveSilently = function() {
return Date.now() - this.mission.finishTime() > ExpeditionMissionLogic.AUTO_REMOVE_TIMEOUT ? !0 : (cleverapps.GameSaver.load(this.slot) || {}).expedition !== this.expedition
}
;
ExpeditionMissionLogic.prototype.beforeRemove = function() {
cleverapps.eventBus.trigger("taskEvent", DailyTasks.FINISH_EXPEDITION)
}
;
ExpeditionMissionLogic.prototype.canShowCompleted = function() {
return cleverapps.environment.hasEpisode(this.location)
}
;
ExpeditionMissionLogic.ATTENTION_TIMEOUT = cleverapps.parseInterval("2 days");
ExpeditionMissionLogic.PERIODIC_PUSH_TIMEOUT = cleverapps.parseInterval("3 days");
ExpeditionMissionLogic.AUTO_REMOVE_TIMEOUT = cleverapps.parseInterval("14 days");
cleverapps.config.debugMode && (ExpeditionMissionLogic.ATTENTION_TIMEOUT = cleverapps.parseInterval("10 minutes"));
ExpeditionMissionLogic.REWARDS = {
fog1: {
soft: 10
},
fog6: {
soft: 10,
lives: 10
},
fog16: {
soft: 20,
lives: 20
},
fog26: {
soft: 30,
lives: 30
},
fog36: {
soft: 50,
lives: 50
}
};
var FeastExpeditionLogic = function(a) {
this.mission = a;
if (a.isRunning())
cleverapps.eventBus.on("mapEvent", this.onMapEvent.bind(this), this)
};
FeastExpeditionLogic.prototype.stop = function() {
runCleaners(this)
}
;
FeastExpeditionLogic.prototype.onMapEvent = function(a, b) {
if (MissionManager.hasProperParent(this.mission)) {
var c = 0;
if (Mission.GetChildType(this.mission.type) === Mission.TYPE_SNAIL_FEAST) {
if (a === Map2d.SPAWN && -1 !== ["drsnail", "seasnail"].indexOf(b.unit.code)) {
c = this.getSnailPoints(b.unit.stage);
var d = b.affected && Unit.IsApplicable({
type: "snailhouse"
}, b.affected) ? b.affected : b.unit
}
} else {
switch (a) {
case Map2d.RUDOLF_COMPLETED:
c = b.points;
d = b.unit;
break;
case Map2d.COMPLETE_MINING:
d = b.unit;
var e = b.task.time;
break;
case Map2d.BUILD:
d = b.affected;
e = b.time;
break;
case Map2d.SPAWN:
if (Array.isArray(b.affected) && b.unit.isBuilt()) {
d = b.unit;
var f = void 0 !== b.unit.getData().createPrize ? 500 : 0;
a = b.unit.stage - 1;
6 <= a ? c = cleverapps.Random.random(10, 13) : 5 === a ? c = cleverapps.Random.random(8, 11) : 4 === a ? c = cleverapps.Random.random(6, 9) : 3 === a ? c = cleverapps.Random.random(4, 7) : 2 === a ? c = cleverapps.Random.random(2, 5) : 1 === a ? c = cleverapps.Random.random(1, 3) : 0 === a && (c = 1)
}
}
e && (c = e >= cleverapps.parseInterval("60 minutes") ? 3 : e >= cleverapps.parseInterval("10 minutes") ? 2 : 1)
}
0 < c && d && this.collectFromUnit(c, d, f)
}
}
;
FeastExpeditionLogic.prototype.getSnailPoints = function(a) {
this.snailPoints || (this.snailPoints = {});
if (this.snailPoints[a])
return this.snailPoints[a];
if (0 === a)
var b = 0;
else
1 === a ? b = 1 : 2 === a ? b = 3 : (b = Math.round(2.5 * this.getSnailPoints(a - 1)),
b = 2.5 < b % 5 ? b - b % 5 + 5 : b - b % 5);
return this.snailPoints[a] = b
}
;
FeastExpeditionLogic.prototype.collectFromUnit = function(a, b, c) {
Game.currentGame.addReward("mission", {
missionType: this.mission.type,
amount: a
}, b, {
delay: c || 0
})
}
;
FeastExpeditionLogic.prototype.beforeRemove = function() {
if (Mission.GetChildType(this.mission.type) === Mission.TYPE_SNAIL_FEAST && !cleverapps.gameModes.multipleHeroes) {
var a = "drsnail"
, b = "drresource";
-1 !== [Mission.TYPE_UNDERSEA2_EXPEDITION, Mission.TYPE_UNDERSEA3_EXPEDITION].indexOf(Mission.GetParentType(this.mission.type)) && (a = "seasnail",
b = "searesource");
Game.currentGame.replaceUnit({
code: a
}, function(c) {
var d = cleverapps.unitsLibrary.listAvailableByType(b);
d = cleverapps.Random.choose(d);
return {
code: d,
stage: Math.min(3, c.stage, Families[d].units.length - 1)
}
})
}
}
;
var GrowthFund = function() {
cleverapps.EventEmitter.call(this);
this.received = -1;
this.levels = [];
this.load();
this.createLevels();
cleverapps.user.on("incLevel", this.onUserIncLvl.bind(this));
cleverapps.exp.on("changeExp", this.onUserChangeExp.bind(this));
this.isBought() && cleverapps.playSession.set(cleverapps.EVENTS.FUND_DAU, !0)
};
GrowthFund.prototype = Object.create(cleverapps.EventEmitter.prototype);
GrowthFund.prototype.constructor = GrowthFund;
GrowthFund.prototype.isBought = function() {
return -1 < this.received
}
;
GrowthFund.prototype.onUserChangeExp = function() {
if (cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR) {
var a = this.isActive();
this.wantsAttention = this.wantsAttention || a && !this.wasActive;
this.wasActive = a
}
}
;
GrowthFund.prototype.onUserIncLvl = function() {
cleverapps.gameLevel && cleverapps.gameLevel.withOwnLevel || (this.calcLevelsState(),
cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR && this.isActive() && this.findByLevelNo(cleverapps.user.getVirtualLevel() - 1) && (this.wantsAttention = !0))
}
;
GrowthFund.prototype.getProduct = function() {
return Product.CreateById("growthFund")
}
;
GrowthFund.prototype.buy = function() {
this.getProduct().buy(this.processBought.bind(this))
}
;
GrowthFund.prototype.processBought = function(a) {
a && (this.buyTime = Date.now(),
this.received = 0,
this.save(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.FUND_BUY),
this.trigger("updateState"),
this.trigger("bought"))
}
;
GrowthFund.prototype.createLevels = function() {
for (var a = GrowthFund.LEVELS.start; a <= GrowthFund.LEVELS.finish; a += GrowthFund.LEVELS.step)
this.levels.push({
levelNo: a,
reward: GrowthFund.LEVELS.rewards[a] || GrowthFund.LEVELS.rewards.default
});
this.calcLevelsState()
}
;
GrowthFund.prototype.calcLevelsState = function() {
this.levels.forEach(function(a) {
a.levelNo > cleverapps.user.getVirtualLevel() - 1 ? a.state = GrowthFund.STATE.INSUFFICIENT : a.state = a.levelNo <= this.received ? GrowthFund.STATE.RECEIVED : 0 < this.received ? a.levelNo === this.received + GrowthFund.LEVELS.step ? GrowthFund.STATE.READY : GrowthFund.STATE.WAITING : a.levelNo === GrowthFund.LEVELS.start ? GrowthFund.STATE.READY : GrowthFund.STATE.WAITING
}, this)
}
;
GrowthFund.prototype.takeReward = function(a) {
(!this.buyTime || Date.now() - this.buyTime > cleverapps.parseInterval("10 minutes")) && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.FUND_GOLD, {
amount: this.findByLevelNo(a).reward
});
this.received = a;
this.calcLevelsState();
this.trigger("updateState");
this.save()
}
;
GrowthFund.prototype.findByLevelNo = function(a) {
for (var b in this.levels)
if (this.levels[b].levelNo === a)
return this.levels[b]
}
;
GrowthFund.prototype.findFirst = function(a) {
for (var b in this.levels)
if (this.levels[b].state === a)
return this.levels[b]
}
;
GrowthFund.prototype.isRewardReady = function() {
return this.findFirst(GrowthFund.STATE.READY)
}
;
GrowthFund.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.GROWTHFUND, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("growthfund")
}
;
GrowthFund.prototype.getInfo = function() {
return this.received
}
;
GrowthFund.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.GROWTHFUND);
this.setInfo(void 0 === a ? -1 : a)
}
;
GrowthFund.prototype.setInfo = function(a) {
this.received = a;
"object" === typeof a && (this.received = -1,
a.bought || void 0 !== a.lastReceived) && (this.received = a.lastReceived || 0);
this.wasActive = this.isActive()
}
;
GrowthFund.prototype.updateInfo = function(a) {
this.setInfo(a);
this.save(!0);
this.calcLevelsState()
}
;
GrowthFund.prototype.isActive = function() {
return this.isAvailable() || this.isBought()
}
;
GrowthFund.prototype.isAvailable = function() {
return cleverapps.user.getFloatLevel() >= GrowthFund.LEVELS.available
}
;
GrowthFund.prototype.getTotalWaitingRewards = function() {
var a = 0;
this.levels.forEach(function(b) {
-1 !== [GrowthFund.STATE.READY, GrowthFund.STATE.WAITING].indexOf(b.state) && (a += b.reward)
});
return a
}
;
GrowthFund.prototype.needsAttention = function() {
return this.isBought() && this.isRewardReady() || this.wantsAttention
}
;
GrowthFund.RestoreExpeditionId = function() {
return "main"
}
;
GrowthFund.RestoreActions = function(a, b) {
if (cleverapps.growthFund && !cleverapps.growthFund.isBought())
return [function(c) {
new GrowthFundWindow;
cleverapps.timeouts.setTimeout(c, 1E3)
}
, function(c) {
b();
cleverapps.growthFund.processBought(!0);
cleverapps.focusManager.onceNoWindowsListener = c
}
]
}
;
GrowthFund.STATE = {
INSUFFICIENT: 0,
WAITING: 1,
READY: 2,
RECEIVED: 3
};
GrowthFund.LEVELS = {
available: 6.1,
start: 1,
finish: 49,
step: 1,
rewards: {
default: 450,
1: 550
}
};
Product.RESTORE_LOGIC.growthFund = GrowthFund;
var Products = {
buyExp10: {
boughtMessage: "Shop.BuyExp10.BoughtMessage",
reward: {
exp: 10
}
},
buyExp150: {
boughtMessage: "Shop.BuyExp150.BoughtMessage",
reward: {
exp: 150
}
},
coins350: {
reward: {
soft: 350
},
icon: "shop_coins_very_small_png",
boughtMessage: "Product.SoftCurrencyBought"
},
coins1100: {
reward: {
soft: 1100
},
icon: "shop_coins_small_png",
boughtMessage: "Product.SoftCurrencyBought"
},
coins3000: {
reward: {
soft: 3E3
},
icon: "shop_coins_medium_png",
boughtMessage: "Product.SoftCurrencyBought"
},
coins7000: {
reward: {
soft: 7E3
},
icon: "shop_coins_large_png",
boughtMessage: "Product.SoftCurrencyBought"
},
expeditionPack: {
boughtMessage: "Shop.expeditionPack.boughtMessage",
restoreReward: {
hard: 1200
}
},
growthFund: {
boughtMessage: "Shop.growthFund.boughtMessage",
value: "800%",
icon: "growth_fund_icon",
mainSceneOnly: !0,
clanGift: !0,
restoreReward: {
hard: 2800
},
TileModelClass: "undefined" !== typeof GrowthFundTileModel && GrowthFundTileModel,
ViewClassName: "undefined" !== typeof GrowthFundTile && GrowthFundTile
},
unlimitedLives: {
boughtMessage: "UnlimitedLivesBought",
reward: {
unlimitedLives: "3 days"
},
icon: "unlimitedLives_png",
animation: "animation",
getViewClassName: function() {
if ("undefined" !== typeof LivesProductTile)
return LivesProductTile
},
getTileModelClass: function() {
if ("undefined" !== typeof BuyLivesTileModel)
return BuyLivesTileModel
}
},
cheapProduct: {
reward: {
hard: 1
},
rewardsIcon: "shop_gold_png",
icon: "shop_gold_very_small_png"
},
gold500: {
reward: {
hard: 500
},
rewardsIcon: "shop_gold_png",
icon: "shop_gold_very_small_png"
},
gold1800: {
oldPrice: 1.99,
label: 1800,
reward: {
hard: 1800
},
rewardsIcon: "shop_gold_png",
icon: "shop_gold_small_png"
},
gold3800: {
reward: {
hard: 3800
},
rewardsIcon: "shop_gold_png",
icon: "shop_gold_medium_png"
},
gold6000: {
clanGift: !0,
oldPrice: 5.99,
label: 6E3,
reward: {
hard: 6E3
},
rewardsIcon: "shop_gold_png",
icon: "shop_gold_large_png"
},
gold25000: {
clanGift: !0,
reward: {
hard: 25E3
},
rewardsIcon: "shop_gold_png",
icon: "shop_gold_huge_png"
},
starterPack0: {
boughtMessage: "StarterPack.Bought",
boughtMessageParams: {
title: "StarterPack0.Title"
},
reward: RewardsConfig.Packs[0],
stage: 0,
mainSceneOnly: !0
},
starterPack: {
boughtMessage: "StarterPack.Bought",
boughtMessageParams: {
title: "StarterPack1.Title"
},
reward: RewardsConfig.Packs[1],
stage: 1,
mainSceneOnly: !0
},
starterPack2: {
boughtMessage: "StarterPack.Bought",
boughtMessageParams: {
title: "StarterPack2.Title"
},
reward: RewardsConfig.Packs[2],
stage: 2,
mainSceneOnly: !0
},
piggybank500: {},
piggybank1800: {},
piggybank6000: {},
piggybank25000: {},
subsWeek: {
boughtMessage: "Shop.SubsWeek.BoughtMessage",
icon: "prem_tile_icon",
clanGift: !0
},
subsMonth: {
boughtMessage: "Shop.SubsMonth.BoughtMessage",
icon: "prem_tile_icon",
clanGift: !0,
TileModelClass: "undefined" !== typeof SubscriptionTileModel && SubscriptionTileModel,
ViewClassName: "undefined" !== typeof SubscriptionTile && SubscriptionTile
},
subsWeekTest: {
boughtMessage: "Shop.SubsWeek.BoughtMessage",
icon: "prem_tile_icon"
},
subsMonthTest: {
boughtMessage: "Shop.SubsMonth.BoughtMessage",
icon: "prem_tile_icon"
},
sweetPack: {
boughtMessage: "Shop.sweetPack.boughtMessage",
reward: {
hard: 500,
boosters: {
0: 1,
1: 1
}
},
icon: "pack500_png",
ViewClassName: "undefined" !== typeof PackProductTile && PackProductTile
},
jamPack: {
boughtMessage: "Shop.jamPack.boughtMessage",
reward: {
hard: 1800,
boosters: {
0: 1,
1: 1,
2: 1
}
},
icon: "pack1800_png",
ViewClassName: "undefined" !== typeof PackProductTile && PackProductTile
},
tastyPack: {
boughtMessage: "Shop.tastyPack.boughtMessage",
reward: {
hard: 3800,
boosters: {
0: 3,
1: 3,
2: 3
}
},
icon: "pack3800_png",
ViewClassName: "undefined" !== typeof PackProductTile && PackProductTile
},
honeyPack: {
boughtMessage: "Shop.honeyPack.boughtMessage",
reward: {
hard: 6E3,
boosters: {
0: 5,
1: 5,
2: 5
}
},
icon: "pack6000_png",
ViewClassName: "undefined" !== typeof PackProductTile && PackProductTile
},
epicPack: {
boughtMessage: "Shop.epicPack.boughtMessage",
reward: {
hard: 25E3,
boosters: {
0: 20,
1: 20,
2: 20
}
},
icon: "pack25000_png",
ViewClassName: "undefined" !== typeof PackProductTile && PackProductTile
},
noAds: {
boughtMessage: "NoAds.Bought",
reward: {
hard: 150,
noAds: 1
}
},
kit1: {
boughtMessage: "Kit1.Bought",
restoreReward: {
hard: 100
}
},
kit3: {
boughtMessage: "Kit3.Bought",
restoreReward: {
hard: 300
}
},
kit10: {
boughtMessage: "Kit10.Bought",
restoreReward: {
hard: 1E3
},
oldPrice: 35.99
},
kit50: {
boughtMessage: "Kit50.Bought",
restoreReward: {
hard: 5E3
}
},
island1: {
boughtMessage: "Island1.Bought",
restoreReward: {
hard: 100
}
},
island2: {
boughtMessage: "Island2.Bought",
restoreReward: {
hard: 200
}
},
island5: {
boughtMessage: "Island5.Bought",
restoreReward: {
hard: 500
}
},
island10: {
boughtMessage: "Island10.Bought",
restoreReward: {
hard: 1E3
}
},
island15: {
boughtMessage: "Island15.Bought",
restoreReward: {
hard: 1500
}
},
island20: {
boughtMessage: "Island20.Bought",
restoreReward: {
hard: 2E3
}
},
island30: {
boughtMessage: "Island30.Bought",
restoreReward: {
hard: 3E3
}
},
island45: {
boughtMessage: "Island45.Bought",
restoreReward: {
hard: 4500
}
}
};
["merge", "tile3", "blocks"].includes(cleverapps.config.type) && (Products.gold500.reward = {
hard: 200
},
Products.gold1800.reward = {
hard: 900
},
Products.gold3800.reward = {
hard: 2100
},
Products.gold6000.reward = {
hard: 3500
},
Products.gold25000.reward = {
hard: 14E3
});
"solitaire" === cleverapps.config.type && "spades" !== cleverapps.config.name && (Products.sweetPack.reward.boosters = {
10: 2,
11: 2,
12: 2
},
Products.jamPack.reward.boosters = {
10: 3,
11: 3,
12: 3
},
Products.tastyPack.reward.boosters = {
10: 5,
11: 5,
12: 5
},
Products.honeyPack.reward.boosters = {
10: 7,
11: 7,
12: 7
},
Products.epicPack.reward.boosters = {
10: 30,
11: 30,
12: 30
});
"match3" === cleverapps.config.type && (Products.sweetPack.reward.boosters = {
5: 1,
6: 1,
7: 1
},
Products.jamPack.reward.boosters = {
5: 2,
6: 2,
7: 2
},
Products.tastyPack.reward.boosters = {
0: 3,
1: 3,
5: 3,
6: 3,
7: 3
},
Products.honeyPack.reward.boosters = {
0: 5,
1: 5,
5: 5,
6: 5,
7: 5
},
Products.epicPack.reward.boosters = {
0: 18,
1: 18,
5: 18,
6: 18,
7: 18
},
Products.noAds.reward.hard = 350);
"scramble" === cleverapps.config.name && (Products.sweetPack.reward.boosters = {
13: 2,
14: 2,
15: 2
},
Products.jamPack.reward.boosters = {
13: 3,
14: 3,
15: 3
},
Products.tastyPack.reward.boosters = {
13: 5,
14: 5,
15: 5
},
Products.honeyPack.reward.boosters = {
13: 7,
14: 7,
15: 7
},
Products.epicPack.reward.boosters = {
13: 30,
14: 30,
15: 30
});
"match3" === cleverapps.config.type && (Products.kit3.restoreReward = {
hard: 900
},
Products.kit10.restoreReward = {
hard: 3E3
},
Products.kit50.restoreReward = {
hard: 11E3
});
var RestoreProgress = function() {
this.onUpdate = function() {}
;
this.onRemove = function() {}
;
this.opened = !1;
this.update()
};
RestoreProgress.prototype.isAvailable = function() {
return cleverapps.config.adminMode || cleverapps.config.editorMode || cleverapps.config.wysiwygMode || !connector.social.isConnected() || cleverapps.flags.nologin || connector.social.isLoggedIn() ? !1 : "merge" === cleverapps.config.type ? 2 > cleverapps.user.level : .5 > cleverapps.user.getFloatLevel()
}
;
RestoreProgress.prototype.isOpened = function() {
return this.opened
}
;
RestoreProgress.prototype.isVisible = function() {
return (cleverapps.environment.isMainScene() || cleverapps.environment.isGameScene() || cleverapps.environment.isComicsScene()) && !this.isOpened()
}
;
RestoreProgress.prototype.update = function() {
if (this.isAvailable())
this.onUpdate();
else
this.onRemove()
}
;
RestoreProgress.prototype.restore = function() {
if (!(cleverapps.windows.currentWindow()instanceof SignInWindow)) {
var a = [function(b) {
this.opened = !0;
this.update();
new SignInWindow({
restoreProgress: !0,
onClose: b
})
}
.bind(this), function(b) {
this.opened = !1;
this.update();
b()
}
.bind(this)];
cleverapps.focusManager.isFocused() ? cleverapps.focusManager.distract({
focus: "RestoreProgress",
restore: !0,
keepControls: !0,
actions: a
}) : cleverapps.focusManager.display({
focus: "RestoreProgress",
actions: a
})
}
}
;
var RestoreProgressButton = cleverapps.UI.Button.extend({
alwaysOn: !0,
ctor: function() {
var a = cleverapps.styles.RestoreProgressButton
, b = a.size ? a.size[cleverapps.resolution.mode] : a
, c = this.content = cleverapps.UI.generateOnlyText("RestoreProgress", cleverapps.styles.FONTS.BUTTON_TEXT);
c.setDimensions(b.width, 0);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.fitTo(void 0, b.height);
this._super({
width: b.width,
height: b.height,
content: c,
type: cleverapps.styles.UI.Button.Images.button_blue,
onClicked: function() {
cleverapps.restoreProgress.restore()
}
});
this.content.setPositionRound(a.content);
this.setCascadeOpacityEnabledRecursively(!0);
this.setLocalZOrder(BaseWindow.WINDOWS_ZORDER + 9);
this._setGlobalZOrder(!0);
cleverapps.restoreProgress.onUpdate = this.createListener(this.updateDynamicPosition.bind(this));
cleverapps.restoreProgress.onRemove = this.createListener(this.onRemove.bind(this));
this.updateSize();
this.hide(!0)
},
updateSize: function() {
if (cleverapps.styles.RestoreProgressButton.size) {
var a = cleverapps.styles.RestoreProgressButton
, b = a.size[cleverapps.resolution.mode];
this.resize(b.width, b.height);
this.content.setFontSize(cleverapps.styles.FONTS.BUTTON_TEXT.size);
this.content.setDimensions(b.width, 0);
this.content.fitTo(void 0, b.height);
this.content.setPositionRound(a.content)
}
},
onRemove: function() {
this.removing || (this.removing = !0,
this.updateDynamicPosition = function() {}
,
this.stopAllActions(),
this.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.RemoveSelf)))
},
updateDynamicPosition: function(a) {
if (cleverapps.restoreProgress.isVisible()) {
var b = cleverapps.scenes.getRunningScene().getAvoidNodes(RestoreProgressButton.OverlappingNodes).filter(function(e) {
return !1 !== e.isShown
});
this.showOverlappingNodes(b);
var c = cleverapps.styles.RestoreProgressButton
, d = c.position;
this.preferredPosition && (d = [this.preferredPosition].concat(d));
this.preferredPosition = (b = cleverapps.UI.findPosition(this, {
preferredPositions: d,
avoidNodes: b,
offset: c.offset
})) && b.preferred || this.preferredPosition;
b ? this.isShown ? this.move(b, a) : (this.move(b, !0),
this.show(a)) : this.hide(a)
} else
this.hide(a)
},
move: function(a, b) {
cc.pointEqualToPoint(a, this.movePosition, cleverapps.styles.RestoreProgressButton.eps) || (this.stopAllActions(),
this.movePosition = a,
b ? this.setPosition(a.x, a.y) : this.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.MoveTo(0,a.x,a.y),new cc.FadeIn(.3))).setFinalize(function() {
this.setOpacity(255);
this.setPosition(a.x, a.y)
}
.bind(this)))
},
show: function(a) {
!0 !== this.isShown && (this.isShown = !0,
this.stopAllActions(),
this.setVisible(!0),
a ? this.setOpacity(255) : this.runAction(new cc.FadeIn(.3)).setFinalize(function() {
this.setOpacity(255)
}
.bind(this)))
},
hide: function(a) {
!1 !== this.isShown && (this.isShown = !1,
this.stopAllActions(),
a ? (this.setVisible(!1),
this.setOpacity(0)) : this.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.FadeOut(.3))).setFinalize(function() {
this.setOpacity(0);
this.setVisible(!1)
}
.bind(this)))
},
showOverlappingNodes: function(a) {
cleverapps.gameModes.showAvoidRects && cleverapps.scenes.getRunningScene().drawRects(a.map(function(b) {
var c = b.getBoundingBoxToWorld();
c.name = b.avoidNode;
return c
}))
}
});
RestoreProgressButton.OverlappingNodes = "Window FieldView MenuBarItemView MinimalDialogue Panel PlayButtonView BandButton DialogueView ButtonBooster".split(" ");
cleverapps.styles.RestoreProgressButton = {
width: 300,
height: 110,
eps: 20,
offset: {
x: 20,
y: 20
},
position: [{
x: {
align: "left",
dx: 20
},
y: {
align: "bottom",
dy: 20
}
}, {
x: {
align: "right",
dx: -20
},
y: {
align: "bottom",
dy: 20
}
}, {
x: {
align: "right",
dx: -20
},
y: {
align: "top",
dy: -160
}
}],
content: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
};
var GrowthFundWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this.product = cleverapps.growthFund.getProduct();
this._super({
name: "GrowthFundWindow",
title: "GrowthFundWindow.title",
content: this.createContent(),
styles: cleverapps.styles.GrowthFundWindow.window,
foreground: bundles.windows.frames.window_foreground_png
});
cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem");
cleverapps.growthFund.on("updateState", this.updateState.bind(this), this);
cleverapps.growthFund.on("bought", this.removeBuyButton.bind(this), this);
cleverapps.growthFund.wantsAttention = !1;
Lottery.addText(this);
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this)
},
updateButton: function() {
this.buyButton && (connector.payments.isConnected() ? this.buyButton.enable() : this.buyButton.disable())
},
getPerson: function() {
return cleverapps.persons.choose("seller")
},
onShow: function() {
this._super();
cleverapps.growthFund.isBought() && this.removeBuyButton()
},
createContent: function() {
var a = cleverapps.styles.GrowthFundWindow;
return new cleverapps.Layout([this.createTop(), this.createTiles()],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
},
createTop: function() {
var a = cleverapps.styles.GrowthFundWindow.top
, b = this.top = cleverapps.UI.createScale9Sprite(bundles.growth_fund.frames.top_bg, cleverapps.UI.Scale9Rect.TwoPixelXY);
b.setContentSize2(a);
b.setLocalZOrder(1);
var c = new cleverapps.Spine(bundles.growth_fund.jsons.main_win_safe);
c.setAnimationAndIdleAfter("open", "idle");
b.addChild(c);
c.setPositionRound(a.icon);
c = cleverapps.UI.generateOnlyText("GrowthFundWindow.cta1", cleverapps.styles.FONTS.GROWTH_FUND_CTA1);
var d = cleverapps.UI.generateOnlyText("GrowthFundWindow.cta2", cleverapps.styles.FONTS.GROWTH_FUND_CTA2);
d.fitTo(a.text.width);
c.setAnchorPoint(a.text.anchor);
d.setAnchorPoint(a.text.anchor);
c = new cleverapps.Layout([c, d],{
direction: cleverapps.UI.VERTICAL,
margin: a.text.margin
});
b.addChild(c);
c.setPositionRound(a.text);
this.createBuyButton();
return b
},
createBuyButton: function() {
if (cleverapps.growthFund.isBought())
this.removeBuyButton();
else {
var a = cleverapps.styles.GrowthFundWindow.top.button;
this.buyButton = new cleverapps.UI.Button({
width: a.width,
height: a.height,
type: ["tropical", "riddles"].includes(cleverapps.config.ui) ? cleverapps.styles.UI.Button.Images.button_blue : cleverapps.styles.UI.Button.Images.button_purple,
text: this.product.getCurrentPrice(),
onClicked: function() {
cleverapps.growthFund.buy()
}
});
Lottery.addIcon(this.buyButton);
this.updateButton();
cleverapps.fallSale.isAvailable() && this.buyButton.addChild(new FallSaleIcon);
this.top.addChild(this.buyButton);
this.buyButton.setPositionRound(a)
}
},
removeBuyButton: function() {
this.buyButton && (this.buyButton.removeFromParent(),
delete this.buyButton);
this.mark || (this.mark = new cc.Sprite(bundles.growth_fund.frames.bought_checkmark || bundles.growth_fund.frames.checkmark),
this.top.addChild(this.mark),
this.mark.setPositionRound(cleverapps.styles.GrowthFundWindow.top.mark))
},
createTiles: function() {
var a = cleverapps.styles.GrowthFundWindow.scroll;
this.levelTiles = cleverapps.growthFund.levels.map(function(d) {
return new GrowthFundLevelView(d)
}, this);
var b = new cleverapps.Layout(this.levelTiles,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
});
b = this.scroll = new cleverapps.UI.ScrollView(b,{
direction: cleverapps.UI.ScrollView.DIR_VERTICAL
});
b.setContentSize2(a);
this.animateScrollToRelevant();
if (a.top) {
var c = cleverapps.UI.createScale9Sprite(bundles.growth_fund.frames.scroll_top);
c.setContentSize2(a.top);
b.addChild(c);
c.setPositionRound(a.top)
}
return b
},
animateScrollToRelevant: function() {
for (var a = this.levelTiles.length - 1; 0 <= a && this.levelTiles[a].state === GrowthFund.STATE.INSUFFICIENT; a--)
;
var b = Math.min(2, Math.max(.5, 2 * a / this.levelTiles.length));
this.scroll.scrollTo(this.levelTiles[a]);
this.scroll.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.CallFunc(function() {
var c = cleverapps.growthFund.findFirst(GrowthFund.STATE.READY) || cleverapps.growthFund.findFirst(GrowthFund.STATE.INSUFFICIENT);
c && (c = cleverapps.growthFund.levels.indexOf(c),
this.scroll.scrollTo(this.levelTiles[c], b, {
easing: cc.easeInOut(2)
}))
}
.bind(this))))
},
updateState: function() {
this.levelTiles.forEach(function(a) {
a.updateState()
})
},
listBundles: function() {
return ["growth_fund"]
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
GROWTH_FUND_CTA1: {
size: 52,
color: cleverapps.styles.COLORS.WHITE
},
GROWTH_FUND_CTA2: {
size: 35,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.styles.GrowthFundWindow = {
margin: 10,
window: {
padding: {
left: 45,
right: 45,
top: 90,
bottom: 30
}
},
top: {
width: 980,
height: 250,
text: {
width: 590,
margin: -15,
anchor: {
x: 0,
y: .5
},
x: {
align: "left",
dx: 290
},
y: {
align: "top",
dy: -5
}
},
icon: {
x: {
align: "left",
dx: 15
},
y: {
align: "center",
dy: -30
}
},
button: {
width: 230,
height: 90,
x: {
align: "right",
dx: -80
},
y: {
align: "bottom",
dy: 25
}
},
mark: {
x: {
align: "right",
dx: -150
},
y: {
align: "bottom",
dy: 45
}
}
},
scroll: {
margin: 5,
width: 990,
height: 710,
top: {
width: 1078,
height: 45,
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 25
}
}
}
};
var GrowthFundBuyWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this._super({
name: "GrowthFundBuyWindow",
title: "GrowthFundBuyWindow.title",
content: this.createContent()
});
this.createBadge();
Lottery.addText(this);
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this);
cleverapps.growthFund.on("bought", this.close.bind(this), this)
},
updateButton: function() {
connector.payments.isConnected() ? this.button.enable() : this.button.disable()
},
getPerson: function() {
return cleverapps.persons.choose("seller")
},
createContent: function() {
var a = cleverapps.styles.GrowthFundBuyWindow;
this.button = this.createBuyButton();
var b = this.creteTextNode()
, c = new cleverapps.Spine(bundles.growth_fund.jsons.buy_fund_safe);
c.setAnimationAndIdleAfter("open", "idle");
return new cleverapps.Layout([c, b, this.button],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
creteTextNode: function() {
var a = cleverapps.styles.GrowthFundBuyWindow.text
, b = function(d, e) {
d = cleverapps.UI.generateOnlyText(d, cleverapps.styles.FONTS.WINDOW_TEXT);
e = cleverapps.UI.generateImageText(cleverapps.formatAmount(e), cleverapps.styles.FONTS.GROWTH_FUND_RECEIVE_AMOUNT);
var f = new cc.Sprite(bundles.growth_fund.frames.rubies);
e = new cleverapps.Layout([e, f],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.iconMargin
});
return new cleverapps.Layout([d, e],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
}
, c = b("GrowthFundBuyWindow.text1", cleverapps.growthFund.getTotalWaitingRewards());
b = b("GrowthFundBuyWindow.text2", GrowthFund.LEVELS.rewards.default);
return new cleverapps.Layout([c, b],{
direction: cleverapps.UI.VERTICAL,
margin: a.lineMargin
})
},
createBuyButton: function() {
var a = cleverapps.growthFund.getProduct();
a = new cleverapps.UI.Button({
text: a.getCurrentPrice(),
onClicked: function() {
cleverapps.growthFund.buy()
},
width: cleverapps.styles.GrowthFundBuyWindow.button.width,
height: cleverapps.styles.GrowthFundBuyWindow.button.height
});
Lottery.addIcon(a);
return a
},
createBadge: function() {
var a = cleverapps.styles.GrowthFundBuyWindow.badge
, b = new TileBadge({
type: "value",
value: "800%"
});
b.setPositionRound(a);
this.window.addChild(b)
},
listBundles: function() {
return ["growth_fund"]
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
GROWTH_FUND_RECEIVE_AMOUNT: {
name: "nostroke",
size: 53,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.GrowthFundBuyWindow = {
margin: 20,
text: {
margin: 20,
iconMargin: 5,
lineMargin: 0
},
badge: {
x: {
align: "right",
dx: 40
},
y: {
align: "bottom",
dy: -40
}
},
button: {
width: 240,
height: 95
}
};
var GrowthFundLevelView = cc.Node.extend({
ctor: function(a) {
this._super();
this.data = a;
this.state = a.state;
this.setAnchorPoint(.5, .5);
this.setContentSize2(cleverapps.styles.GrowthFundLevelView);
this.createContent()
},
createContent: function() {
var a = cleverapps.styles.GrowthFundLevelView
, b = cleverapps.growthFund.findFirst(GrowthFund.STATE.INSUFFICIENT);
this.reached = !b || this.data.levelNo < b.levelNo;
b = this.bg = cleverapps.UI.createScale9Sprite(bundles.growth_fund.frames.lvl_bg, cleverapps.UI.Scale9Rect.TwoPixelXY);
b.setContentSize2(this.getContentSize());
this.addChild(b);
b.setPositionRound(this.width / 2, this.height / 2);
if (bundles.growth_fund.frames.lvl_icon_bg) {
var c = cleverapps.UI.createScale9Sprite(bundles.growth_fund.frames.lvl_icon_bg, cleverapps.UI.Scale9Rect.TwoPixelXY);
c.setContentSize2(a.iconBg);
c.setPositionRound(a.iconBg);
b.addChild(c);
b.setCascadeOpacityEnabled(!0);
b.setCascadeColorEnabled(!0)
}
this.createReward();
this.createTitle();
this.createIcon();
this.setState();
this.reached || this.paintInsufficient()
},
createReward: function() {
var a = cleverapps.styles.GrowthFundLevelView.rewards
, b = cleverapps.UI.generateOnlyText("RewardsListComponent.rewardTitle", this.reached ? cleverapps.styles.FONTS.GROWTH_FUND_LEVEL_REWARD_REACHED : cleverapps.styles.FONTS.GROWTH_FUND_LEVEL_REWARD)
, c = this.rewardsList = new RewardsListComponent({
hard: this.data.reward
},{
font: this.reached ? cleverapps.styles.FONTS.GROWTH_FUND_LEVEL_VALUE_REACHED : cleverapps.styles.FONTS.GROWTH_FUND_LEVEL_VALUE,
margin: a.margin,
noPrefix: !0,
textDirection: cleverapps.UI.HORIZONTAL,
textMargin: a.textMargin,
icons: {
hard: bundles.growth_fund.frames.rubies
},
small: !0,
event: cleverapps.EVENTS.EARN.PURCHASE
});
b = new cleverapps.Layout([b, c],{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin.x
});
this.addChild(b);
b.setPositionRound(a)
},
createTitle: function() {
var a = cleverapps.styles.GrowthFundLevelView.title
, b = "GrowthFundWindow.reach"
, c = cleverapps.styles.FONTS.GROWTH_FUND_LEVEL_TITLE;
this.reached && (b = "GrowthFundWindow.reached",
c = cleverapps.styles.FONTS.GROWTH_FUND_LEVEL_TITLE_REACHED);
b = this.title = cleverapps.UI.generateOnlyText(b, c, {
level: this.data.levelNo + 1
});
b.fitTo(a.maxWidth);
this.addChild(b);
b.setPositionRound(a)
},
createIcon: function() {
var a = cleverapps.styles.GrowthFundLevelView.icon
, b = new cc.Sprite(bundles.growth_fund.frames.rubies_heap);
this.addChild(b);
b.setPositionRound(a);
this.icon = b
},
setState: function() {
cleverapps.tooltipManager.remove(this);
cc.eventManager.removeListeners(this);
switch (this.data.state) {
case GrowthFund.STATE.INSUFFICIENT:
var a = Messages.get("GrowthFundWindow.insufficient");
this.createMark();
break;
case GrowthFund.STATE.WAITING:
a = Messages.get("GrowthFundWindow.getPrevious", {
level: cleverapps.growthFund.findFirst(GrowthFund.STATE.READY).levelNo + 1
});
this.createButton();
break;
case GrowthFund.STATE.READY:
this.createButton();
break;
case GrowthFund.STATE.RECEIVED:
this.createMark()
}
a && cleverapps.tooltipManager.create(this.button || this.mark, {
text: a
})
},
createButton: function() {
var a = cleverapps.styles.GrowthFundLevelView.button;
this.button = new cleverapps.UI.Button({
width: a.width,
height: a.height,
text: "Claim",
onClicked: this.onClick.bind(this)
});
this.addChild(this.button);
this.button.setPositionRound(a)
},
onClick: function() {
cleverapps.growthFund.isBought() ? this.data.state === GrowthFund.STATE.READY && (Game.currentGame ? (this.rewardsList.receiveRewards(),
this.rewardsList.receiveRewardsAnimation({
noFadeOut: !0
})) : cleverapps.user.earnHard(cleverapps.EVENTS.EARN.GROWTH_FUND, this.data.reward),
cleverapps.growthFund.takeReward(this.data.levelNo)) : new GrowthFundBuyWindow
},
createMark: function() {
var a = this.mark = new cc.Sprite(bundles.growth_fund.frames[this.data.state === GrowthFund.STATE.RECEIVED ? "checkmark" : "lock"]);
this.addChild(a);
a.setPositionRound(cleverapps.styles.GrowthFundLevelView.mark)
},
updateState: function() {
if (this.state !== this.data.state || this.state === GrowthFund.STATE.WAITING)
this.state = this.data.state,
this.removeAllChildren(!0),
this.createContent()
},
paintInsufficient: function() {
var a = function(c) {
c.setColor(new cc.Color(180,180,180,255));
c.setOpacity(140)
};
a(this.bg);
a(this.icon);
for (var b in this.rewardsList.targets)
a(this.rewardsList.targets[b].icon)
}
});
cleverapps.styles.GrowthFundLevelView = {
width: 960,
height: 150,
title: {
maxWidth: 490,
x: {
align: "left",
dx: 175
},
y: {
align: "center",
dy: 25
}
},
icon: {
width: 130,
height: 130,
x: {
align: "left",
dx: 25
},
y: {
align: "center",
dy: 0
}
},
rewards: {
margin: {
x: 10
},
textMargin: 0,
x: {
align: "left",
dx: 175
},
y: {
align: "center",
dy: -25
}
},
mark: {
x: {
align: "right",
dx: -134
},
y: {
align: "center"
}
},
button: {
width: 200,
height: 80,
x: {
align: "right",
dx: -68
},
y: {
align: "center"
}
}
};
var ReturnBonus = function() {
cleverapps.user.isReturnedPlayer() && (this.hasReward = !0);
this.checkSocial();
cleverapps.user.on("incLevel", this.checkSocial.bind(this))
};
ReturnBonus.prototype.checkSocial = function() {
if ("vk" === connector.info.source) {
var a = Object.keys(ReturnBonus.VK_PROMO).map(function(b) {
b = Number(b);
var c = ReturnBonus.VK_PROMO[b];
return function(d) {
this.isVkBonusAvailable(c) ? !connector.social.isConnected() || this.hasReward ? d() : this.hasVkPromoGift(b, function(e) {
if (this.hasReward = e)
this.promoId = b;
d()
}
.bind(this)) : d()
}
.bind(this)
}
.bind(this));
(new ActionPlayer(a)).play()
}
}
;
ReturnBonus.prototype.shouldReward = function() {
return this.hasReward && !cleverapps.config.wysiwygMode
}
;
ReturnBonus.prototype.isVkBonusAvailable = function(a) {
return cleverapps.user.checkAvailable(a) ? connector.platform.isTester() ? !0 : Date.now() > (new Date(a.start)).getTime() && Date.now() < (new Date(a.end)).getTime() : !1
}
;
ReturnBonus.prototype.hasVkPromoGift = function(a, b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.RETURNBONUS_CHECK + a);
connector.platform.callNative("apps.promoHasActiveGift", {
promo_id: a
}, function(c, d) {
b(c === connector.CODE_SUCCEED && 1 === d.response)
})
}
;
ReturnBonus.prototype.useVkPromoGift = function(a) {
connector.platform.callNative("apps.promoUseGift", {
promo_id: a
}, function(b, c) {
b = b === connector.CODE_SUCCEED && 1 === c.response ? connector.CODE_SUCCEED : connector.CODE_FAILED;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.PROMO_REWARD + a + "_" + b)
})
}
;
ReturnBonus.prototype.giveReward = function() {
cleverapps.focusManager.display({
focus: "ReturnBonusRewardWindow",
action: function(a) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.RETURNBONUS_REWARD);
this.hasReward = !1;
var b = "ReturnBonusRewardWindow.title";
this.promoId && (this.useVkPromoGift(this.promoId),
34 === this.promoId && (b = "PromoBonusRewardWindow.title"),
delete this.promoId);
new RewardWindow(RewardsConfig.ReturnBonus,{
title: b,
fireworks: !0,
event: cleverapps.EVENTS.EARN.RETURN
});
cleverapps.focusManager.onceNoWindowsListener = a
}
.bind(this)
})
}
;
ReturnBonus.REWARD_TIMEOUT = cleverapps.parseInterval("1 hour");
ReturnBonus.VK_PROMO = {
33: {
projectName: ["wordsoup", "mergecraft", "wondermerge"],
start: "2024-02-05",
end: "2024-08-06"
},
34: {
projectName: ["wordsoup", "mergecraft", "wondermerge"],
start: "2024-04-01",
end: "2024-06-01",
level: 2
}
};
"wordsoup" === cleverapps.config.name && (ReturnBonus.VK_PROMO[34].level = 0);
var PromoCodes = function() {};
PromoCodes.prototype.hasAvailableCodes = function() {
for (var a in PromoCodes.CODES)
if (this.canUseCode(a))
return !0;
return !1
}
;
PromoCodes.prototype.isUsedCode = function(a) {
return (cleverapps.dataLoader.load(DataLoader.TYPES.PROMOCODES) || []).includes(a)
}
;
PromoCodes.prototype.canUseCode = function(a) {
if (!a || this.isUsedCode(a))
return !1;
a = PromoCodes.CODES[a];
return !a || a.available && !levels.user.checkAvailable(a.available) ? !1 : !0
}
;
PromoCodes.prototype.save = function(a) {
var b = cleverapps.dataLoader.load(DataLoader.TYPES.PROMOCODES) || [];
cleverapps.dataLoader.save(DataLoader.TYPES.PROMOCODES, b.concat(a))
}
;
PromoCodes.prototype.useCode = function(a) {
if (!this.canUseCode(a))
return !1;
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.PROMOCODE_REWARD + a);
this.save(a);
return PromoCodes.CODES[a].reward
}
;
PromoCodes.CODES = {
KING: {
available: {
disabled: !0,
mergecraft: {
source: ["mygames", "test", "rustore"]
},
wondermerge: {
source: ["test", "rustore"]
}
},
reward: {
energy: 100,
hard: 5,
soft: 100,
worker: "6 hour"
}
}
};
var ComicsPlayer = function(a, b) {
this.stages = a;
this.animation = b;
this.stage = -1
};
ComicsPlayer.prototype.onChangeStage = function() {
if (void 0 === this.dialogueStages || 1 > this.dialogueStages)
this.next(),
this.dialogueStages = this.comics.dialogueStages || 1;
this.dialogueStages--
}
;
ComicsPlayer.prototype.next = function() {
this.stage++;
this.stage >= this.stages.length || (this.comics = this.stages[this.stage],
this.runAnimation())
}
;
ComicsPlayer.prototype.completeShowAnimation = function() {
this.inAnimation && this.comics.idleAnimation && (this.animation.setCompleteListener(),
this.inAnimation = !1,
this.animation.setAnimation(0, this.comics.idleAnimation, !0))
}
;
ComicsPlayer.prototype.runAnimation = function() {
this.animation.setTimeScale(1);
this.comics.showAnimation ? (this.inAnimation = !0,
this.animation.setAnimation(0, this.comics.showAnimation, !1),
this.animation.setCompleteListener(this.animation.createListener(this.completeShowAnimation.bind(this)))) : (this.inAnimation = !1,
this.animation.setAnimation(0, this.comics.idleAnimation, !0))
}
;
var ComicsScene = cleverapps.FixedWidthScene.extend({
ctor: function(a) {
this.data = a;
this._super()
},
onSceneLoaded: function() {
this._super(cleverapps.Environment.SCENE_COMICS);
this.createBg();
this.player = new ComicsPlayer(this.data.stages,this.createAnimation(this.data))
},
playIntroActions: function(a) {
var b = this.dialogue = new Dialogue(this.data.dialogue,{
autoClose: !0,
autoScroll: 3
});
b.on("afterClose", a);
b.on("changedStage", this.player.onChangeStage.bind(this.player));
new DialogueView(b,{
window: {
shadow: !1
}
})
},
setupChildren: function() {
if (this.isAllLoaded) {
this._super();
this.bg && (this.bg.baseScale = Math.max(this.width / this.bg.width, this.height / this.bg.height),
this.bg.setScale(this.bg.baseScale));
if (this.animationNode) {
var a = cleverapps.resolution.getBgSize();
this.animationNode.setScale(Math.max(a.width / this.width, a.height / this.height));
this.animation.setScale(Math.max(this.width / this.animation.width, this.height / this.animation.height))
}
this.bg && this.bg.setPositionRound(this.width / 2, this.height / 2);
this.animationNode && this.animationNode.setPositionRound(this.width / 2, this.height / 2)
}
},
createAnimation: function(a) {
var b = this.animationNode = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize(this.getContentSize());
b.setPositionRound(this.width / 2, this.height / 2);
var c = cleverapps.resolution.getBgSize();
b.setScale(Math.max(c.width / this.width, c.height / this.height));
this.addChild(b);
c = this.animation = new cleverapps.Spine(a.json);
b.addChild(c);
c.setPositionRound(b.width / 2, b.height / 2);
c.setAnimation(0, a.stages[0].showAnimation || a.stages[0].idleAnimation, !1);
c.setScale(Math.max(this.width / c.width, this.height / c.height));
c.setTimeScale(0);
return c
},
createBg: function() {
if (bundles.comicses.urls.bg) {
var a = this.bg = new cc.Sprite(bundles.comicses.urls.bg);
this.addChild(a);
a.setPositionRound(this.width / 2, this.height / 2);
this.bg.baseScale = Math.max(this.width / a.width, this.height / a.height);
a.setScale(this.bg.baseScale);
a.setLocalZOrder(-10)
}
},
listBundles: function() {
var a = ["dialogues"];
this.data.bundles && (a = a.concat(this.data.bundles));
return a
}
});
ComicsScene.showComics = function(a, b) {
var c = new ComicsScene(b);
cleverapps.scenes.replaceScene(c, function() {
c.playIntro(a)
})
}
;
var KeyboardController = function() {
this.bindings = {};
this.keyPressed = {};
cc.eventManager.addListener(cc.EventListener.create({
event: cc.EventListener.KEYBOARD,
onKeyPressed: this.onKeyPressedHandler.bind(this),
onKeyReleased: this.onKeyReleasedHandler.bind(this)
}), 2)
};
KeyboardController.prototype.RETURN_THROTTLE = 250;
KeyboardController.prototype.THROTTLE_KEYS = cleverapps.createSet([cc.KEY.escape, cc.KEY.back]);
KeyboardController.prototype.KEYS = cleverapps.createSet([cc.KEY.ctrl, cc.KEY.shift]);
cleverapps.config.debugMode && (KeyboardController.prototype.KEYS = cleverapps.createSet([cc.KEY.ctrl, cc.KEY.alt, cc.KEY.shift, cc.KEY.s, cc.KEY.d, cc.KEY.r, cc.KEY.j, cc.KEY.a, cc.KEY.Delete, cc.KEY.c, cc.KEY.h, cc.KEY.w, cc.KEY.m, cc.KEY.f, cc.KEY.q, cc.KEY.v, cc.KEY.y, cc.KEY.space, cc.KEY.l, cc.KEY.b, cc.KEY.x]));
KeyboardController.prototype.bindKeys = function(a, b, c) {
this.bindings[a] = {
combo: b,
callback: c
};
return a
}
;
KeyboardController.prototype.unbindKeys = function(a) {
delete this.bindings[a]
}
;
KeyboardController.prototype.isPressed = function(a) {
return this.keyPressed[a]
}
;
KeyboardController.prototype.onKeyPressedHandler = function(a) {
if (!this.keyPressed[a]) {
this.KEYS[a] && (this.keyPressed[a] = !0);
for (var b = Object.values(this.bindings).sort(function(d, e) {
return e.combo.length - d.combo.length
}), c = 0; c < b.length; c++)
if (b[c].combo.every(function(d) {
if (this.KEYS[d]) {
if (!this.keyPressed[d])
return !1
} else if (d !== a)
return !1;
return !0
}, this)) {
b[c].callback();
break
}
}
}
;
KeyboardController.prototype.onKeyReleasedHandler = function(a) {
this.KEYS[a] && (this.keyPressed[a] = !1);
this.THROTTLE_KEYS[a] && this.returnAction()
}
;
KeyboardController.prototype.returnAction = cleverapps.throttle(KeyboardController.prototype.RETURN_THROTTLE, function() {
var a = cleverapps.windows.currentWindow();
cleverapps.sceneDebugger && cleverapps.sceneDebugger.selectedNode ? "undefined" !== typeof EditorMap2dDecoratorView && cleverapps.sceneDebugger.selectedNode instanceof EditorMap2dDecoratorView ? cleverapps.sceneDebugger.selectedNode.unselect() : (cleverapps.sceneDebugger.selectedNode.cleanupBorder(),
cleverapps.sceneDebugger.selectedNode = void 0) : a && !a.closed ? a.closeByBackButton ? a.closeByBackButton() : cleverapps.config.debugMode && (a instanceof DialogueView ? a.dialogue.screenClicked() : a instanceof ForceView && cleverapps.forces.closeRunningForce()) : !cleverapps.toolModel || cleverapps.scenes.getRunningScene()instanceof AdministratorScene ? (a = cleverapps.scenes.getRunningScene(),
!a || a instanceof LoaderScene || a.closeAction()) : cleverapps.toolModel.isOpened() ? cleverapps.toolModel.hide() : cleverapps.toolModel.show()
});
var LivesFeast = function(a, b) {
this.mission = a;
b && Game.currentGame.pixelsPlanner.restart()
}
, SoftFeast = function(a, b) {
this.mission = a;
b && Game.currentGame.pixelsPlanner.restart()
}
, KrakenFeast = function(a, b) {
this.mission = a;
b && Game.currentGame.monstersPlanner.spawnToAllSlots(!0)
};
KrakenFeast.prototype.stop = function() {
Game.currentGame && MissionManager.hasProperParent(this.mission) && (Game.currentGame.monstersPlanner.stop(),
Game.currentGame.quests.applyDynamicFilter())
}
;
var ChestTime = function(a) {
this.mission = a
};
ChestTime.prototype.onAdded = function() {
this.forEachChest(function(a) {
a.onUpdateState()
})
}
;
ChestTime.prototype.canRemoveSilently = function() {
return !0
}
;
ChestTime.prototype.stop = function() {
this.forEachChest(function(a) {
if (!Chest.AlwaysWithEnergy(a.unit))
a.onUpdateState()
})
}
;
ChestTime.prototype.forEachChest = function(a) {
Map2d.currentMap && Map2d.currentMap.listAvailableUnits().forEach(function(b) {
(b = b.findComponent(Chest)) && a(b)
})
}
;
var Caravan = function(a, b) {
this.mission = a;
b && (a = Game.currentGame.shipsPlanner.spawnUnit()) && (b = Game.currentGame.unitStories.findStory(Unit.GetKey(a))) && (this.unitStory = {
story: b,
unit: a
})
};
Caravan.prototype.buyProduct = function(a) {
a.onBuyed()
}
;
Caravan.prototype.beforeRemove = function() {
Game.currentGame && Game.currentGame.shipsPlanner.removeUnit()
}
;
Caravan.PRODUCTS = ["caravan0", "caravan1", "caravan2"];
var CaravanTileView = cc.Scale9Sprite.extend({
ctor: function(a, b, c) {
this.product = a;
this.callback = c;
this.cupData = b;
this.units = Prizes.Generate([this.cupData], {
listOnly: !0
});
this._super(bundles.caravan.frames.tile_bg_png, cleverapps.UI.getScale9Rect(bundles.caravan.frames.tile_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY));
b = cleverapps.styles.CaravanTileView;
this.setContentSize(b);
this.title = this.createTitle();
this.title.setLocalZOrder(1);
this.addChild(this.title);
this.title.setPositionRound(b.title);
this.grid = this.createGrid();
this.grid.setOpacity(0);
this.grid.setVisible(!1);
this.addChild(this.grid);
this.grid.setPositionRound(b.grid);
this.unitsGrid = this.createUnitsGrid();
this.unitsGrid.setOpacity(0);
this.unitsGrid.setVisible(!1);
this.addChild(this.unitsGrid);
this.unitsGrid.setPositionRound(b.grid);
this.amount = this.createAmount();
this.amount.setOpacity(0);
this.amount.setVisible(!1);
this.addChild(this.amount);
this.amount.setPositionRound(b.amount);
this.person = new cc.Sprite(this.product.person);
this.addChild(this.person);
this.person.setPositionRound(b.person);
this.rewardsBlock = this.createRewardsBlock();
this.addChild(this.rewardsBlock);
this.rewardsBlock.setPositionRound(b.rewardsBlock);
this.helpButton = new cleverapps.UI.HelpButton(this.onHelpButtonClicked.bind(this));
this.addChild(this.helpButton);
this.helpButton.setPositionRound(b.helpButton);
a.value && (this.badge = new TileBadge({
type: "value",
value: a.value
}),
this.badge.setScale(b.badge.scale),
this.addChild(this.badge),
this.badge.setPositionRound(b.badge));
a = new UseGoldButton({
price: this.product.price,
eventName: cleverapps.EVENTS.SPENT.CARAVAN + this.product.order,
width: b.button.width,
height: b.button.height,
filter: this.canBeBought.bind(this),
onClicked: this.callback.bind(this)
});
this.addChild(a);
a.setPositionRound(b.button);
this.onHelpButtonClicked(!0)
},
canBeBought: function() {
var a = cleverapps.toArray(this.product.reward.unit || this.product.reward.units || []).reduce(function(b, c) {
return b + (void 0 === c.amount ? 1 : c.amount)
}, 0) - Map2d.currentMap.countEmptySlots();
return 0 < a ? (cleverapps.centerHint.createTextHint("Spawn.nospace", {
left: a
}),
!1) : !0
},
onHelpButtonClicked: function(a) {
this.isHelpShown = !this.isHelpShown;
var b = cleverapps.styles.CaravanTileView;
this.helpButton.setType(this.isHelpShown ? {
button_png: bundles.caravan.frames.return_button_png,
button_on_png: bundles.caravan.frames.return_button_on_png
} : {
button_png: bundles.buttons.frames.help_button_png,
button_on_png: bundles.buttons.frames.help_button_on_png
});
b = this.title.calculatePositionRound(this.isHelpShown ? b.title.help : b.title);
this.title.stopAllActions();
a ? this.title.setPositionRound(b) : this.title.runAction(new cc.MoveTo(.3,b));
b = function(d) {
d.stopAllActions();
a ? (d.setVisible(!0),
d.setOpacity(255)) : d.runAction(new cc.Sequence(new cc.Show,new cc.FadeIn(.3)))
}
;
var c = function(d) {
d.stopAllActions();
a ? (d.setOpacity(0),
d.setVisible(!1)) : d.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.Hide))
};
this.isHelpShown ? ([this.grid, this.unitsGrid, this.amount].forEach(b),
[this.rewardsBlock, this.person].forEach(c),
this.badge && this.badge.performRecursive(c)) : ([this.rewardsBlock, this.person].forEach(b),
[this.grid, this.unitsGrid, this.amount].forEach(c),
this.badge && this.badge.performRecursive(b))
},
createGrid: function() {
var a = cleverapps.styles.CaravanTileView.grid;
this.slots = this.units.map(function() {
var c = new cc.Scale9Sprite(bundles.caravan.frames.inner_bg_png);
c.setContentSize(a.unit.bg);
return c
});
var b = new cleverapps.GridLayout(this.slots,{
columns: 3,
margin: a.margin
});
b.setCascadeOpacityEnabledRecursively(!0);
return b
},
createUnitsGrid: function() {
var a = cleverapps.styles.CaravanTileView.grid
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(this.grid.getContentSize());
b.setCascadeOpacityEnabledRecursively(!0);
this.units.forEach(function(c, d) {
c = UnitView.getUnitImage({
code: c.code,
stage: c.stage
}, {
preferStatic: !0,
alignAnchorX: !0
});
cleverapps.UI.fitToBox(c, {
width: a.unit.width,
height: a.unit.height,
maxScale: 1.5
});
b.addChild(c);
d = this.slots[d].getPosition();
c.setPositionRound(d.x, d.y);
c = cleverapps.UI.generateOnlyText(Math.round(100 / 12) + "%", cleverapps.styles.FONTS.CARAVAN_PROBABILITY);
c.setLocalZOrder(1);
b.addChild(c);
c.setPositionRound(d.x + a.probability.x, d.y + a.probability.y)
}, this);
return b
},
createTitle: function() {
var a = cleverapps.styles.CaravanTileView
, b = new cc.Scale9Sprite(bundles.caravan.frames.title_bg_png);
b.setContentSize(a.title.bg);
var c = cleverapps.UI.generateOnlyText(this.product.title, cleverapps.styles.FONTS.WHITE_TEXT);
c.fitTo(a.title.text.width);
b.addChild(c);
c.setPositionRound(a.title.text);
return b
},
createAmount: function() {
var a = cleverapps.UI.generateOnlyText("Caravan.ItemsAmount", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT, {
amount: this.cupData.amount
});
a.setCascadeOpacityEnabledRecursively(!0);
return a
},
createRewardsBlock: function() {
var a = cleverapps.styles.CaravanTileView.rewardsBlock
, b = a.withBg ? new cc.Scale9Sprite(bundles.caravan.frames.inner_bg_png) : new cc.Node;
b.setContentSize2(a.bg);
var c = new cc.Sprite(this.product.getIcon());
b.addChild(c);
c.setPositionRound(a.icon);
c = new cc.Sprite(bundles.caravan.frames.plus_png);
b.addChild(c);
c.setPositionRound(a.plus);
c = cleverapps.clone(this.product.reward);
delete c.unit;
c = new RewardsListComponent(c,{
columns: 1,
small: !0,
textDirection: cleverapps.UI.HORIZONTAL,
font: cleverapps.styles.FONTS.CARAVAN_REWARDS_BLOCK_TEXT,
margin: {
x: a.margin,
y: a.margin
},
iconWrap: a.iconWrap,
textWrap: a.textWrap
});
b.addChild(c);
c.setPositionRound(a.rewards);
b.setCascadeOpacityEnabledRecursively(!0);
return b
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CARAVAN_PROBABILITY: {
size: 28,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
CARAVAN_REWARDS_BLOCK_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR
}
});
cleverapps.styles.CaravanTileView = {
width: 540,
height: 940,
amount: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 130
}
},
title: {
x: {
align: "center",
dx: 7
},
y: {
align: "center",
dy: -25
},
help: {
x: {
align: "center",
dx: 7
},
y: {
align: "center",
dy: -245
}
},
bg: {
width: 560,
height: 126
},
text: {
width: 400,
x: {
align: "center"
},
y: {
align: "center",
dy: 8
}
}
},
button: {
width: 300,
height: 86,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 30
}
},
grid: {
x: {
align: "center"
},
y: {
align: "top",
dy: -55
},
margin: {
x: 10,
y: 6
},
probability: {
x: 44,
y: -50
},
unit: {
width: 135,
height: 135,
bg: {
width: 145,
height: 145
}
}
},
rewardsBlock: {
withBg: !0,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 130
},
margin: 0,
bg: {
width: 447,
height: 260
},
icon: {
x: {
align: "center",
dx: -110
},
y: {
align: "center"
}
},
plus: {
x: {
align: "center",
dx: 15
},
y: {
align: "center"
}
},
rewards: {
x: {
align: "right",
dx: -10
},
y: {
align: "center"
}
},
iconWrap: {
width: 45,
height: 65
},
textWrap: {
width: 90,
height: 65
}
},
helpButton: {
x: {
align: "left",
dx: -10
},
y: {
align: "top",
dy: 10
}
},
badge: {
x: {
align: "right",
dx: 13
},
y: {
align: "top",
dy: 30
},
scale: .7
},
person: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 475
}
}
};
var CaravanMissionWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.mission = a;
this._super({
name: "CaravanMissionWindow",
content: this.createContent(),
noBackground: !0,
title: "CaravanMissionWindow.Title",
notCloseByTouchInShadow: !0,
closeButtonDelay: !0
});
cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem")
},
getPerson: function() {
return {
left: cleverapps.persons.choose("seller", "camel"),
right: "camel"
}
},
createContent: function() {
var a = cleverapps.styles.CaravanMissionWindow
, b = Caravan.PRODUCTS.map(function(c, d) {
c = Product.CreateById(c);
c = new CaravanTileView(c,Families.caravanbox.units[d].cup,this.buyProduct.bind(this, c));
c.setLocalZOrder(-d);
return c
}, this);
b.forEach(function(c, d) {
c.runAction(new cc.Sequence(new cc.DelayTime(.7 + .3 * d),new cc.CallFunc(function() {
c.onHelpButtonClicked()
}
)))
});
return new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
})
},
buyProduct: function(a) {
this.mission.logic.buyProduct(a);
this.close()
},
listBundles: function() {
return ["caravan"]
}
});
cleverapps.styles.CaravanMissionWindow = {
margin: 20
};
var LanternMissionLogic = function(a) {
this.mission = a;
this.lantern = new Lantern(a)
};
var ManualStarters = {
ChildStarter: function(a) {
return function() {
return cleverapps.missionManager.findByType(a)
}
},
ExpeditionFeastStarter: function(a) {
var b = Game.currentGame;
if (cleverapps.travelBook.isExpedition() && b && b.map.fogs.isOpened("fog6") && (b = cleverapps.missionManager.findLocalExpedition()) && b.type === Missions[a].parentType) {
var c = cleverapps.parseInterval(Missions[a].duration);
a = cleverapps.missionManager.getLastRemoved(a);
return b.getTimeLeft() >= c && a + c < Date.now()
}
return !1
},
SnailFeastStarter: function(a, b) {
var c = cleverapps.missionManager.findLocalExpedition()
, d = cleverapps.missionManager.getLastRemoved(a);
if (!c || c.type !== Missions[a].parentType || !MissionTree.targets[a] || !MissionTree.targets[a].length)
return !1;
d < c.started && (d = 0);
if (b && b.fromMissionTree)
return !d;
if (!d)
return !1;
b = a = cleverapps.parseInterval(Missions[a].duration);
cleverapps.config.debugMode && (b = cleverapps.parseInterval("3 minutes"));
return c.getTimeLeft() >= a && d + b < Date.now()
},
MissionTreeStarter: function(a, b) {
return b && b.fromMissionTree
},
FogStarter: function(a) {
return Missions[a].startFog && Map2d.currentMap.fogs.isOpened(Missions[a].startFog)
},
UnitStarter: function(a) {
return Missions[a].startUnit && cleverapps.unitsLibrary.isOpened(Missions[a].startUnit)
},
clPassStarter: function(a) {
return cleverapps.user.checkAvailable(Missions[a].available) ? cleverapps.missionManager.getLastRemoved(a) + cleverapps.parseInterval(Missions[a].cooldown) < Date.now() : !1
}
};
var CurrentEpisodeLabel = cc.Node.extend({
ctor: function(a) {
this._super();
this.pageNo = a;
this.createContent();
this.setAnchorPoint(.5, .5);
this.setPositionRound({
x: {
align: "center"
},
y: {
align: "center"
}
});
this.setLocalZOrder(1)
},
createContent: function() {
this.bg = this.createBg();
var a = this.label = new cc.Node;
a.setAnchorPoint(.5, .5);
a.setContentSize2(this.bg.getContentSize());
a.addChild(this.bg);
a.setPositionRound(cleverapps.styles.CurrentEpisodeLabel.label.alignment);
this.addLabelText();
this.setContentSize2(a.getContentSize());
this.addChild(this.label)
},
createBg: function() {
var a = cleverapps.styles.CurrentEpisodeLabel.background;
if (a.json) {
var b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a);
a = this.bgAnimation = new cleverapps.Spine(a.json);
a.setAnimation(0, "idle", !1);
a.setPosition(b.width / 2, b.height / 2);
b.addChild(a)
} else
b = cleverapps.UI.createScale9Sprite(a.image, cleverapps.UI.Scale9Rect.TwoPixelXY),
a.width && b.setContentSize2(a);
b.setPosition(b.width / 2, b.height / 2);
return b
},
addLabelText: function() {
var a = cleverapps.styles.CurrentEpisodeLabel.label.islandText
, b = this.labelText = cleverapps.UI.generateTTFText("StartEpisodeWindow.Title" + this.pageNo, a.font);
b.fitTo(this.bg.width + a.padding);
b.setPositionRound(a.alignment);
this.label.addChild(b)
}
});
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
ISLAND_LABEL_TEXT: {
size: 34,
color: cleverapps.styles.COLORS.WHITE
},
ISLAND_LABEL_LEVELS: {
size: 30,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.UI.Tooltip = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.options = b;
this.target = a;
this.duration = b.duration || 4;
this.location = b.location;
a = cleverapps.styles.UI.Tooltip;
var c = b.size || a.SIZE.medium;
b.rewards ? this.setContentSize2(c.width + a.rewards.extraWidth, c.height + a.rewards.extraHeight) : this.setContentSize2(c);
this.bg = new cc.Scale9Sprite(bundles.tooltip.frames.tooltip_bg_png);
this.addChild(this.bg);
this.bg.setContentSize2(this.getContentSize());
this.arrow = new cc.Sprite(bundles.tooltip.frames.tooltip_arrow_png);
this.addChild(this.arrow);
if (b.content)
this.content = b.content,
this.bg.addChild(this.content),
c = Math.min(this.width / (this.content.width * this.content.scaleX + a.content.padding), this.height / (this.content.height * this.content.scaleY + a.content.padding)),
1 > c && this.content.setScale(this.content.scaleX * c, this.content.scaleY * c),
this.content.setPositionRound(this.width / 2, this.height / 2 + a.content.offset.y);
else {
c = this.text = cleverapps.UI.generateOnlyText(b.text, cleverapps.styles.FONTS.TOOLTIP_TEXT);
c.fitTo(this.width - a.content.padding);
var d = c;
b.rewards && (d = new RewardsListComponent(b.rewards,{
columns: 5,
textDirection: b.textDirection,
font: cleverapps.styles.FONTS.TOOLTIP_REWARDS_FONT,
noPrefix: !0,
iconWrap: a.rewards.iconWrap,
noShowControls: !0
}),
cleverapps.UI.fitToBox(d, {
width: this.width - a.content.padding
}),
d = new cleverapps.Layout([c, d],{
direction: cleverapps.UI.VERTICAL,
margin: a.rewards.margin
}));
d.setPositionRound(this.width / 2, this.height / 2 + a.content.offset.y);
this.bg.addChild(d);
this.content = d
}
b.control ? cleverapps.focusManager.registerControl(b.control, this.createListener(function(e) {
e ? this.show() : this.hide()
}
.bind(this))) : this.show();
this.setCascadeOpacityEnabledRecursively(!0)
},
hide: function() {
this.stopAllActions();
var a = .2 * this.scale;
this.runAction(new cc.Sequence((new cc.Spawn(new cc.ScaleTo(a,.3),new cc.FadeOut(a))).easing(cc.easeInOut(2)),new cc.CallFunc(function() {
this.content.removeFromParent()
}
.bind(this)),new cc.RemoveSelf))
},
setupChildren: function() {
var a = this.target.getGlobalBoundingBox()
, b = cleverapps.scenes.getRunningScene();
this.location === cleverapps.UI.Tooltip.LOCATION_BELOW && b.convertToNodeSpace(a).y < this.height && (this.location = cleverapps.UI.Tooltip.LOCATION_ABOVE);
this.updateArrow();
this.location === cleverapps.UI.Tooltip.LOCATION_BELOW ? (this.setAnchorPoint(.5, 1),
this.setPosition(b.convertToNodeSpace(cc.p(a.x + a.width / 2, a.y - this.arrow.height)))) : (this.setAnchorPoint(.5, 0),
this.setPosition(b.convertToNodeSpace(cc.p(a.x + a.width / 2, a.y + a.height + this.arrow.height))));
this.bg.setPositionRound(this.width / 2, this.height / 2);
0 > this.x - this.width / 2 && (this.bg.x += this.width / 2 - this.x + cleverapps.styles.UI.Tooltip.bgPadding);
this.x + this.width / 2 > cleverapps.scenes.getRunningScene().width && (this.bg.x -= this.width / 2 - cleverapps.scenes.getRunningScene().width + this.x + cleverapps.styles.UI.Tooltip.bgPadding)
},
show: function() {
this.setupChildren();
this.stopAllActions();
this.setScale(.2);
this.setOpacity(0);
this.runAction(new cc.Sequence(new cc.Show,(new cc.Spawn(new cc.FadeIn(.1),new cc.ScaleTo(.1,1))).easing(cc.easeInOut(2))));
this.runAction(new cc.Sequence(new cc.DelayTime(this.duration),new cc.CallFunc(function() {
this.hide()
}
.bind(this))))
},
updateArrow: function() {
var a = cleverapps.styles.UI.Tooltip.ARROW
, b = this.location === cleverapps.UI.Tooltip.LOCATION_BELOW ? a.top : a.bottom;
this.arrow.setSpriteFrame(b === a.bottom ? bundles.tooltip.frames.tooltip_shadow_arrow_png : bundles.tooltip.frames.tooltip_arrow_png);
this.arrow.setRotation(b.rotation);
this.arrow.setPositionRound(b)
}
});
cleverapps.styles.COLORS.TOOLTIP_COLOR = new cc.Color(148,49,19,255);
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TOOLTIP_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.TOOLTIP_COLOR
},
TOOLTIP_REWARDS_FONT: {
name: "nostroke",
color: cleverapps.styles.COLORS.TOOLTIP_COLOR,
size: 30
}
});
cleverapps.styles.UI.Tooltip = {
content: {
padding: 80,
offset: {
y: 0
}
},
bgPadding: 10,
rewards: {
extraWidth: 0,
extraHeight: 110,
margin: 10,
iconWrap: {
width: 60,
height: 60
}
},
SIZE: {
short: {
width: 360,
height: 100
},
medium: {
width: 480,
height: 100
},
long: {
width: 600,
height: 100
}
},
ARROW: {
top: {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 18
},
rotation: 180
},
bottom: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -16
},
rotation: 0
}
}
};
cleverapps.UI.Tooltip.LOCATION_ABOVE = 0;
cleverapps.UI.Tooltip.LOCATION_BELOW = 1;
var TooltipManager = function() {
this.active = void 0;
cc.eventManager.addListener(cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function() {
this.onClick()
}
.bind(this)
}), -1);
"mouse"in cc.sys.capabilities && cc.eventManager.addListener(cc.EventListener.create({
event: cc.EventListener.MOUSE,
onMouseScroll: function() {
this.onClick()
}
.bind(this)
}), -1)
};
TooltipManager.prototype.create = function(a, b) {
a.tooltipHandler && this.remove(a);
a.baseScaleX = a.scaleX;
a.baseScaleY = a.scaleY;
a.tooltipHandler = cleverapps.UI.onClick(a, function(c) {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
if (b.clickableArea) {
if (c = b.clickableArea.convertTouchToNodeSpace(c),
cc.rectContainsPoint(cc.rect(0, 0, b.clickableArea.width, b.clickableArea.height), c))
cleverapps.tooltipManager.onClick(a, b)
} else
cleverapps.tooltipManager.onClick(a, b)
})
}
;
TooltipManager.prototype.remove = function(a) {
a.tooltipHandler && (a.tooltipHandler.remove(),
a.tooltipHandler = void 0)
}
;
TooltipManager.prototype.onClick = cleverapps.accumulate(0, function(a, b) {
if (a || this.active) {
b = b || {};
var c = this.active && this.active.target;
c = a && c !== a;
this._hide();
(c || b.forceShow) && this._show(a, b)
}
});
TooltipManager.prototype._show = function(a, b) {
var c = new cleverapps.UI.Tooltip(a,b);
cleverapps.scenes.getRunningScene().movingNode.addChild(c);
addCleaner(c, function() {
this.active === c && delete this.active
}
.bind(this));
this.active = c
}
;
TooltipManager.prototype._hide = function() {
this.active && this.active.hide()
}
;
var Exclamation = function() {
cleverapps.EventEmitter.call(this)
};
Exclamation.prototype = Object.create(cleverapps.EventEmitter.prototype);
Exclamation.prototype.constructor = Exclamation;
Exclamation.prototype.show = function(a, b, c) {
this.trigger("show", a, b || Exclamation.Types.Normal, c)
}
;
Exclamation.prototype.remove = function() {
this.trigger("hide")
}
;
Exclamation.prototype.getCongratulations = function() {
return -1 !== ["heroes", "runes"].indexOf(cleverapps.config.name) ? "wow super yay yeah ohyeah oh".split(" ") : Messages.get("congratulations")
}
;
Exclamation.Types = {
Normal: 100,
Warning: 101,
Congrats: 102
};
var ExclamationViewBase = cc.Node.extend({
ctor: function() {
this._super();
var a = this.getStyles();
this.setAnchorPoint(.5, .5);
this.setContentSize2(a);
a.scale && this.setScale(a.scale[cleverapps.resolution.mode]);
cleverapps.exclamation.on("show", cleverapps.throttle(1E3, this.showMessage.bind(this)), this);
cleverapps.exclamation.on("hide", this.hideMessage.bind(this), this)
},
showMessage: function(a, b, c) {
var d = "message.Shuffle" === a ? bundles.exclamations.urls.shuffle_effect : bundles.exclamations.urls.keep_going_effect
, e = "keep_going_letsgo"
, f = cleverapps.styles.FONTS.MESSAGE_TEXT_NORMAL;
switch (b) {
case Exclamation.Types.Warning:
e = "5_moves_left";
d = bundles.exclamations.urls.five_moves_effect;
f = cleverapps.styles.FONTS.MESSAGE_TEXT_WARNING;
break;
case Exclamation.Types.Congrats:
e = "you_win",
d = bundles.main.urls.beat_friend_effect,
f = cleverapps.styles.FONTS.MESSAGE_TEXT_CONGRATS
}
this.runActions(a, f, d, e, c)
},
hideMessage: function() {
this.setVisible(!1)
},
runActions: function(a, b, c, d, e) {
this.createAnimation(d, e);
this.createMsg(a, b);
this.playSound(c)
},
playSound: function(a) {
if (a) {
var b = this.getStyles().sound ? this.getStyles().sound.delay : 0;
this.runAction(new cc.Sequence(new cc.DelayTime(b),new cc.CallFunc(function() {
cleverapps.audio.playSound(a)
}
)))
}
},
createMsg: function(a, b) {
a = this.createText(a, b);
a.opacity = 0;
a.runAction(new cc.Sequence(new cc.DelayTime(.2),new cc.FadeIn(.2),new cc.Spawn(new cc.MoveBy(.1,0,-2),new cc.ScaleTo(.1,1,.9)),new cc.ScaleTo(.25,1,1),new cc.DelayTime(.3),new cc.FadeOut(.2),new cc.RemoveSelf))
},
createText: function(a, b) {
var c = cleverapps.UI.LabelTTF.GetLocalizedText(a);
a = cleverapps.UI.generateTTFText(a, b);
-1 !== c.indexOf(" ") ? a.setDimensions(this.width, 0) : a.fitTo(this.width);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a);
return a
},
createAnimation: function(a, b) {
this.animation || (this.animation = new cleverapps.Spine(bundles.exclamations.jsons.exclamations_json),
this.animation.setPositionRound(this.width / 2, this.height / 2),
this.addChild(this.animation));
this.animation.setAnimation(0, a, !1);
b && this.animation.setCompleteListener(b)
},
getStyles: function() {
return cleverapps.styles.Exclamations.base
}
});
ExclamationViewBase.Create = function() {
return -1 !== ["heroes", "runes"].indexOf(cleverapps.config.name) ? new ExclamationViewHeroes : -1 !== ["board", "solitaire", "differences"].indexOf(cleverapps.config.type) ? new ExclamationViewWords : -1 !== ["adventure"].indexOf(cleverapps.config.name) ? new ExclamationViewActor : new ExclamationViewBase
}
;
var ExclamationViewHeroes = ExclamationViewBase.extend({
getStyles: function() {
return cleverapps.styles.Exclamations.heroes
},
showMessage: function(a, b, c) {
var d = this.getStyles()
, e = "message.YouWin" === a ? bundles.main.urls.sound_win_effect : bundles.exclamations.urls.keep_going_effect
, f = cleverapps.styles.FONTS.CONGRATS_MESSAGE_FONT
, g = d[a];
f.color = g ? g.color : b === Exclamation.Types.Warning ? d.warning.color : d["default"].color;
b = "lets_go";
-1 !== cleverapps.exclamation.getCongratulations().indexOf(a) ? (e = bundles.game.urls[a + "_effect"],
b = a,
a = "message." + a) : "message.KeepGoing" === a ? e = bundles.exclamations.urls.go_on_effect : "message.Shuffle" === a && (b = "shuffle",
e = bundles.exclamations.urls.shuffle_effect);
this.runActions(a, f, e, b, c)
},
createMsg: function(a, b) {
a = this.createText(a, b);
a.setRotation(10);
a.setScale(.1);
a.setVisible(!1);
a.runAction(new cc.Sequence(new cc.DelayTime(.2),new cc.Show,(new cc.ScaleTo(.3,1)).easing(cc.easeInOut(3)),new cc.DelayTime(.55),new cc.ScaleTo(.3,.1),new cc.RemoveSelf))
}
})
, ExclamationViewWords = ExclamationViewBase.extend({
getStyles: function() {
return cleverapps.styles.Exclamations.base
},
showMessage: function(a, b, c) {
this.runActions(a, void 0, void 0, "animation", c)
},
_initMsg: function(a, b, c, d) {
b = b || 0;
a = Messages.getLocalized(a);
a = this.splitTextToLines(a).map(function(e) {
return this.createLine(e, c, d)
}
.bind(this));
a = new cleverapps.Layout(a,{
direction: cleverapps.UI.VERTICAL,
margin: a.length && a[0].height / 10 || 0
});
a.setCascadeOpacityEnabled(!0);
a.setOpacity(0);
a.setScale(0);
a.setPositionRound(this.width / 2, this.height / 2 + b);
this.addChild(a);
return a
},
_calcScale: function(a) {
var b = 1
, c = cleverapps.scenes.getRunningScene();
a.width > c.width && (b = c.width / (1.2 * a.width));
return b
},
getEntireNodeAnimation: function(a, b) {
b = b || 1.2;
return new cc.Spawn(new cc.FadeIn(.25),new cc.Sequence(new cc.ScaleTo(.2,1.4 * a,1.4 * a),new cc.ScaleTo(.2,.8 * a,.8 * a),new cc.ScaleTo(1,a,a)),new cc.Sequence(new cc.DelayTime(b),new cc.FadeOut(.2),new cc.RemoveSelf))
},
createMsg: function(a) {
a = this._initMsg(a);
var b = this._calcScale(a);
this.setVisible(!0);
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.DelayTime(1.4),new cc.Hide));
a.runAction(this.getEntireNodeAnimation(b))
},
createLine: function(a, b, c) {
b = b || cleverapps.styles.FONTS.CONGRATE_TEXT;
var d = new cc.Node;
d.setAnchorPoint(.5, .5);
var e = 0
, f = 0;
a = this.splitLineToBlocks(a);
for (var g = 0; g < a.length; g++) {
var h = cleverapps.UI.generateOnlyText(a[g], b);
d.addChild(h);
var k = Math.abs(g - a.length / 2)
, m = 1 - .2 / a.length * k;
k = .2 + .6 / a.length * k;
var l = " " !== a[g] ? h.width - (c && c.offset || 0) : c && c.spaceWidth || cleverapps.styles.Exclamations.spaceWidth;
h.setPosition(e + l * m / 2, h.height / 2);
e += l * m;
f = Math.max(f, h.height);
h.setScale(0);
h.runAction(new cc.Sequence(new cc.ScaleTo(k,1.36),new cc.ScaleTo(.13,m)))
}
d.setContentSize(e, f);
d.setCascadeOpacityEnabled(!0);
return d
},
splitTextToLines: function(a) {
if (!a)
return [];
var b = a.indexOf(" ");
if (16 >= a.length || -1 === b)
return [a];
var c = a.substr(0, 16).lastIndexOf(" ");
-1 === c && (c = b);
b = [a.substr(0, c)];
return b = b.concat(a.substr(c + 1).trim())
},
splitLineToBlocks: function(a) {
a = a.split("");
if (6 >= a.length)
return a;
var b = a.slice(3, a.length - 3).join("");
b.startsWith(" ") ? b = [" ", b] : b.endsWith(" ") && (b = [b, " "]);
return a.slice(0, 3).concat(b).concat(a.slice(a.length - 3, a.length))
}
})
, ExclamationViewActor = ExclamationViewWords.extend({
getStyles: function() {
return cleverapps.styles.Exclamations.actor
},
showMessage: function(a, b, c) {
b = bundles.exclamations.urls.exclamation_alert_effect;
if (-1 !== cleverapps.exclamation.getCongratulations().indexOf(a)) {
var d = cleverapps.Random.mathChoose(this.getStyles().actorActions);
b = d.sound;
cleverapps.scenes.getRunningScene().actor.animate(d.animation, {
noSFX: !0
})
} else
"message.YouWin" === a ? b = bundles.exclamations.urls.exclamation_win_effect : "message.Shuffle" === a && (b = bundles.exclamations.urls.shuffle_effect);
this.runActions(a, void 0, b, "animation", c)
}
});
cleverapps.overrideColors(cleverapps.styles.COLORS, {
CONGRATS_RED: new cc.Color(255,35,60,255),
CONGRATS_LIGHT_GREEN: new cc.Color(182,248,68,255),
CONGRATS_BLUE: new cc.Color(0,177,249,255),
CONGRATS_ORANGE: new cc.Color(233,117,38,255),
CONGRATS_PURPLE: new cc.Color(194,11,227,255),
CONGRATS_GREEN: new cc.Color(0,209,121,255),
CONGRATS_DARK_RED: new cc.Color(241,15,51,255)
});
cleverapps.styles.Exclamations = {
spaceWidth: 10
};
cleverapps.styles.Exclamations.base = {
width: 650,
height: 200
};
cleverapps.styles.Exclamations.heroes = cleverapps.overrideStyles(cleverapps.styles.Exclamations.base, {
width: 760,
scale: [.8, 1, 1],
sound: {
delay: .6
},
"default": {
color: cleverapps.styles.COLORS.CONGRATS_BLUE
},
warning: {
color: cleverapps.styles.COLORS.CONGRATS_DARK_RED
},
yeah: {
color: cleverapps.styles.COLORS.CONGRATS_RED
},
"super": {
color: cleverapps.styles.COLORS.CONGRATS_LIGHT_GREEN
},
yay: {
color: cleverapps.styles.COLORS.CONGRATS_BLUE
},
lets_go: {
color: cleverapps.styles.COLORS.CONGRATS_ORANGE
},
ohyeah: {
color: cleverapps.styles.COLORS.CONGRATS_PURPLE
},
oh: {
color: cleverapps.styles.COLORS.CONGRATS_GREEN
},
wow: {
color: cleverapps.styles.COLORS.CONGRATS_DARK_RED
}
}, !0);
cleverapps.styles.Exclamations.actor = cleverapps.overrideStyles(cleverapps.styles.Exclamations.base, {
actorActions: [{
animation: Actor.ANIMATIONS.ATTACK1,
sound: bundles.game.urls.sc_welldone
}, {
animation: Actor.ANIMATIONS.ATTACK2,
sound: bundles.game.urls.sc_welldone2
}, {
animation: Actor.ANIMATIONS.ATTACK3,
sound: bundles.game.urls.sc_welldone3
}]
}, !0);
var SceneDecors = {
add: function(a, b) {
if ((b = cleverapps.toArray(b)) && b.length)
return this.createDecors(a, b)
},
createDecors: function(a, b) {
return b.map(function(c) {
if (c.json) {
var d = new cleverapps.Spine(c.json);
d.setAnimation(0, c.animation, !0)
} else
d = new cc.Sprite(c.image);
a.addChild(d, c.zOrder || 0);
c.scale && (c.scale.x ? d.setScale(c.scale.x, c.scale.y) : d.setScale(c.scale));
d.setPositionRound(c);
return d
})
}
};
cleverapps.styles.SceneDecors = {};
cleverapps.SkinManager = function() {
this.active = [];
this.defaultSlots = cleverapps.SkinManager.SKINS.default.slots
}
;
cleverapps.SkinManager.prototype.getLink = function(a) {
if (!this.active.length)
return a;
for (var b = 0; b < this.active.length; b++) {
var c = this.active[b].slots;
if (c = (c = c && c.skinName && c.skinName()) && this.overrides[c] && this.overrides[c][a])
return c
}
return a
}
;
cleverapps.SkinManager.prototype.getSlot = function(a, b) {
for (var c = 0; c < this.active.length; c++)
if (this.active[c] && this.active[c].slots[a]) {
var d = this.active[c].slots[a];
d = "function" === typeof d ? d(b) : d;
if (void 0 !== d)
return d
}
return this.defaultSlots[a] && this.defaultSlots[a](b)
}
;
cleverapps.SkinManager.prototype.update = function() {
this.active = [];
if ("merge" === cleverapps.config.type) {
var a = cleverapps.travelBook.getCurrentExpedition();
a && cleverapps.SkinManager.SKINS[a.id + "_expedition"] && this.active.push(cleverapps.SkinManager.SKINS[a.id + "_expedition"]);
cleverapps.eventManager && cleverapps.eventManager.isActive("xmas_skin") && this.active.push(cleverapps.SkinManager.SKINS.xmas);
cleverapps.eventManager && cleverapps.eventManager.isActive("dragonia") && this.active.push(cleverapps.SkinManager.SKINS.dragonia);
cleverapps.eventManager && cleverapps.eventManager.isActive("dragonia2") && this.active.push(cleverapps.SkinManager.SKINS.dragonia2);
cleverapps.eventManager && cleverapps.eventManager.isActive("undersea") && this.active.push(cleverapps.SkinManager.SKINS.undersea);
cleverapps.eventManager && cleverapps.eventManager.isActive("undersea2") && this.active.push(cleverapps.SkinManager.SKINS.undersea2)
} else
cleverapps.eventManager && cleverapps.eventManager.listCurrentFeatures().forEach(function(b) {
cleverapps.SkinManager.SKINS[b] && this.active.push(cleverapps.SkinManager.SKINS[b])
}, this)
}
;
cleverapps.SkinManager.prototype.getBundles = function() {
var a = [];
this.active.forEach(function(b) {
b && b.bundle && a.push(b.bundle)
});
return 0 < a.length ? a : void 0
}
;
cleverapps.SkinManager.SKINS = {
default: {
slots: {
skinName: function() {
if (cleverapps.travelBook.isExpedition())
return bundles["location_" + cleverapps.travelBook.getCurrentPage().id].meta.units
},
windowDecors: function(a) {
return a.decors
},
windowBg: function(a) {
return a.image
},
spine: function(a) {
return a.json
},
menuBarItem: function() {},
controlButton: function() {},
gameAudio: function() {},
missionIcon: function(a) {
a = Missions[a.type].collectIcon;
return "function" === typeof a ? a() : a
},
missionWindowHero: function() {
return cleverapps.styles.MissionWindow.heroTitleAnimation
},
tulpanScale: function() {
return cleverapps.styles.TulpanCellView.scale
},
removeMissions: function() {},
toolbarDecors: function() {
return []
},
localization: function(a) {
return cleverapps.SkinManager.SKINS.default.localization[a]
},
windowTitle: function(a) {
return a.image
},
missionMarkIcon: function(a) {
return Missions[a.type].collectIcon
},
missionWindowTitleFont: function() {
return cleverapps.styles.FONTS.WINDOW_TITLE_TEXT
},
cardMarkSpine: function(a) {
return a.json
},
unitIcon: function(a) {
return bundles.unit_icons.frames["small_icon_" + a.code + "_" + a.stage] || bundles.unit_icons.frames["small_icon_" + a.code]
},
fog: function() {
return {}
},
outOfBoundaryScale: function() {
return .2
},
whirlwind: function() {
return bundles.fog_animations.jsons.whirlwind
},
hasChessLayer: function() {
return "hustlemerge" === cleverapps.config.name
},
getPoiAnimation: function() {},
sellerPerson: function() {
return "seller"
}
}
}
};
cleverapps.SkinManager.SKINS.halloween = {
bundle: "halloween",
localization: {},
slots: {
localization: function() {},
windowDecors: function(a) {
var b = cleverapps.clone(a.decors || {}, !0);
b.window_liana_left = !1;
b.window_liana_right = !1;
b.window_liana_bottom_left = !1;
b.window_liana_top_left = !1;
b.window_liana_bottom_right = !1;
b.window_liana_top_right = !1;
if (a.window instanceof ConfirmExitWindow)
return b.halloween_window_pumpkin = !0,
b.halloween_window_spider = !0,
b;
b.halloween_window_candle_right = !0;
b.halloween_window_candle_left = "undefined" === typeof UnitsLibraryWindow || "wooden" !== cleverapps.config.ui || !(a.window instanceof UnitsLibraryWindow);
b.halloween_window_lian_left = !0;
b.halloween_window_lian_top = !0;
b.halloween_window_lian_right = !0;
b.halloween_window_lian_bottom = !0;
b.halloween_window_pumpkin = !0;
b.halloween_window_spider = !0;
b.halloween_window_decor_bg_right = !0;
[SalePassWindow, BuildPassWindow, ExpeditionPassWindow].some(function(c) {
return a.window instanceof c
}) && (b.halloween_window_lian_top = !1,
b.halloween_window_pumpkin = !1);
return b
},
menuBarItem: function() {
return cleverapps.styles.SceneDecors.halloween_menubar
},
menuBarLevelItem: function() {
return cleverapps.styles.SceneDecors.halloween_menubar_level
}
}
};
var NoConnectionWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.NoConnectionWindow;
this._super({
title: "NoConnectionWindow.title",
name: "noconnectionwindow",
content: this.getContent(),
button: {
width: a.button.width,
height: a.button.height,
text: "OK",
onPressed: function() {
this.close()
}
.bind(this)
}
})
},
getContent: function() {
var a = cleverapps.styles.NoConnectionWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.animation);
var c = new cleverapps.Spine(bundles.noconnection_window.jsons.no_connection_json);
b.addChild(c);
c.setPositionRound(b.width / 2, b.height / 2);
c.setAnimation(0, "animation", !0);
c = cleverapps.UI.generateTTFText("RestartWindow.AnErrorOccured", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
c.setDimensions(a.text.width, 0);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
return new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
listBundles: function() {
return ["noconnection_window"]
}
});
cleverapps.styles.NoConnectionWindow = {
width: 500,
height: 800,
margin: 30,
animation: {
width: 400,
height: 400
},
text: {
width: 480
},
button: {
width: 200,
height: 100
}
};
cleverapps.UI.ZoomHandler = function(a, b) {
b = b || {};
this.target = a;
this.minZoom = b.minZoom || .8;
this.maxZoom = b.maxZoom || 2;
this.resolutionScale = cleverapps.resolution.scale;
new PointerHandler(this.target,{
onMouseZoom: function(c) {
var d = 1;
.3 >= this.target.zoom ? d = .3 : .5 >= this.target.zoom && (d = .5);
this.target.stopScrollAction();
this.setZoom(this.target.zoom + c * d)
}
.bind(this),
onPinchZoom: cc.sys.capabilities.touches && function(c) {
this.target.stopScrollAction();
this.setZoom(this.target.zoom + c)
}
.bind(this)
})
}
;
cleverapps.UI.ZoomHandler.prototype.normalizeZoom = function(a) {
a = Math.round(100 * a) / 100;
return Math.min(Math.max(a, this.minZoom), this.maxZoom)
}
;
cleverapps.UI.ZoomHandler.prototype.normalizeResolutionScale = function(a, b) {
var c = a * this.resolutionScale / cleverapps.resolution.scale;
b || (c = this.normalizeZoom(c));
this.resolutionScale *= a / c;
return c
}
;
cleverapps.UI.ZoomHandler.prototype.setZoom = function(a, b) {
a = b ? a : this.normalizeZoom(a);
this.target.zoom = this.normalizeResolutionScale(a, b);
this.target.zoomScale = this.target.zoom * this.resolutionScale / cleverapps.resolution.scale;
this.target.centerNode.setScale(this.target.zoomScale);
this.target.updateVisibility();
this.target.calcBorders();
this.target.scrollHandler.afterContainerScale();
this.target.onUpdateZoomListener()
}
;
cleverapps.UI.ZoomHandler.ZOOM_DIRECTION_IN = 0;
cleverapps.UI.ZoomHandler.ZOOM_DIRECTION_OUT = 1;
cc.ZoomAction = cc.ActionInterval.extend({
ctor: function(a, b) {
cc.ActionInterval.prototype.ctor.call(this);
this._params = b;
cc.ActionInterval.prototype.initWithDuration.call(this, a)
},
startWithTarget: function(a) {
cc.ZoomAction._UID++;
this._UID = cc.ZoomAction._UID;
cc.ActionInterval.prototype.startWithTarget.call(this, a);
this._startZoom = this.getZoomHandler().target.zoom;
this._targetZoom = this._params.zoom;
this._params.maxZoom && this._targetZoom > this._params.maxZoom && (this._targetZoom = this._params.maxZoom);
this._params.direction === cleverapps.UI.ZoomHandler.ZOOM_DIRECTION_IN && this._targetZoom < this._startZoom && (this._targetZoom = this._startZoom);
this._params.direction === cleverapps.UI.ZoomHandler.ZOOM_DIRECTION_OUT && this._targetZoom > this._startZoom && (this._targetZoom = this._startZoom);
this._params.zoomFocus && (this._zoomFocusStartPosition = this.target.getContainerPosition(),
this._zoomFocusTargetPosition = this.target.targetToPoint(this._params.zoomFocus, this._params.focusCenterOffset))
},
clone: function() {
return new cc.ZoomAction(this._duration,this._params)
},
getZoomHandler: function() {
return this.target.zoomHandler
},
stop: function() {
this.getZoomHandler()._zoomRunning = !1;
this.target.onUpdateZoomListener()
},
update: function(a) {
cc.ZoomAction._UID === this._UID && (a = this._computeEaseTime(a),
this._zoomFocusTargetPosition && this.target.scrollToPoint(this.target.normalizePoint(cc.pAdd(this._zoomFocusStartPosition, cc.pMult(cc.pSub(this._zoomFocusTargetPosition, this._zoomFocusStartPosition), a)))),
this.getZoomHandler().setZoom(this._startZoom + (this._targetZoom - this._startZoom) * a, !0),
this.getZoomHandler()._zoomRunning = !0)
}
});
cc.ZoomAction._UID = 0;
var Rocket = cc.Node.extend({
ctor: function(a, b, c) {
this._super();
this.startCell = a;
this.targetCell = b;
this.addChild(c.rocket);
this.setVisible(!1);
b = 0;
c.startDX && (b += c.startDX);
cleverapps.styles.Rocket.startDX && (b += cleverapps.styles.Rocket.startDX);
var d = 0;
c.startDY && (d += c.startDY);
cleverapps.styles.Rocket.startDY && (d += cleverapps.styles.Rocket.startDY);
this.setPositionRound(BaseCellView.alignInTheGrid(a.x, a.y));
this.setPosition(this.getPosition().x + b, this.getPosition().y + d);
this.aim(c)
},
aim: function(a) {
this.targetPos = BaseCellView.alignInTheGrid(this.targetCell.x, this.targetCell.y);
this.prevPos = this.getPosition();
this.animateFly(a)
},
animateFly: function(a) {
var b = cleverapps.styles.Rocket, c, d = BaseCellView.alignInTheGrid(this.targetCell.x, this.targetCell.y);
if (a.plane) {
this.prevPos = c = BaseCellView.alignInTheGrid(this.startCell.x, this.startCell.y);
b = 3 * cleverapps.styles.BaseCellView.CELL_SIZE_PX;
this.directionAngle = cleverapps.styles.Rocket.rotation;
var e = (90 + this.directionAngle) / 180 * Math.PI;
c = cc.p(c.x + b * Math.cos(e), c.y + b * Math.sin(e));
e = .5 * cc.pDistance(d, c);
var f = cc.pMidpoint(d, c)
, g = cc.pSub(d, f);
b = cc.pMult(cc.pNormalize(cc.pPerp(g)), -e);
b = cc.pAdd(f, b);
var h = cleverapps.styles.BaseCellView.CELL_SIZE_PX * Field.SIZE;
if (b.x > h || 0 > b.x || b.y > h || 0 > b.y)
b = cc.pMult(cc.pNormalize(cc.pPerp(g)), e),
b = cc.pAdd(f, b)
} else
c = this.getPosition(),
c = cc.p(c.x, Math.max(c.y, d.y) + b.flyUp),
b = cc.p(d.x, c.y),
e = Math.abs(this.targetCell.y - this.startCell.y) * cleverapps.styles.BaseCellView.CELL_SIZE_PX,
this.targetCell.y > this.startCell.y && 1 >= Math.abs(this.targetCell.x - this.startCell.x) ? b.x = this.startCell.x < Field.SIZE / 2 ? b.x + e : b.x - e : this.startCell.x === this.targetCell.x && this.startCell.y > this.targetCell.y && (c.y -= e / 2,
c.x = this.startCell.x < Field.SIZE / 2 ? c.x + e / 2 : c.x - e / 2,
b = cc.p(c.x, d.y + cleverapps.styles.BaseCellView.CELL_SIZE_PX));
this.runAction(new cc.Sequence(new cc.DelayTime(a.delay),new cc.CallFunc(function() {
this.scheduleUpdate();
this.setVisible(!0);
a.onLaunch()
}
.bind(this)),(new cc.BezierTo(a.duration,[c, b, d])).easing(cc.easeIn(1)),new cc.CallFunc(function() {
this.unscheduleUpdate();
a.onArrive(function() {
this.runAction(new cc.RemoveSelf)
}
.bind(this))
}
.bind(this))))
},
update: function(a) {
this._super(a);
this.setRotation(180 * Math.atan2(this.x - this.prevPos.x, this.y - this.prevPos.y) / Math.PI + (this.directionAngle || 0));
this.prevPos = this.getPosition()
}
});
cleverapps.styles.Rocket = {
flyUp: 150,
rotation: 30
};
var UseGoldButton = cleverapps.UI.Button.extend({
ctor: function(a) {
this.price = a.price;
this.source = a.source;
this.onFilterHandler = a.filter || function() {
return !0
}
;
this.onClickHandler = function() {
a.onClicked()
}
;
this.eventName = a.eventName;
this.confirmWindowOptions = a.confirmWindowOptions;
if (this.price && a.canCoins) {
var b = cleverapps.missionManager.findByType(Mission.TYPE_BOOSTTIME);
b && MissionManager.hasProperParent(b) && (this.useCoins = !0,
this.price *= UseGoldButton.RUBY_COINS_RATE)
} else
this.price && a.useCoins && (this.useCoins = !0);
this._super({
width: a.width,
height: a.height,
text: this.getText(a),
onClicked: this.onClick.bind(this),
type: a.type,
disabled: a.disabled
});
this.adviceTarget = a.adviceTarget
},
getText: function(a) {
if (!this.price)
return "UseGoldButton.free" + (a.freeIcon || "");
if (a.text)
return a.text;
var b = this.useCoins ? "@@" + this.price : "$$" + this.price;
a.speedUp && (b += ">>");
return b
},
takeCurrency: function() {
var a = this.source || this;
return this.useCoins ? cleverapps.user.spendSoft(this.eventName, this.price, {
source: a
}) : cleverapps.user.spendHard(this.eventName, this.price)
},
onClick: function() {
if (this.confirmWindowOptions)
this.showConfirmWindow();
else if (this.onFilterHandler() && this.takeCurrency())
this.onClickHandler()
},
showConfirmWindow: function() {
var a = function() {
new ConfirmSpeedUpWindow({
price: this.confirmWindowOptions.price,
timeLeft: this.confirmWindowOptions.timeLeft,
totalDuration: this.confirmWindowOptions.totalDuration,
eventName: this.eventName,
callback: this.onClickHandler
})
}
.bind(this);
cleverapps.focusManager.isFocused() ? a() : cleverapps.focusManager.display({
focus: "ConfirmSpeedUpWindow",
action: function(b) {
a();
cleverapps.focusManager.onceNoWindowsListener = b
}
})
}
});
UseGoldButton.RUBY_COINS_RATE = 5;
var AdBubble = function(a) {
cleverapps.EventEmitter.call(this);
this.onSuccess = a.onSuccess;
this.canClick = a.canClick;
this.limit = a.limit;
this.skin = a.skin;
cleverapps.adsLimits.on("update", this.onAdsUpdate.bind(this), this);
this.onAdsUpdate()
};
AdBubble.prototype = Object.create(cleverapps.EventEmitter.prototype);
AdBubble.prototype.constructor = AdBubble;
AdBubble.prototype.onClick = function() {
this.watchAd()
}
;
AdBubble.prototype.watchAd = function() {
!this._isActive || this.canClick && !this.canClick() || cleverapps.rewardedAdsManager.playRewarded(this.limit, function() {
cleverapps.adsLimits.watch(this.limit);
this.trigger("pop");
this.onSuccess()
}
.bind(this))
}
;
AdBubble.prototype.setActive = function(a) {
this._isActive !== a && (this._isActive = a,
this.trigger("update", this._isActive))
}
;
AdBubble.prototype.isActive = function() {
return this._isActive
}
;
AdBubble.prototype.onAdsUpdate = function() {
this.setActive(this.isAdAvailable());
this.trigger("adsUpdate")
}
;
AdBubble.prototype.isAdAvailable = function() {
return cleverapps.adsLimits.state(this.limit) === AdsLimits.STATE_READY
}
;
AdBubble.prototype.getSkin = function() {
return this.skin || "regular"
}
;
AdBubble.prototype.onExit = function() {
runCleaners(this);
this.purge()
}
;
var AdBubbleView = cleverapps.Spine.extend({
ctor: function(a) {
this.adBubble = a;
this._super(bundles.ads_bubble.jsons.ads_bubble_json);
this.setContentSize2(cleverapps.styles.AdBubbleView);
this.spine.setPositionRound(this.width / 2, this.height / 2);
this.setSkin(this.adBubble.getSkin());
cleverapps.UI.onClick(this, this.adBubble.onClick.bind(this.adBubble));
cleverapps.UI.applyHover(this);
this.adBubble.on("update", this.createListener(this.updateVisibility.bind(this)), this);
this.adBubble.on("pop", this.createListener(this.pop.bind(this)), this);
this.updateVisibility(this.adBubble.isActive())
},
updateVisibility: function(a) {
a ? this.show() : this.hide()
},
hide: function() {
this.setVisible(!1)
},
show: function() {
this.setCompleteListener();
this.setAnimationAndIdleAfter("showup", "idle")
},
pop: function() {
this.setAnimation(0, "hide", !1);
this.setCompleteListenerOnce(function() {
this.setVisible(!1)
}
.bind(this))
},
onExit: function() {
this.adBubble.onExit()
}
});
cleverapps.styles.AdBubbleView = {
width: 150,
height: 150
};
var RewardTypes = {};
RewardTypes.hard = RewardTypes.rubies = {
controls: "MenuBarGoldItem",
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION,
getIcon: function() {
return bundles.reward_icons.frames.reward_gold_png
},
getSmallIcon: function() {
return bundles.reward_icons.frames.gold_small_png
},
handler: function(a, b) {
cleverapps.isNumber(a) || (cleverapps.throwAsync("RewardTypes.hard - " + a),
a = 0);
cleverapps.user.earnHard(b.event, a, !0);
return function() {
cleverapps.user.onChangeGold()
}
}
};
RewardTypes.soft = {
controls: "MenuBarCoinsItem",
bundle: "episode_0",
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION,
getIcon: function() {
return bundles.reward_icons.frames.reward_coin_png
},
getSmallIcon: function() {
return bundles.reward_icons.frames.coin_small_png
},
handler: function(a, b) {
cleverapps.isNumber(a) || (cleverapps.throwAsync("RewardTypes.soft - " + a),
a = 0);
cleverapps.user.setSoft(cleverapps.user.soft + a, !0, b);
return function() {
cleverapps.user.trigger("changeSoft")
}
}
};
RewardTypes.exp = {
controls: "MenuBarGameLevelItem",
flyingAnimation: "merge" === cleverapps.config.type && Reward.JUMP_COLLECT_ANIMATION,
getIcon: function() {
return cleverapps.skins.getSlot("reward_exp_png") || bundles.reward_icons.frames.reward_exp_png
},
getSmallIcon: function() {
return cleverapps.skins.getSlot("reward_exp_small_png") || bundles.reward_icons.frames.reward_exp_small_png
},
handler: function(a) {
var b = cleverapps.exp.isAvailable();
cleverapps.isNumber(a) || (cleverapps.throwAsync("RewardTypes.exp - " + a),
a = 0);
b && cleverapps.exp.setExp(cleverapps.exp.getExp() + a, !0);
return function() {
if (b)
cleverapps.exp.onChange()
}
}
};
RewardTypes.boosters = {
icon: {},
smallIcon: {},
getIcon: function(a) {
return this.icon[a.id]
},
getSmallIcon: function(a) {
return this.smallIcon[a.id]
},
parse: function(a, b) {
return Object.keys(a).filter(function(c) {
return a[c]
}).map(function(c) {
var d = c;
cleverapps.Boosters.isType(c) && (d = cleverapps.boosters.getIdByType(c));
return new Reward("boosters",{
id: d,
amount: a[c]
},b)
})
},
handler: function(a) {
var b = 0 < a.amount
, c = cleverapps.boosters.getBoosterById(a.id);
b && (c.inRewardAnimation = !0,
cleverapps.boosters.add(a.id, a.amount, !0));
return function() {
b && (c.inRewardAnimation = !1,
cleverapps.boosters.onChange())
}
}
};
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_CELL] = bundles.reward_icons.frames.cellbooster;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_LINE] = bundles.reward_icons.frames.linebooster;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_COLOR] = bundles.reward_icons.frames.colorbooster;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_HINT] = bundles.reward_icons.frames.hint_icon_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_WILDCARD] = bundles.reward_icons.frames.joker_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_BRUSH] = bundles.reward_icons.frames.pot;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_DISCOVER] = bundles.reward_icons.frames.hat;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_COMBO] = bundles.reward_icons.frames.heroes_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_MOVES] = bundles.reward_icons.frames.moves_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_MULTICOLOR] = bundles.reward_icons.frames.multicolor_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_MAGNET] = bundles.reward_icons.frames.magnet_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_DICE] = bundles.reward_icons.frames.dice_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_JOKERS] = bundles.reward_icons.frames.joker_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_HIGHLIGHT] = bundles.reward_icons.frames.highlight;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_EYE] = bundles.reward_icons.frames.eye;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_SHUFFLE] = bundles.reward_icons.frames.shuffle;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_MAGNIFIER] = bundles.reward_icons.frames.hint;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_UNDO] = bundles.reward_icons.frames.booster_undo_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_TILE_SHUFFLE] = bundles.reward_icons.frames.booster_tile_shuffle_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_VACUUM] = bundles.reward_icons.frames.booster_vacuum_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_REPLACE_ALL] = bundles.reward_icons.frames.booster_replace_all_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_CLEAR_PIECES] = bundles.reward_icons.frames.booster_clear_pieces_png;
RewardTypes.boosters.icon[cleverapps.Boosters.TYPE_UNDO_PIECE] = bundles.reward_icons.frames.booster_undo_piece_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_CELL] = bundles.reward_icons.frames.cellbooster_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_LINE] = bundles.reward_icons.frames.linebooster_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_COLOR] = bundles.reward_icons.frames.colorbooster_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_HINT] = bundles.reward_icons.frames.hint_icon_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_WILDCARD] = bundles.reward_icons.frames.joker_small_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_BRUSH] = bundles.reward_icons.frames.pot_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_DISCOVER] = bundles.reward_icons.frames.hat_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_COMBO] = bundles.reward_icons.frames.heroes_small_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_MOVES] = bundles.reward_icons.frames.moves_small_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_MULTICOLOR] = bundles.reward_icons.frames.multicolor_small_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_MAGNET] = bundles.reward_icons.frames.magnet_small_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_DICE] = bundles.reward_icons.frames.dice_small_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_JOKERS] = bundles.reward_icons.frames.joker_small_png;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_HIGHLIGHT] = bundles.reward_icons.frames.highlight_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_EYE] = bundles.reward_icons.frames.eye_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_MAGNIFIER] = bundles.reward_icons.frames.hint_small;
RewardTypes.boosters.smallIcon[cleverapps.Boosters.TYPE_SHUFFLE] = bundles.reward_icons.frames.shuffle_small;
RewardTypes.randomBoosters = {
getIcon: function() {
return bundles.reward_icons.frames.boosters_common_small_png
},
getSmallIcon: function() {
return bundles.reward_icons.frames.boosters_common_small_png
},
handler: function() {
return function() {}
}
};
RewardTypes.moves = {
getIcon: function() {
return bundles.reward_icons.frames.moves_png
},
getSmallIcon: function() {
return bundles.reward_icons.frames.moves_small_png
},
handler: function() {
return function() {}
}
};
RewardTypes.battlePass = {
bundle: "passbuyticket_window",
getAnimation: function(a) {
return {
json: bundles.passbuyticket_window.jsons[a.missionType === Mission.TYPE_SALEPASS ? "purchase_ticket_json" : "ticket_json"],
animation: "animation"
}
},
handler: function() {
return function() {}
}
};
RewardTypes.mission = {
icon: {},
smallIcon: {},
flyingAnimation: "merge" === cleverapps.config.type && Reward.JUMP_COLLECT_ANIMATION,
getIcon: function(a) {
a = Mission.ParseCompoundType(a.missionType).type;
return this.icon[a] || Mission.getCollectIcon(a)
},
getSmallIcon: function(a) {
a = Mission.ParseCompoundType(a.missionType).type;
return this.smallIcon[a]
},
parse: function(a, b) {
return cleverapps.missionManager.findRunningMission(a.missionType) ? [new Reward("mission",a,b)] : []
},
handler: function(a) {
var b = cleverapps.missionManager.findByType(a.missionType);
b && !b.isRunning() && (b = void 0);
b && (b.isPassMission() || b.isTreasureSearchMission() ? cleverapps.missionManager.dispatchEvent(b, a) : b.isSlotMachineMission() ? b.logic.slotMachine.setTickets(b.logic.slotMachine.tickets + a.amount, !0) : b.isPinballMission() ? b.logic.updateChips(a.amount) : b.update(a.amount, void 0, !0));
return cleverapps.once(function() {
b && (b.onUpdateMission(a.amount),
b.isSlotMachineMission() && b.logic.slotMachine.trigger("updateTickets"))
})
}
};
RewardTypes.mission.icon[Mission.TYPE_SOFTFEAST] = bundles.reward_icons.frames.reward_coin_png;
RewardTypes.mission.icon[Mission.TYPE_SLOT_MACHINE] = bundles.reward_icons.frames.slot_machine_ticket;
RewardTypes.kraken = {
flyingAnimation: Reward.NO_ANIMATION,
getIcon: function() {
return bundles.reward_icons.frames.tentacle_png
},
handler: function() {
Game.currentGame.monstersPlanner.spawnToAllSlots();
return function() {}
}
};
RewardTypes.clover = {
getIcon: function() {
return Game.currentGame && Game.currentGame.secondaryMission && Game.currentGame.secondaryMission.getIcon()
},
getCollectRewardSound: function() {
return Game.currentGame && Game.currentGame.secondaryMission && Game.currentGame.secondaryMission.getCollectRewardSound()
},
parse: function(a, b) {
return Game.currentGame && Game.currentGame.secondaryMission && Game.currentGame.secondaryMission.isRunning() ? [new Reward("clover",a,b)] : []
},
handler: function(a) {
var b = Game.currentGame && Game.currentGame.secondaryMission;
return RewardTypes.mission.handler({
missionType: b && b.type,
amount: a
})
}
};
RewardTypes.lantern = {
flyingAnimation: Reward.CUSTOM_COLLECT,
parse: function(a, b) {
return Game.currentGame && Game.currentGame.level && Lantern.GetCurrentStreak(Game.currentGame.level) ? [new Reward("lantern",a,Object.assign({
currentStreak: Lantern.GetCurrentStreak(Game.currentGame.level)
}, b))] : []
},
getCustomRewardIcon: function() {
return bundles.lantern.jsons.lantern_reward_json
},
getCustomRewardIconAnimation: function(a) {
a = a || {};
return {
before: "idle_" + String(a.currentStreak - 1),
during: "stage_" + String(a.currentStreak),
after: "idle_" + String(a.currentStreak)
}
},
getCustomRewardOpenSound: function() {
return bundles.lantern.urls.lantern_win_effect
},
getCustomRewardProgress: function() {
return bundles.lantern.jsons.lantern_progress_json
},
getCustomRewardProgressAnimation: function(a) {
return RewardTypes.lantern.getCustomRewardIconAnimation(a)
},
handler: function() {
return function() {}
}
};
RewardTypes.cup = {
icon: {},
smallIcon: {},
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION,
getIcon: function(a) {
return this.icon[a.type]
},
getSmallIcon: function(a) {
return this.smallIcon[a.type]
},
handler: function(a) {
switch (a.type) {
case CupsConfig.TYPE_DAILY:
var b = cleverapps.dailyCup;
break;
case CupsConfig.TYPE_WEEKLY:
b = cleverapps.weeklyCup;
break;
case CupsConfig.TYPE_CLAN:
b = cleverapps.clanCup
}
b && (b.addAmount(a.amount),
b.innerCup && b.innerCup.addAmount(a.amount));
return function() {}
}
};
RewardTypes.joker = {
getIcon: function() {
return bundles.reward_icons.frames.stickers_joker_png
},
handler: function() {
return function() {}
}
};
RewardTypes.noAds = {
getIcon: function() {
return bundles.reward_icons.frames.noads_png
},
handler: function() {
cleverapps.noAds.enable()
}
};
RewardTypes.growthFund = {
getIcon: function() {
return bundles.reward_icons.frames.growth_fund_png
},
handler: function() {
cleverapps.growthFund && !cleverapps.growthFund.isBought() && cleverapps.growthFund.processBought(!0)
}
};
RewardTypes.pinballTickets = {
getIcon: function() {
return bundles.reward_icons.frames.pinball_ticket_png
},
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION,
handler: function(a) {
cleverapps.missionManager.findByType(Mission.TYPE_PINBALL).logic.updateTickets(a.amount || 0);
return function() {}
}
};
RewardTypes.pinballChips = {
getIcon: function() {
return bundles.reward_icons.frames.pinball_token_png
},
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION,
handler: function(a) {
cleverapps.missionManager.findByType(Mission.TYPE_PINBALL).logic.updateChips(a || 0);
return function() {}
}
};
RewardTypes.metaStar = {
getIcon: function() {
return bundles.reward_icons.frames.simple_star_png
},
handler: function(a) {
cleverapps.meta.changeStars(a, !0);
return function() {
cleverapps.meta.onChangeStars(a)
}
}
};
RewardTypes.incLevel = {
invisible: !0,
handler: function() {
cleverapps.user.incLevel();
return function() {}
}
};
RewardTypes.cup.icon[CupsConfig.TYPE_CLAN] = bundles.reward_icons.frames.cup_png;
RewardTypes.cup.smallIcon[CupsConfig.TYPE_CLAN] = bundles.reward_icons.frames.cup_small_png;
var Timer = cleverapps.Layout.extend({
ctor: function(a, b, c) {
c = c || {};
var d = cleverapps.styles.Timer
, e = c.width || d.width
, f = d.height
, g = new cc.Scale9Sprite(c.timerBg || bundles.big_timer.frames.big_timer_bg_png);
g.setContentSize2(e, f);
c = new cc.Sprite(c.timerIcon || bundles.big_timer.frames.big_timer_png);
c.setLocalZOrder(1);
a = this.countDown = 0 >= a ? a : new cleverapps.CountDown(a,{
onFinish: b
});
a = new cleverapps.CountDownView(a,{
font: cleverapps.styles.FONTS.TIMER_TEXT
});
g.addChild(a);
a.setPositionRound(d.timer);
a.fitTo(e - 2 * d.padding.x, f - 2 * d.padding.y);
this._super([c, g], {
margin: d.margin,
direction: cleverapps.UI.HORIZONTAL
})
},
isOver: function() {
return this.countDown.getTimeLeft ? 0 >= this.countDown.getTimeLeft() : !0
}
});
cleverapps.styles.Timer = {
width: 260,
height: 60,
margin: -40,
timer: {
x: {
align: "center",
dx: 16
},
y: {
align: "center",
dy: 0
}
},
padding: {
x: 36,
y: 1
},
icon: {
x: {
align: "left",
dx: -25
},
y: {
align: "center",
dy: 3
}
}
};
var TravelBook = function() {
this.pages = [new ExpeditionPage(TravelBook.PAGES[0])];
this.currentPage = this.pages[0]
};
TravelBook.prototype.init = function() {
(cleverapps.config.lives || cleverapps.config.energy) && Meta.SLOTS.forEach(function(c) {
cleverapps.livesBySlots[c].onFullListener = this.onLivesFull.bind(this, c)
}, this);
var a = TravelBook.PAGES.slice(1).map(function(c) {
return new ExpeditionPage(c)
})
, b = this.pages.find(function(c) {
return c.isMain()
});
this.pages = [b].concat(a);
this.updatePages();
this.currentPage = b
}
;
TravelBook.prototype.listDisplayedPages = function() {
this.updatePages();
var a = function(c) {
return c.isPermanent() ? 100 : c.isSeasonal() ? 10 : 1
}
, b = this.pages.filter(function(c) {
return !c.isMain() && c.isActive()
}).sort(function(c, d) {
return a(d) - a(c)
});
b = [this.pages.find(function(c) {
return c.isMain()
})].concat(b);
b.length < TravelBook.DISPLAYED_PAGES && (b = b.concat(this.listUpcoming().slice(0, TravelBook.DISPLAYED_PAGES - b.length)));
return b
}
;
TravelBook.prototype.onLivesFull = function(a) {
this.pages.filter(function(b) {
return b.slot === a
}).forEach(function(b) {
b.planEvent(ExpeditionPage.EVENT_ENERGY, Date.now());
b.setAttentionEvent(ExpeditionPage.EVENT_ENERGY)
})
}
;
TravelBook.prototype.gotoMainScene = function(a) {
cleverapps.config.demoMode ? cleverapps.unitsDemoMode.gotoUnitsDemoScene(a) : this.pages.find(function(b) {
return b.isMain()
}).gotoExpedition(a)
}
;
TravelBook.prototype.getPageById = function(a) {
return this.pages.find(function(b) {
return b.id === a
})
}
;
TravelBook.prototype.setCurrentPage = function(a) {
this.currentPage = a
}
;
TravelBook.prototype.getCurrentPage = function() {
return this.currentPage
}
;
TravelBook.prototype.listAvailablePages = function() {
return this.pages.filter(function(a) {
return cleverapps.user.checkAvailable(a.available, {
ignoreProgress: !0
}) && (!a.missionType || cleverapps.missionManager.canCreateType(a.missionType))
})
}
;
TravelBook.prototype.getCurrentExpedition = function() {
return this.currentPage.isMain() ? void 0 : this.currentPage
}
;
TravelBook.prototype.isExpedition = function() {
return !this.currentPage.isMain()
}
;
TravelBook.prototype.updatePages = function() {
this.pages.forEach(function(a) {
a.updateState()
})
}
;
TravelBook.prototype.onUpdateExpedition = function() {
this.updateBuilt();
this.currentPage.setNew(!1)
}
;
TravelBook.prototype.onNewExpeditionMission = function(a) {
var b = this.pages.find(function(c) {
return c.missionType === a
});
this.startNewExpedition(b)
}
;
TravelBook.prototype.startNewExpedition = function(a) {
this.pages.filter(function(b) {
return b.slot === a.slot
}).forEach(function(b) {
b.resetEvents()
});
a.setNew(!0);
a.setAttentionEvent(ExpeditionPage.EVENT_START);
cleverapps.forces.clearForce(Forces.TRAVEL_BOOK.id)
}
;
TravelBook.prototype.updateBuilt = function() {
var a = Map2d.currentMap.workers.findLeastBusy(Buildable);
a ? (a = Date.now() + a.getTimeLeft(),
this.currentPage.planEvent(ExpeditionPage.EVENT_BUILT, a),
this.currentPage.setAttentionEvent(ExpeditionPage.EVENT_BUILT)) : this.currentPage.planEvent(ExpeditionPage.EVENT_BUILT, 0)
}
;
TravelBook.prototype.listUpcoming = function() {
var a = this.pages.filter(function(e) {
return e.isActive()
}).map(function(e) {
return e.slot
})
, b = this.pages.find(function(e) {
return e.isUpcoming() && !a.includes(e.slot) && e.isPermanent()
})
, c = this.pages.find(function(e) {
return e.isUpcoming() && !a.includes(e.slot) && e.isSeasonal()
})
, d = this.pages.find(function(e) {
return e.isUpcoming() && !a.includes(e.slot) && !e.isSeasonal() && !e.isPermanent()
});
return [b, d, c].filter(Boolean)
}
;
TravelBook.prototype.findExpeditionByMission = function(a) {
return this.pages.find(function(b) {
return a && b.missionType === a.type
})
}
;
TravelBook.prototype.needsAttention = function() {
return this.pages.some(function(a) {
return a.attention
})
}
;
TravelBook.prototype.isChosenForForce = function(a) {
return this.chosenForForce === a
}
;
TravelBook.prototype.chooseForce = function() {
cleverapps.forces.isShown(Forces.TRAVEL_BOOK.id) || (this.chosenForForce = this.pages.filter(function(a) {
return a.isActive() && a.isNew && (void 0 === a.missionType || cleverapps.missionManager.findRunningMission(a.missionType))
}).sort(function(a, b) {
return b.getStartTime() - a.getStartTime()
})[0])
}
;
TravelBook.DISPLAYED_PAGES = 4;
TravelBook.AVAILABLE = {
level: 6
};
TravelBook.PAGES = [{
id: "main",
prefix: "main",
slot: Meta.SLOT_MAIN,
location: "0"
}];
TravelBook.SEASONAL_PAGES = [{
id: "xmas",
prefix: "xm",
missionType: Mission.TYPE_XMAS_EXPEDITION,
name: "XmasExpedition",
location: "xmas",
noOrdersBuyout: !0,
available: {
level: 7,
projectName: ["mergecraft", "wondermerge", "fairy"]
},
feature: "xmas_expedition",
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_EXPEDITION_FEAST],
offers: [{
id: Offers.TYPES.XMAS,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.XmasPack,
bundle: "xmas_offer",
hero: {
code: "xmpack",
stage: 0
}
}]
}, {
id: "halloween",
prefix: "hl",
missionType: Mission.TYPE_HALLOWEEN_EXPEDITION,
name: "HalloweenExpedition",
location: "halloween",
energy: !0,
feature: "halloween_expedition",
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_SNAIL_FEAST],
offers: [{
id: Offers.TYPES.HALLOWEEN,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.Dragonia2Pack,
bundle: "halloween_offer",
hero: {
code: "dr2dragonpack",
stage: 0
}
}, {
id: Offers.TYPES.SNAILFEAST_HALLOWEEN,
base: Offers.TYPES.SNAILFEAST
}]
}, {
id: "easter",
prefix: "es",
missionType: Mission.TYPE_EASTER_EXPEDITION,
name: "EasterExpedition",
location: "easter",
feature: "easter_expedition",
available: {
level: 6,
projectName: ["mergecraft", "wondermerge", "fairy"]
},
energy: !0,
noOrdersBuyout: !0,
childMissions: [{
type: Mission.TYPE_EXPEDITION_PASS,
startFog: "fog1",
rulesOptions: !1
}],
offers: [{
id: Offers.TYPES.EASTER,
base: Offers.TYPES.EXPEDITION,
fog: "fog2",
cooldown: cleverapps.config.debugMode ? "2 minutes" : "24 hours",
reward: RewardsConfig.EasterPack,
bundle: "easter_offer"
}]
}, {
id: "china",
prefix: "ch",
missionType: Mission.TYPE_CHINA_EXPEDITION,
name: "ChinaExpedition",
location: "china",
noOrdersBuyout: !0,
feature: "china_expedition",
available: {
level: 6,
projectName: ["mergecraft", "wondermerge", "fairy"]
},
energy: !0,
childMissions: [{
type: Mission.TYPE_EXPEDITION_PASS,
startFog: "fog1",
rulesOptions: !1
}],
offers: [{
id: Offers.TYPES.CHINA,
base: Offers.TYPES.EXPEDITION,
fog: "fog2",
cooldown: cleverapps.config.debugMode ? "2 minutes" : "24 hours",
reward: RewardsConfig.ChinaPack,
bundle: "china_offer"
}]
}, {
id: "blackfriday",
prefix: "bl",
missionType: Mission.TYPE_BLACKFRIDAY_EXPEDITION,
name: "BlackfridayExpedition",
location: "blackfriday",
energy: !0,
feature: "blackfriday_expedition",
available: {
level: 7.5
},
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_SNAIL_FEAST],
offers: [{
id: Offers.TYPES.BLACKFRIDAY,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.BlackFridayPack,
bundle: "blackfriday_offer",
hero: {
code: "dr2dragonpack",
stage: 0
}
}, {
id: Offers.TYPES.SNAILFEAST_BLACKFRIDAY,
base: Offers.TYPES.SNAILFEAST
}]
}].map(function(a) {
return Object.assign({
slot: Meta.EXPEDITION_SLOT1,
semaphore: Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT1
}, a)
});
TravelBook.ONESHOT_PAGES = [{
id: "dragonia",
prefix: "dr",
missionType: Mission.TYPE_DRAGONIA_EXPEDITION,
name: "DragoniaExpedition",
location: "dragonia",
noOrdersBuyout: !0,
duration: "20 days",
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_EXPEDITION_FEAST],
offers: [Offers.TYPES.EXPEDITION]
}, {
id: "rapunzel",
prefix: "rp",
missionType: Mission.TYPE_RAPUNZEL_EXPEDITION,
name: "RapunzelExpedition",
location: "rapunzel",
duration: "6 days",
noOrdersBuyout: !0,
energy: !0,
childMissions: [{
type: Mission.TYPE_EXPEDITION_PASS,
startFog: "fog1",
rulesOptions: !1
}],
offers: [{
id: Offers.TYPES.RAPUNZEL,
base: Offers.TYPES.EXPEDITION,
fog: "fog2",
cooldown: cleverapps.config.debugMode ? "2 minutes" : "24 hours",
reward: RewardsConfig.RapunzelPack,
bundle: "rapunzel_offer"
}]
}, {
id: "undersea",
prefix: "sea",
missionType: Mission.TYPE_UNDERSEA_EXPEDITION,
name: "UnderseaExpedition",
location: "undersea",
noOrdersBuyout: !0,
duration: "20 days",
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_EXPEDITION_FEAST],
offers: [{
id: Offers.TYPES.UNDERSEA,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.UnderseaPack,
bundle: "undersea_offer",
hero: {
code: "underseapack",
stage: 0
}
}]
}, {
id: "dragonia2",
prefix: "dr2",
missionType: Mission.TYPE_DRAGONIA2_EXPEDITION,
name: "Dragonia2Expedition",
location: "dragonia2",
noOrdersBuyout: !0,
available: {
level: 7
},
duration: "20 days",
energy: !0,
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_SNAIL_FEAST],
offers: [{
id: Offers.TYPES.DRAGONIA2,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.Dragonia2Pack,
bundle: "dragonia_offer",
hero: {
code: "dr2dragonpack",
stage: 0
}
}, Offers.TYPES.SNAILFEAST]
}, {
id: "rapunzel2",
prefix: "rp2",
missionType: Mission.TYPE_RAPUNZEL2_EXPEDITION,
name: "Rapunzel2Expedition",
location: "rapunzel2",
noOrdersBuyout: !0,
duration: "8 days",
energy: !0,
childMissions: [{
type: Mission.TYPE_EXPEDITION_PASS,
startFog: "fog1",
rulesOptions: !1
}],
offers: [{
id: Offers.TYPES.RAPUNZEL2,
base: Offers.TYPES.EXPEDITION,
fog: "fog2",
cooldown: cleverapps.config.debugMode ? "2 minutes" : "24 hours",
reward: RewardsConfig.RapunzelPack,
bundle: "rapunzel_offer"
}]
}, {
id: "undersea2",
prefix: "sea2",
missionType: Mission.TYPE_UNDERSEA2_EXPEDITION,
name: "Undersea2Expedition",
location: "undersea2",
noOrdersBuyout: !0,
parallelHeroDrop: !0,
duration: "20 days",
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_SNAIL_FEAST],
offers: [{
id: Offers.TYPES.UNDERSEA2,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.Undersea2Pack,
bundle: "undersea_offer",
hero: {
code: "sea2pack",
stage: 0
}
}, {
id: Offers.TYPES.SNAILFEAST_UNDERSEA2,
base: Offers.TYPES.SNAILFEAST,
reward: RewardsConfig.SnailPack
}]
}, {
id: "dragonia3",
prefix: "dr3",
missionType: Mission.TYPE_DRAGONIA3_EXPEDITION,
name: "Dragonia3Expedition",
location: "dragonia3",
available: {
level: 7,
projectName: ["mergecraft", "wondermerge", "fairy"]
},
duration: "20 days",
energy: !0,
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_SNAIL_FEAST],
offers: [{
id: Offers.TYPES.DRAGONIA3,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.Dragonia2Pack,
fog: "fog10",
bundle: "dragonia_offer",
hero: {
code: "dr2dragonpack",
stage: 0
}
}, {
id: Offers.TYPES.SNAILFEAST_DRAGONIA3,
base: Offers.TYPES.SNAILFEAST
}]
}, {
id: "rapunzel3",
prefix: "rp3",
missionType: Mission.TYPE_RAPUNZEL3_EXPEDITION,
name: "Rapunzel3Expedition",
location: "rapunzel3",
duration: "14 days",
energy: !0,
available: {
level: 7,
projectName: ["mergecraft", "wondermerge", "fairy"]
},
childMissions: [{
type: Mission.TYPE_EXPEDITION_PASS,
startUnit: {
code: "rpcustomermain0a",
stage: 1
},
rulesOptions: !1
}],
offers: [{
id: Offers.TYPES.RAPUNZEL3,
base: Offers.TYPES.EXPEDITION,
fog: "fog2",
cooldown: cleverapps.config.debugMode ? "2 minutes" : "24 hours",
reward: RewardsConfig.RapunzelPack,
bundle: "rapunzel_offer"
}]
}, {
id: "undersea3",
prefix: "sea3",
missionType: Mission.TYPE_UNDERSEA3_EXPEDITION,
name: "Undersea3Expedition",
location: "undersea3",
available: {
level: 7,
projectName: ["mergecraft"]
},
duration: "20 days",
childMissions: [Mission.TYPE_EXPEDITION_PASS, Mission.TYPE_SNAIL_FEAST],
offers: [{
id: Offers.TYPES.UNDERSEA3,
base: Offers.TYPES.EXPEDITION,
reward: RewardsConfig.Undersea2Pack,
bundle: "undersea_offer",
hero: {
code: "sea2pack",
stage: 0
}
}, {
id: Offers.TYPES.SNAILFEAST_UNDERSEA3,
base: Offers.TYPES.SNAILFEAST,
reward: RewardsConfig.SnailPack
}]
}, {
id: "adventure",
prefix: "adv",
missionType: Mission.TYPE_ADVENTURE_EXPEDITION,
name: "AdventureExpedition",
location: "adventure",
available: {
level: 7.5,
projectName: ["mergecraft", "wondermerge"]
},
duration: "7 days",
energy: !0,
slot: Meta.EXPEDITION_SLOT4,
semaphore: Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT4
}, {
id: "adventure2",
prefix: "adv2",
missionType: Mission.TYPE_ADVENTURE2_EXPEDITION,
name: "Adventure2Expedition",
location: "adventure2",
available: {
level: 7.5,
projectName: ["mergecraft"],
debugMode: !0
},
duration: "7 days",
energy: !0,
slot: Meta.EXPEDITION_SLOT4,
semaphore: Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT4
}].map(function(a) {
return Object.assign({
oneShot: !0,
slot: Meta.EXPEDITION_SLOT2,
semaphore: Missions.SEMAPHORE_CUSTOM_EXPEDITION_SLOT2
}, a)
});
TravelBook.PERMANENT_PAGES = [{
id: "collections",
prefix: "cl",
name: "CollectionsExpedition",
location: "collections",
slot: Meta.EXPEDITION_SLOT3,
permanent: !0,
gameLevel: !0,
noOrdersBuyout: !0,
available: {
level: 8.1,
projectName: ["mergecraft", "fairy", "wondermerge"]
},
offers: [Offers.TYPES.CLPASS, Offers.TYPES.CLCHAIN_SALE, Offers.TYPES.CLSUPPLIES_SALE, Offers.TYPES.CLPROMOTION_SALE]
}];
TravelBook.PAGES = TravelBook.PAGES.concat(TravelBook.SEASONAL_PAGES, TravelBook.ONESHOT_PAGES, TravelBook.PERMANENT_PAGES);
TravelBook.PAGES_BY_ID = TravelBook.PAGES.reduce(function(a, b) {
a[b.id] = b;
return a
}, {});
TravelBook.findPageById = function(a) {
return TravelBook.PAGES_BY_ID[a]
}
;
TravelBook.LIST_IN_ORDER_EXPEDITIONS = function() {
return TravelBook.PAGES.filter(function(a) {
return "main" !== a.id
}).map(function(a) {
return a.missionType
})
}
;
TravelBook.INIT_EXPEDITIONS = function() {
var a = Object.assign({}, {
level: 0,
duration: "1 day",
logic: ExpeditionMissionLogic,
rewardShareId: "bonus_world",
sideBarJson: !1,
rewardTitle: "ExpeditionRewardWindow.title",
rewardText: "ExpeditionRewardWindow.description"
});
TravelBook.PAGES.forEach(function(b) {
"main" !== b.id && (b.available = b.available || {},
b.available.feature = "expedition_" + b.id);
void 0 !== b.missionType && (b.available = Object.assign({}, cleverapps.Availables.EXPEDITIONS, b.available || {}),
Missions[b.missionType] = Object.assign({}, a, b))
})
}
;
"undefined" === typeof cc && (module.exports = TravelBook);
var TravelBookWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this._super({
title: "TravelBookWindow.Title",
name: "travelbookwindow",
content: this.getContent(),
styles: cleverapps.styles.TravelBookWindow.window
});
a && a.targetPage && this.showHint(a.targetPage)
},
getContent: function() {
var a = cleverapps.styles.TravelBookWindow.content
, b = this.pageViews = cleverapps.travelBook.listDisplayedPages().map(function(d) {
return new ExpeditionPageView(d)
}, this);
b = new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin,
padding: a.padding
});
var c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(Math.max(a.width, b.width), b.height);
c.addChild(b);
b.setPositionRound(a);
return c
},
showHint: function(a) {
var b = this.pageViews.find(function(d) {
return d.page.id === a && d.page.isActive()
});
if (b)
b.showHint();
else {
var c;
this.runAction(new cc.Sequence(new cc.DelayTime(.25),new cc.CallFunc(function() {
c = this.dialogue = new MinimalDialogue({
person: "king",
delay: 0,
text: "MissionUnavailable",
rects: this.getMinimalDialogueRects()
});
this.addChild(c);
c.display()
}
.bind(this)),new cc.DelayTime(3),new cc.CallFunc(function() {
c.remove()
}
)))
}
},
listBundles: function() {
return ["travel_book"]
}
});
cleverapps.styles.TravelBookWindow = {
window: {
padding: {
left: 24,
right: 27,
top: 30,
bottom: 30
}
},
content: {
x: {
align: "left"
},
y: {
align: "center"
},
width: 1300,
margin: 20,
padding: {
x: 60,
y: 50
}
}
};
var ExpeditionPage = function(a) {
Object.assign(this, a);
this.slot = this.slot || Meta.SLOT_MAIN;
this.level = this.level || 0;
this.disableNew = a.disableNew;
this.attentionEvent = cleverapps.dataLoader.load(DataLoader.TYPES.TRAVEL_BOOK_ATTENTION + this.id) || !1
};
ExpeditionPage.TYPE_SKIP = 0;
ExpeditionPage.TYPE_ACTIVE = 1;
ExpeditionPage.TYPE_UPCOMING = 2;
ExpeditionPage.prototype.isMain = function() {
return "main" === this.id
}
;
ExpeditionPage.prototype.getStartTime = function() {
var a = cleverapps.missionManager.findByType(this.missionType);
return a && a.isRunning() && a.started || 0
}
;
ExpeditionPage.prototype.getTimeLeft = function() {
var a = cleverapps.missionManager.findByType(this.missionType);
return a && a.isRunning() && a.getTimeLeft() || 0
}
;
ExpeditionPage.prototype.updateState = function() {
var a = this.state;
this.state = this.calcState();
this.isPermanent() && this.isActive() && a !== this.state && ((a = cleverapps.GameSaver.load(this.slot)) && 0 !== Object.keys(a).length || cleverapps.travelBook.startNewExpedition(this));
this.title = "TravelBook.title." + this.id;
this.isUpcoming() && (this.title = "TravelBook.soon");
this.forceText = "TravelBookForce." + this.id;
this.events = this.listEvents();
this.events[0] ? (this.message = "function" === typeof this.events[0].message ? this.events[0].message(this) : this.events[0].message,
a = cleverapps.dataLoader.load(DataLoader.TYPES.TRAVEL_BOOK_EVENTS + this.id) || {},
a[this.events[0].type] = void 0,
cleverapps.dataLoader.save(DataLoader.TYPES.TRAVEL_BOOK_EVENTS + this.id, a)) : this.message = void 0;
this.isCompleted() && this.setAttentionEvent(ExpeditionPage.EVENT_FINISH);
this.attention = !this.isCurrent() && this.events.find(function(b) {
return b.type === this.attentionEvent
}, this);
this.updateSideBar()
}
;
ExpeditionPage.prototype.resetEvents = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.TRAVEL_BOOK_EVENTS + this.id, {})
}
;
ExpeditionPage.prototype.setNew = function(a) {
this.isNew = a
}
;
ExpeditionPage.prototype.setAttentionEvent = function(a) {
this.attentionEvent !== a && (this.attentionEvent = a,
cleverapps.dataLoader.save(DataLoader.TYPES.TRAVEL_BOOK_ATTENTION + this.id, a))
}
;
ExpeditionPage.prototype.planEvent = function(a, b) {
var c = cleverapps.dataLoader.load(DataLoader.TYPES.TRAVEL_BOOK_EVENTS + this.id) || {};
c[a] = {
time: b
};
cleverapps.dataLoader.save(DataLoader.TYPES.TRAVEL_BOOK_EVENTS + this.id, c)
}
;
ExpeditionPage.prototype.listEvents = function() {
if ("merge" !== cleverapps.config.type || !this.isActive())
return [];
var a = cleverapps.dataLoader.load(DataLoader.TYPES.TRAVEL_BOOK_EVENTS + this.id) || {};
return ExpeditionPage.EVENTS.filter(function(b) {
return b.filter ? b.filter(this) : a[b.type] && a[b.type].time && a[b.type].time < Date.now()
}, this)
}
;
ExpeditionPage.prototype.isPassed = function() {
return cleverapps.missionManager.isMissionPassed(this.missionType)
}
;
ExpeditionPage.prototype.calcState = function() {
if (this.isMain())
return ExpeditionPage.TYPE_ACTIVE;
if (this.isPermanent())
return cleverapps.user.checkAvailable(this.available) ? ExpeditionPage.TYPE_ACTIVE : ExpeditionPage.TYPE_UPCOMING;
var a = Missions[this.missionType];
if (!a)
return ExpeditionPage.TYPE_SKIP;
if (cleverapps.missionManager.findByType(this.missionType))
return ExpeditionPage.TYPE_ACTIVE;
if (this.isPassed())
return ExpeditionPage.TYPE_SKIP;
if (!cleverapps.missionManager.isAvailableByType(this.missionType, {
skipFeatures: !0
}))
return a.developmentPreview ? ExpeditionPage.TYPE_UPCOMING : ExpeditionPage.TYPE_SKIP;
if (a.feature) {
var b = cleverapps.eventManager.getNextFeatureEvent(a.feature);
if (!b || b.getTimeBeforeStart() > cleverapps.parseInterval("3 days"))
return ExpeditionPage.TYPE_SKIP
}
return a.disableNew ? ExpeditionPage.TYPE_SKIP : ExpeditionPage.TYPE_UPCOMING
}
;
ExpeditionPage.prototype.gotoExpedition = function(a) {
cleverapps.travelBook.setCurrentPage(this);
this.setAttentionEvent(!1);
if (this.isMain()) {
var b = cleverapps.meta.getMainScene();
cleverapps.scenes.replaceScene(new b, a)
} else {
var c = cleverapps.missionManager.findByType(this.missionType);
b = new GameScene({
level: this.getCurrentLevel()
});
cleverapps.scenes.replaceScene(b, function() {
c && c.isCompleted() ? c.displayCompleted(a) : a()
})
}
}
;
ExpeditionPage.prototype.isActive = function() {
return this.state === ExpeditionPage.TYPE_ACTIVE
}
;
ExpeditionPage.prototype.isUpcoming = function() {
return this.state === ExpeditionPage.TYPE_UPCOMING
}
;
ExpeditionPage.prototype.isSeasonal = function() {
return Missions[this.missionType] && Missions[this.missionType].feature
}
;
ExpeditionPage.prototype.isPermanent = function() {
return !!this.permanent
}
;
ExpeditionPage.prototype.isCompleted = function() {
var a = cleverapps.missionManager.findByType(this.missionType);
return a && a.isCompleted()
}
;
ExpeditionPage.prototype.isCurrent = function() {
return cleverapps.travelBook.getCurrentPage() === this
}
;
ExpeditionPage.prototype.withEnergy = function() {
return this.isMain() || this.energy
}
;
ExpeditionPage.prototype.withWands = function() {
return this.isMain() || !"rapunzel rapunzel2 rapunzel3 easter china adventure adventure2".split(" ").includes(this.id)
}
;
ExpeditionPage.prototype.withWorkers = function() {
return this.isMain() || !"rapunzel rapunzel2 rapunzel3 easter collections china".split(" ").includes(this.id)
}
;
ExpeditionPage.prototype.withToolbarMagnet = function() {
return this.isMain() || !["adventure", "adventure2"].includes(this.id)
}
;
ExpeditionPage.prototype.withToolbarDynamite = function() {
return ["adventure", "adventure2"].includes(this.id)
}
;
ExpeditionPage.prototype.getCurrentLevel = function() {
return new Level(this.location,this.level)
}
;
ExpeditionPage.prototype.getGameSlot = function() {
return cleverapps.GameSaver.getStoreSlot(this.location, this.level)
}
;
ExpeditionPage.prototype.getButtonMsg = function() {
return this.isUpcoming() ? this.isPermanent() && 0 < this.levelsUntil() ? Messages.get("UnlockOnLevel", {
level: Math.floor(this.available.level + 1)
}) : "Soon" : "Go"
}
;
ExpeditionPage.prototype.getTooltipMsg = function() {
return this.isPermanent() && 0 < this.levelsUntil() ? Messages.get("UnlockOnLevel", {
level: Math.floor(this.available.level + 1)
}) : Messages.get("TravelBook.soonTooltip")
}
;
ExpeditionPage.prototype.levelsUntil = function() {
return Math.floor(this.available.level) - Math.floor(cleverapps.user.getFloatLevel())
}
;
ExpeditionPage.prototype.getSidebarIcon = function() {
if (this.id.startsWith("rapunzel"))
return bundles.sidebar.jsons.exp_rapunzel;
if (this.id.startsWith("dragonia"))
return bundles.sidebar.jsons.exp_dragonia;
if (this.id.startsWith("undersea"))
return bundles.sidebar.jsons.exp_undersea;
if ("collections" === this.id)
return bundles.sidebar.jsons.exp_collections;
if (this.id.startsWith("adventure"))
return bundles.sidebar.jsons.exp_adventure;
if (this.id.startsWith("halloween"))
return bundles.sidebar.jsons.exp_halloween;
if (this.id.startsWith("blackfriday"))
return bundles.sidebar.jsons.exp_blackfriday
}
;
ExpeditionPage.prototype.updateSideBar = function() {
var a = cleverapps.sideBar.findExpeditionIcon(this.id)
, b = cleverapps.missionManager.findByType(this.missionType);
b = b && (b.isRunning() || !b.canRemoveSilently());
b = this.isActive() && (this.isPermanent() || b);
a ? b ? cleverapps.sideBar.resetByClassName(ExpeditionIcon) : cleverapps.sideBar.removeTemporaryIcon(a) : b && cleverapps.sideBar.addTemporaryIcon(new ExpeditionIcon(this.id))
}
;
ExpeditionPage.EVENT_START = "start";
ExpeditionPage.EVENT_GOALS_DONE = "done";
ExpeditionPage.EVENT_FINISH = "finish";
ExpeditionPage.EVENT_ENERGY = "energy";
ExpeditionPage.EVENT_KEYS = "keys";
ExpeditionPage.EVENT_BUILT = "built";
ExpeditionPage.EVENTS = [{
type: ExpeditionPage.EVENT_START,
message: {
text: "TravelBook.message.welcome"
},
filter: function(a) {
return a.isNew
}
}, {
type: ExpeditionPage.EVENT_FINISH,
message: function() {
return {
text: "TravelBook.message.finished",
icon: bundles.travel_book.frames.icon_finish
}
},
filter: function(a) {
return a.isCompleted()
}
}, {
type: ExpeditionPage.EVENT_GOALS_DONE,
message: {
text: "TravelBook.message.done"
},
filter: function(a) {
if ("adventure" === a.id)
return Game.currentGame && Game.currentGame.landmarks.isLandmarkGathered(Landmarks.WORLDS.adventure.landmarks[0])
}
}, {
type: ExpeditionPage.EVENT_BUILT,
message: function() {
return {
text: "TravelBook.message.built",
icon: bundles.travel_book.frames.icon_built
}
}
}, {
type: ExpeditionPage.EVENT_KEYS,
message: function(a) {
return {
icon: bundles.travel_book.frames["icon_key_" + a.id],
text: "TravelBook.message.keys." + a.id
}
}
}, {
type: ExpeditionPage.EVENT_ENERGY,
message: function(a) {
return {
icon: a.isMain() ? bundles.travel_book.frames.icon_energy_main : bundles.travel_book.frames.icon_energy_expedition,
text: "TravelBook.message.energy"
}
},
filter: function(a) {
return a.withEnergy() && cleverapps.livesBySlots[a.slot].isFull()
}
}];
var ExpeditionPageView = cc.Scale9Sprite.extend({
ctor: function(a) {
this.page = a;
a = cleverapps.styles.ExpeditionPageView;
this._super(bundles.travel_book.frames.bg_png);
this.setContentSize2(a);
this.createImage();
this.createTitle();
this.page.isCurrent() ? this.createCurrentText() : this.createButton();
this.page.isActive() && !this.page.isMain() && this.page.getTimeLeft() && this.createTimer();
this.page.message && this.createMessage();
if (this.page.isActive() && !this.page.isCurrent())
cleverapps.UI.onClick(this, this.gotoExpedition.bind(this), {
interactiveScale: !1
})
},
createImage: function() {
var a = cleverapps.styles.ExpeditionPageView
, b = new cc.Sprite(bundles.travel_book.frames[this.page.id + "_png"]);
this.addChild(b);
b.setPositionRound(a.image);
this.page.isUpcoming() && b.setColor(new cc.Color(130,130,130,255))
},
createTitle: function() {
var a = cleverapps.styles.ExpeditionPageView;
if (bundles.travel_book.frames.title_bg_png) {
var b = new cc.Scale9Sprite(bundles.travel_book.frames.title_bg_png);
b.setContentSize2(a.title.bg);
this.addChild(b);
b.setPositionRound(a.title.bg)
}
b = cleverapps.UI.generateOnlyText(this.page.title, cleverapps.styles.FONTS.TRAVEL_BOOK_TITLE_TEXT);
b.fitTo(a.title.width);
this.addChild(b);
b.setAnchorPoint(.5, .5);
b.setPositionRound(a.title)
},
createCurrentText: function() {
var a = cleverapps.styles.ExpeditionPageView
, b = cleverapps.UI.generateOnlyText("TravelBook.current", cleverapps.styles.FONTS.TRAVEL_BOOK_BOTTOM_TEXT);
b.fitTo(a.current.text.width);
var c = new cc.Sprite(bundles.travel_book.frames.mark_png);
b = new cleverapps.Layout([b, c],{
margin: a.current.margin,
direction: cleverapps.UI.HORIZONTAL
});
this.addChild(b);
b.setPositionRound(a.current)
},
createTimer: function() {
var a = cleverapps.styles.ExpeditionPageView
, b = this.page.getTimeLeft();
b = new Timer(b,function() {}
,{
width: a.timer.width
});
this.addChild(b);
b.setPositionRound(a.timer)
},
createButton: function() {
var a = cleverapps.styles.ExpeditionPageView
, b = this.button = new cleverapps.UI.Button({
text: this.page.getButtonMsg(),
onClicked: this.gotoExpedition.bind(this),
width: a.button.width,
height: a.button.height,
mark: this.page.attention
});
this.addChild(b);
b.setPositionRound(a.button);
this.page.isUpcoming() && (b.disable(),
cleverapps.tooltipManager.create(b, {
text: this.page.getTooltipMsg()
}));
cleverapps.travelBook.isChosenForForce(this.page) && this.showHint()
},
showHint: function() {
FingerView.hintClick(this.button)
},
createMessage: function() {
var a = cleverapps.styles.ExpeditionPageView
, b = bundles.travel_book.frames.key_text_bg_png;
!this.page.message.icon && bundles.travel_book.frames.key_text_bg_no_icon_png && (b = bundles.travel_book.frames.key_text_bg_no_icon_png);
b = new cc.Scale9Sprite(b);
b.setContentSize2(this.page.message.icon ? a.message.width : a.message.noIcon.width, a.message.height);
var c = cleverapps.UI.generateOnlyText(this.page.message.text, cleverapps.styles.FONTS.TRAVEL_BOOK_MESSAGE_TEXT);
b.addChild(c);
c.setPositionRound(this.page.message.icon ? a.message.text.x : a.message.text.noIcon.x, a.message.text.y);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setDimensions(a.message.text.width, 0);
c.fitTo(void 0, a.message.text.height);
if (this.page.message.icon) {
c = new cc.Sprite(bundles.travel_book.frames.key_icon_bg_png);
var d = new cc.Sprite(this.page.message.icon);
cleverapps.UI.fitToBox(d, a.message.icon);
c.addChild(d);
d.setPositionRound(a.message.icon);
b.addChild(c);
c.setPositionRound(a.message.iconBg)
}
this.addChild(b);
b.setPositionRound(this.page.message.icon ? a.message.x : a.message.noIcon.x, a.message.y)
},
gotoExpedition: function() {
cleverapps.focusManager.distract({
focus: "TravelBook.gotoExpedition",
action: function(a) {
this.page.gotoExpedition(a)
}
.bind(this)
})
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
TRAVEL_BOOK_BOTTOM_TEXT: {
name: "default",
size: 35,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
TRAVEL_BOOK_TITLE_TEXT: {
name: "default",
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
TRAVEL_BOOK_MESSAGE_TEXT: {
name: "default",
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.ExpeditionPageView = {
width: 380,
height: 630,
message: {
noIcon: {
x: {
align: "center"
},
width: 300
},
x: {
align: "center",
dx: 28
},
y: {
align: "top",
dy: -100
},
text: {
width: 210,
height: 75,
noIcon: {
x: {
align: "center"
}
},
x: {
align: "center",
dx: 10
},
y: {
align: "center",
dy: 2
}
},
width: 270,
height: 86,
icon: {
width: 80,
height: 80,
x: {
align: "center"
},
y: {
align: "center"
}
},
iconBg: {
x: {
align: "left",
dx: -50
},
y: {
align: "center"
}
}
},
image: {
x: {
align: "center"
},
y: {
align: "center",
dy: 20
}
},
title: {
x: {
align: "center"
},
y: {
align: "top",
dy: -45,
anchor: !1
},
width: 340
},
current: {
margin: 10,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 35
},
text: {
width: 250
}
},
timer: {
margin: 10,
width: 200,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 140
}
},
button: {
width: 300,
height: 90,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 23
}
}
};
var TravelBookHint = function() {
this.nextTime = cleverapps.dataLoader.load(DataLoader.TYPES.TRAVEL_BOOK_HINT_TIME) || 0;
this.onShowHint = function() {}
;
this.onHideHint = function() {}
};
TravelBookHint.prototype.canShow = function() {
return !cleverapps.focusManager.isFocused() && cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition() && Game.currentGame && !Game.currentGame.stopped && Game.currentGame.showUpFinished
}
;
TravelBookHint.prototype.check = function() {
if (!(Date.now() < this.nextTime || !this.canShow() || this.running)) {
var a = cleverapps.travelBook.pages.map(function(b) {
return b.missionType && cleverapps.missionManager.findByType(b.missionType)
}).filter(function(b) {
return b
}).sort(function(b, c) {
return b.getTimeLeft() - c.getTimeLeft()
})[0];
a && this.checkMission(a)
}
}
;
TravelBookHint.prototype.checkMission = function(a) {
var b = cleverapps.travelBook.findExpeditionByMission(a);
if (b && this.canShow()) {
var c = Math.ceil(a.getTimeLeft() / cleverapps.parseInterval("1 day"));
if (a.isCompleted() && !a.canRemoveSilently()) {
var d = Messages.get("ExpeditionProgressHint.completed", {
name: b.title
});
b.isUpcoming() && cleverapps.throwAsync("completed mission with upcoming page " + (a && a.type) + " " + b.id + " " + b.missionType)
} else
a.isRunning() && 3 >= c && (d = Messages.get("ExpeditionProgressHint.remaining", {
name: b.title,
remaining: c
}));
d && (this.hideHint(),
this.running = !0,
this.onShowHint(d),
Game.currentGame.counter.setTimeout(this.hideHint.bind(this), TravelBookHint.DURATION),
this.setNextTime(Date.now() + TravelBookHint.TIMEOUT))
}
}
;
TravelBookHint.prototype.hideHint = function() {
this.onHideHint();
this.running = !1
}
;
TravelBookHint.prototype.setNextTime = function(a) {
this.nextTime = a;
cleverapps.dataLoader.save(DataLoader.TYPES.TRAVEL_BOOK_HINT_TIME, a)
}
;
TravelBookHint.DURATION = 4E3;
TravelBookHint.TIMEOUT = cleverapps.parseInterval("1 day");
var TravelBookHintView = cc.Node.extend({
ctor: function() {
this._super();
cleverapps.travelBookHint.onShowHint = this.createListener(this.showHint.bind(this));
cleverapps.travelBookHint.onHideHint = this.createListener(this.hideHint.bind(this))
},
showHint: function(a) {
var b = cleverapps.scenes.getRunningScene().downToolBarControl.getSceneBoundingBox();
this.dialogue = new MinimalDialogue({
text: a,
rects: [b],
person: "king"
});
this.addChild(this.dialogue);
this.dialogue.display();
cleverapps.toolbar.getItem(ToolbarItem.TRAVEL_BOOK.type).setFinger(!0, cleverapps.parseInterval("4 seconds"))
},
hideHint: function() {
this.dialogue && this.dialogue.remove()
}
});
cleverapps.Pagination = function(a, b) {
cleverapps.EventEmitter.call(this);
this.page = b || 0;
this.total = a
}
;
cleverapps.Pagination.prototype = Object.create(cleverapps.EventEmitter.prototype);
cleverapps.Pagination.prototype.constructor = cleverapps.Pagination;
cleverapps.Pagination.prototype.isLast = function() {
return this.page === this.total - 1
}
;
cleverapps.Pagination.prototype.getCurrent = function() {
return this.page
}
;
cleverapps.Pagination.prototype.getTotal = function() {
return this.total
}
;
cleverapps.Pagination.prototype.nextPage = function() {
this.isLast() ? this.trigger("lastPage") : this.setPage(this.page + 1)
}
;
cleverapps.Pagination.prototype.setPage = function(a) {
this.page = a;
this.trigger("changePage", this.page)
}
;
cleverapps.Pagination.prototype.addPage = function() {
this.total++;
this.trigger("addPage")
}
;
cleverapps.Pagination.prototype.removePage = function(a) {
1 >= this.total || (this.page > a && this.page--,
this.page === a && (0 === this.page ? (this.setPage(1),
this.page = 0) : this.setPage(this.page - 1)),
this.total--,
this.trigger("removePage", a))
}
;
var PaginationView = cleverapps.Spine.extend({
avoidNode: "PaginationView",
ctor: function(a) {
this.pagination = a;
this._super(bundles.pagination.jsons[this.getJsonName()]);
this.setAnimation(0, this.getIdleAnimationName());
this.pagination.on("changePage", this.createListener(this.changePage.bind(this)));
this.setPositionRound(cleverapps.styles.PaginationView.position)
},
changePage: function() {
this.setAnimationAndIdleAfter("open_" + this.pagination.page, this.getIdleAnimationName())
},
getJsonName: function() {
return "pagination_" + this.pagination.total + "_json"
},
getIdleAnimationName: function() {
return "idle_" + this.pagination.page
}
});
cleverapps.styles.PaginationView = {
position: [{
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -220
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -30
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -30
}
}]
};
var Score = function(a) {
cleverapps.EventEmitter.call(this);
this.points = a || 0
};
Score.prototype = Object.create(cleverapps.EventEmitter.prototype);
Score.prototype.constructor = Score;
Score.prototype.getPoints = function() {
return this.points
}
;
Score.prototype.setPoints = function(a, b) {
0 > a && (a = 0);
this.points = a;
this.trigger("onUpdate", this.points, b)
}
;
Score.prototype.hide = function() {
this.trigger("onHide")
}
;
Score.prototype.show = function() {
this.trigger("onShow")
}
;
Score.prototype.addPoints = function(a, b) {
this.setPoints(this.points + a, b)
}
;
var WebWorker = {
IsAvailable: function() {
return -1 !== ["blocks"].indexOf(cleverapps.config.type)
},
Build: function() {
if (cleverapps.isLocalhost())
var a = new Worker("cleverapps/levels/game/blocks/worker/blocksworker.js");
else
a = document.getElementById("web-worker-task").innerHTML,
a = new Worker(window.URL.createObjectURL(new Blob([a],{
type: "text/javascript"
})));
a.postMessage(Forms.ALL_POSSIBLE_VARIANTS);
return a
}
};
var TilesUnlockWindow = CleverappsWindow.extend({
ctor: function(a) {
this.options = a || {};
this._super.apply(this, arguments)
},
onWindowLoaded: function() {
this.tilesCreated = !1;
var a = this.createContent();
this._super({
content: a,
name: "tilesunlockwindow",
noBackground: !0,
title: "TilesUnlockWindow.text"
})
},
createContent: function() {
var a = cleverapps.styles.TilesUnlockWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize(a.width, a.height);
var c = this.animation = new cleverapps.Spine(bundles.tiles_unlock_window.jsons.tiles_unlock_json);
c.setAnimationAndIdleAfter("open", "idle");
cleverapps.audio.playSound(bundles.tiles_unlock_window.urls.rays_show_effect);
this.runAction(new cc.RepeatForever(new cc.Sequence(new cc.DelayTime(1.4),new cc.CallFunc(function() {
this.idleSound = cleverapps.audio.playSound(bundles.tiles_unlock_window.urls.rays_idle_effect)
}
.bind(this)),new cc.DelayTime(6.6))));
c.setPositionRound(a.animation);
b.addChild(c);
(this.tiles = this.createTiles()).forEach(function(d) {
b.addChild(d)
});
return b
},
createTiles: function() {
var a = TileGenerator.getNewSkins(this.options && this.options.random).map(function(c) {
c = CardView.createCardView(new Card({
value: c
}));
c.onTouchHandler.remove();
c.onTouchHandler = void 0;
c.hide = void 0;
return c
})
, b = cleverapps.wait(2, function() {
this.tilesCreated = !0
}
.bind(this));
a.forEach(function(c, d) {
var e = [];
e.push(c.unlockSpawnAnimate(!d, b));
e.push(new cc.CallFunc(b));
var f = {};
d || (f = {
leftAngle: -6,
rightAngle: -3,
delayTime: 2.5
});
e.push(AnimationsLibrary.hovering(c, f));
c.runAction(new cc.Sequence(e))
});
return a
},
beforeCloseAnimation: function(a) {
a = cleverapps.wait(2, a);
cleverapps.audio.stopSound(this.idleSound);
cleverapps.audio.playSound(bundles.tiles_unlock_window.urls.rays_hide_effect);
var b = !0;
this.animation.setAnimation(0, "close", !1);
this.animation.setCompleteListenerRemove();
this.runAction(new cc.Sequence(new cc.DelayTime(1.3),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.tiles_unlock_window.urls.tiles_unlock_effect)
}
)));
this.tiles.forEach(function(c) {
c.stopAllActions();
c.particles.removeFromParent();
c.unlockEndAnimate(a, b);
b = !1
})
},
close: function() {
this.tilesCreated && this._super()
},
listBundles: function() {
return ["tiles_unlock_window"]
}
});
cleverapps.styles.TilesUnlockWindow = {
width: 650,
height: 900,
animation: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 0
}
},
tiles: {
offset: 125,
scale: 1.7
}
};
var Invites = function() {};
Invites.prototype.invite = function(a) {
var b = {
text: Messages.get("InviteFriends.message"),
title: Messages.get(cleverapps.config.title)
}
, c = Share.getData("default").image;
connector.platform.oneOf(connector.WORTAL) && (c = Share.getData("wortal").image);
(new ActionPlayer([function(d) {
connector.social.isNeedsLoginForInvite ? cleverapps.SocialManager.enforceLogin(function(e) {
e === cleverapps.CODE_SUCCEED ? d() : a(!1)
}) : d()
}
, function(d) {
connector.platform.oneOf(connector.INSTANT, connector.WORTAL, connector.TEST) ? cleverapps.loadBase64Image(c, function(e) {
e ? (b.image = e,
d()) : a(!1)
}) : (b.image = c,
d())
}
, function() {
connector.social.inviteCallback(b, a)
}
])).play()
}
;
var Activities = function() {
this.lastActivitySent = 0;
this.interval = Activities.INVERVALS[connector.info.source]
};
Activities.prototype.canSend = function(a) {
return this.interval && Date.now() - this.lastActivitySent < this.interval ? !1 : Activities.CONFIG[a].probability > Math.random()
}
;
Activities.prototype.send = function(a, b) {
connector.platform.oneOf(connector.VK) ? this._sendVkActivity(a, b) : this.canSend(a) && (a = cleverapps.Random.mathChoose(Activities.CONFIG[a].messages),
b = {
title: Messages.get(a.title),
body: Messages.get(a.body, b),
link: cleverapps.config.deployment
},
connector.social.sendActivity(b, function(c) {
c === cleverapps.CODE_SUCCEED && (this.lastActivitySent = Date.now())
}
.bind(this)))
}
;
Activities.prototype._sendVkActivity = function(a, b) {
a === Activities.TYPES.LVL_PASSED && connector.social.sendActivity(b.score && .5 > Math.random() ? {
activityId: 2,
value: b.score
} : {
activityId: 1,
value: b.levelNo
}, function() {})
}
;
Activities.INVERVALS = {
draugiem: cleverapps.parseInterval("1 day")
};
Activities.TYPES = {};
Activities.TYPES.LVL_PASSED = 0;
Activities.TYPES.DAILY_TASK = 1;
Activities.CONFIG = {};
Activities.CONFIG[Activities.TYPES.LVL_PASSED] = {
probability: .25,
messages: [{
title: "Activity.PassLevel.title",
body: "Activity.PassLevel.body1"
}, {
title: "Activity.PassLevel.title",
body: "Activity.PassLevel.body2"
}, {
title: "Activity.PassLevel.title",
body: "Activity.PassLevel.body3"
}]
};
Activities.CONFIG[Activities.TYPES.DAILY_TASK] = {
probability: .5,
messages: [{
title: "Activity.DailyTask.title",
body: "Activity.DailyTask.body1"
}, {
title: "Activity.DailyTask.title",
body: "Activity.DailyTask.body2"
}]
};
var GameManager = function() {
connector.platform.on("pause", this.pause.bind(this));
connector.platform.on("resume", this.resume.bind(this))
};
GameManager.prototype.pause = function() {
if (!(cc.game.isPaused() || cleverapps.gameModes && cleverapps.gameModes.noGamePause || connector.platform.oneOf(connector.INSTANT) && connector.info.os === connector.OS_IOS && connector.info.isInApp)) {
console.log("pause game");
cc.game.pause();
if (cleverapps.audio)
cleverapps.audio.onChangeMusic();
cc.eventManager && cc.eventManager.dispatchEvent(new cc.EventCustom(cc.game.EVENT_HIDE))
}
}
;
GameManager.prototype.resume = function() {
cleverapps.Audio.resumeAudioContext();
if (!(!cc.game.isPaused() || cleverapps.gameModes && cleverapps.gameModes.noGamePause)) {
console.log("resume game");
cc.game.resume();
if (cleverapps.audio)
cleverapps.audio.onChangeMusic();
cleverapps.allInitialized && cleverapps.rewardedAdsManager.showInterstitial();
cc.eventManager && cc.eventManager.dispatchEvent(new cc.EventCustom(cc.game.EVENT_SHOW))
}
}
;
var Country = function() {
cleverapps.EventEmitter.call(this);
this.country = void 0;
this.load();
this.update()
};
Country.prototype = Object.create(cleverapps.EventEmitter.prototype);
Country.prototype.constructor = Country;
Country.prototype.update = function() {
// cleverapps.RestClient.get("/country/getbyip", {}, function(a) {
// a = a && a.countryCode;
// console.log("countryCode", a);
// a && this.setCountry(a)
// }
// .bind(this))
}
;
Country.prototype.whenReady = function(a) {
if (this.country)
a(this.country);
else
this.once("ready", a)
}
;
Country.prototype.getCountry = function() {
return this.country
}
;
Country.prototype.setCountry = function(a) {
this.country !== a && (this.country = a,
this.save(),
this.trigger("ready", a))
}
;
Country.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.COUNTRY);
a && a.country && (this.country = a.country)
}
;
Country.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.COUNTRY, {
country: this.country
})
}
;
var UserPermissions = function() {
this.queue = [];
this.busy = !1
};
UserPermissions.prototype.queuePermission = function(a) {
this.queue.push(a);
this.process()
}
;
UserPermissions.prototype.process = function() {
if (!this.busy) {
var a = this.queue.shift();
a && (this.busy = !0,
a(function() {
this.busy = !1;
this.process()
}
.bind(this)))
}
}
;
var WechatShutdownWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this._super({
content: this.getContent(),
name: "wechatshutdownwindow",
title: "\u300a\u840c\u732a\u6d88\u6d88\u4e50\u9762\u5305\u7248\u300b\u6e38\u620f\u5373\u5c06\u5173\u670d\u901a\u77e5",
button: {
text: "OK",
onPressed: this.close.bind(this)
}
})
},
getContent: function() {
var a = cleverapps.styles.WechatShutdownWindow
, b = cleverapps.UI.generateOnlyText("\u5c0a\u656c\u7684\u73a9\u5bb6\uff1a\n\u611f\u8c22\u60a8\u5bf9\u300a\u840c\u732a\u6d88\u6d88\u4e50\u9762\u5305\u7248\u300b\u6e38\u620f\u7684\u652f\u6301\u3002\u7531\u4e8e\u8fd0\u8425\u7b56\u7565\u8c03\u6574\uff0c\u6211\u4eec\u9057\u61be\u5730\u901a\u77e5\u60a8\uff0c\u300a\u840c\u732a\u6d88\u6d88\u4e50\u9762\u5305\u7248\u300b\u6e38\u620f\u5c06\u4e8e2024\u5e748\u67081\u65e500:00\u6b63\u5f0f\u5173\u670d\u3002\n\u8bf7\u60a8\u5728\u5173\u670d\u524d\u5904\u7406\u597d\u6e38\u620f\u5185\u7684\u76f8\u5173\u4e8b\u5b9c\uff0c\u5e76\u5173\u6ce8\u6211\u4eec\u7684\u540e\u7eed\u516c\u544a\u4ee5\u4e86\u89e3\u53ef\u80fd\u7684\u8865\u507f\u63aa\u65bd\u3002\n\u5982\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u8bf7\u968f\u65f6\u8054\u7cfb\u6211\u4eec\u7684\u5ba2\u670d\u3002\n\u611f\u8c22\u60a8\u7684\u7406\u89e3\u4e0e\u652f\u6301\uff01\n\u300a\u840c\u732a\u6d88\u6d88\u4e50\u9762\u5305\u7248\u300b\u6e38\u620f\u8fd0\u8425\u56e2\u961f", cleverapps.styles.FONTS.WINDOW_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.text.width, 0);
b.fitTo(void 0, a.text.height);
return b
}
});
cleverapps.styles.WechatShutdownWindow = {
text: {
width: 650,
height: 400
}
};
var FallSale = function() {};
FallSale.prototype.isAvailable = function() {
return cleverapps.user.checkAvailable(FallSale.CONFIG.available) && Date.now() < (new Date(FallSale.CONFIG.end)).getTime() && (connector.info.os === connector.OS_IOS || cleverapps.config.debugMode) && cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR
}
;
FallSale.prototype.needToShowWindow = function() {
return this.isAvailable() && (!Map2d.currentMap || Map2d.currentMap.fogs.isOpened("fog3")) && !cleverapps.config.adminMode
}
;
FallSale.prototype.showWindow = function() {
cleverapps.focusManager.display({
focus: "FallSaleWindow",
action: function(a) {
new FallSaleWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
;
FallSale.CONFIG = {
end: "2024-10-14",
available: {
disabled: !0,
projectName: ["mergecraft", "wondermerge", "fairy", "hustlemerge"],
source: ["test", "instant"]
}
};
var FallSaleIcon = cc.Sprite.extend({
ctor: function(a) {
this._super(bundles.main.frames.fallsale_badge);
this.setLocalZOrder(3);
this.setPositionRound(cleverapps.styles.FallSaleIcon.positions[a || FallSaleIcon.POSITION_BUTTON])
}
})
, FallSaleTitleIcon = cc.Scale9Sprite.extend({
ctor: function() {
this._super(bundles.main.frames.fallsale_title, cleverapps.UI.getScale9Rect(bundles.main.frames.fallsale_title, cleverapps.UI.Scale9Rect.TwoPixelXY));
this.setAnchorPoint(.5, .5);
var a = cleverapps.styles.FallSaleIcon.positions.title
, b = cleverapps.UI.generateOnlyText("FallSaleWindow.shoptitle", cleverapps.styles.FONTS.FALL_SALE_BIG_TITLE);
b.fitTo(a.description.width, a.description.height);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setPositionRound(a.description);
this.addChild(b);
this.setLocalZOrder(-1);
this.setPositionRound(a);
this.setContentSize2(a);
this.setCascadeOpacityEnabledRecursively(!0)
}
});
FallSaleIcon.POSITION_SIDEBAR = "sidebar";
FallSaleIcon.POSITION_BUTTON = "button";
FallSaleIcon.POSITION_MENUBAR = "menubar";
FallSaleIcon.POSITION_TILE = "title";
cleverapps.overrideStyles(cleverapps.styles.DECORATORS, {
FALL_SALE_BIG_TITLE_SHADOW: {
color: new cc.Color(255,188,95),
direction: cc.size(2, -3)
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
FALL_SALE_BIG_TITLE: {
size: 44,
color: new cc.Color(137,64,45,255),
shadow: cleverapps.styles.DECORATORS.FALL_SALE_BIG_TITLE_SHADOW
}
});
cleverapps.styles.FallSaleIcon = {
positions: {
sidebar: {
x: {
align: "right",
dx: 18
},
y: {
align: "top",
dy: 4
}
},
menubar: {
x: {
align: "center",
dx: 130
},
y: {
align: "bottom",
dy: -50
}
},
button: {
x: {
align: "center",
dx: 116
},
y: {
align: "bottom",
dy: -38
}
},
title: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -100
},
width: 500,
height: 123,
description: {
height: 80,
width: 340,
x: {
align: "center"
},
y: {
align: "center",
dy: -2
}
}
}
}
};
var FallSaleWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
this._super({
name: "FallSaleWindow",
noBackground: !0,
notCloseByTouchInShadow: !0,
closeButtonDelay: !0,
fireworks: !0,
content: this.createContent(),
openSound: bundles.fallsale.urls.sale_showup_effect,
button: {
width: cleverapps.styles.FallSaleWindow.button.width,
height: cleverapps.styles.FallSaleWindow.button.height,
text: "FallSaleWindow.Button.text",
onPressed: function() {
new HardCurrencyShopWindow;
this.close()
}
.bind(this)
}
})
},
createContent: function() {
var a = cleverapps.styles.FallSaleWindow
, b = this.content = new cleverapps.Spine(bundles.fallsale.jsons.sale_bg);
b.setAnimationAndIdleAfter("open", "idle");
var c = cleverapps.UI.generateOnlyText("FallSaleWindow.description", cleverapps.styles.FONTS.FALL_SALE_BG_DESCRIPTION);
c.setDimensions(a.description.width, 0);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.fitTo(void 0, a.description.height);
c.setPositionRound(a.description);
this.content.addChild(c);
this.createHeader();
return b
},
createHeader: function() {
var a = cleverapps.styles.FallSaleWindow
, b = cleverapps.UI.generateOnlyText("FallSaleWindow.title", cleverapps.styles.FONTS.FALL_SALE_BG_TITLE);
b.fitTo(a.title.width, a.title.height);
b.setPositionRound(a.title);
this.content.addChild(b)
},
listBundles: function() {
return ["fallsale"]
},
getPerson: function() {
return cleverapps.persons.choose("seller", "hero")
}
});
cleverapps.overrideStyles(cleverapps.styles.DECORATORS, {
FALL_SALE_BG_TITLE_SHADOW: {
color: new cc.Color(201,71,0,255),
direction: cc.size(4, -6)
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
FALL_SALE_BG_TITLE: {
size: 200,
color: new cc.Color(255,240,0,255),
shadow: cleverapps.styles.DECORATORS.FALL_SALE_BG_TITLE_SHADOW
},
FALL_SALE_BG_DESCRIPTION: {
size: 24,
color: new cc.Color(255,253,81,255)
}
});
cleverapps.styles.FallSaleWindow = {
title: {
x: {
align: "center",
dx: -10
},
y: {
align: "center",
dy: 394
},
width: 800,
height: 200
},
description: {
x: {
align: "center",
dx: -10
},
y: {
align: "center",
dy: -330
},
width: 1E3,
height: 200
},
header: {
x: {
align: "center"
},
y: {
align: "top",
dy: -40
}
},
button: {
width: 460,
height: 100
}
};
var hiddenByDefault = function() {
var a = [cleverapps.Environment.SCENE_OCTOPUS_HUNT];
["match3", "tile3", "battlefield"].includes(cleverapps.config.type) && (a.push(cleverapps.Environment.SCENE_GAME),
a.push(cleverapps.Environment.SCENE_WYSIWYG));
return a
}
, GoldMenuBarItem = {
name: "GoldItem",
lottery: !0,
isClickable: function() {
return cleverapps.flags.monetization !== cleverapps.Flags.MONETIZATION_DISABLED
},
clickableUpdater: function(a) {
cleverapps.flags.on("change:monetization", a, this)
},
targets: "hard",
plusButton: !0,
value: function() {
return cleverapps.user.gold
},
updater: function(a) {
cleverapps.user.on("changeHard", a, this)
},
attentionUpdater: function(a) {
cleverapps.adsLimits.on("update", a, this);
if (cleverapps.subscription)
cleverapps.subscription.on("update", a, this);
if (cleverapps.growthFund)
cleverapps.growthFund.on("updateState", a, this)
},
sparks: !0,
attention: function() {
return -1 !== ShopProductSource.listProducts(ShopWindow.TABS.HARD_CURRENCY).indexOf("hardForVideo") && cleverapps.adsLimits.state(AdsLimits.TYPES.HARD) === AdsLimits.STATE_READY || -1 !== ShopProductSource.listProducts(ShopWindow.TABS.HARD_CURRENCY).indexOf("subsMonth") && cleverapps.subscription && cleverapps.subscription.needsAttention() || cleverapps.growthFund && cleverapps.growthFund.needsAttention() ? !0 : !1
},
availableOnScenes: function() {
return [cleverapps.Environment.SCENE_MAIN, cleverapps.Environment.SCENE_HEROES, cleverapps.Environment.SCENE_DAILY_CUP, cleverapps.Environment.SCENE_BONUS_WORLD, cleverapps.Environment.SCENE_SLOT_MACHINE, cleverapps.Environment.SCENE_PINBALL, cleverapps.Environment.SCENE_OCTOPUS_HUNT, cleverapps.Environment.SCENE_GAME]
},
hiddenByDefault: hiddenByDefault(),
icon: bundles.menubar.frames.gold_png,
onClickWindow: HardCurrencyShopWindow,
deltaSound: bundles.menubar.urls.coins_effect
};
hiddenByDefault = function() {
var a = [cleverapps.Environment.SCENE_OCTOPUS_HUNT];
["match3"].includes(cleverapps.config.type) && a.push(cleverapps.Environment.SCENE_GAME);
return a
}
;
var SoftMenuBarItem = {
name: "CoinsItem",
targets: "soft",
plusButton: !0,
value: function() {
return cleverapps.user.soft
},
updater: function(a) {
cleverapps.user.on("changeSoft", a, this)
},
attentionUpdater: function(a) {
cleverapps.adsLimits.on("update", a, this)
},
attention: function() {
return !1
},
onClickWindow: SoftCurrencyShopWindow,
icon: bundles.menubar.frames.coin_png,
force: Forces.MENU_BAR_SOFT_FORCE,
availableOnScenes: function() {
return [cleverapps.Environment.SCENE_MAIN, cleverapps.Environment.SCENE_GAME, cleverapps.Environment.SCENE_OCTOPUS_HUNT]
},
hiddenByDefault: hiddenByDefault(),
sparks: !0,
deltaSound: bundles.menubar.urls.coins_effect
};
var BaseBoosterBefore = function(a) {
BaseBooster.call(this, a);
this.spentEvent = cleverapps.EVENTS.SPENT.BOOSTER_BEFORE
};
BaseBoosterBefore.prototype = Object.create(BaseBooster.prototype);
BaseBoosterBefore.prototype.constructor = BaseBoosterBefore;
BaseBoosterBefore.prototype.onUsed = function() {
cleverapps.eventBus.trigger("taskEvent", DailyTasks.USE_BOOSTER_BEFORE)
}
;
BaseBoosterBefore.prototype.onGiveUp = function() {
!cleverapps.lives || this.getLanternBonus() && !cleverapps.config.features.includes("lantern_start") || cleverapps.boosters.add(this.id, 1)
}
;
BaseBoosterBefore.prototype.getLanternBonus = function() {
return Lantern.GetBoosterBonus(Game.currentGame.level, this)
}
;
BaseBoosterBefore.prototype.logUseEvents = cleverapps.extendFunc(BaseBoosterBefore.prototype.logUseEvents, function() {
this.getLanternBonus() && !cleverapps.config.features.includes("lantern_start") || this._super()
});
BaseBoosterBefore.prototype.execute = cleverapps.extendFunc(BaseBoosterBefore.prototype.execute, function() {
this.getLanternBonus() && !cleverapps.config.features.includes("lantern_start") && this.setAmount(this.getAmount() + 1);
this._super()
});
BaseBoosterBefore.prototype.isUpcoming = function() {
for (var a = cleverapps.boosters.listBoostersBefore(), b = 0; b < a.length; b++)
if (!a[b].isAvailable())
return a[b] === this;
return !1
}
;
BaseBoosterBefore.prototype.calcPrice = function() {
var a = 0;
switch (this.type) {
case cleverapps.Boosters.TYPES.CHEAP:
a = 50;
break;
case cleverapps.Boosters.TYPES.MEDIUM:
a = 100;
break;
case cleverapps.Boosters.TYPES.EXPENSIVE:
a = 150
}
return a
}
;
var ComboBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_COMBO)
};
ComboBooster.prototype = Object.create(BaseBoosterBefore.prototype);
ComboBooster.prototype.constructor = ComboBooster;
ComboBooster.prototype.getActionBefore = function() {
return {
type: "combo",
source: this,
amount: 5
}
}
;
var DiceBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_DICE)
};
DiceBooster.prototype = Object.create(BaseBoosterBefore.prototype);
DiceBooster.prototype.constructor = DiceBooster;
DiceBooster.prototype.getActionBefore = function() {
return {
type: "dice",
source: this,
getDuration: function() {
return 2.6 + .2 * (Game.currentGame.dice.number || 6)
}
}
}
;
var EyeBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_EYE)
};
EyeBooster.prototype = Object.create(BaseBoosterBefore.prototype);
EyeBooster.prototype.constructor = EyeBooster;
EyeBooster.prototype.getActionBefore = function() {
return {
type: "eye",
source: this,
duration: 5
}
}
;
var HighlightBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_HIGHLIGHT)
};
HighlightBooster.prototype = Object.create(BaseBoosterBefore.prototype);
HighlightBooster.prototype.constructor = HighlightBooster;
HighlightBooster.prototype.getActionBefore = function() {
return {
type: "highlight",
source: this,
duration: "scramble" === cleverapps.config.name ? 0 : .3
}
}
;
var MagnetBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_MAGNET)
};
MagnetBooster.prototype = Object.create(BaseBoosterBefore.prototype);
MagnetBooster.prototype.constructor = MagnetBooster;
MagnetBooster.prototype.getActionBefore = function() {
return {
type: "magnet",
source: this,
duration: 2.2
}
}
;
var MagnifierBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_MAGNIFIER)
};
MagnifierBooster.prototype = Object.create(BaseBoosterBefore.prototype);
MagnifierBooster.prototype.constructor = MagnifierBooster;
MagnifierBooster.prototype.getActionBefore = function() {
return {
type: "magnifier",
source: this,
amount: 5,
duration: "scramble" === cleverapps.config.name ? 0 : .3
}
}
;
var MovesBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_MOVES)
};
MovesBooster.prototype = Object.create(BaseBoosterBefore.prototype);
MovesBooster.prototype.constructor = MovesBooster;
MovesBooster.prototype.getActionBefore = function() {
return {
type: "moves",
source: this,
amount: 5
}
}
;
var MultiColorBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_MULTICOLOR)
};
MultiColorBooster.prototype = Object.create(BaseBoosterBefore.prototype);
MultiColorBooster.prototype.constructor = MultiColorBooster;
MultiColorBooster.prototype.getActionBefore = function() {
return {
type: "multicolor",
source: this,
amount: 1
}
}
;
var TwoJokersBooster = function() {
BaseBoosterBefore.call(this, cleverapps.Boosters.TYPE_JOKERS)
};
TwoJokersBooster.prototype = Object.create(BaseBoosterBefore.prototype);
TwoJokersBooster.prototype.constructor = TwoJokersBooster;
TwoJokersBooster.prototype.getActionBefore = function() {
return {
type: "jokers",
source: this,
duration: 1.6
}
}
;
var WindowBoosterBefore = function(a, b) {
cleverapps.EventEmitter.call(this);
this.booster = a;
this.level = b;
this.selected = !1;
this.changeAmountListener = this.booster.on("changeAmount", this.onChangeAmount.bind(this));
this.onChangeAmount()
};
WindowBoosterBefore.prototype = Object.create(cleverapps.EventEmitter.prototype);
WindowBoosterBefore.prototype.constructor = WindowBoosterBefore;
WindowBoosterBefore.prototype.onChangeAmount = function() {
this.isDisabled() ? delete this.bonus : this.bonus = Lantern.GetBoosterBonus(this.level, this.booster);
this.trigger("changeAmount")
}
;
WindowBoosterBefore.prototype.getIcon = function() {
return this.isDisabled() ? bundles.boosters_before.frames.booster_before_lock_png : this.booster.icon
}
;
WindowBoosterBefore.prototype.getLevelAvailable = function() {
return cleverapps.humanReadableNumber({
floatLevel: this.booster.available.level
})
}
;
WindowBoosterBefore.prototype.getAmount = function() {
return this.booster.getAmount()
}
;
WindowBoosterBefore.prototype.getForce = function() {
return this.booster.force
}
;
WindowBoosterBefore.prototype.getPrice = function() {
return this.booster.getPrice().amount
}
;
WindowBoosterBefore.prototype.setSelected = function(a) {
this.selected !== a && (this.selected = a,
this.trigger("update"))
}
;
WindowBoosterBefore.prototype.onClick = function() {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
!this.isLantern() && this.isActive() && (this.isAd() ? cleverapps.rewardedAdsManager.playRewarded(this.booster.limit, function() {
cleverapps.adsLimits.watch(this.booster.limit);
cleverapps.boosters.add(this.booster.id, 1);
this.setSelected(!0)
}
.bind(this)) : this.isSelected() ? this.setSelected(!1) : (this.booster.canExecute() || this.booster.buy()) && this.setSelected(!0))
}
;
WindowBoosterBefore.prototype.isSelected = function() {
return this.selected
}
;
WindowBoosterBefore.prototype.isActive = function() {
return this.booster.isAvailable()
}
;
WindowBoosterBefore.prototype.isDisabled = function() {
return !this.booster.isAvailable() || this.booster.isUpcoming()
}
;
WindowBoosterBefore.prototype.isUpcoming = function() {
return this.booster.isUpcoming()
}
;
WindowBoosterBefore.prototype.isAd = function() {
return this.booster.isAdsAvailable() && 0 >= this.getAmount()
}
;
WindowBoosterBefore.prototype.isLantern = function() {
return Lantern.GetBoosterBonus(this.level, this.booster) && !this.booster.isForceAvailable() && !cleverapps.config.features.includes("lantern_start")
}
;
WindowBoosterBefore.prototype.showTutorialStep = function(a) {
this.booster.isForceAvailable() && this.isActive() ? (cleverapps.boosters.has(this.booster.id) || cleverapps.boosters.add(this.booster.id, 1),
this.trigger("showForce", a)) : a()
}
;
WindowBoosterBefore.prototype.onExit = function() {
this.changeAmountListener && (this.changeAmountListener.clear(),
delete this.changeAmountListener)
}
;
var WindowBoostersBefore = function(a) {
this.level = a;
this.list = cleverapps.boosters.listBoostersBefore().map(function(b) {
return new WindowBoosterBefore(b,a)
})
};
WindowBoostersBefore.prototype.listActionsBefore = function() {
return this.list.filter(function(a) {
return a.isSelected() || !cleverapps.config.features.includes("lantern_start") && a.isLantern()
}).map(function(a) {
return a.booster.getActionBefore()
})
}
;
WindowBoostersBefore.prototype.showTutorialSteps = function() {
var a = this.list.map(function(b) {
return function(c) {
b.showTutorialStep(c)
}
});
(new ActionPlayer(a)).play()
}
;
WindowBoostersBefore.isAvailable = function(a) {
return cleverapps.user.checkAvailable(WindowBoostersBefore.AVAILABLE, a) && 0 < cleverapps.boosters.listBoostersBefore().length
}
;
WindowBoostersBefore.AVAILABLE = {
level: .83
};
"match3" === cleverapps.config.type && (WindowBoostersBefore.AVAILABLE = {
level: 1.46
});
var BoosterBeforeAmountView = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.setCascadeOpacityEnabled(!0);
this.booster = a;
this.bg = new cc.Sprite(bundles.boosters_before.frames.booster_before_purple_button_png);
this.addChild(this.bg);
this.booster.isDisabled() && this.booster.getAmount() > cleverapps.Boosters.INIT_AMOUNT && cleverapps.UI.convertToGrayScale(this.bg);
this.amount = cleverapps.UI.generateImageText("", cleverapps.styles.FONTS.BOOSTER_BEFORE_AMOUNT_TEXT);
this.addChild(this.amount);
this.icon = new cc.Sprite(bundles.boosters_before.frames.booster_before_check_icon_png);
this.addChild(this.icon);
this.update()
},
showActivated: function() {
this.amount.visible = !1;
this.icon.visible = !0;
this.bg.setSpriteFrame(bundles.boosters_before.frames.booster_before_green_button_png);
this.visible = !0
},
showAmount: function() {
var a = cleverapps.styles.BoosterBeforeAmountView;
this.amount.visible = !0;
this.icon.visible = !1;
this.bg.setSpriteFrame(bundles.boosters_before.frames.booster_before_purple_button_png);
this.visible = !0;
this.amount.setString(this.booster.getAmount());
this.amount.fitTo(a.amount.width)
},
update: function() {
this.booster.isSelected() ? this.showActivated() : 0 < this.booster.getAmount() ? this.showAmount() : this.visible = !1;
var a = cleverapps.styles.BoosterBeforeAmountView;
this.setContentSize2(Math.max(this.bg.width * this.bg.scale, this.amount.width * this.amount.scale), Math.max(this.bg.height * this.bg.scale, this.amount.height * this.amount.scale));
this.amount.setPositionRound(a.amount);
this.bg.setPositionRound(this.width / 2, this.height / 2);
this.icon.setPositionRound(a.icon)
}
});
cleverapps.styles.BoosterBeforeAmountView = {
amount: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 4
},
width: 55
},
icon: {
x: {
align: "center"
},
y: {
align: "center"
}
}
};
var BoosterBeforeBonusView = cc.Sprite.extend({
ctor: function() {
this._super(bundles.boosters_before.frames.booster_before_green_button_png);
this.icon = new cc.Sprite(bundles.boosters_before.frames.booster_before_lantern_icon_png);
this.icon.setPositionRound(this.width / 2, this.height / 2);
this.addChild(this.icon)
},
lanternAnimation: function() {
this.scale = 0;
this.runAction(new cc.Sequence(new cc.DelayTime(1.1),new cc.ScaleTo(.2,1,1)))
}
});
var BoosterBeforeView = cc.Scale9Sprite.extend({
ctor: function(a, b) {
this._super(bundles.boosters_before.frames.booster_before_bg_png);
this.windowBooster = a;
this.level = b;
a = cleverapps.styles.BoosterBeforeView;
this.setContentSize2(a);
this.createIcon();
this.windowBooster.isUpcoming() && this.createUpcomingText();
this.windowBooster.isLantern() && !cleverapps.config.features.includes("lantern_start") && (b = new BoosterBeforeBonusView,
b.setPositionRound(a.bonus),
this.addChild(b),
b.lanternAnimation());
this.windowBooster.isDisabled() || this.windowBooster.isLantern() || (this.amount = new BoosterBeforeAmountView(this.windowBooster),
this.amount.setPositionRound(a.amount),
this.addChild(this.amount),
this.createPrice());
this.windowBooster.on("update", this.createListener(this.update.bind(this)), this);
this.windowBooster.on("showForce", this.createListener(this.showForce.bind(this)), this);
this.windowBooster.on("changeAmount", this.createListener(this.update.bind(this)), this);
cleverapps.adsLimits.on("update", this.createListener(this.update.bind(this)), this);
if (cleverapps.config.soft)
cleverapps.user.on("changeSoft", this.update.bind(this), this);
else
cleverapps.user.on("changeHard", this.update.bind(this), this);
this.windowBooster.isDisabled() || this.windowBooster.isLantern() || (cleverapps.UI.applyHover(this),
cleverapps.UI.onClick(this, this.onClick.bind(this)));
this.update()
},
showUp: function(a, b) {
this.setVisible(!1);
this.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.CallFunc(function() {
b || cleverapps.audio.playSound(bundles.boosters_before.urls.appear_sfx, {
throttle: 0
});
this.setScale(.5);
this.setVisible(!0)
}
.bind(this)),(new cc.ScaleTo(.4,1,1)).easing(cc.easeBackOut(2))))
},
createPrice: function() {
var a = cleverapps.styles.BoosterBeforeView.price
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.content.width, a.content.height);
var c = this.price = new TextWithIcon("$$" + this.windowBooster.getPrice(),{
font: cleverapps.styles.FONTS.WHITE_TEXT
});
b.addChild(c);
c.setPosition(b.width / 2, b.height / 2);
"riddles" === cleverapps.config.ui ? (c = this.ads = new cc.Sprite(bundles.buttons_inlined_icons.frames.ad_icon_png),
c.setPositionRound(a.ads),
c.setRotation(a.ads.rotation),
this.addChild(c)) : (c = this.ads = new TextWithIcon("## x1",{
font: cleverapps.styles.FONTS.WHITE_TEXT
}),
b.addChild(c),
c.setPosition(b.width / 2, b.height / 2));
b = this.priceButton = new cleverapps.UI.Button({
content: b,
width: a.width,
height: a.height,
type: cleverapps.styles.UI.Button.Images.small_button_green,
keepRadius: !0,
onClicked: this.onClick.bind(this)
});
this.addChild(b);
b.setPositionRound(a)
},
createUpcomingText: function() {
var a = cleverapps.styles.BoosterBeforeView;
this.textAvailableBg = cleverapps.UI.createScale9Sprite(bundles.boosters_before.frames.booster_before_level_bg, a.textAvailable.bg.rect);
this.addChild(this.textAvailableBg);
this.textAvailableBg.setContentSize2(a.textAvailable.bg);
this.textAvailableBg.setPositionRound(a.textAvailable.bg);
var b = cleverapps.UI.generateOnlyText(Messages.get("UnlockOnLevel", {
level: this.windowBooster.getLevelAvailable()
}), cleverapps.styles.FONTS.BOOSTERS_BEFORE_UNLOCK || cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
this.addChild(b, 1);
b.setPositionRound(a.textAvailable);
b.fitTo(a.textAvailable.width)
},
createIcon: function() {
var a = cleverapps.styles.BoosterBeforeView;
a = a.icon[this.windowBooster.id] ? a.icon[this.windowBooster.id].dy : a.icon.dy;
this.icon = new cc.Sprite(this.windowBooster.getIcon());
this.windowBooster.isUpcoming() ? this.icon.setOpacity(150) : this.icon.setOpacity(255);
this.icon.setPositionRound(this.width / 2, this.height / 2 + a);
this.addChild(this.icon)
},
onClick: function() {
this.windowBooster.onClick();
this.icon.stopAllActions();
this.icon.setScale(.95);
this.icon.runAction((new cc.ScaleTo(.15,1)).easing(cc.easeBackInOut()));
var a = this.windowBooster.isSelected() ? bundles.main.urls.booster_before_cancel_effect : bundles.main.urls.booster_before_selection_effect;
cleverapps.audio.playSound(a)
},
updateBackground: function() {
var a = bundles.boosters_before.frames.booster_before_bg_png;
if (this.windowBooster.isDisabled())
a = bundles.boosters_before.frames.booster_before_bg_off_png;
else if (this.windowBooster.isSelected() || this.windowBooster.isLantern())
a = bundles.boosters_before.frames.booster_before_bg_on_png;
this.setSpriteFrame(a)
},
updateIcon: function() {
this.icon.setSpriteFrame(this.windowBooster.getIcon());
this.windowBooster.isUpcoming() ? this.icon.setOpacity(150) : this.icon.setOpacity(255)
},
update: function() {
this.updateBackground();
this.amount && this.amount.update();
this.priceButton && ("riddles" === cleverapps.config.ui ? this.priceButton.setVisible(!this.windowBooster.isAd() && this.windowBooster.isActive() && 0 >= this.windowBooster.getAmount()) : this.priceButton.setVisible(this.windowBooster.isActive() && 0 >= this.windowBooster.getAmount()),
this.price.setVisible(!this.windowBooster.isAd()),
this.ads.setVisible(this.windowBooster.isAd()));
this.windowBooster.isSelected() && Messages.has("BoosterBeforeUse_" + this.windowBooster.booster.id) && cleverapps.notification.create("BoosterBeforeUse_" + this.windowBooster.booster.id, {
image: this.windowBooster.booster.icon
})
},
showForce: function(a) {
var b = this.windowBooster.getForce();
if (cleverapps.forces.isAvailable(this, b)) {
var c = cleverapps.windows.currentWindow() && cleverapps.windows.currentWindow().window;
cleverapps.forces.create(this, b, {
importantNodes: c ? [c] : void 0
});
cleverapps.forces.onceForceClosed = a;
this.update()
} else
a()
},
onExit: function() {
this.windowBooster.onExit()
}
});
cleverapps.styles.BoosterBeforeView = {
width: 186,
height: 186,
bonus: {
x: {
align: "right",
dx: 18
},
y: {
align: "bottom",
dy: -18
}
},
amount: {
x: {
align: "right",
dx: 18
},
y: {
align: "bottom",
dy: -18
}
},
price: {
width: 160,
height: 80,
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -40
},
content: {
width: 115,
height: 50
},
ads: {
rotation: 10,
x: {
align: "right",
dx: -4
},
y: {
align: "bottom",
dy: 7
}
}
},
textAvailable: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 8
},
width: 170,
bg: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -5
},
width: 190,
height: 55
}
},
icon: {
dy: 0
}
};
var BoostersBeforeComponent = function(a, b) {
var c = cleverapps.styles.BoostersBeforeComponent
, d = cleverapps.styles.FONTS.WINDOW_BIG_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT;
cleverapps.config.features.includes("lantern_start") && (d = cleverapps.styles.FONTS.BOOSTERS_BEFORE_TEXT);
d = cleverapps.UI.generateOnlyText("BoostersBeforeComponent.Title", d);
var e = a.list.map(function(h) {
return new BoosterBeforeView(h,a.level)
})
, f = new cleverapps.Layout(e,{
padding: c.boostersPadding,
margin: b ? c.lantern.boostersMargin : c.boostersMargin,
direction: cleverapps.UI.HORIZONTAL
});
cleverapps.config.features.includes("lantern_start") && f.runAction(new cc.Sequence(new cc.DelayTime(.2),new cc.PlaySound(bundles.boosters_before.urls.appear_sfx)));
e.forEach(function(h, k) {
cleverapps.config.features.includes("lantern_start") ? h.showUp(.2, !0) : h.showUp(.2 + .2 * k)
});
c = new cleverapps.Layout([d, f],{
margin: b ? c.lantern.contentMargin : c.contentMargin,
direction: cleverapps.UI.VERTICAL
});
d = a.list.some(function(h) {
return h.isLantern()
});
e = Lantern.Get();
if (d && e && !b) {
var g = new LanternView(e,c);
c.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.CallFunc(function() {
g.show()
}
),new cc.DelayTime(.2),new cc.CallFunc(function() {
g.replaceParentSamePlace(cleverapps.windows.currentWindow());
g.setLocalZOrder(20)
}
),new cc.DelayTime(.6),new cc.CallFunc(function() {
g.hide()
}
)))
}
return c
};
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
BOOSTERS_BEFORE_TEXT: {
size: 40,
color: new cc.Color(220,110,70,255)
}
});
cleverapps.styles.BoostersBeforeComponent = {
boostersPadding: {
bottom: 20
},
contentMargin: 50,
lantern: {
boostersMargin: 25,
contentMargin: 30
},
boostersMargin: 25
};
var BoostersBeforeHelper = {
animateAppear: function(a, b, c) {
c = cleverapps.once(c || function() {}
);
if (a && a.parent && b.target && b.target.parent) {
var d = b.target
, e = cleverapps.scenes.getRunningScene();
a.setPosition(a.getParent().convertToNodeSpace(d.getParent().convertToWorldSpace(d.getPosition())));
a.replaceParentSamePlace(e);
a.setLocalZOrder(10);
a.setScale(2);
a.runAction(new cc.Sequence((new cc.ScaleTo(.5,b.scale)).easing(cc.easeBackOut()),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.main.urls.collect_coins_effect);
!1 !== b.remove && a.parent && a.removeFromParent(!0)
}
)));
a.runAction(new cc.Sequence(new cc.DelayTime(.3),new cc.CallFunc(c)));
BoostersBeforeHelper.animateStars(a)
} else
c()
},
animateStars: function(a) {
var b = new cleverapps.Spine(bundles.game.jsons.boosters_before_json);
b.setAnimation(0, "animation", !1);
b.setPositionRound(a.x, a.y);
a.parent.addChild(b);
b.setLocalZOrder(a.getLocalZOrder() - 1);
b.setTimeScale(1.3);
b.runAction(new cc.Sequence(new cc.DelayTime(1.3),new cc.RemoveSelf))
}
};
var EyeBoosterView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.booster = a;
this.grid = b.grid;
this.boardView = b;
this.board = b.board;
this.setAnchorPoint(.5, .5);
this.soundNode = new cc.Node;
this.addChild(this.soundNode);
this.booster.on("giveBonus", this.giveBonus.bind(this), this);
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && (EyeBoosterView.ANIMATION_TIME_SCALE = .6,
EyeBoosterView.SINGLE_PASS_TIME = 2.25)
},
giveBonus: function() {
var a = cleverapps.scenes.getRunningScene()
, b = new cleverapps.Spine(bundles.game.jsons.eye_booster_json);
a.addChild(b);
b.setLocalZOrder(110);
b.setPositionRound(a.width / 2, a.height / 2);
b.setAnimation(0, "show", !1);
b.setCompleteListener(function() {
b.setAnimation(0, "activate", !1);
b.setCompleteListenerRemove();
b.setTimeScale(EyeBoosterView.ANIMATION_TIME_SCALE);
var c = [];
this.grid.placeholders.forEach(function(d, e) {
d.forEach(function(f, g) {
if (!this.board.foundWordsSet[this.board.words[e]]) {
var h = this.boardView.createLetter(this.board.words[e][g].toUpperCase());
this.grid.addChild(h);
h.setupChildren = function() {
h.setPositionRound(this.grid.getCell(e, g).x, this.grid.getCell(e, g).y + cleverapps.styles.BoardView.Letter.paddingBottom)
}
.bind(this);
h.setupChildren();
c.push(h)
}
}
.bind(this))
}
.bind(this));
c.sort(function(d, e) {
return d.x - e.x
});
this.soundNode.runAction(new cc.RepeatForever(new cc.Sequence(new cc.PlaySound(bundles.game.urls.eye_booster_effect),new cc.DelayTime(2.4))));
this.runPass(c, 0)
}
.bind(this));
cleverapps.audio.playSound(bundles.game.urls.eye_booster_start_effect)
},
runPass: function(a, b) {
if (b === EyeBoosterView.PASSES_COUNT)
this.onAllPassesFinished(a);
else {
var c = cleverapps.styles.EyeBoosterView
, d = c.MIN_OPACITY_OFFSET
, e = c.MAX_OPACITY_OFFSET
, f = a[0].x - d
, g = a[a.length - 1].x + d
, h = g - f
, k = cleverapps.wait(a.length, this.runPass.bind(this, a, b + 1));
a.forEach(function(m) {
var l = 0 === b % 2 ? m.x : g - m.x;
var n = (l - d - f) / h * EyeBoosterView.SINGLE_PASS_TIME;
l = (l - e - f) / h * EyeBoosterView.SINGLE_PASS_TIME - n;
m.setOpacity(0);
m.runAction(new cc.Sequence(new cc.DelayTime(n),new cc.FadeIn(l),new cc.FadeOut(l),new cc.CallFunc(k)))
})
}
},
onAllPassesFinished: function(a) {
this.soundNode.stopAllActions();
a.forEach(function(b) {
b.removeFromParent()
});
this.board.showUpLetters(!1);
this.board.showUpCoins(!1);
this.board.showUpStars(!1);
this.board.trigger("afterShowUp", !1)
}
});
EyeBoosterView.ANIMATION_TIME_SCALE = .8;
EyeBoosterView.SINGLE_PASS_TIME = 1.8;
EyeBoosterView.PASSES_COUNT = 2;
cleverapps.styles.EyeBoosterView = {
MIN_OPACITY_OFFSET: 300,
MAX_OPACITY_OFFSET: 100
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_COMBO] = {
model: ComboBooster,
type: cleverapps.Boosters.TYPES.CHEAP,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.heroes_png,
force: Forces.FIRST_BOOSTERS_BEFORE,
available: {
level: 1.73
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_MOVES] = {
model: MovesBooster,
type: cleverapps.Boosters.TYPES.MEDIUM,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.moves_png,
force: Forces.SECOND_BOOSTERS_BEFORE,
available: {
level: 2.4
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_MULTICOLOR] = {
model: MultiColorBooster,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.multicolor_png,
force: Forces.THIRD_BOOSTERS_BEFORE,
available: {
level: 2.93
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_MAGNET] = {
model: MagnetBooster,
type: cleverapps.Boosters.TYPES.CHEAP,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.magnet_png,
force: Forces.FIRST_BOOSTERS_BEFORE,
available: {
level: 1.85
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_DICE] = {
model: DiceBooster,
type: cleverapps.Boosters.TYPES.MEDIUM,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.dice_png,
force: Forces.SECOND_BOOSTERS_BEFORE,
available: {
level: 2.4
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_JOKERS] = {
model: TwoJokersBooster,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.joker_png,
force: Forces.THIRD_BOOSTERS_BEFORE,
available: {
level: 2.93
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_HIGHLIGHT] = {
model: HighlightBooster,
type: cleverapps.Boosters.TYPES.CHEAP,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.highlight,
force: Forces.FIRST_BOOSTERS_BEFORE,
available: {
level: 1.33
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_EYE] = {
model: EyeBooster,
type: cleverapps.Boosters.TYPES.MEDIUM,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.eye,
force: Forces.SECOND_BOOSTERS_BEFORE,
available: {
level: 2.4
}
};
cleverapps.Boosters.CONFIG[cleverapps.Boosters.TYPE_MAGNIFIER] = {
model: MagnifierBooster,
type: cleverapps.Boosters.TYPES.EXPENSIVE,
limit: AdsLimits.TYPES.BOOSTERS_BEFORE,
icon: bundles.reward_icons.frames.hint,
force: Forces.THIRD_BOOSTERS_BEFORE,
available: {
level: 2.93
}
};
cleverapps.ServerFlags = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.SERVER_FLAGS);
this.flags = a ? a : []
}
;
cleverapps.ServerFlags.prototype.reset = function() {
this.flags = [];
this.save()
}
;
cleverapps.ServerFlags.prototype.hasFlag = function(a) {
return 0 <= this.flags.indexOf(a)
}
;
cleverapps.ServerFlags.prototype.setFlag = function(a) {
this.hasFlag(a) || (this.flags.push(a),
this.save())
}
;
cleverapps.ServerFlags.prototype.clearFlag = function(a) {
a = this.flags.indexOf(a);
-1 !== a && (this.flags.splice(a, 1),
this.save())
}
;
cleverapps.ServerFlags.prototype.getInfo = function() {
return this.flags
}
;
cleverapps.ServerFlags.prototype.updateInfo = function(a, b) {
this.flags = a;
this.save(b)
}
;
cleverapps.ServerFlags.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.SERVER_FLAGS, this.flags);
a || cleverapps.synchronizer.addUpdateTask("serverflags")
}
;
cleverapps.ServerFlags.PAGE_LIKED = 2;
cleverapps.ServerFlags.EXPEDITION_COMPENSATION = 5;
var levels = {
User: function(a) {
cleverapps.User.call(this, a);
connector.platform.on("userIdChanged", this.onUserIdChanged.bind(this))
}
};
levels.User.prototype = Object.create(cleverapps.User.prototype);
levels.User.prototype.constructor = levels.User;
levels.User.prototype.getProgress = function() {
return cleverapps.humanReadableNumber(this.episode, this.level) - 1
}
;
levels.User.prototype.getVirtualProgress = function() {
return cleverapps.humanReadableNumber(this.episode, this.level) + this.progress - 1
}
;
levels.User.prototype.loadData = function(a) {
cleverapps.User.prototype.loadData.call(this, a);
this.episode = a.episode;
this.level = a.level;
this.league = this.calcLeague();
this.progress = a.progress || 0;
a.uniqueStartEvent && (this.uniqueStartEvent = a.uniqueStartEvent);
this.migrateEpisode();
this.calcRating()
}
;
levels.User.prototype.calcRating = function() {
var a = this.calcLeague();
this.league !== a && (this.league = a,
this.isLeagueChanged = !0,
this.onLeagueChangeListener());
this.save()
}
;
levels.User.prototype.isUniqueStart = function(a, b, c) {
a = a + "_" + b + "_" + c;
if (this.uniqueStartEvent === a)
return !1;
this.uniqueStartEvent = a;
this.save(!1);
return !0
}
;
levels.User.prototype.getPassAllProgress = function() {
return this.progress
}
;
levels.User.prototype.isCurrentLevel = function(a, b) {
if (cleverapps.meta.getType() !== Meta.HOSE)
return !0;
var c = this.getCurrentLevel();
return c.levelNo === a && c.episodeNo === b
}
;
levels.User.prototype.isPassedLevel = function(a, b) {
return this.episode > b || this.episode === b && this.level > a
}
;
levels.User.prototype.getHumanReadableNumber = function() {
return cleverapps.humanReadableNumber(this.episode, this.level)
}
;
levels.User.prototype.checkAvailable = function(a, b) {
a = a || {};
b = b || [];
var c = cleverapps.config.name;
if (a[c])
return this.checkAvailable(a[c], b);
if (cleverapps.config.subtype && a[cleverapps.config.subtype])
return this.checkAvailable(a[cleverapps.config.subtype], b);
var d = connector.info.source;
if (a[d])
return this.checkAvailable(a[d], b);
if (a.registeredDate && this.registered < (new Date(a.registeredDate)).getTime() || a.registeredBefore && this.registered >= (new Date(a.registeredBefore)).getTime() || !cleverapps.config.debugMode && a.registered && this.registered + cleverapps.parseInterval(a.registered) > Date.now() || a.disabled || a.debugMode && !cleverapps.config.debugMode)
return !1;
a.level = a.level || 0;
a.episode = a.episode || 0;
return a.projectName && (a.projectName = cleverapps.toArray(a.projectName),
-1 === a.projectName.indexOf(c)) || a.types && -1 === a.types.indexOf(cleverapps.config.type) || a.meta && -1 === a.meta.indexOf(cleverapps.meta.getType()) || a.feature && -1 === (cleverapps.config.features || []).indexOf(a.feature) || a.source && (Array.isArray(a.source) || (a.source = [a.source]),
-1 === a.source.indexOf(d)) ? !1 : a.language && cleverapps.settings.language !== a.language || a.payments && cleverapps.flags.monetization !== cleverapps.Flags.MONETIZATION_REGULAR || a.paymentsCountry && cleverapps.country.getCountry() !== a.paymentsCountry ? !1 : b.ignoreProgress ? !0 : void 0 !== a.gameLevel ? cleverapps.gameLevel && cleverapps.gameLevel.level >= a.gameLevel : this.getFloatLevel() + 1E-8 >= a.level
}
;
levels.User.prototype.getFloatLevel = function(a, b) {
void 0 === a && (a = this.episode);
void 0 === b && (b = this.level);
return "merge" === cleverapps.config.type ? b + Math.min(1, cleverapps.expBySlots[Meta.SLOT_MAIN].getExp() / cleverapps.gameLevel.nextLevelThreshold(!0)) : "knockout" === cleverapps.config.regime ? 6 * (a + b / Level.LEVELS_PER_EPISODE) : 2 * (a + b / Level.LEVELS_PER_EPISODE)
}
;
levels.User.prototype.parseFloatLevel = function(a) {
for (var b = {
episodeNo: 0,
levelNo: 0
}, c = 0, d = 0; ; ++c) {
"merge" !== cleverapps.config.type && c >= Level.LEVELS_PER_EPISODE && (c = 0,
d += 1);
if (this.getFloatLevel(d, c) > a)
return b;
b.episodeNo = d;
b.levelNo = c
}
}
;
levels.User.prototype.isPassedAll = function() {
return cleverapps.isLevels() && this.episode >= this.getEpisodesAmount()
}
;
levels.User.prototype.incLevel = function() {
if (this.isPassedAll()) {
this.progress++;
if ("board" === cleverapps.config.type) {
var a = this.getCurrentLevel();
cleverapps.GameSaver.removeSave(cleverapps.GameSaver.getStoreSlot(a.episodeNo, a.levelNo))
}
this.trigger("incLevel");
this.calcRating();
this.save()
} else
this.level++,
this.level === Level.LEVELS_PER_EPISODE && (this.level = 0,
this.incEpisode()),
this.trigger("incLevel"),
this.calcRating(),
this.save(),
2 === this.getHumanReadableNumber() && 0 === this.getDaysSinceRegistration() && this.reportRetention()
}
;
levels.User.prototype.incEpisode = function() {
this.episode++;
this.calcRating();
this.save();
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.GENERAL.LEVEL_UP, {
level: this.episode
});
cleverapps.conversionManager.processConversion(cleverapps.EVENTS.CONVERSIONS.LEVEL, this.episode)
}
;
levels.User.prototype.getPhysicalLevel = function() {
return this.getHumanReadableNumber()
}
;
levels.User.prototype.getRandomLevel = function(a, b) {
a = void 0 === a ? 10 * this.progress : a;
var c = "blocks" === cleverapps.config.type ? 15 : 75
, d = levels.User.CalcEpisodesAndLevelsAmount(cleverapps.config.importMode).amountLevels - 1;
a = cleverapps.Random.random(c, d, a);
return Level.CreateByNumber(a, {
type: b
})
}
;
levels.User.prototype.getCurrentLevel = function() {
return this.isPassedAll() ? this.getRandomLevel() : new Level(this.episode,this.level)
}
;
levels.User.prototype.getVirtualLevel = function() {
return this.getHumanReadableNumber() + this.progress
}
;
levels.User.prototype.getVirtualDisplayLevel = function() {
return this.getVirtualLevel()
}
;
levels.User.prototype.setLevel = function(a) {
this.episode = Math.floor(a / 15);
this.level = a % 15;
this.progress = 0;
var b = this.getEpisodesAmount();
this.episode >= b && (this.episode = b,
this.level = 0,
this.progress = a - this.getHumanReadableNumber() + 1);
this.save()
}
;
levels.User.prototype.getPlayerInfo = function() {
return {
id: connector.player.id,
name: connector.player.name || Messages.get("Friends.You"),
avatar: connector.player.avatar || "#avatars/default_avatar.png",
firstName: connector.player.firstName,
lastName: connector.player.lastName
}
}
;
levels.User.prototype.onUserIdChanged = function(a) {
var b = a.oldId;
a = a.newId;
delete this.idfa;
this.save(!1);
cleverapps.abTest.updateGroups();
var c = cleverapps.isRumble() && cleverapps.meta.getRumble();
c && c.changePlayerId(b, a);
(c = Game.currentGame && Game.currentGame.competition) && c.changePlayerId(b, a);
cleverapps.userIdsHistory.add(b);
this.updateIDFA()
}
;
levels.User.prototype.getSaveInfo = function() {
var a = cleverapps.User.prototype.getSaveInfo.call(this);
return Object.assign(a, {
episode: this.episode,
level: this.level,
uniqueStartEvent: this.uniqueStartEvent,
progress: this.progress
})
}
;
levels.User.prototype.updateInfo = function(a) {
delete a.source;
var b = a.visited;
a.forcedVisited ? a.visited = a.forcedVisited : delete a.visited;
var c = a.exp;
delete a.exp;
cleverapps.expBySlots[Meta.SLOT_MAIN].load(c);
for (var d in a)
this[d] = a[d];
this.migrateEpisode();
this.save(!1);
b && !this.lastReportDAU && (this.lastReportDAU = this.getDaysSinceRegistration(b))
}
;
levels.User.prototype.migrateEpisode = function() {
if ("woodenblock" === cleverapps.config.name) {
var a = this.getEpisodesAmount();
this.episode >= a && (this.progress += (this.episode - a) * Level.LEVELS_PER_EPISODE + this.level,
this.episode = a,
this.level = 0)
}
}
;
levels.User.prototype.getInfo = function() {
return {
id: connector.platform.getUserID(),
gold: this.gold,
soft: this.soft,
registered: this.registered,
visited: this.visited,
source: connector.info.source,
channel: this.channel,
progressCompare: this.progressCompare,
progress: this.progress,
level: this.level,
episode: this.episode,
exp: cleverapps.expBySlots[Meta.SLOT_MAIN].getExp()
}
}
;
levels.User.prototype.getEpisodesAmount = function() {
void 0 === this.episodesAmount && (this.episodesAmount = levels.User.CalcEpisodesAmount(cleverapps.config.importMode));
return this.episodesAmount
}
;
levels.User.prototype.resetEpisodesAmount = function() {
this.episodesAmount = void 0
}
;
levels.User.CalcEpisodesAndLevelsAmount = function(a) {
for (var b = 0, c = 0, d = 0; void 0 !== bundles[Level.BundleId(d)]; d++) {
var e = bundles[Level.BundleId(d)];
if (!e.jsons || !e.jsons.levels && !e.jsons.map_json || e.meta.debug && !a)
break;
b++;
c += e.meta.episode.levelsAmount
}
return {
amountEpisodes: b,
amountLevels: c
}
}
;
levels.User.CalcEpisodesAmount = function(a) {
return levels.User.CalcEpisodesAndLevelsAmount(a).amountEpisodes
}
;
levels.User.GOLD_FB_CONNECT_REWARD = 100;
var VersionChecker = function() {
this.serverVersion = cleverapps.dataLoader.load(DataLoader.TYPES.SERVER_VERSION, {
raw: !0
});
this.clientVersion = void 0
};
VersionChecker.prototype.check = function() {
cleverapps.RestClient.get("/", {}, function(a) {
this.serverVersion = a;
cleverapps.dataLoader.save(DataLoader.TYPES.SERVER_VERSION, a, {
raw: !0
})
}
.bind(this), function() {
console.log("Error getting server version in VersionChecker!")
})
}
;
VersionChecker.prototype.needUpdate = function() {
if (!this.serverVersion)
return !1;
var a = parseInt(cleverapps.config.version)
, b = parseInt(this.serverVersion);
return a < b
}
;
VersionChecker.prototype.isNewClientVersionAvailable = function() {
return this.clientVersion && this.clientVersion !== cleverapps.config.version
}
;
VersionChecker.prototype.isClientVersionActual = function() {
return this.clientVersion && this.clientVersion === cleverapps.config.version
}
;
VersionChecker.prototype.loadClientVersion = function(a) {
a = a || function() {}
;
if (connector.info.isNative || cleverapps.isLocalhost() || connector.platform.oneOf(connector.INSTANT, connector.GDCOM, connector.COOLMATHGAMES, connector.SAMSUNG))
this.clientVersion = cleverapps.config.version,
a();
else {
var b = cleverapps.config.staticUrl + "version.json";
cleverapps.RestClient.get(b, {}, function(c) {
console.log("loaded current client version - " + c.version);
this.clientVersion = c.version;
a()
}
.bind(this), function() {
console.log("error loading client version from path - " + b);
a()
})
}
}
;
levels.FPS = {
run: function(a, b) {
levels.FPS.fpsInterval || (levels.FPS.episode = a,
levels.FPS.level = b,
levels.FPS.fpsStatistics = [],
levels.FPS.fpsTotalFrames = cc.director.getTotalFrames(),
levels.FPS.fpsInterval = cleverapps.timeouts.setInterval(function() {
if (levels.FPS.fpsStatistics.length < levels.FPS.FPS_STATISTICS_MAX_LENGTH) {
var c = cc.director.getTotalFrames()
, d = Math.round(1E3 * (c - levels.FPS.fpsTotalFrames) / levels.FPS.FPS_STATISTICS_INTERVAL);
60 < d && (d = 60);
levels.FPS.fpsStatistics.push(d);
levels.FPS.fpsTotalFrames = c
} else
levels.FPS.stop()
}, levels.FPS.FPS_STATISTICS_INTERVAL))
},
stop: function() {
levels.FPS.fpsInterval && (cleverapps.timeouts.clearInterval(levels.FPS.fpsInterval),
levels.FPS.fpsInterval = !1);
if (levels.FPS.fpsStatistics && levels.FPS.fpsStatistics.length) {
levels.FPS.fpsStatistics.sort();
var a = levels.FPS.fpsStatistics[Math.floor(levels.FPS.fpsStatistics.length * levels.FPS.FPS_STATISTICS_PERCENT_VALUE)];
console.log("SAVE FPS: " + a);
cleverapps.playSession.inc(cleverapps.EVENTS.STATS.FPS_RATE, a);
cleverapps.playSession.inc(cleverapps.EVENTS.STATS.FPS_COUNT, 1);
levels.FPS.fpsStatistics = !1
}
}
};
levels.FPS.FPS_STATISTICS_MAX_LENGTH = 15;
levels.FPS.FPS_STATISTICS_PERCENT_VALUE = .1;
levels.FPS.FPS_STATISTICS_INTERVAL = 500;
levels.FPS.FPS_SWITCH_TO_LOW = 40;
var NewVersionWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.NewVersionWindow
, b = cleverapps.UI.generateOnlyText("NewVersionWindow.text1", cleverapps.styles.FONTS.WINDOW_TEXT, {
version: cleverapps.versionChecker.serverVersion,
title: Messages.get(cleverapps.config.title)
});
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.text.width, 0);
b.setAnchorPoint(.5, .5);
var c = cleverapps.UI.generateOnlyText("NewVersionWindow.text2", cleverapps.styles.FONTS.WINDOW_TEXT);
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
c.setDimensions(a.text.width, 0);
c.setAnchorPoint(.5, .5);
b = new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL,
padding: a.padding,
margin: a.margin
});
b.setAnchorPoint(.5, .5);
this._super({
title: "NewVersionWindow.Title",
name: "newversionwindow",
content: b,
button: {
text: "OK",
width: a.button.width,
height: a.button.height,
onPressed: function() {
connector.platform.openUrl(connector.platform.getGameUrl())
}
},
closeButton: !1
})
},
close: function() {}
});
cleverapps.styles.NewVersionWindow = {
text: {
width: 550
},
button: {
width: 220,
height: 90
},
margin: 40
};
"horizontal" === cleverapps.config.orientation && cleverapps.increaseStylesByKoef(cleverapps.styles.NewVersionWindow, 1.4);
var WaitWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = new LoadingAnimation;
a.setCascadeOpacityEnabled(!0);
a.setOpacity(0);
a.setVisible(!1);
var b = cleverapps.styles.WaitWindow;
this._super({
name: "waitwindow",
noBackground: !0,
content: a,
closeButton: !1,
styles: b
});
a.runAction(new cc.Sequence(new cc.DelayTime(b.delay),new cc.Show,new cc.FadeTo(.3,255)))
},
popUpAnimation: function() {},
closeAnimation: function(a) {
a()
}
});
WaitWindow.show = function() {
this.instance ? this.counter += 1 : cleverapps.focusManager.display({
stack: !0,
focus: "WaitWindow",
action: function(a) {
this.instance = new WaitWindow;
this.counter = 1;
this.onceWaitWindowClosed = a
}
.bind(this)
})
}
;
WaitWindow.hide = function() {
--this.counter;
0 === this.counter && (this.instance && (this.instance.close(),
this.instance = void 0),
this.onceWaitWindowClosed && (this.onceWaitWindowClosed(),
this.onceWaitWindowClosed = void 0))
}
;
cleverapps.styles.WaitWindow = {
delay: .2
};
var TacticalExtendWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.TacticalExtendWindow
, b = this.createAnimation()
, c = this.createText();
b = new cleverapps.Layout([c, b],{
margin: a.margin,
direction: cleverapps.UI.VERTICAL
});
this._super({
title: "TacticalExtendWindow.title",
name: "tacticalextendwindow",
content: b,
button: {
width: a.button.width,
height: a.button.height,
text: "$$" + TacticalExtendWindow.PRICE,
onPressed: this.onPressed.bind(this)
}
})
},
getPerson: function() {
return "hero"
},
createText: function() {
var a = cleverapps.styles.TacticalExtendWindow
, b = cleverapps.UI.generateOnlyText("TacticalExtendWindow.text", cleverapps.styles.FONTS.WINDOW_TEXT, {
amount: TacticalExtendWindow.AMOUNT
});
b.setDimensions(a.text.width, 0);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
return b
},
createAnimation: function() {
var a = cleverapps.styles.TacticalExtendWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.animation);
var c = new cleverapps.Spine(bundles.tactical_extend_window.jsons.tactical_extend);
c.setSkin(cleverapps.config.name);
c.setAnimation(0, "addmoves", !0);
b.addChild(c);
c.setPositionRound(a.animation);
return b
},
onPressed: function() {
Game.currentGame ? cleverapps.user.spendHard(cleverapps.EVENTS.SPENT.TACTICAL_EXTEND, TacticalExtendWindow.PRICE) && (this.giveMoves(),
this.close()) : this.close()
},
giveMoves: function() {
var a = cleverapps.UI.generateImageText(TacticalExtendWindow.AMOUNT, cleverapps.styles.FONTS.MOVES_TEXT);
a.setPositionRound(this.buttons);
this.buttons.parent.addChild(a);
a.runAction(new cc.Sequence(new cc.PlaySound(bundles.main.urls.shop_buy_effect),AnimationsLibrary.animateCollect(a, "moves", {
duration: .7,
scale: 1.5,
collectEffect: !0
}),new cc.RemoveSelf));
Game.currentGame.counter.setTimeout(function() {
Game.currentGame.setMoves(Game.currentGame.moves + TacticalExtendWindow.AMOUNT)
}, 700)
},
listBundles: function() {
var a = ["tactical_extend_window"];
cleverapps.config.rpg && a.push("dialogues");
return a
}
});
TacticalExtendWindow.canShow = function() {
if (!cleverapps.user.checkAvailable(TacticalExtendWindow.AVAILABLE) || !levels.user.canTakeHard(TacticalExtendWindow.PRICE))
return !1;
var a = cleverapps.dataLoader.load(DataLoader.TYPES.BUY_MOVES_WINDOW) || 0;
return Date.now() - a > cleverapps.parseInterval(TacticalExtendWindow.INTERVAL) && Math.random() < TacticalExtendWindow.PROBABILITY
}
;
TacticalExtendWindow.show = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.BUY_MOVES_WINDOW, Date.now());
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.TACTICAL_EXTEND_SHOW);
return new TacticalExtendWindow
}
;
TacticalExtendWindow.PROBABILITY = .12;
TacticalExtendWindow.PRICE = 50;
TacticalExtendWindow.AMOUNT = 3;
TacticalExtendWindow.INTERVAL = "1 hour";
cleverapps.config.debugMode && (TacticalExtendWindow.INTERVAL = "1 minute");
TacticalExtendWindow.AVAILABLE = {
level: 1.2
};
"merge" === cleverapps.config.type && (TacticalExtendWindow.AVAILABLE = {
disabled: !0
});
cleverapps.styles.TacticalExtendWindow = {
margin: 30,
text: {
width: 500
},
animation: {
width: 300,
height: 300,
x: {
align: "center"
},
y: {
align: "center"
}
},
button: {
width: 320,
height: 120
}
};
var FinisherWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.FinisherWindow;
this._super({
title: "FinisherWindow.title",
name: "finisherwindow",
content: this.generateContent(),
fireworks: !0,
button: {
width: a.button.width,
height: a.button.height,
text: "FinisherWindow.Button.text",
onPressed: function() {
connector.social.joinCommunityCallback()
}
},
openSound: bundles.finisher_window.urls.finisher_effect
})
},
generateStoreButton: function(a) {
var b = {
android: bundles.finisher_window.urls.android_png,
ios: bundles.finisher_window.urls.ios_png,
amazon: bundles.finisher_window.urls.amazon_png
}[a]
, c = connector.platform.getGameUrl(a);
if (c && b)
return a = new cc.Sprite(b),
cleverapps.UI.applyHover(a),
cleverapps.UI.onClick(a, function() {
connector.platform.openUrl(c)
}),
a
},
generateContent: function() {
var a = cleverapps.styles.FinisherWindow
, b = [];
b.push(this.createText("FinisherWindow.GroupText"));
if (connector.info.isNative || connector.platform.oneOf(connector.OK, connector.VK, connector.MM, connector.INSTANT)) {
var c = this.generateStoreButton(connector.info.source);
c && b.push(c);
b.push(this.createText("FinisherWindow.AllAndStoreText"))
} else
c = ["android", "ios", "amazon"].map(this.generateStoreButton).filter(function(d) {
return void 0 !== d
}),
0 < c.length && (b.push(this.createButtonsLayout(c.slice(0, 2))),
b.push(this.createText("FinisherWindow.StoreText"))),
b.push(this.createText("FinisherWindow.AllPassedText"));
return new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
createText: function(a) {
var b = cleverapps.styles.FinisherWindow;
a = cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.setDimensions(b.text.width, 0);
return a
},
createButtonsLayout: function(a) {
var b = cleverapps.styles.FinisherWindow;
return new cleverapps.Layout(a,{
padding: b.button.padding,
margin: b.button.margin,
direction: cleverapps.UI.HORIZONTAL
})
},
listBundles: function() {
return ["finisher_window"]
}
});
cleverapps.styles.FinisherWindow = {
margin: 10,
text: {
width: 550
},
button: {
padding: {
x: 0,
y: 10
},
margin: 30,
width: 460,
height: 100
}
};
levels.GameHints = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.LEVEL_HINTS);
this.usedHints = "number" === typeof a ? a : 0
}
;
levels.GameHints.prototype.reset = function() {
this.isCurrentLevel() && (this.usedHints = 0,
this.save())
}
;
levels.GameHints.prototype.isCurrentLevel = function() {
return Game.currentGame && Game.currentGame.level.isCurrentLevel()
}
;
levels.GameHints.prototype.addHint = function() {
this.isCurrentLevel() && (this.usedHints++,
this.save())
}
;
levels.GameHints.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.LEVEL_HINTS, this.usedHints)
}
;
var Lantern = function(a) {
this.mission = a;
this.load()
};
Lantern.prototype.isActive = function(a) {
return a ? a.isCurrentLevel() : levels.user.isCurrentLevel(cleverapps.environment.levelNo, cleverapps.environment.episodeNo)
}
;
Lantern.getMaxStreak = function() {
return 3
}
;
Lantern.prototype.save = function() {
this.mission.result = 0;
this.mission.update(this.streak)
}
;
Lantern.prototype.load = function() {
this.savedStreak = this.streak = this.mission.result
}
;
Lantern.prototype.getCurrentStreak = function() {
return this.savedStreak
}
;
Lantern.prototype.onChangeOutcome = function(a) {
a === GameBase.OUTCOME_GAVEUP ? this.streak = this.savedStreak : a === GameBase.OUTCOME_VICTORY ? this.savedStreak = this.streak = Math.min(this.savedStreak + 1, Lantern.getMaxStreak()) : a === GameBase.OUTCOME_LOST && (this.previousStreak = this.savedStreak,
this.savedStreak = this.streak = 0);
this.save()
}
;
Lantern.prototype.onStart = function() {
this.savedStreak = this.streak;
this.streak = 0;
this.save()
}
;
Lantern.prototype.listActionsBefore = function() {
if (!cleverapps.config.features.includes("lantern_start"))
return [];
var a = [{
type: "lantern",
duration: 1,
lanternStreak: this.streak
}, {
type: "combo",
amount: 3,
lantern: !0
}, {
type: "moves",
amount: 3,
lantern: !0
}, {
type: "multicolor",
amount: 1,
lantern: !0
}];
return 0 === this.streak ? [] : a.slice(0, this.streak + 1)
}
;
Lantern.Get = function() {
var a = cleverapps.missionManager.findRunningMission(Mission.TYPE_LANTERN);
return a && a.logic.lantern
}
;
Lantern.IsActive = function(a) {
var b = Lantern.Get();
return b && b.isActive(a)
}
;
Lantern.GetStreak = function(a) {
var b = Lantern.Get();
return b && b.isActive(a) && 0 < b.streak ? b.streak : 0
}
;
Lantern.GetCurrentStreak = function(a) {
var b = Lantern.Get();
return b && b.isActive(a) && 0 < b.savedStreak ? b.savedStreak : 0
}
;
Lantern.GetPreviousStreak = function(a) {
var b = Lantern.Get();
return b && b.isActive(a) && 0 < b.previousStreak ? b.previousStreak : 0
}
;
Lantern.GetBoosterBonus = function(a, b) {
var c = Lantern.Get();
b = cleverapps.boosters.listBoostersBefore().indexOf(b);
return c && c.isActive(a) && c.getCurrentStreak() > b ? 1 : 0
}
;
Lantern.ListActionsBefore = function(a) {
var b = Lantern.Get();
return b && b.isActive(a) ? b.listActionsBefore(a) : []
}
;
var LanternView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.lantern = a;
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(2);
this.styles = cleverapps.styles.LanternView;
this.animation = new cleverapps.Spine(bundles.lantern.jsons.lantern_json);
this.addChild(this.animation);
this.setContentSize2(this.animation.getContentSize());
this.animation.setPositionRound(this.width / 2, this.height / 2);
b = b || Game.currentGame.field.onGetView();
b.addChild(this)
},
show: function() {
this.animation.setAnimation(0, "idle_" + this.lantern.getCurrentStreak(), !0);
var a = this.getParent().convertToNodeSpace(cc.p(-this.width, 0));
a.x || (a.x = 0);
a.y = this.styles.show.y;
var b = 1 / this.parent.scale;
b = cc.p(this.parent.width / 2 + this.styles.offset.x * (1 > b ? b : 1), this.parent.height / 2 + this.styles.offset.y * (1 > b ? b : 1));
this.setPositionRound(a);
"heroes" === cleverapps.config.name ? this.runAction(new cc.MoveTo(.5,b)) : (this.setRotation(45),
this.runAction(new cc.Spawn(new cc.MoveTo(.5,b),new cc.RotateTo(.5,0))));
cleverapps.audio.playSound(bundles.lantern.urls.lanternshow_effect)
},
hide: function() {
var a = this.getParent().convertToNodeSpace(cc.p(-this.width, 0));
a.y = this.styles.hide.y;
this.animation.setAnimation(0, "out_" + this.lantern.getCurrentStreak(), !1);
this.animation.setCompleteListener(function() {
this.animation.setAnimation(0, "idle_" + this.lantern.getCurrentStreak(), !0);
var b = new cc.Spawn(new cc.MoveTo(.5,a),new cc.RotateTo(.4,-45));
"heroes" === cleverapps.config.name && (b = new cc.MoveTo(.5,a));
this.runAction(new cc.Sequence(b,new cc.RemoveSelf))
}
.bind(this));
cleverapps.audio.playSound(bundles.lantern.urls.lanternhide_effect)
}
});
cleverapps.styles.LanternView = {
offset: {
x: 0,
y: 150
},
show: {
y: 100
},
hide: {
y: 1E3
}
};
var FriendSorter = function() {
this.data = cleverapps.dataLoader.load(DataLoader.TYPES.SORTER);
this.data || (this.data = {});
cleverapps.config.debugMode && (FriendSorter.PRIVACY_INTERVAL = "1 minute");
this.update()
};
FriendSorter.PRIVACY_INTERVAL = "1 day";
FriendSorter.prototype.update = function() {
var a = {}, b = Date.now(), c = !1, d;
for (d in this.data)
this.data[d] + cleverapps.parseInterval(FriendSorter.PRIVACY_INTERVAL) > b ? a[d] = this.data[d] : c = !0;
c && (this.data = a,
this.save())
}
;
FriendSorter.prototype.save = function() {
cleverapps.dataLoader.save(DataLoader.TYPES.SORTER, this.data)
}
;
FriendSorter.prototype.canUse = function(a) {
return void 0 === this.data[a]
}
;
FriendSorter.prototype.markUsed = function(a) {
a.forEach(function(b) {
this.data[b] = Date.now()
}, this);
this.save()
}
;
FriendSorter.prototype.listActiveFriends = function() {
return cleverapps.friends.listFriends()
}
;
FriendSorter.prototype.listInactiveFriends = function() {
var a = cleverapps.invitalbleFriends.listFriends();
this.update();
return a = a.filter(function(b) {
return b && void 0 === this.data[b.id]
}, this)
}
;
var SelectFriendWindow = CleverappsWindow.extend({
onWindowLoaded: function(a, b) {
var c = new cc.Node;
c.setAnchorPoint(.5, .5);
this.content = c;
this.type = a;
cleverapps.config.debugMode && (SelectFriendWindow.PROCESS_PERIOD = "300 second");
var d = cleverapps.friends.listFriends().concat(cleverapps.invitalbleFriends.listFriends());
d.length ? this.generateFriendsContent(d, b) : this.generateNoFriendsContent();
this._super({
title: SelectFriendWindow.ByType[this.type].title,
name: "selectfriendwindow" + a,
content: c,
styles: cleverapps.styles.SelectFriendWindow.window
})
},
addCheck: function(a, b) {
var c = new cc.Sprite(bundles.checkbox.frames.check_mark_png);
b && cleverapps.UI.convertToGrayScale(c);
c.setPosition(a.width / 2, a.height / 2);
a.check = c;
a.addChild(c)
},
checkElementByFriendId: function(a, b) {
var c = this.selectedElements.friends.indexOf(a);
-1 !== c ? (this.selectedElements.data[a].checked = !1,
this.selectedElements.data[a].check.removeFromParent(),
this.selectedElements.data[a] = void 0,
this.selectedElements.friends.splice(c, 1)) : (this.addCheck(b),
b.checked = !0,
this.selectedElements.data[a] = b,
this.selectedElements.friends.push(a),
this.selectedElements.friends.length > SelectFriendWindow.MAX_SELECTED && this.checkElementByFriendId(this.selectedElements.friends[0]));
this.updateSelectedContent()
},
generateCheckbox: function(a, b) {
var c = cleverapps.styles.SelectFriendWindow.withFriends.friendContainer.checkBox;
if (!this.processTimeData) {
this.processTimeData = cleverapps.dataLoader.load(SelectFriendWindow.ByType[this.type].dataLoaderType());
this.processTimeData || (this.processTimeData = {});
for (var d in this.processTimeData)
this.processTimeData[d] < Date.now() - cleverapps.parseInterval(SelectFriendWindow.PROCESS_PERIOD) && (this.processTimeData[d] = void 0)
}
var e = function() {
cleverapps.UI.onClick(b, function() {
this.checkElementByFriendId(a.id, f)
}
.bind(this), {
interactiveScale: !1
});
cleverapps.UI.applyHover(b, {
onMouseOver: function() {
b.bg && b.bg.setColor(cleverapps.styles.COLORS.HOVER);
f.setScale(1.1)
},
onMouseOut: function() {
b.bg && b.bg.setColor(cleverapps.styles.COLORS.WHITE);
f.setScale(1)
}
})
}
.bind(this)
, f = this.generateCheckBoxBg();
f.setPositionRound(c.x, b.height / 2 + cleverapps.styles.SelectFriendWindow.Avatar.y);
b.fullData = {
checkBox: f,
id: a.id
};
b.addChild(f);
if (this.processTimeData && this.processTimeData[a.id] && this.processTimeData[a.id] > Date.now() - cleverapps.parseInterval(SelectFriendWindow.PROCESS_PERIOD)) {
d = {
showHours: !0,
font: cleverapps.styles.FONTS.WINDOW_SMALL_TEXT,
imageFont: !1
};
console.log("disabled", b);
var g = this.processTimeData[a.id] + cleverapps.parseInterval(SelectFriendWindow.PROCESS_PERIOD) - Date.now()
, h = new cleverapps.CountDownView(new cleverapps.CountDown(g),d)
, k = function() {
h.refresh();
h.removeFromParent();
b.name.setVisible(!0);
b.avatar.setOpacity(255);
f.setOpacity(255);
b.coinsIcon && b.coinsIcon.setOpacity(255);
f.check.removeFromParent();
b.notActive = !1;
e()
};
h.onEnter = function() {
cleverapps.CountDownView.prototype.onEnter.call(this);
h.countDown.onFinish = h.createListener(k)
}
;
h.setPosition(b.width / 2, c.timer.y);
b.addChild(h);
b.name.setVisible(!1);
this.addCheck(f, !0);
f.setOpacity(150);
b.avatar.setOpacity(120);
b.notActive = !0;
b.coinsIcon && b.coinsIcon.setOpacity(150)
} else
b.notActive = !1,
e()
},
generateCheckBoxBg: function() {
var a = new cc.Sprite(bundles.checkbox.frames.background_png);
a.setAnchorPoint(.5, .5);
a.setCascadeOpacityEnabled(!0);
return a
},
generateFriendContent: function(a) {
var b = cleverapps.styles.SelectFriendWindow.withFriends.friendContainer
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize(b.width, b.height);
if (bundles.select_friend_window.frames.friend_bg_png) {
var d = cleverapps.UI.createScale9Sprite(bundles.select_friend_window.frames.friend_bg_png);
d.setAnchorPoint(.5, .5);
d.setContentSize(b.width, b.height);
d.setPosition(c.width / 2, c.height / 2);
c.addChild(d);
c.bg = d
}
d = new cleverapps.UI.Avatar(a);
d.setPositionRound(cleverapps.styles.SelectFriendWindow.Avatar.x, c.height / 2 + cleverapps.styles.SelectFriendWindow.Avatar.y);
d.setAnchorPoint(.5, .5);
c.avatar = d;
d.setCascadeOpacityEnabled(!0);
c.addChild(d);
d = cleverapps.UI.generateTTFText(a.name, cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
d.setDimensions(b.Name.width, b.Name.height);
d.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
d.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP);
c.addChild(d);
d.setPositionRound(c.width / 2, b.Name.y);
c.name = d;
this.generateCheckbox(a, c);
return c
},
generateFriendsContent: function(a, b) {
this.selectedElements = {
friends: [],
data: {}
};
var c = cleverapps.styles.SelectFriendWindow.withFriends;
this.content.setContentSize(c.width, c.height);
var d = new cleverapps.UI.Button({
text: SelectFriendWindow.ByType[this.type].button,
width: c.Button.width,
height: c.Button.height,
onClicked: function() {
this.selectedElements.friends.length && (this.close(),
b(this.selectedElements.friends, function() {
if (this.processTimeData) {
for (var h = 0; h < this.selectedElements.friends.length; h++)
this.processTimeData[this.selectedElements.friends[h]] = Date.now();
cleverapps.dataLoader.save(SelectFriendWindow.ByType[this.type].dataLoaderType(), this.processTimeData)
}
}
.bind(this)))
}
.bind(this)
});
d.setPositionRound(this.content.width / 2 + c.Button.x, c.Button.y);
this.button = d;
this.content.addChild(d);
d = new cc.Node;
d.setAnchorPoint(0, .5);
d.setPositionRound(c.SelectedBlock.x, c.SelectedBlock.y);
var e = this.generateCheckBoxBg();
e.setAnchorPoint(0, .5);
e.setPositionRound(0, e.height / 2);
d.addChild(e);
var f = cleverapps.UI.generateTTFText("Selected", cleverapps.styles.FONTS.WINDOW_TEXT);
f.fitTo(c.selectedText.width);
f.setPositionRound(e.width + c.SelectedBlock.margin.x, e.y + f.height / 2);
f.setAnchorPoint(0, .5);
d.addChild(f);
var g = cleverapps.UI.generateTTFText("", cleverapps.styles.FONTS.WINDOW_TEXT);
g.setAnchorPoint(.5, .5);
this.selectedAmountText = g;
d.addChild(g);
this.updateSelectedContent();
g.setPositionRound(f.x + f.width / 2, e.y - g.height / 2);
d.setContentSize(e.width + f.width + c.SelectedBlock.margin.x, e.height);
this.content.addChild(d);
cleverapps.UI.applyHover(d, {
onMouseOver: function() {
e.setScale(1.1)
},
onMouseOut: function() {
e.setScale(1)
}
});
cleverapps.UI.onClick(d, function() {
this.switchSelectAll(e)
}
.bind(this));
d = new cc.Node;
d.setAnchorPoint(.5, .5);
this.friendContainers = a.map(function(h, k) {
return {
container: this.generateFriendContent(h),
order: k
}
}, this);
levels.friendSorter.update();
this.friendContainers.sort(function(h, k) {
return h.container.notActive !== k.container.notActive ? h.container.notActive ? 1 : -1 : levels.friendSorter.canUse(h.container.fullData.id) !== levels.friendSorter.canUse(k.container.fullData.id) ? levels.friendSorter.canUse(h.container.fullData.id) ? -1 : 1 : h.order - k.order
});
this.friendContainers.length > SelectFriendWindow.MAX_ROWS_AMOUNT * SelectFriendWindow.IN_ROW && (this.friendContainers = this.friendContainers.slice(0, SelectFriendWindow.MAX_ROWS_AMOUNT * SelectFriendWindow.IN_ROW));
for (a = 0; a < this.friendContainers.length; a++)
d.addChild(this.friendContainers[a].container),
this.friendContainers[a].container.setPositionRound(a % SelectFriendWindow.IN_ROW * (c.friendContainer.margin + c.friendContainer.width) + c.friendContainer.width / 2, d.height - Math.floor(a / SelectFriendWindow.IN_ROW) * (c.friendContainer.margin + c.friendContainer.height) - c.friendContainer.height / 2);
d = cleverapps.UI.wrap(d);
this.friendsContainer = new cleverapps.UI.ScrollView(d);
this.friendsContainer.setContentSize(d.width + cleverapps.styles.SelectFriendWindow.scroll.margin.mx[0], c.friendsContainer.height);
this.friendsContainer.setAnchorPoint(.5, 0);
this.friendsContainer.setPositionRound(this.content.width / 2, c.friendsContainer.y);
this.friendsContainer.scrollToDefault();
connector.info.isNative || this.switchSelectAll(e);
this.content.addChild(this.friendsContainer)
},
switchSelectAll: function(a) {
if (a.selected)
for (a.selected = !1,
a.check.removeFromParent(),
a = this.selectedElements.friends.length - 1; 0 <= a; a--)
this.checkElementByFriendId(this.selectedElements.friends[a]);
else {
for (var b = !1, c = 0; c < this.friendContainers.length; c++) {
var d = this.friendContainers[c].container
, e = d.fullData;
this.selectedElements.friends.length < SelectFriendWindow.MAX_SELECTED && !d.notActive && !e.checkBox.checked && (this.checkElementByFriendId(e.id, e.checkBox),
b = !0)
}
b && (a.selected = !0,
this.addCheck(a))
}
},
updateSelectedContent: function() {
this.selectedAmountText.setString(this.selectedElements.friends.length + "/" + SelectFriendWindow.MAX_SELECTED);
this.selectedElements.friends.length ? this.button.enable() : this.button.disable()
},
generateNoFriendsContent: function() {
var a = cleverapps.styles.SelectFriendWindow.noFriends;
this.content.setContentSize(a.width, a.height);
var b = cleverapps.UI.generateTTFText(SelectFriendWindow.ByType[this.type].noFriends, cleverapps.styles.FONTS.WINDOW_TEXT);
b.setPositionRound(this.content.width / 2, a.Text.y);
b.setDimensions(a.Text.width, 0);
b.fitTo(void 0, a.Text.height);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.content.addChild(b);
b = new cleverapps.UI.Button({
text: "SettingsWindow.InviteFriends",
width: a.Button.width,
height: a.Button.height,
onClicked: function() {
cleverapps.invites.invite(this.createListener(this.close.bind(this)))
}
.bind(this)
});
b.setPositionRound(this.content.width / 2, a.Button.y);
this.content.addChild(b)
}
});
SelectFriendWindow.ByType = {
askLives: {
title: "SelectFriendWindow.askLives.title",
button: "Ask",
noFriends: "SelectFriendWindow.askLives.noFriendsText",
dataLoaderType: function() {
return DataLoader.TYPES.ASKED_LIVES
}
},
askStars: {
title: "SelectFriendWindow.askStars.title",
button: "Ask",
noFriends: "SelectFriendWindow.askStars.noFriendsText",
dataLoaderType: function() {
return DataLoader.TYPES.ASKED_STARS
}
}
};
SelectFriendWindow.PROCESS_PERIOD = "1 day";
SelectFriendWindow.MAX_SELECTED = 10;
SelectFriendWindow.MAX_ROWS_AMOUNT = 10;
SelectFriendWindow.IN_ROW = 3;
cleverapps.styles.SelectFriendWindow = {
Avatar: {
x: 140,
y: 20
},
scroll: {
margin: {
mx: [30]
}
},
withFriends: {
width: 670,
height: 750,
selectedText: {
width: 250
},
friendsContainer: {
height: 580,
y: 175
},
friendContainer: {
height: 180,
width: 210,
margin: 20,
Name: {
width: 200,
height: 40,
y: 24
},
checkBox: {
x: 42,
timer: {
y: 24,
height: 20
}
}
},
Button: {
width: 300,
height: 120,
y: 75,
x: 190,
margin: 10
},
SelectedBlock: {
y: 75,
x: 0,
margin: {
x: 20
}
}
},
noFriends: {
width: 550,
height: 500,
Text: {
y: 300,
width: 550,
height: 250
},
Button: {
width: 450,
height: 120,
y: 60
}
}
};
levels.FriendRequests = function() {
this.load();
this.lastServerReload = 0;
this.onNewListener = function() {}
;
this.onChangeListener = function() {}
;
cleverapps.flags.requestsEnabled || this.deleteFakeRequests();
cleverapps.timeouts.setInterval(function() {
this.serverReload();
FakeRequestSender.sendIfNeed()
}
.bind(this), cleverapps.parseInterval("1 minute"))
}
;
levels.FriendRequests.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.FRIEND_REQUESTS);
if (a) {
this.notProcessed = [];
var b = this.listAvailableTypes();
a.notProcessed = a.notProcessed.filter(function(d) {
return -1 !== b.indexOf(d.type)
});
for (var c = 0; c < a.notProcessed.length; c++)
this.notProcessed.push(levels.FriendRequest.createFriendRequest(a.notProcessed[c]));
this.processedIds = a.processedIds
} else
this.notProcessed = [],
this.processedIds = []
}
;
levels.FriendRequests.prototype.save = function() {
for (var a = [], b = 0; b < this.notProcessed.length; b++)
a.push(this.notProcessed[b].getData());
cleverapps.dataLoader.save(DataLoader.TYPES.FRIEND_REQUESTS, {
notProcessed: a,
processedIds: this.processedIds
})
}
;
levels.FriendRequests.prototype.idInNotProcessed = function(a) {
for (var b = 0; b < this.notProcessed.length; b++)
if (this.notProcessed[b].getId() === a)
return !0;
return !1
}
;
levels.FriendRequests.prototype.lastNotProcessedId = function() {
for (var a = this.notProcessed.length - 1; 0 <= a; a--)
if (this.notProcessed[a].canView())
return this.notProcessed[a].id;
return !1
}
;
levels.FriendRequests.prototype.existNotProcessed = function() {
for (var a = 0; a < this.notProcessed.length; a++)
if (this.notProcessed[a].canView())
return !0;
return !1
}
;
levels.FriendRequests.prototype.existRequestFrom = function(a) {
for (var b = 0; b < this.notProcessed.length; b++)
if (this.notProcessed[b].canView() && this.notProcessed[b].from === a)
return !0;
return !1
}
;
levels.FriendRequests.prototype.existRequestTypes = function(a) {
for (var b = 0; b < this.notProcessed.length; b++)
if (0 <= a.indexOf(this.notProcessed[b].type))
return !0;
return !1
}
;
levels.FriendRequests.prototype.processById = function(a) {
for (var b = !1, c = !1, d = 0; d < this.notProcessed.length; d++)
if (this.notProcessed[d].getId() === a) {
this.notProcessed[d].onServer() && (c = !0);
this.notProcessed.splice(d, 1);
b = !0;
break
}
c && (this.processedIds.push(a),
this.deleteOnServerById(a));
if (b)
this.onChangeListener();
this.save()
}
;
levels.FriendRequests.prototype.onServerLoad = function(a) {
var b = []
, c = !1
, d = this.listAvailableTypes();
Array.isArray(a) || (cleverapps.throwAsync("FriendRequests.onServerLoad data type is - " + typeof a),
a = []);
a = a.filter(function(f) {
return -1 !== d.indexOf(f.type)
});
for (var e = 0; e < a.length; e++)
0 <= this.processedIds.indexOf(a[e].id) ? (this.deleteOnServerById(a[e].id),
b.push(a[e].id)) : this.idInNotProcessed(a[e].id) || (this.notProcessed.push(levels.FriendRequest.createFriendRequest({
id: a[e].id,
from: a[e].fromUserId,
type: a[e].type
})),
c = !0);
this.processedIds = b;
this.save();
c && (this.onNewListener(),
this.onChangeListener())
}
;
levels.FriendRequests.prototype.sendServerRequest = function(a, b) {
cleverapps.RestClient.post("/friendrequests/create/" + encodeURIComponent(connector.platform.getUserID()) + "/a", {
toUserId: a,
type: b
})
}
;
levels.FriendRequests.prototype.deleteOnServerById = function(a) {
cleverapps.RestClient.post("/friendrequests/delete/" + encodeURIComponent(connector.platform.getUserID()) + "/a", {
id: a
})
}
;
levels.FriendRequests.prototype.serverReload = function(a) {
cleverapps.synchronizer.synced && (a || this.lastServerReload + levels.FriendRequests.RELOAD_INTERVAL < Date.now() && cleverapps.flags.requestsEnabled && 0 < cleverapps.friends.listIds().length) && (this.lastServerReload = Date.now(),
cleverapps.RestClient.get("/friendrequests/getmy/" + encodeURIComponent(connector.platform.getUserID()) + "/a", {}, this.onServerLoad.bind(this)))
}
;
levels.FriendRequests.prototype.deleteFakeRequests = function() {
var a = this.notProcessed.filter(function(b) {
return !b.fake
});
a.length !== this.notProcessed.length && (this.notProcessed = a,
this.onChangeListener(),
this.save())
}
;
levels.FriendRequests.prototype.listAvailableTypes = function() {
var a = [levels.FriendRequest.TYPE_STUCK_HELP_COINS];
"undefined" === typeof match3 && (a = a.concat([levels.FriendRequest.TYPE_SENT_COINS, levels.FriendRequest.TYPE_ASK_COINS, levels.FriendRequest.TYPE_SENT_HELP_COINS, levels.FriendRequest.TYPE_ASK_HELP_COINS]));
cleverapps.lives && (a = a.concat([levels.FriendRequest.TYPE_SENT_HELP_LIVE, levels.FriendRequest.TYPE_ASK_HELP_LIVE, levels.FriendRequest.TYPE_SENT_LIVE, levels.FriendRequest.TYPE_ASK_LIVE]));
cleverapps.starChest && (a = a.concat([levels.FriendRequest.TYPE_SENT_HELP_STAR, levels.FriendRequest.TYPE_ASK_HELP_STAR, levels.FriendRequest.TYPE_SENT_STAR, levels.FriendRequest.TYPE_ASK_STAR]));
return a
}
;
levels.FriendRequests.RELOAD_INTERVAL = cleverapps.parseInterval("15 minutes");
levels.FriendRequest = function(a) {
this.id = a.id;
this.from = a.from;
this.type = a.type;
this.fake = a.fake;
this.onRemoveListener = function() {}
}
;
levels.FriendRequest.prototype.getId = function() {
return this.id
}
;
levels.FriendRequest.prototype.getView = function() {
if (this.canView())
return levels.FriendRequestView
}
;
levels.FriendRequest.prototype.canView = function() {
return levels.FriendRequest.REQUEST_TYPES[this.type]
}
;
levels.FriendRequest.prototype.isFake = function() {
return !0 === this.fake
}
;
levels.FriendRequest.prototype.onServer = function() {
return !this.isFake()
}
;
levels.FriendRequest.prototype.getData = function() {
return {
id: this.id,
from: this.from,
type: this.type,
fake: this.fake
}
}
;
levels.FriendRequest.prototype.process = function() {
var a = levels.FriendRequest.REQUEST_TYPES[this.type];
if (!a.checkProcess || a.checkProcess()) {
var b = function() {
a.createNewRequestId && levels.friendRequests.sendServerRequest(this.from, a.createNewRequestId);
if (a.onProcess)
a.onProcess(this);
this.remove()
}
.bind(this);
a.fbRequest ? cleverapps.requests.send(this.from, a.fbRequest, b) : b()
}
}
;
levels.FriendRequest.prototype.remove = function() {
levels.friendRequests.processById(this.getId());
this.onRemoveListener()
}
;
levels.FriendRequest.prototype.cancel = function() {
levels.friendRequests.processById(this.getId());
this.onRemoveListener()
}
;
levels.FriendRequest.createFriendRequest = function(a) {
return new levels.FriendRequest(a)
}
;
levels.FriendRequest.addLiveProcess = function(a) {
a.animateCollect("lives", function() {
cleverapps.lives.give(1, "help")
})
}
;
levels.FriendRequest.checkAddLiveProcess = function() {
return !0
}
;
levels.FriendRequest.addStarProcess = function(a) {
a.animateCollect("stars", function() {
cleverapps.starChest.addStars(1)
})
}
;
levels.FriendRequest.addCoinsProcess = function(a, b) {
b = b || levels.FriendRequest.HELP_COINS_AMOUNT;
a.animateCollect("hard", function() {
cleverapps.user.earnHard(cleverapps.EVENTS.EARN.FRIEND_REQUEST, b)
})
}
;
levels.FriendRequest.addCoinsStuckProcess = function(a) {
levels.FriendRequest.addCoinsProcess(a, levels.FriendRequest.STUCK_COINS_AMOUNT)
}
;
levels.FriendRequest.TYPE_ASK_LIVE = 0;
levels.FriendRequest.TYPE_SENT_LIVE = 1;
levels.FriendRequest.TYPE_ASK_STAR = 2;
levels.FriendRequest.TYPE_SENT_STAR = 3;
levels.FriendRequest.TYPE_ASK_HELP_LIVE = 4;
levels.FriendRequest.TYPE_SENT_HELP_LIVE = 5;
levels.FriendRequest.TYPE_ASK_HELP_STAR = 6;
levels.FriendRequest.TYPE_SENT_HELP_STAR = 7;
levels.FriendRequest.TYPE_ASK_HELP_COINS = 9;
levels.FriendRequest.TYPE_SENT_HELP_COINS = 10;
levels.FriendRequest.TYPE_ASK_COINS = 12;
levels.FriendRequest.TYPE_SENT_COINS = 13;
levels.FriendRequest.TYPE_STUCK_HELP_COINS = 14;
levels.FriendRequest.HELP_COINS_AMOUNT = 10;
levels.FriendRequest.STUCK_COINS_AMOUNT = 50;
levels.FriendRequest.REQUEST_TYPES = {};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_ASK_LIVE] = {
image: bundles.request_center.frames.send_life_icon,
button_type: cleverapps.styles.UI.Button.Images.small_button_blue,
button_text: "Send",
text: "AskLiveRequest",
fbRequest: "sendLiveRequest",
createNewRequestId: levels.FriendRequest.TYPE_SENT_LIVE
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_SENT_LIVE] = {
image: bundles.request_center.frames.send_life_icon,
imageText: "+1",
button_type: cleverapps.styles.UI.Button.Images.small_button_green,
button_text: "Accept",
text: "SendLiveRequest",
fbRequest: "thanksForLiveRequest",
onProcess: levels.FriendRequest.addLiveProcess,
checkProcess: levels.FriendRequest.checkAddLiveProcess
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_ASK_STAR] = {
image: bundles.request_center.frames.send_star_icon,
button_type: cleverapps.styles.UI.Button.Images.small_button_blue,
button_text: "Send",
text: "AskStarRequest",
fbRequest: "sendStarRequest",
createNewRequestId: levels.FriendRequest.TYPE_SENT_STAR
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_SENT_STAR] = {
image: bundles.request_center.frames.send_star_icon,
imageText: "+1",
button_type: cleverapps.styles.UI.Button.Images.small_button_green,
button_text: "Accept",
text: "SendStarRequest",
fbRequest: "thanksForStarRequest",
onProcess: levels.FriendRequest.addStarProcess
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_ASK_HELP_LIVE] = {
image: bundles.request_center.frames.send_life_icon,
button_type: cleverapps.styles.UI.Button.Images.small_button_blue,
button_text: "Send",
text: "AskHelpRequest",
fbRequest: "sentHelpRequest",
createNewRequestId: levels.FriendRequest.TYPE_SENT_HELP_LIVE
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_SENT_HELP_LIVE] = {
image: bundles.request_center.frames.send_life_icon,
imageText: "+1",
button_type: cleverapps.styles.UI.Button.Images.small_button_green,
button_text: "Accept",
text: "SentHelpRequest",
fbRequest: "thanksForHelpRequest",
onProcess: levels.FriendRequest.addLiveProcess,
checkProcess: levels.FriendRequest.checkAddLiveProcess
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_ASK_HELP_STAR] = {
image: bundles.request_center.frames.send_star_icon,
button_type: cleverapps.styles.UI.Button.Images.small_button_blue,
button_text: "Send",
text: "AskHelpRequest",
fbRequest: "sentHelpRequest",
createNewRequestId: levels.FriendRequest.TYPE_SENT_HELP_STAR
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_SENT_HELP_STAR] = {
image: bundles.request_center.frames.send_star_icon,
imageText: "+1",
button_type: cleverapps.styles.UI.Button.Images.small_button_green,
button_text: "Accept",
text: "SentHelpRequest",
fbRequest: "thanksForHelpRequest",
onProcess: levels.FriendRequest.addStarProcess
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_ASK_HELP_COINS] = {
image: bundles.request_center.frames.send_coins_icon,
button_type: cleverapps.styles.UI.Button.Images.small_button_blue,
button_text: "Send",
text: "AskHelpRequest",
fbRequest: "sentHelpRequest",
createNewRequestId: levels.FriendRequest.TYPE_SENT_HELP_COINS
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_SENT_HELP_COINS] = {
image: bundles.request_center.frames.send_coins_icon,
imageText: "+10",
button_type: cleverapps.styles.UI.Button.Images.small_button_green,
button_text: "Accept",
text: "SentHelpRequest",
fbRequest: "thanksForHelpRequest",
onProcess: levels.FriendRequest.addCoinsProcess
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_ASK_COINS] = {
image: bundles.request_center.frames.send_coins_icon,
button_type: cleverapps.styles.UI.Button.Images.small_button_blue,
button_text: "Send",
text: "AskCoinsRequest",
fbRequest: "sendCoinsRequest",
createNewRequestId: levels.FriendRequest.TYPE_SENT_COINS
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_SENT_COINS] = {
image: bundles.request_center.frames.send_coins_icon,
imageText: "+10",
button_type: cleverapps.styles.UI.Button.Images.small_button_green,
button_text: "Accept",
text: "SendCoinsRequest",
fbRequest: "thanksForCoinsRequest",
onProcess: levels.FriendRequest.addCoinsProcess
};
levels.FriendRequest.REQUEST_TYPES[levels.FriendRequest.TYPE_STUCK_HELP_COINS] = {
image: bundles.request_center.frames.accept_stuck_coins_icon,
imageText: "+50",
button_type: cleverapps.styles.UI.Button.Images.small_button_green,
button_text: "Accept",
text: "SendStuckHelpRequest",
onProcess: levels.FriendRequest.addCoinsStuckProcess
};
levels.FriendRequest.SYSTEM_ID = -1;
levels.FriendRequestView = cc.Node.extend({
ctor: function(a, b, c) {
this._super();
this.setContentSize(cleverapps.styles.FriendRequestView.width, cleverapps.styles.FriendRequestView.height);
this.setAnchorPoint(.5, .5);
this.model = a;
this.onRemove = c;
this.createBackground();
this.createFromContent();
this.createRequestContent();
this.createRequestImage();
this.createCancelContent();
this.createProcessContent();
cleverapps.UI.onClick(this, function() {
this.process()
}
.bind(this))
},
onEnter: function() {
this._super();
this.model.onRemoveListener = this.createListener(this.removeAnimation.bind(this));
this.model.animateCollect = this.createListener(this.animateCollect.bind(this))
},
animateCollect: function(a, b) {
b = b || function() {}
;
this.image ? this.image.runAction(new cc.Sequence(AnimationsLibrary.animateCollect(this.image, a, {
scale: .8,
collectEffect: !0
}),new cc.CallFunc(b),new cc.RemoveSelf)) : b()
},
createFromContent: function() {
var a = levels.FriendRequest.REQUEST_TYPES[this.model.type];
var b = void 0;
connector.social.oneOf(connector.FACEBOOK) && (b = this.model.from);
b = a.avatar ? new cleverapps.UI.Avatar(a.avatar,b) : (a = cleverapps.friends.getById(this.model.from)) ? new cleverapps.UI.Avatar(a) : new cleverapps.UI.Avatar("https://scontent.xx.fbcdn.net/v/",b);
a = cleverapps.styles.FriendRequestView.Avatar;
b.setPositionRound(b.width / 2 + a.Margin.x, this.height / 2 + a.Margin.y);
b.setAnchorPoint(.5, .5);
this.addChild(b)
},
createBackground: function() {
var a = cleverapps.UI.createScale9Sprite(bundles.request_center.frames.friend_message_bg_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
a.setContentSize2(this.width, this.height);
a.setPosition(this.width / 2, this.height / 2);
this.addChild(a)
},
getRequestText: function() {
return Messages.get(levels.FriendRequest.REQUEST_TYPES[this.model.type].text)
},
createRequestContent: function() {
var a = this.getRequestText();
if (a) {
var b = cleverapps.styles.FriendRequestView.Request;
a = cleverapps.UI.generateTTFText(a, cleverapps.styles.FONTS.FRIEND_REQUEST_TEXT || cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
a.setPositionRound(this.width / 2 + b.x, this.height / 2 + b.y);
a.setDimensions(b.width, 0);
a.fitTo(void 0, b.height);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
a.setVerticalAlignment(cc.TEXT_ALIGNMENT_CENTER);
this.addChild(a)
}
},
getRequestImage: function() {
var a = levels.FriendRequest.REQUEST_TYPES[this.model.type];
if (a.image) {
var b = new cc.Sprite(a.image);
a.imageText && (a = cleverapps.UI.generateImageText(a.imageText, cleverapps.styles.FONTS.FRIEND_REQUEST_ITEM_TEXT),
a.setPositionRound(b.width / 2, b.height / 2),
b.addChild(a));
return b
}
return !1
},
createRequestImage: function() {
var a = this.getRequestImage();
a && (a.setPosition(cleverapps.styles.FriendRequestView.Icon.x, this.height / 2 + cleverapps.styles.FriendRequestView.Icon.y),
this.addChild(a),
this.image = a)
},
createProcessContent: function() {
var a = levels.FriendRequest.REQUEST_TYPES[this.model.type]
, b = cleverapps.styles.FriendRequestView.processButton;
b = new cleverapps.UI.Button({
type: a.button_type,
text: a.button_text,
onClicked: this.process.bind(this),
width: b.width,
height: b.height
});
a.image ? b.setPositionRound(this.width - b.width / 2 - cleverapps.styles.FriendRequestView.processButton.x, this.height / 2 + cleverapps.styles.FriendRequestView.processButton.y) : b.setPositionRound(this.width - b.width / 2 - cleverapps.styles.FriendRequestView.processButton.noImage.x, this.height / 2 + cleverapps.styles.FriendRequestView.processButton.noImage.y);
this.addChild(b)
},
createCancelContent: function() {
var a = cleverapps.styles.FriendRequestView.close
, b = new cleverapps.UI.Button({
type: {
button_png: bundles.buttons_main.frames.close_small,
button_on_png: bundles.buttons_main.frames.close_small_on
},
onClicked: this.cancel.bind(this)
});
b.setPositionRound(this.width - b.width / 2 + a.x, this.height - b.height / 2 + a.y);
this.addChild(b)
},
cancel: function() {
this.model.cancel()
},
process: function() {
this.model.process()
},
removeAnimation: function() {
this.runAction(new cc.Sequence(new cc.ScaleTo(.3,0),new cc.CallFunc(this.onRemove),new cc.RemoveSelf))
},
showAnimation: function(a) {
this.setScale(0);
this.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.ScaleTo(.3,1)))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
FRIEND_REQUEST_ITEM_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.FriendRequestView = {
width: 490,
height: 190,
close: {
x: 10,
y: 10
},
processButton: {
width: 170,
x: 25,
y: -30,
noImage: {
x: 90,
y: -35
}
},
Request: {
x: 66,
y: 45,
width: 270,
height: 80
},
Icon: {
x: 216,
y: -30
},
Avatar: {
Margin: {
x: 30,
y: 0
}
}
};
var Requests = function() {
connector.social.on("error:request", this.onError.bind(this))
};
Requests.prototype.send = function(a, b, c) {
Array.isArray(a) || (a = [a]);
var d;
(new ActionPlayer([function(e) {
cleverapps.SocialManager.enforceLogin(function(f) {
f === cleverapps.CODE_SUCCEED && e()
})
}
, function(e) {
FriendsCache.loadFriends(e)
}
, function(e) {
d = Share.getData("default").image;
connector.platform.oneOf(connector.WORTAL) && (d = Share.getData("wortal").image);
connector.platform.oneOf(connector.INSTANT, connector.WORTAL, connector.MM) ? cleverapps.loadBase64Image(d, function(f) {
f && (d = f,
e())
}) : e()
}
, function() {
this._send(a, b, d, c)
}
.bind(this)])).play()
}
;
Requests.prototype._send = function(a, b, c, d) {
connector.social.requestCallback({
to: a,
text: Messages.get(b + ".message"),
title: Messages.get(b + ".title"),
image: c
}, function(e) {
if (e)
this.onSuccess(b, a),
d && d();
else
this.onFail(b, a)
}
.bind(this))
}
;
Requests.prototype.onSuccess = function(a, b) {
levels.friendSorter.markUsed(b);
var c = cleverapps.friends.listIds()
, d = b.filter(function(e) {
return -1 !== c.indexOf(e)
});
0 < d.length && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MESSAGE_SENT_FRIEND, {
value: d.length
});
0 < b.length - d.length && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MESSAGE_SENT_INVITE, {
value: b.length - d.length
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MESSAGE_SENT_PREFIX + a, {
value: b.length
})
}
;
Requests.prototype.onFail = function(a, b) {
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MESSAGE_CANCEL_PREFIX + a, {
value: b.length
})
}
;
Requests.prototype.onError = function(a) {
if ([cleverapps.CODE_CANCELLED, cleverapps.CODE_CANCELLED_FACEBOOK_DIALOG].includes(a)) {
var b = cleverapps.EVENTS.MESSAGE_ERROR + "_" + connector.info.source;
"number" === typeof a && (b += "_" + a);
cleverapps.eventLogger.logEvent(b)
}
}
;
var FakeRequestSender = {
load: function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.FAKE_REQUESTS);
a || (a = {
lastLoadTime: 0
});
return a
},
save: function(a) {
a.lastLoadTime = Date.now();
cleverapps.dataLoader.save(DataLoader.TYPES.FAKE_REQUESTS, a)
},
sendIfNeed: function() {
if (0 !== cleverapps.friends.listIds().length && "merge" !== cleverapps.config.type && cleverapps.flags.requestsEnabled) {
var a = levels.friendRequests
, b = FakeRequestSender.load()
, c = Math.floor((Date.now() - b.lastLoadTime) / cleverapps.parseInterval(FakeRequestSender.REQUEST_PERIOD));
if (!(0 >= c)) {
var d = a.notProcessed.filter(function(k) {
return k.isFake()
});
c > FakeRequestSender.MAX_REQUESTS - d.length && (c = FakeRequestSender.MAX_REQUESTS - d.length);
d = !1;
var e = levels.friendSorter.listActiveFriends();
cleverapps.Random.shuffle(e);
10 < e.length && (e = e.slice(0, 10));
for (var f = 0; f < e.length && 0 < c; f++) {
var g = e[f];
if (!a.existRequestFrom(g.id)) {
var h = cleverapps.Random.mathChoose(this.listFakeRequestsTypes(a));
c--;
d = !0;
a.notProcessed.push(levels.FriendRequest.createFriendRequest({
id: "__" + Math.floor(1E15 * Math.random()),
from: g.id,
type: h,
fake: !0
}))
}
}
d && (a.onNewListener(),
FakeRequestSender.save(b),
a.save())
}
}
},
listFakeRequestsTypes: function(a) {
var b = [levels.FriendRequest.TYPE_ASK_HELP_LIVE, levels.FriendRequest.TYPE_ASK_HELP_STAR, levels.FriendRequest.TYPE_ASK_HELP_COINS]
, c = a.listAvailableTypes();
return b.filter(function(d) {
return -1 !== c.indexOf(d)
})
},
MAX_REQUESTS: 2,
REQUEST_PERIOD: "12 hours"
};
-1 !== ["crocword", "scramble", "magicwords"].indexOf(cleverapps.config.name) && (FakeRequestSender.REQUEST_PERIOD = "3 hours");
cleverapps.config.debugMode && (FakeRequestSender.REQUEST_PERIOD = "1 minute");
var Level = function(a, b, c) {
c = c || {};
if (0 !== arguments.length) {
this.episodeNo = a;
this.levelNo = b;
var d = bundles[this.bundleId()];
this.meta = d.meta.episode ? Object.assign({}, d.meta.episode.levels && d.meta.episode.levels[b] || {}) : d.meta;
this.meta.expedition || (this.meta.expedition = "main");
"merge" === cleverapps.config.type && (this.families = Families.listExpeditionCodes(this.meta.expedition));
this.loadTasks = {};
this.levelType = c.type ? c.type : Level.CalcLevelType(a);
this.update()
}
};
Level.prototype.bundleId = function() {
return Level.BundleId(this.episodeNo)
}
;
Level.BundleId = function(a) {
a = ("merge" === cleverapps.config.type ? "location_" : "episode_") + a;
"board" === cleverapps.config.type && "en" !== cleverapps.settings.language && (a += "_" + cleverapps.settings.language);
return a
}
;
Level.prototype.getHumanReadableNumber = function() {
return cleverapps.humanReadableNumber(this.episodeNo, this.levelNo)
}
;
Level.prototype.isRegular = function() {
return this.levelType === Level.LevelTypes.REGULAR
}
;
Level.prototype.isDailyCup = function() {
return this.levelType === Level.LevelTypes.DAILYCUP
}
;
Level.prototype.isBonusRound = function() {
return this.levelType === Level.LevelTypes.BONUSROUNDS
}
;
Level.prototype.isDailyLevel = function() {
return this.levelType === Level.LevelTypes.DAILY_LEVELS
}
;
Level.prototype.isBonusWorldLevel = function() {
return this.levelType === Level.LevelTypes.BONUS_WORLD
}
;
Level.prototype.isAdsLevel = function() {
return this.levelType === Level.LevelTypes.ADS || this.levelType === Level.LevelTypes.PROMO || this.levelType === Level.LevelTypes.SCREENSHOTS
}
;
Level.CalcLevelType = function(a) {
return "undefined" !== typeof BonusWorld && BonusWorld.getConfigByEpisode(a) ? Level.LevelTypes.BONUS_WORLD : Level.LevelTypeValues[a] ? a : Level.LevelTypes.REGULAR
}
;
Level.LevelTypes = {
REGULAR: "regular",
BONUSROUNDS: "bonusrounds",
EDITOR: "editor",
DAILY_LEVELS: "daily_levels",
DAILYCUP: "dailycup",
HIGHSCORE_MODE: "score_mode",
BONUS_WORLD: "bonus_world",
ADS: "ads",
PROMO: "promo",
SCREENSHOTS: "screenshots",
PLAYABLE_ADS: "playable_ads",
ADS_HALLOWEEN: "ads_halloween",
ADS_XMAS: "ads_xmas",
ADS_DRAGONIA: "ads_dragonia",
ADS_UNDERSEA: "ads_undersea",
ADS_UNDERSEA2: "ads_undersea2",
ADS_RAPUNZEL: "ads_rapunzel",
ADS_RAPUNZEL2: "ads_rapunzel2"
};
Level.LevelTypeValues = cleverapps.createSet(Object.values(Level.LevelTypes));
Level.prototype.isCurrentLevel = function() {
return this.isRegular() && levels.user.isCurrentLevel(this.levelNo, this.episodeNo)
}
;
Level.prototype.isPassedLevel = function() {
return levels.user.isPassedLevel(this.levelNo, this.episodeNo)
}
;
Level.prototype.getTag = function() {
return this.meta.tag
}
;
Level.prototype.isHard = function() {
return this.getTag() === Level.TAGS.HARD
}
;
Level.prototype.isTricky = function() {
return this.getTag() === Level.TAGS.TRICKY
}
;
Level.prototype.isDanger = function() {
return this.isTricky() && cleverapps.config.features.includes("danger")
}
;
Level.prototype.isNewRules = function() {
return this.getTag() === Level.TAGS.RULES
}
;
Level.prototype.isBonus = function() {
return this.getTag() === Level.TAGS.BONUS
}
;
Level.prototype.getImageBundle = function() {
return this.meta.bundleName
}
;
Level.prototype.getLevelCellSkins = function() {
return this.meta.cellSkins
}
;
Level.prototype.getLevelEnemies = function() {
var a = {};
this.meta.enemies && this.meta.enemies.forEach(function(b) {
a[b] = Game.GOAL_ENEMY_TYPES[b]
});
return a
}
;
Level.prototype.isNew = function() {
return this.type !== Level.TYPE_PASSED || this.isCurrentLevel()
}
;
Level.prototype.isLastLevelOnEpisode = function() {
var a = bundles[this.bundleId()].meta.episode.levelsAmount;
return this.levelNo === a - 1
}
;
Level.prototype.isLoaded = function() {
return cleverapps.bundleLoader.isLoaded(this.bundleId())
}
;
Level.prototype.loadBundles = function(a, b, c) {
this.deleted ? c && c() : (this.loadTasks[a] || (this.loadTasks[a] = new SuccessWait(b)),
this.loadTasks[a].whenLoaded(c))
}
;
Level.prototype.loadData = function(a) {
this.isLoaded() ? a && a() : this.loadBundles("levels", [this.bundleId()], a)
}
;
Level.prototype.destructor = function() {
if (!this.deleted) {
for (var a in this.loadTasks)
this.loadTasks[a].destructor();
this.loadTasks = {};
this.deleted = !0
}
}
;
Level.prototype.load = function(a) {
this.content && !cleverapps.config.editorMode ? a && a() : this.loadData(function() {
if (this.meta.location)
var b = cc.loader.getRes(bundles[this.bundleId()].jsons.map_json);
else
b = cc.loader.getRes(bundles[this.bundleId()].jsons.levels),
b = Array.isArray(b) ? b[this.levelNo] : b.levels[this.levelNo];
if (Array.isArray(b)) {
var c = 0;
b.forEach(function(d, e) {
e = d.version || e;
e = parseInt(e);
if (e > c || !this.content)
c = e,
this.content = d
}
.bind(this))
} else
this.content = b;
this.hash = Level.CalcHash(this.content);
a && a(this)
}
.bind(this))
}
;
Level.prototype.unload = function() {
this.destructor()
}
;
Level.CalcHash = function(a) {
return RecursiveHasher(a, "episodeNo levelNo version hard paint extra gold hash hashes comments translate definitions bundles horizontalCards".split(" "))
}
;
Level.prototype.play = function(a, b) {
cleverapps.config.editorMode && (cleverapps.config.editorMode = !1,
this.content = void 0,
cleverapps.environment.setScene(cleverapps.Environment.SCENE_GAME));
b = new GameScene({
level: this,
gameOptions: b
});
cleverapps.scenes.replaceScene(b, a)
}
;
Level.prototype.onPressed = function() {
cleverapps.lives && cleverapps.lives.isEmpty() ? cleverapps.focusManager.display({
focus: ["LevelPressedNoLives", "MenuBarGoldItem", "MenuBarLivesItem"],
action: function(a) {
new LivesShopWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
}) : cleverapps.config.features.includes("boosters_before") && !WindowBoostersBefore.isAvailable() && this.isCurrentLevel() && !this.isHard() || !LevelStartWindow.isAvailable(this) ? cleverapps.focusManager.display({
focus: "LevelPressedPlay",
action: function(a) {
this.play(a)
}
.bind(this)
}) : cleverapps.focusManager.display({
focus: "LevelStartWindow",
control: "MenuBarGoldItem",
actions: [function(a) {
new LevelStartWindow(this.getStartWindowOptions());
cleverapps.focusManager.onceNoWindowsListener = a
}
.bind(this)]
})
}
;
Level.prototype.getStartWindowOptions = function() {
var a = {};
this.isDanger() ? a.danger = !0 : cleverapps.config.features.includes("boosters_before") && WindowBoostersBefore.isAvailable() && (a.boostersBefore = !0,
Lantern.IsActive(this) && cleverapps.config.features.includes("lantern_start") && (a.lantern = !0));
a.level = this;
return a
}
;
Level.prototype.update = function() {
if (cleverapps.meta.getType() !== Meta.HOSE && cleverapps.meta.getType() !== Meta.SHORTMETA)
this.type = Level.TYPE_CURRENT;
else {
var a = levels.user.episode
, b = levels.user.level;
cleverapps.meta.getType() === Meta.SHORTMETA && (a = Math.floor(cleverapps.meta.getMainObject().level / Level.LEVELS_PER_EPISODE),
b = cleverapps.meta.getMainObject().level % Level.LEVELS_PER_EPISODE);
this.type = a > this.episodeNo ? Level.TYPE_PASSED : a < this.episodeNo ? Level.TYPE_NOTPASSED : b > this.levelNo ? Level.TYPE_PASSED : b === this.levelNo ? Level.TYPE_CURRENT : Level.TYPE_NOTPASSED
}
}
;
Level.prototype.nextLevel = function() {
if (this.building)
return this;
var a = this.episodeNo
, b = this.levelNo + 1;
b >= Level.LEVELS_PER_EPISODE && (b = 0,
a += 1);
return MethaHelper.getLevel(a, b)
}
;
Level.prototype.clone = function() {
var a = new Level;
Object.assign(a, this);
return a
}
;
Level.AvailableTags = function() {
return "stacks" === cleverapps.config.subtype ? [Level.TAGS.HARD, Level.TAGS.TRICKY, Level.TAGS.BONUS] : "board" === cleverapps.config.type ? [Level.TAGS.HARD, Level.TAGS.BONUS] : "match3" === cleverapps.config.type ? [Level.TAGS.RULES, Level.TAGS.HARD, Level.TAGS.TRICKY, Level.TAGS.BONUS] : [Level.TAGS.HARD]
}
;
Level.CreateByNumber = function(a, b) {
b = b || {};
var c = Math.floor(a / Level.LEVELS_PER_EPISODE)
, d = a % Level.LEVELS_PER_EPISODE
, e = levels.User.CalcEpisodesAmount(cleverapps.config.importMode);
return c >= e ? (a = a - cleverapps.humanReadableNumber(e, 0) + 1,
levels.user.getRandomLevel(a, b.type)) : new Level(c,d,b)
}
;
Level.LEVELS_PER_EPISODE = 15;
Level.TYPE_PASSED = 0;
Level.TYPE_CURRENT = 1;
Level.TYPE_NOTPASSED = 2;
Level.TAGS = {};
Level.TAGS.HARD = "hard";
Level.TAGS.TRICKY = "tricky";
Level.TAGS.BONUS = "bonus";
Level.TAGS.RULES = "rules";
"undefined" === typeof cc && (module.exports = Level);
var LevelView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.level = a;
void 0 !== b && this.calculatePosition(b);
this.levelBg = this.addLevelBg();
this.addLevelId();
this.level.type === Level.TYPE_CURRENT ? (this.addTouchListener(),
cleverapps.UI.applyHover(this.levelBg || this)) : this.level.type === Level.TYPE_NOTPASSED && cleverapps.tooltipManager.create(this, {
text: Messages.get("LevelNotPassedTooltip"),
location: cleverapps.UI.Tooltip.LOCATION_BELOW
});
this.level.getReward && this.level.getReward() && this.level.type !== Level.TYPE_PASSED && this.createReward(this.level.getReward());
void 0 === b && this.customize()
},
createReward: function(a) {
var b = cleverapps.styles.LevelView
, c = new cc.Scale9Sprite(bundles.level.frames.prize_bg_png);
c.setContentSize2(b.prize);
var d = new cc.Sprite(bundles.level.frames.prize_arrow_png);
c.addChild(d);
d.setPositionRound(b.prize.arrow);
d = Object.keys(a)[0];
a = new TextWithIcon(TextWithIcon.ICONS_BY_NAME[d] + " x" + a[d].factor,{
font: cleverapps.styles.FONTS.LEVEL_REWARD_TEXT
});
c.addChild(a);
a.setPositionRound(c.width / 2 + b.prize.offset.x, c.height / 2 + b.prize.offset.y);
this.addChild(c);
c.setPositionRound(b.prize);
c.runAction(new cc.RepeatForever(new cc.Sequence((new cc.MoveBy(1,0,b.prize.animation.dy)).easing(cc.easeInOut(1.7)),(new cc.MoveBy(1,0,-b.prize.animation.dy)).easing(cc.easeInOut(1.7)))))
},
calculatePosition: function() {
var a = cleverapps.styles.LevelsView;
a = this.level.location % 2 && a.levels_2 || a.levels_1;
(a = a[this.level.progress]) && this.setPosition(a)
},
customize: function() {},
getAnimationName: function() {
var a = ["past", "current", "future"];
this.level.isHard() ? a = ["hard_past", "hard_current", "hard_future"] : this.level.isBonus() && (a = ["bonus_past", "bonus_current", "bonus_future"]);
return a[this.level.type]
},
getImage: function() {
var a = ["level_past_png", "level_current_png", "level_future_png"][this.level.type];
this.level.isHard() ? a = "level_hard_png" : this.level.isBonus() ? a = "level_bonus_png" : this.level.isTricky() && (a = "level_tricky_png");
a = new cc.Sprite(bundles.level.frames[a]);
a.setAnchorPoint(.5, .5);
if (void 0 !== this.getStars() && this.level.type === Level.TYPE_PASSED) {
var b = "star_" + this.getStars() + "_png";
b = new cc.Sprite(bundles.level.frames[b]);
b.setAnchorPoint(.5, .5);
b.setPositionRound(cleverapps.styles.LevelView.stars);
a.addChild(b)
}
return a
},
getStars: function() {
if ("match3" === cleverapps.config.type && !cleverapps.config.rpg && this.level.type !== Level.TYPE_CURRENT && this.level.type === Level.TYPE_PASSED)
return void 0 !== this.level.stars ? this.level.stars : 0
},
addLevelBg: function() {
var a = cleverapps.styles.LevelView
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize(a.clickSize);
this.setContentSize(b.getContentSize());
if (bundles.level.jsons.level_json) {
var c = this.getAnimationName();
var d = new cleverapps.Spine(bundles.level.jsons.level_json);
d.setAnimation(0, c, !0)
} else
d = this.getImage(),
this.level.type === Level.TYPE_CURRENT && b.runAction(new cc.RepeatForever(new cc.Sequence(new cc.ScaleTo(.83,1.19),new cc.ScaleTo(.5,1))));
d.setPosition(b.width / 2, b.height / 2 + a.dy);
b.addChild(d);
b.setPositionRound(this.width / 2, this.height / 2);
this.setAnchorPoint(.5, .5);
this.addChild(b);
return b
},
addLevelId: function() {
(this.level.isHard() || this.level.isBonus() || this.level.isTricky()) && cleverapps.styles.LevelView.hidableLevelNo || LevelView.generateLevelId(this.levelBg, this.level.type, this.level.getHumanReadableNumber())
},
addTouchListener: function() {
cleverapps.UI.onClick(this, this.onPressed.bind(this))
},
onPressed: function() {
cleverapps.audio.playSound(bundles.main.urls.click_effect);
this.level.onPressed()
}
});
LevelView.generateLevelId = function(a, b, c) {
var d = cleverapps.styles.LevelView.LevelId;
if (cleverapps.config.editorMode || -1 !== d.showTypes.indexOf(b)) {
var e = cleverapps.styles.FONTS.LEVEL_TITLE_TEXT;
b === Level.TYPE_NOTPASSED && (e = cleverapps.styles.FONTS.LEVEL_NOT_PASSED_TITLE_TEXT);
b === Level.TYPE_CURRENT && cleverapps.styles.FONTS.LEVEL_CURRENT_TITLE_TEXT && (e = cleverapps.styles.FONTS.LEVEL_CURRENT_TITLE_TEXT);
b === Level.TYPE_PASSED && cleverapps.styles.FONTS.LEVEL_PASSED_TITLE_TEXT && (e = cleverapps.styles.FONTS.LEVEL_CURRENT_TITLE_TEXT);
b = cleverapps.UI.generateImageText(c, e);
if (1E3 <= c) {
e = d.alternativeSizes[0];
var f = d.alternativeAnchorsY[0]
} else
100 <= c ? (e = d.alternativeSizes[1],
f = d.alternativeAnchorsY[1]) : (e = d.alternativeSizes[2],
f = d.alternativeAnchorsY[2]);
e && b.setScale(b.scale * e);
d.scale && c % 2 && b.setScale(.9 * b.scale);
b.setAnchorPoint(.5, f);
a.addChild(b);
a.levelId = b;
b.setPositionRound(d.x, d.y)
}
}
;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
LEVEL_TITLE_TEXT: {
name: "default",
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
LEVEL_NOT_PASSED_TITLE_TEXT: {
name: "default",
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
LEVEL_REWARD_TEXT: {
size: 40,
name: "nostroke",
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.LevelView = {
dy: -10,
LevelId: {
alternativeSizes: [.6, .7, .8],
alternativeAnchorsY: [.1, .2, .2],
x: {
dx: 0
},
y: {
dy: 0
},
showTypes: [Level.TYPE_PASSED, Level.TYPE_CURRENT, Level.TYPE_NOTPASSED]
},
clickSize: {
width: 90,
height: 75
},
stars: {
x: {
align: "center"
},
y: {
align: "center",
dy: 50
}
},
prize: {
width: 170,
height: 130,
x: {
align: "center"
},
y: {
align: "top",
dy: 140
},
arrow: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -27
}
},
animation: {
dy: 20
},
offset: {
x: -7,
y: 7
}
}
};
var SignInWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
a = a || {};
var b = cleverapps.styles.SignInWindow;
this.restoreProgress = a.restoreProgress;
var c = []
, d = new cleverapps.Spine(bundles.sign_in_window.jsons.sign_in_icon_json);
d.setAnimationAndIdleAfter("open", "idle");
c.push(d);
c.push(this.createText("SignInWindow.text", cleverapps.styles.FONTS.FBCONNECT_WINDOW_TEXT || cleverapps.styles.FONTS.WINDOW_TEXT));
a.errorMessage && c.push(this.createText(a.errorMessage, cleverapps.styles.FONTS.SMALL_TEXT_ERROR));
c.push(this.createButtons());
b = new cleverapps.Layout(c,{
margin: b.margin,
padding: b.padding,
direction: cleverapps.UI.VERTICAL
});
this._super({
title: "RestoreProgress",
closeButton: !0,
name: "signinwindow",
content: b
});
this.closeCallback = cleverapps.once(a.onClose);
this.success = cleverapps.once(a.onSuccess);
this.failureLogin = a.onFailure;
this.waitingSync = !1;
this.restoreProgress && this._setGlobalZOrder(!0)
},
createText: function(a, b) {
var c = cleverapps.styles.SignInWindow;
a = cleverapps.UI.generateOnlyText(a, b);
a.setDimensions(c.text.width, 0);
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
return a
},
onClose: function() {
this.failureLogin && this.failureLogin();
this.closeCallback && this.closeCallback()
},
waitSync: function() {
this.waitingSync = !0;
var a;
cleverapps.focusManager.display({
stack: !0,
focus: "WaitSync",
actions: [function(b) {
a = new WaitWindow;
b()
}
, function(b) {
b = cleverapps.wait(2, b);
cleverapps.synchronizer._onceNextSyncCompletedListener = cleverapps.waitNoMore(15E3, b);
setTimeout(b, 3E3)
}
, function(b) {
cleverapps.platformLogic.loadOldUserId && !cleverapps.platformLogic.oldUserId ? cleverapps.platformLogic.loadOldUserId(function(c) {
c && (cleverapps.platformLogic.oldUserId = c,
cleverapps.userIdsHistory.add(c));
b()
}) : b()
}
, function(b) {
!cleverapps.synchronizer._syncIn.needShowReloadWindow() && cleverapps.platformLogic.oldUserId && cleverapps.synchronizer.isReady() ? (b = cleverapps.waitNoMore(15E3, b),
cleverapps.synchronizer.getProgress(cleverapps.platformLogic.oldUserId, {
acceptOnlyIfBetter: !0,
progressLoadOnly: !0,
callback: function() {
cleverapps.platformLogic.oldUserId = void 0;
b()
}
})) : b()
}
, function(b) {
a.close();
this.waitingSync = !1;
this.closed || this.close();
this.success();
cleverapps.synchronizer._syncIn.needShowReloadWindow() ? cleverapps.focusManager.isFocused() && !cleverapps.synchronizer._syncIn.isReloadInProcess() && cleverapps.synchronizer._syncIn.distractToReloadWindow() : this.restoreProgress && cleverapps.notification.create("RestoreProgress.progressNotFound");
b()
}
.bind(this)]
})
},
close: function() {
this.waitingSync || this._super()
},
onButtonClick: function() {
this.closed || (this.failureLogin = !1,
this.waitSync())
},
createButtons: function() {
var a = connector.social.listAvailable()
, b = cleverapps.styles.SignInWindow
, c = a.map(function(d) {
return new LoginButton({
multiSocials: 1 < a.length,
height: b.button.height,
width: b.button.width,
source: d,
onSuccess: this.onButtonClick.bind(this)
})
}, this);
return new cleverapps.Layout(c,{
direction: cleverapps.UI.VERTICAL,
margin: b.button.margin
})
},
listBundles: function() {
return ["social_buttons", "sign_in_window"]
}
});
cleverapps.styles.SignInWindow = {
margin: 30,
padding: {
bottom: 25
},
button: {
height: 110,
width: 500,
margin: 20
},
text: {
width: 800,
height: 400
}
};
var EmailWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.callback = a;
this._super({
title: "EmailWindow.title",
content: this.createContent(),
button: {
text: "OK",
onPressed: this.onPressed.bind(this)
},
notCloseByTouchInShadow: !0
})
},
onPressed: function() {
var a = this.editBox.getString().toLowerCase().trim();
cleverapps.validateEmail(a) ? (this.email = a,
cleverapps.info.setKeyValue("email", a),
this.close()) : cleverapps.notification.create("EmailWindow.error")
},
onClose: function() {
this.callback && this.callback(this.email)
},
createContent: function() {
var a = cleverapps.styles.EmailWindow
, b = cleverapps.UI.generateOnlyText("EmailWindow.text", cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.text.width, 0);
var c = "RU" === cleverapps.country.getCountry() || connector.payments.oneOf(connector.YOOKASSA) ? "your_email@yandex.ru" : "your_email@gmail.com"
, d = new cc.Scale9Sprite(bundles.windows.frames.editbox_bg_png);
d = this.editBox = new cc.EditBox(a.editBox,d,!0);
d.setPlaceholderFontColor(cleverapps.styles.FONTS.EMAIL_WINDOW_PLACEHOLDER_TEXT.color);
d.setPlaceholderFont(cleverapps.UI.getFontName(), cleverapps.styles.FONTS.EMAIL_WINDOW_PLACEHOLDER_TEXT.size);
d.setPlaceHolder(c);
d.setInputMode(cc.EDITBOX_INPUT_MODE_EMAILADDR);
d.setMaxLength(100);
d.stayOnTop(!0);
d.setTouchEnabled();
d.setFontColor(cleverapps.styles.FONTS.EMAIL_WINDOW_EDITBOX_TEXT.color);
d.setFont(cleverapps.UI.getFontName(), cleverapps.styles.FONTS.EMAIL_WINDOW_EDITBOX_TEXT.size);
(c = cleverapps.info.getValue("email")) && d.setString(c);
return new cleverapps.Layout([b, d],{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
EMAIL_WINDOW_EDITBOX_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE
},
EMAIL_WINDOW_PLACEHOLDER_TEXT: {
size: 30,
color: cc.color.GRAY
}
});
cleverapps.styles.EmailWindow = {
margin: 60,
padding: {
top: 70,
bottom: 40
},
text: {
width: 650
},
editBox: {
width: 550,
height: 50
}
};
var Boatswain = function(a) {
this.level = a;
this.setIntent(Boatswain.RETURN_INTENT)
};
Boatswain.prototype.setIntent = function(a) {
this.intent = a
}
;
Boatswain.prototype.playIntent = function(a) {
this.intent !== Boatswain.NEXT_INTENT || this.canNext() || (this.intent = Boatswain.RETURN_INTENT);
switch (this.intent) {
case Boatswain.NEXT_INTENT:
cleverapps.focusManager.compound(a, [function(b) {
if (this.level.isDailyCup())
cleverapps.dailyCup.wantsToPlay(b);
else if (this.level.isCurrentLevel())
cleverapps.meta.wantsToPlay(b);
else {
var c = this.level.nextLevel();
cleverapps.meta.wantsToPlay(b, c)
}
}
.bind(this), function(b) {
cleverapps.environment.isGameScene() && !Game.currentGame ? cleverapps.Plot.ReturnToMainScene(b, this.level) : b()
}
.bind(this)]);
break;
case Boatswain.REPLAY_INTENT:
cleverapps.focusManager.compound(a, [function(b) {
cleverapps.meta.wantsToReplay(b, this.level)
}
.bind(this), function(b) {
cleverapps.environment.isGameScene() && !Game.currentGame ? cleverapps.Plot.ReturnToMainScene(b, this.level) : b()
}
.bind(this)]);
break;
case Boatswain.RETURN_INTENT:
this.level.isDailyCup() ? cleverapps.scenes.replaceScene(new DailyCupScene, a) : cleverapps.Plot.ReturnToMainScene(a, this.level)
}
}
;
Boatswain.prototype.prepareNext = function() {
cleverapps.isKnockoutGame() || cleverapps.missionManager.run()
}
;
Boatswain.prototype.canNext = function() {
if ("undefined" !== typeof match3 && match3.heroes && match3.heroes.readyToOpen())
return !1;
if (this.level.isDailyCup())
return cleverapps.dailyCup.isRunning() && (!cleverapps.dailyCup.withLives() || !cleverapps.lives.isEmpty());
if (!this.level.isRegular() || cleverapps.isKnockoutGame() || cleverapps.forces.checkMainForces() || cleverapps.missionManager.skipNext() || cleverapps.missionManager.wantsToShowCompleted() || cleverapps.missionManager.pendingStartWindow() || cleverapps.missionManager.getWantToShowNewStateMission())
return !1;
switch (cleverapps.meta.getType()) {
case Meta.FARM:
if (!cleverapps.farm.isCompleted() && (cleverapps.farm.getBuilding().getQuest().isCompleted() || cleverapps.farm.justCollectedDialogue))
return !1;
break;
case Meta.HOMEFIX:
if (!cleverapps.meta.isCompleted()) {
var a = cleverapps.meta.getMainObject().getFurnitureToUpgrade();
if (a && (a = a.getInfo().cost,
cleverapps.meta.stars >= a && cleverapps.meta.stars - cleverapps.meta.getMainObject().amountLevelStars(this.level) < a))
return !1
}
break;
case Meta.SIMPLE:
if (cleverapps.meta.getMainObject().checkCompleted() || cleverapps.Plot.getDialogueAfterLevel(this.level))
return !1;
break;
case Meta.HOSE:
if (cleverapps.starChest && cleverapps.starChest.stars >= cleverapps.StarChest.GOAL_AMOUNT || this.level.isCurrentLevel() && this.level.isLastLevelOnEpisode())
return !1
}
return !0
}
;
var BoatswainAction = function() {
cleverapps.focusManager.distract({
focus: "boatswain",
control: this.introControls(),
action: function(a) {
this.game.boatswain.playIntent(a)
}
.bind(this)
})
};
Boatswain.RETURN_INTENT = 0;
Boatswain.NEXT_INTENT = 1;
Boatswain.REPLAY_INTENT = 2;
var UndoHistory = function(a) {
this.commands = [];
this.pointer = 0;
a && a.moves && (this.commands = a.moves.map(function(b) {
return Game.currentGame.getCommand(b)
}),
this.pointer = a.pointer);
this.onChangeListener = function() {}
};
UndoHistory.prototype.add = function(a) {
this.commands.splice(this.pointer);
this.commands.push(a);
this.redo()
}
;
UndoHistory.prototype.hasUndo = function() {
return 0 !== this.pointer
}
;
UndoHistory.prototype.hasRedo = function() {
return void 0 !== this.commands[this.pointer]
}
;
UndoHistory.prototype.undo = function() {
this.hasUndo() && (this.pointer--,
this.commands[this.pointer].undo(),
this.onChangeListener(this.hasUndo(), this.hasRedo()))
}
;
UndoHistory.prototype.redo = function() {
if (this.hasRedo()) {
var a = this.commands[this.pointer];
this.pointer++;
a.redo();
this.onChangeListener(this.hasUndo(), this.hasRedo())
}
}
;
UndoHistory.prototype.reset = function() {
this.commands = [];
this.pointer = 0;
this.onChangeListener(this.hasUndo(), this.hasRedo())
}
;
UndoHistory.prototype.getInfo = function() {
return {
moves: this.commands.map(function(a) {
return a.move
}),
pointer: this.pointer
}
}
;
var Highscore = function() {
cleverapps.EventEmitter.call(this);
this.load()
};
Highscore.prototype = Object.create(cleverapps.EventEmitter.prototype);
Highscore.prototype.constructor = Highscore;
Highscore.prototype.setScore = function(a) {
this.highscore !== a && (this.highscore = a,
this.trigger("update", a))
}
;
Highscore.prototype.getScore = function() {
return this.highscore
}
;
Highscore.prototype.showView = function() {
this.trigger("show")
}
;
Highscore.prototype.hideView = function() {
this.trigger("hide")
}
;
Highscore.prototype.gamePlayed = function(a, b) {
cleverapps.playSession.set(cleverapps.EVENTS.COMPLETE_LEVEL_DAU, !0);
var c = b.score.getPoints()
, d = c > this.highscore;
d && this.setScore(c);
c = "klondike" === cleverapps.config.type ? Highscore.LOWER_BETTER : Highscore.HIGHER_BETTER;
c === Highscore.LOWER_BETTER ? (this.bestmoves = this.bestmoves || b.moves,
b.moves < this.bestmoves && (this.bestmoves = b.moves)) : c === Highscore.HIGHER_BETTER && b.moves > this.bestmoves && (this.bestmoves = b.moves);
this.save();
a === GameBase.OUTCOME_VICTORY && (cleverapps.meta.getType() === Meta.SIMPLE && (b.rewards.metaStar = d ? 3 : 1),
b.rewards[cleverapps.config.soft ? GameBase.REWARD_SOFT : GameBase.REWARD_HARD] = d ? 50 : 10)
}
;
Highscore.HIGHER_BETTER = 0;
Highscore.LOWER_BETTER = 1;
Highscore.prototype.getInfo = function() {
return {
highscore: this.highscore,
bestmoves: this.bestmoves
}
}
;
Highscore.prototype.updateInfo = function(a) {
a = a || {};
this.highscore = a.highscore || 0;
this.bestmoves = a.bestmoves || 0
}
;
Highscore.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.HIGHSCORE);
this.updateInfo(a)
}
;
Highscore.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.HIGHSCORE, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("metha")
}
;
cleverapps.InitByFeature.highscore = function() {
cleverapps.highscore = new Highscore
}
;
var ScoreStatsComponent = cc.Node.extend({
ctor: function() {
this._super();
this.setAnchorPoint(.5, .5);
this.createContent()
},
simpleEntry: function(a, b) {
return cleverapps.UI.generateOnlyText(Messages.get(a) + ": " + b, cleverapps.styles.FONTS.WHITE_TEXT)
},
createContent: function() {
var a = cleverapps.styles.ScoreStatsComponent;
var b = [];
b.push(this.simpleEntry("moves", Game.currentGame.moves));
cleverapps.highscore.bestmoves && b.push(this.simpleEntry("bestmoves", cleverapps.highscore.bestmoves));
b = new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
});
a.background && (a = new cc.Scale9Sprite(bundles.game.frames.loop_stats_bg),
a.setPositionRound(b.width / 2, b.height / 2),
a.setContentSize2(b.getContentSize()),
this.addChild(a));
b.setPositionRound(b.width / 2, b.height / 2);
this.addChild(b);
this.setContentSize2(b.getContentSize())
},
beforeWinClose: function() {
this.setCascadeOpacityEnabledRecursively(!0);
this.runAction(new cc.FadeOut(.1))
}
});
cleverapps.styles.ScoreStatsComponent = {
margin: 20,
padding: {
x: 50,
y: 20
},
background: !0
};
var VictoryScoreComponent = cleverapps.Layout.extend({
ctor: function() {
var a = cleverapps.styles.VictoryScoreComponent
, b = Game.currentGame.score.getPoints()
, c = cleverapps.highscore.getScore()
, d = cleverapps.UI.generateOnlyText(Messages.get(b >= c ? "VictoryScoreComponent.newRecord" : "VictoryScoreComponent.yourScore"), cleverapps.styles.FONTS.LOOP_SCORE_TITLE_TEXT);
this.animatedAmount = cleverapps.UI.generateImageText(0, cleverapps.styles.FONTS.LOOP_SCORE_VALUE_TEXT);
d = [new cleverapps.Layout([d, this.animatedAmount],{
direction: cleverapps.UI.VERTICAL
})];
b >= c ? d.unshift(new cc.Sprite(bundles.highscore.frames.new_high_score_icon)) : (b = cleverapps.UI.generateOnlyText(Messages.get("VictoryScoreComponent.bestScore"), cleverapps.styles.FONTS.LOOP_SCORE_SECONDARY_TITLE_TEXT),
c = new TextWithIcon("@@" + c,{
font: cleverapps.styles.FONTS.LOOP_SCORE_SECONDARY_VALUE_TEXT,
icons: {
"@@": bundles.highscore.frames.high_score_icon
}
}),
this.bestScoreLayout = new cleverapps.Layout([b, c],{
direction: cleverapps.UI.VERTICAL
}),
d.push(this.bestScoreLayout));
this._super(d, {
direction: cleverapps.UI.VERTICAL,
margin: a.margin
})
},
showUp: function() {
var a = Game.currentGame.score.getPoints()
, b = 1;
a !== this.lastShownScore && (this.animatedAmount.countToAnimation(1, a),
this.lastShownScore = a);
this.bestScoreLayout && (this.bestScoreLayout.setCascadeOpacityEnabledRecursively(!0),
this.bestScoreLayout.setVisible(!1),
this.bestScoreLayout.runAction(new cc.Sequence(new cc.FadeTo(0,0),new cc.DelayTime(b),new cc.Show,(new cc.FadeIn(.3)).easing(cc.easeOut(1.2)))),
b += .3);
return 1E3 * b
},
beforeWinClose: function() {
this.setCascadeOpacityEnabledRecursively(!0);
this.runAction(new cc.FadeOut(.1))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
LOOP_SCORE_TITLE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
LOOP_SCORE_VALUE_TEXT: {
size: 100,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
LOOP_SCORE_SECONDARY_TITLE_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
LOOP_SCORE_SECONDARY_VALUE_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
}
});
cleverapps.styles.VictoryScoreComponent = {
margin: 50
};
var ScoreView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.targetScore = b;
this.setAnchorPoint(.5, .5);
b = a.getPoints();
this.targetScore && (b = b + "/" + this.targetScore);
this.scoreView = cleverapps.UI.generateImageText(b, cleverapps.styles.FONTS.SCORE_TEXT);
this.scoreView.fitTo(cleverapps.styles.UI.ScoreView.maxWidth);
this.addChild(this.scoreView);
this.setPositionRound(cleverapps.styles.UI.ScoreView);
a.on("onChange", this.updateScore.bind(this), this)
},
updateScore: function(a, b) {
this.scoreView.countToAnimation(.4, a, this.targetScore);
this.scoreView.fitTo(cleverapps.styles.UI.ScoreView.maxWidth);
b && this.scoreView.runAction(new cc.Sequence(new cc.ScaleTo(.3,1.2),new cc.ScaleTo(.1,1)))
}
});
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
SCORE_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.styles.UI.ScoreView = {
x: {
align: "center"
},
y: {
align: "center"
},
maxWidth: 350
};
var HighScoreView = cc.Scale9Sprite.extend({
ctor: function(a) {
this._super(bundles.game.frames.high_score_bg);
var b = cleverapps.styles.UI.HighScoreView;
this.setAnchorPoint(.5, .5);
this.setContentSize(b.bg);
this.scoreView = cleverapps.UI.generateImageText(a.getScore(), cleverapps.styles.FONTS.HIGH_SCORE_TEXT);
this.scoreView.setPositionRound(b.text);
this.addChild(this.scoreView);
this.icon = new cc.Sprite(bundles.game.frames.high_score_icon);
this.icon.setPositionRound(b.icon);
this.addChild(this.icon);
this.setCascadeOpacityEnabledRecursively(!0);
this.setVisible(!1);
a.on("show", this.createListener(this.showScore.bind(this)), this);
a.on("hide", this.createListener(this.hideScore.bind(this)), this);
a.on("update", this.createListener(this.updateScore.bind(this)), this)
},
updateScore: function(a) {
this.scoreView.countToAnimation(.4, a);
this.scoreView.fitTo(cleverapps.styles.UI.ScoreView.maxWidth)
},
showScore: function() {
this.setOpacity(0);
this.runAction(new cc.Sequence(new cc.Show,new cc.FadeIn(.5)))
},
hideScore: function() {
this.runAction(new cc.Sequence(new cc.FadeOut(.5),new cc.Hide))
}
});
cleverapps.overrideColors(cleverapps.styles.COLORS, {
HIGHSCORE_COLOR: new cc.Color(241,187,24,255)
});
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
HIGH_SCORE_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.HIGHSCORE_COLOR
}
});
cleverapps.styles.UI.HighScoreView = {
bg: {
width: 250,
height: 84
},
text: {
x: {
align: "center",
dx: 44
},
y: {
align: "center"
}
},
icon: {
x: {
align: "left",
dx: 10
},
y: {
align: "center"
}
},
maxWidth: 130
};
cleverapps.InitByFeature.lives = function(a) {
cleverapps.unlimitedLives = new UnlimitedLives;
cleverapps.Lives.initialize(a)
}
;
cleverapps.Lives = function(a, b) {
this.slot = b;
a ? this.init() : this.load();
this.onChangeAmountListeners = {};
this.onStartRegenerateListener = function() {}
;
this.onBuyUnlimitedLivesListener = function() {}
;
this.onFullListener = function() {}
;
this.processRegenerateState()
}
;
cleverapps.Lives.TIMEOUT = cleverapps.parseInterval(cleverapps.config.debugMode ? "3 minute" : "30 minutes");
cleverapps.Lives.prototype.init = function() {
this.amount = this.getMaxLives();
this.whenStart = void 0;
this.save()
}
;
cleverapps.Lives.prototype.getMaxLives = function() {
return ["olympics", "zenmatch", "woodenblock"].includes(cleverapps.config.name) ? 3 : 5
}
;
cleverapps.Lives.prototype.processRegenerateState = function(a) {
this.stopRegenerateTimeout();
for (var b, c; this.amount < this.getMaxLives() && this.whenStart && this.whenStart + cleverapps.Lives.TIMEOUT <= Date.now(); )
this.amount++,
this.whenStart += cleverapps.Lives.TIMEOUT,
c = b = !0;
var d = cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed();
!b || a || d || this.runListeners();
if (b && this.amount >= this.getMaxLives())
this.onFullListener();
this.amount >= this.getMaxLives() ? delete this.whenStart : (this.whenStart || (this.whenStart = Date.now(),
c = !0),
this.startRegenerateTimeout(void 0 !== a ? a : d));
c && this.save();
this.processLocalPushes()
}
;
cleverapps.Lives.prototype.startRegenerateTimeout = function(a) {
if (void 0 === this.finishRegenerateTimeout && (console.log("startRegenerateTimeout", this.calcTimeLeft()),
this.finishRegenerateTimeout = new cleverapps.LongTimeout(this.processRegenerateState.bind(this),this.calcTimeLeft()),
!a))
this.onStartRegenerateListener()
}
;
cleverapps.Lives.prototype.stopRegenerateTimeout = function() {
clearTimeout(this.finishRegenerateTimeout);
this.finishRegenerateTimeout = void 0
}
;
cleverapps.Lives.prototype.isRegenerateRunning = function() {
return void 0 !== this.finishRegenerateTimeout
}
;
cleverapps.Lives.prototype.calcTimeLeft = function() {
var a = (this.whenStart || Date.now()) + cleverapps.Lives.TIMEOUT - Date.now();
0 > a && (a = 0);
a > cleverapps.Lives.TIMEOUT && (a = cleverapps.Lives.TIMEOUT);
return a
}
;
cleverapps.Lives.prototype.isEmpty = function() {
return 0 === this.amount && !(cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed())
}
;
cleverapps.Lives.prototype.isFull = function() {
return this.amount >= this.getMaxLives() || cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed()
}
;
cleverapps.Lives.prototype.give = function(a, b, c) {
a = void 0 === a ? 1 : a;
b && cleverapps.eventLogger.logEvent(cleverapps.EVENTS.EARN.LIVES + this.slot + "_" + b, {
value: a
});
this.setAmount(this.amount + a, c)
}
;
cleverapps.Lives.prototype.setAmount = function(a, b) {
0 > a && (a = 0);
if (0 < this.amount - a) {
var c = cleverapps.missionManager.findByType(Mission.TYPE_LIVESFEAST);
c && c.update(this.amount - a)
}
this.amount !== a && (this.amount = a,
this.save(),
b || this.runListeners());
this.processRegenerateState(!0);
this.amount < .2 * this.getMaxLives() && this.showForce()
}
;
cleverapps.Lives.prototype.processLocalPushes = cleverapps.timeredThrottle(cleverapps.parseInterval("1 minute"), function() {
if (this.isFull())
cleverapps.localPushes.cancelPush(cleverapps.LocalPushes.TYPES.LIVES);
else {
var a = this.getMaxLives() - this.amount;
a = (this.whenStart || Date.now()) + cleverapps.Lives.TIMEOUT * a - Date.now();
cleverapps.localPushes.sendPush(cleverapps.LocalPushes.TYPES.LIVES, a)
}
});
cleverapps.Lives.prototype.reset = function() {
this.amount = this.getMaxLives();
this.whenStart = void 0;
this.processRegenerateState();
this.save()
}
;
cleverapps.Lives.prototype.canTake = function(a) {
return this.amount >= a
}
;
cleverapps.Lives.prototype.take = function(a) {
cleverapps.config.editorMode || (this.amount >= this.getMaxLives() && delete this.whenStart,
0 < this.amount && this.setAmount(this.amount - 1, a))
}
;
cleverapps.Lives.prototype.getInfo = function() {
return {
a: this.amount,
wc: this.whenStart && cleverapps.compactTime(this.whenStart, {
seconds: !0
})
}
}
;
cleverapps.Lives.prototype.updateInfo = function(a, b) {
this.load(a);
this.processRegenerateState();
this.save(b)
}
;
cleverapps.Lives.prototype.runListeners = function() {
Object.values(this.onChangeAmountListeners).forEach(function(a) {
a()
})
}
;
cleverapps.Lives.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.LIVES + this.slot, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("lives" + this.slot)
}
;
cleverapps.Lives.prototype.load = function(a) {
(a = a || cleverapps.dataLoader.load(DataLoader.TYPES.LIVES + this.slot)) ? (this.amount = a.a || a.amount || 0,
this.whenStart = a.wc && cleverapps.expandTime(a.wc, {
seconds: !0
}) || a.ws || a.whenStart) : (this.amount = this.getMaxLives(),
this.whenStart = void 0)
}
;
cleverapps.Lives.prototype.showForce = function() {}
;
cleverapps.Lives.Switch = function(a, b) {
cleverapps.lives = cleverapps.livesBySlots[a];
b && cleverapps.lives.init()
}
;
CustomSyncers.registerBySlots("lives", function(a) {
return cleverapps.livesBySlots[a] ? cleverapps.livesBySlots[a].getInfo() : {}
}, function(a, b) {
cleverapps.livesBySlots[a] && cleverapps.livesBySlots[a].updateInfo(b, !0)
});
cleverapps.Lives.initialize = function(a) {
cleverapps.livesBySlots = {};
Meta.SLOTS.forEach(function(b) {
cleverapps.livesBySlots[b] = new cleverapps.Lives(a,b)
});
cleverapps.lives = cleverapps.livesBySlots[Meta.SLOT_MAIN]
}
;
RewardTypes.lives = {
controls: "MenuBarLivesItem",
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION,
getIcon: function() {
return bundles.reward_icons.frames.life_png
},
getSmallIcon: function() {
return bundles.reward_icons.frames.life_small_png
},
handler: function(a, b) {
cleverapps.lives.give(a, b.event, !0);
return function() {
cleverapps.lives.processRegenerateState(!0);
cleverapps.lives.runListeners()
}
}
};
RewardTypes.unlimitedLives = {
controls: "MenuBarLivesItem",
getIcon: function() {
return bundles.reward_icons.frames.life_unlim
},
getSmallIcon: function() {
return bundles.reward_icons.frames.life_unlim_small
},
handler: function(a) {
cleverapps.unlimitedLives.buy(a.time);
return function() {
cleverapps.lives.onBuyUnlimitedLivesListener()
}
}
};
var LivesMenuBarItemModel = function(a) {
MenuBarItem.call(this, a);
this.onUpdateLotteryIcon = function() {}
};
LivesMenuBarItemModel.prototype = Object.create(MenuBarItem.prototype);
LivesMenuBarItemModel.prototype.constructor = LivesMenuBarItemModel;
LivesMenuBarItemModel.prototype.clearListeners = function() {
this.lives.onChangeAmountListeners.livesview = function() {}
;
this.lives.onStartRegenerateListener = function() {}
;
this.lives.onBuyUnlimitedLivesListener = function() {}
}
;
LivesMenuBarItemModel.prototype.customInit = function() {
this.lives && this.clearListeners();
this.lives = cleverapps.lives;
this.attention = !1;
this.lives.onChangeAmountListeners.livesview = this.updateAll.bind(this);
this.lives.onStartRegenerateListener = this.updateAll.bind(this);
this.lives.onBuyUnlimitedLivesListener = this.updateAll.bind(this);
Game.currentGame && Game.currentGame.energyLottery && (Game.currentGame.energyLottery.onShowHint = this.setFinger.bind(this, !0),
Game.currentGame.energyLottery.onHideHint = this.setFinger.bind(this));
this.updateAll()
}
;
LivesMenuBarItemModel.prototype.onAction = function() {
this.setFinger(!1)
}
;
LivesMenuBarItemModel.prototype.withPlusButton = function() {
return cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed() ? !1 : MenuBarItem.prototype.withPlusButton.call(this)
}
;
LivesMenuBarItemModel.prototype.updateAll = function() {
cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed() ? this.totalIcon = bundles.menubar.frames.unlim_png : this.totalIcon = !1;
this.changeText();
this.updatePlusButton();
this.updateTimer();
this.updateAttention()
}
;
LivesMenuBarItemModel.prototype.updateTimer = function() {
var a = this.timer;
this.stopTimer();
this.lottery = !["merge"].includes(cleverapps.config.type);
cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed() ? (this.lottery = !1,
this.setTimer(new cleverapps.CountDown(cleverapps.unlimitedLives.getLeftTime(),{
onFinish: function() {
!cleverapps.focusManager.isFocused() && cleverapps.environment.hasScene([cleverapps.Environment.SCENE_MAIN, cleverapps.Environment.SCENE_DAILY_CUP]) && cleverapps.unlimitedLives.displayPromotionOnFinish();
this.updateAll()
}
.bind(this)
}), !1)) : this.lives.amount < this.lives.getMaxLives() && 0 < this.lives.calcTimeLeft() && (this.lottery = !1,
this.setTimer(new cleverapps.CountDown(this.lives.calcTimeLeft(),{
onFinish: this.updateAll.bind(this)
}), !1));
this.onUpdateLotteryIcon();
if (this.onChangeTimer)
this.onChangeTimer(!!this.timer === !!a);
if (this.onRefreshTimer && this.timer)
this.onRefreshTimer()
}
;
LivesMenuBarItemModel.prototype.getCurrentValue = function() {
if (cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed())
var a = Date.now() + cleverapps.unlimitedLives.getLeftTime();
return {
amount: cleverapps.lives.amount,
total: cleverapps.lives.getMaxLives(),
time: a
}
}
;
var LivesProductTile = BaseProductTile.extend({
ctor: function(a, b) {
var c = LivesProductTile.styles = LivesProductTile.styles || cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, cleverapps.styles.LivesProductTile, !0);
b = b || {};
b.noTileClick = !0;
b.iconSkipScale = !0;
b.iconAnimationOverride = a.product.animation ? {
json: bundles.tile_shop.jsons.shop_lives_animations_json,
delay: 0
} : {};
this._super(a, c, b)
},
onReady: function() {
this.tileModel instanceof EnergyLotteryTileModel && Game.currentGame.energyLottery.isHintActive() && Game.currentGame.energyLottery.isReady() && this.addFinger()
},
createDescription: function() {
var a = this.tileModel.getProductDescription();
if (a) {
"string" === typeof a && (a = {
title: a
});
var b = this.styles.description;
if (a.reward) {
var c = this.createRewards(cleverapps.styles.FONTS.SHOP_WINDOW_LIVES_TEXT);
a = new cc.Node;
a.setAnchorPoint(.5, .5);
a.setContentSize(b);
c.setPositionRound(b.width / 2, b.height / 2);
a.addChild(c);
return a
}
if (a.countdown) {
var d = cleverapps.styles.FONTS.SHOP_LIVES_PRODUCT_TILE_DESCRIPTION_TEXT || cleverapps.styles.FONTS.SMALL_WHITE_TEXT;
c = cleverapps.UI.generateOnlyText("TileShop.tile.leftTime", d);
a = new cleverapps.CountDownView(new cleverapps.CountDown(a.countdown,{
onFinish: this.tileModel.updateModelState.bind(this.tileModel)
}),{
font: d
});
d = new cc.Sprite(bundles.timer.frames.timer_png);
a = new cleverapps.Layout([d, a],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.timer.margin
});
return new cleverapps.Layout([c, a],{
direction: cleverapps.UI.VERTICAL,
dimensions: b
})
}
if (a.text)
return d = cleverapps.styles.FONTS.SHOP_LIVES_PRODUCT_TILE_DESCRIPTION_TEXT || cleverapps.styles.FONTS.SMALL_WHITE_TEXT,
c = cleverapps.UI.generateOnlyText(a.text, d),
c.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
c.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),
c.setDimensions(b.width, 0),
c.fitTo(void 0, b.height),
c.setDimensions(b.width, b.height),
c
}
},
createLimit: function() {
if ("merge" !== cleverapps.config.type)
return this._super();
var a = this.tileModel.getProductLimit();
if (a) {
var b = this.styles.limit;
if (a.left)
return a = cleverapps.UI.generateOnlyText(a.left, cleverapps.styles.FONTS.SHOPTILE_LEFT),
"heroes" === cleverapps.config.ui && a.setOpacity(120),
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
a.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),
a.setDimensions(b.width, b.height),
a
}
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
SHOP_LIVES_PRODUCT_TILE_DESCRIPTION_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.LivesProductTile = {
button: {
width: 225,
height: 75
},
description: {
width: 300,
height: 70,
timer: {
margin: 6
}
},
badge: {
x: {
align: "right",
dx: -5
},
y: {
align: "top",
dy: -58
},
rotation: 0
}
};
var AskLivesTileModel = function(a) {
TileModel.call(this, a)
};
AskLivesTileModel.prototype = Object.create(TileModel.prototype);
AskLivesTileModel.prototype.constructor = AskLivesTileModel;
AskLivesTileModel.prototype.getCurrentPrice = function() {
return "FREE"
}
;
AskLivesTileModel.prototype.getProductDescription = function() {
return {
text: "AskLivesProduct.description"
}
}
;
AskLivesTileModel.prototype.isEnabled = function() {
return cleverapps.flags.requestsEnabled
}
;
AskLivesTileModel.prototype.buy = function(a) {
cleverapps.SocialManager.enforceLogin(function(b) {
b === cleverapps.CODE_SUCCEED && FriendsCache.loadFriends(function() {
new SelectFriendWindow("askLives",function(c, d) {
cleverapps.requests.send(c, "askLiveRequest", function() {
c.forEach(function(e) {
cleverapps.friends.inApp(e) && levels.friendRequests.sendServerRequest(e, levels.FriendRequest.TYPE_ASK_LIVE)
});
d();
a()
})
}
)
})
})
}
;
var RefillLivesTileModel = function(a) {
TileModel.call(this, a);
this.product.reward = this.getReward()
};
RefillLivesTileModel.prototype = Object.create(TileModel.prototype);
RefillLivesTileModel.prototype.constructor = RefillLivesTileModel;
RefillLivesTileModel.prototype.getReward = function() {
return {
lives: cleverapps.lives.getMaxLives()
}
}
;
RefillLivesTileModel.prototype.getProductDescription = function() {
return {
reward: !0
}
}
;
var BuyLivesTileModel = function(a) {
TileModel.call(this, a)
};
BuyLivesTileModel.prototype = Object.create(TileModel.prototype);
BuyLivesTileModel.prototype.constructor = BuyLivesTileModel;
BuyLivesTileModel.prototype.getProductDescription = function() {
return {
reward: !0
}
}
;
var UnlimitedLives = function() {
this.value = void 0;
this.load()
};
UnlimitedLives.prototype.buy = function(a) {
"string" === typeof a && (a = cleverapps.parseInterval(a));
this.checkBuyed() ? this.value.actionTime += a : this.value = {
buyTime: Date.now(),
actionTime: a,
fpShowed: 0
};
this.save()
}
;
UnlimitedLives.prototype.reset = function() {
this.value = void 0;
this.save()
}
;
UnlimitedLives.prototype.getLeftTime = function() {
if (connector.platform.oneOf(connector.PLIEGA))
return Infinity;
if (void 0 === this.value)
return 0;
var a = this.value.buyTime + this.value.actionTime - Date.now();
return 0 >= a ? 0 : a
}
;
UnlimitedLives.prototype.checkBuyed = function() {
return 0 < this.getLeftTime()
}
;
UnlimitedLives.prototype.displayPromotionOnFinish = function() {
cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_REGULAR && this.value && !this.value.fpShowed && 0 === this.getLeftTime() && this.showPromotion()
}
;
UnlimitedLives.prototype.showPromotion = function() {
cleverapps.focusManager.display({
focus: "ExtendUnlimitedLivesWindow",
action: function(a) {
this.value.fpShowed = 1;
this.save();
new ExtendUnlimitedLivesWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
.bind(this)
})
}
;
UnlimitedLives.prototype.showFreeOffer = function(a) {
cleverapps.focusManager.display({
stack: !0,
focus: "FreeUnlimitedLivesWindow",
action: function(b) {
new FreeUnlimitedLivesWindow(a);
cleverapps.focusManager.onceNoWindowsListener = b
}
})
}
;
UnlimitedLives.prototype.freeOfferIsAvailable = function() {
return cleverapps.lives.isEmpty() && !cleverapps.forces.isShown(Forces.FREE_UNLIMITED_LIVES_FORCE.id) && cleverapps.user.getFloatLevel() < UnlimitedLives.FREE_OFFER_AVAILABLE_THRESHOLD
}
;
UnlimitedLives.prototype.getInfo = function() {
var a = {};
a[UnlimitedLives.UNLIMITED_LIVES_COMPAT] = this.value;
return a
}
;
UnlimitedLives.prototype.updateInfo = function(a, b) {
this.value = a[UnlimitedLives.UNLIMITED_LIVES_COMPAT];
this.save(b)
}
;
UnlimitedLives.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.UNLIMITED_LIVES);
this.value = void 0 === a ? void 0 : a[UnlimitedLives.UNLIMITED_LIVES_COMPAT]
}
;
UnlimitedLives.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.UNLIMITED_LIVES, this.getInfo());
a || cleverapps.synchronizer.addUpdateTask("tempgoods")
}
;
UnlimitedLives.FREE_OFFER_AVAILABLE_THRESHOLD = 4;
UnlimitedLives.UNLIMITED_LIVES_COMPAT = 1;
var ExtendUnlimitedLivesWindow = CleverappsWindow.extend({
onWindowLoaded: function() {
var a = cleverapps.styles.ExtendUnlimitedLivesWindow
, b = this.createAnimation()
, c = this.createText();
this.product = Product.CreateById("unlimitedLives");
b = new cleverapps.Layout([b, c],{
margin: a.margin,
direction: cleverapps.UI.VERTICAL,
padding: a.padding
});
this._super({
content: b,
title: "ExtendUnlimitedLivesWindow.title",
name: "extendunlimitedliveswindow",
button: {
text: this.getButtonText(),
width: a.button.width,
height: a.button.height,
onPressed: this.onBuy.bind(this)
},
openSound: bundles.extend_unlimited_lives_window.urls.lives_effect
});
"hard" === this.product.currency && cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem");
Lottery.addIcon(this.button);
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this);
this.updateButton()
},
updateButton: function() {
connector.payments.isConnected() ? this.buttons.enable() : this.buttons.disable()
},
getPerson: function() {
return {
role: "hero",
emotion: "sad"
}
},
createText: function() {
var a = cleverapps.styles.ExtendUnlimitedLivesWindow
, b = cleverapps.UI.generateOnlyText("ExtendUnlimitedLivesWindow.unlimitedLivesText", cleverapps.styles.FONTS.WINDOW_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.text.width, 0);
b.fitTo(void 0, a.text.height);
return b
},
createAnimation: function() {
var a = cleverapps.styles.ExtendUnlimitedLivesWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setContentSize2(a.animation);
var c = new cleverapps.Spine(bundles.extend_unlimited_lives_window.jsons.lives_json);
-1 !== ["differences", "tripeaks", "olympics", "spades", "zenmatch"].indexOf(cleverapps.config.name) ? c.setAnimationAndIdleAfter("no_life", "idle") : c.setAnimation(0, "no_life", !0);
b.addChild(c);
c.setPositionRound(a.animation);
return b
},
onBuy: function() {
this.product.buy(function(a) {
a && this.close()
}
.bind(this))
},
getButtonText: function() {
return this.product.getCurrentPrice()
},
listBundles: function() {
return ["extend_unlimited_lives_window"]
}
});
cleverapps.styles.ExtendUnlimitedLivesWindow = {
margin: 75,
padding: {
bottom: 40
},
animation: {
width: 250,
height: 250,
x: {
align: "center"
},
y: {
align: "center"
}
},
text: {
width: 700,
height: 300
},
button: {
width: 300,
height: 100
}
};
var FreeUnlimitedLivesWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.onSuccess = a;
a = cleverapps.styles.ExtendUnlimitedLivesWindow;
var b = this.createIcon()
, c = this.createText();
b = new cleverapps.Layout([b, c],{
margin: a.margin,
direction: cleverapps.UI.VERTICAL
});
this._super({
content: b,
title: "FreeUnlimitedLivesWindow.title",
name: "freeunlimitedliveswindow",
button: {
text: "FREE",
width: a.button.width,
height: a.button.height,
onPressed: this.onBuy.bind(this)
},
closeButton: !1
})
},
createText: function() {
var a = cleverapps.styles.FreeUnlimitedLivesWindow.text
, b = cleverapps.UI.generateOnlyText("FreeUnlimitedLivesWindow.unlimitedLivesText", cleverapps.styles.FONTS.WINDOW_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.width, 0);
b.fitTo(void 0, a.height);
return b
},
createIcon: function() {
var a = new cc.Sprite(bundles.tile_shop.frames.unlimitedLives_png)
, b = bundles.tile_shop.jsons.shop_lives_animations_json;
b && (b = new cleverapps.Spine(b),
b.setPosition(a.width / 2, a.height / 2),
b.setAnimation(0, "animation", !0),
a.addChild(b));
return a
},
onShow: function() {
this._super();
cleverapps.forces.create(this.buttons, Forces.FREE_UNLIMITED_LIVES_FORCE, {
highlights: [this],
importantNodes: [this.window]
})
},
onBuy: function() {
cleverapps.unlimitedLives.buy("3 hours");
cleverapps.lives.onBuyUnlimitedLivesListener();
cleverapps.forces.closeRunningForce();
this.onSuccess();
this.close()
},
listBundles: function() {
return ["tile_shop"]
}
});
cleverapps.styles.FreeUnlimitedLivesWindow = {
margin: 75,
text: {
width: 700,
height: 300
},
button: {
width: 300,
height: 100
}
};
Placements.ENTRIES.unlimitedLivesWindow = {
type: Placements.FREE_FOCUS,
priority: 0,
filter: function() {
return cleverapps.environment.hasScene([cleverapps.Environment.SCENE_MAIN, cleverapps.Environment.SCENE_DAILY_CUP])
},
action: function() {
cleverapps.unlimitedLives.displayPromotionOnFinish()
}
};
Placements.ENTRIES.restoreLives = {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return cleverapps.flags.monetization === cleverapps.Flags.MONETIZATION_DISABLED && cleverapps.lives.isEmpty()
},
action: function() {
cleverapps.focusManager.display({
focus: "restoreLives",
action: function(a) {
new RewardWindow({
lives: cleverapps.lives.getMaxLives()
});
cleverapps.focusManager.onceNoWindowsListener = a
}
})
}
};
var LivesMenuBarItem = {
name: "LivesItem",
lottery: !0,
targets: "lives",
plusButton: connector.platform.oneOf(connector.PLIEGA) ? void 0 : !0,
attentionUpdater: function(a) {
Game.currentGame && Game.currentGame.energyLottery && (Game.currentGame.energyLottery.onLotteryAttentionChanged = a)
},
attention: function() {
if (Game.currentGame && Game.currentGame.energyLottery)
return Game.currentGame.energyLottery.isReady()
},
availableOnScenes: function() {
var a = [cleverapps.Environment.SCENE_BONUS_WORLD];
cleverapps.travelBook.getCurrentPage().withEnergy() && a.push(cleverapps.Environment.SCENE_MAIN);
cleverapps.dailyCup.withLives() && a.push(cleverapps.Environment.SCENE_DAILY_CUP);
return a
},
force: Forces.BUY_ENERGY_ICON,
viewClass: MenuBarWithTimeoutView,
modelClass: LivesMenuBarItemModel,
icon: function() {
return cleverapps.skins.getSlot("menubar_life_png") || bundles.menubar.frames.menubar_life_png
},
onClickWindow: LivesShopWindow,
filter: function() {
return cleverapps.unlimitedLives && cleverapps.unlimitedLives.freeOfferIsAvailable() ? (cleverapps.unlimitedLives.showFreeOffer(function() {}),
!1) : cleverapps.unlimitedLives && cleverapps.unlimitedLives.checkBuyed() || connector.platform.oneOf(connector.PLIEGA) ? !1 : !0
},
sparks: !0,
deltaSound: cleverapps.config.lives ? bundles.menubar.urls.lives_fly_finish_effect : bundles.menubar.urls.energy_fly_finish_effect
};
var ProlongationWindow = CleverappsWindow.extend({
onWindowLoaded: function(a, b) {
b = b || {};
this.prolongation = a;
this.type = b.type || Prolongation.TYPES.MOVES;
this.onSuccess = b.onSuccess || function() {}
;
this.onGiveUp = b.onGiveUp || function() {}
;
this.canGiveUp = "klondike" !== cleverapps.config.type;
this.offer = b.offer || this.prolongation.getOffer(this.type);
if (cleverapps.gameModes.skipProlongation)
this.onGiveUp();
else
this.prolongation.onCompleteOffer = function() {
this.skipAlert = this.canGiveUp = !0;
this.close()
}
.bind(this),
this.haveForce = "free" === this.offer.priceType,
a = !this.haveForce,
b = "ProlongationWindow.title",
this.type === Prolongation.TYPES.BOMB ? b = "PostponeBombWindow.title" : this.type === Prolongation.TYPES.FLAGS ? b = "RemoveFlagsWindow.title" : this.type === Prolongation.TYPES.OCTOPUS_HUNT && (b = "OctopusHuntProlongationWindow.Title"),
this._super({
title: b,
name: "prolongationwindow",
content: this.createContent(),
styles: cleverapps.styles.ProlongationWindow.window,
closeButton: a,
notCloseByTouchInShadow: !0,
openSound: bundles.prolongation_window.urls.continue_effect
}),
this.prolongation.on("acceptOffer", this.createListener(this.onAcceptOffer.bind(this), this)),
this.prolongation.on("adsCanceled", this.createListener(this.onAdsCanceled.bind(this), this)),
cleverapps.focusManager.showControlsWhileFocused("MenuBarGoldItem"),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MOVES_SHOW),
cleverapps.windows.list.forEach(function(c) {
"confirmexitwindow" === c.name && c.close()
})
},
getPerson: function() {
return {
role: "hero",
emotion: "sad"
}
},
onAdsCanceled: function() {
var a = this.prolongation.getOffer(this.type);
"currency" === a.priceType && (this.offerView.updateOffer(a),
this.offer = a)
},
close: function() {
if (!this.skipAlert) {
this.skipAlert = !0;
var a = this.prolongation.getAlertMessage(this.type);
if (a) {
this.showGiveUpAlert(a);
return
}
}
this._super()
},
createContent: function() {
var a = cleverapps.styles.ProlongationWindow
, b = [];
"match3" === cleverapps.config.type && this.type !== Prolongation.TYPES.BOMB && b.push(this.createGoals());
this.offerView = new ProlongationOfferView(this.prolongation,this.offer);
b.push(this.offerView);
return new cleverapps.Layout(b,{
direction: cleverapps.UI.VERTICAL,
margin: a.margin,
padding: a.padding
})
},
addFinger: function() {
FingerView.isRunning(this.finger) || this.haveForce || (this.finger = FingerView.hintClick(this.offerView.button, {
delay: 1.6
}))
},
removeFinger: function() {
FingerView.remove(this.finger);
this.finger = void 0
},
createGoals: function() {
var a = cleverapps.styles.ProlongationWindow.goals
, b = this.createGoalIcons();
a = new cleverapps.Layout(b,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin,
padding: a.padding
});
bundles.prolongation_window.frames.goals_bg_png && (b = new cc.Scale9Sprite(bundles.prolongation_window.frames.goals_bg_png),
b.setContentSize(a.getContentSize()),
b.setPositionRound({
align: "center"
}, {
align: "center"
}),
b.setLocalZOrder(-1),
a.addChild(b));
return a
},
showGiveUpAlert: function(a) {
var b = [];
this.offerView.button && b.push(this.offerView.button.getSceneBoundingBox());
a = new MinimalDialogue({
items: [a, new BreakViews(!0,cleverapps.styles.FONTS.FORCE_MESSAGE_TEXT)],
rects: b
});
this.addChild(a);
a.display();
cleverapps.audio.playSound(bundles.game.urls.giveup_alert_effect)
},
onShow: function() {
this.closed || (Game.currentGame && Game.currentGame.outcome !== GameBase.OUTCOME_UNKNOWN ? this.close() : (this._super(),
this.offerView.onShow(),
this.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.CallFunc(this.addFinger.bind(this))))))
},
onHide: function() {
this.removeFinger();
this.offerView.stopAllActions();
this._super()
},
onClose: function() {
this.removeFinger();
if (this.canGiveUp)
this.onGiveUp()
},
onAcceptOffer: function(a) {
this.skipAlert = !0;
this.canGiveUp = !1;
"match3" === cleverapps.config.type && this.animateAddMoves(a.moves);
this.hint && this.hint.close();
this.onSuccess();
this.close()
},
animateAddMoves: function(a) {
this.collectAnimationFinished || (this.collectAnimationFinished = !0,
a = "runes" === cleverapps.config.name ? new cc.Sprite(bundles.moves.frames.moves_icon) : cleverapps.UI.generateOnlyText(a, cleverapps.styles.FONTS.MOVES_TEXT),
a.setPosition(this.window.width / 2, this.offerView.y),
this.window.addChild(a),
a.runAction(new cc.Sequence(new cc.PlaySound(bundles.main.urls.shop_buy_effect),AnimationsLibrary.animateCollect(a, "moves", {
scale: 1.5
}),new cc.RemoveSelf)))
},
createGoalIcons: function() {
var a = [], b;
for (b in Game.currentGame.goals.elements) {
var c = Game.currentGame.goals.elements[b]
, d = c.getView()
, e = {};
d.actor && (e.skin = d.actor.currSkin,
e.spine = d.actor.currSpine);
d = GoalViewFactory.createView(c, e);
c = new WindowGoalView(c,d);
a.push(c)
}
return a
},
getPreferredBundles: function() {
return ["game"]
}
});
cleverapps.styles.ProlongationWindow = {
margin: 20,
padding: {
bottom: 20
},
goals: {
margin: 30,
padding: {
x: 30,
y: 20
}
},
underline: {
x: {
align: "left",
dx: 0
},
y: {
align: "bottom",
dy: -2
},
height: 3
}
};
var Prolongation = function() {
cleverapps.EventEmitter.call(this);
this.counter = 0;
this.onCompleteOffer = function() {}
};
Prolongation.prototype = Object.create(cleverapps.EventEmitter.prototype);
Prolongation.prototype.constructor = Prolongation;
Prolongation.prototype.getOfferCurrencyPrice = function() {
var a = this.isCustomWhaleFirstStep() ? 250 : Prolongation.PRICES[this.counter];
return cleverapps.config.soft ? Math.floor(a / 2) : a
}
;
Prolongation.prototype.checkEligibleFree = function(a, b) {
return (1.4 > levels.user.getFloatLevel() && !cleverapps.forces.isShown(Forces.FREE_PROLONGATION_FORCE.id) || a === Prolongation.TYPES.SLOT && !cleverapps.forces.isShown(Forces.FREE_EXTRA_SLOT_FORCE.id)) && !b
}
;
Prolongation.prototype.getOffer = function(a, b) {
var c;
a === Prolongation.TYPES.MOVES && (c = Game.currentGame.getProlongationMovies());
if (this.checkEligibleFree(a, b))
return {
type: a,
priceType: "free",
price: 0,
moves: c,
text: "FREE",
force: a === Prolongation.TYPES.SLOT ? Forces.FREE_EXTRA_SLOT_FORCE : Forces.FREE_PROLONGATION_FORCE
};
if (this.isAdAvailable())
return {
type: a,
priceType: "ads",
moves: c,
text: "##"
};
b = this.getOfferCurrencyPrice();
a === Prolongation.TYPES.MOVES && this.isCustomWhaleFirstStep() && (c *= 2);
return {
type: a,
priceType: "currency",
price: b,
moves: c,
text: "$$" + b
}
}
;
Prolongation.prototype.acceptOffer = function(a) {
switch (a.priceType) {
case "free":
this.onAcceptOffer(a);
break;
case "ads":
cleverapps.rewardedAdsManager.playRewarded(AdsLimits.TYPES.PROLONGATION, function() {
this.onAcceptOffer(a);
cleverapps.adsLimits.watch(AdsLimits.TYPES.PROLONGATION)
}
.bind(this), function() {
this.trigger("adsCanceled", a)
}
.bind(this));
break;
case "currency":
levels.user.spendHard.bind(levels.user)(cleverapps.EVENTS.SPENT.CONTINUE, a.price) && (this.onAcceptOffer(a),
this.escalateToUpperLevel(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.HINT_USED, {
value: a.price
}),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.MOVES_BOUGHT + "_" + a.price))
}
}
;
Prolongation.prototype.isAdAvailable = function() {
return cleverapps.adsLimits.state(AdsLimits.TYPES.PROLONGATION) === AdsLimits.STATE_READY && cleverapps.rewardedAdsManager.isRewardedAvailable()
}
;
Prolongation.prototype.isCustomWhaleFirstStep = function() {
return 0 === this.counter && (500 < levels.user.gold || cleverapps.paymentsHistory.classify() === cleverapps.PaymentsHistory.BRACKET_WHALE || cleverapps.paymentsHistory.classify() === cleverapps.PaymentsHistory.BRACKET_BIGWHALE)
}
;
Prolongation.prototype.escalateToUpperLevel = function() {
this.counter++;
this.counter >= Prolongation.PRICES.length && !cleverapps.highscore && (this.counter = Prolongation.PRICES.length - 1)
}
;
Prolongation.prototype.getAlertMessage = function(a) {
if (a === Prolongation.TYPES.OCTOPUS_HUNT)
return a = cleverapps.missionManager.findRunningMission(Mission.TYPE_OCTOPUS_HUNT).logic.octopusHunt,
Messages.get("OctopusHuntProlongationWindow.leftStages", {
stages: a.calcStagesBeforeBonus()
});
var b = Game.currentGame
, c = b.secondaryMission
, d = Lantern.Get()
, e = b.getPercentOfCompletion()
, f = b.rewards[GameBase.REWARD_HARD];
a = void 0;
b.rewards[GameBase.REWARD_BOOSTERS] ? a = Prolongation.GIVE_UP_TYPES.BOOSTER : d && d.isActive(b.level) && 0 < d.getCurrentStreak() ? a = Prolongation.GIVE_UP_TYPES.LANTERN : c && c.isRunning() && 0 < b.rewards.clover ? a = Prolongation.GIVE_UP_TYPES.MISSION : f && 0 < f ? a = Prolongation.GIVE_UP_TYPES.GOLD_COLLECTED : .7 <= e && (a = Prolongation.GIVE_UP_TYPES.NEARLY);
if (void 0 !== a)
return b = [Messages.get("GiveUpAlert.text1")],
a === Prolongation.GIVE_UP_TYPES.NEARLY && b.push(Messages.get("AddMovesWindow.nearlyDoneGiveUp")),
0 < cleverapps.ListBreaks().length && b.push(Messages.get("GiveUpAlert.text2")),
b.join("\n")
}
;
Prolongation.prototype.getText = function(a) {
return a === Prolongation.TYPES.BOMB ? Messages.get("PostponeBombWindow.addMoves", {
moves: BombOnCard.MOVES_TO_ADD
}) : a === Prolongation.TYPES.FLAGS ? Messages.get("RemoveFlagsWindow.text") : a === Prolongation.TYPES.OCTOPUS_HUNT ? Messages.get("OctopusHuntProlongationWindow.Text") : Messages.get("ProlongationWindow.addMoves")
}
;
Prolongation.prototype.hasOffer = function() {
return void 0 !== Prolongation.PRICES[this.counter]
}
;
Prolongation.prototype.onAcceptOffer = function(a) {
this.trigger("acceptOffer", a)
}
;
Prolongation.GIVE_UP_TYPES = {
BOOSTER: 0,
LANTERN: 1,
MISSION: 2,
GOLD_COLLECTED: 3,
NEARLY: 4
};
Prolongation.PRICES = [100, 300, 500, 700, 1E3];
Prolongation.TYPES = {};
Prolongation.TYPES.MOVES = 1;
Prolongation.TYPES.BOMB = 2;
Prolongation.TYPES.FLAGS = 3;
Prolongation.TYPES.SLOT = 4;
Prolongation.TYPES.OCTOPUS_HUNT = 5;
var CircleCountdown = cleverapps.Spine.extend({
ctor: function(a, b) {
this.onComplete = a;
this.withBomb = b.type === Prolongation.TYPES.BOMB;
this._super(this.withBomb ? bundles.prolongation_window.jsons.bomb_timer_json : bundles.prolongation_window.jsons.timer_json);
this.timeScale = 1;
this.currentNum = 10;
this.numberNode = cleverapps.UI.generateImageText("0", this.withBomb ? cleverapps.styles.FONTS.CIRCLE_BOMB_COUNTDOWN_TEXT : cleverapps.styles.FONTS.CIRCLE_COUNTDOWN_TEXT);
this.addChild(this.numberNode);
this.numberNode.setPositionRound(cleverapps.styles.CircleCountdown);
this.isShown = !1
},
show: function() {
this.isShown = !0;
cleverapps.settings.music && (cleverapps.settings.toggleMusic(),
this.toggledMusic = !0);
this.setAnimation(0, "open", !1);
this.withBomb ? this.numberNode.setString(this.currentNum.toString()) : (cleverapps.audio.playSound(bundles.prolongation_window.urls.timer_start),
this.numberNode.runAction(new cc.Sequence(AnimationsLibrary.countTo(this.numberNode, 10, {
duration: .6
}),AnimationsLibrary.pulse(this, {
duration: .6
}))));
this.setCompleteListener(function() {
this.isShown = !0;
this.setAnimation(0, "animation", !1);
this.setStartListener(function() {
this.countDownAction()
}
.bind(this));
this.setCompleteListener(this.onComplete)
}
.bind(this))
},
countDownAction: function() {
this.numberNode.setString(this.currentNum.toString());
cleverapps.audio.playSound(bundles.prolongation_window.urls[0 < this.currentNum ? this.withBomb ? "bomb_timer_tick" : "timer_tick" : this.withBomb ? "bomb_timer_tick_zero" : "timer_tick_zero"]);
this.withBomb || (6 > this.currentNum && 3 < this.currentNum ? this.numberNode.setColor(cleverapps.styles.COLORS.ORANGE) : 3 > this.currentNum && this.numberNode.setColor(cleverapps.styles.COLORS.COLOR_RED));
this.numberNode.runAction(new cc.Sequence((new cc.ScaleTo(.2,1)).easing(cc.easeCubicActionOut()),(new cc.DelayTime(.6)).easing(cc.easeElasticIn(.5)),(new cc.ScaleTo(.3,0)).easing(cc.easeCubicActionIn()),new cc.CallFunc(function() {
this.currentNum--;
0 <= this.currentNum ? this.countDownAction() : this.withBomb && (this.numberNode.removeFromParent(),
cleverapps.audio.playSound(bundles.prolongation_window.urls.bomb_timer_explosion))
}
.bind(this))))
},
pauseAction: function() {
this.numberNode.pause();
this.setTimeScale(0)
},
resumeAction: function() {
this.setTimeScale(this.timeScale);
this.numberNode.resume()
},
cleanup: function() {
this._super();
this.toggledMusic && cleverapps.settings.toggleMusic()
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
CIRCLE_COUNTDOWN_TEXT: {
name: "nostroke",
size: 80,
color: cleverapps.styles.COLORS.COLOR_BROWN_2
},
CIRCLE_BOMB_COUNTDOWN_TEXT: {
name: "nostroke",
size: 80,
color: cleverapps.styles.COLORS.WHITE
}
});
cleverapps.styles.CircleCountdown = {
x: {
align: "center",
dx: 5
},
y: {
align: "center",
dy: -10
}
};
var ProlongationOfferView = cleverapps.Layout.extend({
ctor: function(a, b) {
var c = cleverapps.styles.ProlongationOfferView;
this.prolongation = a;
this.offer = b;
a = [];
this.useProlongationTimer = this.needTimer();
var d = this.offer.moves;
this.useProlongationTimer && (this.timer = new CircleCountdown(this.prolongation.onCompleteOffer,this.offer),
a.push(this.timer));
if (d || b.magic)
this.label = this.createLabel(),
a.push(this.label);
d && b.bonus && this.createBonusLabel();
b.lottery && Lottery.addIcon(this);
b.rewards && a.push(this.createRewards(b.rewards));
b = cleverapps.UI.generateTTFText(this.prolongation.getText(b.type), cleverapps.styles.FONTS.WINDOW_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(c.question.width, 0);
b.fitTo(void 0, c.question.height);
a.push(b);
this.button = this.createButton();
a.push(this.button);
this._super(a, {
direction: cleverapps.UI.VERTICAL,
margin: c.margin
})
},
createButton: function() {
var a = cleverapps.styles.ProlongationOfferView.button;
return new cleverapps.UI.Button({
type: this.offer.magic && cleverapps.styles.UI.Button.Images.button_blue,
content: new TextWithIcon(this.getButtonText()),
width: a.width,
height: a.height,
onClicked: this.onClick.bind(this)
})
},
updateOffer: function(a) {
this.offer = a;
this.button.setString(this.getButtonText());
this.useProlongationTimer && this.timer && this.timer.resumeAction()
},
getButtonText: function() {
return "free" === this.offer.priceType ? this.offer.text : Messages.get("PlayOn") + " " + this.offer.text
},
createLabel: function() {
var a = cleverapps.styles.ProlongationOfferView;
if (bundles.prolongation_window.jsons.label_moves_json) {
var b = this.label = new cleverapps.Spine(bundles.prolongation_window.jsons.label_moves_json);
b.setAnimationAndIdleAfter("open", "idle")
} else if (b = this.label = new cc.Sprite(bundles.prolongation_window.frames.label_moves_png),
!this.offer.magic) {
var c = cleverapps.UI.generateImageText("+" + this.offer.moves, cleverapps.styles.FONTS.PROLONG_BUTTON_AMOUNT_TEXT);
b.addChild(c);
c.setPositionRound(a.label.amount)
}
return b
},
createBonusLabel: function() {
var a = cleverapps.styles.ProlongationOfferView
, b = new cleverapps.Spine(bundles.prolongation_window.jsons.bonus_json);
this.label.addChild(b);
b.setLocalZOrder(-1);
b.setPositionRound(a.bonusLabel);
b.runAction(new cc.Sequence(new cc.DelayTime(1),new cc.CallFunc(function() {
b.setAnimationAndIdleAfter("showUp", "idle")
}
)))
},
calcRewardsColumns: function(a) {
var b = Object.keys(a).length;
a.boosters && (b = b - 1 + Object.keys(a.boosters).length);
return 3 >= b ? b : b / 2 + b % 2
},
createRewards: function(a) {
var b = cleverapps.styles.ProlongationOfferView.rewards
, c = new cc.Scale9Sprite(bundles.prolongation_window.frames.foreground_png);
c.setContentSize2(b.fg);
a = new RewardsListComponent(a,{
columns: this.calcRewardsColumns(a),
font: cleverapps.styles.FONTS.PROLONG_REWARDS_TEXT,
iconWrap: b.rewards.iconWrap
});
c.addChild(a);
a.setPositionRound(b.rewards);
return c
},
onShow: function() {
this.setVisible(!1);
this.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.ScaleTo(0,.5),new cc.Show,new cc.CallFunc(function() {
this.useProlongationTimer && (this.timer.isShown ? this.timer.resumeAction() : this.timer.show(),
this.button.runAction(new cc.RepeatForever(new cc.Sequence((new cc.ScaleTo(.5,1.1)).easing(cc.easeOut(2)),(new cc.ScaleTo(.5,1)).easing(cc.easeIn(2))))))
}
.bind(this)),(new cc.ScaleTo(.3,1)).easing(cc.easeBackOut()),new cc.CallFunc(this.showForce.bind(this))))
},
showForce: function() {
this.offer.force && cleverapps.forces.create(this.button, this.offer.force, {
importantNodes: [this.button],
highlights: [cleverapps.windows.currentWindow()],
actives: [this]
})
},
onClick: function() {
this.useProlongationTimer && this.timer && this.timer.pauseAction();
this.prolongation.acceptOffer(this.offer);
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce()
},
needTimer: function() {
return Game.currentGame && -1 !== ["solitaire", "tile3", "blocks"].indexOf(cleverapps.config.type) ? cleverapps.forces.isShown(Forces.FREE_PROLONGATION_FORCE.id) || 1.4 <= levels.user.getFloatLevel() : !1
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PROLONG_BUTTON_AMOUNT_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
PROLONG_REWARDS_TEXT: {
size: 50,
name: "nostroke",
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.ProlongationOfferView = {
margin: 20,
button: {
width: 350,
height: 90
},
label: {
amount: {
x: {
align: "center",
dx: -3
},
y: {
align: "center",
dy: -3
}
}
},
bonusLabel: {
x: {
align: "center",
dx: 125
},
y: {
align: "center",
dy: 73
}
},
question: {
width: 730,
height: 200,
x: {
align: "center"
},
y: {
align: "center",
dy: 125
}
},
rewards: {
fg: {
width: 860,
height: 610
},
rewards: {
x: {
align: "center"
},
y: {
align: "center"
},
iconWrap: {
width: 170,
height: 170
}
}
}
};
cleverapps.ListBreaks = function() {
if (!Game.currentGame)
return [];
var a = Lantern.Get()
, b = [bundles.game.frames.cellbooster_small_png, bundles.game.frames.linebooster_small_png, bundles.game.frames.colorbooster_small_png]
, c = Game.currentGame.secondaryMission;
return [{
text: "AddMovesWindow.booster",
amount: 1,
isActive: Game.currentGame.rewards.boosters,
icon: Game.currentGame.rewards.boosters && b[Object.keys(Game.currentGame.rewards.boosters)[0]]
}, {
text: "AddMovesWindow.mission." + (c && c.getName()),
amount: Game.currentGame.rewards.clover,
isActive: c && c.isRunning() && 0 < Game.currentGame.rewards.clover,
icon: c && c.getIcon()
}, {
text: "AddMovesWindow.lantern",
amount: a && a.isActive(Game.currentGame.level) && a.getCurrentStreak(),
isActive: a && a.isActive(Game.currentGame.level) && 0 < a.getCurrentStreak(),
icon: bundles.game.frames.lantern_streak_icon
}, {
text: "AddMovesWindow.collectedGold",
amount: Game.currentGame.rewards[GameBase.REWARD_HARD],
isActive: !["board"].includes(cleverapps.config.type) && Game.currentGame.rewards[GameBase.REWARD_HARD] && 0 < Game.currentGame.rewards[GameBase.REWARD_HARD],
icon: bundles.game.frames.collected_gold_png
}].filter(function(d) {
return d.isActive
})
}
;
var BreakView = cleverapps.Layout.extend({
ctor: function(a, b, c) {
this.data = a;
var d = cleverapps.styles.BreakView;
if (!b)
var e = cleverapps.UI.generateOnlyText(a.text, c || cleverapps.styles.FONTS.WINDOW_SMALL_TEXT);
a = this.createAmount(c);
this._super(b ? [a] : [e, a], {
margin: d.margin,
direction: cleverapps.UI.HORIZONTAL
})
},
getPreferredBundles: function() {
return ["game"]
},
createAmount: function(a) {
return new TextWithIcon("!!x" + this.data.amount,{
font: a || cleverapps.styles.FONTS.BREAK_AMOUNT_TEXT,
icons: {
"!!": this.data.icon
}
})
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
BREAK_AMOUNT_TEXT: {
name: "nostroke",
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
}
});
cleverapps.styles.BreakView = {
margin: 10
};
var BreakViews = cleverapps.Layout.extend({
ctor: function(a, b) {
var c = cleverapps.styles.BreakViews
, d = cleverapps.ListBreaks().map(function(e) {
return new BreakView(e,a,b)
});
this._super(d, {
margin: a ? c.small.margin : c.margin,
direction: a ? cleverapps.UI.HORIZONTAL : cleverapps.UI.VERTICAL
})
}
});
cleverapps.styles.BreakViews = {
margin: 10,
small: {
margin: 20
}
};
Meta = function() {
cleverapps.EventEmitter.call(this);
this.locations = {};
this.type = this.calcType();
this.allLocationsIds = this.calcAllLocationsIds();
cleverapps.isKnockoutGame() && (this.knockoutGame = new KnockoutGame);
this.load();
cleverapps.playSession.set(cleverapps.EVENTS.META_LOCATION, this.currentLocationId)
}
;
Meta.prototype = Object.create(cleverapps.EventEmitter.prototype);
Meta.prototype.constructor = Meta;
Meta.prototype.calcType = function() {
return "playable" === connector.info.source ? Meta.NONE : cleverapps.config.meta
}
;
Meta.prototype.calcAllLocationsIds = function() {
return this.getLocationClass().listLocationsIds()
}
;
Meta.prototype.calcActiveLocationsIds = function() {
return this.getLocationClass().listActiveLocationsIds(this.currentLocationId)
}
;
Meta.prototype.updateLocations = function() {
this.activeLocationsIds = this.calcActiveLocationsIds();
this.activeLocationsIds.forEach(function(a) {
var b = this.getLocationClass();
this.locations[a] || (this.locations[a] = new b(a))
}
.bind(this));
Object.keys(this.locations).forEach(function(a) {
this.activeLocationsIds.includes(Number(a)) || delete this.locations[a]
}
.bind(this));
this.switchLocation(this.currentLocationId)
}
;
Meta.prototype.switchLocation = function(a) {
-1 === this.activeLocationsIds.indexOf(a) && (a = this.getLastLocationId());
this.selectedLocationId = a
}
;
Meta.prototype.getType = function() {
return this.type
}
;
Meta.prototype.load = function() {
var a = cleverapps.dataLoader.load(DataLoader.TYPES.META);
a = this.migrateData(a);
this.updateData(a);
this.needSave && this.save()
}
;
Meta.prototype.migrateData = function(a) {
var b = this.getType();
b === Meta.FARM ? a = cleverapps.dataLoader.load(DataLoader.TYPES.FARM) : b === Meta.HOMEFIX ? a || (a = cleverapps.dataLoader.load(DataLoader.TYPES.HOMEFIX) || {}) : b === Meta.SHORTMETA ? a = cleverapps.dataLoader.load(DataLoader.TYPES.SHORTMETA) || cleverapps.dataLoader.load(DataLoader.TYPES.KNOCKOUT) : b === Meta.SIMPLE ? 0 > Version.compare(cleverapps.user.lastVersion, Meta.SIMPLE_MIGRATE_VERSION) && (a = cleverapps.dataLoader.load(DataLoader.TYPES.SIMPLE),
this.needSave = !0) : b === Meta.HOSE && (a = cleverapps.dataLoader.load(DataLoader.TYPES.HOSE));
return a
}
;
Meta.prototype.updateData = function(a) {
a = a || {};
cleverapps.config.rpg && !a && 0 < levels.user.episode && (a = {
stars: 0,
current: levels.user.episode
});
this.currentLocationId = a.current || 0;
this.stars = a.stars || 0;
this.knockoutGame && (a = void 0 !== a.knockoutLevel ? a.knockoutLevel : void 0 !== a.cups ? a.cups : cleverapps.user.getVirtualProgress(),
this.knockoutGame.setLevel(a))
}
;
Meta.prototype.updateInfo = function(a) {
this.locations = {};
this.updateData(a);
this.updateLocations();
this.save(!0);
cleverapps.highscore && (cleverapps.highscore.updateInfo(a),
cleverapps.highscore.save(!0))
}
;
Meta.prototype.getData = function() {
var a = {
current: this.currentLocationId,
stars: this.stars
};
this.knockoutGame && (a.knockoutLevel = this.knockoutGame.getLevel());
return a
}
;
Meta.prototype.getInfo = function() {
var a = this.getData();
cleverapps.highscore && Object.assign(a, cleverapps.highscore.getInfo());
return a
}
;
Meta.prototype.save = function(a) {
cleverapps.dataLoader.save(DataLoader.TYPES.META, this.getData());
a || cleverapps.synchronizer.addUpdateTask("metha")
}
;
Meta.prototype.loadLocation = function(a) {
return cleverapps.dataLoader.load(DataLoader.TYPES.LOCATION + a) || {}
}
;
Meta.prototype.saveLocation = function(a, b) {
b = a.getSlotId();
cleverapps.dataLoader.save(DataLoader.TYPES.LOCATION + b, a.getInfo())
}
;
Meta.prototype.listAllLocationIds = function() {
return this.allLocationsIds
}
;
Meta.prototype.getMainObject = function() {
return this.locations[this.selectedLocationId]
}
;
Meta.prototype.gamePlayed = function(a, b) {
a === GameBase.OUTCOME_VICTORY && (cleverapps.eventLogger.logEvent(cleverapps.EVENTS.METHA_LEVEL),
cleverapps.playSession.set(cleverapps.EVENTS.METHA_LEVEL, !0));
this.getMainObject().gamePlayed(a, b)
}
;
Meta.prototype.resetStars = function() {
this.stars = 0;
this.save()
}
;
Meta.prototype.changeStars = function(a, b) {
this.stars += a;
this.save();
if (!b)
this.onChangeStars(a)
}
;
Meta.prototype.onChangeStars = function(a) {
this.trigger("changeStars", a)
}
;
Meta.prototype.getNextLocationId = function() {
return this.currentLocationId + 1
}
;
Meta.prototype.isCompleted = function() {
return this.currentLocationId > this.getLastLocationId()
}
;
Meta.prototype.getLastLocationId = function() {
return this.allLocationsIds.length - 1
}
;
Meta.prototype.moveNextLocation = function(a) {
this.currentLocationId++;
this.save();
this.isCompleted() ? (new AllDoneWindow,
cleverapps.focusManager.onceNoWindowsListener = a) : (this.updateLocations(),
this.getMainObject().load({}),
this.getMainObject().save(),
this.getMainObject().onOpen(a))
}
;
Meta.prototype.afterMoveNext = function(a) {
this.trigger("afterMoveNext", a)
}
;
Meta.prototype.getRumble = function() {
return this.knockoutGame && this.knockoutGame.rumble
}
;
Meta.prototype.stopRumble = function() {
return this.knockoutGame.stopRumble()
}
;
Meta.prototype.wantsToPlay = function(a, b) {
if (cleverapps.lives && cleverapps.lives.isEmpty())
cleverapps.unlimitedLives && cleverapps.unlimitedLives.freeOfferIsAvailable() ? cleverapps.unlimitedLives.showFreeOffer(a) : (new LivesShopWindow,
cleverapps.focusManager.onceNoWindowsListener = a);
else {
var c = this.getMainObject();
this.getType() === Meta.FARM ? (b = b && b.building && b.building.canStillProvideQuestItems() ? b.building : c.findBuildingForActiveItem() || cleverapps.Random.mathChoose(c.listAvailableProvidesBuildings()),
b = MethaHelper.getCurrentLevel(b)) : b = b || MethaHelper.getCurrentLevel();
this.getType() === Meta.HOSE && (cleverapps.Plot.isPassedAllEpisodes = levels.user.isPassedAll());
this.knockoutGame ? this.knockoutGame.wantsToPlay(a, b) : MethaHelper.start(a, b)
}
}
;
Meta.prototype.wantsToReplay = function(a, b) {
MethaHelper.start(a, b)
}
;
Meta.prototype.reset = function() {
this.stars = this.currentLocationId = 0;
this.updateLocations();
this.knockoutGame && this.knockoutGame.reset();
this.save()
}
;
Meta.prototype.getLocationClass = function() {
if ("playable" === connector.info.source)
return PlayableAdsScene;
switch (this.getType()) {
case Meta.FARM:
return Farm;
case Meta.HOMEFIX:
return Home;
case Meta.FISHDOM:
return Fishdom;
case Meta.SHORTMETA:
return ShortMeta;
case Meta.SIMPLE:
return Simple;
case Meta.NONE:
return NoMetha;
default:
return Hose
}
}
;
Meta.prototype.getMainScene = function() {
if ("playable" === connector.info.source)
return PlayableAdsScene;
switch (this.getType()) {
case Meta.FARM:
return FarmScene;
case Meta.HOMEFIX:
return HomefixScene;
case Meta.FISHDOM:
return FishdomScene;
case Meta.SHORTMETA:
return ShortMetaScene;
case Meta.SIMPLE:
return SimpleMainScene;
case Meta.NONE:
return GameScene;
default:
return HoseScene
}
}
;
Meta.HOSE = "hose";
Meta.FARM = "farm";
Meta.HOMEFIX = "homefix";
Meta.SHORTMETA = "shortmeta";
Meta.SIMPLE = "simple";
Meta.NONE = "none";
Meta.FISHDOM = "fishdom";
Meta.SIMPLE_MIGRATE_VERSION = "1.408.1";
Meta.SLOT_MAIN = "";
Meta.SLOTS = [Meta.SLOT_MAIN];
"merge" === cleverapps.config.type && (Meta.EXPEDITION_SLOT1 = "1",
Meta.EXPEDITION_SLOT2 = "2",
Meta.EXPEDITION_SLOT3 = "3",
Meta.EXPEDITION_SLOT4 = "4",
Meta.SLOTS = [Meta.SLOT_MAIN, Meta.EXPEDITION_SLOT1, Meta.EXPEDITION_SLOT2, Meta.EXPEDITION_SLOT3, Meta.EXPEDITION_SLOT4]);
"homefix" === cleverapps.config.meta && (Meta.LOCATION_SLOT0 = "0",
Meta.LOCATION_SLOT1 = "1",
Meta.LOCATION_SLOT2 = "2",
Meta.SLOTS = [Meta.SLOT_MAIN, Meta.LOCATION_SLOT0, Meta.LOCATION_SLOT1, Meta.LOCATION_SLOT2]);
cleverapps.config.debugMode && (Meta.SIMPLE_MIGRATE_VERSION = "1.405.33");
var SimpleMainScene = MainScene.extend({
ctor: function(a) {
this._super(a);
cleverapps.config.rpg && (a = cleverapps.meta.selectedLocationId,
this.pagingScroll = new PagingScroll(cleverapps.meta.listAllLocationIds().length),
this.pagingScroll.scrollToLevel(0, a))
},
onSceneLoaded: function() {
this._super();
if (cleverapps.config.rpg) {
var a = new PagingScrollView(this.pagingScroll);
a.setLocalZOrder(-1);
this.addChild(a)
} else
this.progress = this.addProgress();
a = new PlayButtonView;
this.addChild(a, 1);
cleverapps.focusManager.registerControl("play_button", new HidingNode(a,cleverapps.UI.VERTICAL));
a.addFinger();
cleverapps.highscore && (a = new ScoreModeButton,
this.addChild(a, 1),
cleverapps.focusManager.registerControl("score_mode_button", new HidingNode(a,cleverapps.UI.VERTICAL)))
},
getBackgroundStyles: function() {
var a = cleverapps.meta.getMainObject().getBackgroundBundle(cleverapps.meta.selectedLocationId);
if (a)
return {
bundle: a,
backgroundId: "background"
}
},
listBundles: function() {
var a = [];
this.pagingScroll ? (this.pagingScroll.listVisiblePages().forEach(function(b) {
b.isComingSoon() && a.push("episode_coming_soon")
}),
a.push("episodes_resources")) : a = a.concat(cleverapps.meta.getMainObject().getBundles());
return a
},
addProgress: function() {
var a = new ProgressView;
this.addChild(a);
a = new HidingNode(a,HidingNode.DIR.NONE);
cleverapps.focusManager.registerControl("progress_view", a);
return a
},
completeCurrentPage: function(a) {
var b = cleverapps.meta.selectedLocationId;
cleverapps.focusManager.compound(a, [function(c) {
this.pagingScroll.gotoNextPage(c, b)
}
.bind(this), function(c) {
setTimeout(c, 300)
}
, function(c) {
new FinishEpisodeWindow(b);
cleverapps.focusManager.onceNoWindowsListener = c
}
, function(c) {
var d = 0;
"runes" === cleverapps.config.name && (this.createFilmEffect({
scale: 1.2,
layerTimeout: .3
}),
d = 2E3);
cleverapps.timeouts.setTimeout(c, d)
}
.bind(this), function(c) {
this.pagingScroll.animateClose(c, b)
}
.bind(this)])
},
startNextPage: function(a) {
var b = cleverapps.meta.selectedLocationId;
cleverapps.focusManager.compound(a, [function(c) {
this.pagingScroll.gotoNextPage(c, b)
}
.bind(this), function(c) {
this.pagingScroll.animateOpen(c, b)
}
.bind(this), function(c) {
this.removeFilmEffect(.6, c)
}
.bind(this)])
},
moveNextBg: function(a) {
cleverapps.focusManager.removeControl("progress_view");
this.progress.removeFromParent();
this.progress = this.addProgress();
this.changeBg(a)
},
changeBg: function(a) {
if (this.background) {
var b = this.background;
b.setLocalZOrder(-7);
this.backgroundStyles = this.getBackgroundStyles();
this.setBackground();
b.runAction(new cc.Sequence(new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.simple.urls.simple_transition_effect)
}
),new cc.FadeOut(1),new cc.RemoveSelf,new cc.CallFunc(a)))
} else
a()
}
});
var Simple = function(a) {
BaseLocation.call(this, a);
this.pendingsStars = 0;
cleverapps.meta.on("changeStars", this.onChangeStars.bind(this), this)
};
Simple.prototype = Object.create(BaseLocation.prototype);
Simple.prototype.constructor = Simple;
Simple.prototype.onChangeStars = function(a) {
0 < a && (this.pendingsStars += a);
cleverapps.meta.stars >= this.getRequiredStars() && cleverapps.meta.currentLocationId < cleverapps.meta.getLastLocationId() && this.complete()
}
;
Simple.prototype.getBundles = function() {
return [this.getBackgroundBundle(this.locationId), this.getIconBundle(this.locationId), this.getIconBundle(this.locationId + 1), this.getPostMoveActionBundle()].filter(Boolean)
}
;
Simple.prototype.getIconBundle = function(a) {
return a >= cleverapps.meta.listAllLocationIds().length || cleverapps.config.rpg ? "simple_background_icon_coming_soon" : "simple_background_icon_" + a
}
;
Simple.prototype.getBackgroundBundle = function(a) {
if (!cleverapps.config.rpg)
return ["simple_background_" + a, (cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? "simple_background_vertical_" : "simple_background_horizontal_") + a, "simple_background_" + cleverapps.config.orientation + "_" + a].find(function(b) {
return bundles[b]
})
}
;
Simple.prototype.getPostMoveActionBundle = function() {
if ("tile3" === cleverapps.config.type && TileGenerator.getNewSkins().length)
return "tiles_unlock_window"
}
;
Simple.prototype.onComplete = function(a) {
cleverapps.focusManager.compound(a, [function(b) {
0 < this.pendingsStars ? this.updateProgress(b) : b()
}
.bind(this), function(b) {
this.isForceAvailable() ? this.showForce(b) : cleverapps.config.rpg ? cleverapps.scenes.getRunningScene().completeCurrentPage(b) : b()
}
.bind(this)])
}
;
Simple.prototype.onOpen = function(a) {
var b = cleverapps.scenes.getRunningScene();
cleverapps.focusManager.compound(a, [function(c) {
cleverapps.meta.resetStars();
var d = this.getBundles();
d && cleverapps.bundleLoader.loadBundles(d);
connector.social.markAchievement({});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.SIMPLE_METHA_LEVELUP);
c()
}
.bind(this), function(c) {
cleverapps.config.rpg ? b.startNextPage(c) : (new BackgroundsWindow({
moveNext: !0
}),
cleverapps.focusManager.onceNoWindowsListener = c)
}
, function(c) {
cleverapps.config.rpg ? c() : b.moveNextBg(c)
}
, function(c) {
cleverapps.meta.afterMoveNext(c)
}
])
}
;
Simple.prototype.updateProgress = function(a) {
this.trigger("updateProgress", this.pendingsStars, a);
this.pendingsStars = 0
}
;
Simple.prototype.amountLevelStars = function(a) {
return a.isHard() ? 3 : a.isTricky() ? 2 : 1
}
;
Simple.prototype.getRequiredStars = function() {
var a = cleverapps.meta.currentLocationId
, b = [5, 10, 20, 30, 30, 40, 40, 40, 40, 40].concat([50, 50, 50, 50, 50, 70, 70, 70, 70, 70]).concat([100, 100, 100, 100, 100, 125, 125, 125, 125, 125]).concat([150, 150, 150, 150, 150, 175, 175, 175, 175, 175]).concat([200, 200, 200, 200, 200, 225, 225, 225, 225, 225]);
cleverapps.config.rpg && (b = [5, 10, 15, 20, 25]);
return a < b.length ? b[a] : b[b.length - 1]
}
;
Simple.prototype.isForceAvailable = function() {
return 0 === cleverapps.user.episode && !cleverapps.forces.isShown(Forces.SIMPLE.id) && "match3" !== cleverapps.config.type
}
;
Simple.prototype.showForce = function(a) {
this.trigger("showForce");
cleverapps.forces.onceForceClosed = a
}
;
Simple.prototype.calcReward = function(a) {
var b = cleverapps.config.soft ? {
soft: 50
} : {
hard: 50
};
b.boosters = {};
var c = 0
, d = cleverapps.boosters.listBoostersBefore();
"differences" === cleverapps.config.name && (d = cleverapps.boosters.listBoosters());
d.forEach(function(f) {
3 > c && f.isAvailable() && (b.boosters[f.id] = 1,
c++)
});
if (a) {
a = [];
for (var e in b)
d = b[e],
"boosters" === e ? a = a.concat(Object.keys(d).map(function(f) {
return {
type: "boosters",
value: {
id: f,
amount: b.boosters[f]
}
}
})) : a.push({
type: e,
value: d
});
return a
}
return b
}
;
Simple.prototype.processChatMessage = function(a) {
a.metha.simple && (cleverapps.meta.currentLocationId = a.metha.simple.current,
cleverapps.meta.resetStars())
}
;
Simple.listLocationsIds = function() {
for (var a = [], b = 0; cleverapps.config.rpg ? bundles["episode_" + b] : bundles["simple_background_" + b] || bundles["simple_background_horizontal_" + b] || bundles["simple_background_vertical_" + b]; )
a.push(b),
b++;
return a
}
;
Simple.listActiveLocationsIds = BaseLocation.listActiveLocationsIds;
var StarsProgressBar = cc.Node.extend({
ctor: function(a) {
this._super();
this.options = a;
this.stars = void 0 !== this.options.stars ? this.options.stars : cleverapps.meta.stars;
a = cleverapps.styles.StarsProgressBar;
this.setAnchorPoint(.5, .5);
this.setContentSize2(this.options.width, a.bar.height);
this.addProgressBar();
this.options.withPresent && this.addPresent();
cleverapps.meta.on("changeStars", function() {
this.setStars(0 < cleverapps.meta.getMainObject().pendingsStars ? cleverapps.meta.stars - cleverapps.meta.getMainObject().pendingsStars : cleverapps.meta.stars)
}
.bind(this));
this.setStars(this.stars)
},
addProgressBar: function() {
var a = cleverapps.styles.StarsProgressBar.bar
, b = this.bar = new ScaledProgressBar({
background: bundles.progress_bar.frames.bg_simple,
progress: bundles.progress_bar.frames.bar_simple,
barText: {
font: cleverapps.styles.FONTS.STARS_PROGRESS_BAR_TEXT,
text: "[[%from%/%to%",
icons: {
"[[": bundles.simple.frames.star_png
},
dy: a.dy
}
});
b.setLength(this.options.width + 2 * a.offsetX);
b.setPercentage(0);
b.setPositionRound(this.width / 2, this.height / 2);
this.addChild(this.bar);
b.background.setLocalZOrder(-10)
},
addPresent: function() {
var a = cleverapps.styles.StarsProgressBar;
this.present = new cleverapps.Spine(bundles.simple.jsons.present_json);
this.addChild(this.present);
this.present.setScale(a.present.scale);
this.present.setSkin(a.present.skin);
this.present.setAnimation(0, a.present.animation, !0);
this.present.setPositionRound(a.present);
this.present.setLocalZOrder(10);
cleverapps.tooltipManager.create(this.present, {
text: "OpenBackgroundTooltip",
rewards: cleverapps.meta.getMainObject().calcReward(),
location: cleverapps.UI.Tooltip.LOCATION_BELOW,
size: cleverapps.styles.UI.Tooltip.SIZE.medium
})
},
setStars: function(a) {
this.stars = a;
this.bar.setGoal(cleverapps.meta.getMainObject().getRequiredStars());
this.bar.setPercentage(a)
},
updateProgress: function(a) {
this.stars += a;
this.bar.setGoal(cleverapps.meta.getMainObject().getRequiredStars());
this.bar.setPercentage(this.stars, {
animated: !0
})
},
receivePrize: function() {
cleverapps.meta.getMainObject().calcReward(!0).forEach(function(a) {
a = new Reward(a.type,a.value,{
event: cleverapps.EVENTS.EARN.LEVEL_REWARD
});
a.receiveReward();
a.collectRewardsAnimation(this.present, {
flyingAnimation: Reward.JUMP_COLLECT_ANIMATION
})
}
.bind(this))
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
STARS_PROGRESS_BAR_TEXT: {
name: "default",
size: 40
}
});
cleverapps.styles.StarsProgressBar = {
bar: {
offsetX: 15,
height: 80,
dy: 4
},
present: {
scale: .7,
x: {
align: "right",
dx: 90
},
y: {
align: "center",
dy: 5
},
skin: "green",
animation: "animation"
}
};
var ProgressView = cc.Node.extend({
ctor: function() {
this._super();
this.setAnchorPoint(.5, .5);
this.hoverContainer = new cc.Node;
this.hoverContainer.setAnchorPoint(.5, .5);
this.addChild(this.hoverContainer);
this.addProgressBar();
this.addArrows();
this.addIcons();
cleverapps.UI.wrap(this.hoverContainer);
this.setContentSize2(this.hoverContainer.getContentSize());
this.hoverContainer.setPositionRound(this.width / 2, this.height / 2);
cleverapps.UI.onClick(this.hoverContainer, this.onClick.bind(this));
this.setPositionRound(cleverapps.styles.ProgressView.positions || cleverapps.styles.ProgressView);
this.setCascadeOpacityEnabledRecursively(!0);
cleverapps.aims.registerTarget("metaStar", this, {
controls: ["progress_view", "play_button"],
withoutDelta: !0,
noTargetDelta: !0,
flyingUnderShadow: !0,
flyingAnimation: Reward.NO_ANIMATION
});
cleverapps.meta.getMainObject().on("updateProgress", this.updateProgress.bind(this), this);
cleverapps.meta.getMainObject().on("showForce", this.showForce.bind(this), this);
SceneDecors.add(this.hoverContainer, cleverapps.skins.getSlot("progressViewDecor"))
},
onClick: function() {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
cleverapps.audio.playSound(bundles.main.urls.click_effect);
cleverapps.config.rpg || cleverapps.focusManager.display({
focus: "BackgroundsWindow",
action: function(a) {
new BackgroundsWindow;
cleverapps.focusManager.onceNoWindowsListener = a
}
})
},
showForce: function() {
cleverapps.forces.create(this.hoverContainer, Forces.SIMPLE)
},
runProgressAnimation: function() {
var a = cleverapps.styles.ProgressView
, b = new cleverapps.Spine(bundles.simple.jsons.progress_bar_spark_json);
this.hoverContainer.addChild(b);
b.setPositionRound(a.bar.spark);
b.runAction(new cc.Sequence(new cc.DelayTime(.4),new cc.CallFunc(function() {
b.setAnimation(0, "animation", !1);
b.setCompleteListenerRemove()
}
)))
},
runAvatarAnimation: function() {
if (!cleverapps.config.rpg) {
var a = new cleverapps.Spine(bundles.simple.jsons.avatar_spark_json);
this.hoverContainer.addChild(a);
a.setPositionRound(this.nextIcon.getPosition());
a.setCompleteListenerRemove();
a.runAction(new cc.Sequence(new cc.DelayTime(.7),new cc.CallFunc(function() {
a.setAnimation(0, "animation", !1);
cleverapps.audio.playSound(bundles.simple.urls.simple_win_effect)
}
)))
}
},
runStarAnimation: function(a, b, c, d) {
var e = cleverapps.styles.ProgressView
, f = cleverapps.scenes.getRunningScene()
, g = this.progressBar.bar.barText.items[0];
g = f.convertToNodeSpace(g.getParent().convertToWorldSpace(g.getPosition()));
g.x += e.star.x;
g.y += e.star.y;
var h = new cleverapps.Spine(bundles.simple.jsons.star_json);
f.addChild(h);
h.setPositionRound(g.x, f.height / 2);
h.setLocalZOrder(10);
h.setTimeScale(b);
h.runAction(new cc.Sequence(new cc.DelayTime(a),new cc.CallFunc(function() {
h.setAnimation(0, "collect", !1);
h.setCompleteListenerRemove()
}
),(new cc.MoveTo(c,g)).easing(cc.easeIn(2)),new cc.PlaySound(bundles.simple.urls.star_collect_effect),new cc.CallFunc(function() {
this.progressBar.updateProgress(1);
d()
}
.bind(this))))
},
updateProgress: function(a, b) {
var c = cleverapps.styles.ProgressView
, d = ["progress_view"];
cleverapps.meta.getMainObject().checkCompleted() || d.push("play_button");
cleverapps.focusManager.showControlsWhileFocused(d);
d = cleverapps.wait(a, function() {
!cleverapps.meta.isCompleted() && cleverapps.meta.getMainObject().checkCompleted() && (this.runProgressAnimation(),
this.runAvatarAnimation());
var k = AnimationsLibrary.animateDelta(a, {
target: this.progressBar,
x: c.delta.x,
y: c.delta.y,
font: cleverapps.styles.FONTS.SCENE_ANIMATE_DELTA_TEXT
});
b && (k = new cc.Spawn(k,new cc.Sequence(new cc.DelayTime(1.2),new cc.CallFunc(b))));
this.runAction(k)
}
.bind(this));
var e = .4;
5 < .4 * a && (e = 5 / a);
for (var f = .4 / e, g = e / .4, h = 0; h < a; h++)
this.runStarAnimation(h * e, f, g, d)
},
addProgressBar: function() {
this.progressBar = new StarsProgressBar({
width: cleverapps.styles.ProgressView.bar.width,
stars: 0 < cleverapps.meta.getMainObject().pendingsStars ? cleverapps.meta.stars - cleverapps.meta.getMainObject().pendingsStars : void 0
});
this.hoverContainer.addChild(this.progressBar)
},
addArrows: function() {
var a = cleverapps.styles.ProgressView.arrows;
if (a) {
var b = (new cc.Sprite(bundles.simple.frames.arrow_png)).width;
b = (this.progressBar.width - a.widthOffset) / (b + a.margin);
for (var c = [], d = 0; d < b; d++)
c.push(new cc.Sprite(bundles.simple.frames.arrow_png));
b = new cleverapps.Layout(c,{
direction: cleverapps.UI.HORIZONTAL,
margin: a.margin
});
b.setLocalZOrder(-1);
this.progressBar.bar.addChild(b);
b.setPositionRound(a)
}
},
addIcons: function() {
if (!cleverapps.config.rpg) {
var a = cleverapps.styles.ProgressView
, b = this.currentIcon = this.createIcon();
this.hoverContainer.addChild(b);
b.setPositionRound(-a.bar.width / 2 - a.icon.offset.x, this.height / 2 + a.icon.offset.y);
b.setRotation(-a.icon.rotation || 0);
b = this.nextIcon = this.createIcon(!0);
b.setRotation(a.icon.rotation || 0);
this.hoverContainer.addChild(b);
b.setPositionRound(a.bar.width / 2 + a.icon.offset.x, this.height / 2 + a.icon.offset.y);
cleverapps.meta.selectedLocationId === cleverapps.meta.getLastLocationId() && b.addChild(this.createLock())
}
},
createIcon: function(a) {
var b = a ? new cc.Sprite(bundles[cleverapps.meta.getMainObject().getIconBundle(cleverapps.meta.selectedLocationId + 1)].urls.icon) : new cc.Sprite(bundles[cleverapps.meta.getMainObject().getIconBundle(cleverapps.meta.selectedLocationId)].urls.icon);
a = this.createIconBg(b, a);
var c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(a.getContentSize());
c.addChild(b);
c.addChild(a);
c.setLocalZOrder(10);
b.setPositionRound(c.width / 2, c.height / 2);
return c
},
createLock: function() {
var a = cleverapps.styles.ProgressView
, b = new cc.Sprite(bundles.simple.frames.lock_png);
b.setLocalZOrder(10);
b.setScale(a.comingSoon.lock.scale);
b.setPositionRound(a.comingSoon.lock);
return b
},
createIconBg: function(a, b) {
var c = cleverapps.styles.ProgressView.icon.bg
, d = new cc.Scale9Sprite(b ? bundles.simple.frames.frame_next_png || bundles.simple.frames.frame_silver_png : bundles.simple.frames.frame_current_png || bundles.simple.frames.frame_gold_png);
c.flipped ? (c = c.flipped,
b && d.setScaleX(-1),
d.setPositionRound(b ? c.right : c.left)) : (d.setContentSize2(a.width * a.scaleX + 2 * c.padding.x, a.height * a.scaleY + 2 * c.padding.y),
d.setPositionRound(c));
return d
},
showAnimation: function(a) {
this.setVisible(!0);
a ? (this.hoverContainer.setScale(1),
this.hoverContainer.setOpacity(255)) : (this.hoverContainer.setScale(.6),
this.hoverContainer.setOpacity(0),
this.hoverContainer.runAction(new cc.Spawn((new cc.ScaleTo(.15,1)).easing(cc.easeBackOut()),new cc.FadeIn(.15))))
},
hideAnimation: function(a) {
a ? this.setVisible(!1) : (this.hoverContainer.runAction(new cc.Spawn((new cc.ScaleTo(.15,.6)).easing(cc.easeBackIn()),new cc.FadeOut(.15))),
this.runAction(new cc.Sequence(new cc.DelayTime(.15),new cc.Hide)))
}
});
cleverapps.styles.ProgressView = {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 250
},
bar: {
width: 350,
spark: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
star: {
x: 0,
y: -12
},
arrows: {
x: {
align: "center"
},
y: {
align: "center",
dy: 4
},
widthOffset: 40,
margin: 15
},
icon: {
offset: {
y: 6,
x: 52
},
bg: {
padding: {
x: 11,
y: 12
},
x: {
align: "center"
},
y: {
align: "center",
dy: -2
}
}
},
comingSoon: {
lock: {
x: {
align: "center"
},
y: {
align: "center"
},
scale: .3
},
icon: {
width: 96,
height: 92
}
},
delta: {
x: {
align: "center"
},
y: {
align: "top",
dy: 50
}
}
};
var BackgroundsWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.options = a || {};
this.current = this.options.moveNext ? cleverapps.meta.selectedLocationId - 1 : cleverapps.meta.selectedLocationId;
this.stars = this.options.moveNext ? cleverapps.meta.getMainObject().getRequiredStars() : cleverapps.meta.stars;
a = this.createContent();
this._super({
content: a,
title: "BackgroundsWindow.title",
name: "backgroundswindow",
foreground: bundles.windows.frames.window_foreground_png,
closeButton: !this.options.moveNext
});
this.options.moveNext && this.changeCurrent(this.close.bind(this))
},
setupChildren: function() {
this._super();
if (this.scroll.dir === cleverapps.UI.ScrollView.DIR_HORIZONTAL && this.isVertical() || this.scroll.dir === cleverapps.UI.ScrollView.DIR_VERTICAL && !this.isVertical())
this.window.removeFromParent(),
this.onWindowLoaded(this.options)
},
isVertical: function() {
return cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL
},
changeCurrent: function(a) {
var b = cleverapps.meta.selectedLocationId
, c = this.bgs[b - 1]
, d = this.bgs[b]
, e = this.bgs[b + 1];
b === this.bgs.length - 2 && (e = !1);
this.addTape(c);
c.tape.setScale(0);
this.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.CallFunc(function() {
c.progressBar.receivePrize()
}
),new cc.DelayTime(3.2),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.simple.urls.opening_lock_effect)
}
),new cc.DelayTime(.9),new cc.CallFunc(function() {
d.name && d.name.setFont(cleverapps.styles.FONTS.BACKGROUNDS_WINDOW_NAME_TEXT);
a()
}
)));
d.lock.runAction(new cc.Sequence(new cc.DelayTime(2.9),(new cc.ScaleTo(.4,1.3 * d.lock.scale)).easing(cc.easeInOut(3)),(new cc.ScaleTo(.4,0)).easing(cc.easeIn(3)),new cc.RemoveSelf));
c.progressBar.runAction(new cc.Sequence(new cc.DelayTime(.6),(new cc.ScaleTo(.3,1.2 * c.progressBar.baseScale)).easing(cc.easeOut(2)),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.simple.urls.simple_complete_bg_effect)
}
),(new cc.ScaleTo(.3,0)).easing(cc.easeIn(2))));
c.tape.runAction(new cc.Sequence(new cc.DelayTime(2.3),(new cc.ScaleTo(.5,1)).easing(cc.easeBackInOut(.6))));
this.scroll.runAction(new cc.Sequence(new cc.DelayTime(2.8),(new cc.ScrollAction(d,{
duration: 1.4
})).easing(cc.easeBackInOut())));
d.layerColor.runAction(new cc.Sequence(new cc.DelayTime(3.5),new cc.FadeOut(.5)));
e && e.closedImage.runAction(new cc.Sequence(new cc.DelayTime(4.7),new cc.CallFunc(function() {
e && (this.addLayerColor(e),
e.layerColor.setOpacity(150))
}
.bind(this))))
},
createContent: function() {
var a = cleverapps.styles.BackgroundsWindow
, b = Messages.get("BackgroundsWindow.text");
this.options.moveNext && -1 !== ["scramble", "differences"].indexOf(cleverapps.config.name) && (b = Messages.get("BackgroundsWindow.moveNextText", {
place: Messages.get("background_name_" + cleverapps.meta.selectedLocationId)
}));
b = cleverapps.UI.generateOnlyText(b, cleverapps.styles.FONTS.WINDOW_TEXT);
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(this.isVertical() ? a.text.vertical.width : a.text.width, 0);
b.fitTo(void 0, this.isVertical() ? a.text.vertical.height : a.text.height);
this.bgs = [];
for (var c = 0, d = void 0; bundles["backgrounds_window_" + c]; ) {
var e = this.createItem(c);
c === this.current && (d = e);
this.bgs.push(e);
c++
}
this.bgs.push(this.createItem(c));
c = new cleverapps.Layout(this.bgs,{
direction: this.isVertical() ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL,
margin: a.scroll.margin,
padding: a.scroll.padding
});
e = this.scroll = new cleverapps.UI.ScrollView(c);
this.isVertical() ? e.setContentSize2(c.width, a.scroll.height) : e.setContentSize2(a.scroll.width, c.height);
e.scrollTo(d);
return new cleverapps.Layout([b, e.bg || e],{
direction: cleverapps.UI.VERTICAL,
margin: this.isVertical() ? a.verticalMargin : a.margin,
padding: a.padding
})
},
getItemSize: function() {
var a = cleverapps.styles.BackgroundsWindow.item.size;
return this.isVertical() ? a.horizontal : a.vertical
},
createItem: function(a) {
var b = cleverapps.styles.BackgroundsWindow
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
var d = this.getItemSize();
c.setContentSize2(d.width + 2 * b.item.bg.padding.x, d.height + 2 * b.item.bg.padding.y);
var e = cleverapps.UI.createScale9Sprite(a <= this.current ? bundles.simple.frames.frame_gold_png : bundles.simple.frames.frame_silver_png, cleverapps.UI.Scale9Rect.TwoPixelXY);
e.setContentSize2(c.getContentSize());
c.addChild(e);
e.setPositionRound(c.width / 2, c.height / 2);
e.setLocalZOrder(10);
a < this.current ? (this.addTape(c),
this.addBg(c, a)) : a === this.current ? (this.addProgressBar(c, this.current, this.stars),
this.addBg(c, a)) : a < cleverapps.meta.listAllLocationIds().length ? (d = c.lock = new cc.Sprite(bundles.simple.frames.lock_png),
c.addChild(d),
d.setPositionRound(b.lock),
a === this.current + 1 ? (this.addBg(c, a),
this.addLayerColor(c),
c.layerColor.setOpacity(150)) : this.addClosedImage(c),
this.options.moveNext && a === this.current + 2 && this.addBg(c, a)) : (this.addClosedImage(c),
a = cleverapps.UI.generateTTFText("BackgroundsWindow.ComingSoonTitle", cleverapps.styles.FONTS.BACKGROUNDS_WINDOW_NAME_COMING_SOON),
a.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER),
a.setDimensions(.8 * d.width, 0),
c.addChild(a),
a.setPositionRound(b.comingSoon));
return c
},
addProgressBar: function(a, b, c) {
var d = cleverapps.styles.BackgroundsWindow;
b = a.progressBar = new StarsProgressBar({
width: d.bar.width,
stars: c,
current: b,
withPresent: cleverapps.meta.selectedLocationId < cleverapps.meta.getLastLocationId()
});
a.addChild(b);
b.setScale(d.bar.scale);
b.baseScale = d.bar.scale;
b.setPositionRound(d.bar)
},
addTape: function(a) {
var b = cleverapps.styles.BackgroundsWindow
, c = a.tape = new cc.Sprite(bundles.simple.frames.tape_png);
c.setLocalZOrder(11);
a.addChild(c);
c.setPositionRound(b.name ? b.tape.withName : b.tape);
b.tape.text && (a = cleverapps.UI.generateTTFText(Messages.get("BackgroundsWindow.tapeText").toUpperCase(), cleverapps.styles.FONTS.BACKGROUNDS_WINDOW_TAPE_TEXT),
a.setLocalZOrder(12),
c.addChild(a),
a.fitTo(b.tape.text.width),
a.setPositionRound(b.tape.text))
},
addLayerColor: function(a) {
var b = cleverapps.styles.BackgroundsWindow;
a.layerColor = new cc.Scale9Sprite(bundles.pixel.frames.pixel_png);
a.layerColor.setColor(cleverapps.styles.COLORS.CLOSED_BACKGROUND_COLOR);
a.layerColor.setContentSize2(this.getItemSize());
a.layerColor.setAnchorPoint(0, 0);
a.layerColor.setLocalZOrder(-9);
a.addChild(a.layerColor);
a.layerColor.setPositionRound(a.width / 2 - a.layerColor.width / 2 + b.layerColor.offsetX, a.height / 2 - a.layerColor.height / 2 + b.layerColor.offsetY)
},
addClosedImage: function(a) {
var b = cleverapps.styles.BackgroundsWindow
, c = this.isVertical() ? bundles.simple.frames.closed_bg_png : bundles.simple.frames.closed_bg_vertical_png;
a.closedImage = new cc.Sprite(c);
a.closedImage.setLocalZOrder(-9);
a.addChild(a.closedImage);
a.closedImage.setPositionRound(b.item.bg)
},
getBgBundleName: function(a) {
var b = "backgrounds_window_";
this.isVertical() || (b += "vertical_");
return b + a
},
addBg: function(a, b) {
var c = cleverapps.styles.BackgroundsWindow
, d = this.getBgBundleName(b);
d = a.bg = new cc.Sprite(bundles[d].urls.background);
d.setLocalZOrder(-10);
a.addChild(d);
d.setPositionRound(c.item.bg);
this.addNameText(a, b)
},
addNameText: function(a, b) {
var c = cleverapps.styles.BackgroundsWindow;
if (c.name) {
var d = a.name = cleverapps.UI.generateTTFText("background_name_" + b, cleverapps.styles.FONTS.BACKGROUNDS_WINDOW_NAME_TEXT);
d.setPositionRound(c.name);
var e = bundles.simple.frames.blue_background;
e ? (e = cleverapps.UI.createScale9Sprite(e, cleverapps.UI.Scale9Rect.TwoPixelXY),
e.addChild(d),
e.setPositionRound(c.name.bg),
e.setContentSize2(a.width, e.height),
a.addChild(e),
d.setPositionRound(c.name)) : a.addChild(d, 11);
b === this.current + 1 && a.lock.setPositionRound(c.lockWithName)
}
},
listBundles: function(a) {
a = a || {};
var b = []
, c = cleverapps.meta.selectedLocationId + 1;
a.moveNext && c++;
for (a = 0; a <= c; a++)
b.push(this.getBgBundleName(a));
return b
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
BACKGROUNDS_WINDOW_TAPE_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: {
color: new cc.Color(168,28,54,255),
size: 2
}
},
BACKGROUNDS_WINDOW_NAME_COMING_SOON: {
size: 60,
color: new cc.Color(255,232,72,255),
stroke: {
size: 1,
color: new cc.Color(198,90,22,255)
},
shadow: {
direction: cc.size(0, -4),
color: new cc.Color(198,90,22,255),
blur: 1
}
},
BACKGROUNDS_WINDOW_NAME_TEXT: {
size: 45,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
}
});
cleverapps.overrideColors(cleverapps.styles.COLORS, {
CLOSED_BACKGROUND_COLOR: new cc.Color(0,8,38,255)
});
cleverapps.styles.BackgroundsWindow = {
margin: -10,
verticalMargin: 5,
padding: {
bottom: -26,
right: -46,
left: -48
},
text: {
width: 1700,
height: 100,
vertical: {
width: 600,
height: 200
}
},
lock: {
x: {
align: "center"
},
y: {
align: "center",
dy: 8
}
},
tape: {
x: {
align: "right",
dx: 16
},
y: {
align: "top",
dy: -25
},
withName: {
x: {
align: "right",
dx: 16
},
y: {
align: "top",
dy: -120
}
},
text: {
x: 147,
y: 58,
width: 220
}
},
layerColor: {
offsetX: 0,
offsetY: 0
},
comingSoon: {
x: {
align: "center"
},
y: {
align: "center"
}
},
bar: {
width: 300,
scale: .8,
x: {
align: "center",
dx: -25
},
y: {
align: "bottom",
dy: 80
}
},
item: {
size: {
vertical: {
width: 443,
height: 633
},
horizontal: {
width: 600,
height: 350
}
},
bg: {
padding: {
x: 13,
y: 15
},
x: {
align: "center"
},
y: {
align: "center"
}
}
},
scroll: {
x: {
align: "center"
},
y: {
align: "center",
dy: -1
},
height: 800,
width: 1800,
margin: 15,
padding: {
x: 35,
y: 40
},
rightHorizontalFrame: {
x: {
align: "right",
dx: 2
},
y: {
align: "center"
},
padding: 30
},
leftHorizontalFrame: {
x: {
align: "left"
},
y: {
align: "center"
},
padding: 30
}
},
present: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -30
},
width: 200,
height: 200,
scale: 1,
animation: {
scale: .5,
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
}
};
cleverapps.whenAllInitialized(function() {
cleverapps.meta.on("afterMoveNext", function(a) {
"tile3" === cleverapps.config.type && TileGenerator.getNewSkins().length ? cleverapps.focusManager.compound(a, [function(b) {
cleverapps.focusManager.hideAllControls();
cleverapps.aims.whenAllHidden(b)
}
, function(b) {
new TilesUnlockWindow;
cleverapps.focusManager.onceNoWindowsListener = b
}
, function(b) {
cleverapps.focusManager.showControlsWhileFocused("progress_view");
b()
}
]) : a()
})
});
Placements.ENTRIES.simpleForce = {
type: Placements.FREE_FOCUS_MAIN,
priority: 9,
filter: function() {
return cleverapps.meta.getMainObject().isForceAvailable()
},
action: function() {
cleverapps.focusManager.display({
focus: "simpleForce",
control: ["progress_view", "play_button"],
actions: [function(a) {
0 < cleverapps.meta.getMainObject().pendingsStars ? cleverapps.meta.getMainObject().updateProgress(a) : cleverapps.timeouts.setTimeout(a, 500)
}
, function(a) {
cleverapps.meta.getMainObject().showForce(a)
}
, function(a) {
cleverapps.playButton && cleverapps.playButton.passedLevel && cleverapps.playButton.animatePassLevel();
a()
}
]
})
}
};
Placements.ENTRIES.simpleUpdateProgress = {
type: Placements.FREE_FOCUS_MAIN,
priority: -2,
filter: function() {
return 0 < cleverapps.meta.getMainObject().pendingsStars && !cleverapps.meta.getMainObject().checkCompleted()
},
action: function() {
cleverapps.meta.getMainObject().updateProgress()
}
};
Placements.ENTRIES.simpleMoveNext = {
type: Placements.FREE_FOCUS_MAIN,
priority: 10,
filter: function() {
return cleverapps.meta.getMainObject().checkCompleted()
},
action: function() {
cleverapps.focusManager.display({
focus: "homeMoveNextLocation",
actions: [function(a) {
cleverapps.meta.getMainObject().onComplete(a)
}
, function(a) {
cleverapps.meta.moveNextLocation(a)
}
, function(a) {
cleverapps.playButton && cleverapps.playButton.passedLevel && "woodenblock" !== cleverapps.config.name && cleverapps.playButton.animatePassLevel();
a()
}
]
})
}
};
Mission.TYPE_PIGGY_BANK = 65;
Missions.FEATURES[Mission.TYPE_PIGGY_BANK] = function() {
Missions[Mission.TYPE_PIGGY_BANK] = {
available: {
level: "board" === cleverapps.config.type ? 3.2 : 3.6,
payments: !0,
youtube: {
disabled: !0
}
},
name: "PiggyBank",
view: PiggyBankWindow,
startWindow: PiggyBankWindow,
semaphore: Missions.SEMAPHORE_CUSTOM_PIGGY_BANK,
duration: "2 days",
sideBarJson: bundles.sidebar.jsons.piggybank_icon_json,
logic: PiggyBankMissionLogic
}
}
;
var PiggyBankMissionLogic = function(a, b) {
this.mission = a;
b && this.init();
this.onShowBottomButtonPriceWithAnimation = function() {}
;
this.onSetBalance = function() {}
;
this.updateProgress = function() {}
;
this.lastShownAmount = this.mission.result;
this.load(this.mission.details)
};
PiggyBankMissionLogic.prototype.init = function() {
this.level = cleverapps.paymentsHistory.classify();
this.level === cleverapps.PaymentsHistory.BRACKET_UNDECIDED && (this.level = cleverapps.PaymentsHistory.BRACKET_NONE);
this.level === cleverapps.PaymentsHistory.BRACKET_BIGWHALE && (this.level = cleverapps.PaymentsHistory.BRACKET_WHALE);
if (this.getProduct())
this.mission.result = this.getStartAmount(),
this.saveProgress();
else {
var a = connector.payments.getName();
cleverapps.throwAsync("no product for PiggyBank level:" + this.level + " plugin:" + a + " productKey:" + (PiggyBankMissionLogic.PRODUCTS[this.level] || PiggyBankMissionLogic.VIRTUAL_PRODUCTS[this.level]))
}
}
;
PiggyBankMissionLogic.prototype.getInfo = function() {
return {
level: this.level,
amount: this.mission.result
}
}
;
PiggyBankMissionLogic.prototype.saveProgress = function() {
this.mission.update(0, this.getInfo())
}
;
PiggyBankMissionLogic.prototype.load = function(a) {
this.level = a.level || 0;
this.mission.result = a.amount || 0
}
;
PiggyBankMissionLogic.prototype.addGameReward = function() {
Game.currentGame.rewards[GameBase.REWARD_PIGGY_BANK] = this.getLevelReward()
}
;
PiggyBankMissionLogic.prototype.add = function(a) {
this.unlocked = this.filled = void 0;
this.isFull() || (this.mission.result < this.getBaseAmount() && this.mission.result + a >= this.getBaseAmount() && (this.unlocked = !0,
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.PIGGY_BANK + "_unlocked")),
this.mission.result += a,
this.isFull() && (this.filled = !0,
this.mission.result = Math.min(this.mission.result, this.getMaxAmount()),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.PIGGY_BANK + "_full")),
(this.unlocked || this.filled) && this.mission.setNeedReview(!0),
this.saveProgress())
}
;
PiggyBankMissionLogic.prototype.getStartAmount = function() {
return Math.round(this.getBaseAmount() - PiggyBankMissionLogic.WINS_TO_MINIMAL * this.getLevelReward())
}
;
PiggyBankMissionLogic.prototype.getBaseAmount = function() {
return PiggyBankMissionLogic.BASE_AMOUNTS[this.level]
}
;
PiggyBankMissionLogic.prototype.getLevelReward = function() {
return Math.round((this.getMaxAmount() - this.getBaseAmount()) / PiggyBankMissionLogic.WINS_TO_FULFILL)
}
;
PiggyBankMissionLogic.prototype.getMaxAmount = function() {
return Math.round(this.getBaseAmount() * PiggyBankMissionLogic.MAX_COEF / PiggyBankMissionLogic.WINS_TO_FULFILL) * PiggyBankMissionLogic.WINS_TO_FULFILL
}
;
PiggyBankMissionLogic.prototype.getCurrentPrice = function() {
return this.getProduct().getCurrentPrice()
}
;
PiggyBankMissionLogic.prototype.wasShown = function() {
return this.isFull() && .01 <= Math.abs(this.getLastShowAmountProgress() - this.mission.result)
}
;
PiggyBankMissionLogic.prototype.showBottomButtonPriceWithAnimation = function() {
this.onShowBottomButtonPriceWithAnimation()
}
;
PiggyBankMissionLogic.prototype.setBalance = function(a) {
this.onSetBalance(a)
}
;
PiggyBankMissionLogic.prototype.getProgressGoals = function() {
return [this.getBaseAmount(), this.getMaxAmount()]
}
;
PiggyBankMissionLogic.prototype.calculateProgress = function(a) {
return a / this.getMaxAmount()
}
;
PiggyBankMissionLogic.prototype.getLastShowAmountProgress = function() {
return this.lastShownAmount
}
;
PiggyBankMissionLogic.prototype.setLastShowAmountProgress = function(a) {
this.lastShownAmount = a
}
;
PiggyBankMissionLogic.prototype.isFull = function() {
return this.mission.result >= this.getMaxAmount()
}
;
PiggyBankMissionLogic.prototype.isReadyToFinish = function() {
var a = this.getState();
return a === PiggyBankMissionLogic.STATE_BASE || a === PiggyBankMissionLogic.STATE_FULL
}
;
PiggyBankMissionLogic.prototype.wantToShowNewState = function() {
return this.mission.needReview && this.isReadyToFinish()
}
;
PiggyBankMissionLogic.prototype.processEvent = function(a) {
this.add(a.amount)
}
;
PiggyBankMissionLogic.prototype.getProduct = function() {
return Product.CreateById(PiggyBankMissionLogic.PRODUCTS[this.level]) || Product.CreateById(PiggyBankMissionLogic.VIRTUAL_PRODUCTS[this.level])
}
;
PiggyBankMissionLogic.prototype.getRewardCurrency = function() {
return !1 !== cleverapps.config.soft ? "soft" : "hard"
}
;
PiggyBankMissionLogic.prototype.getGoal = function(a) {
return "soft" === this.getRewardCurrency() ? "@@" + a : "$$" + a
}
;
PiggyBankMissionLogic.prototype.getCurrentAmount = function() {
var a = cleverapps.formatAmount(this.mission.result);
return this.getGoal(a)
}
;
PiggyBankMissionLogic.prototype.getReward = function() {
var a = {};
a[this.getRewardCurrency()] = this.mission.result;
return a
}
;
PiggyBankMissionLogic.prototype.buy = function(a) {
if (this.getState() === PiggyBankMissionLogic.STATE_UNACTIVE)
a();
else {
var b = this.getProduct();
b.reward = this.getReward();
b.context = {
type: "piggy_bank",
mission: Mission.TYPE_PIGGY_BANK
};
b.buy(function(c) {
c && (this.mission.complete(),
a())
}
.bind(this))
}
}
;
PiggyBankMissionLogic.prototype.getControls = function() {
return !1 !== cleverapps.config.soft ? "MenuBarCoinsItem" : "MenuBarGoldItem"
}
;
PiggyBankMissionLogic.prototype.getState = function() {
var a = PiggyBankMissionLogic.STATE_FULL;
this.mission.result < this.getBaseAmount() ? a = PiggyBankMissionLogic.STATE_UNACTIVE : this.mission.result >= this.getBaseAmount() && this.mission.result < this.getMaxAmount() && (a = PiggyBankMissionLogic.STATE_BASE);
return a
}
;
PiggyBankMissionLogic.prototype.checkAvailableBottomButton = function() {
return this.lastShownAmount >= this.getBaseAmount()
}
;
PiggyBankMissionLogic.prototype.getDescriptionText = function() {
var a = this.getState()
, b = "PiggyBankWindow.text1.Full";
a === PiggyBankMissionLogic.STATE_UNACTIVE ? b = "PiggyBankWindow.desc1" : a === PiggyBankMissionLogic.STATE_BASE && (b = "PiggyBankWindow.desc2");
return b
}
;
PiggyBankMissionLogic.RestoreExpeditionId = function() {
return "main"
}
;
PiggyBankMissionLogic.RestoreActions = function(a, b) {
var c = cleverapps.missionManager.findByType(a.mission)
, d = c && c.logic && c.logic.getReward();
if (c && c.isRunning() && d)
return [function(e) {
c.isRunning() && c.complete();
b();
new RewardWindow(d,{
event: cleverapps.EVENTS.EARN.PURCHASE
});
cleverapps.focusManager.onceNoWindowsListener = e
}
]
}
;
PiggyBankMissionLogic.MAX_COEF = 1.5;
PiggyBankMissionLogic.BASE_AMOUNTS = [500, 1800, 6E3, 25E3];
PiggyBankMissionLogic.PRODUCTS = ["piggybank500", "piggybank1800", "piggybank6000", "piggybank25000"];
PiggyBankMissionLogic.VIRTUAL_PRODUCTS = ["piggybankSmall", "piggybankMedium", "piggybankLarge", "piggybankHuge"];
PiggyBankMissionLogic.WINS_TO_FULFILL = 15;
PiggyBankMissionLogic.WINS_TO_MINIMAL = 10;
PiggyBankMissionLogic.STATE_UNACTIVE = 0;
PiggyBankMissionLogic.STATE_BASE = 1;
PiggyBankMissionLogic.STATE_FULL = 2;
Product.RESTORE_LOGIC.piggy_bank = PiggyBankMissionLogic;
GameBase.REWARD_PIGGY_BANK = "piggyBank";
RewardTypes.piggyBank = {
flyingAnimation: Reward.CUSTOM_COLLECT,
getCustomRewardAnimation: function() {
return bundles.piggy_bank_reward.jsons.coins_animation_json
},
getCustomRewardIcon: function() {
return bundles.custom_reward.jsons.piggybank_icon_json
},
getCustomRewardText: function(a, b) {
var c = cleverapps.missionManager.findByType(Mission.TYPE_PIGGY_BANK);
if (c && c.isRunning())
return c.logic.isFull() ? b ? c.result - a : "PiggyBank.Full" : b ? c.result - a : c.result
},
getCustomRewardSound: function() {
return bundles.custom_reward.urls.piggybank_coins_effect
},
getCustomRewardOpenSound: function() {
return bundles.custom_reward.urls.piggy_reward_open
},
getCustomRewardCloseSound: function() {
return bundles.custom_reward.urls.piggy_reward_close
},
getCustomRewardAfterUpdateSound: function() {
var a = cleverapps.missionManager.findByType(Mission.TYPE_PIGGY_BANK);
if (a && a.isRunning() && a.logic.isFull())
return bundles.custom_reward.urls.piggybank_coins_full_effect
},
parse: function(a, b) {
return (a = cleverapps.missionManager.findRunningMission(Mission.TYPE_PIGGY_BANK)) && !a.logic.isFull() ? [new Reward("piggyBank",Math.min(a.logic.getLevelReward(), a.logic.getMaxAmount() - a.result),b)] : []
},
handler: function(a) {
var b = cleverapps.missionManager.findByType(Mission.TYPE_PIGGY_BANK);
b && b.isRunning() && b.logic.add(a);
return function() {}
}
};
var PiggyBankWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.mission = a;
this.mission.logic.onShowBottomButtonPriceWithAnimation = this.createListener(this.showBottomButtonPriceWithAnimation.bind(this));
this.mission.logic.onSetBalance = this.createListener(this.setBalance.bind(this));
var b = a.getTimeLeft()
, c = this.createTimer(b);
if (!(0 >= b) && a) {
var d = cleverapps.styles.PiggyBankWindow;
b = this.createAnimation(b);
var e = this.createDescription()
, f = this.progress = new PiggyBankProgressBar(a)
, g = new cc.Node;
g.setContentSize(0, 30);
c = new cleverapps.Layout([b, c, e, f, g],{
direction: cleverapps.UI.VERTICAL,
margin: d.margin
});
this._super({
name: "piggybankwindow",
title: a.logic.isFull() ? "PiggyBankWindow.Title.Full" : "PiggyBankWindow.Title",
content: c,
button: {
width: d.button.width,
height: d.button.height,
onDisableHint: "PiggyBankWindow.bottom_button_hint",
text: a.logic.getCurrentPrice(),
onPressed: function() {
a.logic.buy(this.close.bind(this))
}
.bind(this)
},
help: function() {
new GuideWindow({
name: "PiggyBankRulesWindow",
bundle: bundles.piggybankruleswindow
})
},
styles: cleverapps.styles.PiggyBankWindow,
openSound: bundles.main.urls.shop_buy_effect
});
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.PIGGY_BANK_WINDOW_OPENED);
Lottery.addIcon(this.button);
Lottery.addText(this);
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this);
this.mission.setNeedReview(!1);
this.updateButton();
this.mission.logic.updateProgress()
}
},
createWindowButtons: function() {
this.params.button.onClicked = this.params.button.onPressed || this.close.bind(this);
return this.bottomButton = new BottomButton(this.params.button)
},
updateButton: function() {
connector.payments.isConnected() && this.mission.logic.checkAvailableBottomButton() ? this.bottomButton.enable() : this.bottomButton.disable()
},
showBottomButtonPriceWithAnimation: function() {
if (this.bottomButton.disabled && connector.payments.isConnected()) {
var a = new cleverapps.Spine(bundles.piggy_bank_window.jsons.button_light);
a.setAnchorPoint(.5, .5);
a.setPositionRound({
x: {
align: "center"
},
y: {
align: "center"
}
});
a.setAnimation(0, "animation", !1);
this.bottomButton.addChild(a);
a.setLocalZOrder(-1);
this.bottomButton.runAction(new cc.Sequence(new cc.ScaleTo(.5,.8),new cc.ScaleTo(.3,1),new cc.CallFunc(function() {
this.bottomButton.enable()
}
.bind(this))))
}
},
createAnimation: function() {
var a = cleverapps.styles.PiggyBankWindow
, b = new cleverapps.Spine(bundles.piggy_bank.jsons.piggy_bank_json);
b.setAnchorPoint(.5, .5);
b.setAnimation(0, this.mission.logic.isFull() ? "piggy_full" : "piggy_bank", !0);
this.mission.logic.isFull() && this.runAction(new cc.RepeatForever(new cc.Sequence(new cc.DelayTime(1.15),new cc.PlaySound(bundles.piggy_bank.urls.jump_effect),new cc.DelayTime(1.38))));
var c = this.balance = this.createBalance();
b.addChild(c);
c.setPositionRound(a.balance.position);
c.setLocalZOrder(1);
return b
},
setBalance: function() {
this.balance.setScale(1);
var a = this.mission.result - this.mission.logic.getLastShowAmountProgress()
, b = 1 + a / this.mission.logic.getMaxAmount() * 50
, c = Math.floor(a / b);
a = .6 / b;
var d = this.mission.logic.getLastShowAmountProgress();
this.balance.runAction((new cc.Sequence(new cc.ScaleTo(.2,1.2),new cc.DelayTime(.2),new cc.PlaySound(bundles.piggy_bank.urls.piggy_load_coins),new cc.Repeat(new cc.Sequence(new cc.DelayTime(a),new cc.CallFunc(function() {
d += c;
this.balance.setString(this.mission.logic.getGoal(d))
}
.bind(this))),b - 1),new cc.CallFunc(function() {
this.balance.setString(this.mission.logic.getGoal(this.mission.result))
}
.bind(this)),new cc.DelayTime(.3),new cc.ScaleTo(.4,1))).setFinalize(function() {
this.mission.logic.setLastShowAmountProgress(this.mission.result)
}
.bind(this)))
},
createBalance: function() {
return new TextWithIcon(this.mission.logic.getGoal(this.mission.logic.getLastShowAmountProgress()),{
font: cleverapps.styles.FONTS.PIGGY_BANK_BALANCE_FONT,
iconSize: 1.2
})
},
createTimer: function(a) {
return new Timer(a,this.close.bind(this),{
timerBg: bundles.piggy_bank_window.frames.big_timer_bg_png,
timerIcon: bundles.piggy_bank_window.frames.big_timer_png
})
},
createDescription: function() {
var a = cleverapps.styles.PiggyBankWindow
, b = cleverapps.UI.generateOnlyText(this.mission.logic.getDescriptionText(), cleverapps.styles.FONTS.WINDOW_TEXT, {
value: this.mission.logic.getBaseAmount()
});
b.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
b.setDimensions(a.text.width, 0);
b.fitTo(void 0, a.text.height);
return b
}
});
PiggyBankWindow.prototype.listBundles = function() {
return ["piggy_bank_window"]
}
;
cleverapps.styles.FONTS.PIGGY_BANK_BALANCE_FONT = {
size: 50,
color: new cc.Color(255,226,64,255)
};
cleverapps.styles.PiggyBankWindow = {
margin: 20,
padding: {
bottom: 100
},
amount: {
width: 260,
height: 64,
margin: 10
},
text: {
width: 640,
height: 150
},
button: {
width: 300,
height: 100
},
pig: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
}
},
balance: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -20
}
}
},
timer: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 0
}
}
},
goal: {
iconSize: 11
},
deltaAnimation: {
dy: -40
}
};
var PiggyBankGoalView = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
var b = cleverapps.styles.PiggyBankGoalView;
a = this.parseText(a);
this.createGoalIcon(a[0]);
cleverapps.UI.wrap(this);
var c = cleverapps.UI.generateImageText(a[1], cleverapps.styles.FONTS.PIGGY_BANK_GOAL_FONT);
this.addChild(c);
c.setPositionRound(b.amount);
this.amount = Number.parseInt(a[1])
},
createGoalIcon: function(a) {
a = this.createIcon(a);
this.light = new cleverapps.Spine(bundles.piggy_bank_window.jsons.coin_light);
this.light.setSkin("yellow");
this.addChild(this.light);
this.addChild(a)
},
parseText: function(a) {
a.trim();
var b = [];
b.push(a.substring(0, 2));
b.push(a.substring(2, a.length));
return b
},
showLight: function() {
this.light && this.light.setAnimation(0, "multiple", !1);
this.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.PlaySound(bundles.piggy_bank.urls.coins_light_effect)))
},
createIcon: function(a) {
var b = this.chooseImage(a);
b = new cc.Sprite(b);
b.setScale(PiggyBankGoalView.ICONS[a].scale);
return b
},
chooseImage: function(a) {
a = PiggyBankGoalView.ICONS[a];
return bundles[a.bundle].frames[a.name]
}
});
PiggyBankGoalView.ICONS = {
$$: {
name: "gold_icon_png",
bundle: "buttons_inlined_icons",
scale: 1
},
"@@": {
name: "coin_icon_png",
bundle: "buttons_inlined_icons",
scale: 1
}
};
cleverapps.styles.FONTS.PIGGY_BANK_GOAL_FONT = {
size: 35,
color: new cc.Color(255,226,64,255)
};
cleverapps.styles.PiggyBankGoalView = {
amount: {
x: {
align: "center"
},
y: {
align: "center",
dy: -50
}
}
};
var PiggyBankProgressBar = ScaledProgressBar.extend({
ctor: function(a) {
var b = cleverapps.styles.PiggyBankProgressBar;
this._super({
progress: bundles.progress_bar.frames.bar_dailytask,
background: bundles.progress_bar.frames.bg_dailytask,
to: a.logic.getMaxAmount()
});
a.logic.updateProgress = this.createListener(this.updateProgress.bind(this));
this.mission = a;
this.setLength(b.length);
this.goalViews = this.addGoalViews();
a = a.logic.getLastShowAmountProgress();
this.setPercentage(a);
a = this.target = new cc.Node;
this.addChild(a);
this.updateTargetPosition()
},
addGoalViews: function() {
var a = this.mission.logic.getProgressGoals()
, b = cleverapps.styles.PiggyBankProgressBar;
return a.map(function(c) {
var d = new PiggyBankGoalView(this.mission.logic.getGoal(c));
this.addChild(d);
c = this.width * this.mission.logic.calculateProgress(c) + (b.goalsOffset || 0);
d.setPosition(c, this.height / 2);
return d
}
.bind(this))
},
updateTargetPosition: function() {
var a = this.width * this.mission.result / this.mission.logic.getMaxAmount();
this.target.setPosition(a, this.height / 2)
},
updateProgress: function() {
if (!(.01 > Math.abs(this.mission.logic.getLastShowAmountProgress() - this.mission.result))) {
var a = this.mission.result
, b = this.goalViews.filter(function(d) {
return d.amount <= a && d.amount > this.mission.logic.getLastShowAmountProgress()
}
.bind(this));
cleverapps.audio.playSound(bundles.piggy_bank_window.urls.piggy_progress_update);
var c = [];
b.length && (c = b.map(function(d) {
return new cc.Sequence(new cc.CallFunc(function() {
this.setPercentage(d.amount, {
animated: !0,
delta: !0,
callback: function() {
d.showLight();
this.mission.logic.showBottomButtonPriceWithAnimation();
this.mission.result === d.amount && this.mission.logic.setBalance(this.mission.result)
}
.bind(this)
})
}
.bind(this)),new cc.DelayTime(2))
}
.bind(this)));
c.push(new cc.CallFunc(function() {
this.setPercentage(this.mission.result, {
animated: !0,
delta: !0,
callback: function() {
this.mission.logic.setBalance(this.mission.result)
}
.bind(this)
})
}
.bind(this)));
c.push(new cc.CallFunc(function() {
this.updateTargetPosition()
}
.bind(this)));
this.runAction(new cc.Sequence(c))
}
}
});
cleverapps.styles.PiggyBankProgressBar = {
length: 550
};
"heroes" === cleverapps.config.ui && cleverapps.overrideStyles(cleverapps.styles.PiggyBankProgressBar, {
goalsOffset: -10
});
var PlayButton = function() {
cleverapps.EventEmitter.call(this);
if (cleverapps.isLevels())
cleverapps.user.on("incLevel", this.onIncLevel.bind(this));
this.update()
};
PlayButton.prototype = Object.create(cleverapps.EventEmitter.prototype);
PlayButton.prototype.constructor = PlayButton;
PlayButton.prototype.onIncLevel = function() {
this.incLevelDisabled || (this.passedLevel = !0,
this.update())
}
;
PlayButton.prototype.enableIncLevel = function() {
delete this.incLevelDisabled
}
;
PlayButton.prototype.disableIncLevel = function() {
this.incLevelDisabled = !0
}
;
PlayButton.prototype.getLevelNo = function() {
var a = cleverapps.user.getVirtualDisplayLevel();
this.passedLevel && a--;
return a
}
;
PlayButton.prototype.update = function() {
if (cleverapps.isLevels()) {
var a = cleverapps.user.getCurrentLevel();
this.currentLevel && this.currentLevel.episodeNo === a.episodeNo && this.currentLevel.levelNo === a.levelNo || (this.currentLevel && (this.previousLevel = this.currentLevel),
this.currentLevel = a,
this.trigger("update"))
}
}
;
PlayButton.prototype.onClick = function() {
cleverapps.forces.isRunningForce() && cleverapps.forces.closeRunningForce();
cleverapps.focusManager.display({
focus: "PlayButton_scene",
action: function(a) {
cleverapps.meta.wantsToPlay(a)
}
})
}
;
PlayButton.prototype.animatePassLevel = function() {
this.passedLevel = !1;
this.trigger("animatePassLevel")
}
;
PlayButton.prototype.showForce = function(a) {
this.trigger("showForce", a)
}
;
cleverapps.InitByFeature.playbutton = function() {
cleverapps.playButton = new PlayButton
}
;
Placements.ENTRIES.animatePassLevel = {
type: Placements.FREE_FOCUS_MAIN,
priority: -2,
filter: function() {
return cleverapps.playButton.passedLevel && cleverapps.isLevels()
},
action: function() {
cleverapps.playButton.animatePassLevel()
}
};
var PlayButtonView = cc.Node.extend({
avoidNode: "PlayButtonView",
ctor: function(a) {
this._super();
this.options = a || {};
this.isSmall = this.options.isSmall;
this.noLevelNumber = "knockout" === cleverapps.config.regime || cleverapps.meta.getType() === Meta.SHORTMETA || cleverapps.meta.getType() === Meta.HOSE && cleverapps.user.isPassedAll();
this.setAnchorPoint(.5, .5);
this.setContentSize2(cleverapps.styles.PlayButtonView);
this.setPositionRound(cleverapps.styles.PlayButtonView.position);
cleverapps.playButton.on("update", this.update.bind(this), this);
cleverapps.playButton.on("animatePassLevel", this.animatePassLevel.bind(this), this);
cleverapps.playButton.on("showForce", this.showForce.bind(this), this);
this.update()
},
update: function() {
this.styling = this.getStyling();
this.createButton();
cleverapps.styles.PlayButtonView.button || (cleverapps.UI.applyHover(this),
cleverapps.UI.onClick(this, function() {
cleverapps.playButton.onClick()
}))
},
showForce: function(a) {
cleverapps.forces.isAvailable(this, Forces.METHA_PLAY_BUTTON) ? (cleverapps.forces.create(this, Forces.METHA_PLAY_BUTTON),
cleverapps.forces.onceForceClosed = a) : a()
},
animatePassLevel: function() {
this.button && this.button.stopAllActions();
if (!this.isSmall && !this.noLevelNumber) {
var a = new cleverapps.Spine(bundles.play_button.jsons.play_button_transition_json);
this.button.addChild(a);
a.setPositionRound(this.button.width / 2, this.button.height / 2);
a.runAction(new cc.Sequence(new cc.DelayTime(.6),new cc.CallFunc(function() {
a.setAnimation(0, "animation", !1);
a.setCompleteListenerRemove()
}
)))
}
this.button.runAction(new cc.Sequence(this.listAnimationActions()))
},
listAnimationActions: function() {
if (this.noLevelNumber)
return [new cc.DelayTime(1.1), new cc.CallFunc(this.updateTextAndButton.bind(this))];
var a = this.scale;
return [new cc.DelayTime(1.1), new cc.ScaleTo(.15,1.3 * a), new cc.CallFunc(this.updateTextAndButton.bind(this)), new cc.PlaySound(bundles.play_button.urls.play_button_effect), new cc.ScaleTo(.2,a)]
},
updateTextAndButton: function() {
this.styling = this.getStyling();
this.button.setString(this.getTextMsg());
this.button.setType(this.styling.type)
},
addFinger: function() {
FingerView.hintClick(this, {
delay: 5,
repeatDelay: 5
})
},
createButton: function() {
var a = cleverapps.styles.PlayButtonView;
this.button && this.button.removeFromParent();
var b = this.button = new cleverapps.UI.Button({
width: a.width,
height: a.height,
text: this.getTextMsg(),
type: this.styling.type,
icons: "woodenblock" === cleverapps.config.name ? {
"*": bundles.play_button.frames.jewel_png
} : void 0,
onClicked: function() {
cleverapps.playButton.onClick()
}
});
this.addChild(b);
b.setPositionRound(a.button)
},
getTextMsg: function() {
if (!cleverapps.isLevels())
return Messages.getLocalized("Play");
var a = cleverapps.playButton.getLevelNo()
, b = this.getDisplayedLevel()
, c = this.noLevelNumber ? "Play" : "PlayButton.text";
b.isHard() && !1 !== this.options.hard && (c = "message.hardLevel");
b.isTricky() && (c = "message.trickyLevel");
b.isBonus() && (c = "message.bonusLevel");
this.isSmall && (c = a);
c = Messages.getLocalized(c, {
levelNo: a
});
"woodenblock" === cleverapps.config.name && (c = "* " + c);
return c
},
getDisplayedLevel: function() {
return cleverapps.playButton.passedLevel && cleverapps.playButton.previousLevel ? cleverapps.playButton.previousLevel : cleverapps.playButton.currentLevel
},
getStyling: function() {
var a = this.getDisplayedLevel()
, b = cleverapps.styles.PlayButtonView
, c = {
button_png: bundles.play_button.frames.play_button_png,
button_on_png: bundles.play_button.frames.play_button_on_png
};
b.button && b.button.SKIP_RESOLUTION && b.button.SKIP_RESOLUTION.padding && (c.SKIP_RESOLUTION = {
padding: b.button.SKIP_RESOLUTION.padding
});
cleverapps.isLevels() && a.isHard() && !["wordsoup"].includes(cleverapps.config.name) && (c = Object.assign(c, cleverapps.styles.UI.Button.Images.button_red));
cleverapps.isLevels() && (a.isTricky() || a.isBonus()) && !["wordsoup"].includes(cleverapps.config.name) && (c = Object.assign(c, cleverapps.styles.UI.Button.Images.button_blue));
return {
type: c
}
}
});
"blocks" === cleverapps.config.type && (PlayButtonView.prototype.animatePassLevel = function() {
this.button && this.button.stopAllActions();
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.DelayTime(1.15),new cc.CallFunc(function() {
this.styling = this.getStyling();
this.button.setString(this.getTextMsg());
this.button.setType(this.styling.type)
}
.bind(this))))
}
);
cleverapps.styles.PlayButtonView = {
width: 300,
height: 100,
position: [{
x: {
align: "center"
},
y: {
align: "bottom",
dy: 150
}
}, {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 150
}
}, {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 150
}
}],
button: {
x: {
align: "center"
},
y: {
align: "center"
}
}
};
Mission.TYPE_LETTER = 3;
Missions.FEATURES[Mission.TYPE_LETTER] = function() {
Missions[Mission.TYPE_LETTER] = {
available: {
level: 3.45
},
view: MissionWindow,
duration: "1 day",
prize: RewardsConfig.Tournament.places,
teaser: !0,
name: "LetterTournament",
collectIcon: bundles.tournament_icon.frames.mission_letter_png,
semaphore: Missions.SEMAPHORE_SECONDARY,
competition: {
step: [2, 6],
amount: [20, 30]
},
sideBarJson: bundles.sidebar.jsons.mission_letter_icon_json,
finishWindow: MissionWindow,
startWindow: {
name: "LetterTournamentGuideWindow",
bundle: bundles.lettertournamentguidewindow
},
bundle: "letter_tournament",
STAR_TYPES_AMOUNT: 2
}
}
;
cleverapps.overrideStyles(cleverapps.styles.Decorators, {
present: {
type: Decors.TYPE_IMAGE,
image: "decor_shop_png",
scale: 1.1,
zOrder: 1,
x: {
align: "left",
dx: 60
},
y: {
align: "top",
dy: 110
}
},
star: {
type: Decors.TYPE_IMAGE,
image: "decor_league_png",
scale: 1.1,
zOrder: 1,
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 150
}
},
xmas_window_right_top: {
type: Decors.TYPE_ANIMATION,
json: bundles.windows.jsons.xmas_window,
animation: "up_right",
x: {
align: "right",
dx: 30
},
y: {
align: "top",
dy: 70
},
lovesBackgroundAndForeground: !0
},
xmas_window_right_bottom: {
type: Decors.TYPE_ANIMATION,
json: bundles.windows.jsons.xmas_window_title,
animation: "right",
x: {
align: "right",
dx: 0
},
y: {
align: "bottom",
dy: 0
},
lovesBackgroundAndForeground: !0
},
xmas_window_left_bottom: {
type: Decors.TYPE_ANIMATION,
json: bundles.windows.jsons.xmas_window_title,
animation: "left",
x: {
align: "left",
dx: 0
},
y: {
align: "bottom",
dy: 0
},
lovesBackgroundAndForeground: !0
},
xmas_window_left_top: {
type: Decors.TYPE_ANIMATION,
json: bundles.windows.jsons.xmas_window,
animation: "up_left",
x: {
align: "left",
dx: -30
},
y: {
align: "top",
dy: 70
},
lovesBackgroundAndForeground: !0
},
xmas_window_top: {
type: Decors.TYPE_SCALE9,
image: bundles.windows.frames.xmas_window_top,
lovesBackgroundAndForeground: !0,
scale: 1,
zOrder: 1,
width: "parent",
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 15
}
},
halloween_window_candle_left: {
image: bundles.windows.frames.candle_decor,
type: Decors.TYPE_IMAGE,
x: {
align: "right",
dx: 20
},
y: {
align: "bottom",
dy: -11
},
lovesBackgroundAndForeground: !0,
scale: {
x: 1,
y: 1
}
},
halloween_window_lian_left: {
image: bundles.windows.frames.lian_left_decor,
type: Decors.TYPE_IMAGE,
x: {
align: "left",
dx: -23
},
y: {
align: "center",
dy: 10
},
lovesBackgroundAndForeground: !0,
scale: {
x: 1,
y: 1
}
},
halloween_window_lian_right: {
image: bundles.windows.frames.lian_down_decor,
type: Decors.TYPE_IMAGE,
x: {
align: "right",
dx: 23
},
y: {
align: "center",
dy: 40
},
lovesBackgroundAndForeground: !0,
scale: {
x: 1,
y: 1
}
},
halloween_window_lian_bottom: {
image: bundles.windows.frames.lian_right_decor,
type: Decors.TYPE_IMAGE,
x: {
align: "left",
dx: -6
},
y: {
align: "top",
dy: 0
},
lovesBackgroundAndForeground: !0,
scale: {
x: 1,
y: 1
}
},
halloween_window_decor_bg_right: {
image: bundles.windows.frames.decor_bg,
type: Decors.TYPE_IMAGE,
x: {
align: "right",
dx: 6
},
y: {
align: "top",
dy: 0
},
lovesBackgroundAndForeground: !0,
scale: {
x: 1,
y: 1
}
},
halloween_window_pumpkin: {
image: bundles.windows.frames.pumpkin_decor,
type: Decors.TYPE_IMAGE,
x: {
align: "right",
dx: 42
},
y: {
align: "top",
dy: 44
},
lovesTitle: "bg_window",
scale: {
x: 1,
y: 1
}
},
halloween_window_spider: {
image: bundles.windows.frames.spider_decor,
type: Decors.TYPE_IMAGE,
x: {
align: "left",
dx: -20
},
y: {
align: "bottom",
dy: 1
},
lovesBackgroundAndForeground: !0,
scale: {
x: 1,
y: 1
}
}
});
cleverapps.overrideStyles(cleverapps.styles.SceneDecors, {
halloween_menubar: {
image: bundles.menubar.frames.spiderweb_decor,
x: {
align: "right",
dx: 12
},
y: {
align: "top",
dy: 18
}
}
});
cleverapps.overrideColors(cleverapps.styles.COLORS, {
COLOR_WINDOW_TEXT: new cc.Color(20,74,131,255),
PURPLE: new cc.Color(61,29,125,255),
COLOR_FORCE_MESSAGE_TEXT: new cc.Color(141,74,56),
BLACK_STROKE: new cc.Color(0,0,0,110),
GREEN: new cc.Color(119,229,0,46),
COLOR_RED: new cc.Color(255,80,94,46),
DARK_BLUE_TEXT_COLOR: new cc.Color(20,74,131,110),
COLOR_BONUS: new cc.Color(215,169,255,255),
STICKERS_COLLECTION_COLOR: new cc.Color(225,229,119,1),
BARREL_ADS_ITEM_TITLE_COLOR: new cc.Color(49,108,150,255),
BROWN_BUTTON_COLOR: new cc.Color(128,45,23,255),
STICKER_LABEL_COLOR: new cc.Color(75,111,128,255)
});
cleverapps.overrideStyles(cleverapps.styles.DECORATORS, {
TILE_SHOP_WINDOW_TIMER_STROKE: {
color: new cc.Color(196,29,58,255),
size: 1
},
TILE_SHOP_BADGE_STROKE: {
color: new cc.Color(243,78,36,255),
size: 3
},
IMAGE_FONT_STROKE: {
color: cleverapps.styles.COLORS.BLACK_STROKE,
size: 2
},
IMAGE_FONT_STROKE_THIN: {
color: cleverapps.styles.COLORS.BLACK_STROKE,
size: 1
},
TITLE_TEXT_SHADOW: {
color: cleverapps.styles.COLORS.BLACK,
direction: cc.size(0, -2),
blur: 6
},
WHITE_TEXT_SHADOW: {
color: new cc.Color(0,0,0,250),
direction: cc.size(0, -2),
blur: 6
},
RED_STROKE: {
color: cleverapps.styles.COLORS.COLOR_RED,
size: 2
},
DIALOGUE_PERSON_TITLE_TEXT_STROKE: {
color: cleverapps.styles.COLORS.BLACK_STROKE,
size: 1
},
DIALOGUE_PERSON_TITLE_TEXT_SHADOW: {
color: cleverapps.styles.COLORS.BLACK,
direction: cc.size(0, 0),
blur: 3
},
TRANSPARENT_BLACK_3PX: {
color: cleverapps.styles.COLORS.BLACK_STROKE,
size: 3
}
});
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
LOADING_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
SHOP_WINDOW_TILE_TITLE: {
size: 64,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.RED_STROKE
},
TILE_SHOP_COINS_OFFER: {
size: 64,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.RED_STROKE
},
UNITSSHOPTILE_AMOUNT: {
size: 50
},
BUTTON_BROWN_TEXT: {
size: 36,
color: cleverapps.styles.COLORS.BROWN_BUTTON_COLOR
},
SHOP_WINDOW_SMALL_TILE_TITLE: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
PACKWINDOW_TEXT: {
name: "default",
size: 64,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.RED_STROKE
},
TILE_SHOP_WINDOW_BADGE_TIMER: {
size: 22,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TILE_SHOP_WINDOW_TIMER_STROKE
},
UNITSSHOPTILE_NAME: {
size: 40,
color: cleverapps.styles.COLORS.DARK_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
UNITSSHOP_APPEAR_IN: {
size: 54,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
TOOLBAR_ITEM_TIMER_TEXT: {
size: 27
},
SHOPTILE_LEFT: {
size: 32,
color: cleverapps.styles.COLORS.DARK_BLUE_TEXT_COLOR
},
UNITSSHOP_CART_AMOUNT: {
name: "nostroke",
size: 40,
color: cleverapps.styles.COLORS.DARK_BLUE_TEXT_COLOR,
stroke: void 0,
shadow: void 0
},
MENUBAR_TIMER_TEXT: {
size: 28,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
RATE_WINDOW_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_3PX
},
TILE_REWARDS: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
PRODUCT_TILE_LIMIT_TEXT: {
size: 32,
color: cleverapps.styles.COLORS.DARK_BLUE_TEXT_COLOR,
stroke: void 0,
shadow: void 0
},
TIMER_TEXT: {
size: 42,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
ORDERS_PLACEHOLDER_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
ORDERS_WINDOW_TITLE: {
size: 70,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
LOADING_ANIMATION_TEXT: {
size: 54,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
name: "default"
},
WINDOW_SMALL_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.DARK_BLUE_TEXT_COLOR
},
TOURNAMENT_PLAYER_TEXT: {
name: "nostroke",
size: 30,
color: cleverapps.styles.COLORS.BLACK,
stroke: void 0,
shadow: void 0
},
SIDEBAR_ICON_TEXT: {
name: "default",
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
WINDOW_TEXT: {
size: 43,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
stroke: void 0,
shadow: void 0
},
SAME_ITEMS_TEXT: {
size: 28,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
ORDERICON_AMOUNT_TEXT: {
size: 58,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
INGREDIENT_ORDER_ICON_TEXT: {
size: 58
},
DARK_TEXT: {
size: 45,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
BUYINGREDIENTSWINDOW_TITLE: {
size: 55,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
stroke: void 0,
shadow: void 0
},
UNITICON_TITLE: {
size: 36,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
UNITICON_LEVEL: {
size: 36,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR
},
PROMOTION_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
EXTRA_WINDOW_TEXT: {
size: 43,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
BUTTON_TEXT: {
size: 58,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
SMALL_TEXT: {
size: 30,
color: cleverapps.styles.COLORS.WHITE,
shadow: cleverapps.styles.DECORATORS.WHITE_TEXT_SHADOW
},
VERY_BIG_TEXT: {
size: 100,
color: cleverapps.styles.COLORS.COLOR_VICTORY,
shadow: cleverapps.styles.DECORATORS.WHITE_TEXT_SHADOW
},
WINDOW_BIG_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
WINDOW_TITLE_TEXT: {
size: 65,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_3PX
},
NOBG_WINDOW_TITLE_TEXT: {
size: 65,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_3PX
},
FRIEND_REQUEST_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_3PX
},
MENUBAR_TEXT: {
size: 42
},
PASS_TICKET_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
PASS_PROGRESS_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
shadow: cleverapps.styles.DECORATORS.WHITE_TEXT_SHADOW
},
DAILY_TASKS_BAR: {
size: 45
},
DAILY_TASK_PROGRESS_FONT: {
size: 38
},
DAILY_CUP_TITLE_TEXT: {
size: 80,
color: cleverapps.styles.COLORS.WHITE,
shadow: cleverapps.styles.DECORATORS.TITLE_TEXT_SHADOW
},
DAILY_TASKS_TIMER_TEXT: {
size: 43,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
stroke: void 0,
shadow: void 0
},
SMALL_TEXT_ERROR: {
size: 32,
color: cleverapps.styles.COLORS.DARK_RED,
stroke: void 0
},
LOSE_WINDOW_TEXT: {
color: cleverapps.styles.COLORS.WHITE,
size: 60
},
LOSE_WINDOW_TITLE_TEXT: {
color: cleverapps.styles.COLORS.WHITE,
size: 70
},
TILE_SHOP_OFFER_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
REWARDS_LIST_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
BREAK_AMOUNT_TEXT: {
name: "default",
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
FORCE_MESSAGE_TEXT: {
size: 52,
color: cleverapps.styles.COLORS.COLOR_FORCE_MESSAGE_TEXT
},
SHOP_WINDOW_LIVES_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
SUBSCRIPTION_PRIZE_SUBTITLE: {
size: 60
},
SUBSCRIPTION_MAIN_TEXT: {
size: 48,
color: cleverapps.styles.COLORS.WHITE
},
SUBSCRIPTION_BUTTON_TITLE: {
size: 36,
color: cleverapps.styles.COLORS.WHITE
},
TERMS_TEXT: {
size: 32,
color: cleverapps.styles.COLORS.WHITE
},
TERMS_LINK_TEXT: {
size: 32,
color: new cc.Color(200,200,200,200)
},
BADGE_TEXT: {
size: 33,
color: cleverapps.styles.COLORS.WHITE
},
KNOCKOUT_WINDOW_COUNTDOWN_TEXT: {
size: 70,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
ROW_DATA_TEXT: {
size: 38,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
ROW_PLAYER_TEXT: {
size: 38,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
ROW_TEXT: {
size: 38,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
DIALOGUE_PERSON_TITLE_TEXT: {
size: 52,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.DIALOGUE_PERSON_TITLE_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.DIALOGUE_PERSON_TITLE_TEXT_SHADOW
},
PACKWINDOW_LABEL_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
LEVEL_TITLE_TEXT: {
name: "nostroke",
size: 45,
color: new cc.Color(48,83,120,255)
},
LEVEL_CURRENT_TITLE_TEXT: {
size: 45
},
LEVEL_NOT_PASSED_TITLE_TEXT: {
name: "nostroke",
size: 45,
color: new cc.Color(95,95,95,255)
},
LEVEL_PASSED_TITLE_TEXT: {
size: 45
},
VIPREWARDEDWINDOW_DESCRIPTION_TEXT: {
size: 56
},
VIPREWARDEDWINDOW_NOTE_TEXT: {
size: 38
},
PROLONG_BUTTON_AMOUNT_TEXT: {
size: 48,
color: cleverapps.styles.COLORS.WHITE
},
DAILY_TASK_FONT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
DAILY_TASK_REWARD_FONT: {
size: 36,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
DAILY_TASK_CTA: {
size: 43,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
GUIDE_WINDOW_STAGE_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE
},
GUIDEWINDOW_DESCRIPTION_TEXT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
lineHeight: 60
},
LIGHT_TITLE_TEXT: {
size: 42,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX,
shadow: void 0
},
LEVEL_REWARD_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_BROWN
},
SHOP_USER_GOLD_TEXT: {
name: "nostroke",
size: 33,
color: cleverapps.styles.COLORS.COLOR_FORCE_MESSAGE_TEXT
},
BONUSBG_TITLE: {
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
BONUS_WORLD_WINDOW_TEXT: {
size: 45,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
MENUBAR_LEVEL_TEXT: {
size: 66
},
HERO_ABILITIES_TEXT: {
size: 43,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
HERO_UPGRADE: {
size: 43,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
HERO_STATS_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
SHOP_LIVES_PRODUCT_TILE_DESCRIPTION_TEXT: {
size: 41,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
EXP_INFO_WINDOW_AMOUNT_TEXT: {
size: 47,
color: cleverapps.styles.COLORS.WHITE
},
LANTERN_TIMER_FONT: {
size: 43,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
MISSION_WINDOW_COUNTDOWN_TEXT: {
size: 43,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
FIGURE_DRAGON_LIVES_TEXT: {
size: 36,
color: cleverapps.styles.COLORS.WHITE
},
OPENCHESTWINDOW_TITLE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
stroke: void 0,
shadow: void 0
},
SUPPLIES_WINDOW_TEXT: {
name: "nostroke",
size: 47,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
SUPPLIES_PAPER_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
SUPPLIES_DAYS_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
SUPPLY_REWARD_TEXT: {
name: "stroke",
size: 48,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
SUPPLIES_BADGE: {
size: 30,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
BONUSSALE_PRODUCT_REWARD: {
name: "stroke",
size: 50,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
BOOSTER_BEFORE_AMOUNT_TEXT: {
name: "default",
size: 36
},
UNIT_PROB: {
size: 32,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT,
stroke: void 0,
shadow: void 0
},
UNIT_AMOUNT: {
size: 50,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.LIGHT_TEXT_STROKE,
shadow: cleverapps.styles.DECORATORS.LIGHT_TEXT_SHADOW
},
TILE_SHOP_BADGE_TEXT: {
size: 58,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
},
LEVELUPWINDOW_TITLE_TEXT: {
size: 100,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_3PX
},
TREASURE_STAGE_TEXT: {
size: 25,
color: cleverapps.styles.COLORS.WHITE
},
LIGHT_TEXT: {
size: 35,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR
},
BARREL_ADS_TITLE: {
size: 37,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
BARREL_ADS_ITEM_TITLE: {
size: 45,
color: cleverapps.styles.COLORS.BARREL_ADS_ITEM_TITLE_COLOR
},
NOTE_WINDOW_TEXT: {
color: cleverapps.styles.COLORS.DARK_BLUE_TEXT_COLOR
},
NOADS_BONUS_TEXT: {
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
size: 60
},
TRAVEL_BOOK_MESSAGE_TEXT: {
size: 28
},
CHAIN_SALE_CLAIMED: {
size: 55,
color: new cc.Color(203,3,150)
},
PRIZE_BAR_TEXT: {
size: 38
},
BOOSTERS_BEFORE_TEXT: {
size: 57,
color: cleverapps.styles.COLORS.COLOR_WINDOW_TEXT
},
LANTERN_START_COMPONENT_TEXT: {
size: 57,
lineHeight: 45,
color: cleverapps.styles.COLORS.LIGHT_TEXT_COLOR,
stroke: cleverapps.styles.DECORATORS.LANTERN_START_COMPONENT_STROKE
},
LANTERN_WINDOW_TEXT: {
size: 34,
color: cleverapps.styles.COLORS.DARK_BLUE_TEXT_COLOR
}
});
cleverapps.overrideStyles(cleverapps.styles.SubscriptionTile, {
width: 400,
height: 710,
content: {
y: {
align: "bottom",
dy: 50
},
margin: 20
},
icon: {
zOrder: 1,
y: -46,
bg: {
height: 230,
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 25
}
}
},
title: {
y: -23,
text: {
y: {
align: "center",
dy: 6
}
}
},
description: {
width: 360,
height: 180,
rowMargin: 3,
text: {
width: 270
},
x: 0,
y: 0
},
button: {
y: 4
}
});
cleverapps.styles.LivesProductTile && cleverapps.overrideStyles(cleverapps.styles.LivesProductTile, {
description: {
width: 350,
height: 100,
x: 0,
y: 10,
bg: {
width: 494,
height: 130
}
},
content: {
y: {
align: "bottom",
dy: 40
},
margin: 20
},
icon: {
y: 2,
bg: {
width: 360,
height: 290,
x: {
align: "center",
dx: 2
},
y: {
align: "center",
dy: 30
}
}
},
title: {
x: 6,
width: 446,
text: {
x: {
align: "center",
dx: -6
},
y: {
align: "center",
dy: 8
}
}
},
limit: {
y: -85
},
badge: {
x: {
align: "right",
dx: 40
},
y: {
align: "top",
dy: 35
}
}
});
cleverapps.overrideStyles(cleverapps.styles.ShopWindow, {
margin: {
x: 45,
y: 30
},
padding: {
x: 0,
top: 30,
bottom: 10
}
});
cleverapps.overrideStyles(cleverapps.styles.OfferProductTile, {
width: 400,
height: 710,
content: {
y: {
align: "bottom",
dy: 44
},
margin: 0
},
icon: {
y: -40,
bg: {
width: 350,
height: 290,
x: {
align: "center",
dx: 6
},
y: {
align: "center",
dy: 20
}
}
},
title: {
y: -7
},
description: {
y: 5,
paddingY: 42,
bg: void 0
}
});
cleverapps.overrideStyles(cleverapps.styles.PackProductTile, {
width: 400,
height: 710,
icon: {
y: -103,
bg: {
height: 238,
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 40
}
}
},
title: {
y: -52
},
description: {
width: 340,
height: 155,
y: -8,
bg: {
width: 360,
height: 175
}
},
button: {
y: 20
}
});
cleverapps.overrideStyles(cleverapps.styles.CoinsProductTile, {
width: 400,
height: 710,
button: {
y: 20
},
icon: {
bg: {
x: {
align: "center",
dx: 4
},
y: {
align: "center",
dy: 4
}
}
},
description: void 0
});
cleverapps.overrideStyles(cleverapps.styles.SoftCurrencyTile, {
width: 400,
height: 710,
button: {
y: 20
}
});
cleverapps.overrideStyles(cleverapps.styles.TileRewardsBlock, {
colMargin: 10,
paddingX: 10
});
cleverapps.overrideStyles(cleverapps.styles.TileIcon, {
wrap: {
dy: -5
},
sweetPack: {
wrap: {
dy: 2
}
},
jamPack: {
wrap: {
dy: 2
}
}
});
cleverapps.overrideStyles(cleverapps.styles.TileBadge, {
x: {
align: "center",
dx: 1
},
y: {
align: "center",
dy: 8
},
width: 110,
rotation: 20
});
cleverapps.overrideStyles(cleverapps.styles.TileButton, {
height: 100,
width: 290
});
cleverapps.overrideStyles(cleverapps.styles.BaseProductTile, {
height: 730,
width: 408,
title: {
width: 438,
x: 5,
y: 0,
text: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 8
}
}
},
badge: {
x: {
align: "right",
dx: 30
},
y: {
align: "top",
dy: 35
}
},
limit: {
y: -128
},
button: {
y: 10
},
content: {
y: {
align: "bottom",
dy: 34
},
margin: 50
},
icon: {
y: -10,
bg: {
width: 350,
height: 350
}
}
});
cleverapps.styles.UnitsShopTile && cleverapps.overrideStyles(cleverapps.styles.UnitsShopTile, {
width: 396,
height: 690,
leftText: {
y: {
align: "center",
dy: 280
}
},
guideButton: {
x: {
align: "center",
dx: -156
},
y: {
align: "center",
dy: 296
}
},
blockIcon: {
x: {
align: "center"
},
y: {
align: "center",
dy: 180
}
},
icon: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 380
},
bg: {
width: 350,
height: 295,
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 172
}
},
scale: 1
},
title: {
x: {
align: "center",
dx: 3
},
y: {
align: "center",
dy: -44
},
width: 430,
height: 111,
amount: {
x: {
align: "center"
},
y: {
align: "center",
dy: 10
}
}
},
description: {
x: {
align: "center"
},
y: {
align: "center",
dy: -148
},
width: 350,
height: 90
},
button: {
x: {
align: "center"
},
y: {
align: "center",
dy: -250
},
width: 280,
height: 104
}
});
cleverapps.styles.UnitsShopWindow && cleverapps.overrideStyles(cleverapps.styles.UnitsShopWindow, {
bottomLine: {
height: 102,
content: {
y: 4
}
},
cart: {
x: {
align: "center",
dx: -815
},
y: {
align: "center",
dy: 7
}
}
});
cleverapps.styles.UnitOnCell && cleverapps.overrideStyles(cleverapps.styles.UnitOnCell, {
ground: {
x: 3,
y: -60
}
});
cleverapps.styles.RoundTabs && cleverapps.overrideStyles(cleverapps.styles.RoundTabs, {
margin: 10
});
cleverapps.styles.UnitsShopCart && cleverapps.overrideStyles(cleverapps.styles.UnitsShopCart, {
topIcon: {
x: {
align: "center",
dx: 6
},
y: {
align: "center",
dy: -20
}
},
amountBlock: {
x: {
align: "right",
dx: -30
},
y: {
align: "bottom",
dy: 4
}
},
item: {
scale: .6,
firstItem: {
oneItem: {
x: {
align: "center",
dx: 12
},
y: {
align: "bottom",
dy: 85
}
},
twoItems: {
x: {
align: "center",
dx: -3
},
y: {
align: "bottom",
dy: 74
}
}
},
secondItem: {
x: {
align: "center",
dx: 18
},
y: {
align: "bottom",
dy: 100
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.LeadersWindow, {
window: {
decors: {
star: !0
}
}
});
cleverapps.overrideStyles(cleverapps.styles.DailyTasksWindow, {
tabs: {
x: {
align: "left",
dx: -123
}
}
});
cleverapps.styles.AchievementsTab && cleverapps.overrideStyles(cleverapps.styles.AchievementsTab, {
gridPadding: {
y: 15
},
margin: {
x: 15,
y: 15
},
scroll: {
paddingY: 160,
y: {
align: "center",
dy: -50
}
}
});
cleverapps.overrideStyles(cleverapps.styles.DailyTasksTab, {
padding: {
top: 100,
bottom: 40
},
margin: 10,
foreground: {
width: 842,
height: 600,
y: {
align: "center",
dy: 0
}
},
timer: {
padding: {
y: 10
}
}
});
cleverapps.overrideStyles(cleverapps.styles.SideBarIconView, {
lock: {
x: {
align: "right",
dx: 8
},
y: {
align: "bottom",
dy: 25
}
},
text: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -5
},
width: 150,
height: 45,
offsetY: -2
},
mark: {
x: {
align: "right",
dx: -20
},
y: {
align: "top",
dy: -20
}
}
});
cleverapps.overrideStyles(cleverapps.styles.MissionWindow, {
animation: {
width: 340,
height: 247,
x: -70
}
});
cleverapps.overrideStyles(cleverapps.styles.SelectFriendWindow, {
withFriends: {
friendContainer: {
Name: {
height: 30
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.BandButton, {
position: {
x: {
align: "right",
dx: -40
},
y: {
align: "top",
dy: 24
}
},
icon: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 36
}
}
});
cleverapps.overrideStyles(cleverapps.styles.LanternView, {
offset: {
x: 0,
y: 0
}
});
cleverapps.styles.BoosterBeforeView && cleverapps.overrideStyles(cleverapps.styles.BoosterBeforeView, {
width: 153,
height: 156,
textAvailable: {
y: {
align: "bottom",
dy: 4
},
width: 115,
bg: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -10
},
width: 146
}
},
price: {
height: 65
}
});
cleverapps.overrideStyles(cleverapps.styles.MinimalDialogue, {
person: {
margin: 30
},
text: {
maxHeight: 400,
arrow: {
left: {
x: {
align: "left",
dx: -33
},
y: {
align: "center",
dy: 0
}
},
right: {
x: {
align: "right",
dx: 30
},
y: {
align: "center",
dy: 0
}
}
},
padding: {
left: 30,
right: 30
},
verticalPadding: {
top: 15,
bottom: 20,
left: 20,
right: 20
}
}
});
cleverapps.overrideStyles(cleverapps.styles.DialogueView, {
widthPadding: 30,
arrow: {
y: {
align: "top",
dy: 41
}
},
text: {
padding: {
x: 50,
y: 50
},
verticalPadding: {
fromWallX: 30,
x: 30,
y: 40
}
}
});
cleverapps.overrideStyles(cleverapps.styles.DialoguePersonTitleView, {
text: {
y: {
align: "center",
dy: 3
},
padding: {
x: 25,
y: 15
}
}
});
cleverapps.overrideStyles(cleverapps.styles.ToolbarItemView, {
timer: {
bg: {
width: 114,
height: 30
}
},
reward: {
x: {
align: "center",
dx: 7
},
y: {
align: "bottom",
dy: 17
}
}
});
cleverapps.overrideStyles(cleverapps.styles.LevelPassWindow, {
progress: {
x: {
align: "right",
dx: -6
}
},
window: {
padding: {
top: 100,
bottom: 40
}
}
});
cleverapps.overrideStyles(cleverapps.styles.RateWindow, {
text: {
y: {
align: "center"
}
}
});
cleverapps.overrideStyles(cleverapps.styles.DailyTaskView, {
margin: 20,
padding: {
left: 35,
right: 35,
top: 20,
bottom: 20
},
icon: {
x: {
align: "left",
dx: 60
}
},
title: {
height: 80
},
titleAndRewards: {
width: 394,
height: 130,
x: {
align: "left",
dx: 2
},
y: {
align: "center",
dy: 3
},
wide: {
width: 606
}
},
progressBar: {
text: {
dy: -2
}
}
});
cleverapps.overrideStyles(cleverapps.styles.LoseWindow, {
content: {
padding: {
top: 20
}
},
life: {
width: 70,
height: 60
},
noBackground: !0
});
cleverapps.overrideStyles(cleverapps.styles.ToolbarView, {
margin: 12,
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 5
}
},
bg: {
height: 105,
offsetY: 0
}
});
cleverapps.overrideStyles(cleverapps.styles.MenuBarItem, {
noPlusDx: 0,
bg: {
width: 165,
minWidth: 165,
height: 60,
padding: {
right: 16
}
},
plusButton: {
offset: {
x: -16,
y: -6
}
},
icon: {
x: 0
},
attention: {
x: {
align: "right",
dx: 10
},
y: {
align: "bottom",
dy: -23
}
},
helpButton: {
width: 25
},
timer: {
icon: !1,
height: 44,
padding: {
x: 20
},
position: {
x: {
align: "center",
dx: 21
},
y: {
align: "bottom",
dy: -44
}
},
text: {
x: {
align: "center",
dx: 1
},
y: {
align: "center",
dy: 2
},
width: 85
}
}
});
cleverapps.overrideStyles(cleverapps.styles.MenuBarTextView, {
noColoredText: !0
});
cleverapps.overrideStyles(cleverapps.styles.Tabs, {
margin: 20,
buttons: {
width: 127,
height: 96,
padding: {
bottom: 15
}
},
attention: {
x: {
align: "left",
dx: -20
},
y: {
align: "top",
dy: -5
}
}
});
cleverapps.styles.UI.glyphScale = {
scale: .85
};
cleverapps.overrideStyles(cleverapps.styles.UI, {
Avatar: {
x: 4,
top: 4,
bottom: 8
}
});
cleverapps.overrideStyles(cleverapps.styles.SettingsWindow, {
button: {
margin: 10,
width: 400,
width2: 185,
width3: 120,
height: 104
},
loginButton: {
height: 104
},
window: {
padding: {
left: 40,
right: 40,
top: 120,
bottom: 40
}
}
});
cleverapps.overrideStyles(cleverapps.styles.CloseButton, {
x: {
align: "right",
dx: -12
},
y: {
align: "top",
dy: -12
}
});
cleverapps.overrideStyles(cleverapps.styles.Window, {
padding: {
x: 65,
top: 150,
bottom: 70
},
HelpButton: {
x: {
align: "left",
dx: 35
},
y: {
align: "top",
dy: -25
},
zOrder: 3
},
BottomButton: {
height: 104
},
Background: {
padding: {
x: 30,
y: 20
}
}
});
cleverapps.overrideStyles(cleverapps.styles.SideBarSlot, {
margin: 40,
padding: {
top: 150
}
});
cleverapps.styles.StarChestWindow && cleverapps.overrideStyles(cleverapps.styles.StarChestWindow, {
margin: 40,
chest: {
height: 300,
y: {
align: "center",
dy: 40
}
}
});
cleverapps.overrideStyles(cleverapps.styles.DailyTasksCompleteAllView, {
textLayout: {
width: "merge" === cleverapps.config.type ? 700 : 520
},
prize: {
y: {
align: "bottom",
dy: -14
}
},
prizePosition: {
x: {
align: "right",
dx: 50
},
y: {
align: "center",
dy: 16
}
},
padding: {
left: 50,
right: 50
},
icon: {
dy: -10
}
});
cleverapps.overrideStyles(cleverapps.styles.PrizeBarComponent, {
progressBar: {
barText: {
dy: -2
}
},
prize: {
x: {
align: "right",
dx: 50
},
y: {
align: "center",
dy: 6
}
},
mark: {
x: {
align: "right",
dx: 20
},
y: {
align: "center",
dy: 0
}
},
button: {
y: {
align: "center",
dy: -2
}
}
});
cleverapps.overrideStyles(cleverapps.styles.DailyCupView, {
title: {
width: 500,
height: 97,
bg: {
x: {
align: "center"
},
y: {
align: "center",
dy: -15
}
},
text: {
width: 360,
y: {
align: "center",
dy: -7
}
}
},
playButton: {
width: 300,
height: 100
},
finishedText: {
width: 500
}
});
cleverapps.styles.BackgroundsWindow && cleverapps.overrideStyles(cleverapps.styles.BackgroundsWindow, {
padding: {
x: -70
},
tape: {
x: {
align: "right",
dx: 18
}
},
item: {
bg: {
padding: {
x: 10,
y: 10
}
}
}
});
cleverapps.styles.ExtendUnlimitedLivesWindow && cleverapps.overrideStyles(cleverapps.styles.ExtendUnlimitedLivesWindow, {
animation: {
height: 300
}
});
cleverapps.styles.CookieJarView && cleverapps.overrideStyles(cleverapps.styles.CookieJarView, {
scale: .6
});
cleverapps.overrideStyles(cleverapps.styles.ShopUserGoldView, {
items: {
boosters: {
dy: 0
}
}
});
cleverapps.overrideStyles(cleverapps.styles.ConfirmExitWindow, {
animation: {
width: 200,
height: 200
}
});
cleverapps.styles.LanternWindow && cleverapps.overrideStyles(cleverapps.styles.LanternWindow, {
margin: 20,
window: {
padding: {
top: 135,
x: 55
}
},
timer: {
y: {
align: "top",
dy: -5
}
},
bonuses: {
margin: 3,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 30
},
bonusBg: {
width: 168,
height: 168
},
amount: {
x: {
align: "right",
dx: -7
},
y: {
align: "bottom",
dy: 7
},
bg: {
x: {
align: "center"
},
y: {
align: "center",
dy: -5
},
width: 86,
height: 86
}
}
},
text: {
width: 620,
height: 130
},
animation: {
y: 12
}
});
cleverapps.styles.ProlongationOfferView && cleverapps.overrideStyles(cleverapps.styles.ProlongationOfferView, {
button: {
height: 100
}
});
cleverapps.overrideStyles(cleverapps.styles.WindowTitle.Types, {
bg_window: {
background: void 0,
position: {
y: {
align: "top",
anchor: !1,
dy: -80
}
},
textPosition: {
y: {
align: "center",
dy: 32
}
},
helpButton: {
x: {
align: "left",
dx: 40
},
y: {
align: "center",
dy: 15
},
padding: {
x: 30
}
}
},
nobg_window: {
padding: {
x: 140
},
textPosition: {
x: {
align: "center"
},
y: {
align: "center",
dy: 12
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.CrossPromoWindow, {
button: {
width: 250,
height: 100
},
badge: {
dy: -37,
rotation: 30,
price: {
dx: 12,
dy: 4
}
}
});
cleverapps.overrideStyles(cleverapps.styles.NotificationView, {
progress: {
height: 52
}
});
cleverapps.overrideStyles(cleverapps.styles.AdBlockWindow, {
window: {
padding: {
top: 160
}
}
});
cleverapps.styles.ExtraWindow && cleverapps.overrideStyles(cleverapps.styles.ExtraWindow, {
window: {
padding: {
top: 100,
bottom: 80
},
CloseButton: {
x: {
align: "right",
dx: 20
},
y: {
align: "top",
dy: 20
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.LevelStartWindow, {
padding: {
top: 30
},
lanternStart: {
margin: 25,
padding: {
left: -25,
right: -25,
top: 5
},
coinBadge: {
label: {
anchor: {
x: .5,
y: .5
},
x: {
align: "center"
},
y: {
align: "center"
},
bonusText: {
width: 150,
height: 95
}
},
x: {
align: "right",
dx: 0
},
y: {
align: "bottom",
dy: 164
}
}
}
});
"match3" === cleverapps.config.type && cleverapps.overrideStyles(cleverapps.styles.LevelStartWindow, {
hardLevel: {
x: {
align: "right",
dx: -50
},
y: {
align: "bottom",
dy: 50
}
}
});
cleverapps.overrideStyles(cleverapps.styles.PassBuyTicketWindow, {
margin: 30,
rewards: {
icon: {
dy: 13
}
},
badge: {
x: {
align: "left",
dx: -46
},
y: {
align: "top",
dy: 6
}
}
});
cleverapps.overrideStyles(cleverapps.styles.LevelView, {
clickSize: {
width: 165,
height: 165
},
LevelId: {
x: {
dx: 5
},
y: {
dy: -5
},
scale: .75
},
prize: {
x: {
align: "center",
dx: 10
},
y: {
align: "top",
dy: 180
}
}
});
cleverapps.styles.ShortMetaProgressView && cleverapps.overrideStyles(cleverapps.styles.ShortMetaProgressView, {
dy: 195,
margin: {
x: 20,
y: 30,
mobileY: 50
}
});
cleverapps.overrideStyles(cleverapps.styles.UpMenuContainer, {
controlButtons: {
y: {
align: "center",
dy: 0
}
}
});
cleverapps.styles.MenuBarGameLevelView && cleverapps.overrideStyles(cleverapps.styles.MenuBarGameLevelView, {
margin: -33,
value: {
offset: {
x: -2,
y: -4
}
},
exp: {
offset: {
x: 16,
y: 0
},
padding: {
x: 80,
y: 5
}
},
crown: {
offset: {
y: -18
}
}
});
cleverapps.styles.HintButtonBooster && cleverapps.overrideStyles(cleverapps.styles.HintButtonBooster, {
content: {
layout: {
y: {
align: "center",
dy: 6
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.RestoreProgressButton, {
content: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 8
}
}
});
cleverapps.styles.QuestIcon && cleverapps.overrideStyles(cleverapps.styles.QuestIcon, {
progress: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -2
},
text: {
x: {
align: "center"
},
y: {
align: "center",
dy: -2
}
}
}
});
cleverapps.styles.StartQuestWindow && cleverapps.overrideStyles(cleverapps.styles.StartQuestWindow, {
tile: {
icon: {
x: {
align: "center",
dx: -240
},
y: {
align: "center",
dy: -40
},
scale: 1.4
},
task: {
x: {
align: "center",
dx: 140
},
y: {
align: "center",
dy: -40
},
width: 480
}
}
});
cleverapps.styles.UnitsLibraryWindow && cleverapps.overrideStyles(cleverapps.styles.UnitsLibraryWindow, {
width: 1860,
height: 1060,
padding: {
x: 50,
y: 20
},
tabs: {
x: {
align: "left",
dx: -120
}
},
window: {
Foreground: {
padding: {
left: 0,
right: 0,
top: 0,
bottom: 0
}
}
}
});
cleverapps.styles.FamilyLayout && cleverapps.overrideStyles(cleverapps.styles.FamilyLayout, {
title: {
x: {
align: "center"
},
y: {
align: "top",
dy: 15
}
},
grid: {
x: {
align: "left"
},
y: {
align: "center",
dy: 0
}
}
});
cleverapps.styles.HeroesTab && cleverapps.overrideStyles(cleverapps.styles.HeroesTab, {
scroll: {
width: 1820
}
});
cleverapps.styles.TravelBookWindow && cleverapps.overrideStyles(cleverapps.styles.TravelBookWindow, {
window: {
padding: {
top: 100
}
}
});
cleverapps.styles.HeroDetailsLayout && cleverapps.overrideStyles(cleverapps.styles.HeroDetailsLayout, {
height: 560,
buttonInfo: {
x: {
align: "right",
dx: -10
},
y: {
align: "top",
dy: -10
}
},
infoHeroText: {
x: {
align: "center"
},
y: {
align: "center",
dy: 20
}
},
grid: {
width: 1712,
x: {
align: "left",
dx: 24
},
y: {
align: "center",
dy: -28
}
}
});
cleverapps.styles.UnitLibraryIcon && (cleverapps.overrideStyles(cleverapps.styles.UnitLibraryIconBg, {
width: 240,
height: 320,
title: {
x: {
align: "center"
},
y: {
align: "center",
dy: 105
}
}
}),
cleverapps.overrideStyles(cleverapps.styles.UnitLibraryIconFooter, {
width: 200,
height: 100,
collectButton: {
height: 63,
type: cleverapps.styles.UI.Button.Images.small_button_green
}
}));
cleverapps.styles.OrdersWindow && cleverapps.overrideStyles(cleverapps.styles.OrdersWindow, {
width: 1240,
roof: {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 0
},
width: 1380,
marquise: {
x: 30,
y: 0
},
title: {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 28
},
width: 500
}
},
Background: {
image: bundles.orderswindow.frames.ow_window_background
},
tabs: {
x: {
align: "left",
dx: -20
},
y: {
align: "top",
dy: 88
},
direction: cleverapps.UI.HORIZONTAL,
width: 160,
height: 100,
margin: -10
}
});
cleverapps.styles.OrdersTab && cleverapps.overrideStyles(cleverapps.styles.OrdersTab, {
table: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -20
},
width: 1350,
height: 420
},
shelve: {
x: {
align: "center"
},
y: {
align: "center",
dy: -15
},
padding: 150
},
grid: {
x: {
align: "left",
dx: -24
},
y: {
align: "center",
dy: -250
},
width: 1286,
padding: {
x: 20,
y: 30
}
}
});
cleverapps.styles.OrderDetails && cleverapps.overrideStyles(cleverapps.styles.OrderDetails, {
width: 1200,
bucket: {
left: {
x: {
align: "center",
dx: -395
},
y: {
align: "center",
dy: -16
}
},
right: {
x: {
align: "center",
dx: 400
},
y: {
align: "center",
dy: -16
}
},
width: 500
},
button: {
x: {
align: "center",
dx: 5
},
y: {
align: "center",
dy: -80
},
width: 300,
height: 104
},
ingredients: {
x: {
align: "center",
dx: -400
},
y: {
align: "bottom",
dy: 52
}
},
rewards: {
x: {
align: "center",
dx: 390
},
y: {
align: "bottom",
dy: 70
}
}
});
cleverapps.styles.IngredientOrderIcon && cleverapps.overrideStyles(cleverapps.styles.IngredientOrderIcon, {
text: {
width: 130,
x: {
align: "center",
dx: -100
},
y: {
align: "bottom",
dy: -10
}
}
});
cleverapps.styles.OrderIcon && cleverapps.overrideStyles(cleverapps.styles.OrderIcon, {
width: 222,
highlight: {
border: 20
},
button: {
type: cleverapps.styles.UI.Button.Images.small_button_green
},
pin: {
x: {
align: "center",
dx: -80
},
y: {
align: "top",
dy: 0
},
rotation: 0,
icon: {
x: {
align: "center"
},
y: {
align: "center",
dy: 20
}
}
},
ingredients: {
width: 184
},
timer: {
x: {
align: "left",
dx: -6
},
y: {
align: "top",
dy: 14
},
background: {
x: {
align: "center",
dx: 28
},
y: {
align: "top",
dy: -13
},
margin: -2
}
},
rewards: {
width: 184,
x: {
align: "center"
},
y: {
align: "center",
dy: 20
}
}
});
cleverapps.styles.SpeedUpWindow && cleverapps.overrideStyles(cleverapps.styles.SpeedUpWindow, {
timer: {
button: {
height: 99
}
},
buttons: {
padding: {
bottom: 10
},
button: {
width: 340,
height: 104
}
}
});
cleverapps.styles.TreasureSearchView && cleverapps.overrideStyles(cleverapps.styles.TreasureSearchView, {
size: [{
width: 886,
height: 1050
}, {
width: 886,
height: 1050
}, {
width: 886,
height: 1050
}],
header: {
y: {
align: "top",
dy: 2
}
},
goalBlock: {
g: {
positions: [{
x: {
align: "center",
dx: 68
},
y: {
align: "top",
dy: -101
}
}, {
x: {
align: "center",
dx: 68
},
y: {
align: "top",
dy: -101
}
}, {
x: {
align: "center",
dx: 68
},
y: {
align: "top",
dy: -101
}
}],
scale: .47
},
h: {
positions: [{
x: {
align: "center",
dx: -4
},
y: {
align: "top",
dy: -49
}
}, {
x: {
align: "center",
dx: -4
},
y: {
align: "top",
dy: -49
}
}, {
x: {
align: "center",
dx: -4
},
y: {
align: "top",
dy: -49
}
}],
scale: .34
},
j: {
positions: [{
x: {
align: "center",
dx: -83
},
y: {
align: "top",
dy: -106
}
}, {
x: {
align: "center",
dx: -83
},
y: {
align: "top",
dy: -106
}
}, {
x: {
align: "center",
dx: -83
},
y: {
align: "top",
dy: -106
}
}],
scale: .32
},
k: {
positions: [{
x: {
align: "center",
dx: -8
},
y: {
align: "top",
dy: -165
}
}, {
x: {
align: "center",
dx: -8
},
y: {
align: "top",
dy: -165
}
}, {
x: {
align: "center",
dx: -8
},
y: {
align: "top",
dy: -165
}
}],
rotation: 90,
scale: .26
}
},
progress: {
bg: {
size: [{
width: 986,
height: 170
}, {
width: 986,
height: 170
}, {
width: 986,
height: 170
}],
positions: [{
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -284
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -284
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -284
}
}]
},
progressBar: {
width: 730,
positions: [{
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 14
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 14
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 14
}
}]
},
currentStage: {
width: 140,
height: 170,
dy: -2
},
chestBlock: {
margins: {
vertical: 90,
horizontal: 90
},
positions: [{
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 10
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 10
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 10
}
}],
text: {
y: {
align: "center",
dy: -60
}
}
}
},
miningTool: {
bg: {
width: 92,
height: 160,
positions: [{
x: {
align: "right",
dx: 98
},
y: {
align: "center",
dy: 0
}
}, {
x: {
align: "right",
dx: 98
},
y: {
align: "center",
dy: 0
}
}, {
x: {
align: "right",
dx: 98
},
y: {
align: "center",
dy: 0
}
}]
},
icon: {
x: {
align: "center",
dx: 1
},
y: {
align: "top",
dy: -11
}
},
amountBg: {
width: 75,
height: 45,
x: {
align: "center",
dx: -4
}
}
},
ads: {
positions: [{
x: {
align: "left",
dx: -21
},
y: {
align: "bottom",
dy: -22
}
}, {
x: {
align: "left",
dx: -21
},
y: {
align: "bottom",
dy: -22
}
}, {
x: {
align: "left",
dx: -21
},
y: {
align: "bottom",
dy: -22
}
}]
},
scroll: {
size: [{
width: 988,
height: 745
}, {
width: 988,
height: 745
}, {
width: 988,
height: 745
}],
positions: [{
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -397
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -397
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -397
}
}]
},
shadow: {
size: [{
width: 986,
height: 1140
}, {
width: 986,
height: 1140
}, {
width: 986,
height: 1140
}],
positions: [{
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 0
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 0
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: 0
}
}],
zOrder: 99
}
});
cleverapps.styles.TreasureSearchCellView && cleverapps.overrideStyles(cleverapps.styles.TreasureSearchCellView, {
width: 143,
height: 143
});
cleverapps.styles.TreasureSearchWindow && cleverapps.overrideStyles(cleverapps.styles.TreasureSearchWindow, {
content: {
y: {
align: "top",
dy: 52
}
},
timer: {
positions: [{
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -35
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -35
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -35
}
}]
},
winBg: {
width: 986,
height: 840,
y: {
align: "bottom",
dy: -39
},
pattern: {
padding: {
bottom: 30
}
}
}
});
cleverapps.styles.SuppliesWindow && cleverapps.overrideStyles(cleverapps.styles.SuppliesWindow, {
window: {
padding: {
bottom: 60
}
},
size: [{
width: 800,
height: 1150
}, {
width: 1270,
height: 660
}, {
width: 1270,
height: 660
}],
text: {
width: 750,
positions: [{
x: {
align: "center"
},
y: {
align: "center",
dy: -85
}
}, {
x: {
align: "center",
dx: 210
},
y: {
align: "top",
dy: -105
}
}, {
x: {
align: "center",
dx: 210
},
y: {
align: "top",
dy: -105
}
}]
},
textWithTimer: {
positions: [{
x: {
align: "center"
},
y: {
align: "bottom",
dy: -20
}
}, {
x: {
align: "center",
dx: 200
},
y: {
align: "bottom",
dy: 5
}
}, {
x: {
align: "center",
dx: 200
},
y: {
align: "bottom",
dy: 5
}
}]
},
paper: {
positions: [{
x: {
align: "center"
},
y: {
align: "top",
dy: -15
}
}, {
x: {
align: "left",
dx: 10
},
y: {
align: "center",
dy: -55
}
}, {
x: {
align: "left",
dx: 10
},
y: {
align: "center",
dy: -55
}
}]
},
daysLayout: {
positions: [{
x: {
align: "center",
dx: -8
},
y: {
align: "bottom",
dy: 50
}
}, {
x: {
align: "center",
dx: 200
},
y: {
align: "center",
dy: -40
}
}, {
x: {
align: "center",
dx: 200
},
y: {
align: "center",
dy: -40
}
}]
},
strikethrough: {
positions: [{
x: {
align: "center"
},
y: {
align: "bottom",
dy: -15
}
}, {
x: {
align: "center",
dx: 40
},
y: {
align: "bottom",
dy: 5
}
}, {
x: {
align: "center",
dx: 40
},
y: {
align: "bottom",
dy: 5
}
}]
},
button: {
positions: [{
x: {
align: "center"
},
y: {
align: "bottom",
dy: -210
}
}, {
x: {
align: "center",
dx: 40
},
y: {
align: "bottom",
dy: -200
}
}, {
x: {
align: "center",
dx: 40
},
y: {
align: "bottom",
dy: -200
}
}],
badge: {
y: {
align: "center",
dy: 26
},
text: {
x: {
align: "center",
dx: 12
},
y: {
align: "center",
dy: 4
},
height: 64
}
}
}
});
cleverapps.styles.SupplyPaperView && cleverapps.overrideStyles(cleverapps.styles.SupplyPaperView, {
title: {
size: [{
width: 420
}, {
width: 420
}, {
width: 420
}],
positions: [{
x: {
align: "center"
},
y: {
align: "top",
dy: 44
}
}, {
x: {
align: "center"
},
y: {
align: "top",
dy: 43
}
}, {
x: {
align: "center"
},
y: {
align: "top",
dy: 43
}
}],
text: {
width: 300,
height: 70,
positions: [{
x: {
align: "center",
dx: -4
},
y: {
align: "center",
dy: 4
}
}, {
x: {
align: "center",
dx: -4
},
y: {
align: "center",
dy: 4
}
}, {
x: {
align: "center",
dx: -4
},
y: {
align: "center",
dy: 4
}
}]
}
},
rewards: {
positions: [{
x: {
align: "center"
},
y: {
align: "center",
dy: -18
}
}, {
x: {
align: "center"
},
y: {
align: "center",
dy: -10
}
}, {
x: {
align: "center"
},
y: {
align: "center",
dy: -10
}
}],
size: [{
width: 750,
height: 460
}, {
width: 370,
height: 450
}, {
width: 370,
height: 450
}],
margin: [{
x: 100,
y: 40
}, {
y: 0
}, {
y: 0
}]
},
decor: !1
});
cleverapps.styles.SupplyDayView && cleverapps.overrideStyles(cleverapps.styles.SupplyDayView, {
title: {
y: {
align: "top",
dy: -25
},
lineBreak: !0
},
last: {
title: {
y: {
align: "center",
dy: 2
},
lineBreak: !0
}
}
});
cleverapps.styles.PromotionSaleWindow && cleverapps.overrideStyles(cleverapps.styles.PromotionSaleWindow[Offers.TYPES.PROMOTION_SALE], {
title: {
y: {
align: "center",
dy: 424
},
width: 390
},
description: {
y: {
align: "bottom",
dy: 35
}
},
header: {
y: {
align: "center",
dy: -15
}
},
lots: {
marginX: 0,
padding: {
top: 130
}
}
});
cleverapps.styles.PromotionSaleLot && cleverapps.overrideStyles(cleverapps.styles.PromotionSaleLot[Offers.TYPES.PROMOTION_SALE], {
height: 640,
reward: {
width: 380,
height: 443,
y: {
align: "center",
dy: 60
},
margin: {
x: 5,
y: 5
},
icons: {
y: {
align: "center",
dy: 10
},
wrap: {
width: 150,
height: 150
}
}
},
badge: {
x: {
align: "right",
dx: 0
},
y: {
align: "top",
dy: -17
},
text: {
x: {
align: "center",
dx: 3
},
y: {
align: "center",
dy: 3
},
width: 100,
height: 80
}
},
button: {
y: {
align: "bottom",
dy: 45
}
}
});
cleverapps.styles.ChainSaleLot && cleverapps.overrideStyles(cleverapps.styles.ChainSaleLot, {
button: {
SKIP_RESOLUTION: {
padding: {
left: .3,
right: .3,
top: .03,
bottom: .2
}
}
}
});
cleverapps.styles.TextWithIcon && cleverapps.overrideStyles(cleverapps.styles.TextWithIcon, {
margin: 4
});
cleverapps.styles.ChestPrizeProbWindow && cleverapps.overrideStyles(cleverapps.styles.ChestPrizeProbWindow, {
prize: {
probText: {
y: {
align: "bottom",
dy: 4
}
}
}
});
cleverapps.styles.OpenChestWindow && cleverapps.overrideStyles(cleverapps.styles.OpenChestWindow, {
padding: {
top: 160
},
showAd: {
buttons: {
padding: {
top: -10,
bottom: 20
},
margin: 40
}
},
chest: {
scale: 1.4,
margin: 10,
extra: {
scale: 1.2
}
}
});
cleverapps.styles.SellUnitWindow && cleverapps.overrideStyles(cleverapps.styles.SellUnitWindow, {
icon: {
scale: 1.3
}
});
cleverapps.overrideStyles(cleverapps.styles.LoadingAnimation, {
text: {
x: {
align: "center"
},
y: {
align: "center",
dy: -125
},
width: 240
}
});
cleverapps.overrideStyles(cleverapps.styles.GameMessageView, {
showAnimation: "fromCenter"
});
(function() {
[cleverapps.styles.UI.Button.Images.button_green, cleverapps.styles.UI.Button.Images.button_blue, cleverapps.styles.UI.Button.Images.button_red, cleverapps.styles.UI.Button.Images.button_purple].forEach(function(a) {
cleverapps.overrideStyles(a, {
SKIP_RESOLUTION: {
padding: {
left: .3,
right: .3,
top: .1,
bottom: .25
}
}
})
});
[cleverapps.styles.UI.Button.Images.small_button_blue, cleverapps.styles.UI.Button.Images.small_button_green, cleverapps.styles.UI.Button.Images.field_button_green, cleverapps.styles.UI.Button.Images.field_button_blue].forEach(function(a) {
cleverapps.overrideStyles(a, {
SKIP_RESOLUTION: {
padding: {
left: .3,
right: .3,
top: .02,
bottom: .15
}
}
})
})
}
)();
cleverapps.styles.ChainSaleWindow && cleverapps.overrideStyles(cleverapps.styles.ChainSaleWindow, {
bg: {
positions: [{
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -90
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -40
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -40
}
}]
}
});
cleverapps.styles.StickersBookWindow && cleverapps.overrideStyles(cleverapps.styles.StickersBookWindow, {
size: [{
width: 900,
height: 1200
}, {
width: 1500,
height: 1090
}, {
width: 1500,
height: 1090
}],
scroll: {
size: [{
width: 860,
height: 975
}, {
width: 1490,
height: 1100
}, {
width: 1490,
height: 1100
}],
position: [{
x: {
align: "center"
},
y: {
align: "center",
dy: -110
}
}, {
x: {
align: "center"
},
y: {
align: "center",
dy: -85
}
}, {
x: {
align: "center"
},
y: {
align: "center",
dy: -85
}
}]
},
fg: void 0,
jokers: {
position: [{
x: {
align: "right",
dx: -34
},
y: {
align: "top",
dy: -95
}
}, {
x: {
align: "right",
dx: -42
},
y: {
align: "top",
dy: -97
}
}, {
x: {
align: "right",
dx: -42
},
y: {
align: "top",
dy: -97
}
}]
},
progressView: {
width: 350,
verticalWidth: 283,
position: [{
x: {
align: "center",
dx: 50
},
y: {
align: "top",
dy: -120
}
}, {
x: {
align: "center",
dx: 40
},
y: {
align: "top",
dy: -122
}
}, {
x: {
align: "center",
dx: 40
},
y: {
align: "top",
dy: -122
}
}],
joker: [{
x: {
align: "left",
dx: -50
},
y: {
align: "center"
}
}, {
x: {
align: "left",
dx: -20
},
y: {
align: "center"
}
}, {
x: {
align: "left",
dx: -20
},
y: {
align: "center"
}
}],
text: {
dy: -1
}
},
grid: {
margin: {
x: 2,
y: -5
},
padding: {
top: 30,
right: 10
}
},
collectionsAmount: {
position: [{
x: {
align: "left",
dx: 32
},
y: {
align: "top",
dy: -99
}
}, {
x: {
align: "left",
dx: 43
},
y: {
align: "top",
dy: -101
}
}, {
x: {
align: "left",
dx: 43
},
y: {
align: "top",
dy: -101
}
}]
},
stickersAmount: {
position: [{
x: {
align: "left",
dx: 248
},
y: {
align: "top",
dy: -131
}
}, {
x: {
align: "left",
dx: 300
},
y: {
align: "top",
dy: -100
}
}, {
x: {
align: "left",
dx: 300
},
y: {
align: "top",
dy: -100
}
}]
}
});
cleverapps.styles.StickersComponent && cleverapps.overrideStyles(cleverapps.styles.StickersComponent, {
fg: !1,
layout: {
margin: [{
x: 30,
y: 20
}, {
x: 30,
y: 20
}, {
x: 40,
y: 45
}],
x: {
align: "center"
},
y: {
align: "center",
dy: -90
}
}
});
cleverapps.styles.StickersCollectionWindow && (cleverapps.overrideStyles(cleverapps.styles.StickersCollectionWindow, {
size: [{
width: 1E3,
height: 1300
}, {
width: 1E3,
height: 1300
}, {
width: 1670,
height: 1020
}],
prize: {
width: 400,
position: [{
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -94
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -94
}
}, {
x: {
align: "center"
},
y: {
align: "top",
dy: -105
}
}]
},
jokers: {
position: [{
x: {
align: "right",
dx: -49
},
y: {
align: "top",
dy: -84
}
}, {
x: {
align: "right",
dx: -49
},
y: {
align: "top",
dy: -84
}
}, {
x: {
align: "right",
dx: -56
},
y: {
align: "top",
dy: -96
}
}]
},
text: {
dy: -1
}
}),
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
STICKERS_PROGRESS_BAR_TEXT: {
size: 38
},
STICKER_JOKER_BUTTON_TEXT: {
size: 80,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.TRANSPARENT_BLACK_2PX
}
}));
cleverapps.styles.StickerView && (cleverapps.overrideStyles(cleverapps.styles.StickerView, {
label: {
textBg: !1,
text: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 20
},
width: 240
}
},
image: {
x: {
align: "center"
},
y: {
align: "center",
dy: 30
}
},
tape: {
x: {
align: "center"
},
y: {
align: "top",
dy: 30
},
rotation: [-75, -75, 0]
}
}),
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
COLLECTION_WINDOW_TEXT: {
name: "default",
size: 45,
color: cleverapps.styles.COLORS.STICKER_LABEL_COLOR
}
}));
cleverapps.styles.StickersBookJokerView && cleverapps.overrideStyles(cleverapps.styles.StickersBookJokerView, {
bg: {
width: 135,
height: 60,
x: {
align: "right",
dx: -40
},
y: {
align: "center"
}
},
text: {
x: {
align: "center",
dx: -20
},
y: {
align: "center"
}
},
withBillet: !0
});
cleverapps.styles.StickersCollectionIcon && (cleverapps.overrideStyles(cleverapps.styles.StickersCollectionIcon, {
textBg: void 0,
title: {
maxWidth: 215,
maxHeight: 42,
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -27
},
unavailableOpacity: void 0
},
icon: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -20
}
},
prizebar: {
x: {
align: "center"
},
y: {
align: "center",
dy: 20
},
width: 160,
checkmark: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 10
}
},
text: {
dy: -1
},
button: {
y: {
align: "center",
dy: 15
}
}
},
margin: -10,
availableText: {
y: {
align: "center",
dy: 15
}
},
badge: {
x: {
align: "right",
dx: 20
},
y: {
align: "top",
dy: 10
}
}
}),
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
STICKERS_COLLECTION_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.WHITE
},
COLLECTION_BADGE_TEXT: {
size: 35
},
STICKERS_AVAILABLE_TEXT: {
size: 40,
color: cleverapps.styles.COLORS.STICKER_LABEL_COLOR
}
}));
cleverapps.styles.PrizeCalendarWindow && (cleverapps.overrideStyles(cleverapps.styles.PrizeCalendarWindow, {
bg: {
outerBg: {
width: 764,
height: 869,
x: {
align: "center"
},
y: {
align: "center",
dy: 8
}
},
innerBg: {
width: 739,
height: 844,
x: {
align: "center"
},
y: {
align: "center",
dy: 1
}
},
decorTopLeft: {
x: {
align: "left"
},
y: {
align: "top"
}
},
decorTopRight: {
x: {
align: "right"
},
y: {
align: "top"
}
},
decorBottomLeft: {
x: {
align: "left"
},
y: {
align: "bottom"
}
},
decorBottomRight: {
x: {
align: "right"
},
y: {
align: "bottom"
}
},
pattern: {
x: 1,
y: 0
}
},
margin: 0,
windowPadding: {
x: -18,
y: -2,
bottom: void 0
},
tiles: {
margin: {
x: 70,
y: 60
},
padding: {
x: 25,
y: 18
}
},
timerAtBottom: !0,
ticketAnimation: {
x: {
align: "center",
dx: 120
},
y: {
align: "center"
},
delay: {
reward: 1,
animation: .4
},
rewardNode: {
x: {
align: "center",
dx: 130
},
y: {
align: "center"
}
}
}
}),
cleverapps.overrideStyles(cleverapps.styles.PrizeCalendarTileView, {
ticketAnimation: !0,
collectDelay: 1.5,
titleBg: {
width: 130,
height: 50,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 30
}
},
outerBg: {
spine: {
json: bundles.prizecalendar.jsons.tile_json,
animations: {
last: "idle_gold_crown",
lastAvailable: "idle_gold_star_active",
locked: "idle_silver_padlock",
received: "idle_silver_star_check",
available: "idle_silver_star_active",
adsUnavailable: "idle_silver_star_active"
}
},
receiveAnimation: {
default: "silver_star_to_check",
last: "gold_star_to_check"
},
changeAnimation: {
lockedToAvailable: {
animation: "silver_padlock_to_star",
idle: "idle_silver_star_active"
},
availableToReceived: {
animation: "silver_star_to_check",
idle: "idle_silver_star_check"
},
lastToAvailable: {
animation: "idle_gold_star_active",
idle: "idle_gold_star_active"
},
lastToReceived: {
animation: "gold_star_to_check",
idle: "idle_gold_star_check"
},
dontWaitForAds: !0
},
x: {
align: "center"
},
y: {
align: "center"
}
},
mark: {
checkOnly: !0,
x: {
align: "center"
},
y: {
align: "center",
dy: -3
}
},
arrow: {
right: {
x: {
align: "right",
dx: 57
},
y: {
align: "center"
}
},
down: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: -55
}
},
left: {
x: {
align: "left",
dx: -56
},
y: {
align: "center"
}
}
}
}),
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
PRIZE_CALENDAR_TITLE: {
size: 54
}
}));
cleverapps.styles.BarrelAdsWindow && cleverapps.overrideStyles(cleverapps.styles.BarrelAdsWindow, {
contentMargin: 35,
item: {
height: 555,
buttonMargin: 25,
strip: {
x: {
align: "center",
dx: 7
},
y: {
align: "bottom",
dy: 104
}
},
title: {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 42
}
},
button: {
height: 103
}
},
styles: {
padding: {
top: 135,
bottom: 85
}
}
});
cleverapps.overrideStyles(cleverapps.styles.NoAdsWindow, {
width: 840,
height: 950,
window: {
padding: {
top: 125
}
},
footnote: {
y: {
align: "bottom",
dy: -90
},
underline: {
y: {
align: "bottom",
dy: -92
}
}
},
badge: {
scale: 1.2,
x: {
align: "right",
dx: 50
},
y: {
align: "top",
dy: -100
}
},
bonusnote: {
x: {
align: "center"
},
y: {
align: "top",
dy: -195
}
},
gift: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -10
}
}
});
cleverapps.styles.ExpeditionPageView && cleverapps.overrideStyles(cleverapps.styles.ExpeditionPageView, {
height: 620,
message: {
height: 82,
width: 220,
x: {
align: "center",
dx: 46
},
y: {
align: "top",
dy: -96
},
text: {
x: {
align: "center",
dx: -6
},
width: 220,
height: 70
},
icon: {
width: 70,
height: 70
},
iconBg: {
x: {
align: "left",
dx: -94
}
}
},
button: {
y: {
align: "bottom",
dy: 27
}
}
});
cleverapps.overrideStyles(cleverapps.styles.PassRewardIcon, {
icon: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -20
}
},
claimButton: {
height: 70,
y: {
align: "bottom",
dy: -90
}
},
text: {
x: {
align: "right",
dx: 6
},
y: {
align: "bottom",
dy: -17
}
},
attention: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: -80
}
}
});
cleverapps.overrideStyles(cleverapps.styles.PassHeader, {
decor: {
x: {
align: "center",
dx: -650
},
y: {
align: "center",
dy: 42
}
},
timer: {
margin: 40,
x: {
align: "center"
},
y: {
align: "center",
dy: 30
}
},
amount: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: -50
}
},
pack: {
x: {
align: "right",
dx: -115
},
y: {
align: "center",
dy: 40
}
}
});
cleverapps.overrideStyles(cleverapps.styles.ExpeditionPassHeader, {
title: {
x: {
align: "center"
},
y: {
align: "center",
dy: 55
}
},
amount: {
x: {
align: "center"
},
y: {
align: "center",
dy: -5
}
}
});
cleverapps.overrideStyles(cleverapps.styles.PassTicket, {
height: 600,
text: {
width: 250,
height: 90
},
icon: {
height: 270
},
premium: {
icon: {
height: 250
}
},
button: {
height: 70
}
});
cleverapps.overrideStyles(cleverapps.styles.PassProgress, {
tasks: {
taskPoint: {
numberDy: 2,
completedNumberDy: 5
},
premiumReward: {
y: {
align: "center",
dy: 228
}
},
reward: {
y: {
align: "center",
dy: -100
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.PassTickets, {
free: {
x: {
align: "center",
dx: -8
},
y: {
align: "center",
dy: -150
}
},
premium: {
x: {
align: "center",
dx: -5
},
y: {
align: "center",
dy: 160
}
}
});
cleverapps.overrideStyles(cleverapps.styles.BuildPassWindow, {
width: 1798,
height: 955,
progress: {
x: {
align: "right",
dx: -17
},
y: {
align: "center",
dy: -136
}
},
header: {
x: {
align: "center",
dx: -2
},
y: {
align: "top",
dy: -99
}
},
tickets: {
x: {
align: "left",
dx: 16
},
y: {
align: "center",
dy: -132
}
}
});
cleverapps.overrideStyles(cleverapps.styles.ExpeditionPassWindow, {
width: 1754,
header: {
x: {
align: "center"
},
y: {
align: "top",
dy: -70
},
zOrder: -1
},
progress: {
x: {
align: "right",
dx: -17
},
y: {
align: "bottom",
dy: -10
}
},
tickets: {
x: {
align: "left",
dx: 16
},
y: {
align: "center",
dy: -106
}
}
});
cleverapps.overrideStyles(cleverapps.styles.PassLastChanceWindow, {
premiumOfferBadge: {
x: {
align: "right",
dx: -22
},
y: {
align: "center",
dy: -130
},
rotation: 15
},
rewards: {
ribbon: {
x: {
align: "left",
dx: -12
},
y: {
align: "top",
dy: -12
}
},
text: {
x: {
align: "center",
dx: -10
},
y: {
align: "center",
dy: 18
},
width: 300,
height: 80,
rotation: 0
}
}
});
cleverapps.styles.LanternStartComponent && cleverapps.overrideStyles(cleverapps.styles.LanternStartComponent, {
bg: {
scale9: {
width: 583,
height: 280
}
},
lanternIcon: {
y: {
align: "center"
}
},
helpButton: {
x: {
align: "right",
dx: -11
},
y: {
align: "top",
dy: -11
},
scale: .8
},
label: {
width: 300,
height: 150,
x: {
align: "center",
dx: 100
},
y: {
align: "center",
dy: 45
}
},
progressBar: {
x: {
align: "center",
dx: 100
}
}
});
cleverapps.styles.BoostersBeforeComponent && cleverapps.overrideStyles(cleverapps.styles.BoostersBeforeComponent, {
lantern: {
boostersMargin: 35,
contentMargin: 15
}
});
cleverapps.styles.StickersShopItemView && (cleverapps.overrideStyles(cleverapps.styles.StickersShopItemView, {
size: [{
width: 870,
height: 420
}, {
width: 500,
height: 890
}, {
width: 500,
height: 890
}],
inner_bg: {
size: [{
width: 380,
height: 380
}, {
width: 460,
height: 350
}, {
width: 460,
height: 350
}],
position: [{
x: {
align: "left",
dx: 20
},
y: {
align: "center"
}
}, {
x: {
align: "center"
},
y: {
align: "top",
dy: -20
}
}, {
x: {
align: "center"
},
y: {
align: "top",
dy: -20
}
}]
},
image: {
position: [{
x: {
align: "left",
dx: 30
},
y: {
align: "center",
dy: -18
}
}, {
x: {
align: "center",
dx: 5
},
y: {
align: "center",
dy: 250
}
}, {
x: {
align: "center",
dx: 15
},
y: {
align: "center",
dy: 253
}
}]
},
button: {
size: [{
width: 270,
height: 100
}, {
width: 300,
height: 100
}, {
width: 300,
height: 100
}],
position: [{
x: {
align: "center",
dx: 180
},
y: {
align: "bottom",
dy: 30
}
}, {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 30
}
}, {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 30
}
}]
},
ribbon: {
size: [{
width: 460,
height: 110
}, {
width: 550,
height: 100
}, {
width: 550,
height: 100
}],
position: [{
x: {
align: "left",
dx: -10
},
y: {
align: "top",
dy: 35
}
}, {
x: {
align: "center",
dx: 12
},
y: {
align: "top",
dy: -376
}
}, {
x: {
align: "center",
dx: 12
},
y: {
align: "top",
dy: -376
}
}]
},
rewards: {
position: [{
x: {
align: "right",
dx: -10
},
y: {
align: "center",
dy: 50
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -470
}
}, {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -470
}
}],
box: [{
width: 400,
height: 220
}, {
width: 380,
height: 320
}, {
width: 380,
height: 320
}]
}
}),
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
STICKERS_SHOP_REWARD: {
color: cleverapps.styles.COLORS.WHITE
}
}));
cleverapps.styles.PackOfferComponent && cleverapps.styles.PackOfferComponent[Offers.TYPES.STICKERS_PACK] && cleverapps.overrideStyles(cleverapps.styles.PackOfferComponent[Offers.TYPES.STICKERS_PACK], {
pack: {
offsetY: 420,
badge: {
x: {
align: "right",
dx: 40
},
y: {
align: "top",
dy: 45
},
rotation: 30
}
},
tap: {
x: {
align: "center",
dx: 10
},
y: {
align: "center",
dy: -80
},
rotation: 0,
scaleX: 1
}
});
cleverapps.styles.QuestInfoView && cleverapps.overrideStyles(cleverapps.styles.QuestInfoView, {
size: {
default: {
height: 340
}
}
});
cleverapps.styles.OpenLetterButtonBooster && cleverapps.overrideStyles(cleverapps.styles.OpenLetterButtonBooster, {
width: 240,
height: 110,
position: [{
x: {
align: "right",
dx: -10
},
y: {
align: "center",
dy: 0
}
}, {
x: {
align: "right",
dx: -10
},
y: {
align: "top",
dy: -580
}
}, {
x: {
align: "right",
dx: -10
},
y: {
align: "top",
dy: -580
}
}],
content: {
margin: 20,
direction: cleverapps.UI.HORIZONTAL,
layout: {
x: {
align: "center",
dx: 3
},
y: {
align: "center",
dy: 5
}
}
}
});
var Goal = function(a, b) {
cleverapps.EventEmitter.call(this);
this.type = a.type;
this.target = a.target;
this.amount = b || 0;
this.getView = function() {}
};
Goal.prototype = Object.create(cleverapps.EventEmitter.prototype);
Goal.prototype.constructor = Goal;
Goal.prototype.getInfo = function() {
return this.amount
}
;
Goal.prototype.inc = function(a, b) {
this.setAmount(this.amount + (a || 1), b)
}
;
Goal.prototype.setAmount = function(a, b) {
a = Math.max(0, a);
this.withTarget() && (a = Math.min(this.target, a));
this.amount !== a && (b || this.trigger("update", a - this.amount),
this.amount = a,
this.checkCompleted(),
this.checkIncompleted())
}
;
Goal.prototype.collect = function(a, b, c) {
this.inc(a, !0);
c = c || {};
var d = c.callback || function() {}
;
this.onCollectFinished = function() {}
;
this.trigger("collect", a, b, Object.assign(c, {
callback: function() {
this.onCollectFinished && (this.onCollectFinished(),
delete this.onCollectFinished);
d()
}
.bind(this)
}))
}
;
Goal.prototype.onCollect = function(a) {
this.trigger("onCollect", a)
}
;
Goal.prototype.getRemaining = function() {
return Math.max(0, this.target - this.amount)
}
;
Goal.prototype.getAmount = function() {
return this.amount
}
;
Goal.prototype.getTarget = function() {
return this.target
}
;
Goal.prototype.isCompleted = function() {
return this.completed
}
;
Goal.prototype.checkCompleted = function() {
this.withTarget() && this.amount >= this.target && !this.isCompleted() && (this.completed = !0,
this.trigger("complete"))
}
;
Goal.prototype.checkIncompleted = function() {
this.amount < this.target && this.isCompleted() && (this.completed = !1,
this.trigger("incomplete"))
}
;
Goal.prototype.incTarget = function(a) {
this.target += a;
this.trigger("update");
this.checkCompleted();
this.checkIncompleted()
}
;
Goal.prototype.withTarget = function() {
return this.target !== Goal.NO_TARGET
}
;
Goal.prototype.showView = function() {
this.trigger("show")
}
;
Goal.NO_TARGET = -1;
var Goals = function(a, b) {
cleverapps.EventEmitter.call(this);
this.elements = {};
this.isDone = !1;
this.required = a.goals.length;
a.goals.forEach(function(c) {
var d = c.type
, e = Goal;
"match3" === cleverapps.config.type && (e = Match3Goal);
c = new e(c,b && b[d]);
this.elements[d] = c;
c.on("complete", this.onGoalComplete.bind(this), this);
c.on("incomplete", this.onGoalInComplete.bind(this), this);
c.checkCompleted()
}, this)
};
Goals.prototype = Object.create(cleverapps.EventEmitter.prototype);
Goals.prototype.constructor = Goals;
Goals.prototype.getInfo = function() {
var a = {}, b;
for (b in this.elements)
a[b] = this.elements[b].getInfo();
return a
}
;
Goals.prototype.onGoalComplete = function() {
this.required--;
0 === this.required && (this.isDone = !0)
}
;
Goals.prototype.onGoalInComplete = function() {
this.required++;
0 < this.required && (this.isDone = !1)
}
;
Goals.prototype.findTargetFor = function(a) {
return this.elements[a]
}
;
Goals.prototype.hasType = function(a) {
return void 0 !== this.elements[a]
}
;
Goals.prototype.incGoal = function(a, b) {
(a = this.findTargetFor(a)) && a.inc(b)
}
;
Goals.prototype.incTarget = function(a, b) {
(a = this.findTargetFor(a)) && a.incTarget(b)
}
;
Goals.prototype.whenCollectsFinished = function(a) {
var b = 0, c;
for (c in this.elements)
this.elements[c].onCollectFinished && b++;
if (0 === b)
a();
else
for (c in a = cleverapps.wait(b, a),
this.elements)
this.elements[c].onCollectFinished && (this.elements[c].onCollectFinished = a)
}
;
var Cell = function(a) {
cleverapps.EventEmitter.call(this);
this.x = a.x;
this.y = a.y;
a.color = void 0 !== a.color ? a.color : BlocksGame.COLOR_NONE;
this.setProperties(a)
};
Cell.prototype = Object.create(cleverapps.EventEmitter.prototype);
Cell.prototype.constructor = Cell;
Cell.prototype.getInfo = function() {
if (!this.isEmpty()) {
var a = {
color: this.color,
x: this.x,
y: this.y
};
void 0 !== this.mark && (a.mark = this.mark.getType());
a.components = this.components.map(function(b) {
return b.getInfo()
});
return a
}
}
;
Cell.prototype.setProperties = function(a) {
void 0 !== a.color && (this.color = a.color);
var b = a.mark;
void 0 !== b && (this.mark = new Mark(b));
this.components = (a.components || []).map(function(c) {
switch (c.name) {
case "ice":
return new IceOnCell(this,c)
}
}
.bind(this));
this.updateViewProperties({
fadeIn: a.fadeIn
})
}
;
Cell.prototype.resetProperties = function(a) {
this.color = BlocksGame.COLOR_NONE;
this.mark = void 0;
this.components.forEach(function(b) {
b.remove()
});
this.components = [];
a || this.updateViewProperties()
}
;
Cell.prototype.updateViewProperties = function(a) {
this.trigger("update", a)
}
;
Cell.prototype.isEmpty = function() {
return this.color === BlocksGame.COLOR_NONE
}
;
Cell.prototype.getColor = function() {
return this.color
}
;
Cell.prototype.getMark = function() {
return this.mark
}
;
Cell.prototype.getComponents = function() {
return this.components
}
;
Cell.prototype.getHover = function() {
return this.isHovered
}
;
Cell.prototype.setHover = function(a) {
this.isHovered = !0;
this.updateViewProperties(a)
}
;
Cell.prototype.resetHover = function() {
this.isHovered = !1;
this.updateViewProperties()
}
;
Cell.prototype.collectMark = function() {
void 0 !== this.mark && (this.mark.collect(),
this.mark = void 0,
this.trigger("collectMark"))
}
;
Cell.prototype.remove = function(a) {
this.resetProperties();
this.trigger("remove", a)
}
;
Cell.prototype.explode = function() {
for (var a = 0; a < this.components.length; a++)
if (this.components[a].explode())
return;
this.collectMark();
this.resetProperties()
}
;
Cell.prototype.isBlocked = function() {
return this.components.filter(function(a) {
return a.isBlocked()
}).length
}
;
Cell.prototype.removeComponent = function(a) {
for (var b = 0; b < this.components.length; b++)
if (this.components[b]instanceof a) {
this.components.splice(b, 1);
break
}
}
;
Cell.prototype.onFall = function(a) {
this.trigger("onFall", a.getView())
}
;
Cell.WIDTH = 100;
Cell.HEIGHT = 100;
var Grid = function(a, b) {
cleverapps.EventEmitter.call(this);
a = b || a.cells;
this.cells = [];
for (b = 0; b < Grid.HEIGHT; b++) {
this.cells.push([]);
for (var c = 0; c < Grid.WIDTH; c++)
this.cells[b].push(new Cell({
x: c,
y: b
}))
}
a && (this.addRegularMarks(a),
a.forEach(function(d) {
this.setCellProperties(d.x, d.y, d)
}
.bind(this)));
this.getView = function() {}
;
this.updatePiecesData = function() {}
};
Grid.prototype = Object.create(cleverapps.EventEmitter.prototype);
Grid.prototype.constructor = Grid;
cleverapps.config.debugMode && (Grid.prototype.onClick = function(a, b) {
var c = this.getCell(a, b)
, d = cleverapps.config.editorMode ? Editor.currentEditor.orangery : Game.currentGame.orangery;
if (d && d.selected) {
if (d.selected.form) {
c = new Piece(void 0,{
form: d.selected.form,
color: d.selected.color,
mark: d.selected.mark,
components: d.selected.components,
fromOrangery: !0
});
Game.currentGame.placePiece(c, a, b);
return
}
if (d.selected.eraser) {
c.isEmpty() || c.resetProperties();
return
}
if (void 0 !== d.selected.color) {
c.isEmpty() || c.setProperties({
color: d.selected.color
});
return
}
}
c.isEmpty() || c.explode(c.color)
}
);
Grid.prototype.addRegularMarks = function(a) {
cleverapps.config.editorMode || cleverapps.config.adminMode || Game.currentGame.getMissionType() !== Mission.TYPE_LETTER || (a = a.filter(function(b) {
return !b.mark
}),
cleverapps.Random.chooseAmount(a, Math.min(Math.floor(1 + .3 * a.length), a.length)).forEach(function(b) {
b.mark = "letter"
}))
}
;
Grid.prototype.clear = function(a) {
this.iterateCells(function(b) {
b.resetProperties(a)
})
}
;
Grid.prototype.hideGrid = function(a) {
this.trigger("hideGrid", a)
}
;
Grid.prototype.changeModeFrameColor = function(a) {
this.trigger("changeModeFrameColor", a)
}
;
Grid.prototype.placeFormErrors = function(a, b, c) {
if (b + a[0].length > Grid.WIDTH || c + a.length > Grid.HEIGHT)
return Infinity;
var d = 0;
Forms.convertFormToCoordinates(a).forEach(function(e) {
this.getCell(b + e.x, c + e.y).isEmpty() || d++
}, this);
return d
}
;
Grid.prototype.listFilledLines = function() {
var a = [], b, c;
for (b = 0; b < Grid.HEIGHT; b++) {
var d = !0;
for (c = 0; c < Grid.WIDTH; c++) {
var e = this.getCell(c, b);
if (e.isEmpty() && !e.getHover()) {
d = !1;
break
}
}
d && a.push(b)
}
d = [];
for (c = 0; c < Grid.WIDTH; c++) {
var f = !0;
for (b = 0; b < Grid.HEIGHT; b++)
if (e = this.getCell(c, b),
e.isEmpty() && !e.getHover()) {
f = !1;
break
}
f && d.push(c)
}
return {
rows: a,
columns: d
}
}
;
Grid.prototype.isInside = function(a, b) {
return 0 <= a && 0 <= b && a < Grid.WIDTH && b < Grid.HEIGHT
}
;
Grid.prototype.isEmpty = function() {
var a = !0;
this.iterateCells(function(b) {
b.isEmpty() || (a = !1)
});
return a
}
;
Grid.prototype.getCell = function(a, b) {
return this.cells[b] && this.cells[b][a]
}
;
Grid.prototype.setCellProperties = function(a, b, c) {
this.cells[b][a].setProperties(c)
}
;
Grid.prototype.iterateCells = function(a) {
for (var b = 0; b < Grid.HEIGHT; b++)
for (var c = 0; c < Grid.WIDTH; c++)
a(this.cells[b][c], c, b)
}
;
Grid.prototype.iterateByRowsOrColumns = function(a, b, c) {
a.forEach(function(d) {
for (var e = 0; e < Grid.WIDTH; e++)
c(this.cells[d][e])
}, this);
b.forEach(function(d) {
for (var e = 0; e < Grid.HEIGHT; e++)
c(this.cells[e][d])
}, this)
}
;
Grid.prototype.setExplodeHint = function(a, b, c) {
this.createExplodeHint(a, b, c);
this.iterateByRowsOrColumns(a, b, function(d) {
d.updateViewProperties({
color: c,
mark: d.getMark()
})
})
}
;
Grid.prototype.resetExplodeHint = function(a, b) {
this.iterateByRowsOrColumns(a, b, function(c) {
c.updateViewProperties()
});
this.trigger("resetExplodeHint")
}
;
Grid.prototype.explodeRowsOrColumns = function(a, b, c) {
this.iterateByRowsOrColumns(a, b, function(d) {
d.explode()
});
this.trigger("explode", a, b, c);
Game.currentGame.goalCounter.setTimeout(function() {}, Grid.EXPLODE_DURATION)
}
;
Grid.prototype.showCombo = function(a) {
this.trigger("showCombo", a)
}
;
Grid.prototype.showHint = function(a, b) {
this.trigger("showHint", a, b)
}
;
Grid.prototype.hideHint = function(a, b) {
this.trigger("hideHint", a, b)
}
;
Grid.prototype.createExplodeHint = function(a, b, c) {
if (!cleverapps.gameModes.hideExplodeHint) {
var d = [];
if (0 < a.length) {
var e = a[0];
var f = {
height: 1,
x: Grid.WIDTH / 2,
y: e
};
for (var g = 1; g < a.length; g++)
e + 1 === a[g] ? f.height += 1 : (d.push(f),
f = {
height: 1,
x: Grid.WIDTH / 2,
y: a[g]
}),
e = a[g];
d.push(f)
}
if (0 < b.length) {
e = b[0];
f = {
width: 1,
x: e,
y: Grid.HEIGHT / 2,
isVertical: !0
};
for (a = 1; a < b.length; a++)
e + 1 === b[a] ? f.width += 1 : (d.push(f),
f = {
width: 1,
x: b[a],
y: Grid.HEIGHT / 2,
isVertical: !0
}),
e = b[a];
d.push(f)
}
this.trigger("explodeHint", d, c)
}
}
;
Grid.prototype.getInfo = function() {
var a = [];
this.iterateCells(function(b) {
(b = b.getInfo()) && a.push(b)
});
return a
}
;
Grid.prototype.getCellsWithGoal = function(a) {
var b = [];
this.iterateCells(function(c) {
var d = c.getMark();
d && d.getTargetName() === a && b.push(c)
});
return b
}
;
Grid.prototype.fill = function(a, b, c) {
c = c || {};
var d = a(this.cells);
d = a(this.cells).concat(c.singleDirection ? d : d.reverse());
var e = 0;
d.forEach(function(f, g) {
var h;
f.forEach(function(k) {
var m = g >= d.length / 2;
h = g * (c.delay || .07);
cleverapps.timeouts.setTimeout(function() {
if (m)
this.cells[k.y][k.x].updateViewProperties();
else {
var l = c.colors && c.colors[g] || cleverapps.Random.random(0, BlocksGame.COLORS.length - 1);
c.withExplode && this.cells[k.y][k.x].explode();
this.cells[k.y][k.x].updateViewProperties({
color: l,
mark: !1
})
}
}
.bind(this), 1E3 * h)
}, this);
e = Math.max(e, h || 0)
}, this);
b && cleverapps.timeouts.setTimeout(b, 1E3 * e)
}
;
Grid.prototype.toStringArray = function() {
return this.cells.map(function(a) {
for (var b = "", c = 0; c < a.length; c++)
b += a[c].isEmpty() ? "." : "x";
return b
})
}
;
Grid.prototype.runClearBang = function() {
(new ActionPlayer([function(a) {
Game.currentGame.counter.inc();
a()
}
, function(a) {
this.trigger("runClearBang");
cleverapps.timeouts.setTimeout(a, 1100)
}
.bind(this), function(a) {
Game.currentGame.history.reset();
this.fill(Grid.FILL_EFFECTS.ToCenterWithoutBorder, a, {
delay: .1,
singleDirection: !0,
colors: [3, 6, 0],
withExplode: !0
})
}
.bind(this), function(a) {
this.dropCells(a)
}
.bind(this), function(a) {
Game.currentGame.counter.dec();
a()
}
])).play()
}
;
Grid.prototype.dropCellsAnimation = function() {
for (var a = 0, b = 0; b < Grid.WIDTH; b++)
for (var c = 0, d = 0; d < Grid.HEIGHT; d++)
this.cells[d][b].isEmpty() ? c++ : 0 < c && (this.cells[d - c][b].setProperties(this.cells[d][b].getInfo()),
this.cells[d][b].resetProperties(),
a = Math.max(a, c),
this.cells[d - c][b].trigger("onFall", this.cells[d][b].getView().getPosition(), c));
return a
}
;
Grid.prototype.dropCells = function(a) {
var b = 0;
(new ActionPlayer([function(c) {
b = this.dropCellsAnimation();
cleverapps.timeouts.setTimeout(c, b * CellView.FALL_TIME_PER_CELL * 1E3)
}
.bind(this), function(c) {
b ? (Game.currentGame.checkLines(cleverapps.Random.random(0, BlocksGame.COLORS.length - 1)),
cleverapps.timeouts.setTimeout(this.dropCells.bind(this, c), 500)) : c()
}
.bind(this)])).play(a)
}
;
Grid.FILL_EFFECTS = {
LinearFromTop: function(a) {
return Grid.FILL_EFFECTS.LinearFromBottom(a).reverse()
},
LinearFromBottom: function(a) {
for (var b = [], c = 0; c < a.length; c++) {
b.push([]);
for (var d = 0; d < a[c].length; d++)
b[c].push({
x: d,
y: c
})
}
return b
},
LinearFromLeft: function(a) {
for (var b = [], c = 0; c < a.length; c++) {
for (var d = [], e = 0; e < a[c].length; e++)
d.push({
x: c,
y: e
});
b.push(d)
}
return b
},
FromCenter: function(a) {
for (var b = [], c = 0; c < a.length; c++)
for (var d = 0; d < a[c].length; d++) {
for (var e = Math.max(Math.abs(a.length - 1 - 2 * c), Math.abs(a[c].length - 1 - 2 * d)); !b[e]; )
b.push([]);
b[e].push({
x: d,
y: c
})
}
return b.reverse()
},
ToCenterWithoutBorder: function(a) {
a = a.length;
for (var b = [], c = Math.floor((a - 1) / 2), d = Math.floor((a - 1) / 2), e = 1; e < a - 1; e++)
for (var f = 1; f < a - 1; f++) {
for (var g = Math.max(Math.abs(c - e), Math.abs(d - f)); !b[g]; )
b.push([]);
b[g].push({
x: f,
y: e
})
}
return b
},
Spiraling: function(a) {
var b = []
, c = [[0, 1], [1, 0], [0, -1], [-1, 0]];
a = [a[0].length, a.length - 1];
for (var d = 0, e = 0, f = -1; 0 < a[d % 2]; ) {
for (var g = 0; g < a[d % 2]; g++)
e += c[d][0],
f += c[d][1],
b.push([{
x: f,
y: e
}]);
a[d % 2]--;
d = (d + 1) % 4
}
return b
}
};
Grid.WIDTH = 8;
Grid.HEIGHT = 8;
Grid.EXPLODE_DURATION = 1500;
var Forms = {
ToKey: function(a) {
return a.join("-")
},
GetHardness: function(a) {
return Forms._HARDNESS_BY_KEY[Forms.ToKey(a)]
},
Mirror: function(a) {
a = cleverapps.clone(a);
for (var b = 0; b < a.length; b++)
a[b] = a[b].split("").reverse().join("");
return a
},
Rotate90: function(a) {
for (var b = [], c = 0; c < a[0].length; c++) {
for (var d = [], e = 0; e < a.length; e++)
d.push(a[a.length - 1 - e][c]);
b.push(d.join(""))
}
return b
},
Square: function(a) {
for (var b = 0, c = 0; c < a.length; c++)
for (var d = 0; d < a[0].length; d++)
"x" === a[c][d] && b++;
return b
},
convertFormToCoordinates: function(a) {
for (var b = a.length, c = a[0].length, d = [], e = 0; e < b; e++)
for (var f = 0; f < c; f++)
"x" === a[e][f] && d.push({
x: f,
y: e
});
return d
},
__EASY: [["x"], ["xx"], ["xxx"], ["xxxx"], ["xx", "xx"], ["xx", ".x"]],
__NORMAL: [["xxx", "xxx"], ["xxx", ".x."], [".x", ".x", "xx"], ["xx.", ".xx"], ["xxxxx"]],
__HARD: [["xxx", "xxx", "xxx"], ["xxx", "..x", "..x"]],
__NIGHTMARE: [[".x.", "xxx", ".x."], ["xxx", ".x.", ".x."], ["x.x", "xxx"]]
};
Forms.__BY_HARDNESS = [{
forms: Forms.__EASY,
points: 0
}, {
forms: Forms.__NORMAL,
points: 3
}, {
forms: Forms.__HARD,
points: 7
}, {
forms: Forms.__NIGHTMARE,
points: 9
}];
Forms._HARDNESS_BY_KEY = {};
Forms.ALL_POSSIBLE_VARIANTS = [];
Forms.ALL_POSSIBLE_VARIANTS = [];
for (var i = 0; i < Forms.__BY_HARDNESS.length; i++) {
var forms = Forms.__BY_HARDNESS[i].forms
, points = Forms.__BY_HARDNESS[i].points
, modifiedForms = forms.map(function(a) {
var b = []
, c = a;
a = Forms.Mirror(a);
for (var d = 0; 4 > d; d++)
b.push(c),
b.push(a),
3 !== d && (c = Forms.Rotate90(c),
a = Forms.Rotate90(a));
return cleverapps.unique(b, Forms.ToKey)
}).flat();
modifiedForms.forEach(function(a) {
Forms._HARDNESS_BY_KEY[Forms.ToKey(a)] = points
});
Forms.ALL_POSSIBLE_VARIANTS = Forms.ALL_POSSIBLE_VARIANTS.concat(modifiedForms)
}
Forms.ALL_POSSIBLE_VARIANTS.sort(function(a, b) {
return Forms.Square(b) - Forms.Square(a)
});
var Piece = function(a, b) {
b = b || {};
this.index = a;
this.form = b.form;
this.color = b.color;
this.cells = Forms.convertFormToCoordinates(this.getForm());
b.mark && (this.mark = new Mark(b.mark.type),
this.mark.coordinateInPiece = cc.p(b.mark.x || this.cells[0].x, b.mark.y || this.cells[0].y));
this.components = (b.components || []).map(function(c) {
c.position || (c.position = this.cells[0]);
return c
}
.bind(this));
this.onEnable = function() {}
;
this.onDisable = function() {}
;
this.getView = function() {}
};
Piece.prototype.setRandomGoal = function() {
var a = Game.currentGame && Game.currentGame.goals;
if (a && !(.5 > Math.random())) {
var b = [], c;
for (c in BlocksGame.MARKS) {
var d = BlocksGame.MARKS[c]
, e = a.findTargetFor(d.target);
e && !e.isCompleted() && (e = e.getRemaining(),
d = Game.currentGame.grid.getCellsWithGoal(d.goal).length,
0 < e + 1 - d && b.push(c))
}
b.length && (a = cleverapps.Random.mathChoose(this.cells),
this.mark = new Mark(cleverapps.Random.mathChoose(b)),
this.mark.coordinateInPiece = a)
}
}
;
Piece.prototype.getInfo = function() {
var a = {
form: this.form,
color: this.color,
index: this.index
};
this.mark && (a.mark = {
type: this.mark.getType(),
x: this.mark.coordinateInPiece.x,
y: this.mark.coordinateInPiece.y
});
return a
}
;
Piece.prototype.getForm = function() {
return this.form
}
;
Piece.prototype.getColor = function() {
return this.color
}
;
Piece.prototype.getMark = function(a, b) {
if (this.mark && this.mark.coordinateInPiece.x === a && this.mark.coordinateInPiece.y === b)
return this.mark
}
;
Piece.prototype.getComponents = function(a, b) {
return this.components.filter(function(c) {
return cc.pointEqualToPoint(c.position, cc.p(a, b))
})
}
;
Piece.prototype.getCenter = function() {
return {
x: this.form[0].length / 2,
y: this.form.length / 2
}
}
;
Piece.prototype.isLocked = function() {
return !this.enabled
}
;
Piece.prototype.enable = function() {
this.enabled = !0;
this.onEnable()
}
;
Piece.prototype.disable = function() {
cleverapps.gameModes.piecesAlwaysEnabled || (this.enabled = !1,
this.onDisable())
}
;
Piece.prototype.setHint = function(a) {
cleverapps.gameModes.hideSingleMoveHint || (this.singleMoveHint = a)
}
;
Piece.prototype.clearHint = function() {
this.singleMoveHint = void 0
}
;
Piece.prototype.onClick = function() {
Game.currentGame.pieces.onClick(this.index)
}
;
Piece.prototype.dragStart = function() {
if (this.dragging || this.isLocked() || Game.currentGame.counter.isActive() || Game.currentGame.outcome !== GameBase.OUTCOME_UNKNOWN)
return !1;
this.dragging = !0;
this.getView().animateStartDrag();
Game.currentGame.pieces.dragStartPiece(this.index);
return !0
}
;
Piece.prototype.dragMove = function(a) {
Game.currentGame.dragMovePiece(this, a)
}
;
Piece.prototype.dragEnd = function(a) {
this.dragging = !1;
this.getView().animateEndDrag();
Game.currentGame.dragEndPiece(this, a)
}
;
var Pieces = function(a, b) {
this.game = a;
this.nextPieces = b || void 0;
this.pid = 0;
this.pieces = [void 0, void 0, void 0];
this.onStartDrag = function() {}
;
this.onNewPiece = function() {}
;
this.onReplacePiece = function() {}
;
this.onTookPiece = function() {}
;
this.onShowHint = function() {}
;
this.onHidePieces = function() {}
;
this.onHide = function() {}
};
Pieces.prototype.onClick = function(a) {
var b = this.game.orangery;
if (b && b.selected) {
if (b.selected.eraser)
var c = -1;
else if (b.selected.form) {
c = b.selected.form;
var d = b.selected.color;
b.unselect(b.selected)
} else
d = b.selected.color;
this.replacePiece({
index: a,
form: c,
color: d
})
}
}
;
Pieces.prototype.dragStartPiece = function(a) {
var b = this.pieces[a];
b.singleMoveHint && this.game.grid.showHint(b.form, b.singleMoveHint);
this.onStartDrag(a)
}
;
Pieces.prototype.getPiece = function(a) {
return this.pieces[a]
}
;
Pieces.prototype.isEmpty = function() {
return 0 === this.pieces.filter(Boolean).length
}
;
Pieces.prototype.take = function(a, b) {
this.pieces[a] = void 0;
this.onTookPiece(a, b)
}
;
Pieces.prototype.getNewPieces = function(a, b) {
if (this.nextPieces)
++this.pid,
this.pieces = this.nextPieces.map(function(d, e) {
if (d)
return d = new Piece(e,d)
}),
this.nextPieces = void 0,
this.showNewPieces(b),
a();
else if (!this.calcPieceFormsInProcess) {
var c = ++this.pid;
this.calcPieceFormsInProcess = !0;
Game.currentGame.calcPieceForms(function(d) {
this.calcPieceFormsInProcess = !1;
this.pid === c && (this.pieces = d.map(function(e, f) {
e = new Piece(f,{
form: e,
color: this.calcPieceColor()
});
e.setRandomGoal();
return e
}
.bind(this)),
this.showNewPieces(b));
a()
}
.bind(this))
}
}
;
Pieces.prototype.showNewPieces = function(a) {
this.onHidePieces(!0);
for (var b = 0; b < this.pieces.length; b++)
if (this.pieces[b])
this.onNewPiece(this.pieces[b], a)
}
;
Pieces.prototype.calcPieceColor = function() {
this.lastColor = void 0 === this.lastColor ? 0 : this.lastColor + 1;
this.lastColor === BlocksGame.COLORS.length && (this.lastColor = 0);
return this.lastColor
}
;
Pieces.prototype.getInfo = function() {
return this.pieces.map(function(a) {
return a ? a.getInfo() : void 0
})
}
;
Pieces.prototype.startHint = function(a) {
this.onShowHint(this.pieces[1], a)
}
;
Pieces.prototype.setHint = function(a, b) {
this.pieces[a] && this.pieces[a].setHint(b)
}
;
Pieces.prototype.clearHint = function(a) {
this.pieces[a] && this.pieces[a].clearHint()
}
;
Pieces.prototype.replacePiece = function(a) {
this.onTookPiece(a.index, !1);
a ? (this.pieces[a.index] = new Piece(a.index,a),
this.onReplacePiece(this.pieces[a.index])) : this.pieces[a.index] = void 0;
Game.currentGame.setTimeout(function() {
Game.currentGame.checkMoves()
}, 500)
}
;
var Mark = function(a) {
cleverapps.EventEmitter.call(this);
this.type = a
};
Mark.prototype = Object.create(cleverapps.EventEmitter.prototype);
Mark.prototype.constructor = Mark;
Mark.prototype.collect = function() {
var a = this.getTargetName()
, b = Game.currentGame.goals.findTargetFor(a);
if (b) {
b.inc(1, !0);
Game.currentGame.goalCounter.setTimeout(function() {}, Mark.COLLECT_DURATION);
var c = function() {
b.onCollect(1)
}
} else
"letter" === this.type && (Game.currentGame.addClover(Mission.TYPE_LETTER, 1, !0),
c = function() {
Game.currentGame.trigger("rewardClover")
}
);
this.trigger("collect", a, c)
}
;
Mark.prototype.getType = function() {
return this.type
}
;
Mark.prototype.getImage = function() {
return BlocksGame.MARKS[this.type].image
}
;
Mark.prototype.getSpine = function() {
return BlocksGame.MARKS[this.type].spine
}
;
Mark.prototype.getDisableImage = function() {
return BlocksGame.MARKS[this.type].disableImage
}
;
Mark.prototype.getTargetName = function() {
return BlocksGame.MARKS[this.type].target || BlocksGame.MARKS[this.type].getTarget()
}
;
Mark.COLLECT_DURATION = 1200;
var IceOnCell = function(a, b) {
cleverapps.EventEmitter.call(this);
b = b || {};
this.cell = a;
this.stage = b.stage || 0;
this.onBreakOff = function() {}
;
this.onRemove = function() {}
};
IceOnCell.prototype = Object.create(cleverapps.EventEmitter.prototype);
IceOnCell.prototype.constructor = IceOnCell;
IceOnCell.prototype.getViewClass = function() {
return IceOnCellView
}
;
IceOnCell.prototype.getInfo = function() {
return {
name: "ice",
stage: this.stage
}
}
;
IceOnCell.prototype.explode = function() {
this.stage++;
this.trigger("breakOff");
this.stage === IceOnCell.PARTS && this.remove();
return !0
}
;
IceOnCell.prototype.remove = function() {
this.cell.removeComponent(IceOnCell);
Game.currentGame.goalCounter.setTimeout(function() {
this.trigger("remove")
}
.bind(this), IceOnCell.BREAK_OFF_DURATION)
}
;
IceOnCell.PARTS = 2;
IceOnCell.BREAK_OFF_DURATION = 1E3;
var IceOnCellView = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.setLocalZOrder(11);
this.iceOnCell = a;
this.animation = new cleverapps.Spine(bundles.blocks.jsons.ice_json);
this.animation.setAnimation(0, "idle" + this.getStage(), !1);
this.addChild(this.animation);
this.setCascadeColorEnabled(!0);
a.on("breakOff", this.createListener(this.breakOffAnimation.bind(this)));
a.on("remove", this.createListener(function() {
this.stopAllActions();
this.removeFromParent()
}, this))
},
breakOffAnimation: function() {
var a = this.getStage();
this.iceOnCell.stage === IceOnCell.PARTS ? this.animation.setAnimation(0, "animation" + a, !1) : this.animation.setAnimationAndIdleAfter("animation" + a, "idle" + a);
this.runAction(new cc.Sequence(new cc.DelayTime(.2),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.blocks.urls.ice_stage_effect)
}
)))
},
getStage: function() {
return Math.min(this.iceOnCell.stage, IceOnCell.PARTS)
}
});
var ScoreModeButton = cleverapps.UI.Button.extend({
ctor: function() {
var a = cleverapps.styles.ScoreModeButton;
this._super({
width: a.width,
height: a.height,
text: "* " + Messages.getLocalized("ScoreModeButton.text"),
icons: {
"*": bundles.buttons_main.frames.zen_png
},
type: cleverapps.styles.UI.Button.Images.button_blue,
onClicked: function() {
cleverapps.focusManager.display({
focus: "ScoreLevel",
action: function(b) {
var c = new Level(Level.LevelTypes.HIGHSCORE_MODE,0);
cleverapps.meta.wantsToPlay(b, c)
}
})
}
});
this.setPositionRound(cleverapps.styles.ScoreModeButton.position)
}
});
cleverapps.styles.ScoreModeButton = {
width: 300,
height: 100,
button: {
x: {
align: "center"
},
y: {
align: "center"
}
},
position: [{
x: {
align: "center"
},
y: {
align: "bottom",
dy: 135
}
}, {
x: {
align: "center",
dx: 175
},
y: {
align: "bottom",
dy: 140
}
}, {
x: {
align: "center",
dx: 175
},
y: {
align: "bottom",
dy: 160
}
}]
};
var GoalView = cc.Node.extend({
ctor: function(a) {
this._super();
this.goal = a;
this.type = a.type;
this.collected = a.getAmount();
this.setAnchorPoint(.5, .5);
this.icon = GoalView.getGoalImage(this.type);
this.amountType = this.getAmountType();
this.content = new TextWithIcon("%%",{
font: cleverapps.styles.FONTS.GOAL_TEXT,
margin: cleverapps.styles.GoalView.margin,
icons: {
"%%": this.icon,
"!!": bundles.checkbox.frames.check_mark_png
},
iconScale: 1
});
this.update();
this.addChild(this.content);
cleverapps.UI.wrap(this);
this.updateSize();
this.setVisible(!1);
this.setCascadeOpacityEnabledRecursively(!0);
this.setOpacity(0);
a.on("onCollect", this.createListener(this.animateCollect.bind(this)));
a.on("update", this.createListener(this.update.bind(this)));
a.on("show", this.createListener(this.show.bind(this)))
},
animateSparks: function() {
var a = new cleverapps.Spine(bundles.blocks.jsons.sparks_json);
this.icon.addChild(a);
a.setSkin("blue");
a.setPositionRound(this.icon.width / 2, this.icon.height / 2);
a.setAnimation(0, "animation", !1);
a.setCompleteListenerRemove()
},
show: function(a) {
this.setVisible(!0);
this.icon.setAnimation(0, "idle", !1);
a ? this.setOpacity(255) : (this.setScale(.6),
this.animateSparks(),
this.runAction(new cc.FadeIn(.3)),
this.runAction((new cc.ScaleTo(.2,1)).easing(cc.easeBackOut())))
},
hide: function(a) {
a ? this.setVisible(!1) : (this.icon.setAnimation(0, "fadeout", !1),
this.icon.setCompleteListener(function() {
this.setVisible(!1)
}
.bind(this)),
this.runAction(new cc.FadeOut(.3)))
},
updateSize: function() {
this.content.setOptions({
direction: cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL
})
},
updateAmount: function() {
var a;
this.amountType === GoalView.DISPLAYED_AMOUNT.TOTAL ? a = this.collected : this.amountType === GoalView.DISPLAYED_AMOUNT.REMAINING ? a = this.goal.getTarget() - this.collected : this.amountType === GoalView.DISPLAYED_AMOUNT.FRACTION && (a = this.collected + "/" + this.goal.getTarget());
this.content.setString("%%" + a)
},
animateCollect: function(a) {
this.update(a);
this.icon.stopAllActions();
this.icon.setRotation(0);
this.icon.setScale(1);
this.icon.runAction(new cc.Spawn(new cc.Sequence(new cc.ScaleTo(.15,1.3),new cc.ScaleTo(.15,1)),new cc.Sequence(new cc.RotateBy(.3,15),(new cc.RotateBy(1.2,-15)).easing(cc.easeElasticOut(.4)))))
},
update: function(a) {
this.collected += a || 0;
this.updateAmount();
this.collected >= this.goal.getTarget() && this.goal.withTarget() && this.setCompleted()
},
setCompleted: function() {
this.content.setString("%%!!");
cleverapps.audio.playSound(bundles.blocks.urls.goal_is_completed)
},
getAmountType: function() {
return this.goal.withTarget() ? GoalView.DISPLAYED_AMOUNT.REMAINING : GoalView.DISPLAYED_AMOUNT.TOTAL
}
});
GoalView.getGoalImage = function(a) {
return new cleverapps.Spine(bundles.blocks.jsons[a + "_goal_json"])
}
;
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
GOAL_TEXT: {
name: "default",
size: 45
}
});
cleverapps.styles.GoalView = {
margin: 10,
offsetY: 30
};
GoalView.DISPLAYED_AMOUNT = {};
GoalView.DISPLAYED_AMOUNT.TOTAL = 0;
GoalView.DISPLAYED_AMOUNT.REMAINING = 1;
GoalView.DISPLAYED_AMOUNT.FRACTION = 2;
var GoalsView = cc.Scale9Sprite.extend({
ctor: function(a) {
this._super(bundles.game.frames.pieces_bg);
this.goals = a;
this.setVisible(!1);
this.setAnchorPoint(.5, .5);
this.setGoals();
this.updateSize();
this.setupChildren()
},
show: function(a) {
cleverapps.gameModes.hideGoals || (a ? (this.setVisible(!0),
this.views.forEach(function(b) {
b.show && b.show(a)
})) : (this.setOpacity(0),
this.runAction(new cc.Sequence(new cc.Show,new cc.FadeIn(.5)))))
},
hide: function(a) {
a ? this.setVisible(!1) : this.runAction(new cc.FadeOut(.3));
this.views.forEach(function(b) {
b.hide && b.hide(a)
})
},
setGoals: function() {
this.views = [];
Object.values(this.goals.elements).forEach(function(a) {
var b = new GoalView(a);
this.views.push(b);
cleverapps.aims.registerTarget(a.type, b)
}
.bind(this));
this.goalsLayout = new cleverapps.Layout(this.views,{
margin: cleverapps.styles.GoalsView.margin
});
this.addChild(this.goalsLayout)
},
updateSize: function() {
var a = cleverapps.styles.GoalsView;
this.setContentSize2(a.sizes[cleverapps.resolution.mode]);
this.goalsLayout.setOptions({
direction: cleverapps.resolution.mode !== cleverapps.WideMode.HORIZONTAL ? cleverapps.UI.HORIZONTAL : cleverapps.UI.VERTICAL,
margin: cleverapps.resolution.mode !== cleverapps.WideMode.HORIZONTAL ? a.margin : a.verticalMargin
})
},
setupChildren: function() {
this.setPositionRound(cleverapps.styles.GoalsView);
this.goalsLayout.setPositionRound(this.width / 2, this.height / 2)
}
});
cleverapps.styles.GoalsView = {
sizes: [{
width: 640,
height: 140
}, {
width: 640,
height: 140
}, {
width: 200,
height: 600
}],
x: {
align: "center"
},
y: {
align: "center"
},
margin: 60,
verticalMargin: 85
};
var GoalsMessageContent = cleverapps.Layout.extend({
ctor: function(a) {
var b = cleverapps.styles.GoalsMessageContent
, c = Game.currentGame.getMode() === GameBase.MODE_HIGHSCORE ? "GameMessage.highScoreMode.text" : "GameMessage.text";
c = this.text = cleverapps.UI.generateOnlyText(c, cleverapps.styles.FONTS.GAME_MESSAGE_TEXT);
this.text.setCascadeOpacityEnabledRecursively(!0);
this.text.setOpacity(0);
this.goals = a;
this.views = [];
Object.values(a).forEach(function(d) {
var e = GoalView.getGoalImage(d.type)
, f = cleverapps.UI.generateImageText(d.getRemaining() || "", cleverapps.styles.FONTS.GOAL_TEXT)
, g = new cleverapps.Layout([e, f],{
direction: cleverapps.UI.HORIZONTAL,
margin: b.goalMargin
});
g.icon = e;
g.amount = f;
g.target = cleverapps.aims.getTarget(d.type);
g.type = d.type;
this.views.push(g)
}
.bind(this));
a = new cleverapps.Layout(this.views,{
direction: cleverapps.UI.HORIZONTAL,
margin: b.goalsMargin
});
this._super([c, a], {
direction: cleverapps.UI.VERTICAL,
margin: b.margin,
padding: b.padding
})
},
onShow: function() {
var a = cleverapps.styles.GoalsMessageContent;
this.text.setOpacity(0);
this.text.runAction(new cc.Sequence(new cc.FadeIn(.3),new cc.DelayTime(.5),new cc.FadeOut(.3)));
this.views.forEach(function(b) {
b.replaceParentSamePlace(cleverapps.scenes.getMovingNode());
var c = b.parent.convertToNodeSpace(b.target.parent.convertToWorldSpace(b.target.getPosition()));
c = [b.getPosition(), cc.p(b.x + a.midPoint.dx, b.y + a.midPoint.dy), c];
b.amount.runAction(new cc.Sequence(new cc.FadeIn(.3),new cc.DelayTime(.2),new cc.FadeOut(.2)));
b.runAction(new cc.Sequence(new cc.CallFunc(function() {
b.icon.setAnimationAndIdleAfter("fadein", "idle")
}
),new cc.DelayTime(.7),new cc.Spawn((new cc.BezierTo(.75,c)).easing(cc.easeIn(1)),new cc.Sequence(new cc.DelayTime(.4),new cc.PlaySound(bundles.blocks.urls.fly_to_goal)),new cc.Sequence(new cc.RotateBy(.5,-90),new cc.RotateBy(.25,90)),(new cc.ScaleTo(.75,.6)).easing(cc.easeIn(3))),new cc.CallFunc(function() {
this.goals[b.type].showView()
}
.bind(this)),new cc.RemoveSelf))
}
.bind(this))
}
});
cleverapps.styles.GoalsMessageContent = {
margin: 50,
padding: {
bottom: 30
},
goalMargin: 10,
goalsMargin: 20,
midPoint: {
dx: 150,
dy: 150
}
};
var CellView = cc.Sprite.extend({
ctor: function(a) {
this.cell = a;
this._super(bundles.blocks.frames.cell_bg_red_png);
this.setAnchorPoint(0, 0);
this.update();
this.setCascadeOpacityEnabled(!0);
a.getView = function() {
return this
}
.bind(this);
a.on("update", this.createListener(this.update.bind(this)));
a.on("collectMark", this.createListener(this.collectMark.bind(this)));
a.on("remove", this.createListener(this.remove.bind(this)));
a.on("onFall", this.createListener(this.fall.bind(this)))
},
update: function(a) {
a = a || {};
var b = void 0 !== a.color ? a.color : this.cell.getColor();
this.markView && (this.markView.removeFromParent(),
this.markView = void 0);
(this.components || []).forEach(function(e) {
e.removeFromParent()
});
var c = void 0 !== a.mark ? a.mark : this.cell.getMark()
, d = a.components || this.cell.getComponents();
this.stopAllActions();
b === BlocksGame.COLOR_NONE ? this.setVisible(!1) : (this.setVisible(!a.fadeIn),
this.setSpriteFrame((new cc.Sprite(BlocksGame.COLORS[b].image)).getSpriteFrame()),
c && (this.markView = new MarkView(c),
this.addChild(this.markView)),
this.components = [],
(d || []).forEach(function(e) {
e = new (e.getViewClass())(e);
e.setPositionRound(this.width / 2, this.height / 2);
this.components.push(e);
this.addChild(e)
}
.bind(this)),
this.setOpacity(this.cell.getHover() ? 82 : 255),
a.fadeIn && this.fadeIn())
},
runAnimation: function(a, b) {
a = new cleverapps.Spine(a);
void 0 !== b && a.setColor(BlocksGame.COLORS[b].rgb);
a.setAnchorPoint(0, 0);
a.setAnimation(0, "animation", !1);
this.addChild(a);
a.replaceParentSamePlace(cleverapps.scenes.getRunningScene());
a.setCompleteListenerRemove()
},
remove: function(a) {
this.runAnimation(bundles.blocks.jsons.cell_remove_json, a)
},
collectMark: function() {
this.runAnimation(bundles.blocks.jsons.explode_goal_json)
},
fall: function(a, b) {
var c = new cleverapps.Spine(bundles.blocks.jsons.cell_light_json);
this.addChild(c, 1E3);
c.setPositionRound(this.width / 2, this.height / 2);
var d = this.getPosition();
this.setPosition(a);
this.runAction(new cc.Sequence((new cc.MoveTo(b * CellView.FALL_TIME_PER_CELL,d.x,d.y)).easing(cc.easeIn(1)),new cc.CallFunc(function() {
c.setAnimation(0, "animation", !1);
c.setCompleteListenerRemove();
Game.currentGame.shakeField()
}
)))
},
fadeIn: function() {
this.runAction(new cc.Sequence(new cc.FadeOut(0),new cc.Show,new cc.FadeIn(.3)))
}
});
CellView.getCellSize = function() {
return {
width: Cell.WIDTH * resolutionScale,
height: Cell.HEIGHT * resolutionScale
}
}
;
CellView.FALL_TIME_PER_CELL = .08;
var MarkView = cc.Node.extend({
ctor: function(a) {
this.mark = a;
this._super();
var b = this.getMarkImage(a);
this.addChild(b);
this.setLocalZOrder(10);
this.setAnchorPoint(.5, .5);
this.setPositionRound(cleverapps.styles.MarkView);
a.on("collect", this.createListener(this.collect.bind(this)), this)
},
collect: function(a, b) {
cleverapps.audio.playSound(BlocksGame.MARKS[this.mark.type].explodeEffect || bundles.blocks.urls.explode_mark_effect);
if (a = cleverapps.aims.getTarget(a, {
noDefault: !0
})) {
var c = this.getFlyingImage(this.mark);
this.addChild(c, 10);
c.setPositionRound(this.width / 2, this.height / 2);
c.replaceParentSamePlace(cleverapps.scenes.getMovingNode());
c.runAction(new cc.Spawn(new cc.Sequence((new cc.ScaleTo(.3,2)).easing(cc.easeOut(2)),(new cc.ScaleTo(.3,1)).easing(cc.easeInOut(2))),new cc.Sequence(new cc.DelayTime(.4),AnimationsLibrary.animateCollect(c, a.icon || a, {
sound: BlocksGame.MARKS[this.mark.type].collectEffect
}),new cc.RemoveSelf,new cc.CallFunc(function() {
b && b()
}
))))
} else
this.removeFromParent()
},
getMarkImage: function(a) {
a.getImage() ? a = new cc.Sprite(a.getImage()) : (a = new cleverapps.Spine(a.getSpine()),
a.setAnimation(0, "idle", !0));
return a
},
getFlyingImage: function(a) {
var b = Game.currentGame.goals.findTargetFor(a.getTargetName());
a = b ? GoalView.getGoalImage(b.type) : new cleverapps.Spine(BlocksGame.MARKS[a.type].flyingView);
a.setAnimation(0, "animation", !1);
return a
}
});
cleverapps.styles.MarkView = {
x: {
align: "center"
},
y: {
align: "center"
}
};
var GridView = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.grid = a;
this.background = this.addBackground();
this.setContentSize(this.background.width, this.background.height);
this.background.setPositionRound(this.width / 2, this.height / 2);
this.floor = this.addFloor();
this.content = this.addContent();
this.addModeFrame();
this.grid.getView = this.createListener(function() {
return this.content
}
.bind(this));
a.on("explode", this.createListener(this.explode.bind(this)));
a.on("showCombo", this.createListener(this.showCombo.bind(this)));
a.on("hideGrid", this.createListener(this.hideGrid.bind(this)));
a.on("changeModeFrameColor", this.createListener(this.changeModeFrameColor.bind(this)));
a.on("showHint", this.createListener(this.showHint.bind(this)));
a.on("hideHint", this.createListener(this.hideHint.bind(this)));
a.on("explodeHint", this.createListener(this.showExplodeHint.bind(this)));
a.on("resetExplodeHint", this.createListener(this.hideExplodeHint.bind(this)));
a.on("runClearBang", this.createListener(this.runClearBang.bind(this)));
cleverapps.config.debugMode && !cleverapps.config.wysiwygMode && (this.addDebugInfo(),
this.pointHandler = cleverapps.UI.onClick(this.content, function(b) {
b = this.content.convertTouchToNodeSpace(b);
b = GridView.positionToCell(b);
b.x = Math.floor(b.x);
b.y = Math.floor(b.y);
this.grid.onClick(b.x, b.y)
}
.bind(this), {
interactiveScale: !1
}));
this.debugId = "GridView"
},
addBackground: function() {
var a = cleverapps.styles.GridView
, b = cleverapps.UI.createScale9Sprite(bundles.blocks.frames.grid_border_png, cleverapps.UI.Scale9Rect.TwoPixelXY)
, c = CellView.getCellSize();
b.setContentSize2(c.width * Grid.WIDTH + 2 * a.borderOffset, c.height * Grid.HEIGHT + 2 * a.borderOffset);
this.addChild(b);
return b
},
addFloor: function() {
var a = new cc.Node
, b = CellView.getCellSize();
a.setContentSize2(b.width * Grid.WIDTH, b.height * Grid.HEIGHT);
a.setAnchorPoint(.5, .5);
a.setCascadeOpacityEnabled(!0);
this.grid.iterateCells(function(c, d, e) {
c = new cc.Sprite(bundles.blocks.frames.grid_cell_bg_png);
if (cleverapps.config.debugMode && (c.width !== b.width || c.height !== b.height))
throw "Wrong size of cell, should be " + JSON.stringify(b);
c.setAnchorPoint(0, 0);
c.setPositionRound(d * b.width, e * b.height);
a.addChild(c)
});
a.setPositionRound(this.width / 2, this.height / 2);
this.addChild(a);
return a
},
addContent: function() {
var a = cleverapps.styles.GridView
, b = new cc.Node
, c = CellView.getCellSize();
b.setContentSize2(c.width * Grid.WIDTH, c.height * Grid.HEIGHT);
b.setAnchorPoint(.5, .5);
this.grid.iterateCells(function(d, e, f) {
d = new CellView(d);
d.setLocalZOrder(this.calcCellZOrder(e, f));
d.setPositionRound(e * c.width + a.cellOffset.x, f * c.height + a.cellOffset.x);
b.addChild(d)
}
.bind(this));
b.setPositionRound(this.width / 2, this.height / 2);
this.addChild(b);
return b
},
addModeFrame: function() {
var a = cleverapps.styles.GridView;
if (bundles.blocks.jsons.mode_frame) {
var b = this.modeFrame = new cleverapps.Spine(bundles.blocks.jsons.mode_frame);
b.setAnimation(0, "animation", !0);
b.setPositionRound(a.modeFrame);
b.setLocalZOrder(-1);
b.setVisible(!1);
this.addChild(b)
}
},
explode: function(a, b, c) {
this.addLineExplodeAnimation(a, c);
this.addLineExplodeAnimation(b, c, !0);
cleverapps.audio.playSound(bundles.blocks.urls.explode_line_effect)
},
addLineExplodeAnimation: function(a, b, c) {
a.forEach(function(d) {
var e = new cleverapps.Spine(bundles.blocks.jsons.line_explode_json);
e.setAnchorPoint(.5, .5);
e.setAnimation(0, "animation", !1);
e.setCompleteListenerRemove();
e.setColor(BlocksGame.COLORS[b].rgb);
e.setRotation(c ? -90 : 0);
e.setPosition(GridView.cellToPosition(cc.p(c ? d + .5 : Grid.WIDTH / 2, c ? Grid.HEIGHT / 2 : d + .5)));
this.floor.addChild(e)
}
.bind(this))
},
showCombo: function(a) {
var b = cleverapps.styles.GridView.combo
, c = new cleverapps.Spine(bundles.blocks.jsons.explode_combo_json);
this.addChild(c);
c.setPositionRound(b.animation);
a = cleverapps.UI.generateImageText("+" + a.toString(), cleverapps.styles.FONTS.COMBO_TEXT);
a.fitTo(b.text.width, b.text.height);
a.setVisible(!1);
a.setScale(.4);
a.setCascadeOpacityEnabled(!0);
a.setOpacity(0);
this.addChild(a);
a.setPositionRound(b.text);
a.runAction(new cc.Sequence(new cc.DelayTime(.65),new cc.Spawn(new cc.Show,new cc.Sequence((new cc.ScaleTo(.2,1.4)).easing(cc.easeCubicActionOut()),(new cc.ScaleTo(.3,1)).easing(cc.easeCubicActionIn())),new cc.FadeIn(.5)),new cc.DelayTime(.15),new cc.FadeOut(.1),new cc.RemoveSelf));
this.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.game.urls.message_effect);
c.setAnimation(0, "animation", !1);
c.setCompleteListenerRemove()
}
)))
},
hideGrid: function(a) {
this.floor.runAction(new cc.FadeOut(.3));
this.background.runAction(new cc.Sequence(new cc.FadeOut(.3),new cc.CallFunc(a)));
this.modeCircle && this.modeCircle.removeFromParent();
this.modeFrame && this.modeFrame.removeFromParent()
},
changeModeFrameColor: function(a) {
this.modeFrame && (this.modeFrame.setVisible(!0),
this.modeFrame.setColor(a))
},
addDebugInfo: function() {
var a = cleverapps.styles.GridView
, b = this.modeCircle = new cc.Sprite(bundles.finger.frames.tutorial_click_png);
b.setPositionRound(a.modeCircle);
b.setScale(.6);
this.addChild(b);
var c = cleverapps.UI.generateOnlyText("", cleverapps.styles.FONTS.SCORE_TEXT);
c.setPositionRound(b.width / 2, b.height / 2);
b.addChild(c);
var d = cleverapps.UI.generateOnlyText("", cleverapps.styles.FONTS.SMALL_WHITE_TEXT);
d.setPositionRound(b.width / 2, -b.height / 2);
b.addChild(d);
this.grid.updatePiecesData = this.createListener(function(e, f) {
b.setColor(e);
c.setString(f && f.estimation || "");
d.setString("Mode: " + Game.currentGame.mode);
this.debugHints && (this.debugHints.forEach(function(g) {
g.stopAllActions();
g.removeFromParent()
}),
delete this.debugHints);
cleverapps.gameModes.showHint && f && f.positions && (this.debugHints = [],
f.positions.forEach(function(g, h) {
g = new HintPieceView(g);
g.setPositionRound(GridView.cellToPosition(cc.p(0, 0)));
g.setLocalZOrder(GridView.HINT_ZORDER);
g.show();
this.content.addChild(g);
this.debugHints.push(g);
g.runAction(new cc.Sequence(new cc.Hide,new cc.DelayTime(2 * h),new cc.Show,new cc.DelayTime(1.5),new cc.Hide,new cc.RemoveSelf,new cc.CallFunc(function() {
h === f.positions.length - 1 && delete this.debugHints
}
.bind(this))))
}
.bind(this)))
})
},
showHint: function(a, b) {
a = this.hintView = new HintPieceView(a);
a.setPositionRound(GridView.cellToPosition(b));
a.setLocalZOrder(2);
this.content.addChild(a);
a.show()
},
hideHint: function() {
this.hintView && (this.hintView.hide(),
this.hintView = void 0)
},
showExplodeHint: function(a, b) {
a = this.explodeHints = new ExplodeHintsView(a,b);
a.setLocalZOrder(GridView.HINT_ZORDER);
this.content.addChild(a)
},
hideExplodeHint: function() {
this.explodeHints && (this.explodeHints.stopAllActions(),
this.explodeHints.removeFromParent(),
delete this.explodeHints)
},
calcCellZOrder: function(a, b, c) {
return a + (this.grid.height - b) + (c ? GridView.HINT_ZORDER : 3)
},
animateBomb: function() {
var a = cleverapps.scenes.getRunningScene()
, b = new cleverapps.Spine(bundles.blocks.jsons.clear_bang_json);
this.addChild(b);
b.replaceParentSamePlace(cleverapps.scenes.getMovingNode(b));
b.setPositionRound(b.parent.convertToNodeSpace(a.clearPiecesButtonBooster.convertToWorldSpace(a.clearPiecesButtonBooster.icon)));
a = b.parent.convertToNodeSpace(this.parent.convertToWorldSpace(this.getPosition()));
b.setAnimation(0, "animation", !1);
b.setCompleteListenerRemove();
b.runAction((new cc.MoveTo(1.1,a.x,a.y)).easing(cc.easeOutIn(1)))
},
animateExplode: function() {
var a = new cleverapps.Spine(bundles.blocks.jsons.clear_bang_explode_json);
this.addChild(a);
a.setPositionRound(this.width / 2, this.height / 2);
a.runAction(new cc.Sequence(new cc.DelayTime(.8),new cc.CallFunc(function() {
cleverapps.audio.playSound(bundles.blocks.urls.booster_bomb_effect)
}
),new cc.DelayTime(.3),new cc.CallFunc(function() {
a.setAnimation(0, "animation", !1);
a.setCompleteListenerRemove();
Game.currentGame.shakeField({
fullShake: !0
})
}
)))
},
runClearBang: function() {
this.animateBomb();
this.animateExplode()
}
});
GridView.cellToPosition = function(a) {
var b = CellView.getCellSize();
return cc.p(a.x * b.width, a.y * b.height)
}
;
GridView.positionToCell = function(a) {
var b = CellView.getCellSize();
return cc.p(a.x / b.width, a.y / b.height)
}
;
GridView.HINT_ZORDER = 20;
cleverapps.overrideColors(cleverapps.styles.COLORS, {
BLOCK_COLOR_RED: new cc.Color(209,50,55,255),
BLOCK_COLOR_GREEN: new cc.Color(90,218,93,255),
BLOCK_COLOR_BLUE: new cc.Color(56,89,247,255),
BLOCK_COLOR_YELLOW: new cc.Color(235,171,0,255),
BLOCK_COLOR_PURPLE: new cc.Color(142,71,210,255),
BLOCK_COLOR_CYAN: new cc.Color(28,169,255,255),
BLOCK_COLOR_ORANGE: new cc.Color(233,92,0,255),
MODE_COLOR_GREEN: new cc.Color(24,237,22,255),
MODE_COLOR_BLUE: new cc.Color(0,210,255,255),
MODE_COLOR_YELLOW: new cc.Color(255,194,0,255),
MODE_COLOR_ORANGE: new cc.Color(255,128,14,255),
MODE_COLOR_RED: new cc.Color(255,46,77,255)
});
cleverapps.overrideStyles(cleverapps.styles.GameScene, {
exclamation: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 250
}
}
});
cleverapps.styles.GridView = {
borderOffset: 9,
modeCircle: {
x: {
align: "center",
dx: -500
},
y: {
align: "center",
dy: -500
}
},
modeFrame: {
x: {
align: "center"
},
y: {
align: "center",
dy: 44
}
},
cellOffset: {
x: 0,
y: 0
},
combo: {
animation: {
x: {
align: "center",
dx: 100
},
y: {
align: "center",
dy: 20
}
},
text: {
width: 240,
height: 90,
x: {
align: "center",
dx: 200
},
y: {
align: "center",
dy: -15
}
}
}
};
var PieceView = cc.Node.extend({
ctor: function(a, b) {
this._super();
this.piece = a;
this.cubeColor = a.color;
this.view = new cc.Node;
this.cubes = a.cells.map(this.createCube.bind(this));
this.enable();
this.setScale(.5);
cleverapps.UI.wrap(this.view);
cleverapps.UI.wrapWithPadding(this.view, cleverapps.styles.PieceView.padding, !0);
this.view.setCascadeOpacityEnabledRecursively(!0);
b || cleverapps.config.wysiwygMode || (this.addControls(),
a.getView = this.createListener(function() {
return this
}
.bind(this)),
a.onEnable = this.createListener(this.enable.bind(this)),
a.onDisable = this.createListener(this.disable.bind(this)));
this.setAnchorPoint(.5, .5);
this.addChild(this.view);
this.setContentSize(this.view)
},
createCube: function(a) {
var b = this.piece.getMark(a.x, a.y)
, c = new cc.Node;
c.setContentSize2(CellView.getCellSize());
c.setPositionRound(a.x * c.width, a.y * c.height);
c.setLocalZOrder(this.piece.form.length - a.y);
this.view.addChild(c);
var d = new cc.Sprite;
d.image = b ? b.getImage() : BlocksGame.COLORS[this.cubeColor].image;
d.disableImage = b ? b.getDisableImage() : BlocksGame.DISABLE_COLOR.image;
d.setAnchorPoint(0, 0);
d.setPositionRound(0, 0);
d.orderIndex = a.x + a.y;
c.addChild(d);
return d
},
calculateViewPosition: function() {
var a = this.view.getBoundingBoxToWorld();
return cc.p(a.x + a.width / 2, a.y + a.height / 2)
},
addControls: function() {
this.pointHandler = cleverapps.UI.onDrag(this, {
instantDrag: !0,
followPointer: this.createListener(function(a) {
this.setPositionRound(this.parent.convertTouchToNodeSpaceDisplacement(a))
}
.bind(this)),
onClick: this.createListener(this.piece.onClick.bind(this.piece)),
onDragStart: this.createListener(this.piece.dragStart.bind(this.piece)),
onDragMove: this.createListener(function() {
this.piece.dragMove(this.calculateViewPosition())
}
.bind(this)),
onDragEnd: this.createListener(function() {
this.piece.dragEnd(this.calculateViewPosition())
}
.bind(this))
})
},
stopDragAnimation: function() {
this.stopAllActions()
},
needDragOffset: function() {
return connector.info.isMobile
},
animateStartDrag: function() {
var a = cleverapps.styles.PieceView.dragOffset;
this.stopDragAnimation();
cleverapps.audio.playSound(bundles.game.urls.drag_effect);
this.getParent().setLocalZOrder(2);
this.needDragOffset() && this.view.runAction((new cc.MoveBy(.1,a.x,a.y)).easing(cc.easeExponentialOut(2)));
this.runAction((new cc.ScaleTo(.1,1)).easing(cc.easeIn(2)))
},
animateEndDrag: function() {
var a = cleverapps.styles.PieceView.dragOffset;
this.stopDragAnimation();
this.getParent().setLocalZOrder(1);
this.needDragOffset() && this.view.runAction(new cc.MoveBy(.1,a.x,-a.y));
this.runAction(new cc.Spawn(new cc.ScaleTo(.1,.5),new cc.MoveTo(.1,0,0)))
},
enable: function() {
this.cubes.forEach(function(a) {
a.runAction(new cc.Sequence(new cc.DelayTime(.05 * a.orderIndex),new cc.CallFunc(function() {
a.setSpriteFrame(a.image)
}
)))
})
},
disable: function() {
this.cubes.forEach(function(a) {
a.runAction(new cc.Sequence(new cc.DelayTime(.05 * a.orderIndex + .3),new cc.CallFunc(function() {
a.setSpriteFrame(a.disableImage)
}
)))
})
},
onRemove: function(a) {
this.pointHandler && this.pointHandler.remove();
a ? this.removeFromParent() : this.runAction(new cc.Sequence((new cc.ScaleTo(.2,.55)).easing(cc.easeCubicActionOut()),(new cc.ScaleTo(.3,0)).easing(cc.easeCubicActionIn()),new cc.RemoveSelf))
}
});
cleverapps.styles.PieceView = {
dragOffset: {
x: 0,
y: 160
},
padding: {
x: 120,
y: 120
}
};
var HintPieceView = cc.Node.extend({
ctor: function(a) {
this._super();
Forms.convertFormToCoordinates(a).forEach(function(b) {
var c = new cc.Node;
c.setContentSize2(CellView.getCellSize());
c.setPositionRound(b.x * c.width, b.y * c.height);
c.setCascadeOpacityEnabled(!0);
this.addChild(c);
b = new cc.Sprite(bundles.blocks.frames.hint_bg_png);
b.setPosition(c.width / 2, c.height / 2);
c.addChild(b)
}
.bind(this));
this.setCascadeOpacityEnabled(!0);
this.setOpacity(0)
},
show: function() {
this.runAction(new cc.FadeIn(.25))
},
hide: function() {
this.stopAllActions();
this.runAction(new cc.Sequence(new cc.FadeOut,new cc.RemoveSelf))
}
});
var ExplodeHintsView = cc.Node.extend({
ctor: function(a, b) {
this._super();
var c = Game.currentGame.grid;
this.setContentSize2(c.getView().getContentSize());
a.forEach(function(d) {
var e = d.isVertical ? bundles.blocks.jsons.explode_hint_vertical_json : bundles.blocks.jsons.explode_hint_json
, f = new cleverapps.Spine(e);
e = new cleverapps.Spine(e);
[f, e].forEach(function(h) {
h.setAnchorPoint(.5, .5);
h.setAnimation(0, "animation", !0);
h.setColor(BlocksGame.COLORS[b].rgb);
this.addChild(h)
}
.bind(this));
var g = {
x: d.x,
y: d.y
};
d.width && (g.x += d.width,
g.x === c.width && f.setVisible(!1),
0 === d.x && e.setVisible(!1));
d.height && (g.y += d.height,
g.y === c.height && f.setVisible(!1),
0 === d.y && e.setVisible(!1));
f.setPositionRound(GridView.cellToPosition(g));
e.setPositionRound(GridView.cellToPosition(d));
e.setRotation(180)
}
.bind(this))
}
});
var PieceSlotView = cc.Node.extend({
addPiece: function(a, b) {
a = this.pieceView = new PieceView(a);
this.addChild(a);
b || this.showUpPiece(a)
},
replacePiece: function(a) {
a = this.pieceView = new PieceView(a);
a.setVisible(!1);
this.addChild(a);
a.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.Show,new cc.CallFunc(this.showUpPiece.bind(this, a))))
},
showUpPiece: function(a) {
var b = a.getScale();
a.setScale(0);
var c = new cleverapps.Spine(bundles.blocks.jsons.appear_json);
c.setPosition(a.getPosition());
c.setAnimation(0, "animation", !1);
c.setCompleteListenerRemove();
c.setLocalZOrder(-1);
this.addChild(c, -1);
a.runAction(new cc.ScaleTo(.25,b))
},
removePiece: function(a) {
this.pieceView && (this.pieceView.onRemove(a),
delete this.pieceView)
},
takeAnimation: function() {
var a = new cleverapps.Spine(bundles.blocks.jsons.take_json);
a.setAnimation(0, "animation", !1);
a.setCompleteListenerRemove();
this.addChild(a, -1)
}
});
var PiecesView = cc.Node.extend({
ctor: function(a) {
this._super();
this.setAnchorPoint(.5, .5);
this.pieces = a;
this.bg = cleverapps.UI.createScale9Sprite(bundles.game.frames.pieces_bg, cleverapps.UI.Scale9Rect.TwoPixelXY);
this.addChild(this.bg);
this.slots = [];
for (a = 0; a < this.pieces.pieces.length; a++) {
var b = new PieceSlotView;
this.addChild(b);
this.slots.push(b)
}
this.resize();
this.pieces.onNewPiece = this.createListener(this.addPiece.bind(this));
this.pieces.onReplacePiece = this.createListener(this.replacePiece.bind(this));
this.pieces.onTookPiece = this.createListener(this.removePiece.bind(this));
this.pieces.onStartDrag = this.createListener(this.startDrag.bind(this));
this.pieces.onShowHint = this.createListener(this.showHint.bind(this));
this.pieces.onHidePieces = this.createListener(this.clearPieces.bind(this));
this.pieces.onHide = this.createListener(this.hide.bind(this))
},
resize: function() {
this.hideHint();
var a = cleverapps.styles.PiecesView;
cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL ? this.setContentSize2(a.item.width + 2 * a.bgPadding, 3 * a.item.height + 2 * a.bgPadding) : this.setContentSize2(3 * a.item.width + 2 * a.bgPadding, a.item.height + 2 * a.bgPadding);
this.bg.setContentSize2(this.width, this.height);
this.bg.setPositionRound(this.width / 2, this.height / 2);
this.setSlotPositions()
},
setSlotPositions: function() {
for (var a = cleverapps.styles.PiecesView, b = 0; b < this.pieces.pieces.length; b++) {
var c = this.slots[b]
, d = a.item.height
, e = a.item.width;
cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL ? c.setPositionRound(this.width / 2, b * d + d / 2 + a.bgPadding) : c.setPositionRound(b * e + e / 2 + a.bgPadding, this.height / 2)
}
},
startDrag: function(a) {
this.hideHint();
this.slots[a].takeAnimation()
},
removePiece: function(a, b) {
this.slots[a].removePiece(b)
},
clearPieces: function(a) {
this.slots.forEach(function(b) {
b.removePiece(a)
})
},
hide: function(a) {
this.clearPieces(a);
this.bg && this.bg.runAction(new cc.FadeOut(.3))
},
addPiece: function(a, b) {
this.slots[a.index].addPiece(a, b)
},
replacePiece: function(a) {
this.slots[a.index].replacePiece(a)
},
showHint: function(a, b) {
this.hideHint();
b = [this.slots[1], b];
var c = Game.currentGame && Game.currentGame.grid && Game.currentGame.grid.getView();
c = cc.Base.GetHierarchyScale(c).x;
a = new PieceView(a,!0);
a.setOpacity(150);
a.setPositionRound(this.slots[1].getPosition());
this.addChild(a);
this.finger = FingerView.hintDrag(b, {
payload: a,
payloadScale: c
})
},
hideHint: function() {
FingerView.remove(this.finger);
this.finger = void 0
}
});
cleverapps.styles.PiecesView = {
item: {
width: 259,
height: 259
},
bgPadding: 20
};
var ReplaceAllButtonBooster = BaseButtonBooster.extend({
ctor: function(a) {
this._super({
booster: a,
styles: cleverapps.styles.ReplaceAllButtonBooster
});
this.setLocalZOrder(cleverapps.styles.ReplaceAllButtonBooster.zOrder)
},
createIcon: function() {
var a = new cleverapps.Spine(bundles.buttons.jsons.replace_all_json);
a.setAnimation(0, "idle", !1);
return a
},
onExecute: function() {
this.icon.setAnimation(0, "animation", !1);
cleverapps.audio.playSound(this.booster.executeEffect)
}
});
cleverapps.styles.ReplaceAllButtonBooster = {
size: [{
width: 125,
height: 110
}, {
width: 220,
height: 100
}, {
width: 220,
height: 100
}],
zOrder: 0,
position: [{
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 45
}
}, {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: 0
}
}, {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: 0
}
}],
phone: {
scale: .8
},
content: {
layout: [{
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 33
}
}, {
x: {
align: "center",
dx: 20
},
y: {
align: "center",
dy: 7
}
}, {
x: {
align: "center",
dx: 20
},
y: {
align: "center",
dy: 7
}
}],
margin: [5, 8, 8],
direction: [cleverapps.UI.VERTICAL, cleverapps.UI.HORIZONTAL, cleverapps.UI.HORIZONTAL],
reversed: [!1, !0, !0],
freeBlock: {
textWidth: 120
}
}
};
var ClearPiecesButtonBooster = BaseButtonBooster.extend({
ctor: function(a) {
this._super({
booster: a,
styles: cleverapps.styles.ClearPiecesButtonBooster
});
this.setLocalZOrder(cleverapps.styles.ClearPiecesButtonBooster.zOrder)
},
createIcon: function() {
return new cc.Sprite(bundles.buttons.frames.clear_pieces_png)
}
});
cleverapps.styles.ClearPiecesButtonBooster = {
size: [{
width: 125,
height: 110
}, {
width: 220,
height: 100
}, {
width: 220,
height: 100
}],
zOrder: 0,
position: [{
x: {
align: "center",
dx: 200
},
y: {
align: "bottom",
dy: 45
}
}, {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: -150
}
}, {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: -150
}
}],
phone: {
scale: .8
},
content: {
layout: [{
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 33
}
}, {
x: {
align: "center",
dx: 30
},
y: {
align: "center",
dy: 7
}
}, {
x: {
align: "center",
dx: 30
},
y: {
align: "center",
dy: 7
}
}],
margin: [5, 8, 8],
direction: [cleverapps.UI.VERTICAL, cleverapps.UI.HORIZONTAL, cleverapps.UI.HORIZONTAL],
reversed: [!1, !0, !0],
freeBlock: {
textWidth: 120
}
}
};
var UndoPieceButtonBooster = BaseButtonBooster.extend({
ctor: function(a) {
this._super({
booster: a,
styles: cleverapps.styles.UndoPieceButtonBooster
});
this.setLocalZOrder(cleverapps.styles.UndoPieceButtonBooster.zOrder);
if (!Game.currentGame.history.hasUndo())
this.booster.onDisableListener()
},
createIcon: function() {
var a = new cleverapps.Spine(bundles.buttons.jsons.undo_json);
a.setAnimation(0, "idle", !1);
return a
},
onExecute: function() {
this.icon.setAnimation(0, "animation", !1);
cleverapps.audio.playSound(this.booster.executeEffect)
}
});
// uptap 底部按钮
cleverapps.styles.UndoPieceButtonBooster = {
size: [{
width: 125,
height: 110
}, {
width: 220,
height: 100
}, {
width: 220,
height: 100
}],
zOrder: 0,
position: [{
x: {
align: "center",
dx: -200
},
y: {
align: "bottom",
dy: 45
}
}, {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: 150
}
}, {
x: {
align: "right",
dx: -30
},
y: {
align: "center",
dy: 150
}
}],
phone: {
scale: .8
},
content: {
layout: [{
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 33
}
}, {
x: {
align: "center",
dx: 30
},
y: {
align: "center",
dy: 7
}
}, {
x: {
align: "center",
dx: 30
},
y: {
align: "center",
dy: 7
}
}],
margin: [5, 8, 8],
direction: [cleverapps.UI.VERTICAL, cleverapps.UI.HORIZONTAL, cleverapps.UI.HORIZONTAL],
reversed: [!1, !0, !0],
freeBlock: {
textWidth: 120
}
}
};
var BlocksGame = function(a, b) {
GameBase.call(this, a, b);
this._modeCounter = this.savedGame._modeCounter || 0;
this.mode = this.savedGame.mode || a.content.mode || 0;
this.maxMode = BlocksGame.MODES.length - 1;
void 0 !== this.savedGame.maxMode ? this.maxMode = this.savedGame.maxMode : void 0 !== a.content.maxMode && (this.maxMode = a.content.maxMode);
this.grid = new (cleverapps.environment.isEditorScene() ? EditorGrid : Grid)(a.content,this.savedGame.cells);
this.pieces = new Pieces(this,this.savedGame.pieces);
this.hover = {};
this.explodedLines = 0;
this.levelWithTutorial() && (this.tutorial = new BlocksTutorial(this.level,this.savedGame.tutorial));
this.score.on("onUpdate", this.onScoreUpdate.bind(this));
this.score.on("onShow", cleverapps.highscore.showView.bind(cleverapps.highscore));
this.score.on("onHide", cleverapps.highscore.hideView.bind(cleverapps.highscore));
this.movesSinceClear = 0;
a.content.goals && a.content.goals.length && (this.goals = new Goals(this.levelContent,this.savedGame.goals));
this.history = new UndoHistory(this.savedGame.history);
cleverapps.config.debugMode && (this.orangery = new Orangery(BlocksOrangery));
this.counter.registerStage(1, this.checkWin.bind(this));
this.counter.registerStage(2, this.nextStep.bind(this));
this.goalCounter = new Counter;
this.goalCounter.registerStage(0, function() {
this.counter.trigger()
}
.bind(this))
}
, Game = BlocksGame;
BlocksGame.prototype = Object.create(GameBase.prototype);
BlocksGame.constructor = BlocksGame;
BlocksGame.prototype.checkWin = function() {
this.getMode() !== GameBase.MODE_HIGHSCORE && this.goals && this.goals.isDone && this.outcome === GameBase.OUTCOME_UNKNOWN && this.win()
}
;
BlocksGame.prototype.animateOutcome = function() {
this.goalCounter.isActive() || GameBase.prototype.animateOutcome.call(this)
}
;
BlocksGame.prototype.lose = function() {
Game.currentGame.isMemorableGame() ? this.setOutcome(GameBase.OUTCOME_VICTORY) : this.setOutcome(GameBase.OUTCOME_LOST)
}
;
BlocksGame.prototype.getMode = function() {
return this.level.levelType === Level.LevelTypes.HIGHSCORE_MODE ? GameBase.MODE_HIGHSCORE : GameBase.MODE_REGULAR
}
;
BlocksGame.prototype.resetHover = function() {
if (void 0 !== this.hover.index) {
var a = this.pieces.getPiece(this.hover.index);
Forms.convertFormToCoordinates(a.getForm()).forEach(function(b) {
this.grid.getCell(this.hover.x + b.x, this.hover.y + b.y).resetHover()
}, this);
this.hover.rows && this.grid.resetExplodeHint(this.hover.rows, this.hover.columns);
this.hover = {}
}
}
;
BlocksGame.prototype.dragMovePiece = function(a, b) {
var c = this.getPieceCoordinatesInGrid(a, b);
b = c.x;
c = c.y;
var d = a.index;
if (!this.grid.isInside(b, c))
this.resetHover();
else if (this.hover.index !== d || this.hover.x !== b || this.hover.y !== c)
this.resetHover(),
0 === this.placementErrors(a.getForm(), b, c) && (this.hover.index = d,
this.hover.x = b,
this.hover.y = c,
this.takeAndPlacePiece(this.hover.index, b, c, !0))
}
;
BlocksGame.prototype.dragEndPiece = function(a, b) {
b = this.getPieceCoordinatesInGrid(a, b);
var c = b.x
, d = b.y
, e = a.index;
this.grid.hideHint();
this.resetHover();
this.grid.isInside(c, d) && 0 === this.placementErrors(a.getForm(), c, d) ? (this.currentMove = a.getInfo(),
this.currentMove.position = b,
this.currentMove.isLast = this.pieces.pieces.filter(function(f) {
return !f
}).length === this.pieces.pieces.length - 1,
this.takeAndPlacePiece(e, c, d, !1)) : (cleverapps.audio.playSound(bundles.blocks.urls.wrong_effect),
this.tutorial && this.tutorial.showHint())
}
;
BlocksGame.prototype.getPieceCoordinatesInGrid = function(a, b) {
b = this.grid.getView().convertToNodeSpace(b);
var c = GridView.positionToCell(b);
b = c.x;
c = c.y;
b = Math.round(b - a.getCenter().x);
c = Math.round(c - a.getCenter().y);
return cc.p(b, c)
}
;
BlocksGame.prototype.undo = function(a) {
if (a.isLast)
for (var b = 0; b < this.pieces.pieces.length; b++)
b !== a.index && this.pieces.take(b);
this.pieces.clearHint(a.index);
this.pieces.replacePiece(a);
b = this.pieces.getPiece(a.index);
this.removePiece(b, a.position.x, a.position.y);
cleverapps.audio.playSound(bundles.game.urls.explosion_piece_effect);
this.checkMoves();
this.score.setPoints(a.score);
a.highscore && cleverapps.highscore.setScore(a.highscore);
this.moves--;
this.movesSinceClear--
}
;
BlocksGame.prototype.removePiece = function(a, b, c) {
Forms.convertFormToCoordinates(a.getForm()).forEach(function(d) {
this.grid.getCell(b + d.x, c + d.y).remove(a.getColor())
}
.bind(this))
}
;
BlocksGame.prototype.isMemorableGame = function() {
return !cleverapps.gameModes.alwaysNoMemorable && this.getMode() === GameBase.MODE_HIGHSCORE && 200 <= this.score.points
}
;
BlocksGame.prototype.setMoves = function() {
cleverapps.audio.playSound(bundles.blocks.urls.prolongation_effect);
this.pieces.onHidePieces();
this.pieces.pieces = [void 0, void 0, void 0];
this.applySelectionAlgorithm({
findSolvable: !0,
findMaxExplode: !1,
proposedIndexes: !1,
enableDuplicate: !0,
callback: function(a) {
a = (a.items || []).map(function(b) {
return Forms.ALL_POSSIBLE_VARIANTS[b]
});
this.pieces.nextPieces = a.map(function(b) {
return {
form: b,
color: this.pieces.calcPieceColor()
}
}
.bind(this));
this.counter.trigger(150)
}
.bind(this)
})
}
;
BlocksGame.prototype.noMoves = function() {
if (cleverapps.user.checkAvailable(cleverapps.Availables.FREE_PROLONGATION)) {
var a = this.prolongation.hasOffer() && this.prolongation.getOffer(Prolongation.TYPES.MOVES);
if (a && "free" === a.priceType)
this.prolongationUsed = !0,
this.trigger("outOfMoves", a);
else {
var b = cleverapps.boosters.listBoosters().find(function(c) {
return !this.prolongationUsed && c.isForceAvailable()
}
.bind(this));
this.prolongationUsed = !0;
b ? b.showForce() : this.trigger("outOfMoves", a)
}
} else
this.trigger("outOfMoves")
}
;
BlocksGame.prototype.placePiece = function(a, b, c, d) {
d = d || {};
var e = a.getColor()
, f = a.getForm();
f = Forms.convertFormToCoordinates(f);
f.forEach(function(h) {
var k = a.getMark(h.x, h.y)
, m = a.getComponents(h.x, h.y)
, l = this.grid.getCell(b + h.x, c + h.y);
l && (d.isHover ? l.setHover({
color: e
}) : (l.resetHover(),
this.grid.setCellProperties(b + h.x, c + h.y, {
color: e,
mark: k && k.type,
components: m
})))
}, this);
var g = this.checkLines(e, d.isHover);
d.isHover || a.fromOrangery || (this.playPiece(f.length),
0 < g && this.history.reset(),
this.counter.trigger())
}
;
BlocksGame.prototype.playPiece = function(a) {
cleverapps.config.editorMode || (this.moves++,
10 === this.moves && cleverapps.playSession.set(cleverapps.EVENTS.MOVES10_DAU, !0),
this._modeCounter++,
this.currentMove && (this.currentMove.score = this.score.points,
this.getMode() === GameBase.MODE_HIGHSCORE && (this.currentMove.highscore = cleverapps.highscore.getScore()),
this.history.add(this.getCommand(this.currentMove)),
this.movesSinceClear++,
this.score.addPoints(a * BlocksGame.PIECE_COST),
this._modeCounter >= 3 * BlocksGame.MODES[this.mode].steps && (this._modeCounter = 0,
this.mode !== this.maxMode && (this.mode++,
this.grid.changeModeFrameColor(BlocksGame.MODES[this.mode].color))),
cleverapps.audio.playSound(bundles.blocks.urls.tile_set_effect)))
}
;
BlocksGame.prototype.takeAndPlacePiece = function(a, b, c, d) {
var e = this.pieces.getPiece(a);
d || this.pieces.take(a, !0);
this.placePiece(e, b, c, {
isHover: d
})
}
;
BlocksGame.prototype.showGoalsMessage = function(a) {
cleverapps.timeouts.setTimeout(function() {
this.trigger("showGoalsMessage")
}
.bind(this), 200);
cleverapps.timeouts.setTimeout(a, 2200)
}
;
BlocksGame.prototype.showStartGameMessage = function(a, b) {
this.goals && !b ? this.showGoalsMessage(a) : a()
}
;
BlocksGame.prototype.checkLines = function(a, b) {
var c = this.grid.listFilledLines()
, d = c.rows
, e = c.columns;
c = d.length + e.length;
0 < c && (b ? (this.grid.setExplodeHint(d, e, a),
this.hover.rows = d,
this.hover.columns = e) : (this.grid.explodeRowsOrColumns(d, e, a),
this.explodedLines += c,
a = 1,
4 <= c ? a = 3 : 3 <= c && (a = 2),
a = c * a * BlocksGame.LINE_COST,
this.score.addPoints(a, !0),
1 < c && this.grid.showCombo(a),
10 <= this.movesSinceClear && this.grid.isEmpty() && (this.grid.fill(Grid.FILL_EFFECTS.FromCenter),
this.movesSinceClear = 0)));
return c
}
;
BlocksGame.prototype.onScoreUpdate = function(a) {
!this.highScoreBroken && this.getMode() === GameBase.MODE_HIGHSCORE && a > cleverapps.highscore.getScore() && (this.highScoreBroken = !0,
cleverapps.exclamation.show("message.newHighscore"),
cleverapps.audio.playSound(bundles.game.urls.message_effect));
this.getMode() === GameBase.MODE_HIGHSCORE && a > cleverapps.highscore.getScore() && cleverapps.highscore.setScore(a);
var b = Game.currentGame.goals.findTargetFor(BlocksGame.GOALS_TYPES.SCORE);
b && b.setAmount(a)
}
;
BlocksGame.prototype.hint = function(a) {
for (var b = Infinity, c, d, e = !1, f = 0; f < Grid.WIDTH; f++)
for (var g = 0; g < Grid.HEIGHT; g++) {
var h = this.placementErrors(a, f, g);
h < b ? (b = h,
c = f,
d = g,
e = !0) : h === b && (e = !1)
}
return {
single: e,
x: c,
y: d,
errors: b
}
}
;
BlocksGame.prototype.placementErrors = function(a, b, c) {
var d = this.grid.placeFormErrors(a, b, c, !0);
this.tutorial && this.tutorial.isActive() && !this.tutorial.isCorrectPlace(a, b, c) && d++;
return d
}
;
BlocksGame.prototype.checkMoves = function() {
if (!this.pieces.isEmpty()) {
for (var a = !0, b = 0; b < this.pieces.pieces.length; b++) {
var c = this.pieces.pieces[b];
if (c) {
var d = this.hint(c.getForm());
0 === d.errors ? (c.enable(),
a = !1) : c.disable();
d.single ? c.setHint(d) : c.clearHint()
}
}
a && this.noMoves()
}
}
;
BlocksGame.prototype.nextStep = function() {
this.outcome === GameBase.OUTCOME_UNKNOWN && (this.pieces.isEmpty() ? (this.tutorial && this.tutorial.isActive() && this.tutorial.wantNextStep(),
this.pieces.getNewPieces(this.checkMoves.bind(this)),
this.tutorial && this.tutorial.showHint()) : this.checkMoves())
}
;
BlocksGame.prototype.showScreen = function(a, b) {
cleverapps.focusManager.compound(a, [function(c) {
b ? (this.grid.iterateCells(function(d) {
d.updateViewProperties()
}),
c()) : this.grid.fill(Grid.FILL_EFFECTS[this.getMode() === GameBase.MODE_REGULAR ? "LinearFromBottom" : "FromCenter"], c)
}
.bind(this), function(c) {
this.pieces.nextPieces ? this.pieces.getNewPieces(c, b) : c()
}
.bind(this), function(c) {
this.trigger("showGoals", b);
this.score.show();
this.grid.changeModeFrameColor(BlocksGame.MODES[this.mode].color);
c()
}
.bind(this)])
}
;
BlocksGame.prototype.displayTutorial = function(a) {
this.tutorial.hasStep() && (cleverapps.focusManager.setEventNodes([cleverapps.scenes.getRunningScene()]),
this.tutorial.startTutorial(),
this.tutorial.onFinishCallback = a,
cleverapps.focusManager.display({
stack: !0,
focus: "TutorialForce",
actions: [function(b) {
this.pieces.getNewPieces(b)
}
.bind(this), function(b) {
this.tutorial.showForce(b);
this.tutorial.showHint()
}
.bind(this)]
}))
}
;
BlocksGame.prototype.getInfo = function() {
var a = GameBase.prototype.getInfo.call(this);
this.stopped || (a.score = this.score.getPoints(),
a.moves = this.moves,
a._modeCounter = this._modeCounter,
a.mode = this.mode,
a.maxMode = this.maxMode,
a.cells = this.grid.getInfo(),
a.pieces = this.pieces.getInfo(),
a.tutorial = this.tutorial && this.tutorial.getInfo(),
a.history = this.history.getInfo(),
this.goals && (a.goals = this.goals.getInfo()));
return a
}
;
BlocksGame.prototype.guessPosition = function(a) {
return {
x: Grid.WIDTH - a[0].length >> 1,
y: Grid.HEIGHT - a.length + 1 >> 1
}
}
;
BlocksGame.prototype.customGridForPiece = function(a) {
var b = this.guessPosition(a)
, c = b.x;
b = b.y;
for (var d = [], e = 0; e <= BlocksGame.COLORS.length; e++)
d.push(e);
cleverapps.Random.shuffle(d);
e = 2 < a[0].length || 1 === a.length;
var f, g, h = d[0];
if (1 < a.length || !e)
for (f = 0; f < a.length; f++)
for (g = 0; g < Grid.WIDTH; g++)
this.grid.setCellProperties(g, b + f, {
color: h,
fadeIn: !0
});
d = d[1];
if (e)
for (g = 0; g < a[0].length; g++)
for (f = 0; f < Grid.HEIGHT; f++)
this.grid.setCellProperties(c + g, f, {
color: d,
fadeIn: !0
});
for (f = 0; f < a.length; f++)
for (g = 0; g < a[f].length; g++)
"x" === a[f][g] && this.grid.setCellProperties(c + g, b + f, {
color: BlocksGame.COLOR_NONE
})
}
;
BlocksGame.prototype.getPercentOfCompletion = function() {
return cleverapps.highscore ? this.score.getPoints() / cleverapps.highscore.getScore() : 1
}
;
BlocksGame.prototype.calcPieceForms = function(a) {
for (var b = BlocksGame.MODES[this.mode], c = b.times || 1, d = void 0, e = Infinity, f = 0; f < c; f++) {
var g = this.proposeMove(b.filter);
g.score < e && (e = g.score,
d = g.chosen)
}
var h = cleverapps.styles.COLORS.COLOR_GRAY
, k = !1;
b.maxExplode && (k = Math.random() < parseInt(b.maxExplode) / 100);
var m = !1;
b.solvable && (m = Math.random() < parseInt(b.solvable) / 100);
this.applySelectionAlgorithm({
findSolvable: m,
findMaxExplode: k,
proposedIndexes: d,
callback: function(l) {
k ? h = cleverapps.styles.COLORS.COLOR_RED : m && (h = cleverapps.styles.COLORS.LIFE_GREEN);
this.grid.updatePiecesData(h, l);
a(cleverapps.Random.shuffle(l.items).map(function(n) {
return Forms.ALL_POSSIBLE_VARIANTS[n]
}))
}
.bind(this)
})
}
;
BlocksGame.prototype.applySelectionAlgorithm = function(a) {
cleverapps.webWorker.postMessage({
grid: this.grid.toStringArray(),
findMaxExplode: a.findMaxExplode,
findSolvable: a.findSolvable,
proposed: a.proposedIndexes,
enableDuplicate: a.enableDuplicate
});
cleverapps.webWorker.onmessage = function(b) {
a.callback(b.data)
}
}
;
BlocksGame.prototype.proposeMove = function(a) {
var b = Forms.ALL_POSSIBLE_VARIANTS
, c = b.map(function(f, g) {
return g
});
a && (c = c.filter(function(f) {
return a(b[f])
}));
c = cleverapps.Random.shuffle(c);
for (var d = c.slice(0, 2), e = 2; e < c.length; e++)
if (0 === this.hint(b[c[e]]).errors) {
d.push(c[e]);
break
}
2 === d.length && d.push(c[2]);
c = Forms.GetHardness(b[d[0]]) + Forms.GetHardness(b[d[1]]) + Forms.GetHardness(b[d[2]]);
return {
chosen: d,
score: c
}
}
;
BlocksGame.prototype.shakeField = function(a) {
this.trigger("shakeField", a)
}
;
BlocksGame.prototype.getCommand = function(a) {
return {
move: a,
undo: this.undo.bind(this, a),
redo: function() {}
}
}
;
BlocksGame.prototype.useLives = function() {
return GameBase.prototype.useLives.call(this) && this.getMode() !== GameBase.MODE_HIGHSCORE
}
;
BlocksGame.MODES = [{
steps: 3,
filter: function(a) {
return Forms.GetHardness(a) <= Forms.__BY_HARDNESS[0].points
},
solvable: "100%",
color: cleverapps.styles.COLORS.MODE_COLOR_GREEN
}, {
steps: 20,
filter: function(a) {
return Forms.GetHardness(a) <= Forms.__BY_HARDNESS[1].points
},
solvable: "100%",
maxExplode: "25%",
color: cleverapps.styles.COLORS.MODE_COLOR_BLUE
}, {
steps: 30,
times: 4,
solvable: "100%",
maxExplode: "25%",
color: cleverapps.styles.COLORS.MODE_COLOR_YELLOW
}, {
steps: 40,
times: 3,
solvable: "80%",
maxExplode: "25%",
color: cleverapps.styles.COLORS.MODE_COLOR_ORANGE
}, {
times: 2,
filter: function(a) {
return Forms.GetHardness(a) >= Forms.__BY_HARDNESS[1].points
},
maxExplode: "20%",
color: cleverapps.styles.COLORS.MODE_COLOR_RED
}];
BlocksGame.PIECE_COST = 1;
BlocksGame.LINE_COST = 10;
BlocksGame.COLOR_NONE = -1;
BlocksGame.COLORS = [{
rgb: cleverapps.styles.COLORS.BLOCK_COLOR_RED,
image: bundles.blocks.frames.cell_bg_red_png,
skin: "red"
}, {
rgb: cleverapps.styles.COLORS.BLOCK_COLOR_GREEN,
image: bundles.blocks.frames.cell_bg_green_png,
skin: "green"
}, {
rgb: cleverapps.styles.COLORS.BLOCK_COLOR_BLUE,
image: bundles.blocks.frames.cell_bg_blue_png,
skin: "blue"
}, {
rgb: cleverapps.styles.COLORS.BLOCK_COLOR_YELLOW,
image: bundles.blocks.frames.cell_bg_yellow_png,
skin: "yellow"
}, {
rgb: cleverapps.styles.COLORS.BLOCK_COLOR_PURPLE,
image: bundles.blocks.frames.cell_bg_purple_png,
skin: "purple"
}, {
rgb: cleverapps.styles.COLORS.BLOCK_COLOR_CYAN,
image: bundles.blocks.frames.cell_bg_cyan_png,
skin: "pink"
}, {
rgb: cleverapps.styles.COLORS.BLOCK_COLOR_ORANGE,
image: bundles.blocks.frames.cell_bg_orange_png,
skin: "orange"
}];
BlocksGame.GOALS_TYPES = {
CRYSTAL_BLUE: "crystal_blue",
CRYSTAL_PINK: "crystal_pink",
CRYSTAL_ORANGE: "crystal_orange",
SCORE: "score"
};
BlocksGame.MARKS = {
goal_blue: {
image: bundles.blocks.frames.cell_crystal_blue_png,
flyingView: bundles.blocks.jsons.letter_mark_json,
disableImage: bundles.blocks.frames.cell_crystal_blue_disable_png,
target: BlocksGame.GOALS_TYPES.CRYSTAL_BLUE,
collectEffect: bundles.blocks.urls.blue_mark_collect_effect
},
goal_pink: {
image: bundles.blocks.frames.cell_crystal_pink_png,
disableImage: bundles.blocks.frames.cell_crystal_pink_disable_png,
target: BlocksGame.GOALS_TYPES.CRYSTAL_PINK,
collectEffect: bundles.blocks.urls.pink_mark_collect_effect
},
goal_orange: {
image: bundles.blocks.frames.cell_crystal_orange_png,
disableImage: bundles.blocks.frames.cell_crystal_orange_disable_png,
target: BlocksGame.GOALS_TYPES.CRYSTAL_ORANGE,
collectEffect: bundles.blocks.urls.orange_mark_collect_effect
},
letter: {
spine: bundles.blocks.jsons.letter_mark_json,
flyingView: bundles.blocks.jsons.letter_mark_json,
getTarget: function() {
return "mission_reward" + Mission.TYPE_LETTER
},
explodeEffect: bundles.blocks.urls.explode_letter_effect,
collectEffect: bundles.blocks.urls.letter_mark_collect_effect
}
};
BlocksGame.DISABLE_COLOR = {
image: bundles.blocks.frames.cell_bg_gray_png
};
BlocksGame.FIELD_MAX_SCALE = 1.4;
var BlocksTutorial = function(a, b) {
this.step = b && b.step || 0;
this.config = BlocksTutorial.TutorialConfig(a)
};
BlocksTutorial.prototype.startTutorial = function() {
!cleverapps.config.wysiwygMode && this.hasStep() && (this.running = !0,
this.step = (this.step || 0) - 1,
this.wantNextStep({
silent: !0
}),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.STATS.TUTORIAL_BEGIN))
}
;
BlocksTutorial.isAvailable = function(a) {
return cleverapps.config.editorMode ? !1 : (a = a.content.tutorial) ? void 0 !== BlocksTutorial.TUTORIAL_LEVELS[a] : !1
}
;
BlocksTutorial.TutorialConfig = function(a) {
return BlocksTutorial.TUTORIAL_LEVELS[a.content.tutorial]
}
;
BlocksTutorial.prototype.isActive = function() {
return this.running && this.hasStep()
}
;
BlocksTutorial.prototype.afterResize = function() {
this.isActive() && !Game.currentGame.pieces.isEmpty() && this.showHint()
}
;
BlocksTutorial.prototype.wantNextStep = function(a) {
a = a || {};
this.step++;
var b = this.config.tutorial[this.step]
, c = this.step && this.config.tutorial[this.step - 1];
c && c.force && cleverapps.forces.isRunningForce(c.force) && cleverapps.forces.closeRunningForce();
b ? (c = b.grid || {},
a.silent && (c.silent = !0),
b.customGrid && Game.currentGame.counter.setTimeout(function() {
Game.currentGame.customGridForPiece(b.piece, a)
}, this.step ? Grid.EXPLODE_DURATION : 0),
b.piece && (Game.currentGame.pieces.nextPieces = [void 0, {
form: b.piece,
color: cleverapps.Random.choose(Object.keys(BlocksGame.COLORS))
}, void 0])) : (this.onFinishCallback && this.onFinishCallback(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.GENERAL.TUTORIAL_COMPLETE))
}
;
BlocksTutorial.prototype.needFillGrid = function() {
var a = this.config.tutorial[this.step];
return a && a.customGrid
}
;
BlocksTutorial.prototype.showForce = function(a) {
var b = this.config.tutorial[this.step];
if (b.force) {
var c = cleverapps.scenes.getRunningScene();
cleverapps.forces.create(c.field, b.force);
cleverapps.forces.onceForceClosed = a
}
}
;
BlocksTutorial.prototype.showHint = function() {
if (this.isActive()) {
var a = this.config.tutorial[this.step]
, b = this.guessPosition(a.piece);
Game.currentGame.pieces.startHint({
x: b.x + a.piece[0].length / 2,
y: b.y + a.piece.length / 2
})
}
}
;
BlocksTutorial.prototype.isCorrectPlace = function(a, b, c) {
a = this.guessPosition(a);
return a.x === b && a.y === c
}
;
BlocksTutorial.prototype.guessPosition = function(a) {
return this.config.tutorial[this.step].position || Game.currentGame.guessPosition(a)
}
;
BlocksTutorial.prototype.hasStep = function() {
return this.step < this.config.tutorial.length
}
;
BlocksTutorial.prototype.getInfo = function() {
return {
step: this.step
}
}
;
BlocksTutorial.TUTORIAL_LEVELS = {
initial: {
tutorial: [{
force: {
text: "Blocks.TutorialMessage1",
position: Dialogue.POSITIONS.TOP_LOWER,
finger: {
delay: 10
}
},
piece: ["x", "x"],
customGrid: !0
}, {
piece: ["xxx"],
customGrid: !0
}, {
piece: [".xx", "xx."],
customGrid: !0
}]
},
burnLines: {
tutorial: [{
force: {
text: "Blocks.TutorialMessage2",
position: Dialogue.POSITIONS.TOP_LOWER,
finger: {
delay: 10
}
},
piece: ["x", "x"],
position: {
x: 4,
y: 3
}
}]
},
ice: {
tutorial: [{
force: {
text: "Blocks.TutorialMessage.Ice",
position: Dialogue.POSITIONS.BOTTOM,
finger: {
delay: 10
}
},
piece: ["x"],
position: {
x: 4,
y: 5
}
}, {
piece: ["xx"],
position: {
x: 2,
y: 4
}
}]
}
};
var BlocksGameScene = GameSceneBase.extend({
onSceneLoaded: function() {
this._super();
this.createHighScoreView();
var a = this.gridView = new GridView(this.game.grid);
this.game.grid.iterateCells(function(c) {
c.updateViewProperties({
color: BlocksGame.COLOR_NONE
})
});
var b = this.piecesView = new PiecesView(this.game.pieces);
this.game.goals && (this.goalsView = new GoalsView(this.game.goals));
a = this.gridLayout = new cleverapps.Layout([this.goalsView, a],{
direction: cleverapps.resolution.mode !== cleverapps.WideMode.HORIZONTAL ? cleverapps.UI.VERTICAL : cleverapps.UI.HORIZONTAL,
margin: cleverapps.styles.BlocksGameScene.margin
});
this.field = new cleverapps.Layout([a, b],{
direction: cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? cleverapps.UI.HORIZONTAL : cleverapps.UI.VERTICAL,
margin: cleverapps.styles.BlocksGameScene.margin
});
this.addChild(this.field);
cleverapps.gameModes.hidePieces && b.setVisible(!1);
FieldScoreView.fillPool();
!(b = Game.currentGame.orangery) || cleverapps.gameModes.noControls || cleverapps.config.wysiwygMode || (a = new OrangeryView(b),
this.addChild(a),
cleverapps.focusManager.registerControl(b.getControlName(), new HidingNode(a,cleverapps.UI.VERTICAL)));
(b = cleverapps.boosters.getBoosterById(cleverapps.Boosters.TYPE_REPLACE_ALL)) && b.isAvailable() && (b = this.replaceAllButtonBooster = new ReplaceAllButtonBooster(b),
this.addChild(b),
this.replaceAllControl = new HidingNode(b),
cleverapps.focusManager.registerControl(b.getControlId(), this.replaceAllControl));
(b = cleverapps.boosters.getBoosterById(cleverapps.Boosters.TYPE_CLEAR_PIECES)) && b.isAvailable() && (b = this.clearPiecesButtonBooster = new ClearPiecesButtonBooster(b),
this.addChild(b),
this.clearPiecesControl = new HidingNode(b),
cleverapps.focusManager.registerControl(b.getControlId(), this.clearPiecesControl));
(b = cleverapps.boosters.getBoosterById(cleverapps.Boosters.TYPE_UNDO_PIECE)) && b.isAvailable() && (b = this.undoPieceButtonBooster = new UndoPieceButtonBooster(b),
this.addChild(b),
this.undoPieceControl = new HidingNode(b),
cleverapps.focusManager.registerControl(b.getControlId(), this.undoPieceControl));
cleverapps.playSession.set(cleverapps.EVENTS.START_LEVEL_DAU, !0);
this.updateSize();
this.setupChildren();
this.game.on("showGoals", function(c) {
this.goalsView && this.goalsView.show(c)
}
.bind(this), this);
this.game.on("showGoalsMessage", this.showGoalsMessage.bind(this), this);
this.game.on("shakeField", this.shakeField.bind(this), this)
},
outOfMoves: function(a) {
cleverapps.focusManager.display({
focus: "noMovesWindow",
actions: [function(b) {
cleverapps.audio.playSound(bundles.blocks.urls.nomoves_exclamation_effect);
cleverapps.exclamation.show("message.noMoves", Exclamation.Types.Warning, b)
}
, function(b) {
a ? (new ProlongationWindow(this.game.prolongation,{
offer: a,
onGiveUp: function() {
this.game.lose()
}
.bind(this)
}),
cleverapps.focusManager.onceNoWindowsListener = b) : (this.game.lose(),
b())
}
.bind(this)]
})
},
showGoalsMessage: function() {
var a = new GoalsMessageContent(this.game.goals.elements)
, b = new GameMessageView(void 0,{
content: a
});
this.addChild(b);
a.onShow()
},
createHighScoreView: function() {
var a = cleverapps.highscore.getScore();
!cleverapps.gameModes.hideHighScore && Game.currentGame.getMode() === GameBase.MODE_HIGHSCORE && 0 < a && (a = this.highScoreView = new HighScoreView(cleverapps.highscore),
this.addChild(a))
},
getOverlappingNodes: function() {
var a = [this.upMenuContainer, this.replaceAllControl, this.clearPiecesControl, this.clearPiecesControl, this.horizontalBlocker];
if (this.highScoreView)
if (cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL) {
var b = new cc.Node;
b.setPositionRound(this.highScoreView.getBoundingBox());
b.setContentSize(this.width, this.highScoreView.height);
this.addChild(b);
a.push(b)
} else
a.push(this.highScoreView);
return a.filter(Boolean)
},
scaleGameField: function() {
var a = cc.p(this.width / 2, this.height / 2);
cleverapps.resolution.mode === cleverapps.WideMode.SQUARE && this.undoPieceControl && (a.x = this.undoPieceControl.getGlobalBoundingBox().x / 2);
cleverapps.UI.inflateToBoundaries(this.field, this.getOverlappingNodes(), {
lovesPosition: this.convertToWorldSpace(a),
padding: cleverapps.styles.BlocksGameScene.padding[cleverapps.resolution.mode],
maxScale: BlocksGame.FIELD_MAX_SCALE
})
},
setupChildren: function() {
if (this.isAllLoaded) {
this._super();
var a = cleverapps.styles.BlocksGameScene;
this.field.setPositionRound(a.field);
this.highScoreView && this.highScoreView.setPositionRound(a.highScore.position)
}
},
updateSize: function() {
this._super();
if (this.isAllLoaded) {
var a = cleverapps.styles.BlocksGameScene
, b = a.piecesView.anchor[cleverapps.resolution.mode];
this.piecesView.setAnchorPoint(b.x, b.y);
this.piecesView.resize();
this.goalsView && this.goalsView.updateSize();
b = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? a.verticalMargin : a.margin;
var c = cleverapps.resolution.mode !== cleverapps.WideMode.VERTICAL ? cleverapps.UI.HORIZONTAL : cleverapps.UI.VERTICAL;
this.gridLayout.setOptions({
direction: cleverapps.resolution.mode === cleverapps.WideMode.HORIZONTAL ? cleverapps.UI.HORIZONTAL : cleverapps.UI.VERTICAL,
margin: b
});
this.field.setOptions({
direction: c,
margin: b
});
this.highScoreView && this.highScoreView.setScale(a.highScore.scale[cleverapps.resolution.mode])
}
},
shakeField: function(a) {
if (!this.field.shakeAction || this.field.shakeAction.isDone())
a = a || {},
a = a.fullShake ? BlocksGameScene.SHAKE_ACTIONS.FULL.apply(this) : BlocksGameScene.SHAKE_ACTIONS.DOWN_UP.apply(this),
this.field.shakeAction = this.field.runAction(a)
}
});
GameScene = BlocksGameScene;
BlocksGameScene.SHAKE_ACTIONS = {
FULL: function() {
return AnimationsLibrary.shake(this.field, {
power: 10,
points: [{
x: 1,
y: 1,
r: 0
}, {
x: 1,
y: -1,
r: 0
}, {
x: -1,
y: -1,
r: 0
}, {
x: -1,
y: 1,
r: 0
}, {
x: 0,
y: 0,
r: 0
}]
})
},
DOWN_UP: function() {
return AnimationsLibrary.shake(this.field, {
power: 15,
points: [{
x: 0,
y: -1,
r: 0
}, {
x: 0,
y: 2,
r: 0
}, {
x: 0,
y: 0,
r: 0
}]
})
}
};
cleverapps.styles.BlocksGameScene = {
padding: [{
top: 30,
bottom: 60,
left: 30,
right: 30
}, {
top: 30,
bottom: 140,
left: 30,
right: 30
}, {
top: 30,
bottom: 180,
left: 30,
right: 30
}],
margin: 70,
verticalMargin: 30,
highScore: {
scale: [.7, .8, 1],
position: [{
x: {
align: "left",
dx: 20
},
y: {
align: "top",
dy: -120
}
}, {
x: {
align: "left",
dx: 40
},
y: {
align: "top",
dy: -130
}
}, {
x: {
align: "left",
dx: 80
},
y: {
align: "top",
dy: -150
}
}]
},
field: [{
x: {
align: "center"
},
y: {
align: "center"
}
}, {
x: {
align: "center"
},
y: {
align: "center"
}
}, {
x: {
align: "center",
dx: 50
},
y: {
align: "center"
}
}],
piecesPadding: [20, 20, 40],
scoreViewClassic: {
x: {
align: "left",
dx: 50
},
y: {
align: "center"
},
margin: 140
},
piecesView: {
anchor: [{
x: .5,
y: .5
}, {
x: 1,
y: .625
}, {
x: .5,
y: .5
}]
}
};
HideAnimations = function(a) {
cleverapps.audio.playSound(bundles.game.urls.lose_animation_effect);
var b = this.game
, c = b.grid;
cleverapps.focusManager.compound(a, [function(d) {
c.clear(!0);
c.fill(Grid.FILL_EFFECTS.LinearFromLeft, d)
}
, function(d) {
b.score.hide();
b.pieces.onHide(!0);
this.goalsView.hide();
c.hideGrid(d)
}
.bind(this)])
}
;
var FieldScoreView = cc.Node.extend({
ctor: function() {
this._super();
this.text = cleverapps.UI.generateImageText("+", cleverapps.styles.FONTS.FIELD_SCORE);
this.text.setScale(1.2);
this.addChild(this.text);
this.setLocalZOrder(-1E6);
this.setCascadeOpacityEnabled(!0)
},
onEnterTransitionDidFinish: function() {
this._super();
this.text.setString("+" + this.score);
cleverapps.styles.COLORS.CELL_COLORS[this.cellColor] && this.text.setColor(cleverapps.styles.COLORS.CELL_COLORS[this.cellColor]);
this.setPosition(this.targetPosition);
this.setOpacity(255);
this.runAction(new cc.Sequence(new cc.DelayTime(.8),new cc.Spawn(new cc.MoveBy(1,cleverapps.styles.FieldScoreView.animation.moveBy),new cc.FadeOut(1)),new cc.CallFunc(function() {
cc.pool.putInPool(this)
}
.bind(this))))
},
reuse: function(a, b, c) {
this.score = a;
this.cellColor = b;
this.targetPosition = c
},
unuse: function() {
this.removeFromParent()
}
});
FieldScoreView.factory = function(a, b, c) {
return cc.pool.hasObject(FieldScoreView) ? cc.pool.getFromPool(FieldScoreView, a, b, c) : void 0
}
;
FieldScoreView.fillPool = function() {
for (var a = 0; 3 > a; a++)
cc.pool.putInPool(new FieldScoreView);
cc.pool.hasObject(FieldScoreView)
}
;
cleverapps.overrideFonts(cleverapps.styles.FONTS, {
FIELD_SCORE: {
size: 40,
name: "default"
}
});
cleverapps.styles.FieldScoreView = {
animation: {
moveBy: {
x: 0,
y: 50
}
}
};
cleverapps.overrideStyles(cleverapps.styles.RestoreProgressButton, {
width: 200,
height: 77
});
cleverapps.overrideStyles(cleverapps.styles.LoseWindow, {
content: {
margin: 10,
padding: {
bottom: 20,
top: 10
}
}
});
cleverapps.styles.FONTS = cleverapps.overrideFonts(cleverapps.styles.FONTS, {
GAME_MESSAGE_TEXT: {
size: 60,
color: cleverapps.styles.COLORS.WHITE,
stroke: cleverapps.styles.DECORATORS.IMAGE_FONT_STROKE
},
COMBO_TEXT: {
name: "combo_digits",
size: 90
}
});
cleverapps.overrideStyles(cleverapps.styles.FingerView, {
offset: {
x: 20,
y: -10
}
});
cleverapps.overrideStyles(cleverapps.styles.LoaderSceneBackground, {
logoAnimation: {
pos: {
factorY: .8
}
}
});
cleverapps.overrideStyles(cleverapps.styles.ScoreStatsComponent, {
background: !1
});
cleverapps.overrideStyles(cleverapps.styles.PlayButtonView, {
position: [{
x: {
align: "center"
},
y: {
align: "bottom",
dy: 252
}
}, {
x: {
align: "center",
dx: -175
},
y: {
align: "bottom",
dy: 140
}
}, {
x: {
align: "center",
dx: -175
},
y: {
align: "bottom",
dy: 160
}
}]
});
cleverapps.overrideStyles(cleverapps.styles.ProgressView, {
positions: [{
x: {
align: "center"
},
y: {
align: "bottom",
dy: 364
}
}, {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 255
}
}, {
x: {
align: "center"
},
y: {
align: "bottom",
dy: 278
}
}],
icon: {
bg: {
padding: {
x: 10
},
y: {
align: "center",
dy: -4
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.CloversView, {
width: 235,
height: 82,
icon: {
x: {
align: "left",
dx: -20
}
},
position: [{
x: {
align: "left",
dx: 40
},
y: {
align: "top",
dy: -140
}
}, {
x: {
align: "left",
dx: 40
},
y: {
align: "top",
dy: -140
}
}, {
x: {
align: "left",
dx: 40
},
y: {
align: "top",
dy: -140
}
}],
text: {
x: {
align: "center",
dx: 30
},
y: {
align: "center",
dy: 0
}
}
});
cleverapps.overrideStyles(cleverapps.styles.MinimalDialogue, {
person: {
y: {
align: "center",
dy: -21
}
},
text: {
arrow: {
left: {
y: {
align: "center",
dy: -15
}
},
right: {
y: {
align: "center",
dy: -15
}
}
}
}
});
cleverapps.overrideStyles(cleverapps.styles.PackWindow, {
animation: {
"default": {
idleDelay: -.7,
dx: 0,
dy: 50
},
starterPack0: {
idleAnimation: "0_idle",
introAnimation: "0_start"
},
starterPack: {
idleAnimation: "1_idle",
introAnimation: "1_start"
},
starterPack2: {
idleAnimation: "2_idle",
introAnimation: "2_start"
}
},
button: {
width: 280,
height: 110
},
rewards: {
delay: .2,
duration: .375,
fitTo: {
width: 120,
height: 80
},
positions: {
starterPack0: {
boosters: {
22: {
rotation: 10,
x: 130,
y: -250
},
21: {
rotation: 10,
x: 130,
y: 80
}
},
hard: {
rotation: 10,
x: -112,
y: 78
},
soft: {
rotation: 10,
x: -112,
y: -252
}
},
starterPack: {
boosters: {
20: {
rotation: 10,
x: 138,
y: 80
}
},
unlimitedLives: {
rotation: 10,
x: 138,
y: -250
},
hard: {
rotation: 10,
x: -112,
y: 76
},
soft: {
rotation: 10,
x: -112,
y: -254
}
},
starterPack2: {
boosters: {
20: {
rotation: 10,
x: 138,
y: -250
},
21: {
rotation: 10,
x: 135,
y: 80
}
},
hard: {
rotation: 10,
x: -112,
y: 76
},
soft: {
rotation: 10,
x: -112,
y: -254
}
}
}
}
});
var BoosterOfferLogic = function(a) {
cleverapps.EventEmitter.call(this);
this.offer = a
};
BoosterOfferLogic.prototype = Object.create(cleverapps.EventEmitter.prototype);
BoosterOfferLogic.prototype.constructor = BoosterOfferLogic;
BoosterOfferLogic.prototype.getTimeLeft = function() {}
;
BoosterOfferLogic.prototype.isIconAvailable = function() {
return !0
}
;
BoosterOfferLogic.prototype.hasIconAttention = function() {
return !1
}
;
BoosterOfferLogic.prototype.getProduct = function() {
return Product.CreateById("kit3")
}
;
BoosterOfferLogic.prototype.processBought = function() {
new RewardWindow(Offers[this.offer.type].reward,{
event: cleverapps.EVENTS.EARN.PURCHASE
});
cleverapps.eventLogger.logEvent(this.offer.name + "_" + cleverapps.EVENTS.OFFER_LOT);
this.offer.complete()
}
;
var BoosterOfferWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.logic = a.logic;
var b = this.logic.getProduct();
a = cleverapps.styles.BoosterOfferWindow;
var c = a.button;
c.text = b.getCurrentPrice();
c.onPressed = function() {
this.buyProduct()
}
.bind(this);
b = this.generateContent(b);
this._super({
name: "BoosterOfferWindow",
title: "BoosterOffer.title",
content: b,
button: c,
styles: a,
notCloseByTouchInShadow: !0,
closeButtonDelay: !0
});
cleverapps.paymentsLogic.onChangeStatus(this.updateButton.bind(this), this);
this.updateButton()
},
updateButton: function() {
connector.payments.isConnected() ? this.buttons.enable() : this.buttons.disable()
},
onShow: function() {
this._super();
this.runAction(new cc.Sequence(new cc.DelayTime(.1),new cc.PlaySound(bundles.booster_offer.urls.booster_offer_effect)))
},
buyProduct: function() {
this.logic.getProduct().buy(function(a) {
a && (this.closed || this.close(),
this.logic.processBought())
}
.bind(this))
},
generateContent: function() {
var a = cleverapps.styles.BoosterOfferWindow
, b = this.content = new cc.Node;
b.setAnchorPoint(.5, .5);
b.setPositionRound(a.position);
var c = b.animation = new cleverapps.Spine(bundles.booster_offer.jsons.booster_offer_json);
c.setAnimation(0, "animation", !0);
b.addChild(c);
b.setContentSize2(a.size);
c.setPositionRound(a.animation.position);
c = cleverapps.UI.generateOnlyText("BoosterOffer.description", cleverapps.styles.FONTS.WHITE_TITLE_TEXT);
b.addChild(c);
c.setPositionRound(a.text.position);
c.setWrapWidth(a.text.wrapWidth);
return b
}
});
BoosterOfferWindow.prototype.listBundles = function() {
return ["booster_offer"]
}
;
cleverapps.styles.BoosterOfferWindow = {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "center",
dy: 0
}
},
noBackground: !0,
size: {
width: 700,
height: 800
},
button: {
width: 300,
height: 100,
x: 0,
y: 50
},
animation: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "top",
dy: -80
}
}
},
text: {
position: {
x: {
align: "center",
dx: 0
},
y: {
align: "bottom",
dy: 0
}
},
wrapWidth: 700
}
};
cleverapps.DailyChest = function(a) {
cleverapps.config.debugMode && (cleverapps.DailyChest.TIMEOUT = "10 minutes");
a = Object.assign({
storage: DataLoader.TYPES.DAILY_CHEST,
interval: cleverapps.parseInterval(cleverapps.DailyChest.TIMEOUT)
}, a);
this.onUnlockingStarted = function() {}
;
this.interval = a.interval;
cleverapps.Chest.call(this, a)
}
;
cleverapps.DailyChest.prototype = Object.create(cleverapps.Chest.prototype);
cleverapps.DailyChest.prototype.constructor = cleverapps.DailyChest;
cleverapps.DailyChest.prototype.initializeForNewUser = function() {
this.locked = !0;
this.startUnlockFromScratch()
}
;
cleverapps.DailyChest.prototype.fromJSON = function(a) {
this.locked = !0;
this.setWhenUnlock(a.nextTime)
}
;
cleverapps.DailyChest.prototype.toJSON = function() {
return {
nextTime: this.when
}
}
;
cleverapps.DailyChest.prototype.startUnlockFromScratch = function() {
this.setWhenUnlock(Date.now() + this.interval)
}
;
cleverapps.DailyChest.prototype.open = function() {
this.locked = !0;
this.startUnlockFromScratch();
this.changeLockedListener()
}
;
cleverapps.DailyChest.prototype.resetUnlockCountdown = function() {
void 0 !== this.countdown ? this.countdown.resetTimeLeft(this.when - Date.now()) : this.countdown = new cleverapps.CountDown(this.when - Date.now(),{
onFinish: this.unlock.bind(this),
permanent: !0
});
this.onUnlockingStarted()
}
;
cleverapps.DailyChest.prototype.setWhenUnlock = function(a) {
a || (a = Date.now());
this.when = Math.min(a, Date.now() + this.interval);
this.save();
this.resetUnlockCountdown()
}
;
cleverapps.DailyChest.TIMEOUT = "3 hours";
cleverapps.MiniGame = function(a) {
cleverapps.config.debugMode && (cleverapps.MiniGame.TIMEOUT = "2 minutes");
cleverapps.DailyChest.call(this, {
isNewUser: a,
serverTaskName: "bonuses",
interval: cleverapps.parseInterval(cleverapps.MiniGame.TIMEOUT)
})
}
;
cleverapps.MiniGame.prototype = Object.create(cleverapps.DailyChest.prototype);
cleverapps.MiniGame.prototype.constructor = cleverapps.MiniGame;
cleverapps.MiniGame.prototype.initializeForNewUser = function() {
this.locked = !1;
this.setWhenUnlock(Date.now())
}
;
cleverapps.MiniGame.TIMEOUT = "1 day";
cleverapps.MiniGame.prototype.resetUnlockCountdown = function() {
cleverapps.DailyChest.prototype.resetUnlockCountdown.call(this);
cleverapps.localPushes.sendPush(cleverapps.LocalPushes.TYPES.MINI_GAME, this.when - Date.now())
}
;
cleverapps.MiniGame.prototype.refreshItems = function() {}
;
cleverapps.MiniGame.prototype.isAvailable = function() {
return levels.user.checkAvailable(cleverapps.MiniGame.AVAILABLE) ? !this.locked : !1
}
;
cleverapps.MiniGame.prototype.getReward = function() {
var a = cleverapps.Random.choose(RewardsConfig.MiniGame);
levels.user.isBeginner() && RewardsConfig.MiniGameBeginner && (a = cleverapps.Random.choose(RewardsConfig.MiniGameBeginner));
levels.user.isNovice() && RewardsConfig.MiniGameNovice && (a = cleverapps.Random.choose(RewardsConfig.MiniGameNovice));
a.betGold && delete a.betGold;
return a = cleverapps.user.prepareRewardByRich(a)
}
;
cleverapps.MiniGame.prototype.openWindow = function(a) {
cleverapps.miniGame.locked ? (cleverapps.notification.create("MiniGame.ClosedText"),
a && a()) : (a && (cleverapps.focusManager.onceNoWindowsListener = a),
a = cleverapps.clone(cleverapps.miniGame.getReward(), !0),
new MiniGameWindow(a),
cleverapps.eventBus.trigger("taskEvent", DailyTasks.PLAY_MINI_GAME))
}
;
cleverapps.MiniGame.AVAILABLE = {
level: 2.13,
registered: "1 hour",
epicart: {
disabled: !0
}
};
cleverapps.InitByFeature.minigame = function(a) {
cleverapps.miniGame = new cleverapps.MiniGame(a)
}
;
var MiniGameWindow = CleverappsWindow.extend({
onWindowLoaded: function(a) {
this.reward = a;
a = cleverapps.styles.MiniGameWindow;
this.text = cleverapps.UI.generateOnlyText("MiniGameWindow.Text", cleverapps.styles.FONTS.WINDOW_TEXT);
this.text.fitTo(a.text.width);
var b = this.createBoxesNode()
, c = new cc.Node;
c.setAnchorPoint(.5, .5);
c.setContentSize2(a.size);
c.addChild(b);
b.setPositionRound(a.animation);
c.addChild(this.text);
this.text.setPositionRound(a.text);
this._super({
title: "MiniGameWindow.Title",
name: "minigamewindow",
content: c,
closeButton: !1
})
},
createBoxesNode: function() {
var a = cleverapps.styles.MiniGameWindow
, b = new cc.Node;
b.setAnchorPoint(.5, .5);
this.boxes = [];
a.boxes.forEach(function(c, d) {
d = this.createBox(d);
this.boxes.push(d);
b.addChild(d);
d.setPositionRound(c)
}, this);
cleverapps.UI.wrap(b);
return b
},
createBox: function(a) {
var b = cleverapps.styles.MiniGameWindow
, c = new cleverapps.Spine(bundles.minigame.jsons.minigame_json);
c.setSkin(["1", "2", "3"][a]);
c.setAnimation(0, "idle", !0);
c.setPositionRound(b.box);
cleverapps.UI.applyHover(c);
cleverapps.UI.onClick(c, this.onPressed.bind(this));
return c
},
onShow: function() {
this._super();
this.showUpAnimation()
},
onHide: function() {
this._super();
this.boxes && this.boxes.forEach(function(a) {
a.stopAllActions()
});
this.text && this.text.stopAllActions()
},
showUpAnimation: function() {
var a = this.boxes
, b = a.map(function(e) {
return e.getPosition()
})
, c = [[2, 0, 1], [0, 2, 1], [1, 0, 2]];
this.text.setOpacity(0);
var d = [[20, -20, 20, -20], [-20, 20, -20, 20], [20, 0, -20, 0]];
cleverapps.focusManager.display({
stack: !0,
focus: "BoxesAnimation",
action: function(e) {
a.forEach(function(f, g) {
f.runAction(new cc.Sequence(new cc.DelayTime(.5),new cc.Spawn(new cc.MoveTo(.3,b[c[0][g]]),new cc.Sequence(new cc.RotateBy(.2,d[g][0]),new cc.RotateBy(.1,-d[g][0]))),new cc.DelayTime(.1),new cc.CallFunc(function() {
0 === g && cleverapps.audio.playSound(bundles.main.urls.daily_game_mix_effect)
}
),new cc.Spawn(new cc.MoveTo(.3,b[c[1][g]]),new cc.Sequence(new cc.RotateBy(.2,d[g][1]),new cc.RotateBy(.1,-d[g][1]))),new cc.DelayTime(.1),new cc.CallFunc(function() {
0 === g && cleverapps.audio.playSound(bundles.main.urls.daily_game_mix_effect)
}
),new cc.Spawn(new cc.MoveTo(.3,b[c[2][g]]),new cc.Sequence(new cc.RotateBy(.2,d[g][2]),new cc.RotateBy(.1,-d[g][2]))),new cc.DelayTime(.1),new cc.CallFunc(function() {
0 === g && cleverapps.audio.playSound(bundles.main.urls.daily_game_mix_effect)
}
),new cc.Spawn(new cc.MoveTo(.3,b[g]),new cc.Sequence(new cc.RotateBy(.2,d[g][3]),new cc.RotateBy(.1,-d[g][3]))),new cc.DelayTime(.3),new cc.CallFunc(function() {
0 === g && this.text.runAction(new cc.FadeIn(.5));
e()
}
.bind(this)),new cc.DelayTime(.5 * g),new cc.CallFunc(function() {
f.setAnimation(0, "animation", !0)
}
)))
}, this)
}
.bind(this)
})
},
onPressed: function() {
cleverapps.miniGame.locked || (cleverapps.miniGame.open(),
cleverapps.eventLogger.logEvent(cleverapps.EVENTS.DAILY_BONUS),
RewardWindow.createMiniGameWindow(this.reward),
this.close())
}
});
RewardWindow.createMiniGameWindow = function(a) {
return new RewardWindow(a,{
title: "MiniGameRewardWindow.title",
name: "minigamerewardwindow",
text: "MiniGameRewardWindow.text",
event: cleverapps.EVENTS.EARN.DAILY
})
}
;
cleverapps.styles.MiniGameWindow = {
size: {
width: 940,
height: 700
},
margin: 30,
padding: {
top: 30,
bottom: 30
},
text: {
width: 650,
x: {
align: "center"
},
y: {
align: "bottom",
dy: 30
}
},
box: {
width: 230,
height: 290,
x: {
align: "center",
dx: 10
},
y: {
align: "center"
}
},
boxes: [{
x: -260,
y: -180
}, {
x: 0,
y: 100
}, {
x: 260,
y: -180
}],
animation: {
x: {
align: "center"
},
y: {
align: "center",
dy: 65
}
}
};
var MiniGameToolbarItem = function() {
ToolbarItem.call(this, ToolbarItem.MINIGAME_BONUS);
this.countdown = cleverapps.miniGame.countdown;
cleverapps.miniGame.changeLockedListener = this.changeLocked.bind(this);
this.changeLocked()
};
MiniGameToolbarItem.prototype = Object.create(ToolbarItem.prototype);
MiniGameToolbarItem.prototype.constructor = MiniGameToolbarItem;
MiniGameToolbarItem.prototype.isVisible = function() {
return levels.user.checkAvailable(cleverapps.MiniGame.AVAILABLE)
}
;
MiniGameToolbarItem.prototype.unlock = function() {
this.mark()
}
;
MiniGameToolbarItem.prototype.changeLocked = function() {
cleverapps.miniGame.locked ? this.disable() : (this.enable(),
this.mark())
}
;
MiniGameToolbarItem.prototype.onClick = function() {
cleverapps.miniGame.locked ? cleverapps.notification.create("MiniGame.ClosedText", {
image: this.icon
}) : (this.unmark(),
cleverapps.focusManager.display({
focus: "MiniGameWindowFromToolbar",
action: function(a) {
cleverapps.miniGame.openWindow(a)
}
}))
}
;
var FlyingAd = function() {
cleverapps.EventEmitter.call(this);
this.nextTime = 0;
cleverapps.focusManager.registerControl("flyingAd", function(a) {
this.enabled && this.trigger("toggle", a)
}
.bind(this))
};
FlyingAd.prototype = Object.create(cleverapps.EventEmitter.prototype);
FlyingAd.prototype.constructor = FlyingAd;
FlyingAd.prototype.setGame = function() {
cleverapps.userStatus.on("inactive_very_short", this.update.bind(this))
}
;
FlyingAd.prototype.reset = function() {
this.disable();
this.purge();
this.type = void 0;
cleverapps.environment.isGameScene() && "board" === cleverapps.config.type && this.setDelay(cleverapps.parseInterval(FlyingAd.GAMESCENE_DELAY))
}
;
FlyingAd.prototype.getSkin = function() {
return FlyingAd.DATA[this.type].skin
}
;
FlyingAd.prototype.needUpdate = function() {
return !this.enabled && this.isReady()
}
;
FlyingAd.prototype.setDelay = function(a) {
this.nextTime = Date.now() + a
}
;
FlyingAd.prototype.isReady = function() {
return Date.now() >= this.nextTime
}
;
FlyingAd.prototype.update = function() {
if (!this.enabled && this.isReady()) {
var a = this.selectType();
void 0 !== a ? (this.setType(a),
this.enable()) : this.disable()
}
}
;
FlyingAd.prototype.isClickAvailable = function() {
return !this.enabled || Game.currentGame && Game.currentGame.counter.isActive() ? !1 : !0
}
;
FlyingAd.prototype.onClick = function() {
this.isClickAvailable() && this.playAds()
}
;
FlyingAd.prototype.selectType = function() {
if (cleverapps.config.debugMode && void 0 !== FlyingAd.DEBUG_TYPE) {
var a = FlyingAd.DEBUG_TYPE;
delete FlyingAd.DEBUG_TYPE;
return a
}
a = Object.values(FlyingAd.TYPES).filter(function(b) {
return FlyingAd.DATA[b] && cleverapps.adsLimits.state(FlyingAd.DATA[b].limit) === AdsLimits.STATE_READY && FlyingAd.DATA[b].filter()
});
return cleverapps.Random.mathChoose(a)
}
;
FlyingAd.prototype.setType = function(a) {
this.type !== a && (this.type = a,
this.trigger("changeType"))
}
;
FlyingAd.prototype.playAds = function() {
var a = FlyingAd.DATA[this.type]
, b = !1;
cleverapps.focusManager.display({
focus: "FlyingAdReward",
actions: [function(c) {
cleverapps.rewardedAdsManager.playRewarded(a.limit, function() {
cleverapps.adsLimits.watch(a.limit);
b = !0;
c()
}, function() {
c()
});
this.clearTimeout();
this.setDelay(cleverapps.parseInterval(FlyingAd.COOLDOWN));
this.enabled = !1;
this.trigger("disappear")
}
.bind(this), function(c) {
b ? (new RewardWindow(a.reward,{
event: cleverapps.EVENTS.EARN.FLYING,
target: a.target
}),
cleverapps.focusManager.onceNoWindowsListener = c) : c()
}
, function(c) {
b && a.action && a.action();
c()
}
]
})
}
;
FlyingAd.prototype.enable = function() {
this.enabled || cleverapps.focusManager.isFocused() || (this.enabled = !0,
cleverapps.environment.isGameScene() && (this.timeout = cleverapps.timeouts.setTimeout(function() {
this.setDelay(cleverapps.parseInterval(FlyingAd.DIDNT_CLICK_COOLDOWN));
this.clearTimeout();
this.enabled = !1;
this.trigger("disappear")
}
.bind(this), cleverapps.parseInterval(FlyingAd.DURATION))),
this.trigger("enable"))
}
;
FlyingAd.prototype.disable = function() {
this.enabled && (this.clearTimeout(),
this.enabled = !1,
this.trigger("disable"))
}
;
FlyingAd.prototype.clearTimeout = function() {
this.timeout && (clearTimeout(this.timeout),
delete this.timeout)
}
;
FlyingAd.COOLDOWN = "15 seconds";
FlyingAd.GAMESCENE_DELAY = "1 minute";
FlyingAd.DURATION = "45 seconds";
FlyingAd.DIDNT_CLICK_COOLDOWN = "1 minutes";
cleverapps.config.debugMode && (FlyingAd.DIDNT_CLICK_COOLDOWN = "30 seconds");
FlyingAd.TYPES = {
TYPE_HINT: 0,
TYPE_STAR: 1,
TYPE_COMBO: 3,
TYPE_DISCOVER: 4,
TYPE_CARDS: 5,
TYPE_HARD_SOFT: 7,
TYPE_MOVES: 8,
TYPE_REPLACE_ALL: 9,
TYPE_SHUFFLE: 10
};
FlyingAd.DATA = {};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_HINT] = {
limit: AdsLimits.TYPES.FLYING_HINT,
skin: "hint",
filter: function() {
return cleverapps.environment.isGameScene() && "board" === cleverapps.config.type
},
reward: {
boosters: {
3: 1
}
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_STAR] = {
limit: AdsLimits.TYPES.FLYING_STAR,
skin: "star",
filter: function() {
return cleverapps.environment.isMainScene()
},
reward: {
metaStar: 1
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_COMBO] = {
limit: AdsLimits.TYPES.FLYING_BOOSTER,
skin: "heroes",
filter: function() {
return cleverapps.environment.isMainScene() && "match3" === cleverapps.config.type
},
reward: {
boosters: {
5: 1
}
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_DISCOVER] = {
limit: AdsLimits.TYPES.FLYING_DISCOVER,
skin: "hint",
filter: function() {
var a = Game.currentGame;
return cleverapps.environment.isGameScene() && a && a.discoverBooster ? a.inflamer.hasMistakes() ? !0 : 1 <= a.level.episodeNo || 3 <= a.level.levelNo : !1
},
reward: {
boosters: {
9: 1
}
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_CARDS] = {
limit: AdsLimits.TYPES.FLYING_MOVES,
skin: "cards",
filter: function() {
return cleverapps.environment.isGameScene() && "solitaire" === cleverapps.config.type
},
reward: {
cards: 2
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_MOVES] = {
limit: AdsLimits.TYPES.FLYING_MOVES,
skin: "moves",
filter: function() {
return cleverapps.environment.isMainScene() && "match3" === cleverapps.config.type
},
reward: {
boosters: {
6: 1
}
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_HARD_SOFT] = {
limit: AdsLimits.TYPES.FLYING_HARD_SOFT,
skin: "coin",
filter: function() {
return cleverapps.environment.isMainScene()
},
reward: {
hard: cleverapps.config.soft ? void 0 : 10,
soft: cleverapps.config.soft ? 10 : void 0
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_REPLACE_ALL] = {
limit: AdsLimits.TYPES.BOOSTER_ADS,
skin: "replaceall",
filter: function() {
if (!cleverapps.flags.lowMonetization || !cleverapps.environment.isGameScene())
return !1;
var a = cleverapps.boosters.getBoosterById(cleverapps.Boosters.TYPE_REPLACE_ALL);
return a && a.isAvailable()
},
reward: {
boosters: {
20: 1
}
}
};
FlyingAd.DATA[FlyingAd.TYPES.TYPE_SHUFFLE] = {
limit: AdsLimits.TYPES.BOOSTER_ADS,
skin: "replaceall",
filter: function() {
if (!cleverapps.flags.lowMonetization || !cleverapps.environment.isGameScene())
return !1;
var a = cleverapps.boosters.getBoosterById(cleverapps.Boosters.TYPE_SHUFFLE);
return a && a.isAvailable()
},
reward: {
boosters: {
16: 1
}
}
};
cleverapps.InitByFeature.flyingad = function() {
cleverapps.flyingAd = new FlyingAd
}
;
Placements.ENTRIES.flyingAd = {
type: Placements.FREE_FOCUS_MAIN,
filter: function() {
return cleverapps.flyingAd.needUpdate()
},
action: function() {
cleverapps.flyingAd.update()
}
};
var FlyingAdView = cc.Node.extend({
ctor: function() {
this._super();
this.setAnchorPoint(.5, .5);
var a = cleverapps.styles.FlyingAdView;
this.setContentSize2(a);
this.setPositionRound({
x: {
align: "center"
},
y: {
align: "center"
}
});
this.createAnimation();
cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL && (this.setScale(a.mobile.scale),
this.baseScale = this.scale);
cleverapps.UI.applyHover(this, {
filter: this.isClickAvailable.bind(this),
onMouseOver: function() {
this.animation.setSkin(cleverapps.flyingAd.getSkin() + "_hover")
}
.bind(this),
onMouseOut: function() {
this.animation.setSkin(cleverapps.flyingAd.getSkin() + "_normal")
}
.bind(this)
});
cleverapps.UI.onClick(this, cleverapps.flyingAd.onClick.bind(cleverapps.flyingAd), {
filter: this.isClickAvailable.bind(this)
});
this.setLocalZOrder(16);
cleverapps.flyingAd.enabled ? this.enable() : this.disable();
cleverapps.flyingAd.on("disable", this.createListener(this.disable.bind(this)));
cleverapps.flyingAd.on("enable", this.createListener(this.enable.bind(this)));
cleverapps.flyingAd.on("disappear", this.createListener(this.disappear.bind(this)));
cleverapps.flyingAd.on("toggle", this.createListener(this.toggle.bind(this)));
cleverapps.flyingAd.on("changeType", this.createListener(this.changeType.bind(this)))
},
isClickAvailable: function() {
return this.isVisible() && cleverapps.flyingAd.isClickAvailable()
},
setupChildren: function() {
cleverapps.flyingAd.enabled && (this.stopAllActions(),
this.runMoveAnimation())
},
createAnimation: function() {
var a = cleverapps.styles.FlyingAdView;
this.animation = new cleverapps.Spine(bundles.flying_ad.jsons.flying_ad_json);
this.addChild(this.animation);
this.animation.setPositionRound(a.animation)
},
changeType: function() {
this.animation.setSkin(cleverapps.flyingAd.getSkin() + "_normal")
},
toggle: function(a) {
this.isVisible() !== a && (this.setVisible(a),
a ? this.animation.runAction(new cc.RepeatForever(new cc.Sequence(new cc.PlaySound(bundles.flying_ad.urls.fly_effect),new cc.DelayTime(3.8)))) : this.animation.stopAllActions())
},
disappear: function() {
this.stopAllActions();
this.animation.setAnimation(0, "application", !1);
this.animation.setCompleteListener(function() {
this.animation.setCompleteListener();
this.toggle(!1)
}
.bind(this))
},
runMoveAnimation: function() {
this._runMoveAnimation(1)
},
_runMoveAnimation: function(a) {
var b = cleverapps.scenes.getRunningScene()
, c = cleverapps.styles.FlyingAdView
, d = cleverapps.environment.isMainScene() && !cleverapps.travelBook.isExpedition() && cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL;
var e = cleverapps.resolution.mode === cleverapps.WideMode.VERTICAL ? c.mobile.xBorderOffset : c.xBorderOffset;
var f = c.yOffsetBottom;
c = c.yOffsetTop;
e = 0 < a ? d ? cc.p(b.width / 2, b.height - c) : cc.p(b.width - e, this.y) : d ? cc.p(b.width / 2, f) : cc.p(e, this.y);
b = cleverapps.styles.FlyingAdView.speed;
var g = cc.pDistance(this.getPosition(), e) / b;
b = Math.round(g / 7);
e = new cc.MoveBy(g,cc.p(e.x - this.x, e.y - this.y));
c = f = 0;
d ? f = cleverapps.styles.FlyingAdView.animation.dx : c = cleverapps.styles.FlyingAdView.animation.dy;
if (0 < b) {
d = [];
g = g / b / 2;
for (var h = 0; h < b; h++)
d.push(new cc.MoveBy(g / 2,cc.p(f / 2, c / 2))),
d.push(new cc.MoveBy(g,cc.p(-f, -c))),
d.push(new cc.MoveBy(g / 2,cc.p(f / 2, c / 2)));
e = new cc.Spawn(e,new cc.Sequence(d))
}
this.runAction(new cc.Sequence(e,new cc.CallFunc(function() {
this._runMoveAnimation(-a)
}
.bind(this))))
},
enable: function() {
this.stopAllActions();
this.animation.setCompleteListener();
this.toggle(!cleverapps.focusManager.isFocused());
this.animation.setAnimationAndIdleAfter("appearance", "idle");
this.runMoveAnimation();
cleverapps.audio.playSound(bundles.flying_ad.urls.show_up_effect)
},
disable: function() {
this.stopAllActions();
this.toggle(!1)
}
});
cleverapps.styles.FlyingAdView = {
width: 200,
height: 200,
mobile: {
xBorderOffset: 160,
scale: .8
},
animation: {
x: {
align: "center"
},
y: {
align: "center",
dy: -30
},
dy: 60,
dx: 200
},
xBorderOffset: 300,
yOffsetBottom: 500,
yOffsetTop: 150,
speed: 80
};
cc.game.run(function() {
cleverapps.onStart()
});
}
.call(this));