海拔图小头像&比赛状态实时刷新

This commit is contained in:
lishuo committed 2021-07-28 14:00:03 +08:00
1 parent e29f0a8116
commit ea717ccdb8
11 files changed
+435 -94

No files matched your search

@@ -14,7 +14,7 @@ namespace Assets.Scenes.Ride.Scripts
private GameObject Watch { get; set; }
private bool _canJoin = false;
private bool _canStart = false;
private bool _canWatch = false;
private RawImage CompetitionDesc { get; set; }
private RawImage SponsorLogoImage { get; set; }
private Text StartTime { get; set; }
@@ -71,14 +71,22 @@ namespace Assets.Scenes.Ride.Scripts
//1.报名按钮
Apply.SetActive(_canJoin);
//2.观看按钮
var showWatch = !_canJoin && !_canStart && !_canCancelApply && _raceStart;
Watch.SetActive(showWatch);
Watch.SetActive(_canWatch);
//3.开始按钮
rideNow.gameObject.SetActive(_canStart);
//4.详情按钮
Detail.SetActive(!_canStart);
//5.取消报名按钮 (比赛开始前可以取消报名)
CancelJoin.SetActive(_canCancelApply && count > 0);
CancelJoin.SetActive(_canCancelApply);
if (_canCancelApply)
{
CompetitionStatus.text = "applied";
}
else
{
CompetitionStatus.text = competition.StatusVlaue.ToString();
}
}
#endregion
}
@@ -131,8 +139,9 @@ namespace Assets.Scenes.Ride.Scripts
//赛事状态按钮控制
_canJoin = competition.CanJoin;
_canStart = competition.CanStart;
_canCancelApply = competition.applyed;//可以取消预约
_canCancelApply = competition.CanCancelJoin;//可以取消预约
_raceStart = competition.Status == 3;
_canWatch = competition.CanWatch;
#region 赛事基本信息
//赛事名称
mapName.text = competition.Title;
@@ -151,9 +160,13 @@ namespace Assets.Scenes.Ride.Scripts
ShowPlayers(competition.UserList);
//路书描述
mapDescText.text = competition.Dec;
//主办方logo
Utils.DisplayImage(SponsorLogoImage, competition.SponsorCoverage, true);
ReadMore.SetActive(!string.IsNullOrEmpty(competition.Dec));
//主办方logo
if (!string.IsNullOrEmpty(competition.SponsorCoverage))
{
Utils.DisplayImage(SponsorLogoImage, competition.SponsorCoverage, true);
}
//赛事详情
//if (!string.IsNullOrEmpty(competition.ShortPreview))
//{
@@ -202,9 +215,25 @@ namespace Assets.Scenes.Ride.Scripts
{
Application.OpenURL(App.CurrentUser.WebHost + $"#/Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}");
}
protected override void StartRide(BaseEventData baseEvent)
{
UpdateCompetition();
if (competition.Status == 4)
{
Utils.showToast(gameObject, "race close");
return;
}
base.StartRide(baseEvent);
}
//观察
protected void StartWatch(BaseEventData baseEvent)
{
UpdateCompetition();
if (competition.Status == 4)
{
Utils.showToast(gameObject, "race close");
return;
}
//隐藏当前用户
cyclingController.isWatch = true;
cyclingController.player.SetActive(false);
@@ -229,7 +258,9 @@ namespace Assets.Scenes.Ride.Scripts
competition = result.data;
_canStart = competition.CanStart;
_canJoin = competition.CanJoin;
_canCancelApply = competition.applyed;
_canCancelApply = competition.CanCancelJoin;
_canWatch = competition.CanWatch;
_raceStart = competition.Status == 3;
}
}
protected void ApplyRace(BaseEventData baseEvent)
@@ -53,9 +53,9 @@ namespace Assets.Scenes.Ride.Scripts
protected override void Compute()
{
currentlatlong = mainController.Along(totalDistance);//下一个坐标
if (_playerController != null)
if (mainController.currentPlayer != null)
{
diff = Math.Round((totalDistance - _playerController.TotalDistance) * 1000, 0);
diff = Math.Round((totalDistance - mainController.currentPlayer.TotalDistance) * 1000, 0);
}
else
{
@@ -114,7 +114,7 @@ namespace Assets.Scenes.Ride.Scripts
infoName.text = nickName;
//距离
var infoDistance = infoPanel.transform.Find("Distance").GetComponent<Text>();
if (_playerController != null)
if (mainController.currentPlayer != null)
{
infoDistance.text = diff > 0? $"+{diff}M" : $"{diff}M";
}
@@ -281,7 +281,7 @@ namespace Assets.Scenes.Ride.Scripts
}
if (head == null)
{
head = headPanel.GetComponentInChildren<RawImage>();
head = headPanel.transform.Find("Head").GetComponent<RawImage>();
if (!string.IsNullOrEmpty(headUrl))
{
Utils.DisplayImage(head, headUrl, true);