123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import { _decorator, Component, Node } from 'cc';
- import { GameUILayers, gui } from 'db://assets/core/ui/ui';
- import ui_base from 'db://assets/core/ui/ui_base';
- import { ModuleDef } from 'db://assets/Scripts/ModuleDef';
- import { Layout_Main } from './Layout_Main';
- import { UI_Settings } from '../UI_Settings/UI_Settings';
- import { UI_GameRules } from '../UI_GameRules/UI_GameRules';
- import { ch } from 'db://assets/ch/ch';
- import { GameCtl } from 'db://assets/Scripts/GameCtl';
- import { Container_Manager } from 'db://assets/Scripts/Container_Manager';
- const { ccclass, property } = _decorator;
- @ccclass('UI_Main')
- export class UI_Main extends ui_base {
- constructor() {
- super(ModuleDef.GAME, 'ui/UI_Main/Main', GameUILayers.GAME, Layout_Main);
- }
- protected async onCreated() {
- const layout = this.getLayout<Layout_Main>();
- this.onButtonEvent(layout.Pause_Btn, async (button: any) => {
- //打开设置界面
- gui.show(UI_Settings);
- }, this);
- this.onButtonEvent(layout.Rules_Btn, async (button: any) => {
- //打开游戏说明
- gui.show(UI_GameRules);
- }, this);
- this.onButtonEvent(layout.Eliminate_Btn, async (button: any) => {
- //判断道具数量
- //清除
- Container_Manager.instance.eliminate();
- // const ret = await chsdk.playRewardAd('获得道具:清除');
- // if(ret)
- // {
- // ch.audio.resume();
- // }
- }, this);
-
- this.onButtonEvent(layout.Shuffle_Btn, async (button: any) => {
- //刷新
- Container_Manager.instance.shuffle();
- // const ret = await chsdk.playRewardAd('获得道具:刷新');
- // if(ret)
- // {
- // ch.audio.resume();
- // }
- }, this);
- this.onButtonEvent(layout.Empty_Btn, async (button: any) => {
- //清空
- Container_Manager.instance.Empty();
- // const ret = await chsdk.playRewardAd('获得道具:清空');
- // if(ret)
- // {
- // ch.audio.resume();
- // }
- }, this);
- }
- }
- export function ani_ui(node: Node, end: number = 1.0): void {
- gui.scale_elasticOut_anim(node, 1.2, 0.5, end);
- }
- export function repair_ani_ui(node: Node, end: number = 1.15): void {
- gui.scale_elasticOut_anim(node, 1.2, 0.5, end);
- }
|