using System; using System.Collections; using System.Collections.Generic; using DG.Tweening; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class Bootstrapper : MonoBehaviour { [SerializeField] private CanvasGroup PrivacyPolicyPanel; [SerializeField] private Slider loadingSlider; private void Awake() { CheckForPrivacyPolicy(); } public void CheckForPrivacyPolicy() { // Check if the key exists and its value if (PlayerPrefs.GetInt(GameConstants.PrivacyPolicyPrefKey, 0) == 0) { // Show the privacy policy panel PrivacyPolicyPanel.alpha = 0; PrivacyPolicyPanel.gameObject.SetActive(true); PrivacyPolicyPanel.DOFade(1, 0.5f); } else { // Hide the panel if already accepted PrivacyPolicyPanel.gameObject.SetActive(false); } } // Call this method when the user agrees to the privacy policy public void OnAgreeButtonPressed() { PlayerPrefs.SetInt(GameConstants.PrivacyPolicyPrefKey, 1); PlayerPrefs.Save(); // Hide the panel PrivacyPolicyPanel.DOFade(0, 0.5f).OnComplete(() => { PrivacyPolicyPanel.gameObject.SetActive(false); }); } public void StartGame() { Debug.Log("StartGame0"); loadingSlider.gameObject.SetActive(true); loadingSlider.DOValue(100f, 2.5f).OnComplete(() => { Debug.Log("StartGame1"); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); Debug.Log("StartGame2"); }); } public void OnPrivacyPolicyClicked() { Application.OpenURL(GameConstants.PrivacyPolicyLink); } }