/// <summary> /// Allows custom logic to be applied when switching between categories. /// </summary> /// <param name="categoryRows">The <see cref="CategoryRow"/> controls.</param> /// <param name="changedRow">The changed category row index in the array.</param> /// <param name="previous">The previously selected category index.</param> /// <param name="current">The newly selected category index.</param> protected override void UpdateCategories(CategoryRow[] categoryRows, int changedRow, int previous, int current) { CategoryRow crMain = categoryRows[0]; CategoryRow crSecondary = categoryRows[1]; if (changedRow == 0) { // Update the main categories. bool fileOpen = BinFile != null; CategoryMain category = (CategoryMain)current; CategoryMain categoryPrevious = (CategoryMain)previous; crMain.ClearCategories(); crMain.AddCategory("File"); crMain.AddCategory("Points", fileOpen); crMain.AddCategory("Physics", fileOpen); crMain.AddCategory("Speed", fileOpen); crMain.AddCategory("Handling", fileOpen); // Update the secondary categories. crSecondary.Visible = category != CategoryMain.File; crSecondary.ClearCategories(); switch (category) { case CategoryMain.Points: crSecondary.AddCategory("Drivers"); crSecondary.AddCategory("Karts"); crSecondary.AddCategory("Tires"); crSecondary.AddCategory("Gliders"); crSecondary.SelectedCategory = _categoryPoints; break; case CategoryMain.Physics: crSecondary.AddCategory("Weight"); crSecondary.AddCategory("Acceleration"); crSecondary.AddCategory("On-Road Slip"); crSecondary.AddCategory("Off-Road Slip"); crSecondary.AddCategory("Off-Road Brake"); crSecondary.AddCategory("Turbo"); crSecondary.SelectedCategory = _categoryPhysics; break; case CategoryMain.Speed: case CategoryMain.Handling: crSecondary.AddCategory("Ground"); crSecondary.AddCategory("Water"); crSecondary.AddCategory("Anti-Gravity"); crSecondary.AddCategory("Gliding"); crSecondary.SelectedCategory = _categorySpeedHandling; break; } } else { // Remember the newly selected secondary category. switch ((CategoryMain)crMain.SelectedCategory) { case CategoryMain.Points: _categoryPoints = current; break; case CategoryMain.Physics: _categoryPhysics = current; break; case CategoryMain.Speed: case CategoryMain.Handling: _categorySpeedHandling = current; break; } } }
/// <summary> /// Allows custom logic to be applied when switching between categories. /// </summary> /// <param name="categoryRows">The <see cref="CategoryRow"/> controls.</param> /// <param name="changedRow">The changed category row index in the array.</param> /// <param name="previous">The previously selected category index.</param> /// <param name="current">The newly selected category index.</param> protected override void UpdateCategories(CategoryRow[] categoryRows, int changedRow, int previous, int current) { CategoryRow crMain = categoryRows[0]; CategoryRow crSecondary = categoryRows[1]; CategoryRow crTertiary = categoryRows[2]; if (changedRow == 0) { // Update the main categories. bool fileOpen = BinFile != null; CategoryMain category = (CategoryMain)current; CategoryMain categoryPrevious = (CategoryMain)previous; crMain.ClearCategories(); crMain.AddCategory("File"); crMain.AddCategory("Versus Races", fileOpen); crMain.AddCategory("Battle Mode", fileOpen); // Update the secondary categories. crSecondary.ClearCategories(); switch (category) { case CategoryMain.Versus: crSecondary.AddCategory("All Items"); crSecondary.AddCategory("Mushrooms Only"); crSecondary.AddCategory("Shells Only"); crSecondary.AddCategory("Bananas Only"); crSecondary.AddCategory("Bob-ombs Only"); crSecondary.AddCategory("Frantic Mode"); crSecondary.AddCategory("Grand Prix"); crSecondary.AddCategory("Distances"); break; case CategoryMain.Battle: crSecondary.AddCategory("All Items"); crSecondary.AddCategory("Mushrooms Only"); crSecondary.AddCategory("Shells Only"); crSecondary.AddCategory("Bananas Only"); crSecondary.AddCategory("Bob-ombs Only"); crSecondary.AddCategory("Frantic Mode"); break; } if ((CategoryMain)crMain.SelectedCategory == CategoryMain.Battle) { _itemSet = Math.Min((int)CategorySecond.Frantic, _itemSet); } crSecondary.SelectedCategory = _itemSet; } else if (changedRow == 1) { // Update the tertiary categories. crTertiary.Visible = (CategorySecond)current != CategorySecond.Distances; crTertiary.ClearCategories(); crTertiary.AddCategory("Human Player"); crTertiary.AddCategory("Software Player"); crTertiary.SelectedCategory = _playerType; // Remember the newly selected secondary category. _itemSet = current; } else if (changedRow == 2) { // Remember the newly selected tertiary category. _playerType = current; } crSecondary.Visible = (CategoryMain)crMain.SelectedCategory != CategoryMain.File; crTertiary.Visible = crSecondary.Visible && (CategorySecond)crSecondary.SelectedCategory != CategorySecond.Distances; }