Commit d0381018 authored by fallenstardust's avatar fallenstardust

重置资源也可以搬运原路径文件

parent 29c3f0ac
package cn.garymb.ygomobile; package cn.garymb.ygomobile;
import android.os.Environment;
import android.view.Gravity; import android.view.Gravity;
import cn.garymb.ygomobile.lite.BuildConfig; import cn.garymb.ygomobile.lite.BuildConfig;
...@@ -151,6 +152,12 @@ public interface Constants { ...@@ -151,6 +152,12 @@ public interface Constants {
String SERVER_FILE = "server_list.xml"; String SERVER_FILE = "server_list.xml";
String SHARE_FILE = ".share_deck.png"; String SHARE_FILE = ".share_deck.png";
//原目录文件路径
String ORI_DECK = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_DECK_PATH;
String ORI_REPLAY = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_REPLAY_PATH;
String ORI_TEXTURES = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_SKIN_PATH;
String ORI_PICS = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_IMAGE_PATH;
long LOG_TIME = 2 * 1000; long LOG_TIME = 2 * 1000;
/*** /***
* 如果是双击显示,则单击拖拽 * 如果是双击显示,则单击拖拽
......
...@@ -35,6 +35,10 @@ import cn.garymb.ygomobile.utils.YGOUtil; ...@@ -35,6 +35,10 @@ import cn.garymb.ygomobile.utils.YGOUtil;
import static cn.garymb.ygomobile.Constants.ACTION_RELOAD; import static cn.garymb.ygomobile.Constants.ACTION_RELOAD;
import static cn.garymb.ygomobile.Constants.NETWORK_IMAGE; import static cn.garymb.ygomobile.Constants.NETWORK_IMAGE;
import static cn.garymb.ygomobile.Constants.ORI_DECK;
import static cn.garymb.ygomobile.Constants.ORI_PICS;
import static cn.garymb.ygomobile.Constants.ORI_REPLAY;
import static cn.garymb.ygomobile.Constants.ORI_TEXTURES;
import static cn.garymb.ygomobile.ui.home.ResCheckTask.ResCheckListener; import static cn.garymb.ygomobile.ui.home.ResCheckTask.ResCheckListener;
import static cn.garymb.ygomobile.ui.home.ResCheckTask.getDatapath; import static cn.garymb.ygomobile.ui.home.ResCheckTask.getDatapath;
...@@ -243,6 +247,12 @@ public class MainActivity extends HomeActivity { ...@@ -243,6 +247,12 @@ public class MainActivity extends HomeActivity {
IOUtils.copyFilesFromAssets(this, getDatapath(Constants.CORE_SOUND_PATH), IOUtils.copyFilesFromAssets(this, getDatapath(Constants.CORE_SOUND_PATH),
AppsSettings.get().getSoundPath(), false); AppsSettings.get().getSoundPath(), false);
//复制原目录文件
FileUtils.copyDir(ORI_DECK, AppsSettings.get().getDeckDir());
FileUtils.copyDir(ORI_REPLAY, AppsSettings.get().getResourcePath() + "/" + Constants.CORE_REPLAY_PATH);
FileUtils.copyDir(ORI_TEXTURES, AppsSettings.get().getCoreSkinPath());
FileUtils.copyDir(ORI_PICS, AppsSettings.get().getCardImagePath());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Log.e("MainActivity", "错误" + e); Log.e("MainActivity", "错误" + e);
......
...@@ -36,6 +36,10 @@ import ocgcore.DataManager; ...@@ -36,6 +36,10 @@ import ocgcore.DataManager;
import static cn.garymb.ygomobile.Constants.ASSETS_PATH; import static cn.garymb.ygomobile.Constants.ASSETS_PATH;
import static cn.garymb.ygomobile.Constants.CORE_BOT_CONF_PATH; import static cn.garymb.ygomobile.Constants.CORE_BOT_CONF_PATH;
import static cn.garymb.ygomobile.Constants.DATABASE_NAME; import static cn.garymb.ygomobile.Constants.DATABASE_NAME;
import static cn.garymb.ygomobile.Constants.ORI_DECK;
import static cn.garymb.ygomobile.Constants.ORI_PICS;
import static cn.garymb.ygomobile.Constants.ORI_REPLAY;
import static cn.garymb.ygomobile.Constants.ORI_TEXTURES;
import static cn.garymb.ygomobile.Constants.PREF_DEF_GAME_DIR; import static cn.garymb.ygomobile.Constants.PREF_DEF_GAME_DIR;
public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...@@ -210,11 +214,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -210,11 +214,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
ConfigManager systemConf = DataManager.openConfig(mSettings.getSystemConfig()); ConfigManager systemConf = DataManager.openConfig(mSettings.getSystemConfig());
systemConf.setFontSize(mSettings.getFontSize()); systemConf.setFontSize(mSettings.getFontSize());
systemConf.close(); systemConf.close();
//原目录文件路径
String deck = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_DECK_PATH;
String replay = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_REPLAY_PATH;
String textures = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_SKIN_PATH;
String pics = Environment.getExternalStorageDirectory() + "/" + Constants.PREF_DEF_GAME_DIR + "/" + Constants.CORE_IMAGE_PATH;
//如果是新版本 //如果是新版本
if (needsUpdate) { if (needsUpdate) {
...@@ -272,10 +271,10 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -272,10 +271,10 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
IOUtils.copyFilesFromAssets(mContext, getDatapath(Constants.WINDBOT_PATH), IOUtils.copyFilesFromAssets(mContext, getDatapath(Constants.WINDBOT_PATH),
resPath, needsUpdate); resPath, needsUpdate);
//复制原目录文件 //复制原目录文件
FileUtils.copyDir(deck, mSettings.getDeckDir()); FileUtils.copyDir(ORI_DECK, mSettings.getDeckDir());
FileUtils.copyDir(replay, resPath + "/" + Constants.CORE_REPLAY_PATH); FileUtils.copyDir(ORI_REPLAY, resPath + "/" + Constants.CORE_REPLAY_PATH);
FileUtils.copyDir(textures, mSettings.getCoreSkinPath()); FileUtils.copyDir(ORI_TEXTURES, mSettings.getCoreSkinPath());
FileUtils.copyDir(pics, mSettings.getCardImagePath()); FileUtils.copyDir(ORI_PICS, mSettings.getCardImagePath());
han.sendEmptyMessage(0); han.sendEmptyMessage(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment