当前位置: 首页>>代码示例>>C#>>正文


C# SignedInGamer.GetProfile方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.GamerServices.SignedInGamer.GetProfile方法的典型用法代码示例。如果您正苦于以下问题:C# SignedInGamer.GetProfile方法的具体用法?C# SignedInGamer.GetProfile怎么用?C# SignedInGamer.GetProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.GamerServices.SignedInGamer的用法示例。


在下文中一共展示了SignedInGamer.GetProfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
        {
            //BEGIN NEW XBOX LIVE GamerPicture code etc
            //You just need to get the GamerCard info if you don't have it already
            if (gamer == null && SignedInGamer.SignedInGamers.Count > 0)
            {
                //Get info for the 1st player
                gamer = SignedInGamer.SignedInGamers[0];
                profile = gamer.GetProfile();
                //place to draw the gamer picture (in the middle of the screen)
                GamerPictureRectangle = new Rectangle(
                                30,
                                150,
                                64,
                                64
                              );
                //place to write some info
                gamerTagVector = new Vector2(GamerPictureRectangle.X, 0);
            }
            //END NEW XBOX LIVE GamerPicture code etc
            //Get the current state of the keyboard (what keys are and are not being pressed)
            KeyboardState aKeyboard = Keyboard.GetState();
            if (aKeyboard.IsKeyDown(Keys.P))
            {
                //pause the game
                paused = !paused;

            }

            if (paused)
            {

            }
            else
            {
                CheckForRumble(gameTime);

                // TODO: Add your update logic here
                //The time since Update was called last
                float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

                //Update the game objects

                //Lets rotate both ways
                //Only Math.PI / 2( one quarter turn)
                const float quarterturn = (float)Math.PI / 2;

                if (rotation < quarterturn)
                {
                    // The grid is currently rotateing
                    // Just Draw
                }
                else
                    if (rotation > Math.PI / 2 && rotation_direction != 0)
                    {//Rotation completed
                        if (rotation_direction > 0) mPlayfield.Rotate_Grid();
                        else mPlayfield.Rotate_Grid_Clockwise();
                        rotation_direction = 0;
                        rotation = 3.14f;
                    }
                    else
                        if (mPlayfield.CheckCollision(mCurrentShape) == true && mCurrentShape.PositionY < 4)
                        {
                        gameover = true;
                        SaveHighScore();
                        }
                        else
                            UpdateGameObjects(elapsed, aKeyboard);

                base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

                if (IsActive)
                {

                }
            }
        }
开发者ID:hillgr,项目名称:rotatetris,代码行数:83,代码来源:GameplayScreen.cs

示例2: Update

        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
        {
            //BEGIN NEW CODE
            //You just need to get the GamerCard info if you don't have it already
            if (gamer == null && SignedInGamer.SignedInGamers.Count > 0)
            {
                //Get info for the 1st player
                gamer = SignedInGamer.SignedInGamers[0];
                profile = gamer.GetProfile();
                //place to draw the gamer picture (in the middle of the screen)
                GamerPictureRectangle = new Rectangle(
                                30,
                                150,
                                64,
                                64
                              );
                //place to write some info
                gamerTagVector = new Vector2(GamerPictureRectangle.X, 0);
            }
            //END NEW CODE

            Players[1].Update(gameTime);
            Players[0].Update(gameTime);
            Players[2].Update(gameTime);
            Players[3].Update(gameTime);

            //=======OLD CODE HERE===============
               // CheckForRumble(gameTime);

            // TODO: Add your update logic here
            //The time since Update was called last
             elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

              //  //Get the current state of the keyboard (what keys are and are not being pressed)
              //  KeyboardState aKeyboard = Keyboard.GetState();

            /*
                    if (mPlayfield.CheckCollision(mCurrentShape) == true && mCurrentShape.PositionY < 4)
                    {//gameover}}
                        gameover = true;
                    }
                    else
                        UpdateGameObjects(elapsed);
            */
            //==========OLD CODE END HERE===================

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }
开发者ID:hillgr,项目名称:rotatetris,代码行数:54,代码来源:BoringMode.cs

示例3: PlayerHUD

        public PlayerHUD( Player player, SignedInGamer gamer )
        {
            GameplayScreen screen = player.Screen;

              if ( gamer != null )
              {
            profile = gamer.GetProfile();
            Name = gamer.Gamertag;
              }
              else Name = "CPU";

              Player = player;
              Score = 0;
              Boost = 1f;

              Rectangle safeRect = ScreenRects.SafeRegion;

              screenScale = GameCore.Instance.GraphicsDevice.Viewport.Height / 1080f;
              float ss = screenScale;

              // base hud object
              hudCageTexture = screen.Content.Load<Texture2D>( "Textures/playerHUDCage" );
              hudTexture = screen.Content.Load<Texture2D>( "Textures/playerHUD" );
              int hudWidth  = (int)( hudTexture.Width * screenScale );
              int hudHeight = (int)( hudTexture.Height * screenScale );

              int x0 = xPadding + safeRect.X + Player.PlayerNumber * ( safeRect.Width - hudWidth - 2 * xPadding ) / 3;
              int y0 = -(int)( yPadding * screenScale + .5f ) + safeRect.Y + safeRect.Height - hudHeight;

              hudRect = new Rectangle( x0, y0, hudWidth, hudHeight );

              // profile picture
              profileRect = new Rectangle( x0 + (int)( 88 * ss + .5f ),
                                   y0 + (int)( 26 * ss + .5f ),
                                   (int)( 60 * ss + .5f ),
                                   (int)( 60 * ss + .5f ) );

              // boost meter
              boostRect = new Rectangle( x0 + (int)(  90 * ss + .5f ),
                                 y0 + (int)( 111 * ss + .5f ),
                                 (int)( 142 * ss + .5f ),
                                 (int)( 18 * ss + .5f ) );

              boostEffect = screen.Content.Load<Effect>( "Effects/meterEffect" );
              boostEffect.CurrentTechnique = boostEffect.Techniques[0];
              boostEffectParamBoost = boostEffect.Parameters["Boost"];
              boostEffectParamBoosting = boostEffect.Parameters["Boosting"];
              boostEffectParamTime = boostEffect.Parameters["Time"];
              boostTexture = new Texture2D( screen.ScreenManager.GraphicsDevice, boostRect.Width, boostRect.Height );

              // name
              namePos = new Vector2( x0 + 162 * ss, y0 + 12 * ss );
              nameFont = screen.Content.Load<SpriteFont>( "Fonts/HUDNameFont" );
              nameOrigin = nameFont.MeasureString( Name ) / 2;
              float nameLength = nameOrigin.X * 2;
              nameScale = ss * Math.Min( 150f / nameLength, 1f );

              // score
              scorePos = new Vector2( x0 + 230 * ss, y0 + 100 * ss );
              scoreFont = screen.Content.Load<SpriteFont>( "Fonts/HUDScoreFont" );
              scoreSpring = new SpringInterpolater( 1, 700f, .25f * SpringInterpolater.GetCriticalDamping( 700f ) );
              scoreSpring.SetSource( 1f );
              scoreSpring.SetDest( 1f );
              scoreSpring.Active = true;
              scoreString = new StringBuilder( 1 );

              //// score popup
              //scorePopup = new PopupText( ss, scorePos + new Vector2( -25f, -120f ) * screenScale,
              //                            scorePos + new Vector2( -15f, -15f ) * screenScale, 1f );
              // score popup
              //float yMax = GameCore.Instance.DisplayGamertags ? -50f : -10f;
              //float yMin = GameCore.Instance.DisplayGamertags ? 0f : 40f;
              float yMax = -50f;
              float yMin = 0f;
              scorePopup = new PopupText( ss, new Vector2( 0f, yMax ) * screenScale,
                                  new Vector2( 0, yMin ) * screenScale, 1f );

              // place
              placePos = new Vector2( x0 + 36 * ss, y0 + 91 * ss );
              placeFont = screen.Content.Load<SpriteFont>( "Fonts/HUDPlaceFont" );
              placeSmallFont = screen.Content.Load<SpriteFont>( "Fonts/HUDPlaceTagFont" );
              placeNumber = new StringBuilder( "0" );
              placeSpring = new SpringInterpolater( 1, 700f, .25f * SpringInterpolater.GetCriticalDamping( 700f ) );
              placeSpring.SetSource( 1f );
              placeSpring.SetDest( 1f );
              placeSpring.Active = true;
              Place = 1;
        }
开发者ID:yxrkt,项目名称:AvatarHamsterPanic,代码行数:88,代码来源:PlayerHUD.cs

示例4: Update

        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
        {
            //BEGIN NEW XBOX LIVE GamerPicture code etc
            //You just need to get the GamerCard info if you don't have it already
            if (gamer == null && SignedInGamer.SignedInGamers.Count > 0)
            {
                //Get info for the 1st player
                gamer = SignedInGamer.SignedInGamers[0];
                profile = gamer.GetProfile();
                //place to draw the gamer picture (in the middle of the screen)
                GamerPictureRectangle = new Rectangle(
                                30,
                                150,
                                64,
                                64
                              );
                //place to write some info
                gamerTagVector = new Vector2(GamerPictureRectangle.X, 0);
            }
            //END NEW XBOX LIVE GamerPicture code etc

            CheckForRumble(gameTime);

            // TODO: Add your update logic here
            //The time since Update was called last
            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            //Get the current state of the keyboard (what keys are and are not being pressed)
            KeyboardState aKeyboard = Keyboard.GetState();

            //Update the game objects
            if (rotation < Math.PI / 2)
            {
                //rotateing
            }
            else
                if (rotation > Math.PI / 2 && rotation != 3.14f)
                {
                    mPlayfield.Rotate_Grid();
                    rotation = 3.14f;
                }
                else
                    if (mPlayfield.CheckCollision(mCurrentShape) == true && mCurrentShape.PositionY < 4)
                    {gameover = true;}
                    else
                        UpdateGameObjects(elapsed, aKeyboard);

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            if (IsActive)
            {
                // Apply some random jitter to make the enemy move around.
                const float randomization = 10;

                enemyPosition.X += (float)(random.NextDouble() - 0.5) * randomization;
                enemyPosition.Y += (float)(random.NextDouble() - 0.5) * randomization;

                // Apply a stabilizing force to stop the enemy moving off the screen.
                Vector2 targetPosition = new Vector2(200, 200);

                enemyPosition = Vector2.Lerp(enemyPosition, targetPosition, 0.05f);

                // TODO: this game isn't very fun! You could probably improve
                // it by inserting something more interesting in this space :-)
            }
        }
开发者ID:hillgr,项目名称:rotatetris,代码行数:72,代码来源:ParticleScreen.cs


注:本文中的Microsoft.Xna.Framework.GamerServices.SignedInGamer.GetProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。