AgreenmentOption_Second.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. /* 勾选框-用户协议和隐私政策 */
  6. public class AgreenmentOption_Second : MonoBehaviour
  7. {
  8. [SerializeField] Toggle toggle;
  9. void Awake() {
  10. toggle.onValueChanged.AddListener(SetAgreementChecked);
  11. InitAgreementOnClickListeners();
  12. }
  13. void OnEnable()
  14. {
  15. //进来一定是同意条件后才进此页面
  16. toggle.isOn = true;
  17. }
  18. void OnDestroy() {
  19. }
  20. void InitAgreementOnClickListeners() {
  21. transform.Find("TextA").GetComponent<Button>().onClick.AddListener(delegate() {
  22. GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
  23. o.GetComponent<AgreementView>().EnterUserAgreement();
  24. });
  25. transform.Find("TextB").GetComponent<Button>().onClick.AddListener(delegate() {
  26. GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
  27. o.GetComponent<AgreementView>().EnterPrivacyAgreement();
  28. });
  29. }
  30. //public void onAgreeStatusChange(bool isOn) {
  31. // if (toggle.isOn != isOn)
  32. // toggle.isOn = isOn;
  33. //}
  34. public void SetAgreementChecked(bool value) {
  35. //修改主页按钮状态
  36. AgreenmentOption.ins.SetAgreementChecked(value);
  37. }
  38. }