Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PU20
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
PU20
Commits
bd0b2481
Commit
bd0b2481
authored
May 21, 2021
by
jeff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
99555427
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
35 deletions
+54
-35
hitItem.js
play/assets/scene/scene/hitItem.js
+43
-25
picNode.js
play/assets/scene/scene/picNode.js
+4
-0
scene.fire
play/assets/scene/scene/scene.fire
+4
-7
scene.js
play/assets/scene/scene/scene.js
+3
-3
No files found.
play/assets/scene/scene/hitItem.js
View file @
bd0b2481
const
tools
=
require
(
"
../script/tools
"
);
var
onlyOne
cc
.
Class
({
extends
:
cc
.
Component
,
...
...
@@ -15,6 +14,7 @@ cc.Class({
data
:
null
,
onLoad
()
{
this
.
_playing
=
false
this
.
quan
.
active
=
false
this
.
tipsAnim
.
node
.
active
=
false
this
.
handAnim
.
node
.
active
=
false
...
...
@@ -29,14 +29,12 @@ cc.Class({
},
initWithData
(
data
,
scale
)
{
console
.
log
(
scale
)
this
.
data
=
data
let
rect
=
this
.
data
.
rect
this
.
node
.
x
=
(
rect
.
x
+
rect
.
width
/
2
)
/
scale
this
.
node
.
y
=
(
-
rect
.
y
-
rect
.
height
/
2
)
/
scale
this
.
node
.
width
=
rect
.
width
/
scale
this
.
node
.
height
=
rect
.
height
/
scale
console
.
log
(
this
.
node
)
this
.
sprite
.
node
.
active
=
false
if
(
data
.
useHand
)
{
this
.
handAnim
.
node
.
active
=
true
...
...
@@ -50,19 +48,10 @@ cc.Class({
},
onTouchStart
()
{
if
(
this
.
_playing
)
return
if
(
this
.
audioId
)
return
if
(
this
.
data
)
{
let
url
=
this
.
data
.
audio_url
if
(
url
&&
url
!=
''
)
{
this
.
playAudio
(
url
)
this
.
tipsAnim
.
node
.
active
=
true
this
.
tipsAnim
.
play
()
}
else
{
this
.
scheduleOnce
(()
=>
{
this
.
quan
.
active
=
false
},
0.2
)
}
if
(
this
.
data
.
pic_url
)
{
if
(
this
.
data
.
pic_url
&&
this
.
data
.
gIdx
==
0
)
{
tools
.
getSpriteFrimeByUrl
(
this
.
data
.
pic_url
,
(
sp
)
=>
{
this
.
sprite
.
spriteFrame
=
sp
this
.
sprite
.
node
.
width
=
this
.
node
.
width
...
...
@@ -75,33 +64,62 @@ cc.Class({
}
this
.
handAnim
.
stop
()
this
.
handAnim
.
node
.
active
=
false
cc
.
audioEngine
.
play
(
this
.
tipClip
)
if
(
!
this
.
_playing
)
{
this
.
_playing
=
true
cc
.
systemEvent
.
once
(
'
stopMusic
'
,
this
.
onStopAudio
,
this
)
let
id
=
cc
.
audioEngine
.
play
(
this
.
tipClip
)
cc
.
audioEngine
.
setFinishCallback
(
id
,
()
=>
{
if
(
onlyOne
!=
this
)
{
this
.
_playing
=
false
return
}
let
url
=
this
.
data
.
audio_url
if
(
url
&&
url
!=
''
)
{
this
.
playAudio
(
url
)
this
.
tipsAnim
.
node
.
active
=
true
this
.
tipsAnim
.
play
()
}
else
{
this
.
_playing
=
false
}
})
}
if
(
onlyOne
&&
onlyOne
!=
this
)
{
onlyOne
.
hideBox
()
}
onlyOne
=
this
}
},
/**隐藏边框 */
hideBox
()
{
this
.
quan
.
active
=
false
this
.
stopAudio
()
},
/** 播放音乐 */
playAudio
(
url
)
{
cc
.
assetManager
.
loadRemote
(
url
,
(
err
,
audioClip
)
=>
{
if
(
err
)
return
cc
.
systemEvent
.
once
(
'
stopMusic
'
,
this
.
stopAudio
,
this
)
if
(
!
this
.
_playing
)
return
this
.
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
audioId
,
this
.
stopAudio
.
bind
(
this
));
});
},
onStopAudio
()
{
this
.
_playing
=
false
this
.
stopAudio
()
},
stopAudio
()
{
this
.
_playing
=
false
if
(
this
.
audioId
!=
null
)
{
cc
.
audioEngine
.
stop
(
this
.
audioId
)
this
.
audioId
=
null
this
.
quan
.
active
=
false
this
.
tipsAnim
.
stop
()
this
.
tipsAnim
.
node
.
active
=
false
if
(
this
.
data
.
useHand
)
{
this
.
handAnim
.
node
.
active
=
true
this
.
handAnim
.
play
()
}
cc
.
systemEvent
.
off
(
'
stopMusic
'
,
this
.
stopAudio
,
this
)
}
this
.
tipsAnim
.
stop
()
this
.
tipsAnim
.
node
.
active
=
false
cc
.
systemEvent
.
off
(
'
stopMusic
'
,
this
.
onStopAudio
,
this
)
},
/** 音频id */
audioId
:
null
,
...
...
play/assets/scene/scene/picNode.js
View file @
bd0b2481
...
...
@@ -12,6 +12,8 @@ cc.Class({
this
.
_hitItem
=
[]
this
.
_items
=
this
.
node
.
getChildByName
(
'
items
'
)
this
.
_sprite
=
this
.
getComponentInChildren
(
cc
.
Sprite
)
this
.
borders
[
0
].
active
=
false
this
.
borders
[
1
].
active
=
false
},
initWithData
(
data
)
{
...
...
@@ -36,6 +38,8 @@ cc.Class({
this
.
node
.
width
=
originRect
.
width
this
.
node
.
height
=
originRect
.
height
}
this
.
borders
[
0
].
active
=
true
this
.
borders
[
1
].
active
=
true
this
.
borders
[
0
].
x
=
-
this
.
node
.
width
/
2
this
.
borders
[
1
].
x
=
this
.
node
.
width
/
2
this
.
_sprite
.
spriteFrame
=
sp
...
...
play/assets/scene/scene/scene.fire
View file @
bd0b2481
...
...
@@ -1440,8 +1440,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-16.572
,
3.038
,
42.455
,
-7.606
,
0,
0,
0,
...
...
@@ -1619,8 +1619,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
97.71
,
3.038
,
135.449
,
-6.961
,
0,
0,
0,
...
...
@@ -1852,9 +1852,6 @@
"btnClip": {
"__uuid__": "39ef1939-3bf9-4d21-a67a-bc1dede521a9"
},
"tipClip": {
"__uuid__": "e0bcf4cc-35a7-4d61-b202-8dd49299c2c0"
},
"_id": "a1ibU1vO9Nwbfwjsm/NgGR"
}
]
\ No newline at end of file
play/assets/scene/scene/scene.js
View file @
bd0b2481
...
...
@@ -100,7 +100,7 @@ cc.Class({
},
getDefaultData
()
{
const
dataJson
=
'
[{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/3
1bde9b15582618fa5db4ac7cbc275b4.gif","rect":{"x":84.63,"y":0,"width":1411.73,"height":594}},"hotZoneItemArr":[{"id":"1620785442406","index":0,"pic_url":"http://staging-teach.cdn.ireadabc.com/aa0d852ef05d9d8de158f10b4a727376.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/bd0502e664d0d279ccbec4e22b60f051.mp3","itemType":"pic","fontScale":1.23515625,"imgScale":0.48055555555555557,"mapScale":1.23515625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":1149.88,"y":4,"width":346,"height":346}}]},{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/e74a1c89473132b6ce53633fc53a6aee.jpg","rect":{"x":566.43,"y":0,"width":448.14,"height":594}},"hotZoneItemArr":[]},{
}]
'
const
dataJson
=
'
[{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/3
35dea1b83498b0c7c05be637dc13dad.jpeg","rect":{"x":246.27,"y":0,"width":114.46,"height":233},"useBorder":true},"hotZoneItemArr":[{"id":"1620754084744","index":0,"pic_url":"http://staging-teach.cdn.ireadabc.com/335dea1b83498b0c7c05be637dc13dad.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/8f73a6b73a217d25ca4f4a2e234c1513.mp3","itemType":"rect","fontScale":0.47421875,"imgScale":0.4640625,"mapScale":0.47421875,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":184.73,"y":92,"width":69.01,"height":69.01}},{"id":"1621558296515","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/c8a7dd49a778b0b6dd509aac0ef437ff.mp3","itemType":"rect","fontScale":0.47421875,"imgScale":1,"mapScale":0.47421875,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":-140.27,"y":99,"width":59,"height":59}}]},{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/31bde9b15582618fa5db4ac7cbc275b4.gif","rect":{"x":56.34,"y":0,"width":1005.32,"height":423}},"hotZoneItemArr":[{"id":"1621560079894","index":0,"pic_url":"http://staging-teach.cdn.ireadabc.com/335dea1b83498b0c7c05be637dc13dad.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/8f73a6b73a217d25ca4f4a2e234c1513.mp3","itemType":"pic","fontScale":0.8734375,"imgScale":0.19338422391857507,"mapScale":0.8734375,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":773.66,"y":47.15,"width":76,"height":154.71}},{"id":"1621560091737","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/8f73a6b73a217d25ca4f4a2e234c1513.mp3","itemType":"rect","fontScale":0.8734375,"imgScale":1,"mapScale":0.8734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":150.66,"y":26.5,"width":200,"height":200}}]
}]
'
const
data
=
JSON
.
parse
(
dataJson
);
return
data
;
},
...
...
@@ -225,7 +225,7 @@ cc.Class({
leftMove
()
{
this
.
stopAudio
()
this
.
_cantouch
=
false
;
let
width
=
cc
.
winSize
.
width
+
64
let
width
=
cc
.
winSize
.
width
+
64
this
.
picNode
.
x
=
0
this
.
picTempNode
.
x
=
width
this
.
setContent
(
this
.
picTempNode
,
this
.
data
[
this
.
curPage
])
...
...
@@ -248,7 +248,7 @@ cc.Class({
rightMove
()
{
this
.
stopAudio
()
this
.
_cantouch
=
false
;
let
width
=
cc
.
winSize
.
width
+
64
let
width
=
cc
.
winSize
.
width
+
64
this
.
picNode
.
x
=
0
this
.
picTempNode
.
x
=
-
width
this
.
setContent
(
this
.
picTempNode
,
this
.
data
[
this
.
curPage
])
...
...
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