123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { _decorator, Component, Node, Sprite, SpriteFrame, Animation } from 'cc';
- import { tools } from '../../tools';
- const { ccclass, property } = _decorator;
- @ccclass('home_honor')
- export class home_honor extends Component {
- @property(Node) img_text:Node = null
- @property(Node) img_light:Node = null
- @property(SpriteFrame) sf_country_text:SpriteFrame = null
- @property(SpriteFrame) sf_country_light:SpriteFrame = null
- @property(SpriteFrame) sf_province_text:SpriteFrame = null
- @property(SpriteFrame) sf_province_light:SpriteFrame = null
- @property(SpriteFrame) sf_city_text:SpriteFrame = null
- @property(SpriteFrame) sf_city_light:SpriteFrame = null
- private is_img_light_play_animation:boolean = false
- initView() {
- let rank_data = tools.mine_rank_data
- if(rank_data.nationwide_badge_status==undefined||rank_data.nationwide_badge_status==null) {
- rank_data.nationwide_badge_status = 0
- }
- if(rank_data.province_badge_status==undefined||rank_data.province_badge_status==null) {
- rank_data.province_badge_status = 0
- }
- if(rank_data.city_badge_status==undefined||rank_data.city_badge_status==null) {
- rank_data.city_badge_status = 0
- }
- if(rank_data.nationwide_badge_status==0&&rank_data.province_badge_status==0&&rank_data.city_badge_status==0) {
- this.node.active = false
- if(this.is_img_light_play_animation) {
- this.is_img_light_play_animation = false
- this.img_light.getComponent(Animation).stop()
- }
- return
- }
- this.node.active = true
- this.is_img_light_play_animation = true
- this.img_light.getComponent(Animation).play()
- if(rank_data.nationwide_badge_status==1) {
- this.img_text.getComponent(Sprite).spriteFrame = this.sf_country_text
- this.img_light.getComponent(Sprite).spriteFrame = this.sf_country_light
- return
- }
- if(rank_data.province_badge_status==1) {
- this.img_text.getComponent(Sprite).spriteFrame = this.sf_province_text
- this.img_light.getComponent(Sprite).spriteFrame = this.sf_province_light
- return
- }
- if(rank_data.city_badge_status==1) {
- this.img_text.getComponent(Sprite).spriteFrame = this.sf_city_text
- this.img_light.getComponent(Sprite).spriteFrame = this.sf_city_light
- return
- }
- }
- }
|