Advertisement
Guest User

debugCNY

a guest
Feb 6th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.     function a() {
  3.         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();
  4.         else if ("clear123" == s("leaderboard")) $("#container2").hide(), r();
  5.         else {
  6.             createjs.Sound.registerSound("Firecracker.mp3", ca);
  7.             var a = [{
  8.                 src: "completeSend.png",
  9.                 id: "submittedScore"
  10.             }, {
  11.                 src: "sendScore.png",
  12.                 id: "sendScore"
  13.             }, {
  14.                 src: "fu_dao_le.png",
  15.                 id: "fu"
  16.             }, {
  17.                 src: "border.jpg",
  18.                 id: "border"
  19.             }, {
  20.                 src: "borderRed.jpg",
  21.                 id: "borderRed"
  22.             }, {
  23.                 src: "cardDesign.jpg",
  24.                 id: "cardDesign"
  25.             }];
  26.             ta = new createjs.LoadQueue(!1), ta.loadManifest(a, !0, "./"), ta.addEventListener("complete", e), y()
  27.         }
  28.     }
  29.  
  30.     function t() {}
  31.  
  32.     function e() {
  33.         $("#page_canvas").hide(), $("#container2").show()
  34.     }
  35.  
  36.     function n() {
  37.         for (z = 0; z < aa.children.length; z++)
  38.             for (i = 0; i < aa.children.length; i++) {
  39.                 var a = aa.children[i].name - 1;
  40.                 if (a == z) {
  41.                     aa.setChildIndex(aa.children[i], aa.getNumChildren() - 1);
  42.                     break
  43.                 }
  44.             }
  45.     }
  46.  
  47.     function o() {
  48.         setInterval(function() {
  49.             l()
  50.         }, 2e3)
  51.     }
  52.  
  53.     function h() {
  54.         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()
  55.     }
  56.  
  57.     function r() {
  58.         Meteor.call("cleardata", function(a, t) {})
  59.     }
  60.  
  61.     function d(a, t, e) {
  62.         Meteor.call("updatedata", a, t, e, function(n, o) {
  63.             n && d(a, t, e);
  64.             var h = new createjs.Bitmap("completeSend.png");
  65.             sa.image = h.image, sa.scaleX = .87, setTimeout(function() {
  66.                 sa.alpha = 0
  67.             }, 3e3)
  68.         })
  69.     }
  70.  
  71.     function l() {
  72.         Meteor.call("selectdata", function(a, t) {
  73.             if (a) return void console.log(a.reason);
  74.             for (console.log(t), i = 0; i < 5; i++)
  75.                 if (i < t.length) {
  76.                     var e = 18e4 - t[i].Timer,
  77.                         n = "" + Math.floor(e % 1e3),
  78.                         o = "000";
  79.                     n = o.substring(0, o.length - n.length) + n;
  80.                     var h = "" + Math.floor(e / 1e3 % 60),
  81.                         r = "00",
  82.                         d = r.substring(0, r.length - h.length) + h,
  83.                         l = i + 1;
  84.                     $("#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")
  85.                 } else {
  86.                     var l = i + 1;
  87.                     $("#tn" + l).html("-"), $("#s" + l).html("-"), $("#tt" + l).html("- min -- sec --- millisec")
  88.                 }
  89.         })
  90.     }
  91.  
  92.     function s(a) {
  93.         a = a.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
  94.         var t = new RegExp("[\\?&]" + a + "=([^&#]*)"),
  95.             e = t.exec(location.search);
  96.         return null === e ? "" : decodeURIComponent(e[1].replace(/\+/g, " "))
  97.     }
  98.  
  99.     function c(a) {
  100.         a.paused || l()
  101.     }
  102.  
  103.     function m() {
  104.         var a = new Date,
  105.             t = a.getTime();
  106.         W -= t - U, U = t;
  107.         var e = "" + Math.floor(W % 1e3),
  108.             n = "000";
  109.         e = n.substring(0, n.length - e.length) + e, e = e.substring(0, 2);
  110.         var o = "" + Math.floor(W / 1e3 % 60),
  111.             h = "00",
  112.             r = h.substring(0, h.length - o.length) + o;
  113.         q.text = "Time: " + Math.floor(W / 1e3 / 60) + ":" + r + ":" + e
  114.     }
  115.  
  116.     function M(a) {
  117.         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"))
  118.     }
  119.  
  120.     function f() {
  121.         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])
  122.     }
  123.  
  124.     function g() {
  125.         createjs.Sound.play(ca)
  126.     }
  127.  
  128.     function v() {
  129.         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)
  130.     }
  131.  
  132.     function u() {
  133.         Ma = new createjs.Text("Table: " + ma, "20px Arial", "#000000"), Ma.y = 140, Ma.x = 20, aa.addChild(Ma)
  134.     }
  135.  
  136.     function x() {
  137.         q = new createjs.Text("Time: 3:00:00", "20px Arial", "#000000"), q.y = 7, q.x = 150, aa.addChild(q)
  138.     }
  139.  
  140.     function p() {
  141.         la = new createjs.Text("Score: " + da, "20px Arial", "#000000"), la.y = 7, la.x = 50, aa.addChild(la)
  142.     }
  143.  
  144.     function w() {
  145.         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)
  146.     }
  147.  
  148.     function b() {
  149.         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)
  150.     }
  151.  
  152.     function j(a, t, e, n) {
  153.         var o = new createjs.Container;
  154.         aa.addChildAt(o, 0);
  155.         var h = new createjs.Text(a, "50px Arial", "#EDE286"),
  156.             r = new createjs.Bitmap("cardDesign.jpg");
  157.         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) {
  158.             this.parent.addChild(this), this.offset = {
  159.                 x: this.x - a.stageX,
  160.                 y: this.y - a.stageY
  161.             }, ea = !0
  162.         }), o.on("pressmove", function(a) {
  163.             if (0 == Q) {
  164.                 Q = 1;
  165.                 var t = new Date;
  166.                 U = t.getTime()
  167.             }
  168.             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))
  169.         }), o.on("pressup", function(a) {
  170.             var t = this.localToLocal(50, 60, na),
  171.                 e = this.localToLocal(50, 60, oa),
  172.                 n = this.localToLocal(50, 60, ha),
  173.                 o = this.localToLocal(50, 60, ra),
  174.                 h = K.indexOf(this.name);
  175.             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)
  176.         })
  177.     }
  178.  
  179.     function C(a) {
  180.         if (-1 != a[0] && -1 != a[1] && -1 != a[2] && -1 != a[3]) {
  181.             for (i = 0; i < Z.length; i++)
  182.                 if (Z[i][0] == a[0] && Z[i][1] == a[1] && Z[i][2] == a[2] && Z[i][3] == a[3]) {
  183.                     for (console.log("correct"), a = K, z = 0; z < aa.children.length; z++)
  184.                         if (aa.children[z].name == a[0]) {
  185.                             aa.removeChildAt(z);
  186.                             break
  187.                         }
  188.                     for (z = 0; z < aa.children.length; z++)
  189.                         if (aa.children[z].name == a[1]) {
  190.                             aa.removeChildAt(z);
  191.                             break
  192.                         }
  193.                     for (z = 0; z < aa.children.length; z++)
  194.                         if (aa.children[z].name == a[2]) {
  195.                             aa.removeChildAt(z);
  196.                             break
  197.                         }
  198.                     for (z = 0; z < aa.children.length; z++)
  199.                         if (aa.children[z].name == a[3]) {
  200.                             aa.removeChildAt(z);
  201.                             break
  202.                         }
  203.                     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, {
  204.                         loop: !0
  205.                     }).to({
  206.                         x: 1,
  207.                         alpha: 0
  208.                     }, 2e3, createjs.Ease.linear), setInterval(function() {
  209.                         g()
  210.                     }, 2800)) : createjs.Tween.get(ia, {
  211.                         loop: !1
  212.                     }).to({
  213.                         x: 1,
  214.                         alpha: 0
  215.                     }, 2e3, createjs.Ease.linear), !0
  216.                 }
  217.             var t = new createjs.Bitmap("borderRed.jpg");
  218.             return na.image = t.image, oa.image = t.image, ha.image = t.image, ra.image = t.image, !1
  219.         }
  220.         var t = new createjs.Bitmap("border.jpg");
  221.         return na.image = t.image, oa.image = t.image, ha.image = t.image, ra.image = t.image, !1
  222.     }
  223.  
  224.     function y() {
  225.         window.innerWidth > window.innerHeight ? (aa.canvas.width = 320, aa.canvas.height = 480) : (aa.canvas.width = 320, aa.canvas.height = 480)
  226.     }
  227.  
  228.     function T(a) {
  229.         ea && (ea = !1, aa.update(a))
  230.     }
  231.     var I, k, S, A, B, X, N, Y, E, L, D, _, O, R, F, V = [I, k, S, A, B],
  232.         G = [X, N, Y, E, L],
  233.         P = [D, _, O, R, F],
  234.         H = 0,
  235.         Q = 0,
  236.         U = 0,
  237.         W = 18e4,
  238.         q, J = [-1, -1, -1, -1],
  239.         K = [-1, -1, -1, -1],
  240.         Z = [
  241.             ["恭", "禧", "發", "財"],
  242.             ["猴", "年", "吉", "祥"],
  243.             ["心", "想", "事", "成"],
  244.             ["大", "吉", "大", "利"],
  245.             ["年", "年", "有", "余"],
  246.             ["吉", "祥", "如", "意"],
  247.             ["身", "体", "健", "康"],
  248.             ["工", "作", "顺", "利"]
  249.         ],
  250.         aa, ta, ea = !0,
  251.         na, oa, ha, ra, ia, da = 0,
  252.         la, sa, ca = "Cracker",
  253.         ma, Ma;
  254.     $(function() {
  255.         $("#form1").submit(function(a) {
  256.             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"))
  257.         })
  258.     }), Meteor.startup(function() {
  259.         a()
  260.     })
  261. }).call(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement