Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_09
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
op_09
Commits
5a133171
Commit
5a133171
authored
Sep 17, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 选项的出现速度加快
parent
93afe146
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
op_09.js
play/assets/op_09/scene/op_09.js
+11
-17
No files found.
play/assets/op_09/scene/op_09.js
View file @
5a133171
...
@@ -169,16 +169,10 @@ cc.Class({
...
@@ -169,16 +169,10 @@ cc.Class({
arr
.
forEach
(
async
(
option
,
idx
)
=>
{
arr
.
forEach
(
async
(
option
,
idx
)
=>
{
const
optionNode
=
await
this
.
createOption
(
option
);
const
optionNode
=
await
this
.
createOption
(
option
);
optionNode
.
name
=
`option_
${
idx
}
`
;
optionNode
.
name
=
`option_
${
idx
}
`
;
optionNode
.
x
=
canvasWidth
+
idx
*
maxOptionWidth
;
optionNode
.
x
=
(
maxOptionWidth
)
*
(
idx
+
0.5
)
-
canvasWidth
/
2
-
box
.
x
;
optionNode
.
y
=
canvasHeight
/
2
-
box
.
y
-
300
;
optionNode
.
y
=
canvasHeight
/
2
-
box
.
y
-
300
;
optionNode
.
scale
=
Math
.
min
(
1
,
(
maxOptionWidth
-
10
)
/
optionNode
.
width
,
maxOptionHeight
/
optionNode
.
height
);
optionNode
.
scale
=
Math
.
min
(
1
,
(
maxOptionWidth
-
10
)
/
optionNode
.
width
,
maxOptionHeight
/
optionNode
.
height
);
optionNode
.
parent
=
box
;
optionNode
.
parent
=
box
;
const
targetX
=
(
maxOptionWidth
)
*
(
idx
+
0.5
)
-
canvasWidth
/
2
-
box
.
x
;
const
time
=
(
optionNode
.
x
-
targetX
)
/
1000
;
cc
.
tween
(
optionNode
)
.
to
(
time
,
{
x
:
targetX
},
cc
.
easing
.
quadIn
)
.
start
();
});
});
},
},
...
@@ -246,18 +240,17 @@ cc.Class({
...
@@ -246,18 +240,17 @@ cc.Class({
return
optionNode
;
return
optionNode
;
});
});
// optionData.audio_url
},
},
optionJump
(
node
)
{
optionJump
(
node
,
time
=
0.1
)
{
if
(
node
.
baseScale
)
{
if
(
node
.
baseScale
)
{
return
;
return
;
}
}
node
.
baseScale
=
node
.
scaleX
;
node
.
baseScale
=
node
.
scaleX
;
cc
.
tween
(
node
)
cc
.
tween
(
node
)
.
to
(
0.1
,
{
scaleX
:
node
.
baseScale
*
1.1
,
scaleY
:
node
.
baseScale
*
1.1
})
.
to
(
time
,
{
scaleX
:
node
.
baseScale
*
1.1
,
scaleY
:
node
.
baseScale
*
1.1
})
.
to
(
0.1
,
{
scaleX
:
node
.
baseScale
*
1
,
scaleY
:
node
.
baseScale
*
1
})
.
to
(
time
,
{
scaleX
:
node
.
baseScale
*
1
,
scaleY
:
node
.
baseScale
*
1
})
.
call
(()
=>
{
.
call
(()
=>
{
node
.
baseScale
=
null
;
node
.
baseScale
=
null
;
})
})
...
@@ -267,7 +260,7 @@ cc.Class({
...
@@ -267,7 +260,7 @@ cc.Class({
initListener
()
{
initListener
()
{
const
btnSubmit
=
cc
.
find
(
'
Canvas/bg/btnSubmit
'
);
const
btnSubmit
=
cc
.
find
(
'
Canvas/bg/btnSubmit
'
);
btnSubmit
.
on
(
'
click
'
,
()
=>
{
btnSubmit
.
on
(
'
click
'
,
()
=>
{
this
.
optionJump
(
btnSubmit
);
this
.
optionJump
(
btnSubmit
,
0.05
);
this
.
playEffect
(
'
submit
'
);
this
.
playEffect
(
'
submit
'
);
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
if
(
box
.
children
.
every
(
child
=>
child
.
optionData
.
selected
==
child
.
optionData
.
is_right
))
{
if
(
box
.
children
.
every
(
child
=>
child
.
optionData
.
selected
==
child
.
optionData
.
is_right
))
{
...
@@ -284,7 +277,7 @@ cc.Class({
...
@@ -284,7 +277,7 @@ cc.Class({
const
btnNext
=
cc
.
find
(
'
Canvas/bg/btnNext
'
);
const
btnNext
=
cc
.
find
(
'
Canvas/bg/btnNext
'
);
btnNext
.
on
(
'
click
'
,
()
=>
{
btnNext
.
on
(
'
click
'
,
()
=>
{
this
.
optionJump
(
btnNext
);
this
.
optionJump
(
btnNext
,
0.05
);
});
});
},
},
...
@@ -348,10 +341,6 @@ cc.Class({
...
@@ -348,10 +341,6 @@ cc.Class({
.
start
();
.
start
();
},
},
coolCatSpeakStart
(
cb
)
{
cb
();
},
submitBtnMoveOut
()
{
submitBtnMoveOut
()
{
const
submitBtn
=
cc
.
find
(
'
Canvas/bg/btnSubmit
'
);
const
submitBtn
=
cc
.
find
(
'
Canvas/bg/btnSubmit
'
);
cc
.
tween
(
submitBtn
)
cc
.
tween
(
submitBtn
)
...
@@ -364,6 +353,11 @@ cc.Class({
...
@@ -364,6 +353,11 @@ cc.Class({
btnNext
.
active
=
true
;
btnNext
.
active
=
true
;
},
},
coolCatSpeakStart
(
cb
)
{
cb
();
},
...
...
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