Пример #1
0
 public void UpdateRadarData(int id, RadarData data)
 {
     if (!datas.ContainsKey(id))
     {
         return;
     }
     datas[id] = data;
 }
Пример #2
0
 public void AddRadarData(int id, RadarData data)
 {
     if (datas.ContainsKey(id))
     {
         return;
     }
     datas.Add(id, data);
 }
        public override VertexHelper DrawLine(VertexHelper vh)
        {
            float perRadian = Mathf.PI * 2.0f / radarData.ItemCount;

            for (int i = 0; i < radarDatas.datas.Count; i++)
            {
                RadarData  radarline  = radarDatas.datas[i];
                Color      lineColor  = radarData.GetLineColor(i);
                Color      fillColor  = new Color(lineColor.r, lineColor.g, lineColor.b, 0.6f);
                UIVertex[] oldVertexs = null;
                for (int j = 0; j < radarline.keypoints.Count; j++)
                {
                    float startradian = perRadian * j;
                    float startradius = radarData.Radius * radarline.keypoints[j];
                    int   index       = j + 1;
                    if (index >= radarline.keypoints.Count)
                    {
                        index = 0;
                    }
                    float   endRadian  = perRadian * index;
                    float   endRadius  = radarData.Radius * radarline.keypoints[index];
                    var     startPos   = new Vector2(Mathf.Cos(startradian), Mathf.Sin(startradian)) * startradius;
                    Vector2 endPos     = new Vector2(Mathf.Cos(endRadian), Mathf.Sin(endRadian)) * endRadius;
                    var     newVertexs = GetQuad(startPos, endPos, lineColor, radarData.LineWidth);
                    vh.AddUIVertexQuad(new UIVertex[]
                    {
                        GetUIVertex(startPos, fillColor),
                        GetUIVertex(endPos, fillColor),
                        GetUIVertex(Vector2.zero, fillColor),
                        GetUIVertex(startPos, fillColor)
                    });
                    vh.AddUIVertexQuad(newVertexs);
                    if (j > 0)
                    {
                        vh.AddUIVertexQuad(new UIVertex[]
                        {
                            oldVertexs[1],
                            newVertexs[0],
                            oldVertexs[2],
                            newVertexs[3]
                        });
                    }
                    oldVertexs = newVertexs;
                }
            }
            return(vh);
        }
Пример #4
0
        public static RadarData Convert2RD <T>(IList <T> datas)
        {
            RadarData data = new RadarData();
            Type      type = typeof(T);

            PropertyInfo[] infos = type.GetProperties();
            foreach (var v in datas)
            {
                foreach (var info in infos)
                {
                    if (info.Name.Equals("value"))
                    {
                        data.AddData((float)info.GetValue(v, null));
                    }
                }
            }
            return(data);
        }
 public void Adddata(RadarData data)
 {
     datas.AddRadarData(data);
 }
Пример #6
0
 public void AddRadarData(RadarData data)
 {
     datas.Add(datas.Count, data);
 }