From a5207bd97cb15c02544cfe0ab2d628727ddede7c Mon Sep 17 00:00:00 2001 From: ZYT <2300409876@qq.com> Date: Wed, 6 Aug 2025 17:59:19 +0800 Subject: [PATCH] no message --- .gitignore | 1 + .../Scripts/Manager/TrueGearEffectManager.cs | 2 + Assets/Scripts/UI/LoginPanel.cs | 162 ++++++++++++++++++ Assets/Scripts/UI/LoginPanel.cs.meta | 2 +- Assets/StreamingAssets/build_info | 2 +- ProjectSettings/GraphicsSettings.asset | 2 +- 6 files changed, 168 insertions(+), 3 deletions(-) create mode 100644 Assets/Scripts/UI/LoginPanel.cs diff --git a/.gitignore b/.gitignore index 124512ae..13ebf36a 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,4 @@ crashlytics-build.properties ProjectSettings/EditorBuildSettings.asset ProjectSettings/ProjectSettings.asset Assets/FR2_Cache.asset +Assets/FR2_Cache.asset.meta diff --git a/Assets/Scripts/Manager/TrueGearEffectManager.cs b/Assets/Scripts/Manager/TrueGearEffectManager.cs index abae9d55..572f48ef 100644 --- a/Assets/Scripts/Manager/TrueGearEffectManager.cs +++ b/Assets/Scripts/Manager/TrueGearEffectManager.cs @@ -138,7 +138,9 @@ public class TrueGearEffectManager : MonoBehaviour { //断开连接 Debug.Log("断开连接"); +#if !UNITY_EDITOR CloseConnect(); +#endif } diff --git a/Assets/Scripts/UI/LoginPanel.cs b/Assets/Scripts/UI/LoginPanel.cs new file mode 100644 index 00000000..42d32115 --- /dev/null +++ b/Assets/Scripts/UI/LoginPanel.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BestHTTP; +using DragonLi.Core; +using TMPro; +using Unity.XR.PXR; +using UnityEngine; +using UnityEngine.UI; + +/// +/// 登录信息 +/// +public class LoginInfo +{ + public string deviceSn = ""; + public string startAt = ""; + public int shop; + public int gameId; +} + +public class ResponseInfo +{ + public int code = 400; + public string msg = ""; +} + +public class LoginPanel : MonoBehaviour + { + public UIState PanelState; + + private int RequestLoginCount = 0; + + public Image progressImage; + public TextMeshProUGUI progressText; + + private int _progress; + private bool _isLogin; + public static void Show() + { + WorldUIManager.Ins.Cover("UI/LoginPanel", false); + } + + public void Start() + { +#if !UNITY_EDITOR && UNITY_ANDROID && PICO + PXR_Enterprise.InitEnterpriseService(); + PXR_Enterprise.BindEnterpriseService(); +#endif + Author(); + if (progressImage == null) + return; + StartCoroutine(Progress()); + } + + public void Author() + { + //延迟请求 + MonoSingleton.Instance.WaitSecondTodo(() => + { + // 登录 + GameManager.Ins.Request((req, response) => + + { + RequestLoginCount++; + if (response == null) + { + Debug.Log("鉴权失败1"); + if (RequestLoginCount < 2) + { + Author(); + return; + } + PanelState.StateChange(1); + return; + } + ResponseInfo info = JsonUtility.FromJson(response.DataAsText); + if (info.code < 200 || info.code >= 300) + { + Debug.Log("鉴权失败2"); + if (RequestLoginCount < 2) + { + Author(); + return; + } + PanelState.StateChange(1); + return; + } + + if (info.code == 200) + { + GameManager.Ins.InitData(); + _isLogin = true; + } + }); + }, 1); + } + + IEnumerator Progress() + { + + progressImage.fillAmount = 0; + progressText.text = "0%"; + _progress = 0; + _isLogin = false; + + //GameManager.Ins.InitData(); + //_isLogin = true;//修改为本地游戏 + float curWaitTime = 0; + + while (_progress<=90) + { + //Debug.Log(_progress); + progressText.text = _progress + "%"; + progressImage.fillAmount = _progress/100f; + _progress += 1; + yield return new WaitForSeconds(0.02f); + } + + Debug.Log("是否鉴定成功 :"+_isLogin); + if (_isLogin) + { + while (_progress<=100) + { + progressText.text = _progress + "%"; + progressImage.fillAmount = _progress/100f; + _progress += 1; + yield return new WaitForSeconds(0.02f); + } + Debug.Log("鉴权成功"); + StartGame(); + } + else + { + while (!_isLogin && curWaitTime < 30) + { + curWaitTime += 1; + yield return new WaitForSeconds(1f); + } + if (_isLogin) + { + while (_progress<=100) + { + progressText.text = _progress + "%"; + progressImage.fillAmount = _progress/100f; + _progress += 1; + yield return new WaitForSeconds(0.02f); + } + StartGame(); + } + } + } + + public void StartGame() + { + RequestLoginCount = 0; + WorldUIManager.Ins.Back(); + + GameManager.Ins.CreateGameStartPoint(); + + } + } diff --git a/Assets/Scripts/UI/LoginPanel.cs.meta b/Assets/Scripts/UI/LoginPanel.cs.meta index 8b12eb67..b223f65c 100644 --- a/Assets/Scripts/UI/LoginPanel.cs.meta +++ b/Assets/Scripts/UI/LoginPanel.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: eaf6efb413af3fe4887c4ac5943879ee +guid: a34560ba714cecc45879fecccbe03753 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/StreamingAssets/build_info b/Assets/StreamingAssets/build_info index 9abf076e..30088e59 100644 --- a/Assets/StreamingAssets/build_info +++ b/Assets/StreamingAssets/build_info @@ -1 +1 @@ -Build from CHINAMI-UKDLSK3 at 2025/7/31 17:08:06 \ No newline at end of file +Build from ZTT at 2025/8/6 17:57:18 \ No newline at end of file diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index b7aec058..c69a9519 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -108,7 +108,7 @@ GraphicsSettings: m_FogKeepExp: 1 m_FogKeepExp2: 1 m_AlbedoSwatchInfos: [] - m_LightsUseLinearIntensity: 0 + m_LightsUseLinearIntensity: 1 m_LightsUseColorTemperature: 1 m_DefaultRenderingLayerMask: 1 m_LogWhenShaderIsCompiled: 0