index.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>eosbaccarat game</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
  7. <meta name="apple-mobile-web-app-capable" content="yes" />
  8. <meta name="full-screen" content="true" />
  9. <meta name="screen-orientation" content="portrait" />
  10. <meta name="x5-fullscreen" content="true" />
  11. <meta name="360-fullscreen" content="true" />
  12. <style>
  13. html, body {
  14. -ms-touch-action: none;
  15. background: #000;
  16. padding: 0;
  17. border: 0;
  18. margin: 0;
  19. height: 100%;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
  25. data-entry-class="Main"
  26. data-orientation="auto"
  27. data-scale-mode="showAll"
  28. data-frame-rate="60"
  29. data-content-width="1920"
  30. data-content-height="1000"
  31. data-multi-fingered="2"
  32. data-show-fps="false" data-show-log="false"
  33. data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
  34. </div>
  35. <script>
  36. var GAME_ISMOBILE = window.innerWidth <= 480;
  37. var playerElement = document.querySelector('.egret-player');
  38. if(GAME_ISMOBILE){
  39. playerElement.setAttribute('data-content-width',750);
  40. playerElement.setAttribute('data-content-height',1100);
  41. playerElement = null;
  42. }
  43. var loadScript = function (list, callback) {
  44. var loaded = 0;
  45. var loadNext = function () {
  46. loadSingleScript(list[loaded], function () {
  47. loaded++;
  48. if (loaded >= list.length) {
  49. callback();
  50. }
  51. else {
  52. loadNext();
  53. }
  54. })
  55. };
  56. loadNext();
  57. };
  58. var loadSingleScript = function (src, callback) {
  59. var s = document.createElement('script');
  60. s.async = false;
  61. s.src = src;
  62. s.addEventListener('load', function () {
  63. s.parentNode.removeChild(s);
  64. s.removeEventListener('load', arguments.callee, false);
  65. callback();
  66. }, false);
  67. document.body.appendChild(s);
  68. };
  69. var xhr = new XMLHttpRequest();
  70. xhr.open('GET', './manifest.json?v=' + Math.random(), true);
  71. xhr.addEventListener("load", function () {
  72. var manifest = JSON.parse(xhr.response);
  73. var list = manifest.initial.concat(manifest.game);
  74. loadScript(list, function () {
  75. /**
  76. * {
  77. * "renderMode":, //Engine rendering mode, "canvas" or "webgl"
  78. * "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
  79. * "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
  80. * "calculateCanvasScaleFactor": //a function return canvas scale factor
  81. * }
  82. **/
  83. egret.runEgret({ renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor:function(context) {
  84. var backingStore = context.backingStorePixelRatio ||
  85. context.webkitBackingStorePixelRatio ||
  86. context.mozBackingStorePixelRatio ||
  87. context.msBackingStorePixelRatio ||
  88. context.oBackingStorePixelRatio ||
  89. context.backingStorePixelRatio || 1;
  90. return (window.devicePixelRatio || 1) / backingStore;
  91. }});
  92. });
  93. });
  94. xhr.send(null);
  95. </script>
  96. </body>
  97. </html>