Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP53
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
OP53
Commits
76d712d3
Commit
76d712d3
authored
Jan 11, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加数据上报
parent
b81c6c74
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
4 deletions
+149
-4
util_OP53.js
assets/OP53/script/util_OP53.js
+2
-4
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/OP53/script/util_OP53.js
View file @
76d712d3
...
@@ -338,13 +338,11 @@ export function showTrebleFirework(baseNode, rabbonList) {
...
@@ -338,13 +338,11 @@ 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
(()
=>
{
});
}
}
else
{
}
else
{
console
.
log
(
'
onHomeworkFinish
'
);
console
.
log
(
'
onHomeworkFinish
'
);
}
}
...
...
packages/check-file-name/main.js
0 → 100644
View file @
76d712d3
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 @
76d712d3
{
"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 @
76d712d3
{
"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 @
76d712d3
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