Commit 34e9abd9 authored by fallenstardust's avatar fallenstardust

update gframe

parent 8a717caf
...@@ -27,6 +27,7 @@ ClientField::ClientField() { ...@@ -27,6 +27,7 @@ ClientField::ClientField() {
hovered_card = 0; hovered_card = 0;
clicked_card = 0; clicked_card = 0;
highlighting_card = 0; highlighting_card = 0;
menu_card = 0;
hovered_controler = 0; hovered_controler = 0;
hovered_location = 0; hovered_location = 0;
hovered_sequence = 0; hovered_sequence = 0;
...@@ -41,6 +42,7 @@ ClientField::ClientField() { ...@@ -41,6 +42,7 @@ ClientField::ClientField() {
conti_act = false; conti_act = false;
deck_reversed = false; deck_reversed = false;
conti_selecting = false; conti_selecting = false;
cant_check_grave = false;
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
mzone[p].resize(7, 0); mzone[p].resize(7, 0);
szone[p].resize(8, 0); szone[p].resize(8, 0);
...@@ -94,6 +96,7 @@ void ClientField::Clear() { ...@@ -94,6 +96,7 @@ void ClientField::Clear() {
hovered_card = 0; hovered_card = 0;
clicked_card = 0; clicked_card = 0;
highlighting_card = 0; highlighting_card = 0;
menu_card = 0;
hovered_controler = 0; hovered_controler = 0;
hovered_location = 0; hovered_location = 0;
hovered_sequence = 0; hovered_sequence = 0;
...@@ -105,7 +108,7 @@ void ClientField::Clear() { ...@@ -105,7 +108,7 @@ void ClientField::Clear() {
pzone_act[1] = false; pzone_act[1] = false;
conti_act = false; conti_act = false;
deck_reversed = false; deck_reversed = false;
RefreshCardCountDisplay(); cant_check_grave = false;
} }
void ClientField::Initial(int player, int deckc, int extrac) { void ClientField::Initial(int player, int deckc, int extrac) {
ClientCard* pcard; ClientCard* pcard;
...@@ -402,6 +405,18 @@ void ClientField::ClearChainSelect() { ...@@ -402,6 +405,18 @@ void ClientField::ClearChainSelect() {
} }
// needs to be synchronized with EGET_SCROLL_BAR_CHANGED // needs to be synchronized with EGET_SCROLL_BAR_CHANGED
void ClientField::ShowSelectCard(bool buttonok, bool chain) { void ClientField::ShowSelectCard(bool buttonok, bool chain) {
if(cant_check_grave) {
bool has_card_in_grave = false;
for(size_t i = 0; i < selectable_cards.size(); ++i) {
if(selectable_cards[i]->location == LOCATION_GRAVE) {
has_card_in_grave = true;
break;
}
}
if(has_card_in_grave) {
std::random_shuffle(selectable_cards.begin(), selectable_cards.end());
}
}
int startpos; int startpos;
size_t ct; size_t ct;
if(selectable_cards.size() <= 5) { if(selectable_cards.size() <= 5) {
...@@ -428,6 +443,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -428,6 +443,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
wchar_t formatBuffer[2048]; wchar_t formatBuffer[2048];
if(conti_selecting) if(conti_selecting)
myswprintf(formatBuffer, L"%ls", DataManager::unknown_string); myswprintf(formatBuffer, L"%ls", DataManager::unknown_string);
else if(cant_check_grave && selectable_cards[i]->location == LOCATION_GRAVE)
myswprintf(formatBuffer, L"%ls", dataManager.FormatLocation(selectable_cards[i]->location, 0));
else if(selectable_cards[i]->location == LOCATION_OVERLAY) else if(selectable_cards[i]->location == LOCATION_OVERLAY)
myswprintf(formatBuffer, L"%ls[%d](%d)", myswprintf(formatBuffer, L"%ls[%d](%d)",
dataManager.FormatLocation(selectable_cards[i]->overlayTarget->location, selectable_cards[i]->overlayTarget->sequence), dataManager.FormatLocation(selectable_cards[i]->overlayTarget->location, selectable_cards[i]->overlayTarget->sequence),
...@@ -447,7 +464,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -447,7 +464,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff); mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
if(selectable_cards[i]->overlayTarget->controler) if(selectable_cards[i]->overlayTarget->controler)
mainGame->stCardPos[i]->setBackgroundColor(0xff5a5a5a); mainGame->stCardPos[i]->setBackgroundColor(0xff5a5a5a);
else mainGame->stCardPos[i]->setBackgroundColor(0xff56649f); else
mainGame->stCardPos[i]->setBackgroundColor(0xff56649f);
} else if(selectable_cards[i]->location == LOCATION_DECK || selectable_cards[i]->location == LOCATION_EXTRA || selectable_cards[i]->location == LOCATION_REMOVED) { } else if(selectable_cards[i]->location == LOCATION_DECK || selectable_cards[i]->location == LOCATION_EXTRA || selectable_cards[i]->location == LOCATION_REMOVED) {
if(selectable_cards[i]->position & POS_FACEDOWN) if(selectable_cards[i]->position & POS_FACEDOWN)
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff); mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
...@@ -467,7 +485,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) { ...@@ -467,7 +485,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
wchar_t formatBuffer[2048]; wchar_t formatBuffer[2048];
myswprintf(formatBuffer, L"%d", sort_list[i]); myswprintf(formatBuffer, L"%d", sort_list[i]);
mainGame->stCardPos[i]->setText(formatBuffer); mainGame->stCardPos[i]->setText(formatBuffer);
} else mainGame->stCardPos[i]->setText(L""); } else
mainGame->stCardPos[i]->setText(L"");
mainGame->stCardPos[i]->setBackgroundColor(0xff56649f); mainGame->stCardPos[i]->setBackgroundColor(0xff56649f);
} }
mainGame->stCardPos[i]->setVisible(true); mainGame->stCardPos[i]->setVisible(true);
...@@ -648,12 +667,12 @@ void ClientField::ShowSelectOption(int select_hint) { ...@@ -648,12 +667,12 @@ void ClientField::ShowSelectOption(int select_hint) {
mainGame->wOptions->setRelativePosition(pos); mainGame->wOptions->setRelativePosition(pos);
mainGame->bgOptions->setRelativePosition(rect<s32>(0, 0, (scrollbar ? 405 : 390) * mainGame->xScale, pos.LowerRightCorner.Y - pos.UpperLeftCorner.Y)); mainGame->bgOptions->setRelativePosition(rect<s32>(0, 0, (scrollbar ? 405 : 390) * mainGame->xScale, pos.LowerRightCorner.Y - pos.UpperLeftCorner.Y));
} else { } else {
mainGame->SetStaticText(mainGame->stOptions, 350 * mainGame->xScale, mainGame->guiFont,(wchar_t*)dataManager.GetDesc(select_options[0])); mainGame->SetStaticText(mainGame->stOptions, 350 * mainGame->xScale, mainGame->guiFont,
(wchar_t*)dataManager.GetDesc(select_options[0]));
mainGame->stOptions->setVisible(true); mainGame->stOptions->setVisible(true);
mainGame->btnOptionp->setVisible(false); mainGame->btnOptionp->setVisible(false);
mainGame->btnOptionn->setVisible(count > 1); mainGame->btnOptionn->setVisible(count > 1);
mainGame->btnOptionOK->setVisible(true); mainGame->btnOptionOK->setVisible(true);
mainGame->scrOption->setVisible(false);
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; i++)
mainGame->btnOption[i]->setVisible(false); mainGame->btnOption[i]->setVisible(false);
recti pos = mainGame->wOptions->getRelativePosition(); recti pos = mainGame->wOptions->getRelativePosition();
......
...@@ -46,6 +46,7 @@ public: ...@@ -46,6 +46,7 @@ public:
std::vector<ClientCard*> conti_cards; std::vector<ClientCard*> conti_cards;
std::vector<std::pair<int,int>> activatable_descs; std::vector<std::pair<int,int>> activatable_descs;
std::vector<int> select_options; std::vector<int> select_options;
std::vector<int> select_options_index;
std::vector<ChainInfo> chains; std::vector<ChainInfo> chains;
int extra_p_count[2]; int extra_p_count[2];
...@@ -85,6 +86,7 @@ public: ...@@ -85,6 +86,7 @@ public:
bool last_chain; bool last_chain;
bool deck_reversed; bool deck_reversed;
bool conti_selecting; bool conti_selecting;
bool cant_check_grave;
ClientField(); ClientField();
void Clear(); void Clear();
...@@ -145,6 +147,7 @@ public: ...@@ -145,6 +147,7 @@ public:
ClientCard* clicked_card; ClientCard* clicked_card;
ClientCard* command_card; ClientCard* command_card;
ClientCard* highlighting_card; ClientCard* highlighting_card;
ClientCard* menu_card;
int list_command; int list_command;
virtual bool OnEvent(const irr::SEvent& event); virtual bool OnEvent(const irr::SEvent& event);
...@@ -165,5 +168,6 @@ public: ...@@ -165,5 +168,6 @@ public:
//special cards //special cards
#define CARD_MARINE_DOLPHIN 78734254 #define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930 #define CARD_TWINKLE_MOSS 13857930
#define CARD_QUESTION 38723936
#endif //CLIENT_FIELD_H #endif //CLIENT_FIELD_H
This diff is collapsed.
...@@ -27,6 +27,11 @@ public: ...@@ -27,6 +27,11 @@ public:
void ClearSearch(); void ClearSearch();
void SortList(); void SortList();
void RefreshDeckList();
void RefreshReadonly(int catesel);
void ChangeCategory(int catesel);
void ShowDeckManage();
bool CardNameContains(const wchar_t *haystack, const wchar_t *needle); bool CardNameContains(const wchar_t *haystack, const wchar_t *needle);
bool push_main(code_pointer pointer, int seq = -1); bool push_main(code_pointer pointer, int seq = -1);
......
This diff is collapsed.
...@@ -157,6 +157,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -157,6 +157,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HP_DUELIST: { case BUTTON_HP_DUELIST: {
mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
DuelClient::SendPacketToServer(CTOS_HS_TODUELIST); DuelClient::SendPacketToServer(CTOS_HS_TODUELIST);
break; break;
...@@ -604,6 +605,32 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -604,6 +605,32 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case irr::gui::EGET_CHECKBOX_CHANGED: {
switch(id) {
case CHECKBOX_HP_READY: {
if(!caller->isEnabled())
break;
mainGame->env->setFocus(mainGame->wHostPrepare);
if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false);
break;
}
UpdateDeck();
DuelClient::SendPacketToServer(CTOS_HS_READY);
mainGame->cbCategorySelect->setEnabled(false);
mainGame->cbDeckSelect->setEnabled(false);
} else {
DuelClient::SendPacketToServer(CTOS_HS_NOTREADY);
mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true);
}
break;
}
}
break;
}
case irr::gui::EGET_COMBO_BOX_CHANGED: { case irr::gui::EGET_COMBO_BOX_CHANGED: {
switch(id) { switch(id) {
case COMBOBOX_BOT_RULE: { case COMBOBOX_BOT_RULE: {
...@@ -637,32 +664,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -637,32 +664,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case irr::gui::EGET_CHECKBOX_CHANGED: {
switch(id) {
case CHECKBOX_HP_READY: {
if(!caller->isEnabled())
break;
mainGame->env->setFocus(mainGame->wHostPrepare);
if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false);
break;
}
UpdateDeck();
DuelClient::SendPacketToServer(CTOS_HS_READY);
mainGame->cbCategorySelect->setEnabled(false);
mainGame->cbDeckSelect->setEnabled(false);
} else {
DuelClient::SendPacketToServer(CTOS_HS_NOTREADY);
mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true);
}
break;
}
}
break;
}
default: break; default: break;
} }
break; break;
......
...@@ -182,7 +182,6 @@ public: ...@@ -182,7 +182,6 @@ public:
return success; return success;
} }
struct file_unit { struct file_unit {
std::string filename; std::string filename;
bool is_dir; bool is_dir;
......
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