Commit 65e2bde7 authored by mercury233's avatar mercury233

say sorry when MSG_RETRY

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