修复小人移动动画显示异常和一些界面调整

This commit is contained in:
lishuo committed 2021-07-29 16:13:23 +08:00
1 parent b9db3325a8
commit 33df128750
10 files changed
+338 -65

No files matched your search

@@ -107,12 +107,18 @@ namespace Assets.Scenes.Ride.Scripts
}
GameObject Detail { get; set; }
GameObject Apply { get; set; }
GameObject Watcher { get; set; }
GameObject MoreHead { get; set; }
Text CompetitionTitle { get; set; }
Text EndTime { get; set; }
//构建赛事界面
protected override void InitGameObject()
{
base.InitGameObject();
CompetitionTitle = panel.transform.Find("CompetitionName").GetComponent<Text>();
CompetitionDesc = panel.transform.Find("CompetitionDesc").GetComponent<RawImage>();
StartTime = panel.transform.Find("Time").GetComponent<Text>();
EndTime = panel.transform.Find("EndTime").GetComponent<Text>();
Contestant = panel.transform.Find("Contestant").GetComponent<Text>();
Watch = panel.transform.Find("Watch").gameObject;
CancelJoin = panel.transform.Find("CancelJoin").gameObject;
@@ -125,7 +131,8 @@ namespace Assets.Scenes.Ride.Scripts
ReadMore = panel.transform.Find("ReadMore").gameObject;
GetReady = panel.transform.Find("GetReady").GetComponent<Text>();
GetReadyTitle = panel.transform.Find("GetReadyTitle").GetComponent<Text>();
Watcher = Resources.Load<GameObject>("UI/Prefab/Match/Watcher");
MoreHead = Resources.Load<GameObject>("UI/Prefab/Match/MoreHead");
Watch.GetComponent<Button>().enabled = false;
Watch.GetComponent<Button>().interactable = false;
@@ -151,7 +158,9 @@ namespace Assets.Scenes.Ride.Scripts
_canWatch = competition.CanWatch;
#region 赛事基本信息
//赛事名称
mapName.text = competition.Title;
CompetitionTitle.text = competition.Title;
//线路名称
mapName.text = route.Name;
//距离
distance.text = route.Distance.ToString("f1") + "KM";
//海拔
@@ -160,6 +169,8 @@ namespace Assets.Scenes.Ride.Scripts
slope.text = Math.Round(route.AverageGrade, 2).ToString() + "%";
//比赛开始时间
StartTime.text = competition.StartTime.ToLocalTime().ToString();
//比赛结束时间
EndTime.text = competition.EndTime.ToLocalTime().ToString();
//比赛状态
CompetitionStatus.text = competition.StatusVlaue.ToString();
//参赛选手
@@ -196,18 +207,17 @@ namespace Assets.Scenes.Ride.Scripts
private int maxShowCout = 9;
private void ShowPlayers(List<CompetitionPlayer> list)
{
var watcher = Resources.Load<GameObject>("UI/Prefab/Match/Watcher");
var moreHead = Resources.Load<GameObject>("UI/Prefab/Match/MoreHead");
int index = 0;
Utils.DestroyChildren(PlayersPanel);
foreach (var item in list)
{
index++;
if (index >= maxShowCout)
{
Instantiate(moreHead, PlayersPanel);
Instantiate(MoreHead, PlayersPanel);
break;
}
var head = Instantiate(watcher, PlayersPanel);
var head = Instantiate(Watcher, PlayersPanel);
var headiamge = head.GetComponent<RawImage>();
if (!string.IsNullOrEmpty(item.WxHeadImg))
{
@@ -268,11 +278,14 @@ namespace Assets.Scenes.Ride.Scripts
_canCancelApply = competition.CanCancelJoin;
_canWatch = competition.CanWatch;
_raceStart = competition.Status == 3;
Contestant.text = competition.UserList.Count.ToString() + "Riders";
ShowPlayers(competition.UserList);
}
}
protected void ApplyRace(BaseEventData baseEvent)
{
UIManager.ShowConfirm("Join", "you want to join?", async () =>
UIManager.ShowConfirm("Join", "Do you want to join?", async () =>
{
MapCompetitionApi s = ConfigHelper.mapCompetitionApi;
var rrr = s.ApplyMapCompetition(cyclingController.competitionId);
@@ -298,7 +311,7 @@ namespace Assets.Scenes.Ride.Scripts
{
try
{
UIManager.ShowConfirm("Canel Reservation", "you want to cancel reservation?", async () =>
UIManager.ShowConfirm("Canel Reservation", "Do you want to cancel reservation?", async () =>
{
MapCompetitionApi api = ConfigHelper.mapCompetitionApi;
var data = api.CancelMapCompetition(cyclingController.competition.Id);
@@ -181,7 +181,7 @@ namespace Assets.Scenes.Ride.Scripts
}
if (mainController.isWatch)
{
UIManager.ShowConfirm("Quit", "Are you want to quit?", async () =>
UIManager.ShowConfirm("Quit", "Do you want to quit?", async () =>
{
SceneManager.LoadScene("MainScene");
UIManager.CloseConfirm();
@@ -33,7 +33,19 @@ namespace Assets.Scenes.Ride.Scripts
var ss = s?.competitionRankingModel;
rankingList = ss?.TopList;
if (rankingList == null) return;
//删除
var currentTopRankingList = FindObjectsOfType<TopRankingItem>();
foreach (var o in currentTopRankingList)
{
var e = rankingList.Where(c => c.UserId == o.UserId).FirstOrDefault();
if (e == null)
{
o.transform.gameObject.SetActive(false);//TODO:这里暂时不删除,删除对应的图片和脚本依赖这个对象;脚本提供一个dispose
bufferSize--;
}
}
for (int i = 0; i < rankingList.Count(); i++)
{
Create(rankingList[i]);
@@ -60,6 +72,7 @@ namespace Assets.Scenes.Ride.Scripts
//情况二:没有足够的buffer,找到要被淘汰的buffer()最后一名
competitionRankingItem = rankingList.OrderByDescending(c => c.rank).FirstOrDefault();
}
}
competitionRankingItem.setHead(item.Head);
competitionRankingItem.setTimer(item.TripTime);