Esempio n. 1
0
 protected override void SuccessAction()
 {
     try {
         bool val;
         var  moves =
             tas.MyBattle.Users.Where(x => x.Name != tas.MyBattle.Founder.Name)
             .Where(x => !userVotes.TryGetValue(x.Name, out val) || val)
             .Select(x => new MovePlayerEntry()
         {
             BattleHost = host, PlayerName = x.Name
         })
             .ToArray();    // move all that didnt vote "no"
         var serv = new SpringieService();
         serv.MovePlayers(tas.UserName, tas.UserPassword, moves.ToArray());
     } catch (Exception ex) {
         ah.SayBattle(ex.ToString());
     }
 }
Esempio n. 2
0
        public override void End()
        {
            bool val;

            try {
                var moves =
                    tas.MyBattle.Users.Where(x => x.Name != tas.MyBattle.Founder.Name)
                    .Where(x => userVotes.TryGetValue(x.Name, out val) && val)
                    .Select(x => new MovePlayerEntry()
                {
                    BattleHost = host, PlayerName = x.Name
                })
                    .ToArray();    // move those that voted yes if there are at least 2
                if (moves.Length > 1)
                {
                    var serv = new SpringieService();
                    serv.MovePlayers(tas.UserName, tas.UserPassword, moves.ToArray());
                }
            } catch (Exception ex) {
                ah.SayBattle(ex.ToString());
            }

            base.End();
        }