|
|
@@ -7,10 +7,10 @@ const { ccclass, property } = cc._decorator;
|
|
|
* @author 邹勇
|
|
|
*/
|
|
|
|
|
|
-const ScrollType = cc.Enum({
|
|
|
- ST_horizontal : 0,
|
|
|
- ST_vertical : 1,
|
|
|
-});
|
|
|
+ enum ScrollType {
|
|
|
+ ST_horizontal,
|
|
|
+ ST_vertical,
|
|
|
+};
|
|
|
|
|
|
|
|
|
@ccclass
|
|
|
@@ -23,8 +23,14 @@ export default class TweenCast extends cc.Component {
|
|
|
private move_speed: number = 3;
|
|
|
@property({ displayName: "等待时间" })
|
|
|
private wait_time: number = 10;
|
|
|
- @property({displayName: '滚动方向', type: ScrollType})
|
|
|
- private scrollType = ScrollType.ST_horizontal;
|
|
|
+
|
|
|
+ @property({displayName: '滚动方向', type: cc.Enum(ScrollType)})
|
|
|
+ private scrollType: ScrollType = ScrollType.ST_horizontal;
|
|
|
+ @property({displayName: '是否一开始就是显示公告'})
|
|
|
+ private isShowFirstNotice: boolean = true;
|
|
|
+ @property({ displayName: '一开始显示的公告', type: cc.RichText, visible() { return this.isShowFirstNotice } })
|
|
|
+ private rich_text_2: cc.RichText = null;
|
|
|
+
|
|
|
|
|
|
private names: string[] = ["拒绝寂寞", "孽緣", "祗為与妳相爱", "羙男", "浅蓝", "腊笔小东", "卡布奇诺", "苊狠幸福", "埋葬回忆", "早已该放手", "白兎",
|
|
|
"豿疍疍", "宿命", "渗透的葬礼", "全都是虚假", "俄侑伱-直", "隱裑", "你不配我", "非主流网名", "剧终", "如果沵走了", "續雪", "默默然", "大白痴", "衮开",
|
|
|
@@ -53,6 +59,14 @@ export default class TweenCast extends cc.Component {
|
|
|
}
|
|
|
|
|
|
onLoad() {
|
|
|
+ if(this.isShowFirstNotice)
|
|
|
+ {
|
|
|
+ this.rich_text_2.string = this.getContent();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ if(this.rich_text_2)
|
|
|
+ this.rich_text_2.node.active = false;
|
|
|
+ }
|
|
|
this.play();
|
|
|
}
|
|
|
|
|
|
@@ -64,26 +78,56 @@ export default class TweenCast extends cc.Component {
|
|
|
}
|
|
|
|
|
|
private rickPlay() {
|
|
|
- this.node.active = true;
|
|
|
+ this.rich_text.node.active = true;
|
|
|
if(this.scrollType == ScrollType.ST_horizontal)
|
|
|
{
|
|
|
cc.tween(this.rich_text.node)
|
|
|
- .to(this.move_speed, { x: 16 })
|
|
|
+ .to(this.move_speed, { x: 0 })
|
|
|
.delay(this.display_time)
|
|
|
.to(this.move_speed, { x: -450 })
|
|
|
.call(this.play.bind(this)).start();
|
|
|
+
|
|
|
+ if(this.isShowFirstNotice)
|
|
|
+ {
|
|
|
+ cc.tween(this.rich_text_2.node)
|
|
|
+ .to(this.move_speed, {x: -450})
|
|
|
+ .hide()
|
|
|
+ .delay(this.display_time)
|
|
|
+ .call(()=>{
|
|
|
+
|
|
|
+ this.reset2();
|
|
|
+ cc.tween(this.rich_text_2.node).show().to(this.move_speed, {x: 0}).start();
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}else{
|
|
|
cc.tween(this.rich_text.node)
|
|
|
.to(this.move_speed, { y: 0 }, cc.easeSineOut())
|
|
|
.delay(this.display_time)
|
|
|
.to(this.move_speed, { y: 50 })
|
|
|
.call(this.play.bind(this)).start();
|
|
|
+
|
|
|
+ if(this.isShowFirstNotice)
|
|
|
+ {
|
|
|
+ cc.tween(this.rich_text_2.node)
|
|
|
+ .to(this.move_speed, {y: 50})
|
|
|
+ .hide()
|
|
|
+ .delay(this.display_time)
|
|
|
+ .call(()=>{
|
|
|
+
|
|
|
+ this.reset2();
|
|
|
+ cc.tween(this.rich_text_2.node).show().to(this.move_speed, {y: 0}).start();
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private reset() {
|
|
|
- this.node.active = false;
|
|
|
+ this.rich_text.node.active = false;
|
|
|
if(this.scrollType == ScrollType.ST_horizontal)
|
|
|
{
|
|
|
this.rich_text.node.x = 450;
|
|
|
@@ -94,4 +138,15 @@ export default class TweenCast extends cc.Component {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private reset2(){
|
|
|
+ if(this.scrollType == ScrollType.ST_horizontal)
|
|
|
+ {
|
|
|
+ this.rich_text_2.node.x = 450;
|
|
|
+ this.rich_text_2.string = this.getContent();
|
|
|
+ }else{
|
|
|
+ this.rich_text_2.node.y = -50;
|
|
|
+ this.rich_text_2.string = this.getContent();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|