Commit f7872668 authored by feihuaduo's avatar feihuaduo
parents 2e607fc1 105f5745
......@@ -26,6 +26,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
#endif
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
if(mainGame->fadingList.size())
break;
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
......@@ -1050,6 +1052,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
irr::core::position2di pos(x, y);
if (x < (200 * mainGame->xScale) && y < (270 * mainGame->yScale)) {
mainGame->textFont->setTransparency(true);
mainGame->ClearChatMsg();
break;
}//touch the pic of detail to refresh textfonts
if(x < 300 * mainGame->xScale)
......
......@@ -320,23 +320,16 @@ bool Game::Initialize() {
wHostPrepare->getCloseButton()->setVisible(false);
wHostPrepare->setVisible(false);
btnHostPrepDuelist = env->addButton(rect<s32>(10 * xScale, 30 * yScale, 110 * xScale, 55 * yScale), wHostPrepare, BUTTON_HP_DUELIST, dataManager.GetSysString(1251));
for (int i = 0; i < 2; ++i) {
stHostPrepDuelist[i] = env->addStaticText(L"",
rect<s32>(60 * xScale, (65 + i * 45) * yScale, 260 * xScale,
(105 + i * 45) * yScale), true, false, wHostPrepare);
for(int i = 0; i < 2; ++i) {
stHostPrepDuelist[i] = env->addStaticText(L"", rect<s32>(60 * xScale, (65 + i * 45) * yScale, 260 * xScale, (105 + i * 45) * yScale), true, false, wHostPrepare);
stHostPrepDuelist[i]->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
btnHostPrepKick[i] = env->addButton(
rect<s32>(10 * xScale, (65 + i * 45) * yScale, 50 * xScale,
(105 + i * 45) * yScale), wHostPrepare, BUTTON_HP_KICK,
L"X");
chkHostPrepReady[i] = env->addCheckBox(false,
rect<s32>(270 * xScale, (65 + i * 45) * yScale, 310 * xScale,
(105 + i * 45) * yScale), wHostPrepare,
CHECKBOX_HP_READY, L"");
btnHostPrepKick[i] = env->addButton(rect<s32>(10 * xScale, (65 + i * 45) * yScale, 50 * xScale, (105 + i * 45) * yScale), wHostPrepare, BUTTON_HP_KICK, L"X");
chkHostPrepReady[i] = env->addCheckBox(false, rect<s32>(270 * xScale, (65 + i * 45) * yScale, 310 * xScale, (105 + i * 45) * yScale), wHostPrepare, CHECKBOX_HP_READY, L"");
chkHostPrepReady[i]->setEnabled(false);
}
for (int i = 2; i < 4; ++i) {
for(int i = 2; i < 4; ++i) {
stHostPrepDuelist[i] = env->addStaticText(L"", rect<s32>(60 * xScale, (145 + i * 45) * yScale, 260 * xScale, (185 + i * 45) * yScale), true, false, wHostPrepare);
stHostPrepDuelist[i]->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
btnHostPrepKick[i] = env->addButton(rect<s32>(10 * xScale, (145 + i * 45) * yScale, 50 * xScale, (185 + i * 45) * yScale), wHostPrepare, BUTTON_HP_KICK, L"X");
chkHostPrepReady[i] = env->addCheckBox(false, rect<s32>(270 * xScale, (145 + i * 45) * yScale, 310 * xScale, (185 + i * 45) * yScale), wHostPrepare, CHECKBOX_HP_READY, L"");
chkHostPrepReady[i]->setEnabled(false);
......@@ -567,10 +560,9 @@ bool Game::Initialize() {
btnPSDD->setImageScale(core::vector2df(0.5 * xScale, 0.5 * yScale));
btnPSDD->setImageRotation(270);
btnPSDD->setImage(imageManager.tCover[2], rect<s32>(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT));
//card select
#ifdef _IRR_ANDROID_PLATFORM_
//card select
wCardSelect = env->addWindow(rect<s32>(320 * xScale, 100 * yScale, 1000 * xScale, 430 * yScale), false, L"");
#endif
wCardSelect->getCloseButton()->setVisible(false);
wCardSelect->setVisible(false);
for(int i = 0; i < 5; ++i) {
......@@ -580,7 +572,6 @@ bool Game::Initialize() {
btnCardSelect[i] = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>((30 + 125 * i) * xScale, 55 * yScale, (150 + 125 * i) * xScale, 225 * yScale), wCardSelect, BUTTON_CARD_0 + i);
btnCardSelect[i]->setImageScale(core::vector2df(0.6f * xScale, 0.6f * yScale));
}
#ifdef _IRR_ANDROID_PLATFORM_
scrCardList = env->addScrollBar(true, rect<s32>(30 * xScale, 235 * yScale, 650 * xScale, 275 * yScale), wCardSelect, SCROLL_CARD_SELECT);
btnSelectOK = env->addButton(rect<s32>(300 * xScale, 285 * yScale, 380 * xScale, 325 * yScale), wCardSelect, BUTTON_CARD_SEL_OK, dataManager.GetSysString(1211));
//card display
......@@ -836,9 +827,9 @@ bool Game::Initialize() {
env->addStaticText(dataManager.GetSysString(1349), rect<s32>(360 * xScale, 30 * yScale, 570 * xScale, 50 * yScale), false, true, wReplay);
stReplayInfo = env->addStaticText(L"", rect<s32>(360 * xScale, 60 * yScale, 570 * xScale, 315 * yScale), false, true, wReplay);
env->addStaticText(dataManager.GetSysString(1353), rect<s32>(360 * xScale, 240 * yScale, 570 * xScale, 260 * yScale), false, true, wReplay);
ebRepStartTurn = CAndroidGUIEditBox::addAndroidEditBox(L"", true, env, rect<s32>(360 * xScale, 275 * yScale, 460 * xScale, 295 * yScale), wReplay, -1);
ebRepStartTurn = CAndroidGUIEditBox::addAndroidEditBox(L"", true, env, rect<s32>(360 * xScale, 270 * yScale, 460 * xScale, 310 * yScale), wReplay, -1);
ebRepStartTurn->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnExportDeck = env->addButton(rect<s32>(470 * xScale, 270 * yScale, 570 * xScale, 310 * yScale), wReplay, BUTTON_EXPORT_DECK, dataManager.GetSysString(1281));
//single play window
wSinglePlay = env->addWindow(rect<s32>(220 * xScale, 100 * yScale, 800 * xScale, 520 * yScale), false, dataManager.GetSysString(1201));
wSinglePlay->getCloseButton()->setVisible(false);
......
......@@ -319,6 +319,7 @@ public:
irr::gui::IGUIButton* btnDeleteReplay;
irr::gui::IGUIButton* btnRenameReplay;
irr::gui::IGUIButton* btnReplayCancel;
irr::gui::IGUIButton* btnExportDeck;
irr::gui::IGUIEditBox* ebRepStartTurn;
//single play
irr::gui::IGUIWindow* wSinglePlay;
......@@ -574,6 +575,7 @@ extern Game* mainGame;
#define BUTTON_CANCEL_REPLAY 132
#define BUTTON_DELETE_REPLAY 133
#define BUTTON_RENAME_REPLAY 134
#define BUTTON_EXPORT_DECK 135
#define BUTTON_REPLAY_START 140
#define BUTTON_REPLAY_PAUSE 141
#define BUTTON_REPLAY_STEP 142
......
......@@ -295,6 +295,42 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->ShowElement(mainGame->wMainMenu);
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"%ls %ls", ex_filename, namebuf[i]);
deckManager.SaveDeck(tmp_deck, filename);
}
mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20);
break;
}
//TEST BOT MODE
case BUTTON_BOT_START: {
int sel = mainGame->lstBotList->getSelected();
......
......@@ -106,7 +106,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
if(query_flag & QUERY_CODE) *p++ = data.code;
if(query_flag & QUERY_POSITION) *p++ = get_info_location();
if(!use_cache) {
if(query_flag & QUERY_ALIAS) q_cache.code = *p++ = get_code();
if(query_flag & QUERY_ALIAS) q_cache.alias = *p++ = get_code();
if(query_flag & QUERY_TYPE) q_cache.type = *p++ = get_type();
if(query_flag & QUERY_LEVEL) q_cache.level = *p++ = get_level();
if(query_flag & QUERY_RANK) q_cache.rank = *p++ = get_rank();
......
......@@ -3142,11 +3142,7 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
case 21: {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]
|| core.attacker->current.controler != core.attacker->attack_controler
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE
|| core.attack_target->current.controler != core.attack_target->attack_controler
|| core.attack_target->fieldid_r != core.pre_field[1]))) {
if(core.attacker->is_status(STATUS_ATTACK_CANCELED)) {
core.units.begin()->step = 32;
return FALSE;
}
......@@ -3184,12 +3180,7 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
case 23: {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]
|| ((core.attacker->current.position & POS_DEFENSE) && !(core.attacker->is_affected_by_effect(EFFECT_DEFENSE_ATTACK)))
|| core.attacker->current.controler != core.attacker->attack_controler
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE
|| core.attack_target->current.controler != core.attack_target->attack_controler
|| core.attack_target->fieldid_r != core.pre_field[1]))) {
if(core.attacker->is_status(STATUS_ATTACK_CANCELED)) {
core.units.begin()->step = 32;
return FALSE;
}
......@@ -3219,11 +3210,7 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
case 25: {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]
|| core.attacker->current.controler != core.attacker->attack_controler
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE
|| core.attack_target->current.controler != core.attack_target->attack_controler
|| core.attack_target->fieldid_r != core.pre_field[1]))) {
if(core.attacker->is_status(STATUS_ATTACK_CANCELED)) {
reset_phase(PHASE_DAMAGE_CAL);
adjust_all();
infos.phase = PHASE_DAMAGE;
......@@ -3472,7 +3459,6 @@ int32 field::process_battle_command(uint16 step) {
}
case 33: {
core.units.begin()->ptarget = 0;
// for unexpected end of damage step
core.damage_calculated = TRUE;
core.selfdes_disabled = FALSE;
core.flip_delayed = FALSE;
......@@ -4356,7 +4342,7 @@ int32 field::add_chain(uint16 step) {
set_spsummon_counter(clit.triggering_player, true, true);
if(clit.opinfos[0x200].op_player == PLAYER_ALL)
set_spsummon_counter(1 - clit.triggering_player, true, true);
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && peffect->is_flag(EFFECT_FLAG_CARD_TARGET)) {
if(core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) {
auto& optarget = clit.opinfos[0x200];
if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) {
......@@ -4602,32 +4588,30 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
if(cait->opinfos[0x200].op_player == PLAYER_ALL && core.spsummon_state_count_tmp[1 - cait->triggering_player] == core.spsummon_state_count[1 - cait->triggering_player])
set_spsummon_counter(1 - cait->triggering_player);
//sometimes it may add twice, only works for once per turn
if(cait->triggering_effect->is_flag(EFFECT_FLAG_CARD_TARGET)) {
auto& optarget = cait->opinfos[0x200];
if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) {
uint32 sumplayer = optarget.op_param;
if(core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) {
auto opit = optarget.op_cards->container.begin();
if((*opit)->spsummon_code)
core.spsummon_once_map[sumplayer][(*opit)->spsummon_code]++;
++opit;
if((*opit)->spsummon_code)
core.spsummon_once_map[1 - sumplayer][(*opit)->spsummon_code]++;
}
auto& optarget = cait->opinfos[0x200];
if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) {
uint32 sumplayer = optarget.op_param;
if(core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) {
auto opit = optarget.op_cards->container.begin();
check_card_counter(*opit, 3, sumplayer);
if((*opit)->spsummon_code)
core.spsummon_once_map[sumplayer][(*opit)->spsummon_code]++;
++opit;
check_card_counter(*opit, 3, 1 - sumplayer);
} else {
uint32 sumplayer = cait->triggering_player;
if(optarget.op_player == 1)
sumplayer = 1 - sumplayer;
for(auto& ptarget : optarget.op_cards->container) {
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && ptarget->spsummon_code)
core.spsummon_once_map[sumplayer][ptarget->spsummon_code]++;
check_card_counter(ptarget, 3, sumplayer);
}
if((*opit)->spsummon_code)
core.spsummon_once_map[1 - sumplayer][(*opit)->spsummon_code]++;
}
auto opit = optarget.op_cards->container.begin();
check_card_counter(*opit, 3, sumplayer);
++opit;
check_card_counter(*opit, 3, 1 - sumplayer);
} else {
uint32 sumplayer = cait->triggering_player;
if(optarget.op_player == 1)
sumplayer = 1 - sumplayer;
for(auto& ptarget : optarget.op_cards->container) {
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && ptarget->spsummon_code)
core.spsummon_once_map[sumplayer][ptarget->spsummon_code]++;
check_card_counter(ptarget, 3, sumplayer);
}
}
}
......@@ -4970,7 +4954,7 @@ int32 field::adjust_step(uint16 step) {
return FALSE;
}
case 1: {
//win check(deck=0 or lp=0)
//win check
uint32 winp = 5, rea = 1;
if(player[0].lp <= 0 && player[1].lp > 0) {
winp = 1;
......@@ -5229,21 +5213,31 @@ int32 field::adjust_step(uint16 step) {
return FALSE;
if(attacker->is_status(STATUS_ATTACK_CANCELED))
return FALSE;
if(!core.attacker->is_capable_attack()
|| core.attacker->current.controler != core.attacker->attack_controler
|| core.attacker->fieldid_r != core.pre_field[0]) {
attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
return FALSE;
}
if(core.attack_rollback)
return FALSE;
std::set<uint16> fidset;
for(auto& pcard : player[1 - infos.turn_player].list_mzone) {
if(pcard)
fidset.insert(pcard->fieldid_r);
if(infos.phase != PHASE_DAMAGE && infos.phase != PHASE_DAMAGE_CAL) {
if(!core.attacker->is_capable_attack()
|| core.attacker->current.controler != core.attacker->attack_controler
|| core.attacker->fieldid_r != core.pre_field[0]) {
attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
return FALSE;
}
if(core.attack_rollback)
return FALSE;
std::set<uint16> fidset;
for(auto& pcard : player[1 - infos.turn_player].list_mzone) {
if(pcard)
fidset.insert(pcard->fieldid_r);
}
if(fidset != core.opp_mzone || !confirm_attack_target())
core.attack_rollback = TRUE;
} else {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]
|| ((core.attacker->current.position & POS_DEFENSE) && !(core.attacker->is_affected_by_effect(EFFECT_DEFENSE_ATTACK)))
|| core.attacker->current.controler != core.attacker->attack_controler
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE
|| core.attack_target->current.controler != core.attack_target->attack_controler
|| core.attack_target->fieldid_r != core.pre_field[1])))
core.attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
}
if(fidset != core.opp_mzone || !confirm_attack_target())
core.attack_rollback = TRUE;
return FALSE;
}
case 15: {
......
......@@ -321,6 +321,7 @@
!system 1278 自动选择魔法/陷阱卡位置
!system 1279 显示场地背景
!system 1280 重命名成功后请重新选择卡组
!system 1281 提取卡组
!system 1290 停用聊天功能
!system 1291 忽略观战者发言
!system 1292 □忽略时点
......
......@@ -321,6 +321,7 @@
!system 1278 Auto spell/trap placing
!system 1279 Drawing field spell
!system 1280 please rechoose deck after rename.
!system 1281 Export Deck
!system 1290 Disable Chatting
!system 1291 Mute spectators
!system 1292 Ignore chain
......
......@@ -321,6 +321,7 @@
!system 1278 카드 위치 자동 (마법&함정)
!system 1279 필드 이미지 활성화
!system 1280 이름을 변경후 덱을 다시 선택해주세요.
!system 1281 추출물 선택
!system 1290 상대방 메시지 무시
!system 1291 관전자 메시지 무시
!system 1292 체인 무시
......
......@@ -8,7 +8,7 @@ android {
applicationId "cn.garymb.ygomobile"
minSdkVersion 16
targetSdkVersion 28
versionCode 340400513
versionCode 340400527
versionName "3.4.4"
flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true
......
......@@ -176,15 +176,15 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
if (deckItem == null || deckItem.getCardInfo() == null) {
return;
}
DialogPlus dialogPlus = new DialogPlus(this);
dialogPlus.setTitle(R.string.question);
dialogPlus.setMessage(getString(R.string.delete_card, deckItem.getCardInfo().Name));
dialogPlus.setMessageGravity(Gravity.CENTER_HORIZONTAL);
dialogPlus.setLeftButtonListener((dlg, v) -> {
dlg.dismiss();
// DialogPlus dialogPlus = new DialogPlus(this);
// dialogPlus.setTitle(R.string.question);
// dialogPlus.setMessage(getString(R.string.delete_card, deckItem.getCardInfo().Name));
// dialogPlus.setMessageGravity(Gravity.CENTER_HORIZONTAL);
// dialogPlus.setLeftButtonListener((dlg, v) -> {
// dlg.dismiss();
mDeckItemTouchHelper.remove(pos);
});
dialogPlus.show();
// });
// dialogPlus.show();
} else {
mDeckAdapater.showHeadView();
}
......
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