AgreenmentOption.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class AgreenmentOption : MonoBehaviour
  6. {
  7. public static AgreenmentOption ins;
  8. void Awake() {
  9. ins = this;
  10. InitAgreementOnClickListeners();
  11. }
  12. void OnDestroy() {
  13. if (ins == this) ins = null;
  14. }
  15. void InitAgreementOnClickListeners() {
  16. transform.Find("TextA").GetComponent<Button>().onClick.AddListener(delegate() {
  17. GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
  18. o.GetComponent<AgreementView>().EnterUserAgreement();
  19. });
  20. transform.Find("TextB").GetComponent<Button>().onClick.AddListener(delegate() {
  21. GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
  22. o.GetComponent<AgreementView>().EnterPrivacyAgreement();
  23. });
  24. }
  25. public bool IsAgreementChecked() {
  26. return transform.Find("Toggle").GetComponent<Toggle>().isOn;
  27. }
  28. public void SetAgreementChecked(bool value) {
  29. transform.Find("Toggle").GetComponent<Toggle>().isOn = value;
  30. }
  31. }