Ejemplo n.º 1
0
        public new static Frames LoadFromFile(string path)
        {
            Frames frame = JsonAsset.LoadFromFile <Frames>(path);

            if (frame != null)
            {
                // sanity check loaded data
                if (frame.frameGrid != null)
                {
                    if (frame.frameGrid.size.Count == 0)
                    {
                        frame.frameGrid = null;
                    }
                    else if (frame.frameGrid.size.Count == 1)
                    {
                        frame.frameGrid.size.Add(1);
                    }
                    else
                    {
                        frame.frameGrid.size.RemoveRange(2, frame.frameGrid.size.Count - 2);
                    }
                }
                if (frame.frameGrid != null)
                {
                    if (frame.frameGrid.dimensions.Count == 0)
                    {
                        frame.frameGrid = null;
                    }
                    else if (frame.frameGrid.dimensions.Count == 1)
                    {
                        frame.frameGrid.dimensions.Add(1);
                    }
                    else
                    {
                        frame.frameGrid.dimensions.RemoveRange(2, frame.frameGrid.dimensions.Count - 2);
                    }
                }
                if ((frame.frameGrid != null) && (frame.frameGrid.names != null))
                {
                    if (frame.frameGrid.names.Count == 0)
                    {
                        frame.frameGrid.names = null;
                    }
                }

                frame.RecalcFrameItems();
            }

            return(frame);
        }
Ejemplo n.º 2
0
        public new static Animation LoadFromFile(string path)
        {
            VariantAnimation va = JsonAsset.LoadFromFile <VariantAnimation>(path);

            if (va != null)
            {
                if (va.variants > 0)
                {
                    // init variant animation stuff
                    return(va);
                }
            }

            ComplexAnimation ca = JsonAsset.LoadFromFile <ComplexAnimation>(path);

            if (ca != null)
            {
                // init complex animation stuff
            }

            return(ca);
        }