예제 #1
0
        public override void PostDraw(SpriteBatch batch, SpriteFont font, GlyphTextRenderer tr, float alpha)
        {
            float   smallFactor = this.FontManager.SmallFactor;
            float   num1        = (float)batch.GraphicsDevice.Viewport.Height / 2f;
            Vector2 position    = FezMath.Round(new Vector2((float)(batch.GraphicsDevice.Viewport.Width - this.ControlsImage.Width) / 2f, num1 - (float)this.ControlsImage.Height / 2f));
            float   viewScale   = SettingsManager.GetViewScale(batch.GraphicsDevice);
            int     num2        = batch.GraphicsDevice.Viewport.Width / 2;
            int     num3        = batch.GraphicsDevice.Viewport.Height / 2;
            int     num4        = num2 - 464;
            int     num5        = num2 + 464;

            if (this.SelectedIndex == this.Items.Count - 3)
            {
                batch.Draw(this.ControlsImage, position, new Color(1f, 1f, 1f, alpha));
                if (Culture.IsCJK)
                {
                    smallFactor /= viewScale;
                }
                tr.DrawShadowedText(batch, font, StaticText.GetString("Map_Title").ToUpper(CultureInfo.InvariantCulture), new Vector2((float)num4, num1 - 222f), new Color(1f, 1f, 1f, alpha), smallFactor);
                tr.DrawShadowedText(batch, font, StaticText.GetString("ControlsRotateLeft").ToUpper(CultureInfo.InvariantCulture), new Vector2((float)num4, num1 - 170f), new Color(1f, 1f, 1f, alpha), smallFactor);
                tr.DrawShadowedText(batch, font, StaticText.GetString("ControlsMove").ToUpper(CultureInfo.InvariantCulture), new Vector2((float)num4, num1 - 15f), new Color(1f, 1f, 1f, alpha), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsPause").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 222f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsRotateRight").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 170f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsAction").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 114f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsInventory").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 81f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsTalk").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 - 40f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsJump").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 + 3f), smallFactor);
                this.DrawLeftAligned(tr, batch, font, StaticText.GetString("ControlsLook").ToUpper(CultureInfo.InvariantCulture), alpha, new Vector2((float)num5, num1 + 72f), smallFactor);
                if (Culture.IsCJK)
                {
                    float num6 = smallFactor * viewScale;
                }
            }
            float num7 = this.Items[this.chosen].Size.X + 70f;

            if (Culture.IsCJK)
            {
                num7 *= 0.5f;
            }
            if (this.SelectedIndex >= this.Items.Count - 3)
            {
                float num6 = 25f;
                float num8;
                if (!Culture.IsCJK)
                {
                    num8 = num6 * viewScale;
                }
                else
                {
                    num7 = num7 * 0.4f + 25f;
                    num8 = 5f * viewScale;
                    if (Culture.Language == Language.Chinese)
                    {
                        num8 = (float)(10.0 + 25.0 * (double)viewScale);
                    }
                }
                int     num9   = ServiceHelper.Game.GraphicsDevice.Viewport.Width / 2;
                Vector2 offset = new Vector2((float)(-(double)num7 + 25.0 * (double)viewScale - 40.0 * ((double)viewScale - 1.0)), (float)num3 + 180f * viewScale + num8);
                if (!this.noArrows)
                {
                    tr.DrawCenteredString(batch, this.FontManager.Big, "{LA}", new Color(1f, 1f, 1f, alpha), offset, (Culture.IsCJK ? 0.2f : 1f) * viewScale);
                    this.leftSliderRect = new Rectangle?(new Rectangle((int)((double)offset.X + (double)num9 - 25.0 * (double)viewScale), (int)offset.Y, (int)(40.0 * (double)viewScale), (int)(25.0 * (double)viewScale)));
                }
                else
                {
                    this.leftSliderRect = new Rectangle?();
                }
                offset = new Vector2(num7 + (float)(40.0 * ((double)viewScale - 1.0)), (float)num3 + 180f * viewScale + num8);
                if (!this.noArrows)
                {
                    tr.DrawCenteredString(batch, this.FontManager.Big, "{RA}", new Color(1f, 1f, 1f, alpha), offset, (Culture.IsCJK ? 0.2f : 1f) * viewScale);
                    this.rightSliderRect = new Rectangle?(new Rectangle((int)((double)offset.X + (double)num9 - 30.0 * (double)viewScale), (int)offset.Y, (int)(40.0 * (double)viewScale), (int)(25.0 * (double)viewScale)));
                }
                else
                {
                    this.rightSliderRect = new Rectangle?();
                }
            }
            else
            {
                ControlsMenuLevel controlsMenuLevel1 = this;
                ControlsMenuLevel controlsMenuLevel2 = this;
                ControlsMenuLevel controlsMenuLevel3 = this;
                Rectangle?        nullable1          = new Rectangle?();
                Rectangle?        nullable2          = nullable1;
                controlsMenuLevel3.rightSliderRect = nullable2;
                Rectangle?nullable3;
                Rectangle?nullable4 = nullable3 = nullable1;
                controlsMenuLevel2.rightSliderRect = nullable3;
                Rectangle?nullable5 = nullable4;
                controlsMenuLevel1.leftSliderRect = nullable5;
            }
        }
예제 #2
0
 private Keys AKMToKey(ControlsMenuLevel.ArrowKeyMapping akm, int i)
 {
   Keys keys;
   switch (akm)
   {
     case ControlsMenuLevel.ArrowKeyMapping.WASD:
       keys = i != 0 ? (i != 1 ? (i != 2 ? Keys.D : Keys.S) : Keys.A) : Keys.W;
       break;
     case ControlsMenuLevel.ArrowKeyMapping.ZQSD:
       keys = i != 0 ? (i != 1 ? (i != 2 ? Keys.D : Keys.S) : Keys.Q) : Keys.Z;
       break;
     case ControlsMenuLevel.ArrowKeyMapping.IJKL:
       keys = i != 0 ? (i != 1 ? (i != 2 ? Keys.L : Keys.K) : Keys.J) : Keys.I;
       break;
     case ControlsMenuLevel.ArrowKeyMapping.ESDF:
       keys = i != 0 ? (i != 1 ? (i != 2 ? Keys.F : Keys.D) : Keys.S) : Keys.E;
       break;
     default:
       keys = i != 0 ? (i != 1 ? (i != 2 ? Keys.Right : Keys.Down) : Keys.Left) : Keys.Up;
       break;
   }
   return keys;
 }
예제 #3
0
        public override void Update(TimeSpan elapsed)
        {
            base.Update(elapsed);
            if (this.pendingApply && !SdlGamePad.GetPressedButtonId().HasValue)
            {
                this.pendingApply = false;
                SettingsManager.Settings.ApplyGamepadMapping();
            }
            if (this.TrapInput)
            {
                if (this.forGamepad)
                {
                    if (this.KeyboardManager.GetKeyState(Keys.Escape) == FezButtonState.Pressed)
                    {
                        int          num                    = this.Items.IndexOf(this.keyGrabFor);
                        MappedAction mappedAction           = ControlsMenuLevel.GamepadActionOrder[num - this.otherGamepadsStart];
                        Dictionary <MappedAction, int> gMap = SettingsManager.Settings.GamepadMapping;
                        this.keyGrabFor.SuffixText = (Func <string>)(() => " : " + this.Buttonize(gMap[mappedAction]));
                        this.TrapInput             = false;
                        this.forGamepad            = false;
                        this.pendingApply          = true;
                    }
                    else
                    {
                        int?pressedButtonId = SdlGamePad.GetPressedButtonId();
                        ControlsMenuLevel controlsMenuLevel = this;
                        int num1 = controlsMenuLevel.hasBeenIdle | !pressedButtonId.HasValue ? 1 : 0;
                        controlsMenuLevel.hasBeenIdle = num1 != 0;
                        if (this.hasBeenIdle && pressedButtonId.HasValue)
                        {
                            int          num2                   = this.Items.IndexOf(this.keyGrabFor);
                            MappedAction mappedAction           = ControlsMenuLevel.GamepadActionOrder[num2 - this.otherGamepadsStart];
                            Dictionary <MappedAction, int> gMap = SettingsManager.Settings.GamepadMapping;
                            gMap[mappedAction]         = pressedButtonId.Value;
                            this.keyGrabFor.SuffixText = (Func <string>)(() => " : " + this.Buttonize(gMap[mappedAction]));
                            this.TrapInput             = false;
                            this.forGamepad            = false;
                            this.pendingApply          = true;
                        }
                    }
                }
                else
                {
                    this.thisPressed.Clear();
                    foreach (Keys keys in Keyboard.GetState().GetPressedKeys())
                    {
                        this.thisPressed.Add(keys);
                    }
                    foreach (Keys keys1 in this.keysDown)
                    {
                        if (!this.thisPressed.Contains(keys1))
                        {
                            Keys         keys2                   = keys1;
                            int          num                     = this.Items.IndexOf(this.keyGrabFor);
                            MappedAction mappedAction            = ControlsMenuLevel.KeyboardActionOrder[num - this.keyboardStart];
                            Dictionary <MappedAction, Keys> kMap = SettingsManager.Settings.KeyboardMapping;
                            kMap[mappedAction]         = keys2;
                            this.keyGrabFor.SuffixText = (Func <string>)(() => " : " + this.Localize((object)kMap[mappedAction]));
                            this.KeyboardManager.UpdateMapping();
                            this.TrapInput = false;
                            break;
                        }
                    }
                    foreach (Keys keys in this.thisPressed)
                    {
                        if (!this.lastPressed.Contains(keys))
                        {
                            this.keysDown.Add(keys);
                        }
                    }
                    HashSet <Keys> hashSet = this.thisPressed;
                    this.thisPressed = this.lastPressed;
                    this.lastPressed = hashSet;
                }
            }
            if (this.SelectedIndex < this.Items.Count - 3)
            {
                return;
            }
            Point position = this.MouseState.Position;

            if (this.leftSliderRect.HasValue && this.leftSliderRect.Value.Contains(position))
            {
                this.menuBase.CursorSelectable = true;
                if (this.MouseState.LeftButton.State == MouseButtonStates.Pressed)
                {
                    this.FakeSlideLeft(false);
                }
            }
            else if (this.rightSliderRect.HasValue && this.rightSliderRect.Value.Contains(position))
            {
                this.menuBase.CursorSelectable = true;
                if (this.MouseState.LeftButton.State == MouseButtonStates.Pressed)
                {
                    this.FakeSlideRight(false);
                }
            }
            if (this.InputManager.Right == FezButtonState.Pressed)
            {
                this.FakeSlideRight(false);
            }
            else
            {
                if (this.InputManager.Left != FezButtonState.Pressed)
                {
                    return;
                }
                this.FakeSlideLeft(false);
            }
        }
예제 #4
0
파일: MenuBase.cs 프로젝트: Zeludon/FEZ
 public override void Initialize()
 {
   this.KeyboardState.IgnoreMapping = true;
   MenuBase menuBase1 = this;
   CreditsMenuLevel creditsMenuLevel1 = new CreditsMenuLevel();
   creditsMenuLevel1.Title = "Credits";
   creditsMenuLevel1.Oversized = true;
   creditsMenuLevel1.IsDynamic = true;
   CreditsMenuLevel creditsMenuLevel2 = creditsMenuLevel1;
   menuBase1.CreditsMenu = creditsMenuLevel2;
   this.StartNewGameMenu = new MenuLevel()
   {
     Title = "StartNewGameTitle",
     AButtonStarts = true,
     AButtonString = "StartNewGameWithGlyph",
     AButtonAction = new Action(this.StartNewGame)
   };
   this.StartNewGameMenu.AddItem("StartNewGameTextLine", new Action(Util.NullAction), -1);
   this.ExitToArcadeMenu = new MenuLevel()
   {
     Title = "ExitConfirmationTitle",
     AButtonString = "ExitChoiceYes",
     AButtonAction = new Action(this.ReturnToArcade)
   };
   this.ExitToArcadeMenu.AddItem("ReturnToArcadeTextLine", new Action(Util.NullAction), -1);
   MenuBase menuBase2 = this;
   LeaderboardsMenuLevel leaderboardsMenuLevel1 = new LeaderboardsMenuLevel(this);
   leaderboardsMenuLevel1.Title = "LeaderboardsTitle";
   leaderboardsMenuLevel1.Oversized = true;
   LeaderboardsMenuLevel leaderboardsMenuLevel2 = leaderboardsMenuLevel1;
   menuBase2.LeaderboardsMenu = leaderboardsMenuLevel2;
   MenuBase menuBase3 = this;
   ControlsMenuLevel controlsMenuLevel1 = new ControlsMenuLevel(this);
   controlsMenuLevel1.Title = "Controls";
   controlsMenuLevel1.Oversized = true;
   ControlsMenuLevel controlsMenuLevel2 = controlsMenuLevel1;
   menuBase3.ControlsMenu = controlsMenuLevel2;
   this.GameSettingsMenu = new MenuLevel()
   {
     Title = "GameSettings",
     BButtonString = "MenuSaveWithGlyph",
     IsDynamic = true,
     Oversized = true
   };
   this.AudioSettingsMenu = new MenuLevel()
   {
     Title = "AudioSettings",
     BButtonString = "MenuSaveWithGlyph",
     IsDynamic = true,
     Oversized = true
   };
   this.VideoSettingsMenu = new MenuLevel()
   {
     Title = "VideoSettings",
     AButtonString = "MenuApplyWithGlyph",
     IsDynamic = true,
     Oversized = true
   };
   this.VideoSettingsMenu.AddItem<string>("Resolution", new Action(this.ApplyVideo), false, (Func<string>) (() =>
   {
     DisplayMode local_0 = SettingsManager.Resolutions[this.currentResolution];
     float wD = (float) (local_0.Width / 1280);
     float hD = (float) (local_0.Height / 720);
     bool local_1 = local_0.Width % 1280 == 0 && (double) local_0.Height >= (double) wD * 720.0 && ((double) local_0.Height == (double) wD * 720.0 || !Enumerable.Any<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if ((double) x.Width == (double) wD * 1280.0)
         return (double) x.Height == (double) wD * 720.0;
       else
         return false;
     }))) || local_0.Height % 720 == 0 && (double) local_0.Width >= (double) hD * 1280.0 && ((double) local_0.Width == (double) hD * 1280.0 || !Enumerable.Any<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if ((double) x.Width == (double) hD * 1280.0)
         return (double) x.Height == (double) hD * 720.0;
       else
         return false;
     }))) || local_0.Width == 1920 && local_0.Height == 1080 && !Enumerable.Any<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if (x.Width >= 2560)
         return x.Height >= 1440;
       else
         return false;
     })) || local_0 == SettingsManager.NativeResolution;
     return string.Concat(new object[4]
     {
       (object) local_0.Width,
       (object) "x",
       (object) local_0.Height,
       local_1 ? (object) " *" : (object) ""
     });
   }), (Action<string, int>) ((lastValue, change) =>
   {
     this.currentResolution += change;
     if (this.currentResolution == SettingsManager.Resolutions.Count)
       this.currentResolution = 0;
     if (this.currentResolution != -1)
       return;
     this.currentResolution = SettingsManager.Resolutions.Count - 1;
   }), -1).UpperCase = true;
   this.VideoSettingsMenu.AddItem<string>("ScreenMode", new Action(this.ApplyVideo), false, (Func<string>) (() =>
   {
     if (!this.isFullscreen)
       return StaticText.GetString("Windowed");
     else
       return StaticText.GetString("Fullscreen");
   }), (Action<string, int>) ((_, __) => this.isFullscreen = !this.isFullscreen), -1).UpperCase = true;
   this.VideoSettingsMenu.AddItem("ResetToDefault", new Action(this.ReturnToVideoDefault), -1);
   this.VideoSettingsMenu.OnPostDraw += (Action<SpriteBatch, SpriteFont, GlyphTextRenderer, float>) ((batch, font, tr, alpha) =>
   {
     float local_0 = this.Fonts.SmallFactor * SettingsManager.GetViewScale(batch.GraphicsDevice);
     float local_1 = (float) batch.GraphicsDevice.Viewport.Height / 2f;
     if (this.VideoSettingsMenu.SelectedIndex != 0)
       return;
     tr.DrawCenteredString(batch, this.Fonts.Small, StaticText.GetString("RecommendedResolution"), new Color(1f, 1f, 1f, alpha), new Vector2(0.0f, local_1 * 1.5f), local_0);
   });
   this.AudioSettingsMenu.AddItem<float>("SoundVolume", MenuBase.SliderAction, false, (Func<float>) (() => SettingsManager.Settings.SoundVolume), (Action<float, int>) ((lastValue, change) =>
   {
     float local_0 = (double) lastValue > 0.0500000007450581 || change >= 0 ? ((double) lastValue < 0.949999988079071 || change <= 0 ? lastValue + (float) change * 0.05f : 1f) : 0.0f;
     this.SoundManager.SoundEffectVolume = SettingsManager.Settings.SoundVolume = local_0;
   }), -1).UpperCase = true;
   this.AudioSettingsMenu.AddItem<float>("MusicVolume", MenuBase.SliderAction, false, (Func<float>) (() => SettingsManager.Settings.MusicVolume), (Action<float, int>) ((lastValue, change) =>
   {
     float local_0 = (double) lastValue > 0.0500000007450581 || change >= 0 ? ((double) lastValue < 0.949999988079071 || change <= 0 ? lastValue + (float) change * 0.05f : 1f) : 0.0f;
     this.SoundManager.MusicVolume = SettingsManager.Settings.MusicVolume = local_0;
   }), -1).UpperCase = true;
   this.AudioSettingsMenu.AddItem("ResetToDefault", new Action(this.ReturnToAudioDefault), -1);
   Language toSet = Culture.Language;
   MenuItem<Language> menuItem1 = this.GameSettingsMenu.AddItem<Language>("Language", MenuBase.SliderAction, false, (Func<Language>) (() => toSet), (Action<Language, int>) ((lastValue, change) =>
   {
     if (change < 0 && toSet == Language.English)
       toSet = Language.Korean;
     else if (change > 0 && toSet == Language.Korean)
       toSet = Language.English;
     else
       toSet += (Language) change;
   }), -1);
   this.GameSettingsMenu.AButtonString = "MenuApplyWithGlyph";
   menuItem1.Selected = (Action) (() => Culture.Language = SettingsManager.Settings.Language = toSet);
   this.GameSettingsMenu.OnReset = (Action) (() => toSet = Culture.Language);
   menuItem1.UpperCase = true;
   menuItem1.LocalizeSliderValue = true;
   menuItem1.LocalizationTagFormat = "Language{0}";
   if (this.GameState.SaveData.HasStereo3D)
     this.StereoMenuItem = this.GameSettingsMenu.AddItem(this.GameState.StereoMode ? "Stereo3DOn" : "Stereo3DOff", new Action(this.ToggleStereo), -1);
   this.VibrationMenuItem = this.GameSettingsMenu.AddItem(SettingsManager.Settings.Vibration ? "VibrationOn" : "VibrationOff", new Action(this.ToggleVibration), -1);
   this.GameSettingsMenu.AddItem("ResetToDefault", (Action) (() =>
   {
     this.ReturnToGameDefault();
     toSet = Culture.Language;
   }), -1);
   this.SaveManagementMenu = new SaveManagementLevel(this);
   this.HelpOptionsMenu = new MenuLevel()
   {
     Title = "HelpOptions"
   };
   this.HelpOptionsMenu.AddItem("Controls", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.ControlsMenu, false)), -1);
   this.HelpOptionsMenu.AddItem("GameSettings", (Action) (() => this.ChangeMenuLevel(this.GameSettingsMenu, false)), -1);
   this.HelpOptionsMenu.AddItem("VideoSettings", (Action) (() =>
   {
     FezEngine.Tools.Settings s = SettingsManager.Settings;
     DisplayMode local_0 = Enumerable.FirstOrDefault<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if (x.Width == s.Width)
         return x.Height == s.Height;
       else
         return false;
     })) ?? GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
     this.currentResolution = SettingsManager.Resolutions.IndexOf(local_0);
     if (this.currentResolution == -1 || this.currentResolution >= SettingsManager.Resolutions.Count)
       this.currentResolution = 0;
     this.isFullscreen = SettingsManager.Settings.ScreenMode == ScreenMode.Fullscreen;
     this.ChangeMenuLevel(this.VideoSettingsMenu, false);
   }), -1).UpperCase = true;
   this.HelpOptionsMenu.AddItem("AudioSettings", (Action) (() => this.ChangeMenuLevel(this.AudioSettingsMenu, false)), -1);
   if (!Fez.PublicDemo)
     this.HelpOptionsMenu.AddItem("SaveManagementTitle", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.SaveManagementMenu, false)), -1);
   this.SaveManagementMenu.Parent = this.HelpOptionsMenu;
   this.GameSettingsMenu.Parent = this.HelpOptionsMenu;
   this.AudioSettingsMenu.Parent = this.HelpOptionsMenu;
   this.VideoSettingsMenu.Parent = this.HelpOptionsMenu;
   this.ControlsMenu.Parent = this.HelpOptionsMenu;
   this.UnlockNeedsLIVEMenu = new MenuLevel();
   this.UnlockNeedsLIVEMenu.AddItem("UnlockNeedsLIVE", MenuBase.SliderAction, -1).Selectable = false;
   this.MenuRoot = new MenuLevel();
   this.MenuRoot.AddItem("HelpOptions", (Action) (() => this.ChangeMenuLevel(this.HelpOptionsMenu, false)), -1);
   MenuItem menuItem2 = this.MenuRoot.AddItem("Leaderboards", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.LeaderboardsMenu, false)), -1);
   this.MenuRoot.AddItem("Credits", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.CreditsMenu, false)), -1);
   this.CreditsMenu.Parent = this.MenuRoot;
   MenuItem menuItem3 = (MenuItem) null;
   if (this.GameState.IsTrialMode)
     menuItem3 = this.MenuRoot.AddItem("UnlockFullGame", new Action(this.UnlockFullGame), -1);
   MenuItem menuItem4 = this.MenuRoot.AddItem("ReturnToArcade", (Action) (() => this.ChangeMenuLevel(this.ExitToArcadeMenu, false)), -1);
   if (Fez.PublicDemo)
   {
     menuItem4.Disabled = true;
     menuItem2.Disabled = true;
     if (menuItem3 != null)
       menuItem3.Disabled = true;
     menuItem4.Selectable = false;
     menuItem2.Selectable = false;
     if (menuItem3 != null)
       menuItem3.Selectable = false;
   }
   this.MenuLevels = new List<MenuLevel>()
   {
     this.MenuRoot,
     this.UnlockNeedsLIVEMenu,
     this.StartNewGameMenu,
     this.HelpOptionsMenu,
     this.AudioSettingsMenu,
     this.VideoSettingsMenu,
     this.GameSettingsMenu,
     this.ExitToArcadeMenu,
     (MenuLevel) this.LeaderboardsMenu,
     (MenuLevel) this.ControlsMenu,
     (MenuLevel) this.CreditsMenu,
     (MenuLevel) this.SaveManagementMenu
   };
   foreach (MenuLevel menuLevel in this.MenuLevels)
   {
     if (menuLevel != this.MenuRoot && menuLevel.Parent == null)
       menuLevel.Parent = this.MenuRoot;
   }
   this.nextMenuLevel = this.EndGameMenu ? (MenuLevel) this.CreditsMenu : this.MenuRoot;
   this.GameState.DynamicUpgrade += new Action(this.DynamicUpgrade);
   this.PostInitialize();
   base.Initialize();
 }