StarHandbookTypeTab.js 794 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. bgFrames: [cc.SpriteFrame],
  5. tabRichText: cc.RichText
  6. },
  7. // LIFE-CYCLE CALLBACKS:
  8. onLoad () {
  9. },
  10. start () {
  11. },
  12. init (text) {
  13. this.text = text;
  14. },
  15. show () {
  16. this.getComponent(cc.Button).interactable = false;
  17. this.getComponent(cc.Sprite).spriteFrame = this.bgFrames[1];
  18. this.tabRichText.string = `<b><outline color=#ffae00 width=2><color=#fef3cf>${this.text}</color></outline></b>`;
  19. },
  20. hide () {
  21. this.getComponent(cc.Button).interactable = true;
  22. this.getComponent(cc.Sprite).spriteFrame = this.bgFrames[0];
  23. this.tabRichText.string = `<b><color=#b6896b>${this.text}</color></b>`;
  24. },
  25. // update (dt) {},
  26. });