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


C# SpriteBatch.DrawRightText方法代码示例

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


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

示例1: Draw

        public void Draw(SpriteBatch spriteBatch)
        {
            var screenSize = SceneManager.Instance.VirtualSize;
            var fontBig = SceneManager.Instance.GameFontBig;
            var font = SceneManager.Instance.GameFont;
            var format = "{0}/{1}";

            spriteBatch.Draw(_background, new Rectangle(0, 0, (int)screenSize.X, (int)screenSize.Y), Color.White * 0.5f);
            
            var coinsLPos = new Vector2(_rowsInnerPositionsLeft[0, Current], 60);
            var coinsRPos = new Vector2(_rowsInnerPositionsRight[0], 60);

            var heartsLPos = new Vector2(_rowsInnerPositionsLeft[1, Current], 85);
            var heartsRPos = new Vector2(_rowsInnerPositionsRight[1], 85);

            var enemiesLPos = new Vector2(_rowsInnerPositionsLeft[2, Current], 110);
            var enemiesRPos = new Vector2(_rowsInnerPositionsRight[2], 110);

            var timeLPos = new Vector2(_rowsInnerPositionsLeft[3, Current], 135);
            var timeRPos = new Vector2(_rowsInnerPositionsRight[3], 135);

            spriteBatch.DrawTextWithShadow(fontBig, _completed ? TitleCompleted : TitleFailed, _titlePosition, Color.White);

            var coinsStr = String.Format(format, _values[0, 0], _data.MaxCoins);
            var coinsColor = CalculateColor(_values[0, 0], _data.MaxCoins);
            spriteBatch.DrawTextWithShadow(font, CoinsEarned, coinsLPos, Color.White);
            spriteBatch.DrawRightText(font, coinsStr, coinsRPos, coinsColor, Color.Black);

            var heartsColor = CalculateColor(_values[1, 0], 0);
            spriteBatch.DrawTextWithShadow(font, HeartsLost, heartsLPos, Color.White);
            spriteBatch.DrawRightText(font, _values[1, 0].ToString(), heartsRPos, heartsColor, Color.Black);

            var enemiesStr = String.Format(format, _values[2, 0], _data.MaxEnemies);
            var enemiesColor = CalculateColor(_values[2, 0], _data.MaxEnemies);
            spriteBatch.DrawTextWithShadow(font, EnemiesDefeated, enemiesLPos, Color.White);
            spriteBatch.DrawRightText(font, enemiesStr, enemiesRPos, enemiesColor, Color.Black);

            var timeColor = CalculateColor(_timeValues[0], _data.MaxTime);
            spriteBatch.DrawTextWithShadow(font, Time, timeLPos, Color.White);
            spriteBatch.DrawRightText(font, FormatTime(_timeValues[0]), timeRPos, timeColor, Color.Black);

            if (_phase >= 1)
            {
                spriteBatch.DrawTextWithShadow(font, _rankSentences[_rank], _rankSentencePosition, Color.White * _rankSentenceAlpha);

                if (_rank == "S")
                    ((AnimatedSprite)_rankSprite).Draw(spriteBatch);
                else
                    _rankSprite.Draw(spriteBatch);
            }

            IconsManager.Instance.DrawActionButton(spriteBatch, new Vector2(5, screenSize.Y - 40), false, "Continue", _buttonsAlpha, true);
            IconsManager.Instance.DrawCancelButton(spriteBatch, new Vector2(5, screenSize.Y - 20), false, "Again", _buttonsAlpha, true);
        }
开发者ID:rafaelalmeidatk,项目名称:Super-Pete-The-Pirate,代码行数:54,代码来源:SceneMapSCHelper.cs


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