當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。