From ca938ab6f516e9ba15c114d17104efa788290776 Mon Sep 17 00:00:00 2001 From: CaiYanPeng Date: Tue, 27 Jul 2021 18:36:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Resources/Images/Race/inplay.png | Bin 1022 -> 1495 bytes Assets/Resources/Images/Race/inplay.png.meta | 2 +- .../Prefab/Panel/DownloadWorkoutsModal.prefab | 1307 +++++++++++++++++ .../Panel/DownloadWorkoutsModal.prefab.meta | 7 + .../UI/Prefab/Panel/RaceHomePanel.prefab | 13 + .../UI/Prefab/Panel/RaceListPanel.prefab | 15 +- Assets/Scripts/Apis/ApiBase.cs | 2 +- Assets/Scripts/UI/Control/PfUIButton.cs | 4 +- .../UI/Prefab/Panel/EditUserController.cs | 6 +- .../Scripts/UI/Prefab/Race/RaceHomeScript.cs | 44 +- .../Scripts/UI/Prefab/Race/RaceItemScript.cs | 5 +- .../Scripts/UI/Prefab/Race/RaceListScript.cs | 32 +- Assets/Scripts/UI/Prefab/Race/RaceScript.cs | 30 +- .../Update/DownloadWorkoutsController.cs | 168 +++ .../Update/DownloadWorkoutsController.cs.meta | 11 + Assets/Scripts/UIManager.cs | 15 + 16 files changed, 1609 insertions(+), 52 deletions(-) create mode 100644 Assets/Resources/UI/Prefab/Panel/DownloadWorkoutsModal.prefab create mode 100644 Assets/Resources/UI/Prefab/Panel/DownloadWorkoutsModal.prefab.meta create mode 100644 Assets/Scripts/UI/Prefab/Update/DownloadWorkoutsController.cs create mode 100644 Assets/Scripts/UI/Prefab/Update/DownloadWorkoutsController.cs.meta diff --git a/Assets/Resources/Images/Race/inplay.png b/Assets/Resources/Images/Race/inplay.png index 65851812efa5d6e1e62cf38e1197b829f771ee7c..1a2d7d3a74ed43a663c75567f7c8a03244530f1a 100644 GIT binary patch delta 800 zcmeyzew|yfGr-TCmrII^fq{Y7)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@PlLAA%rl~=FxsoZTSyGUfwr8B2oERvV5 fNjn$A$i}eGpCMm!*HJ#8xtt81u6{1-oD!M(); + if (App.CurrentUser.Birthday.HasValue) + { + App.CurrentUser.Birthday = App.CurrentUser.Birthday.Value.ToLocalTime(); + } var userinfos = UIManager.Instance.userInfos; var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id); if (i != -1) diff --git a/Assets/Scripts/UI/Prefab/Race/RaceHomeScript.cs b/Assets/Scripts/UI/Prefab/Race/RaceHomeScript.cs index 01e0f608..dcc34629 100644 --- a/Assets/Scripts/UI/Prefab/Race/RaceHomeScript.cs +++ b/Assets/Scripts/UI/Prefab/Race/RaceHomeScript.cs @@ -13,12 +13,17 @@ public class RaceHomeScript : RaceScript { // Start is called before the first frame update private ScrollRect scroll; - private Transform content,rightContainer,leftContainer,btnGoList,avatar; + private Transform content,rightContainer,leftContainer,btnGoList; private float contentSize; private int count; private Button L, R; //当前鼠标悬浮的卡片 - async void Start() + public override void Show() + { + base.Show(); + handleAvatar(); + } + void Start() { scroll = transform.Find("LeftContainer/Swiper").GetComponent(); content = scroll.content; @@ -43,38 +48,31 @@ public class RaceHomeScript : RaceScript }); } StartTime(); -#if UNITY_EDITOR - if (App.CurrentUser == null) //App.CurrentUser == null - { - await Login(); - } -#endif rightContainer = transform.Find("RightContainer"); leftContainer = transform.Find("LeftContainer"); btnGoList = rightContainer.Find("Container-2/BtnGoList"); UIManager.AddEvent(btnGoList.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { - UIManager.ShowRaceListPanel(); + transform.GetComponent().DOFade(0, 0.5f).onComplete = () => + { + UIManager.ShowRaceListPanel(); + }; }); - avatar = transform.Find("Avatar"); - if (avatar != null) - { - Utils.DisplayImage(avatar.GetComponent(), App.CurrentUser.WxHeadImg, true); - UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => - { - UIManager.ShowUserInfoPanel(); - }); - } - var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7,order:0); - var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1,order:1); - DisplayMaps(r.data,activityList.data); + handleAvatar(); + GetData(); + } + + async void GetData() + { + var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7, order: 0); + var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1, order: 1); + DisplayMaps(r.data, activityList.data); Initial(); - Utils.StartTimeUnLimit(10, () => + Utils.StartTimeUnLimit(10, () => { goRight(); }); } - private void DisplayMaps(List list, List activityList) { int i = 0; diff --git a/Assets/Scripts/UI/Prefab/Race/RaceItemScript.cs b/Assets/Scripts/UI/Prefab/Race/RaceItemScript.cs index 8aa184cb..ff49a5de 100644 --- a/Assets/Scripts/UI/Prefab/Race/RaceItemScript.cs +++ b/Assets/Scripts/UI/Prefab/Race/RaceItemScript.cs @@ -46,7 +46,10 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH transform.Find("CountContainer/Text").GetComponent().text = mapCompetition.ApplyCount.ToString(); SetStatus(mapCompetition); SetButtonGroup(mapCompetition); - this.parent = parent; + if (parent != null) + { + this.parent = parent; + } this.mapCompetition = mapCompetition; } diff --git a/Assets/Scripts/UI/Prefab/Race/RaceListScript.cs b/Assets/Scripts/UI/Prefab/Race/RaceListScript.cs index 10e39588..7c2db4c9 100644 --- a/Assets/Scripts/UI/Prefab/Race/RaceListScript.cs +++ b/Assets/Scripts/UI/Prefab/Race/RaceListScript.cs @@ -1,6 +1,7 @@ using Assets.Scripts; using Assets.Scripts.Apis.Models; using Assets.Scripts.UI.Prefab.Race; +using DG.Tweening; using System; using System.Collections; using System.Collections.Generic; @@ -21,15 +22,14 @@ public class RaceListScript : RaceScript private List statusOptions = new List(); bool isReserve = false; int order = 1; - //筛选条件 - async void Start() + public override void Show() + { + base.Show(); + handleAvatar(); + } + //筛选条件 + void Start() { -#if UNITY_EDITOR - if (App.CurrentUser == null) //App.CurrentUser == null - { - await Login(); - } -#endif scroll = transform.Find("ListContainer/List").gameObject; if (scroll != null) { @@ -108,18 +108,13 @@ public class RaceListScript : RaceScript { UIManager.AddEvent(btnReturn.gameObject, EventTriggerType.PointerClick, (b) => { - UIManager.ShowRaceHomePanel(true); - }); - } - avatar = transform.Find("Avatar"); - if (avatar != null) - { - Utils.DisplayImage(avatar.GetComponent(), App.CurrentUser.WxHeadImg, true); - UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => - { - UIManager.ShowUserInfoPanel(); + transform.GetComponent().DOFade(0, 0.5f).onComplete = () => + { + UIManager.ShowRaceHomePanel(true); + }; }); } + handleAvatar(); Refresh(); } @@ -134,7 +129,6 @@ public class RaceListScript : RaceScript { if (Input.GetAxis("Mouse ScrollWheel") != 0) { - Debug.Log(scroll.GetComponent().verticalNormalizedPosition); if (scroll.GetComponent().verticalNormalizedPosition <= 0 || scroll.GetComponent().verticalNormalizedPosition >= (pageIndex == 0 ? 1.2 : 1)) { diff --git a/Assets/Scripts/UI/Prefab/Race/RaceScript.cs b/Assets/Scripts/UI/Prefab/Race/RaceScript.cs index a9529e19..84ff4016 100644 --- a/Assets/Scripts/UI/Prefab/Race/RaceScript.cs +++ b/Assets/Scripts/UI/Prefab/Race/RaceScript.cs @@ -1,4 +1,5 @@ using Assets.Scripts; +using DG.Tweening; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -8,6 +9,11 @@ public class RaceScript : PFUIPanel { // Start is called before the first frame update protected Transform currentItem { get; set; } + public override void Show() + { + base.Show(); + transform.GetComponent().DOFade(1, 0.5f); + } protected void StartTime() { timerFlag = true; @@ -34,6 +40,20 @@ public class RaceScript : PFUIPanel StopTime(); } } + private Transform avatar; + protected void handleAvatar() + { + avatar = transform.Find("Avatar"); + if (avatar != null) + { + Debug.Log(App.CurrentUser.WxHeadImg); + Utils.DisplayImage(avatar.GetComponent(), App.CurrentUser.WxHeadImg, true); + UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => + { + UIManager.ShowUserInfoPanel(); + }); + } + } /*参考代码 var second = Math.Ceiling((Now - mapCompetition.StartTime.ToLocalTime()).TotalSeconds); @@ -54,7 +74,6 @@ public class RaceScript : PFUIPanel if (currentItem != null && currentItem.Find("GetReadyContainer").gameObject.activeSelf) { var map = currentItem.GetComponent().mapCompetition; - Debug.Log(map.Status); if (map.Status == 1) { currentItem.Find("GetReadyContainer/Title").GetComponent().text = "Application Start Time"; @@ -67,16 +86,21 @@ public class RaceScript : PFUIPanel else { //Dictionary - var time = (map.Status == 1 ? map.StartTime.ToLocalTime() : map.EndTime.ToLocalTime()) - UIManager.Now.GetDateTime(); + var time = (map.Status == 2 ? map.StartTime.ToLocalTime() : map.EndTime.ToLocalTime()) - UIManager.Now.GetDateTime(); if (time.TotalSeconds < 0) { currentItem.Find("GetReadyContainer").GetComponent().alpha = 0; + var res = ConfigHelper.mapCompetitionApi.GetById(map.Id); + if (res.result) + { + currentItem.GetComponent().Initial(res.data, null); + } } else { currentItem.Find("GetReadyContainer").GetComponent().alpha = 1; currentItem.Find("GetReadyContainer/Title").GetComponent().text - = map.Status == 1 ? "Get Ready" : "Riding Time"; + = map.Status == 2 ? "Get Ready" : "Riding Time"; currentItem.Find("GetReadyContainer/Value").GetComponent().text = Utils.GetCountDown(time); } diff --git a/Assets/Scripts/UI/Prefab/Update/DownloadWorkoutsController.cs b/Assets/Scripts/UI/Prefab/Update/DownloadWorkoutsController.cs new file mode 100644 index 00000000..49acba38 --- /dev/null +++ b/Assets/Scripts/UI/Prefab/Update/DownloadWorkoutsController.cs @@ -0,0 +1,168 @@ +using Assets.Scripts; +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Net; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; + +public class DownloadWorkoutsController : PFUIPanel +{ + // Start is called before the first frame update + Transform Btn, Loading,Exit,BtnStart; + ScrollRect scroll; + string path; + [SerializeField] Transform log; + void Start() + { + Btn = transform.Find("Panel/BtnConfirm"); + BtnStart = transform.Find("Panel/BtnStart"); + Loading = transform.Find("Panel/LoadingContainer"); + scroll = transform.Find("Panel/Scroll View").GetComponent(); + Exit = transform.Find("Panel/Exit"); + UIManager.AddEvent(Exit.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) => + { + Utils.showToast(gameObject, "Please update to the latest version."); + }); + SetType(1); + //Button.GetComponent