HomeLayout.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { rootMgr } from '../../scene/RootMgr';
  3. import { FMSType } from '../../GameContorl/fms/FMSGameInit';
  4. import { aa } from 'db://assets/scripts/aa';
  5. import { UI_Setting } from '../UIDialog/setting/UI_Setting';
  6. import { UI_Rank } from '../UIDialog/rank/UI_Rank';
  7. import { UI_AddCollect } from '../UIDialog/addCollect/UI_AddCollect';
  8. import { UI_NeedCoin } from '../UIDialog/needCoin/UI_NeedCoin';
  9. import { UI_NeedLife } from '../UIDialog/needLife/UI_NeedLife';
  10. import { UI_Collect } from '../UIDialog/collect/UI_Collect';
  11. import { toggleBreath } from '../../util/Customize_Ani';
  12. import { Stage } from '../../data/stage/Stage';
  13. const { ccclass, property } = _decorator;
  14. @ccclass('HomeLayout')
  15. export class HomeLayout extends Component {
  16. @property(Node)
  17. settingBtn: Node
  18. @property(Node)
  19. rankBtn: Node
  20. @property(Node)
  21. mycollectBtn: Node
  22. @property(Node)
  23. addCollectBtn: Node
  24. @property(Node)
  25. startGameBtn: Node
  26. @property(Node)
  27. addCoinBtn: Node
  28. @property(Node)
  29. addLifeBtn: Node
  30. @property(Label)
  31. levelLabel: Label
  32. protected start(): void {
  33. toggleBreath(this.startGameBtn, 0.8)
  34. this.settingBtn.on(Node.EventType.TOUCH_END, this.showSetting, this)
  35. this.rankBtn.on(Node.EventType.TOUCH_END, this.showRank, this)
  36. this.mycollectBtn.on(Node.EventType.TOUCH_END, this.showMyCollect, this)
  37. this.addCollectBtn.on(Node.EventType.TOUCH_END, this.showaddCollect, this)
  38. this.startGameBtn.on(Node.EventType.TOUCH_END, this.startGame, this)
  39. this.addCoinBtn.on(Node.EventType.TOUCH_END, this.showAddCoinBtn, this)
  40. this.addLifeBtn.on(Node.EventType.TOUCH_END, this.showAddLifeBtn, this)
  41. let stage = rootMgr.dataControl.getCompent(Stage)
  42. this.levelLabel.string = "关卡 " + stage.index
  43. }
  44. startGame() {
  45. rootMgr.game.Change(FMSType.Start)
  46. }
  47. showSetting() {
  48. aa.uIMgr.showUI(UI_Setting)
  49. }
  50. showRank() {
  51. aa.uIMgr.showUI(UI_Rank)
  52. }
  53. showMyCollect() {
  54. aa.uIMgr.showUI(UI_Collect)
  55. }
  56. showaddCollect() {
  57. aa.uIMgr.showUI(UI_AddCollect)
  58. }
  59. showAddLifeBtn() {
  60. aa.uIMgr.showUI(UI_NeedLife)
  61. }
  62. showAddCoinBtn() {
  63. aa.uIMgr.showUI(UI_NeedCoin)
  64. }
  65. }