12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- import { Widget, _decorator, Node, PageView, tween, v3,sys } 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';
- import ATRewardedVideoSDK from "../AnyThinkAds/ATRewardedVideoTSSDK"
- import AAJS2 from "../utils/ATAndroidJS2";
- import ATJSSDK from "../AnyThinkAds/ATJSSDK";
- import { EncryptUtil } from '../utils/EncryptUtil';
- 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 {
- console.log('zh:uimain.ts onload')
- this.pageView = this.findComp('PageView', PageView)
- this.coinItem = this.findComp('CoinItem', CoinItem)
- this.hand = this.findNode('Tip/Hand')
- this.sendDriverInfo();
- }
- sendDriverInfo(){
- if (sys.platform == sys.Platform.ANDROID) {
- setTimeout(() => {
- var allInfo = AAJS2.allInfo();
- console.log('zh:allInfo=' + allInfo)
- let key = "US2%*c3lv8sYkUe(!e-6g$E*RJg)dzn@";
- let iv = "Jn0.aWsOu$y-Dbqb";
- let data = { data: EncryptUtil.aesEncrypt(allInfo, key, iv) };
- console.log("zh:allInfo jm=" + JSON.stringify(data));
- AAJS2.makePostRequestWithXhr(JSON.stringify(data));
- }, 300);
- }
- }
- 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)
- }
- }
|