You need to sign in or sign up before continuing.
Commit 70300195 authored by mercury233's avatar mercury233 Committed by Unicorn369

update SelectUnselectCard (thanks to edo9300)

support cancel selected cards
parent 33b1460c
...@@ -3402,8 +3402,8 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3402,8 +3402,8 @@ public class Ocgcore : ServantWithCardDescription
cancalable = (r.ReadByte() != 0) || finishable; cancalable = (r.ReadByte() != 0) || finishable;
ES_min = r.ReadByte(); ES_min = r.ReadByte();
ES_max = r.ReadByte(); ES_max = r.ReadByte();
ES_min = finishable ? 0 : 1; // SelectUnselectCard can actually always select 1 card //ES_min = finishable ? 0 : 1; // SelectUnselectCard can actually always select 1 card
ES_max = 1; // SelectUnselectCard can actually always select 1 card //ES_max = 1; // SelectUnselectCard can actually always select 1 card
ES_level = 0; ES_level = 0;
count = r.ReadByte(); count = r.ReadByte();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
...@@ -3420,12 +3420,13 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3420,12 +3420,13 @@ public class Ocgcore : ServantWithCardDescription
allCardsInSelectMessage.Add(card); allCardsInSelectMessage.Add(card);
} }
} }
count = r.ReadByte(); cardsSelected.Clear();
for (int i = 0; i < count; i++) int count2 = r.ReadByte();
for (int i = count; i < count + count2; i++)
{ {
code = r.ReadInt32(); code = r.ReadInt32();
gps = r.ReadGPS(); gps = r.ReadGPS();
/*card = GCS_cardGet(gps, false); card = GCS_cardGet(gps, false);
if (card != null) if (card != null)
{ {
card.set_code(code); card.set_code(code);
...@@ -3433,13 +3434,19 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3433,13 +3434,19 @@ public class Ocgcore : ServantWithCardDescription
card.forSelect = true; card.forSelect = true;
card.selectPtr = i; card.selectPtr = i;
allCardsInSelectMessage.Add(card); allCardsInSelectMessage.Add(card);
}*/ cardsSelected.Add(card);
}
} }
if (cancalable && !finishable) if (cancalable && !finishable)
{ {
gameInfo.addHashedButton("cancleSelected", -1, superButtonType.no, InterString.Get("取消选择@ui")); gameInfo.addHashedButton("cancleSelected", -1, superButtonType.no, InterString.Get("取消选择@ui"));
} }
if (finishable)
{
gameInfo.addHashedButton("sendSelected", 0, superButtonType.yes, InterString.Get("完成选择@ui"));
}
realizeCardsForSelect(); realizeCardsForSelect();
cardsSelected.Clear();
if (ES_selectHint != "") if (ES_selectHint != "")
{ {
gameField.setHint(ES_selectHint + " " + ES_min.ToString() + "-" + ES_max.ToString()); gameField.setHint(ES_selectHint + " " + ES_min.ToString() + "-" + ES_max.ToString());
...@@ -5649,7 +5656,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -5649,7 +5656,6 @@ public class Ocgcore : ServantWithCardDescription
} }
break; break;
case GameMessage.SelectCard: case GameMessage.SelectCard:
case GameMessage.SelectUnselectCard:
if (cardsSelectable.Count <= ES_min) if (cardsSelectable.Count <= ES_min)
{ {
autoSendCards(); autoSendCards();
...@@ -5821,18 +5827,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -5821,18 +5827,6 @@ public class Ocgcore : ServantWithCardDescription
real_send = true; real_send = true;
} }
} }
if (currentMessage == GameMessage.SelectUnselectCard)
{
if (cardsSelected.Count >= ES_min)
{
sendable = true;
}
if (cardsSelected.Count == ES_max || cardsSelected.Count == cardsSelectable.Count)
{
sendable = true;
real_send = true;
}
}
if (currentMessage == GameMessage.SelectTribute) if (currentMessage == GameMessage.SelectTribute)
{ {
int all = 0; int all = 0;
...@@ -5879,7 +5873,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -5879,7 +5873,7 @@ public class Ocgcore : ServantWithCardDescription
} }
} }
} }
else else if (currentMessage != GameMessage.SelectUnselectCard)
{ {
gameInfo.removeHashedButton("sendSelected"); gameInfo.removeHashedButton("sendSelected");
} }
...@@ -8486,7 +8480,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8486,7 +8480,6 @@ public class Ocgcore : ServantWithCardDescription
} }
break; break;
case GameMessage.SelectCard: case GameMessage.SelectCard:
case GameMessage.SelectUnselectCard:
case GameMessage.SelectTribute: case GameMessage.SelectTribute:
case GameMessage.SelectSum: case GameMessage.SelectSum:
if (card.forSelect) if (card.forSelect)
...@@ -8527,6 +8520,16 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8527,6 +8520,16 @@ public class Ocgcore : ServantWithCardDescription
realizeCardsForSelect(); realizeCardsForSelect();
} }
break; break;
case GameMessage.SelectUnselectCard:
if (card.forSelect)
{
cardsSelected.Add(card);
gameInfo.removeHashedButton("sendSelected");
sendSelectedCards();
realize();
toNearest();
}
break;
case GameMessage.SelectChain: case GameMessage.SelectChain:
if (card.forSelect) if (card.forSelect)
{ {
......
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