AddCountPanel.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { _decorator, Component, Node } from 'cc';
  2. import { Difficulty, SuperFind } from '../../script/Manager/LocalDataMgr';
  3. import EventMgr from '../../script/Manager/EventMgr';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('AddCountPanel')
  6. export class AddCountPanel extends Component {
  7. @property(Node)
  8. btnClose:Node = null
  9. start() {
  10. this.btnClose.on(Node.EventType.TOUCH_END,this.close,this)
  11. }
  12. close()
  13. {
  14. this.node.active = false
  15. }
  16. AddCount(event,customEventData)
  17. {
  18. let count = Number(customEventData)
  19. Difficulty.difficutyData.difficutyCount += count
  20. if(Difficulty.difficutyData.difficutyCount > 30)
  21. {
  22. Difficulty.difficutyData.difficutyCount = 30
  23. }
  24. Difficulty.createOrDeleteOtherScale();
  25. Difficulty.saveDifficutyData();
  26. SuperFind.setTitle()
  27. EventMgr.ins.dispatchEvent("refreshLevelInfo")
  28. this.node.active = false
  29. EventMgr.ins.dispatchEvent("regenerate")
  30. }
  31. }