Commit c1856c89 authored by mercury233's avatar mercury233

update auto search

parent 90e14db2
...@@ -216,6 +216,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -216,6 +216,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(mainGame->chkCategory[i]->isChecked()) if(mainGame->chkCategory[i]->isChecked())
filter_effect |= filter; filter_effect |= filter;
mainGame->HideElement(mainGame->wCategories); mainGame->HideElement(mainGame->wCategories);
InstantSearch();
break; break;
} }
case BUTTON_SIDE_OK: { case BUTTON_SIDE_OK: {
...@@ -308,6 +309,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -308,6 +309,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if (mainGame->btnMark[7]->isPressed()) if (mainGame->btnMark[7]->isPressed())
filter_marks |= 0004; filter_marks |= 0004;
mainGame->HideElement(mainGame->wLinkMarks); mainGame->HideElement(mainGame->wLinkMarks);
InstantSearch();
break; break;
} }
} }
...@@ -328,8 +330,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -328,8 +330,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case irr::gui::EGET_EDITBOX_CHANGED: { case irr::gui::EGET_EDITBOX_CHANGED: {
switch(id) { switch(id) {
case EDITBOX_KEYWORD: { case EDITBOX_KEYWORD: {
if(mainGame->gameConf.auto_search_limit >= 0 && (wcslen(mainGame->ebCardName->getText()) >= mainGame->gameConf.auto_search_limit)) InstantSearch();
StartFilter();
break; break;
} }
} }
...@@ -446,6 +447,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -446,6 +447,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
} }
InstantSearch();
break; break;
} }
case COMBOBOX_SORTTYPE: { case COMBOBOX_SORTTYPE: {
...@@ -462,8 +464,13 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -462,8 +464,13 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->ebDefense->setEnabled(true); mainGame->ebDefense->setEnabled(true);
} }
} }
InstantSearch();
break; break;
} }
case COMBOBOX_ATTRIBUTE:
case COMBOBOX_RACE:
case COMBOBOX_LIMIT:
InstantSearch();
} }
} }
default: break; default: break;
...@@ -854,6 +861,10 @@ void DeckBuilder::FilterCards() { ...@@ -854,6 +861,10 @@ void DeckBuilder::FilterCards() {
} }
SortList(); SortList();
} }
void DeckBuilder::InstantSearch() {
if(mainGame->gameConf.auto_search_limit >= 0 && (wcslen(mainGame->ebCardName->getText()) >= mainGame->gameConf.auto_search_limit))
StartFilter();
}
void DeckBuilder::ClearSearch() { void DeckBuilder::ClearSearch() {
mainGame->cbCardType->setSelected(0); mainGame->cbCardType->setSelected(0);
mainGame->cbCardType2->setSelected(0); mainGame->cbCardType2->setSelected(0);
......
...@@ -17,6 +17,7 @@ public: ...@@ -17,6 +17,7 @@ public:
void FilterCards(); void FilterCards();
void StartFilter(); void StartFilter();
void ClearFilter(); void ClearFilter();
void InstantSearch();
void ClearSearch(); void ClearSearch();
void SortList(); void SortList();
......
...@@ -463,7 +463,7 @@ bool Game::Initialize() { ...@@ -463,7 +463,7 @@ bool Game::Initialize() {
cbCardType2->setMaxSelectionRows(10); cbCardType2->setMaxSelectionRows(10);
cbCardType2->addItem(dataManager.GetSysString(1310), 0); cbCardType2->addItem(dataManager.GetSysString(1310), 0);
env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter); env->addStaticText(dataManager.GetSysString(1315), rect<s32>(205, 2 + 25 / 6, 280, 22 + 25 / 6), false, false, wFilter);
cbLimit = env->addComboBox(rect<s32>(260, 25 / 6, 390, 20 + 25 / 6), wFilter, -1); cbLimit = env->addComboBox(rect<s32>(260, 25 / 6, 390, 20 + 25 / 6), wFilter, COMBOBOX_LIMIT);
cbLimit->setMaxSelectionRows(10); cbLimit->setMaxSelectionRows(10);
cbLimit->addItem(dataManager.GetSysString(1310)); cbLimit->addItem(dataManager.GetSysString(1310));
cbLimit->addItem(dataManager.GetSysString(1316)); cbLimit->addItem(dataManager.GetSysString(1316));
...@@ -474,13 +474,13 @@ bool Game::Initialize() { ...@@ -474,13 +474,13 @@ bool Game::Initialize() {
cbLimit->addItem(dataManager.GetSysString(1242)); cbLimit->addItem(dataManager.GetSysString(1242));
cbLimit->addItem(dataManager.GetSysString(1243)); cbLimit->addItem(dataManager.GetSysString(1243));
env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter); env->addStaticText(dataManager.GetSysString(1319), rect<s32>(10, 22 + 50 / 6, 70, 42 + 50 / 6), false, false, wFilter);
cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 190, 40 + 50 / 6), wFilter, -1); cbAttribute = env->addComboBox(rect<s32>(60, 20 + 50 / 6, 190, 40 + 50 / 6), wFilter, COMBOBOX_ATTRIBUTE);
cbAttribute->setMaxSelectionRows(10); cbAttribute->setMaxSelectionRows(10);
cbAttribute->addItem(dataManager.GetSysString(1310), 0); cbAttribute->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x80; filter <<= 1) for(int filter = 0x1; filter != 0x80; filter <<= 1)
cbAttribute->addItem(dataManager.FormatAttribute(filter), filter); cbAttribute->addItem(dataManager.FormatAttribute(filter), filter);
env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter); env->addStaticText(dataManager.GetSysString(1321), rect<s32>(10, 42 + 75 / 6, 70, 62 + 75 / 6), false, false, wFilter);
cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 190, 60 + 75 / 6), wFilter, -1); cbRace = env->addComboBox(rect<s32>(60, 40 + 75 / 6, 190, 60 + 75 / 6), wFilter, COMBOBOX_RACE);
cbRace->setMaxSelectionRows(10); cbRace->setMaxSelectionRows(10);
cbRace->addItem(dataManager.GetSysString(1310), 0); cbRace->addItem(dataManager.GetSysString(1310), 0);
for(int filter = 0x1; filter != 0x2000000; filter <<= 1) for(int filter = 0x1; filter != 0x2000000; filter <<= 1)
......
...@@ -551,6 +551,8 @@ extern Game* mainGame; ...@@ -551,6 +551,8 @@ extern Game* mainGame;
#define SCROLL_FILTER 315 #define SCROLL_FILTER 315
#define EDITBOX_KEYWORD 316 #define EDITBOX_KEYWORD 316
#define BUTTON_CLEAR_FILTER 317 #define BUTTON_CLEAR_FILTER 317
#define COMBOBOX_ATTRIBUTE 318
#define COMBOBOX_RACE 319
#define BUTTON_REPLAY_START 320 #define BUTTON_REPLAY_START 320
#define BUTTON_REPLAY_PAUSE 321 #define BUTTON_REPLAY_PAUSE 321
#define BUTTON_REPLAY_STEP 322 #define BUTTON_REPLAY_STEP 322
...@@ -564,6 +566,7 @@ extern Game* mainGame; ...@@ -564,6 +566,7 @@ extern Game* mainGame;
#define BUTTON_CANCEL_SINGLEPLAY 352 #define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECKBOX_AUTO_SEARCH 360 #define CHECKBOX_AUTO_SEARCH 360
#define COMBOBOX_SORTTYPE 370 #define COMBOBOX_SORTTYPE 370
#define COMBOBOX_LIMIT 371
#define BUTTON_MARKS_FILTER 380 #define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381 #define BUTTON_MARKERS_OK 381
......
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