示例#1
0
        public new static GameObject <T> Load(String PathName)
        {
            // First we load up the Data In the Serialization file.
            String            gameDataObjectXMLPath = Path.Combine(PathName, "ImageSequence");
            ImageSequence <T> sequenceLoaded        = LoadSerializationFileForFolder(gameDataObjectXMLPath);

            // Now lets look for and load up any images that we find.
            String[]      tgaFilesArray  = Directory.GetFiles(PathName, "*.tga");
            List <String> sortedTgaFiles = new List <string>(tgaFilesArray);

            // Make sure they are sorted.
            sortedTgaFiles.Sort();
            sequenceLoaded.m_Images = new Image <T> [sortedTgaFiles.Count];
            int imageIndex = 0;

            foreach (String tgaFile in sortedTgaFiles)
            {
                sequenceLoaded.m_Images[imageIndex] = new Image <T>();
                Stream imageStream = File.Open(tgaFile, FileMode.Open);
                sequenceLoaded.m_Images[imageIndex].LoadImageData(imageStream);
                imageIndex++;
            }

            return(sequenceLoaded);
        }
示例#2
0
        private static ImageSequence <T> LoadSerializationFileForFolder(String gameDataObjectXMLPath)
        {
            ImageSequence <T> sequenceLoaded;

            sequenceLoaded = (ImageSequence <T>) GameObject <T> .Load(gameDataObjectXMLPath);

            if (sequenceLoaded == null)
            {
                sequenceLoaded = new ImageSequence <T>();
                sequenceLoaded.SaveXML(gameDataObjectXMLPath);
            }

            return(sequenceLoaded);
        }