Example #1
0
 public Client(string serverUrl)
 {
     _serverUrl   = serverUrl;
     _myCaptain   = new MyCaptain();
     _transmitter = new HttpTransmitter();
     _listener    = new HttpListenerClass(3);
 }
Example #2
0
        public IEnumerable <Placement> GetPlacements(IEnumerable <Clazz> classes)
        {
            var data = new HttpTransmitter().SendMessage(_connectedPlayer.Url, "getplacements", new PlacementRequest
            {
                Classes = classes.Select(c => c.Name)
            });

            return(JsonConvert.DeserializeObject <IEnumerable <Placement> >(data));
        }
Example #3
0
        public IEnumerable <Shot> GetShots(IEnumerable <EnemyFleetInfo> enemyFleetInfo, int numberOfShots)
        {
            var data = new HttpTransmitter().SendMessage(_connectedPlayer.Url, "getshots", new ShotRequest
            {
                NumberOfShots = numberOfShots,
                EnemyFleets   = enemyFleetInfo
            });

            return(JsonConvert.DeserializeObject <IEnumerable <Shot> >(data));
        }
Example #4
0
 public void EndRound(RoundEndNotification roundEndNotification)
 {
     var data = new HttpTransmitter().SendMessage(_connectedPlayer.Url, "endround", roundEndNotification);
 }
Example #5
0
 public void EndGame(GameEndNotification gameEndNotification)
 {
     var data = new HttpTransmitter().SendMessage(_connectedPlayer.Url, "endgame", gameEndNotification);
 }
Example #6
0
 public void NotifyOfBeingHit(IEnumerable <HitNotification> hits)
 {
     var data = new HttpTransmitter().SendMessage(_connectedPlayer.Url, "hitnotification", hits);
 }
Example #7
0
 public void StartGame(GameStartNotification gameStartNotification)
 {
     var data = new HttpTransmitter().SendMessage(_connectedPlayer.Url, "startgame", gameStartNotification);
 }
Example #8
0
 public void RespondToShots(IEnumerable <ShotResult> results)
 {
     var data = new HttpTransmitter().SendMessage(_connectedPlayer.Url, "shotresult", results);
 }