コード例 #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // create input engine
            new InputEngine(this);

            // TODO: Add your initialization logic here change local host to newly created local host
            //http://s00160273-signalrtest.azurewebsites.net/
            //serverConnection = new HubConnection("http://localhost:53922/");
            serverConnection = new HubConnection("http://s00160273-signalrtest.azurewebsites.net/");
            serverConnection.StateChanged += ServerConnection_StateChanged;
            proxy = serverConnection.CreateHubProxy("GameHub");
            serverConnection.Start();


            Action <PlayerData> joined = clientJoined;

            proxy.On <PlayerData>("Joined", joined);

            Action <List <PlayerData> > currentPlayers = clientPlayers;

            proxy.On <List <PlayerData> >("CurrentPlayers", currentPlayers);

            Action <string, Position> otherMove = clientOtherMoved;

            proxy.On <string, Position>("OtherMove", otherMove);

            // Add the proxy client as a Game service o components can send messages
            Services.AddService <IHubProxy>(proxy);

            FadeManager = new FadeTextManager(this);


            base.Initialize();
        }
コード例 #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Helpers.GraphicsDevice = GraphicsDevice;
            new GetGameInputComponent(this);
            sf = Content.Load <SpriteFont>("keyboardfont");
            // TODO: Add your initialization logic here
            serverConnection = new HubConnection("http://localhost:15878");
            //serverConnection = new HubConnection("http://g-teamcasualgames.azurewebsites.net");
            serverConnection.StateChanged += severConnection_StateChanged;
            proxy = serverConnection.CreateHubProxy("GameHub");
            serverConnection.Start();

            Action <PlayerData> joined = clientJoined;

            proxy.On <PlayerData>("Joined", joined);

            Action <List <PlayerData> > currentPlayers = clientPlayers;

            proxy.On <List <PlayerData> >("CurrentPlayers", currentPlayers);

            Action <string, Position> otherMove = clientOtherMoved;

            proxy.On <string, Position>("OtherMove", otherMove);


            //Sets up the method that will be used when player leaves the game.
            Action <PlayerData, List <PlayerData> > left = PlayerLeft;

            proxy.On <PlayerData, List <PlayerData> >("Left", left);


            FadeManager = new FadeTextManager(this);

            Services.AddService <IHubProxy>(proxy);

            FadeManager = new FadeTextManager(this);
            base.Initialize();
        }
コード例 #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Helpers.GraphicsDevice = GraphicsDevice;
            new InputEngine(this);
            // TODO: Add your initialization logic here
            serverConnection = new HubConnection("http://localhost:15878");
            //serverConnection = new HubConnection("http://g-teamcasualgames.azurewebsites.net");
            serverConnection.StateChanged += severConnection_StateChanged;
            proxy = serverConnection.CreateHubProxy("GameHub");
            serverConnection.Start();



            Action <PlayerData> joined = clientJoined;

            proxy.On <PlayerData>("Joined", joined);

            Action <List <PlayerData> > currentPlayers = clientPlayers;

            proxy.On <List <PlayerData> >("CurrentPlayers", currentPlayers);

            Action <string, Position> otherMove = clientOtherMoved;

            proxy.On <string, Position>("OtherMove", otherMove);

            Action <int, int> getWorldSize = SetWorldSize;

            proxy.On <int, int>("SendWorldSize", getWorldSize);

            Action <PlayerData, List <PlayerData> > left = PlayerLeft;

            proxy.On <PlayerData, List <PlayerData> >("Left", left);

            Action <ProjectileData> hitreg = hitRegistered;

            proxy.On <ProjectileData>("HitReg", hitreg);

            Action <ProjectileData> fired = ProjectileFired;

            proxy.On <ProjectileData>("Fired", fired);

            Action <List <CollectableData> > createCols = createCollectibles;

            proxy.On <List <CollectableData> >("CreateCollectibles", createCols);

            Action checkPs = playerCheck;

            proxy.On("IsGameReady", checkPs);

            Action <string, CollectableData> collected = collectableCollected;

            proxy.On <string, CollectableData>("CollectableCollected", collected);



            FadeManager = new FadeTextManager(this);

            Services.AddService <IHubProxy>(proxy);

            FadeManager = new FadeTextManager(this);
            base.Initialize();
        }