UI_GameRules.ts 906 B

12345678910111213141516171819202122232425
  1. import { _decorator, Component, Node } from 'cc';
  2. import ui_base from 'db://assets/core/ui/ui_base';
  3. import { Layout_GameRules } from './Layout_GameRules';
  4. import { GameUILayers, gui } from 'db://assets/core/ui/ui';
  5. import { ModuleDef } from 'db://assets/Scripts/ModuleDef';
  6. import { ani_ui } from '../UI_Main/UI_Main';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('UI_GameRules')
  9. export class UI_GameRules extends ui_base {
  10. constructor() {
  11. super(ModuleDef.GAME, 'ui/UI_GameRules/GameRules', GameUILayers.HUD, Layout_GameRules);
  12. }
  13. protected async onCreated() {
  14. const layout = this.getLayout<Layout_GameRules>();
  15. ani_ui(layout.Close_Btn.node.parent);
  16. this.onButtonEvent(layout.Close_Btn, async (button: any) => {
  17. //关闭设置界面
  18. gui.close(UI_GameRules);
  19. }, this);
  20. }
  21. }