import { _decorator, Color, Component, director, Label, Node, resources, SceneAsset, Sprite } from 'cc'; import { DEBUG } from 'cc/env'; import { AdManager } from './MyFrame/AD/AdManager'; import { SDKManager } from './MyFrame/SDK/SDKManager'; import { AudioManager } from './Set/AudioManager'; const { ccclass, property } = _decorator; @ccclass('Loading') export class Loading extends Component { @property(Node) RankNode: Node = null; @property(Node) StartNode: Node = null; @property(Node) SliderNode: Node = null; @property(Node) SetNode: Node = null; @property(Node) TipsNode: Node = null; @property(Node) RankPanelNode: Node = null; @property(Node) SetPanelNode: Node = null; protected onLoad(): void { this.init() this.Startloading() AudioManager.Instance.playBgm(AudioManager.BGM) SDKManager.getInstance().login((res) => { }) SDKManager.getInstance().showShareMenu() } init() { this.RankNode.active = false; this.SetNode.active = false; this.StartNode.active = false; this.TipsNode.active = false; this.SliderNode.active = true; this.SliderNode.getComponentInChildren(Sprite).fillRange = 0; } Startloading() { resources.preloadScene('Game', (finished: number, total: number) => { if ((finished / total) > this.SliderNode.getComponentInChildren(Sprite).fillRange) { this.SliderNode.getComponentInChildren(Sprite).fillRange = finished / total; } } , (err) => { if (err) { console.error(err); return; } this.OverLoading() console.log('预加载场景成功'); if (DEBUG) { // this.ClickGame() } }) } OverLoading() { this.SliderNode.active = false; this.StartNode.active = true; this.RankNode.active = true; this.TipsNode.active = true; this.SetNode.active = true; } ClickGame() { director.loadScene('Game', (err) => { if (err) { console.error(err); return; } console.log('加载场景成功'); }) AudioManager.Instance.playEffict(AudioManager.anniu) } ClickRank() { console.log('点击排行榜'); this.RankPanelNode.active = true; AudioManager.Instance.playEffict(AudioManager.anniu) } ClickSet() { console.log('点击设置'); this.SetPanelNode.active = true; AudioManager.Instance.playEffict(AudioManager.anniu) } /////////////////// banner() { // AdManager.getInstance().showBannerAd() } chapinng() { // AdManager.getInstance().showInterstitialAd() } jili() { // AdManager.getInstance().showRewardVideoAd((res: boolean) => { // console.log(res); // }) } }