Пример #1
0
 private void parseOpponent()
 {
     String[] tmp = msg[0].Split(':');
     while (!(tmp[0].Equals("end") && tmp[1].Equals("opponent")))
     {
         tmp = msg[0].Split(':');
         if (tmp[0].Equals("id"))
         {
             this.id = Int32.Parse(tmp[1]);
             msg.RemoveAt(0);
             tmp = msg[0].Split(':');
             if (tmp[0].Equals("decision"))
             {
                 this.decision = tmp[1];
                 msg.RemoveAt(0);
                 tmp = msg[0].Split(':');
                 if (tmp[0].Equals("points"))
                 {
                     this.points = Int32.Parse(tmp[1]);
                     msg.RemoveAt(0);
                     tmp = msg[0].Split(':');
                     if (tmp[0].Equals("total"))
                     {
                         this.total = Int32.Parse(tmp[1]);
                         msg.RemoveAt(0);
                         tmp = msg[0].Split(':');
                         if (tmp[0].Equals("end") && tmp[1].Equals("opponent"))
                         {
                             Opponent o = new Opponent(id, decision, points, total);
                             clearVars();
                         }
                         else
                         {
                             throw new Exception("NO OPPONENT");
                         }
                     }
                 }
             }
         }
         else
         {
             throw new Exception("NO OPPONENT");
         }
     }
 }
Пример #2
0
 public Skirmish(Opponent opponent, Boolean isAccepted)
     : base(opponent, isAccepted, "Skirmish")
 {
 }
Пример #3
0
 public Dragonhunt(Int32 id, Player player, Opponent opponent, Boolean isAccepted)
     : base(opponent, isAccepted, "Dragonhunt")
 {
 }
Пример #4
0
        //instead Opponent just int id ??

        public Challenge(Opponent opponent, Boolean isAccepted, String type)
        {
            this.opponentId = opponent;
            this.isAccepted = isAccepted;
            this.type       = type;
        }
Пример #5
0
 public Staghunt(Opponent opponent, Boolean isAccepted)
     : base(opponent, isAccepted, "Staghunt")
 {
 }