UI_SideBar.ts 1013 B

12345678910111213141516171819202122232425262728293031323334
  1. import { _decorator, Component, Node } from 'cc';
  2. import { GameUILayers, gui } from '../../../core/ui/ui';
  3. import ui_base from '../../../core/ui/ui_base';
  4. import { ModuleDef } from '../../../Scripts/ModuleDef';
  5. import { Layout_SideBar } from './Layout_SideBar';
  6. import { ani_ui } from '../UI_Main/UI_Main';
  7. import { Start } from '../../../start/Start';
  8. const { ccclass, property } = _decorator;
  9. @ccclass('UI_SideBar')
  10. export class UI_SideBar extends ui_base {
  11. constructor(){
  12. super(ModuleDef.GAME, 'ui/UI_SideBar/SideBar', GameUILayers.HUD, Layout_SideBar);
  13. }
  14. protected async onCreated() {
  15. const layout = this.getLayout<Layout_SideBar>();
  16. ani_ui(layout.Close_Btn.node.parent);
  17. this.onButtonEvent(layout.Close_Btn, ()=>{
  18. gui.close(UI_SideBar);
  19. });
  20. this.onButtonEvent(layout.Go_SideBar, ()=>{
  21. //进入侧边栏
  22. chsdk.goToSidebar();
  23. });
  24. layout.Logo.spriteFrame=layout.Logos[Start.packId];
  25. }
  26. }