File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,30 @@ const show = ref(false)
66const page = ref (0 )
77const total = 5
88const props = defineProps <{ scene: Phaser .Scene }>()
9+ const images = ref <HTMLImageElement []>([])
910
1011onMounted (() => {
1112 const seen = localStorage .getItem (" hasSeenTutorial" )
1213 if (! seen ) {
1314 show .value = true
1415 props .scene .input .enabled = false
16+ for (let i = 1 ; i <= total ; i ++ ) {
17+ const img = new Image ()
18+ img .onload = () => {
19+ console .log (` Tutorial image ${i } loaded. ` )
20+ }
21+ img .src = ` /assets/tutorial-${i }.png `
22+ images .value .push (img )
23+ }
1524 }
1625})
1726
1827function nextPage() {
1928 if (page .value < total - 1 ) {
20- page .value ++
29+ const nextImage = images .value [page .value + 1 ]
30+ if (nextImage && nextImage .complete ) {
31+ page .value ++
32+ }
2133 } else {
2234 show .value = false
2335 props .scene .input .enabled = true
@@ -56,10 +68,8 @@ function nextPage() {
5668}
5769
5870.tutorial-progress {
59- position : absolute ;
60- bottom : 16px ;
61- right : 16px ;
6271 color : #fff ;
6372 font-size : 16px ;
73+ padding : 8px 12px ;
6474}
6575 </style >
You can’t perform that action at this time.
0 commit comments