예제 #1
0
파일: Engine.cs 프로젝트: Jebeli/Tiles
        public void Start()
        {
            string defName = fileResolver.Resolve(@"fonts/Roboto-Regular.ttf");
            string icoName = fileResolver.Resolve(@"fonts/entypo.ttf");
            string tpzName = fileResolver.Resolve(@"fonts/Topaz.ttf");

            fonts.Init(defName, 12, tpzName, 12, icoName, 16);
            state = EngineState.Run;
            SwitchToSplashScreen();
        }
예제 #2
0
        public string Save(IFile file)
        {
            var fullFileName = string.Format("{0}.{1}", Guid.NewGuid(), file.Extension);
            var physicalPath = string.Concat(_fileResolver.Resolve(_destinationPath), fullFileName);

            using (var fileStream = System.IO.File.Create(physicalPath))
            {
                file.Stream.Seek(0, SeekOrigin.Begin);
                file.Stream.CopyTo(fileStream);
            }

            return(fullFileName);
        }
예제 #3
0
        public override Texture GetTexture(string textureId, IFileResolver fileResolver)
        {
            string assetName = fileResolver.Resolve(textureId);
            var    bmp       = game.Content.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(assetName);

            return(new MONOTexture(textureId, bmp));
        }
예제 #4
0
파일: SDLGraphics.cs 프로젝트: Jebeli/Tiles
        public override Texture GetTexture(string textureId, IFileResolver fileResolver)
        {
            string assetName = fileResolver.Resolve(textureId);
            IntPtr tex       = SDL_image.IMG_LoadTexture(game.ren, assetName);

            return(new SDLTexture(textureId, tex));
        }
예제 #5
0
파일: SDLSounds.cs 프로젝트: Jebeli/Tiles
        public override Sound GetSound(string fileId, IFileResolver fileResolver)
        {
            IntPtr chunk = SDL_mixer.Mix_LoadWAV(fileResolver.Resolve(fileId));

            if (!chunk.Equals(IntPtr.Zero))
            {
                return(new SDLSound(fileId, chunk));
            }
            return(null);
        }
예제 #6
0
파일: SDLSounds.cs 프로젝트: Jebeli/Tiles
        public override Music GetMusic(string fileId, IFileResolver fileResolver)
        {
            IntPtr chunk = SDL_mixer.Mix_LoadMUS(fileResolver.Resolve(fileId));

            if (!chunk.Equals(IntPtr.Zero))
            {
                return(new SDLMusic(fileId, chunk));
            }
            return(null);
        }
예제 #7
0
        /// <summary>
        /// Agrega un archivo al zip
        /// </summary>
        /// <param name="identifier">Identificador del Zip</param>
        /// <param name="entryName">Nombre del elemento en el zip</param>
        /// <param name="FileInBytes">Informacion en Bytes que corresponde al elemento a subir</param>
        /// <param name="fileMode">Modo del archivo</param>
        public void AddOrUpdateFile(int identifier, EFileContainer fileContainer, string entryName, byte[] fileInBytes, FileMode fileMode)
        {
            var fullFileName = string.Format("{0}_{1}.zip", identifier, fileContainer);
            var physicalPath = string.Concat(_fileResolver.Resolve(_destinationPath + fileContainer + "/"), fullFileName);

            using (FileStream zipToOpen = new FileStream(physicalPath, fileMode))
            {
                using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
                {
                    ZipArchiveEntry readmeEntry = archive.GetEntry(entryName);
                    if (readmeEntry == null)
                    {
                        readmeEntry = archive.CreateEntry(entryName);
                    }
                    using (BufferedStream writer = new BufferedStream(readmeEntry.Open()))
                    {
                        writer.Write(fileInBytes, 0, fileInBytes.Length);
                    }
                }
            }
        }
예제 #8
0
        public string Save(IFile file, EFileContainer fileContainer, int identifier)
        {
            var fullFileName = string.Format("{0}_{1}.{2}", identifier, fileContainer, file.Extension);
            var physicalPath = string.Concat(_fileResolver.Resolve(_destinationPath + fileContainer + "/"), fullFileName);

            using (var fileStream = System.IO.File.Create(physicalPath))
            {
                file.Stream.Seek(0, SeekOrigin.Begin);
                file.Stream.CopyTo(fileStream);
            }

            return(fullFileName);
        }
예제 #9
0
        public override Texture GetTexture(string textureId, IFileResolver fileResolver)
        {
            string fileName = fileResolver.Resolve(textureId);

            return(LoadTexture(textureId, fileName));
        }