Unbind save handshake after message receive.

This commit is contained in:
Michael 2017-05-01 14:56:56 -04:00
parent 249c479985
commit 097afe3dfe

View file

@ -159,17 +159,23 @@ namespace ShiftOS.Engine
{
KernelWatchdog.Log("mud_handshake", "handshake successful: kernel watchdog access code is \"" + ServerManager.thisGuid.ToString() + "\"");
ServerManager.MessageReceived += (msg) =>
ServerMessageReceived savehandshake = null;
savehandshake = (msg) =>
{
if (msg.Name == "mud_savefile")
{
CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
ServerManager.MessageReceived -= savehandshake;
}
else if (msg.Name == "mud_login_denied")
{
oobe.PromptForLogin();
ServerManager.MessageReceived -= savehandshake;
}
};
ServerManager.MessageReceived += savehandshake;
ReadSave();