骑行页面消息通知

在线用户和影子选手用图片显示,缩放等功能按钮微调
This commit is contained in:
lishuo committed 2021-05-11 18:21:32 +08:00
1 parent 2b4b2c4f70
commit 8f0598580d
37 files changed
+5951 -3153

No files matched your search

+39 -43
View File
@@ -99,6 +99,7 @@ namespace Assets.Scenes.Ride.Scripts
Image nextSlopeImage;
Image currentSlopeImage;
Image miniMapProcess;
Image currentSlopeProcess;
Text miniMapProcessText;
void Awake()
@@ -124,6 +125,8 @@ namespace Assets.Scenes.Ride.Scripts
currentSlopeText = transform.Find("Panel/CurrentSlopePanel/CurrentSlopeText").GetComponent<Text>();
currentSlopeDistanceText = transform.Find("Panel/CurrentSlopePanel/CurrentSlopeDistance").GetComponent<Text>();
currentSlopeToatalDistanceText = transform.Find("Panel/CurrentSlopePanel/TotalSlopeDistance").GetComponent<Text>();
currentSlopeProcess = transform.Find("Panel/CurrentSlopePanel/Process").GetComponent<Image>();
speedTxt = transform.Find("Panel/ComputerPanel/Speed").GetComponent<Text>();
powerTxt = transform.Find("Panel/PowerPanel/Power").GetComponent<Text>();
timerTxt = transform.Find("Panel/ComputerPanel/Timer").GetComponent<Text>();
@@ -395,39 +398,43 @@ namespace Assets.Scenes.Ride.Scripts
//nextSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.NextSlopeDistance, 0, "-{0}M");
nextSlopeDistanceText.text = $"{Math.Round(playerController.NextSlopeTotalDistance, 0)}M";
currentSlopeText.text = Math.Round(playerController.CurrentSlope, 1).ToString() + "%";
currentSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.CurrentSlopeDistance, Math.Round(playerController.CurrentDistance, 0), playerController.CurrentIndex, 0, "{0}M");
currentSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.CurrentDistance - (float)playerController.CurrentSlopeDistance, Math.Round(playerController.CurrentDistance, 0), playerController.CurrentIndex, 0, "{0}M", currentSlopeProcess);
totalClimb.text = Math.Round(playerController.TotalClimb, 0).ToString();
//小地图进度
var process = (float)(playerController.TotalDistance / routeInstance.Distance);
miniMapProcess.fillAmount = process;
miniMapProcessText.text = $"{process*100:f0}%";
//动态改变坡度图片
if (playerController.CurrentSlope >= 1)
{
currentSlopeImage.sprite = uphill1;
}
else if (playerController.CurrentSlope > -1 || playerController.CurrentSlope < 1)
{
currentSlopeImage.sprite = straight;
}
else
{
currentSlopeImage.sprite = downhill1;
}
//下一个坡度
if (playerController.NextSlope >= 1)
{
nextSlopeImage.sprite = uphill1Small;
}
else if (playerController.NextSlope > -1 || playerController.NextSlope < 1)
{
nextSlopeImage.sprite = straightSmall;
}
else
{
nextSlopeImage.sprite = downhill1Small;
}
ChangeSlopeImage();
}
}
private void ChangeSlopeImage()
{
if (playerController.CurrentSlope >= 1)
{
currentSlopeImage.sprite = uphill1;
}
else if (playerController.CurrentSlope > -1 || playerController.CurrentSlope < 1)
{
currentSlopeImage.sprite = straight;
}
else
{
currentSlopeImage.sprite = downhill1;
}
//下一个坡度
if (playerController.NextSlope >= 1)
{
nextSlopeImage.sprite = uphill1Small;
}
else if (playerController.NextSlope > -1 || playerController.NextSlope < 1)
{
nextSlopeImage.sprite = straightSmall;
}
else
{
nextSlopeImage.sprite = downhill1Small;
}
}
//重置游戏
@@ -552,7 +559,11 @@ namespace Assets.Scenes.Ride.Scripts
titlePanel.transform.DOLocalMove(new Vector3(titlePanel.transform.localPosition.x, titlePanel.transform.localPosition.y + isSimple * 200f, titlePanel.transform.localPosition.z), 1);
miniMap.transform.DOLocalMove(new Vector3(miniMap.transform.localPosition.x, miniMap.transform.localPosition.y + isSimple * 260f, miniMap.transform.localPosition.z), 1);
nextSlopePanel.transform.DOLocalMove(new Vector3(nextSlopePanel.transform.localPosition.x, nextSlopePanel.transform.localPosition.y + isSimple * 260f, nextSlopePanel.transform.localPosition.z), 1);
currentSlopePanel.transform.DOLocalMove(new Vector3(currentSlopePanel.transform.localPosition.x, currentSlopePanel.transform.localPosition.y + isSimple * 80f, currentSlopePanel.transform.localPosition.z), 1);
currentSlopePanel.transform.DOLocalMove(new Vector3(currentSlopePanel.transform.localPosition.x, currentSlopePanel.transform.localPosition.y + isSimple * 120f, currentSlopePanel.transform.localPosition.z), 1);
var Scale = isSimple == 1 ? new Vector3(0.7f, 0.7f, 0.7f) : new Vector3(1f, 1f, 1f);
currentSlopePanel.transform.DOScale(Scale, 1);
viewButton.transform.DOLocalMove(new Vector3(viewButton.transform.localPosition.x + isSimple * 200f, viewButton.transform.localPosition.y, viewButton.transform.localPosition.z), 1);
nearByPanel.transform.DOLocalMove(new Vector3(nearByPanel.transform.localPosition.x + isSimple * -330f, nearByPanel.transform.localPosition.y, nearByPanel.transform.localPosition.z), 1).onComplete += () =>
{
@@ -593,7 +604,6 @@ namespace Assets.Scenes.Ride.Scripts
}
}
//挪到人物脚本中处理
void MoveChartMarkPoint()
{
//if (mainController.isStart)
@@ -650,21 +660,7 @@ namespace Assets.Scenes.Ride.Scripts
itemPosition.y += 5f;
item.MoveHead(graph.transform, itemPosition);
}
//移动在线的人
var onlineUsers = FindObjectsOfType<OnlinePlayerController>();
foreach (var item in onlineUsers)
{
var itemIndex = chartDataSourceScript.GetViewIndex(item.CurrentIndex) + 1;
//if (!mainController.isStart && !mainController.isPause && !mainController.isQuit || (mainController.isStart && item.TotalDistance == 0))//未开始未暂停未结束
//{
// itemIndex = 0;
//}
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;
item.MoveHead(graph.transform, itemPosition);
}
}
//移动总海拔图范围
private void MoveElevationImage()