GameScene.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. var baseScene = require('BaseScene');
  2. import SoundMgr from "../base/SoundMgr";
  3. import Tool from "../base/Tool";
  4. import UIMgr from "../base/UIMgr";
  5. import UserInfoMgr from "../base/user/UserInfoMgr";
  6. cc.Class({
  7. extends: cc.Component,
  8. properties: {
  9. labCoin: cc.Label,
  10. labBli: cc.Label,
  11. dropDownNode: cc.Node, //下拉内容
  12. },
  13. // LIFE-CYCLE CALLBACKS:
  14. // onLoad () {},
  15. start () {
  16. },
  17. // update (dt) {},
  18. setPlayerInfo(){
  19. this.labCoin.string = UserInfoMgr.getUserCoin();
  20. this.labBli.string = UserInfoMgr.getUserBli();
  21. },
  22. //---------------------点击事件---------------------------
  23. onClickMenu(){
  24. SoundMgr.playClick();
  25. this.dropDownNode.active = !this.dropDownNode.active;
  26. let tPosY = [125, 35, -55, -150];
  27. if(this.timeOut)
  28. clearTimeout(this.timeOut);
  29. if(this.dropDownNode.active){
  30. Tool.effectMoveY(this.dropDownNode, tPosY);
  31. this.timeOut = setTimeout(()=>{
  32. this.dropDownNode.active = false;
  33. }, 3000);
  34. }
  35. },
  36. onClickCoin(){
  37. SoundMgr.playClick();
  38. UIMgr.openUI('prefabs/Shop2Layer');
  39. },
  40. onClickBli(){
  41. SoundMgr.playClick();
  42. UIMgr.openUI('prefabs/Exchange2Layer');
  43. }
  44. });