Hall.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import AudioManager from "./AudioManager";
  2. import LoadManager from "./LoadManager";
  3. import LocalData from "./LocalData";
  4. import { ButtonLock } from "./Template/MyComponent";
  5. const { ccclass, property } = cc._decorator;
  6. @ccclass
  7. export default class Hall extends cc.Component {
  8. //最高纪录
  9. @property(cc.Label)
  10. MaxRecordLabel: cc.Label = null;
  11. // //金币
  12. // @property(cc.Label)
  13. // GoldLabel: cc.Label = null;
  14. @property(cc.Node)
  15. UIParentNode: cc.Node = null;
  16. start() {
  17. this.init()
  18. AudioManager.instance.playHallBg()
  19. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  20. let Editer = this.node.getChildByName("UI").getChildByName("Editer")
  21. Editer.active=false
  22. }
  23. }
  24. init() {
  25. // LocalData.getInstance().setGold(99, '+')
  26. // LocalData.getInstance().setMaxRecord(99, '=')
  27. // this.GoldLabel.string = LocalData.getInstance().getGold().toString()
  28. this.MaxRecordLabel.string = LocalData.getInstance().getMaxRecord().toString()
  29. }
  30. @ButtonLock(1, null)
  31. ClickSet() {
  32. cc.log('ClickSet');
  33. (async () => {
  34. const url = "res/Pop/Set"
  35. let Prefab = await LoadManager.instance.LoadAssets<cc.Prefab>(url);
  36. if (cc.isValid(Prefab)) {
  37. let a = cc.instantiate(Prefab);
  38. // a.setPosition(0,0)
  39. this.UIParentNode.addChild(a)
  40. this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0)
  41. }
  42. })();
  43. }
  44. @ButtonLock(1, null)
  45. ClickFuLi() {
  46. cc.log('ClickFuLi');
  47. }
  48. @ButtonLock(1, null)
  49. ClickMeiRiJiangLi() {
  50. return
  51. cc.log('ClickMeiRiJiangLi');
  52. (async () => {
  53. const url = "res/Pop/Sign"
  54. let Prefab = await LoadManager.instance.LoadAssets<cc.Prefab>(url);
  55. if (cc.isValid(Prefab)) {
  56. let a = cc.instantiate(Prefab);
  57. this.UIParentNode.addChild(a)
  58. this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0)
  59. }
  60. })();
  61. }
  62. @ButtonLock(1, null)
  63. ClickRank() {
  64. cc.log('ClickRank');
  65. }
  66. @ButtonLock(1, null)
  67. ClickShop() {
  68. cc.log('ClickShop');
  69. (async () => {
  70. const url = "res/Pop/Shop"
  71. let Prefab = await LoadManager.instance.LoadAssets<cc.Prefab>(url);
  72. if (cc.isValid(Prefab)) {
  73. let a = cc.instantiate(Prefab);
  74. this.UIParentNode.addChild(a)
  75. this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0)
  76. }
  77. })();
  78. }
  79. @ButtonLock(1, null)
  80. ClickStart() {
  81. cc.log('ClickStart');
  82. cc.director.loadScene("Game")
  83. }
  84. @ButtonLock(1, null)
  85. ClickBjq() {
  86. cc.log('ClickGold');
  87. cc.director.loadScene("Editer")
  88. }
  89. }