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

84 lines
2.3 KiB
C#

using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Code.Scripts.HotUpdate.UI
{
public class TempUpdateUI : MonoBehaviour
{
public Camera UICamera;
public GameObject m_DialogObj;
public GameObject m_ProgressObj;
public GameObject m_PrivacyDialogObj;
public Slider m_SliderProgress;
public TextMeshProUGUI m_textSliderProgress;
public TextMeshProUGUI m_TextProgress;
//public TextMeshProUGUI m_TextTitle;
public TextMeshProUGUI m_TextContent;
/// <summary>
/// 版本
/// </summary>
public TextMeshProUGUI m_TextVersion;
public LinkTextAOT PrivacyAgreementText;
public static TempUpdateUI Instance { get; private set; }
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/";
private void Awake()
{
Instance = this;
#if DEVELOPMENT_BUILD || DEBUG
if(m_DialogObj.TryGetComponent(out Button btn))
btn.enabled = true;
#else
if(m_DialogObj.TryGetComponent(out Button btn))
btn.enabled = false;
#endif
m_DialogObj.SetActive(false);
m_ProgressObj.SetActive(false);
m_PrivacyDialogObj.SetActive(false);
PrivacyAgreementText.SetText(string.Format(LocalizeMono.Instance.GetLocalizeText("PrivacyContent"), url1, url2, url3));
}
public void OnClickOk()
{
isClickOk = true;
m_DialogObj.SetActive(false);
}
public void OnClickCancel()
{
isClickOk = false;
m_DialogObj.SetActive(false);
Application.Quit();
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
}
public void OnClickPrivacyOk()
{
PlayerPrefs.SetInt("PrivacyAgreement", BIManager.Agree_Privacy);
m_PrivacyDialogObj.SetActive(false);
PrivacyAgreeCallback?.Invoke();
}
public void OnClickPrivacyCancel()
{
m_PrivacyDialogObj.SetActive(false);
Application.Quit();
}
}
}