Commit 7f6e461c authored by 247321453's avatar 247321453

监听游戏暂停状态

parent 8f484a26
......@@ -150,9 +150,7 @@ bool DataManager::Error(spmemvfs_db_t* pDB, sqlite3_stmt* pStmt, int errNo) {
if(pStmt)
sqlite3_finalize(pStmt);
int len = strlen(msg);
char buff[len+32];
sprintf(buff, "cdb Error code=%d,msg=%s", errNo, msg);
os::Printer::log(buff);
ALOGE("cdb Error code=%d,msg=%s", errNo, msg);
spmemvfs_close_db(pDB);
spmemvfs_env_fini();
return false;
......
......@@ -33,12 +33,68 @@ void Game::process(irr::SEvent &event) {
s32 y = event.MouseInput.Y;
event.MouseInput.X = optX(x);
event.MouseInput.Y = optY(y);
// __android_log_print(ANDROID_LOG_DEBUG, "ygo", "Android comman process %d,%d -> %d,%d", x, y,
// event.MouseInput.X, event.MouseInput.Y);
}
}
#ifdef _IRR_ANDROID_PLATFORM_
void Game::stopBGM() {
ALOGD("stop bgm");
gMutex.lock();
soundManager->StopBGM();
gMutex.unlock();
}
void Game::playBGM() {
ALOGV("play bgm");
gMutex.lock();
if(dInfo.isStarted) {
if(dInfo.isFinished && showcardcode == 1)
soundManager->PlayBGM(SoundManager::BGM::WIN);
else if(dInfo.isFinished && (showcardcode == 2 || showcardcode == 3))
soundManager->PlayBGM(SoundManager::BGM::LOSE);
else if(dInfo.lp[0] > 0 && dInfo.lp[0] <= dInfo.lp[1] / 2)
soundManager->PlayBGM(SoundManager::BGM::DISADVANTAGE);
else if(dInfo.lp[0] > 0 && dInfo.lp[0] >= dInfo.lp[1] * 2)
soundManager->PlayBGM(SoundManager::BGM::ADVANTAGE);
else
soundManager->PlayBGM(SoundManager::BGM::DUEL);
} else if(is_building) {
soundManager->PlayBGM(SoundManager::BGM::DECK);
} else {
soundManager->PlayBGM(SoundManager::BGM::MENU);
}
gMutex.unlock();
}
void Game::onHandleAndroidCommand(ANDROID_APP app, int32_t cmd){
switch (cmd)
{
case APP_CMD_PAUSE:
ALOGD("APP_CMD_PAUSE");
if(ygo::mainGame != nullptr){
ygo::mainGame->stopBGM();
}
break;
case APP_CMD_RESUME:
//第一次不一定调用
ALOGD("APP_CMD_RESUME");
if(ygo::mainGame != nullptr){
ygo::mainGame->playBGM();
}
break;
case APP_CMD_STOP:
case APP_CMD_INIT_WINDOW:
case APP_CMD_SAVE_STATE:
case APP_CMD_TERM_WINDOW:
case APP_CMD_GAINED_FOCUS:
case APP_CMD_LOST_FOCUS:
case APP_CMD_DESTROY:
case APP_CMD_WINDOW_RESIZED:
default:
break;
}
}
bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
this->appMain = app;
#endif
......@@ -76,6 +132,7 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
// logger->setLogLevel(ELL_WARNING);
isPSEnabled = options->isPendulumScaleEnabled();
dataManager.FileSystem = device->getFileSystem();
((CIrrDeviceAndroid*)device)->onAppCmd = onHandleAndroidCommand;
xScale = android::getXScale(app);
yScale = android::getYScale(app);
......@@ -112,9 +169,9 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
for(int i=0;i<len;i++){
io::path zip_path = zips[i];
if(dataManager.FileSystem->addFileArchive(zip_path.c_str(), false, false, EFAT_ZIP)) {
os::Printer::log("add arrchive ok ", zip_path.c_str());
ALOGD("add arrchive ok ", zip_path.c_str());
}else{
os::Printer::log("add arrchive fail ", zip_path.c_str());
ALOGW("add arrchive fail ", zip_path.c_str());
}
}
#endif
......@@ -174,15 +231,15 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
wchar_t wpath[1024];
BufferIO::DecodeUTF8(cdb_path.c_str(), wpath);
if(dataManager.LoadDB(wpath)) {
os::Printer::log("add cdb ok ", cdb_path.c_str());
ALOGD("add cdb ok ", cdb_path.c_str());
}else{
os::Printer::log("add cdb fail ", cdb_path.c_str());
ALOGW("add cdb fail ", cdb_path.c_str());
}
}
//if(!dataManager.LoadDB(workingDir.append("/cards.cdb").c_str()))
// return false;
if(dataManager.LoadStrings((workingDir + path("/expansions/strings.conf")).c_str())){
os::Printer::log("loadStrings expansions/strings.conf");
ALOGD("loadStrings expansions/strings.conf");
}
if(!dataManager.LoadStrings((workingDir + path("/strings.conf")).c_str()))
return false;
......@@ -195,7 +252,7 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
titleFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, (int)32 * yScale, isAntialias, true);
textFont = guiFont;
if(!numFont || !textFont) {
os::Printer::log("add font fail ");
ALOGW("add font fail ");
}
smgr = device->getSceneManager();
device->setWindowCaption(L"[---]");
......@@ -1291,6 +1348,7 @@ void Game::MainLoop() {
}
#endif
while(device->run()) {
ALOGV("game draw frame");
linePatternD3D = (linePatternD3D + 1) % 30;
linePatternGL = (linePatternGL << 1) | (linePatternGL >> 15);
atkframe += 0.1f;
......@@ -1317,16 +1375,6 @@ void Game::MainLoop() {
#endif
gMutex.lock();
if(dInfo.isStarted) {
if(dInfo.isFinished && showcardcode == 1)
soundManager->PlayBGM(SoundManager::BGM::WIN);
else if(dInfo.isFinished && (showcardcode == 2 || showcardcode == 3))
soundManager->PlayBGM(SoundManager::BGM::LOSE);
else if(dInfo.lp[0] > 0 && dInfo.lp[0] <= dInfo.lp[1] / 2)
soundManager->PlayBGM(SoundManager::BGM::DISADVANTAGE);
else if(dInfo.lp[0] > 0 && dInfo.lp[0] >= dInfo.lp[1] * 2)
soundManager->PlayBGM(SoundManager::BGM::ADVANTAGE);
else
soundManager->PlayBGM(SoundManager::BGM::DUEL);
DrawBackImage(imageManager.tBackGround);
DrawBackGround();
DrawCards();
......@@ -1335,14 +1383,12 @@ void Game::MainLoop() {
driver->setMaterial(irr::video::IdentityMaterial);
driver->clearZBuffer();
} else if(is_building) {
soundManager->PlayBGM(SoundManager::BGM::DECK);
DrawBackImage(imageManager.tBackGround_deck);
#ifdef _IRR_ANDROID_PLATFORM_
driver->enableMaterial2D(true);
DrawDeckBd();
driver->enableMaterial2D(false);
} else {
soundManager->PlayBGM(SoundManager::BGM::MENU);
DrawBackImage(imageManager.tBackGround_menu);
}
driver->enableMaterial2D(true);
......@@ -1351,13 +1397,15 @@ void Game::MainLoop() {
driver->enableMaterial2D(false);
#else
} else {
soundManager->PlayBGM(SoundManager::BGM::MENU);
DrawBackImage(imageManager.tBackGround_menu);
}
DrawGUI();
DrawSpec();
#endif
gMutex.unlock();
#ifdef _IRR_ANDROID_PLATFORM_
playBGM();
#endif
if(signalFrame > 0) {
signalFrame--;
if(!signalFrame)
......
......@@ -12,6 +12,14 @@
namespace ygo {
#ifdef _IRR_ANDROID_PLATFORM_
#define LOG_TAG "ygo-jni"
#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG ,__VA_ARGS__)
#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG ,__VA_ARGS__)
#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG ,__VA_ARGS__)
#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG ,__VA_ARGS__)
#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG ,__VA_ARGS__)
#endif
struct Config {
bool _init;
bool use_d3d;
......@@ -121,6 +129,8 @@ class Game :IProcessEventReceiver{
public:
#ifdef _IRR_ANDROID_PLATFORM_
void stopBGM();
void playBGM();
bool Initialize(ANDROID_APP app, android::InitOptions *options);
#else
bool Initialize();
......@@ -643,6 +653,7 @@ public:
s32 ogles2BlendTexture;
irr::android::CustomShaderConstantSetCallBack customShadersCallback;
Signal externalSignal;
static void onHandleAndroidCommand(ANDROID_APP app, int32_t cmd);
#endif
void setPositionFix(core::position2di fix){
InputFix = fix;
......
......@@ -64,7 +64,7 @@ int main(int argc, char* argv[]) {
*/
bool keep_on_return = false;
#ifdef _IRR_ANDROID_PLATFORM_
__android_log_print(ANDROID_LOG_WARN, "ygo", "handle args %d", argc);
ALOGD("handle args %d", argc);
//android
for(int i = 0; i < argc; ++i) {
const char* arg = argv[i].c_str();
......@@ -111,7 +111,7 @@ int main(int argc, char* argv[]) {
wchar_t fname[1024];
BufferIO::DecodeUTF8(name, fname);
index = GetListBoxIndex(ygo::mainGame->lstReplayList, fname);
__android_log_print(ANDROID_LOG_DEBUG, "ygo", "open replay file:index=%d, name=%s", index, name);
ALOGD("open replay file:index=%d, name=%s", index, name);
}
ygo::mainGame->HideElement(ygo::mainGame->wMainMenu);
ClickButton(ygo::mainGame->btnReplayMode);
......@@ -138,7 +138,7 @@ int main(int argc, char* argv[]) {
wchar_t fname[1024];
BufferIO::DecodeUTF8(name, fname);
index = GetListBoxIndex(ygo::mainGame->lstSinglePlayList, fname);
__android_log_print(ANDROID_LOG_DEBUG, "ygo", "open single file:index=%d, name=%s", index, name);
ALOGD("open single file:index=%d, name=%s", index, name);
}
if(index >= 0){
ygo::mainGame->lstSinglePlayList->setSelected(index);
......
......@@ -285,9 +285,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
prev_operation = id;
prev_sel = sel;
#if defined(_IRR_ANDROID_PLATFORM_)
__android_log_print(ANDROID_LOG_DEBUG, "ygo", "1share replay file=%s", name);
ALOGD("1share replay file=%s", name);
android::OnShareFile(mainGame->appMain, "yrp", name);
__android_log_print(ANDROID_LOG_DEBUG, "ygo", "2after share replay file:index=%d", sel);
ALOGD("2after share replay file:index=%d", sel);
#endif
break;
}
......
......@@ -200,7 +200,9 @@ E_DEVICE_TYPE CIrrDeviceAndroid::getType() const
void CIrrDeviceAndroid::handleAndroidCommand(ANDROID_APP app, int32_t cmd)
{
CIrrDeviceAndroid* device = (CIrrDeviceAndroid*)app->userData;
if(device->onAppCmd != nullptr){
device->onAppCmd(app, cmd);
}
switch (cmd)
{
case APP_CMD_SAVE_STATE:
......
......@@ -58,6 +58,19 @@ namespace irr
core::array<EKEY_CODE> KeyMap;
bool isPaused(){
return Paused;
}
bool isFocused(){
return Focused;
}
bool isDestroy(){
return !Initialized;
}
void (*onAppCmd)(struct android_app* app, int32_t cmd) = nullptr;
private:
static void handleAndroidCommand(ANDROID_APP app, int32_t cmd);
......
......@@ -8,6 +8,7 @@
#include <android_native_app_glue.h>
#include <signal.h>
#include <android/log.h>
#include <Android/CIrrDeviceAndroid.h>
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "ygomobile-native", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "ygomobile-native", __VA_ARGS__))
......
......@@ -297,7 +297,7 @@ static void* join_game_thread(void* param) {
JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeSetInputFix(
JNIEnv* env, jclass clazz, jlong handle, jint x, jint y) {
if(ygo::mainGame) {
__android_log_print(ANDROID_LOG_INFO, "ygo", "setInputFix posX=%d, posY=%d", x, y);
ALOGD("setInputFix posX=%d, posY=%d", x, y);
ygo::mainGame->setPositionFix(core::position2di(x, y));
}
}
......
......@@ -9,9 +9,7 @@
<application>
<activity
android:name="cn.garymb.ygomobile.YGOMobileActivity"
android:clearTaskOnLaunch="true"
android:configChanges="orientation|keyboardHidden|screenSize"
android:excludeFromRecents="true"
android:exported="true"
android:label="YGOMobile"
android:process=":game"
......
......@@ -16,19 +16,15 @@ public class GameReceiver extends BroadcastReceiver {
if (ACTION_START.equals(action)) {
//
IrrlichtBridge.gPid = intent.getIntExtra(IrrlichtBridge.EXTRA_PID, 0);
// Log.w("ygo", "pid=" + IrrlichtBridge.gPid);
} else if (ACTION_STOP.equals(action)) {
int pid = intent.getIntExtra(IrrlichtBridge.EXTRA_PID, 0);
if (pid == 0 && IrrlichtBridge.gPid != 0) {
pid = IrrlichtBridge.gPid;
// Log.w("ygo", "will kill last pid=" + pid);
}
if (pid == 0) {
pid = android.os.Process.myPid();
// Log.w("ygo", "will kill now pid=" + pid);
}
try {
// Log.w("ygo", "kill pid=" + pid);
android.os.Process.killProcess(pid);
} catch (Exception e) {
//ignore
......
......@@ -89,6 +89,7 @@ public class YGOMobileActivity extends NativeActivity implements
private boolean replaced = false;
private static boolean USE_SURFACE = true;
private String[] mArgV;
private boolean onGameExiting;
// public static int notchHeight;
......@@ -291,7 +292,6 @@ public class YGOMobileActivity extends NativeActivity implements
int h = (int) app().getScreenWidth();
int spX = (int) ((w - size[0]) / 2.0f);
int spY = (int) ((h - size[1]) / 2.0f);
// Log.i("ygo", "Android command 1:posX=" + spX + ",posY=" + spY);
boolean update = false;
synchronized (this) {
if (spX != mPositionX || spY != mPositionY) {
......@@ -301,7 +301,6 @@ public class YGOMobileActivity extends NativeActivity implements
}
}
if (update) {
// Log.i("ygo", "Android command setInputFix2:posX=" + spX + ",posY=" + spY);
IrrlichtBridge.setInputFix(mPositionX, mPositionY);
}
}
......@@ -548,15 +547,26 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public void onGameExit() {
if(onGameExiting){
return;
}
onGameExiting = true;
Log.e("ygomobile", "game exit");
Intent intent = new Intent("ygomobile.intent.action.GAME");
final Intent intent = new Intent("ygomobile.intent.action.GAME");
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intent.putExtra("game_exit_time", System.currentTimeMillis());
intent.setPackage(getPackageName());
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
startActivity(intent);
} catch (Throwable ignore) {}
finishAndRemoveTask();
Process.killProcess(Process.myPid());
}
});
}
}
......@@ -17,6 +17,8 @@ import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
import cn.garymb.ygodata.YGOGameOptions;
import static cn.garymb.ygomobile.utils.ByteUtils.byte2int;
import static cn.garymb.ygomobile.utils.ByteUtils.byte2uint;
......
......@@ -37,10 +37,12 @@ android {
buildTypes {
debug {
debuggable false
buildConfigField 'boolean', 'DEBUG_MODE', 'true'
}
release {
shrinkResources false
minifyEnabled false
buildConfigField 'boolean', 'DEBUG_MODE', 'false'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
......
......@@ -15,12 +15,12 @@
android:usesCleartextTraffic="true"
android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:taskAffinity="cn.garymb.ygomobile.task"
tools:replace="android:allowBackup,android:supportsRtl"
tools:targetApi="m">
<activity
android:name="cn.garymb.ygomobile.ui.activities.LogoActivity"
android:excludeFromRecents="false"
android:taskAffinity="cn.garymb.logo"
android:theme="@style/TranslucentTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -33,14 +33,18 @@
</activity>
<activity
android:name="com.tencent.bugly.beta.ui.BetaActivity"
android:launchMode="singleTop"
android:configChanges="keyboardHidden|orientation|screenSize|locale"
android:excludeFromRecents="true"/>
<activity
android:name="cn.garymb.ygomobile.ui.home.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:excludeFromRecents="false"
android:exported="true"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:stateNotNeeded="true"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<intent-filter>
......@@ -119,6 +123,11 @@
android:name="cn.garymb.ygomobile.YGOMobileActivity"
android:theme="@style/AppTheme.Game"
tools:replace="android:theme" />
<receiver
android:name="cn.garymb.ygomobile.GameReceiver"
android:enabled="false" />
<activity
android:name="cn.garymb.ygomobile.ui.preference.SettingsActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
......@@ -187,11 +196,6 @@
<activity
android:name="cn.garymb.ygomobile.ui.activities.PermissionsActivity"
android:theme="@style/TranslucentTheme"/>
<activity
android:name="com.tencent.bugly.beta.ui.BetaActivity"
android:configChanges="keyboardHidden|orientation|screenSize|locale"
android:theme="@android:style/Theme.Translucent" />
<meta-data
android:name="BUGLY_APPID"
android:value="${APP_ID}" />
......
......@@ -18,7 +18,9 @@ import com.tencent.bugly.beta.Beta;
import com.yuyh.library.imgsel.ISNav;
import com.yuyh.library.imgsel.common.ImageLoader;
import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.home.MainActivity;
import cn.garymb.ygomobile.utils.CrashHandler;
public class App extends GameApplication {
......@@ -153,6 +155,12 @@ public class App extends GameApplication {
Beta.strToastYourAreTheLatestVersion = this.getString(R.string.Already_Lastest);
Beta.strToastCheckingUpgrade = this.getString(R.string.Checking_Update);
Beta.upgradeDialogLayoutId = R.layout.dialog_upgrade;
Beta.enableHotfix = false;
Beta.autoCheckHotfix = false;
Beta.autoCheckUpgrade = false;
Beta.autoCheckAppUpgrade = false;
//添加可显示弹窗的Activity
Beta.canShowUpgradeActs.add(MainActivity.class);
ApplicationInfo appInfo = null;
try {
appInfo = this.getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
......@@ -160,6 +168,6 @@ public class App extends GameApplication {
e.printStackTrace();
}
String msg = appInfo.metaData.getString("BUGLY_APPID");
Bugly.init(this, msg, true);
Bugly.init(this, msg, BuildConfig.DEBUG_MODE);
}
}
......@@ -678,4 +678,8 @@ public class AppsSettings {
// Log.i("kk", "saveTemp:" + array);
mSharedPreferences.putString(Constants.PREF_LAST_ROOM_LIST, array.toString());
}
public boolean isAutoCheckUpdate(){
return true;//mSharedPreferences.getBoolean(Constants.PREF_CHECK_UPDATE, false);
}
}
......@@ -222,4 +222,6 @@ public interface Constants {
//打开ydk,是否复制到文件夹
boolean COPY_YDK_FILE = false;
String TAG = "ygo-java";
}
......@@ -47,7 +47,7 @@ public class GameUriManager {
}
public boolean doIntent(Intent intent) {
Log.i("ygo", "doIntent");
Log.i(Constants.TAG, "doIntent");
if (ACTION_OPEN_DECK.equals(intent.getAction())) {
if (intent.getData() != null) {
doUri(intent.getData());
......@@ -85,7 +85,7 @@ public class GameUriManager {
private String getPathName(String path, boolean withOutEx) {
Log.d("ygo", "path=" + path);
Log.d(Constants.TAG, "path=" + path);
if (path != null) {
int index = path.lastIndexOf("/");
if (index > 0) {
......@@ -146,11 +146,11 @@ public class GameUriManager {
}
try {
if (!remoteFile.canRead()) {
Log.w("ygo", "don't read file " + remoteFile.getAbsolutePath());
Log.w(Constants.TAG, "don't read file " + remoteFile.getAbsolutePath());
return null;
}
} catch (Throwable e) {
Log.e("ygo", "don't read file " + remoteFile.getAbsolutePath(), e);
Log.e(Constants.TAG, "don't read file " + remoteFile.getAbsolutePath(), e);
return null;
}
}
......@@ -169,11 +169,11 @@ public class GameUriManager {
local = new File(AppsSettings.get().getResourcePath() + "/temp", name);
}
if (local.exists()) {
Log.w("ygo", "Overwrite file "+local.getAbsolutePath());
Log.w(Constants.TAG, "Overwrite file "+local.getAbsolutePath());
}
if(remoteFile != null && TextUtils.equals(remoteFile.getAbsolutePath(), local.getAbsolutePath())){
//is same path
Log.i("ygo", "is same file " + remoteFile.getAbsolutePath() + "==" + local.getAbsolutePath());
Log.i(Constants.TAG, "is same file " + remoteFile.getAbsolutePath() + "==" + local.getAbsolutePath());
return local;
}
//copy
......@@ -192,7 +192,7 @@ public class GameUriManager {
FileUtils.copyFile(input, local);
}
} catch (Throwable e) {
Log.w("ygo", "copy file " + path + "->" + local.getAbsolutePath(), e);
Log.w(Constants.TAG, "copy file " + path + "->" + local.getAbsolutePath(), e);
return null;
} finally {
IOUtils.close(input);
......@@ -213,7 +213,7 @@ public class GameUriManager {
boolean isYpk = file.getName().toLowerCase(Locale.US).endsWith(".ypk");
boolean isYrp = file.getName().toLowerCase(Locale.US).endsWith(".yrp");
boolean isLua = file.getName().toLowerCase(Locale.US).endsWith(".lua");
Log.i("ygo", "open file:" + uri + "->" + file.getAbsolutePath());
Log.i(Constants.TAG, "open file:" + uri + "->" + file.getAbsolutePath());
if(isYdk){
Intent intent = new Intent(getActivity(), DeckManagerActivity.getDeckManager());
intent.putExtra(Intent.EXTRA_TEXT, file.getAbsolutePath());
......@@ -231,14 +231,14 @@ public class GameUriManager {
YGOStarter.startGame(getActivity(), null, "-r", file.getName());
Toast.makeText(activity, activity.getString(R.string.yrp_installed), Toast.LENGTH_LONG).show();
} else {
Log.w("ygo", "game is running");
Log.w(Constants.TAG, "game is running");
}
} else if(isLua){
if (!YGOStarter.isGameRunning(getActivity())) {
YGOStarter.startGame(getActivity(), null, "-s", file.getName());
Toast.makeText(activity, "load single lua file", Toast.LENGTH_LONG).show();
} else {
Log.w("ygo", "game is running");
Log.w(Constants.TAG, "game is running");
}
}
} else {
......
......@@ -12,6 +12,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.view.Gravity;
import android.view.Menu;
......@@ -143,8 +144,15 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
};
//x5内核初始化接口
QbSdk.initX5Environment(this, cb);
if(AppsSettings.get().isAutoCheckUpdate()) {
if (!"ygomobile.intent.action.GAME".equals(getIntent().getAction())) {
Log.d("kk-test", "start check update");
//check update
Beta.checkUpgrade(false, false);
} else {
Log.d("kk-test", "skip check update");
}
}
//初始化决斗助手
initDuelAssistant();
//萌卡
......
......@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import androidx.core.content.FileProvider;
import java.io.BufferedReader;
import java.io.Console;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
......@@ -19,6 +20,8 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import cn.garymb.ygomobile.Constants;
public class FileUtils {
......@@ -116,7 +119,7 @@ public class FileUtils {
outputStream = new FileOutputStream(out);
copy(inputStream, outputStream);
} catch (Throwable e) {
Log.e("ygo", "copy file", e);
Log.e(Constants.TAG, "copy file", e);
return false;
} finally {
IOUtils.close(outputStream);
......
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