|
|
@@ -7,23 +7,23 @@ const { ccclass, property } = cc._decorator;
|
|
|
*/
|
|
|
export default class TipSystem extends cc.Component {
|
|
|
@property({ type: cc.Integer, displayName: "飘动时间" })
|
|
|
- tween_time: number = 1;
|
|
|
+ tween_time: number = 1;
|
|
|
@property({ type: cc.Integer, displayName: "开始坐标x" })
|
|
|
- src_x: number = 0;
|
|
|
+ src_x: number = 0;
|
|
|
@property({ type: cc.Integer, displayName: "开始坐标y" })
|
|
|
- src_y: number = 0;
|
|
|
+ src_y: number = 0;
|
|
|
@property({ type: cc.Integer, displayName: "目标坐标x" })
|
|
|
- tar_x: number = 0;
|
|
|
+ tar_x: number = 0;
|
|
|
@property({ type: cc.Integer, displayName: "目标坐标y" })
|
|
|
- tar_y: number = 200;
|
|
|
+ tar_y: number = 200;
|
|
|
@property({ type: cc.Integer, displayName: "背景透明度" })
|
|
|
- bg_opacity: number = 40;
|
|
|
+ bg_opacity: number = 40;
|
|
|
@property({ displayName: "背景颜色" })
|
|
|
- bg_color = new cc.Color(200, 200, 200);
|
|
|
+ bg_color = new cc.Color(200, 200, 200);
|
|
|
@property({ displayName: "文本颜色" })
|
|
|
- tip_color = new cc.Color(255, 255, 255);
|
|
|
+ tip_color = new cc.Color(255, 255, 255);
|
|
|
@property({ type: cc.Integer, displayName: "文本字体" })
|
|
|
- tip_size: number = 40;
|
|
|
+ tip_size: number = 40;
|
|
|
|
|
|
onLoad() {
|
|
|
mk.tip = this;
|
|
|
@@ -38,7 +38,7 @@ export default class TipSystem extends cc.Component {
|
|
|
* @param str
|
|
|
* @param type 弹窗类型 0正常中间弹 1弹到最顶上
|
|
|
*/
|
|
|
- public async pop(str: string,type:number=0) {
|
|
|
+ public async pop(str: string, type: number = 0) {
|
|
|
let node = await mk.pool.getPrefab("game/prefab/tips");
|
|
|
let node_bg = node.getChildByName("bg");
|
|
|
let node_lbl = node.getChildByName("lbl");
|
|
|
@@ -54,17 +54,28 @@ export default class TipSystem extends cc.Component {
|
|
|
node.parent = this.node;
|
|
|
node.x = this.src_x;
|
|
|
node.y = this.src_y;
|
|
|
- if(type == 1){
|
|
|
- this.tween_time = 2;
|
|
|
+ if (type == 0) {
|
|
|
+ cc.tween(node)
|
|
|
+ .to(this.tween_time, { x: this.tar_x, y: this.tar_y })
|
|
|
+ .call(() => {
|
|
|
+ mk.pool.return("tips", node);
|
|
|
+ }, this)
|
|
|
+ .start();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.tween_time = 1;
|
|
|
node.y = 400;
|
|
|
- this.tar_y = 800;
|
|
|
+ this.tar_y = 520;
|
|
|
+
|
|
|
+ cc.tween(node)
|
|
|
+ .to(this.tween_time, { x: this.tar_x, y: this.tar_y })
|
|
|
+ .delay(2)
|
|
|
+ .call(() => {
|
|
|
+ mk.pool.return("tips", node);
|
|
|
+ }, this)
|
|
|
+ .start();
|
|
|
}
|
|
|
- cc.tween(node)
|
|
|
- .to(this.tween_time, { x: this.tar_x, y: this.tar_y })
|
|
|
- .call(() => {
|
|
|
- mk.pool.return("tips", node);
|
|
|
- }, this)
|
|
|
- .start();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|