Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_01
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_01
Commits
dae24752
Commit
dae24752
authored
Jan 09, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加结束按钮
parent
74b27ba6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
427 additions
and
16 deletions
+427
-16
op_01.fire
assets/op_01/scene/op_01.fire
+207
-9
op_01.js
assets/op_01/scene/op_01.js
+5
-0
defaultData.js
assets/op_01/script/defaultData.js
+28
-1
util.js
assets/op_01/script/util.js
+4
-6
btn_submit.png
assets/op_01/textures/btn_submit.png
+0
-0
btn_submit.png.meta
assets/op_01/textures/btn_submit.png.meta
+36
-0
main.js
packages/check-file-name/main.js
+28
-0
package-lock.json
packages/check-file-name/package-lock.json
+30
-0
package.json
packages/check-file-name/package.json
+15
-0
file.js
packages/check-file-name/util/file.js
+74
-0
No files found.
assets/op_01/scene/op_01.fire
View file @
dae24752
...
@@ -17,10 +17,10 @@
...
@@ -17,10 +17,10 @@
"__id__": 2
"__id__": 2
},
},
{
{
"__id__": 2
1
"__id__": 2
5
},
},
{
{
"__id__": 2
2
"__id__": 2
6
}
}
],
],
"_active": false,
"_active": false,
...
@@ -85,18 +85,21 @@
...
@@ -85,18 +85,21 @@
},
},
{
{
"__id__": 11
"__id__": 11
},
{
"__id__": 18
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__":
18
"__id__":
22
},
},
{
{
"__id__":
19
"__id__":
23
},
},
{
{
"__id__": 2
0
"__id__": 2
4
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -820,6 +823,201 @@
...
@@ -820,6 +823,201 @@
"_originalHeight": 0,
"_originalHeight": 0,
"_id": "dfPm4AKlJGOpFnlHIOjQvT"
"_id": "dfPm4AKlJGOpFnlHIOjQvT"
},
},
{
"__type__": "cc.Node",
"_name": "btn_submit",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 19
},
{
"__id__": 20
},
{
"__id__": 21
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 122,
"height": 116
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
283,
-342,
0,
0,
0,
0,
1,
1,
1,
0
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "6cR1ME+95BB7u3lTTJ0Za3"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "ef5037e5-6d66-4b53-9704-d380daccdfbf"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "70MxWuknNB57+X2o9j1bo+"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 36,
"_left": 0,
"_right": 200,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "eaXqMjk4VJY4+53WJtBZsk"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "7fzZ57L0lLjL0Le0SzT1qN"
},
{
{
"__type__": "cc.Canvas",
"__type__": "cc.Canvas",
"_name": "",
"_name": "",
...
@@ -943,10 +1141,10 @@
...
@@ -943,10 +1141,10 @@
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 2
3
"__id__": 2
7
},
},
{
{
"__id__": 2
4
"__id__": 2
8
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -1002,7 +1200,7 @@
...
@@ -1002,7 +1200,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 2
2
"__id__": 2
6
},
},
"_enabled": true,
"_enabled": true,
"_materials": [
"_materials": [
...
@@ -1034,7 +1232,7 @@
...
@@ -1034,7 +1232,7 @@
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
"__id__": 2
2
"__id__": 2
6
},
},
"_enabled": true,
"_enabled": true,
"_normalMaterial": null,
"_normalMaterial": null,
...
...
assets/op_01/scene/op_01.js
View file @
dae24752
...
@@ -159,6 +159,7 @@ cc.Class({
...
@@ -159,6 +159,7 @@ cc.Class({
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
bg
=
cc
.
find
(
'
Canvas/ImgBg
'
);
const
bg
=
cc
.
find
(
'
Canvas/ImgBg
'
);
const
submitButton
=
cc
.
find
(
"
Canvas/btn_submit
"
);
await
this
.
asyncLoadSpriteByUrl
(
bg
,
this
.
data
.
bgItem
.
url
);
await
this
.
asyncLoadSpriteByUrl
(
bg
,
this
.
data
.
bgItem
.
url
);
bg
.
scale
=
Math
.
max
(
canvas
.
width
/
bg
.
width
,
canvas
.
height
/
bg
.
height
);
bg
.
scale
=
Math
.
max
(
canvas
.
width
/
bg
.
width
,
canvas
.
height
/
bg
.
height
);
...
@@ -168,6 +169,10 @@ cc.Class({
...
@@ -168,6 +169,10 @@ cc.Class({
const
item
=
await
this
.
createItem
(
itemData
,
bg
);
const
item
=
await
this
.
createItem
(
itemData
,
bg
);
this
.
itemList
.
push
(
item
);
this
.
itemList
.
push
(
item
);
});
});
submitButton
.
on
(
"
click
"
,
()
=>
{
onHomeworkFinish
({});
})
},
},
shakeItem
(
item
)
{
shakeItem
(
item
)
{
...
...
assets/op_01/script/defaultData.js
View file @
dae24752
export
const
defaultData
=
{
"
startAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/83513f8d6083ebe072e3f9e47a21558a.mp3
"
,
"
endAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/440cf9d57752b30691d90ed565e8c924.mp3
"
,
"
bgItem
"
:{
"
url
"
:
"
http://staging-teach.cdn.ireadabc.com/5f386875d81fe018682062dc716a2f83.jpg
"
,
"
rect
"
:{
"
x
"
:
187
,
"
y
"
:
0
,
"
width
"
:
768
,
"
height
"
:
432
}},
"
hotZoneItemArr
"
:[{
"
id
"
:
"
1632453910417
"
,
"
index
"
:
0
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/6b900e48a68f389dcd8c6dbd3455a270.jpg
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/c08af4f22c71ad8b3d8786a837787ac9.mp3
"
,
"
itemType
"
:
"
pic
"
,
"
fontScale
"
:
0.8921875
,
"
imgScale
"
:
1.136111111111111
,
"
mapScale
"
:
0.8921875
,
"
gIdx
"
:
"
0
"
,
"
rect
"
:{
"
x
"
:
238.58
,
"
y
"
:
70.58
,
"
width
"
:
290.84
,
"
height
"
:
290.84
}}],
"
tipAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/5285e1e88a26a08783757e9c43a8653f.mp3
"
}
export
const
defaultData
=
{
\ No newline at end of file
startAudio
:
"
http://staging-teach.cdn.ireadabc.com/83513f8d6083ebe072e3f9e47a21558a.mp3
"
,
endAudio
:
"
http://staging-teach.cdn.ireadabc.com/440cf9d57752b30691d90ed565e8c924.mp3
"
,
bgItem
:
{
url
:
"
http://staging-teach.cdn.ireadabc.com/5f386875d81fe018682062dc716a2f83.jpg
"
,
rect
:
{
x
:
187
,
y
:
0
,
width
:
768
,
height
:
432
},
},
hotZoneItemArr
:
[
{
id
:
"
1632453910417
"
,
index
:
0
,
pic_url
:
"
http://staging-teach.cdn.ireadabc.com/6b900e48a68f389dcd8c6dbd3455a270.jpg
"
,
audio_url
:
"
http://staging-teach.cdn.ireadabc.com/c08af4f22c71ad8b3d8786a837787ac9.mp3
"
,
itemType
:
"
pic
"
,
fontScale
:
0.8921875
,
imgScale
:
1.136111111111111
,
mapScale
:
0.8921875
,
gIdx
:
"
0
"
,
rect
:
{
x
:
238.58
,
y
:
70.58
,
width
:
290.84
,
height
:
290.84
},
},
],
tipAudio
:
"
http://staging-teach.cdn.ireadabc.com/5285e1e88a26a08783757e9c43a8653f.mp3
"
,
};
assets/op_01/script/util.js
View file @
dae24752
...
@@ -341,15 +341,13 @@ export function showTrebleFirework(baseNode, rabbonList) {
...
@@ -341,15 +341,13 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks
(
right
);
showFireworks
(
right
);
}
}
export
function
onHomeworkFinish
()
{
export
function
onHomeworkFinish
(
data
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
if
(
middleLayerComponent
.
role
==
'
student
'
)
{
middleLayerComponent
.
onHomeworkFinish
(()
=>
{
},
data
);
middleLayerComponent
.
onHomeworkFinish
(()
=>
{
});
}
return
;
}
else
{
console
.
log
(
'
onHomeworkFinish
'
);
}
}
}
}
...
...
assets/op_01/textures/btn_submit.png
0 → 100644
View file @
dae24752
8.3 KB
assets/op_01/textures/btn_submit.png.meta
0 → 100644
View file @
dae24752
{
"ver": "2.3.5",
"uuid": "6e4a5a87-3592-4437-998c-8c58493066bf",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 244,
"height": 232,
"platformSettings": {},
"subMetas": {
"btn_submit": {
"ver": "1.0.4",
"uuid": "ef5037e5-6d66-4b53-9704-d380daccdfbf",
"rawTextureUuid": "6e4a5a87-3592-4437-998c-8c58493066bf",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 244,
"height": 232,
"rawWidth": 244,
"rawHeight": 232,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
packages/check-file-name/main.js
0 → 100644
View file @
dae24752
var
fs
=
require
(
'
fs-extra
'
);
var
file
=
require
(
'
./util/file
'
);
module
.
exports
=
{
load
()
{
},
unload
()
{
},
replaceDirUuid
:
function
(
path
,
dbpath
)
{
Editor
.
log
(
'
开始检查:
'
+
path
);
file
.
findDirUuid
(
path
);
Editor
.
log
(
'
资源检查完成
'
);
},
messages
:
{
'
checkFileName
'
()
{
var
uuids
=
Editor
.
Selection
.
curSelection
(
'
asset
'
);
uuids
.
forEach
((
uuid
)
=>
{
var
dir_path
=
Editor
.
assetdb
.
_uuid2path
[
uuid
];
if
(
fs
.
existsSync
(
dir_path
))
{
this
.
replaceDirUuid
(
dir_path
,
Editor
.
assetdb
.
uuidToUrl
(
uuid
));
}
});
},
},
}
\ No newline at end of file
packages/check-file-name/package-lock.json
0 → 100644
View file @
dae24752
{
"name"
:
"check-file-name"
,
"version"
:
"0.0.1"
,
"lockfileVersion"
:
2
,
"requires"
:
true
,
"packages"
:
{
""
:
{
"version"
:
"0.0.1"
,
"dependencies"
:
{
"node-uuid"
:
"1.4.8"
}
},
"node_modules/node-uuid"
:
{
"version"
:
"1.4.8"
,
"resolved"
:
"https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz"
,
"integrity"
:
"sha1-sEDrCSOWivq/jTL7HxfxFn/auQc="
,
"deprecated"
:
"Use uuid module instead"
,
"bin"
:
{
"uuid"
:
"bin/uuid"
}
}
},
"dependencies"
:
{
"node-uuid"
:
{
"version"
:
"1.4.8"
,
"resolved"
:
"https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz"
,
"integrity"
:
"sha1-sEDrCSOWivq/jTL7HxfxFn/auQc="
}
}
}
packages/check-file-name/package.json
0 → 100644
View file @
dae24752
{
"name"
:
"check-file-name"
,
"version"
:
"0.0.1"
,
"description"
:
"check-file-name"
,
"author"
:
"Cocos Creator"
,
"main"
:
"main.js"
,
"main-menu"
:
{
"i18n:MAIN_MENU.package.title/check-file-name"
:
{
"message"
:
"check-file-name:checkFileName"
}
},
"dependencies"
:
{
"node-uuid"
:
"1.4.8"
}
}
packages/check-file-name/util/file.js
0 → 100644
View file @
dae24752
var
fs
=
require
(
"
fs-extra
"
);
var
path
=
require
(
"
path
"
);
var
AppName
=
""
module
.
exports
=
{
/**
* 递归目录 检查文件名
* 参考 https://docs.cocos.com/creator/manual/zh/advanced-topics/meta.html
*/
findDirUuid
:
function
(
dir
)
{
if
(
AppName
==
''
)
{
AppName
=
this
.
getRootDirName
(
dir
);
if
(
AppName
!=
""
)
{
Editor
.
log
(
"
AppName:
"
+
AppName
);
}
}
var
stat
=
fs
.
statSync
(
dir
);
if
(
!
stat
.
isDirectory
())
{
return
;
}
var
subpaths
=
fs
.
readdirSync
(
dir
),
subpath
;
for
(
var
i
=
0
;
i
<
subpaths
.
length
;
++
i
)
{
if
(
subpaths
[
i
][
0
]
===
"
.
"
)
{
continue
;
}
subpath
=
path
.
join
(
dir
,
subpaths
[
i
]);
stat
=
fs
.
statSync
(
subpath
);
if
(
stat
.
isDirectory
())
{
this
.
findDirUuid
(
subpath
);
}
else
if
(
stat
.
isFile
())
{
var
metastr
=
subpath
.
substr
(
subpath
.
length
-
5
,
5
);
if
(
metastr
!=
"
.meta
"
)
{
this
.
check
(
AppName
,
subpaths
[
i
]);
}
}
}
},
getRootDirName
:
function
(
path
)
{
let
pArr
=
path
.
split
(
"
/
"
);
let
assteIndex
=
-
1
;
pArr
.
find
((
item
,
index
)
=>
{
if
(
item
==
'
assets
'
)
{
assteIndex
=
index
;
return
true
}
else
{
return
false
}
})
if
(
assteIndex
>
0
&&
assteIndex
<
(
pArr
.
length
-
1
))
{
return
pArr
[
assteIndex
+
1
];
}
else
{
return
""
}
},
check
:
(
appName
,
filePath
)
=>
{
if
(
escape
(
filePath
).
indexOf
(
"
%u
"
)
>=
0
)
{
Editor
.
log
(
`检测到[中文或中文符号]命名的文件:
${
filePath
}
`
);
}
if
(
!
/^
\S
*$/
.
test
(
filePath
))
{
Editor
.
log
(
`检测到[包含空格]命名的文件:
${
filePath
}
`
);
}
if
(
/
[
-
]
/
.
test
(
filePath
))
{
Editor
.
log
(
`检测到存在[包含减号(-)]命名的文件:
${
filePath
}
`
);
}
if
(
filePath
.
indexOf
(
appName
)
==
-
1
&&
(
filePath
.
endsWith
(
"
.js
"
)
||
filePath
.
endsWith
(
"
.ts
"
)))
{
Editor
.
log
(
`检测到[不包含包名(
${
appName
}
)]的文件:
${
filePath
}
`
);
}
}
};
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