Commit e98e2abd authored by nanahira's avatar nanahira Committed by GitHub

add export deck from replay (#2138)

parent 7ddb62e9
...@@ -754,8 +754,9 @@ bool Game::Initialize() { ...@@ -754,8 +754,9 @@ bool Game::Initialize() {
btnDeleteReplay = env->addButton(rect<s32>(360, 355, 460, 380), wReplay, BUTTON_DELETE_REPLAY, dataManager.GetSysString(1361)); btnDeleteReplay = env->addButton(rect<s32>(360, 355, 460, 380), wReplay, BUTTON_DELETE_REPLAY, dataManager.GetSysString(1361));
btnRenameReplay = env->addButton(rect<s32>(360, 385, 460, 410), wReplay, BUTTON_RENAME_REPLAY, dataManager.GetSysString(1362)); btnRenameReplay = env->addButton(rect<s32>(360, 385, 460, 410), wReplay, BUTTON_RENAME_REPLAY, dataManager.GetSysString(1362));
btnReplayCancel = env->addButton(rect<s32>(470, 385, 570, 410), wReplay, BUTTON_CANCEL_REPLAY, dataManager.GetSysString(1347)); btnReplayCancel = env->addButton(rect<s32>(470, 385, 570, 410), wReplay, BUTTON_CANCEL_REPLAY, dataManager.GetSysString(1347));
btnExportDeck = env->addButton(rect<s32>(470, 325, 570, 350), wReplay, BUTTON_EXPORT_DECK, dataManager.GetSysString(1369));
env->addStaticText(dataManager.GetSysString(1349), rect<s32>(360, 30, 570, 50), false, true, wReplay); env->addStaticText(dataManager.GetSysString(1349), rect<s32>(360, 30, 570, 50), false, true, wReplay);
stReplayInfo = env->addStaticText(L"", rect<s32>(360, 60, 570, 350), false, true, wReplay); stReplayInfo = env->addStaticText(L"", rect<s32>(360, 60, 570, 320), false, true, wReplay);
env->addStaticText(dataManager.GetSysString(1353), rect<s32>(360, 275, 570, 295), false, true, wReplay); env->addStaticText(dataManager.GetSysString(1353), rect<s32>(360, 275, 570, 295), false, true, wReplay);
ebRepStartTurn = env->addEditBox(L"", rect<s32>(360, 300, 460, 320), true, wReplay, -1); ebRepStartTurn = env->addEditBox(L"", rect<s32>(360, 300, 460, 320), true, wReplay, -1);
ebRepStartTurn->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebRepStartTurn->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
......
...@@ -369,6 +369,7 @@ public: ...@@ -369,6 +369,7 @@ public:
irr::gui::IGUIButton* btnDeleteReplay; irr::gui::IGUIButton* btnDeleteReplay;
irr::gui::IGUIButton* btnRenameReplay; irr::gui::IGUIButton* btnRenameReplay;
irr::gui::IGUIButton* btnReplayCancel; irr::gui::IGUIButton* btnReplayCancel;
irr::gui::IGUIButton* btnExportDeck;
irr::gui::IGUIEditBox* ebRepStartTurn; irr::gui::IGUIEditBox* ebRepStartTurn;
//single play //single play
irr::gui::IGUIWindow* wSinglePlay; irr::gui::IGUIWindow* wSinglePlay;
...@@ -633,6 +634,7 @@ extern Game* mainGame; ...@@ -633,6 +634,7 @@ extern Game* mainGame;
#define BUTTON_CANCEL_REPLAY 132 #define BUTTON_CANCEL_REPLAY 132
#define BUTTON_DELETE_REPLAY 133 #define BUTTON_DELETE_REPLAY 133
#define BUTTON_RENAME_REPLAY 134 #define BUTTON_RENAME_REPLAY 134
#define BUTTON_EXPORT_DECK 135
#define BUTTON_REPLAY_START 140 #define BUTTON_REPLAY_START 140
#define BUTTON_REPLAY_PAUSE 141 #define BUTTON_REPLAY_PAUSE 141
#define BUTTON_REPLAY_STEP 142 #define BUTTON_REPLAY_STEP 142
......
...@@ -280,6 +280,42 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -280,6 +280,42 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->ShowElement(mainGame->wMainMenu); mainGame->ShowElement(mainGame->wMainMenu);
break; break;
} }
case BUTTON_EXPORT_DECK: {
if(mainGame->lstReplayList->getSelected() == -1)
break;
Replay replay;
wchar_t ex_filename[256];
wchar_t namebuf[4][20];
wchar_t filename[256];
myswprintf(ex_filename, L"%ls", mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected()));
if(!replay.OpenReplay(ex_filename))
break;
const ReplayHeader& rh = replay.pheader;
if(rh.flag & REPLAY_SINGLE_MODE)
break;
int max = (rh.flag & REPLAY_TAG) ? 4 : 2;
//player name
for(int i = 0; i < max; ++i)
replay.ReadName(namebuf[i]);
//skip pre infos
for(int i = 0; i < 4; ++i)
replay.ReadInt32();
//deck
for(int i = 0; i < max; ++i) {
int main = replay.ReadInt32();
Deck tmp_deck;
for(int j = 0; j < main; ++j)
tmp_deck.main.push_back(dataManager.GetCodePointer(replay.ReadInt32()));
int extra = replay.ReadInt32();
for(int j = 0; j < extra; ++j)
tmp_deck.extra.push_back(dataManager.GetCodePointer(replay.ReadInt32()));
myswprintf(filename, L"%ls %ls", ex_filename, namebuf[i]);
deckManager.SaveDeck(tmp_deck, filename);
}
mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20);
break;
}
case BUTTON_BOT_START: { case BUTTON_BOT_START: {
int sel = mainGame->lstBotList->getSelected(); int sel = mainGame->lstBotList->getSelected();
if(sel == -1) if(sel == -1)
......
...@@ -415,6 +415,7 @@ ...@@ -415,6 +415,7 @@
!system 1365 重命名失败,可能存在同名文件 !system 1365 重命名失败,可能存在同名文件
!system 1366 自动保存录像 !system 1366 自动保存录像
!system 1367 录像已自动保存为%ls.yrp !system 1367 录像已自动保存为%ls.yrp
!system 1369 提取卡组
!system 1370 星数↑ !system 1370 星数↑
!system 1371 攻击↑ !system 1371 攻击↑
!system 1372 守备↑ !system 1372 守备↑
......
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