Example #1
0
        // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
        public static GameObject SpriteFromFile(string spriteName, GameObject obj = null, bool copyFromExisting = true)
        {
            string     fileName        = spriteName.Replace(".png", "");
            Texture2D  textureFromFile = ResourceExtractor.GetTextureFromFile(fileName, ".png");
            bool       flag            = textureFromFile == null;
            GameObject result;

            if (flag)
            {
                result = null;
            }
            else
            {
                result = SpriteBuilder.SpriteFromTexture(textureFromFile, spriteName, obj, copyFromExisting);
            }
            return(result);
        }
Example #2
0
        // Token: 0x06000002 RID: 2 RVA: 0x00002098 File Offset: 0x00000298
        public static GameObject SpriteFromResource(string spriteName, GameObject obj = null, bool copyFromExisting = true)
        {
            string     str  = (!spriteName.EndsWith(".png")) ? ".png" : "";
            string     text = spriteName + str;
            Texture2D  textureFromResource = ResourceExtractor.GetTextureFromResource(text);
            bool       flag = textureFromResource == null;
            GameObject result;

            if (flag)
            {
                result = null;
            }
            else
            {
                result = SpriteBuilder.SpriteFromTexture(textureFromResource, text, obj, copyFromExisting);
            }
            return(result);
        }