CloseShop() public method

public CloseShop ( bool closedByCharacter = false ) : void
closedByCharacter bool
return void
Beispiel #1
0
        public void Destroy()
        {
            // unregister from WCF events
            ServiceFactory.Instance.CommunicationCallback.CharacterConnectedEvent    -= CommunicationCallback_CharacterConnectedEvent;
            ServiceFactory.Instance.CommunicationCallback.CharacterDisconnectedEvent -= CommunicationCallback_CharacterDisconnectedEvent;

            // do everything necessary before removing client, DB save, Whatever
            if (HasSelectedCharacter)
            {
                Character.CloseShop();

                // disconnect client
                ServiceFactory.Instance.CommunicationService.DisconnectCharacter(Character.Name);

                // unregister from map if registered
                if (CurrentMap != null)
                {
                    CurrentMap.UnregisterSession(this.Character.CharacterId);
                    CurrentMap = null;
                    ServerManager.Instance.UnregisterSession(this.Character.CharacterId);
                }
            }

            if (Account != null)
            {
                ServiceFactory.Instance.CommunicationService.DisconnectAccount(Account.Name);
            }

            _queue.ClearQueue();
        }