public static void OnStartServerSessionMessageReceived(StartServerSessionMessage message)
        {
            if (GameModeClusterManager.m_sessionClusters.ContainsKey(message.SessionId))
            {
                throw new Exception("GameModeClusterManager.onStartSessionMessageReceived: session already started!");
            }

            GameModeCluster gameModeCluster = GameModeClusterManager.GetFastestCluster();

            if (gameModeCluster != null)
            {
                GameModeClusterManager.m_sessionClusters.Add(message.SessionId, gameModeCluster);
                gameModeCluster.SendMessage(message);
            }
            else
            {
                if (message.BindRequestMessage != null)
                {
                    ServerRequestManager.SendResponse(new BindServerSocketResponseMessage(), message.BindRequestMessage);
                }
                ServerMessageManager.SendMessage(new StartServerSessionFailedMessage
                {
                    SessionId = message.SessionId
                }, message.Sender);
            }
        }
 public void OnStartServerSessionMessageReceived(StartServerSessionMessage message)
 {
     if (this.m_sessions.ContainsKey(message.SessionId))
     {
         throw new Exception("HomeSessionManager.onStartSessionMessageReceived: session already started!");
     }
     this.m_sessions.Add(message.SessionId, new HomeSession(message));
 }
Ejemplo n.º 3
0
 public static void OnStartServerSessionMessageReceived(StartServerSessionMessage message)
 {
     if (AllianceSessionManager.m_sessions.ContainsKey(message.SessionId))
     {
         throw new Exception("AllianceSessionManager.onStartSessionMessageReceived: session already started!");
     }
     AllianceSessionManager.m_sessions.Add(message.SessionId, new AllianceSession(message));
 }
        public AllianceSession(StartServerSessionMessage message) : base(message)
        {
            this.LogicMessageManager = new LogicMessageManager(this);

            ServerRequestManager.Create(new AvatarRequestMessage
            {
                AccountId = this.AccountId
            }, ServerManager.GetDocumentSocket(9, this.AccountId)).OnComplete = this.OnAvatarReceived;
        }
Ejemplo n.º 5
0
        public GameSession(StartServerSessionMessage message) : base(message)
        {
            this.LogicMessageManager = new LogicMessageManager(this);
            this.GameAvatar          = GameAvatarManager.TryGet(this.AccountId, out GameAvatar document) ? document : GameAvatarManager.Create(this.AccountId);

            if (this.GameAvatar.CurrentSession != null)
            {
                GameSessionManager.Remove(this.GameAvatar.CurrentSession.Id);
            }
            this.GameAvatar.CurrentSession = this;

            GameMatchmakingManager.Dequeue(this.GameAvatar);
            ServerRequestManager.Create(new BindServerSocketRequestMessage
            {
                SessionId  = this.Id,
                ServerType = 10,
                ServerId   = -1
            }, this.m_sockets[1], 10).OnComplete = this.OnHomeServerBound;
        }
Ejemplo n.º 6
0
        public ServerSession(StartServerSessionMessage message) : this(message.SessionId, message.AccountId, message.Country)
        {
            LogicArrayList <int> serverSocketTypeList = message.ServerSocketTypeList;
            LogicArrayList <int> serverSocketIdList   = message.ServerSocketIdList;

            for (int i = 0; i < serverSocketTypeList.Size(); i++)
            {
                int type = serverSocketTypeList[i];
                int id   = serverSocketIdList[i];

                this.m_sockets[type] = ServerManager.GetSocket(type, id);
            }

            if (message.BindRequestMessage != null)
            {
                ServerRequestManager.SendResponse(new BindServerSocketResponseMessage
                {
                    ServerType = ServerCore.Type,
                    ServerId   = ServerCore.Id,
                    Success    = true
                }, message.BindRequestMessage);
            }
        }
Ejemplo n.º 7
0
 public HomeSession(StartServerSessionMessage message) : base(message)
 {
     this.LogicMessageManager = new LogicMessageManager(this);
 }
 public ChatSession(StartServerSessionMessage message) : base(message)
 {
     this.LogicMessageManager = new LogicMessageManager(this);
     this.ChatInstance        = ChatInstanceManager.GetJoinableInstance(this.Country);
     this.ChatInstance.Add(this);
 }
 private void OnStartServerSessionMessageReceived(StartServerSessionMessage message)
 {
     this.m_sessionManager.OnStartServerSessionMessageReceived(message);
 }