added giftype NoWood

This commit is contained in:
beo3000 2025-12-30 17:43:10 +01:00
parent 752523fe78
commit a3a5c288a1
10 changed files with 30 additions and 8 deletions

View File

@ -10,5 +10,6 @@ public enum ThrowEventType
Strike = 1, // alle 9 pins Strike = 1, // alle 9 pins
Circle = 2, // Kranz - 8 outer pins, center standing Circle = 2, // Kranz - 8 outer pins, center standing
Bell = 4, // Glocke - bell hit Bell = 4, // Glocke - bell hit
Gutter = 8 // Rinne - gutter throw Gutter = 8, // Rinne - gutter throw
NoWood = 16, // Fehlwurf - no pins hit
} }

View File

@ -56,7 +56,7 @@ public class ClubGifRepository(IDbContextFactory<AppDbContext> contextFactory) :
await using var context = await contextFactory.CreateDbContextAsync(ct); await using var context = await contextFactory.CreateDbContextAsync(ct);
// Get top-rated GIFs for each event type // Get top-rated GIFs for each event type
var allEvents = new[] { ThrowEventType.Strike, ThrowEventType.Circle, ThrowEventType.Bell, ThrowEventType.Gutter }; var allEvents = new[] { ThrowEventType.Strike, ThrowEventType.Circle, ThrowEventType.Bell, ThrowEventType.Gutter, ThrowEventType.NoWood };
var result = new List<ClubGif>(); var result = new List<ClubGif>();
foreach (var eventType in allEvents) foreach (var eventType in allEvents)

View File

@ -150,6 +150,7 @@
ThrowEventType.Circle => "KRANZ!", ThrowEventType.Circle => "KRANZ!",
ThrowEventType.Bell => "GLOCKE!", ThrowEventType.Bell => "GLOCKE!",
ThrowEventType.Gutter => "RINNE!", ThrowEventType.Gutter => "RINNE!",
ThrowEventType.NoWood => "KEIN HOLZ!",
_ => "" _ => ""
}; };
} }

View File

@ -46,6 +46,13 @@
Icon="@Icons.Material.Filled.FlashOn"> Icon="@Icons.Material.Filled.FlashOn">
Auslöser Auslöser
</MudNavLink> </MudNavLink>
<MudNavLink Href="/admin/gifs"
Match="NavLinkMatch.Prefix"
Icon="@Icons.Material.Filled.VideoFile">
Gifs
</MudNavLink>
</MudNavGroup> </MudNavGroup>
} }
} }

View File

@ -31,6 +31,7 @@
<MudCheckBox @bind-Value="_circle" Label="Kranz" Color="Color.Primary" /> <MudCheckBox @bind-Value="_circle" Label="Kranz" Color="Color.Primary" />
<MudCheckBox @bind-Value="_bell" Label="Glocke" Color="Color.Warning" /> <MudCheckBox @bind-Value="_bell" Label="Glocke" Color="Color.Warning" />
<MudCheckBox @bind-Value="_gutter" Label="Rinne" Color="Color.Error" /> <MudCheckBox @bind-Value="_gutter" Label="Rinne" Color="Color.Error" />
<MudCheckBox @bind-Value="_noWood" Label="kein Holz" Color="Color.Tertiary" />
</MudStack> </MudStack>
<MudTextField @bind-Value="_description" <MudTextField @bind-Value="_description"
@ -59,10 +60,10 @@
private string _name = ""; private string _name = "";
private string _description = ""; private string _description = "";
private bool _strike, _circle, _bell, _gutter; private bool _strike, _circle, _bell, _gutter, _noWood;
private bool _isEnabled = true; private bool _isEnabled = true;
private bool IsValid => !string.IsNullOrWhiteSpace(_name) && (_strike || _circle || _bell || _gutter); private bool IsValid => !string.IsNullOrWhiteSpace(_name) && (_strike || _circle || _bell || _gutter || _noWood);
protected override void OnParametersSet() protected override void OnParametersSet()
{ {
@ -74,6 +75,7 @@
_circle = (Gif.AssignedEvents & ThrowEventType.Circle) != 0; _circle = (Gif.AssignedEvents & ThrowEventType.Circle) != 0;
_bell = (Gif.AssignedEvents & ThrowEventType.Bell) != 0; _bell = (Gif.AssignedEvents & ThrowEventType.Bell) != 0;
_gutter = (Gif.AssignedEvents & ThrowEventType.Gutter) != 0; _gutter = (Gif.AssignedEvents & ThrowEventType.Gutter) != 0;
_noWood = (Gif.AssignedEvents & ThrowEventType.NoWood) != 0;
_isEnabled = Gif.IsEnabled; _isEnabled = Gif.IsEnabled;
} }
} }
@ -85,6 +87,7 @@
if (_circle) events |= ThrowEventType.Circle; if (_circle) events |= ThrowEventType.Circle;
if (_bell) events |= ThrowEventType.Bell; if (_bell) events |= ThrowEventType.Bell;
if (_gutter) events |= ThrowEventType.Gutter; if (_gutter) events |= ThrowEventType.Gutter;
if (_noWood) events |= ThrowEventType.NoWood;
return events; return events;
} }

View File

@ -43,11 +43,11 @@
private string _url = ""; private string _url = "";
private string _name = ""; private string _name = "";
private string _description = ""; private string _description = "";
private bool _strike, _circle, _bell, _gutter; private bool _strike, _circle, _bell, _gutter, _noWood;
private bool IsValid => !string.IsNullOrWhiteSpace(_url) private bool IsValid => !string.IsNullOrWhiteSpace(_url)
&& !string.IsNullOrWhiteSpace(_name) && !string.IsNullOrWhiteSpace(_name)
&& (_strike || _circle || _bell || _gutter) && (_strike || _circle || _bell || _gutter || _noWood)
&& Uri.TryCreate(_url, UriKind.Absolute, out _); && Uri.TryCreate(_url, UriKind.Absolute, out _);
private ThrowEventType GetEvents() private ThrowEventType GetEvents()
@ -57,6 +57,7 @@
if (_circle) events |= ThrowEventType.Circle; if (_circle) events |= ThrowEventType.Circle;
if (_bell) events |= ThrowEventType.Bell; if (_bell) events |= ThrowEventType.Bell;
if (_gutter) events |= ThrowEventType.Gutter; if (_gutter) events |= ThrowEventType.Gutter;
if (_noWood) events |= ThrowEventType.NoWood;
return events; return events;
} }

View File

@ -510,6 +510,7 @@
if ((events & ThrowEventType.Circle) != 0) result.Add(ThrowEventType.Circle); if ((events & ThrowEventType.Circle) != 0) result.Add(ThrowEventType.Circle);
if ((events & ThrowEventType.Bell) != 0) result.Add(ThrowEventType.Bell); if ((events & ThrowEventType.Bell) != 0) result.Add(ThrowEventType.Bell);
if ((events & ThrowEventType.Gutter) != 0) result.Add(ThrowEventType.Gutter); if ((events & ThrowEventType.Gutter) != 0) result.Add(ThrowEventType.Gutter);
if ((events & ThrowEventType.NoWood) != 0) result.Add(ThrowEventType.NoWood);
return result; return result;
} }
@ -519,6 +520,7 @@
ThrowEventType.Circle => "Kranz", ThrowEventType.Circle => "Kranz",
ThrowEventType.Bell => "Glocke", ThrowEventType.Bell => "Glocke",
ThrowEventType.Gutter => "Rinne", ThrowEventType.Gutter => "Rinne",
ThrowEventType.NoWood => "kein Holz",
_ => type.ToString() _ => type.ToString()
}; };
@ -528,6 +530,7 @@
ThrowEventType.Circle => Color.Primary, ThrowEventType.Circle => Color.Primary,
ThrowEventType.Bell => Color.Warning, ThrowEventType.Bell => Color.Warning,
ThrowEventType.Gutter => Color.Error, ThrowEventType.Gutter => Color.Error,
ThrowEventType.NoWood => Color.Tertiary,
_ => Color.Default _ => Color.Default
}; };

View File

@ -20,6 +20,7 @@
<MudCheckBox @bind-Value="_strike" Label="Alle 9" Color="Color.Success" /> <MudCheckBox @bind-Value="_strike" Label="Alle 9" Color="Color.Success" />
<MudCheckBox @bind-Value="_circle" Label="Kranz" Color="Color.Primary" /> <MudCheckBox @bind-Value="_circle" Label="Kranz" Color="Color.Primary" />
<MudCheckBox @bind-Value="_bell" Label="Glocke" Color="Color.Warning" /> <MudCheckBox @bind-Value="_bell" Label="Glocke" Color="Color.Warning" />
<MudCheckBox @bind-Value="_noWood" Label="kein Holz" Color="Color.Tertiary" />
<MudCheckBox @bind-Value="_gutter" Label="Rinne" Color="Color.Error" /> <MudCheckBox @bind-Value="_gutter" Label="Rinne" Color="Color.Error" />
</MudStack> </MudStack>
@ -42,9 +43,9 @@
private string _name = ""; private string _name = "";
private string _description = ""; private string _description = "";
private bool _strike, _circle, _bell, _gutter; private bool _strike, _circle, _bell, _gutter, _noWood;
private bool IsValid => !string.IsNullOrWhiteSpace(_name) && (_strike || _circle || _bell || _gutter); private bool IsValid => !string.IsNullOrWhiteSpace(_name) && (_strike || _circle || _bell || _gutter || _noWood);
private ThrowEventType GetEvents() private ThrowEventType GetEvents()
{ {
@ -53,6 +54,7 @@
if (_circle) events |= ThrowEventType.Circle; if (_circle) events |= ThrowEventType.Circle;
if (_bell) events |= ThrowEventType.Bell; if (_bell) events |= ThrowEventType.Bell;
if (_gutter) events |= ThrowEventType.Gutter; if (_gutter) events |= ThrowEventType.Gutter;
if (_noWood) events |= ThrowEventType.NoWood;
return events; return events;
} }

View File

@ -1054,6 +1054,10 @@ public class GameEffects
{ {
triggeredEvent = ThrowEventType.Gutter; triggeredEvent = ThrowEventType.Gutter;
} }
else if (afterThrowState.PinsKnocked == 0)
{
triggeredEvent = ThrowEventType.NoWood;
}
if (!triggeredEvent.HasValue) if (!triggeredEvent.HasValue)
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 KiB