Exemple #1
0
        public EterniaXna()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);
            //graphics.PreferredBackBufferWidth = (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width * 9) / 10;
            //graphics.PreferredBackBufferHeight = ((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - 50) * 9) / 10;

            graphics.PreferredBackBufferWidth = (1920 * 9) / 10;
            graphics.PreferredBackBufferHeight = ((1080 - 50) * 9) / 10;

            graphics.PreferMultiSampling = true;
            graphics.SynchronizeWithVerticalRetrace = false;

            IsFixedTimeStep = false;

            screenManager = new ScreenManager(this);

            Components.Add(screenManager);
        }
Exemple #2
0
        public static void SaveActors(ScreenManager screenManager, Player player)
        {
            var containerPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Eternia");
            //var containerPath = @"C:\Users\Christer\Documents\SavedGames\Eternia\AllPlayers";

            if (!Directory.Exists(containerPath))
                Directory.CreateDirectory(containerPath);

            player.Heroes.ForEach(x => x.Auras.Clear());

            // Add the container path to our file name.
            string filename = Path.Combine(containerPath, "Player.xml");

            // Open the file, creating it if necessary
            FileStream stream = File.Open(filename, FileMode.Create);
            var writer = new StreamWriter(stream);

            // Convert the object to XML data and put it in the stream
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(player, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, PreserveReferencesHandling = PreserveReferencesHandling.All });
            writer.Write(json);

            // Close the file
            writer.Close();
        }