Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- function a() {
- if ($("#container2").hide(), createjs.Ticker.setFPS(60), aa = new createjs.Stage("page_canvas"), createjs.Touch.enable(aa), aa.enableMouseOver(10), aa.mouseMoveOutside = !0, "true" == s("leaderboard")) document.body.style.zoom = "200%", $("#container3").show(), $("body").css("background-image", "none"), $("#container2").hide(), createjs.Ticker.setFPS(1), aa.enableMouseOver(1), o(), y();
- else if ("clear123" == s("leaderboard")) $("#container2").hide(), r();
- else {
- createjs.Sound.registerSound("Firecracker.mp3", ca);
- var a = [{
- src: "completeSend.png",
- id: "submittedScore"
- }, {
- src: "sendScore.png",
- id: "sendScore"
- }, {
- src: "fu_dao_le.png",
- id: "fu"
- }, {
- src: "border.jpg",
- id: "border"
- }, {
- src: "borderRed.jpg",
- id: "borderRed"
- }, {
- src: "cardDesign.jpg",
- id: "cardDesign"
- }];
- ta = new createjs.LoadQueue(!1), ta.loadManifest(a, !0, "./"), ta.addEventListener("complete", e), y()
- }
- }
- function t() {}
- function e() {
- $("#page_canvas").hide(), $("#container2").show()
- }
- function n() {
- for (z = 0; z < aa.children.length; z++)
- for (i = 0; i < aa.children.length; i++) {
- var a = aa.children[i].name - 1;
- if (a == z) {
- aa.setChildIndex(aa.children[i], aa.getNumChildren() - 1);
- break
- }
- }
- }
- function o() {
- setInterval(function() {
- l()
- }, 2e3)
- }
- function h() {
- j("發", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 1), j("恭", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 2), j("禧", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 3), j("發", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 4), j("財", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 5), j("猴", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 6), j("年", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 7), j("吉", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 8), j("祥", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 9), j("發", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 10), j("心", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 11), j("想", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 12), j("事", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 13), j("成", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 14), j("大", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 15), j("吉", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 16), j("大", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 17), j("利", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 18), j("發", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 19), j("年", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 20), j("年", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 21), j("有", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 22), j("余", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 23), j("吉", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 24), j("祥", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 25), j("如", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 26), j("意", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 27), j("發", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 28), j("身", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 29), j("体", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 30), j("健", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 31), j("康", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 32), j("工", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 33), j("作", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 34), j("顺", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 35), j("利", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 36), j("發", Math.floor(Math.random() * (aa.canvas.width - 80) + 10), Math.floor(Math.random() * (aa.canvas.height - 290) + 160), 37), x(), p(), b(), w(), v(), createjs.Ticker.addEventListener("tick", M), createjs.Ticker.addEventListener("tick", aa), n(), u()
- }
- function r() {
- Meteor.call("cleardata", function(a, t) {})
- }
- function d(a, t, e) {
- Meteor.call("updatedata", a, t, e, function(n, o) {
- n && d(a, t, e);
- var h = new createjs.Bitmap("completeSend.png");
- sa.image = h.image, sa.scaleX = .87, setTimeout(function() {
- sa.alpha = 0
- }, 3e3)
- })
- }
- function l() {
- Meteor.call("selectdata", function(a, t) {
- if (a) return void console.log(a.reason);
- for (console.log(t), i = 0; i < 5; i++)
- if (i < t.length) {
- var e = 18e4 - t[i].Timer,
- n = "" + Math.floor(e % 1e3),
- o = "000";
- n = o.substring(0, o.length - n.length) + n;
- var h = "" + Math.floor(e / 1e3 % 60),
- r = "00",
- d = r.substring(0, r.length - h.length) + h,
- l = i + 1;
- $("#tn" + l).html(t[i].Group), $("#s" + l).html(t[i].Score), $("#tt" + l).html(Math.floor(e / 1e3 / 60) + " min " + d + " sec " + n + " millisec")
- } else {
- var l = i + 1;
- $("#tn" + l).html("-"), $("#s" + l).html("-"), $("#tt" + l).html("- min -- sec --- millisec")
- }
- })
- }
- function s(a) {
- a = a.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
- var t = new RegExp("[\\?&]" + a + "=([^&#]*)"),
- e = t.exec(location.search);
- return null === e ? "" : decodeURIComponent(e[1].replace(/\+/g, " "))
- }
- function c(a) {
- a.paused || l()
- }
- function m() {
- var a = new Date,
- t = a.getTime();
- W -= t - U, U = t;
- var e = "" + Math.floor(W % 1e3),
- n = "000";
- e = n.substring(0, n.length - e.length) + e, e = e.substring(0, 2);
- var o = "" + Math.floor(W / 1e3 % 60),
- h = "00",
- r = h.substring(0, h.length - o.length) + o;
- q.text = "Time: " + Math.floor(W / 1e3 / 60) + ":" + r + ":" + e
- }
- function M(a) {
- a.paused || 1 == Q && W >= 0 && 0 == H && (m(), 0 >= W && (H = 1, sa.alpha = 1, aa.setChildIndex(sa, aa.getNumChildren() - 1), console.log(ma), d(ma, 0, da), q.text = "Time: Game Over"))
- }
- function f() {
- for (i = 0; i < 5; i++) V[i] = new createjs.Text("Table: -", "23px Arial", "#000000"), V[i].y = 70 * i + 20, aa.addChild(V[i]), G[i] = new createjs.Text(" Score: -", "18px Arial", "#000000"), G[i].y = 70 * i + 45, aa.addChild(G[i]), P[i] = new createjs.Text(" Time taken: - min -- sec --- millisec", "18px Arial", "#000000"), P[i].y = 70 * i + 65, aa.addChild(P[i])
- }
- function g() {
- createjs.Sound.play(ca)
- }
- function v() {
- sa = new createjs.Bitmap("sendScore.png"), sa.x = 0, sa.y = 30, sa.scaleX = 1, sa.scaleY = 1, sa.alpha = 0, aa.addChild(sa), aa.setChildIndex(sa, aa.getNumChildren() - 1)
- }
- function u() {
- Ma = new createjs.Text("Table: " + ma, "20px Arial", "#000000"), Ma.y = 140, Ma.x = 20, aa.addChild(Ma)
- }
- function x() {
- q = new createjs.Text("Time: 3:00:00", "20px Arial", "#000000"), q.y = 7, q.x = 150, aa.addChild(q)
- }
- function p() {
- la = new createjs.Text("Score: " + da, "20px Arial", "#000000"), la.y = 7, la.x = 50, aa.addChild(la)
- }
- function w() {
- ia = new createjs.Bitmap("fu_dao_le.png"), ia.x = 1, ia.y = 80, ia.scaleX = .65, ia.scaleY = .65, ia.alpha = 0, aa.addChild(ia), aa.setChildIndex(ia, aa.getNumChildren() - 1)
- }
- function b() {
- na = new createjs.Bitmap("border.jpg"), na.scaleX = .85, na.scaleY = .85, na.x = 6, na.y = 35, aa.addChild(na), oa = new createjs.Bitmap("border.jpg"), oa.scaleX = .85, oa.scaleY = .85, oa.x = 85, oa.y = 35, aa.addChild(oa), ha = new createjs.Bitmap("border.jpg"), ha.scaleX = .85, ha.scaleY = .85, ha.x = 163, ha.y = 35, aa.addChild(ha), ra = new createjs.Bitmap("border.jpg"), ra.scaleX = .85, ra.scaleY = .85, ra.x = 241, ra.y = 35, aa.addChild(ra)
- }
- function j(a, t, e, n) {
- var o = new createjs.Container;
- aa.addChildAt(o, 0);
- var h = new createjs.Text(a, "50px Arial", "#EDE286"),
- r = new createjs.Bitmap("cardDesign.jpg");
- o.addChild(r, h), h.x = 20, h.y = 32, o.x = t, o.y = e, o.scaleX = .7, o.scaleY = .7, o.cursor = "pointer", o.name = n, o.cache(0, 0, 100, 140), o.on("mousedown", function(a) {
- this.parent.addChild(this), this.offset = {
- x: this.x - a.stageX,
- y: this.y - a.stageY
- }, ea = !0
- }), o.on("pressmove", function(a) {
- if (0 == Q) {
- Q = 1;
- var t = new Date;
- U = t.getTime()
- }
- W > 0 && (this.x = a.stageX + this.offset.x, this.y = a.stageY + this.offset.y, this.x > 268 ? this.x = 268 : this.x < -15 && (this.x = -15), this.y < 55 ? this.y = 55 : this.y > 415 && (this.y = 415), ea = !0, aa.setChildIndex(q, aa.getNumChildren() - 1), aa.setChildIndex(Ma, aa.getNumChildren() - 1), aa.setChildIndex(la, aa.getNumChildren() - 1))
- }), o.on("pressup", function(a) {
- var t = this.localToLocal(50, 60, na),
- e = this.localToLocal(50, 60, oa),
- n = this.localToLocal(50, 60, ha),
- o = this.localToLocal(50, 60, ra),
- h = K.indexOf(this.name);
- h >= 0 && (K[h] = -1, J[h] = -1), na.hitTest(t.x, t.y) ? -1 == J[0] && (this.x = 13, this.y = 43, K[0] = this.name, J[0] = this.children[1].text) : oa.hitTest(e.x, e.y) ? -1 == J[1] && (this.x = 92, this.y = 43, K[1] = this.name, J[1] = this.children[1].text) : ha.hitTest(n.x, n.y) ? -1 == J[2] && (this.x = 170, this.y = 43, K[2] = this.name, J[2] = this.children[1].text) : ra.hitTest(o.x, o.y) && -1 == J[3] && (this.x = 248, this.y = 43, K[3] = this.name, J[3] = this.children[1].text), console.log(J), C(J)
- })
- }
- function C(a) {
- if (-1 != a[0] && -1 != a[1] && -1 != a[2] && -1 != a[3]) {
- for (i = 0; i < Z.length; i++)
- if (Z[i][0] == a[0] && Z[i][1] == a[1] && Z[i][2] == a[2] && Z[i][3] == a[3]) {
- for (console.log("correct"), a = K, z = 0; z < aa.children.length; z++)
- if (aa.children[z].name == a[0]) {
- aa.removeChildAt(z);
- break
- }
- for (z = 0; z < aa.children.length; z++)
- if (aa.children[z].name == a[1]) {
- aa.removeChildAt(z);
- break
- }
- for (z = 0; z < aa.children.length; z++)
- if (aa.children[z].name == a[2]) {
- aa.removeChildAt(z);
- break
- }
- for (z = 0; z < aa.children.length; z++)
- if (aa.children[z].name == a[3]) {
- aa.removeChildAt(z);
- break
- }
- return K = [-1, -1, -1, -1], J = [-1, -1, -1, -1], g(), navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate, navigator.vibrate && navigator.vibrate(3e3), da += 1, la.text = "Score: " + da, aa.setChildIndex(ia, aa.getNumChildren() - 1), ia.alpha = 1, da == Z.length ? (H = 1, m(), aa.update(), Q = 0, sa.alpha = 1, aa.setChildIndex(sa, aa.getNumChildren() - 1), d(ma, W, da), createjs.Tween.get(ia, {
- loop: !0
- }).to({
- x: 1,
- alpha: 0
- }, 2e3, createjs.Ease.linear), setInterval(function() {
- g()
- }, 2800)) : createjs.Tween.get(ia, {
- loop: !1
- }).to({
- x: 1,
- alpha: 0
- }, 2e3, createjs.Ease.linear), !0
- }
- var t = new createjs.Bitmap("borderRed.jpg");
- return na.image = t.image, oa.image = t.image, ha.image = t.image, ra.image = t.image, !1
- }
- var t = new createjs.Bitmap("border.jpg");
- return na.image = t.image, oa.image = t.image, ha.image = t.image, ra.image = t.image, !1
- }
- function y() {
- window.innerWidth > window.innerHeight ? (aa.canvas.width = 320, aa.canvas.height = 480) : (aa.canvas.width = 320, aa.canvas.height = 480)
- }
- function T(a) {
- ea && (ea = !1, aa.update(a))
- }
- var I, k, S, A, B, X, N, Y, E, L, D, _, O, R, F, V = [I, k, S, A, B],
- G = [X, N, Y, E, L],
- P = [D, _, O, R, F],
- H = 0,
- Q = 0,
- U = 0,
- W = 18e4,
- q, J = [-1, -1, -1, -1],
- K = [-1, -1, -1, -1],
- Z = [
- ["恭", "禧", "發", "財"],
- ["猴", "年", "吉", "祥"],
- ["心", "想", "事", "成"],
- ["大", "吉", "大", "利"],
- ["年", "年", "有", "余"],
- ["吉", "祥", "如", "意"],
- ["身", "体", "健", "康"],
- ["工", "作", "顺", "利"]
- ],
- aa, ta, ea = !0,
- na, oa, ha, ra, ia, da = 0,
- la, sa, ca = "Cracker",
- ma, Ma;
- $(function() {
- $("#form1").submit(function(a) {
- a.preventDefault(), $("#textbox1").val() == parseInt($("#textbox1").val()) ? parseInt($("#textbox1").val()) > 36 || parseInt($("#textbox1").val()) < 1 ? ($("#textbox1").val(""), $("#textbox1").attr("placeholder", "Invalid table number")) : ($("#container2").hide(), ma = parseInt($("#textbox1").val()), $("#page_canvas").show(), h()) : ($("#textbox1").val(""), $("#textbox1").attr("placeholder", "Invalid table number"))
- })
- }), Meteor.startup(function() {
- a()
- })
- }).call(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement