大致完成模拟器游戏下载、模拟器下载与安装

This commit is contained in:
张玉久
2020-10-16 17:15:51 +08:00
parent 93126517b6
commit b1079e84d8
24 changed files with 560 additions and 257 deletions

View File

@ -6,12 +6,11 @@ import android.text.TextUtils;
import android.widget.TextView;
import com.gh.common.constant.Config;
import com.gh.common.emulator.EmulatorGameManager;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.ApkLink;
import com.gh.gamecenter.entity.EmulatorGameEntity;
import com.gh.gamecenter.entity.GameCollectionEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
@ -118,12 +117,10 @@ public class GameUtils {
installCount++;
}
}
// TODO: 修改后缀
apkEntity.setFormat("nes");
if (EmulatorGameManager.isEmulatorGame(apkEntity.getFormat())) {
EmulatorGameEntity emulatorGameEntity = EmulatorGameManager.findGameByName(gameEntity.getName());
if (emulatorGameEntity != null) {
boolean isInstalled = PackageUtils.isInstalled(context, apkEntity.getPackageName());
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
DownloadEntity simulatorDownloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apkEntity.getUrl());
if (simulatorDownloadEntity != null && gameEntity.getSimulator() != null) {
boolean isInstalled = PackageUtils.isInstalled(context, gameEntity.getSimulator().getApk().getPackageName());
if (isInstalled) {
installCount++;
} else {
@ -132,15 +129,15 @@ public class GameUtils {
}
}
}
if (doneCount != 0) {
return context.getString(R.string.install);
} else if (pluginCount != 0) {
return context.getString(R.string.pluggable);
} else if (updateCount != 0) {
return context.getString(R.string.update);
} else if (installCount != 0) {
if (installCount != 0) {
return context.getString(R.string.launch);
} else if (gameEntity.getVersionNumber().contains("无版号") && Config.isGameDomeSwitchOpen()) {
} else if (pluginCount != 0 && !SimulatorGameManager.isSimulatorGame(gameEntity)) {
return context.getString(R.string.pluggable);
} else if (updateCount != 0 && !SimulatorGameManager.isSimulatorGame(gameEntity)) {
return context.getString(R.string.update);
} else if (doneCount != 0) {
return context.getString(R.string.install);
} else if (gameEntity.getVersionNumber().contains("无版号") && Config.isGameDomeSwitchOpen() && !SimulatorGameManager.isSimulatorGame(gameEntity)) {
return context.getString(R.string.attempt);
} else {
return context.getString(R.string.download);