コード例 #1
0
 public void SetEfficiencyScore(IBattleAttribute battle, IWrittenByAttribute writtenBy, double efficiencyScore)
 {
     if (HasBattle(battle))
     {
         IBattleOutcome battleOutcome = GetBattleOutcome(battle);
         //battleOutcome.SetEfficiencyScore(writtenBy, efficiencyScore);
     }
 }
コード例 #2
0
        public IBattleOutcome CurrentBattle()
        {
            List <IBattleOutcome> battleOutcomes = GetAllBattleOutcomes();
            DateTime       max     = battleOutcomes.Max((battle) => battle.Battle.Deadline);
            IBattleOutcome current = battleOutcomes.Where((battle) => battle.Battle.Deadline == max).FirstOrDefault();

            //IBattleOutcome current = battleOutcomes.Where((battle) => battle.Battle.Name == "Census Maximus").FirstOrDefault();

            return(current);
        }
コード例 #3
0
 public void CreateBattle(IBattleAttribute battle, ISenseiAttribute sensei)
 {
     if (!HasBattle(battle))
     {
         IBattleOutcome battleOutcome = Factory.Get <IBattleOutcome>();
         battleOutcome.Battle = battle;
         battleOutcome.Sensei = sensei;
         battles.Add(battleOutcome);
     }
 }
コード例 #4
0
 public void AssignAwardToPlayer(IWrittenByAttribute player, IBattleAttribute battle, IBonusPointsAttribute award)
 {
     if (HasBattle(battle))
     {
         IBattleOutcome battleOutcome = GetBattleOutcome(battle);
         battleOutcome.AddAward(player, award);
     }
     else
     {
         IBattleOutcome battleOutcome = Factory.Get <IBattleOutcome>();
         battleOutcome.Battle = battle;
         battleOutcome.AddAward(player, award);
         battles.Add(battleOutcome);
     }
 }
コード例 #5
0
 public void GrantPointsToPlayer(IBattleAttribute battle, IWrittenByAttribute writtenBy, int points = 1)
 {
     if (HasBattle(battle))
     {
         IBattleOutcome battleOutcome = GetBattleOutcome(battle);
         battleOutcome.AddPoint(writtenBy, points);
     }
     else
     {
         IBattleOutcome battleResults = Factory.Get <IBattleOutcome>();
         battleResults.Battle = battle;
         battleResults.AddPoint(writtenBy, points);
         battles.Add(battleResults);
     }
 }
コード例 #6
0
        public int CompareTo(IBattleOutcome other)
        {
            DateTime thisDeadline  = Battle.Deadline;
            DateTime otherDeadline = other.Battle.Deadline;

            int result = 0;

            if (thisDeadline > otherDeadline)
            {
                result = -1;
            }
            else if (thisDeadline < otherDeadline)
            {
                result = 1;
            }

            return(result);
        }
コード例 #7
0
        public IBattleOutcome GetBattleOutcome(IBattleAttribute battle)
        {
            IBattleOutcome results = battles.Where((x) => x.Battle.Equals(battle))?.FirstOrDefault();

            return(results);
        }
コード例 #8
0
        public HttpResponseMessage Get()
        {
            IBattleOutcome battle = battleRepository.CurrentBattle();

            return(Request.CreateResponse(HttpStatusCode.OK, battle));
        }
コード例 #9
0
        public IBattleOutcome GetMostRecentBattle()
        {
            IBattleOutcome battle = battleRepository.CurrentBattle();

            return(battle);
        }