private static void OnGameMatchmakingMessageReceived(GameMatchmakingMessage message) { if (GameSessionManager.TryGet(message.SessionId, out GameSession session)) { session.DestructGameState(); if (session.FakeAttackState != null) { session.LoadGameState(session.FakeAttackState); session.FakeAttackState = null; return; } switch (message.MatchmakingType) { case GameMatchmakingMessage.GameMatchmakingType.DEFAULT: GameMatchmakingManager.Enqueue(session); break; case GameMatchmakingMessage.GameMatchmakingType.DUEL: GameDuelMatchmakingManager.Enqueue(session); break; } } }
public static void Init() { ServerGame.GameDatabase = new CouchbaseDatabase("magic-players", "game"); GameResourceManager.Init(); GameMatchmakingManager.Init(); GameDuelMatchmakingManager.Init(); GameAvatarManager.Init(); GameSessionManager.Init(); LiveReplayManager.Init(); GameBaseGenerator.Init(); WordCensorUtil.Init(); }
private void OnCancelMatchmakingMessageReceived(CancelMatchmakingMessage message) { if (this.m_session.InDuelMatchmaking) { GameDuelMatchmakingManager.Dequeue(this.m_session); if (!this.m_session.InDuelMatchmaking) { this.m_session.LoadGameState(new GameHomeState { PlayerAvatar = this.m_session.GameAvatar.LogicClientAvatar, Home = this.m_session.GameAvatar.LogicClientHome, SaveTime = this.m_session.GameAvatar.SaveTime, MaintenanceTime = this.m_session.GameAvatar.MaintenanceTime, ServerCommands = this.m_session.GameAvatar.ServerCommands }); } } }
public void DestructGameState() { if (this.GameState != null) { if (this.GameState.GetSimulationServiceNodeType() == SimulationServiceNodeType.BATTLE) { this.SendMessage(new StopSpecifiedServerSessionMessage { ServerType = 27, ServerId = this.m_sockets[27].ServerId }, 1); } else { this.SendMessage(new GameStateNullDataMessage(), 10); } this.GameState = null; } if (this.InMatchmaking) { GameMatchmakingManager.Dequeue(this); } if (this.InDuelMatchmaking) { GameDuelMatchmakingManager.Dequeue(this); } if (this.SpectateLiveReplayId != -1) { ServerMessageManager.SendMessage(new LiveReplayRemoveSpectatorMessage { AccountId = this.SpectateLiveReplayId, SlotId = this.SpectateLiveReplaySlotId, SessionId = this.Id }, 9); this.SpectateLiveReplayId = -1; this.SpectateLiveReplaySlotId = 0; } }