/// <summary> /// Open up the Options submenu. If AIParams is supplied, the AImenu /// initializes its menuitems to equal previously selected settings. /// </summary> /// <param name = "aiParams"></param> public void TransitionToOptions(IEnumerable<Tuple<string, int>> aiParams) { CurrentSubMenu = SubMenu.Options; MenuItems.Clear(); MenuItem currentAILevelSelector; for (int currentPlayer = 1; currentPlayer<=6; currentPlayer++) { var currentAISelector = new MenuItem("Player["+currentPlayer+"] AI", 0); currentAILevelSelector = new MenuItem("Player["+currentPlayer+"] AI Level: ", 1, 9, 1, 1); MenuItems.Add(currentAISelector); MenuItems.Add(currentAILevelSelector); MenuItem.LinkAIandLevelMenuItems(currentAISelector, currentAILevelSelector); currentAILevelSelector.Enabled = false; } MenuItems.Add(new MenuItem("Back to Main Menu")); if (aiParams != null) LoadSavedAISettings(aiParams); SelectedMenuItemIndex = 0; }
/// <summary> /// Associate a MenuItem that selects an AI and a MenuItem that selects a difficulty. /// </summary> /// <param name = "aiSelectorMenuItem">A menu item that selects an AI</param> /// <param name = "levelMenuItem">A menu item that selects a level</param> public static void LinkAIandLevelMenuItems(MenuItem aiSelectorMenuItem, MenuItem levelMenuItem) { aiSelectorMenuItem.DifficultySlider = levelMenuItem; }