/** @format */ import {BaseUI} from '../BaseUI' import {UI} from '../../enums/UI' import {node, observer} from '../../mobx/observer' import {Mgr} from '../../GameControl' import {FunctionsConfig} from '../../config/FunctionsConfig' import {ccUtils} from '../../utils/ccUtils' import {IRule} from '../../interface/UIInterface' import {LANGUAGE_TYPE} from '../../enums/Enum' const {ccclass, property} = cc._decorator @ccclass @observer export class RuleUI extends BaseUI { @node('scrollView/view/content/lb') ruleText: cc.Node fixedWidth: number = 1200 onShow(args: UI | IRule, fromUI: number) { let ruleStr = '' ccUtils.setLabel(LANGUAGE_TYPE.rules, this.node, 'title/lb') if (args) { if (typeof args == 'number') { ruleStr = Mgr.i18n.getLabel(FunctionsConfig[args]?.rule) } else { ccUtils.setLabel(args.title, this.node, 'title/lb') ruleStr = Mgr.i18n.getLabel(args.content) } } //ccUtils.setLabel(FunctionsConfig[args]?.rule, this.ruleText) let linesArray = ruleStr.split('\n') let labelNode = ccUtils.instantChildren(this.ruleText, linesArray.length) for (let i = 0; i < linesArray.length; i++) { ccUtils.setLabel(linesArray[i], labelNode[i]) } } onHide(): any {} //UI或者其他函数======================================= //网络事件======================================= // 点击事件======================================= }