예제 #1
0
 public static void GenerateSnapshot(BackgroundGroup group)
 {
     if (group == null || group.entries.Count <= 0)
     {
         return;
     }
     GenerateSnapshot(group.entries[0]);
 }
예제 #2
0
        private static bool GroupResourcesReferenceIsCorrect(BackgroundGroup group)
        {
            foreach (var entry in group.entries)
            {
                var path = entry.resourcePath;
                if (Resources.Load <Sprite>(path) == null)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #3
0
        private static bool GroupSnapshotAspectRatioIsCorrect(BackgroundGroup group)
        {
            if (group.entries.Count == 0)
            {
                return(true);
            }
            var entry  = group.entries[0];
            var path   = entry.resourcePath;
            var sprite = Resources.Load <Sprite>(path);

            if (sprite == null)
            {
                return(true);
            }
            var tex  = sprite.texture;
            var size = entry.snapshotScale * new Vector2(tex.width, tex.height);

            return(Math.Abs(BackgroundGroupEditor.SnapshotAspectRatio - size.y / size.x) < 3 * float.Epsilon);
        }
예제 #4
0
 private static bool GroupIsEmpty(BackgroundGroup group)
 {
     return(group.entries.Count == 0);
 }