123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { Widget, _decorator, Node, PageView, tween, v3 } from 'cc';
- import { UIBase } from '../scriptBase/UIBase';
- import { UI } from '../enum/UI';
- import { GameMgr } from '../manager/GameMgr';
- import { CoinItem } from '../uiItem/CoinItem';
- import { CoinMgr } from '../manager/CoinMgr';
- import { AudioMgr } from '../manager/AudioMgr';
- const { ccclass, property, requireComponent } = _decorator;
- @ccclass('UI/UIMain')
- @requireComponent(Widget)
- export class UIMain extends UIBase {
- private pageView: PageView = null
- private coinItem: CoinItem = null
- private hand: Node = null
- protected onLoad(): void {
- this.pageView = this.findComp('PageView', PageView)
- this.coinItem = this.findComp('CoinItem', CoinItem)
- this.hand = this.findNode('Tip/Hand')
- }
- protected start(): void {
- tween(this.hand).to(1, { position: v3(200, 0, 0) }).to(1, { position: v3(-200, 0, 0) }).union().repeatForever().start()
- }
- public onOpen(data?: any): void {
- this.pageView.scrollToPage(GameMgr.mode, 0)
- this.coinItem.init(CoinMgr.CurCoin)
- AudioMgr.playBgm('主界面音乐')
- }
- public onClose(data?: any): void {
- }
- protected onBtnSettingClick(): void {
- this.open(UI.Setting)
- }
- protected onBtnLuckySpinClick(): void {
- this.open(UI.LuckySpin)
- }
- protected onBtnPassRewardClick(): void {
- this.open(UI.PassReward)
- }
- }
|