コード例 #1
0
        protected MenuState(Game game, string title, string level, MenuArrangement arrangement) : base(game, level, LevelOptions.Menu)
        {
            m_unlocalisedTitle     = title;
            m_unlocalisedBack      = "menus.back";
            m_unlocalisedAltSelect = "menus.select";

            // Create camera
            m_animatedCamera = new AnimatedCameraController(Level.TimeMachine);

            // Create title menu
            {
                m_titleMenu = new TextMenu(UIFonts.Default, new string[] {
                    Game.Language.Translate(title),
                }, TextAlignment.Center, MenuDirection.Vertical);
                if (arrangement == MenuArrangement.RobotScreen)
                {
                    m_titleMenu.Anchor        = Anchor.TopMiddle;
                    m_titleMenu.LocalPosition = new Vector2(0.0f, 40.0f);
                }
                else
                {
                    m_titleMenu.Anchor        = Anchor.TopMiddle;
                    m_titleMenu.LocalPosition = new Vector2(0.0f, 32.0f);
                }
                m_titleMenu.TextColour = UIColours.Title;
                m_titleMenu.Enabled    = false;
                m_titleMenu.MouseOnly  = true;
                m_titleMenu.OnClicked += delegate(object sender, TextMenuClickedEventArgs e)
                {
                    if (Dialog == null)
                    {
                        OnTitleClicked();
                    }
                };
            }

            // Create prompts
            {
                m_backPrompt                       = new InputPrompt(UIFonts.Smaller, Game.Language.Translate(m_unlocalisedBack), TextAlignment.Right);
                m_backPrompt.Key                   = Key.Escape;
                m_backPrompt.MouseButton           = MouseButton.Left;
                m_backPrompt.GamepadButton         = GamepadButton.B;
                m_backPrompt.SteamControllerButton = SteamControllerButton.MenuBack;
                if (arrangement == MenuArrangement.RobotScreen)
                {
                    m_backPrompt.Anchor        = Anchor.BottomMiddle;
                    m_backPrompt.LocalPosition = new Vector2(225.0f, -40.0f - m_backPrompt.Font.Height);
                }
                else
                {
                    m_backPrompt.Anchor        = Anchor.BottomRight;
                    m_backPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_backPrompt.Font.Height);
                }
                m_backPrompt.OnClick += delegate(object sender, EventArgs e)
                {
                    GoBack();
                };
            }
            {
                m_selectPrompt                       = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.select"), TextAlignment.Left);
                m_selectPrompt.Key                   = Key.Return;
                m_selectPrompt.GamepadButton         = GamepadButton.A;
                m_selectPrompt.SteamControllerButton = SteamControllerButton.MenuSelect;
                if (arrangement == MenuArrangement.RobotScreen)
                {
                    m_selectPrompt.Anchor        = Anchor.BottomMiddle;
                    m_selectPrompt.LocalPosition = new Vector2(-224.0f, -40.0f - m_selectPrompt.Font.Height);
                }
                else
                {
                    m_selectPrompt.Anchor        = Anchor.BottomLeft;
                    m_selectPrompt.LocalPosition = new Vector2(16.0f, -16.0f - m_selectPrompt.Font.Height);
                }
                m_selectPrompt.Visible = false;
            }
            {
                m_altSelectPrompt                       = new InputPrompt(UIFonts.Smaller, Game.Language.Translate(m_unlocalisedAltSelect), TextAlignment.Left);
                m_altSelectPrompt.Key                   = Key.Tab;
                m_altSelectPrompt.GamepadButton         = GamepadButton.Y;
                m_altSelectPrompt.SteamControllerButton = SteamControllerButton.MenuAltSelect;
                m_altSelectPrompt.Anchor                = m_selectPrompt.Anchor;
                m_altSelectPrompt.LocalPosition         = m_selectPrompt.LocalPosition + new Vector2(0.0f, -m_altSelectPrompt.Font.Height);
                m_altSelectPrompt.Visible               = false;
            }
        }
コード例 #2
0
ファイル: OptionsState.cs プロジェクト: xiuzhifu/Redirection
 protected OptionsState(Game game, string title, string levelPath, MenuArrangement arrangement) : base(game, title, levelPath, arrangement)
 {
     m_menu    = null;
     m_options = null;
 }