解决海图索引超过2000头像不显示问题

This commit is contained in:
lishuo 2021-11-24 16:40:53 +08:00
parent 70a8bc0000
commit a2ff7604cc
2 changed files with 28 additions and 8 deletions

View File

@ -565,6 +565,23 @@ namespace ChartAndGraph
return true;
}
public int GetViewIndex(int dataIndex,string category)
{
CategoryData data = (CategoryData)mData[category];
int viewIndex = 0;
List<DoubleVector3> points = data.getPoints();
if (points.Count == 0)
viewIndex = 0;
if (dataIndex < 0)
viewIndex = 0;
for (int i = 0; i < points.Count; i++)
{
if (points[i].x == dataIndex)
viewIndex = i;
}
return viewIndex;
}
public DoubleVector3 GetPoint(string category, int index)
{
CategoryData data = (CategoryData)mData[category];

View File

@ -159,14 +159,17 @@ namespace Assets.Scenes.Ride.Scripts
}
public int GetViewIndex(int index)
{
foreach (var item in pointMap)
{
if (item.Key.Contains(index))
{
return item.Value;
}
}
return index;
if (graph == null)
return index;
return graph.DataSource.GetViewIndex(index, Category);
//foreach (var item in pointMap)
//{
// if (item.Key.Contains(index))
// {
// return item.Value;
// }
//}
//return index;
}
private IDictionary<IList<int>, int> pointMap = new Dictionary<IList<int>, int>();