Commit 89f298a5 authored by mercury233's avatar mercury233 Committed by GitHub

Merge pull request #1960 from edo9300/mark_search

Added Link Markers Filter
parents 4db0b84f 857279a5
......@@ -66,6 +66,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
if(mainGame->wQuery->isVisible() && id != BUTTON_YES && id != BUTTON_NO)
break;
if(mainGame->wLinkMarks->isVisible() && id != BUTTON_MARKERS_OK)
break;
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
switch(id) {
......@@ -242,6 +244,31 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
is_clearing = false;
break;
}
case BUTTON_MARKS_FILTER: {
mainGame->PopupElement(mainGame->wLinkMarks);
break;
}
case BUTTON_MARKERS_OK: {
filter_marks = 0;
if (mainGame->btnMark[0]->isPressed())
filter_marks |= 0100;
if (mainGame->btnMark[1]->isPressed())
filter_marks |= 0200;
if (mainGame->btnMark[2]->isPressed())
filter_marks |= 0400;
if (mainGame->btnMark[3]->isPressed())
filter_marks |= 0010;
if (mainGame->btnMark[4]->isPressed())
filter_marks |= 0040;
if (mainGame->btnMark[5]->isPressed())
filter_marks |= 0001;
if (mainGame->btnMark[6]->isPressed())
filter_marks |= 0002;
if (mainGame->btnMark[7]->isPressed())
filter_marks |= 0004;
mainGame->HideElement(mainGame->wLinkMarks);
break;
}
}
break;
}
......@@ -860,6 +887,8 @@ void DeckBuilder::FilterCards() {
}
if(filter_effect && !(data.category & filter_effect))
continue;
if(filter_marks && (data.link_marker & filter_marks)!= filter_marks)
continue;
if(filter_lm) {
if(filter_lm <= 3 && (!filterList->count(ptr->first) || (*filterList)[ptr->first] != filter_lm - 1))
continue;
......@@ -921,6 +950,9 @@ void DeckBuilder::ClearFilter() {
filter_effect = 0;
for(int i = 0; i < 32; ++i)
mainGame->chkCategory[i]->setChecked(false);
filter_marks = 0;
for(int i = 0; i < 8; i++)
mainGame->btnMark[i]->setPressed(false);
}
void DeckBuilder::SortList() {
auto left = results.begin();
......
......@@ -29,6 +29,7 @@ public:
unsigned int filter_lv;
unsigned int filter_scltype;
unsigned int filter_scl;
unsigned int filter_marks;
int filter_lm;
int hovered_code;
int hovered_pos;
......
......@@ -473,10 +473,10 @@ bool Game::Initialize() {
ebDefense = env->addEditBox(L"", rect<s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter);
ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1324), rect<s32>(10, 62 + 100 / 6, 80, 82 + 100 / 6), false, false, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1336), rect<s32>(10, 82 + 125 / 6, 80, 102 + 125 / 6), false, false, wFilter);
ebScale = env->addEditBox(L"", rect<s32>(60, 80 + 125 / 6, 190, 100 + 125 / 6), true, wFilter);
env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101, 62 + 100 / 6, 150, 82 + 100 / 6), false, false, wFilter);
ebScale = env->addEditBox(L"", rect<s32>(150, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter);
ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter);
ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD);
......@@ -495,6 +495,23 @@ bool Game::Initialize() {
btnCategoryOK = env->addButton(rect<s32>(135, 175, 235, 200), wCategories, BUTTON_CATEGORY_OK, dataManager.GetSysString(1211));
for(int i = 0; i < 32; ++i)
chkCategory[i] = env->addCheckBox(false, recti(10 + (i % 4) * 90, 10 + (i / 4) * 20, 100 + (i % 4) * 90, 30 + (i / 4) * 20), wCategories, -1, dataManager.GetSysString(1100 + i));
btnMarksFilter = env->addButton(rect<s32>(60, 80 + 125 / 6, 190, 100 + 125 / 6), wFilter, BUTTON_MARKS_FILTER, dataManager.GetSysString(1374));
wLinkMarks = env->addWindow(rect<s32>(700, 30, 820, 150), false, dataManager.strBuffer);
wLinkMarks->getCloseButton()->setVisible(false);
wLinkMarks->setDrawTitlebar(false);
wLinkMarks->setDraggable(false);
wLinkMarks->setVisible(false);
btnMarksOK = env->addButton(recti(45, 45, 75, 75), wLinkMarks, BUTTON_MARKERS_OK, dataManager.GetSysString(1211));
btnMark[0] = env->addButton(recti(10, 10, 40, 40), wLinkMarks, -1, L"\u2196");
btnMark[1] = env->addButton(recti(45, 10, 75, 40), wLinkMarks, -1, L"\u2191");
btnMark[2] = env->addButton(recti(80, 10, 110, 40), wLinkMarks, -1, L"\u2197");
btnMark[3] = env->addButton(recti(10, 45, 40, 75), wLinkMarks, -1, L"\u2190");
btnMark[4] = env->addButton(recti(80, 45, 110, 75), wLinkMarks, -1, L"\u2192");
btnMark[5] = env->addButton(recti(10, 80, 40, 110), wLinkMarks, -1, L"\u2199");
btnMark[6] = env->addButton(recti(45, 80, 75, 110), wLinkMarks, -1, L"\u2193");
btnMark[7] = env->addButton(recti(80, 80, 110, 110), wLinkMarks, -1, L"\u2198");
for(int i=0;i<8;i++)
btnMark[i]->setIsPushButton(true);
//replay window
wReplay = env->addWindow(rect<s32>(220, 100, 800, 520), false, dataManager.GetSysString(1202));
wReplay->getCloseButton()->setVisible(false);
......
......@@ -384,6 +384,10 @@ public:
irr::gui::IGUIWindow* wCategories;
irr::gui::IGUICheckBox* chkCategory[32];
irr::gui::IGUIButton* btnCategoryOK;
irr::gui::IGUIButton* btnMarksFilter;
irr::gui::IGUIWindow* wLinkMarks;
irr::gui::IGUIButton* btnMark[8];
irr::gui::IGUIButton* btnMarksOK;
//sort type
irr::gui::IGUIStaticText* wSort;
irr::gui::IGUIComboBox* cbSortType;
......@@ -540,5 +544,8 @@ extern Game* mainGame;
#define BUTTON_CANCEL_SINGLEPLAY 352
#define COMBOBOX_SORTTYPE 370
#define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381
#define DEFAULT_DUEL_RULE 3
#endif // GAME_H
......@@ -271,6 +271,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->ebStar->setEnabled(false);
mainGame->ebScale->setEnabled(false);
mainGame->deckBuilder.filter_effect = 0;
mainGame->deckBuilder.filter_marks = 0;
mainGame->deckBuilder.result_string[0] = L'0';
mainGame->deckBuilder.result_string[1] = 0;
mainGame->deckBuilder.results.clear();
......@@ -280,6 +281,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->device->setEventReceiver(&mainGame->deckBuilder);
for(int i = 0; i < 32; ++i)
mainGame->chkCategory[i]->setChecked(false);
for(int i = 0; i < 8; i++)
mainGame->btnMark[i]->setPressed(false);
break;
}
}
......
......@@ -358,6 +358,7 @@
!system 1371 攻击↑
!system 1372 守备↑
!system 1373 名称↓
!system 1374 连接标记
!system 1390 等待行动中...
!system 1391 等待行动中....
!system 1392 等待行动中.....
......
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