public void Initialize(GDPRConsentDialog.Section section)
        {
            this.section = section;

            if (!string.IsNullOrEmpty(section.description))
            {
                description.text = section.description;
                description.gameObject.SetActive(true);
            }
            else
            {
                description.gameObject.SetActive(false);
            }

            if (!string.IsNullOrEmpty(section.title))
            {
                title.text = section.title;
                title.gameObject.SetActive(true);
            }
            else
            {
                title.gameObject.SetActive(false);
            }

            if (!string.IsNullOrEmpty(section.identifier))
            {
                toggle.gameObject.SetActive(true);

                SimpleGDPR.ConsentState consentState = GDPRConsentCanvas.GetConsentState(section.identifier);
                if (consentState == SimpleGDPR.ConsentState.Unknown)
                {
                    toggleHolder.Value = section.initialConsentValue;
                }
                else
                {
                    toggleHolder.Value = consentState != SimpleGDPR.ConsentState.No;
                }
            }
            else
            {
                toggle.gameObject.SetActive(false);
            }

            if (section.onButtonClicked != null)
            {
                buttonLabel.text = !string.IsNullOrEmpty(section.buttonLabel) ? section.buttonLabel : "Configure";
                button.gameObject.SetActive(true);
            }
            else
            {
                button.gameObject.SetActive(false);
            }

            toggleHolder.gameObject.SetActive(toggle.gameObject.activeSelf || title.gameObject.activeSelf);
        }
Exemple #2
0
 public static void SetConsentState(string identifier, SimpleGDPR.ConsentState value)
 {
     PlayerPrefs.SetInt("GDPR_" + identifier, (int)value);
 }
Exemple #3
0
 public static void SetTermsOfServiceState(SimpleGDPR.ConsentState value)
 {
     PlayerPrefs.SetInt("GDPR_Terms", (int)value);
 }