Exemplo n.º 1
0
        public void loadSoundSettings()
        {
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenRead("Preference.xml");
            _soundVolume = float.Parse(file.FindReadNode("SFXvolume"));
            _soundPitch  = float.Parse(file.FindReadNode("SFXpitch"));
            _soundPan    = float.Parse(file.FindReadNode("pan"));
            file.ReadClose();
            _weapon.LoadPreferenceData();
        }
Exemplo n.º 2
0
        //Obtient les limites de l'écran de jeu
        public void GetLimit()
        {
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenRead("Preference.xml");

            positionEnd.X = Int32.Parse(file.FindReadNode("width"));
            positionEnd.Y = Int32.Parse(file.FindReadNode("height"));

            file.ReadClose();
        }
Exemplo n.º 3
0
        public void LoadPreferenceData()
        {
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenRead("Preference.xml");

            brightness = Int32.Parse(file.FindReadNode("brightness"));
            bgm.Volume = float.Parse(file.FindReadNode("Mvolume"));
            contrast   = Int32.Parse(file.FindReadNode("contrast"));

            file.ReadClose();
        }
Exemplo n.º 4
0
 public void pause(bool state)
 {
     if (state)
     {
         bgm.Pause();
     }
     else
     {
         XmlReaderWriter file = new XmlReaderWriter();
         file.OpenRead("Preference.xml");
         bgm.Volume = float.Parse(file.FindReadNode("Mvolume"));
         file.ReadClose();
         bgm.Play();
     }
 }
Exemplo n.º 5
0
        public Normal()
        {
            _hp = 10;

            _proximity = new Proximity();

            Random rand    = new Random();
            int    randomX = rand.Next(-200, 1110);
            int    randomY = rand.Next(-200, 750);

            if (randomX <= 960 && randomX >= -50)
            {
                if (randomY > 550 || randomY < -50)
                {
                    position = new Position(randomX, randomY);
                }
                else
                {
                    position = new Position(randomX, -200);
                }
            }
            else
            {
                position = new Position(randomX, randomY);
            }

            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenRead("Preference.xml");

            int width  = Int32.Parse(file.FindReadNode("width"));
            int height = Int32.Parse(file.FindReadNode("height"));

            _soundVolume = float.Parse(file.FindReadNode("SFXvolume"));
            _soundPitch  = float.Parse(file.FindReadNode("SFXpitch"));
            _soundPan    = float.Parse(file.FindReadNode("pan"));


            file.ReadClose();

            timeBeforeSoundPlay = rand.Next(0, 20000);

            limit = new Vector2(width + _width, height + _height);
        }
Exemplo n.º 6
0
        public void reset()
        {
            observers = new List <Monster>();
            _hp       = 100;
            _kill     = 0;
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenRead("Preference.xml");

            limit = new Vector2(Int32.Parse(file.FindReadNode("width")), Int32.Parse(file.FindReadNode("height")));

            loadSoundSettings();

            _position          = new Position((int)limit.X / 2, (int)limit.Y / 2);
            _weapon            = new Handgun();
            _weapon.shootSound = _sounds[0];

            file.ReadClose();
        }
Exemplo n.º 7
0
        public void LoadPreferenceData()
        {
            //Load from Database.sdf
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenRead("Preference.xml");

            buttons[TEXTBOX_INDEX].Text = file.ReadNextTextNode();
            brightness            = Int32.Parse(file.ReadNextTextNode());
            contrast              = Int32.Parse(file.ReadNextTextNode());
            Music_Preview.Volume  = float.Parse(file.ReadNextTextNode());
            Sound_Preview.Volume  = float.Parse(file.ReadNextTextNode());
            Sound_Preview.Pitch   = float.Parse(file.ReadNextTextNode());
            Sound_Preview.Pan     = float.Parse(file.ReadNextTextNode());
            graphics.IsFullScreen = Boolean.Parse(file.ReadNextTextNode());

            file.ReadClose();
            graphics.ApplyChanges();
        }
Exemplo n.º 8
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();
        }
Exemplo n.º 9
0
        public Player()
        {
            XmlReaderWriter file = new XmlReaderWriter();

            file.OpenRead("Preference.xml");

            limit = new Vector2(Int32.Parse(file.FindReadNode("width")), Int32.Parse(file.FindReadNode("height")));

            _position = new Position((int)limit.X / 2, (int)limit.Y / 2);

            file.ReadClose();

            /********************************************************************
             * **************************************************************** *
             *******************************************************************/

            _weapon = new Handgun();

            /********************************************************************
             * **************************************************************** *
             *******************************************************************/
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
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;
        }