Пример #1
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);
            }
        }
Пример #2
0
        /// <summary>
        ///     Called when a <see cref="ServerBoundMessage"/> is received.
        /// </summary>
        internal void ServerBoundMessageReceived(ServerBoundMessage message)
        {
            LogicLong accountId = message.RemoveAccountId();

            if (!accountId.IsZero())
            {
                if (!AvatarAccountManager.TryGet(accountId, out AvatarAccount avatarAccount))
                {
                    if (NetManager.GetDocumentOwnerId(ServiceCore.ServiceNodeType, accountId) != ServiceCore.ServiceNodeId)
                    {
                        return;
                    }

                    avatarAccount = AvatarAccountManager.CreatePartyAccount(accountId);
                }
                else
                {
                    if (avatarAccount.Session != null)
                    {
                        NetAvatarSessionManager.Remove(avatarAccount.Session.SessionId);

                        avatarAccount.Session.Destruct();
                        avatarAccount.SetSession(null);
                    }
                }

                NetAvatarSession session = NetAvatarSessionManager.Create(avatarAccount, message.RemoveSessionId());

                int[] ids = message.RemoveEndPoints();

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

                avatarAccount.SetSession(session);

                AskForBindServerMessage askForBindServerMessage1 = new AskForBindServerMessage();
                AskForBindServerMessage askForBindServerMessage2 = new AskForBindServerMessage();

                askForBindServerMessage1.SetServerType(10);
                askForBindServerMessage2.SetServerType(11);
                askForBindServerMessage1.SetServerId(NetManager.GetDocumentOwnerId(NetUtils.SERVICE_NODE_TYPE_ZONE_CONTAINER, accountId));
                askForBindServerMessage2.SetServerId(NetManager.GetDocumentOwnerId(NetUtils.SERVICE_NODE_TYPE_PARTY_CONTAINER, accountId));

                session.SendMessage(NetUtils.SERVICE_NODE_TYPE_PROXY_CONTAINER, askForBindServerMessage1);
                session.SendMessage(NetUtils.SERVICE_NODE_TYPE_PROXY_CONTAINER, askForBindServerMessage2);
            }
        }