예제 #1
0
    private Dictionary <string, Rect> GetSpriteInfoInAtlas(string spriteName, GameObject atlasObj)
    {
        Dictionary <string, Rect> newInfo = new Dictionary <string, Rect>();

        if (
            string.IsNullOrEmpty(spriteName) ||
            (null == atlasObj)
            )
        {
            return(null);
        }

        Dictionary <string, Rect> tempInfo = UtilityForNGUI.GetSpriteInfo(atlasObj);

        if (null == tempInfo)
        {
            return(null);
        }

        Rect spriteRect;

        if (tempInfo.TryGetValue(spriteName, out spriteRect))
        {
            newInfo.Add(spriteName, spriteRect);
        }

        return(newInfo);
    }
예제 #2
0
    private Dictionary <string, Rect> VagueGetSpriteInfoInAtlas(string spriteName, GameObject atlasObj)
    {
        Dictionary <string, Rect> newInfo = new Dictionary <string, Rect>();

        if (
            string.IsNullOrEmpty(spriteName) ||
            (null == atlasObj)
            )
        {
            return(null);
        }

        Dictionary <string, Rect> tempInfo = UtilityForNGUI.GetSpriteInfo(atlasObj);

        if (null == tempInfo)
        {
            return(null);
        }

        foreach (KeyValuePair <string, Rect> item in tempInfo)
        {
            if (item.Key.Contains(spriteName))
            {
                newInfo.Add(item.Key, item.Value);
            }
        }

        return(newInfo);
    }