home_honor.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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==undefined||rank_data.nationwide_badge_status==null) {
  17. rank_data.nationwide_badge_status = 0
  18. }
  19. if(rank_data.province_badge_status==undefined||rank_data.province_badge_status==null) {
  20. rank_data.province_badge_status = 0
  21. }
  22. if(rank_data.city_badge_status==undefined||rank_data.city_badge_status==null) {
  23. rank_data.city_badge_status = 0
  24. }
  25. if(rank_data.nationwide_badge_status==0&&rank_data.province_badge_status==0&&rank_data.city_badge_status==0) {
  26. this.node.active = false
  27. this.img_light.getComponent(Animation).stop()
  28. return
  29. }
  30. this.node.active = true
  31. this.img_light.getComponent(Animation).play()
  32. if(rank_data.nationwide_badge_status==1) {
  33. this.img_text.getComponent(Sprite).spriteFrame = this.sf_country_text
  34. this.img_light.getComponent(Sprite).spriteFrame = this.sf_country_light
  35. return
  36. }
  37. if(rank_data.province_badge_status==1) {
  38. this.img_text.getComponent(Sprite).spriteFrame = this.sf_province_text
  39. this.img_light.getComponent(Sprite).spriteFrame = this.sf_province_light
  40. return
  41. }
  42. if(rank_data.city_badge_status==1) {
  43. this.img_text.getComponent(Sprite).spriteFrame = this.sf_city_text
  44. this.img_light.getComponent(Sprite).spriteFrame = this.sf_city_light
  45. return
  46. }
  47. }
  48. }