Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use cocos log instead #15567

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cocos/2d/assembler/label/bmfontUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import { JSB } from 'internal:constants';
import { IConfig, FontAtlas } from '../../assets/bitmap-font';
import { SpriteFrame } from '../../assets/sprite-frame';
import { Rect } from '../../../core';
import { Rect, error } from '../../../core';
import { Label, Overflow, CacheMode } from '../../components/label';
import { UITransform } from '../../framework/ui-transform';
import { LetterAtlas, shareLabelInfo } from './font-utils';
Expand Down Expand Up @@ -282,7 +282,7 @@ export const bmfontUtils = {

createQuadIndices (indexCount): void {
if (indexCount % 6 !== 0) {
console.error('illegal index count!');
error('illegal index count!');
return;
}
const quadCount = indexCount / 6;
Expand Down
4 changes: 2 additions & 2 deletions cocos/2d/assembler/label/font-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

import { FontAtlas } from '../../assets/bitmap-font';
import { Color, macro, warnID } from '../../../core';
import { Color, macro, warn, warnID } from '../../../core';
import { ImageAsset, Texture2D } from '../../../asset/assets';
import { PixelFormat } from '../../../asset/assets/asset-enum';
import { BufferTextureCopy } from '../../../gfx';
Expand Down Expand Up @@ -251,7 +251,7 @@

const gfxDevice = this._getGFXDevice();
if (!gfxDevice) {
console.warn('Unable to get device');
warn('Unable to get device');
return;
}

Expand Down Expand Up @@ -400,7 +400,7 @@
}

public getLetterDefinitionForChar (char: string, labelInfo: ILabelInfo): any {
const hash = char.charCodeAt(0) + labelInfo.hash;

Check failure on line 403 in cocos/2d/assembler/label/font-utils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal
let letter = this.fontDefDictionary.letterDefinitions[hash];
if (!letter) {
const temp = new LetterTexture(char, labelInfo);
Expand Down Expand Up @@ -450,8 +450,8 @@
const color = labelInfo.color.toHEX();
let out = '';
if (labelInfo.isOutlined && labelInfo.margin > 0) {
out = out + labelInfo.margin + labelInfo.out.toHEX();

Check failure on line 453 in cocos/2d/assembler/label/font-utils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal

Check failure on line 453 in cocos/2d/assembler/label/font-utils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal
}

return hashData + labelInfo.fontSize + labelInfo.fontFamily + color + out;

Check failure on line 456 in cocos/2d/assembler/label/font-utils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal

Check failure on line 456 in cocos/2d/assembler/label/font-utils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal

Check failure on line 456 in cocos/2d/assembler/label/font-utils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal
}
4 changes: 2 additions & 2 deletions cocos/2d/assembler/sprite/tiled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import { JSB } from 'internal:constants';
import { IUV, SpriteFrame } from '../../assets/sprite-frame';
import { Mat4, Vec3, Color } from '../../../core';
import { Mat4, Vec3, Color, error } from '../../../core';
import { IRenderData, RenderData } from '../../renderer/render-data';
import { IBatcher } from '../../renderer/i-batcher';
import { Sprite } from '../../components/sprite';
Expand Down Expand Up @@ -121,7 +121,7 @@ export const tiled: IAssembler = {

createQuadIndices (indexCount) {
if (indexCount % 6 !== 0) {
console.error('illegal index count!');
error('illegal index count!');
return;
}
const quadCount = indexCount / 6;
Expand Down
4 changes: 2 additions & 2 deletions cocos/2d/components/mask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
THE SOFTWARE.
*/

import { ccclass, help, executionOrder, menu, tooltip, displayOrder, type, visible, serializable, range, slide, executeInEditMode } from 'cc.decorator';

Check warning on line 26 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 152. Maximum allowed is 150
import { JSB } from 'internal:constants';
import { clamp, Color, Mat4, Vec2, Vec3, warnID, cclegacy, ccenum } from '../../core';
import { clamp, Color, Mat4, Vec2, Vec3, warnID, cclegacy, ccenum, error } from '../../core';
import { Graphics } from './graphics';
import { TransformBit } from '../../scene-graph/node-enum';
import { Stage } from '../renderer/stencil-manager';
Expand Down Expand Up @@ -189,7 +189,7 @@
* @zh
* 椭圆遮罩的曲线细分数。
*/
@visible(function (this: Mask) {

Check warning on line 192 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
return this.type === MaskType.GRAPHICS_ELLIPSE;
})
get segments (): number {
Expand Down Expand Up @@ -224,7 +224,7 @@
if (this._sprite) {
this._sprite.spriteFrame = value;
} else {
console.error('please change type to sprite_stencil first');
error('please change type to sprite_stencil first');
}
}

Expand All @@ -241,7 +241,7 @@
* 该数值 0 ~ 1 之间的浮点数,默认值为 0.1
* 当被设置为 1 时,会丢弃所有蒙版像素,所以不会显示任何内容
*/
@visible(function (this: Mask): boolean {

Check warning on line 244 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
return this.type === MaskType.SPRITE_STENCIL;
})
@range([0, 1, 0.1])
Expand Down Expand Up @@ -463,7 +463,7 @@

// deprecated interface
/**
* @deprecated Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation

Check warning on line 466 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 180. Maximum allowed is 150
*/
get customMaterial (): Material | null {
warnID(9007);
Expand All @@ -479,7 +479,7 @@
}
}
/**
* @deprecated Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation

Check warning on line 482 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 180. Maximum allowed is 150
*/
get color (): Color | null {
warnID(9007);
Expand All @@ -495,7 +495,7 @@
}
}
/**
* @deprecated Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation

Check warning on line 498 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 180. Maximum allowed is 150
*/
public markForUpdateRenderData (enable = true): void {
warnID(9007);
Expand All @@ -504,20 +504,20 @@
}
}
/**
* @deprecated Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation

Check warning on line 507 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 180. Maximum allowed is 150
*/
public requestRenderData (any): void {
warnID(9007);
}
/**
* @deprecated Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation

Check warning on line 513 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 180. Maximum allowed is 150
*/
public destroyRenderData (): void {
warnID(9007);
}

/**
* @deprecated Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation

Check warning on line 520 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 180. Maximum allowed is 150
*/
public updateRenderer (): void {
warnID(9007);
Expand All @@ -527,7 +527,7 @@
}

/**
* @deprecated Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation

Check warning on line 530 in cocos/2d/components/mask.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 180. Maximum allowed is 150
*/
public fillBuffers (render: any): void {
warnID(9007);
Expand Down
4 changes: 2 additions & 2 deletions cocos/2d/components/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ccclass, help, executionOrder, menu, tooltip, displayOrder, type, range
import { BUILD, EDITOR } from 'internal:constants';
import { SpriteAtlas } from '../assets/sprite-atlas';
import { SpriteFrame } from '../assets/sprite-frame';
import { Vec2, cclegacy, ccenum, clamp } from '../../core';
import { Vec2, cclegacy, ccenum, clamp, warn } from '../../core';
import { IBatcher } from '../renderer/i-batcher';
import { UIRenderer, InstanceMaterialType } from '../framework/ui-renderer';
import { PixelFormat } from '../../asset/assets/asset-enum';
Expand Down Expand Up @@ -526,7 +526,7 @@ export class Sprite extends UIRenderer {
*/
public changeSpriteFrameFromAtlas (name: string): void {
if (!this._atlas) {
console.warn('SpriteAtlas is null.');
warn('SpriteAtlas is null.');
return;
}
const sprite = this._atlas.getSpriteFrame(name);
Expand Down
4 changes: 2 additions & 2 deletions cocos/2d/components/ui-mesh-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { NativeUIModelProxy } from '../renderer/native-2d';
import { uiRendererManager } from '../framework/ui-renderer-manager';
import { RenderEntity, RenderEntityType } from '../renderer/render-entity';
import { MeshRenderData, RenderData } from '../renderer/render-data';
import { assert, cclegacy } from '../../core';
import { assert, cclegacy, warn } from '../../core';
import { RenderDrawInfoType } from '../renderer/render-draw-info';
import type { UIRenderer } from '../framework/ui-renderer';

Expand Down Expand Up @@ -99,7 +99,7 @@ export class UIMeshRenderer extends Component {

this._modelComponent = this.getComponent('cc.ModelRenderer') as ModelRenderer;
if (!this._modelComponent) {
console.warn(`node '${this.node && this.node.name}' doesn't have any renderable component`);
warn(`node '${this.node && this.node.name}' doesn't have any renderable component`);
return;
}
if (JSB) {
Expand Down
4 changes: 2 additions & 2 deletions cocos/2d/utils/dynamic-atlas/atlas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { PixelFormat } from '../../../asset/assets/asset-enum';
import { ImageAsset } from '../../../asset/assets/image-asset';
import { Texture2D } from '../../../asset/assets/texture-2d';
import { BufferTextureCopy } from '../../../gfx';
import { cclegacy } from '../../../core';
import { cclegacy, warn } from '../../../core';
import { SpriteFrame } from '../../assets/sprite-frame';

const space = 2;
Expand Down Expand Up @@ -254,7 +254,7 @@ export class DynamicAtlasTexture extends Texture2D {

const gfxDevice = this._getGFXDevice();
if (!gfxDevice) {
console.warn('Unable to get device');
warn('Unable to get device');
return;
}

Expand Down
12 changes: 6 additions & 6 deletions cocos/3d/lod/lodgroup-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
import { EDITOR, JSB } from 'internal:constants';
import { ccclass, editable, executeInEditMode, menu, serializable, type } from 'cc.decorator';
import { Vec3, Mat4, geometry, CCInteger, CCFloat } from '../../core';
import { Vec3, Mat4, geometry, CCInteger, CCFloat, error, warn } from '../../core';
import { Node } from '../../scene-graph/node';
import { Component } from '../../scene-graph/component';
import { MeshRenderer } from '../framework/mesh-renderer';
Expand Down Expand Up @@ -205,7 +205,7 @@ export class LOD {
*/
public setRenderer (index: number, renderer: MeshRenderer): void {
if (index < 0 || index >= this.rendererCount) {
console.error('setRenderer to LOD error, index out of range');
error('setRenderer to LOD error, index out of range');
return;
}
this.deleteRenderer(index);
Expand Down Expand Up @@ -378,12 +378,12 @@ export class LODGroup extends Component {
*/
public eraseLOD (index: number): LOD | null {
if (index < 0 || index >= this.lodCount) {
console.warn('eraseLOD error, index out of range');
warn('eraseLOD error, index out of range');
return null;
}
const lod = this._LODs[index];
if (!lod) {
console.warn('eraseLOD error, LOD not exist at specified index.');
warn('eraseLOD error, LOD not exist at specified index.');
return null;
}
this._LODs.splice(index, 1);
Expand All @@ -401,7 +401,7 @@ export class LODGroup extends Component {
*/
public getLOD (index: number): LOD | null {
if (index < 0 || index >= this.lodCount) {
console.warn('getLOD error, index out of range');
warn('getLOD error, index out of range');
return null;
}
return this._LODs[index];
Expand All @@ -415,7 +415,7 @@ export class LODGroup extends Component {
*/
public setLOD (index: number, lod: LOD): void {
if (index < 0 || index >= this.lodCount) {
console.warn('setLOD error, index out of range');
warn('setLOD error, index out of range');
return;
}
this._LODs[index] = lod;
Expand Down
8 changes: 4 additions & 4 deletions cocos/3d/misc/batch-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import { MeshRenderer } from '../framework/mesh-renderer';
import { Mesh } from '../assets/mesh';
import { Mat4 } from '../../core';
import { Mat4, error } from '../../core';
import { Node } from '../../scene-graph/node';

function checkMaterialisSame (comp1: MeshRenderer, comp2: MeshRenderer): boolean {
Expand Down Expand Up @@ -65,16 +65,16 @@ export class BatchingUtility {
public static batchStaticModel (staticModelRoot: Node, batchedRoot: Node): boolean {
const models = staticModelRoot.getComponentsInChildren(MeshRenderer);
if (models.length < 2) {
console.error('the number of static models to batch is less than 2,it needn\'t batch.');
error('the number of static models to batch is less than 2,it needn\'t batch.');
return false;
}
for (let i = 1; i < models.length; i++) {
if (!models[0].mesh!.validateMergingMesh(models[i].mesh!)) {
console.error(`the meshes of ${models[0].node.name} and ${models[i].node.name} can't be merged`);
error(`the meshes of ${models[0].node.name} and ${models[i].node.name} can't be merged`);
return false;
}
if (!checkMaterialisSame(models[0], models[i])) {
console.error(`the materials of ${models[0].node.name} and ${models[i].node.name} can't be merged`);
error(`the materials of ${models[0].node.name} and ${models[i].node.name} can't be merged`);
return false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions cocos/3d/reflection-probe/reflection-probe-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
import { ccclass, executeInEditMode, menu, playOnFocus, serializable, tooltip, type, visible } from 'cc.decorator';
import { EDITOR, EDITOR_NOT_IN_PREVIEW } from 'internal:constants';
import { CCBoolean, CCObject, Color, Enum, Vec3 } from '../../core';
import { CCBoolean, CCObject, Color, Enum, Vec3, warn } from '../../core';

import { TextureCube } from '../../asset/assets';
import { scene } from '../../render-scene';
Expand Down Expand Up @@ -151,7 +151,7 @@ export class ReflectionProbe extends Component {
this._objFlags ^= CCObject.Flags.IsRotationLocked;
}
if (!this._sourceCamera) {
console.warn('the reflection camera is invalid, please set the reflection camera');
warn('the reflection camera is invalid, please set the reflection camera');
} else {
this.probe.switchProbeType(value, this._sourceCamera.camera);
}
Expand Down
1 change: 0 additions & 1 deletion cocos/3d/skeletal-animation/limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
THE SOFTWARE.
*/


export const MAX_ANIMATION_LAYER = 32;
3 changes: 1 addition & 2 deletions cocos/3d/skeletal-animation/skeletal-animation-blending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export abstract class BlendStateBuffer<
this.deRef(internal.node, internal.property);
}

public ref<P extends BlendingPropertyName> (node: Node, property: P): PropertyBlendStateTypeMap<PropertyBlendState<Vec3>, PropertyBlendState<Quat>>[P]
{
public ref<P extends BlendingPropertyName> (node: Node, property: P): PropertyBlendStateTypeMap<PropertyBlendState<Vec3>, PropertyBlendState<Quat>>[P] {
let nodeBlendState = this._nodeBlendStates.get(node);
if (!nodeBlendState) {
nodeBlendState = this.createNodeBlendState();
Expand Down
3 changes: 1 addition & 2 deletions cocos/3d/skeletal-animation/skeletal-animation-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ export class JointTexturePool {
}
}

private _createAnimInfos (skeleton: Skeleton, clip: AnimationClip, skinningRoot: Node): IInternalJointAnimInfo[]
{
private _createAnimInfos (skeleton: Skeleton, clip: AnimationClip, skinningRoot: Node): IInternalJointAnimInfo[] {
const animInfos: IInternalJointAnimInfo[] = [];
const { joints, bindposes } = skeleton;
const jointCount = joints.length;
Expand Down
4 changes: 2 additions & 2 deletions cocos/3d/skeletal-animation/skeletal-animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
ccclass, executeInEditMode, executionOrder, help, menu, tooltip, type, serializable, editable,
} from 'cc.decorator';
import { SkinnedMeshRenderer } from '../skinned-mesh-renderer';
import { Mat4, cclegacy, js, assertIsTrue } from '../../core';
import { Mat4, cclegacy, js, assertIsTrue, warn } from '../../core';
import { DataPoolManager } from './data-pool-manager';
import { Node } from '../../scene-graph/node';
import { AnimationClip } from '../../animation/animation-clip';
Expand Down Expand Up @@ -276,7 +276,7 @@ export class SkeletalAnimation extends Animation {
const socket = this._sockets.find((s) => s.path === path);
if (socket) { return socket.target; }
const joint = this.node.getChildByPath(path);
if (!joint) { console.warn('illegal socket path'); return null; }
if (!joint) { warn('illegal socket path'); return null; }
const target = new Node();
target.parent = this.node;
this._sockets.push(new Socket(path, target));
Expand Down
11 changes: 5 additions & 6 deletions cocos/3d/skinned-mesh-renderer/skinned-mesh-batch-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { Material } from '../../asset/assets/material';
import { Mesh } from '../assets/mesh';
import { Skeleton } from '../assets/skeleton';
import { Texture2D } from '../../asset/assets/texture-2d';
import { CCString, Mat4, Vec2, Vec3, cclegacy } from '../../core';
import { CCString, Mat4, Vec2, Vec3, cclegacy, warn } from '../../core';
import { AttributeName, FormatInfos, Format, Type, Attribute, BufferTextureCopy } from '../../gfx';
import { mapBuffer, readBuffer, writeBuffer } from '../misc/buffer';
import { SkinnedMeshRenderer } from './skinned-mesh-renderer';
Expand Down Expand Up @@ -118,8 +118,7 @@ export class SkinnedMeshUnit {
if (comp.skinningRoot) { getWorldTransformUntilRoot(comp.node, comp.skinningRoot, this._localTransform); }
}

get copyFrom (): SkinnedMeshRenderer | null
{
get copyFrom (): SkinnedMeshRenderer | null {
return null;
}
}
Expand Down Expand Up @@ -228,7 +227,7 @@ export class SkinnedMeshBatchRenderer extends SkinnedMeshRenderer {
}
const mat = this.getMaterialInstance(0);
if (!mat || !this._batchMaterial || !this._batchMaterial.effectAsset) {
console.warn('incomplete batch material!'); return;
warn('incomplete batch material!'); return;
}
mat.copy(this._batchMaterial); this.resizeAtlases();
const tech = mat.effectAsset!.techniques[mat.technique];
Expand Down Expand Up @@ -260,7 +259,7 @@ export class SkinnedMeshBatchRenderer extends SkinnedMeshRenderer {
}

public cookSkeletons (): void {
if (!this._skinningRoot) { console.warn('no skinning root specified!'); return; }
if (!this._skinningRoot) { warn('no skinning root specified!'); return; }
// merge joints accordingly
const joints: string[] = [];
const bindposes: Mat4[] = [];
Expand All @@ -276,7 +275,7 @@ export class SkinnedMeshBatchRenderer extends SkinnedMeshRenderer {
if (EDITOR) { // consistency check
Mat4.multiply(m4_1, partial.bindposes[i], m4_local);
if (!m4_1.equals(bindposes[idx])) {
console.warn(`${this.node.name}: Inconsistent bindpose at ${joints[idx]} in unit ${u}, artifacts may present`);
warn(`${this.node.name}: Inconsistent bindpose at ${joints[idx]} in unit ${u}, artifacts may present`);
}
}
continue;
Expand Down
10 changes: 5 additions & 5 deletions cocos/asset/asset-manager/asset-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,9 @@ export class AssetManager {
* @zh 加载好的资源,如果加载过程出现了错误,资源将会 null。
*
* @example
* assetManager.loadRemote('http://www.cloud.com/test1.jpg', (err, texture) => console.log(err));
* assetManager.loadRemote('http://www.cloud.com/test2.mp3', (err, audioClip) => console.log(err));
* assetManager.loadRemote('http://www.cloud.com/test3', { ext: '.png' }, (err, texture) => console.log(err));
* assetManager.loadRemote('http://www.cloud.com/test1.jpg', (err, texture) => log(err));
* assetManager.loadRemote('http://www.cloud.com/test2.mp3', (err, audioClip) => log(err));
* assetManager.loadRemote('http://www.cloud.com/test3', { ext: '.png' }, (err, texture) => log(err));
*
*/
public loadRemote<T extends Asset> (url: string, options: { [k: string]: any, ext?: string } | null, onComplete?: ((err: Error | null, data: T) => void) | null): void;
Expand Down Expand Up @@ -671,8 +671,8 @@ export class AssetManager {
* @zh 加载完成的 bundle。如果加载过程中出现了错误,则为 null。
*
* @example
* loadBundle('myBundle', (err, bundle) => console.log(bundle));
* loadBundle('http://localhost:8080/test', null, (err, bundle) => console.log(err));
* loadBundle('myBundle', (err, bundle) => log(bundle));
* loadBundle('http://localhost:8080/test', null, (err, bundle) => log(err));
*
*/
public loadBundle (nameOrUrl: string, options: { [k: string]: any, version?: string } | null, onComplete?: ((err: Error | null, data: Bundle) => void) | null): void;
Expand Down
12 changes: 6 additions & 6 deletions cocos/asset/asset-manager/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,16 @@ export default class Bundle {
*
* @example
* // load the texture (${project}/assets/resources/textures/background.jpg) from resources
* resources.load('textures/background', Texture2D, (err, texture) => console.log(err));
* resources.load('textures/background', Texture2D, (err, texture) => log(err));
*
* // load the audio (${project}/assets/resources/music/hit.mp3) from resources
* resources.load('music/hit', AudioClip, (err, audio) => console.log(err));
* resources.load('music/hit', AudioClip, (err, audio) => log(err));
*
* // load the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
* bundle1.load('misc/character/cocos', Prefab, (err, prefab) => console.log(err));
* bundle1.load('misc/character/cocos', Prefab, (err, prefab) => log(err));
*
* // load the sprite frame (${project}/assets/some/xxx/bundle2/imgs/cocos.png) from bundle2 folder
* bundle2.load('imgs/cocos', SpriteFrame, null, (err, spriteFrame) => console.log(err));
* bundle2.load('imgs/cocos', SpriteFrame, null, (err, spriteFrame) => log(err));
*
*/
public load<T extends Asset> (
Expand Down Expand Up @@ -346,10 +346,10 @@ export default class Bundle {
* });
*
* // load all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
* bundle1.loadDir('misc/characters', Prefab, (err, prefabs) => console.log(err));
* bundle1.loadDir('misc/characters', Prefab, (err, prefabs) => log(err));
*
* // load all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
* bundle2.loadDir('skills', SpriteFrame, null, (err, spriteFrames) => console.log(err));
* bundle2.loadDir('skills', SpriteFrame, null, (err, spriteFrames) => log(err));
*
*/
public loadDir<T extends Asset> (dir: string, type: Constructor<T> | null, onProgress: ((finished: number, total: number, item: RequestItem) => void) | null, onComplete: ((err: Error | null, data: T[]) => void) | null): void;
Expand Down
2 changes: 1 addition & 1 deletion cocos/asset/asset-manager/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export default class Cache<T = any> implements ICache<T> {
*
* @example
* var cache = new Cache();
* cache.forEach((val, key) => console.log(key));
* cache.forEach((val, key) => log(key));
*
*/
public forEach (func: (val: T, key: string) => void): void {
Expand Down
4 changes: 2 additions & 2 deletions cocos/asset/asset-manager/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ export class Downloader {
* @param onComplete.content @en The downloaded file. @zh 下载下来的文件内容。
*
* @example
* download('http://example.com/test.tga', '.tga', { onFileProgress: (loaded, total) => console.log(loaded/total) },
* onComplete: (err) => console.log(err));
* download('http://example.com/test.tga', '.tga', { onFileProgress: (loaded, total) => log(loaded/total) },
* onComplete: (err) => log(err));
*/
public download (id: string, url: string, type: string, options: Record<string, any>, onComplete: ((err: Error | null, data?: any | null) => void)): void {
// if it is downloaded, don't download again
Expand Down
Loading
Loading