123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- 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);
- // })
- }
- }
|