Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PS06
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
PS06
Commits
37bc2229
Commit
37bc2229
authored
Dec 22, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: homework
parent
73309607
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
21 deletions
+19
-21
util.js
assets/PS06/script/util.js
+19
-21
No files found.
assets/PS06/script/util.js
View file @
37bc2229
...
...
@@ -72,7 +72,7 @@ export function setSprNodeMaxLen(sprNode, maxW, maxH) {
export
function
getSpriteFrimeByUrl
(
url
,
cb
)
{
cc
.
loader
.
load
({
url
},
(
err
,
img
)
=>
{
cc
.
loader
.
load
({
url
},
(
err
,
img
)
=>
{
const
spriteFrame
=
new
cc
.
SpriteFrame
(
img
)
if
(
cb
)
{
cb
(
spriteFrame
);
...
...
@@ -100,8 +100,8 @@ export function getSprNodeByUrl(url, cb) {
export
function
playAudio
(
audioClip
,
cb
=
null
)
{
if
(
audioClip
)
{
export
function
playAudio
(
audioClip
,
cb
=
null
)
{
if
(
audioClip
)
{
const
audioId
=
cc
.
audioEngine
.
playEffect
(
audioClip
,
false
,
0.8
);
if
(
cb
)
{
cc
.
audioEngine
.
setFinishCallback
(
audioId
,
()
=>
{
...
...
@@ -110,16 +110,16 @@ export function playAudio(audioClip, cb=null) {
}
return
audioId
;
}
}
}
export
function
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
if
(
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
audio_url
,
(
err
,
audioClip
)
=>
{
export
function
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
if
(
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
audio_url
,
(
err
,
audioClip
)
=>
{
playAudio
(
audioClip
,
cb
);
});
}
});
}
}
...
...
@@ -295,7 +295,7 @@ export function showTrebleFirework(baseNode, rabbonList) {
export
function
delayCall
(
time
,
cb
)
{
return
cc
.
tween
({})
.
delay
(
time
)
.
delay
(
time
)
.
call
(()
=>
{
if
(
cb
)
{
cb
();
...
...
@@ -314,12 +314,12 @@ export function removeFromArr(arr, item) {
}
export
function
showBtnAnima
(
btn
,
cb
=
null
)
{
export
function
showBtnAnima
(
btn
,
cb
=
null
)
{
const
baseS
=
btn
.
scale
;
cc
.
tween
(
btn
)
.
to
(
0.05
,
{
scale
:
0.9
*
baseS
})
.
to
(
0.05
,
{
scale
:
1
*
baseS
})
.
to
(
0.05
,
{
scale
:
0.9
*
baseS
})
.
to
(
0.05
,
{
scale
:
1
*
baseS
})
.
call
(()
=>
{
if
(
cb
)
{
cb
();
...
...
@@ -332,11 +332,11 @@ export function jellyShake(node) {
const
baseS
=
node
.
scale
;
const
time
=
1
;
cc
.
tween
(
node
)
.
to
(
time
/
5
/
2
,
{
scaleX
:
baseS
*
0.8
,
scaleY
:
baseS
*
1.2
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
1.1
,
scaleY
:
baseS
*
0.9
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
0.95
,
scaleY
:
baseS
*
1.15
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
1.02
,
scaleY
:
baseS
*
0.98
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
1
,
scaleY
:
baseS
*
1
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
/
2
,
{
scaleX
:
baseS
*
0.8
,
scaleY
:
baseS
*
1.2
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
1.1
,
scaleY
:
baseS
*
0.9
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
0.95
,
scaleY
:
baseS
*
1.15
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
1.02
,
scaleY
:
baseS
*
0.98
},
{
easing
:
"
sineInOut
"
})
.
to
(
time
/
5
,
{
scaleX
:
baseS
*
1
,
scaleY
:
baseS
*
1
},
{
easing
:
"
sineInOut
"
})
.
start
();
}
...
...
@@ -345,9 +345,7 @@ export function onHomeworkFinish() {
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
if
(
middleLayerComponent
.
role
==
'
student
'
)
{
middleLayerComponent
.
onHomeworkFinish
(()
=>
{
});
}
middleLayerComponent
.
onHomeworkFinish
(()
=>
{
});
return
;
}
}
\ No newline at end of file
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