コード例 #1
0
        public Attack[] GetFullAttackForGame(Guid gameId)
        {
            List <Attack> attacks = new List <Attack>();

            DbAttack[] dbAttacks = GetAttacksForGame(gameId);
            foreach (DbAttack a in dbAttacks)
            {
                EZoneFunction function = a.IsOpponentAttack ? EZoneFunction.Defence : EZoneFunction.Attack;


                Attack attack = new Attack(function, a.ZoneStartFunction, gameId, a.IsFirstHalf);

                // get shots
                attack.Shots = myDbConnection.Table <DbAttackShot>().Where(s => s.AttackId == a.Id).ToList();
                // get rebounds
                attack.Rebounds = myDbConnection.Table <DbAttackRebound>().Where(r => r.AttackId == a.Id).ToList();
                //
                if (a.GoalId != Guid.Empty)
                {
                    attack.Goal = myDbConnection.Table <DbAttackGoal>().FirstOrDefault(g => g.Id == a.GoalId);
                }
                attack.DbAttack = a;
                attacks.Add(attack);
            }
            return(attacks.ToArray());
        }
コード例 #2
0
 private void Init(EZoneFunction function, string startingZoneFunction, Guid gameId, bool isFirstHalf)
 {
     DbAttack.IsOpponentAttack  = function == EZoneFunction.Defence ? true : false;
     DbAttack.ZoneStartFunction = startingZoneFunction;
     DbAttack.Id          = Guid.NewGuid();
     DbAttack.GameId      = gameId;
     DbAttack.IsFirstHalf = isFirstHalf;
 }
コード例 #3
0
        public List <Attack> GetAttacksByGameId(Guid gameId, EZoneFunction zoneFilter)
        {
            List <Attack> attacks = new List <Attack>(myGameDbManager.GetFullAttackForGame(gameId));

            if (zoneFilter == EZoneFunction.None)
            {
                return(attacks);
            }
            string zoneStartFunctionFilter = zoneFilter == EZoneFunction.Attack ? "A" : "D";

            return(attacks.Where(a => a.DbAttack.ZoneStartFunction.Equals(zoneStartFunctionFilter)).ToList());
        }
コード例 #4
0
        public Attack(EZoneFunction function, EZoneFunction startingZoneFunction, Guid gameId, bool isFirstHalf)
        {
            string startingFunction = startingZoneFunction == EZoneFunction.Attack ? "A" : "D";

            Init(function, startingFunction, gameId, isFirstHalf);
        }
コード例 #5
0
 public Attack(EZoneFunction function, string startingZoneFunction, Guid gameId, bool isFirstHalf)
 {
     Init(function, startingZoneFunction, gameId, isFirstHalf);
 }