UIAtlas.SortAlphabetically C# (CSharp) Метод

SortAlphabetically() публичный Метод

Sort the list of sprites within the atlas, making them alphabetical.
public SortAlphabetically ( ) : void
Результат void
	public void SortAlphabetically ()
	{
		mSprites.Sort(delegate(UISpriteData s1, UISpriteData s2) { return s1.name.CompareTo(s2.name); });
#if UNITY_EDITOR
		NGUITools.SetDirty(this);
#endif
	}

Usage Example

Пример #1
0
    /// <summary>
    /// Replace the sprites within the atlas.
    /// </summary>

    static public void ReplaceSprites(UIAtlas atlas, List <SpriteEntry> sprites)
    {
        // Get the list of sprites we'll be updating
        List <UISpriteData> spriteList = atlas.spriteList;
        List <UISpriteData> kept       = new List <UISpriteData>();

        // Run through all the textures we added and add them as sprites to the atlas
        for (int i = 0; i < sprites.Count; ++i)
        {
            SpriteEntry  se     = sprites[i];
            UISpriteData sprite = AddSprite(spriteList, se);
            kept.Add(sprite);
        }

        // Remove unused sprites
        for (int i = spriteList.Count; i > 0;)
        {
            UISpriteData sp = spriteList[--i];
            if (!kept.Contains(sp))
            {
                spriteList.RemoveAt(i);
            }
        }

        // Sort the sprites so that they are alphabetical within the atlas
        atlas.SortAlphabetically();
        atlas.MarkAsChanged();
    }
All Usage Examples Of UIAtlas::SortAlphabetically