Skip to content

Commit 424ec92

Browse files
committed
モジュール間でデータ送信
完全に開発者向けのアプデ
1 parent 805289e commit 424ec92

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

Script/puzzle.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default () => {
1+
export default (scenes) => {
22
// SECTOR_1:定数群
33
const ORB_COLORS=5;
44
const [BASE_SCORE,SCORE_EXPONENT]=[100,1.5];
@@ -30,7 +30,7 @@ export default () => {
3030

3131
const endscene = (err = null) => {
3232
DIV_PUZ_DISPLAY.style.display="none";
33-
document.getElementById('move_START').onclick();
33+
scenes.start();
3434
if(err)throw err;
3535
}
3636
const gameClear = () => {
@@ -193,12 +193,11 @@ export default () => {
193193
update_display();
194194
updateTarget();
195195
}
196-
const startgame = () => {
197-
const StageID = document.getElementById('StageLink').value;
196+
const startgame = (StageID) => {
198197
if(isNaN(StageID))endscene(TypeError(`GUARD! StageID ${StageID} is NaN`));
199198
const DATALINK = "../Data/Stage/"+StageID+".js";
200199
DIV_PUZ_DISPLAY.style.display="block";
201200
import(DATALINK).then(x => {DATA = object_copy(x.default) ; board_init()}).catch(endscene);
202201
}
203-
document.getElementById('move_GAME').onclick=startgame;
202+
return startgame;
204203
}

Script/scene-module.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import START from "./start.js";
22
import PUZZLE from "./puzzle.js";
3-
START();
4-
PUZZLE();
5-
document.querySelector("#move_START").click();
3+
const scenes={};
4+
scenes.start=START(scenes);
5+
scenes.puzzle=PUZZLE(scenes);
6+
Object.freeze(scenes);
7+
scenes.start();

Script/start.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
export default () => {
1+
export default (scenes) => {
22
const DIV_STAGE_SELECT = document.querySelector("#stage_select");
33
const initer = () => {
44
DIV_STAGE_SELECT.style.display = "block";
55
document.querySelector("#startbutton").onclick = () => {
66
DIV_STAGE_SELECT.style.display = "none";
7-
document.querySelector("#move_GAME").click();
7+
scenes.puzzle(document.getElementById('StageLink').value);
88
}
99
}
10-
document.querySelector("#move_START").onclick = initer;
10+
return initer;
1111
}

index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
<link rel="icon" href="favicon.ico">
99
</head>
1010
<body>
11-
<button type="button" id="move_START" class="scene_mover">TP_START</button>
12-
<button type="button" id="move_GAME" class="scene_mover">TP_GAME</button>
1311
<div id="stage_select">
1412
<input type="text" value="1" id="StageLink">
1513
<button type="button" onclick="" id="startbutton">GAME START</button>

0 commit comments

Comments
 (0)