gamen.js 2.8 KB

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