From 570bd1554f3565eea999f9be6332b1c527cf42ee Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 11 Aug 2021 16:56:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/Ride/Competiton/CompetitionRankingFactory.cs | 4 +++- .../Scenes/Ride/Competiton/CompetitionUIManager.cs | 5 +++-- Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs | 2 +- Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs index fe77c79a..6e6f130c 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs @@ -1,5 +1,6 @@ using Assets.Scenes.Ride.Scripts.Model; using Assets.Scenes.Ride.Scripts.Model.CyclingModels; +using System; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -137,7 +138,8 @@ namespace Assets.Scenes.Ride.Scripts competitionRankingItem.setHead(item.Headimage); var countryTexture = cyclingController.GetCountryImageByName(item.CountryImg); competitionRankingItem.setCountry(countryTexture); - competitionRankingItem.setDistance(currentPlayer.UserId == item.UserId?"0KM": item.Near.ToString() + "KM"); + var near = Math.Round((item.EndDistance - cyclingController.currentPlayer.TotalDistance)*1000); + competitionRankingItem.setDistance(cyclingController.currentPlayer.UserId == item.UserId?"0M": near.ToString() + "M"); competitionRankingItem.transform.SetSiblingIndex(item.Index); } } diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs index edaab380..a836f6d9 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionUIManager.cs @@ -17,14 +17,14 @@ namespace Assets.Scenes.Ride.Scripts GameObject countDownPanel { get; set; } Text title { get; set; } Text timer { get; set; } + GameObject raceViewBtn { get; set; } protected override void Start() { base.Start(); reviewPanel.SetActive(false); //隐藏单人骑行时间 var spilitLineH2 = transform.Find("Panel/ComputerPanel/SpilitLineH2").gameObject; - var raceViewBtn = transform.Find("Panel/RaceViewButton").gameObject; - raceViewBtn.SetActive(mainController.isWatch); + raceViewBtn = transform.Find("Panel/RaceViewButton").gameObject; viewButton.gameObject.SetActive(false); UIManager.AddEvent(raceViewBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeView); @@ -70,6 +70,7 @@ namespace Assets.Scenes.Ride.Scripts private void CountDown() { + raceViewBtn.SetActive(mainController.isWatch); miniMap.SetActive(false); //隐藏小地图 //viewButton.gameObject.SetActive(false);//隐藏切换视角 headPanel.SetActive(!mainController.isWatch); //隐藏海拔图观察者的头像 diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs b/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs index 25bd1f8c..9dd60560 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs @@ -51,7 +51,7 @@ namespace Assets.Scenes.Ride.Scripts //显示倒计时面板信息 ShowCountDown(s.Item1, "Get The First Place. Time Limit"); } - else if (s.Item1 > 0) + else if (s.Item1 >= 0) { //显示倒计时面板信息 //ShowCountDown(s.Item1, "remaining"); diff --git a/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs b/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs index 8ea06149..8cab03f6 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs @@ -55,10 +55,10 @@ namespace Assets.Scenes.Ride.Scripts cadance = mainController.UpdateCadence(); weight = App.CurrentUser.Weight; bicycleWeight = App.CurrentUser.BicycleWeight; -//#if UNITY_EDITOR - power = 500; -//#endif - mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100); +#if UNITY_EDITOR + power = 500; +#endif + mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100); } catch (Exception ex) {