Commit 65e2bde7 authored by mercury233's avatar mercury233

say sorry when MSG_RETRY

parent 41f5ba8c
...@@ -74,6 +74,11 @@ namespace WindBot.Game.AI ...@@ -74,6 +74,11 @@ namespace WindBot.Game.AI
} }
} }
public void SendSorry()
{
InternalSendMessage(new[] { "Sorry, an error occurs." });
}
public void SendWelcome() public void SendWelcome()
{ {
InternalSendMessage(_welcome); InternalSendMessage(_welcome);
......
...@@ -22,6 +22,14 @@ namespace WindBot.Game ...@@ -22,6 +22,14 @@ namespace WindBot.Game
_dialogs = new Dialogs(game); _dialogs = new Dialogs(game);
} }
/// <summary>
/// Called when the AI got the error message.
/// </summary>
public void OnRetry()
{
_dialogs.SendSorry();
}
/// <summary> /// <summary>
/// Called when the AI join the game. /// Called when the AI join the game.
/// </summary> /// </summary>
......
...@@ -235,6 +235,7 @@ namespace WindBot.Game ...@@ -235,6 +235,7 @@ namespace WindBot.Game
private void OnRetry(BinaryReader packet) private void OnRetry(BinaryReader packet)
{ {
_ai.OnRetry();
Connection.Close(); Connection.Close();
throw new Exception("Got MSG_RETRY."); throw new Exception("Got MSG_RETRY.");
} }
......
...@@ -118,14 +118,7 @@ namespace WindBot ...@@ -118,14 +118,7 @@ namespace WindBot
string EnvPassword = Environment.GetEnvironmentVariable("YGOPRO_PASSWORD"); string EnvPassword = Environment.GetEnvironmentVariable("YGOPRO_PASSWORD");
if (EnvPassword != null) if (EnvPassword != null)
Info.HostInfo = EnvPassword; Info.HostInfo = EnvPassword;
Run(Info);
GameClient client = new GameClient(Info);
client.Start();
while (client.Connection.IsConnected)
{
client.Tick();
Thread.Sleep(client.nextTickDelay);
}
} }
private static void RunAsServer(int ServerPort) private static void RunAsServer(int ServerPort)
......
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