Dispose() 공개 메소드

Make the character moveable also from Teleport, ..
public Dispose ( ) : void
리턴 void
예제 #1
0
        public void Destroy()
        {
            // unregister from events
            CommunicationServiceClient.Instance.CharacterConnectedEvent    -= OnOtherCharacterConnected;
            CommunicationServiceClient.Instance.CharacterDisconnectedEvent -= OnOtherCharacterDisconnected;

            // do everything necessary before removing client, DB save, Whatever
            if (HasSelectedCharacter)
            {
                Character.Dispose();
                if (Character.MapInstance.MapInstanceType == MapInstanceType.TimeSpaceInstance || Character.MapInstance.MapInstanceType == MapInstanceType.RaidInstance)
                {
                    Character.MapInstance.InstanceBag.DeadList.Add(Character.CharacterId);
                    if (Character.MapInstance.MapInstanceType == MapInstanceType.RaidInstance)
                    {
                        Character?.Group?.Characters.ToList().ForEach(s =>
                        {
                            s.SendPacket(s.Character.Group.GeneraterRaidmbf());
                            s.SendPacket(s.Character.Group.GenerateRdlst());
                        });
                    }
                }
                if (Character?.Miniland != null)
                {
                    ServerManager.Instance.RemoveMapInstance(Character.Miniland.MapInstanceId);
                }
                // TODO Check why ExchangeInfo.TargetCharacterId is null Character.CloseTrade();
                // disconnect client
                CommunicationServiceClient.Instance.DisconnectCharacter(ServerManager.Instance.WorldId, Character.CharacterId);

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

            if (Account != null)
            {
                CommunicationServiceClient.Instance.DisconnectAccount(Account.AccountId);
            }

            ClearReceiveQueue();
        }
예제 #2
0
        public void Destroy()
        {
            // unregister from WCF events
            ServerCommunicationClient.Instance.CharacterConnectedEvent    -= OnOtherCharacterConnected;
            ServerCommunicationClient.Instance.CharacterDisconnectedEvent -= OnOtherCharacterDisconnected;

            // do everything necessary before removing client, DB save, Whatever
            if (HasSelectedCharacter)
            {
                Character.Dispose();
                if (Character.MapInstance.MapInstanceType == MapInstanceType.TimeSpaceInstance || Character.MapInstance.MapInstanceType == MapInstanceType.RaidInstance)
                {
                    Character.MapInstance.InstanceBag.DeadList.Add(Character.CharacterId);
                }
                ServerManager.Instance.RemoveMapInstance(Character.Miniland.MapInstanceId);

                // TODO Check why ExchangeInfo.TargetCharacterId is null Character.CloseTrade();
                // disconnect client
                ServerCommunicationClient.Instance.HubProxy.Invoke("DisconnectCharacter", ServerManager.Instance.ServerGroup, Character.Name, Character.CharacterId).Wait();

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

            if (Account != null)
            {
                ServerCommunicationClient.Instance.HubProxy.Invoke("DisconnectAccount", Account.Name).Wait();
            }

            ClearReceiveQueue();
        }