update
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import SoundPrefab from '../../engine/uicomponent/SoundPrefab'
|
||||
import MusicPrefab from '../../engine/uicomponent/MusicPrefab'
|
||||
import SoundPrefab from '../../engine/uicomponent/SoundPrefab'
|
||||
import RandomUtil from '../../engine/utils/RandomUtil'
|
||||
|
||||
export default class GameMusicHelper {
|
||||
public static playBg() {
|
||||
let randomIndex: number = RandomUtil.nextInt(1, 3)
|
||||
MusicPrefab.play('background_' + randomIndex)
|
||||
const randomIndex: number = RandomUtil.nextInt(1, 3)
|
||||
MusicPrefab.play(`background_${randomIndex}`)
|
||||
}
|
||||
|
||||
public static playFishDead(fishType: number) {
|
||||
SoundPrefab.play('deadfish_' + fishType)
|
||||
SoundPrefab.play(`deadfish_${fishType}`)
|
||||
}
|
||||
|
||||
public static playFire() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { error, game } from 'cc'
|
||||
|
||||
import DarkLayer from '../../engine/uicomponent/DarkLayer'
|
||||
import LoadingPrefab from '../../engine/uicomponent/LoadingPrefab'
|
||||
import LoadingScenePrefab from '../../engine/uicomponent/LoadingScenePrefab'
|
||||
@@ -22,29 +23,28 @@ export default class ResourcePreload {
|
||||
}
|
||||
this.isPreloaded = true
|
||||
this.progress = progress
|
||||
if (this.progress) {
|
||||
if (this.progress)
|
||||
progress.updateProgress(this.nowIndex, this.totalNum)
|
||||
}
|
||||
await LoadingPrefab.preLoad() //1
|
||||
|
||||
await LoadingPrefab.preLoad() // 1
|
||||
this.finishOneItemLoad()
|
||||
await DarkLayer.preLoad() //2
|
||||
await DarkLayer.preLoad() // 2
|
||||
this.finishOneItemLoad()
|
||||
await MusicPrefab.preLoad() //3
|
||||
await MusicPrefab.preLoad() // 3
|
||||
this.finishOneItemLoad()
|
||||
await SoundPrefab.preLoad() //4
|
||||
await SoundPrefab.preLoad() // 4
|
||||
this.finishOneItemLoad()
|
||||
await ResourcePrefab.preLoad() //5
|
||||
await ResourcePrefab.preLoad() // 5
|
||||
this.finishOneItemLoad()
|
||||
await ShaderMaterialPrefab.preLoad() //6
|
||||
await ShaderMaterialPrefab.preLoad() // 6
|
||||
this.finishOneItemLoad() //
|
||||
callback()
|
||||
}
|
||||
|
||||
private finishOneItemLoad() {
|
||||
this.nowIndex++
|
||||
if (this.progress) {
|
||||
if (this.progress)
|
||||
this.progress.updateProgress(this.nowIndex, this.totalNum)
|
||||
}
|
||||
}
|
||||
|
||||
public restartGame() {
|
||||
@@ -53,7 +53,7 @@ export default class ResourcePreload {
|
||||
LoadingScenePrefab.clear()
|
||||
LoadingPrefab.clear()
|
||||
error('需要获取游戏里所有的AudioSource停止音乐')
|
||||
//audioEngine.stopAll();
|
||||
// audioEngine.stopAll();
|
||||
|
||||
// VersionManager.instance.releaseAll();
|
||||
MusicPrefab.destory()
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { _decorator, Component } from 'cc'
|
||||
import { Component, _decorator } from 'cc'
|
||||
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
@ccclass('UIRoot')
|
||||
export class UIRoot extends Component {
|
||||
public static Instance: UIRoot
|
||||
onLoad() {
|
||||
UIRoot.Instance = this
|
||||
}
|
||||
onDestroy() {
|
||||
UIRoot.Instance = null
|
||||
}
|
||||
public static Instance: UIRoot
|
||||
|
||||
onLoad() {
|
||||
UIRoot.Instance = this
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
UIRoot.Instance = null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user