Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM_L5_26
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
YM_L5_26
Commits
256a8bcf
Commit
256a8bcf
authored
Aug 19, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: bugs
parent
c7c8bfe2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
39 deletions
+56
-39
MyGame.ts
src/app/play/game/MyGame.ts
+54
-38
resources.js
src/app/play/resources.js
+2
-1
click_green_btn.mp3
src/assets/play/music/click_green_btn.mp3
+0
-0
click_line.mp3
src/assets/play/music/click_line.mp3
+0
-0
No files found.
src/app/play/game/MyGame.ts
View file @
256a8bcf
...
@@ -36,8 +36,12 @@ export class MyGame extends Game {
...
@@ -36,8 +36,12 @@ export class MyGame extends Game {
group
.
forEach
(
line
=>
{
group
.
forEach
(
line
=>
{
imgUrlList
.
push
(
line
.
img
);
imgUrlList
.
push
(
line
.
img
);
audioUrlList
.
push
(
line
.
audio
);
audioUrlList
.
push
(
line
.
audio
);
audioUrlList
.
push
(...
line
.
groupAudios
.
map
(
data
=>
data
.
audio
));
});
});
});
});
audioUrlList
.
push
(...
this
.
data
.
groupAudio
);
imgUrlList
.
push
(
this
.
data
.
middleImg
);
imgUrlList
.
push
(
this
.
data
.
middleImg
);
audioUrlList
.
push
(
this
.
data
.
titleLetterAudio
);
audioUrlList
.
push
(
this
.
data
.
titleLetterAudio
);
audioUrlList
.
push
(
this
.
data
.
titleAudio
);
audioUrlList
.
push
(
this
.
data
.
titleAudio
);
...
@@ -266,8 +270,6 @@ export class MyGame extends Game {
...
@@ -266,8 +270,6 @@ export class MyGame extends Game {
}
}
});
});
console
.
log
(
'
numberDataList =
'
+
numberDataList
);
numberDataList
.
forEach
(
numberData
=>
{
numberDataList
.
forEach
(
numberData
=>
{
const
letterLabel
=
new
MyLabel
();
const
letterLabel
=
new
MyLabel
();
letterLabel
.
fontSize
=
20
;
letterLabel
.
fontSize
=
20
;
...
@@ -346,7 +348,8 @@ export class MyGame extends Game {
...
@@ -346,7 +348,8 @@ export class MyGame extends Game {
wordMiddle
.
setName
(
'
wordMiddle
'
);
wordMiddle
.
setName
(
'
wordMiddle
'
);
popUpWinBg
.
addChild
(
wordMiddle
);
popUpWinBg
.
addChild
(
wordMiddle
);
wordMiddle
.
addTouchBeganListener
(()
=>
{
wordMiddle
.
addTouchBeganListener
(()
=>
{
console
.
log
(
'
汪汪汪
'
)
this
.
playAudio
(
this
.
popUpData
.
audio
);
this
.
playAudio
(
this
.
popUpData
.
audio
);
});
});
...
@@ -358,10 +361,11 @@ export class MyGame extends Game {
...
@@ -358,10 +361,11 @@ export class MyGame extends Game {
changeBtn
.
setName
(
'
changeBtn
'
);
changeBtn
.
setName
(
'
changeBtn
'
);
changeBtn
.
addTouchBeganListener
(
async
()
=>
{
changeBtn
.
addTouchBeganListener
(
async
()
=>
{
jelly
(
changeBtn
);
jelly
(
changeBtn
);
tweenChange
(
changeBtn
,
{
alpha
:
0
},
0.2
,
()
=>
{
tweenChange
(
changeBtn
,
{
alpha
:
0
},
0.2
,
()
=>
{
changeBtn
.
visible
=
false
;
changeBtn
.
visible
=
false
;
changeBtn
.
alpha
=
1
;
changeBtn
.
alpha
=
1
;
});
});
this
.
playAudio
(
'
click_green_btn
'
);
await
this
.
changePopUp
();
await
this
.
changePopUp
();
});
});
popUpWinBg
.
addChild
(
changeBtn
);
popUpWinBg
.
addChild
(
changeBtn
);
...
@@ -391,11 +395,21 @@ export class MyGame extends Game {
...
@@ -391,11 +395,21 @@ export class MyGame extends Game {
nodePosBase
.
childDepandAlpha
=
true
;
nodePosBase
.
childDepandAlpha
=
true
;
popUpWinBg
.
addChild
(
nodePosBase
);
popUpWinBg
.
addChild
(
nodePosBase
);
const
wordBase
=
new
TouchSprite
();
wordBase
.
childDepandAlpha
=
true
;
wordBase
.
setName
(
'
wordBase
'
);
nodePosBase
.
addChild
(
wordBase
);
const
lineBase
=
new
TouchSprite
();
lineBase
.
childDepandAlpha
=
true
;
lineBase
.
setName
(
'
lineBase
'
);
nodePosBase
.
addChild
(
lineBase
);
const
groupNumber
=
Math
.
max
(...
popUpData
.
letterDataList
.
map
(
letterData
=>
letterData
.
group
))
+
1
;
const
groupNumber
=
Math
.
max
(...
popUpData
.
letterDataList
.
map
(
letterData
=>
letterData
.
group
))
+
1
;
const
groupShowedList
=
new
Array
(
groupNumber
).
fill
(
false
);
const
groupShowedList
=
new
Array
(
groupNumber
).
fill
(
false
);
le
t
labelGroupList
=
[];
cons
t
labelGroupList
=
[];
let
blankWidth
=
0
;
let
blankWidth
=
0
;
let
width
=
0
;
let
width
=
0
;
popUpData
.
letterDataList
.
forEach
((
letterData
,
idx
)
=>
{
popUpData
.
letterDataList
.
forEach
((
letterData
,
idx
)
=>
{
...
@@ -412,8 +426,6 @@ export class MyGame extends Game {
...
@@ -412,8 +426,6 @@ export class MyGame extends Game {
wordMiddle
.
y
=
120
;
wordMiddle
.
y
=
120
;
wordMiddle
.
visible
=
false
;
wordMiddle
.
visible
=
false
;
wordMiddle
.
addTouchBeganListener
(()
=>
{
wordMiddle
.
addTouchBeganListener
(()
=>
{
// changeBtn
console
.
log
(
'
汪汪汪
'
);
for
(
const
label
of
labelGroupList
[
letterData
.
group
])
{
for
(
const
label
of
labelGroupList
[
letterData
.
group
])
{
label
.
visible
=
true
;
label
.
visible
=
true
;
tweenChange
(
label
,
{
alpha
:
1
},
0.2
);
tweenChange
(
label
,
{
alpha
:
1
},
0.2
);
...
@@ -425,10 +437,11 @@ export class MyGame extends Game {
...
@@ -425,10 +437,11 @@ export class MyGame extends Game {
tweenChange
(
changeBtn
,
{
alpha
:
1
},
0.2
);
tweenChange
(
changeBtn
,
{
alpha
:
1
},
0.2
);
}
}
this
.
playAudio
(
popUpData
.
groupAudios
[
letterData
.
group
].
audio
);
this
.
playAudio
(
'
click_line
'
,
true
,
()
=>
{
this
.
playAudio
(
popUpData
.
groupAudios
[
letterData
.
group
].
audio
);
});
});
});
nodePosBase
.
addChild
(
wordMiddle
);
wordBase
.
addChild
(
wordMiddle
);
if
(
!
labelGroupList
[
letterData
.
group
])
{
if
(
!
labelGroupList
[
letterData
.
group
])
{
labelGroupList
.
push
([]);
labelGroupList
.
push
([]);
...
@@ -447,18 +460,19 @@ export class MyGame extends Game {
...
@@ -447,18 +460,19 @@ export class MyGame extends Game {
line
.
y
=
170
;
line
.
y
=
170
;
line
.
scaleX
=
wordMiddle
.
width
/
line
.
width
;
line
.
scaleX
=
wordMiddle
.
width
/
line
.
width
;
line
.
setName
(
`line_
${
idx
}
`
);
line
.
setName
(
`line_
${
idx
}
`
);
nodePos
Base
.
addChild
(
line
);
line
Base
.
addChild
(
line
);
});
});
const
changeBtn
=
this
.
seekChildByName
(
'
changeBtn
'
);
const
changeBtn
=
this
.
seekChildByName
(
'
changeBtn
'
);
changeBtn
.
visible
=
false
;
changeBtn
.
visible
=
false
;
changeBtn
.
alpha
=
0
;
changeBtn
.
alpha
=
0
;
nodePosBase
.
x
=
-
(
width
+
blankWidth
)
/
2
;
lineBase
.
x
=
-
(
width
+
blankWidth
)
/
2
;
wordBase
.
x
=
-
(
width
+
blankWidth
)
/
2
;
tweenChange
(
popUpBg
,
{
alpha
:
1
},
0.2
);
tweenChange
(
popUpBg
,
{
alpha
:
1
},
0.2
);
tweenChange
(
popUpWinBg
,
{
alpha
:
1
},
0.2
,
()
=>
{
tweenChange
(
popUpWinBg
,
{
alpha
:
1
},
0.2
,
()
=>
{
popUpData
.
letterDataList
.
forEach
((
_
,
idx
)
=>
{
popUpData
.
letterDataList
.
forEach
((
_
,
idx
)
=>
{
const
wordMiddle
=
nodePos
Base
.
getChildByName
(
`wordMiddle_
${
idx
}
`
);
const
wordMiddle
=
word
Base
.
getChildByName
(
`wordMiddle_
${
idx
}
`
);
wordMiddle
.
visible
=
true
;
wordMiddle
.
visible
=
true
;
wordMiddle
.
alpha
=
0.00000001
;
wordMiddle
.
alpha
=
0.00000001
;
});
});
...
@@ -473,19 +487,21 @@ export class MyGame extends Game {
...
@@ -473,19 +487,21 @@ export class MyGame extends Game {
}
}
async
changePopUp
()
{
async
changePopUp
()
{
const
nodePosBaseOld
=
this
.
seekChildByName
(
'
nodePos
Base
'
);
const
wordBaseOld
=
this
.
seekChildByName
(
'
word
Base
'
);
await
asyncTweenChange
(
nodePos
BaseOld
,
{
alpha
:
0
},
0.3
);
await
asyncTweenChange
(
word
BaseOld
,
{
alpha
:
0
},
0.3
);
const
popUpWinBg
=
this
.
getChildByName
(
'
popUpWinBg
'
);
const
popUpWinBg
=
this
.
getChildByName
(
'
popUpWinBg
'
);
const
nodePosBaseOld2
=
popUpWinBg
.
seekChildByName
(
'
nodePos
Base
'
);
const
wordBaseOld2
=
popUpWinBg
.
seekChildByName
(
'
word
Base
'
);
if
(
nodePos
BaseOld2
)
{
if
(
word
BaseOld2
)
{
popUpWinBg
.
removeChild
(
nodePos
BaseOld2
);
popUpWinBg
.
removeChild
(
word
BaseOld2
);
}
}
const
nodePosBase
=
new
TouchSprite
();
const
nodePosBase
=
this
.
seekChildByName
(
'
nodePosBase
'
);
nodePosBase
.
setName
(
'
nodePosBase
'
);
nodePosBase
.
childDepandAlpha
=
true
;
const
wordBase
=
new
TouchSprite
();
popUpWinBg
.
addChild
(
nodePosBase
);
wordBase
.
setName
(
'
wordBase
'
);
wordBase
.
childDepandAlpha
=
true
;
nodePosBase
.
addChild
(
wordBase
);
let
labelGroupList
=
[];
let
labelGroupList
=
[];
let
blankWidth
=
0
;
let
blankWidth
=
0
;
...
@@ -503,13 +519,13 @@ export class MyGame extends Game {
...
@@ -503,13 +519,13 @@ export class MyGame extends Game {
wordMiddle
.
alpha
=
0
;
wordMiddle
.
alpha
=
0
;
wordMiddle
.
x
=
width
+
letterData
.
group
*
20
;
wordMiddle
.
x
=
width
+
letterData
.
group
*
20
;
wordMiddle
.
y
=
120
;
wordMiddle
.
y
=
120
;
nodePos
Base
.
addChild
(
wordMiddle
);
word
Base
.
addChild
(
wordMiddle
);
// tweenChange(wordMiddle, { alpha: 1 }, 0.2);
// tweenChange(wordMiddle, { alpha: 1 }, 0.2);
const
groupNumber
=
Math
.
max
(...
this
.
popUpData
.
letterDataList
.
map
(
letterData
=>
letterData
.
group
))
+
1
;
const
groupNumber
=
Math
.
max
(...
this
.
popUpData
.
letterDataList
.
map
(
letterData
=>
letterData
.
group
))
+
1
;
const
groupShowedList
=
new
Array
(
groupNumber
).
fill
(
false
);
const
groupShowedList
=
new
Array
(
groupNumber
).
fill
(
false
);
wordMiddle
.
addTouchBeganListener
(()
=>
{
wordMiddle
.
addTouchBeganListener
(()
=>
{
// changeBtn
// changeBtn
console
.
log
(
'
汪汪汪
'
);
console
.
log
(
'
汪汪汪
'
);
for
(
const
label
of
labelGroupList
[
letterData
.
group
])
{
for
(
const
label
of
labelGroupList
[
letterData
.
group
])
{
...
@@ -535,28 +551,28 @@ export class MyGame extends Game {
...
@@ -535,28 +551,28 @@ export class MyGame extends Game {
width
+=
wordMiddle
.
width
;
width
+=
wordMiddle
.
width
;
const
line
=
new
TouchSprite
();
//
const line = new TouchSprite();
line
.
init
(
this
.
images
.
get
(
'
img_line_purple
'
));
//
line.init(this.images.get('img_line_purple'));
line
.
anchorX
=
0
;
//
line.anchorX = 0;
line
.
anchorY
=
0.5
;
//
line.anchorY = 0.5;
line
.
x
=
wordMiddle
.
x
;
//
line.x = wordMiddle.x;
line
.
y
=
170
;
//
line.y = 170;
line
.
scaleX
=
wordMiddle
.
width
/
line
.
width
;
//
line.scaleX = wordMiddle.width / line.width;
line
.
setName
(
`line_
${
idx
}
`
);
//
line.setName(`line_${idx}`);
nodePosBase
.
addChild
(
line
);
//
nodePosBase.addChild(line);
if
(
letterData
.
point
)
{
if
(
letterData
.
point
)
{
const
point
=
new
TouchSprite
();
const
point
=
new
TouchSprite
();
point
.
init
(
this
.
images
.
get
(
'
Img_point
'
));
point
.
init
(
this
.
images
.
get
(
'
Img_point
'
));
point
.
x
=
wordMiddle
.
x
+
10
;
point
.
x
=
wordMiddle
.
x
+
10
;
point
.
y
=
wordMiddle
.
y
-
50
;
point
.
y
=
wordMiddle
.
y
-
50
;
nodePos
Base
.
addChild
(
point
);
word
Base
.
addChild
(
point
);
}
}
});
});
nodePos
Base
.
x
=
-
(
width
+
blankWidth
)
/
2
;
word
Base
.
x
=
-
(
width
+
blankWidth
)
/
2
;
nodePos
Base
.
alpha
=
0
;
word
Base
.
alpha
=
0
;
await
asyncTweenChange
(
nodePos
Base
,
{
alpha
:
1
},
0.3
);
await
asyncTweenChange
(
word
Base
,
{
alpha
:
1
},
0.3
);
}
}
}
}
\ No newline at end of file
src/app/play/resources.js
View file @
256a8bcf
...
@@ -18,8 +18,9 @@ const res = [
...
@@ -18,8 +18,9 @@ const res = [
];
];
const
resAudio
=
[
const
resAudio
=
[
// ['click', "assets/play/music/click.mp3"],
[
'
pop_up
'
,
"
assets/play/music/pop_up.mp3
"
],
[
'
pop_up
'
,
"
assets/play/music/pop_up.mp3
"
],
[
'
click_green_btn
'
,
"
assets/play/music/click_green_btn.mp3
"
],
[
'
click_line
'
,
"
assets/play/music/click_line.mp3
"
],
];
];
...
...
src/assets/play/music/click_green_btn.mp3
0 → 100644
View file @
256a8bcf
File added
src/assets/play/music/click_line.mp3
0 → 100644
View file @
256a8bcf
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment