Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
a7daef5d
Commit
a7daef5d
authored
Nov 17, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
按语言决定data路径
parent
da086dd1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
15 deletions
+43
-15
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+43
-15
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
View file @
a7daef5d
...
@@ -210,8 +210,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -210,8 +210,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
IOUtils
.
createNoMedia
(
resPath
);
IOUtils
.
createNoMedia
(
resPath
);
//检查文件夹
//检查文件夹
checkDirs
();
checkDirs
();
//复制游戏配置文件
copyCoreConfig
(
resPath
,
needsUpdate
);
if
(
AppsSettings
.
get
().
isUseExtraCards
())
{
if
(
AppsSettings
.
get
().
isUseExtraCards
())
{
//自定义数据库无效,则用默认的
//自定义数据库无效,则用默认的
if
(!
CardManager
.
checkDataBase
(
AppsSettings
.
get
().
getDataBaseFile
()))
{
if
(!
CardManager
.
checkDataBase
(
AppsSettings
.
get
().
getDataBaseFile
()))
{
...
@@ -235,11 +233,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -235,11 +233,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
}
}
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PACK_PATH
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PACK_PATH
),
mSettings
.
get
().
getPackDeckDir
(),
needsUpdate
);
mSettings
.
get
().
getPackDeckDir
(),
needsUpdate
);
//复制残局
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
single_lua
)));
File
single
=
new
File
(
mSettings
.
getSingleDir
());
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_SINGLE_PATH
),
mSettings
.
getSingleDir
(),
needsUpdate
);
}
}
String
[]
sound1
=
mContext
.
getAssets
().
list
(
getDatapath
(
Constants
.
CORE_SOUND_PATH
));
String
[]
sound1
=
mContext
.
getAssets
().
list
(
getDatapath
(
Constants
.
CORE_SOUND_PATH
));
String
[]
sound2
=
new
File
(
mSettings
.
getSoundPath
()).
list
();
String
[]
sound2
=
new
File
(
mSettings
.
getSoundPath
()).
list
();
...
@@ -270,17 +263,13 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -270,17 +263,13 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_SCRIPTS_ZIP
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_SCRIPTS_ZIP
),
resPath
,
needsUpdate
);
resPath
,
needsUpdate
);
}
}
//复制数据库
copyCdbFile
(
needsUpdate
);
//复制卡图压缩包
//复制卡图压缩包
if
(
IOUtils
.
hasAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
)))
{
if
(
IOUtils
.
hasAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
)))
{
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
images
)));
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
images
)));
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
),
resPath
,
needsUpdate
);
resPath
,
needsUpdate
);
}
}
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
resPath
,
needsUpdate
);
han
.
sendEmptyMessage
(
0
);
han
.
sendEmptyMessage
(
0
);
...
@@ -294,12 +283,51 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -294,12 +283,51 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
return
ERROR_NONE
;
return
ERROR_NONE
;
}
}
private
int
copyCnData
(
Boolean
needsUpdate
)
throws
IOException
{
//复制数据库
copyCdbFile
(
getDatapath
(
DATABASE_NAME
),
needsUpdate
);
//复制残局
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
single_lua
)));
File
single
=
new
File
(
mSettings
.
getSingleDir
());
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_SINGLE_PATH
),
mSettings
.
getSingleDir
(),
needsUpdate
);
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
mSettings
.
getResourcePath
(),
needsUpdate
);
//复制游戏配置文件
copyCoreConfig
(
mSettings
.
getResourcePath
(),
needsUpdate
);
return
ERROR_NONE
;
}
private
int
copyEnData
(
File
stringfile
,
File
botfile
)
{
String
enStringConf
=
ASSETS_PATH
+
"en/conf/"
+
CORE_STRING_PATH
;
String
enBotConf
=
ASSETS_PATH
+
"en/conf/"
+
CORE_BOT_CONF_PATH
;
String
enCdb
=
ASSETS_PATH
+
"en/"
+
DATABASE_NAME
;
try
{
IOUtils
.
copyFilesFromAssets
(
mContext
,
enStringConf
,
stringfile
.
getPath
(),
true
);
IOUtils
.
copyFilesFromAssets
(
mContext
,
enBotConf
,
botfile
.
getPath
(),
true
);
copyCdbFile
(
enCdb
,
true
);
//替换换行符
fixString
(
stringfile
.
getAbsolutePath
());
fixString
(
botfile
.
getAbsolutePath
());
return
ERROR_NONE
;
}
catch
(
IOException
e
)
{
mError
=
ERROR_COPY
;
return
ERROR_COPY
;
}
}
private
int
copyKorData
(
File
systemfile
,
File
stringfile
,
File
botfile
)
{
return
ERROR_NONE
;
}
private
void
loadData
()
{
private
void
loadData
()
{
setMessage
(
mContext
.
getString
(
R
.
string
.
loading
));
setMessage
(
mContext
.
getString
(
R
.
string
.
loading
));
DataManager
.
get
().
load
(
false
);
DataManager
.
get
().
load
(
false
);
}
}
void
copyCdbFile
(
boolean
needsUpdate
)
throws
IOException
{
void
copyCdbFile
(
String
assetPath
,
boolean
needsUpdate
)
throws
IOException
{
File
dbFile
=
new
File
(
mSettings
.
getDataBasePath
(),
DATABASE_NAME
);
File
dbFile
=
new
File
(
mSettings
.
getDataBasePath
(),
DATABASE_NAME
);
//如果数据库存在
//如果数据库存在
if
(
dbFile
.
exists
())
{
if
(
dbFile
.
exists
())
{
...
@@ -310,7 +338,7 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -310,7 +338,7 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
return
;
return
;
}
}
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
cards_cdb
)));
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
cards_cdb
)));
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
DATABASE_NAME
)
,
mSettings
.
getDataBasePath
(),
needsUpdate
);
IOUtils
.
copyFilesFromAssets
(
mContext
,
assetPath
,
mSettings
.
getDataBasePath
(),
needsUpdate
);
}
}
private
void
checkDirs
()
{
private
void
checkDirs
()
{
...
...
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