KoogleApp/KoogleApp/Store/Game/Participants/Reducers.cs

45 lines
1.3 KiB
C#

using Fluxor;
using KoogleApp.Store.Game.Setup;
using KoogleApp.Store.Game.ThrowPanel;
namespace KoogleApp.Store.Game.Participants
{
public static class ParticipantsStateReducer
{
[ReducerMethod]
public static ParticipantsState OnSetThrowsPerRoundAction(ParticipantsState state,
SetParticipatingPlayersAction action)
{
return state with
{
PlayerIds = action.PlayerIds
};
}
[ReducerMethod]
public static ParticipantsState OnParticipantsState(ParticipantsState state, ParticipantsStateLoadedAction action)
{
return action.ParticipantsState;
}
//[ReducerMethod]
//public static ParticipantsState OnSelectedPlayerChangedAction(ParticipantsState state, SelectedPlayerChangedAction action)
//{
// var lst = state.PlayerIds.ToList();
// lst.Remove(action.NewId);
// lst.Insert(0,action.NewId);
// return state with
// {
// PlayerIds = lst.ToArray()
// };
//}
[ReducerMethod]
public static ParticipantsState OnUpdateStateAfterUndoRedo(ParticipantsState state, UpdateStateAfterUndoRedo action)
{
return action.ParticipantsState;
}
}
}