Ejemplo n.º 1
0
 public static int HitCount(this IPlayerResult player)
 {
     Contract.Requires <ArgumentNullException>(player != null);
     if (player.HitTimes == null)
     {
         return(0);
     }
     return(player.HitTimes.Count());
 }
Ejemplo n.º 2
0
 public static int Dora(this IPlayerResult player)
 {
     Contract.Requires <ArgumentNullException>(player != null);
     if (player.KillTimes == null || player.DieTimes == null)
     {
         return(0);
     }
     return(player.KillTimes.Count() - player.DieTimes.Count());
 }
Ejemplo n.º 3
0
 public static double HitRate(this IPlayerResult player)
 {
     Contract.Requires <ArgumentNullException>(player != null);
     if (player.HitTimes == null || player.ShotTimes == null)
     {
         return(0);
     }
     return(Math.Round(((double)player.HitTimes.Count() / (double)player.ShotTimes.Count() * 100), 1));
 }
Ejemplo n.º 4
0
        public static string RawName(this IPlayerResult player)
        {
            Contract.Requires <ArgumentNullException>(player != null);
            Contract.Ensures(Contract.Result <string>() != null);

            if (player.Name == null)
            {
                return("");
            }

            string name  = player.Name;
            var    match = rawNameRegex.Match(name);

            if (match.Success)
            {
                name = match.Groups[1].ToString();
            }

            return(name);
        }