core/asset
애셋.
Asset.
Assetextends Object
애셋.
Asset.
import { ImageAsset } from "./build/vanilla.js";
const imageAsset = new ImageAsset();
await imageAsset.load("examples/assets/spritesheet.png");
console.log(imageAsset.getAssetType(), imageAsset.getAssetPath(), imageAsset.isLoaded());
imageAsset.unload();
console.log(imageAsset.isLoaded(), imageAsset.getAssetPath());비동기 애셋 로드.
Loads the asset asynchronously.
- assetPathstring
- 애셋 경로. (이미 로드되었으면 아무것도 하지 않는다)Asset path. (does nothing if already loaded)
반환ReturnsPromise<void> 경로를 정하면 풀리는 프로미스. (이 기반 함수는 읽지 않고 로드 상태도 바꾸지 않는다)A promise resolved once the path is set. (this base function does not read anything or change the loaded state)
애셋 언로드.
- 그 자리에서 끝나고 아무것도 돌려주지 않는다. (로드되어 있었든 아니든 같다, 덮어쓴 하위 클래스와 같다)
Unloads the asset.
- Finishes immediately and returns nothing. (the same whether it was loaded or not, same as the overriding subclasses)
짝Counterpart: vanilla-engine AssetBase.unload
애셋 타입 설정.
Sets the asset type.
- assetTypestring
- 애셋 타입 이름. ("image", "audio", "json", "text", "font", "blob" 같은, 하위 클래스가 생성자에서 정한다)Asset type name. (such as "image", "audio", "json", "text", "font", "blob", set by subclasses in their constructor)
애셋 타입 반환.
Returns the asset type.
반환Returnsstring 애셋 타입 이름. (정하지 않았으면 "none")Asset type name. ("none" if not set)
짝Counterpart: vanilla-engine AssetBase.get_asset_type
로드 경로 반환.
Returns the load path.
반환Returnsstring 로드 경로. (로드 전이나 언로드 뒤에는 빈 글)Load path. (empty string before loading or after unloading)
짝Counterpart: vanilla-engine AssetBase.get_asset_path
로드 되었는지 여부 설정.
Sets whether it is loaded.
- isLoadedboolean
- 로드 되었으면 참.True if loaded.
로드 되었는지 여부 반환.
Returns whether it is loaded.
반환Returnsboolean 로드 되었으면 참.True if loaded.
짝Counterpart: vanilla-engine AssetBase.is_loaded
AssetTypeenum
애셋 타입.
Asset type.
| 이름Name | 값Value | 설명Description |
|---|---|---|
none | none | 애셋 종류 없음.No asset type. |
image | image | 이미지 애셋.Image asset. |
audio | audio | 오디오 애셋.Audio asset. |
json | json | JSON 애셋.JSON asset. |
text | text | 텍스트 애셋.Text asset. |
font | font | 글꼴 애셋.Font asset. |
blob | blob | 바이너리 덩어리 애셋.Binary blob asset. |
bunch | bunch | 묶음 애셋.Bundle asset. |
visual | visual | 비주얼 애셋.Visual asset. |