Commit 929609a1 authored by salix5's avatar salix5

quick key

F1~F3: self grave, remove, extra
F5~F7: opponent grave, remove, extra
They can let the players check public areas when mouse clicks are not
captured properly.
parent c0035560
......@@ -483,6 +483,58 @@ void ClientField::ShowChainCard() {
else mainGame->btnSelectOK->setVisible(false);
mainGame->PopupElement(mainGame->wCardSelect);
}
void ClientField::ShowLocationCard() {
if(display_cards.size() <= 5) {
int startpos = 30 + 125 * (5 - display_cards.size()) / 2;
for(size_t i = 0; i < display_cards.size(); ++i) {
if(display_cards[i]->code)
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardDisplay[i], display_cards[i]->code));
else
mainGame->btnCardDisplay[i]->setImage(imageManager.tCover);
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(startpos + i * 125, 55, startpos + 120 + i * 125, 225));
mainGame->btnCardDisplay[i]->setPressed(false);
mainGame->btnCardDisplay[i]->setVisible(true);
myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(display_cards[i]->location, display_cards[i]->sequence),
display_cards[i]->sequence + 1);
mainGame->stDisplayPos[i]->setText(formatBuffer);
mainGame->stDisplayPos[i]->setVisible(true);
if(display_cards[i]->controler)
mainGame->stDisplayPos[i]->setBackgroundColor(0xffd0d0d0);
else mainGame->stDisplayPos[i]->setBackgroundColor(0xffffffff);
mainGame->stDisplayPos[i]->setRelativePosition(rect<s32>(startpos + 10 + i * 125, 30, startpos + 109 + i * 125, 50));
}
for(int i = display_cards.size(); i < 5; ++i) {
mainGame->btnCardDisplay[i]->setVisible(false);
mainGame->stDisplayPos[i]->setVisible(false);
}
mainGame->scrDisplayList->setPos(0);
mainGame->scrDisplayList->setVisible(false);
} else {
for(int i = 0; i < 5; ++i) {
if(display_cards[i]->code)
mainGame->imageLoading.insert(std::make_pair(mainGame->btnCardDisplay[i], display_cards[i]->code));
else
mainGame->btnCardDisplay[i]->setImage(imageManager.tCover);
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
mainGame->btnCardDisplay[i]->setPressed(false);
mainGame->btnCardDisplay[i]->setVisible(true);
myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(display_cards[i]->location, display_cards[i]->sequence),
display_cards[i]->sequence + 1);
mainGame->stDisplayPos[i]->setText(formatBuffer);
mainGame->stDisplayPos[i]->setVisible(true);
if(display_cards[i]->controler)
mainGame->stDisplayPos[i]->setBackgroundColor(0xffd0d0d0);
else mainGame->stDisplayPos[i]->setBackgroundColor(0xffffffff);
mainGame->stDisplayPos[i]->setRelativePosition(rect<s32>(40 + i * 125, 30, 139 + i * 125, 50));
}
mainGame->scrDisplayList->setVisible(true);
mainGame->scrDisplayList->setMin(0);
mainGame->scrDisplayList->setMax((display_cards.size() - 5) * 10 + 9);
mainGame->scrDisplayList->setPos(0);
}
mainGame->btnDisplayOK->setVisible(true);
mainGame->PopupElement(mainGame->wCardDisplay);
}
void ClientField::ReplaySwap() {
std::swap(deck[0], deck[1]);
std::swap(hand[0], hand[1]);
......
......@@ -61,6 +61,7 @@ public:
std::vector<ClientCard*> selected_cards;
std::set<ClientCard*> selectsum_cards;
std::vector<ClientCard*> selectsum_all;
std::vector<ClientCard*> display_cards;
std::vector<int> sort_list;
bool grave_act;
bool remove_act;
......@@ -85,6 +86,7 @@ public:
void ClearChainSelect();
void ShowSelectCard(bool buttonok = false, bool chain = false);
void ShowChainCard();
void ShowLocationCard();
void ReplaySwap();
void RefreshAllCards();
......
......@@ -495,6 +495,10 @@ void Game::DrawGUI() {
for(int i = 0; i < 5; ++i)
btnCardSelect[i]->setDrawImage(true);
}
if(fu.guiFading == wCardDisplay) {
for(int i = 0; i < 5; ++i)
btnCardDisplay[i]->setDrawImage(true);
}
env->setFocus(fu.guiFading);
} else
fu.guiFading->setRelativePosition(irr::core::recti(fu.fadingUL, fu.fadingLR));
......@@ -522,6 +526,10 @@ void Game::DrawGUI() {
for(int i = 0; i < 5; ++i)
btnCardSelect[i]->setDrawImage(true);
}
if(fu.guiFading == wCardDisplay) {
for(int i = 0; i < 5; ++i)
btnCardDisplay[i]->setDrawImage(true);
}
} else
fu.guiFading->setRelativePosition(irr::core::recti(fu.fadingUL, fu.fadingLR));
}
......@@ -761,6 +769,10 @@ void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
for(int i = 0; i < 5; ++i)
btnCardSelect[i]->setDrawImage(false);
}
if(win == wCardDisplay) {
for(int i = 0; i < 5; ++i)
btnCardDisplay[i]->setDrawImage(false);
}
win->setRelativePosition(irr::core::recti(center.X, center.Y, 0, 0));
fadingList.push_back(fu);
}
......@@ -789,6 +801,10 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
for(int i = 0; i < 5; ++i)
btnCardSelect[i]->setDrawImage(false);
}
if(win == wCardDisplay) {
for(int i = 0; i < 5; ++i)
btnCardDisplay[i]->setDrawImage(false);
}
fadingList.push_back(fu);
}
void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) {
......
......@@ -432,7 +432,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
selectable_cards.clear();
switch(command_location) {
case LOCATION_DECK: {
for(int32 i = (int32)deck[hovered_controler].size() - 1; i >= 0 ; --i)
for(int32 i = (int32)deck[command_controler].size() - 1; i >= 0 ; --i)
selectable_cards.push_back(deck[command_controler][i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1000), deck[command_controler].size());
mainGame->wCardSelect->setText(formatBuffer);
......@@ -659,6 +659,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case BUTTON_CARD_DISP_OK: {
mainGame->HideElement(mainGame->wCardDisplay);
break;
}
}
break;
}
......@@ -748,6 +752,23 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case SCROLL_CARD_DISPLAY: {
int pos = mainGame->scrDisplayList->getPos() / 10;
for(int i = 0; i < 5; ++i) {
if(display_cards[i + pos]->code)
mainGame->btnCardDisplay[i]->setImage(imageManager.GetTexture(display_cards[i + pos]->code));
else
mainGame->btnCardDisplay[i]->setImage(imageManager.tCover);
mainGame->btnCardDisplay[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
myswprintf(formatBuffer, L"%ls[%d]", dataManager.FormatLocation(display_cards[i + pos]->location, display_cards[i + pos]->sequence),
display_cards[i + pos]->sequence + 1);
mainGame->stDisplayPos[i]->setText(formatBuffer);
if(display_cards[i + pos]->controler)
mainGame->stDisplayPos[i]->setBackgroundColor(0xffd0d0d0);
else mainGame->stDisplayPos[i]->setBackgroundColor(0xffffffff);
}
break;
}
case SCROLL_CARDTEXT: {
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth()-25, mainGame->textFont, mainGame->showingtext, pos);
......@@ -861,6 +882,20 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->scrCardText->setVisible(false);
}
}
if(id >= BUTTON_DISPLAY_0 && id <= BUTTON_DISPLAY_4) {
int pos = mainGame->scrDisplayList->getPos() / 10;
ClientCard* mcard = display_cards[id - BUTTON_DISPLAY_0 + pos];
if(mcard->code) {
mainGame->ShowCardInfo(mcard->code);
} else {
mainGame->imgCard->setImage(imageManager.tCover);
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
mainGame->stText->setText(L"");
mainGame->scrCardText->setVisible(false);
}
}
break;
}
default:
......@@ -884,6 +919,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(panel && panel->isVisible())
break;
GetHoverField(x, y);
if(hovered_location & 0xe)
clicked_card = GetCard(hovered_controler, hovered_location, hovered_sequence);
else clicked_card = 0;
if(mainGame->dInfo.isReplay) {
if(mainGame->wCardSelect->isVisible())
break;
......@@ -897,10 +935,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case LOCATION_MZONE: {
ClientCard* pcard = deck[hovered_controler][hovered_sequence];
for(int32 i = 0; i < (int32)pcard->overlayed.size(); ++i)
selectable_cards.push_back(pcard->overlayed[i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1007), pcard->overlayed.size());
for(int32 i = 0; i < (int32)clicked_card->overlayed.size(); ++i)
selectable_cards.push_back(clicked_card->overlayed[i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1007), clicked_card->overlayed.size());
mainGame->wCardSelect->setText(formatBuffer);
break;
}
......@@ -947,9 +984,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
ShowSelectCard(true);
break;
}
if(hovered_location & 0xe)
clicked_card = GetCard(hovered_controler, hovered_location, hovered_sequence);
else clicked_card = 0;
command_controler = hovered_controler;
command_location = hovered_location;
command_sequence = hovered_sequence;
......@@ -1547,6 +1581,56 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->textFont->setTransparency(true);
break;
}
case irr::KEY_F1:
case irr::KEY_F2:
case irr::KEY_F3:
case irr::KEY_F5:
case irr::KEY_F6:
case irr::KEY_F7: {
if(!event.KeyInput.PressedDown && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type != 7 && mainGame->dInfo.isStarted
&& !mainGame->wCardDisplay->isVisible()) {
int loc_id = 0;
display_cards.clear();
switch(event.KeyInput.Key) {
case irr::KEY_F1:
loc_id = 1004;
for(int32 i = (int32)grave[0].size() - 1; i >= 0 ; --i)
display_cards.push_back(grave[0][i]);
break;
case irr::KEY_F2:
loc_id = 1005;
for(int32 i = (int32)remove[0].size() - 1; i >= 0 ; --i)
display_cards.push_back(remove[0][i]);
break;
case irr::KEY_F3:
loc_id = 1006;
for(int32 i = (int32)extra[0].size() - 1; i >= 0 ; --i)
display_cards.push_back(extra[0][i]);
break;
case irr::KEY_F5:
loc_id = 1004;
for(int32 i = (int32)grave[1].size() - 1; i >= 0 ; --i)
display_cards.push_back(grave[1][i]);
break;
case irr::KEY_F6:
loc_id = 1005;
for(int32 i = (int32)remove[1].size() - 1; i >= 0 ; --i)
display_cards.push_back(remove[1][i]);
break;
case irr::KEY_F7:
loc_id = 1006;
for(int32 i = (int32)extra[1].size() - 1; i >= 0 ; --i)
display_cards.push_back(extra[1][i]);
break;
}
if(display_cards.size()) {
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(loc_id), display_cards.size());
mainGame->wCardDisplay->setText(formatBuffer);
ShowLocationCard();
}
}
break;
}
case irr::KEY_ESCAPE: {
mainGame->device->minimizeWindow();
break;
......
......@@ -341,6 +341,19 @@ bool Game::Initialize() {
}
scrCardList = env->addScrollBar(true, rect<s32>(30, 235, 650, 255), wCardSelect, SCROLL_CARD_SELECT);
btnSelectOK = env->addButton(rect<s32>(300, 265, 380, 290), wCardSelect, BUTTON_CARD_SEL_OK, dataManager.GetSysString(1211));
//card display
wCardDisplay = env->addWindow(rect<s32>(320, 100, 1000, 400), false, L"");
wCardDisplay->getCloseButton()->setVisible(false);
wCardDisplay->setVisible(false);
for(int i = 0; i < 5; ++i) {
stDisplayPos[i] = env->addStaticText(L"", rect<s32>(40 + 125 * i, 30, 139 + 125 * i, 50), true, false, wCardDisplay, -1, true);
stDisplayPos[i]->setBackgroundColor(0xffffffff);
stDisplayPos[i]->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnCardDisplay[i] = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(30 + 125 * i, 55, 150 + 125 * i, 225), wCardDisplay, BUTTON_DISPLAY_0 + i);
btnCardDisplay[i]->setImageScale(core::vector2df(0.6f, 0.6f));
}
scrDisplayList = env->addScrollBar(true, rect<s32>(30, 235, 650, 255), wCardDisplay, SCROLL_CARD_DISPLAY);
btnDisplayOK = env->addButton(rect<s32>(300, 265, 380, 290), wCardDisplay, BUTTON_CARD_DISP_OK, dataManager.GetSysString(1211));
//announce number
wANNumber = env->addWindow(rect<s32>(550, 200, 780, 295), false, L"");
wANNumber->getCloseButton()->setVisible(false);
......@@ -948,11 +961,10 @@ void Game::ClearTextures() {
mainGame->imgCard->setImage(0);
mainGame->btnPSAU->setImage();
mainGame->btnPSDU->setImage();
mainGame->btnCardSelect[0]->setImage();
mainGame->btnCardSelect[1]->setImage();
mainGame->btnCardSelect[2]->setImage();
mainGame->btnCardSelect[3]->setImage();
mainGame->btnCardSelect[4]->setImage();
for(int i=0; i<=4; ++i) {
mainGame->btnCardSelect[i]->setImage();
mainGame->btnCardDisplay[i]->setImage();
}
imageManager.ClearTexture();
}
void Game::CloseDuelWindow() {
......@@ -967,6 +979,7 @@ void Game::CloseDuelWindow() {
wANRace->setVisible(false);
wCardImg->setVisible(false);
wCardSelect->setVisible(false);
wCardDisplay->setVisible(false);
wCmdMenu->setVisible(false);
wFTSelect->setVisible(false);
wHand->setVisible(false);
......
......@@ -273,6 +273,12 @@ public:
irr::gui::IGUIStaticText *stCardPos[5];
irr::gui::IGUIScrollBar *scrCardList;
irr::gui::IGUIButton* btnSelectOK;
//card display
irr::gui::IGUIWindow* wCardDisplay;
irr::gui::CGUIImageButton* btnCardDisplay[5];
irr::gui::IGUIStaticText *stDisplayPos[5];
irr::gui::IGUIScrollBar *scrDisplayList;
irr::gui::IGUIButton* btnDisplayOK;
//announce number
irr::gui::IGUIWindow* wANNumber;
irr::gui::IGUIComboBox* cbANNumber;
......@@ -442,6 +448,13 @@ extern Game* mainGame;
#define BUTTON_CLEAR_LOG 270
#define LISTBOX_LOG 271
#define SCROLL_CARDTEXT 280
#define BUTTON_DISPLAY_0 290
#define BUTTON_DISPLAY_1 291
#define BUTTON_DISPLAY_2 292
#define BUTTON_DISPLAY_3 293
#define BUTTON_DISPLAY_4 294
#define SCROLL_CARD_DISPLAY 295
#define BUTTON_CARD_DISP_OK 296
#define BUTTON_CATEGORY_OK 300
#define COMBOBOX_DBLFLIST 301
#define COMBOBOX_DBDECKS 302
......
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