Commit 14d75768 authored by fallenstardust's avatar fallenstardust

refresh分类和列表时控制是否显示卡包展示路径

parent 993f5474
......@@ -218,7 +218,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
int catesel = mainGame->cbDBCategory->getSelected();
wchar_t catepath[256];
deckManager.GetCategoryPath(catepath, catesel, mainGame->cbDBCategory->getText());
deckManager.GetCategoryPath(catepath, catesel, mainGame->cbDBCategory->getText(), true);
wchar_t filepath[256];
myswprintf(filepath, L"%ls/%ls.ydk", catepath, dname);
if(deckManager.SaveDeck(deckManager.current_deck, filepath)) {
......@@ -522,7 +522,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case BUTTON_NEW_DECK: {
const wchar_t* deckname = mainGame->ebDMName->getText();
wchar_t catepath[256];
deckManager.GetCategoryPath(catepath, mainGame->cbDBCategory->getSelected(), mainGame->cbDBCategory->getText());
deckManager.GetCategoryPath(catepath, mainGame->cbDBCategory->getSelected(), mainGame->cbDBCategory->getText(), true);
wchar_t filepath[256];
myswprintf(filepath, L"%ls/%ls.ydk", catepath, deckname);
bool res = false;
......@@ -1051,7 +1051,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
wchar_t filepath[256];
wchar_t catepath[256];
deckManager.GetCategoryPath(catepath, mainGame->lstCategories->getSelected(), mainGame->lstCategories->getListItem(mainGame->lstCategories->getSelected()));
deckManager.GetCategoryPath(catepath, mainGame->lstCategories->getSelected(), mainGame->lstCategories->getListItem(mainGame->lstCategories->getSelected()), true);
myswprintf(filepath, L"%ls/%ls.ydk", catepath, mainGame->lstDecks->getListItem(decksel));
deckManager.LoadDeck(filepath, showing_pack);
RefreshPackListScroll();
......@@ -1645,11 +1645,11 @@ void DeckBuilder::SortList() {
}
}
void DeckBuilder::RefreshDeckList() {
void DeckBuilder::RefreshDeckList(bool showPack) {
irr::gui::IGUIListBox* lstCategories = mainGame->lstCategories;
irr::gui::IGUIListBox* lstDecks = mainGame->lstDecks;
wchar_t catepath[256];
deckManager.GetCategoryPath(catepath, lstCategories->getSelected(), lstCategories->getListItem(lstCategories->getSelected()));
deckManager.GetCategoryPath(catepath, lstCategories->getSelected(), lstCategories->getListItem(lstCategories->getSelected()), showPack);
lstDecks->clear();
mainGame->RefreshDeck(catepath, [lstDecks](const wchar_t* item) { lstDecks->addItem(item); });
}
......
......@@ -26,7 +26,7 @@ public:
void ClearSearch();
void SortList();
void RefreshDeckList();
void RefreshDeckList(bool showPack);
void RefreshReadonly(int catesel);
void RefreshPackListScroll();
void ChangeCategory(int catesel);
......
......@@ -206,30 +206,33 @@ bool DeckManager::LoadSide(Deck& deck, int* dbuf, int mainc, int sidec) {
deck = ndeck;
return true;
}
void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text) {
void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text, bool showPack) {
wchar_t catepath[256];
switch(index) {
case 0:
if (mainGame->wHostPrepare->isVisible()) {
myswprintf(catepath, L"./windbot/Decks");
} else {
if (showPack) {
myswprintf(catepath, L"./pack");
} else {
myswprintf(catepath, L"./windbot/Decks");
}
break;
case 1:
if (mainGame->wHostPrepare->isVisible()) {
myswprintf(catepath, L"./deck");
} else {
if (showPack) {
myswprintf(catepath, L"./windbot/Decks");
} else {
myswprintf(catepath, L"./deck");
}
break;
case -1:
case 2:
case 3:
if (mainGame->wHostPrepare->isVisible()) {
myswprintf(catepath, L"./deck/%ls", text);
} else {
if (showPack) {
myswprintf(catepath, L"./deck");
} else {
myswprintf(catepath, L"./deck/%ls", text);
}
break;
default:
......@@ -242,7 +245,7 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
wchar_t catepath[256];
wchar_t* deckname = (wchar_t*)cbDeck->getItem(cbDeck->getSelected());
if(deckname != NULL) {
GetCategoryPath(catepath, cbCategory->getSelected(), cbCategory->getText());
GetCategoryPath(catepath, cbCategory->getSelected(), cbCategory->getText(), cbCategory == mainGame->cbDBCategory);
myswprintf(filepath, L"%ls/%ls.ydk", catepath, deckname);
BufferIO::CopyWStr(filepath, ret, 256);
}
......
......@@ -45,7 +45,7 @@ public:
int CheckDeck(Deck& deck, int lfhash, int rule);
int LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_packlist = false);
bool LoadSide(Deck& deck, int* dbuf, int mainc, int sidec);
void GetCategoryPath(wchar_t* ret, int index, const wchar_t* text);
void GetCategoryPath(wchar_t* ret, int index, const wchar_t* text, bool showPack);
void GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck);
bool LoadDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck);
FILE* OpenDeckFile(const wchar_t* file, const char* mode);
......
......@@ -1663,7 +1663,7 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBo
}
}
wchar_t catepath[256];
deckManager.GetCategoryPath(catepath, cbCategory->getSelected(), cbCategory->getText());
deckManager.GetCategoryPath(catepath, cbCategory->getSelected(), cbCategory->getText(), cbCategory == mainGame->cbDBCategory);
cbDeck->clear();
RefreshDeck(catepath, [cbDeck](const wchar_t* item) { cbDeck->addItem(item); });
}
......
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