Commit c1856c89 authored by mercury233's avatar mercury233

update auto search

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