Skip to content

Commit

Permalink
Standardize separator UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinoAbate committed Feb 18, 2023
1 parent addd2fb commit e9bcc95
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public PokemonSettingsUI(PokemonSettings settings, IEnumerable<string> metricTyp
if(settings.Data.Count > 0)
{
stack.Add(new MetricDataUI(settings.Data, metricTypeOptions, initialize));
stack.Add(new Separator());
stack.Separator();
}
stack.Add(new BoundCheckBoxUI(settings.BanLegendaries, b => settings.BanLegendaries = b, "Ban Legendaries"));
stack.Add(new BoundCheckBoxUI(settings.RestrictIllegalEvolutions, b => settings.RestrictIllegalEvolutions = b, "Ban Illegal Evolutions"));
Expand Down
13 changes: 10 additions & 3 deletions PokemonRandomizer/PokemonRandomizer/UI/UIExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace PokemonRandomizer.UI
{
public static class UIExtensions
{
private static Separator StdSeparator => new Separator() { Height = 1, UseLayoutRounding=true };

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T Add<T>(this Panel p, T element) where T : UIElement
{
Expand All @@ -21,11 +23,11 @@ public static void Add(this Panel p, params UIElement[] elements)
}
public static void Header(this Panel p, string content)
{
p.Add(new Label { Content = content }, new Separator());
p.Add(new Label { Content = content }, StdSeparator);
}
public static void Header(this Panel p, string content, string tooltip)
{
p.Add(new Label { Content = content, ToolTip = tooltip }, new Separator());
p.Add(new Label { Content = content, ToolTip = tooltip }, StdSeparator);
}

public static void Description(this Panel p, params string[] content)
Expand All @@ -34,7 +36,12 @@ public static void Description(this Panel p, params string[] content)
{
p.Add(new Label() { Content = line });
}
p.Add(new Separator());
p.Add(StdSeparator);
}

public static void Separator(this Panel p)
{
p.Add(StdSeparator);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private TabItem CreateLearnsetsTab(PokemonTraitsModel model)
bonusMovesStack.Add(new BoundCheckBoxUI("Ban adding HM moves", model.DisableAddingHmMoves));
stack.Add(new RandomChanceUI("Bonus Moves", model.AddMoves, model.AddMovesChance, bonusMovesStack));
stack.Add(bonusMovesStack);
stack.Add(new Separator());
stack.Separator();
stack.Header(UISkin.Current.HacksAndTweaksHeader);
stack.Add(new BoundCheckBoxUI("Ban Selfdestruct", model.BanSelfdestruct, banSelfdestructTooltip));
return CreateTabItem("Learnsets", stack); ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public TmHmTutorDataView(TmHmTutorModel model)
stack.Add(new BoundCheckBoxUI("Prevent HM moves in TMs and Tutors", model.NoHmMovesInTMsAndTutors));
stack.Add(new BoundCheckBoxUI("Prevent duplicate moves in TMs and Tutors", model.NoDuplicateTMsAndTutors));
stack.Add(new BoundCheckBoxUI("Keep important TMs and Tutors", model.KeepImportantTmsAndTutors, "Ensures that important TMs and Tutors won't be randomized (Secret Power + Dig in RSE)"));
stack.Add(new Separator());
stack.Separator();
stack.Header("Compatibility");
var compatDropdown = stack.Add(new EnumComboBoxUI<CompatOption>("Compatibility Strategy", CompatOptionDropdown, model.MoveCompatOption));
stack.Add(compatDropdown.BindVisibility(new BoundSliderUI("Random Compatibility Chance", model.RandomCompatTrueChance), (int)CompatOption.Random, (int)CompatOption.RandomKeepNumber));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public WeatherDataView(WeatherDataModel model)
{
var stack = CreateMainStack();
stack.Add(new Label() { Content = "Weather Randomization" });
stack.Add(new Separator());
stack.Separator();
var strategyDrop = stack.Add(new EnumComboBoxUI<WeatherOption>("Randomization Strategy", WeatherOptionDropdown, model.WeatherSetting));
strategyDrop.BindVisibility(stack.Add(new WeightedSetUI<Weather>("Custom Weather Type", model.CustomWeatherWeights, GetWeatherWeightDropdown)), (int)WeatherOption.CustomWeighting);
var settingsStack = stack.Add(strategyDrop.BindEnabled(CreateStack(), (int)WeatherOption.CompletelyRandom, (int)WeatherOption.InBattleWeather, (int)WeatherOption.CustomWeighting));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public WildEncounterDataView(WildEncounterDataModel model)
{
var stack = new StackPanel() { Orientation = Orientation.Vertical };
Content = stack;
stack.Add(new Label() { Content = "Wild Encounter Randomization" });
stack.Add(new Separator());
stack.Header("Wild Encounter Randomization");
stack.Add(new EnumComboBoxUI<Strategy>("Randomization Strategy", StrategyDropdown, model.Strategy));
stack.Add(new PokemonSettingsUI(model.PokemonSettings, MetricTypes, model.InitializeMetric));
}
Expand Down
2 changes: 1 addition & 1 deletion PokemonRandomizer/PokemonRandomizer/UI/WeightedSetUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public WeightedSetUI(string name, WeightedSet<T> set, Func<IReadOnlyList<MenuBox
}
addButton.ContextMenu = contextMenu;
mainStack.Add(controlStack);
mainStack.Add(new Separator());
mainStack.Separator();
foreach(var item in set)
{
Add(item.Key, item.Value);
Expand Down

0 comments on commit e9bcc95

Please sign in to comment.