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
binaryMaster = new BinaryMaster();
player = r.ReadByte();
min = r.ReadByte();
//TODO: can cancel
if (min == 0) min = 1;
bool cancelable = false;
if (min == 0)
{
cancelable = true;
min = 1;
}
var _field = ~r.ReadUInt32();
if (Program.I().setting.setting.hand.value || Program.I().setting.setting.handm.value ||
currentMessage == GameMessage.SelectDisfield)
......@@ -3581,6 +3585,10 @@ public class Ocgcore : ServantWithCardDescription
else
gameField.setHint(GameStringManager.get_unsafe(570));
}
if (cancelable)
{
gameInfo.addHashedButton("cancelPlace", -1, superButtonType.no, InterString.Get("取消操作@ui"));
}
}
else
{
......@@ -7054,6 +7062,12 @@ public class Ocgcore : ServantWithCardDescription
return;
}
if (btn.hashString == "cancelPlace")
{
cancelSelectPlace();
return;
}
switch (currentMessage)
{
case GameMessage.SelectBattleCmd:
......@@ -7115,6 +7129,18 @@ public class Ocgcore : ServantWithCardDescription
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()
{
for (var i = 0; i < cards.Count; i++)
......@@ -7561,6 +7587,7 @@ public class Ocgcore : ServantWithCardDescription
if (flagForTimeConfirm)
return;
if (gameInfo.queryHashedButton("cancleSelected")) return;
if (gameInfo.queryHashedButton("cancelPlace")) return;
rightExcited = true;
//gameInfo.ignoreChain_set(true);
base.ES_mouseDownRight();
......@@ -7659,6 +7686,13 @@ public class Ocgcore : ServantWithCardDescription
var binaryMaster = new BinaryMaster();
binaryMaster.writer.Write(-1);
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