| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>Game</title>
- </head>
- <body style="margin:0">
- @* Kích ho?ch HTML5 v?i tham s? truy?n san construct 3 trên url *@
- @* <iframe id="gameFrame"
- src="@root/DragDrop/index.html?gameType=0&msisdn=09&token=1234567890&transId=1234567"
- style="
- width:100%;
- height:100vh;
- border:none;
- display:block;
- ">
- </iframe> *@
- <iframe id="gameFrame"
- src="@root/DragDrop/index.html"
- style="
- width:100%;
- height:100vh;
- border:none;
- display:block;
- ">
- </iframe>
-
- @* Ðo?n Js nh?n k?t qu? t? construct 3 v? *@
- <script>
- const frame = document.getElementById("gameFrame");
- console.log("MVC bat dau gui du lieu vao trong construct 3");
- window.addEventListener(
- "message",
- function (event)
- {
- console.log("Ðây là hàm l?ng nghe s? kiên t? construct 3 d?y ra MVC nhé!!!!!!");
- console.log(event.data);
- //Khi trong construct 3 g?i ra s? ki?n này thì t?c là trong Construc 3
- if (event.data.type === "GAME_READY")
- {
- console.log("Gui INIT_GAME");
- //Khi da nhan duoc su kien nay tu trong Construct 3 gui ra thi
- // chung ta construct 3 da listener thanh cong
- //Tien hanh gui cac thong so duoi vao construct3
- frame.contentWindow.postMessage({
- type: "INIT_GAME",
- gameType: "Easy",
- msisdn: "09",
- token: "1234567890",
- transId: "1234567890",
- root: "@root"
- }, "*");
- }
- }
- );
- </script>
- </body>
- </html>
|