Commit 65a5810e authored by fallenstardust's avatar fallenstardust

随机难度AI&初始化顺序整理

parent 33d6a199
...@@ -22,12 +22,15 @@ ...@@ -22,12 +22,15 @@
<pre> <pre>
更新: 更新:
1.更新ygo内核; 1.更新ygo内核;
4.新卡SHVA+VJ; 2.增加AI按难易度随机加入功能;
3.新卡SHVA+CT15+VJ;
修复: 修复:
1.关键词输入数字无法搜索「No.」的问题; 1.关键词输入数字无法搜索「No.」的问题;
2.部分机型打开残局闪退的问题;
优化: 优化:
1.属性、种族宣言时的易误触的问题; 1.属性、种族宣言时的易误触的问题;
2.增加适配机型; 2.增加适配机型;
3.更新适配更能开关说明;
</pre> </pre>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -4,25 +4,40 @@ ...@@ -4,25 +4,40 @@
# description # description
# flags (avail flags: SUPPORT_MASTER_RULE_3, SUPPORT_NEW_MASTER_RULE) # flags (avail flags: SUPPORT_MASTER_RULE_3, SUPPORT_NEW_MASTER_RULE)
!随机-非常简单
Random=AI_LV1
主要是一些沙包。
SUPPORT_NEW_MASTER_RULE
!随机-简单
Random=AI_LV2
一些比较弱的卡组。
SUPPORT_NEW_MASTER_RULE
!随机-普通
Random=AI_LV3
一些环境里可以看到的卡组。
SUPPORT_NEW_MASTER_RULE
!谜之剑士LV4-龙骑星爆 !谜之剑士LV4-龙骑星爆
Name=谜之剑士LV4 Deck=Dragunity Dialog=swordsman.zh-CN Name=谜之剑士LV4 Deck=Dragunity Dialog=swordsman.zh-CN
龙骑轴星尘龙爆裂体卡组。 龙骑轴星尘龙爆裂体卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!谜之剑士LV4-R5 !谜之剑士LV4-R5
Name=谜之剑士LV4 Deck='Rank V' Dialog=swordsman.zh-CN Name=谜之剑士LV4 Deck='Rank V' Dialog=swordsman.zh-CN
5阶超量卡组。 5阶超量卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!谜之剑士LV4-异热同心武器 !谜之剑士LV4-异热同心武器
Name=谜之剑士LV4 Deck='Zexal Weapons' Dialog=swordsman.zh-CN Name=谜之剑士LV4 Deck='Zexal Weapons' Dialog=swordsman.zh-CN
神装电光皇卡组。 神装电光皇卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!琪露诺-彩虹 !琪露诺-彩虹
Name=琪露诺 Deck=Rainbow Dialog=cirno.zh-CN Name=琪露诺 Deck=Rainbow Dialog=cirno.zh-CN
全属性凡骨卡组。 全属性凡骨卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!琪露诺-饼蛙 !琪露诺-饼蛙
Name=琪露诺 Deck='Toadally Awesome' Dialog=cirno.zh-CN Name=琪露诺 Deck='Toadally Awesome' Dialog=cirno.zh-CN
...@@ -32,7 +47,7 @@ SUPPORT_MASTER_RULE_3 ...@@ -32,7 +47,7 @@ SUPPORT_MASTER_RULE_3
!复制植物-青眼 !复制植物-青眼
Name=复制植物 Deck=Blue-Eyes Dialog=copy.zh-CN Name=复制植物 Deck=Blue-Eyes Dialog=copy.zh-CN
青眼卡组。 青眼卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!复制植物-十二兽 !复制植物-十二兽
Name=复制植物 Deck=Zoodiac Dialog=copy.zh-CN Name=复制植物 Deck=Zoodiac Dialog=copy.zh-CN
...@@ -42,64 +57,64 @@ SUPPORT_MASTER_RULE_3 ...@@ -42,64 +57,64 @@ SUPPORT_MASTER_RULE_3
!尼亚-妖仙兽 !尼亚-妖仙兽
Name=尼亚 Deck=Yosenju Dialog=near.zh-CN Name=尼亚 Deck=Yosenju Dialog=near.zh-CN
妖仙兽卡组。 妖仙兽卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!尼亚-机壳 !尼亚-机壳
Name=尼亚 Deck=Qliphort Dialog=near.zh-CN Name=尼亚 Deck=Qliphort Dialog=near.zh-CN
机壳卡组。 机壳卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!尼亚-淘气仙星 !尼亚-淘气仙星
Name=尼亚 Deck=Trickstar Dialog=near.zh-CN Name=尼亚 Deck=Trickstar Dialog=near.zh-CN
淘气仙星卡组。 淘气仙星卡组。
SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_NEW_MASTER_RULE
!永远之魂-削血 !永远之魂-削血
Name=永远之魂 Deck=Burn Dialog=soul.zh-CN Name=永远之魂 Deck=Burn Dialog=soul.zh-CN
老式削血卡组。 老式削血卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!永远之魂-青蛙 !永远之魂-青蛙
Name=永远之魂 Deck=Frog Dialog=soul.zh-CN Name=永远之魂 Deck=Frog Dialog=soul.zh-CN
老式青蛙卡组。 老式青蛙卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!永远之魂-荷鲁斯 !永远之魂-荷鲁斯
Name=永远之魂 Deck=Horus Dialog=soul.zh-CN Name=永远之魂 Deck=Horus Dialog=soul.zh-CN
老式龙族卡组。 老式龙族卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!悠悠 !悠悠
Name=悠悠 Deck=MokeyMokey Dialog=mokey.zh-CN Name=悠悠 Deck=MokeyMokey Dialog=mokey.zh-CN
沙包。 沙包。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!悠悠王 !悠悠王
Name=悠悠王 Deck=MokeyMokeyKing Dialog=mokey.zh-CN Name=悠悠王 Deck=MokeyMokeyKing Dialog=mokey.zh-CN
大沙包。 大沙包。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!试作型机器人1732 !试作型机器人1732
Name=试作型机器人1732 Deck=ST1732 Dialog=zh-CN Name=试作型机器人1732 Deck=ST1732 Dialog=zh-CN
由三盒ST17和三盒SD32组成的卡组。 由三盒ST17和三盒SD32组成的卡组。
SUPPORT_NEW_MASTER_RULE AI_LV2 SUPPORT_NEW_MASTER_RULE
!奇異果 !奇異果
Name=奇異果 Deck=LightswornShaddoldinosour Dialog=kiwi.zh-TW Name=奇異果 Deck=LightswornShaddoldinosour Dialog=kiwi.zh-TW
光道影依恐龙卡组。 光道影依恐龙卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!奇魔果 !奇魔果
Name=奇魔果 Deck=DarkMagician Dialog=kiwi.zh-TW Name=奇魔果 Deck=DarkMagician Dialog=kiwi.zh-TW
黑魔术师卡组。 黑魔术师卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!燃血鬥士 !燃血鬥士
Name=燃血鬥士 Deck=ChainBurn Dialog=kiwi.zh-TW Name=燃血鬥士 Deck=ChainBurn Dialog=kiwi.zh-TW
连锁烧卡组。 连锁烧卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!复制梁龙-闪刀姬 !复制梁龙-闪刀姬
Name=复制梁龙 Deck=SkyStriker Dialog=anothercopy.zh-CN Name=复制梁龙 Deck=SkyStriker Dialog=anothercopy.zh-CN
纯闪刀姬卡组。 纯闪刀姬卡组。
SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_NEW_MASTER_RULE
#bots list
# !name
# command
# description
# flags (avail flags: SUPPORT_MASTER_RULE_3, SUPPORT_NEW_MASTER_RULE)
!随机-非常简单
Random=AI_LV1
主要是一些沙包。
SUPPORT_NEW_MASTER_RULE
!随机-简单
Random=AI_LV2
一些比较弱的卡组。
SUPPORT_NEW_MASTER_RULE
!随机-普通
Random=AI_LV3
一些环境里可以看到的卡组。
SUPPORT_NEW_MASTER_RULE
!谜之剑士LV4-龙骑星爆
Name=谜之剑士LV4 Deck=Dragunity Dialog=swordsman.zh-CN
龙骑轴星尘龙爆裂体卡组。
AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!谜之剑士LV4-R5
Name=谜之剑士LV4 Deck='Rank V' Dialog=swordsman.zh-CN
5阶超量卡组。
AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!谜之剑士LV4-异热同心武器
Name=谜之剑士LV4 Deck='Zexal Weapons' Dialog=swordsman.zh-CN
神装电光皇卡组。
AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!琪露诺-彩虹
Name=琪露诺 Deck=Rainbow Dialog=cirno.zh-CN
全属性凡骨卡组。
AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!琪露诺-饼蛙
Name=琪露诺 Deck='Toadally Awesome' Dialog=cirno.zh-CN
大师规则三的全盛饼蛙卡组。
SUPPORT_MASTER_RULE_3
!复制植物-青眼
Name=复制植物 Deck=Blue-Eyes Dialog=copy.zh-CN
青眼卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!复制植物-十二兽
Name=复制植物 Deck=Zoodiac Dialog=copy.zh-CN
大师规则三的十四兽卡组。
SUPPORT_MASTER_RULE_3
!尼亚-妖仙兽
Name=尼亚 Deck=Yosenju Dialog=near.zh-CN
妖仙兽卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!尼亚-机壳
Name=尼亚 Deck=Qliphort Dialog=near.zh-CN
机壳卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!尼亚-淘气仙星
Name=尼亚 Deck=Trickstar Dialog=near.zh-CN
淘气仙星卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE
!永远之魂-削血
Name=永远之魂 Deck=Burn Dialog=soul.zh-CN
老式削血卡组。
AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!永远之魂-青蛙
Name=永远之魂 Deck=Frog Dialog=soul.zh-CN
老式青蛙卡组。
AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!永远之魂-荷鲁斯
Name=永远之魂 Deck=Horus Dialog=soul.zh-CN
老式龙族卡组。
AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!悠悠
Name=悠悠 Deck=MokeyMokey Dialog=mokey.zh-CN
沙包。
AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!悠悠王
Name=悠悠王 Deck=MokeyMokeyKing Dialog=mokey.zh-CN
大沙包。
AI_LV1 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!试作型机器人1732
Name=试作型机器人1732 Deck=ST1732 Dialog=zh-CN
由三盒ST17和三盒SD32组成的卡组。
AI_LV2 SUPPORT_NEW_MASTER_RULE
!奇異果
Name=奇異果 Deck=LightswornShaddoldinosour Dialog=kiwi.zh-TW
光道影依恐龙卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!奇魔果
Name=奇魔果 Deck=DarkMagician Dialog=kiwi.zh-TW
黑魔术师卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!燃血鬥士
Name=燃血鬥士 Deck=ChainBurn Dialog=kiwi.zh-TW
连锁烧卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE
!复制梁龙-闪刀姬
Name=复制梁龙 Deck=SkyStriker Dialog=anothercopy.zh-CN
纯闪刀姬卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
applicationId "cn.garymb.ygomobile" applicationId "cn.garymb.ygomobile"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 22
versionCode 33050823 versionCode 33050902
versionName "3.3.5" versionName "3.3.5"
flavorDimensions "versionCode" flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
......
...@@ -58,6 +58,7 @@ public interface Constants { ...@@ -58,6 +58,7 @@ public interface Constants {
String CORE_LIMIT_PATH = "lflist.conf"; String CORE_LIMIT_PATH = "lflist.conf";
String CORE_CUSTOM_LIMIT_PATH = "expansions/lflist.conf"; String CORE_CUSTOM_LIMIT_PATH = "expansions/lflist.conf";
String CORE_SYSTEM_PATH = "system.conf"; String CORE_SYSTEM_PATH = "system.conf";
String CORE_BOT_CONF_PATH = "bot.conf";
String CORE_SKIN_PATH = "textures"; String CORE_SKIN_PATH = "textures";
String CORE_SKIN_PENDULUM_PATH = CORE_SKIN_PATH + "/extra"; String CORE_SKIN_PENDULUM_PATH = CORE_SKIN_PATH + "/extra";
String CORE_DECK_PATH = "deck"; String CORE_DECK_PATH = "deck";
......
package cn.garymb.ygomobile.ui.home; package cn.garymb.ygomobile.ui.home;
import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color; import android.graphics.Color;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants; import cn.garymb.ygomobile.Constants;
...@@ -31,27 +21,20 @@ import cn.garymb.ygomobile.ui.plus.VUiKit; ...@@ -31,27 +21,20 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.ComponentUtils; import cn.garymb.ygomobile.utils.ComponentUtils;
import cn.garymb.ygomobile.utils.IOUtils; import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.NetUtils; import cn.garymb.ygomobile.utils.NetUtils;
import libwindbot.windbot.WindBot;
import static cn.garymb.ygomobile.Constants.ACTION_RELOAD; import static cn.garymb.ygomobile.Constants.ACTION_RELOAD;
import static cn.garymb.ygomobile.Constants.CORE_PICS_ZIP;
import static cn.garymb.ygomobile.Constants.DATABASE_NAME;
import static cn.garymb.ygomobile.Constants.NETWORK_IMAGE; import static cn.garymb.ygomobile.Constants.NETWORK_IMAGE;
import static cn.garymb.ygomobile.Constants.PREF_DEF_GAME_DIR;
import static cn.garymb.ygomobile.ui.home.ResCheckTask.getDatapath;
public class MainActivity extends HomeActivity { public class MainActivity extends HomeActivity {
private GameUriManager mGameUriManager; private GameUriManager mGameUriManager;
private ImageUpdater mImageUpdater; private ImageUpdater mImageUpdater;
private boolean enableStart; private boolean enableStart;
MessageReceiver mReceiver = new MessageReceiver(); ResCheckTask mResCheckTask;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
YGOStarter.onCreated(this); YGOStarter.onCreated(this);
//checkWindbot();
han.sendEmptyMessage(0);
mImageUpdater = new ImageUpdater(this); mImageUpdater = new ImageUpdater(this);
//资源复制 //资源复制
checkResourceDownload((error, isNew) -> { checkResourceDownload((error, isNew) -> {
...@@ -61,7 +44,7 @@ public class MainActivity extends HomeActivity { ...@@ -61,7 +44,7 @@ public class MainActivity extends HomeActivity {
enableStart = true; enableStart = true;
} }
if (isNew) { if (isNew) {
if(!getGameUriManager().doIntent(getIntent())) { if (!getGameUriManager().doIntent(getIntent())) {
new DialogPlus(this) new DialogPlus(this)
.setTitleText(getString(R.string.settings_about_change_log)) .setTitleText(getString(R.string.settings_about_change_log))
.loadUrl("file:///android_asset/changelog.html", Color.TRANSPARENT) .loadUrl("file:///android_asset/changelog.html", Color.TRANSPARENT)
...@@ -97,7 +80,8 @@ public class MainActivity extends HomeActivity { ...@@ -97,7 +80,8 @@ public class MainActivity extends HomeActivity {
protected void onDestroy() { protected void onDestroy() {
YGOStarter.onDestroy(this); YGOStarter.onDestroy(this);
super.onDestroy(); super.onDestroy();
unregisterReceiver(mReceiver); mResCheckTask.unregisterMReceiver();
} }
@Override @Override
...@@ -126,11 +110,11 @@ public class MainActivity extends HomeActivity { ...@@ -126,11 +110,11 @@ public class MainActivity extends HomeActivity {
@Override @Override
protected void checkResourceDownload(ResCheckTask.ResCheckListener listener) { protected void checkResourceDownload(ResCheckTask.ResCheckListener listener) {
ResCheckTask task = new ResCheckTask(this, listener); mResCheckTask = new ResCheckTask(this, listener);
if (Build.VERSION.SDK_INT >= 11) { if (Build.VERSION.SDK_INT >= 11) {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); mResCheckTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else { } else {
task.execute(); mResCheckTask.execute();
} }
} }
...@@ -147,7 +131,7 @@ public class MainActivity extends HomeActivity { ...@@ -147,7 +131,7 @@ public class MainActivity extends HomeActivity {
public void updateImages() { public void updateImages() {
DialogPlus dialog = DialogPlus.show(this, null, getString(R.string.message)); DialogPlus dialog = DialogPlus.show(this, null, getString(R.string.message));
dialog.show(); dialog.show();
VUiKit.defer().when(()->{ VUiKit.defer().when(() -> {
if (IOUtils.hasAssets(this, ResCheckTask.getDatapath(Constants.CORE_PICS_ZIP))) { if (IOUtils.hasAssets(this, ResCheckTask.getDatapath(Constants.CORE_PICS_ZIP))) {
try { try {
IOUtils.copyFilesFromAssets(this, ResCheckTask.getDatapath(Constants.CORE_PICS_ZIP), IOUtils.copyFilesFromAssets(this, ResCheckTask.getDatapath(Constants.CORE_PICS_ZIP),
...@@ -156,52 +140,11 @@ public class MainActivity extends HomeActivity { ...@@ -156,52 +140,11 @@ public class MainActivity extends HomeActivity {
e.printStackTrace(); e.printStackTrace();
} }
} }
}).done((rs)->{ }).done((rs) -> {
dialog.dismiss(); dialog.dismiss();
}); });
} }
/* checkResourceDownload((result, isNewVersion) -> { /* checkResourceDownload((result, isNewVersion) -> {
Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show();
});*/ });*/
public class MessageReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals("RUN_WINDBOT")) {
String args = intent.getStringExtra("args");
WindBot.runAndroid(args);
}
}
}
public void checkWindbot() {
Log.i("路径", getFilesDir().getPath());
Log.i("路径2", AppsSettings.get().getDataBasePath() + "/" + DATABASE_NAME);
try {
WindBot.initAndroid(getFilesDir().getPath(), AppsSettings.get().getDataBasePath() + "/" + DATABASE_NAME);
}catch (Throwable e){
e.printStackTrace();
}
IntentFilter filter = new IntentFilter();
filter.addAction("RUN_WINDBOT");
registerReceiver(mReceiver, filter);
}
Handler han = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO: Implement this method
super.handleMessage(msg);
switch (msg.what) {
case 0:
checkWindbot();
break;
}
}
};
} }
...@@ -44,6 +44,7 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -44,6 +44,7 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
private DialogPlus dialog = null; private DialogPlus dialog = null;
private Handler handler; private Handler handler;
private boolean isNewVersion; private boolean isNewVersion;
MessageReceiver mReceiver = new MessageReceiver();
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ResCheckTask(Context context, ResCheckListener listener) { public ResCheckTask(Context context, ResCheckListener listener) {
...@@ -170,6 +171,10 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -170,6 +171,10 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
IOUtils.copyFilesFromAssets(mContext, getDatapath(Constants.CORE_EXPANSIONS), IOUtils.copyFilesFromAssets(mContext, getDatapath(Constants.CORE_EXPANSIONS),
mSettings.getExpansionsPath().getAbsolutePath(), true, needsUpdate); mSettings.getExpansionsPath().getAbsolutePath(), true, needsUpdate);
} }
//checkWindbot();
han.sendEmptyMessage(0);
} catch (Exception e) { } catch (Exception e) {
if (Constants.DEBUG) if (Constants.DEBUG)
Log.e(TAG, "check", e); Log.e(TAG, "check", e);
...@@ -320,4 +325,49 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -320,4 +325,49 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
public interface ResCheckListener { public interface ResCheckListener {
void onResCheckFinished(int result, boolean isNewVersion); void onResCheckFinished(int result, boolean isNewVersion);
} }
public void unregisterMReceiver(){
mContext.unregisterReceiver(mReceiver);
}
public void checkWindbot() {
Log.i("路径", mContext.getFilesDir().getPath());
Log.i("路径2", mSettings.getDataBasePath() + "/" + DATABASE_NAME);
try {
WindBot.initAndroid(mContext.getFilesDir().getPath(), mSettings.getDataBasePath() + "/" + DATABASE_NAME);
}catch (Throwable e){
e.printStackTrace();
}
MessageReceiver mReceiver = new MessageReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction("RUN_WINDBOT");
mContext.registerReceiver(mReceiver, filter);
}
public class MessageReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals("RUN_WINDBOT")) {
String args = intent.getStringExtra("args");
WindBot.runAndroid(args);
}
}
}
Handler han = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO: Implement this method
super.handleMessage(msg);
switch (msg.what) {
case 0:
checkWindbot();
break;
}
}
};
} }
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