Пример #1
0
    void OnPlayerLeft(RPlayer p)
    {
        Title.text = "Chat - " + RasonManager.players.Count + " Player";
        string fullMsg = "\n" + p.name + " Left the room.";

        ChatText.text += fullMsg;
    }
Пример #2
0
    void GetMsg(string msg, int SenderID)
    {
        RPlayer sender  = RasonManager.GetPlayer(SenderID);
        string  fullMsg = "\n" + sender.name + " : " + msg;

        ChatText.text += fullMsg;
    }
Пример #3
0
 public void Intia(RPlayer i)
 {
     audioSource = GetComponent <AudioSource>();
     voice       = GetComponent <RVoice>();
     info        = i;
     tex.text    = info.name;
 }
Пример #4
0
        public void GameStart(int gameId, int playerId, int teamId, string trumpCard, int trumpCardPlayer, string[] cards, int floorId)
        {
            int playerID1 = _randomNumberGenerator.Next(1, 2);
            int playerID2 = ((playerID1 + 1) % 2);

            SuecaPub.GazeAtTarget("player" + playerID1);
            if (playerId == _id)
            {
                _initialyzing = true;

                _teamId               = teamId;
                _currentGameId        = gameId;
                _currentTrickId       = 0;
                _currentPlayInTrickId = 0;

                if (gameId != 0)
                {
                    //Console.WriteLine("next games");
                    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.AddPropertyChange(Consts.DIALOGUE_FLOOR_PROPERTY, floorId.ToString(), Consts.DEFAULT_SUBJECT);
                    ev.ChangeTagsAndMeanings(new string[] { "|playerID1|", "|playerID2|" }, new string[] { playerID1.ToString(), playerID2.ToString() });
                    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);

                if (_nameId == 1)
                {
                    _ai = new RBOPlayer(playerId, initialCards, myTrumpCard, trumpCardPlayer);
                }
                else if (_nameId == 2)
                {
                    _ai = new RKOPlayer(playerId, initialCards, myTrumpCard, trumpCardPlayer);
                }
                Console.WriteLine("MY NAME IS {0}.", _nameId);
                _initialyzing = false;
            }
        }
Пример #5
0
        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;
            }


            _randomNumberGenerator = new Random(System.Guid.NewGuid().GetHashCode());
            SetPublisher <ISuecaPublisher>();
            SuecaPub      = new SuecaPublisher(Publisher);
            _ai           = null;
            _suecaRPC     = new SuecaRolePlayCharacter(_nameId, agentType, scenarioPath, this);
            _initialyzing = false;
            _agentType    = agentType;
            numRobots     = 1; //default
        }