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
2bbabd5a
Commit
2bbabd5a
authored
Jun 24, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 基本完成
parent
8371b586
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
170 additions
and
5 deletions
+170
-5
MyGame.ts
src/app/play/game/MyGame.ts
+169
-5
resources.js
src/app/play/resources.js
+1
-0
Img_point.png
src/assets/play/Img_point.png
+0
-0
No files found.
src/app/play/game/MyGame.ts
View file @
2bbabd5a
...
...
@@ -2,10 +2,11 @@ import {
Game
,
TouchSprite
,
MyLabel
,
asyncTweenChange
,
}
from
'
./Game
'
;
import
{
jelly
,
jelly
,
tweenChange
,
}
from
'
./../Unit
'
;
import
{
defaultData
}
from
'
./DefaultData
'
;
...
...
@@ -227,8 +228,7 @@ export class MyGame extends Game {
groupBg
.
addChild
(
letterLabel
);
letterLabel
.
addTouchBeganListener
(()
=>
{
console
.
log
(
`groupIdx =
${
idx
}
, lineIdx =
${
lineIdx
}
`
);
console
.
log
(
'
this.data.group[idx][lineIdx] =
'
+
JSON
.
stringify
(
this
.
data
.
group
[
idx
][
lineIdx
]));
this
.
popUp
(
this
.
data
.
group
[
idx
][
lineIdx
]);
});
width
+=
letterLabel
.
width
;
...
...
@@ -302,19 +302,183 @@ export class MyGame extends Game {
initPopUp
()
{
const
popUpBg
=
new
TouchSprite
();
popUpBg
.
init
(
this
.
images
.
get
(
'
img_grey_bg
'
));
popUpBg
.
setName
(
'
popUpBg
'
);
popUpBg
.
x
=
this
.
_parent
.
canvasWidth
/
2
;
popUpBg
.
y
=
this
.
_parent
.
canvasHeight
/
2
;
popUpBg
.
setScaleXY
(
this
.
_parent
.
mapScaleBig
);
popUpBg
.
alpha
=
0
;
popUpBg
.
childDepandAlpha
=
true
;
popUpBg
.
addTouchBeganListener
(()
=>
{
console
.
log
(
'
汪汪汪
'
);
});
this
.
addChild
(
popUpBg
);
const
popUpWinBg
=
new
TouchSprite
();
popUpWinBg
.
init
(
this
.
images
.
get
(
'
img_win_bg
'
));
popUpWinBg
.
setName
(
'
popUpWinBg
'
);
popUpWinBg
.
x
=
this
.
_parent
.
canvasWidth
/
2
;
popUpWinBg
.
y
=
this
.
_parent
.
canvasHeight
/
2
;
popUpWinBg
.
setScaleXY
(
this
.
mapScale
);
popUpWinBg
.
alpha
=
0
;
popUpWinBg
.
childDepandAlpha
=
true
;
this
.
addChild
(
popUpWinBg
);
const
btnClose
=
new
TouchSprite
();
btnClose
.
init
(
this
.
images
.
get
(
'
btn_close
'
));
btnClose
.
setName
(
'
btnClose
'
);
btnClose
.
x
=
(
popUpWinBg
.
width
/
2
-
btnClose
.
width
/
3
);
btnClose
.
y
=
-
(
popUpWinBg
.
height
/
2
-
btnClose
.
height
/
3
);
btnClose
.
addTouchBeganListener
(()
=>
{
jelly
(
btnClose
);
this
.
hidePopUp
();
});
popUpWinBg
.
addChild
(
btnClose
);
const
wordMiddle
=
new
MyLabel
();
wordMiddle
.
fontSize
=
72
;
wordMiddle
.
fontColor
=
"
#680099
"
;
wordMiddle
.
fontName
=
'
GOTHICB
'
;
wordMiddle
.
text
=
''
;
wordMiddle
.
refreshSize
();
wordMiddle
.
setName
(
'
wordMiddle
'
);
popUpWinBg
.
addChild
(
wordMiddle
);
const
changeBtn
=
new
TouchSprite
();
changeBtn
.
init
(
this
.
images
.
get
(
'
btn_switch
'
));
changeBtn
.
x
=
(
popUpWinBg
.
width
/
2
-
100
);
changeBtn
.
y
=
(
popUpWinBg
.
height
/
2
-
100
);
changeBtn
.
setName
(
'
changeBtn
'
);
changeBtn
.
addTouchBeganListener
(
async
()
=>
{
jelly
(
changeBtn
);
await
this
.
changePopUp
();
changeBtn
.
visible
=
false
;
});
popUpWinBg
.
addChild
(
changeBtn
);
}
popUpData
;
popUp
(
popUpData
)
{
this
.
popUpData
=
popUpData
;
const
popUpBg
=
this
.
getChildByName
(
'
popUpBg
'
);
tweenChange
(
popUpBg
,
{
alpha
:
1
},
0.2
);
const
popUpWinBg
=
this
.
getChildByName
(
'
popUpWinBg
'
);
tweenChange
(
popUpWinBg
,
{
alpha
:
1
},
0.2
);
const
wordMiddle
=
this
.
seekChildByName
(
'
wordMiddle
'
);
wordMiddle
.
text
=
popUpData
.
word
;
wordMiddle
.
refreshSize
();
wordMiddle
.
x
=
0
;
wordMiddle
.
y
=
-
150
;
const
nodePosBaseOld
=
popUpWinBg
.
seekChildByName
(
'
nodePosBase
'
);
if
(
nodePosBaseOld
)
{
popUpWinBg
.
removeChild
(
nodePosBaseOld
);
}
const
nodePosBase
=
new
TouchSprite
();
nodePosBase
.
setName
(
'
nodePosBase
'
);
nodePosBase
.
childDepandAlpha
=
true
;
popUpWinBg
.
addChild
(
nodePosBase
);
let
blankWidth
=
0
;
let
width
=
0
;
popUpData
.
letterDataList
.
forEach
((
letterData
,
idx
)
=>
{
const
wordMiddle
=
new
MyLabel
();
wordMiddle
.
fontSize
=
72
;
wordMiddle
.
fontColor
=
"
#363333
"
;
wordMiddle
.
fontName
=
'
GOTHICB
'
;
wordMiddle
.
text
=
letterData
.
letter
;
wordMiddle
.
setName
(
`wordMiddle_
${
idx
}
`
);
wordMiddle
.
refreshSize
();
wordMiddle
.
anchorX
=
0
;
wordMiddle
.
anchorY
=
0.5
;
wordMiddle
.
x
=
width
+
letterData
.
group
*
20
;
wordMiddle
.
y
=
120
;
nodePosBase
.
addChild
(
wordMiddle
);
blankWidth
=
letterData
.
group
*
20
;
width
+=
wordMiddle
.
width
;
const
line
=
new
TouchSprite
();
line
.
init
(
this
.
images
.
get
(
'
img_line_purple
'
));
line
.
anchorX
=
0
;
line
.
anchorY
=
0.5
;
line
.
x
=
wordMiddle
.
x
;
line
.
y
=
170
;
line
.
scaleX
=
wordMiddle
.
width
/
line
.
width
;
line
.
setName
(
`line_
${
idx
}
`
);
nodePosBase
.
addChild
(
line
);
});
const
changeBtn
=
this
.
seekChildByName
(
'
changeBtn
'
);
changeBtn
.
visible
=
true
;
nodePosBase
.
x
=
-
(
width
+
blankWidth
)
/
2
;
}
hidePopUp
()
{
const
popUpBg
=
this
.
getChildByName
(
'
popUpBg
'
);
tweenChange
(
popUpBg
,
{
alpha
:
0
},
0.2
);
const
popUpWinBg
=
this
.
getChildByName
(
'
popUpWinBg
'
);
tweenChange
(
popUpWinBg
,
{
alpha
:
0
},
0.2
);
}
async
changePopUp
()
{
const
nodePosBaseOld
=
this
.
seekChildByName
(
'
nodePosBase
'
);
await
asyncTweenChange
(
nodePosBaseOld
,
{
alpha
:
0
},
0.2
);
const
popUpWinBg
=
this
.
getChildByName
(
'
popUpWinBg
'
);
const
nodePosBaseOld2
=
popUpWinBg
.
seekChildByName
(
'
nodePosBase
'
);
if
(
nodePosBaseOld2
)
{
popUpWinBg
.
removeChild
(
nodePosBaseOld2
);
}
const
nodePosBase
=
new
TouchSprite
();
nodePosBase
.
setName
(
'
nodePosBase
'
);
nodePosBase
.
childDepandAlpha
=
true
;
popUpWinBg
.
addChild
(
nodePosBase
);
let
blankWidth
=
0
;
let
width
=
0
;
this
.
popUpData
.
letterDataList
.
forEach
((
letterData
,
idx
)
=>
{
const
wordMiddle
=
new
MyLabel
();
wordMiddle
.
fontSize
=
72
;
wordMiddle
.
fontColor
=
letterData
.
color
;
wordMiddle
.
fontName
=
'
GOTHICB
'
;
wordMiddle
.
text
=
letterData
.
letter
;
wordMiddle
.
setName
(
`wordMiddle_
${
idx
}
`
);
wordMiddle
.
refreshSize
();
wordMiddle
.
anchorX
=
0
;
wordMiddle
.
anchorY
=
0.5
;
wordMiddle
.
alpha
=
0
;
wordMiddle
.
x
=
width
+
letterData
.
group
*
20
;
wordMiddle
.
y
=
120
;
nodePosBase
.
addChild
(
wordMiddle
);
tweenChange
(
wordMiddle
,
{
alpha
:
1
},
0.2
);
blankWidth
=
letterData
.
group
*
20
;
width
+=
wordMiddle
.
width
;
const
line
=
new
TouchSprite
();
line
.
init
(
this
.
images
.
get
(
'
img_line_purple
'
));
line
.
anchorX
=
0
;
line
.
anchorY
=
0.5
;
line
.
x
=
wordMiddle
.
x
;
line
.
y
=
170
;
line
.
scaleX
=
wordMiddle
.
width
/
line
.
width
;
line
.
setName
(
`line_
${
idx
}
`
);
nodePosBase
.
addChild
(
line
);
if
(
letterData
.
point
)
{
const
point
=
new
TouchSprite
();
point
.
init
(
this
.
images
.
get
(
'
Img_point
'
));
point
.
x
=
wordMiddle
.
x
+
10
;
point
.
y
=
wordMiddle
.
y
-
50
;
nodePosBase
.
addChild
(
point
);
}
});
nodePosBase
.
x
=
-
(
width
+
blankWidth
)
/
2
;
}
}
src/app/play/resources.js
View file @
2bbabd5a
...
...
@@ -14,6 +14,7 @@ const res = [
[
'
btn_switch
'
,
'
assets/play/btn_switch.png
'
],
[
'
img_line_black
'
,
'
assets/play/img_line_black.png
'
],
[
'
img_oval_bg
'
,
'
assets/play/img_oval_bg.png
'
],
[
'
Img_point
'
,
'
assets/play/Img_point.png
'
],
];
const
resAudio
=
[
...
...
src/assets/play/Img_point.png
0 → 100644
View file @
2bbabd5a
345 Bytes
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