testUI.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. window.testUI = null;
  11. cc.Class({
  12. extends: cc.Component,
  13. properties: {
  14. // foo: {
  15. // // ATTRIBUTES:
  16. // default: null, // The default value will be used only when the component attaching
  17. // // to a node for the first time
  18. // type: cc.SpriteFrame, // optional, default is typeof default
  19. // serializable: true, // optional, default is true
  20. // },
  21. // bar: {
  22. // get () {
  23. // return this._bar;
  24. // },
  25. // set (value) {
  26. // this._bar = value;
  27. // }
  28. // },
  29. },
  30. // LIFE-CYCLE CALLBACKS:
  31. // onLoad () {},
  32. start () {
  33. testUI = this
  34. this.dishu = UtilsNode.getNode("dishu",this.node)
  35. this.da = UtilsNode.getNode("da",this.node)
  36. },
  37. showDishu(index,b){
  38. this.dishu.children[index].active = b;
  39. // Log.info("现在盒子",this.dishu.children)
  40. },
  41. showDa(index){
  42. var temp = this.da.children[index]
  43. temp.active = true;
  44. setTimeout(function () {
  45. temp.active = false;
  46. },200)
  47. },
  48. // update (dt) {},
  49. });