Rule.ts 973 B

12345678910111213141516171819202122232425262728293031323334353637
  1. const { ccclass, property } = cc._decorator;
  2. /**
  3. * 服务协议,隐私协议
  4. * @author 邹勇
  5. */
  6. @ccclass
  7. export default class Rule extends cc.Component {
  8. @property({ type: cc.ScrollView, displayName: "滚动条" })
  9. scrollView: cc.ScrollView = null;
  10. @property({ type: cc.Label, displayName: "内容" })
  11. lbl_content: cc.Label = null;
  12. @property({ type: cc.Button, displayName: "关闭" })
  13. btn_close: cc.Button = null;
  14. onLoad() {
  15. }
  16. /**
  17. *
  18. * @param type 0服务协议 1隐私协议
  19. */
  20. public setContent(type: string = "0") {
  21. let arr = type == "0" ? gData.loginData.rule_data : gData.loginData.privacy_data;
  22. let str = "";
  23. for (let i = 0; i < arr.length; i++) {
  24. str += arr[i] + "\n";
  25. }
  26. this.lbl_content.string = str;
  27. this.scrollView.scrollToTop();
  28. }
  29. private close() {
  30. this.node.active = false;
  31. }
  32. }