Unity雷达图效果实现

先放成果视频

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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值