Rule.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. update() {
  17. if (gData.setting.init_rule_tyle) {
  18. this.setContent(gData.setting.rule_type)
  19. }
  20. }
  21. lateUpdate() {
  22. gData.setting.init_rule_tyle = false;
  23. }
  24. /**
  25. *
  26. * @param type 0服务协议 1隐私协议
  27. */
  28. public setContent(type: number = 0) {
  29. let arr = !type ? gData.loginData.rule_data : gData.loginData.privacy_data;
  30. let str = "";
  31. for (let i = 0; i < arr.length; i++) {
  32. str += arr[i] + "\n";
  33. }
  34. this.lbl_content.string = str;
  35. this.scrollView.scrollToTop();
  36. }
  37. }