12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- cc.Class({
- extends: cc.Component,
- properties: {
- ///
- descRichText: cc.RichText,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this.node.zIndex = 200;
- },
- init (noticeStr) {
- let desc = noticeStr + '';
- let stringArr = desc.split('n');
-
- if (stringArr.length > 1) {
- for (let i = 0; i < stringArr.length; ++ i) {
- if (i == 0) {
- desc = stringArr[0];
- } else if (i < stringArr.length - 1) {
- desc += '<br/>' + stringArr[i];
- } else {
- desc += stringArr[i];
- }
- }
- }
- this.descRichText.string = `<color=#540904>${desc}</color>`;
- },
- start () {
- },
- hiddenAction() {
- this.node.destroy();
- }
- // update (dt) {},
- });
|