void Actions::RebuildPosibleListOfActions() { // save our current position // so that if the user has selected the second item in the list // we still show the second item, even if the list has changed. auto uSave = m_uCommand; // remove the previous list of items. ClearSearch(); // get the possible list of commands. const auto aoa = GetListOfPossibleCommands(); // make sure that we are withing our new limits. auto matchSize = aoa.size(); if( matchSize == 0 ) { return; } uSave = uSave > matchSize ? matchSize : uSave; // get the lock myodd::threads::Lock guard(_mutexActionsMatch); // reset the possible matches // we don't delete all the pointers. // because they do no belong to it. _actionsMatch = aoa; // and set it. m_uCommand = uSave; }
void DeckBuilder::Initialize() { mainGame->is_building = true; mainGame->is_siding = false; mainGame->wInfos->setVisible(true); mainGame->wCardImg->setVisible(true); mainGame->wDeckEdit->setVisible(true); mainGame->wFilter->setVisible(true); mainGame->wSort->setVisible(true); mainGame->btnLeaveGame->setVisible(true); mainGame->btnLeaveGame->setText(dataManager.GetSysString(1306)); mainGame->btnSideOK->setVisible(false); mainGame->btnSideShuffle->setVisible(false); mainGame->btnSideSort->setVisible(false); mainGame->btnSideReload->setVisible(false); filterList = deckManager._lfList[0].content; mainGame->cbDBLFList->setSelected(0); ClearSearch(); mouse_pos.set(0, 0); hovered_code = 0; hovered_pos = 0; hovered_seq = -1; is_lastcard = 0; is_draging = false; prev_deck = mainGame->cbDBDecks->getSelected(); prev_operation = 0; mainGame->device->setEventReceiver(this); }
// ------------------------------------------------------------- void Actions::ClearAll() { { // get the lock myodd::threads::Lock guard( _mutexActions ); // delete all the pointers. for (auto it = _actions.begin(); it != _actions.end(); ++it) { delete *it; } _actions.clear(); } // clear all the searches. ClearSearch(); }
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(); if(mainGame->wCategories->isVisible() && id != BUTTON_CATEGORY_OK) 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) { case BUTTON_CLEAR_DECK: { deckManager.current_deck.main.clear(); deckManager.current_deck.extra.clear(); deckManager.current_deck.side.clear(); break; } case BUTTON_SORT_DECK: { std::sort(deckManager.current_deck.main.begin(), deckManager.current_deck.main.end(), ClientCard::deck_sort_lv); std::sort(deckManager.current_deck.extra.begin(), deckManager.current_deck.extra.end(), ClientCard::deck_sort_lv); std::sort(deckManager.current_deck.side.begin(), deckManager.current_deck.side.end(), ClientCard::deck_sort_lv); break; } case BUTTON_SHUFFLE_DECK: { std::random_shuffle(deckManager.current_deck.main.begin(), deckManager.current_deck.main.end()); break; } case BUTTON_SAVE_DECK: { int sel = mainGame->cbDBDecks->getSelected(); if(sel >= 0 && deckManager.SaveDeck(deckManager.current_deck, mainGame->cbDBDecks->getItem(sel))) { mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->PopupElement(mainGame->wACMessage, 20); } break; } case BUTTON_SAVE_DECK_AS: { const wchar_t* dname = mainGame->ebDeckname->getText(); if(*dname == 0) break; int sel = -1; for(size_t i = 0; i < mainGame->cbDBDecks->getItemCount(); ++i) { if(!wcscmp(dname, mainGame->cbDBDecks->getItem(i))) { sel = i; break; } } if(sel >= 0) mainGame->cbDBDecks->setSelected(sel); else { mainGame->cbDBDecks->addItem(dname); mainGame->cbDBDecks->setSelected(mainGame->cbDBDecks->getItemCount() - 1); } if(deckManager.SaveDeck(deckManager.current_deck, dname)) { mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->PopupElement(mainGame->wACMessage, 20); } break; } case BUTTON_DELETE_DECK: { int sel = mainGame->cbDBDecks->getSelected(); if(sel == -1) break; mainGame->gMutex.Lock(); wchar_t textBuffer[256]; myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer); mainGame->PopupElement(mainGame->wQuery); mainGame->gMutex.Unlock(); prev_operation = id; break; } case BUTTON_LEAVE_GAME: { Terminate(); break; } case BUTTON_EFFECT_FILTER: { mainGame->PopupElement(mainGame->wCategories); break; } case BUTTON_START_FILTER: { StartFilter(); break; } case BUTTON_CLEAR_FILTER: { ClearSearch(); break; } case BUTTON_CATEGORY_OK: { filter_effect = 0; long long filter = 0x1; for(int i = 0; i < 32; ++i, filter <<= 1) if(mainGame->chkCategory[i]->isChecked()) filter_effect |= filter; mainGame->HideElement(mainGame->wCategories); break; } case BUTTON_SIDE_OK: { if(deckManager.current_deck.main.size() != deckManager.pre_deck.main.size() || deckManager.current_deck.extra.size() != deckManager.pre_deck.extra.size() || deckManager.current_deck.side.size() != deckManager.pre_deck.side.size()) { mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410)); break; } mainGame->imgCard->setImage(imageManager.tCover[0]); mainGame->stName->setText(L""); mainGame->stInfo->setText(L""); mainGame->stDataInfo->setText(L""); mainGame->stSetName->setText(L""); mainGame->stText->setText(L""); mainGame->showingcard = 0; mainGame->scrCardText->setVisible(false); char deckbuf[1024]; char* pdeck = deckbuf; BufferIO::WriteInt32(pdeck, deckManager.current_deck.main.size() + deckManager.current_deck.extra.size()); BufferIO::WriteInt32(pdeck, deckManager.current_deck.side.size()); for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) BufferIO::WriteInt32(pdeck, deckManager.current_deck.main[i]->first); for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) BufferIO::WriteInt32(pdeck, deckManager.current_deck.extra[i]->first); for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) BufferIO::WriteInt32(pdeck, deckManager.current_deck.side[i]->first); DuelClient::SendBufferToServer(CTOS_UPDATE_DECK, deckbuf, pdeck - deckbuf); break; } case BUTTON_SIDE_RELOAD: { deckManager.current_deck = deckManager.pre_deck; break; } case BUTTON_MSG_OK: { mainGame->HideElement(mainGame->wMessage); mainGame->actionSignal.Set(); break; } case BUTTON_YES: { mainGame->HideElement(mainGame->wQuery); if(!mainGame->is_building || mainGame->is_siding) break; if(prev_operation == BUTTON_DELETE_DECK) { int sel = mainGame->cbDBDecks->getSelected(); if(deckManager.DeleteDeck(deckManager.current_deck, mainGame->cbDBDecks->getItem(sel))) { mainGame->cbDBDecks->removeItem(sel); int count = mainGame->cbDBDecks->getItemCount(); if(sel >= count) sel = count - 1; mainGame->cbDBDecks->setSelected(sel); if(sel != -1) deckManager.LoadDeck(mainGame->cbDBDecks->getItem(sel)); mainGame->stACMessage->setText(dataManager.GetSysString(1338)); mainGame->PopupElement(mainGame->wACMessage, 20); prev_deck = sel; } } else if(prev_operation == BUTTON_LEAVE_GAME) { Terminate(); } else if(prev_operation == COMBOBOX_DBDECKS) { int sel = mainGame->cbDBDecks->getSelected(); deckManager.LoadDeck(mainGame->cbDBDecks->getItem(sel)); prev_deck = sel; } prev_operation = 0; break; } case BUTTON_NO: { mainGame->HideElement(mainGame->wQuery); if (prev_operation == COMBOBOX_DBDECKS) { mainGame->cbDBDecks->setSelected(prev_deck); } prev_operation = 0; 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); StartFilter(); break; } } break; } case irr::gui::EGET_EDITBOX_ENTER: { switch(id) { case EDITBOX_KEYWORD: { StartFilter(); break; } } break; } case irr::gui::EGET_EDITBOX_CHANGED: { switch (id) { case EDITBOX_KEYWORD: { stringw filter = mainGame->ebCardName->getText(); if (filter.size() > 2) { StartFilter(); } break; } case EDITBOX_DECK_NAME: { mainGame->ValidateName(mainGame->ebDeckname); break; } } break; } case irr::gui::EGET_COMBO_BOX_CHANGED: { switch(id) { case COMBOBOX_DBLFLIST: { filterList = deckManager._lfList[mainGame->cbDBLFList->getSelected()].content; break; } case COMBOBOX_DBDECKS: { int sel = mainGame->cbDBDecks->getSelected(); if(sel >= 0) deckManager.LoadDeck(mainGame->cbDBDecks->getItem(sel)); prev_deck = sel; break; } case COMBOBOX_MAINTYPE: { mainGame->cbCardType2->setSelected(0); mainGame->cbAttribute->setSelected(0); mainGame->cbRace->setSelected(0); mainGame->ebAttack->setText(L""); mainGame->ebDefense->setText(L""); mainGame->ebStar->setText(L""); mainGame->ebScale->setText(L""); switch(mainGame->cbCardType->getSelected()) { case 0: { mainGame->cbCardType2->setEnabled(false); mainGame->cbCardType2->setSelected(0); mainGame->cbRace->setEnabled(false); mainGame->cbAttribute->setEnabled(false); mainGame->ebAttack->setEnabled(false); mainGame->ebDefense->setEnabled(false); mainGame->ebStar->setEnabled(false); mainGame->ebScale->setEnabled(false); break; } case 1: { wchar_t normaltuner[32]; wchar_t normalpen[32]; wchar_t syntuner[32]; mainGame->cbCardType2->setEnabled(true); mainGame->cbRace->setEnabled(true); mainGame->cbAttribute->setEnabled(true); mainGame->ebAttack->setEnabled(true); mainGame->ebDefense->setEnabled(true); mainGame->ebStar->setEnabled(true); mainGame->ebScale->setEnabled(true); mainGame->cbCardType2->clear(); mainGame->cbCardType2->addItem(dataManager.GetSysString(1080), 0); mainGame->cbCardType2->addItem(dataManager.GetSysString(1054), TYPE_MONSTER + TYPE_NORMAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1055), TYPE_MONSTER + TYPE_EFFECT); mainGame->cbCardType2->addItem(dataManager.GetSysString(1056), TYPE_MONSTER + TYPE_FUSION); mainGame->cbCardType2->addItem(dataManager.GetSysString(1057), TYPE_MONSTER + TYPE_RITUAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1063), TYPE_MONSTER + TYPE_SYNCHRO); mainGame->cbCardType2->addItem(dataManager.GetSysString(1073), TYPE_MONSTER + TYPE_XYZ); mainGame->cbCardType2->addItem(dataManager.GetSysString(1074), TYPE_MONSTER + TYPE_PENDULUM); mainGame->cbCardType2->addItem(dataManager.GetSysString(1076), TYPE_MONSTER + TYPE_LINK); mainGame->cbCardType2->addItem(dataManager.GetSysString(1075), TYPE_MONSTER + TYPE_SPSUMMON); myswprintf(normaltuner, L"%ls|%ls", dataManager.GetSysString(1054), dataManager.GetSysString(1062)); mainGame->cbCardType2->addItem(normaltuner, TYPE_MONSTER + TYPE_NORMAL + TYPE_TUNER); myswprintf(normalpen, L"%ls|%ls", dataManager.GetSysString(1054), dataManager.GetSysString(1074)); mainGame->cbCardType2->addItem(normalpen, TYPE_MONSTER + TYPE_NORMAL + TYPE_PENDULUM); myswprintf(syntuner, L"%ls|%ls", dataManager.GetSysString(1063), dataManager.GetSysString(1062)); mainGame->cbCardType2->addItem(syntuner, TYPE_MONSTER + TYPE_SYNCHRO + TYPE_TUNER); mainGame->cbCardType2->addItem(dataManager.GetSysString(1062), TYPE_MONSTER + TYPE_TUNER); mainGame->cbCardType2->addItem(dataManager.GetSysString(1061), TYPE_MONSTER + TYPE_DUAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1060), TYPE_MONSTER + TYPE_UNION); mainGame->cbCardType2->addItem(dataManager.GetSysString(1059), TYPE_MONSTER + TYPE_SPIRIT); mainGame->cbCardType2->addItem(dataManager.GetSysString(1071), TYPE_MONSTER + TYPE_FLIP); mainGame->cbCardType2->addItem(dataManager.GetSysString(1072), TYPE_MONSTER + TYPE_TOON); break; } case 2: { mainGame->cbCardType2->setEnabled(true); mainGame->cbRace->setEnabled(false); mainGame->cbAttribute->setEnabled(false); mainGame->ebAttack->setEnabled(false); mainGame->ebDefense->setEnabled(false); mainGame->ebStar->setEnabled(false); mainGame->ebScale->setEnabled(false); mainGame->cbCardType2->clear(); mainGame->cbCardType2->addItem(dataManager.GetSysString(1080), 0); mainGame->cbCardType2->addItem(dataManager.GetSysString(1054), TYPE_SPELL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1066), TYPE_SPELL + TYPE_QUICKPLAY); mainGame->cbCardType2->addItem(dataManager.GetSysString(1067), TYPE_SPELL + TYPE_CONTINUOUS); mainGame->cbCardType2->addItem(dataManager.GetSysString(1057), TYPE_SPELL + TYPE_RITUAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1068), TYPE_SPELL + TYPE_EQUIP); mainGame->cbCardType2->addItem(dataManager.GetSysString(1069), TYPE_SPELL + TYPE_FIELD); break; } case 3: { mainGame->cbCardType2->setEnabled(true); mainGame->cbRace->setEnabled(false); mainGame->cbAttribute->setEnabled(false); mainGame->ebAttack->setEnabled(false); mainGame->ebDefense->setEnabled(false); mainGame->ebStar->setEnabled(false); mainGame->ebScale->setEnabled(false); mainGame->cbCardType2->clear(); mainGame->cbCardType2->addItem(dataManager.GetSysString(1080), 0); mainGame->cbCardType2->addItem(dataManager.GetSysString(1054), TYPE_TRAP); mainGame->cbCardType2->addItem(dataManager.GetSysString(1067), TYPE_TRAP + TYPE_CONTINUOUS); mainGame->cbCardType2->addItem(dataManager.GetSysString(1070), TYPE_TRAP + TYPE_COUNTER); break; } } StartFilter(); break; } case COMBOBOX_SECONDTYPE: case COMBOBOX_OTHER_FILT: { if (id==COMBOBOX_SECONDTYPE && mainGame->cbCardType->getSelected() == 1) { if (mainGame->cbCardType2->getSelected() == 8) { mainGame->ebDefense->setEnabled(false); mainGame->ebDefense->setText(L""); } else { mainGame->ebDefense->setEnabled(true); } } StartFilter(); break; } case COMBOBOX_SORTTYPE: { SortList(); mainGame->env->setFocus(0); break; } } break; } case irr::gui::EGET_CHECKBOX_CHANGED: { switch (id) { case CHECKBOX_SHOW_ANIME: { int prevLimit = mainGame->cbLimit->getSelected(); mainGame->cbLimit->clear(); mainGame->cbLimit->addItem(dataManager.GetSysString(1310)); mainGame->cbLimit->addItem(dataManager.GetSysString(1316)); mainGame->cbLimit->addItem(dataManager.GetSysString(1317)); mainGame->cbLimit->addItem(dataManager.GetSysString(1318)); mainGame->cbLimit->addItem(dataManager.GetSysString(1240)); mainGame->cbLimit->addItem(dataManager.GetSysString(1241)); mainGame->cbLimit->addItem(dataManager.GetSysString(1242)); if(mainGame->chkAnime->isChecked()) { mainGame->cbLimit->addItem(dataManager.GetSysString(1243)); mainGame->cbLimit->addItem(L"Illegal"); mainGame->cbLimit->addItem(L"VG"); mainGame->cbLimit->addItem(L"Custom"); } if (prevLimit < 8) mainGame->cbLimit->setSelected(prevLimit); StartFilter(); break; } } break; } default: break; } break; } case irr::EET_MOUSE_INPUT_EVENT: { switch(event.MouseInput.Event) { case irr::EMIE_LMOUSE_PRESSED_DOWN: { irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); if(root->getElementFromPoint(mouse_pos) != root) break; if(mainGame->wCategories->isVisible() || mainGame->wQuery->isVisible()) break; if(hovered_pos == 0 || hovered_seq == -1) break; click_pos = hovered_pos; dragx = event.MouseInput.X; dragy = event.MouseInput.Y; draging_pointer = dataManager.GetCodePointer(hovered_code); if(draging_pointer == dataManager._datas.end()) break; if(hovered_pos == 4) { if(!check_limit(draging_pointer)) break; } is_draging = true; if(hovered_pos == 1) pop_main(hovered_seq); else if(hovered_pos == 2) pop_extra(hovered_seq); else if(hovered_pos == 3) pop_side(hovered_seq); mouse_pos.set(event.MouseInput.X, event.MouseInput.Y); GetHoveredCard(); break; } case irr::EMIE_LMOUSE_LEFT_UP: { if(!is_draging) break; bool pushed = false; if(hovered_pos == 1) pushed = push_main(draging_pointer, hovered_seq); else if(hovered_pos == 2) pushed = push_extra(draging_pointer, hovered_seq + is_lastcard); else if(hovered_pos == 3) pushed = push_side(draging_pointer, hovered_seq + is_lastcard); else if(hovered_pos == 4 && !mainGame->is_siding) pushed = true; if(!pushed) { if(click_pos == 1) push_main(draging_pointer); else if(click_pos == 2) push_extra(draging_pointer); else if(click_pos == 3) push_side(draging_pointer); } is_draging = false; break; } case irr::EMIE_RMOUSE_LEFT_UP: { if(mainGame->is_siding) { if(is_draging) break; if(hovered_pos == 0 || hovered_seq == -1) break; auto pointer = dataManager.GetCodePointer(hovered_code); if(pointer == dataManager._datas.end()) break; if(hovered_pos == 1) { if(push_side(pointer)) pop_main(hovered_seq); } else if(hovered_pos == 2) { if(push_side(pointer)) pop_extra(hovered_seq); } else { if(push_extra(pointer) || push_main(pointer)) pop_side(hovered_seq); } break; } if(mainGame->wCategories->isVisible() || mainGame->wQuery->isVisible()) break; if(!is_draging) { if(hovered_pos == 0 || hovered_seq == -1) break; if(hovered_pos == 1) { pop_main(hovered_seq); } else if(hovered_pos == 2) { pop_extra(hovered_seq); } else if(hovered_pos == 3) { pop_side(hovered_seq); } else { auto pointer = dataManager.GetCodePointer(hovered_code); if(pointer == dataManager._datas.end()) break; if(event.MouseInput.Shift) push_side(pointer); else { if (!check_limit(pointer)) break; if (!push_extra(pointer) && !push_main(pointer)) push_side(pointer); } } } else { if(click_pos == 1) { push_side(draging_pointer); } else if(click_pos == 2) { push_side(draging_pointer); } else if(click_pos == 3) { if(!push_extra(draging_pointer)) push_main(draging_pointer); } else { push_side(draging_pointer); } is_draging = false; } break; } case irr::EMIE_MMOUSE_LEFT_UP: { if (mainGame->is_siding) break; if (mainGame->wCategories->isVisible() || mainGame->wQuery->isVisible()) break; if (hovered_pos == 0 || hovered_seq == -1) break; if (is_draging) break; auto pointer = dataManager.GetCodePointer(hovered_code); if(!check_limit(pointer)) break; if (hovered_pos == 1) { if(!push_main(pointer)) push_side(pointer); } else if (hovered_pos == 2) { if(!push_extra(pointer)) push_side(pointer); } else if (hovered_pos == 3) { if(!push_side(pointer) && !push_extra(pointer)) push_main(pointer); } else { if(!push_extra(pointer) && !push_main(pointer)) push_side(pointer); } break; } case irr::EMIE_MOUSE_MOVED: { mouse_pos.set(event.MouseInput.X, event.MouseInput.Y); GetHoveredCard(); break; } case irr::EMIE_MOUSE_WHEEL: { if(!mainGame->scrFilter->isVisible()) break; if(!mainGame->Resize(805, 160, 1020, 630).isPointInside(mouse_pos)) break; if(event.MouseInput.Wheel < 0) { if(mainGame->scrFilter->getPos() < mainGame->scrFilter->getMax()) mainGame->scrFilter->setPos(mainGame->scrFilter->getPos() + 1); } else { if(mainGame->scrFilter->getPos() > 0) mainGame->scrFilter->setPos(mainGame->scrFilter->getPos() - 1); } GetHoveredCard(); break; } default: break; } break; } default: break; } return false; }
bool DeckBuilder::OnEvent(const irr::SEvent& event) { switch(event.EventType) { case irr::EET_GUI_EVENT: { s32 id = event.GUIEvent.Caller->getID(); if(mainGame->wCategories->isVisible() && id != BUTTON_CATEGORY_OK) break; if(mainGame->wQuery->isVisible() && id != BUTTON_YES && id != BUTTON_NO) break; switch(event.GUIEvent.EventType) { case irr::gui::EGET_BUTTON_CLICKED: { switch(id) { case BUTTON_CLEAR_DECK: { mainGame->gMutex.Lock(); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1339)); mainGame->PopupElement(mainGame->wQuery); mainGame->gMutex.Unlock(); is_clearing = true; break; } case BUTTON_SORT_DECK: { std::sort(deckManager.current_deck.main.begin(), deckManager.current_deck.main.end(), ClientCard::deck_sort_lv); std::sort(deckManager.current_deck.extra.begin(), deckManager.current_deck.extra.end(), ClientCard::deck_sort_lv); std::sort(deckManager.current_deck.side.begin(), deckManager.current_deck.side.end(), ClientCard::deck_sort_lv); break; } case BUTTON_SHUFFLE_DECK: { std::random_shuffle(deckManager.current_deck.main.begin(), deckManager.current_deck.main.end()); break; } case BUTTON_SAVE_DECK: { if(deckManager.SaveDeck(deckManager.current_deck, mainGame->cbDBDecks->getItem(mainGame->cbDBDecks->getSelected()))) { mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->PopupElement(mainGame->wACMessage, 20); } break; } case BUTTON_SAVE_DECK_AS: { const wchar_t* dname = mainGame->ebDeckname->getText(); if(*dname == 0) break; int sel = -1; for(size_t i = 0; i < mainGame->cbDBDecks->getItemCount(); ++i) { if(!wcscmp(dname, mainGame->cbDBDecks->getItem(i))) { sel = i; break; } } if(sel >= 0) mainGame->cbDBDecks->setSelected(sel); else { mainGame->cbDBDecks->addItem(dname); mainGame->cbDBDecks->setSelected(mainGame->cbDBDecks->getItemCount() - 1); } if(deckManager.SaveDeck(deckManager.current_deck, dname)) { mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->PopupElement(mainGame->wACMessage, 20); } break; } case BUTTON_DELETE_DECK: { int sel = mainGame->cbDBDecks->getSelected(); if(sel == -1) break; mainGame->gMutex.Lock(); wchar_t textBuffer[256]; myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer); mainGame->PopupElement(mainGame->wQuery); mainGame->gMutex.Unlock(); is_deleting = true; break; } case BUTTON_LEAVE_GAME: { mainGame->is_building = false; mainGame->wDeckEdit->setVisible(false); mainGame->wCategories->setVisible(false); mainGame->wFilter->setVisible(false); mainGame->wSort->setVisible(false); mainGame->wCardImg->setVisible(false); mainGame->wInfos->setVisible(false); mainGame->btnLeaveGame->setVisible(false); mainGame->PopupElement(mainGame->wMainMenu); mainGame->device->setEventReceiver(&mainGame->menuHandler); mainGame->wACMessage->setVisible(false); imageManager.ClearTexture(); mainGame->scrFilter->setVisible(false); if(mainGame->cbDBDecks->getSelected() != -1) { BufferIO::CopyWStr(mainGame->cbDBDecks->getItem(mainGame->cbDBDecks->getSelected()), mainGame->gameConf.lastdeck, 64); } if(exit_on_return) mainGame->device->closeDevice(); break; } case BUTTON_EFFECT_FILTER: { mainGame->PopupElement(mainGame->wCategories); break; } case BUTTON_START_FILTER: { filter_type = mainGame->cbCardType->getSelected(); filter_type2 = mainGame->cbCardType2->getItemData(mainGame->cbCardType2->getSelected()); filter_lm = mainGame->cbLimit->getSelected(); if(filter_type == 1) { filter_attrib = mainGame->cbAttribute->getItemData(mainGame->cbAttribute->getSelected()); filter_race = mainGame->cbRace->getItemData(mainGame->cbRace->getSelected()); filter_atk = parse_filter(mainGame->ebAttack->getText(), &filter_atktype); filter_def = parse_filter(mainGame->ebDefense->getText(), &filter_deftype); filter_lv = parse_filter(mainGame->ebStar->getText(), &filter_lvtype); filter_scl = parse_filter(mainGame->ebScale->getText(), &filter_scltype); } FilterCards(); if(!mainGame->gameConf.separate_clear_button) ClearFilter(); break; } case BUTTON_CLEAR_FILTER: { ClearSearch(); break; } case BUTTON_CATEGORY_OK: { filter_effect = 0; long long filter = 0x1; for(int i = 0; i < 32; ++i, filter <<= 1) if(mainGame->chkCategory[i]->isChecked()) filter_effect |= filter; mainGame->HideElement(mainGame->wCategories); break; } case BUTTON_SIDE_OK: { if(deckManager.current_deck.main.size() != pre_mainc || deckManager.current_deck.extra.size() != pre_extrac || deckManager.current_deck.side.size() != pre_sidec) { mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410)); break; } char deckbuf[1024]; char* pdeck = deckbuf; BufferIO::WriteInt32(pdeck, deckManager.current_deck.main.size() + deckManager.current_deck.extra.size()); BufferIO::WriteInt32(pdeck, deckManager.current_deck.side.size()); for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) BufferIO::WriteInt32(pdeck, deckManager.current_deck.main[i]->first); for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) BufferIO::WriteInt32(pdeck, deckManager.current_deck.extra[i]->first); for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) BufferIO::WriteInt32(pdeck, deckManager.current_deck.side[i]->first); DuelClient::SendBufferToServer(CTOS_UPDATE_DECK, deckbuf, pdeck - deckbuf); break; } case BUTTON_YES: { mainGame->HideElement(mainGame->wQuery); if(!mainGame->is_building || mainGame->is_siding) break; if(is_clearing) { deckManager.current_deck.main.clear(); deckManager.current_deck.extra.clear(); deckManager.current_deck.side.clear(); } else if(is_deleting) { int sel = mainGame->cbDBDecks->getSelected(); if (deckManager.DeleteDeck(deckManager.current_deck, mainGame->cbDBDecks->getItem(sel))) { mainGame->cbDBDecks->removeItem(sel); int count = mainGame->cbDBDecks->getItemCount(); if (sel >= count) sel = count - 1; mainGame->cbDBDecks->setSelected(sel); if (sel != -1) deckManager.LoadDeck(mainGame->cbDBDecks->getItem(sel)); mainGame->stACMessage->setText(dataManager.GetSysString(1338)); mainGame->PopupElement(mainGame->wACMessage, 20); } } is_clearing = false; is_deleting = false; break; } case BUTTON_NO: { mainGame->HideElement(mainGame->wQuery); is_deleting = false; is_clearing = false; 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); break; } break; } } case irr::gui::EGET_EDITBOX_ENTER: { switch(id) { case EDITBOX_KEYWORD: { irr::SEvent me; me.EventType = irr::EET_GUI_EVENT; me.GUIEvent.EventType = irr::gui::EGET_BUTTON_CLICKED; me.GUIEvent.Caller = mainGame->btnStartFilter; me.GUIEvent.Element = mainGame->btnStartFilter; mainGame->device->postEventFromUser(me); break; } } break; } case irr::gui::EGET_COMBO_BOX_CHANGED: { switch(id) { case COMBOBOX_DBLFLIST: { filterList = deckManager._lfList[mainGame->cbDBLFList->getSelected()].content; break; } case COMBOBOX_DBDECKS: { deckManager.LoadDeck(mainGame->cbDBDecks->getItem(mainGame->cbDBDecks->getSelected())); break; } case COMBOBOX_MAINTYPE: { mainGame->cbCardType2->setSelected(0); mainGame->cbAttribute->setSelected(0); mainGame->cbRace->setSelected(0); mainGame->ebAttack->setText(L""); mainGame->ebDefense->setText(L""); mainGame->ebStar->setText(L""); mainGame->ebScale->setText(L""); switch(mainGame->cbCardType->getSelected()) { case 0: { mainGame->cbCardType2->setEnabled(false); mainGame->cbCardType2->setSelected(0); mainGame->cbRace->setEnabled(false); mainGame->cbAttribute->setEnabled(false); mainGame->ebAttack->setEnabled(false); mainGame->ebDefense->setEnabled(false); mainGame->ebStar->setEnabled(false); mainGame->ebScale->setEnabled(false); break; } case 1: { wchar_t normaltuner[32]; wchar_t normalpen[32]; wchar_t syntuner[32]; mainGame->cbCardType2->setEnabled(true); mainGame->cbRace->setEnabled(true); mainGame->cbAttribute->setEnabled(true); mainGame->ebAttack->setEnabled(true); mainGame->ebDefense->setEnabled(true); mainGame->ebStar->setEnabled(true); mainGame->ebScale->setEnabled(true); mainGame->cbCardType2->clear(); mainGame->cbCardType2->addItem(dataManager.GetSysString(1080), 0); mainGame->cbCardType2->addItem(dataManager.GetSysString(1054), TYPE_MONSTER + TYPE_NORMAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1055), TYPE_MONSTER + TYPE_EFFECT); mainGame->cbCardType2->addItem(dataManager.GetSysString(1056), TYPE_MONSTER + TYPE_FUSION); mainGame->cbCardType2->addItem(dataManager.GetSysString(1057), TYPE_MONSTER + TYPE_RITUAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1063), TYPE_MONSTER + TYPE_SYNCHRO); mainGame->cbCardType2->addItem(dataManager.GetSysString(1073), TYPE_MONSTER + TYPE_XYZ); mainGame->cbCardType2->addItem(dataManager.GetSysString(1074), TYPE_MONSTER + TYPE_PENDULUM); myswprintf(normaltuner, L"%ls|%ls", dataManager.GetSysString(1054), dataManager.GetSysString(1062)); mainGame->cbCardType2->addItem(normaltuner, TYPE_MONSTER + TYPE_NORMAL + TYPE_TUNER); myswprintf(normalpen, L"%ls|%ls", dataManager.GetSysString(1054), dataManager.GetSysString(1074)); mainGame->cbCardType2->addItem(normalpen, TYPE_MONSTER + TYPE_NORMAL + TYPE_PENDULUM); myswprintf(syntuner, L"%ls|%ls", dataManager.GetSysString(1063), dataManager.GetSysString(1062)); mainGame->cbCardType2->addItem(syntuner, TYPE_MONSTER + TYPE_SYNCHRO + TYPE_TUNER); mainGame->cbCardType2->addItem(dataManager.GetSysString(1062), TYPE_MONSTER + TYPE_TUNER); mainGame->cbCardType2->addItem(dataManager.GetSysString(1061), TYPE_MONSTER + TYPE_DUAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1060), TYPE_MONSTER + TYPE_UNION); mainGame->cbCardType2->addItem(dataManager.GetSysString(1059), TYPE_MONSTER + TYPE_SPIRIT); mainGame->cbCardType2->addItem(dataManager.GetSysString(1071), TYPE_MONSTER + TYPE_FLIP); mainGame->cbCardType2->addItem(dataManager.GetSysString(1072), TYPE_MONSTER + TYPE_TOON); break; } case 2: { mainGame->cbCardType2->setEnabled(true); mainGame->cbRace->setEnabled(false); mainGame->cbAttribute->setEnabled(false); mainGame->ebAttack->setEnabled(false); mainGame->ebDefense->setEnabled(false); mainGame->ebStar->setEnabled(false); mainGame->ebScale->setEnabled(false); mainGame->cbCardType2->clear(); mainGame->cbCardType2->addItem(dataManager.GetSysString(1080), 0); mainGame->cbCardType2->addItem(dataManager.GetSysString(1054), TYPE_SPELL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1066), TYPE_SPELL + TYPE_QUICKPLAY); mainGame->cbCardType2->addItem(dataManager.GetSysString(1067), TYPE_SPELL + TYPE_CONTINUOUS); mainGame->cbCardType2->addItem(dataManager.GetSysString(1057), TYPE_SPELL + TYPE_RITUAL); mainGame->cbCardType2->addItem(dataManager.GetSysString(1068), TYPE_SPELL + TYPE_EQUIP); mainGame->cbCardType2->addItem(dataManager.GetSysString(1069), TYPE_SPELL + TYPE_FIELD); break; } case 3: { mainGame->cbCardType2->setEnabled(true); mainGame->cbRace->setEnabled(false); mainGame->cbAttribute->setEnabled(false); mainGame->ebAttack->setEnabled(false); mainGame->ebDefense->setEnabled(false); mainGame->ebStar->setEnabled(false); mainGame->ebScale->setEnabled(false); mainGame->cbCardType2->clear(); mainGame->cbCardType2->addItem(dataManager.GetSysString(1080), 0); mainGame->cbCardType2->addItem(dataManager.GetSysString(1054), TYPE_TRAP); mainGame->cbCardType2->addItem(dataManager.GetSysString(1067), TYPE_TRAP + TYPE_CONTINUOUS); mainGame->cbCardType2->addItem(dataManager.GetSysString(1070), TYPE_TRAP + TYPE_COUNTER); break; } } break; } case COMBOBOX_SORTTYPE: { SortList(); mainGame->env->setFocus(0); break; } } } default: break; } break; } case irr::EET_MOUSE_INPUT_EVENT: { switch(event.MouseInput.Event) { case irr::EMIE_LMOUSE_PRESSED_DOWN: { irr::core::position2di mouse_pos(event.MouseInput.X, event.MouseInput.Y); irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); if(root->getElementFromPoint(mouse_pos) != root) break; if(mainGame->wCategories->isVisible() || mainGame->wQuery->isVisible()) break; if(hovered_pos == 0 || hovered_seq == -1) break; click_pos = hovered_pos; dragx = event.MouseInput.X; dragy = event.MouseInput.Y; draging_pointer = dataManager.GetCodePointer(hovered_code); if(draging_pointer == dataManager._datas.end()) break; unsigned int limitcode = draging_pointer->second.alias ? draging_pointer->second.alias : draging_pointer->first; if(hovered_pos == 4) { int limit = 3; if(filterList->count(limitcode)) limit = (*filterList)[limitcode]; for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) if(deckManager.current_deck.main[i]->first == limitcode || deckManager.current_deck.main[i]->second.alias == limitcode) limit--; for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) if(deckManager.current_deck.extra[i]->first == limitcode || deckManager.current_deck.extra[i]->second.alias == limitcode) limit--; for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) if(deckManager.current_deck.side[i]->first == limitcode || deckManager.current_deck.side[i]->second.alias == limitcode) limit--; if(limit <= 0) break; } if(hovered_pos == 1) deckManager.current_deck.main.erase(deckManager.current_deck.main.begin() + hovered_seq); else if(hovered_pos == 2) deckManager.current_deck.extra.erase(deckManager.current_deck.extra.begin() + hovered_seq); else if(hovered_pos == 3) deckManager.current_deck.side.erase(deckManager.current_deck.side.begin() + hovered_seq); is_draging = true; break; } case irr::EMIE_LMOUSE_LEFT_UP: { if(!is_draging) break; if(!mainGame->is_siding) { if((hovered_pos == 1 && (draging_pointer->second.type & 0x802040)) || (hovered_pos == 2 && !(draging_pointer->second.type & 0x802040))) hovered_pos = 0; if((hovered_pos == 1 || (hovered_pos == 0 && click_pos == 1)) && deckManager.current_deck.main.size() < 60) { if(hovered_seq == -1) deckManager.current_deck.main.push_back(draging_pointer); else if(hovered_seq < (int)deckManager.current_deck.main.size() && hovered_pos) deckManager.current_deck.main.insert(deckManager.current_deck.main.begin() + hovered_seq, draging_pointer); else deckManager.current_deck.main.push_back(draging_pointer); is_draging = false; } else if((hovered_pos == 2 || (hovered_pos == 0 && click_pos == 2)) && deckManager.current_deck.extra.size() < 15) { if(hovered_seq == -1) deckManager.current_deck.extra.push_back(draging_pointer); else if(hovered_seq < (int)deckManager.current_deck.extra.size() && hovered_pos) deckManager.current_deck.extra.insert(deckManager.current_deck.extra.begin() + hovered_seq, draging_pointer); else deckManager.current_deck.extra.push_back(draging_pointer); is_draging = false; } else if((hovered_pos == 3 || (hovered_pos == 0 && click_pos == 3)) && deckManager.current_deck.side.size() < 15) { if(hovered_seq == -1) deckManager.current_deck.side.push_back(draging_pointer); else if(hovered_seq < (int)deckManager.current_deck.side.size() && hovered_pos) deckManager.current_deck.side.insert(deckManager.current_deck.side.begin() + hovered_seq, draging_pointer); else deckManager.current_deck.side.push_back(draging_pointer); is_draging = false; } else if (hovered_pos == 4) is_draging = false; } else { if((hovered_pos == 1 && (draging_pointer->second.type & 0x802040)) || (hovered_pos == 2 && !(draging_pointer->second.type & 0x802040)) || hovered_pos == 4) hovered_pos = 0; if((hovered_pos == 1 || (hovered_pos == 0 && click_pos == 1)) && deckManager.current_deck.main.size() < 65) { if(hovered_seq == -1) deckManager.current_deck.main.push_back(draging_pointer); else if(hovered_seq < (int)deckManager.current_deck.main.size() && hovered_pos) deckManager.current_deck.main.insert(deckManager.current_deck.main.begin() + hovered_seq, draging_pointer); else deckManager.current_deck.main.push_back(draging_pointer); is_draging = false; } else if((hovered_pos == 2 || (hovered_pos == 0 && click_pos == 2)) && deckManager.current_deck.extra.size() < 20) { if(hovered_seq == -1) deckManager.current_deck.extra.push_back(draging_pointer); else if(hovered_seq < (int)deckManager.current_deck.extra.size() && hovered_pos) deckManager.current_deck.extra.insert(deckManager.current_deck.extra.begin() + hovered_seq, draging_pointer); else deckManager.current_deck.extra.push_back(draging_pointer); is_draging = false; } else if((hovered_pos == 3 || (hovered_pos == 0 && click_pos == 3)) && deckManager.current_deck.side.size() < 20) { if(hovered_seq == -1) deckManager.current_deck.side.push_back(draging_pointer); else if(hovered_seq < (int)deckManager.current_deck.side.size() && hovered_pos) deckManager.current_deck.side.insert(deckManager.current_deck.side.begin() + hovered_seq, draging_pointer); else deckManager.current_deck.side.push_back(draging_pointer); is_draging = false; } } if(is_draging) { if(click_pos == 1) deckManager.current_deck.main.push_back(draging_pointer); else if(click_pos == 2) deckManager.current_deck.extra.push_back(draging_pointer); else if(click_pos == 3) deckManager.current_deck.side.push_back(draging_pointer); } is_draging = false; break; } case irr::EMIE_RMOUSE_LEFT_UP: { if(mainGame->is_siding) { if(is_draging) break; if(hovered_pos == 0 || hovered_seq == -1) break; draging_pointer = dataManager.GetCodePointer(hovered_code); if(draging_pointer == dataManager._datas.end()) break; if(hovered_pos == 1) { if(deckManager.current_deck.side.size() < 20) { deckManager.current_deck.main.erase(deckManager.current_deck.main.begin() + hovered_seq); deckManager.current_deck.side.push_back(draging_pointer); } } else if(hovered_pos == 2) { if(deckManager.current_deck.side.size() < 20) { deckManager.current_deck.extra.erase(deckManager.current_deck.extra.begin() + hovered_seq); deckManager.current_deck.side.push_back(draging_pointer); } } else { if((draging_pointer->second.type & 0x802040) && deckManager.current_deck.extra.size() < 20) { deckManager.current_deck.side.erase(deckManager.current_deck.side.begin() + hovered_seq); deckManager.current_deck.extra.push_back(draging_pointer); } if(!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 64) { deckManager.current_deck.side.erase(deckManager.current_deck.side.begin() + hovered_seq); deckManager.current_deck.main.push_back(draging_pointer); } } break; } if(mainGame->wCategories->isVisible() || mainGame->wQuery->isVisible()) break; if(hovered_pos == 0 || hovered_seq == -1) break; if(!is_draging) { draging_pointer = dataManager.GetCodePointer(hovered_code); if(draging_pointer == dataManager._datas.end()) break; } if(hovered_pos == 1) { if(!is_draging) deckManager.current_deck.main.erase(deckManager.current_deck.main.begin() + hovered_seq); else if(deckManager.current_deck.side.size() < 15) { deckManager.current_deck.side.push_back(draging_pointer); is_draging = false; } } else if(hovered_pos == 2) { if(!is_draging) deckManager.current_deck.extra.erase(deckManager.current_deck.extra.begin() + hovered_seq); else if(deckManager.current_deck.side.size() < 15) { deckManager.current_deck.side.push_back(draging_pointer); is_draging = false; } } else if(hovered_pos == 3) { if(!is_draging) deckManager.current_deck.side.erase(deckManager.current_deck.side.begin() + hovered_seq); else { if((draging_pointer->second.type & 0x802040) && deckManager.current_deck.extra.size() < 15) { deckManager.current_deck.extra.push_back(draging_pointer); is_draging = false; } else if(!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 60) { deckManager.current_deck.main.push_back(draging_pointer); is_draging = false; } } } else { if(is_draging) { if(deckManager.current_deck.side.size() < 15) { deckManager.current_deck.side.push_back(draging_pointer); is_draging = false; } } else { unsigned int limitcode = draging_pointer->second.alias ? draging_pointer->second.alias : draging_pointer->first; int limit = 3; if(filterList->count(limitcode)) limit = (*filterList)[limitcode]; for(size_t i = 0; i < deckManager.current_deck.main.size(); ++i) if(deckManager.current_deck.main[i]->first == limitcode || deckManager.current_deck.main[i]->second.alias == limitcode) limit--; for(size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) if(deckManager.current_deck.extra[i]->first == limitcode || deckManager.current_deck.extra[i]->second.alias == limitcode) limit--; for(size_t i = 0; i < deckManager.current_deck.side.size(); ++i) if(deckManager.current_deck.side[i]->first == limitcode || deckManager.current_deck.side[i]->second.alias == limitcode) limit--; if(limit <= 0) break; if((draging_pointer->second.type & 0x802040) && deckManager.current_deck.extra.size() < 15) { deckManager.current_deck.extra.push_back(draging_pointer); } else if(!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 60) { deckManager.current_deck.main.push_back(draging_pointer); } else if (deckManager.current_deck.side.size() < 15) { deckManager.current_deck.side.push_back(draging_pointer); } } } break; } case irr::EMIE_MMOUSE_LEFT_UP: { if (mainGame->is_siding) break; if (mainGame->wCategories->isVisible() || mainGame->wQuery->isVisible()) break; if (hovered_pos == 0 || hovered_seq == -1) break; if (is_draging) break; draging_pointer = dataManager.GetCodePointer(hovered_code); unsigned int limitcode = draging_pointer->second.alias ? draging_pointer->second.alias : draging_pointer->first; int limit = 3; if (filterList->count(limitcode)) limit = (*filterList)[limitcode]; for (size_t i = 0; i < deckManager.current_deck.main.size(); ++i) if (deckManager.current_deck.main[i]->first == limitcode || deckManager.current_deck.main[i]->second.alias == limitcode) limit--; for (size_t i = 0; i < deckManager.current_deck.extra.size(); ++i) if (deckManager.current_deck.extra[i]->first == limitcode || deckManager.current_deck.extra[i]->second.alias == limitcode) limit--; for (size_t i = 0; i < deckManager.current_deck.side.size(); ++i) if (deckManager.current_deck.side[i]->first == limitcode || deckManager.current_deck.side[i]->second.alias == limitcode) limit--; if (limit <= 0) break; if (hovered_pos == 1) { if (deckManager.current_deck.main.size() < 60) deckManager.current_deck.main.push_back(draging_pointer); else if (deckManager.current_deck.side.size() < 15) deckManager.current_deck.side.push_back(draging_pointer); } else if (hovered_pos == 2) { if (deckManager.current_deck.extra.size() < 15) deckManager.current_deck.extra.push_back(draging_pointer); else if (deckManager.current_deck.side.size() < 15) deckManager.current_deck.side.push_back(draging_pointer); } else if (hovered_pos == 3) { if (deckManager.current_deck.side.size() < 15) deckManager.current_deck.side.push_back(draging_pointer); else { if ((draging_pointer->second.type & 0x802040) && deckManager.current_deck.extra.size() < 15) deckManager.current_deck.extra.push_back(draging_pointer); else if (!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 60) deckManager.current_deck.main.push_back(draging_pointer); } } else { if ((draging_pointer->second.type & 0x802040) && deckManager.current_deck.extra.size() < 15) deckManager.current_deck.extra.push_back(draging_pointer); else if (!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 60) deckManager.current_deck.main.push_back(draging_pointer); else if (deckManager.current_deck.side.size() < 15) deckManager.current_deck.side.push_back(draging_pointer); } break; } case irr::EMIE_MOUSE_MOVED: { int x = event.MouseInput.X; int y = event.MouseInput.Y; irr::core::position2di mouse_pos(x, y); irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement(); if(root->getElementFromPoint(mouse_pos) != root) break; int pre_code = hovered_code; if(x >= 314 && x <= 794 && y >= 164 && y <= 435) { int lx = 10, px, py = (y - 164) / 68; hovered_pos = 1; if(deckManager.current_deck.main.size() > 40) lx = (deckManager.current_deck.main.size() - 41) / 4 + 11; if(x >= 750) px = lx - 1; else px = (x - 314) * (lx - 1) / 436; if(py*lx + px >= (int)deckManager.current_deck.main.size()) { hovered_seq = -1; hovered_code = 0; } else { hovered_seq = py * lx + px; hovered_code = deckManager.current_deck.main[hovered_seq]->first; } } else if(x >= 314 && x <= 794 && y >= 466 && y <= 530) { int lx = deckManager.current_deck.extra.size(); hovered_pos = 2; if(lx < 10) lx = 10; if(x >= 750) hovered_seq = lx - 1; else hovered_seq = (x - 314) * (lx - 1) / 436; if(hovered_seq >= (int)deckManager.current_deck.extra.size()) { hovered_seq = -1; hovered_code = 0; } else { hovered_code = deckManager.current_deck.extra[hovered_seq]->first; } } else if (x >= 314 && x <= 794 && y >= 564 && y <= 628) { int lx = deckManager.current_deck.side.size(); hovered_pos = 3; if(lx < 10) lx = 10; if(x >= 750) hovered_seq = lx - 1; else hovered_seq = (x - 314) * (lx - 1) / 436; if(hovered_seq >= (int)deckManager.current_deck.side.size()) { hovered_seq = -1; hovered_code = 0; } else { hovered_code = deckManager.current_deck.side[hovered_seq]->first; } } else if(x >= 810 && x <= 995 && y >= 165 && y <= 626) { hovered_pos = 4; hovered_seq = (y - 165) / 66; if(mainGame->scrFilter->getPos() + hovered_seq >= (int)results.size()) { hovered_seq = -1; hovered_code = 0; } else { hovered_code = results[mainGame->scrFilter->getPos() + hovered_seq]->first; } } else { hovered_pos = 0; hovered_code = 0; } if(is_draging) { dragx = x; dragy = y; } if(!is_draging && pre_code != hovered_code) { if(hovered_code) { mainGame->ShowCardInfo(hovered_code); } if(pre_code) imageManager.RemoveTexture(pre_code); } break; } case irr::EMIE_MOUSE_WHEEL: { if(!mainGame->scrFilter->isVisible()) break; if(event.MouseInput.Wheel < 0) { if(mainGame->scrFilter->getPos() < mainGame->scrFilter->getMax()) mainGame->scrFilter->setPos(mainGame->scrFilter->getPos() + 1); } else { if(mainGame->scrFilter->getPos() > 0) mainGame->scrFilter->setPos(mainGame->scrFilter->getPos() - 1); } SEvent e = event; e.MouseInput.Event = irr::EMIE_MOUSE_MOVED; mainGame->device->postEventFromUser(e); break; } default: break; } 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; } return false; }