Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy01_danci
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
hy01_danci
Commits
83c91eb1
Commit
83c91eb1
authored
Jul 01, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
b5e79f78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
16 deletions
+42
-16
LayerRecord_hy01_danci.ts
assets/hy01_danci/common/script/LayerRecord_hy01_danci.ts
+2
-0
hy01_danci.ts
assets/hy01_danci/scene/hy01_danci.ts
+40
-16
No files found.
assets/hy01_danci/common/script/LayerRecord_hy01_danci.ts
View file @
83c91eb1
...
...
@@ -2,6 +2,8 @@
// letter: 'test',
// targetTime: 10
// })
//pg.event.on('layer_record_start_record',()=>{});
//pg.event.on('layer_record_end_record',()=>{});
import
pg
from
"
../../scene/pg_hy01_danci
"
;
...
...
assets/hy01_danci/scene/hy01_danci.ts
View file @
83c91eb1
...
...
@@ -71,24 +71,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layer_word_little
=
pg
.
view
.
find
(
this
,
'
layer_word_little
'
)
this
.
layer_touch
=
pg
.
view
.
find
(
this
,
'
layer_touch
'
)
pg
.
view
.
touchStartOn
(
this
.
layer_touch
,
this
.
onTouchPanelGameDown
,
this
);
pg
.
view
.
touchEndOn
(
this
.
layer_touch
,
this
.
onTouchPanelGameUp
,
this
);
pg
.
view
.
touchMoveOn
(
this
.
layer_touch
,
this
.
onTouchPanelMove
,
this
);
pg
.
view
.
touchCancelOn
(
this
.
layer_touch
,
this
.
onTouchPanelGameUp
,
this
);
}
// 播放中不让点
// 录音中不让点
private
touchForbid
:
boolean
;
onTouchPanelMove
(
e
:
cc
.
Event
.
EventTouch
)
{
if
(
this
.
touchForbid
)
return
;
//加一些限制
let
touchPoint
=
e
.
getLocation
();
let
startPoint
=
e
.
getStartLocation
();
let
move
=
touchPoint
.
clone
().
subtract
(
startPoint
);
console
.
log
(
move
.
toString
());
if
(
Math
.
abs
(
move
.
x
)
>
5
0
)
{
if
(
move
.
x
<
0
)
{
if
(
move
.
x
<
-
1
0
)
{
this
.
touchForbid
=
true
;
this
.
lastPage
();
}
else
if
(
move
.
x
>
0
)
{
}
else
if
(
move
.
x
>
10
)
{
this
.
touchForbid
=
true
;
this
.
nextPage
();
}
}
}
lastPage
()
{
this
.
lastLayer
();
}
...
...
@@ -102,8 +104,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg
.
event
.
on
(
'
layer_record_score
'
,
(
score
)
=>
{
this
.
onRecorScore
(
score
);
})
pg
.
event
.
on
(
'
layer_record_start_record
'
,
()
=>
{
this
.
touchForbid
=
true
;
});
pg
.
event
.
on
(
'
layer_record_end_record
'
,
()
=>
{
this
.
touchForbid
=
false
;
});
}
private
get
LastData
()
{
return
this
.
list
[
this
.
count
-
1
]
}
private
get
CurrentData
()
{
return
this
.
list
[
this
.
count
]
}
...
...
@@ -113,14 +124,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
get
OutData
()
{
return
this
.
list
[
this
.
count
+
2
]
}
private
get
LastLayer
()
{
return
this
.
layers
[
this
.
count
-
1
]
}
private
get
CurrentLayer
()
{
return
this
.
layers
[
0
]
return
this
.
layers
[
this
.
count
]
}
private
get
LittleLayer
()
{
return
this
.
layers
[
1
]
return
this
.
layers
[
this
.
count
+
1
]
}
private
get
OutLayer
()
{
return
this
.
layers
[
2
]
return
this
.
layers
[
this
.
count
+
2
]
}
private
count
:
number
;
...
...
@@ -134,10 +148,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layers
.
push
(
nextLayer
)
}
startGame
()
{
this
.
touchForbid
=
false
;
this
.
startPlay
();
}
startPlay
()
{
if
(
this
.
recordFlag
)
{
this
.
touchForbid
=
false
;
pg
.
event
.
emit
(
'
layer_record_open
'
,
{
letter
:
this
.
CurrentData
.
content
,
targetTime
:
this
.
CurrentData
.
duration
...
...
@@ -214,17 +230,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
lastLayer
()
{
alert
(
"
上一题
"
)
// 积分需要计算,未获取的内容
this
.
count
--
;
if
(
!
this
.
LastData
)
return
;
cc
.
tween
(
this
.
lastLayer
).
to
(
3
,
{
x
:
0
,
y
:
0
,
scale
:
1
}).
start
();
cc
.
tween
(
this
.
CurrentLayer
).
to
(
3
,
{
x
:
this
.
layer_word_little
.
x
,
y
:
this
.
layer_word_little
.
y
,
scale
:
this
.
layer_word_little
.
scale
}).
start
();
if
(
this
.
nextLayer
)
{
cc
.
tween
(
this
.
nextLayer
).
to
(
3
,
{
x
:
-
1500
}).
start
();
}
this
.
scheduleOnce
(()
=>
{
this
.
count
--
;
this
.
startPlay
();
},
3
)
}
nextLayer
()
{
this
.
touchForbid
=
true
;
if
(
!
this
.
NextData
)
{
this
.
gameOver
();
return
;
}
if
(
this
.
OutData
)
{
if
(
this
.
OutData
&&
!
this
.
OutLayer
)
{
let
outLayer
=
this
.
createLittleLayer
();
this
.
updateLayer
(
outLayer
,
this
.
OutData
)
outLayer
.
x
=
-
1500
;
...
...
@@ -240,7 +265,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
this
.
scheduleOnce
(()
=>
{
this
.
count
++
;
this
.
layers
.
shift
();
this
.
startPlay
();
},
3
)
}
...
...
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