public override void update(GameTime time) { if (client != null) { if (!client.connectionStarted && drawn) { client.connect(); } if (client.connectionStarted) { client.receiveMessages(); } if (client.readyToPlay) { Game1.gameMode = 3; loadClientOptions(); if (Game1.activeClickableMenu is FarmhandMenu || (Game1.activeClickableMenu is TitleMenu && TitleMenu.subMenu is FarmhandMenu)) { Game1.exitActiveMenu(); } } else if (client.timedOut) { if (approvingFarmhand) { Game1.multiplayer.clientRemotelyDisconnected(Multiplayer.IsTimeout(client.pendingDisconnect) ? Multiplayer.DisconnectType.Timeout_FarmhandSelection : client.pendingDisconnect); } else { menuSlots.RemoveAll((MenuSlot slot) => slot is FarmhandSlot); } } } base.update(time); }
protected override void Dispose(bool disposing) { if (client != null && disposing && Game1.client != client) { Multiplayer.LogDisconnect(Multiplayer.IsTimeout(client.pendingDisconnect) ? Multiplayer.DisconnectType.Timeout_FarmhandSelection : Multiplayer.DisconnectType.ExitedToMainMenu_FromFarmhandSelect); client.disconnect(); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (client != null && disposing && Game1.client != client) { Multiplayer.LogDisconnect(Multiplayer.IsTimeout(client.pendingDisconnect) ? Multiplayer.DisconnectType.Timeout_FarmhandSelection : Multiplayer.DisconnectType.ExitedToMainMenu_FromFarmhandSelect); client.disconnect(); if (!Game1.game1.IsMainInstance) { GameRunner.instance.RemoveGameInstance(Game1.game1); } } base.Dispose(disposing); }