Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.graphics.PreferredBackBufferWidth  = 960;
            this.graphics.PreferredBackBufferHeight = 600;

            //Définit si l'on voit la souris ou non. Nous pouvons la généré.
            this.IsMouseVisible = true;
            if (!File.Exists("Preference.xml"))
            {
                //First Logon Process

                XmlReaderWriter file = new XmlReaderWriter();
                file.OpenWrite("Preference.xml");

                file.WriteCategory("Preference");

                file.WriteNextTextNode("username", "Player");
                file.WriteNextTextNode("brightness", "255");
                file.WriteNextTextNode("contrast", "128");
                file.WriteNextTextNode("Mvolume", "1");
                file.WriteNextTextNode("SFXvolume", "1");
                file.WriteNextTextNode("SFXpitch", "0");
                file.WriteNextTextNode("pan", "0");
                file.WriteNextTextNode("fullscreen", "False");
                file.WriteNextTextNode("width", this.graphics.PreferredBackBufferWidth.ToString());
                file.WriteNextTextNode("height", this.graphics.PreferredBackBufferHeight.ToString());

                file.WriteEndCategory();

                file.WriteClose();
            }

            options = new Options((this.Window.ClientBounds.Width / 2), (this.Window.ClientBounds.Height / 2));
            main    = new MainMenu();
            game    = new Level();
            game.initialize(this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight);

            base.Initialize();
        }
Пример #2
0
        void DefaultConfig()
        {
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenWrite("Preference.xml");

            file.WriteCategory("Preference");

            file.WriteNextTextNode("username", buttons[TEXTBOX_INDEX].Text);
            file.WriteNextTextNode("brightness", "255");
            file.WriteNextTextNode("contrast", "128");
            file.WriteNextTextNode("Mvolume", "1");
            file.WriteNextTextNode("SFXvolume", "1");
            file.WriteNextTextNode("SFXpitch", "0");
            file.WriteNextTextNode("pan", "0");
            file.WriteNextTextNode("fullscreen", graphics.IsFullScreen.ToString());
            file.WriteNextTextNode("width", this.graphics.PreferredBackBufferWidth.ToString());
            file.WriteNextTextNode("height", this.graphics.PreferredBackBufferHeight.ToString());

            file.WriteEndCategory();

            file.WriteClose();
            LoadPreferenceData();
        }
Пример #3
0
        void ApplyChanges()
        {
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenWrite("Preference.xml");

            file.WriteCategory("Preference");

            file.WriteNextTextNode("username", buttons[TEXTBOX_INDEX].Text);
            file.WriteNextTextNode("brightness", brightness.ToString());
            file.WriteNextTextNode("contrast", contrast.ToString());
            file.WriteNextTextNode("Mvolume", Music_Preview.Volume.ToString());
            file.WriteNextTextNode("SFXvolume", Sound_Preview.Volume.ToString());
            file.WriteNextTextNode("SFXpitch", Sound_Preview.Pitch.ToString());
            file.WriteNextTextNode("pan", Sound_Preview.Pan.ToString());
            file.WriteNextTextNode("fullscreen", graphics.IsFullScreen.ToString());
            file.WriteNextTextNode("width", this.graphics.PreferredBackBufferWidth.ToString());
            file.WriteNextTextNode("height", this.graphics.PreferredBackBufferHeight.ToString());

            file.WriteEndCategory();

            file.WriteClose();
            changes = true;
        }