SuperFindPanel.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. import EventMgr from '../../script/Manager/EventMgr';
  9. const { ccclass, property } = _decorator;
  10. @ccclass('SuperFindPanel')
  11. export class SuperFindPanel extends Component {
  12. @property(SelectDifficultyPanel)
  13. selDifPanel: SelectDifficultyPanel = null
  14. @property(SelectSkinPanel)
  15. selSkinPanel: SelectSkinPanel = null
  16. @property(SelectMapPanel)
  17. selMapPanel: SelectMapPanel = null
  18. @property(LevelContainer)
  19. lvlContainer: LevelContainer = null
  20. @property(Label)
  21. tipLabel: Label = null
  22. @property(Label)
  23. tipLabel2: Label = null
  24. @property(Node)
  25. bottom: Node = null
  26. _editMode:boolean = false
  27. protected start(): void {
  28. this.init()
  29. EventMgr.ins.addEventListener("refreshLevelInfo",this.refreshInfo,this)
  30. }
  31. init()
  32. {
  33. this.refreshInfo()
  34. let bgPath = SuperFind.superFindData.imgPath
  35. let selectSkins:string[] = Skin.getSelectSkinPath()
  36. selectSkins = selectSkins.length > 0?selectSkins:[defaultSkin]
  37. this.lvlContainer.genLvlContent(bgPath,selectSkins,Difficulty.difficutyData.difficutyCount,Difficulty.difficutyData.scales)
  38. }
  39. OpenselDifPanel() {
  40. this.selDifPanel.node.active = true;
  41. this.selDifPanel.init();
  42. }
  43. OpenSelSkinPanel() {
  44. this.selSkinPanel.node.active = true;
  45. this.selSkinPanel.init();
  46. }
  47. OpenSelMapPanel() {
  48. this.selMapPanel.node.active = true;
  49. this.selMapPanel.init();
  50. }
  51. CloseSelDifPanel() {
  52. this.selDifPanel.node.active = false;
  53. }
  54. CloseSelSkinPanel() {
  55. this.selSkinPanel.node.active = false;
  56. }
  57. CloseSelMapPanel() {
  58. this.selMapPanel.node.active = false;
  59. }
  60. close()
  61. {
  62. this.node.destroy()
  63. }
  64. onEditClick()
  65. {
  66. this._editMode = !this._editMode
  67. this.lvlContainer.swtichEditMode(this._editMode)
  68. }
  69. onRegenerateClick()
  70. {
  71. this.lvlContainer.regenerate()
  72. }
  73. onHideClick()
  74. {
  75. this.bottom.active = false
  76. }
  77. onTipClick()
  78. {
  79. this.lvlContainer.showOneHint()
  80. }
  81. refreshInfo()
  82. {
  83. this.tipLabel.string = SuperFind.superFindData.title
  84. this.tipLabel2.string = SuperFind.superFindData.levelDesc
  85. }
  86. }