fix game setup
This commit is contained in:
parent
304caa1d9e
commit
8aff1f5d48
|
|
@ -32,7 +32,14 @@
|
|||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0" Style="height: 76px;">
|
||||
<MudStack Spacing="0" Wrap="Wrap.Wrap">
|
||||
<MudChip T="string" Color="Color.Dark" Size="Size.Small">@(ThrowPanelSelectors.GetThrowModeName(ThrowPanelState.Value))</MudChip>
|
||||
<MudChip T="string" Color="Color.Dark" Size="Size.Small">Wurf @ThrowPanelState.Value.ThrowCounterPerRound von @ThrowPanelState.Value.ThrowsPerRound</MudChip>
|
||||
@if (@ThrowPanelState.Value.ThrowsPerRound == int.MaxValue)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Dark" Size="Size.Small">Wurf @ThrowPanelState.Value.ThrowCounterPerRound</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Color="Color.Dark" Size="Size.Small">Wurf @ThrowPanelState.Value.ThrowCounterPerRound von @ThrowPanelState.Value.ThrowsPerRound</MudChip>
|
||||
}
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,17 +6,24 @@
|
|||
|
||||
@implements ISetupControl
|
||||
|
||||
<h3>Setup</h3>
|
||||
|
||||
<MudItem>
|
||||
<MudNumericField @bind-Value="_shitNumber" Label="Scheiss-Zahl" HelperText="Bei welcher Zahl verliehrt man?" Min="1" Max="9"/>
|
||||
</MudItem>
|
||||
|
||||
@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
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ namespace KoogleApp.Services
|
|||
}
|
||||
services.AddSingleton<IDayRepository, DayRepository>();
|
||||
|
||||
services.AddTransient<GameTrainingService>(); // TODO: add all automatically
|
||||
|
||||
AddAllGameServices(services);
|
||||
|
||||
services.AddSingleton<IGameStatusDataService, GameStatusDataService>();
|
||||
services.AddSingleton<IGameServiceFactory, GameServiceFactory>();
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue