const { ccclass, property } = cc._decorator; @ccclass export default class RedPointM extends cc.Component { static instance: RedPointM; @property(cc.Node) chatPoint: cc.Node = null; @property(cc.Node) touZiPoint: cc.Node = null; @property(cc.Node) turnTablePoint: cc.Node = null; @property(cc.Node) taskPoint: cc.Node = null; @property(cc.Node) shopPoint: cc.Node = null; @property(cc.Node) chatPage: cc.Node = null; @property(cc.Node) matePoint: cc.Node = null; @property(cc.Node) dailyNode: cc.Node = null; // LIFE-CYCLE CALLBACKS: onLoad() { RedPointM.instance = this; } start() { } // update (dt) {} ActiveRedPoint(redPointType: RedPointType, active: boolean) { switch (redPointType) { case RedPointType.ChatReaPacket: // if (active) { // this.chatAniNode.active = true // this.chatPage.active = false // } // else { // this.chatAniNode.active = false // this.chatPage.active = true // } break; case RedPointType.Invest: this.touZiPoint.active = active; // this.touZiPoint.color = GameM.commonData.roleData.lv >= 5 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255); break; case RedPointType.Turnplate: this.turnTablePoint.active = active; // this.turnTablePoint.color = GameM.commonData.roleData.lv >= 4 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255); break; case RedPointType.Task: if (this.taskPoint.active == active) { return } this.taskPoint.active = active; if (active) { // this.taskPoint.getChildByName('rectpoint copy').getChildByName('common_img_geted').getComponent(cc.Label).string = '可领取' // if (GameM.commonData.roleData.lv >= 4) this.taskPoint.getComponent(cc.Animation).play("rectpointAni"); // else this.taskPoint.getComponent(cc.Animation).play("rectpointAni - 001"); this.taskPoint.getComponent(cc.Animation).play("rectpointAni"); } break; case RedPointType.Shop: // this.shopPoint.active = active; // if (active) { // this.shopPoint.getComponent(cc.Animation).play("rectpointAni"); // } break; case RedPointType.Mate: if (this.matePoint.active == active) { return } this.matePoint.active = active break; case RedPointType.Daily: if (this.dailyNode.active == active) { return } this.dailyNode.active = active break; } } UpdateRedPointState() { // this.touZiPoint.color = GameM.commonData.roleData.lv >= 5 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255); // this.turnTablePoint.color = GameM.commonData.roleData.lv >= 4 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255); // this.speedUpPoint.color = GameM.commonData.roleData.lv >= 7 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255); // if (this.taskPoint.active) { // if (GameM.commonData.roleData.lv >= 4) this.taskPoint.getComponent(cc.Animation).play("rectpointAni"); // else this.taskPoint.getComponent(cc.Animation).play("rectpointAni - 001"); // } // if (this.shopPoint.active) { // if (GameM.commonData.roleData.lv >= 3) this.shopPoint.getComponent(cc.Animation).play("rectpointAni"); // else this.shopPoint.getComponent(cc.Animation).play("rectpointAni - 001"); // } } } export enum RedPointType { /**聊天代码 */ ChatReaPacket, /**投资 */ Invest, /**转盘 */ Turnplate, /**任务 */ Task, /**商店 */ Shop, /**日常任务 */ DailyTask, /**任务成就 */ TaskAchievement, /**银行 */ Bank, /**伙伴 */ Mate, /**每日登录 */ Daily, }