先放成果视频
Unity雷达图
上代码
using Sirenix.OdinInspector;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class Yjj_RadarMap : Graphic
{
[FoldoutGroup("基础设置"),LabelText("数据")]
public List<float> datas;
#region 标题设置
[FoldoutGroup("基础设置/标题"), LabelText("标题")]
public List<string> names = new List<string>();
[FoldoutGroup("基础设置/标题"), LabelText("标题字体")]
public TMP_FontAsset titleFont;
[FoldoutGroup("基础设置/标题"), LabelText("标题颜色")]
public Color titelColor = Color.white;
[FoldoutGroup("基础设置/标题"), LabelText("标题大小")]
public float titleSize = 24;
[FoldoutGroup("基础设置/标题"), LabelText("标题距离")]
public float titleDistance = 5;
#endregion
[FoldoutGroup("基础设置")]
public Color centerColor = Color.blue;
[HorizontalGroup("基础设置/radiuSet")]
public float radius = 100;
//[HorizontalGroup("基础设置/radiuSet"),Button]
//private void AutoSetRadiu()
//{
// var image = transform.GetComponentInChildren<Image>();
// if (image != null)
// {
// var v = image.rectTransform.sizeDelta;
// float s = Mathf.Min(v.x, v.y);
// radius = s * 0.5f;
// }
//}
[FoldoutGroup("基础设置")]
private int max = 1000;
[FoldoutGroup("基础设置"),LabelText("底图线层数")]
public int radarCount = 4;
[FoldoutGroup("基础设置"),LabelText("底图线颜色")]
public Color radarLineColor = Color.gray;
[FoldoutGroup("基础设置"),LabelText("底图线宽")]
public float radarWidth = 1;
//画线
// public bool drawLine = true;
[FoldoutGroup("基础设置")]
public float line_width = 10;
[FoldoutGroup("基础设置")]
public Color line_color = Color.yellow;
[FoldoutGroup("基础设置")]
private Yjj_RadarLine line;
//字体
[FoldoutGroup("基础设置")]
[LabelText("圆点sprite")]
public Sprite sprite;
[FoldoutGroup("基础设置")]
[LabelText("圆点颜色"),ShowIf("@sprite!=null")]
public Color sprite_color = Color.white;
[FoldoutGroup("基础设置")]
[LabelText("圆点大小"),ShowIf("@sprite!=null")]
public Vector2 sprite_size = new Vector2(20, 20);
[FoldoutGroup("基础设置")]
[LabelText("文本大小")]
public float text_size = 20;
[FoldoutGroup("基础设置")]
[LabelText("文本与中心距离")]
public float text_distance = 5;
[FoldoutGroup("基础设置")]
[LabelText("文本颜色")]
public Color text_Color = Color.white;
//动画参数
[FoldoutGroup("动画设置")]
public float animation_easyIn_ti