public Client(GameStateMultiplayer gameStateMultiplayer)
        {
            this.gameStateMultiplayer = gameStateMultiplayer;
            packetQueue      = new ConcurrentQueue <Packet>();
            processorContext = new ClientProcessorContext(this);

            SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            NetPeerConfiguration config = new NetPeerConfiguration("PlanetbaseMultiplayer");

            config.EnableMessageType(NetIncomingMessageType.Data);
            config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
            client = new NetClient(config);
            client.RegisterReceivedCallback(new SendOrPostCallback(MessageReceived));

            InitializeProcessors();
            InitializeActions();
            InitializeManagers();
        }
        public static bool Show(GuiDefinitions.Callback callback, string title, string text)
        {
            GameState gameState = GameManager.getInstance().getGameState();

            if (gameState is GameStateGame)
            {
                GuiGameOverWindow window        = new GuiGameOverWindow(callback, title, text);
                GameStateGame     gameStateGame = (GameStateGame)gameState;
                FieldInfo         mGameGuiInfo  = Reflection.GetPrivateFieldOrThrow(gameStateGame.GetType(), "mGameGui", true);
                GameGui           mGameGui      = (GameGui)Reflection.GetInstanceFieldValue(gameStateGame, mGameGuiInfo);
                mGameGui.setWindow(window);
                return(true);
            }

            if (gameState is GameStateMultiplayer)
            {
                GameStateMultiplayer gameStateMultiplayer = (GameStateMultiplayer)gameState;
                gameStateMultiplayer.ShowMessageBox(callback, title, text);
                return(true);
            }

            // Not supported
            return(false);
        }