コード例 #1
0
        /// <summary>
        /// Load the content that will be used to create the help screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              Font = shared.Load<SpriteFont>("Font/menufont");

              foreach (string name in gameContent) {
            objectContent.Add(shared.Load<Texture2D>(name));
              }

              detailsTemplate.Title = new TextLine("Game Objects", Font, new Color(192, 192, 192));

              IList<IMenuLine> lines = detailsTemplate.Lines;
              lines.Clear();

              for (int i = 0; i < gameObjects.Length; ++i) {
            string text = gameObjects[i];
            Texture2D image = objectContent[i];

            TextLine caption = new TextLine(text, Font, Color.Black, 0.75f);
            caption.Align = TextAlignment.LEFT;
            lines.Add(new ImageMenuLine(image, caption));
              }

              exitMenuEntry = new MenuButton("Back", Font);
              exitMenuEntry.Selected += OnCancel;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Middle] = exitMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Middle;
        }
コード例 #2
0
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont font = shared.Load<SpriteFont>("Font/menufont");

              menuTemplate.Title = new TextLine("Options", font, new Color(192, 192, 192));

              IList<MenuButton> items = menuTemplate.Items;

              soundMenuEntry = new MenuButton(string.Empty, font);
              soundMenuEntry.Selected += SoundMenuEntrySelected;
              items.Add(soundMenuEntry);

              controllerConfigurationMenuEntry = new MenuButton(string.Empty, font);
              controllerConfigurationMenuEntry.Selected += ControllerConfigurationMenuEntrySelected;
              items.Add(controllerConfigurationMenuEntry);

              apply = new MenuButton("Apply Changes", font);
              apply.Selected += OnApply;
              items.Add(apply);

              back = new MenuButton("Cancel", font);
              back.Selected += OnCancel;
              items.Add(back);

              // Warning messages
              firstWarningLine = new TextLine("The currently selected controller is not connected.", font, Color.Black);
              secondWarningLine = new TextLine("The change will not take effect.", font, Color.Black);

              // Get the current settings of the game.
              sound = Profile.Prefs.PlaySounds;
              currentControllerType = (int)Controller.InputType;
              currentControllerConnected = true; // Well, it has to be to even open this menu (for now).

              SetMenuEntryText();
        }