SuperFindPanel.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import { _decorator, Component, Label, Node, Prefab } from 'cc';
  2. import { SelectDifficultyPanel } from './SelectDifficultyPanel';
  3. import { SelectSkinPanel } from './SelectSkinPanel';
  4. import { SelectMapPanel } from './SelectMapPanel';
  5. import { LevelContainer } from './LevelContainer';
  6. import { defaultSkin, Difficulty, Skin, SuperFind} from '../../script/Manager/LocalDataMgr';
  7. import EventMgr from '../../script/Manager/EventMgr';
  8. const { ccclass, property } = _decorator;
  9. @ccclass('SuperFindPanel')
  10. export class SuperFindPanel extends Component {
  11. @property(SelectDifficultyPanel)
  12. selDifPanel: SelectDifficultyPanel = null
  13. @property(SelectSkinPanel)
  14. selSkinPanel: SelectSkinPanel = null
  15. @property(SelectMapPanel)
  16. selMapPanel: SelectMapPanel = null
  17. @property(LevelContainer)
  18. lvlContainer: LevelContainer = null
  19. @property(Node)
  20. editBtns:Node = null
  21. @property(Node)
  22. noEditBtns:Node = null
  23. @property(Label)
  24. tipLabel: Label = null
  25. @property(Label)
  26. tipLabel2: Label = null
  27. @property(Label)
  28. showOrHideScaleLabel: Label = null
  29. @property(Node)
  30. bottom: Node = null
  31. _showScale:boolean = false
  32. protected start(): void {
  33. this.init()
  34. EventMgr.ins.addEventListener("refreshLevelInfo",this.refreshInfo,this)
  35. }
  36. init()
  37. {
  38. this.refreshInfo()
  39. let bgPath = SuperFind.superFindData.imgPath
  40. let selectSkins:string[] = Skin.getSelectSkinPath()
  41. selectSkins = selectSkins.length > 0?selectSkins:[defaultSkin]
  42. this.lvlContainer.genLvlContent(bgPath,selectSkins,Difficulty.difficutyData.difficutyCount,Difficulty.difficutyData.scales)
  43. }
  44. OpenselDifPanel() {
  45. this.selDifPanel.node.active = true;
  46. this.selDifPanel.init();
  47. }
  48. OpenSelSkinPanel() {
  49. this.selSkinPanel.node.active = true;
  50. this.selSkinPanel.init();
  51. }
  52. OpenSelMapPanel() {
  53. this.selMapPanel.node.active = true;
  54. this.selMapPanel.init();
  55. }
  56. OpenEditBtns()
  57. {
  58. this.editBtns.active = true
  59. this.lvlContainer.swtichEditMode(true)
  60. this.noEditBtns.active = false
  61. }
  62. CloseEditBtns()
  63. {
  64. this.editBtns.active = false
  65. this.lvlContainer.swtichEditMode(false)
  66. this.noEditBtns.active = true
  67. }
  68. CloseSelDifPanel() {
  69. this.selDifPanel.node.active = false;
  70. }
  71. CloseSelSkinPanel() {
  72. this.selSkinPanel.node.active = false;
  73. }
  74. CloseSelMapPanel() {
  75. this.selMapPanel.node.active = false;
  76. }
  77. close()
  78. {
  79. this.node.destroy()
  80. }
  81. onEditFinishClick()
  82. {
  83. this.CloseEditBtns()
  84. }
  85. onRegenerateClick()
  86. {
  87. this.lvlContainer.regenerate()
  88. }
  89. onHideClick()
  90. {
  91. this.bottom.active = false
  92. }
  93. onTipClick()
  94. {
  95. this.lvlContainer.showOneHint()
  96. }
  97. refreshInfo()
  98. {
  99. this.tipLabel.string = SuperFind.superFindData.title
  100. this.tipLabel2.string = SuperFind.superFindData.levelDesc
  101. }
  102. showOrHideScale()
  103. {
  104. this._showScale = !this._showScale
  105. this.lvlContainer.showOrHideScale(this._showScale)
  106. this.showOrHideScaleLabel.string = this._showScale?"隐藏缩放":"显示缩放"
  107. }
  108. }