Hall.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. }
  20. init() {
  21. // LocalData.getInstance().setGold(99, '+')
  22. // LocalData.getInstance().setMaxRecord(99, '=')
  23. // this.GoldLabel.string = LocalData.getInstance().getGold().toString()
  24. this.MaxRecordLabel.string = LocalData.getInstance().getMaxRecord().toString()
  25. }
  26. @ButtonLock(1, null)
  27. ClickSet() {
  28. cc.log('ClickSet');
  29. (async () => {
  30. const url = "res/Pop/Set"
  31. let Prefab = await LoadManager.instance.LoadAssets<cc.Prefab>(url);
  32. if (cc.isValid(Prefab)) {
  33. let a = cc.instantiate(Prefab);
  34. // a.setPosition(0,0)
  35. this.UIParentNode.addChild(a)
  36. this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0)
  37. }
  38. })();
  39. }
  40. @ButtonLock(1, null)
  41. ClickFuLi() {
  42. cc.log('ClickFuLi');
  43. }
  44. @ButtonLock(1, null)
  45. ClickMeiRiJiangLi() {
  46. return
  47. cc.log('ClickMeiRiJiangLi');
  48. (async () => {
  49. const url = "res/Pop/Sign"
  50. let Prefab = await LoadManager.instance.LoadAssets<cc.Prefab>(url);
  51. if (cc.isValid(Prefab)) {
  52. let a = cc.instantiate(Prefab);
  53. this.UIParentNode.addChild(a)
  54. this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0)
  55. }
  56. })();
  57. }
  58. @ButtonLock(1, null)
  59. ClickRank() {
  60. cc.log('ClickRank');
  61. }
  62. @ButtonLock(1, null)
  63. ClickShop() {
  64. cc.log('ClickShop');
  65. (async () => {
  66. const url = "res/Pop/Shop"
  67. let Prefab = await LoadManager.instance.LoadAssets<cc.Prefab>(url);
  68. if (cc.isValid(Prefab)) {
  69. let a = cc.instantiate(Prefab);
  70. this.UIParentNode.addChild(a)
  71. this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0)
  72. }
  73. })();
  74. }
  75. @ButtonLock(1, null)
  76. ClickStart() {
  77. cc.log('ClickStart');
  78. cc.director.loadScene("Game")
  79. }
  80. @ButtonLock(1, null)
  81. ClickBjq() {
  82. cc.log('ClickGold');
  83. cc.director.loadScene("Editernew")
  84. }
  85. }