Commit 3820e8c4 authored by mercury233's avatar mercury233
parents 7a566f2c 64f6ff07
......@@ -1131,6 +1131,7 @@ bool ClientField::ShowSelectSum(bool panelmode) {
if(CheckSelectSum()) {
if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) {
SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true);
else {
......@@ -1151,6 +1152,7 @@ bool ClientField::ShowSelectSum(bool panelmode) {
if(CheckSelectSum()) {
if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) {
SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
DuelClient::SendResponse();
return true;
} else {
......@@ -1165,6 +1167,11 @@ bool ClientField::ShowSelectSum(bool panelmode) {
} else
select_ready = false;
}
if (select_ready) {
ShowCancelOrFinishButton(1);
} else {
ShowCancelOrFinishButton(0);
}
return false;
}
bool ClientField::CheckSelectSum() {
......
......@@ -39,6 +39,7 @@ public:
std::vector<ClientCard*> conti_cards;
std::vector<int> activatable_descs;
std::set<int> reset_descs;
std::set<int> conti_descs;
std::vector<int> select_options;
std::vector<ChainInfo> chains;
int extra_p_count[2];
......@@ -126,7 +127,8 @@ public:
virtual bool OnEvent(const irr::SEvent& event);
void GetHoverField(int x, int y);
void ShowMenu(int flag, int x, int y);
void UpdateChainButtons();
void UpdateChainButtons();
void ShowCancelOrFinishButton(int buttonOp);
void SetResponseSelectedCards() const;
};
......
......@@ -39,6 +39,25 @@ static int parse_filter(const wchar_t* pstr, unsigned int* type) {
*type = 0;
return 0;
}
static bool check_set_code(const CardDataC& data, int set_code) {
unsigned long long sc = data.setcode;
if (data.alias) {
auto aptr = dataManager._datas.find(data.alias);
if (aptr != dataManager._datas.end())
sc = aptr->second.setcode;
}
bool res = false;
int settype = set_code & 0xfff;
int setsubtype = set_code & 0xf000;
while (sc) {
if ((sc & 0xfff) == settype && (sc & 0xf000 & setsubtype) == setsubtype)
res = true;
sc = sc >> 16;
}
return res;
}
bool DeckBuilder::OnEvent(const irr::SEvent& event) {
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
......@@ -358,7 +377,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case irr::EET_MOUSE_INPUT_EVENT: {
switch(event.MouseInput.Event) {
case irr::EMIE_LMOUSE_PRESSED_DOWN: {
position2d<s32> mouse_pos = position2d<s32>(event.MouseInput.X, event.MouseInput.Y);
irr::core::position2di mouse_pos(event.MouseInput.X, event.MouseInput.Y);
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
if(root->getElementFromPoint(mouse_pos) != root)
break;
......@@ -629,7 +648,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case irr::EMIE_MOUSE_MOVED: {
int x = event.MouseInput.X;
int y = event.MouseInput.Y;
position2d<s32> mouse_pos = position2d<s32>(x, y);
irr::core::position2di mouse_pos(x, y);
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
if(root->getElementFromPoint(mouse_pos) != root)
break;
......@@ -833,24 +852,13 @@ void DeckBuilder::FilterCards() {
if(wcsstr(text.name, &pstr[1]) == 0)
continue;
} else if(pstr[0] == L'@' && set_code) {
unsigned long long sc = data.setcode;
if(data.alias) {
auto aptr = dataManager._datas.find(data.alias);
if(aptr != dataManager._datas.end())
sc = aptr->second.setcode;
}
bool res = false;
int settype = set_code & 0xfff;
int setsubtype = set_code & 0xf000;
while(sc) {
if ((sc & 0xfff) == settype && (sc & 0xf000 & setsubtype) == setsubtype)
res = true;
sc = sc >> 16;
}
if(!res) continue;
if(!check_set_code(data, set_code)) continue;
} else {
if(wcsstr(text.name, pstr) == 0 && wcsstr(text.text, pstr) == 0)
continue;
if(wcsstr(text.name, pstr) == 0 && wcsstr(text.text, pstr) == 0) {
set_code = dataManager.GetSetCode(&pstr[0]);
if(!set_code || !check_set_code(data, set_code))
continue;
}
}
}
results.push_back(ptr);
......
......@@ -288,6 +288,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false);
mainGame->deckBuilder.result_string[0] = L'0';
mainGame->deckBuilder.result_string[1] = 0;
mainGame->deckBuilder.results.clear();
......@@ -510,6 +511,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false);
mainGame->stMessage->setText(dataManager.GetSysString(1500));
mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock();
......@@ -539,6 +541,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false);
time_t nowtime = time(NULL);
struct tm *localedtime = localtime(&nowtime);
char timebuf[40];
......@@ -1179,6 +1182,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true);
}
if (mainGame->dField.select_cancelable) {
mainGame->dField.ShowCancelOrFinishButton(1);
} else {
mainGame->dField.ShowCancelOrFinishButton(0);
}
return false;
}
case MSG_SELECT_CHAIN: {
......@@ -1197,6 +1205,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.activatable_descs.clear();
mainGame->dField.conti_cards.clear();
mainGame->dField.reset_descs.clear();
mainGame->dField.conti_descs.clear();
for (int i = 0; i < count; ++i) {
int flag = BufferIO::ReadInt8(pbuf);
code = BufferIO::ReadInt32(pbuf);
......@@ -1214,6 +1223,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->chain_code = code;
mainGame->dField.conti_cards.push_back(pcard);
mainGame->dField.conti_act = true;
mainGame->dField.conti_descs.insert(desc);
conti_exist = true;
} else {
pcard->chain_code = code;
......@@ -1412,6 +1422,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock();
mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true);
if (mainGame->dField.select_cancelable) {
mainGame->dField.ShowCancelOrFinishButton(1);
}
mainGame->gMutex.Unlock();
return false;
}
......@@ -1866,7 +1879,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnLeaveGame->setVisible(true);
}
if(!mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) {
if(!mainGame->chkHideChainButton->isChecked()) {
if(mainGame->gameConf.control_mode == 0) {
mainGame->btnChainIgnore->setVisible(true);
mainGame->btnChainAlways->setVisible(true);
mainGame->btnChainWhenAvail->setVisible(true);
......@@ -1875,6 +1888,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false);
}
}
if(mainGame->dInfo.isTag && mainGame->dInfo.turn != 1) {
......
This diff is collapsed.
......@@ -241,8 +241,8 @@ bool Game::Initialize() {
chkIgnore2->setChecked(gameConf.chkIgnore2 != 0);
chkHideSetname = env->addCheckBox(false, rect<s32>(20, 260, 280, 285), tabSystem, -1, dataManager.GetSysString(1354));
chkHideSetname->setChecked(gameConf.chkHideSetname != 0);
chkHideChainButton = env->addCheckBox(false, rect<s32>(20, 290, 280, 315), tabSystem, -1, dataManager.GetSysString(1355));
chkHideChainButton->setChecked(gameConf.chkHideChainButton != 0);
chkHideHintButton = env->addCheckBox(false, rect<s32>(20, 290, 280, 315), tabSystem, -1, dataManager.GetSysString(1355));
chkHideHintButton->setChecked(gameConf.chkHideHintButton != 0);
//
wHand = env->addWindow(rect<s32>(500, 450, 825, 605), false, L"");
wHand->getCloseButton()->setVisible(false);
......@@ -367,10 +367,6 @@ bool Game::Initialize() {
stHintMsg->setBackgroundColor(0xc0ffffff);
stHintMsg->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stHintMsg->setVisible(false);
stTip = env->addStaticText(L"", rect<s32>(0, 0, 150, 150), false, true, 0, -1, true);
stTip->setBackgroundColor(0xc0ffffff);
stTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stTip->setVisible(false);
//cmd menu
wCmdMenu = env->addWindow(rect<s32>(10, 10, 110, 179), false, L"");
wCmdMenu->setDrawTitlebar(false);
......@@ -541,9 +537,17 @@ bool Game::Initialize() {
btnChainIgnore->setVisible(false);
btnChainAlways->setVisible(false);
btnChainWhenAvail->setVisible(false);
//cancel or finish
btnCancelOrFinish = env->addButton(rect<s32>(205, 230, 295, 265), 0, BUTTON_CANCEL_OR_FINISH, dataManager.GetSysString(1295));
btnCancelOrFinish->setVisible(false);
//leave/surrender/exit
btnLeaveGame = env->addButton(rect<s32>(205, 5, 295, 80), 0, BUTTON_LEAVE_GAME, L"");
btnLeaveGame->setVisible(false);
//tip
stTip = env->addStaticText(L"", rect<s32>(0, 0, 150, 150), false, true, 0, -1, true);
stTip->setBackgroundColor(0xc0ffffff);
stTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stTip->setVisible(false);
device->setEventReceiver(&menuHandler);
LoadConfig();
env->getSkin()->setFont(guiFont);
......@@ -861,7 +865,7 @@ void Game::LoadConfig() {
gameConf.chkIgnore1 = 0;
gameConf.chkIgnore2 = 0;
gameConf.chkHideSetname = 0;
gameConf.chkHideChainButton = 0;
gameConf.chkHideHintButton = 0;
gameConf.control_mode = 0;
gameConf.draw_field_spell = 1;
gameConf.separate_clear_button = 1;
......@@ -911,8 +915,8 @@ void Game::LoadConfig() {
gameConf.chkIgnore2 = atoi(valbuf);
} else if(!strcmp(strbuf, "hide_setname")) {
gameConf.chkHideSetname = atoi(valbuf);
} else if(!strcmp(strbuf, "hide_chain_button")) {
gameConf.chkHideChainButton = atoi(valbuf);
} else if(!strcmp(strbuf, "hide_hint_button")) {
gameConf.chkHideHintButton = atoi(valbuf);
} else if(!strcmp(strbuf, "control_mode")) {
gameConf.control_mode = atoi(valbuf);
} else if(!strcmp(strbuf, "draw_field_spell")) {
......@@ -967,8 +971,8 @@ void Game::SaveConfig() {
fprintf(fp, "mute_opponent = %d\n", ((mainGame->chkIgnore1->isChecked()) ? 1 : 0));
fprintf(fp, "mute_spectators = %d\n", ((mainGame->chkIgnore2->isChecked()) ? 1 : 0));
fprintf(fp, "hide_setname = %d\n", ((mainGame->chkHideSetname->isChecked()) ? 1 : 0));
fprintf(fp, "hide_chain_button = %d\n", ((mainGame->chkHideChainButton->isChecked()) ? 1 : 0));
fprintf(fp, "#control_mode = 0: Key A/S/D/R. control_mode = 1: MouseLeft/MouseRight/NULL/F9\n");
fprintf(fp, "hide_hint_button = %d\n", ((mainGame->chkHideHintButton->isChecked()) ? 1 : 0));
fprintf(fp, "#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons\n");
fprintf(fp, "control_mode = %d\n", gameConf.control_mode);
fprintf(fp, "draw_field_spell = %d\n", gameConf.draw_field_spell);
fprintf(fp, "separate_clear_button = %d\n", gameConf.separate_clear_button);
......@@ -1122,6 +1126,7 @@ void Game::CloseDuelWindow() {
btnChainIgnore->setVisible(false);
btnChainAlways->setVisible(false);
btnChainWhenAvail->setVisible(false);
btnCancelOrFinish->setVisible(false);
wChat->setVisible(false);
lstLog->clear();
logParam.clear();
......
......@@ -32,7 +32,7 @@ struct Config {
int chkIgnore1;
int chkIgnore2;
int chkHideSetname;
int chkHideChainButton;
int chkHideHintButton;
int control_mode;
int draw_field_spell;
int separate_clear_button;
......@@ -193,7 +193,7 @@ public:
irr::gui::IGUICheckBox* chkAutoChain;
irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkHideSetname;
irr::gui::IGUICheckBox* chkHideChainButton;
irr::gui::IGUICheckBox* chkHideHintButton;
irr::gui::IGUIListBox* lstLog;
irr::gui::IGUIButton* btnClearLog;
irr::gui::IGUIButton* btnSaveLog;
......@@ -395,7 +395,8 @@ public:
irr::gui::IGUIButton* btnChainIgnore;
irr::gui::IGUIButton* btnChainAlways;
irr::gui::IGUIButton* btnChainWhenAvail;
//cancel or finish
irr::gui::IGUIButton* btnCancelOrFinish;
};
extern Game* mainGame;
......@@ -486,6 +487,7 @@ extern Game* mainGame;
#define BUTTON_CHAIN_IGNORE 264
#define BUTTON_CHAIN_ALWAYS 265
#define BUTTON_CHAIN_WHENAVAIL 266
#define BUTTON_CANCEL_OR_FINISH 267
#define BUTTON_CLEAR_LOG 270
#define LISTBOX_LOG 271
#define SCROLL_CARDTEXT 280
......
Subproject commit 87063a011d7bc19e6535347d5c9f0956d5f0e25a
Subproject commit 69d9a3241eb9841fb3433e45d2c43cf13d5f9412
......@@ -286,6 +286,8 @@
!system 1292 忽略时点
!system 1293 显示时点
!system 1294 可用时点
!system 1295 取消操作
!system 1296 完成选择
!system 1300 禁限卡表:
!system 1301 卡组列表:
!system 1302 保存
......@@ -338,7 +340,7 @@
!system 1352 主要信息:
!system 1353 播放起始于回合:
!system 1354 不显示卡片系列
!system 1355 不显示询问连锁按钮
!system 1355 不显示提示按钮
!system 1360 上一步
!system 1370 星数↑
!system 1371 攻击↑
......@@ -390,6 +392,8 @@
!system 1622 [%ls]错过时点
!system 1623 投掷硬币结果:
!system 1624 投掷骰子结果:
#tips
!system 1700 可以用鼠标右键%ls
#victory reason
!victory 0x0 投降
!victory 0x1 LP变成0
......@@ -464,7 +468,7 @@
!counter 0x34 指示物(BOX
!counter 0x35 音响指示物
!counter 0x36 娱乐法师指示物
!counter 0x37 大怪兽指示物
!counter 0x37 兽指示物
!counter 0x1038 方界指示物
!counter 0x1039 咕咚指示物
!counter 0x40 指示物(No.51 怪腕之必杀摔角手)
......@@ -737,9 +741,9 @@
!setname 0x10cf 混沌战士 カオス・ソルジャー
!setname 0xd0 威风妖怪 マジェスペクター
!setname 0xd1 灰篮 グレイドル
!setname 0xd2 Kozmo
!setname 0xd3 大怪兽 Kaiju
!setname 0xd4 古生物 버제스토마
!setname 0xd2际仙踪 Kozmo
!setname 0xd3 坏兽 壊獣
!setname 0xd4 伯吉斯异兽 バージェストマ
!setname 0xd5 但丁 ダンテ
!setname 0xd6 破坏剑 破壊剣
!setname 0xd7 巴斯达·布雷达 バスター・ブレイダー
......
......@@ -18,7 +18,8 @@ waitchain = 0
mute_opponent = 0
mute_spectators = 0
hide_setname = 0
hide_chain_button = 0
#control_mode = 0: Key A/S/D/R. control_mode = 1: MouseLeft/MouseRight/NULL/F9
hide_hint_button = 1
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
control_mode = 0
draw_field_spell = 1
separate_clear_button = 1
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