Commit 2047a67a authored by mercury233's avatar mercury233 Committed by GitHub

update pos of ShowCardInfoInList, fix the tip blink (#2149)

parent dc4a2800
...@@ -995,6 +995,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -995,6 +995,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->ClearCardInfo(mcard->controler); mainGame->ClearCardInfo(mcard->controler);
} }
} }
if(id == TEXT_CARD_LIST_TIP) {
mainGame->stCardListTip->setVisible(true);
}
break; break;
} }
case irr::gui::EGET_ELEMENT_LEFT: { case irr::gui::EGET_ELEMENT_LEFT: {
...@@ -1010,6 +1013,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1010,6 +1013,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
SetShowMark(mcard, false); SetShowMark(mcard, false);
mainGame->stCardListTip->setVisible(false); mainGame->stCardListTip->setVisible(false);
} }
if(id == TEXT_CARD_LIST_TIP) {
mainGame->stCardListTip->setVisible(false);
}
break; break;
} }
default: default:
...@@ -2243,9 +2249,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e ...@@ -2243,9 +2249,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
irr::core::rect<s32> ePos = element->getRelativePosition(); irr::core::rect<s32> ePos = element->getRelativePosition();
s32 x = (ePos.UpperLeftCorner.X + ePos.LowerRightCorner.X) / 2; s32 x = (ePos.UpperLeftCorner.X + ePos.LowerRightCorner.X) / 2;
s32 y = ePos.LowerRightCorner.Y; s32 y = ePos.LowerRightCorner.Y;
mainGame->SetStaticText(mainGame->stCardListTip, 160, mainGame->guiFont, str.c_str()); mainGame->SetStaticText(mainGame->stCardListTip, 320, mainGame->guiFont, str.c_str());
irr::core::dimension2d<unsigned int> dTip = mainGame->guiFont->getDimension(mainGame->stCardListTip->getText()) + irr::core::dimension2d<unsigned int>(10, 10); irr::core::dimension2d<unsigned int> dTip = mainGame->guiFont->getDimension(mainGame->stCardListTip->getText()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stCardListTip->setRelativePosition(recti(x - dTip.Width / 2, y - 10, x + dTip.Width / 2, y - 10 + dTip.Height)); s32 w = dTip.Width / 2;
if(x - w < 10)
x = w + 10;
if(x + w > 670)
x = 670 - w;
mainGame->stCardListTip->setRelativePosition(recti(x - w, y - 10, x + w, y - 10 + dTip.Height));
mainGame->stCardListTip->setVisible(true); mainGame->stCardListTip->setVisible(true);
} }
} }
......
...@@ -675,7 +675,7 @@ bool Game::Initialize() { ...@@ -675,7 +675,7 @@ bool Game::Initialize() {
stTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); stTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stTip->setVisible(false); stTip->setVisible(false);
//tip for cards in select / display list //tip for cards in select / display list
stCardListTip = env->addStaticText(L"", rect<s32>(0, 0, 150, 150), false, true, wCardSelect, -1, true); stCardListTip = env->addStaticText(L"", rect<s32>(0, 0, 150, 150), false, true, wCardSelect, TEXT_CARD_LIST_TIP, true);
stCardListTip->setBackgroundColor(0xc0ffffff); stCardListTip->setBackgroundColor(0xc0ffffff);
stCardListTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); stCardListTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stCardListTip->setVisible(false); stCardListTip->setVisible(false);
......
...@@ -553,6 +553,7 @@ extern Game* mainGame; ...@@ -553,6 +553,7 @@ extern Game* mainGame;
#define BUTTON_CARD_4 234 #define BUTTON_CARD_4 234
#define SCROLL_CARD_SELECT 235 #define SCROLL_CARD_SELECT 235
#define BUTTON_CARD_SEL_OK 236 #define BUTTON_CARD_SEL_OK 236
#define TEXT_CARD_LIST_TIP 237
#define BUTTON_CMD_ACTIVATE 240 #define BUTTON_CMD_ACTIVATE 240
#define BUTTON_CMD_SUMMON 241 #define BUTTON_CMD_SUMMON 241
#define BUTTON_CMD_SPSUMMON 242 #define BUTTON_CMD_SPSUMMON 242
......
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