public void SetValues(List <Tuple <int, Color> > locations360) { locations360.Sort((x, y) => x.First - y.First); if (locations360[0].First != 0) { locations360.Insert(0, Tuple.New(0, locations360.Last().Second)); } if (locations360.Count != m_bordersInformation.sliceCount) { while (m_bordersInformation.sliceCount > 0) { m_bordersInformation.RemoveSlice(0); } foreach (Tuple <int, Color> loc in locations360) { m_bordersInformation.AddSlice(loc.Second, loc.Second); } } else { for (int i = 0; i < m_bordersInformation.sliceCount; i++) { m_bordersInformation.GetSlice(i).innerColor = locations360[i].Second; m_bordersInformation.GetSlice(i).outterColor = locations360[i].Second; } } List <float> targetValues = locations360.Select(x => x.First * 100 / 360f).ToList(); m_bordersInformation.SetValuesStarts(targetValues.ToArray()); }
public void SetValues(List <Tuple <int, Color, uint> > steps) { if (steps.Count == 0) { return; } steps.Sort((x, y) => x.First - y.First); //float dividerMultiplier = steps.Max(x => x.Third); if (steps[0].First != 0) { steps.Insert(0, Tuple.New(0, steps.Last().Second, steps.Last().Third)); } if (steps.Count != m_clock.sliceCount) { while (m_clock.sliceCount > 0) { m_clock.RemoveSlice(0); } foreach (Tuple <int, Color, uint> loc in steps) { m_clock.AddSlice(loc.Second, loc.Second, 1);// loc.Third / dividerMultiplier); } } else { for (int i = 0; i < m_clock.sliceCount; i++) { m_clock.GetSlice(i).innerColor = steps[i].Second; m_clock.GetSlice(i).outterColor = steps[i].Second; m_clock.GetSlice(i).sizeMultiplier = 1;// steps[i].Third / dividerMultiplier; } } var targetValues = steps.Select(x => Mathf.RoundToInt(x.First * 100f / 24f)).ToList(); m_clock.SetValuesStarts(targetValues.ToArray()); }