From 99081519bbaed2eb8593a65c9ef75918dec3e75e Mon Sep 17 00:00:00 2001 From: lishuo Date: Tue, 7 Sep 2021 16:11:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=91=E8=A1=8C=E7=95=8C=E9=9D=A2&=E8=B5=9B?= =?UTF-8?q?=E4=BA=8B=E7=95=8C=E9=9D=A2=E8=B0=83=E6=95=B4&=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=96=AD=E5=BC=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/Images/Pop-ups_Close_white.png | Bin 0 -> 1063 bytes .../Images/Pop-ups_Close_white.png.meta | 128 ++ .../UI/Prefab/Device/Mobile/MobileInfo.prefab | 204 ++ .../Device/Mobile/MobileInfo.prefab.meta | 7 + .../Match/Mobile/CompetitionArrow.prefab | 12 +- .../Match/Mobile/CompetitionArrow.prefab.meta | 2 +- .../Mobile/CompetitionRankingItem.prefab | 36 +- .../Mobile/CompetitionRankingMajorItem.prefab | 34 +- .../Mobile/CompetitionRankingPanel.prefab | 52 +- .../Mobile/CompetitionResultPanel.prefab | 16 +- .../Match/Mobile/CompetitonPanel.prefab | 14 +- .../Prefab/Match/Mobile/CountDownPanel.prefab | 24 +- .../Prefab/Match/Mobile/TopRankPanel.prefab | 14 +- .../Prefab/Match/Mobile/TopRankingItem.prefab | 34 +- .../UI/Prefab/Match/Mobile/Watcher.prefab | 4 +- .../UI/Prefab/Ride/Mobile/LoadingPanel.prefab | 22 +- .../UI/Prefab/Ride/Mobile/NearbyItem.prefab | 28 +- .../Prefab/Ride/Mobile/NearbyMajorItem.prefab | 28 +- .../Prefab/Ride/Mobile/OnlineInfoPanel.prefab | 505 +++++ .../Ride/Mobile/OnlineInfoPanel.prefab.meta | 7 + .../Ride/Mobile/OnlineRaceInfoPanebakl.prefab | 505 +++++ .../Mobile/OnlineRaceInfoPanebakl.prefab.meta | 7 + .../Ride/Mobile/OnlineRaceInfoPanel.prefab | 505 +++++ .../Mobile/OnlineRaceInfoPanel.prefab.meta | 7 + .../UI/Prefab/Ride/Mobile/Panel.prefab | 1790 ++++++++++++----- .../UI/Prefab/Ride/Mobile/ReviewItem.prefab | 32 +- Assets/Scripts/Apis/MapCompetitionApi.cs | 15 +- .../Models/CompetitionRankingResultModel.cs | 6 + .../Apis/Models/MapCompetitionListItem.cs | 129 ++ .../Models/MapCompetitionListItem.cs.meta | 11 + Assets/Scripts/Devices/MobileInfo.cs | 27 + Assets/Scripts/Devices/MobileInfo.cs.meta | 11 + .../CompetitionLoadingController.cs | 6 +- .../Competiton/CompetitionRankingFactory.cs | 4 + .../Ride/Competiton/CountDownFactory.cs | 4 + .../Model/CyclingModels/CompetitionModel.cs | 2 +- .../Scenes/Ride/Scripts/BaseUIManager.cs | 29 +- .../Scenes/Ride/Scripts/LoadingController.cs | 2 +- .../Scenes/Ride/Scripts/NearByFactory.cs | 2 +- .../Ride/Scripts/OnlinePlayerController.cs | 13 +- .../Ride/Scripts/OtherPlayerController.cs | 4 + .../Ride/Scripts/SelectPlayerFactory.cs | 3 + .../UI/Prefab/Device/ConnectDeviceModal.cs | 70 +- 43 files changed, 3658 insertions(+), 697 deletions(-) create mode 100644 Assets/Resources/Images/Pop-ups_Close_white.png create mode 100644 Assets/Resources/Images/Pop-ups_Close_white.png.meta create mode 100644 Assets/Resources/UI/Prefab/Device/Mobile/MobileInfo.prefab create mode 100644 Assets/Resources/UI/Prefab/Device/Mobile/MobileInfo.prefab.meta create mode 100644 Assets/Resources/UI/Prefab/Ride/Mobile/OnlineInfoPanel.prefab create mode 100644 Assets/Resources/UI/Prefab/Ride/Mobile/OnlineInfoPanel.prefab.meta create mode 100644 Assets/Resources/UI/Prefab/Ride/Mobile/OnlineRaceInfoPanebakl.prefab create mode 100644 Assets/Resources/UI/Prefab/Ride/Mobile/OnlineRaceInfoPanebakl.prefab.meta create mode 100644 Assets/Resources/UI/Prefab/Ride/Mobile/OnlineRaceInfoPanel.prefab create mode 100644 Assets/Resources/UI/Prefab/Ride/Mobile/OnlineRaceInfoPanel.prefab.meta create mode 100644 Assets/Scripts/Apis/Models/MapCompetitionListItem.cs create mode 100644 Assets/Scripts/Apis/Models/MapCompetitionListItem.cs.meta create mode 100644 Assets/Scripts/Devices/MobileInfo.cs create mode 100644 Assets/Scripts/Devices/MobileInfo.cs.meta diff --git a/Assets/Resources/Images/Pop-ups_Close_white.png b/Assets/Resources/Images/Pop-ups_Close_white.png new file mode 100644 index 0000000000000000000000000000000000000000..361064e0d2bac16e496045d2ef6f38830ec45cf3 GIT binary patch literal 1063 zcmV+?1laqDP)N<6tr_vH7X+=s0eo^&*+k) z<5F@_0lH^K7iIT}3j>b;2#|z>83ug6-F*N_(NbPsGUM@hoXm|Ajsp$MA2bv=(7^a| zS|rLu&?;47nRK!Y<3P+4&!S2TGH{hsGkljCPxUCDvBJY>Iq{1 zel;gd%!sJZ*;1)CSx-5MVJ!&^0Ve*HtvT-Mhn&;=%h_g5Kwlv^f=1FS!bIB9usyoS zp+r9;9tybvM;xC%$=k@e(HGX+jA>sp$w6k)G*Ci7Mb7tbemdh3CrADd`Ljh)B2Uv~ zRk|dZNpiB&EM%4dILEteb{zD{ip51?m0a>~C3AMMr-ROE1kG}2HV_#;Sqv`zFuGE5 zu1MFC2g=@g0w~P@Nv?X>cM^Ph^vG@^LcRwM5GDpzxIIE7J;@Rwr3lQ}tW!9fh`ND2 zQv(rFW@E0{1A7|~OC6D=A6P^zCPKr=?vZe2GXPtGJ$IdG0XQrL@|Kn^C29rstu_%M z>4qaWf?^NsZ4?(fvRowGBZjjFXtgs$ZzAA_Av<}#A+;iA@_@ld&lSf};IVr6*In1B z%PrF}e*6+#qj~+Q5=A+1VqL>Wj_dX(f=wg@NA2vDXTtkK_IDhmQ6)i9Nx9(#(XeWF zZkA*Tobf=wlOB?8a51%ztOjo-0YPn~%OX%e1EIDjC4x3^k#&;vfp?Ou11AZ(s9xvn zQewL225_X<=qEwhlJW^VOzk8qz{Rpm(g4oRYL{@Cqy=0X*-g>|-c7Owyo&?`wXt{; zp}4juC*Dk@u?XJK$*n}t48A~eA;Ft#p&L9Ri9det@{7d3zKHjXlhvewr1ONFIAX!l z!m%2DuI_JeQyb*HXs9l(`KHK8byLFrxpATsS1U-20Cf%5K=zs5Ut&(a}d z%ca%Q#TenflL3u /// /// - public JsonResult> GetRankingList(int id) + public JsonResult> GetRankingListAsync(int id) { - var list = Get>($"/MapRecord/GetCompetitionRanking?id={ id }&pageIndex=0&pageSize=999"); + var list = Get>($"/MapRecord/GetCompetitionRanking?id={ id }&pageIndex=0&pageSize=999"); return new JsonResult> { @@ -38,7 +40,7 @@ namespace Assets.Scripts.Apis //查询我参与的比赛列表 public JsonResult> GetMyCompetitionList() { - var list = Get>($"/MapCompetition/v0/GetMyList"); + var list = Get>>($"/MapCompetition/v0/GetMyList"); return new JsonResult> { @@ -50,7 +52,7 @@ namespace Assets.Scripts.Apis //查询比赛列表 public JsonResult> GetCompetitionList(string name,int pageIndex,int pageSize,int status=0) { - var list = Get>($"/MapCompetition/v1/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&status={ status }"); + var list = Get>>($"/MapCompetition/v1/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&status={ status }"); return new JsonResult> { @@ -61,7 +63,8 @@ namespace Assets.Scripts.Apis } public async Task>> GetCompetitionListV2(string name, int pageIndex, int pageSize, string status = "", int order = 1, bool self = false, int activity = 0) { - var list = await GetAsync>($"/MapCompetition/v2/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&status={ status }&order={order}&self={self}&activity={activity}"); + var list = await GetAsync>>($"/MapCompetition/v2/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&status={ status }&order={order}&self={self}&activity={activity}"); + Debug.Log("67"); return new JsonResult> { result = list.result, @@ -72,7 +75,7 @@ namespace Assets.Scripts.Apis //查询比赛详情 public JsonResult GetCompetitionDetail(int id) { - var list = Get>($"/MapRouteGlobalCycling/Get?id={ id }"); + var list = Get>($"/MapRouteGlobalCycling/Get?id={ id }"); return new JsonResult { diff --git a/Assets/Scripts/Apis/Models/CompetitionRankingResultModel.cs b/Assets/Scripts/Apis/Models/CompetitionRankingResultModel.cs index e84afb5b..786d232f 100644 --- a/Assets/Scripts/Apis/Models/CompetitionRankingResultModel.cs +++ b/Assets/Scripts/Apis/Models/CompetitionRankingResultModel.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace Assets.Scripts.Apis.Models { @@ -34,4 +35,9 @@ namespace Assets.Scripts.Apis.Models public string Gap { get; set; } public string WxHeadImg { get; set; } } + + public class CompetitionRankingResultListModel + { + public List list { get; set; } + } } diff --git a/Assets/Scripts/Apis/Models/MapCompetitionListItem.cs b/Assets/Scripts/Apis/Models/MapCompetitionListItem.cs new file mode 100644 index 00000000..0200e395 --- /dev/null +++ b/Assets/Scripts/Apis/Models/MapCompetitionListItem.cs @@ -0,0 +1,129 @@ +using System; + +public class MapCompetitionListItem +{ + /// + /// + /// + public int Id { get; set; } + /// + /// + /// + public string CoverImage { get; set; } + /// + /// + /// + public int Status { get; set; } + /// + /// + /// + public string StatusVlaue { get; set; } + /// + /// + /// + public string Area { get; set; } + /// + /// + /// + public DateTime StartApplyTime { get; set; } + /// + /// + /// + public DateTime EndApplyTime { get; set; } + /// + /// + /// + public string PhoneNumber { get; set; } + /// + /// + /// + public int CloseTime { get; set; } + /// + /// + /// + public int MaxMembers { get; set; } + /// + /// + /// + public DateTime StartTime { get; set; } + /// + /// + /// + public DateTime EndTime { get; set; } + /// + /// 阳澄湖绕圈赛 + /// + public string Title { get; set; } + /// + /// 周一赛事 + /// + public string Dec { get; set; } + /// + /// + /// + public int RouteId { get; set; } + /// + /// + /// + public int ApplyCount { get; set; } + /// + /// + /// + public bool HasJoin { get; set; } + /// + /// + /// + public string CanCancelJoin { get; set; } + /// + /// + /// + public bool CanJoin { get; set; } + /// + /// + /// + public bool CanEnter { get; set; } + /// + /// + /// + public int MapCompetitionType { get; set; } + /// + /// + /// + public bool CanWatch { get; set; } + /// + /// + /// + public double Distance { get; set; } + /// + /// + /// + public double AverageGrade { get; set; } + /// + /// + /// + public double EleDifference { get; set; } + /// + /// + /// + public double TotalClimb { get; set; } + /// + /// + /// + public double MaxElevation { get; set; } + /// + /// + /// + public string RouteCover { get; set; } + /// + /// + /// + public string AltitudeGraph { get; set; } + /// + /// + /// + public string SponsorCoverage { get; set; } + /// + /// + /// + public string BannerPreview { get; set; } +} \ No newline at end of file diff --git a/Assets/Scripts/Apis/Models/MapCompetitionListItem.cs.meta b/Assets/Scripts/Apis/Models/MapCompetitionListItem.cs.meta new file mode 100644 index 00000000..1d50bbbf --- /dev/null +++ b/Assets/Scripts/Apis/Models/MapCompetitionListItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dfee8082eae2f2948b4c9022d38ae383 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Devices/MobileInfo.cs b/Assets/Scripts/Devices/MobileInfo.cs new file mode 100644 index 00000000..39290da3 --- /dev/null +++ b/Assets/Scripts/Devices/MobileInfo.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.UI; + +namespace Assets.Scripts.Devices +{ + class MobileInfo : MonoBehaviour + { + Text BatteryText { get; set; } + Text TimeText { get; set; } + private void Start() + { + BatteryText = transform.Find("BatteryText").GetComponent(); + TimeText = transform.Find("TimeText").GetComponent(); + } + private void Update() + { + BatteryText.text = $"{Math.Round(SystemInfo.batteryLevel * 100, 0)}%"; + + TimeText.text = DateTime.Now.ToString("HH:mm"); + } + } +} diff --git a/Assets/Scripts/Devices/MobileInfo.cs.meta b/Assets/Scripts/Devices/MobileInfo.cs.meta new file mode 100644 index 00000000..cc8850f2 --- /dev/null +++ b/Assets/Scripts/Devices/MobileInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 43faa658bc3cc36499ad4687b54e8608 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionLoadingController.cs b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionLoadingController.cs index 1b5f1ba2..72643a89 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionLoadingController.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionLoadingController.cs @@ -174,9 +174,9 @@ namespace Assets.Scenes.Ride.Scripts _canEnter = competition.CanEnter; #region 赛事基本信息 //赛事名称 - CompetitionTitle.text = GetMaxString(competition.Title,40); + CompetitionTitle.text = GetMaxString(competition.Title, 35); //线路名称 - mapName.text = GetMaxString(route.Name, 68); + mapName.text = GetMaxString(route.Name, 45); //距离 distance.text = route.Distance.ToString("f1") + "KM"; //海拔 @@ -193,7 +193,7 @@ namespace Assets.Scenes.Ride.Scripts Contestant.text = competition.UserList.Count.ToString() + "Riders"; ShowPlayers(competition.UserList); //路书描述 - mapDescText.text = competition.Dec; + mapDescText.text = GetMaxString(competition.Dec, 400); //线路编号 MapId.text = route.Id.ToString(); diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs index 7527d464..9457ebe5 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CompetitionRankingFactory.cs @@ -24,7 +24,11 @@ namespace Assets.Scenes.Ride.Scripts protected override void Awake() { //base.Awake(); +#if UNITY_IOS || UNITY_ANDROID + pageSize = 7; +#else pageSize = 4; +#endif scroll = transform.Find("List").gameObject; if (scroll != null) { diff --git a/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs b/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs index 9dd60560..f031c47c 100644 --- a/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs +++ b/Assets/Scripts/Scenes/Ride/Competiton/CountDownFactory.cs @@ -48,8 +48,12 @@ namespace Assets.Scenes.Ride.Scripts //显示关门时间 if (s.Item3 && !isAutoSave) { +#if UNITY_IOS || UNITY_ANDROID //显示倒计时面板信息 + ShowCountDown(s.Item1, "Time Limit"); +#else ShowCountDown(s.Item1, "Get The First Place. Time Limit"); +#endif } else if (s.Item1 >= 0) { diff --git a/Assets/Scripts/Scenes/Ride/Model/CyclingModels/CompetitionModel.cs b/Assets/Scripts/Scenes/Ride/Model/CyclingModels/CompetitionModel.cs index 9f6f5de7..0c083b02 100644 --- a/Assets/Scripts/Scenes/Ride/Model/CyclingModels/CompetitionModel.cs +++ b/Assets/Scripts/Scenes/Ride/Model/CyclingModels/CompetitionModel.cs @@ -173,7 +173,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels if ((users1.Any() && users1.Any(d => mapWorkoutRecordRankings.All(u => u.UserId != d.Id))) || mapWorkoutRecordRankings.All(u => u.UserId != recorderData.BelongUserId)) { - var rrr = mapCompetitionApi.GetRankingList(recorderData.Competitionid); + var rrr = mapCompetitionApi.GetRankingListAsync(recorderData.Competitionid); if (rrr.result) { mapWorkoutRecordRankings = rrr.data; diff --git a/Assets/Scripts/Scenes/Ride/Scripts/BaseUIManager.cs b/Assets/Scripts/Scenes/Ride/Scripts/BaseUIManager.cs index 631c199b..5fb3a593 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/BaseUIManager.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/BaseUIManager.cs @@ -115,7 +115,9 @@ namespace Assets.Scenes.Ride.Scripts InitData();//初始 RenderChart();//渲染海拔图 } - + Text totalDistanceCompetition { get; set; } + GameObject distanceIconCompetition { get; set; } + GameObject totalDistanceIcon { get; set; } private void InitGameObject() { #region 控件获取与事件绑定 @@ -130,6 +132,8 @@ namespace Assets.Scenes.Ride.Scripts ditance = uipanel.transform.Find("ComputerPanel/Distance").GetComponent(); titlePanel = uipanel.transform.Find("TitlePanel").gameObject; totalDistance = uipanel.transform.Find("TitlePanel/TotalDistance").GetComponent(); + totalDistanceIcon = uipanel.transform.Find("TitlePanel/DistanceIcon").gameObject; + candance = uipanel.transform.Find("PowerPanel/Cadance").GetComponent(); heartRate = uipanel.transform.Find("PowerPanel/Hrv").GetComponent(); nextSlopePanel = uipanel.transform.Find("NextSlopePanel").gameObject; @@ -137,6 +141,11 @@ namespace Assets.Scenes.Ride.Scripts nextSlopeText = uipanel.transform.Find("NextSlopePanel/NextSlopeText").GetComponent(); nextSlopeDistanceText = uipanel.transform.Find("NextSlopePanel/NextSlopeDistance").GetComponent(); currentSlopeText = uipanel.transform.Find("CurrentSlopePanel/CurrentSlopeText").GetComponent(); +#if UNITY_IOS || UNITY_ANDROID + totalDistanceCompetition = uipanel.transform.Find("TitlePanel/TotalDistanceCompetition").GetComponent(); + distanceIconCompetition = uipanel.transform.Find("TitlePanel/DistanceIconCompetition").gameObject; + nextSlopeText = uipanel.transform.Find("CurrentSlopePanel/NextSlopeText").GetComponent(); +#endif currentSlopeDistanceText = uipanel.transform.Find("CurrentSlopePanel/CurrentSlopeDistance").GetComponent(); currentSlopeToatalDistanceText = uipanel.transform.Find("CurrentSlopePanel/TotalSlopeDistance").GetComponent(); currentSlopeProcess = uipanel.transform.Find("CurrentSlopePanel/Process").GetComponent(); @@ -226,7 +235,7 @@ namespace Assets.Scenes.Ride.Scripts UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerExit, OnPointExit); UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerExit, OnPointExit); - #endregion +#endregion } protected virtual void Update() { @@ -273,6 +282,7 @@ namespace Assets.Scenes.Ride.Scripts //开发者视角调整 cameraSlider = uipanel.transform.Find("CameraSlider").GetComponent(); Text CameraText = uipanel.transform.Find("CameraSlider/Text").GetComponent(); +#if !(UNITY_IOS || UNITY_ANDROID) string[] phoneList = new string[] { "18120141032", "15651831367", "18120141031", "15261826280", "18662240319" }; if (phoneList.Contains(App.CurrentUser.Phone)) { @@ -285,9 +295,24 @@ namespace Assets.Scenes.Ride.Scripts CameraText.text = f.ToString("f0"); }); } +#endif //路书基本信息绑定 mapName.text = routeInstance.Name; totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程 + +#if UNITY_IOS || UNITY_ANDROID + totalDistanceCompetition.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程 + var watchList = mainController.GetWatcherList(); + if (mainController.competitionId > 0) + { + var showLeft = watchList.Count > 0; + distanceIconCompetition.SetActive(!showLeft); + totalDistanceCompetition.gameObject.SetActive(!showLeft); + totalDistance.gameObject.SetActive(showLeft); + totalDistanceIcon.gameObject.SetActive(showLeft); + } +#endif + Utils.DisplayImage(altitudeGraph, route.RouteInstance.AltitudeGraph);//渲染海拔图 //影子骑行按钮控制 if (mainController.mapRouteRankingList == null || mainController.mapRouteRankingList.Count == 0) diff --git a/Assets/Scripts/Scenes/Ride/Scripts/LoadingController.cs b/Assets/Scripts/Scenes/Ride/Scripts/LoadingController.cs index 3121df02..5da00cbf 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/LoadingController.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/LoadingController.cs @@ -76,7 +76,7 @@ namespace Assets.Scenes.Ride.Scripts slope.text = Math.Round(route.AverageGrade, 2).ToString() + "%"; rideNum.text = route.TheHeat.ToString(); distance.text = route.Distance.ToString("f1") + "KM"; - mapDescText.text = route.Dec; + mapDescText.text = GetMaxString(route.Dec, 255); mapId.text = route.Id.ToString(); var userList = ConfigHelper.mapApi.GetOnlineUserInfo(new int[] { route.UserId }).data; if (userList.Count > 0) diff --git a/Assets/Scripts/Scenes/Ride/Scripts/NearByFactory.cs b/Assets/Scripts/Scenes/Ride/Scripts/NearByFactory.cs index 0657604f..440a52aa 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/NearByFactory.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/NearByFactory.cs @@ -29,7 +29,7 @@ namespace Assets.Scenes.Ride.Scripts #endif Title = transform.Find("Title").GetComponent(); OnlineUserNum = transform.Find("NearByView/OnlineUserNum").GetComponent(); - pageSize = 5;//开启无线下拉 + pageSize = 7;//开启无线下拉 } protected override void CreateList() { diff --git a/Assets/Scripts/Scenes/Ride/Scripts/OnlinePlayerController.cs b/Assets/Scripts/Scenes/Ride/Scripts/OnlinePlayerController.cs index a019891f..5aceca2d 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/OnlinePlayerController.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/OnlinePlayerController.cs @@ -96,7 +96,17 @@ namespace Assets.Scenes.Ride.Scripts { if (infoPanel == null) { - if(mainController.cyclingModel == CyclingModel.Competition) +#if UNITY_IOS || UNITY_ANDROID + if (mainController.cyclingModel == CyclingModel.Competition) + { + infoPanel = Instantiate(Resources.Load("UI/Prefab/Ride/Mobile/OnlineRaceInfoPanel"), uiObject); + } + else + { + infoPanel = Instantiate(Resources.Load("UI/Prefab/Ride/Mobile/OnlineInfoPanel"), uiObject); + } +#else + if (mainController.cyclingModel == CyclingModel.Competition) { infoPanel = Instantiate(Resources.Load("UI/Prefab/Ride/OnlineRaceInfoPanel"), uiObject); } @@ -104,6 +114,7 @@ namespace Assets.Scenes.Ride.Scripts { infoPanel = Instantiate(Resources.Load("UI/Prefab/Ride/OnlineInfoPanel"), uiObject); } +#endif } var headPos = infoPanel.transform.Find("Head").position; var infoPos = playerScreenPos + new Vector3(150f, 60f, 0f); diff --git a/Assets/Scripts/Scenes/Ride/Scripts/OtherPlayerController.cs b/Assets/Scripts/Scenes/Ride/Scripts/OtherPlayerController.cs index acf2bbe7..dabff3e5 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/OtherPlayerController.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/OtherPlayerController.cs @@ -72,7 +72,11 @@ namespace Assets.Scenes.Ride.Scripts { if (infoPanel == null) { +#if UNITY_IOS || UNITY_ANDROID + infoPanel = Instantiate(Resources.Load("UI/Prefab/Ride/Mobile/OnlineInfoPanel"), uiObject); +#else infoPanel = Instantiate(Resources.Load("UI/Prefab/Ride/OnlineInfoPanel"), uiObject); +#endif } var headPos = infoPanel.transform.Find("Head").position; var infoPos = playerScreenPos + new Vector3(150f, 60f, 0f); diff --git a/Assets/Scripts/Scenes/Ride/Scripts/SelectPlayerFactory.cs b/Assets/Scripts/Scenes/Ride/Scripts/SelectPlayerFactory.cs index fec9ac32..dc2c8be2 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/SelectPlayerFactory.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/SelectPlayerFactory.cs @@ -92,6 +92,9 @@ namespace Assets.Scenes.Ride.Scripts gameObjects.Add(transform.Find("Panel/Player3").gameObject); gameObjects.Add(transform.Find("Panel/Player4").gameObject); gameObjects.Add(transform.Find("Panel/Player5").gameObject); +#if UNITY_IOS || UNITY_ANDROID + gameObjects.Add(transform.Find("Panel/Player6").gameObject); +#endif //功体比默认条件 //var currentUserWkg = Math.Round((App.CurrentUser.FTP / App.CurrentUser.Weight),2); //_startValue = currentUserWkg - 0.5<0?0 : currentUserWkg - 0.5; diff --git a/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs b/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs index ecb1ca01..a5efadc3 100644 --- a/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs +++ b/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs @@ -41,6 +41,7 @@ public class ConnectDeviceModal : PFUIPanel private UnityEngine.Object deviceItem; private VerticalLayoutGroup content; private PfUIButton connectBtn; + private Text connectBtnText; private Dictionary deviceList; private Text noDevice,Title; private RectTransform searchIconRect; @@ -75,34 +76,54 @@ public class ConnectDeviceModal : PFUIPanel deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem"); connectBtn = container.Find("ConnectBtn").GetComponent(); + connectBtnText = connectBtn.transform.Find("Text").GetComponent(); UIManager.AddEvent(connectBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction(e => { - foreach (var item in deviceList) + if (!connectBtnText.text.Equals("DISCONNECT")) { - if (item.Value.GetStatus() == false) + foreach (var item in deviceList) { - if (SensorType == SensorType.SpeedCadence) + if (item.Value.GetStatus() == false) { - if (item.Value.DeviceInfo.Sensor == SensorType.SpeedCadence || item.Value.DeviceInfo.Sensor == SensorType.Cadence) + if (SensorType == SensorType.SpeedCadence) + { + if (item.Value.DeviceInfo.Sensor == SensorType.SpeedCadence || item.Value.DeviceInfo.Sensor == SensorType.Cadence) + { + //Debug.Log("断开设备" + item.Value.DeviceInfo.Name); + item.Value.DeviceInfo.Disconnect(); + DeviceCache.Remove(item.Value.DeviceInfo); + } + } + else if (item.Value.DeviceInfo.Sensor == SensorType) { - //Debug.Log("断开设备" + item.Value.DeviceInfo.Name); item.Value.DeviceInfo.Disconnect(); DeviceCache.Remove(item.Value.DeviceInfo); } } - else if (item.Value.DeviceInfo.Sensor == SensorType) - { - item.Value.DeviceInfo.Disconnect(); - DeviceCache.Remove(item.Value.DeviceInfo); - } + } + var dd = deviceList.Select(d => d.Value).Where(d => d.GetStatus()).FirstOrDefault(); + if (dd != null) + { + dd.DeviceInfo.Connect(); + DeviceCache.Add(dd.DeviceInfo); } } - var dd = deviceList.Select(d => d.Value).Where(d => d.GetStatus()).FirstOrDefault(); - if (dd != null) + else { - dd.DeviceInfo.Connect(); - DeviceCache.Add(dd.DeviceInfo); + foreach (var item in deviceList) + { + Debug.Log("116" + item.Value.DeviceInfo.Name+ item.Value.GetStatus().ToString()); + if (item.Value.GetStatus()) + { + if (item.Value.DeviceInfo.Sensor == SensorType) + { + item.Value.DeviceInfo.Disconnect(); + Debug.Log("121" + item.Value.DeviceInfo.Name + "断开"); + DeviceCache.Remove(item.Value.DeviceInfo); + } + } + } } this.Close(); })); @@ -172,10 +193,18 @@ public class ConnectDeviceModal : PFUIPanel gameObject.transform.localScale = new Vector3(1, 1, 1); var deviceItemObj = gameObject.GetComponent(); deviceItemObj.DeviceInfo = device; - + UIManager.AddEvent(deviceItemObj.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction(e => { deviceItemObj.Set(true); + if (deviceItemObj.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected) + { + connectBtnText.text = "DISCONNECT"; + } + else + { + connectBtnText.text = "CONNECT"; + } foreach (var item in deviceList) { if (item.Key != deviceItemObj.DeviceInfo.Id) @@ -197,13 +226,20 @@ public class ConnectDeviceModal : PFUIPanel deviceList.Add(device.Id, deviceItemObj); } - if(deviceList.All(d=>d.Value.GetStatus() == false)) + if(deviceList.All(d=>d.Value.GetStatus() == false)) { var firstDevice = deviceList.Select(d => d.Value).Where(d => d.DeviceInfo.State == DeviceState.Connected).OrderByDescending(d => d.DeviceInfo.Priority).FirstOrDefault(); if (firstDevice != null) { firstDevice.Set(true); - + if (firstDevice.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && firstDevice.DeviceInfo.State == DeviceState.Connected) + { + connectBtnText.text = "DISCONNECT"; + } + else + { + connectBtnText.text = "CONNECT"; + } //connectBtn.text.text = "DISCOUNECT"; noDevice.text = firstDevice.DeviceInfo.Name; }