观察者TCP通信对接,实时列表优化,观察者模式界面显示逻辑

This commit is contained in:
lishuo committed 2021-07-06 18:24:15 +08:00
1 parent d6a7cd798f
commit b2a527f518
41 files changed
+11545 -3263

No files matched your search

@@ -45,8 +45,14 @@ namespace Assets.Scenes.Ride.Scripts
protected override void Compute()
{
currentlatlong = mainController.Along(totalDistance);//下一个坐标
diff = Math.Round((totalDistance - _playerController.TotalDistance) * 1000, 0);
if (_playerController != null)
{
diff = Math.Round((totalDistance - _playerController.TotalDistance) * 1000, 0);
}
else
{
diff = 0;
}
}
double diff = 0;
public void SetDataSource(double _totalDistance, double _distance,string Name,double weightKg,int index=0)
@@ -97,7 +103,7 @@ namespace Assets.Scenes.Ride.Scripts
public void RemoveSelf()
{
arrowImage.gameObject?.Destroy();
arrowImage?.gameObject?.Destroy();
headPanel?.Destroy();
infoPanel?.Destroy();
transform.gameObject.Destroy();
@@ -107,7 +113,7 @@ namespace Assets.Scenes.Ride.Scripts
{
var playerScreenPos = Camera.main.WorldToScreenPoint(transform.position);
//如果是比赛模式头像
if (mainController.cyclingController.Mode == CyclingModel.Competition)
if (mainController.cyclingModel == CyclingModel.Competition)
{
playerScreenPos.y += 10f;
}
@@ -162,10 +168,22 @@ namespace Assets.Scenes.Ride.Scripts
}
protected override void MoveGraphHead()
{
if (mainController.cyclingModel == CyclingModel.Competition)
{
MoveGraghHead4Race();
}
else
{
MoveHead();
}
}
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;
@@ -196,5 +214,20 @@ namespace Assets.Scenes.Ride.Scripts
}
}
}
private void MoveGraghHead4Race()
{
MoveHead();
var rect = ((RectTransform)(headPanel.transform));
//如果切换到当前用户,当前用户头像变大
if (mainController.currentPlayer.UserId == UserId)
{
rect.DOScale(new Vector3(1.5f, 1.5f, 1.5f), 0.5f);
}
else
{
rect.DOScale(new Vector3(1f, 1f, 1f), 0.5f);
}
}
}
}