Esempio n. 1
0
        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());
        }
Esempio n. 2
0
 private void criaFatiaELegenda(Color c, UIRadialChartExtended chart, UIPanel legendPanel, string localeID, float offsetY)
 {
     chart.AddSlice(c, c);
     KlyteUtils.createUIElement(out UIPanel legendItemContainer, legendPanel.transform);
     legendItemContainer.width            = legendPanel.width;
     legendItemContainer.relativePosition = new Vector3(0f, offsetY);
     legendItemContainer.name             = "LegendItem";
     legendItemContainer.autoLayout       = false;
     legendItemContainer.useCenter        = true;
     legendItemContainer.wrapLayout       = false;
     legendItemContainer.height           = 20;
     KlyteUtils.createUIElement(out UILabel legendColor, legendItemContainer.transform);
     legendColor.backgroundSprite = "EmptySprite";
     legendColor.width            = 10;
     legendColor.height           = 10;
     legendColor.relativePosition = new Vector3(0, 0);
     legendColor.color            = c;
     KlyteUtils.createUIElement(out UILabel legendName, legendItemContainer.transform);
     legendName.textAlignment     = UIHorizontalAlignment.Right;
     legendName.width             = legendItemContainer.width - 10;
     legendName.localeID          = localeID;
     legendName.textScale         = 0.6f;
     legendName.relativePosition  = new Vector3(15f, 2f);
     legendName.verticalAlignment = UIVerticalAlignment.Middle;
 }
Esempio n. 3
0
        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());
        }