Commit 59a9bacd authored by mercury233's avatar mercury233 Committed by nanahira

GameMessage.SelectPlace support cancel

parent bb9b190a
...@@ -4026,8 +4026,12 @@ public class Ocgcore : ServantWithCardDescription ...@@ -4026,8 +4026,12 @@ public class Ocgcore : ServantWithCardDescription
binaryMaster = new BinaryMaster(); binaryMaster = new BinaryMaster();
player = r.ReadByte(); player = r.ReadByte();
min = r.ReadByte(); min = r.ReadByte();
//TODO: can cancel bool cancelable = false;
if (min == 0) min = 1; if (min == 0)
{
cancelable = true;
min = 1;
}
uint _field = ~r.ReadUInt32(); uint _field = ~r.ReadUInt32();
if (Program.I().setting.setting.hand.value == true || Program.I().setting.setting.handm.value == true || currentMessage == GameMessage.SelectDisfield) if (Program.I().setting.setting.hand.value == true || Program.I().setting.setting.handm.value == true || currentMessage == GameMessage.SelectDisfield)
{ {
...@@ -4130,6 +4134,10 @@ public class Ocgcore : ServantWithCardDescription ...@@ -4130,6 +4134,10 @@ public class Ocgcore : ServantWithCardDescription
gameField.setHint(GameStringManager.get_unsafe(570)); gameField.setHint(GameStringManager.get_unsafe(570));
} }
} }
if (cancelable)
{
gameInfo.addHashedButton("cancelPlace", -1, superButtonType.no, InterString.Get("取消操作@ui"));
}
} }
else else
{ {
...@@ -4199,9 +4207,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -4199,9 +4207,9 @@ public class Ocgcore : ServantWithCardDescription
if ((filter & 0x20) != 0) resp[2] = 5; if ((filter & 0x20) != 0) resp[2] = 5;
else if ((filter & 0x40) != 0) resp[2] = 6; else if ((filter & 0x40) != 0) resp[2] = 6;
} }
else else
{ {
if ((filter & 0x20) != 0) resp[2] = 5; if ((filter & 0x20) != 0) resp[2] = 5;
} }
} }
} }
...@@ -8370,6 +8378,11 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8370,6 +8378,11 @@ public class Ocgcore : ServantWithCardDescription
GCS_swapALL(); GCS_swapALL();
return; return;
} }
if (btn.hashString == "cancelPlace")
{
cancelSelectPlace();
return;
}
switch (currentMessage) switch (currentMessage)
{ {
case GameMessage.SelectBattleCmd: case GameMessage.SelectBattleCmd:
...@@ -8433,6 +8446,18 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8433,6 +8446,18 @@ public class Ocgcore : ServantWithCardDescription
} }
} }
private void cancelSelectPlace()
{
clearAllSelectPlace();
BinaryMaster binaryMaster = new BinaryMaster();
byte[] resp = new byte[3];
resp[0] = (byte)localPlayer(0);
resp[1] = 0;
resp[2] = 0;
binaryMaster.writer.Write(resp);
sendReturn(binaryMaster.get());
}
private void clearAllShowed() private void clearAllShowed()
{ {
for (int i = 0; i < cards.Count; i++) if (cards[i].gameObject.activeInHierarchy) for (int i = 0; i < cards.Count; i++) if (cards[i].gameObject.activeInHierarchy)
...@@ -8990,6 +9015,10 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8990,6 +9015,10 @@ public class Ocgcore : ServantWithCardDescription
{ {
return; return;
} }
if (gameInfo.queryHashedButton("cancelPlace") == true)
{
return;
}
rightExcited = true; rightExcited = true;
//gameInfo.ignoreChain_set(true); //gameInfo.ignoreChain_set(true);
base.ES_mouseDownRight(); base.ES_mouseDownRight();
...@@ -9102,7 +9131,11 @@ public class Ocgcore : ServantWithCardDescription ...@@ -9102,7 +9131,11 @@ public class Ocgcore : ServantWithCardDescription
sendReturn(binaryMaster.get()); sendReturn(binaryMaster.get());
return; return;
} }
if (gameInfo.queryHashedButton("cancelPlace") == true)
{
cancelSelectPlace();
return;
}
} }
void animation_confirm(gameCard target) void animation_confirm(gameCard target)
......
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