jkomoros / boardgame

An in-progress framework in golang to easily build boardgame Progressive Web Apps
Apache License 2.0
31 stars 4 forks source link

Create EnumSlice property type #750

Open jkomoros opened 4 years ago

jkomoros commented 4 years ago

Related to #492.

Shouldn't be that hard now that code generation machinery has been refactored.

The one wrinkle: unlike all of the other slice types, our enum slices need to be able to say which enum they're associated with.

Maybe it's just a simple struct. The enum they're affiliated with, and then the slice of values. And in the same way PlayerIndex won't let state be saved if it's now invalid, EnumSlices won't let it be saved if the values are enum.Value not from the right set at the end.