UI_Hall.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { _decorator, Button, Component, Node } from 'cc';
  2. import { Layout_Hall } from './Layout_Hall';
  3. import { UI_Rank } from '../UI_Rank/UI_Rank';
  4. import { UI_Settings } from '../UI_Settings/UI_Settings';
  5. import { UI_Sign } from '../UI_Sign/UI_Sign';
  6. import { UI_Invite } from '../UI_Invite/UI_Invite';
  7. import { GameUILayers, gui } from '../../../core/ui/ui';
  8. import ui_base from '../../../core/ui/ui_base';
  9. import { ResUtil } from '../../../core/util/ResUtil';
  10. import { ModuleDef } from '../../../Scripts/ModuleDef';
  11. import { SceneDef } from '../../../Scripts/SceneDef';
  12. import { UI_Store } from '../UI_Store/UI_Store';
  13. import { UI_SideBar } from '../UI_SideBar/UI_SideBar';
  14. import { UI_Task } from '../UI_Task/UI_Task';
  15. import { Hall } from '../../hall/Hall';
  16. import { ch } from 'db://assets/ch/ch';
  17. const { ccclass, property } = _decorator;
  18. @ccclass('UI_Hall')
  19. export class UI_Hall extends ui_base {
  20. constructor() {
  21. super(ModuleDef.GAME, 'ui/UI_Hall/Hall', GameUILayers.GAME, Layout_Hall);
  22. }
  23. protected onCreated() {
  24. const layout = this.getLayout<Layout_Hall>();
  25. this.onButtonEvent(layout.Start_Btn, () => {
  26. gui.close(UI_Hall);
  27. ResUtil.loadScene(SceneDef.GAME, ModuleDef.GAME, true);
  28. });
  29. this.onButtonEvent(layout.Settings_Btn, () => {
  30. gui.show(UI_Settings);
  31. });
  32. this.onButtonEvent(layout.Rank_Btn, async() => {
  33. await Hall.getInstance().player.loadPfInfo();
  34. gui.show(UI_Rank);
  35. });
  36. this.onButtonEvent(layout.Sign_Btn, () => {
  37. gui.show(UI_Sign);
  38. });
  39. this.onButtonEvent(layout.Invite_Btn, () => {
  40. gui.show(UI_Invite);
  41. });
  42. this.onButtonEvent(layout.Store_Btn, () => {
  43. gui.show(UI_Store);
  44. });
  45. this.onButtonEvent(layout.Task_Btn, () => {
  46. gui.show(UI_Task);
  47. })
  48. if (chsdk.checkHasSidebar()) {
  49. layout.SideBar_Btn.node.active = true;
  50. this.onButtonEvent(layout.SideBar_Btn, () => {
  51. gui.show(UI_SideBar);
  52. });
  53. } else {
  54. layout.SideBar_Btn.node.active = false;
  55. }
  56. }
  57. update(deltaTime: number) {
  58. }
  59. }