Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ET04
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
ET04
Commits
9bfc7f14
Commit
9bfc7f14
authored
Feb 27, 2021
by
wangxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beta 1.0
parent
848e7a8e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
16 deletions
+34
-16
Scene.js
play/assets/tmpGame/script/Scene.js
+1
-1
op_pic.js
play/assets/tmpGame/script/op_pic.js
+26
-5
op_sound.js
play/assets/tmpGame/script/op_sound.js
+7
-10
No files found.
play/assets/tmpGame/script/Scene.js
View file @
9bfc7f14
...
@@ -129,7 +129,7 @@ cc.Class({
...
@@ -129,7 +129,7 @@ cc.Class({
getDefaultData
()
{
getDefaultData
()
{
const
dataJson
=
const
dataJson
=
'
{"title":"hello","audio_title":"http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3","options":[{"pic_url":"http://staging-teach.cdn.ireadabc.com/
ae96e15404c873878ed4f4ce03f9f495.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/0f0482ddb8c0d3329165ab0612683148.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/d16a95047e369fbc7f94428624859d03
.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/5433aa00faced2d5e02f9cecce63ba09.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/0f0482ddb8c0d3329165ab0612683148.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/9298013cc63aa40035dbd18f1f8380a8.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3"}]}
'
;
'
{"title":"hello","audio_title":"http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3","options":[{"pic_url":"http://staging-teach.cdn.ireadabc.com/
004be996ea209e366951a7c4b6a3e55f.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/0f0482ddb8c0d3329165ab0612683148.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/785b0bc1766658373e4ebdcbd694a088
.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/5433aa00faced2d5e02f9cecce63ba09.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/0f0482ddb8c0d3329165ab0612683148.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/9298013cc63aa40035dbd18f1f8380a8.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3"}]}
'
;
const
data
=
JSON
.
parse
(
dataJson
);
const
data
=
JSON
.
parse
(
dataJson
);
return
data
;
return
data
;
},
},
...
...
play/assets/tmpGame/script/op_pic.js
View file @
9bfc7f14
...
@@ -31,6 +31,8 @@ cc.Class({
...
@@ -31,6 +31,8 @@ cc.Class({
_soundOp
:
null
,
// 碰到的选框
_soundOp
:
null
,
// 碰到的选框
_picUrl
:
null
,
// 图片地址
_picUrl
:
null
,
// 图片地址
_spriteFrame
:
null
,
_spriteFrame
:
null
,
_width
:
null
,
_height
:
null
,
},
},
onEnable
()
{
onEnable
()
{
...
@@ -54,9 +56,28 @@ cc.Class({
...
@@ -54,9 +56,28 @@ cc.Class({
setPic
()
{
setPic
()
{
cc
.
loader
.
load
({
url
:
this
.
_picUrl
},
(
err
,
img
)
=>
{
cc
.
loader
.
load
({
url
:
this
.
_picUrl
},
(
err
,
img
)
=>
{
const
spriteFrame
=
new
cc
.
SpriteFrame
(
img
);
let
frame
=
new
cc
.
SpriteFrame
(
img
);
this
.
pic
.
spriteFrame
=
spriteFrame
;
let
frameSize
=
frame
.
getOriginalSize
();
this
.
_spriteFrame
=
spriteFrame
;
this
.
_spriteFrame
=
frame
;
let
scale
=
1
;
if
(
frameSize
.
height
>
168
)
{
scale
=
168
/
frameSize
.
height
;
}
this
.
pic
.
spriteFrame
=
frame
;
this
.
pic
.
node
.
width
=
frameSize
.
width
*
scale
;
this
.
pic
.
node
.
height
=
frameSize
.
height
*
scale
;
scale
=
1
;
if
(
frameSize
.
width
>
168
)
{
scale
=
168
/
frameSize
.
width
;
}
this
.
pic
.
node
.
width
=
frameSize
.
width
*
scale
;
this
.
pic
.
node
.
height
=
frameSize
.
height
*
scale
;
this
.
_width
=
this
.
pic
.
node
.
width
;
this
.
_height
=
this
.
pic
.
node
.
height
;
});
});
},
},
...
@@ -80,13 +101,13 @@ cc.Class({
...
@@ -80,13 +101,13 @@ cc.Class({
console
.
log
(
"
enter right
"
);
console
.
log
(
"
enter right
"
);
this
.
playSound
(
0
);
this
.
playSound
(
0
);
this
.
_soundOp
.
node
.
getComponent
(
"
op_sound
"
).
correct
(
this
.
_spriteFrame
);
this
.
_soundOp
.
node
.
getComponent
(
"
op_sound
"
).
correct
(
this
.
_spriteFrame
,
this
.
_width
,
this
.
_height
);
this
.
node
.
destroy
();
this
.
node
.
destroy
();
}
else
{
}
else
{
console
.
log
(
"
enter false
"
);
console
.
log
(
"
enter false
"
);
this
.
playSound
(
1
);
this
.
playSound
(
1
);
this
.
node
.
active
=
false
;
this
.
node
.
active
=
false
;
this
.
_soundOp
.
node
.
getComponent
(
"
op_sound
"
).
wrong
(
this
.
_spriteFrame
);
this
.
_soundOp
.
node
.
getComponent
(
"
op_sound
"
).
wrong
(
this
.
_spriteFrame
,
this
.
_width
,
this
.
_height
);
}
}
}
else
{
}
else
{
this
.
node
.
setPosition
(
this
.
_ori_pos
);
this
.
node
.
setPosition
(
this
.
_ori_pos
);
...
...
play/assets/tmpGame/script/op_sound.js
View file @
9bfc7f14
...
@@ -69,12 +69,10 @@ cc.Class({
...
@@ -69,12 +69,10 @@ cc.Class({
console
.
log
(
"
on collision exit
"
);
console
.
log
(
"
on collision exit
"
);
},
},
correct
(
spriteFrame
)
{
correct
(
spriteFrame
,
width
,
height
)
{
this
.
rightFrame
.
active
=
true
;
this
.
rightFrame
.
active
=
true
;
// cc.loader.load({ url }, (err, img) => {
this
.
rightPic
.
node
.
width
=
width
;
// const spriteFrame = new cc.SpriteFrame(img);
this
.
rightPic
.
node
.
height
=
height
;
// this.rightPic.spriteFrame = spriteFrame;
// });
this
.
rightPic
.
spriteFrame
=
spriteFrame
;
this
.
rightPic
.
spriteFrame
=
spriteFrame
;
var
par
=
cc
.
instantiate
(
this
.
particle_star
);
var
par
=
cc
.
instantiate
(
this
.
particle_star
);
...
@@ -85,13 +83,12 @@ cc.Class({
...
@@ -85,13 +83,12 @@ cc.Class({
cc
.
game
.
emit
(
"
RIGHT
"
);
cc
.
game
.
emit
(
"
RIGHT
"
);
},
},
wrong
(
spriteFrame
)
{
wrong
(
spriteFrame
,
width
,
height
)
{
this
.
rightFrame
.
active
=
true
;
this
.
rightFrame
.
active
=
true
;
// cc.loader.load({ url }, (err, img) => {
this
.
rightPic
.
node
.
width
=
width
;
// const spriteFrame = new cc.SpriteFrame(img);
this
.
rightPic
.
node
.
height
=
height
;
// this.rightPic.spriteFrame = spriteFrame;
// });
this
.
rightPic
.
spriteFrame
=
spriteFrame
;
this
.
rightPic
.
spriteFrame
=
spriteFrame
;
let
time
=
0.1
;
let
time
=
0.1
;
let
action
=
cc
.
repeat
(
let
action
=
cc
.
repeat
(
cc
.
sequence
(
cc
.
moveBy
(
time
,
-
10
,
0
),
cc
.
moveBy
(
time
,
10
,
0
),
cc
.
moveBy
(
time
,
10
,
0
),
cc
.
moveBy
(
time
,
-
10
,
0
)),
cc
.
sequence
(
cc
.
moveBy
(
time
,
-
10
,
0
),
cc
.
moveBy
(
time
,
10
,
0
),
cc
.
moveBy
(
time
,
10
,
0
),
cc
.
moveBy
(
time
,
-
10
,
0
)),
...
...
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