fix(net): conform character entry and session shutdown
This commit is contained in:
parent
bacc7e45a9
commit
aea957f845
12 changed files with 1016 additions and 95 deletions
|
|
@ -2867,6 +2867,7 @@ public sealed class GameWindow : IDisposable, ILiveAnimationPresentationContext
|
|||
_liveSession = _liveSessionController.CreateAndWire(_options, WireLiveSessionEvents);
|
||||
if (_liveSession is null)
|
||||
{
|
||||
_commandBus = null;
|
||||
_combatChatTranslator?.Dispose();
|
||||
_combatChatTranslator = null;
|
||||
_liveSessionController = null;
|
||||
|
|
@ -2883,9 +2884,15 @@ public sealed class GameWindow : IDisposable, ILiveAnimationPresentationContext
|
|||
_liveSession.Connect(user, pass);
|
||||
Chat.OnSystemMessage("connected — character list received", chatType: 1);
|
||||
|
||||
if (_liveSession.Characters is null || _liveSession.Characters.Characters.Count == 0)
|
||||
if (_liveSession.Characters is null
|
||||
|| !AcDream.Core.Net.Messages.CharacterList.TrySelectFirstAvailable(
|
||||
_liveSession.Characters,
|
||||
out AcDream.Core.Net.Messages.CharacterList.Selection selection))
|
||||
{
|
||||
Console.WriteLine("live: no characters on account; disconnecting");
|
||||
Console.WriteLine("live: no available characters on account; disconnecting");
|
||||
_commandBus = null;
|
||||
_combatChatTranslator?.Dispose();
|
||||
_combatChatTranslator = null;
|
||||
_liveSessionController.Dispose();
|
||||
_liveSessionController = null;
|
||||
_liveSession = null;
|
||||
|
|
@ -2893,7 +2900,7 @@ public sealed class GameWindow : IDisposable, ILiveAnimationPresentationContext
|
|||
return;
|
||||
}
|
||||
|
||||
var chosen = _liveSession.Characters.Characters[0];
|
||||
var chosen = selection.Character;
|
||||
_playerServerGuid = chosen.Id;
|
||||
_vitalsVm?.SetLocalPlayerGuid(chosen.Id);
|
||||
Chat.SetLocalPlayerGuid(chosen.Id);
|
||||
|
|
@ -2901,7 +2908,7 @@ public sealed class GameWindow : IDisposable, ILiveAnimationPresentationContext
|
|||
AcDream.App.Streaming.EntityVanishProbe.PlayerGuid = chosen.Id; // TEMP #138-B probe
|
||||
Console.WriteLine($"live: entering world as 0x{chosen.Id:X8} {chosen.Name}");
|
||||
Combat.Clear();
|
||||
_liveSession.EnterWorld(user, characterIndex: 0);
|
||||
_liveSession.EnterWorld(characterIndex: selection.ActiveIndex);
|
||||
|
||||
_activeToonKey = chosen.Name;
|
||||
_retailUiRuntime?.RestoreLayout();
|
||||
|
|
@ -2919,6 +2926,7 @@ public sealed class GameWindow : IDisposable, ILiveAnimationPresentationContext
|
|||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"live: session failed: {ex.Message}");
|
||||
_commandBus = null;
|
||||
_combatChatTranslator?.Dispose();
|
||||
_combatChatTranslator = null;
|
||||
_liveSessionController?.Dispose();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue