/// <summary> /// Constructs a new screen manager component. /// </summary> public ScreenManager(Game game) : base(game) { GameLevelsArray = new CircularArray <GameLevels>((GameLevels[])Enum.GetValues(typeof(GameLevels))); GameLevelsArray.MoveNext(); ComputerColorArray = new CircularArray <FigureColors?>(new FigureColors?[] { FigureColors.Black, null, FigureColors.White }); ComputerColorArray.MoveNext(); }
public OptionsMenuScreen(MainMenuScreen mainMenuScreen) : base(Strings.optionsmenu_title) { this.mainMenuScreen = mainMenuScreen; /* Needed for access to global properties */ ScreenManager = mainMenuScreen.ScreenManager; /* Initialize options */ InitializeCultureOption(); UpdateAllTexts(); /* Click events */ levelOption.Selected += (sender, e) => { ScreenManager.GameLevelsArray.MoveNext(); UpdateLevelText(); }; computerColorOption.Selected += (sender, e) => { ScreenManager.ComputerColorArray.MoveNext(); UpdateComputerColorText(); }; languageOption.Selected += (sender, e) => { cultures.MoveNext(); Strings.Culture = new CultureInfo(cultures.Current); UpdateAllTexts(); }; backOption.Selected += OnCancel; /* Add entries to the menu */ MenuEntries.Add(levelOption); MenuEntries.Add(computerColorOption); MenuEntries.Add(languageOption); MenuEntries.Add(backOption); }