init git
This commit is contained in:
30
assets/FishSingle/script/engine/uicomponent/DarkLayer.ts
Normal file
30
assets/FishSingle/script/engine/uicomponent/DarkLayer.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { _decorator, Component, Prefab, Widget, instantiate, Node } from 'cc'
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
import PrefabLoader from '../utils/PrefabLoader'
|
||||
import { GameConfig } from '../../game/config/GameConfig'
|
||||
import DialogBase from './DialogBase'
|
||||
|
||||
@ccclass('DarkLayer')
|
||||
export default class DarkLayer extends Component {
|
||||
private static prefab: Prefab
|
||||
onLoad() {
|
||||
this.getComponent(Widget).target = DialogBase.GetRootCanvas()
|
||||
}
|
||||
start() {}
|
||||
public static preLoad(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
PrefabLoader.loadPrefab(
|
||||
`${GameConfig.GameName}/share/uicomponent/DarkLayer`,
|
||||
(loadedResource) => {
|
||||
DarkLayer.prefab = loadedResource
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
public static getDarkLayer() {
|
||||
let dialogNode: Node = instantiate(DarkLayer.prefab)
|
||||
return dialogNode
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user