Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM5-9
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
YM5-9
Commits
cc76e42c
Commit
cc76e42c
authored
Feb 02, 2021
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix
parent
c458b230
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
15 deletions
+69
-15
play.component.ts
src/app/play/play.component.ts
+69
-15
No files found.
src/app/play/play.component.ts
View file @
cc76e42c
...
@@ -66,7 +66,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -66,7 +66,7 @@ export class PlayComponent implements OnInit, OnDestroy {
g_topElementContainer
;
// 用于装载装饰元素 气球 星星等
g_topElementContainer
;
// 用于装载装饰元素 气球 星星等
g_stage
;
//中心舞台
g_stage
;
//中心舞台
// g_background_color = "#rgb(0,0,0,0)"
// g_background_color = "#rgb(0,0,0,0)"
g_background_color
=
"
#
FFFFFF
"
g_background_color
=
"
#
f0f5f8
"
g_enableMapDown
=
true
;
// 触摸使能
g_enableMapDown
=
true
;
// 触摸使能
g_enableMapUp
=
true
;
// 抬起使能
g_enableMapUp
=
true
;
// 抬起使能
g_enableMapMove
=
true
;
// 移动ss使能
g_enableMapMove
=
true
;
// 移动ss使能
...
@@ -206,7 +206,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -206,7 +206,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
cleanGameVar
(){
cleanGameVar
(){
this
.
m_currentQuestionIndex
=
-
1
;
}
}
startGame
(){
startGame
(){
...
@@ -322,8 +322,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -322,8 +322,8 @@ export class PlayComponent implements OnInit, OnDestroy {
let
sliderBG
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-background
"
,
"
bgSlider
"
,
(
w
,
h
)
=>
{
let
sliderBG
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-background
"
,
"
bgSlider
"
,
(
w
,
h
)
=>
{
return
{
return
{
sx
:
14
*
this
.
g_mapScale
/
w
,
sx
:
14
/
w
,
sy
:
552
*
this
.
g_mapScale
/
h
,
sy
:
552
/
h
,
}
}
},
(
w
,
h
)
=>
{
},
(
w
,
h
)
=>
{
return
{
return
{
...
@@ -387,7 +387,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -387,7 +387,6 @@ export class PlayComponent implements OnInit, OnDestroy {
return
true
;
return
true
;
}
}
}
}
sliderBG
.
ref
.
addChild
(
sliderTop
.
ref
)
let
sliderBody
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-body
"
,
"
slider_body
"
,
(
w
,
h
)
=>
{
let
sliderBody
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-body
"
,
"
slider_body
"
,
(
w
,
h
)
=>
{
return
{
return
{
...
@@ -419,9 +418,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -419,9 +418,6 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderBottom
.
update
();
sliderBottom
.
update
();
}
}
sliderBG
.
ref
.
addChild
(
sliderBody
.
ref
)
let
sliderBottom
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-bottom
"
,
"
slider_bottom
"
,
(
w
,
h
)
=>
{
let
sliderBottom
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-bottom
"
,
"
slider_bottom
"
,
(
w
,
h
)
=>
{
return
{
return
{
sx
:
8
/
w
,
sx
:
8
/
w
,
...
@@ -446,7 +442,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -446,7 +442,9 @@ export class PlayComponent implements OnInit, OnDestroy {
return
true
;
return
true
;
}
}
}
}
sliderBG
.
ref
.
addChild
(
sliderBody
.
ref
)
sliderBG
.
ref
.
addChild
(
sliderBottom
.
ref
)
sliderBG
.
ref
.
addChild
(
sliderBottom
.
ref
)
sliderBG
.
ref
.
addChild
(
sliderTop
.
ref
)
this
.
render
(
sliderBG
.
ref
,
zIndexMap
.
sliderBG
)
this
.
render
(
sliderBG
.
ref
,
zIndexMap
.
sliderBG
)
let
clickSY
=
0
let
clickSY
=
0
...
@@ -481,13 +479,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -481,13 +479,14 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
initScrollPannel
()
{
initScrollPannel
()
{
let
pannel
=
this
.
g_cartoon
.
createCartoonElementShapeRect
(
"
scroll-pannel
"
,
this
.
g_canvasWidth
,
this
.
g_canvasHeight
-
78
*
this
.
g_mapScale
,
"
#f0f5f8
"
)
let
pannel
=
this
.
g_cartoon
.
createCartoonElementShapeRect
(
"
scroll-pannel
"
,
this
.
g_canvasWidth
-
180
*
this
.
g_mapScale
,
this
.
g_canvasHeight
-
78
*
this
.
g_mapScale
,
"
#f0f5f8
"
)
pannel
.
ref
.
y
=
78
*
this
.
g_mapScale
pannel
.
ref
.
y
=
78
*
this
.
g_mapScale
this
.
render
(
pannel
.
ref
,
10
);
this
.
render
(
pannel
.
ref
,
10
);
pannel
.
lastInserType
=
"
Q
"
pannel
.
lastInserType
=
"
Q
"
pannel
.
windowHeight
=
this
.
g_canvasHeight
-
78
*
this
.
g_mapScale
pannel
.
windowHeight
=
this
.
g_canvasHeight
-
78
*
this
.
g_mapScale
pannel
.
currentY
=
0
;
pannel
.
currentY
=
0
;
pannel
.
currentQuestionIndex
=
-
1
;
pannel
.
currentQuestionIndex
=
-
1
;
pannel
.
topY
=
78
*
this
.
g_mapScale
pannel
.
insertQuestion
=
(
text
,
nextQuestion
=
false
)
=>
{
pannel
.
insertQuestion
=
(
text
,
nextQuestion
=
false
)
=>
{
if
(
nextQuestion
)
{
if
(
nextQuestion
)
{
pannel
.
currentQuestionIndex
++
;
pannel
.
currentQuestionIndex
++
;
...
@@ -512,7 +511,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -512,7 +511,7 @@ export class PlayComponent implements OnInit, OnDestroy {
lineText
.
show
()
lineText
.
show
()
pannel
.
currentY
=
label
.
ref
.
y
+
64
*
this
.
g_mapScale
;
pannel
.
currentY
=
label
.
ref
.
y
+
64
*
this
.
g_mapScale
;
if
(
pannel
.
windowHeight
<
pannel
.
currentY
)
{
if
(
pannel
.
windowHeight
<
pannel
.
currentY
)
{
pannel
.
ref
.
setSize
(
this
.
g_canvasWidth
,
pannel
.
currentY
)
pannel
.
ref
.
setSize
(
this
.
g_canvasWidth
-
180
*
this
.
g_mapScale
,
pannel
.
currentY
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
initSlider
(
pannel
.
windowHeight
,
pannel
.
currentY
,
1
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
initSlider
(
pannel
.
windowHeight
,
pannel
.
currentY
,
1
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
show
()
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
show
()
}
}
...
@@ -520,6 +519,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -520,6 +519,7 @@ export class PlayComponent implements OnInit, OnDestroy {
pannel
.
lastInserType
=
"
Q
"
;
pannel
.
lastInserType
=
"
Q
"
;
}
}
pannel
.
canScroll
=
false
;
pannel
.
firstInstert
=
true
;
pannel
.
firstInstert
=
true
;
pannel
.
insertAnswer
=
(
text
)
=>
{
pannel
.
insertAnswer
=
(
text
)
=>
{
let
line
=
this
.
creatAnswerTextLine
(
pannel
.
currentQuestionIndex
,
text
,
42
*
this
.
g_mapScale
*
2
,
pannel
.
currentY
,
pannel
.
ref
)
let
line
=
this
.
creatAnswerTextLine
(
pannel
.
currentQuestionIndex
,
text
,
42
*
this
.
g_mapScale
*
2
,
pannel
.
currentY
,
pannel
.
ref
)
...
@@ -537,14 +537,68 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -537,14 +537,68 @@ export class PlayComponent implements OnInit, OnDestroy {
line
.
show
()
line
.
show
()
if
(
pannel
.
windowHeight
<
pannel
.
currentY
)
{
if
(
pannel
.
windowHeight
<
pannel
.
currentY
)
{
pannel
.
ref
.
setSize
(
this
.
g_canvasWidth
,
pannel
.
currentY
)
pannel
.
ref
.
setSize
(
this
.
g_canvasWidth
-
180
*
this
.
g_mapScale
,
pannel
.
currentY
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
initSlider
(
pannel
.
windowHeight
,
pannel
.
currentY
,
1
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
initSlider
(
pannel
.
windowHeight
,
pannel
.
currentY
,
1
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
show
()
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
show
();
pannel
.
canScroll
=
true
;
}
}
pannel
.
ref
.
addChild
(
label
.
ref
);
pannel
.
ref
.
addChild
(
label
.
ref
);
pannel
.
lastInserType
=
"
A
"
pannel
.
lastInserType
=
"
A
"
}
}
let
clickSY
=
null
;
let
baseY
=
null
;
this
.
subscribeMapDragEvent
(
pannel
.
id
,
()
=>
{
if
(
!
pannel
.
canScroll
)
{
this
.
g_enableMapUp
=
true
;
this
.
g_enableMapDown
=
true
;
return
;
}
clickSY
=
this
.
g_clickY
;
baseY
=
pannel
.
ref
.
y
console
.
log
(
"
baseY
"
,
baseY
)
},
()
=>
{
let
dis
=
clickSY
-
this
.
g_clickY
;
let
_t
=
pannel
.
topY
-
(
pannel
.
currentY
-
pannel
.
windowHeight
)
if
(
pannel
.
topY
<=
(
baseY
-
dis
))
{
pannel
.
ref
.
y
=
pannel
.
topY
}
else
{
if
((
baseY
-
dis
)
<=
_t
)
{
pannel
.
ref
.
y
=
_t
}
else
{
pannel
.
ref
.
y
=
baseY
-
dis
}
}
let
total
=
pannel
.
topY
-
_t
;
let
current
=
pannel
.
topY
-
pannel
.
ref
.
y
let
progress
=
Math
.
floor
(
current
/
total
*
100
)
/
100
;
if
(
progress
<
0.05
)
{
progress
=
0.05
}
if
(
progress
>
1
)
{
progress
=
1
}
console
.
log
(
progress
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
initSlider
(
pannel
.
windowHeight
,
pannel
.
currentY
,
progress
)
// let crTop = sliderTop.update()
// let crBottom = sliderBottom.update()
// if(!crTop) {
// sliderBody.toTop()
// sliderTop.update();
// sliderBottom.update();
// }
// if(!crBottom) {
// sliderBody.toEnd();
// sliderTop.update();
// sliderBottom.update();
// }
// scrollPannel.ref.y = 78 * this.g_mapScale - (scrollPannel.currentY - (this.g_canvasHeight - 78 * this.g_mapScale)) * sliderBG.getCurrentProgress()
},
()
=>
{
this
.
g_enableMapUp
=
true
;
this
.
g_enableMapDown
=
true
;
})
}
}
initButtions
()
{
initButtions
()
{
...
@@ -637,7 +691,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -637,7 +691,7 @@ export class PlayComponent implements OnInit, OnDestroy {
},
900
*
index
);
},
900
*
index
);
}
}
})
})
})
}
,
100
)
this
.
subscribeMapDownEvent
(
btnAnswer
.
id
,
()
=>
{
this
.
subscribeMapDownEvent
(
btnAnswer
.
id
,
()
=>
{
let
text
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
?
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
:
""
let
text
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
?
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
:
""
...
@@ -664,7 +718,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -664,7 +718,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
},
900
*
index
);
},
900
*
index
);
})
})
})
}
,
100
)
this
.
render
(
btnQuestion
.
ref
,
zIndexMap
.
buttons
);
this
.
render
(
btnQuestion
.
ref
,
zIndexMap
.
buttons
);
this
.
render
(
btnAnswer
.
ref
,
zIndexMap
.
buttons
);
this
.
render
(
btnAnswer
.
ref
,
zIndexMap
.
buttons
);
...
...
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