예제 #1
0
        protected override void Initialize()
        {
            try
            {
                RootTag = BitIO.FromFile("ff.dat", false);
            }
            catch (Exception e)
            {
                string message = e.Message;
                BitIO.ToFile(new SharpTag(), "ff.dat", false);
                RootTag = BitIO.FromFile("ff.dat", false);
            }

            this.IsFixedTimeStep = true;
            if (RootTag.ContainsKey("SETTINGS"))
            {
                Settings.Load(RootTag.GetSharpTag("SETTINGS"));
            }
            else
            {
                Settings.Init();
            }
            Graphics.PreferredBackBufferWidth  = (int)(Settings.WindowWidth * Settings.WindowScale);
            Graphics.PreferredBackBufferHeight = (int)(Settings.WindowHeight * Settings.WindowScale);
            Graphics.ApplyChanges();

#if DEBUG
            Window.Title = "(DEBUG) Final Fantasy: Dawn of Souls";
#else
            Window.Title = "Final Fantasy: Dawn of Souls";
#endif
            Window.AllowUserResizing = false;
            Window.AllowAltF4        = false;

            MediaCache.Init(GraphicsDevice);
            InitDefaultMedia();
            InitVariables();
            base.Initialize();
        }
예제 #2
0
파일: Map.cs 프로젝트: GLugia/VisualBoy
        public static void Save(Map map)
        {
            SharpTag ret = new SharpTag()
            {
                { "mapname", map.Name },
                { "mapwidth", map.Width },
                { "mapheight", map.Height }
            };

            if (map.Tiles == null)
            {
                map.Tiles = new Sprite[map.Width, map.Height];
            }

            for (int i = 0; i < map.Width; i++)
            {
                for (int j = 0; j < map.Height; j++)
                {
                    ret.Add($"maptile[{i},{j}]", map.Tiles[i, j].Save());
                }
            }

            BitIO.ToFile(ret, Path.Combine("Maps", map.Name), false);
        }
예제 #3
0
 protected override void UnloadContent()
 {
     RootTag.Add("SETTINGS", Settings.Save());
     BitIO.ToFile(RootTag, "ff.dat", false);
     MediaCache.UnloadAll();
 }