Commit 8266c93c authored by mercury233's avatar mercury233

GameMessage.SelectPlace support cancel

parent f3cfdd59
Pipeline #16403 passed with stages
in 92 minutes and 55 seconds
...@@ -3484,8 +3484,12 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3484,8 +3484,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;
}
var _field = ~r.ReadUInt32(); var _field = ~r.ReadUInt32();
if (Program.I().setting.setting.hand.value || Program.I().setting.setting.handm.value || if (Program.I().setting.setting.hand.value || Program.I().setting.setting.handm.value ||
currentMessage == GameMessage.SelectDisfield) currentMessage == GameMessage.SelectDisfield)
...@@ -3581,6 +3585,10 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3581,6 +3585,10 @@ public class Ocgcore : ServantWithCardDescription
else else
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
{ {
...@@ -7054,6 +7062,12 @@ public class Ocgcore : ServantWithCardDescription ...@@ -7054,6 +7062,12 @@ public class Ocgcore : ServantWithCardDescription
return; return;
} }
if (btn.hashString == "cancelPlace")
{
cancelSelectPlace();
return;
}
switch (currentMessage) switch (currentMessage)
{ {
case GameMessage.SelectBattleCmd: case GameMessage.SelectBattleCmd:
...@@ -7115,6 +7129,18 @@ public class Ocgcore : ServantWithCardDescription ...@@ -7115,6 +7129,18 @@ public class Ocgcore : ServantWithCardDescription
if (realized) realize(true); if (realized) realize(true);
} }
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 (var i = 0; i < cards.Count; i++) for (var i = 0; i < cards.Count; i++)
...@@ -7561,6 +7587,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -7561,6 +7587,7 @@ public class Ocgcore : ServantWithCardDescription
if (flagForTimeConfirm) if (flagForTimeConfirm)
return; return;
if (gameInfo.queryHashedButton("cancleSelected")) return; if (gameInfo.queryHashedButton("cancleSelected")) return;
if (gameInfo.queryHashedButton("cancelPlace")) return;
rightExcited = true; rightExcited = true;
//gameInfo.ignoreChain_set(true); //gameInfo.ignoreChain_set(true);
base.ES_mouseDownRight(); base.ES_mouseDownRight();
...@@ -7659,6 +7686,13 @@ public class Ocgcore : ServantWithCardDescription ...@@ -7659,6 +7686,13 @@ public class Ocgcore : ServantWithCardDescription
var binaryMaster = new BinaryMaster(); var binaryMaster = new BinaryMaster();
binaryMaster.writer.Write(-1); binaryMaster.writer.Write(-1);
sendReturn(binaryMaster.get()); sendReturn(binaryMaster.get());
return;
}
if (gameInfo.queryHashedButton("cancelPlace"))
{
cancelSelectPlace();
return;
} }
} }
......
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