Hint.js 780 B

123456789101112131415161718192021222324252627282930313233343536
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. bg: {
  5. default: null,
  6. type: cc.Node,
  7. serializable: true,
  8. },
  9. confirm: {
  10. default: null,
  11. type: cc.Node,
  12. serializable: true,
  13. },
  14. hitText: {
  15. default: null,
  16. type: cc.Node,
  17. serializable: true,
  18. },
  19. },
  20. showHintStr(str)
  21. {
  22. this.bg.active = true;
  23. this.confirm.active = true;
  24. this.hitText.active = true;
  25. this.hitText.getComponent(cc.Label).string = str;
  26. this.scheduleOnce(function () {
  27. this.bg.active = false;
  28. this.confirm.active = false;
  29. this.hitText.active = false;
  30. },1);
  31. }
  32. });