Commit b078f4d7 authored by qq247321453's avatar qq247321453

Merge branch 'master' into cc

parents 1533b106 b542e0f0
......@@ -48,6 +48,15 @@ void DeckManager::LoadLFListSingle(const char* path) {
fclose(fp);
}
}
void DeckManager::LoadLFList(android::InitOptions *options) {
io::path workingDir = options->getWorkDir();
LoadLFListSingle((workingDir + path("/expansions/lflist.conf")).c_str());
LoadLFListSingle((workingDir + path("/lflist.conf")).c_str());
LFList nolimit;
nolimit.listName = L"N/A";
nolimit.hash = 0;
_lfList.push_back(nolimit);
}
const wchar_t* DeckManager::GetLFListName(int lfhash) {
auto lit = std::find_if(_lfList.begin(), _lfList.end(), [lfhash](const ygo::LFList& list) {
return list.hash == lfhash;
......
......@@ -36,6 +36,7 @@ public:
std::vector<LFList> _lfList;
void LoadLFListSingle(const char* path);
void LoadLFList(android::InitOptions *options);
const wchar_t* GetLFListName(int lfhash);
std::unordered_map<int, int>* GetLFListContent(int lfhash);
int CheckDeck(Deck& deck, int lfhash, int rule);
......
This diff is collapsed.
......@@ -134,8 +134,6 @@ public:
void stopBGM();
void playBGM();
bool Initialize(ANDROID_APP app, android::InitOptions *options);
#else
bool Initialize();
#endif
void MainLoop();
void RefreshTimeDisplay();
......@@ -291,7 +289,7 @@ public:
irr::gui::CGUIImageButton* imgSettings;
irr::gui::IGUIWindow* wSettings;
irr::gui::IGUIImage* bgSettings;
irr::gui::IGUIButton* btnCloseSettings;//
irr::gui::CGUIImageButton* btnCloseSettings;//
//hint text
irr::gui::IGUIStaticText* stHintMsg;
irr::gui::IGUIStaticText* stTip;
......@@ -379,7 +377,7 @@ public:
irr::gui::IGUIButton* btnHostPrepOB;//
irr::gui::IGUIStaticText* stHostPrepDuelist[4];
irr::gui::IGUICheckBox* chkHostPrepReady[4];
irr::gui::IGUIButton* btnHostPrepKick[4];//
irr::gui::CGUIImageButton* btnHostPrepKick[4];//
irr::gui::IGUIComboBox* cbCategorySelect;
irr::gui::IGUIComboBox* cbDeckSelect;
irr::gui::IGUIStaticText* stHostPrepRule;
......
......@@ -50,6 +50,7 @@ bool ImageManager::Initial(const path dir) {
tPlay = driver->getTexture((dir + path("/textures/extra/tplay.png")).c_str());
tTalk = driver->getTexture((dir + path("/textures/extra/ttalk.png")).c_str());
tShut = driver->getTexture((dir + path("/textures/extra/tshut.png")).c_str());
tClose = driver->getTexture((dir + path("/textures/extra/tclose.png")).c_str());
tTitleBar = driver->getTexture((dir + path("/textures/extra/stitlebar.png")).c_str());
tWindow = driver->getTexture((dir + path("/textures/extra/sWindow.png")).c_str());
tWindow_V = driver->getTexture((dir + path("/textures/extra/sWindow_V.png")).c_str());
......
......@@ -65,6 +65,7 @@ public:
irr::video::ITexture* tPlay;
irr::video::ITexture* tTalk;
irr::video::ITexture* tShut;
irr::video::ITexture* tClose;
irr::video::ITexture* tTitleBar;
irr::video::ITexture* tWindow;
irr::video::ITexture* tWindow_V;
......
......@@ -310,42 +310,42 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_EXPORT_DECK: {
if(mainGame->lstReplayList->getSelected() == -1)
break;
Replay replay;
wchar_t ex_filename[256];
wchar_t namebuf[4][20];
wchar_t filename[256];
myswprintf(ex_filename, L"%ls", mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected()));
if(!replay.OpenReplay(ex_filename))
break;
const ReplayHeader& rh = replay.pheader;
if(rh.flag & REPLAY_SINGLE_MODE)
break;
int max = (rh.flag & REPLAY_TAG) ? 4 : 2;
//player name
for(int i = 0; i < max; ++i)
replay.ReadName(namebuf[i]);
//skip pre infos
for(int i = 0; i < 4; ++i)
replay.ReadInt32();
//deck
for(int i = 0; i < max; ++i) {
int main = replay.ReadInt32();
Deck tmp_deck;
for(int j = 0; j < main; ++j)
tmp_deck.main.push_back(dataManager.GetCodePointer(replay.ReadInt32()));
int extra = replay.ReadInt32();
for(int j = 0; j < extra; ++j)
tmp_deck.extra.push_back(dataManager.GetCodePointer(replay.ReadInt32()));
myswprintf(filename, L"deck/%ls-%d %ls.ydk", ex_filename, i + 1, namebuf[i]);
deckManager.SaveDeck(tmp_deck, filename);
}
mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20);
break;
}
//TEST BOT MODE
if(mainGame->lstReplayList->getSelected() == -1)
break;
Replay replay;
wchar_t ex_filename[256];
wchar_t namebuf[4][20];
wchar_t filename[256];
myswprintf(ex_filename, L"%ls", mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected()));
if(!replay.OpenReplay(ex_filename))
break;
const ReplayHeader& rh = replay.pheader;
if(rh.flag & REPLAY_SINGLE_MODE)
break;
int max = (rh.flag & REPLAY_TAG) ? 4 : 2;
//player name
for(int i = 0; i < max; ++i)
replay.ReadName(namebuf[i]);
//skip pre infos
for(int i = 0; i < 4; ++i)
replay.ReadInt32();
//deck
for(int i = 0; i < max; ++i) {
int main = replay.ReadInt32();
Deck tmp_deck;
for(int j = 0; j < main; ++j)
tmp_deck.main.push_back(dataManager.GetCodePointer(replay.ReadInt32()));
int extra = replay.ReadInt32();
for(int j = 0; j < extra; ++j)
tmp_deck.extra.push_back(dataManager.GetCodePointer(replay.ReadInt32()));
FileSystem::SafeFileName(namebuf[i]);
myswprintf(filename, L"deck/%ls-%d %ls.ydk", ex_filename, i + 1, namebuf[i]);
deckManager.SaveDeck(tmp_deck, filename);
}
mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20);
break;
}
case BUTTON_BOT_START: {
int sel = mainGame->lstBotList->getSelected();
if(sel == -1)
......
......@@ -19,6 +19,11 @@
class FileSystem {
public:
static void SafeFileName(wchar_t* wfile) {
while((wfile = wcspbrk(wfile, L"<>:\"/\\|?*")) != NULL)
*wfile++ = '_';
}
static bool IsFileExists(const wchar_t* wfile) {
DWORD attr = GetFileAttributesW(wfile);
return attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY);
......@@ -112,6 +117,11 @@ public:
class FileSystem {
public:
static void SafeFileName(wchar_t* wfile) {
while((wfile = wcspbrk(wfile, L"/")) != NULL)
*wfile++ = '_';
}
static bool IsFileExists(const char* file) {
struct stat fileStat;
return (stat(file, &fileStat) == 0) && !S_ISDIR(fileStat.st_mode);
......
......@@ -16,15 +16,23 @@
特别感谢: 尸体233,废话多,大毛,幻兽L 的支持与努力.
</pre>
<ul>
<li style="color:#ffff00">3.8.7</li>
<li style="color:#ffff00">3.8.8</li>
</ul>
<pre>
更新:
1.更新ygo内核;
2.新卡1106+KICO+VJ;
3.新增残局lua文件用本app打开进入对局;
4.新增录像yrp文件用本app打开进入观看;
5.新增发送yrp文件到QQ微信等应用;
2.新卡SR12+T1105+DBGC+VJ;
3.升级ygopro版本号为1035.3;
4.卡池添加简中归属分类;
5.先行卡补丁可以在列表中选择删除;
6.查看大卡图时长按支持分享那张卡图;
7.分享卡组时支持分享ydk文件;
变更:
1.修正相同玩家ID的录像只能提取一方的问题;
2.退出ygopro时如果mobile进程被杀则重新唤醒;
3.修正不通过本软件替换数据库而导致的卡组编辑闪退问题;
4.卡组编辑增加一些新手引导;
5.ygopro的禁卡表设置从卡组管理移到设置。
</pre>
<h3 style="color:#ff0000">注意</h3>
<pre>
......
......@@ -9,8 +9,8 @@ android {
minSdkVersion 21
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 29
versionCode 390901604
versionName "3.9.9"
versionCode 380800907
versionName "3.8.8"
flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true
ndk {
......
......@@ -157,9 +157,9 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
$(R.id.btn_nav_list).setOnClickListener((v) -> doMenu(R.id.action_card_list));
//
final File _file;
//打开指定卡组
//打开指定卡组
if (!TextUtils.isEmpty(preLoadFile) && (mPreLoadFile = new File(preLoadFile)).exists()) {
//外面卡组
//外面卡组
_file = mPreLoadFile;
} else {
mPreLoadFile = null;
......@@ -167,7 +167,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
if(TextUtils.isEmpty(path)){
_file = null;
} else {
//最后卡组
//最后卡组
_file = new File(path);
}
}
......@@ -260,13 +260,13 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
DialogPlus dlg = DialogPlus.show(this, null, getString(R.string.loading));
VUiKit.defer().when(() -> {
DataManager.get().load(true);
//默认第一个卡表
//默认第一个卡表
if (mLimitManager.getCount() > 0) {
mCardLoader.setLimitList(mLimitManager.getTopLimit());
}
File file = ydk;
if (file == null || !file.exists()) {
//当默认卡组不存在的时候
//当默认卡组不存在的时候
List<File> files = getYdkFiles();
if (files != null && files.size() > 0) {
file = files.get(0);
......@@ -288,15 +288,15 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
mCardSelector.initItems();
initLimitListSpinners(mLimitSpinner, mCardLoader.getLimitList());
initDecksListSpinners(mDeckSpinner, rs.source);
//设置当前卡组
//设置当前卡组
setCurDeck(rs);
//设置收藏夹
//设置收藏夹
mCardSelector.showFavorites(false);
});
}
/**
* 设置当前卡组
* 设置当前卡组
*/
private void setCurDeck(DeckInfo deckInfo) {
if (deckInfo == null) {
......@@ -307,7 +307,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
String name = IOUtils.tirmName(file.getName(), Constants.YDK_FILE_EX);
setActionBarSubTitle(name);
// if (inDeckDir(file)) {
//记住最后打开的卡组
//记住最后打开的卡组
mSettings.setLastDeckPath(file.getAbsolutePath());
tv_deck.setText(name);
......@@ -383,7 +383,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
@Override
public void onItemDoubleClick(View view, int pos) {
//拖拽中,就不显示
//拖拽中,就不显示
if (isShowDrawer()) {
return;
}
......@@ -627,7 +627,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
// mDeckAdapater.notifyDataSetChanged();
// break;
case R.id.action_search:
//弹条件对话框
//弹条件对话框
showSearch(true);
break;
case R.id.action_card_list:
......@@ -642,7 +642,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
break;
case R.id.action_save:
if (mPreLoadFile != null && mPreLoadFile == mDeckAdapater.getYdkFile()) {
//需要保存到deck文件夹
//需要保存到deck文件夹
inputDeckName(mPreLoadFile, null, true);
} else {
if (mDeckAdapater.getYdkFile() == null) {
......@@ -709,7 +709,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
}
break;
case R.id.action_unsort:
//打乱
//打乱
mDeckAdapater.unSort();
break;
case R.id.action_sort:
......@@ -729,7 +729,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
builder.setMessageGravity(Gravity.CENTER_HORIZONTAL);
builder.setLeftButtonListener((dlg, rs) -> {
dlg.dismiss();
//复制当前卡组
//复制当前卡组
inputDeckName(old, savePath, true);
});
builder.setRightButtonListener((dlg, rs) -> {
......@@ -757,11 +757,11 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
builderShareLoading.setMessage(R.string.Pre_share);
builderShareLoading.show();
//先排序
//先排序
// mDeckAdapater.sort();
//保存
//保存
// if (mPreLoadFile != null && mPreLoadFile == mDeckAdapater.getYdkFile()) {
// //需要保存到deck文件夹
// //需要保存到deck文件夹
// inputDeckName(mPreLoadFile, null, true);
// } else {
// if (mDeckAdapater.getYdkFile() == null) {
......@@ -770,27 +770,27 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
// save(mDeckAdapater.getYdkFile());
// }
// }
// //保存成功后重新加载卡组
// //保存成功后重新加载卡组
// File file = getSelectDeck(mDeckSpinner);
// if (file != null) {
// loadDeckFromFile(file);
// }
//延时半秒,使整体看起来更流畅
//延时半秒,使整体看起来更流畅
new Handler().postDelayed(this::shareDeck1, 500);
}
private void shareDeck1() {
//开启绘图缓存
//开启绘图缓存
mRecyclerView.setDrawingCacheEnabled(true);
//这个方法可调可不调,因为在getDrawingCache()里会自动判断有没有缓存有没有准备好,
//如果没有,会自动调用buildDrawingCache()
//这个方法可调可不调,因为在getDrawingCache()里会自动判断有没有缓存有没有准备好,
//如果没有,会自动调用buildDrawingCache()
mRecyclerView.buildDrawingCache();
//获取绘图缓存 这里直接创建了一个新的bitmap
//因为我们在最后需要释放缓存资源,会释放掉缓存中创建的bitmap对象
//获取绘图缓存 这里直接创建了一个新的bitmap
//因为我们在最后需要释放缓存资源,会释放掉缓存中创建的bitmap对象
Bitmap bitmap = BitmapUtil.drawBg4Bitmap(Color.parseColor("#e6f3fd"), Bitmap.createBitmap(mRecyclerView.getDrawingCache(), 0, 0, mRecyclerView.getMeasuredWidth(),
mRecyclerView.getMeasuredHeight()));
//清理绘图缓存,释放资源
//清理绘图缓存,释放资源
mRecyclerView.destroyDrawingCache();
// shotRecyclerView(mRecyclerView)
......@@ -817,7 +817,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
stopService(new Intent(this, DuelAssistantService.class));
YGOUtil.copyMessage(this, et_code.getText().toString().trim());
showToast(getString(R.string.deck_text_copyed));
//复制完毕开启决斗助手
//复制完毕开启决斗助手
YGOUtil.startDuelService(this);
});
......@@ -844,7 +844,7 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
});
//复制前关闭决斗助手
//复制前关闭决斗助手
// String label = TextUtils.isEmpty(deck.getName()) ? getString(R.string.share_deck) : deck.getName();
......@@ -1075,9 +1075,9 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
addMenuButton(mMenuIds, menu, R.id.action_sort, R.string.sort, R.drawable.sort);
addMenuButton(mMenuIds, menu, R.id.action_deck_backup_n_restore, R.string.deck_backup_n_restore, R.drawable.downloadimages);
//设置展开或隐藏的延时。 默认值为 800ms。
//设置展开或隐藏的延时。 默认值为 800ms。
menu.setDuration(150);
//设置每两个子按钮之间动画的延时(ms为单位)。 比如,如果延时设为0,那么所有子按钮都会同时展开或隐藏,默认值为100ms。
//设置每两个子按钮之间动画的延时(ms为单位)。 比如,如果延时设为0,那么所有子按钮都会同时展开或隐藏,默认值为100ms。
menu.setDelay(10);
menu.setOnBoomListener(new DefaultOnBoomListener() {
......
......@@ -82,9 +82,9 @@ public class StringManager implements Closeable {
InputStreamReader in = null;
try {
in = new InputStreamReader(inputStream, "utf-8");
in = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader reader = new BufferedReader(in);
String line = null;
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith("#") || (!line.startsWith(PRE_SYSTEM) && !line.startsWith(PRE_SETNAME))) {
continue;
......@@ -133,7 +133,7 @@ public class StringManager implements Closeable {
inputStream = new FileInputStream(file);
in = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader reader = new BufferedReader(in);
String line = null;
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith("#") || (!line.startsWith(PRE_SYSTEM) && !line.startsWith(PRE_SETNAME))) {
continue;
......
......@@ -4,6 +4,8 @@ package ocgcore.data;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import ocgcore.enums.CardType;
public class Card extends CardData implements Parcelable {
......@@ -137,6 +139,7 @@ public class Card extends CardData implements Parcelable {
return c.Code == this.Code || c.Alias == this.Code || c.Code == this.Alias;
}
@NonNull
@Override
public String toString() {
return "Card{" +
......
......@@ -3,10 +3,9 @@ package ocgcore.data;
import android.os.Parcel;
import android.os.Parcelable;
import ocgcore.enums.CardAttribute;
import ocgcore.enums.CardOt;
import androidx.annotation.NonNull;
public class CardData implements Parcelable{
public class CardData implements Parcelable {
public CardData() {
}
......@@ -28,6 +27,7 @@ public class CardData implements Parcelable{
public int RightScale;
public long Category;
@NonNull
@Override
public String toString() {
return "CardData{" +
......
......@@ -312,4 +312,10 @@
<string name="title_delete_ex">확장 삭제</string>
<string name="file_installed">문건 나왔습니다.</string>
<string name="ask_delete_ex">지우려면 확인을 클릭하십시오.</string>
<string name="label_ot_OCG">OCG</string>
<string name="label_ot_TCG">TCG</string>
<string name="label_ot_SC_OCG">SC_OCG</string>
<string name="label_ot_All">모든 카드</string>
<string name="label_ot_No_Exclusive">ID 없는 카드</string>
<string name="label_ot_CUSTOM">커스텀 카드</string>
</resources>
......@@ -99,6 +99,12 @@
<string name="hit_def">DEF</string>
<string name="label_race">种族</string>
<string name="label_ot">专属</string>
<string name="label_ot_OCG">OCG</string>
<string name="label_ot_TCG">TCG</string>
<string name="label_ot_SC_OCG">简体中文</string>
<string name="label_ot_CUSTOM">自定义卡片</string>
<string name="label_ot_No_Exclusive">无独有卡</string>
<string name="label_ot_All">全部卡片</string>
<string name="label_limit">不限制</string>
<string name="label_limitlist">禁卡表</string>
<string name="label_type">卡片类型</string>
......
......@@ -315,4 +315,10 @@
<string name="about_delete_ex">if you need to delte all expansion cards</string>
<string name="file_installed">file loaded</string>
<string name="ask_delete_ex">Click OK to confirm the deletion</string>
<string name="label_ot_TCG">TCG</string>
<string name="label_ot_OCG">OCG</string>
<string name="label_ot_All">All</string>
<string name="label_ot_CUSTOM">Custom</string>
<string name="label_ot_No_Exclusive">No exclusive</string>
<string name="label_ot_SC_OCG">SChinese OCG</string>
</resources>
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