示例#1
0
        public MainMenu(Vector2 position, MenuAction[] actions, float spacing)
            : base(position, actions)
        {
            MenuEntry play = new MenuEntry(
                "Play",
                new MenuAction[]
                {
                    new MenuAction(ActionType.Select, new PlayGameDelegate())
                },
                position);

            MenuEntry quit = new MenuEntry(
                "Quit",
                new MenuAction[]
                {
                    new MenuAction(ActionType.Select, new QuitGameDeleage())
                },
                position + new Vector2(0, spacing));

            play.UpperMenu = quit;
            play.LowerMenu = quit;

            quit.UpperMenu = play;
            quit.LowerMenu = play;

            this.Add(play);
            this.Add(quit);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PauseMenu"/> class.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="actions">The actions.</param>
        /// <param name="spacing">The spacing.</param>
        public PauseMenu(Vector2 position, MenuAction[] actions, float spacing)
            : base(position, actions)
        {
            MenuEntry resume = new MenuEntry(
                "Resume",
                new MenuAction[]
                {
                    new MenuAction(ActionType.Select, new QuitTopDelegate())
                },
                position);

            MenuEntry quit = new MenuEntry(
                "Quit",
                new MenuAction[]
                {
                    new MenuAction(ActionType.Select, new QuitGameDeleage())
                },
                position + new Vector2(0, spacing));

            resume.UpperMenu = quit;
            resume.LowerMenu = quit;

            quit.UpperMenu = resume;
            quit.LowerMenu = resume;

            this.Add(resume);
            this.Add(quit);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuEntry"/> class.
        /// </summary>
        /// <param name="text">The text to display.</param>
        /// <param name="actions">The this.actions associated with this menu entry. For example,
        /// one action might be pressing "A" to select the entry. Adding
        /// an action of Left, Right, Up, or Down will overwrite the
        /// menu entry navigation.</param>
        /// <param name="position">The this.position of the image.</param>
        public MenuEntry(string text, MenuAction[] actions, Vector2 position)
        {
            this.text = text;
            this.actions = actions;

            this.position = position;
            this.origin = Drawer.font.MeasureString(text) / 2f;
        }