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


C# Sprite.EnterName方法代码示例

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


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

示例1: NewItems

            /// <summary>
            /// Adds the newly generated items to the list of items to be displayed.
            /// </summary>
            private void NewItems()
            {
            current = generator.GenerateMore();

            Texture2D texture = items[18];

            for (int i = 0; i <= 9; i++)
            {
                int height = 0, length = 50;
                bool transparent = false;

                switch (current[i, 1])
                {
                    case "0": height = 499; break;
                    case "1": height = 399; break;
                    case "2": height = 299; break;
                }

                switch (current[i, 0])
                {
                    case "tomato": texture = items[0]; break;
                    case "carrot": texture = items[1]; break;
                    case "strawberry": texture = items[2]; break;
                    case "orange": texture = items[3]; break;
                    case "pineapple": texture = items[4]; break;
                    case "broccoli": texture = items[5]; break;
                    case "fries": texture = items[6]; break;
                    case "hamburger": texture = items[7]; break;
                    case "pizza": texture = items[8]; break;
                    case "donut": texture = items[9]; break;
                    case "muffin": texture = items[10]; break;
                    case "hotdog": texture = items[11]; break;
                    case "level1": texture = items[12]; break;
                    case "level2": texture = items[13]; break;
                    case "level3": texture = items[14]; break;
                    case "sheild": texture = items[15]; break;
                    case "sword": texture = items[16]; break;
                    case "gym": texture = items[17]; length = 200; height = 349; break;
                    case "Empty": transparent = true; break;
                    default: break;
                }

                if (current[i, 0].Contains("boss"))
                {
                    texture = items[19];
                    length = 200;
                    height = 349;
                }

                if (!transparent)
                {
                    Sprite sprite = new Sprite(texture, new Rectangle(1280, height, length, length), Content);
                    sprite.EnterName(current[i, 0]);
                    currentSprite.Add(sprite);
                }
            }
            }
开发者ID:TheCoderPal,项目名称:terasoft-summer-reunited,代码行数:60,代码来源:PlayScreen.cs


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