修复海拔图头像切换以及移动错位问题
This commit is contained in:
1 parent
65e7d9c4f4
commit
75900ccf3d
10 files changed
+60
-61
No files matched your search
@@ -188,9 +188,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
trailRenderer?.Destroy();
|
||||
}
|
||||
var rect = ((RectTransform)arrowImage.transform);
|
||||
rect.position = new Vector3(playerScreenPos.x, playerScreenPos.y, 0);
|
||||
|
||||
((RectTransform)arrowImage.transform).position = playerScreenPos;
|
||||
|
||||
if (IsShowInfo)
|
||||
{
|
||||
ShowInfoPanel(playerScreenPos);
|
||||
@@ -251,52 +251,42 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
private double horizontalScrolling { get; set; }
|
||||
private void MoveHead()
|
||||
{
|
||||
var itemIndex = chartDataSourceScript.GetViewIndex(CurrentIndex);
|
||||
var m = graph.DataSource.GetPoint("Player 2", itemIndex);
|
||||
|
||||
graph.PointToWorldSpace(out Vector3 itemPosition, m.x, m.y, "Player 2");
|
||||
itemPosition.x -= 12f;
|
||||
itemPosition.y += 5f;
|
||||
|
||||
if (headPanel == null)
|
||||
{
|
||||
var onlineHeadPanel = mainController.GetOnlineheadPanel();
|
||||
headPanel = Instantiate(onlineHeadPanel);
|
||||
headPanel.transform.SetParent(graph.transform);
|
||||
headPanel.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
||||
headPanel.transform.position = itemPosition;
|
||||
}
|
||||
else
|
||||
if (CurrentIndex == 1)
|
||||
{
|
||||
|
||||
}
|
||||
int nextIndex = CurrentIndex;
|
||||
var viewIndex = chartDataSourceScript.GetViewIndex(nextIndex);
|
||||
//人物移动 停止条件 到中间且线未加载完
|
||||
if (GetStart() && chartDataSourceScript.ReachMid(viewIndex) && !chartDataSourceScript.ReachEnd())
|
||||
{
|
||||
//if (UserId != mainController.currentPlayer.UserId)
|
||||
//{
|
||||
// headPanel.transform.position = new Vector3(itemPosition.x, itemPosition.y, 0);
|
||||
//}
|
||||
//else
|
||||
var currentDistance = CurrentDistance;
|
||||
var distance = Distance;
|
||||
var offset = currentDistance > 0 ? distance * 1000 / currentDistance : 1;
|
||||
//horizontalScrolling += offset;
|
||||
if (UserId == mainController.currentPlayer.UserId)
|
||||
{
|
||||
int nextIndex = CurrentIndex;
|
||||
var viewIndex = chartDataSourceScript.GetViewIndex(nextIndex);
|
||||
//人物移动 停止条件 到中间且线未加载完
|
||||
if (GetStart() && chartDataSourceScript.ReachMid(viewIndex) && !chartDataSourceScript.ReachEnd())
|
||||
{
|
||||
var currentDistance = CurrentDistance;
|
||||
var distance = Distance;
|
||||
var offset = currentDistance > 0 ? distance * 1000 / currentDistance : 1;
|
||||
horizontalScrolling += offset;
|
||||
if (UserId == mainController.currentPlayer.UserId)
|
||||
{
|
||||
graph.HorizontalScrolling = horizontalScrolling;
|
||||
}
|
||||
headPanel.transform.position = new Vector3(headPanel.transform.position.x, itemPosition.y, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
headPanel.transform.position = new Vector3(itemPosition.x, itemPosition.y, 0);
|
||||
//headPanel.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||
}
|
||||
graph.HorizontalScrolling += offset;
|
||||
}
|
||||
//headPanel.transform.DOMove(new Vector3(itemPosition.x, itemPosition.y, 0), 1);
|
||||
}
|
||||
//设定当前头像位置
|
||||
var m = graph.DataSource.GetPoint("Player 2", viewIndex);
|
||||
graph.PointToWorldSpace(out Vector3 itemPosition, m.x, m.y, "Player 2");
|
||||
itemPosition.x -= 12f;
|
||||
itemPosition.y += 5f;
|
||||
headPanel.transform.position = new Vector3(itemPosition.x, itemPosition.y, 0);
|
||||
//超出边界隐藏
|
||||
var start = graph.HorizontalScrolling;
|
||||
var end = graph.HorizontalScrolling + graph.DataSource.HorizontalViewSize;
|
||||
headPanel.SetActive( viewIndex >= start && viewIndex <= end);
|
||||
//显示头像
|
||||
if (head == null)
|
||||
{
|
||||
head = headPanel.transform.Find("Head").GetComponent<RawImage>();
|
||||
@@ -319,6 +309,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//如果切换到当前用户,当前用户头像变大,并且只显示当前用户
|
||||
if (mainController.currentPlayer.UserId == UserId)
|
||||
{
|
||||
headPanel.transform.SetAsLastSibling();
|
||||
head.gameObject.SetActive(true);
|
||||
headPanel.GetComponent<Image>().color = blue;
|
||||
rect.DOScale(new Vector3(1.2f, 1.2f, 1.2f), 0.5f);
|
||||
|
||||
Reference in new issue
Block a user