Commit 6ec67282 authored by mercury233's avatar mercury233

update card info when resizing

parent 62515ccb
......@@ -101,6 +101,7 @@ void DeckBuilder::Terminate() {
mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->wACMessage->setVisible(false);
mainGame->ClearTextures();
mainGame->showingcode = 0;
mainGame->scrFilter->setVisible(false);
int sel = mainGame->cbDBDecks->getSelected();
if(sel >= 0)
......@@ -232,6 +233,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
char deckbuf[1024];
char* pdeck = deckbuf;
BufferIO::WriteInt32(pdeck, deckManager.current_deck.main.size() + deckManager.current_deck.extra.size());
......
......@@ -943,6 +943,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->ShowCardInfo(mcard->code);
} else {
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
......@@ -958,6 +959,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->ShowCardInfo(mcard->code);
} else {
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
......@@ -1524,6 +1526,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} else {
should_show_tip = false;
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
......
......@@ -207,6 +207,8 @@ bool Game::Initialize() {
wCardImg->setVisible(false);
imgCard = env->addImage(rect<s32>(10, 9, 10 + CARD_IMG_WIDTH, 9 + CARD_IMG_HEIGHT), wCardImg);
imgCard->setImage(imageManager.tCover[0]);
showingcode = 0;
imgCard->setScaleImage(true);
imgCard->setUseAlphaChannel(true);
//phase
wPhase = env->addStaticText(L"", rect<s32>(480, 310, 855, 330));
......@@ -1151,7 +1153,9 @@ void Game::SaveConfig() {
fprintf(fp, "resize_popup_menu = %d\n", gameConf.resize_popup_menu ? 1 : 0);
fclose(fp);
}
void Game::ShowCardInfo(int code) {
void Game::ShowCardInfo(int code, bool resize) {
if(showingcode == code && !resize)
return;
CardData cd;
wchar_t formatBuffer[256];
if(!dataManager.GetData(code, &cd))
......@@ -1223,6 +1227,7 @@ void Game::ShowCardInfo(int code) {
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale));
}
showingcode = code;
showingtext = dataManager.GetText(code);
const auto& tsize = stText->getRelativePosition();
InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), textFont, showingtext);
......@@ -1291,6 +1296,8 @@ void Game::AddDebugMsg(char* msg)
void Game::ClearTextures() {
matManager.mCard.setTexture(0, 0);
imgCard->setImage(imageManager.tCover[0]);
scrCardText->setVisible(false);
imgCard->setScaleImage(true);
btnPSAU->setImage();
btnPSDU->setImage();
for(int i=0; i<=4; ++i) {
......@@ -1464,8 +1471,8 @@ void Game::OnResize() {
stName->setRelativePosition(recti(10, 10, 287 * xScale, 32));
lstLog->setRelativePosition(Resize(10, 10, 290, 290));
//const auto& tsize = stText->getRelativePosition();
//if(showingcard)
// ShowCardInfo(showingcard, true);
if(showingcode)
ShowCardInfo(showingcode, true);
btnClearLog->setRelativePosition(Resize(160, 300, 260, 325));
wPhase->setRelativePosition(Resize(480, 310, 855, 330));
......
......@@ -127,7 +127,7 @@ public:
void DrawDeckBd();
void LoadConfig();
void SaveConfig();
void ShowCardInfo(int code);
void ShowCardInfo(int code, bool resize = false);
void AddChatMsg(wchar_t* msg, int player);
void AddDebugMsg(char* msgbuf);
void ClearTextures();
......@@ -177,6 +177,7 @@ public:
int waitFrame;
int signalFrame;
int actionParam;
int showingcode;
const wchar_t* showingtext;
int showcard;
int showcardcode;
......
......@@ -225,6 +225,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break;
}
mainGame->imgCard->setImage(imageManager.tCover[0]);
mainGame->showingcode = 0;
mainGame->wCardImg->setVisible(true);
mainGame->wInfos->setVisible(true);
mainGame->wReplay->setVisible(true);
......
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