Commit de985735 authored by mercury233's avatar mercury233

update OnCommonEvent and CHECKBOX_AUTO_SEARCH

parent b4fc5160
......@@ -130,6 +130,7 @@ public:
int list_command;
virtual bool OnEvent(const irr::SEvent& event);
virtual bool OnCommonEvent(const irr::SEvent& event);
void GetHoverField(int x, int y);
void ShowMenu(int flag, int x, int y);
void UpdateChainButtons();
......
......@@ -99,6 +99,8 @@ void DeckBuilder::Terminate() {
mainGame->device->closeDevice();
}
bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(mainGame->dField.OnCommonEvent(event))
return false;
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID();
......@@ -305,14 +307,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
case irr::gui::EGET_SCROLL_BAR_CHANGED: {
switch(id) {
case SCROLL_CARDTEXT: {
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth()-25, mainGame->textFont, mainGame->showingtext, pos);
break;
}
break;
}
}
case irr::gui::EGET_EDITBOX_ENTER: {
switch(id) {
......@@ -626,19 +621,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
case irr::EET_KEY_INPUT_EVENT: {
switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: {
if(!event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
break;
}
case irr::KEY_ESCAPE: {
if(!mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->device->minimizeWindow();
break;
}
default: break;
}
break;
}
default: break;
......
......@@ -14,17 +14,14 @@
namespace ygo {
bool ClientField::OnEvent(const irr::SEvent& event) {
if(OnCommonEvent(event))
return false;
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
switch(id) {
case BUTTON_CLEAR_LOG: {
mainGame->lstLog->clear();
mainGame->logParam.clear();
break;
}
case BUTTON_HAND1:
case BUTTON_HAND2:
case BUTTON_HAND3: {
......@@ -896,13 +893,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
case irr::gui::EGET_LISTBOX_CHANGED: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->ShowCardInfo(mainGame->logParam[sel]);
}
break;
}
case LISTBOX_ANCARD: {
int sel = mainGame->lstANCard->getSelected();
if(sel != -1) {
......@@ -913,18 +903,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case irr::gui::EGET_LISTBOX_SELECTED_AGAIN: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->wInfos->setActiveTab(0);
}
break;
}
}
break;
}
case irr::gui::EGET_SCROLL_BAR_CHANGED: {
switch(id) {
case SCROLL_CARD_SELECT: {
......@@ -1034,11 +1012,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case SCROLL_CARDTEXT: {
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth()-25, mainGame->textFont, mainGame->showingtext, pos);
break;
}
break;
}
}
......@@ -1893,12 +1866,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
break;
}
case irr::KEY_F1:
case irr::KEY_F2:
case irr::KEY_F3:
......@@ -1970,15 +1937,101 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
default: break;
}
break;
}
default: break;
}
return false;
}
bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch(event.EventType) {
case irr::EET_GUI_EVENT: {
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
switch(id) {
case BUTTON_CLEAR_LOG: {
mainGame->lstLog->clear();
mainGame->logParam.clear();
return true;
break;
}
}
break;
}
case irr::gui::EGET_CHECKBOX_CHANGED: {
switch(id) {
case CHECKBOX_AUTO_SEARCH: {
mainGame->gameConf.auto_search_limit = mainGame->chkAutoSearch->isChecked() ? 0 : -1;
return true;
break;
}
}
break;
}
case irr::gui::EGET_LISTBOX_CHANGED: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->ShowCardInfo(mainGame->logParam[sel]);
}
return true;
break;
}
}
break;
}
case irr::gui::EGET_LISTBOX_SELECTED_AGAIN: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->wInfos->setActiveTab(0);
}
return true;
break;
}
}
break;
}
case irr::gui::EGET_SCROLL_BAR_CHANGED: {
switch(id) {
case SCROLL_CARDTEXT: {
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->textFont, mainGame->showingtext, pos);
return true;
break;
}
}
break;
}
default: break;
}
break;
}
case irr::EET_KEY_INPUT_EVENT: {
switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
return true;
break;
}
case irr::KEY_F9: {
if(mainGame->gameConf.control_mode == 1
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
return true;
break;
}
case irr::KEY_ESCAPE: {
if(!mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->device->minimizeWindow();
return true;
break;
}
default: break;
......
......@@ -271,6 +271,9 @@ bool Game::Initialize() {
posY += 30;
chkIgnoreDeckChanges = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1357));
chkIgnoreDeckChanges->setChecked(gameConf.chkIgnoreDeckChanges != 0);
posY += 30;
chkAutoSearch = env->addCheckBox(false, rect<s32>(posX, posY, posX + 225, posY + 25), tabSystem, CHECKBOX_AUTO_SEARCH, dataManager.GetSysString(1358));
chkAutoSearch->setChecked(gameConf.auto_search_limit >= 0);
//
wHand = env->addWindow(rect<s32>(500, 450, 825, 605), false, L"");
wHand->getCloseButton()->setVisible(false);
......
......@@ -551,6 +551,7 @@ extern Game* mainGame;
#define LISTBOX_SINGLEPLAY_LIST 350
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECKBOX_AUTO_SEARCH 360
#define COMBOBOX_SORTTYPE 370
#define BUTTON_MARKS_FILTER 380
......
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