Exemple #1
0
        private void InitRadar(Radar radar)
        {
            float txtWid = 100;
            float txtHig = 20;

            radar.painter          = chart.GetPainter(radar.index);
            radar.refreshComponent = delegate()
            {
                ChartHelper.HideAllObject(chart.transform, INDICATOR_TEXT + "_" + radar.index);
                radar.UpdateRadarCenter(chart.chartPosition, chart.chartWidth, chart.chartHeight);
                for (int i = 0; i < radar.indicatorList.Count; i++)
                {
                    var indicator = radar.indicatorList[i];
                    var pos       = radar.GetIndicatorPosition(i);
                    var textStyle = indicator.textStyle;
                    var objName   = INDICATOR_TEXT + "_" + radar.index + "_" + i;
                    var txt       = ChartHelper.AddTextObject(objName, chart.transform, new Vector2(0.5f, 0.5f),
                                                              new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(txtWid, txtHig),
                                                              textStyle, chart.theme.radar);
                    txt.gameObject.hideFlags = chart.chartHideFlags;
                    txt.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
                    txt.SetText(radar.indicatorList[i].name);
                    txt.SetActive(radar.indicator);
                    var offset = new Vector3(textStyle.offset.x, textStyle.offset.y);
                    AxisHelper.AdjustCircleLabelPos(txt, pos, radar.runtimeCenterPos, txtHig, offset);
                }
                chart.RefreshBasePainter();
            };
            radar.refreshComponent.Invoke();
        }