Commit 093a1b08 authored by fallenstardust's avatar fallenstardust Committed by GitHub

Merge branch 'master' into patch-1

parents 2e5dbd48 907a7c0a
...@@ -586,12 +586,29 @@ void Game::DrawMisc() { ...@@ -586,12 +586,29 @@ void Game::DrawMisc() {
//driver->draw2DImage(imageManager.tLPFrame, recti(400 * mainGame->xScale, 10 * mainGame->yScale, 629 * mainGame->xScale, 30 * mainGame->yScale), recti(0, 0, 200, 20), 0, 0, true); //driver->draw2DImage(imageManager.tLPFrame, recti(400 * mainGame->xScale, 10 * mainGame->yScale, 629 * mainGame->xScale, 30 * mainGame->yScale), recti(0, 0, 200, 20), 0, 0, true);
//driver->draw2DImage(imageManager.tLPFrame, recti(691 * mainGame->xScale, 10 * mainGame->yScale, 920 * mainGame->xScale, 30 * mainGame->yScale), recti(0, 0, 200, 20), 0, 0, true); //driver->draw2DImage(imageManager.tLPFrame, recti(691 * mainGame->xScale, 10 * mainGame->yScale, 920 * mainGame->xScale, 30 * mainGame->yScale), recti(0, 0, 200, 20), 0, 0, true);
if(dInfo.start_lp) { if(dInfo.start_lp) {
if(dInfo.lp[0] >= dInfo.start_lp) auto maxLP = dInfo.isTag ? dInfo.start_lp / 2 : dInfo.start_lp;
driver->draw2DImage(imageManager.tLPBar, recti(390 * mainGame->xScale, 12 * mainGame->yScale, 625 * mainGame->xScale, 74 * mainGame->yScale), recti(0, 0, 60, 60), 0, 0, true); if(dInfo.lp[0] >= maxLP) {
else driver->draw2DImage(imageManager.tLPBar, recti(390 * mainGame->xScale, 12 * mainGame->yScale, (390 + 235 * dInfo.lp[0] / dInfo.start_lp) * mainGame->xScale, 74 * mainGame->yScale), recti(0, 0, 60, 60), 0, 0, true); auto layerCount = dInfo.lp[0] / maxLP;
if(dInfo.lp[1] >= dInfo.start_lp) auto partialLP = dInfo.lp[0] % maxLP;
driver->draw2DImage(imageManager.tLPBar, recti(695 * mainGame->xScale, 12 * mainGame->yScale, 930 * mainGame->xScale, 74 * mainGame->yScale), recti(0, 0, 60, 60), 0, 0, true); auto bgColorPos = (layerCount - 1) % 5;
else driver->draw2DImage(imageManager.tLPBar, recti((930 - 235 * dInfo.lp[1] / dInfo.start_lp) * mainGame->xScale, 12 * mainGame->yScale, 930 * mainGame->xScale, 74 * mainGame->yScale), recti(0, 0, 60, 60), 0, 0, true); auto fgColorPos = layerCount % 5;
driver->draw2DImage(imageManager.tLPBar, recti((390 + 235 * partialLP / maxLP) * mainGame->xScale, 12 * mainGame->yScale, 625 * mainGame->xScale, 74 * mainGame->yScale), recti(0, bgColorPos * 60, 60, (bgColorPos + 1) * 60), 0, 0, true);
if(partialLP > 0) {
driver->draw2DImage(imageManager.tLPBar, recti(390* mainGame->xScale, 12 * mainGame->yScale, (390 + 235 * partialLP / maxLP) * mainGame->xScale, 74 * mainGame->yScale), recti(0, fgColorPos * 60, 60, (fgColorPos + 1) * 60), 0, 0, true);
}
}
else driver->draw2DImage(imageManager.tLPBar, recti(390 * mainGame->xScale, 12 * mainGame->yScale, (390 + 235 * dInfo.lp[0] / maxLP) * mainGame->xScale, 74 * mainGame->yScale), recti(0, 0, 60, 60), 0, 0, true);
if(dInfo.lp[1] >= maxLP) {
auto layerCount = dInfo.lp[1] / maxLP;
auto partialLP = dInfo.lp[1] % maxLP;
auto bgColorPos = (layerCount - 1) % 5;
auto fgColorPos = layerCount % 5;
driver->draw2DImage(imageManager.tLPBar, recti(695 * mainGame->xScale, 12 * mainGame->yScale, (930 - 235 * partialLP / maxLP) * mainGame->xScale, 74 * mainGame->yScale), recti(0, bgColorPos * 60, 60, (bgColorPos + 1) * 60), 0, 0, true);
if(partialLP > 0) {
driver->draw2DImage(imageManager.tLPBar, recti((930 - 235 * partialLP / maxLP) * mainGame->xScale, 12 * mainGame->yScale, 930 * mainGame->xScale, 74 * mainGame->yScale), recti(0, fgColorPos * 60, 60, (fgColorPos + 1) * 60), 0, 0, true);
}
}
else driver->draw2DImage(imageManager.tLPBar, recti((930 - 235 * dInfo.lp[1] / maxLP) * mainGame->xScale, 12 * mainGame->yScale, 930 * mainGame->xScale, 74 * mainGame->yScale), recti(0, 0, 60, 60), 0, 0, true);
} }
if(lpframe) { if(lpframe) {
dInfo.lp[lpplayer] -= lpd; dInfo.lp[lpplayer] -= lpd;
......
...@@ -2182,7 +2182,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2182,7 +2182,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
if (panel_confirm.size()) { if (panel_confirm.size() && mainGame->dInfo.player_type != 7) {
std::sort(panel_confirm.begin(), panel_confirm.end(), ClientCard::client_card_sort); std::sort(panel_confirm.begin(), panel_confirm.end(), ClientCard::client_card_sort);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.selectable_cards = panel_confirm; mainGame->dField.selectable_cards = panel_confirm;
......
...@@ -1757,11 +1757,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1757,11 +1757,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EMIE_LMOUSE_PRESSED_DOWN: { case irr::EMIE_LMOUSE_PRESSED_DOWN: {
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
if(mainGame->wCardSelect->isVisible()) //if(mainGame->wCardSelect->isVisible())
break; //break;
if (mainGame->wQuery->isVisible() || mainGame->wANAttribute->isVisible() if (mainGame->wQuery->isVisible() || mainGame->wANAttribute->isVisible()
|| mainGame->wANCard->isVisible() || mainGame->wANNumber->isVisible() || mainGame->wANCard->isVisible() || mainGame->wANNumber->isVisible()
|| mainGame->wCardSelect->isVisible() || mainGame->wCardSelect->isVisible()|| mainGame->wCardDisplay->isVisible()
||mainGame->wOptions->isVisible()){ ||mainGame->wOptions->isVisible()){
display_cards.clear(); display_cards.clear();
int loc_id = 0; int loc_id = 0;
......
...@@ -27,7 +27,7 @@ bool ImageManager::Initial(const path dir) { ...@@ -27,7 +27,7 @@ bool ImageManager::Initial(const path dir) {
tSelFieldLinkArrows[8] = driver->getTexture((dir + path("/textures/link_marker_on_8.png")).c_str()); tSelFieldLinkArrows[8] = driver->getTexture((dir + path("/textures/link_marker_on_8.png")).c_str());
tSelFieldLinkArrows[9] = driver->getTexture((dir + path("/textures/link_marker_on_9.png")).c_str()); tSelFieldLinkArrows[9] = driver->getTexture((dir + path("/textures/link_marker_on_9.png")).c_str());
tNumber = driver->getTexture((dir + path("/textures/number.png")).c_str()); tNumber = driver->getTexture((dir + path("/textures/number.png")).c_str());
tLPBar = driver->getTexture((dir + path("/textures/lp2.png")).c_str()); tLPBar = driver->getTexture((dir + path("/textures/lp3.png")).c_str());
tLPFrame = driver->getTexture((dir + path("/textures/lpf.png")).c_str()); tLPFrame = driver->getTexture((dir + path("/textures/lpf.png")).c_str());
tMask = driver->getTexture((dir + path("/textures/mask.png")).c_str()); tMask = driver->getTexture((dir + path("/textures/mask.png")).c_str());
tEquip = driver->getTexture((dir + path("/textures/equip.png")).c_str()); tEquip = driver->getTexture((dir + path("/textures/equip.png")).c_str());
......
...@@ -194,6 +194,11 @@ Name=玻璃女巫 Deck=Witchcraft Dialog=verre.zh-CN ...@@ -194,6 +194,11 @@ Name=玻璃女巫 Deck=Witchcraft Dialog=verre.zh-CN
魔女术卡组。 魔女术卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!神数不神-刹帝利
Name=神数不神 Deck=Kashtira Dialog=Zefra.zh-CN
俱舍怒威族卡组。
AI_LV3 SUPPORT_MASTER_RULE_2020
![狂野模式]神数不神-雷龙 ![狂野模式]神数不神-雷龙
Name=神数不神 Deck=ThunderDragon Dialog=Zefra.zh-CN Name=神数不神 Deck=ThunderDragon Dialog=Zefra.zh-CN
深渊混沌雷龙卡组。 深渊混沌雷龙卡组。
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
27204311 27204311
27204311 27204311
82385847 82385847
14532163 20899496
20899496 20899496
20899496 20899496
69946549 69946549
......
#created by ...
#main
27204311
68304193
68304193
68304193
32909498
32909498
32909498
4928565
78534861
78534861
91800273
91800273
72090076
31149212
31149212
31149212
14558127
14558127
14558127
23434538
23434538
31480215
34447918
34447918
34447918
73628505
84211599
84211599
24224830
24224830
65681983
69540484
69540484
69540484
71832012
71832012
71832012
10045474
10045474
33925864
#extra
15291624
27548199
21915012
48626373
48626373
95474755
95474755
95474755
10389142
73542331
73542331
21887175
44097050
22423493
65741786
!side
...@@ -185,7 +185,7 @@ Red-Eyes Dark Dragoon Deck ...@@ -185,7 +185,7 @@ Red-Eyes Dark Dragoon Deck
AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!Smart-FiberAuroradon BravePhenix !Smart-FiberAuroradon BravePhenix
Name=Smart Deck=Brave Dialog=smart.zh-CN Name=Smart Deck=Brave Dialog=default
Good staff Brave Phenix with Halqifiberax and Auroradon Good staff Brave Phenix with Halqifiberax and Auroradon
AI_LV3 SUPPORT_MASTER_RULE_2020 AI_LV3 SUPPORT_MASTER_RULE_2020
...@@ -194,7 +194,12 @@ Name=Madame Verre Deck=Witchcraft Dialog=default ...@@ -194,7 +194,12 @@ Name=Madame Verre Deck=Witchcraft Dialog=default
Witchcraft Deck Witchcraft Deck
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!Zefra Never be Inmmortal-Thunder Dragon !Zeframortal-Kashtira
Name=Zefra Never be Inmmortal Deck=ThunderDragon Dialog=Zefra.zh-CN Name=Zeframortal Deck=Kashtira Dialog=default
The Byssted Thunder Dragon Kashtira Deck
AI_LV3 SUPPORT_MASTER_RULE_2020
!Zeframortal-Thunder Dragon
Name=Zeframortal Deck=ThunderDragon Dialog=default
The Byssted Thunder Dragon Deck
SUPPORT_MASTER_RULE_2020 SUPPORT_MASTER_RULE_2020
\ No newline at end of file
...@@ -194,6 +194,11 @@ Name=베레 Deck=Witchcraft Dialog=verre.kor ...@@ -194,6 +194,11 @@ Name=베레 Deck=Witchcraft Dialog=verre.kor
위치크래프트 덱입니다. (마스터 룰3|신 마스터 룰|마스터 룰 개정판 사용 가능) 위치크래프트 덱입니다. (마스터 룰3|신 마스터 룰|마스터 룰 개정판 사용 가능)
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!세피라-Kashtira
Name=세피라 Deck=Kashtira Dialog=Zefra.kor
Kashtira Deck
SUPPORT_MASTER_RULE_2020
![하드 모드]세피라-썬더 드래곤 ![하드 모드]세피라-썬더 드래곤
Name=세피라 Deck=ThunderDragon Dialog=Zefra.kor Name=세피라 Deck=ThunderDragon Dialog=Zefra.kor
심연 카오스 썬더 드래곤 덱입니다. (싱글 모드의 AI 덱은 사용하는 카드 풀이 리미트 레귤레이션에 대응하는 것이지만, 하드 모드에서는 AI 덱은 리미트 레귤레이션에 대응하지 않습니다.) 심연 카오스 썬더 드래곤 덱입니다. (싱글 모드의 AI 덱은 사용하는 카드 풀이 리미트 레귤레이션에 대응하는 것이지만, 하드 모드에서는 AI 덱은 리미트 레귤레이션에 대응하지 않습니다.)
......
package cn.garymb.ygomobile; package cn.garymb.ygomobile;
import static cn.garymb.ygomobile.Constants.ASSETS_EN;
import static cn.garymb.ygomobile.Constants.ASSETS_KOR;
import static cn.garymb.ygomobile.Constants.BOT_CONF;
import static cn.garymb.ygomobile.Constants.CORE_BOT_CONF_PATH;
import static cn.garymb.ygomobile.Constants.CORE_DECK_PATH; import static cn.garymb.ygomobile.Constants.CORE_DECK_PATH;
import static cn.garymb.ygomobile.Constants.CORE_EXPANSIONS; import static cn.garymb.ygomobile.Constants.CORE_EXPANSIONS;
import static cn.garymb.ygomobile.Constants.CORE_LIMIT_PATH;
import static cn.garymb.ygomobile.Constants.CORE_PACK_PATH; import static cn.garymb.ygomobile.Constants.CORE_PACK_PATH;
import static cn.garymb.ygomobile.Constants.CORE_REPLAY_PATH; import static cn.garymb.ygomobile.Constants.CORE_REPLAY_PATH;
import static cn.garymb.ygomobile.Constants.CORE_SINGLE_PATH;
import static cn.garymb.ygomobile.Constants.CORE_STRING_PATH;
import static cn.garymb.ygomobile.Constants.CORE_SYSTEM_PATH; import static cn.garymb.ygomobile.Constants.CORE_SYSTEM_PATH;
import static cn.garymb.ygomobile.Constants.DATABASE_NAME;
import static cn.garymb.ygomobile.Constants.DEF_PREF_FONT_SIZE; import static cn.garymb.ygomobile.Constants.DEF_PREF_FONT_SIZE;
import static cn.garymb.ygomobile.Constants.DEF_PREF_KEEP_SCALE; import static cn.garymb.ygomobile.Constants.DEF_PREF_KEEP_SCALE;
import static cn.garymb.ygomobile.Constants.DEF_PREF_NOTCH_HEIGHT; import static cn.garymb.ygomobile.Constants.DEF_PREF_NOTCH_HEIGHT;
...@@ -24,6 +32,7 @@ import static cn.garymb.ygomobile.Constants.PREF_WINDOW_TOP_BOTTOM; ...@@ -24,6 +32,7 @@ import static cn.garymb.ygomobile.Constants.PREF_WINDOW_TOP_BOTTOM;
import static cn.garymb.ygomobile.Constants.WINDBOT_DECK_PATH; import static cn.garymb.ygomobile.Constants.WINDBOT_DECK_PATH;
import static cn.garymb.ygomobile.Constants.WINDBOT_PATH; import static cn.garymb.ygomobile.Constants.WINDBOT_PATH;
import static cn.garymb.ygomobile.Constants.YDK_FILE_EX; import static cn.garymb.ygomobile.Constants.YDK_FILE_EX;
import static cn.garymb.ygomobile.ui.home.ResCheckTask.getDatapath;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
...@@ -37,6 +46,7 @@ import androidx.annotation.Nullable; ...@@ -37,6 +46,7 @@ import androidx.annotation.Nullable;
import org.json.JSONArray; import org.json.JSONArray;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -47,6 +57,7 @@ import cn.garymb.ygomobile.lite.R; ...@@ -47,6 +57,7 @@ import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.settings.PreferenceFragmentPlus; import cn.garymb.ygomobile.ui.settings.PreferenceFragmentPlus;
import cn.garymb.ygomobile.utils.DeckUtil; import cn.garymb.ygomobile.utils.DeckUtil;
import cn.garymb.ygomobile.utils.DensityUtils; import cn.garymb.ygomobile.utils.DensityUtils;
import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.IOUtils; import cn.garymb.ygomobile.utils.IOUtils;
public class AppsSettings { public class AppsSettings {
...@@ -224,10 +235,10 @@ public class AppsSettings { ...@@ -224,10 +235,10 @@ public class AppsSettings {
} }
public File[] getExpansionFiles(){ public File[] getExpansionFiles() {
return new File(AppsSettings.get().getResourcePath(), Constants.CORE_EXPANSIONS) return new File(AppsSettings.get().getResourcePath(), Constants.CORE_EXPANSIONS)
.listFiles((file) -> { .listFiles((file) -> {
if(!file.isFile()){ if (!file.isFile()) {
return false; return false;
} }
String s_name = file.getName().toLowerCase(); String s_name = file.getName().toLowerCase();
...@@ -355,6 +366,23 @@ public class AppsSettings { ...@@ -355,6 +366,23 @@ public class AppsSettings {
mSharedPreferences.putString(Constants.PREF_IMAGE_QUALITY, "" + quality); mSharedPreferences.putString(Constants.PREF_IMAGE_QUALITY, "" + quality);
} }
/***
* 资料语言
*/
public void setDataLanguage(int language) {
mSharedPreferences.putString(Constants.PREF_DATA_LANGUAGE, "" + language);
}
/***
* 资料语言
*/
public int getDataLanguage() {
try {
return Integer.valueOf(mSharedPreferences.getString(Constants.PREF_DATA_LANGUAGE, "" + Constants.PREF_DEF_DATA_LANGUAGE));
} catch (Exception e) {
return Constants.PREF_DEF_DATA_LANGUAGE;
}
}
/** /**
* 根据卡密获取卡图的路径 * 根据卡密获取卡图的路径
...@@ -687,4 +715,68 @@ public class AppsSettings { ...@@ -687,4 +715,68 @@ public class AppsSettings {
// Log.i("kk", "saveTemp:" + array); // Log.i("kk", "saveTemp:" + array);
mSharedPreferences.putString(Constants.PREF_LAST_ROOM_LIST, array.toString()); mSharedPreferences.putString(Constants.PREF_LAST_ROOM_LIST, array.toString());
} }
public void copyCnData() throws IOException {
//复制数据库
copyCdbFile(getDatapath(DATABASE_NAME));
//复制游戏配置文件
IOUtils.copyFilesFromAssets(context, getDatapath("conf") + "/" + CORE_STRING_PATH, getResourcePath(), true);
IOUtils.copyFilesFromAssets(context, getDatapath("conf") + "/" + BOT_CONF, getResourcePath(), true);
//替换换行符
String stringConfPath = new File(AppsSettings.get().getResourcePath(), CORE_STRING_PATH).getAbsolutePath();
String botConfPath = new File(AppsSettings.get().getResourcePath(), BOT_CONF).getAbsolutePath();
fixString(stringConfPath);
fixString(botConfPath);
//设置语言为0=中文
AppsSettings.get().setDataLanguage(0);
}
public void copyKorData() throws IOException {
String korStringConf = ASSETS_KOR + getDatapath("conf") + "/" + CORE_STRING_PATH;
String korBotConf = ASSETS_KOR + getDatapath("conf") + "/" + CORE_BOT_CONF_PATH;
String korCdb = ASSETS_KOR + getDatapath(DATABASE_NAME);
//复制数据库
copyCdbFile(korCdb);
//复制游戏配置文件
IOUtils.copyFilesFromAssets(context, korStringConf, getResourcePath(), true);
IOUtils.copyFilesFromAssets(context, korBotConf, getResourcePath(), true);
//替换换行符
String stringConfPath = new File(AppsSettings.get().getResourcePath(), CORE_STRING_PATH).getAbsolutePath();
String botConfPath = new File(AppsSettings.get().getResourcePath(), BOT_CONF).getAbsolutePath();
fixString(stringConfPath);
fixString(botConfPath);
//设置语言为1=조선말
AppsSettings.get().setDataLanguage(1);
}
public void copyEnData() throws IOException {
String enStringConf = ASSETS_EN + getDatapath("conf") + "/" + CORE_STRING_PATH;
String enBotConf = ASSETS_EN + getDatapath("conf") + "/" + CORE_BOT_CONF_PATH;
String enCdb = ASSETS_EN + getDatapath(DATABASE_NAME);
//复制数据库
copyCdbFile(enCdb);
//复制人机资源
IOUtils.copyFilesFromAssets(context, getDatapath(Constants.WINDBOT_PATH), getResourcePath(), true);
//复制游戏配置文件
IOUtils.copyFilesFromAssets(context, enStringConf, getResourcePath(), true);
IOUtils.copyFilesFromAssets(context, enBotConf, getResourcePath(), true);
//替换换行符
String stringConfPath = new File(AppsSettings.get().getResourcePath(), CORE_STRING_PATH).getAbsolutePath();
String botConfPath = new File(AppsSettings.get().getResourcePath(), BOT_CONF).getAbsolutePath();
fixString(stringConfPath);
fixString(botConfPath);
//设置语言为2=English
AppsSettings.get().setDataLanguage(2);
}
private void fixString(String stringPath) {
List<String> lines = FileUtils.readLines(stringPath, Constants.DEF_ENCODING);
FileUtils.writeLines(stringPath, lines, Constants.DEF_ENCODING, "\n");
}
private void copyCdbFile(String cdbPath) throws IOException {
File dbFile = new File(getDataBasePath(), DATABASE_NAME);
if (dbFile.exists()) dbFile.delete();//如果数据库存在先删除
IOUtils.copyFilesFromAssets(context, cdbPath, getDataBasePath(), true);
}
} }
...@@ -20,6 +20,8 @@ public interface Constants { ...@@ -20,6 +20,8 @@ public interface Constants {
String PREF_IMAGE_QUALITY = "pref_key_game_image_quality"; String PREF_IMAGE_QUALITY = "pref_key_game_image_quality";
int PREF_DEF_IMAGE_QUALITY = 1; int PREF_DEF_IMAGE_QUALITY = 1;
String PREF_DATA_LANGUAGE = "pref_key_game_data_language";
int PREF_DEF_DATA_LANGUAGE = 0;
String PREF_GAME_FONT = "pref_key_game_font_name"; String PREF_GAME_FONT = "pref_key_game_font_name";
String PREF_USE_EXTRA_CARD_CARDS = "settings_game_diy_card_db"; String PREF_USE_EXTRA_CARD_CARDS = "settings_game_diy_card_db";
boolean PREF_DEF_USE_EXTRA_CARD_CARDS = true; boolean PREF_DEF_USE_EXTRA_CARD_CARDS = true;
......
...@@ -33,7 +33,6 @@ import androidx.cardview.widget.CardView; ...@@ -33,7 +33,6 @@ import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import com.ourygo.lib.duelassistant.listener.OnDuelAssistantListener; import com.ourygo.lib.duelassistant.listener.OnDuelAssistantListener;
import com.ourygo.lib.duelassistant.util.DuelAssistantManagement; import com.ourygo.lib.duelassistant.util.DuelAssistantManagement;
import com.ourygo.lib.duelassistant.util.Util; import com.ourygo.lib.duelassistant.util.Util;
...@@ -64,8 +63,8 @@ import cn.garymb.ygomobile.bean.Deck; ...@@ -64,8 +63,8 @@ import cn.garymb.ygomobile.bean.Deck;
import cn.garymb.ygomobile.bean.ServerInfo; import cn.garymb.ygomobile.bean.ServerInfo;
import cn.garymb.ygomobile.bean.ServerList; import cn.garymb.ygomobile.bean.ServerList;
import cn.garymb.ygomobile.bean.events.ServerInfoEvent; import cn.garymb.ygomobile.bean.events.ServerInfoEvent;
import cn.garymb.ygomobile.ex_card.ExCardActivity;
import cn.garymb.ygomobile.ex_card.ExCard; import cn.garymb.ygomobile.ex_card.ExCard;
import cn.garymb.ygomobile.ex_card.ExCardActivity;
import cn.garymb.ygomobile.lite.BuildConfig; import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.loader.ImageLoader; import cn.garymb.ygomobile.loader.ImageLoader;
......
...@@ -274,6 +274,9 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -274,6 +274,9 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
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), mSettings.getResourcePath(), needsUpdate);
//根据系统语言复制特定资料文件
String language = mContext.getResources().getConfiguration().locale.getLanguage(); String language = mContext.getResources().getConfiguration().locale.getLanguage();
Log.i(BuildConfig.VERSION_NAME,language); Log.i(BuildConfig.VERSION_NAME,language);
if(!language.isEmpty()){ if(!language.isEmpty()){
...@@ -297,22 +300,21 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -297,22 +300,21 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
return ERROR_NONE; return ERROR_NONE;
} }
private int copyCnData(Boolean needsUpdate) throws IOException { public int copyCnData(Boolean needsUpdate) throws IOException {
//复制数据库 //复制数据库
copyCdbFile(getDatapath(DATABASE_NAME), needsUpdate); copyCdbFile(getDatapath(DATABASE_NAME), needsUpdate);
//复制残局 //复制残局
setMessage(mContext.getString(R.string.check_things, mContext.getString(R.string.single_lua))); setMessage(mContext.getString(R.string.check_things, mContext.getString(R.string.single_lua)));
IOUtils.copyFilesFromAssets(mContext, getDatapath(CORE_SINGLE_PATH), mSettings.getSingleDir(), needsUpdate); IOUtils.copyFilesFromAssets(mContext, getDatapath(CORE_SINGLE_PATH), mSettings.getSingleDir(), needsUpdate);
//复制人机资源
IOUtils.copyFilesFromAssets(mContext, getDatapath(Constants.WINDBOT_PATH), mSettings.getResourcePath(), needsUpdate);
//复制游戏配置文件 //复制游戏配置文件
copyCoreConfig(getDatapath("conf") + "/" + CORE_STRING_PATH, copyCoreConfig(getDatapath("conf") + "/" + CORE_STRING_PATH,
getDatapath("conf") + "/" + BOT_CONF, getDatapath("conf") + "/" + BOT_CONF,
mSettings.getResourcePath(), needsUpdate); mSettings.getResourcePath(), needsUpdate);
AppsSettings.get().setDataLanguage(0);
return ERROR_NONE; return ERROR_NONE;
} }
private int copyEnData(Boolean needsUpdate) throws IOException { public int copyEnData(Boolean needsUpdate) throws IOException {
String enStringConf = ASSETS_EN + getDatapath("conf") + "/" + CORE_STRING_PATH; String enStringConf = ASSETS_EN + getDatapath("conf") + "/" + CORE_STRING_PATH;
String enBotConf = ASSETS_EN + getDatapath("conf") + "/" + CORE_BOT_CONF_PATH; String enBotConf = ASSETS_EN + getDatapath("conf") + "/" + CORE_BOT_CONF_PATH;
String enCdb = ASSETS_EN + getDatapath(DATABASE_NAME); String enCdb = ASSETS_EN + getDatapath(DATABASE_NAME);
...@@ -322,29 +324,25 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -322,29 +324,25 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
//复制残局 //复制残局
setMessage(mContext.getString(R.string.check_things, mContext.getString(R.string.single_lua))); setMessage(mContext.getString(R.string.check_things, mContext.getString(R.string.single_lua)));
IOUtils.copyFilesFromAssets(mContext, enSingle, mSettings.getSingleDir(), needsUpdate); IOUtils.copyFilesFromAssets(mContext, enSingle, mSettings.getSingleDir(), needsUpdate);
//复制人机资源
IOUtils.copyFilesFromAssets(mContext, getDatapath(Constants.WINDBOT_PATH), mSettings.getResourcePath(), needsUpdate);
//复制游戏配置文件 //复制游戏配置文件
copyCoreConfig(enStringConf, enBotConf, mSettings.getResourcePath(), needsUpdate); copyCoreConfig(enStringConf, enBotConf, mSettings.getResourcePath(), needsUpdate);
AppsSettings.get().setDataLanguage(1);
return ERROR_NONE; return ERROR_NONE;
} }
private int copyKorData(Boolean needsUpdate) throws IOException { public int copyKorData(Boolean needsUpdate) throws IOException {
String korStringConf = ASSETS_KOR + getDatapath("conf") + "/" + CORE_STRING_PATH; String korStringConf = ASSETS_KOR + getDatapath("conf") + "/" + CORE_STRING_PATH;
String korBotConf = ASSETS_KOR + getDatapath("conf") + "/" + CORE_BOT_CONF_PATH; String korBotConf = ASSETS_KOR + getDatapath("conf") + "/" + CORE_BOT_CONF_PATH;
String korCdb = ASSETS_KOR + getDatapath(DATABASE_NAME); String korCdb = ASSETS_KOR + getDatapath(DATABASE_NAME);
String korWindbotPath = ASSETS_KOR + getDatapath(WINDBOT_PATH);
String korSingle = ASSETS_EN + getDatapath(CORE_SINGLE_PATH); String korSingle = ASSETS_EN + getDatapath(CORE_SINGLE_PATH);
//复制数据库 //复制数据库
copyCdbFile(korCdb, true); copyCdbFile(korCdb, true);
//复制残局 //复制残局
setMessage(mContext.getString(R.string.check_things, mContext.getString(R.string.single_lua))); setMessage(mContext.getString(R.string.check_things, mContext.getString(R.string.single_lua)));
IOUtils.copyFilesFromAssets(mContext, korSingle, mSettings.getSingleDir(), needsUpdate); IOUtils.copyFilesFromAssets(mContext, korSingle, mSettings.getSingleDir(), needsUpdate);
//复制人机资源
IOUtils.copyFilesFromAssets(mContext, korWindbotPath, mSettings.getResourcePath(), needsUpdate);
//复制游戏配置文件 //复制游戏配置文件
copyCoreConfig(korStringConf, korBotConf, mSettings.getResourcePath(), needsUpdate); copyCoreConfig(korStringConf, korBotConf, mSettings.getResourcePath(), needsUpdate);
AppsSettings.get().setDataLanguage(2);
return ERROR_NONE; return ERROR_NONE;
} }
......
...@@ -10,6 +10,7 @@ import static cn.garymb.ygomobile.Constants.ORI_REPLAY; ...@@ -10,6 +10,7 @@ import static cn.garymb.ygomobile.Constants.ORI_REPLAY;
import static cn.garymb.ygomobile.Constants.PERF_TEST_REPLACE_KERNEL; import static cn.garymb.ygomobile.Constants.PERF_TEST_REPLACE_KERNEL;
import static cn.garymb.ygomobile.Constants.PREF_CHANGE_LOG; import static cn.garymb.ygomobile.Constants.PREF_CHANGE_LOG;
import static cn.garymb.ygomobile.Constants.PREF_CHECK_UPDATE; import static cn.garymb.ygomobile.Constants.PREF_CHECK_UPDATE;
import static cn.garymb.ygomobile.Constants.PREF_DATA_LANGUAGE;
import static cn.garymb.ygomobile.Constants.PREF_DECK_DELETE_DILAOG; import static cn.garymb.ygomobile.Constants.PREF_DECK_DELETE_DILAOG;
import static cn.garymb.ygomobile.Constants.PREF_DEL_EX; import static cn.garymb.ygomobile.Constants.PREF_DEL_EX;
import static cn.garymb.ygomobile.Constants.PREF_FONT_ANTIALIAS; import static cn.garymb.ygomobile.Constants.PREF_FONT_ANTIALIAS;
...@@ -39,6 +40,7 @@ import static cn.garymb.ygomobile.ui.home.ResCheckTask.getDatapath; ...@@ -39,6 +40,7 @@ import static cn.garymb.ygomobile.ui.home.ResCheckTask.getDatapath;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
...@@ -78,6 +80,7 @@ import cn.garymb.ygomobile.lite.BuildConfig; ...@@ -78,6 +80,7 @@ import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R; import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.adapters.SimpleListAdapter; import cn.garymb.ygomobile.ui.adapters.SimpleListAdapter;
import cn.garymb.ygomobile.ui.home.MainActivity; import cn.garymb.ygomobile.ui.home.MainActivity;
import cn.garymb.ygomobile.ui.home.ResCheckTask;
import cn.garymb.ygomobile.ui.plus.DialogPlus; import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit; import cn.garymb.ygomobile.ui.plus.VUiKit;
import cn.garymb.ygomobile.utils.FileUtils; import cn.garymb.ygomobile.utils.FileUtils;
...@@ -165,6 +168,7 @@ public class SettingFragment extends PreferenceFragmentPlus { ...@@ -165,6 +168,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
bind(PREF_DEL_EX, getString(R.string.about_delete_ex)); bind(PREF_DEL_EX, getString(R.string.about_delete_ex));
bind(PERF_TEST_REPLACE_KERNEL, "需root权限,请在开发者的指导下食用"); bind(PERF_TEST_REPLACE_KERNEL, "需root权限,请在开发者的指导下食用");
bind(PREF_WINDOW_TOP_BOTTOM, "" + mSettings.getScreenPadding()); bind(PREF_WINDOW_TOP_BOTTOM, "" + mSettings.getScreenPadding());
bind(PREF_DATA_LANGUAGE, "" + mSettings.getDataLanguage());
Preference preference = findPreference(PREF_READ_EX); Preference preference = findPreference(PREF_READ_EX);
if (preference != null) { if (preference != null) {
preference.setSummary(mSettings.getExpansionsPath().getAbsolutePath()); preference.setSummary(mSettings.getExpansionsPath().getAbsolutePath());
...@@ -229,6 +233,31 @@ public class SettingFragment extends PreferenceFragmentPlus { ...@@ -229,6 +233,31 @@ public class SettingFragment extends PreferenceFragmentPlus {
if (preference instanceof ListPreference) { if (preference instanceof ListPreference) {
ListPreference listPreference = (ListPreference) preference; ListPreference listPreference = (ListPreference) preference;
mSharedPreferences.edit().putString(preference.getKey(), listPreference.getValue()).apply(); mSharedPreferences.edit().putString(preference.getKey(), listPreference.getValue()).apply();
if (preference.getKey().equals(PREF_DATA_LANGUAGE)) {
Log.i(BuildConfig.VERSION_NAME, mSettings.getDataLanguage()+"xxxx");
if (mSettings.getDataLanguage() == 0) {
try {
mSettings.copyCnData();
} catch (IOException e) {
e.printStackTrace();
}
}
if (mSettings.getDataLanguage() == 1) {
try {
mSettings.copyKorData();
} catch (IOException e) {
e.printStackTrace();
}
}
if (mSettings.getDataLanguage() == 2) {
try {
mSettings.copyEnData();
} catch (IOException e) {
e.printStackTrace();
}
}
DataManager.get().load(true);
}
} else { } else {
mSharedPreferences.edit().putString(preference.getKey(), "" + value).apply(); mSharedPreferences.edit().putString(preference.getKey(), "" + value).apply();
} }
......
...@@ -380,7 +380,7 @@ public class YGODialogUtil { ...@@ -380,7 +380,7 @@ public class YGODialogUtil {
deckAdp.notifyDataSetChanged(); deckAdp.notifyDataSetChanged();
} }
})); }));
// itemTouchHelper.attachToRecyclerView(rv_type); itemTouchHelper.attachToRecyclerView(rv_type);
} }
private String[] getStringType(List<DeckType> deckTypeList) { private String[] getStringType(List<DeckType> deckTypeList) {
......
...@@ -75,6 +75,11 @@ ...@@ -75,6 +75,11 @@
<item></item> <item></item>
<item></item> <item></item>
</string-array> </string-array>
<string-array name="data_language" translatable="false">
<item>简体中文</item>
<item>조선말</item>
<item>English</item>
</string-array>
<!-- settings --> <!-- settings -->
<string name="server_list">直连决斗</string> <string name="server_list">直连决斗</string>
<string name="server_name">名称:</string> <string name="server_name">名称:</string>
...@@ -334,4 +339,5 @@ ...@@ -334,4 +339,5 @@
<string name="edit_your_message">输入聊天内容</string> <string name="edit_your_message">输入聊天内容</string>
<string name="login_succeed">登录成功</string> <string name="login_succeed">登录成功</string>
<string name="reChatJoining">连接断开,重新登陆中……</string> <string name="reChatJoining">连接断开,重新登陆中……</string>
<string name="settings_data_language">资料语言</string>
</resources> </resources>
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
<item>0</item> <item>0</item>
<item>1</item> <item>1</item>
</string-array> </string-array>
<string-array name="data_language_value" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="screen_top_bottom_value" translatable="false"> <string-array name="screen_top_bottom_value" translatable="false">
<item>0</item> <item>0</item>
<item>5</item> <item>5</item>
......
...@@ -84,6 +84,11 @@ ...@@ -84,6 +84,11 @@
<item>Speed</item> <item>Speed</item>
<item>Quality</item> <item>Quality</item>
</string-array> </string-array>
<string-array name="data_language" translatable="false">
<item>简体中文</item>
<item>조선말</item>
<item>English</item>
</string-array>
<string-array name="screen_top_bottom_desc" translatable="false"> <string-array name="screen_top_bottom_desc" translatable="false">
<item>Disable</item> <item>Disable</item>
<item>5</item> <item>5</item>
...@@ -344,4 +349,5 @@ ...@@ -344,4 +349,5 @@
<string name="edit_your_message">Input your message</string> <string name="edit_your_message">Input your message</string>
<string name="login_succeed">Chatroom logined</string> <string name="login_succeed">Chatroom logined</string>
<string name="reChatJoining">relogining\.\.\.</string> <string name="reChatJoining">relogining\.\.\.</string>
<string name="settings_data_language">Language</string>
</resources> </resources>
...@@ -129,6 +129,13 @@ ...@@ -129,6 +129,13 @@
android:persistent="true" android:persistent="true"
android:title="@string/settings_game_font_name" /> android:title="@string/settings_game_font_name" />
<ListPreference
android:entries="@array/data_language"
android:entryValues="@array/data_language_value"
android:key="pref_key_game_data_language"
android:persistent="true"
android:title="@string/settings_data_language" />
<!--<CheckBoxPreference <!--<CheckBoxPreference
android:key="settings_game_diy_card_db" android:key="settings_game_diy_card_db"
android:persistent="true" android:persistent="true"
......
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