| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.Networking;
- public class AgreementView : MonoBehaviour
- {
- public void EnterUserAgreement() {
- GetTitleText().text = "用户协议";
- StartCoroutine(GetUserAgreement());
- }
- public void EnterPrivacyAgreement() {
- GetTitleText().text = "隐私政策";
- StartCoroutine(GetPrivacyAgreement());
- }
- Text GetTitleText() {
- return transform.Find("Title").GetComponent<Text>();
- }
- Text GetContentText(string id = "") {
- return transform.Find("ScrollView/Viewport/Content" + id).GetComponent<Text>();
- }
- public void Back() {
- Destroy(gameObject);
- }
- //http
- IEnumerator GetUserAgreement() {
- string url = CommonConfig.businessServerURI + "/app/getUserAgreement";
- UnityWebRequest request = UnityWebRequest.Get(url);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.Success) {
- GetContentText().text = "\n" + request.downloadHandler.text;
- }
- }
- IEnumerator GetPrivacyAgreement() {
- string url = CommonConfig.businessServerURI + "/app/getPrivacyAgreement";
- UnityWebRequest request = UnityWebRequest.Get(url);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.Success) {
- GetContentText().text = "\n" + request.downloadHandler.text;
- }
- }
- }
|