Пример #1
0
 internal static void Load(SharpTag tag)
 {
     VolMaster    = tag.GetFloat("va");
     VolMusic     = tag.GetFloat("vm");
     VolSound     = tag.GetFloat("vs");
     Left         = (Keys)tag.GetInt("kl");
     Right        = (Keys)tag.GetInt("kr");
     Up           = (Keys)tag.GetInt("ku");
     Down         = (Keys)tag.GetInt("kd");
     Activate     = (Keys)tag.GetInt("ka");
     Cancel       = (Keys)tag.GetInt("kb");
     Start        = (Keys)tag.GetInt("kp");
     Select       = (Keys)tag.GetInt("ks");
     WindowWidth  = tag.GetInt("ww");
     WindowHeight = tag.GetInt("wh");
     WindowScale  = tag.GetFloat("ws");
 }
Пример #2
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();
        }
Пример #3
0
        public static Map Load(string name)
        {
            SharpTag tag = BitIO.FromFile(Path.Combine("Maps", name), false);

            Map ret = new Map()
            {
                Name   = tag.GetString("mapname"),
                Width  = tag.GetInt("mapwidth"),
                Height = tag.GetInt("mapheight")
            };

            ret.Tiles = new Sprite[ret.Width, ret.Height];

            for (int i = 0; i < ret.Width; i++)
            {
                for (int j = 0; j < ret.Height; j++)
                {
                    ret.Tiles[i, j] = Sprite.Load(tag.GetSharpTag($"maptile[{i},{j}]"));
                }
            }

            return(ret);
        }
Пример #4
0
        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);
        }
Пример #5
0
 /// <summary>
 /// Use this to load necessary variables from save data.
 /// </summary>
 /// <param name="tag"></param>
 public virtual void Load(SharpTag tag)
 {
 }