Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
babycare_xiaoxiao
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
翁阳
babycare_xiaoxiao
Commits
d267957a
Commit
d267957a
authored
Sep 29, 2020
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
四连特效替换
parent
71c6e716
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
30 deletions
+56
-30
workspace.xml
.idea/workspace.xml
+18
-20
handleLotS.js
scripts/handleLotS.js
+38
-10
No files found.
.idea/workspace.xml
View file @
d267957a
...
...
@@ -3,10 +3,7 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"9cef0552-af3c-4a1c-be1f-dc41ebe5b6db"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/resource/res.json"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/resource/res.json"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/ResJson.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/ResJson.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/scene/PlayScene.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/scene/PlayScene.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/something/class/Element.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/something/class/Element.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/scripts/handleLotS.js"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/scripts/handleLotS.js"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -46,7 +43,7 @@
<property
name=
"RunOnceActivity.ShowReadmeOnStart"
value=
"true"
/>
<property
name=
"SHARE_PROJECT_CONFIGURATION_FILES"
value=
"true"
/>
<property
name=
"WebServerToolWindowFactoryState"
value=
"false"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$/s
rc/panel
s"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$/s
cript
s"
/>
<property
name=
"node.js.detected.package.tslint"
value=
"true"
/>
<property
name=
"node.js.path.for.package.tslint"
value=
"project"
/>
<property
name=
"node.js.selected.package.tslint"
value=
"(autodetect)"
/>
...
...
@@ -60,11 +57,11 @@
</component>
<component
name=
"RecentsManager"
>
<key
name=
"CopyFile.RECENT_KEYS"
>
<recent
name=
"$PROJECT_DIR$/scripts"
/>
<recent
name=
"$PROJECT_DIR$/src/panels"
/>
<recent
name=
"$PROJECT_DIR$/resource/TaskPanel"
/>
<recent
name=
"$PROJECT_DIR$"
/>
<recent
name=
"$PROJECT_DIR$/resource/common"
/>
<recent
name=
"$PROJECT_DIR$/resource/map"
/>
</key>
<key
name=
"MoveFile.RECENT_KEYS"
>
<recent
name=
"$PROJECT_DIR$"
/>
...
...
@@ -151,14 +148,7 @@
<workItem
from=
"1600912046696"
duration=
"16271000"
/>
<workItem
from=
"1600998191749"
duration=
"23862000"
/>
<workItem
from=
"1601170975973"
duration=
"20963000"
/>
<workItem
from=
"1601257315718"
duration=
"47200000"
/>
</task>
<task
id=
"LOCAL-00013"
summary=
"effect"
>
<created>
1594707268299
</created>
<option
name=
"number"
value=
"00013"
/>
<option
name=
"presentableId"
value=
"LOCAL-00013"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1594707268299
</updated>
<workItem
from=
"1601257315718"
duration=
"48486000"
/>
</task>
<task
id=
"LOCAL-00014"
summary=
"effect"
>
<created>
1594712422242
</created>
...
...
@@ -496,7 +486,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1601368171740
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"62"
/>
<task
id=
"LOCAL-00062"
summary=
"四连特效替换"
>
<created>
1601373015025
</created>
<option
name=
"number"
value=
"00062"
/>
<option
name=
"presentableId"
value=
"LOCAL-00062"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1601373015026
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"63"
/>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
...
...
@@ -528,7 +525,8 @@
<MESSAGE
value=
"节日红包"
/>
<MESSAGE
value=
"节日红包fa"
/>
<MESSAGE
value=
"asjghdfkaksjhsaft asxjcv bnot6qwuk"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"asjghdfkaksjhsaft asxjcv bnot6qwuk"
/>
<MESSAGE
value=
"四连特效替换"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"四连特效替换"
/>
</component>
<component
name=
"WindowStateProjectService"
>
<state
x=
"440"
y=
"273"
key=
"#com.intellij.execution.impl.EditConfigurationsDialog"
timestamp=
"1595229546530"
>
...
...
@@ -543,10 +541,10 @@
<screen
x=
"31"
y=
"23"
width=
"1889"
height=
"1177"
/>
</state>
<state
x=
"251"
y=
"471"
key=
"ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1/31.23.1889.1177@31.23.1889.1177"
timestamp=
"1594113080922"
/>
<state
x=
"557"
y=
"183"
width=
"884"
height=
"891"
key=
"CommitChangelistDialog2"
timestamp=
"16013
68171296
"
>
<state
x=
"557"
y=
"183"
width=
"884"
height=
"891"
key=
"CommitChangelistDialog2"
timestamp=
"16013
73014677
"
>
<screen
x=
"30"
y=
"23"
width=
"1890"
height=
"1177"
/>
</state>
<state
x=
"557"
y=
"183"
key=
"CommitChangelistDialog2/30.23.1890.1177@30.23.1890.1177"
timestamp=
"16013
68171296
"
/>
<state
x=
"557"
y=
"183"
key=
"CommitChangelistDialog2/30.23.1890.1177@30.23.1890.1177"
timestamp=
"16013
73014677
"
/>
<state
x=
"558"
y=
"183"
width=
"884"
height=
"891"
key=
"CommitChangelistDialog2/31.23.1889.1177@31.23.1889.1177"
timestamp=
"1595584297912"
/>
<state
x=
"131"
y=
"123"
width=
"730"
height=
"977"
key=
"DiffContextDialog"
timestamp=
"1596165868169"
>
<screen
x=
"30"
y=
"23"
width=
"1890"
height=
"1177"
/>
...
...
@@ -602,10 +600,10 @@
</state>
<state
x=
"289"
y=
"314"
key=
"SettingsEditor/30.23.1890.1177@30.23.1890.1177"
timestamp=
"1596079390860"
/>
<state
x=
"300"
y=
"248"
key=
"SettingsEditor/31.23.1889.1177@31.23.1889.1177"
timestamp=
"1594798992724"
/>
<state
x=
"91"
y=
"351"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"16013
68173271
"
>
<state
x=
"91"
y=
"351"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"16013
73016182
"
>
<screen
x=
"30"
y=
"23"
width=
"1890"
height=
"1177"
/>
</state>
<state
x=
"91"
y=
"351"
key=
"Vcs.Push.Dialog.v2/30.23.1890.1177@30.23.1890.1177"
timestamp=
"16013
68173271
"
/>
<state
x=
"91"
y=
"351"
key=
"Vcs.Push.Dialog.v2/30.23.1890.1177@30.23.1890.1177"
timestamp=
"16013
73016182
"
/>
<state
x=
"92"
y=
"351"
key=
"Vcs.Push.Dialog.v2/31.23.1889.1177@31.23.1889.1177"
timestamp=
"1595584299423"
/>
<state
x=
"87"
y=
"216"
key=
"com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser"
timestamp=
"1594705166397"
>
<screen
x=
"31"
y=
"23"
width=
"1889"
height=
"1177"
/>
...
...
scripts/handleLotS.js
View file @
d267957a
var
fs
=
require
(
"fs"
);
var
iconv
=
require
(
'iconv-lite'
);
var
path
=
require
(
'path'
);
const
trans
=
require
(
"./trans"
)
//用于处理带base64图片的lottie文件,取出图片,同名lottie文件夹,写入代码"./src/lotties/"中;
var
pathName
=
"./lottiesT"
//别再执行,会覆盖
// return
var
hashBase64
=
{};
var
pathName
=
"./l"
;
var
outPath
=
"./resource"
//读文件夹
var
files
=
fs
.
readdirSync
(
pathName
);
//对每个json文件作处理
...
...
@@ -19,20 +26,39 @@ files.forEach(function (lottiesFileName) {
if
(
!
assets
||
!
assets
.
length
)
return
;
//删除属性
delete
data
.
assets
;
var
imgOutPath
=
pathName
+
"/"
+
data
.
nm
var
imgOutPath
=
outPath
+
"/"
+
data
.
nm
//建文件夹data.nm
if
(
!
fs
.
existsSync
(
imgOutPath
))
fs
.
mkdirSync
(
imgOutPath
);
assets
.
forEach
((
e
)
=>
{
//没有base64数据
if
(
!
e
.
p
)
return
let
id
=
e
.
id
;
let
uuid
=
guid
();
//存图片
//
let uuid = guid();
//
//
存图片
var
base64
=
e
.
p
.
replace
(
/^data:image
\/\w
+;base64,/
,
""
);
//去掉图片base64码前面部分data:image/png;base64
var
dataBuffer
=
new
Buffer
(
base64
,
'base64'
);
//把base64码转成buffer对象,
fs
.
writeFile
(
imgOutPath
+
"/"
+
uuid
+
".png"
,
dataBuffer
);
//修改用到id的所有refId
data
.
layers
.
forEach
((
l
)
=>
{
l
.
refId
===
id
&&
(
l
.
refId
=
uuid
)
})
// var dataBuffer = new Buffer(base64, 'base64'); //把base64码转成buffer对象,
var
dataBuffer
=
Buffer
.
from
(
base64
,
'base64'
)
//用用到该图片的图层的名字当作图片名,必须是.png结尾,为了图片去重
var
name
=
data
.
layers
.
find
((
l
)
=>
{
return
l
.
refId
===
id
})
//没找到图层,不存
if
(
!
name
)
return
;
//如果缓存过了,refId,统一把refId当作必有图片
if
(
hashBase64
[
base64
])
{
name
=
hashBase64
[
base64
];
}
else
{
//取图层名字,如果没有。png,用uuid
// if (name.nm.indexOf(".png") == -1) {
name
=
guid
();
// } else {
// //取名字
// name = name.nm.replace(".png", "");
// }
hashBase64
[
base64
]
=
name
}
//修改所有的refId
data
.
layers
.
forEach
((
l
)
=>
{
l
.
refId
===
id
&&
(
l
.
refId
=
name
)
})
fs
.
writeFile
(
imgOutPath
+
"/"
+
name
+
".png"
,
dataBuffer
,
()
=>
{
});
})
//开始删东西
delete
data
.
ddd
;
...
...
@@ -58,10 +84,12 @@ files.forEach(function (lottiesFileName) {
//导出代码到src的lotties文件夹,名字就是lottie动画名字,资源名字临时处理了,首页加载动画用图层的nm,bonustime用refid
var
endPath
=
'./src/lotties'
;
if
(
!
fs
.
existsSync
(
endPath
))
fs
.
mkdirSync
(
endPath
);
//文件名字修改,中划线变成下划线,中文变拼音
var
fileName
=
trans
(
data
.
nm
).
replace
(
/-/g
,
"_"
)
//导出对象直接用lottie动画名字
var
endFile
=
`export const
${
data
.
nm
}
=
${
JSON
.
stringify
(
data
,
""
,
"
\
t"
)}
`
var
endFile
=
`export const
${
fileName
}
=
${
JSON
.
stringify
(
data
,
""
,
"
\
t"
)}
`
//文件名字用lottie动画名字
fs
.
writeFileSync
(
endPath
+
"/"
+
data
.
nm
+
".ts"
,
endFile
);
fs
.
writeFileSync
(
endPath
+
"/"
+
fileName
+
".ts"
,
endFile
);
})
function
guid
()
{
...
...
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