UI_GameRules.ts 1000 B

12345678910111213141516171819202122232425262728
  1. import { _decorator } 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 { ani_ui } from "../UI_Main/UI_Main";
  6. import { Layout_GameRules } from "./Layout_GameRules";
  7. import ch_audio from "../../../ch/audio/audio";
  8. const { ccclass, property } = _decorator;
  9. @ccclass('UI_GameRules')
  10. export class UI_GameRules extends ui_base {
  11. constructor() {
  12. super(ModuleDef.GAME, 'ui/UI_GameRules/GameRules', GameUILayers.HUD, Layout_GameRules);
  13. }
  14. protected async onCreated() {
  15. const layout = this.getLayout<Layout_GameRules>();
  16. ani_ui(layout.Close_Btn.node.parent);
  17. this.onButtonEvent(layout.Close_Btn, async (button: any) => {
  18. ch_audio.getInstance().playOneShot('sound/click_Btn');
  19. //关闭设置界面
  20. gui.close(UI_GameRules);
  21. }, this);
  22. }
  23. }