Esempio n. 1
0
        public EndGameMenu(Texture2D[] panels, Texture2D[] backgroundAssets, Save save, SpriteFont hudFont)
            : base(panels, backgroundAssets)
        {
            //This is the starting point of the menu.
            EndGameMenu.Selected += (object sender, EventArgs args) =>
            {
                this.CurrentState = State.Shown;
                this._delay = 0;
            };

            MenuEntry menu = new MenuEntry("Mission Select");
            MenuEntry retry = new MenuEntry("Retry");
            menu.Enter += (o, e) =>
                {
                    this.CurrentState = State.Hidden;
                    MenuSelectedEvent();
                    PlayMenu.SelectedEvent();
                };
            retry.Enter += (o, e) =>
                {
                    this.CurrentState = State.Hidden;
                    RestartEvent();
                };

            this.MenuEntryList.Add(menu);
            this.MenuEntryList.Add(retry);

            _save = save;
            _HUDFont = hudFont;
        }
Esempio n. 2
0
        public OptionsMenu(Texture2D[] panels, Texture2D[] backgroundAssets, Save save)
            : base(panels, backgroundAssets)
        {
            //This is the starting point of the menu.
            OptionsMenu.Selected += (object sender, EventArgs args) =>
            {
                this.CurrentState = State.Shown;
                this._delay = 0;
            };

            MenuEntry music = new MenuEntry("Music On");
            if (!save.Config.MusicEnabled)
                music.Text = "Music Off";
            MenuEntry voice = new MenuEntry("Voices On");
            if (!save.Config.VoiceEnabled)
                voice.Text = "Voices Off";
            MenuEntry soundeffects = new MenuEntry("Sound Effects On");
            if (!save.Config.SoundEnabled)
                soundeffects.Text = "Sound Effects Off";
            MenuEntry back = new MenuEntry("Back");

            music.Enter += (object sender, EventArgs args) =>
                {
                    save.Config.MusicEnabled = !save.Config.MusicEnabled;
                    if (save.Config.MusicEnabled)
                        music.Text = "Music On";
                    else
                        music.Text = "Music Off";
                };

            voice.Enter += (object sender, EventArgs args) =>
            {
                save.Config.VoiceEnabled = !save.Config.VoiceEnabled;
                if (save.Config.VoiceEnabled)
                    voice.Text = "Voices On";
                else
                    voice.Text = "Voices Off";
            };

            soundeffects.Enter += (object sender, EventArgs args) =>
            {
                save.Config.SoundEnabled = !save.Config.SoundEnabled;
                if (save.Config.SoundEnabled)
                    soundeffects.Text = "Sound Effects On";
                else
                    soundeffects.Text = "Sound Effects Off";
            };

            back.Enter += (object sender, EventArgs args) =>
                {
                    this.CurrentState = State.Hidden;
                    MainMenu.SelectedEvent();
                };

            this.MenuEntryList.Add(music);
            this.MenuEntryList.Add(voice);
            this.MenuEntryList.Add(soundeffects);
            this.MenuEntryList.Add(back);
        }
Esempio n. 3
0
        Save _save; //Points to actual config;

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        public PlayMenu(Texture2D[] panels, Texture2D[] backgroundAssets, string[] descriptions, SpriteFont descFont, Save save)
            : base(panels, backgroundAssets)
        {
            _save = save;
            PlayMenu.Selected += (object sender, EventArgs args) =>
            {
                this.CurrentState = State.Shown;
                this._delay = 0;
            };

            MenuEntry play1 = new MenuEntry("Protecting Earth");
            MenuEntry play2 = new MenuEntry("Defending Dradis");
            MenuEntry play3 = new MenuEntry("The Final Stand");
            MenuEntry back = new MenuEntry("Back");

            play1.Enter += (object sender, EventArgs args) =>
            {
                _save.Config.Mission = 0;
                _save.Config.SpaceBattle = false;
                this.CurrentState = State.Hidden;
                LoadingMenu.SelectedEvent();
            };

            play2.Enter += (object sender, EventArgs args) =>
            {
                _save.Config.Mission = 1;
                _save.Config.SpaceBattle = false;
                this.CurrentState = State.Hidden;
                LoadingMenu.SelectedEvent();
            };

            play3.Enter += (object sender, EventArgs args) =>
                {
                    _save.Config.Mission = 2;
                    _save.Config.SpaceBattle = false;
                    this.CurrentState = State.Hidden;
                    LoadingMenu.SelectedEvent();
                };

            back.Enter += (object sender, EventArgs args) =>
                {
                    this.CurrentState = State.Hidden;
                    MainMenu.SelectedEvent();
                };
            this.MenuEntryList.Add(play1);
            this.MenuEntryList.Add(play2);
            this.MenuEntryList.Add(play3);
            this.MenuEntryList.Add(back);
            _descriptions = descriptions;
            _descFont = descFont;
        }
Esempio n. 4
0
        /// <summary>
        /// Constructor and the Starting point of the game
        /// </summary>
        /// <param name="screenProperties">Represents the screen properties that were passed from the thread creation</param>
        public Paradox(object[] screenProperties)
        {
            int width = (int)screenProperties[0];
            int height = (int)screenProperties[1];
            bool fullScreen = (bool)screenProperties[2];
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            _graphics.PreferredBackBufferWidth = width;
            _graphics.PreferredBackBufferHeight = height;

            _graphics.ApplyChanges();

            if (fullScreen)
            {
                _graphics.ToggleFullScreen();
            }

            _save = Save.LoadFile();
        }
Esempio n. 5
0
        public LeaderboardMenu(Texture2D[] panels, Texture2D[] backgroundAssets, Save save, SpriteFont hudFont)
            : base(panels, backgroundAssets)
        {
            //This is the starting point of the menu.
            LeaderboardMenu.Selected += (object sender, EventArgs args) =>
            {
                this.CurrentState = State.Shown;
                this._delay = 0;
            };

            MenuEntry back = new MenuEntry("Back");

            back.Enter += (object sender, EventArgs args) =>
                {
                    this.CurrentState = State.Hidden;
                    MainMenu.SelectedEvent();
                };

            this.MenuEntryList.Add(back);

            _save = save;
            _HUDFont = hudFont;
        }
Esempio n. 6
0
File: Save.cs Progetto: robertg/Soar
        public static Save LoadFile()
        {
            IsolatedStorageFile storage = GetUserStoreAsAppropriateForCurrentPlatform(); //Gets the Isolated Storage location for the application.
            Save save;

            if (storage.FileExists(fileName)) //Checks if the const fileName exists within Isolated Storage.
            {
                try
                {
                    IsolatedStorageFileStream stream = storage.OpenFile(fileName, FileMode.Open); //Opens the file within Isolated Storage, creating a stream.
                    XmlSerializer xml = new XmlSerializer(typeof(Save)); //Creates a xml serializable object that takes in a Save object, no object instance so typeof() is used to pass a Type param to xml Serializer.
                    save = xml.Deserialize(stream) as Save;  //Deserializes the file, creates a Save object via as keyword.
                    stream.Close();
                    stream.Dispose();
                }
                catch (Exception e)
                {
                    save = new Save();
                }
            }
            else
            {
                save = new Save(); //If no file is found, a new one is created.
            }
            return save;
        }
Esempio n. 7
0
 public ParadoxGame(Paradox game, Save save)
     : base(game)
 {
     _save = save;
 }