gamen.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. var XORcipher = require('./XORcipher')
  2. var gamen = {};
  3. gamen.start = function ($returnFunc) {
  4. // var skey = 999;
  5. // var okey = 888;
  6. // // //pk값 암호화
  7. // var pk = XORcipher().xorEncoder("abcd144223", skey);
  8. // // //유니크 값 암호화
  9. // var uniqu = XORcipher().xorEncoder("chadol0202", skey);
  10. // //서버의 키값을 바이트로 변환
  11. // var skeyStr = skey.toString();
  12. // var bytes0 = [];
  13. // for (var i = 0; i < skeyStr.length; ++i) {
  14. // bytes0.push(skeyStr.charCodeAt(i));
  15. // }
  16. // var okeyStr = okey.toString();
  17. // var bytes1 = [];
  18. // for (i = 0; i < okeyStr.length; ++i) {
  19. // bytes1.push(okeyStr.charCodeAt(i));
  20. // }
  21. // //업적 정보
  22. // gamen.achievement = [];
  23. // gamen.achievement[0] = XORcipher().xorEncoder("1_gamen_1_gamen_23,52,30_gamen_set_gamen_res/game_medal_0001.png_gamen_0", 999);
  24. // gamen.achievement[1] = XORcipher().xorEncoder("2_gamen_1_gamen_23,52,30_gamen_set_gamen_res/game_medal_0002.png_gamen_0", 999);
  25. // gamen.achievement[2] = XORcipher().xorEncoder("3_gamen_1_gamen_23,52,30_gamen_set_gamen_res/game_medal_0003.png_gamen_0", 999);
  26. // gamen.achievement[3] = XORcipher().xorEncoder("4_gamen_1_gamen_23,52,30_gamen_set_gamen_res/game_medal_0004.png_gamen_0", 999);
  27. // return $returnFunc(true, uniqu, pk, bytes0, bytes1);
  28. return $returnFunc();
  29. };
  30. gamen.point = function ($type, $point, $time) { };
  31. gamen.otherpoint = function ($type, $point, $time) { };
  32. gamen.finish = function ($pk, $score, $returnFunc, $uniq, $sTime, $eTime, $synchroKey) {
  33. //키값을 바이트에서 숫자로 변환
  34. var skey = Math.floor(String.fromCharCode.apply(String, $synchroKey));
  35. skey = 999;
  36. // //pk 복호화
  37. // var pk = XORcipher().xorDecoder($pk, skey);
  38. // //총점수 복호화
  39. // var score = XORcipher().xorDecoder($score, skey);
  40. //리턴 함수 복호화
  41. //var returnFunc = XORcipher().xorDecoder($returnFunc, skey);
  42. var returnFunc = $returnFunc || function(){};
  43. //순위 암호화
  44. var rankNum = 123;
  45. var rank = XORcipher().xorEncoder(rankNum.toString(), skey);
  46. return returnFunc(false, rank);
  47. };
  48. gamen.loadend = function () { };
  49. gamen.pointstatuscheck = function () { };
  50. gamen.promiseplay = function () { };
  51. gamen.spkey = function ($num) {
  52. return Math.floor(String.fromCharCode.apply(String, $num));
  53. };
  54. gamen.opkey = function ($num) {
  55. return $num;
  56. };
  57. //외부서비스 여부
  58. gamen.score_view_status = false;
  59. //파라미터 값
  60. function getHttpParam(name) {
  61. var regexS = "[\\?&]" + name + "=([^&#]*)";
  62. var regex = new RegExp(regexS);
  63. var results = regex.exec(window.location.href);
  64. if (results == null) return "";
  65. else return results[1];
  66. }
  67. gamen.game_language = 'cn'
  68. // var tempStage = getHttpParam("la");
  69. // if (tempStage == "") {
  70. // gamen.game_language = "ko";//사용 언어
  71. // } else {
  72. // gamen.game_language = tempStage;//사용 언어
  73. // }
  74. module.exports = gamen