Commit 9c3e3db6 authored by mercury233's avatar mercury233

fix & update

parent a2aac58a
...@@ -76,7 +76,9 @@ void DeckBuilder::Initialize() { ...@@ -76,7 +76,9 @@ void DeckBuilder::Initialize() {
hovered_code = 0; hovered_code = 0;
hovered_pos = 0; hovered_pos = 0;
hovered_seq = -1; hovered_seq = -1;
is_lastcard = 0;
is_draging = false; is_draging = false;
is_starting_dragging = false;
prev_deck = mainGame->cbDBDecks->getSelected(); prev_deck = mainGame->cbDBDecks->getSelected();
prev_operation = 0; prev_operation = 0;
is_modified = false; is_modified = false;
...@@ -487,25 +489,20 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -487,25 +489,20 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(!check_limit(draging_pointer)) if(!check_limit(draging_pointer))
break; break;
} }
if(hovered_pos == 1) is_starting_dragging = true;
pop_main(hovered_seq);
else if(hovered_pos == 2)
pop_extra(hovered_seq);
else if(hovered_pos == 3)
pop_side(hovered_seq);
is_draging = true;
break; break;
} }
case irr::EMIE_LMOUSE_LEFT_UP: { case irr::EMIE_LMOUSE_LEFT_UP: {
is_starting_dragging = false;
if(!is_draging) if(!is_draging)
break; break;
bool pushed = false; bool pushed = false;
if(hovered_pos == 1) if(hovered_pos == 1)
pushed = push_main(draging_pointer, hovered_seq); pushed = push_main(draging_pointer, hovered_seq);
else if(hovered_pos == 2) else if(hovered_pos == 2)
pushed = push_extra(draging_pointer, hovered_seq); pushed = push_extra(draging_pointer, hovered_seq + is_lastcard);
else if(hovered_pos == 3) else if(hovered_pos == 3)
pushed = push_side(draging_pointer, hovered_seq); pushed = push_side(draging_pointer, hovered_seq + is_lastcard);
else if(hovered_pos == 4 && !mainGame->is_siding) else if(hovered_pos == 4 && !mainGame->is_siding)
pushed = true; pushed = true;
if(!pushed) { if(!pushed) {
...@@ -603,6 +600,16 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -603,6 +600,16 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case irr::EMIE_MOUSE_MOVED: { case irr::EMIE_MOUSE_MOVED: {
if(is_starting_dragging) {
is_draging = true;
if(hovered_pos == 1)
pop_main(hovered_seq);
else if(hovered_pos == 2)
pop_extra(hovered_seq);
else if(hovered_pos == 3)
pop_side(hovered_seq);
is_starting_dragging = false;
}
mouse_pos.set(event.MouseInput.X, event.MouseInput.Y); mouse_pos.set(event.MouseInput.X, event.MouseInput.Y);
GetHoveredCard(); GetHoveredCard();
break; break;
...@@ -640,6 +647,7 @@ void DeckBuilder::GetHoveredCard() { ...@@ -640,6 +647,7 @@ void DeckBuilder::GetHoveredCard() {
int pre_code = hovered_code; int pre_code = hovered_code;
hovered_pos = 0; hovered_pos = 0;
hovered_code = 0; hovered_code = 0;
is_lastcard = 0;
if(x >= 314 && x <= 794) { if(x >= 314 && x <= 794) {
if(y >= 164 && y <= 435) { if(y >= 164 && y <= 435) {
int lx = 10, px, py = (y - 164) / 68; int lx = 10, px, py = (y - 164) / 68;
...@@ -671,6 +679,8 @@ void DeckBuilder::GetHoveredCard() { ...@@ -671,6 +679,8 @@ void DeckBuilder::GetHoveredCard() {
hovered_code = 0; hovered_code = 0;
} else { } else {
hovered_code = deckManager.current_deck.extra[hovered_seq]->first; hovered_code = deckManager.current_deck.extra[hovered_seq]->first;
if(x >= 772)
is_lastcard = 1;
} }
} else if (y >= 564 && y <= 628) { } else if (y >= 564 && y <= 628) {
int lx = deckManager.current_deck.side.size(); int lx = deckManager.current_deck.side.size();
...@@ -686,6 +696,8 @@ void DeckBuilder::GetHoveredCard() { ...@@ -686,6 +696,8 @@ void DeckBuilder::GetHoveredCard() {
hovered_code = 0; hovered_code = 0;
} else { } else {
hovered_code = deckManager.current_deck.side[hovered_seq]->first; hovered_code = deckManager.current_deck.side[hovered_seq]->first;
if(x >= 772)
is_lastcard = 1;
} }
} }
} else if(x >= 810 && x <= 995 && y >= 165 && y <= 626) { } else if(x >= 810 && x <= 995 && y >= 165 && y <= 626) {
......
...@@ -49,8 +49,10 @@ public: ...@@ -49,8 +49,10 @@ public:
int hovered_code; int hovered_code;
int hovered_pos; int hovered_pos;
int hovered_seq; int hovered_seq;
int is_lastcard;
int click_pos; int click_pos;
bool is_draging; bool is_draging;
bool is_starting_dragging;
int dragx; int dragx;
int dragy; int dragy;
size_t pre_mainc; size_t pre_mainc;
......
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