SuperFindPanel.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 { LayerMgr } from '../../script/Manager/LayerMgr';
  6. import { LevelContainer } from './LevelContainer';
  7. import { allSkinList, defaultSkin, Difficulty, Skin, SuperFind, UserSuperFindData } from '../../script/Manager/LocalDataMgr';
  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(Label)
  20. tipLabel: Label = null
  21. @property(Label)
  22. tipLabel2: Label = null
  23. @property(Node)
  24. bottom: Node = null
  25. _editMode:boolean = false
  26. protected start(): void {
  27. this.init()
  28. }
  29. init()
  30. {
  31. this.tipLabel.string = SuperFind.superFindData.title
  32. this.tipLabel2.string = SuperFind.superFindData.levelDesc
  33. let bgPath = SuperFind.superFindData.imgPath
  34. let selectSkins:string[] = Skin.getSelectSkinPath()
  35. selectSkins = selectSkins.length > 0?selectSkins:[defaultSkin]
  36. this.lvlContainer.genLvlContent(bgPath,selectSkins,Difficulty.difficutyData.difficutyCount,Difficulty.difficutyData.scales)
  37. }
  38. OpenselDifPanel() {
  39. this.selDifPanel.node.active = true;
  40. this.selDifPanel.init();
  41. }
  42. OpenSelSkinPanel() {
  43. this.selSkinPanel.node.active = true;
  44. this.selSkinPanel.init();
  45. }
  46. OpenSelMapPanel() {
  47. this.selMapPanel.node.active = true;
  48. }
  49. CloseSelDifPanel() {
  50. this.selDifPanel.node.active = false;
  51. }
  52. CloseSelSkinPanel() {
  53. this.selSkinPanel.node.active = false;
  54. }
  55. CloseSelMapPanel() {
  56. this.selMapPanel.node.active = false;
  57. }
  58. close()
  59. {
  60. this.node.destroy()
  61. }
  62. onEditClick()
  63. {
  64. this._editMode = !this._editMode
  65. this.lvlContainer.swtichEditMode(this._editMode)
  66. }
  67. onRegenerateClick()
  68. {
  69. this.lvlContainer.regenerate()
  70. }
  71. onHideClick()
  72. {
  73. this.bottom.active = false
  74. }
  75. onTipClick()
  76. {
  77. this.lvlContainer.showOneHint()
  78. }
  79. }