PropsAction.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { Props3Action } from './Props3Action';
  3. import { Props1Action } from './Props1Action';
  4. import { AudioMgr } from './AudioMgr';
  5. import { Clips } from './Enums';
  6. import { Props2Action } from './Props2Action';
  7. import { BasePage } from './BasePage';
  8. import { Props4Action } from './Props4Action';
  9. import { CatAction } from './CatAction';
  10. import { Global } from './Global';
  11. const { ccclass, property } = _decorator;
  12. @ccclass('PropsAction')
  13. export class PropsAction extends BasePage {
  14. @property(Props3Action)
  15. props3_Action: Props3Action = null;
  16. @property(Props1Action)
  17. props1_Action: Props1Action = null;
  18. @property(Props2Action)
  19. props2_Action: Props2Action = null;
  20. @property(Props4Action)
  21. props4_Action: Props4Action = null;
  22. @property(Label)
  23. coins_label: Label = null;
  24. start() {
  25. super.start();
  26. }
  27. update(deltaTime: number) {
  28. }
  29. //show menu
  30. open(btn_num: number = 0) {
  31. super.open();
  32. this.set_child_active_false();
  33. switch (btn_num) {
  34. case 1:
  35. this.props1_Action.node.active = true;
  36. this.props1_Action.open();
  37. break;
  38. case 2:
  39. this.props2_Action.node.active = true;
  40. this.props2_Action.open();
  41. break;
  42. case 3:
  43. this.props3_Action.node.active = true;
  44. this.props3_Action.open();
  45. break;
  46. case 4:
  47. this.props4_Action.node.active = true;
  48. this.props4_Action.open();
  49. break;
  50. }
  51. this.coins_label.string = Global.cur_coins+"";
  52. }
  53. show_box(cat_action:CatAction){
  54. this.open(4);
  55. this.props4_Action.show_box(cat_action);
  56. }
  57. private set_child_active_false() {
  58. this.props1_Action.node.active = false;
  59. this.props2_Action.node.active = false;
  60. this.props3_Action.node.active = false;
  61. this.props4_Action.node.active = false;
  62. }
  63. close() {
  64. this.set_child_active_false();
  65. super.close();
  66. }
  67. }