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


C# UIAtlas.GetListOfSprites方法代码示例

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


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

示例1: SpriteField

 /// <summary>
 /// Convenience function that displays a list of sprites and returns the selected value.
 /// </summary>
 public static string SpriteField(UIAtlas atlas, string field, string name, params GUILayoutOption[] options)
 {
     List<string> sprites = atlas.GetListOfSprites();
     return (sprites != null && sprites.Count > 0) ? NGUIEditorTools.DrawList(field, sprites.ToArray(), name, options) : null;
 }
开发者ID:quiker,项目名称:hexagon,代码行数:8,代码来源:UISpriteInspector.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        // Find assocciated minigame
        minigame = GetComponent<Minigame>();
        MinigameDifficulty.Difficulty difficulty = minigame.difficulty;

        // Initialize levels array
        myLevels = new GameObject[numLevels];

        // Easy or medium assets
        if(minigame.difficulty != MinigameDifficulty.Difficulty.HARD) {

            foodsAtlas = (UIAtlas) Resources.Load ("NPCs/Amy/AmyLargeFoodBuffetAtlas", typeof(UIAtlas));

            // Gets all large foods
            foreach(string s in foodsAtlas.GetListOfSprites()) {
                if(s.Contains("dess")) {
                    dessertItems.Add (s);
                } else if(s.Contains("app")) {
                    appetizerItems.Add (s);
                } else if(s.Contains("main")) {
                    mainItems.Add (s);
                }
            }

            // Randomizes the possible appetizer foods
            for(int appRandomizer = 0; appRandomizer < appetizerItems.Count; appRandomizer++) {
                int randomindex = Random.Range(appRandomizer, appetizerItems.Count - 1);
                string swap = (string)appetizerItems[randomindex];
                appetizerItems[randomindex] = appetizerItems[appRandomizer];
                appetizerItems[appRandomizer] = swap;
            }

            // Randomizes the possible main foods
            for(int mainRandomizer = 0; mainRandomizer < mainItems.Count; mainRandomizer++) {
                int randomindex = Random.Range(mainRandomizer, mainItems.Count - 1);
                string swap = (string)mainItems[randomindex];
                mainItems[randomindex] = mainItems[mainRandomizer];
                mainItems[mainRandomizer] = swap;
            }

            // Randomizes the possible dessert foods
            for(int dessertRandomizer = 0; dessertRandomizer < dessertItems.Count; dessertRandomizer++) {
                int randomindex = Random.Range(dessertRandomizer, dessertItems.Count - 1);
                string swap = (string)dessertItems[randomindex];
                dessertItems[randomindex] = dessertItems[dessertRandomizer];
                dessertItems[dessertRandomizer] = swap;
            }
        }

        // Hard assets
        if(minigame.difficulty == MinigameDifficulty.Difficulty.HARD) {

            foodsAtlas = (UIAtlas) Resources.Load ("NPCs/Amy/AmySmallFoodBuffetAtlas", typeof(UIAtlas));

            // Gets all large foods
            foreach(string s in foodsAtlas.GetListOfSprites()) {
                if(s.Contains("dess")) {
                    dessertItems.Add (s);
                } else if(s.Contains("app")) {
                    appetizerItems.Add (s);
                } else if(s.Contains("main")) {
                    mainItems.Add (s);
                }
            }

            // Randomizes the possible appetizer foods
            for(int appRandomizer = 0; appRandomizer < appetizerItems.Count; appRandomizer++) {
                int randomindex = Random.Range(appRandomizer, appetizerItems.Count - 1);
                string swap = (string)appetizerItems[randomindex];
                appetizerItems[randomindex] = appetizerItems[appRandomizer];
                appetizerItems[appRandomizer] = swap;
            }

            // Randomizes the possible main foods
            for(int mainRandomizer = 0; mainRandomizer < mainItems.Count; mainRandomizer++) {
                int randomindex = Random.Range(mainRandomizer, mainItems.Count - 1);
                string swap = (string)mainItems[randomindex];
                mainItems[randomindex] = mainItems[mainRandomizer];
                mainItems[mainRandomizer] = swap;
            }

            // Randomizes the possible dessert foods
            for(int dessertRandomizer = 0; dessertRandomizer < dessertItems.Count; dessertRandomizer++) {
                int randomindex = Random.Range(dessertRandomizer, dessertItems.Count - 1);
                string swap = (string)dessertItems[randomindex];
                dessertItems[randomindex] = dessertItems[dessertRandomizer];
                dessertItems[dessertRandomizer] = swap;
            }
        }

        // Get all the foods in the target trays
        ArrayList targetFoodsSmall = new ArrayList();
        foreach(Transform targetFood in smallTargetTray.transform) {
            if(!targetFood.gameObject.name.Contains("Tray")) {
                targetFoodsSmall.Add (targetFood.gameObject);
            }
        }
        ArrayList targetFoodsLarge = new ArrayList();
//.........这里部分代码省略.........
开发者ID:dany1532,项目名称:Social_Clues,代码行数:101,代码来源:BuffetManager.cs


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