Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_YueDuJiaYouZhan
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
NJ_YueDuJiaYouZhan
Commits
03ad8bbf
Commit
03ad8bbf
authored
Jun 10, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 书本跳转到下一页
parent
34343ce8
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
3219 additions
and
376 deletions
+3219
-376
OPW_SB1_Disc1_Track01.mp3
assets/NJ_YueDuJiaYouZhan/audios/OPW_SB1_Disc1_Track01.mp3
+0
-0
OPW_SB1_Disc1_Track01.mp3.meta
.../NJ_YueDuJiaYouZhan/audios/OPW_SB1_Disc1_Track01.mp3.meta
+7
-0
NJ_YueDuJiaYouZhan.fire
assets/NJ_YueDuJiaYouZhan/scene/NJ_YueDuJiaYouZhan.fire
+2880
-225
NJ_YueDuJiaYouZhan.ts
assets/NJ_YueDuJiaYouZhan/scene/NJ_YueDuJiaYouZhan.ts
+122
-33
MyCocosSceneComponent.ts
assets/NJ_YueDuJiaYouZhan/script/MyCocosSceneComponent.ts
+2
-2
util.ts
assets/NJ_YueDuJiaYouZhan/script/util.ts
+172
-116
btn_return.png
assets/NJ_YueDuJiaYouZhan/textures/btn_return.png
+0
-0
btn_return.png.meta
assets/NJ_YueDuJiaYouZhan/textures/btn_return.png.meta
+36
-0
No files found.
assets/NJ_YueDuJiaYouZhan/audios/OPW_SB1_Disc1_Track01.mp3
0 → 100644
View file @
03ad8bbf
File added
assets/NJ_YueDuJiaYouZhan/audios/OPW_SB1_Disc1_Track01.mp3.meta
0 → 100644
View file @
03ad8bbf
{
"ver": "2.0.1",
"uuid": "90f94989-cb3e-49e2-9452-757d066f2144",
"downloadMode": 0,
"duration": 19.435102,
"subMetas": {}
}
\ No newline at end of file
assets/NJ_YueDuJiaYouZhan/scene/NJ_YueDuJiaYouZhan.fire
View file @
03ad8bbf
This diff is collapsed.
Click to expand it.
assets/NJ_YueDuJiaYouZhan/scene/NJ_YueDuJiaYouZhan.ts
View file @
03ad8bbf
import
{
asyncDelay
,
onHomeworkFinish
}
from
"
../script/util
"
;
import
{
asyncDelay
,
onHomeworkFinish
,
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
buttonOnClick
,
jumpToCourseWare
}
from
"
../script/util
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -6,48 +6,135 @@ const { ccclass, property } = cc._decorator;
@
ccclass
export
default
class
SceneComponent
extends
MyCocosSceneComponent
{
@
property
(
cc
.
AudioClip
)
bgMusic1
:
cc
.
AudioClip
=
null
;
async
getKidInfo
()
{
const
kidDataStr
=
await
asyncCallNetworkApiGet
(
'
/api/oxford/v1/kid/info
'
,
{
token
:
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
)
});
if
(
kidDataStr
)
{
return
JSON
.
parse
(
kidDataStr
).
data
;
}
return
null
;
}
addPreloadImage
()
{
// TODO 根据自己的配置预加载图片资源
}
addPreloadAudio
()
{
// TODO 根据自己的配置预加载音频资源
}
addPreloadAnima
()
{
}
onLoadEnd
()
{
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this
.
initData
();
this
.
initView
();
_cantouch
=
null
;
async
onLoadEnd
()
{
this
.
_cantouch
=
true
;
this
.
initListener
();
// 浏览记录
this
.
currentIndex
=
this
.
getStoreCurrentIndex
();
const
node
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
+
1
}
`
);
node
.
x
=
0
;
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
!
middleLayer
)
{
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
'
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicGhvbmUiOiIxNTUwMDAwMDAwMSIsInNpZ24iOiI0OTliYjg5Yy1lYjI5LTQ2M2EtYjk5ZS0zNDg2NDUwMGEyOTkiLCJpYXQiOjE2NTQ2NzY4MzMsImV4cCI6MTY1NzI2ODgzM30.MacCd_XUhvpNrMukYu8YNRVSbc-hju_WBN_FeiRACuc
'
);
}
const
kidDataStr
=
await
asyncCallNetworkApiGet
(
'
/api/oxford/v1/kid/info
'
,
{
token
:
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
)
});
const
kidData
=
JSON
.
parse
(
kidDataStr
);
if
(
!
kidData
.
data
||
!
kidData
.
data
.
id
)
{
middleLayer
.
getComponent
(
'
middleLayer
'
).
showTips
(
"
用户登录失效,请重新登录
"
);
middleLayer
.
getComponent
(
'
middleLayer
'
).
loadOnlineBundle
(
"
NJ_login
"
);
return
;
}
_cantouch
=
null
;
initData
()
{
// 所有全局变量 默认都是null
this
.
_cantouch
=
true
;
const
btnReturn
=
cc
.
find
(
'
Canvas/bg/btn_return
'
);
buttonOnClick
(
btnReturn
,
()
=>
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
middleLayer
.
getComponent
(
'
middleLayer
'
).
loadOnlineBundle
(
'
NJ_YouLeChang
'
);
}
});
const
pid
=
middleLayer
.
getComponent
(
'
middleLayer
'
).
getData
(
'
NJ_YueDuJiaYouZhan
'
);
const
classDataStr
=
await
asyncCallNetworkApiGet
(
'
/api/syllabus/v1/tree
'
,
{
pid
:
pid
,
deep
:
2
});
const
ballData
=
JSON
.
parse
(
classDataStr
);
initView
()
{
this
.
initBg
();
this
.
initBtn
();
ballData
.
forEach
((
data
,
idx
)
=>
{
if
(
idx
>=
5
)
{
console
.
warn
(
'
idx >= 5
'
);
return
;
}
const
level
=
cc
.
find
(
`Canvas/bg/L
${
idx
+
1
}
`
);
data
.
children
.
forEach
((
book
,
i
)
=>
{
if
(
i
>=
3
)
{
console
.
warn
(
'
book >= 3
'
);
return
;
}
const
bookNode
=
cc
.
find
(
`book
${
i
+
1
}
`
,
level
);
bookNode
.
attr
({
syllabus_id
:
book
.
id
,
pid
:
book
.
pid
});
initBg
()
{
buttonOnClick
(
bookNode
,
async
()
=>
{
const
kidInfo
=
await
this
.
getKidInfo
();
const
activeLevels
=
kidInfo
?
kidInfo
.
active_levels
:
[];
const
activeItem
=
activeLevels
.
find
(
item
=>
item
.
syllabus_id
==
data
.
id
);
if
(
middleLayer
&&
!
activeItem
)
{
// 弹出激活码
middleLayer
.
getComponent
(
'
middleLayer
'
).
showActiveWindow
();
return
;
}
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
const
row
=
book
.
children
.
find
(
row
=>
row
.
name
==
'
索引页
'
);
if
(
!
row
)
{
middleLayerComponent
.
showTips
(
"
未配置‘索引页’
"
);
return
;
}
middleLayerComponent
.
setData
(
'
NJ_BookTable
'
,
{
folderId
:
book
.
id
,
courseId
:
row
.
id
,
});
jumpToCourseWare
(
row
.
id
);
}
});
});
});
// 播放背景音乐
cc
.
audioEngine
.
stopMusic
();
cc
.
audioEngine
.
playMusic
(
this
.
bgMusic1
,
true
);
}
initBtn
()
{
storeCurrentIndex
()
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
!
middleLayer
)
{
return
;
}
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
setData
(
'
NJ_YueDuJiaYouZhan_select_idx
'
,
this
.
currentIndex
);
}
getStoreCurrentIndex
()
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
!
middleLayer
)
{
return
0
;
}
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
const
index
=
middleLayerComponent
.
getData
(
'
NJ_YueDuJiaYouZhan_select_idx
'
);
return
index
||
0
;
}
currentIndex
=
0
;
leftMove
()
{
const
node
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
+
1
}
`
);
const
nextNode
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
+
2
}
`
);
const
node
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
+
1
}
`
);
const
nextNode
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
+
2
}
`
);
this
.
_cantouch
=
false
;
cc
.
tween
(
node
)
.
to
(.
3
,
{
x
:
-
4000
},
{
easing
:
'
cubicInOut
'
})
...
...
@@ -55,9 +142,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
nextNode
)
.
to
(.
3
,
{
x
:
0
},
{
easing
:
'
cubicInOut
'
})
.
call
(()
=>
{
this
.
currentIndex
++
;
cc
.
find
(
`Canvas/bg/right`
).
active
=
this
.
currentIndex
<
4
;
cc
.
find
(
`Canvas/bg/left`
).
active
=
this
.
currentIndex
>
0
;
this
.
currentIndex
++
;
this
.
storeCurrentIndex
();
cc
.
find
(
`Canvas/bg/right`
).
active
=
this
.
currentIndex
<
4
;
cc
.
find
(
`Canvas/bg/left`
).
active
=
this
.
currentIndex
>
0
;
this
.
_cantouch
=
true
;
})
.
start
();
...
...
@@ -66,7 +154,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
rightMove
()
{
const
node
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
+
1
}
`
);
const
node
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
+
1
}
`
);
const
beforeNode
=
cc
.
find
(
`Canvas/bg/L
${
this
.
currentIndex
}
`
);
this
.
_cantouch
=
false
;
cc
.
tween
(
node
)
...
...
@@ -75,9 +163,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
beforeNode
)
.
to
(.
3
,
{
x
:
0
},
{
easing
:
'
cubicInOut
'
})
.
call
(()
=>
{
this
.
currentIndex
--
;
cc
.
find
(
`Canvas/bg/right`
).
active
=
this
.
currentIndex
<
4
;
cc
.
find
(
`Canvas/bg/left`
).
active
=
this
.
currentIndex
>
0
;
this
.
currentIndex
--
;
this
.
storeCurrentIndex
();
cc
.
find
(
`Canvas/bg/right`
).
active
=
this
.
currentIndex
<
4
;
cc
.
find
(
`Canvas/bg/left`
).
active
=
this
.
currentIndex
>
0
;
this
.
_cantouch
=
true
;
})
.
start
();
...
...
@@ -101,7 +190,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
worldPoint
=
event
.
getLocation
();
const
x
=
worldPoint
.
x
;
if
(
x
>
this
.
touchX
+
100
)
{
if
(
this
.
currentIndex
<=
0
)
{
if
(
this
.
currentIndex
<=
0
)
{
// 已经是第一个了
return
;
}
...
...
@@ -110,7 +199,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
if
(
x
<
this
.
touchX
-
100
)
{
if
(
this
.
currentIndex
>=
4
)
{
if
(
this
.
currentIndex
>=
4
)
{
// 已经是最后一个了
return
;
}
...
...
assets/NJ_YueDuJiaYouZhan/script/MyCocosSceneComponent.ts
View file @
03ad8bbf
...
...
@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component {
preload
()
{
const
preloadArr
=
this
.
_imageResList
.
concat
(
this
.
_audioResList
).
concat
(
this
.
_animaResList
);
cc
.
assetManager
.
loadAny
(
preloadArr
,
null
,
null
,
(
err
,
data
)
=>
{
cc
.
assetManager
.
loadAny
(
preloadArr
,
null
,
null
,
async
(
err
,
data
)
=>
{
if
(
window
&&
window
[
"
air
"
])
{
// window["air"].onCourseInScreen = (next) => {
...
...
@@ -95,7 +95,7 @@ export class MyCocosSceneComponent extends cc.Component {
// this.onLoadEnd();
// next();
// };
this
.
onLoadEnd
();
await
this
.
onLoadEnd
();
window
[
"
air
"
].
hideAirClassLoading
();
}
else
{
this
.
onLoadEnd
();
...
...
assets/NJ_YueDuJiaYouZhan/script/util.ts
View file @
03ad8bbf
...
...
@@ -94,13 +94,13 @@ export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) {
}
}
export
function
getDistance
(
start
,
end
)
{
export
function
getDistance
(
start
,
end
)
{
var
pos
=
cc
.
v2
(
start
.
x
-
end
.
x
,
start
.
y
-
end
.
y
);
var
dis
=
Math
.
sqrt
(
pos
.
x
*
pos
.
x
+
pos
.
y
*
pos
.
y
);
var
dis
=
Math
.
sqrt
(
pos
.
x
*
pos
.
x
+
pos
.
y
*
pos
.
y
);
return
dis
;
}
export
function
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
export
function
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
if
(
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
audio_url
,
(
err
,
audioClip
)
=>
{
const
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
...
...
@@ -114,21 +114,21 @@ export function playAudioByUrl(audio_url, cb=null) {
}
export
function
btnClickAnima
(
btn
,
time
=
0.15
,
rate
=
1.05
)
{
export
function
btnClickAnima
(
btn
,
time
=
0.15
,
rate
=
1.05
)
{
btn
.
tmpScale
=
btn
.
scale
;
btn
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
()
=>
{
cc
.
tween
(
btn
)
.
to
(
time
/
2
,
{
scale
:
btn
.
scale
*
rate
})
.
to
(
time
/
2
,
{
scale
:
btn
.
scale
*
rate
})
.
start
()
})
btn
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
()
=>
{
cc
.
tween
(
btn
)
.
to
(
time
/
2
,
{
scale
:
btn
.
tmpScale
})
.
to
(
time
/
2
,
{
scale
:
btn
.
tmpScale
})
.
start
()
})
btn
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
cc
.
tween
(
btn
)
.
to
(
time
/
2
,
{
scale
:
btn
.
tmpScale
})
.
to
(
time
/
2
,
{
scale
:
btn
.
tmpScale
})
.
start
()
})
}
...
...
@@ -179,7 +179,7 @@ export async function asyncDelay(time) {
try
{
cc
.
tween
(
cc
.
find
(
'
Canvas
'
))
.
delay
(
time
)
.
call
(()
=>
{
.
call
(()
=>
{
resolve
(
null
);
})
.
start
();
...
...
@@ -236,7 +236,7 @@ export async function asyncLoadDragonBoneAnime(node, { skeJsonData: { url: skeJs
});
Promise
.
all
([
loadTexture
,
loadTexJsonData
,
loadSkeJsonData
]).
then
(([
texture
,
atlasJson
,
dragonBonesJson
])
=>
{
const
atlas
=
new
dragonBones
.
DragonBonesAtlasAsset
();
const
atlas
:
any
=
new
dragonBones
.
DragonBonesAtlasAsset
();
atlas
.
atlasJson
=
JSON
.
stringify
(
atlasJson
);
atlas
.
texture
=
texture
;
...
...
@@ -246,7 +246,7 @@ export async function asyncLoadDragonBoneAnime(node, { skeJsonData: { url: skeJs
dragonDisplay
.
dragonAtlasAsset
=
atlas
;
dragonDisplay
.
dragonAsset
=
asset
;
let
armatureNames
=
dragonBonesJson
.
armature
.
map
(
data
=>
data
.
name
);
let
armatureNames
=
(
<
any
>
dragonBonesJson
)
.
armature
.
map
(
data
=>
data
.
name
);
if
(
armatureNames
.
length
>
0
)
{
dragonDisplay
.
armatureName
=
armatureNames
[
0
];
...
...
@@ -411,56 +411,112 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks
(
right
);
}
export
function
httpHeadCall
(
requsetUrl
:
string
,
callback
)
{
let
xhr
=
new
XMLHttpRequest
();
console
.
log
(
"
Status: Send Post Request to
"
+
requsetUrl
);
try
{
export
function
onHomeworkFinish
()
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
if
(
middleLayerComponent
.
role
==
'
student
'
)
{
middleLayerComponent
.
onHomeworkFinish
(()
=>
{
});
}
}
else
{
console
.
log
(
'
onHomeworkFinish
'
);
}
}
export
function
asyncCallNetworkApiGet
(
apiName
,
data
):
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
callNetworkApiGet
(
apiName
,
data
,
(
res
=>
{
resolve
(
res
);
}));
});
}
export
function
asyncCallNetworkApiPost
(
uri
,
data
):
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
callNetworkApiPost
(
uri
,
data
,
(
res
)
=>
{
resolve
(
res
);
});
});
}
export
function
callNetworkApiPost
(
uri
,
data
,
callBack
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
)?.
getComponent
(
'
middleLayer
'
);
if
(
middleLayer
)
{
middleLayer
.
callNetworkApiPost
(
uri
,
data
,
callBack
);
return
;
}
const
baseUrl
=
'
http://staging-openapi.iteachabc.com
'
;
const
xhr
=
new
XMLHttpRequest
();
const
url
=
`
${
baseUrl
}${
uri
}
`
;
xhr
.
open
(
"
POST
"
,
url
,
true
);
xhr
.
setRequestHeader
(
'
content-type
'
,
'
application/json
'
);
xhr
.
onreadystatechange
=
()
=>
{
try
{
console
.
log
(
'
xhr.readyState:
'
,
xhr
.
readyState
);
if
(
xhr
.
readyState
==
4
)
{
if
((
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
callback
(
true
);
}
else
{
callback
(
false
);
callBack
(
JSON
.
parse
(
xhr
.
responseText
));
}
}
xhr
.
send
(
JSON
.
stringify
(
data
));
}
}
catch
(
e
)
{
console
.
log
(
e
)
export
function
callNetworkApiGet
(
uri
,
data
,
callBack
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
)?.
getComponent
(
'
middleLayer
'
);
if
(
middleLayer
)
{
middleLayer
.
callNetworkApiGet
(
uri
,
data
,
callBack
);
return
;
}
const
baseUrl
=
'
http://staging-openapi.iteachabc.com
'
;
let
queryStr
=
'
?
'
;
const
params
=
[];
for
(
const
key
in
data
)
{
if
(
Object
.
hasOwnProperty
.
call
(
data
,
key
))
{
params
.
push
(
`
${
key
}
=
${
data
[
key
]}
`
);
}
}
queryStr
+=
params
.
join
(
"
&
"
);
const
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
&&
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
callBack
(
xhr
.
responseText
);
}
};
xhr
.
open
(
"
HEAD
"
,
requsetUrl
,
true
);
const
url
=
`
${
baseUrl
}${
uri
}${
queryStr
}
`
;
console
.
log
(
'
url =
'
+
url
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
send
();
xhr
.
timeout
=
15000
;
xhr
.
onerror
=
(
e
)
=>
{
callback
(
false
);
};
xhr
.
ontimeout
=
(
e
)
=>
{
callback
(
false
);
};
}
catch
(
e
)
{
console
.
log
(
"
Send Get Request error:
"
,
e
);
}
}
export
function
onHomeworkFinish
(
data
=
""
,
callback
=
()
=>
{}
)
{
export
function
jumpToBundle
(
bundleName
:
string
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
onHomeworkFinish
(
callback
,
data
);
middleLayerComponent
.
loadOnlineBundle
(
bundleName
);
}
else
{
console
.
log
(
'
onHomeworkFinish
'
,
JSON
.
stringify
(
data
)
);
console
.
log
(
'
jump to bundle:
'
+
bundleName
);
}
}
export
function
callMiddleLayerFunction
(
apiName
:
string
,
data
:
any
,
callback
:
Function
)
{
export
function
jumpToCourseWare
(
courseWareId
:
number
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
callMiddleLayerFunction
(
apiName
,
data
,
callback
);
middleLayerComponent
.
loadOnlineCourseWare
(
courseWareId
);
}
else
{
console
.
log
(
'
callMiddleLayerFunction:
'
+
apiName
);
console
.
log
(
'
jump to CourseWare:
'
+
courseWareId
);
}
}
export
function
buttonOnClick
(
button
:
cc
.
Node
,
callback
:
Function
,
scale
=
1.0
)
{
button
.
on
(
'
click
'
,
()
=>
{
if
(
button
[
'
cantClick
'
])
{
return
;
}
button
[
'
cantClick
'
]
=
true
;
cc
.
tween
(
button
)
.
to
(
0.1
,
{
scale
:
scale
*
1.1
})
.
to
(
0.1
,
{
scale
:
scale
})
.
call
(()
=>
{
button
[
'
cantClick
'
]
=
false
;
callback
&&
callback
();
})
.
start
();
});
}
assets/NJ_YueDuJiaYouZhan/textures/btn_return.png
0 → 100644
View file @
03ad8bbf
10.6 KB
assets/NJ_YueDuJiaYouZhan/textures/btn_return.png.meta
0 → 100644
View file @
03ad8bbf
{
"ver": "2.3.5",
"uuid": "71877d61-effa-4495-acaa-306fe0f14a4a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 107,
"height": 112,
"platformSettings": {},
"subMetas": {
"btn_return": {
"ver": "1.0.4",
"uuid": "55438c5a-174d-4da0-96b2-e11ea29bd18f",
"rawTextureUuid": "71877d61-effa-4495-acaa-306fe0f14a4a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 107,
"height": 112,
"rawWidth": 107,
"rawHeight": 112,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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