public void GameStart(int gameId, int playerId, int teamId, string trumpCard, int trumpCardPlayer, string[] cards) { _initialyzing = true; SuecaEvent ev = new SuecaEvent(Consts.STATE_GAME_START); _suecaRPC.AddSuecaEvent(ev); ev.AddPropertyChange(Consts.DIALOGUE_STATE_PROPERTY, Consts.STATE_GAME_START, Consts.DEFAULT_SUBJECT); ev.Finished = true; List <int> initialCards = new List <int>(); foreach (string cardSerialized in cards) { SuecaTypes.Card card = JsonSerializable.DeserializeFromJson <SuecaTypes.Card>(cardSerialized); SuecaSolver.Rank myRank = (SuecaSolver.Rank)Enum.Parse(typeof(SuecaSolver.Rank), card.Rank.ToString()); SuecaSolver.Suit mySuit = (SuecaSolver.Suit)Enum.Parse(typeof(SuecaSolver.Suit), card.Suit.ToString()); int myCard = SuecaSolver.Card.Create(myRank, mySuit); initialCards.Add(myCard); } SuecaTypes.Card sharedTrumpCard = JsonSerializable.DeserializeFromJson <SuecaTypes.Card>(trumpCard); SuecaSolver.Rank trumpRank = (SuecaSolver.Rank)Enum.Parse(typeof(SuecaSolver.Rank), sharedTrumpCard.Rank.ToString()); SuecaSolver.Suit trumpSuit = (SuecaSolver.Suit)Enum.Parse(typeof(SuecaSolver.Suit), sharedTrumpCard.Suit.ToString()); int myTrumpCard = SuecaSolver.Card.Create(trumpRank, trumpSuit); _ai = new RuleBasedPlayer(playerId, initialCards, myTrumpCard, trumpCardPlayer); _initialyzing = false; }
public EmotionalSuecaPlayer(string clientName, string scenarioPath, string agentType, string charactersNames = "") : base(clientName, charactersNames) { try { _nameId = Int16.Parse("" + clientName[clientName.Length - 1]); } catch (Exception) { _nameId = 1; } SetPublisher <ISuecaPublisher>(); SuecaPub = new SuecaPublisher(Publisher); _ai = null; _suecaRPC = new SuecaRolePlayCharacter(agentType, scenarioPath); _initialyzing = false; _robotHasPlayed = false; _agentType = agentType; }