Beispiel #1
0
        public MainNetworkingManager(
            NewChatManager chatManager,
            ClientManager clientManager,
            LidgrenNetworkingService networkingService
            )
        {
            _chatManager = chatManager;

            _clientManager = clientManager;

            _networkingService = networkingService;
        }
        public GameInterfaceWebView(
            GlobalGameUISingleton gameUserInterface,
            NewChatManager chatManager,
            GameInterfaceViewModel gameInterfaceViewModel
            ) : base(gameUserInterface, gameInterfaceViewModel)
        {
            _chatManager = chatManager;

            _chatManager.ChatAdded += (sender, args) =>
            {
                AddChat(args.ChatJson);
            };
        }
Beispiel #3
0
        public ChatboxWebView(
            ChatboxWebLayer webLayer,
            ChatboxModel chatboxViewModel,
            NewChatManager chatManager,
            SpriteBatch spriteBatch,
            Action <string> chatEntered
            ) : base(webLayer, chatboxViewModel, spriteBatch)
        {
            _chatManager = chatManager;

            _chatEntered = chatEntered;

            WebLayer.RegisterCallback("ChatEntered", ChatEntered);
        }
Beispiel #4
0
        protected override MainManager _manualBuild()
        {
            #region Singletons
            ClientManager clientManager = new ClientManager(new CoreNetworkConfig());
            CameraService cameraService = new CameraService();

            TextDrawingService textDrawingService = null;
            BloomComponent     bloom = null;



            LidgrenMessenger        messenger      = new LidgrenMessenger(clientManager);
            MessageService_ToServer messageService = new MessageService_ToServer(messenger);



            LidgrenNetworkingService networkingService = new LidgrenNetworkingService();


            // Force the static to initialize now
            Utilities.NextUnique();

            #endregion

            List <IGameState> gameStates = new List <IGameState>();

            gameStates.Add(BotStateBuilder.BuildPlanetStateManager(clientManager, networkingService, new PhysicsConfig()));
            gameStates.Add(BotStateBuilder.BuildSpaceStateManager(clientManager, networkingService));
            gameStates.Add(_buildLoginStateManager(null, clientManager, messageService, networkingService));

            NewChatManager chatManager = new NewChatManager(clientManager);

            GameStateManager      gameStateManager      = BuildGameStateManager(cameraService, gameStates, textDrawingService, null);
            MainNetworkingManager mainNetworkingManager = new MainNetworkingManager(chatManager, clientManager, networkingService);

            return(new MainManager(bloom, textDrawingService, this, gameStateManager, _graphics, mainNetworkingManager));
        }
Beispiel #5
0
        protected virtual MainManager _manualBuild()
        {
            #region Singletons
            ClientManager clientManager = new ClientManager(new CoreNetworkConfig());
            CameraService cameraService = new CameraService();

            ParticleManager    particleManager    = null;
            TextDrawingService textDrawingService = null;
            TextureManager     textureManager     = null;
            BloomComponent     bloom = null;
            if (_loadGraphics)
            {
                textureManager     = new TextureManager(Content);
                particleManager    = new ParticleManager(_graphics, _spriteBatch, Content, textureManager);
                textDrawingService = new TextDrawingService(textureManager.DefaultDrawFont, _spriteBatch);
                bloom = new BloomComponent(Content, _spriteBatch);
            }


            LidgrenMessenger        messenger           = new LidgrenMessenger(clientManager);
            MessageService_ToServer messageService      = new MessageService_ToServer(messenger);
            IClientWebViewConfig    clientWebviewConfig = null;
            switch (_environment)
            {
            case ClientEnvironmentType.Development:
                clientWebviewConfig = new DebugClientWebViewConfig();
                break;

            default:
                throw new Exception("You should add a production config, yo!");
            }



            var chatManager = new NewChatManager(clientManager);

            LidgrenNetworkingService networkingService = new LidgrenNetworkingService();

            GlobalGameUISingleton globalGameUiSingleton = new GlobalGameUISingleton(clientWebviewConfig, GraphicsDevice, Window, _spriteBatch);


            GlobalGameWebLayer globalGameWebLayer = new GlobalGameWebLayer(clientWebviewConfig, new GameInterfaceWebView(globalGameUiSingleton, chatManager, new GameInterfaceViewModel()));

            // Force the static to initialize now
            Utilities.NextUnique();

            #endregion

            List <IGameState> gameStates = new List <IGameState>();

            gameStates.Add(_buildPlanetStateManager(globalGameUiSingleton, cameraService, textureManager, particleManager, textDrawingService, messageService, networkingService));
            gameStates.Add(_buildSpaceStateManager(globalGameUiSingleton, cameraService, textureManager, particleManager, textDrawingService, messageService, clientWebviewConfig, networkingService, bloom));
            //gameStates.Add(_buildMoonStateManager(chatManager, CefSharpViewFactory, cameraService, textureManager, particleManager, textDrawingService, messageService, clientWebviewConfig, networkingService));
            gameStates.Add(_buildPortStateManager(globalGameUiSingleton, messageService, networkingService));
            gameStates.Add(_buildLoginStateManager(globalGameUiSingleton, clientManager, messageService, networkingService));
            gameStates.Add(_buildColonyStateManager(globalGameUiSingleton, messageService, networkingService));
            GameStateManager      gameStateManager      = BuildGameStateManager(cameraService, gameStates, textDrawingService, globalGameWebLayer);
            MainNetworkingManager mainNetworkingManager = new MainNetworkingManager(chatManager, clientManager, networkingService);

            return(new MainManager(bloom, textDrawingService, this, gameStateManager, _graphics, mainNetworkingManager));
        }