Пример #1
0
        /// <summary>
        ///     Called when a <see cref="ServerUnboundMessage"/> is received.
        /// </summary>
        internal void ServerUnboundMessageReceived(ServerUnboundMessage message)
        {
            byte[] sessionId = message.GetSessionId();

            if (NetGlobalChatSessionManager.TryRemove(sessionId, out NetGlobalChatSession session))
            {
                session.Destruct();
            }
        }
Пример #2
0
        /// <summary>
        ///     Called when a <see cref="AvatarEntryMessage"/> is received.
        /// </summary>
        internal void AvatarEntryMessageReceived(AvatarEntryMessage message)
        {
            byte[] sessionId = message.RemoveSessionId();

            if (NetGlobalChatSessionManager.TryGet(sessionId, out NetGlobalChatSession session))
            {
                message.RemoveAvatarEntry().CopyTo(session.AvatarEntry);
            }
        }
Пример #3
0
        /// <summary>
        ///     Called when a <see cref="UpdateServerEndPointMessage"/> is received.
        /// </summary>
        internal void UpdateServerEndPointMessageReceived(UpdateServerEndPointMessage message)
        {
            byte[] sessionId = message.RemoveSessionId();

            if (NetGlobalChatSessionManager.TryGet(sessionId, out NetGlobalChatSession session))
            {
                if (message.GetServerType() != ServiceCore.ServiceNodeType)
                {
                    session.SetServiceNodeId(message.GetServerType(), message.GetServerId());
                }
            }
        }
Пример #4
0
        /// <summary>
        ///     Called when a <see cref="ServerBoundMessage"/> is received.
        /// </summary>
        internal void ServerBoundMessageReceived(ServerBoundMessage message)
        {
            LogicLong accountId = message.RemoveAccountId();

            if (!accountId.IsZero())
            {
                NetGlobalChatSession session = NetGlobalChatSessionManager.Create(message.RemoveSessionId());

                int[] ids = message.RemoveEndPoints();

                for (int i = 0; i < 28; i++)
                {
                    if (ids[i] != -1)
                    {
                        session.SetServiceNodeId(i, ids[i]);
                    }
                }

                RoomManager.JoinRoom(session);
            }
        }
Пример #5
0
        /// <summary>
        ///     Called when a <see cref="ForwardPiranhaMessage"/> is received.
        /// </summary>
        internal void ForwardPiranhaMessageReceived(ForwardPiranhaMessage message)
        {
            byte[] sessionId = message.RemoveSessionId();

            if (NetGlobalChatSessionManager.TryGet(sessionId, out NetGlobalChatSession session))
            {
                PiranhaMessage piranhaMessage = message.RemovePiranhaMessage();

                if (piranhaMessage != null)
                {
                    try
                    {
                        piranhaMessage.Decode();
                        session.PiranhaMessageManager.ReceiveMessage(piranhaMessage);
                    }
                    catch (Exception exception)
                    {
                        Logging.Warning("NetChatMessageManager::forwardPiranhaMessageReceived piranha message handle exception, trace: " + exception);
                    }
                }
            }
        }
Пример #6
0
 /// <summary>
 ///     Initializes the network part.
 /// </summary>
 internal static void InitNetwork()
 {
     NetGlobalChatSessionManager.Initialize();
 }