Example #1
0
 public PhaseDto(PhaseData phaseData, List <PhaseData> phases, ParsedLog log)
 {
     Name     = phaseData.Name;
     Duration = phaseData.DurationInMS;
     Start    = phaseData.Start / 1000.0;
     End      = phaseData.End / 1000.0;
     foreach (Target target in phaseData.Targets)
     {
         Targets.Add(log.FightData.Logic.Targets.IndexOf(target));
     }
     PlayerActiveTimes = new List <long>();
     foreach (Player p in log.PlayerList)
     {
         PlayerActiveTimes.Add(phaseData.GetPlayerActiveDuration(p, log));
     }
     // add phase markup
     MarkupLines = new List <double>();
     MarkupAreas = new List <AreaLabelDto>();
     for (int j = 1; j < phases.Count; j++)
     {
         PhaseData curPhase = phases[j];
         if (curPhase.Start < phaseData.Start || curPhase.End > phaseData.End ||
             (curPhase.Start == phaseData.Start && curPhase.End == phaseData.End))
         {
             continue;
         }
         if (SubPhases == null)
         {
             SubPhases = new List <int>();
         }
         SubPhases.Add(j);
         long start = curPhase.Start - phaseData.Start;
         long end   = curPhase.End - phaseData.Start;
         if (curPhase.DrawStart)
         {
             MarkupLines.Add(start / 1000.0);
         }
         if (curPhase.DrawEnd)
         {
             MarkupLines.Add(end / 1000.0);
         }
         AreaLabelDto phaseArea = new AreaLabelDto
         {
             Start     = start / 1000.0,
             End       = end / 1000.0,
             Label     = curPhase.Name,
             Highlight = curPhase.DrawArea
         };
         MarkupAreas.Add(phaseArea);
     }
     if (MarkupAreas.Count == 0)
     {
         MarkupAreas = null;
     }
     if (MarkupLines.Count == 0)
     {
         MarkupLines = null;
     }
 }