This commit is contained in:
2024-10-05 04:22:34 +08:00
parent 5993f231fd
commit 30911fcf5c
298 changed files with 28632 additions and 28632 deletions

View File

@@ -1,18 +1,18 @@
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() {
const randomIndex: number = RandomUtil.nextInt(1, 3)
MusicPrefab.play(`background_${randomIndex}`)
}
public static playFishDead(fishType: number) {
SoundPrefab.play(`deadfish_${fishType}`)
}
public static playFire() {
SoundPrefab.play('fire')
}
}
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() {
const randomIndex: number = RandomUtil.nextInt(1, 3)
MusicPrefab.play(`background_${randomIndex}`)
}
public static playFishDead(fishType: number) {
SoundPrefab.play(`deadfish_${fishType}`)
}
public static playFire() {
SoundPrefab.play('fire')
}
}

View File

@@ -1,11 +1,11 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "5515ff19-e57f-4594-99b0-2e5439136f41",
"files": [],
"subMetas": {},
"userData": {
"simulateGlobals": []
}
}
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "5515ff19-e57f-4594-99b0-2e5439136f41",
"files": [],
"subMetas": {},
"userData": {
"simulateGlobals": []
}
}

View File

@@ -1,64 +1,64 @@
import { error, game } from 'cc'
import DarkLayer from '../../engine/uicomponent/DarkLayer'
import LoadingPrefab from '../../engine/uicomponent/LoadingPrefab'
import LoadingScenePrefab from '../../engine/uicomponent/LoadingScenePrefab'
import MusicPrefab from '../../engine/uicomponent/MusicPrefab'
import Progress from '../../engine/uicomponent/Progress'
import SoundPrefab from '../../engine/uicomponent/SoundPrefab'
import ResourcePrefab from '../prefab/ResourcePrefab'
import ShaderMaterialPrefab from '../prefab/ShaderMaterialPrefab'
export default class ResourcePreload {
public static instance: ResourcePreload = new ResourcePreload()
private isPreloaded: boolean = false
private totalNum: number = 6
private nowIndex: number = 0
private progress: Progress
public async preLoad(callback: Function, progress: Progress) {
if (this.isPreloaded) {
callback()
return
}
this.isPreloaded = true
this.progress = progress
if (this.progress)
progress.updateProgress(this.nowIndex, this.totalNum)
await LoadingPrefab.preLoad() // 1
this.finishOneItemLoad()
await DarkLayer.preLoad() // 2
this.finishOneItemLoad()
await MusicPrefab.preLoad() // 3
this.finishOneItemLoad()
await SoundPrefab.preLoad() // 4
this.finishOneItemLoad()
await ResourcePrefab.preLoad() // 5
this.finishOneItemLoad()
await ShaderMaterialPrefab.preLoad() // 6
this.finishOneItemLoad() //
callback()
}
private finishOneItemLoad() {
this.nowIndex++
if (this.progress)
this.progress.updateProgress(this.nowIndex, this.totalNum)
}
public restartGame() {
this.isPreloaded = false
// GameSocket.getInstance().closeSocket(false);
LoadingScenePrefab.clear()
LoadingPrefab.clear()
error('需要获取游戏里所有的AudioSource停止音乐')
// audioEngine.stopAll();
// VersionManager.instance.releaseAll();
MusicPrefab.destory()
SoundPrefab.destory()
ResourcePrefab.clear()
game.restart()
}
}
import { error, game } from 'cc'
import DarkLayer from '../../engine/uicomponent/DarkLayer'
import LoadingPrefab from '../../engine/uicomponent/LoadingPrefab'
import LoadingScenePrefab from '../../engine/uicomponent/LoadingScenePrefab'
import MusicPrefab from '../../engine/uicomponent/MusicPrefab'
import Progress from '../../engine/uicomponent/Progress'
import SoundPrefab from '../../engine/uicomponent/SoundPrefab'
import ResourcePrefab from '../prefab/ResourcePrefab'
import ShaderMaterialPrefab from '../prefab/ShaderMaterialPrefab'
export default class ResourcePreload {
public static instance: ResourcePreload = new ResourcePreload()
private isPreloaded: boolean = false
private totalNum: number = 6
private nowIndex: number = 0
private progress: Progress
public async preLoad(callback: Function, progress: Progress) {
if (this.isPreloaded) {
callback()
return
}
this.isPreloaded = true
this.progress = progress
if (this.progress)
progress.updateProgress(this.nowIndex, this.totalNum)
await LoadingPrefab.preLoad() // 1
this.finishOneItemLoad()
await DarkLayer.preLoad() // 2
this.finishOneItemLoad()
await MusicPrefab.preLoad() // 3
this.finishOneItemLoad()
await SoundPrefab.preLoad() // 4
this.finishOneItemLoad()
await ResourcePrefab.preLoad() // 5
this.finishOneItemLoad()
await ShaderMaterialPrefab.preLoad() // 6
this.finishOneItemLoad() //
callback()
}
private finishOneItemLoad() {
this.nowIndex++
if (this.progress)
this.progress.updateProgress(this.nowIndex, this.totalNum)
}
public restartGame() {
this.isPreloaded = false
// GameSocket.getInstance().closeSocket(false);
LoadingScenePrefab.clear()
LoadingPrefab.clear()
error('需要获取游戏里所有的AudioSource停止音乐')
// audioEngine.stopAll();
// VersionManager.instance.releaseAll();
MusicPrefab.destory()
SoundPrefab.destory()
ResourcePrefab.clear()
game.restart()
}
}

View File

@@ -1,11 +1,11 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "c49b722e-acd3-4d0f-9685-b773d596a5b3",
"files": [],
"subMetas": {},
"userData": {
"simulateGlobals": []
}
}
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "c49b722e-acd3-4d0f-9685-b773d596a5b3",
"files": [],
"subMetas": {},
"userData": {
"simulateGlobals": []
}
}

View File

@@ -1,7 +1,7 @@
import { Node, tween } from 'cc'
export default class TimeHelper {
public static exeNextFrame(node: Node, callback: Function) {
tween(node).delay(0.02).call(callback).start()
}
}
import { Node, tween } from 'cc'
export default class TimeHelper {
public static exeNextFrame(node: Node, callback: Function) {
tween(node).delay(0.02).call(callback).start()
}
}

View File

@@ -1,9 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "11277eab-4376-4199-9255-4d5c9d2b9e7e",
"files": [],
"subMetas": {},
"userData": {}
}
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "11277eab-4376-4199-9255-4d5c9d2b9e7e",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,16 +1,16 @@
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
}
}
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
}
}

View File

@@ -1,9 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "e0962cbd-f5bd-4c15-b6d8-c403d02a854f",
"files": [],
"subMetas": {},
"userData": {}
}
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "e0962cbd-f5bd-4c15-b6d8-c403d02a854f",
"files": [],
"subMetas": {},
"userData": {}
}