优化若干代码
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { _decorator, Component, Prefab, Node, instantiate } from 'cc'
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
import { _decorator, Component, instantiate, Node, Prefab } from 'cc'
|
||||
import PrefabLoader from '../../engine/utils/PrefabLoader'
|
||||
import { GameConfig } from '../config/GameConfig'
|
||||
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
@ccclass('ResourcePrefab')
|
||||
export default class ResourcePrefab extends Component {
|
||||
private static prefab: Prefab | null = null
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { _decorator, Component, Label, Vec2, tween, Vec3, Tween } from 'cc'
|
||||
import { _decorator, Component, Label, tween, Tween, Vec2, Vec3 } from 'cc'
|
||||
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
@ccclass('ScorePrefab')
|
||||
|
||||
@@ -1,41 +1,42 @@
|
||||
import { _decorator, Component, Node, Material, instantiate, Prefab } from 'cc'
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
import { _decorator, Component, instantiate, Material, Node, Prefab } from 'cc'
|
||||
import PrefabLoader from '../../engine/utils/PrefabLoader'
|
||||
import { GameConfig } from '../config/GameConfig'
|
||||
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
@ccclass('ShaderMaterialPrefab')
|
||||
export default class ShaderMaterialPrefab extends Component {
|
||||
public static instance: Node
|
||||
public static instance: Node
|
||||
|
||||
@property({ type: Material })
|
||||
public default: Material | null = null
|
||||
@property({ type: Material })
|
||||
public default: Material | null = null
|
||||
|
||||
@property({ type: Material })
|
||||
public grayMaterial: Material | null = null
|
||||
@property({ type: Material })
|
||||
public oldPhoto: Material | null = null
|
||||
@property({ type: Material })
|
||||
public glowInner: Material | null = null
|
||||
@property({ type: Material })
|
||||
public mosaic: Material | null = null
|
||||
@property({ type: Material })
|
||||
public roundCornerCrop: Material | null = null
|
||||
@property({ type: Material })
|
||||
public flashLight: Material | null = null
|
||||
@property({ type: Material })
|
||||
public flag: Material | null = null
|
||||
@property({ type: Material })
|
||||
public gaussian: Material | null = null
|
||||
public static preLoad(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
PrefabLoader.loadPrefab(
|
||||
GameConfig.GameName + '/' + 'game/prefab/ShaderMaterialPrefab',
|
||||
(loadedResource: Prefab) => {
|
||||
ShaderMaterialPrefab.instance = instantiate(loadedResource)
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
@property({ type: Material })
|
||||
public grayMaterial: Material | null = null
|
||||
@property({ type: Material })
|
||||
public oldPhoto: Material | null = null
|
||||
@property({ type: Material })
|
||||
public glowInner: Material | null = null
|
||||
@property({ type: Material })
|
||||
public mosaic: Material | null = null
|
||||
@property({ type: Material })
|
||||
public roundCornerCrop: Material | null = null
|
||||
@property({ type: Material })
|
||||
public flashLight: Material | null = null
|
||||
@property({ type: Material })
|
||||
public flag: Material | null = null
|
||||
@property({ type: Material })
|
||||
public gaussian: Material | null = null
|
||||
|
||||
public static preLoad(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
PrefabLoader.loadPrefab(
|
||||
GameConfig.GameName + '/' + 'game/prefab/ShaderMaterialPrefab',
|
||||
(loadedResource: Prefab) => {
|
||||
ShaderMaterialPrefab.instance = instantiate(loadedResource)
|
||||
resolve()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user