Esempio n. 1
0
        protected override void OnCarInfo(MsgCarInfo msg)
        {
            //using (var a = new FileStream("Test.txt", FileMode.Append, FileAccess.Write))
            //using (var b = new StreamWriter(a))
            //{
            //    b.WriteLine($"{DateTime.Now.TimeOfDay}: OnCarInfo Called {msg.CarId}");
            //}

            if (Competitors.Any(driver => driver.DriverGuid == msg.DriverGuid && driver.IsConnected == true) || string.IsNullOrEmpty(msg.DriverGuid))
            {
                return;
            }


            var competitor = new Competitor
            {
                CompetitorId = Guid.NewGuid().ToString(),
                SessionId    = CurrentSession.SessionId,
                CarId        = msg.CarId,
                ConnectionId = msg.CarId,
                CarModel     = msg.CarModel,
                CarSkin      = msg.CarSkin,
                DriverName   = msg.DriverName,
                DriverGuid   = msg.DriverGuid,
                IsConnected  = true
            };

            Competitors.Add(ApiWrapperNet4.Post <Competitor>("competitor/addcompetitor", competitor));
        }
Esempio n. 2
0
        public void Join(string login)
        {
            if (IsTakenPart(login))
            {
                throw new InvalidOperationException(string.Format("{0} is already taking part in this competition", login));
            }

            Competitors.Add(new Competitor(login));
        }
Esempio n. 3
0
        public override RaceWithFactory AddCompetitor(Transport.Transport transport)
        {
            if (transport.IsAir())
            {
                Competitors.Add(transport);
            }
            else
            {
                throw new AddTransportException();
            }

            return(this);
        }
Esempio n. 4
0
 public override RaceWithFactory AddCompetitor(Transport.Transport transport)
 {
     Competitors.Add(transport);
     return(this);
 }
 public void Add(Player player)
 {
     Competitors.Add(new Competitor {
         Player = player, Game = this
     });
 }