diff --git a/KoogleApp/Components/Controls/NumberPanel.razor b/KoogleApp/Components/Controls/NumberPanel.razor index 4d71333..7123f83 100644 --- a/KoogleApp/Components/Controls/NumberPanel.razor +++ b/KoogleApp/Components/Controls/NumberPanel.razor @@ -32,7 +32,14 @@ @(ThrowPanelSelectors.GetThrowModeName(ThrowPanelState.Value)) - Wurf @ThrowPanelState.Value.ThrowCounterPerRound von @ThrowPanelState.Value.ThrowsPerRound + @if (@ThrowPanelState.Value.ThrowsPerRound == int.MaxValue) + { + Wurf @ThrowPanelState.Value.ThrowCounterPerRound + } + else + { + Wurf @ThrowPanelState.Value.ThrowCounterPerRound von @ThrowPanelState.Value.ThrowsPerRound + } diff --git a/KoogleApp/Components/Dialogs/StartGameDialog.razor b/KoogleApp/Components/Dialogs/StartGameDialog.razor index ee27018..c22fad0 100644 --- a/KoogleApp/Components/Dialogs/StartGameDialog.razor +++ b/KoogleApp/Components/Dialogs/StartGameDialog.razor @@ -106,21 +106,10 @@ private void Start() { var setupModel = (dynamicComponentRef.Instance as ISetupControl).GameSetupModel; - setupModel.ParticipantsMode = SetupState.Value.ParticipantsMode; setupModel.DayId = DayState.Value.Id; setupModel.KnownGameType = SetupState.Value.Game.GetType().Name; setupModel.Participants = PlayerIds; - - // MudDialog.Close(DialogResult.Ok(new StartParams( - // DayState.Value.Id, - // SetupState.Value.ThrowMode, - // SetupState.Value.ThrowsPerRound, - // PlayerIds, - // SetupState.Value.ParticipantsMode, - // SetupState.Value.Game.GetType().Name - // ))); - MudDialog.Close(DialogResult.Ok(setupModel)); } } diff --git a/KoogleApp/Games/Shit/Setup.razor b/KoogleApp/Games/Shit/Setup.razor index f7d89c5..57e0b5b 100644 --- a/KoogleApp/Games/Shit/Setup.razor +++ b/KoogleApp/Games/Shit/Setup.razor @@ -6,17 +6,24 @@ @implements ISetupControl -

Setup

+ + + @code { + int _shitNumber = 5; + public IGameSetupModel GameSetupModel => new ShitSetupState() - { - ThrowMode = ThrowMode.Reposition, - ThrowsPerRound = int.MaxValue, - ParticipantsMode = ParticipantsMode.GameLogic, - - }; + { + ThrowMode = ThrowMode.Reposition, + ThrowsPerRound = int.MaxValue, + ParticipantsMode = ParticipantsMode.GameLogic, + + } with + { + ShitNumber = _shitNumber + }; } diff --git a/KoogleApp/Services/ServiceExtension.cs b/KoogleApp/Services/ServiceExtension.cs index 9625bc4..bcc4207 100644 --- a/KoogleApp/Services/ServiceExtension.cs +++ b/KoogleApp/Services/ServiceExtension.cs @@ -64,7 +64,8 @@ namespace KoogleApp.Services } services.AddSingleton(); - services.AddTransient(); // TODO: add all automatically + + AddAllGameServices(services); services.AddSingleton(); services.AddSingleton(); @@ -78,5 +79,21 @@ namespace KoogleApp.Services return services; } + + private static void AddAllGameServices(IServiceCollection services) + { + var assembly = Assembly.GetAssembly(typeof(GameTrainingService)); + + var ns = assembly.FullName.Split(',')[0] + ".Games"; + var types = assembly.GetTypes().Where(_ => _.IsClass && _.FullName.StartsWith(ns) && !_.IsNested); + + foreach (var type in types) + { + if (typeof(IGameService).IsAssignableFrom(type)) + { + services.AddTransient(type); + } + } + } } } diff --git a/KoogleApp/appdata.json b/KoogleApp/appdata.json index d2fffea..08dc678 100644 --- a/KoogleApp/appdata.json +++ b/KoogleApp/appdata.json @@ -8,17 +8,17 @@ "Pin1State": 0, "Pin2State": 0, "Pin3State": 0, - "Pin4State": 2, + "Pin4State": 0, "Pin5State": 0, "Pin6State": 0, "Pin7State": 0, "Pin8State": 0, "Pin9State": 0, - "ThrowsPerRound": 4, - "ThrowCounterPerRound": 2, - "ThrowMode": 1, + "ThrowsPerRound": 2147483647, + "ThrowCounterPerRound": 3, + "ThrowMode": 0, "ThrowPanelStateStatus": 3, - "ThrowCounter": 1, + "ThrowCounter": 2, "DayId": 35 }, "ParticipantsState": { @@ -31,69 +31,10 @@ ], "Eliminated": [] }, - "GameModel": { - "$type": "TrainingState", - "Throws": { - "5": { - "PlayerId": 5, - "TeamNr": 0, - "PinCount": 1, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 1, - "BellCount": 0 - }, - "3": { - "PlayerId": 3, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "10": { - "PlayerId": 10, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "12": { - "PlayerId": 12, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "9": { - "PlayerId": 9, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - } - } - } + "GameModel": null }, - "Version": 3, - "LastModified": "2025-11-27T21:06:17.9099848+01:00", + "Version": 5, + "LastModified": "2025-11-28T20:21:51.2059061+01:00", "LastModifiedBy": "test1@test.de" }, "UndoHistory": [ @@ -106,15 +47,91 @@ "Pin1State": 0, "Pin2State": 0, "Pin3State": 0, - "Pin4State": 1, + "Pin4State": 0, + "Pin5State": 0, + "Pin6State": 0, + "Pin7State": 1, + "Pin8State": 0, + "Pin9State": 1, + "ThrowsPerRound": 2147483647, + "ThrowCounterPerRound": 2, + "ThrowMode": 0, + "ThrowPanelStateStatus": 2, + "ThrowCounter": 1, + "DayId": 35 + }, + "ParticipantsState": { + "PlayerIds": [ + 5, + 3, + 10, + 12, + 9 + ], + "Eliminated": [] + }, + "GameModel": null + }, + "Version": 4, + "LastModified": "2025-11-28T20:21:51.2025106+01:00", + "LastModifiedBy": "test1@test.de" + }, + { + "Status": { + "SetupModel": null, + "ThrowPanelState": { + "IsStated": true, + "BellValue": false, + "Pin1State": 0, + "Pin2State": 0, + "Pin3State": 0, + "Pin4State": 0, "Pin5State": 0, "Pin6State": 0, "Pin7State": 0, "Pin8State": 0, "Pin9State": 0, - "ThrowsPerRound": 4, + "ThrowsPerRound": 2147483647, + "ThrowCounterPerRound": 2, + "ThrowMode": 0, + "ThrowPanelStateStatus": 3, + "ThrowCounter": 1, + "DayId": 35 + }, + "ParticipantsState": { + "PlayerIds": [ + 5, + 3, + 10, + 12, + 9 + ], + "Eliminated": [] + }, + "GameModel": null + }, + "Version": 3, + "LastModified": "2025-11-28T20:21:37.3278595+01:00", + "LastModifiedBy": "test1@test.de" + }, + { + "Status": { + "SetupModel": null, + "ThrowPanelState": { + "IsStated": true, + "BellValue": false, + "Pin1State": 0, + "Pin2State": 0, + "Pin3State": 0, + "Pin4State": 0, + "Pin5State": 0, + "Pin6State": 0, + "Pin7State": 0, + "Pin8State": 0, + "Pin9State": 1, + "ThrowsPerRound": 2147483647, "ThrowCounterPerRound": 1, - "ThrowMode": 1, + "ThrowMode": 0, "ThrowPanelStateStatus": 2, "ThrowCounter": 0, "DayId": 35 @@ -129,78 +146,20 @@ ], "Eliminated": [] }, - "GameModel": { - "$type": "TrainingState", - "Throws": { - "5": { - "PlayerId": 5, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "3": { - "PlayerId": 3, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "10": { - "PlayerId": 10, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "12": { - "PlayerId": 12, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "9": { - "PlayerId": 9, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - } - } - } + "GameModel": null }, "Version": 2, - "LastModified": "2025-11-27T21:06:17.8971982+01:00", + "LastModified": "2025-11-28T20:21:37.3160306+01:00", "LastModifiedBy": "test1@test.de" }, { "Status": { "SetupModel": { - "$type": "TrainingSetupState", + "$type": "ShitSetupState", + "ShitNumber": 6, "DayId": 35, - "ThrowMode": 1, - "ThrowsPerRound": 4, + "ThrowMode": 0, + "ThrowsPerRound": 2147483647, "Participants": [ 5, 3, @@ -208,8 +167,8 @@ 12, 9 ], - "ParticipantsMode": 1, - "KnownGameType": "GameTraining" + "ParticipantsMode": 0, + "KnownGameType": "ShitGame" }, "ThrowPanelState": { "IsStated": true, @@ -223,9 +182,9 @@ "Pin7State": 0, "Pin8State": 0, "Pin9State": 0, - "ThrowsPerRound": 4, + "ThrowsPerRound": 2147483647, "ThrowCounterPerRound": 1, - "ThrowMode": 1, + "ThrowMode": 0, "ThrowPanelStateStatus": 1, "ThrowCounter": 0, "DayId": 35 @@ -240,69 +199,10 @@ ], "Eliminated": [] }, - "GameModel": { - "$type": "TrainingState", - "Throws": { - "5": { - "PlayerId": 5, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "3": { - "PlayerId": 3, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "10": { - "PlayerId": 10, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "12": { - "PlayerId": 12, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - }, - "9": { - "PlayerId": 9, - "TeamNr": 0, - "PinCount": 0, - "CircleCount": 0, - "SinkCount": 0, - "StrikeCount": 0, - "ClearedCount": 0, - "ThrowCount": 0, - "BellCount": 0 - } - } - } + "GameModel": null }, "Version": 1, - "LastModified": "2025-11-27T20:06:09.3170916Z", + "LastModified": "2025-11-28T19:21:26.4095956Z", "LastModifiedBy": "test1@test.de" } ],