Commit 8069b341 authored by nanahira's avatar nanahira Committed by Unicorn369

improve reconnecting (#1)

parent d668a213
...@@ -1303,6 +1303,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1303,6 +1303,7 @@ public class Ocgcore : ServantWithCardDescription
logicalClearChain(); logicalClearChain();
surrended = false; surrended = false;
Program.I().room.duelEnded = false; Program.I().room.duelEnded = false;
Program.I().room.joinWithReconnect = false;
turns = 0; turns = 0;
deckReserved = false; deckReserved = false;
keys.Insert(0, currentMessageIndex); keys.Insert(0, currentMessageIndex);
...@@ -1367,7 +1368,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1367,7 +1368,7 @@ public class Ocgcore : ServantWithCardDescription
gameField.currentPhase = GameField.ph.dp; gameField.currentPhase = GameField.ph.dp;
result = duelResult.disLink; result = duelResult.disLink;
deckReserved = false; deckReserved = false;
isFirst = true; //isFirst = true;
gameInfo.swaped = false; gameInfo.swaped = false;
logicalClearChain(); logicalClearChain();
surrended = false; surrended = false;
...@@ -3442,10 +3443,10 @@ public class Ocgcore : ServantWithCardDescription ...@@ -3442,10 +3443,10 @@ public class Ocgcore : ServantWithCardDescription
if (finishable) if (finishable)
{ {
gameInfo.addHashedButton("sendSelected", 0, superButtonType.yes, InterString.Get("完成选择@ui")); gameInfo.addHashedButton("sendSelected", 0, superButtonType.yes, InterString.Get("完成选择@ui"));
} }
realizeCardsForSelect(); realizeCardsForSelect();
cardsSelected.Clear(); cardsSelected.Clear();
if (ES_selectHint != "") if (ES_selectHint != "")
ES_selectUnselectHint = ES_selectHint; ES_selectUnselectHint = ES_selectHint;
if (ES_selectUnselectHint != "") if (ES_selectUnselectHint != "")
{ {
...@@ -8817,8 +8818,9 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8817,8 +8818,9 @@ public class Ocgcore : ServantWithCardDescription
public Dictionary<int, int> sideReference = new Dictionary<int, int>(); public Dictionary<int, int> sideReference = new Dictionary<int, int>();
void onDuelResultConfirmed() public void onDuelResultConfirmed()
{ {
Program.I().room.joinWithReconnect = false;
if (Program.I().room.duelEnded == true || surrended || TcpHelper.tcpClient == null || TcpHelper.tcpClient.Connected == false) if (Program.I().room.duelEnded == true || surrended || TcpHelper.tcpClient == null || TcpHelper.tcpClient.Connected == false)
{ {
......
...@@ -496,6 +496,7 @@ public class Room : WindowServantSP ...@@ -496,6 +496,7 @@ public class Room : WindowServantSP
Program.I().ocgcore.returnServant = Program.I().selectServer; Program.I().ocgcore.returnServant = Program.I().selectServer;
needSide = false; needSide = false;
joinWithReconnect = true;
if (Program.I().deckManager.isShowed) if (Program.I().deckManager.isShowed)
{ {
Program.I().deckManager.hide(); Program.I().deckManager.hide();
...@@ -572,12 +573,16 @@ public class Room : WindowServantSP ...@@ -572,12 +573,16 @@ public class Room : WindowServantSP
public bool needSide = false; public bool needSide = false;
public bool joinWithReconnect = false;
public void StocMessage_ChangeSide(BinaryReader r) public void StocMessage_ChangeSide(BinaryReader r)
{ {
Program.I().ocgcore.surrended = false; Program.I().ocgcore.surrended = false;
Program.I().ocgcore.returnServant = Program.I().deckManager; Program.I().ocgcore.returnServant = Program.I().deckManager;
needSide = true; needSide = true;
if(Program.I().ocgcore.condition != Ocgcore.Condition.duel || joinWithReconnect) { //Change side when reconnect
Program.I().ocgcore.onDuelResultConfirmed();
}
} }
GameObject handres = null; GameObject handres = null;
......
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