home_honor.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { _decorator, Component, Node, Sprite, SpriteFrame, Animation } from 'cc';
  2. import { tools } from '../../tools';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('home_honor')
  5. export class home_honor extends Component {
  6. @property(Node) img_text:Node = null
  7. @property(Node) img_light:Node = null
  8. @property(SpriteFrame) sf_country_text:SpriteFrame = null
  9. @property(SpriteFrame) sf_country_light:SpriteFrame = null
  10. @property(SpriteFrame) sf_province_text:SpriteFrame = null
  11. @property(SpriteFrame) sf_province_light:SpriteFrame = null
  12. @property(SpriteFrame) sf_city_text:SpriteFrame = null
  13. @property(SpriteFrame) sf_city_light:SpriteFrame = null
  14. initView() {
  15. let rank_data = tools.mine_rank_data
  16. if(rank_data.nationwide_badge_status==0&&rank_data.province_badge_status==0&&rank_data.city_badge_status==0) {
  17. this.node.active = false
  18. this.img_light.getComponent(Animation).stop()
  19. return
  20. }
  21. this.node.active = true
  22. this.img_light.getComponent(Animation).play()
  23. if(rank_data.nationwide_badge_status==1) {
  24. this.img_text.getComponent(Sprite).spriteFrame = this.sf_country_text
  25. this.img_light.getComponent(Sprite).spriteFrame = this.sf_country_light
  26. return
  27. }
  28. if(rank_data.province_badge_status==1) {
  29. this.img_text.getComponent(Sprite).spriteFrame = this.sf_province_text
  30. this.img_light.getComponent(Sprite).spriteFrame = this.sf_province_light
  31. return
  32. }
  33. if(rank_data.city_badge_status==1) {
  34. this.img_text.getComponent(Sprite).spriteFrame = this.sf_city_text
  35. this.img_light.getComponent(Sprite).spriteFrame = this.sf_city_light
  36. return
  37. }
  38. }
  39. }