replaced pinvalue by pinstatus
This commit is contained in:
parent
b9758b0497
commit
91bc5b6b68
|
|
@ -23,8 +23,8 @@
|
|||
<MudItem xs="12">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin1Value)"
|
||||
DisabledSelector="@(state => state.Pin1Disabled)"
|
||||
ValueSelector="@(state => state.Pin1State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin1State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,1)))" />
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
|
@ -34,16 +34,16 @@
|
|||
<MudItem xs="6">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin2Value)"
|
||||
DisabledSelector="@(state => state.Pin2Disabled)"
|
||||
ValueSelector="@(state => state.Pin2State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin2State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,2)))"/>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="6">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin3Value)"
|
||||
DisabledSelector="@(state => state.Pin3Disabled)"
|
||||
ValueSelector="@(state => state.Pin3State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin3State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,3)))"/>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
|
@ -53,24 +53,24 @@
|
|||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin4Value)"
|
||||
DisabledSelector="@(state => state.Pin4Disabled)"
|
||||
ValueSelector="@(state => state.Pin4State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin4State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,4)))"/>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin5Value)"
|
||||
DisabledSelector="@(state => state.Pin5Disabled)"
|
||||
ValueSelector="@(state => state.Pin5State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin5State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,5)))" />
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="4">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin6Value)"
|
||||
DisabledSelector="@(state => state.Pin6Disabled)"
|
||||
ValueSelector="@(state => state.Pin6State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin6State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,6)))"/>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
|
@ -80,16 +80,16 @@
|
|||
<MudItem xs="6">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin7Value)"
|
||||
DisabledSelector="@(state => state.Pin7Disabled)"
|
||||
ValueSelector="@(state => state.Pin7State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin7State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,7)))"/>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="6">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin8Value)"
|
||||
DisabledSelector="@(state => state.Pin8Disabled)"
|
||||
ValueSelector="@(state => state.Pin8State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin8State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,8)))" />
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
|
@ -98,8 +98,8 @@
|
|||
<MudItem xs="12">
|
||||
<MudPaper Class="d-flex align-center justify-center mud-width-full py-0">
|
||||
<Pin TState="ThrowPanelState"
|
||||
ValueSelector="@(state => state.Pin9Value)"
|
||||
DisabledSelector="@(state => state.Pin9Disabled)"
|
||||
ValueSelector="@(state => state.Pin9State == PinStatus.Fallen)"
|
||||
DisabledSelector="@(state => state.Pin9State == PinStatus.Disabled)"
|
||||
OnToggle="@(value => Dispatcher.Dispatch(new TogglePinValueAction(value,9)))" />
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
|
@ -107,99 +107,5 @@
|
|||
}
|
||||
|
||||
@code {
|
||||
// [Parameter]
|
||||
// public ThrowPanelState? ThrowPanelState { get; set; }
|
||||
|
||||
// [Parameter]
|
||||
// public EventCallback<ThrowPanelState> OnStateChanged { get; set; }
|
||||
|
||||
// Pin<ThrowPanelState>? _pin1;
|
||||
// Pin<ThrowPanelState>? _pin2;
|
||||
// Pin<ThrowPanelState>? _pin3;
|
||||
// Pin<ThrowPanelState>? _pin4;
|
||||
// Pin<ThrowPanelState>? _pin5;
|
||||
// Pin<ThrowPanelState>? _pin6;
|
||||
// Pin<ThrowPanelState>? _pin7;
|
||||
// Pin<ThrowPanelState>? _pin8;
|
||||
// Pin<ThrowPanelState>? _pin9;
|
||||
|
||||
|
||||
// readonly List<Pin<ThrowPanelState>> _pins = [];
|
||||
|
||||
// protected override void OnInitialized()
|
||||
// {
|
||||
// EventAggregator.Subscribe(this);
|
||||
// base.OnInitialized();
|
||||
// }
|
||||
|
||||
// public void Dispose()
|
||||
// {
|
||||
// EventAggregator.Unsubscribe(this);
|
||||
// }
|
||||
|
||||
// protected override void OnAfterRender(bool firstRender)
|
||||
// {
|
||||
// if (firstRender)
|
||||
// {
|
||||
// if (ThrowPanelState != null)
|
||||
// {
|
||||
// _pins.Clear();
|
||||
// _pins.Add(_pin9);
|
||||
// _pins.Add(_pin8);
|
||||
// _pins.Add(_pin7);
|
||||
// _pins.Add(_pin6);
|
||||
// _pins.Add(_pin5);
|
||||
// _pins.Add(_pin4);
|
||||
// _pins.Add(_pin3);
|
||||
// _pins.Add(_pin2);
|
||||
// _pins.Add(_pin1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// public async Task HandleAsync(NumberPanelMessage message)
|
||||
// {
|
||||
// var chgCnt = 0;
|
||||
// foreach (var pin in _pins)
|
||||
// {
|
||||
// var nr = _pins.IndexOf(pin) + 1;
|
||||
// if (!pin.Disabled)
|
||||
// {
|
||||
// pin.Value = chgCnt < message.Number;
|
||||
// chgCnt++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
// }
|
||||
|
||||
// public void UpdatePanelState(ThrowPanelState state)
|
||||
// {
|
||||
// _pin1.Value = state.Pin1Value;
|
||||
// _pin2.Value = state.Pin2Value;
|
||||
// }
|
||||
|
||||
// private void OnPinStateChanged(bool value)
|
||||
// {
|
||||
// // OnStateChanged.InvokeAsync(ThrowPanelState);
|
||||
// }
|
||||
|
||||
// public async Task HandleAsync(PinToggleMessage message)
|
||||
// {
|
||||
// foreach (var pin in _pins)
|
||||
// {
|
||||
// if (!pin.Disabled)
|
||||
// {
|
||||
// pin.Value = !pin.Value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // if (!ThrowPanelState.Pin1Disabled)
|
||||
// // {
|
||||
// // ThrowPanelState.Pin1Value = !ThrowPanelState.Pin1Value;
|
||||
// // }
|
||||
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,23 +16,59 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
switch (action.PinNumber)
|
||||
{
|
||||
case 1:
|
||||
return state with { Pin1Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin1State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 2:
|
||||
return state with { Pin2Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin2State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 3:
|
||||
return state with { Pin3Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin3State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 4:
|
||||
return state with { Pin4Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin4State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 5:
|
||||
return state with { Pin5Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin5State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 6:
|
||||
return state with { Pin6Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin6State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 7:
|
||||
return state with { Pin7Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin7State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 8:
|
||||
return state with { Pin8Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin8State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
case 9:
|
||||
return state with { Pin9Value = action.IsOn, ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow };
|
||||
return state with
|
||||
{
|
||||
Pin9State = action.IsOn ? PinStatus.Fallen : PinStatus.Standing,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
}
|
||||
|
||||
return state;
|
||||
|
|
@ -66,47 +102,45 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
[ReducerMethod]
|
||||
public static ThrowPanelState OnToggleAllPins(ThrowPanelState state, ToggleAllPinsAction action)
|
||||
{
|
||||
var _pins = new List<PinState>
|
||||
var pins = new List<PinState>
|
||||
{
|
||||
new(state.Pin9Value, state.Pin9Disabled),
|
||||
new(state.Pin8Value, state.Pin8Disabled),
|
||||
new(state.Pin7Value, state.Pin7Disabled),
|
||||
new(state.Pin6Value, state.Pin6Disabled),
|
||||
new(state.Pin5Value, state.Pin5Disabled),
|
||||
new(state.Pin4Value, state.Pin4Disabled),
|
||||
new(state.Pin3Value, state.Pin3Disabled),
|
||||
new(state.Pin2Value, state.Pin2Disabled),
|
||||
new(state.Pin1Value, state.Pin1Disabled),
|
||||
new(state.Pin9State),
|
||||
new(state.Pin8State),
|
||||
new(state.Pin7State),
|
||||
new(state.Pin6State),
|
||||
new(state.Pin5State),
|
||||
new(state.Pin4State),
|
||||
new(state.Pin3State),
|
||||
new(state.Pin2State),
|
||||
new(state.Pin1State),
|
||||
};
|
||||
|
||||
foreach (var pin in _pins)
|
||||
foreach (var pin in pins)
|
||||
{
|
||||
var nr = _pins.IndexOf(pin) + 1;
|
||||
if (!pin.Disabled)
|
||||
if (pin.PinStatus != PinStatus.Disabled)
|
||||
{
|
||||
pin.Value = !pin.Value;
|
||||
pin.PinStatus = pin.PinStatus == PinStatus.Standing ? PinStatus.Fallen : PinStatus.Standing;
|
||||
}
|
||||
}
|
||||
|
||||
return state with
|
||||
{
|
||||
Pin1Value = _pins[8].Value,
|
||||
Pin2Value = _pins[7].Value,
|
||||
Pin3Value = _pins[6].Value,
|
||||
Pin4Value = _pins[5].Value,
|
||||
Pin5Value = _pins[4].Value,
|
||||
Pin6Value = _pins[3].Value,
|
||||
Pin7Value = _pins[2].Value,
|
||||
Pin8Value = _pins[1].Value,
|
||||
Pin9Value = _pins[0].Value,
|
||||
Pin1State = pins[8].PinStatus,
|
||||
Pin2State = pins[7].PinStatus,
|
||||
Pin3State = pins[6].PinStatus,
|
||||
Pin4State = pins[5].PinStatus,
|
||||
Pin5State = pins[4].PinStatus,
|
||||
Pin6State = pins[3].PinStatus,
|
||||
Pin7State = pins[2].PinStatus,
|
||||
Pin8State = pins[1].PinStatus,
|
||||
Pin9State = pins[0].PinStatus,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
}
|
||||
|
||||
class PinState(bool value, bool disabled)
|
||||
class PinState(PinStatus pinStatus)
|
||||
{
|
||||
public bool Disabled { get; set; } = disabled;
|
||||
public bool Value { get; set; } = value;
|
||||
public PinStatus PinStatus { get; set; } = pinStatus;
|
||||
}
|
||||
|
||||
[ReducerMethod]
|
||||
|
|
@ -114,40 +148,46 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
{
|
||||
var chgCnt = 0;
|
||||
|
||||
var _pins = new List<PinState>
|
||||
var pins = new List<PinState>
|
||||
{
|
||||
new(state.Pin1Value, state.Pin1Disabled),
|
||||
new(state.Pin2Value, state.Pin2Disabled),
|
||||
new(state.Pin3Value, state.Pin3Disabled),
|
||||
new(state.Pin4Value, state.Pin4Disabled),
|
||||
new(state.Pin5Value, state.Pin5Disabled),
|
||||
new(state.Pin6Value, state.Pin6Disabled),
|
||||
new(state.Pin7Value, state.Pin7Disabled),
|
||||
new(state.Pin8Value, state.Pin8Disabled),
|
||||
new(state.Pin9Value, state.Pin9Disabled),
|
||||
new(state.Pin1State),
|
||||
new(state.Pin2State),
|
||||
new(state.Pin3State),
|
||||
new(state.Pin4State),
|
||||
new(state.Pin5State),
|
||||
new(state.Pin6State),
|
||||
new(state.Pin7State),
|
||||
new(state.Pin8State),
|
||||
new(state.Pin9State),
|
||||
};
|
||||
|
||||
foreach (var pin in _pins)
|
||||
foreach (var pin in pins)
|
||||
{
|
||||
var nr = _pins.IndexOf(pin) + 1;
|
||||
if (!pin.Disabled)
|
||||
//var nr = pins.IndexOf(pin) + 1;
|
||||
//if (!pin.Disabled)
|
||||
//{
|
||||
// pin.Value = chgCnt < action.Number;
|
||||
// chgCnt++;
|
||||
//}
|
||||
|
||||
if (pin.PinStatus != PinStatus.Disabled)
|
||||
{
|
||||
pin.Value = chgCnt < action.Number;
|
||||
pin.PinStatus = chgCnt < action.Number ? PinStatus.Fallen : PinStatus.Standing;
|
||||
chgCnt++;
|
||||
}
|
||||
}
|
||||
|
||||
return state with
|
||||
{
|
||||
Pin1Value = _pins[8].Value,
|
||||
Pin2Value = _pins[7].Value,
|
||||
Pin3Value = _pins[6].Value,
|
||||
Pin4Value = _pins[5].Value,
|
||||
Pin5Value = _pins[4].Value,
|
||||
Pin6Value = _pins[3].Value,
|
||||
Pin7Value = _pins[2].Value,
|
||||
Pin8Value = _pins[1].Value,
|
||||
Pin9Value = _pins[0].Value,
|
||||
Pin1State = pins[8].PinStatus,
|
||||
Pin2State = pins[7].PinStatus,
|
||||
Pin3State = pins[6].PinStatus,
|
||||
Pin4State = pins[5].PinStatus,
|
||||
Pin5State = pins[4].PinStatus,
|
||||
Pin6State = pins[3].PinStatus,
|
||||
Pin7State = pins[2].PinStatus,
|
||||
Pin8State = pins[1].PinStatus,
|
||||
Pin9State = pins[0].PinStatus,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.BeforeThrow
|
||||
};
|
||||
}
|
||||
|
|
@ -190,18 +230,17 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
|
||||
var _pins = new List<PinState>
|
||||
{
|
||||
new(state.Pin9Value, state.Pin9Disabled),
|
||||
new(state.Pin8Value, state.Pin8Disabled),
|
||||
new(state.Pin7Value, state.Pin7Disabled),
|
||||
new(state.Pin6Value, state.Pin6Disabled),
|
||||
new(state.Pin5Value, state.Pin5Disabled),
|
||||
new(state.Pin4Value, state.Pin4Disabled),
|
||||
new(state.Pin3Value, state.Pin3Disabled),
|
||||
new(state.Pin2Value, state.Pin2Disabled),
|
||||
new(state.Pin1Value, state.Pin1Disabled),
|
||||
new(state.Pin9State), new(state.Pin8State),
|
||||
new(state.Pin7State),
|
||||
new(state.Pin6State),
|
||||
new(state.Pin5State),
|
||||
new(state.Pin4State),
|
||||
new(state.Pin3State),
|
||||
new(state.Pin2State),
|
||||
new( state.Pin1State),
|
||||
};
|
||||
|
||||
if (_pins.All(_ => _.Value)) // abgeräumt
|
||||
if (_pins.All(_ => _.PinStatus == PinStatus.Fallen)) // abgeräumt
|
||||
{
|
||||
reset = true;
|
||||
}
|
||||
|
|
@ -210,12 +249,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
{
|
||||
foreach (var pin in _pins)
|
||||
{
|
||||
var nr = _pins.IndexOf(pin) + 1;
|
||||
//if (!pin.Disabled)
|
||||
{
|
||||
pin.Value = false;
|
||||
pin.Disabled = false;
|
||||
}
|
||||
pin.PinStatus = PinStatus.Standing;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -225,9 +259,9 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
foreach (var pin in _pins)
|
||||
{
|
||||
var nr = _pins.IndexOf(pin) + 1;
|
||||
if (!pin.Disabled && pin.Value)
|
||||
if (pin.PinStatus != PinStatus.Disabled && pin.PinStatus == PinStatus.Fallen)
|
||||
{
|
||||
pin.Disabled = true;
|
||||
pin.PinStatus = PinStatus.Disabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -236,24 +270,15 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
|
||||
return state with
|
||||
{
|
||||
Pin1Value = _pins[8].Value,
|
||||
Pin1Disabled = _pins[8].Disabled,
|
||||
Pin2Value = _pins[7].Value,
|
||||
Pin2Disabled = _pins[7].Disabled,
|
||||
Pin3Value = _pins[6].Value,
|
||||
Pin3Disabled = _pins[6].Disabled,
|
||||
Pin4Value = _pins[5].Value,
|
||||
Pin4Disabled = _pins[5].Disabled,
|
||||
Pin5Value = _pins[4].Value,
|
||||
Pin5Disabled = _pins[4].Disabled,
|
||||
Pin6Value = _pins[3].Value,
|
||||
Pin6Disabled = _pins[3].Disabled,
|
||||
Pin7Value = _pins[2].Value,
|
||||
Pin7Disabled = _pins[2].Disabled,
|
||||
Pin8Value = _pins[1].Value,
|
||||
Pin8Disabled = _pins[1].Disabled,
|
||||
Pin9Value = _pins[0].Value,
|
||||
Pin9Disabled = _pins[0].Disabled,
|
||||
Pin1State = _pins[8].PinStatus,
|
||||
Pin2State = _pins[7].PinStatus,
|
||||
Pin3State = _pins[6].PinStatus,
|
||||
Pin4State = _pins[5].PinStatus,
|
||||
Pin5State = _pins[4].PinStatus,
|
||||
Pin6State = _pins[3].PinStatus,
|
||||
Pin7State = _pins[2].PinStatus,
|
||||
Pin8State = _pins[1].PinStatus,
|
||||
Pin9State = _pins[0].PinStatus,
|
||||
ThrowCounterPerRound = nextCounter,
|
||||
BellValue = false,
|
||||
ThrowPanelStateStatus = ThrowPanelStateStatus.AfterThrow,
|
||||
|
|
|
|||
|
|
@ -20,17 +20,22 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
GameEnd
|
||||
}
|
||||
|
||||
public enum PinStatus
|
||||
{
|
||||
Standing,
|
||||
Fallen,
|
||||
Disabled
|
||||
}
|
||||
|
||||
[FeatureState]
|
||||
public record ThrowPanelState(bool IsStated, bool BellValue,
|
||||
bool Pin1Value, bool Pin2Value, bool Pin3Value, bool Pin4Value, bool Pin5Value, bool Pin6Value, bool Pin7Value, bool Pin8Value, bool Pin9Value,
|
||||
bool Pin1Disabled, bool Pin2Disabled, bool Pin3Disabled, bool Pin4Disabled, bool Pin5Disabled, bool Pin6Disabled, bool Pin7Disabled, bool Pin8Disabled, bool Pin9Disabled,
|
||||
public record ThrowPanelState(bool IsStated, bool BellValue,
|
||||
PinStatus Pin1State, PinStatus Pin2State, PinStatus Pin3State, PinStatus Pin4State, PinStatus Pin5State, PinStatus Pin6State, PinStatus Pin7State, PinStatus Pin8State, PinStatus Pin9State,
|
||||
int ThrowsPerRound, int ThrowCounterPerRound, ThrowMode ThrowMode, ThrowPanelStateStatus ThrowPanelStateStatus, int ThrowCounter)
|
||||
{
|
||||
// Required for creating initial state
|
||||
public ThrowPanelState() : this(BellValue:false, IsStated:false,
|
||||
Pin1Value:false, Pin2Value:false, Pin3Value: false, Pin4Value: false, Pin5Value: false, Pin6Value: false, Pin7Value: false, Pin8Value: false, Pin9Value: false,
|
||||
Pin1Disabled:false, Pin2Disabled:false, Pin3Disabled: false, Pin4Disabled: false, Pin5Disabled: false, Pin6Disabled: false, Pin7Disabled: false, Pin8Disabled: false, Pin9Disabled: false,
|
||||
ThrowsPerRound : 3, ThrowCounterPerRound : 1, ThrowMode : ThrowMode.Reposition, ThrowPanelStateStatus: ThrowPanelStateStatus.Undefined, ThrowCounter:0
|
||||
public ThrowPanelState() : this(BellValue:false, IsStated:false,
|
||||
Pin1State : PinStatus.Standing, Pin2State: PinStatus.Standing, Pin3State: PinStatus.Standing, Pin4State: PinStatus.Standing, Pin5State: PinStatus.Standing, Pin6State: PinStatus.Standing, Pin7State: PinStatus.Standing, Pin8State: PinStatus.Standing, Pin9State: PinStatus.Standing,
|
||||
ThrowsPerRound : 3, ThrowCounterPerRound : 1, ThrowMode : ThrowMode.Reposition, ThrowPanelStateStatus: ThrowPanelStateStatus.Undefined, ThrowCounter:0
|
||||
)
|
||||
{ }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"IsStated": false,
|
||||
"BellValue": false,
|
||||
"Pin1Value": false,
|
||||
"Pin2Value": false,
|
||||
"Pin3Value": false,
|
||||
"Pin4Value": false,
|
||||
"Pin5Value": false,
|
||||
"Pin6Value": false,
|
||||
"Pin7Value": false,
|
||||
"Pin8Value": false,
|
||||
"Pin9Value": false,
|
||||
"Pin1Disabled": false,
|
||||
"Pin2Disabled": false,
|
||||
"Pin3Disabled": false,
|
||||
"Pin4Disabled": false,
|
||||
"Pin5Disabled": false,
|
||||
"Pin6Disabled": false,
|
||||
"Pin7Disabled": false,
|
||||
"Pin8Disabled": false,
|
||||
"Pin9Disabled": false,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 1,
|
||||
"ThrowMode": 0,
|
||||
"ThrowPanelStateStatus": 4,
|
||||
"ThrowCounter": 0
|
||||
}
|
||||
|
|
@ -0,0 +1,330 @@
|
|||
{
|
||||
"CurrentData": {
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 0,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 0,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 1,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 3,
|
||||
"ThrowCounter": 6
|
||||
}
|
||||
},
|
||||
"Version": 13,
|
||||
"LastModified": "2025-11-11T21:28:53.8441622+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
"UndoHistory": [
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 1,
|
||||
"Pin5State": 2,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 2,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 0,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 3,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2,
|
||||
"ThrowCounter": 5
|
||||
}
|
||||
},
|
||||
"Version": 12,
|
||||
"LastModified": "2025-11-11T21:28:53.8383228+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 2,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 2,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 0,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 3,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 3,
|
||||
"ThrowCounter": 5
|
||||
}
|
||||
},
|
||||
"Version": 11,
|
||||
"LastModified": "2025-11-11T21:28:51.9038117+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 1,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 1,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 0,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 2,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2,
|
||||
"ThrowCounter": 4
|
||||
}
|
||||
},
|
||||
"Version": 10,
|
||||
"LastModified": "2025-11-11T21:28:51.8982999+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 0,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 0,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 2,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 3,
|
||||
"ThrowCounter": 4
|
||||
}
|
||||
},
|
||||
"Version": 9,
|
||||
"LastModified": "2025-11-11T21:28:46.3878041+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 1,
|
||||
"Pin2State": 1,
|
||||
"Pin3State": 1,
|
||||
"Pin4State": 1,
|
||||
"Pin5State": 1,
|
||||
"Pin6State": 1,
|
||||
"Pin7State": 1,
|
||||
"Pin8State": 1,
|
||||
"Pin9State": 1,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 1,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2,
|
||||
"ThrowCounter": 3
|
||||
}
|
||||
},
|
||||
"Version": 8,
|
||||
"LastModified": "2025-11-11T21:28:46.3824896+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 0,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 0,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 1,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 3,
|
||||
"ThrowCounter": 3
|
||||
}
|
||||
},
|
||||
"Version": 7,
|
||||
"LastModified": "2025-11-11T21:28:43.6630774+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 1,
|
||||
"Pin2State": 2,
|
||||
"Pin3State": 1,
|
||||
"Pin4State": 2,
|
||||
"Pin5State": 1,
|
||||
"Pin6State": 1,
|
||||
"Pin7State": 2,
|
||||
"Pin8State": 1,
|
||||
"Pin9State": 2,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 3,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2,
|
||||
"ThrowCounter": 2
|
||||
}
|
||||
},
|
||||
"Version": 6,
|
||||
"LastModified": "2025-11-11T21:28:43.659034+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 2,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 2,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 2,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 2,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 3,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 3,
|
||||
"ThrowCounter": 2
|
||||
}
|
||||
},
|
||||
"Version": 5,
|
||||
"LastModified": "2025-11-11T21:28:41.8730592+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 1,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 1,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 1,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 2,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 2,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2,
|
||||
"ThrowCounter": 1
|
||||
}
|
||||
},
|
||||
"Version": 4,
|
||||
"LastModified": "2025-11-11T21:28:41.8621437+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 0,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 2,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 2,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 3,
|
||||
"ThrowCounter": 1
|
||||
}
|
||||
},
|
||||
"Version": 3,
|
||||
"LastModified": "2025-11-11T21:28:37.9622236+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 0,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 1,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 1,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 2,
|
||||
"ThrowCounter": 0
|
||||
}
|
||||
},
|
||||
"Version": 2,
|
||||
"LastModified": "2025-11-11T21:28:37.9354506+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
},
|
||||
{
|
||||
"Status": {
|
||||
"ThrowPanelState": {
|
||||
"IsStated": true,
|
||||
"BellValue": false,
|
||||
"Pin1State": 0,
|
||||
"Pin2State": 0,
|
||||
"Pin3State": 0,
|
||||
"Pin4State": 0,
|
||||
"Pin5State": 0,
|
||||
"Pin6State": 0,
|
||||
"Pin7State": 0,
|
||||
"Pin8State": 0,
|
||||
"Pin9State": 0,
|
||||
"ThrowsPerRound": 3,
|
||||
"ThrowCounterPerRound": 1,
|
||||
"ThrowMode": 1,
|
||||
"ThrowPanelStateStatus": 1,
|
||||
"ThrowCounter": 0
|
||||
}
|
||||
},
|
||||
"Version": 1,
|
||||
"LastModified": "2025-11-11T21:28:35.0126704+01:00",
|
||||
"LastModifiedBy": "test1@test.de"
|
||||
}
|
||||
],
|
||||
"RedoHistory": []
|
||||
}
|
||||
Loading…
Reference in New Issue