Commit d4a71944 authored by SherryChaos's avatar SherryChaos

fix hand test bug

parent ff0f7328
MDPro3 v1.3.7更新:
1.卡组编辑界面的[测试]按钮恢复功能,并以第一位WindBot为对手,不洗牌进行决斗。
MDPro3 v1.3.6更新: MDPro3 v1.3.6更新:
1.新卡片特效:小丑与锁鸟[94145021]; 1.新卡片特效:小丑与锁鸟[94145021];
2.修复部分情况下召唤怪兽后卡片悬空的错误; 2.修复部分情况下召唤怪兽后卡片悬空的错误;
......
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
...@@ -17,7 +16,7 @@ namespace MDPro3.Net ...@@ -17,7 +16,7 @@ namespace MDPro3.Net
public static Thread serverThread; public static Thread serverThread;
public static void StartServer(string args) public static void StartServer(string args)
{ {
if(ServerRunning()) if (ServerRunning())
StopServer(); StopServer();
serverThread = new Thread(() => serverThread = new Thread(() =>
......
...@@ -210,6 +210,8 @@ namespace MDPro3.Servant ...@@ -210,6 +210,8 @@ namespace MDPro3.Servant
{ {
if (servantUI == null) if (servantUI == null)
return; return;
if (FromHandTest)
return;
GetUI<RoomServantUI>().Realize(); GetUI<RoomServantUI>().Realize();
} }
...@@ -474,7 +476,8 @@ namespace MDPro3.Servant ...@@ -474,7 +476,8 @@ namespace MDPro3.Servant
public void StocMessage_HsPlayerEnter(BinaryReader r) public void StocMessage_HsPlayerEnter(BinaryReader r)
{ {
AudioManager.PlaySE("SE_ROOM_SITDOWN"); if(!FromHandTest)
AudioManager.PlaySE("SE_ROOM_SITDOWN");
var name = r.ReadUnicode(20); var name = r.ReadUnicode(20);
var pos = r.ReadByte() & 3; var pos = r.ReadByte() & 3;
var player = new Player(); var player = new Player();
......
...@@ -230,7 +230,7 @@ namespace MDPro3.UI.ServantUI ...@@ -230,7 +230,7 @@ namespace MDPro3.UI.ServantUI
{ {
base.AfterHideEvent(); base.AfterHideEvent();
if(!gotoAppearance || !RoomServant.FromHandTest) if(!gotoAppearance && !RoomServant.FromHandTest)
Dispose(); Dispose();
} }
...@@ -924,15 +924,22 @@ namespace MDPro3.UI.ServantUI ...@@ -924,15 +924,22 @@ namespace MDPro3.UI.ServantUI
public void OnHandTest() public void OnHandTest()
{ {
if (!DeckView.deckLoaded)
return;
if (condition == Condition.ChangeSide)
return;
if (!DeckIsFromLocal)
{
if (condition != Condition.ChangeSide)
MessageManager.Toast(InterString.Get("请先保存卡组"));
return;
}
_ = HandTestAsync(); _ = HandTestAsync();
} }
private async UniTask HandTestAsync() private async UniTask HandTestAsync()
{ {
UIManager.UIBlackIn(0.3f);
await UniTask.WaitForSeconds(0.3f);
int port = 7911; int port = 7911;
while (!TcpHelper.IsPortAvailable(port)) while (!TcpHelper.IsPortAvailable(port))
{ {
...@@ -943,12 +950,12 @@ namespace MDPro3.UI.ServantUI ...@@ -943,12 +950,12 @@ namespace MDPro3.UI.ServantUI
string args = string.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11}", string args = string.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11}",
port.ToString(), port.ToString(),
BanlistManager.EmptyBanlistName, "-1", // Banlist
"5", // Pool "5", // Pool
"0", // Model "0", // Model
"F", // "F", //
"F", // Check "T", // No Check
"F", // Shuffle "T", // No Shuffle
"8000", // Life Point "8000", // Life Point
"5", // Hand "5", // Hand
"1", // Time "1", // Time
...@@ -960,9 +967,14 @@ namespace MDPro3.UI.ServantUI ...@@ -960,9 +967,14 @@ namespace MDPro3.UI.ServantUI
RoomServant.FromLocalHost = false; RoomServant.FromLocalHost = false;
RoomServant.FromHandTest = true; RoomServant.FromHandTest = true;
YgoServer.StartServer(args); YgoServer.StartServer(args);
await UniTask.Delay(50);
UIManager.UIBlackIn(0.3f);
await UniTask.WaitForSeconds(0.3f);
OcgCore.handler = Program.instance.room.Handler;
Program.instance.solo.StartAIForHandTest(port); Program.instance.solo.StartAIForHandTest(port);
await UniTask.Delay(50); await UniTask.Delay(100);
bool joined = false; bool joined = false;
TcpHelper.LinkStart("127.0.0.1", Config.Get("DuelPlayerName0", Config.EMPTY_STRING), port.ToString(), string.Empty, true, () => joined = true); TcpHelper.LinkStart("127.0.0.1", Config.Get("DuelPlayerName0", Config.EMPTY_STRING), port.ToString(), string.Empty, true, () => joined = true);
await UniTask.WaitUntil(() => joined); await UniTask.WaitUntil(() => joined);
......
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