properties:{
lblNotice:[cc.Node],
speed:1,
curtext:null
},
start (){
this.getNotice();
},
getNotice(){
cc.abc.HttpUtils.httpGet(cc.abc.Global.Reqeust.getNotice,(ret)=>{
if (ret && ret.returncode == "Y" && ret.data){
let data = ret.data.notices; //取集合第一条
cc.fj.Parameter.homeNotice = ret.data.notices;
if (data[0].content.indexOf('\n')){
data[0].content = data[0].content.replace(/[\n]/g, " ") + " ";
}
this.lblNotice[0].getComponent("MyLabel").string=data[0].content ;
this.lblNotice[1].getComponent("MyLabel").string=data[0].content ;
this.scheduleOnce(function() {
this.flag = true;
this.lblNotice[1].x = this.lblNotice[0].x+this.lblNotice[0].width+150;
}, 0.1);
this.curtext = this.lblNotice[0];
}
});
},
 
update (dt) {
let s = dt * this.speed + 2;
let width = this.lblNotice[0].width;
if(this.flag){
this.lblNotice[0].x -= s;
this.lblNotice[1].x -= s;
if (this.curtext.x <= -width) {
if(this.curtext == this.lblNotice[1]) {
this.lblNotice[1].x = this.lblNotice[0].x+this.lblNotice[0].width+150;
this.curtext = this.lblNotice[0];
}
else {
this.lblNotice[0].x = this.lblNotice[1].x+this.lblNotice[1].width+150;
 
this.curtext = this.lblNotice[1];
}
}
}
},

最新文章

  1. solr添加安全设置
  2. [Java基础]字符串
  3. poj 1572
  4. Palindrome_滚动数组&amp;&amp;DP
  5. [LAMP]——mod_security和mod_evasive模块的安装
  6. 8大排序算法图文讲解 分类: Brush Mode 2014-08-18 11:49 78人阅读 评论(0) 收藏
  7. Linux CPU亲缘性详解
  8. SQL生成随机字符串
  9. C#语言基础原理及优缺点
  10. MySQL索引篇
  11. 剑指offer-数组中出现次数超过一半的数字
  12. LDA &amp;&amp; NCA: 降维与度量学习
  13. python:数据库连接操作入门
  14. 第十八节、基于传统图像处理的目标检测与识别(HOG+SVM附代码)
  15. [转载来之雨松:NGUI研究院之为什么打开界面太慢(十三)]
  16. 比原链(Bytom)先知节点 Windows接入文档
  17. mysql日期时间函数
  18. PlainElastic.Net
  19. 转:sql篇 select from where group by having order by
  20. beforeunload事件

热门文章

  1. Linux系统CentOS进入单用户模式和救援模式详解
  2. python argparse (更新中)
  3. 基于OpenCV全景拼接(Python)SIFT/SURF
  4. js swap array
  5. Github Actions All In One
  6. Flutter Vignettes
  7. npx &amp; yarn &amp; npm
  8. MacBook Pro 2019 13 inch &amp; screen blink
  9. TypeScript 3.7 RC &amp; Assertion Functions
  10. SHON WEBB:太怀念过去的人,往往走不远