SortAlphabetically() public method

Sort the list of sprites within the atlas, making them alphabetical.
public SortAlphabetically ( ) : void
return void
Exemplo n.º 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();
    }
Exemplo n.º 2
0
    static int SortAlphabetically(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UIAtlas obj = (UIAtlas)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIAtlas");

        obj.SortAlphabetically();
        return(0);
    }
Exemplo n.º 3
0
 static public int SortAlphabetically(IntPtr l)
 {
     try {
         UIAtlas self = (UIAtlas)checkSelf(l);
         self.SortAlphabetically();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 4
0
 static int SortAlphabetically(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UIAtlas obj = (UIAtlas)ToLua.CheckObject <UIAtlas>(L, 1);
         obj.SortAlphabetically();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 5
0
    public static int SortAlphabetically(IntPtr l)
    {
        int result;

        try
        {
            UIAtlas uIAtlas = (UIAtlas)LuaObject.checkSelf(l);
            uIAtlas.SortAlphabetically();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 6
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();
	}