Commit bf279620 authored by edo9300's avatar edo9300

Added search by Link Marker in Deck Edit

parent b0c449da
......@@ -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;
}
......@@ -921,6 +948,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;
......@@ -1002,6 +1031,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();
......
......@@ -31,6 +31,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;
......
......@@ -517,10 +517,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);
stStar = 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);
stScale = 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);
stScale = 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);
stSearch = 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);
......@@ -539,6 +539,23 @@ bool Game::Initialize() {
btnCategoryOK = env->addButton(rect<s32>(200, 175, 300, 200), wCategories, BUTTON_CATEGORY_OK, dataManager.GetSysString(1211));
for(int i = 0; i < 32; ++i)
chkCategory[i] = env->addCheckBox(false, recti(10 + (i % 4) * 130, 10 + (i / 4) * 20, 140 + (i % 4) * 130, 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"\x2196");
btnMark[1] = env->addButton(recti(45, 10, 75, 40), wLinkMarks, -1, L"\x2191");
btnMark[2] = env->addButton(recti(80, 10, 110, 40), wLinkMarks, -1, L"\x2197");
btnMark[3] = env->addButton(recti(10, 45, 40, 75), wLinkMarks, -1, L"\x2190");
btnMark[4] = env->addButton(recti(80, 45, 110, 75), wLinkMarks, -1, L"\x2192");
btnMark[5] = env->addButton(recti(10, 80, 40, 110), wLinkMarks, -1, L"\x2199");
btnMark[6] = env->addButton(recti(45, 80, 75, 110), wLinkMarks, -1, L"\x2193");
btnMark[7] = env->addButton(recti(80, 80, 110, 110), wLinkMarks, -1, L"\x2198");
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);
......@@ -1350,16 +1367,18 @@ void Game::OnResize()
cbRace->setRelativePosition(Resize(60, 49, 190, 69));
cbAttribute->setRelativePosition(Resize(60, 26, 190, 46));
cbLimit->setRelativePosition(Resize(260, 3, 390, 23));
ebStar->setRelativePosition(Resize(60, 72, 100, 92));
ebScale->setRelativePosition(Resize(150, 72, 190, 92));
ebStar->setRelativePosition(Resize(60, 60 + 100 / 6, 100, 80 + 100 / 6));
ebScale->setRelativePosition(Resize(150, 60 + 100 / 6, 190, 80 + 100 / 6));
ebAttack->setRelativePosition(Resize(260, 26, 340, 46));
ebDefense->setRelativePosition(Resize(260, 49, 340, 69));
ebCardName->setRelativePosition(Resize(260, 72, 390, 92));
btnEffectFilter->setRelativePosition(Resize(345, 28, 390, 69));
btnStartFilter->setRelativePosition(Resize(260, 96, 390, 118));
btnClearFilter->setRelativePosition(Resize(205, 96, 255, 118));
btnMarksFilter->setRelativePosition(Resize(60, 80 + 125 / 6, 190, 100 + 125 / 6));
wCategories->setRelativePosition(ResizeWin(450, 60, 1000, 270));
wLinkMarks->setRelativePosition(ResizeWin(700, 30, 820, 150));
stBanlist->setRelativePosition(ResizeWin(10, 9, 100, 29));
stDeck->setRelativePosition(ResizeWin(10, 39, 100, 59));
stCategory->setRelativePosition(ResizeWin(10, 5, 70, 25));
......@@ -1368,9 +1387,9 @@ void Game::OnResize()
stRace->setRelativePosition(ResizeWin(10, 51, 70, 71));
stAttack->setRelativePosition(ResizeWin(205, 28, 280, 48));
stDefense->setRelativePosition(ResizeWin(205, 51, 280, 71));
stStar->setRelativePosition(ResizeWin(10, 74, 80, 94));
stStar->setRelativePosition(ResizeWin(10, 62 + 100 / 6, 80, 82 + 100 / 6));
stSearch->setRelativePosition(ResizeWin(205, 74, 280, 94));
stScale->setRelativePosition(ResizeWin(101, 74, 150, 94));
stScale->setRelativePosition(ResizeWin(101, 62 + 100 / 6, 150, 82 + 100 / 6));
btnSideOK->setRelativePosition(Resize(510, 40, 820, 80));
btnDeleteDeck->setRelativePosition(Resize(225, 95, 290, 120));
......
......@@ -421,6 +421,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;
......@@ -600,5 +604,8 @@ extern Game* mainGame;
#define SCROLL_VOLUME 362
#define COMBOBOX_SORTTYPE 370
#define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381
#define DEFAULT_DUEL_RULE 3
#endif // GAME_H
......@@ -286,6 +286,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();
......@@ -295,6 +296,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;
}
}
......
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