Commit 1d22b933 authored by fallenstardust's avatar fallenstardust

jni记录最后分类和卡组

parent 5b51aedb
......@@ -173,16 +173,21 @@ void DeckBuilder::Terminate() {
mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->wACMessage->setVisible(false);
mainGame->ClearTextures();
mainGame->SaveConfig();
mainGame->scrFilter->setVisible(false);
int catesel = mainGame->cbDBCategory->getSelected();
char linebuf[256];
if(catesel >= 0)
BufferIO::CopyWStr(mainGame->cbDBCategory->getItem(catesel), mainGame->gameConf.lastcategory, 64);
BufferIO::CopyWStr(mainGame->cbDBCategory->getItem(catesel), mainGame->gameConf.lastcategory, 64);
BufferIO::EncodeUTF8(mainGame->gameConf.lastcategory, linebuf);
android::setLastCategory(mainGame->appMain, linebuf);
//irr:os::Printer::log("setLastCategory", linebuf);
int decksel = mainGame->cbDBDecks->getSelected();
char linebuf[256];
if(decksel >= 0)
if(decksel >= 0)
BufferIO::CopyWStr(mainGame->cbDBDecks->getItem(decksel), mainGame->gameConf.lastdeck, 64);
BufferIO::EncodeUTF8(mainGame->gameConf.lastdeck, linebuf);
android::setLastDeck(mainGame->appMain, linebuf);
//os::Printer::log("setLastDeck", linebuf);
mainGame->SaveConfig();
if(exit_on_return)
mainGame->device->closeDevice();
}
......@@ -1037,8 +1042,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
refreshDeckList();
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1)
break;
// if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1)
// break;
mainGame->lstDecks->setSelected(0);
mainGame->cbDBCategory->setSelected(catesel);
changeCategory(catesel);
......
......@@ -1392,11 +1392,12 @@ void Game::LoadConfig() {
gameConf.textfontsize = 16;
gameConf.nickname[0] = 0;
gameConf.gamename[0] = 0;
gameConf.bot_deck_path[0] = 0;
gameConf.lastcategory[0] = 0;
BufferIO::DecodeUTF8(android::getLastCategory(appMain).c_str(), wstr);;
BufferIO::CopyWStr(wstr, gameConf.lastcategory, 64);
//irr:os::Printer::log("getLastCategory", android::getLastCategory(appMain).c_str());
BufferIO::DecodeUTF8(android::getLastDeck(appMain).c_str(), wstr);
BufferIO::CopyWStr(wstr, gameConf.lastdeck, 64);
irr:os::Printer::log(android::getFontPath(appMain).c_str());
//os::Printer::log(android::getFontPath(appMain).c_str());
BufferIO::DecodeUTF8(android::getFontPath(appMain).c_str(), wstr);
BufferIO::CopyWStr(wstr, gameConf.numfont, 256);
BufferIO::CopyWStr(wstr, gameConf.textfont, 256);
......
......@@ -363,6 +363,11 @@ irr::io::path getLastDeck(ANDROID_APP app) {
return getSetting(app, "lastdeck");
}
//Retrive last category name.
irr::io::path getLastCategory(ANDROID_APP app) {
return getSetting(app, "lastcategory");
}
irr::io::path getSetting(ANDROID_APP app, const char* key) {
irr::io::path ret;
if (!app || !app->activity || !app->activity->vm)
......@@ -403,6 +408,11 @@ void setLastDeck(ANDROID_APP app, const char* deckname) {
saveSetting(app, "lastdeck", deckname);
}
//save last category name.
void setLastCategory(ANDROID_APP app, const char* catename) {
saveSetting(app, "lastcategory", catename);
}
int getIntSetting(ANDROID_APP app, const char* key,int defvalue){
if (!app || !app->activity || !app->activity->vm)
return defvalue;
......@@ -938,4 +948,4 @@ void runWindbot(ANDROID_APP app, const char* args) {
}
} // namespace android
} // namespace irr
} // namespace irr
\ No newline at end of file
......@@ -147,6 +147,9 @@ extern irr::io::path getFontPath(ANDROID_APP app);
//Retrive last deck name.
extern irr::io::path getLastDeck(ANDROID_APP app);
//Retrive last catagory name.
extern irr::io::path getLastCategory(ANDROID_APP app);
extern int getIntSetting(ANDROID_APP app, const char* key,int defvalue);
extern irr::io::path getSetting(ANDROID_APP app, const char* key);
......@@ -154,6 +157,9 @@ extern irr::io::path getSetting(ANDROID_APP app, const char* key);
//save last deck name.
extern void setLastDeck(ANDROID_APP app, const char* deckname);
//save last category name.
extern void setLastCategory(ANDROID_APP app, const char* catename);
extern void saveIntSetting(ANDROID_APP app, const char* key, int value);
extern void saveSetting(ANDROID_APP app, const char* key, const char* value);
......
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