const { ccclass, property } = cc._decorator; /** * 服务协议,隐私协议 * @author 邹勇 */ @ccclass export default class Rule extends cc.Component { @property({ type: cc.ScrollView, displayName: "滚动条" }) scrollView: cc.ScrollView = null; @property({ type: cc.Label, displayName: "内容" }) lbl_content: cc.Label = null; @property({ type: cc.Button, displayName: "关闭" }) btn_close: cc.Button = null; onLoad() { } update() { if (gData.setting.init_rule_tyle) { this.setContent(gData.setting.rule_type) } } lateUpdate() { gData.setting.init_rule_tyle = false; } /** * * @param type 0服务协议 1隐私协议 */ public setContent(type: number = 0) { let arr = !type ? gData.loginData.rule_data : gData.loginData.privacy_data; let str = ""; for (let i = 0; i < arr.length; i++) { str += arr[i] + "\n"; } this.lbl_content.string = str; this.scrollView.scrollToTop(); } }