void updateDataSeries() { for (int i = 0; i < numDataSeries; i++) { if (dataSeries.Count <= i) { WMG_Series aSeries = addSeriesAt(numGrids + i); aSeries.connectFirstToLast = true; aSeries.hidePoints = true; dataSeries.Add(aSeries); } if (dataSeriesColors.Count <= i) { dataSeriesColors.AddNoCb(new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1), ref _dataSeriesColors); } } for (int i = dataSeries.Count - 1; i >= 0; i--) { if (dataSeries[i] != null && i >= numDataSeries) { deleteSeriesAt(numGrids + i); dataSeries.RemoveAt(i); } } for (int i = dataSeriesColors.Count - 1; i >= 0; i--) { if (i >= numDataSeries) { dataSeriesColors.RemoveAtNoCb(i, ref _dataSeriesColors); } } for (int i = 0; i < numDataSeries; i++) { WMG_Series aSeries = lineSeries[i + numGrids].GetComponent <WMG_Series>(); if (randomData) { aSeries.pointValues.SetList(WMG_Util.GenRadar(WMG_Util.GenRandomList(numPoints, radarMinVal, radarMaxVal), offset.x, offset.y, degreeOffset)); } aSeries.lineScale = dataSeriesLineWidth; aSeries.linePadding = dataSeriesLineWidth; aSeries.lineColor = dataSeriesColors[i]; } }
void updateLabels() { if (!createdLabels) { WMG_Series labels = addSeriesAt(numDataSeries + numGrids); labels.hideLines = true; createdLabels = true; labels.pointPrefab = 3; radarLabels = labels; } for (int i = 0; i < numPoints; i++) { if (labelStrings.Count <= i) { labelStrings.AddNoCb("", ref _labelStrings); } } for (int i = labelStrings.Count - 1; i >= 0; i--) { if (labelStrings[i] != null && i >= numPoints) { labelStrings.RemoveAtNoCb(i, ref _labelStrings); } } radarLabels.hidePoints = hideLabels; radarLabels.pointValues.SetList(WMG_Util.GenCircular(numPoints, offset.x, offset.y, labelsOffset + (radarMaxVal - radarMinVal), degreeOffset)); List <GameObject> labelGOs = radarLabels.getPoints(); for (int i = 0; i < labelGOs.Count; i++) { if (i >= numPoints) { break; } changeLabelFontSize(labelGOs[i], fontSize); changeLabelText(labelGOs[i], labelStrings[i]); } radarLabels.pointColor = labelsColor; }
void CreateOrDeleteBasedOnValues() { // Create bands based on values data for (int i = 0; i < values.Count; i++) { if (fillColors.Count <= i) { fillColors.AddNoCb(Color.white, ref _fillColors); } if (labels.Count <= i) { labels.AddNoCb("", ref _labels); } if (bands.Count <= i) { GameObject obj = GameObject.Instantiate(bandPrefab) as GameObject; changeSpriteParent(obj, bandsParent); WMG_Bezier_Band band = obj.GetComponent <WMG_Bezier_Band>(); if (band == null) { Debug.Log(obj.name); Debug.Log("asdf"); } band.Init(this); bands.Add(band); } } for (int i = bands.Count - 1; i >= 0; i--) { if (bands[i] != null && i >= values.Count) { Destroy(bands[i].gameObject); bands.RemoveAt(i); } } }
void updateNumberRings() { // Create rings based on values data for (int i = 0; i < values.Count; i++) { if (labels.Count <= i) { labels.AddNoCb("Ring " + (i + 1), ref _labels); } if (hideRings.Count <= i) { hideRings.AddNoCb(false, ref _hideRings); } if (bandColors.Count <= i) { bandColors.AddNoCb(bandColor, ref _bandColors); } if (rings.Count <= i) { GameObject obj = GameObject.Instantiate(ringPrefab) as GameObject; changeSpriteParent(obj, ringsParent); WMG_Ring ring = obj.GetComponent <WMG_Ring>(); ring.initialize(this); rings.Add(ring); } } for (int i = rings.Count - 1; i >= 0; i--) { if (rings[i] != null && i >= values.Count) { Destroy(rings[i].label); Destroy(rings[i].gameObject); rings.RemoveAt(i); } } }