123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import { _decorator, find, Sprite } from "cc";
- import { GameUILayers, gui } from "../../../core/ui/ui";
- import ui_base from "../../../core/ui/ui_base";
- import { ResUtil } from "../../../core/util/ResUtil";
- import { ModuleDef } from "../../../Scripts/ModuleDef";
- import { SceneDef } from "../../../Scripts/SceneDef";
- import { UI_Hall } from "../UI_Hall/UI_Hall";
- import { ani_ui, UI_Main } from "../UI_Main/UI_Main";
- import { Layout_Win } from "./Layout_Win";
- import { Container_Manager } from "../../game/Container_Manager";
- import { Hall } from "../../hall/Hall";
- const { ccclass, property } = _decorator;
- @ccclass('UI_Win')
- export class UI_Win extends ui_base {
- constructor() {
- super(ModuleDef.GAME, 'ui/UI_Win/Win', GameUILayers.HUD, Layout_Win);
- }
- protected async onCreated() {
- const layout = this.getLayout<Layout_Win>();
- ani_ui(layout.Three_Btn.node.parent.parent);
- layout.Container = find('Container').getComponent(Container_Manager);
- Hall.getInstance().player.set_coin(Hall.getInstance().player.get_coin() + 50);
- this.onButtonEvent(layout.Three_Btn, async (button: any) => {
- //三倍奖励 看广告
- const ret = await chsdk.playRewardAd('三倍获取铜币');
- if (ret) {
- Hall.getInstance().player.set_coin(Hall.getInstance().player.get_coin() + 150 - 50);
- //按钮置灰 点击无效
- layout.Three_Btn.interactable = false;
- layout.Three_Btn.node.getComponent(Sprite).grayscale = true;
- layout.Txt.string = '铜币+150';
- }
- }, this);
- this.onButtonEvent(layout.Next_Btn, async (button: any) => {
- //下一关
- gui.get(UI_Main).evt.emit(gui.get(UI_Main).evt.key.next_level);
- gui.close(UI_Win);
- layout.Container.level_idioms();
- gui.get(UI_Main).evt.emit(gui.get(UI_Main).evt.key.update_ui_idioms);
- gui.get(UI_Main).evt.emit(gui.get(UI_Main).evt.key.update_remain);
- //关卡难度
- //重新选词
- //刷新UI_Idioms
- //计时刷新,剩余方块数量刷新
- }, this);
- this.onButtonEvent(layout.ReturnHall_Btn, async (button: any) => {
- //返回大厅
- await gui.closeAll();
- gui.show(UI_Hall);
- ResUtil.loadScene(SceneDef.Hall, ModuleDef.GAME, true);
- }, this);
- }
- }
|