From 2c5501a096cf3f1951c53856bfe0182e64f67858 Mon Sep 17 00:00:00 2001 From: CaiYanPeng Date: Mon, 10 May 2021 10:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E7=9B=AE=E5=89=8D=E6=98=AF=E5=BC=BA=E5=88=B6=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Assets/Cyp/load.png.meta | 6 +- Assets/Resources/Images/empty.png | Bin 0 -> 155 bytes Assets/Resources/Images/empty.png.meta | 116 ++ Assets/Resources/Loading/LoadingToLeft.shader | 2 +- .../UI/Prefab/Panel/DownloadModal.prefab | 1136 +++++++++++++++++ .../UI/Prefab/Panel/DownloadModal.prefab.meta | 7 + Assets/Resources/UI/Prefab/Update.meta | 8 + Assets/Resources/UI/Prefab/Update/Log.prefab | 353 +++++ .../UI/Prefab/Update/Log.prefab.meta | 7 + Assets/Scenes/MainScene.unity | 45 +- .../Ride/Scripts/SelectPlayerFactory.cs | 1 - Assets/Scripts/Apis/Models/UpdateModel.cs | 22 + .../Scripts/Apis/Models/UpdateModel.cs.meta | 11 + Assets/Scripts/App.cs | 10 +- Assets/Scripts/Scenes/LoginController.cs | 30 +- Assets/Scripts/Scenes/MainController.cs | 3 +- .../UI/Prefab/Device/ConnectDeviceModal.cs | 1 + Assets/Scripts/UI/Prefab/Update.meta | 8 + .../UI/Prefab/Update/DownloadController.cs | 138 ++ .../Prefab/Update/DownloadController.cs.meta | 11 + .../Scripts/UI/Prefab/Update/DownloadLog.cs | 32 + .../UI/Prefab/Update/DownloadLog.cs.meta | 11 + Assets/Scripts/UIManager.cs | 13 + Assets/Scripts/Utils/Utils.cs | 21 +- 25 files changed, 1922 insertions(+), 71 deletions(-) create mode 100644 Assets/Resources/Images/empty.png create mode 100644 Assets/Resources/Images/empty.png.meta create mode 100644 Assets/Resources/UI/Prefab/Panel/DownloadModal.prefab create mode 100644 Assets/Resources/UI/Prefab/Panel/DownloadModal.prefab.meta create mode 100644 Assets/Resources/UI/Prefab/Update.meta create mode 100644 Assets/Resources/UI/Prefab/Update/Log.prefab create mode 100644 Assets/Resources/UI/Prefab/Update/Log.prefab.meta create mode 100644 Assets/Scripts/Apis/Models/UpdateModel.cs create mode 100644 Assets/Scripts/Apis/Models/UpdateModel.cs.meta create mode 100644 Assets/Scripts/UI/Prefab/Update.meta create mode 100644 Assets/Scripts/UI/Prefab/Update/DownloadController.cs create mode 100644 Assets/Scripts/UI/Prefab/Update/DownloadController.cs.meta create mode 100644 Assets/Scripts/UI/Prefab/Update/DownloadLog.cs create mode 100644 Assets/Scripts/UI/Prefab/Update/DownloadLog.cs.meta diff --git a/.gitignore b/.gitignore index c8d4217a..4cbcea7b 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,4 @@ Assets/Resources/Sound.meta Assets/MapWorkoutRecords Assets/Mapbox/User Assets/Mapbox/User.meta +GPUCache diff --git a/Assets/Cyp/load.png.meta b/Assets/Cyp/load.png.meta index 57c3ef24..a44a7299 100644 --- a/Assets/Cyp/load.png.meta +++ b/Assets/Cyp/load.png.meta @@ -34,9 +34,9 @@ TextureImporter: filterMode: -1 aniso: -1 mipBias: -100 - wrapU: 2 - wrapV: 2 - wrapW: 2 + wrapU: 0 + wrapV: 0 + wrapW: 0 nPOTScale: 0 lightmap: 0 compressionQuality: 50 diff --git a/Assets/Resources/Images/empty.png b/Assets/Resources/Images/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..ef60f3f04a831de125aaed7159c442cf06cf916c GIT binary patch literal 155 zcmeAS@N?(olHy`uVBq!ia0vp^DnKm3!3HEJ?TGgSQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XB4ude`@%$AjKtTgf7sn6}@3-d+85s=|2y@-tcL*y uZX32PnIJOBDaeD%Q&Cd|%t>DOmU-FTVwc&|Yd- UpdateLog { get; set; } + } + public class VersionModel + { + public string Version { get; set; } + public DateTime CreateTime { get; set; } + public string Desc { get; set; } + } +} diff --git a/Assets/Scripts/Apis/Models/UpdateModel.cs.meta b/Assets/Scripts/Apis/Models/UpdateModel.cs.meta new file mode 100644 index 00000000..c29f0de5 --- /dev/null +++ b/Assets/Scripts/Apis/Models/UpdateModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 72e93f3cdcc50a64aa7dbda61c720707 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/App.cs b/Assets/Scripts/App.cs index 55f2f640..7e5c561d 100644 --- a/Assets/Scripts/App.cs +++ b/Assets/Scripts/App.cs @@ -8,9 +8,9 @@ using System.Net; public static class App { - public static string Host = "http://192.168.0.97:5082/"; + public static string Host = "http://192.168.0.101:5082/"; - public static string AppVersion = "1.0.0"; + public static string AppVersion = Application.version; public static int RouteIdParam = 0; public static UserResultModel CurrentUser { get; set; } @@ -44,7 +44,10 @@ public static class App public static IPEndPoint UdpAddress { get; private set; } = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000); public static IPEndPoint TcpAddress { get; private set; } = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 21001); - + public static UpdateModel UpdateObject { get; set; } + //public static string AppDownloadUrl { get; internal set; } + //public static string AppVersionCode { get; internal set; } + static App() { #if !UNITY_EDITOR @@ -52,6 +55,5 @@ public static class App UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000); TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001); #endif - } } diff --git a/Assets/Scripts/Scenes/LoginController.cs b/Assets/Scripts/Scenes/LoginController.cs index cecc28fd..d285809a 100644 --- a/Assets/Scripts/Scenes/LoginController.cs +++ b/Assets/Scripts/Scenes/LoginController.cs @@ -217,7 +217,7 @@ public class LoginController : MonoBehaviour { var info = Instantiate(Resources.Load("UI/Prefab/Login/QuickUserInfo")).transform; info.GetComponent().Initial(user, transform); - info.parent = content; + info.SetParent(content); info.localScale = new Vector3(1, 1, 1); } content.Find("empty1").transform.SetSiblingIndex(0); @@ -459,24 +459,33 @@ public class LoginController : MonoBehaviour async void Init() { - GetRotateImage(); UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent(); userInfos = UIManager.Instance.userInfos; App.DefaultRotateTexture = Utils.ReadTextureFromPlayerPrefs("rotateImage"); - var notifyId = PlayerPrefs.GetInt("notifyId"); App.firstEnter = PlayerPrefs.GetInt("firstEnter"); PlayerPrefs.SetInt("firstEnter", 1); + var notifyId = PlayerPrefs.GetInt("notifyId"); var r = await ConfigHelper.userApi.GetNotify(); if (r.result) { +//#if !UNITY_EDITOR + var ver = r.data.Value("Version").ToObject(); + if (ver!=null && ver.HasUpdate) + { + App.UpdateObject = ver; + Debug.Log(Application.persistentDataPath + "/PowerFun.exe"); + UIManager.ShowDownloadModal(); + } +//#endif App.notifyContent = r.data.Value("Content"); + if (r.data.Value("Id") != notifyId) { UIManager.ShowNewsModal(); PlayerPrefs.SetInt("notifyId", r.data.Value("Id")); } - //content.GetComponent().text } + GetRotateImage(); } async void GetRotateImage() @@ -518,14 +527,6 @@ public class LoginController : MonoBehaviour private void AdjustWxQrCode() { wxBrowser.EvalJSCSP(@" - const f = ()=>{ - //if(document.body.style.padding === '0px') - //{ - // console.log('停止'); - // isFinish(); - // return; - //} - console.log('js调整'); document.getElementsByClassName('qrcode')[0].style.marginTop = 0; document.getElementsByClassName('title')[0].style.display = 'none'; document.getElementById('wx_default_tip').childNodes[3].innerHTML = `""PowerFun""`; @@ -533,10 +534,7 @@ public class LoginController : MonoBehaviour document.body.style.overflow = 'hidden'; document.body.style.transformOrigin = 'top left'; document.body.style.transform = 'scale(0.85106382978)'; - document.body.style.padding = '0'; - - } - f();").Done(); + document.body.style.padding = '0';").Done(); } //浏览器加载回调 private async void OnUserScan() diff --git a/Assets/Scripts/Scenes/MainController.cs b/Assets/Scripts/Scenes/MainController.cs index 35f2efa0..af7b5539 100644 --- a/Assets/Scripts/Scenes/MainController.cs +++ b/Assets/Scripts/Scenes/MainController.cs @@ -47,7 +47,7 @@ public class MainController : MonoBehaviour //{ // UIManager.ShowHomePanel(); //}); - if (App.MainSceneParam.ContainsKey("Name") && !string.IsNullOrEmpty(App.MainSceneParam["Name"]) ) + if (App.MainSceneParam.ContainsKey("Name") && !string.IsNullOrEmpty(App.MainSceneParam["Name"])) { UIManager.PushHome(); if (App.MainSceneParam["Name"] == "MapListPanel") @@ -59,6 +59,7 @@ public class MainController : MonoBehaviour { UIManager.ShowUserInfoPanel(); } + App.MainSceneParam["Name"] = string.Empty; } else { diff --git a/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs b/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs index 879323a8..446931be 100644 --- a/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs +++ b/Assets/Scripts/UI/Prefab/Device/ConnectDeviceModal.cs @@ -127,6 +127,7 @@ public class ConnectDeviceModal : PFUIPanel //Debug.Log(AntConnector.Instance().discoveredDevices.Count(d => d.Sensor == SensorType)); var devices = new List(); + var a = AntConnector.Instance().discoveredDevices; switch (SensorType) { case SensorType.Cadence: diff --git a/Assets/Scripts/UI/Prefab/Update.meta b/Assets/Scripts/UI/Prefab/Update.meta new file mode 100644 index 00000000..7a002c9e --- /dev/null +++ b/Assets/Scripts/UI/Prefab/Update.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25494196c8da0294aa28730d63bf7498 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/Prefab/Update/DownloadController.cs b/Assets/Scripts/UI/Prefab/Update/DownloadController.cs new file mode 100644 index 00000000..e46e4efa --- /dev/null +++ b/Assets/Scripts/UI/Prefab/Update/DownloadController.cs @@ -0,0 +1,138 @@ +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 DownloadController : PFUIPanel +{ + // Start is called before the first frame update + Transform Button,Loading,Exit; + ScrollRect scroll; + string path; + [SerializeField] Transform log; + void Start() + { + Button = transform.Find("Panel/BtnConfirm"); + 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(false); + //Button.GetComponent