Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DF-L208
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
DF-L208
Commits
4c2f4568
Commit
4c2f4568
authored
Apr 14, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善
parent
9fc71c62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
22 deletions
+68
-22
Exercises.ts
src/app/play/Exercises.ts
+5
-0
play.component.ts
src/app/play/play.component.ts
+63
-22
No files found.
src/app/play/Exercises.ts
View file @
4c2f4568
...
@@ -26,6 +26,9 @@ export class Exercises{
...
@@ -26,6 +26,9 @@ export class Exercises{
/**显示亮光 */
/**显示亮光 */
lightShow
=
true
;
lightShow
=
true
;
/**正在显示亮光 */
lighting
=
false
;
audioUrl
:
string
;
audioUrl
:
string
;
/**内容类型:T-文本,P-图片;默认为文本 */
/**内容类型:T-文本,P-图片;默认为文本 */
...
@@ -43,6 +46,8 @@ export class Exercises{
...
@@ -43,6 +46,8 @@ export class Exercises{
this
.
lightShow
=
true
;
this
.
lightShow
=
true
;
this
.
lighting
=
false
;
this
.
audioUrl
=
''
;
this
.
audioUrl
=
''
;
}
}
}
}
\ No newline at end of file
src/app/play/play.component.ts
View file @
4c2f4568
...
@@ -80,6 +80,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -80,6 +80,8 @@ export class PlayComponent implements OnInit, OnDestroy {
canClickMonkey
=
false
;
canClickMonkey
=
false
;
canOverCard
=
true
;
showPetalStatus
=
false
;
showPetalStatus
=
false
;
/**背景图片 */
/**背景图片 */
...
@@ -617,6 +619,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -617,6 +619,8 @@ export class PlayComponent implements OnInit, OnDestroy {
};
};
initCardX
();
initCardX
();
this
.
canOverCard
=
true
;
}
}
...
@@ -773,21 +777,23 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -773,21 +777,23 @@ export class PlayComponent implements OnInit, OnDestroy {
cardObj
.
light
=
cardLight
;
cardObj
.
light
=
cardLight
;
cardBaseboard
.
addChild
(
cardLight
);
cardBaseboard
.
addChild
(
cardLight
);
cardBack
.
x
=
cardLight
.
x
;
cardBack
.
y
=
cardLight
.
y
;
cardBaseboard
.
addChild
(
cardBack
);
//卡片正面
//卡片正面
const
cardFront
=
new
MySprite
();
const
cardFront
=
new
MySprite
();
cardFront
.
init
(
this
.
images
.
get
(
"
card-front
"
));
cardFront
.
init
(
this
.
images
.
get
(
"
card-front
"
));
cardFront
.
setScaleXY
(
this
.
mapScale
);
cardFront
.
setScaleXY
(
this
.
mapScale
);
cardFront
.
x
=
card
Back
.
x
;
cardFront
.
x
=
card
Light
.
x
;
cardFront
.
y
=
card
Back
.
y
;
cardFront
.
y
=
card
Light
.
y
;
cardFront
.
alpha
=
0
;
cardFront
.
alpha
=
0
;
cardFront
.
visible
=
true
;
cardFront
.
visible
=
true
;
cardObj
.
front
=
cardFront
;
cardObj
.
front
=
cardFront
;
cardBaseboard
.
addChild
(
cardFront
);
cardBaseboard
.
addChild
(
cardFront
);
cardBack
.
x
=
cardLight
.
x
;
cardBack
.
y
=
cardLight
.
y
;
cardBaseboard
.
addChild
(
cardBack
);
//设置内容
//设置内容
this
.
setContent
(
exercises
,
cardFront
,
cardObj
);
this
.
setContent
(
exercises
,
cardFront
,
cardObj
);
...
@@ -1066,16 +1072,25 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1066,16 +1072,25 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
}
}
//停止闪烁
card
.
lightShow
=
false
;
card
.
light
.
alpha
=
0
;
//停止闪烁
this
.
stopLightMonkey
();
//显示背面,则翻转
//显示背面,则翻转
if
(
card
.
curShow
==
'
0
'
)
{
if
(
card
.
curShow
==
'
0
'
)
{
if
(
!
this
.
canOverCard
){
return
;
}
//停止闪烁
card
.
lightShow
=
false
;
card
.
light
.
alpha
=
0
;
//停止闪烁
this
.
stopLightMonkey
();
//禁止翻动卡片
this
.
canOverCard
=
false
;
this
.
overCard
(
card
.
baseboard
,
()
=>
{
this
.
overCard
(
card
.
baseboard
,
()
=>
{
this
.
canClickMonkey
=
true
;
this
.
canClickMonkey
=
true
;
});
});
...
@@ -1090,7 +1105,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1090,7 +1105,7 @@ export class PlayComponent implements OnInit, OnDestroy {
//卡片未到顶部,则将下一个卡片点亮
//卡片未到顶部,则将下一个卡片点亮
if
(
card
.
index
<
this
.
exercisesArr
.
length
-
1
)
{
if
(
card
.
index
<
this
.
exercisesArr
.
length
-
1
)
{
this
.
lightCard
(
this
.
exercisesArr
[
card
.
index
+
1
]);
//
this.lightCard(this.exercisesArr[card.index + 1]);
}
}
else
{
else
{
this
.
peach
.
canRotate
=
true
;
this
.
peach
.
canRotate
=
true
;
...
@@ -1165,11 +1180,30 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1165,11 +1180,30 @@ export class PlayComponent implements OnInit, OnDestroy {
monkey
.
curFloor
=
monkey
.
curFloor
+
1
;
monkey
.
curFloor
=
monkey
.
curFloor
+
1
;
console
.
log
(
'
monkey cur floor
'
,
monkey
.
curFloor
);
console
.
log
(
'
monkey cur floor
'
,
monkey
.
curFloor
);
this
.
canClickMonkey
=
true
;
this
.
canClickMonkey
=
true
;
this
.
canOverCard
=
true
;
let
card
=
this
.
exercisesArr
[
monkey
.
curFloor
];
if
(
card
.
curShow
==
'
0
'
&&
!
card
.
lighting
){
card
.
lightShow
=
true
;
this
.
lightCard
(
card
);
}
});
});
}
}
}
}
else
{
else
{
//还有卡片未被翻过来,则不跑向成功
for
(
let
i
=
0
;
i
<
this
.
exercisesArr
.
length
;
++
i
){
if
(
this
.
exercisesArr
[
i
].
curShow
==
'
0
'
){
return
;
}
}
let
toX
=
this
.
peach
.
initX
-
monkey
.
baseboard
.
getBoundingBox
().
width
/
2
;
let
toX
=
this
.
peach
.
initX
-
monkey
.
baseboard
.
getBoundingBox
().
width
/
2
;
let
toY
=
this
.
peach
.
initY
-
monkey
.
baseboard
.
getBoundingBox
().
height
/
2
+
30
*
this
.
mapScale
;
let
toY
=
this
.
peach
.
initY
-
monkey
.
baseboard
.
getBoundingBox
().
height
/
2
+
30
*
this
.
mapScale
;
...
@@ -1354,10 +1388,12 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1354,10 +1388,12 @@ export class PlayComponent implements OnInit, OnDestroy {
lightCard
(
card
)
{
lightCard
(
card
)
{
if
(
!
card
.
lightShow
)
{
if
(
!
card
.
lightShow
)
{
card
.
lighting
=
false
;
return
;
return
;
}
}
card
.
lighting
=
true
;
let
alpha
=
card
.
light
.
alpha
;
let
alpha
=
card
.
light
.
alpha
;
tweenChange
(
card
.
light
,
{
alpha
:
1
},
0.4
,
()
=>
{
tweenChange
(
card
.
light
,
{
alpha
:
1
},
0.4
,
()
=>
{
...
@@ -1499,6 +1535,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1499,6 +1535,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
playAudio
(
'
peachShow
'
);
this
.
playAudio
(
'
peachShow
'
);
this
.
canOverCard
=
true
;
//桃子显示并放大
//桃子显示并放大
tweenChange
(
this
.
peach
.
peach
,
{
scaleX
:
this
.
mapScale
*
1.2
,
scaleY
:
this
.
mapScale
*
1.2
,
alpha
:
1
},
0.3
,
()
=>
{
tweenChange
(
this
.
peach
.
peach
,
{
scaleX
:
this
.
mapScale
*
1.2
,
scaleY
:
this
.
mapScale
*
1.2
,
alpha
:
1
},
0.3
,
()
=>
{
...
@@ -1507,9 +1545,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1507,9 +1545,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
peach
.
light
.
alpha
=
1
;
this
.
peach
.
light
.
alpha
=
1
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
t
his
.
peach
.
light
.
alpha
=
0
;
t
weenChange
(
this
.
peach
.
light
,
{
alpha
:
0
},
0.5
)
this
.
peach
.
canRotate
=
true
;
this
.
peach
.
canRotate
=
true
;
},
3
00
);
},
10
00
);
});
});
//显示卡片
//显示卡片
...
@@ -1520,11 +1558,11 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1520,11 +1558,11 @@ export class PlayComponent implements OnInit, OnDestroy {
exercises
.
front
.
alpha
=
1
;
exercises
.
front
.
alpha
=
1
;
exercises
.
back
.
alpha
=
1
;
exercises
.
back
.
alpha
=
1
;
exercises
.
baseboard
.
scaleY
=
0
;
if
(
i
==
this
.
exercisesArr
.
length
-
1
)
{
if
(
i
==
this
.
exercisesArr
.
length
-
1
)
{
t
his
.
overCard
(
exercises
.
baseboard
,
()
=>
{
t
weenChange
(
exercises
.
baseboard
,
{
scaleY
:
this
.
mapScale
},
0.3
,
()
=>
{
this
.
playAudio
(
'
monkey
'
);
this
.
playAudio
(
'
monkey
'
);
...
@@ -1543,7 +1581,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1543,7 +1581,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
else
{
else
{
t
his
.
overCard
(
exercises
.
baseboard
);
t
weenChange
(
exercises
.
baseboard
,
{
scaleY
:
this
.
mapScale
},
0.3
)
}
}
}
}
...
@@ -1569,6 +1607,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1569,6 +1607,9 @@ export class PlayComponent implements OnInit, OnDestroy {
card
.
back
.
alpha
=
0
;
card
.
back
.
alpha
=
0
;
tweenChange
(
card
.
front
,
{
alpha
:
0
},
0.3
,
()
=>
{
tweenChange
(
card
.
front
,
{
alpha
:
0
},
0.3
,
()
=>
{
this
.
overCard
(
card
.
baseboard
);
//重置内容
//重置内容
card
.
resetContent
();
card
.
resetContent
();
...
@@ -1662,10 +1703,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1662,10 +1703,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
showPetal
(
pos
);
this
.
showPetal
(
pos
);
//
1秒后
停止撒花
//停止撒花
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
showPetalStatus
=
false
;
this
.
showPetalStatus
=
false
;
},
8
00
);
},
5
00
);
this
.
rotateLight
();
this
.
rotateLight
();
...
@@ -1730,7 +1771,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1730,7 +1771,7 @@ export class PlayComponent implements OnInit, OnDestroy {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
showPetal
(
pos
);
this
.
showPetal
(
pos
);
},
10
0
);
},
5
0
);
}
}
/**
/**
...
@@ -1759,7 +1800,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1759,7 +1800,7 @@ export class PlayComponent implements OnInit, OnDestroy {
petal
.
y
=
startY
-
petal
.
height
/
2
*
petal
.
scaleY
;
petal
.
y
=
startY
-
petal
.
height
/
2
*
petal
.
scaleY
;
const
randomT
=
2
+
Math
.
random
()
*
5
;
const
randomT
=
0.5
+
Math
.
random
()
*
2
;
petal
[
'
time
'
]
=
randomT
;
petal
[
'
time
'
]
=
randomT
;
let
randomTR
=
360
*
Math
.
random
();
// - 180;
let
randomTR
=
360
*
Math
.
random
();
// - 180;
...
...
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