private List <int[]> BuildBuffStates(BoonsGraphModel bgm) { if (bgm == null || bgm.BoonChart.Count == 0) { return(null); } List <int[]> res = bgm.BoonChart.Select(x => new int[2] { (int)x.Start, x.Value }).ToList(); return(res.Count > 0 ? res : null); }
public BoonChartDataDto(BoonsGraphModel bgm, List <BoonsGraphModel.Segment> bChart, PhaseData phase) { Id = bgm.Boon.ID; Visible = (bgm.Boon.Name == "Might" || bgm.Boon.Name == "Quickness" || bgm.Boon.Name == "Vulnerability"); Color = GeneralHelper.GetLink("Color-" + bgm.Boon.Name); States = new List <object[]>(bChart.Count + 1); foreach (BoonsGraphModel.Segment seg in bChart) { double segStart = Math.Round(Math.Max(seg.Start - phase.Start, 0) / 1000.0, GeneralHelper.TimeDigit); States.Add(new object[] { segStart, seg.Value }); } BoonsGraphModel.Segment lastSeg = bChart.Last(); double segEnd = Math.Round(Math.Min(lastSeg.End - phase.Start, phase.End - phase.Start) / 1000.0, GeneralHelper.TimeDigit); States.Add(new object[] { segEnd, lastSeg.Value }); }
private List <int[]> BuildBuffStates(BoonsGraphModel bgm) { if (bgm == null || bgm.BoonChart.Count == 0) { return(null); } List <int[]> res = new List <int[]>(); foreach (var seg in bgm.BoonChart) { res.Add(new int[2] { (int)seg.Start, seg.Value }); } return(res.Count > 0 ? res : null); }
public static void WritePlayerTabBoonGraph(StreamWriter sw, BoonsGraphModel bgm, PhaseData phase) { long roundedEnd = phase.Start + 1000 * phase.GetDuration("s"); List <BoonsGraphModel.Segment> bChart = bgm.BoonChart.Where(x => x.End >= phase.Start && x.Start <= roundedEnd).ToList(); if (bChart.Count == 0 || (bChart.Count == 1 && bChart.First().Value == 0)) { return; } sw.Write("y: ["); { foreach (BoonsGraphModel.Segment seg in bChart) { sw.Write("'" + seg.Value + "',"); } sw.Write("'" + bChart.Last().Value + "'"); } sw.Write("],"); sw.Write("x: ["); { foreach (BoonsGraphModel.Segment seg in bChart) { double segStart = Math.Round(Math.Max(seg.Start - phase.Start, 0) / 1000.0, 3); sw.Write("'" + segStart + "',"); } sw.Write("'" + Math.Round(Math.Min(bChart.Last().End - phase.Start, roundedEnd - phase.Start) / 1000.0, 3) + "'"); } sw.Write("],"); sw.Write(" yaxis: 'y2'," + " type: 'scatter',"); // "legendgroup: '"+Boon.getEnum(bgm.getBoonName()).getPloltyGroup()+"',"; if (!(bgm.BoonName == "Might" || bgm.BoonName == "Quickness")) { sw.Write(" visible: 'legendonly',"); } sw.Write(" line: {color:'" + GetLink("Color-" + bgm.BoonName) + "', shape: 'hv'},"); sw.Write(" fill: 'tozeroy'," + " name: \"" + bgm.BoonName + "\""); }