c# - Anonymous enum type as class property -


Is it possible to create an anonymous type of public enum class?

I am running through a list of OOD scenarios and working on the original card game. Each game has a specific class with an enum of "PlayerActions", each class has its own unique value values, although after introducing player objects, I want each player to cross the game's Encom.

Is it possible or am I completely off-base?

  Public Sector Players Set action based on this game in which you are playing public Enum < T & gt; Actions {get; Set;} // Hold the deck of cards according to the rules of the game Public list & lt; Cards & gt; Hand {receives; Set;} receives the public bowel maturity; Set;} public player (game gametype) {hand = new list & lt; Cards & gt; (GameType.HandSize); Actions = game type Game action; IsTurn = false; } Public Zero Education Card (Card Card) {Hands. Add (card); }} Public angle gametype {Blackjack, TexasSailedEm} Public Intuitive Class Games {Public Enum & lt; T & gt; GAME Actions {get; Set;} public game type gametype {get; Set;} get the public card [river]; Set;} public player [] username {get} Set;} Public Dealer Dealer = New Dealer (); Public Ent Handsize {get; Set; }} Public Class Black Jack: Game {Private Enum Action (Hit, Street) Private Constant Hedges = 2; Private Constant Total Users = 5; Public Black Jack () {this.gameType = GameType.BlackJack; this. River = new card [arm sys]; this. User list = new player [total user]; this. GameAction = Action; }} Public Class Texas Holdem Em: Game {enum actions (hit, keep, fold, call, alline) public actions myActions {get; Set; } Public const int HANDSIZE = 3; Public const int TOTALUSERS = 7; Public Texsmith () {this.GameActions = Actions; This.gameType = GameType.BlackJack; this. River = new card [HANDSIZE]; this. User List = New Player [TOTALUSERS]; }}  

I think you want action Instead of declaring enum again for each class, the annum, for example, declare your Enan once out of the class and enter all the functions in it:

  enum action {hits   ARE and start it in your constructors: 

  Private actions [ ] GameAction; Public Black Jack () {this.GameActions = New [] {Action.Hit, Action.Stay}; This.gameType = GameType.BlackJack; this. River = new card [HANDSIZE]; this. User List = New Player [TOTALUSERS]; }  

You game action area read only ..


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -