import { _decorator, Component, Node, Animation, Widget, tween } from 'cc'; import { base_ui } from '../../fw/base_ui'; import { uiManager } from '../../manager/uiManager'; import { config } from '../../config'; import { home_modules_more } from './home_modules_more'; import { tools } from '../../tools'; import { userDataManager } from '../../manager/userDataManager'; import { ClientEvent } from '../../lib/clientEvent'; const { ccclass, property } = _decorator; @ccclass('home_modules') export class home_modules extends base_ui { @property(Node) btn_qiandao:Node = null @property(Node) btn_gengduo:Node = null @property(Node) btn_cheku:Node = null @property(Node) btn_beibao:Node = null @property(Node) node_gengduo:Node = null @property(Node) img_dot_qiandao:Node = null @property(Node) img_dot_gengduo:Node = null start() { this.onButtonListen(this.btn_qiandao, ()=>{ uiManager.Instance().showUi(config.UI.ui_sign_view) }) this.onButtonListen(this.btn_gengduo, ()=>{ this.node_gengduo.active = !this.node_gengduo.active if(this.node_gengduo.active) { this.node_gengduo.getComponent(Animation).play() } }) this.onButtonListen(this.btn_cheku, ()=>{ this.node.parent.active = false uiManager.Instance().showUi(config.UI.car_lib, null, ()=>{ this.node.parent.active = true this.hideGengduoView() ClientEvent.dispatchEvent(config.UI_EVENT.HOME_DID_BECOME_INACTIVE) }) }) this.onButtonListen(this.btn_beibao, ()=>{ this.node.parent.active = false uiManager.Instance().showUi(config.UI.bag, null, ()=>{ this.node.parent.active = true this.hideGengduoView() ClientEvent.dispatchEvent(config.UI_EVENT.HOME_DID_BECOME_INACTIVE) }) }) this.node_gengduo.active = false this.startAnimation() } public init() { let data = userDataManager.user_red_dot_data this.showRedDotQiandao(data.sign_red_dot==1?true:false) this.showRedDotGonggao(data.bulletin_red_dot==1?true:false) let is_mail_read = userDataManager.user_red_dot_data.mail_unread_number>0?true:false this.showRedDotYoujian(is_mail_read) } private startAnimation() { let number = -115 this.btn_qiandao.getComponent(Widget).left = number this.btn_gengduo.getComponent(Widget).left = number this.btn_cheku.getComponent(Widget).right = number this.btn_beibao.getComponent(Widget).right = number setTimeout(()=>{ this.btn_qiandao.getComponent(Animation).play() this.btn_gengduo.getComponent(Animation).play() this.btn_cheku.getComponent(Animation).play() this.btn_beibao.getComponent(Animation).play() },200) } public showRedDotQiandao(is_show:boolean) { this.img_dot_qiandao.active = is_show } public showRedDotYoujian(is_show:boolean) { this.node_gengduo.getComponent(home_modules_more).showRedDotYoujian(is_show) this.checkRedDotMore() } public showRedDotGonggao(is_show:boolean) { this.node_gengduo.getComponent(home_modules_more).showRedDotGonggao(is_show) this.checkRedDotMore() } private checkRedDotMore() { let is_show = this.node_gengduo.getComponent(home_modules_more).getDotAllShow() this.img_dot_gengduo.active = is_show } public hideGengduoView() { if(this.node_gengduo.active==true) { this.node_gengduo.active = false } } }