NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/HotUpdate/UI/TempUpdateUI.cs

111 lines
3.2 KiB
C#
Raw Normal View History

2025-09-01 17:21:29 +08:00
using Assets.PhxhSDK.AOT.BI;
using System;
2025-10-17 18:51:01 +08:00
using Obfuz;
using TMPro;
2024-02-22 14:53:23 +08:00
using UnityEngine;
using UnityEngine.UI;
2025-09-04 14:01:19 +08:00
namespace HotUpdate.UI
2024-02-22 14:53:23 +08:00
{
2025-10-17 18:51:01 +08:00
[ObfuzIgnore]
2024-02-22 14:53:23 +08:00
public class TempUpdateUI : MonoBehaviour
{
2024-07-16 14:00:58 +08:00
public Camera UICamera;
2024-02-22 14:53:23 +08:00
public GameObject m_DialogObj;
public GameObject m_ProgressObj;
public GameObject m_PrivacyDialogObj;
2025-06-27 14:43:16 +08:00
2024-02-22 14:53:23 +08:00
public Slider m_SliderProgress;
2024-07-10 17:54:47 +08:00
public TextMeshProUGUI m_textSliderProgress;
2024-02-22 14:53:23 +08:00
public TextMeshProUGUI m_TextProgress;
2025-06-27 14:43:16 +08:00
//public TextMeshProUGUI m_TextTitle;
2024-02-22 14:53:23 +08:00
public TextMeshProUGUI m_TextContent;
2024-08-08 15:58:28 +08:00
/// <summary>
2025-07-18 15:37:15 +08:00
/// Aot版本
2024-08-08 15:58:28 +08:00
/// </summary>
2025-07-18 15:37:15 +08:00
public TextMeshProUGUI m_TextAotVersion;
/// <summary>
2025-08-01 15:08:19 +08:00
/// 当前资源版本
2025-07-18 15:37:15 +08:00
/// </summary>
2025-08-01 15:08:19 +08:00
public TextMeshProUGUI m_TextCurResVersion;
2025-07-18 15:37:15 +08:00
/// <summary>
2025-08-01 15:08:19 +08:00
/// 最新资源版本
2025-07-18 15:37:15 +08:00
/// </summary>
2025-08-01 15:08:19 +08:00
public TextMeshProUGUI m_TextNewResVersion;
2024-11-28 18:47:57 +08:00
public LinkTextAOT PrivacyAgreementText;
2025-06-27 14:43:16 +08:00
2024-07-16 14:00:58 +08:00
public static TempUpdateUI Instance { get; private set; }
2024-02-22 14:53:23 +08:00
public bool isClickOk;
public Action PrivacyAgreeCallback;
string url1 = "https://kedrgame.com/user_agreement.txt";
string url2 = "https://kedrgame.com/privacy_agreement.txt";
string url3 = "https://kedrgame.com/";
2024-02-22 14:53:23 +08:00
private void Awake()
{
2024-07-16 14:00:58 +08:00
Instance = this;
2024-12-13 15:15:19 +08:00
#if DEVELOPMENT_BUILD || DEBUG
2025-06-27 14:43:16 +08:00
if (m_DialogObj.TryGetComponent(out Button btn))
2024-12-13 15:15:19 +08:00
btn.enabled = true;
#else
if(m_DialogObj.TryGetComponent(out Button btn))
btn.enabled = false;
#endif
2024-02-23 12:28:25 +08:00
m_DialogObj.SetActive(false);
m_ProgressObj.SetActive(false);
m_PrivacyDialogObj.SetActive(false);
2025-01-10 18:40:47 +08:00
PrivacyAgreementText.SetText(string.Format(LocalizeMono.Instance.GetLocalizeText("PrivacyContent"), url1, url2, url3));
2024-02-22 14:53:23 +08:00
}
public void OnClickOk()
{
isClickOk = true;
m_DialogObj.SetActive(false);
}
public void OnClickCancel()
{
isClickOk = false;
m_DialogObj.SetActive(false);
2024-07-11 17:16:09 +08:00
Application.Quit();
2024-07-16 14:00:58 +08:00
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
2024-02-22 14:53:23 +08:00
}
public void OnClickPrivacyOk()
{
PlayerPrefs.SetInt("PrivacyAgreement", BIManager.Agree_Privacy);
m_PrivacyDialogObj.SetActive(false);
2026-04-21 19:22:47 +08:00
PrivacyAgreeCallback?.Invoke();
2025-09-01 17:21:29 +08:00
BIToolinAOT.Instance.TrackEventInAOT("app_privacy_permission", new System.Collections.Generic.Dictionary<string, object>()
{
{"result", 0 }//0: success
});
}
public void OnClickPrivacyCancel()
{
m_PrivacyDialogObj.SetActive(false);
2025-09-01 17:21:29 +08:00
BIToolinAOT.Instance.TrackEventInAOT("app_privacy_permission", new System.Collections.Generic.Dictionary<string, object>()
{
{"result", 1 }//1: cancel
});
Application.Quit();
}
2025-06-27 14:43:16 +08:00
private void OnDestroy()
{
if (Instance == this)
{
Instance = null;
}
}
2024-02-22 14:53:23 +08:00
}
}