Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void LoadSprites(object sender, LoadSpritesEventArgs e)
        {
            if (Animations != null)
            {
                System.Console.WriteLine("Reloading animations:");
                Animations.Dispose();
                Animations = null;
                background.Dispose();
                background = null;
                System.GC.Collect();
            }

            Animations = new AnimationList(Settings.Get <BomberStuff.Core.Utilities.ColorRemapInfo[]>(Settings.Types.PlayerColor));
            System.Console.WriteLine("Loading animations...");
            //long ticks = System.DateTime.Now.Ticks;
            AniFileReader.AddAliFile(Animations, Settings.Get <string>(Settings.Types.ABDirectory) + @"\DATA\ANI\master.ali");
            System.Console.WriteLine("Done loading animations..." /* took {0} µs", (System.DateTime.Now.Ticks - ticks) / 10.0*/);
            Animations.Check();
            System.Console.WriteLine("Animation check succeeded. All animations accounted for.");

            System.Console.WriteLine("Caching animations...");
            Animations.Cache(e.Device, Players.Length);
            System.Console.WriteLine("Done caching animations.");

            background = e.Device.LoadSprite(PCXReader.FromFile(Settings.Get <string>(Settings.Types.ABDirectory) + @"\DATA\RES\FIELD" + Tileset + ".PCX"), false, System.Drawing.Color.Transparent);

            System.Console.WriteLine("Stand by...");
            System.GC.Collect();
        }