Ui/SoloOptionsPanel.razor

A UI component for configuring solo game options. It provides buttons for selecting the number of AI rivals and setting the bot difficulty.

@namespace CitySim
@using CitySim.DesignSystem
@using CitySim.Ai
@using CitySim.Punchboard
@inherits MatchPanel

<root class="solo-options">
	<div class="solo-option-row">
		<div class="solo-label">@(GameText.Get("ui.solo_options_panel.rivals"))</div>
		<div class="solo-choices">
			<PlotterButton Text="1" Size=@(PbSize.Small) Kind=@(PbButtonKind.Secondary) Toggled=@(City.SoloRivals == 1) Clicked=@(() => { City.ConfigureSolo(1, City.SoloDifficulty); }) />
			<PlotterButton Text="2" Size=@(PbSize.Small) Kind=@(PbButtonKind.Secondary) Toggled=@(City.SoloRivals == 2) Clicked=@(() => { City.ConfigureSolo(2, City.SoloDifficulty); }) />
			<PlotterButton Text="3" Size=@(PbSize.Small) Kind=@(PbButtonKind.Secondary) Toggled=@(City.SoloRivals == 3) Clicked=@(() => { City.ConfigureSolo(3, City.SoloDifficulty); }) />
		</div>
	</div>
	<div class="solo-option-row">
		<div class="solo-label">@(GameText.Get("ui.game_setup_panel.difficulty"))</div>
		<div class="solo-choices">
			<PlotterButton Text=@(GameText.Get("ui.solo_options_panel.easy")) Size=@(PbSize.Small) Kind=@(PbButtonKind.Secondary) Toggled=@(City.SoloDifficulty == BotDifficulty.Easy) Clicked=@(() => { City.ConfigureSolo(City.SoloRivals, BotDifficulty.Easy); }) />
			<PlotterButton Text=@(GameText.Get("ui.solo_options_panel.normal")) Size=@(PbSize.Small) Kind=@(PbButtonKind.Secondary) Toggled=@(City.SoloDifficulty == BotDifficulty.Normal) Clicked=@(() => { City.ConfigureSolo(City.SoloRivals, BotDifficulty.Normal); }) />
			<PlotterButton Text=@(GameText.Get("ui.solo_options_panel.hard")) Size=@(PbSize.Small) Kind=@(PbButtonKind.Secondary) Toggled=@(City.SoloDifficulty == BotDifficulty.Hard) Clicked=@(() => { City.ConfigureSolo(City.SoloRivals, BotDifficulty.Hard); }) />
		</div>
	</div>
</root>

@code {
	CityGame subscribedCity;
	protected override void Subscribe() { subscribedCity = City; if (subscribedCity != null) subscribedCity.UiChanged += Refresh; }
	protected override void Unsubscribe() { if (subscribedCity != null) subscribedCity.UiChanged -= Refresh; subscribedCity = null; }
}