Пример #1
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);
            }
        }
Пример #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MessageManager"/> class.
 /// </summary>
 internal MessageManager(NetAvatarSession session)
 {
     this._session = session;
 }
Пример #3
0
 /// <summary>
 ///     Destructs this instance.
 /// </summary>
 internal void Destruct()
 {
     this._session = null;
 }
Пример #4
0
 /// <summary>
 ///     Sets the <see cref="NetAvatarSession"/> instance.
 /// </summary>
 internal void SetSession(NetAvatarSession session)
 {
     this.Session = session;
 }