108 lines
3.1 KiB
C#
108 lines
3.1 KiB
C#
using Assets.PhxhSDK.AOT.BI;
|
|
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace 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>
|
|
/// Aot版本
|
|
/// </summary>
|
|
public TextMeshProUGUI m_TextAotVersion;
|
|
/// <summary>
|
|
/// 当前资源版本
|
|
/// </summary>
|
|
public TextMeshProUGUI m_TextCurResVersion;
|
|
/// <summary>
|
|
/// 最新资源版本
|
|
/// </summary>
|
|
public TextMeshProUGUI m_TextNewResVersion;
|
|
|
|
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);
|
|
BIToolinAOT.Instance.TrackEventInAOT("app_privacy_permission", new System.Collections.Generic.Dictionary<string, object>()
|
|
{
|
|
{"result", 0 }//0: success
|
|
});
|
|
PrivacyAgreeCallback?.Invoke();
|
|
}
|
|
|
|
public void OnClickPrivacyCancel()
|
|
{
|
|
m_PrivacyDialogObj.SetActive(false);
|
|
BIToolinAOT.Instance.TrackEventInAOT("app_privacy_permission", new System.Collections.Generic.Dictionary<string, object>()
|
|
{
|
|
{"result", 1 }//1: cancel
|
|
});
|
|
Application.Quit();
|
|
}
|
|
private void OnDestroy()
|
|
{
|
|
if (Instance == this)
|
|
{
|
|
Instance = null;
|
|
}
|
|
}
|
|
}
|
|
}
|