mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Eliminate cc.* log functions invocation (#6845)
This commit is contained in:
committed by
GitHub
parent
7b792b42d9
commit
adfdb67bb8
@@ -326,7 +326,7 @@ const AssetLibrary = {
|
||||
*/
|
||||
init (options) {
|
||||
if (EDITOR && _libraryBase) {
|
||||
legacyCC.errorID(6402);
|
||||
debug.errorID(6402);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ const AssetLibrary = {
|
||||
const typeId = info[1];
|
||||
const type = _getClassById(typeId);
|
||||
if (!type) {
|
||||
legacyCC.error('Cannot get', typeId);
|
||||
debug.error('Cannot get', typeId);
|
||||
continue;
|
||||
}
|
||||
// backward compatibility since 1.10
|
||||
|
||||
@@ -33,6 +33,7 @@ import { Eventify } from '../event';
|
||||
import { RawAsset } from './raw-asset';
|
||||
import { Node } from '../scene-graph';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { errorID } from '../platform/debug';
|
||||
|
||||
/**
|
||||
* @en
|
||||
@@ -140,7 +141,7 @@ export class Asset extends Eventify(RawAsset) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
legacyCC.errorID(6400);
|
||||
errorID(6400);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
|
||||
@@ -34,6 +34,7 @@ import { Asset } from './asset';
|
||||
import { PixelFormat } from './asset-enum';
|
||||
import { EDITOR, MINIGAME } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID } from '../platform/debug';
|
||||
|
||||
/**
|
||||
* 内存图像源。
|
||||
@@ -194,13 +195,13 @@ export class ImageAsset extends Asset {
|
||||
this._onDataComplete();
|
||||
});
|
||||
data.addEventListener('error', (err) => {
|
||||
legacyCC.warnID(3119, err.message);
|
||||
warnID(3119, err.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public destroy (): boolean {
|
||||
public destroy () {
|
||||
if (this.data && this.data instanceof HTMLImageElement) {
|
||||
this.data.src = "";
|
||||
legacyCC.loader.removeItem(this.data.id);
|
||||
|
||||
@@ -35,6 +35,7 @@ import { Enum } from '../value-types';
|
||||
import { Asset } from './asset';
|
||||
import { SUPPORT_JIT, ALIPAY, RUNTIME_BASED } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID } from '../platform/debug';
|
||||
|
||||
/**
|
||||
* Prefab 创建实例所用的优化策略,配合 [[optimizationPolicy]] 使用。
|
||||
@@ -148,7 +149,7 @@ export default class Prefab extends Asset {
|
||||
}
|
||||
else {
|
||||
// temp guard code
|
||||
legacyCC.warnID(3700);
|
||||
warnID(3700);
|
||||
}
|
||||
if (!this._createFunction) {
|
||||
this.compileCreateFunction();
|
||||
|
||||
@@ -40,6 +40,7 @@ import { EDITOR } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { ImageAsset, ImageSource } from './image-asset';
|
||||
import { Texture2D } from './texture-2d';
|
||||
import { errorID } from '../platform/debug';
|
||||
|
||||
const INSET_LEFT = 0;
|
||||
const INSET_TOP = 1;
|
||||
@@ -683,12 +684,12 @@ export class SpriteFrame extends Asset {
|
||||
}
|
||||
|
||||
if (maxX > texture.width) {
|
||||
legacyCC.errorID(3300, this.name + '/' + texture.name, maxX, texture.width);
|
||||
errorID(3300, this.name + '/' + texture.name, maxX, texture.width);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (maxY > texture.height) {
|
||||
legacyCC.errorID(3301, this.name + '/' + texture.name, maxY, texture.height);
|
||||
errorID(3301, this.name + '/' + texture.name, maxY, texture.height);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import { Asset } from './asset';
|
||||
import { Filter, PixelFormat, WrapMode } from './asset-enum';
|
||||
import { GFXSampler } from '../gfx';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { errorID } from '../platform/debug';
|
||||
|
||||
const CHAR_CODE_1 = 49; // '1'
|
||||
|
||||
@@ -270,7 +271,7 @@ export class TextureBase extends Asset {
|
||||
if (this._gfxDevice) {
|
||||
this._gfxSampler = samplerLib.getSampler(this._gfxDevice, this._samplerHash);
|
||||
} else {
|
||||
legacyCC.errorID(9302);
|
||||
errorID(9302);
|
||||
}
|
||||
}
|
||||
return this._gfxSampler;
|
||||
|
||||
@@ -41,6 +41,7 @@ import * as RF from '../data/utils/requiring-frame';
|
||||
import { Node } from '../scene-graph';
|
||||
import { EDITOR, TEST, DEV } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { errorID, warnID, assertID } from '../platform/debug';
|
||||
|
||||
const idGenerator = new IDGenerator('Comp');
|
||||
// @ts-ignore
|
||||
@@ -362,7 +363,7 @@ class Component extends CCObject {
|
||||
// @ts-ignore
|
||||
const depend = this.node._getDependComponent(this);
|
||||
if (depend) {
|
||||
legacyCC.errorID(3626,
|
||||
errorID(3626,
|
||||
getClassName(this), getClassName(depend));
|
||||
return false;
|
||||
}
|
||||
@@ -432,8 +433,8 @@ class Component extends CCObject {
|
||||
* ```
|
||||
*/
|
||||
public schedule (callback, interval: number = 0, repeat: number = legacyCC.macro.REPEAT_FOREVER, delay: number = 0) {
|
||||
legacyCC.assertID(callback, 1619);
|
||||
legacyCC.assertID(interval >= 0, 1620);
|
||||
assertID(callback, 1619);
|
||||
assertID(interval >= 0, 1620);
|
||||
|
||||
interval = interval || 0;
|
||||
repeat = isNaN(repeat) ? legacyCC.macro.REPEAT_FOREVER : repeat;
|
||||
@@ -739,7 +740,7 @@ value(Component, '_registerEditorProps', function (cls, props) {
|
||||
cls._playOnFocus = true;
|
||||
}
|
||||
else {
|
||||
legacyCC.warnID(3601, name);
|
||||
warnID(3601, name);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -776,7 +777,7 @@ value(Component, '_registerEditorProps', function (cls, props) {
|
||||
break;
|
||||
|
||||
default:
|
||||
legacyCC.warnID(3602, key, name);
|
||||
warnID(3602, key, name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import {BUILTIN_CLASSID_RE} from '../utils/misc';
|
||||
import { Component } from './component';
|
||||
import { EDITOR } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID } from '../platform/debug';
|
||||
|
||||
/**
|
||||
* @en
|
||||
@@ -117,7 +118,7 @@ export default class MissingScript extends Component {
|
||||
}
|
||||
|
||||
public onLoad () {
|
||||
legacyCC.warnID(4600, this.node.name);
|
||||
warnID(4600, this.node.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import { CanvasComponent } from './canvas-component';
|
||||
import { Node } from '../../scene-graph';
|
||||
import { EDITOR } from 'internal:constants';
|
||||
import { legacyCC } from '../../global-exports';
|
||||
import { warnID } from '../../platform/debug';
|
||||
|
||||
const _vec2a = new Vec2();
|
||||
const _vec2b = new Vec2();
|
||||
@@ -213,7 +214,7 @@ export class UITransformComponent extends Component {
|
||||
}
|
||||
|
||||
if (this._canvas && this._canvas.node === this.node) {
|
||||
legacyCC.warn(9200);
|
||||
warnID(9200);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+21
-20
@@ -47,6 +47,7 @@ import { Scheduler } from './scheduler';
|
||||
import { js } from './utils';
|
||||
import { DEBUG, EDITOR, BUILD } from 'internal:constants';
|
||||
import { legacyCC } from './global-exports';
|
||||
import { errorID, error, logID, assertID } from './platform/debug';
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -489,7 +490,7 @@ export class Director extends EventTarget {
|
||||
* @param onLaunched - The function invoked at the scene after launch.
|
||||
*/
|
||||
public runSceneImmediate (scene: Scene, onBeforeLoadScene?: Director.OnBeforeLoadScene, onLaunched?: Director.OnSceneLaunched) {
|
||||
legacyCC.assertID(scene instanceof legacyCC.Scene, 1216);
|
||||
assertID(scene instanceof legacyCC.Scene, 1216);
|
||||
|
||||
const uuid = legacyCC.loader._getReferenceKey(scene.uuid);
|
||||
// Scene cannot be cached in loader, because it will be destroyed after switching.
|
||||
@@ -594,8 +595,8 @@ export class Director extends EventTarget {
|
||||
* @private
|
||||
*/
|
||||
public runScene (scene: Scene, onBeforeLoadScene?: Director.OnBeforeLoadScene, onLaunched?: Director.OnSceneLaunched) {
|
||||
legacyCC.assertID(scene, 1205);
|
||||
legacyCC.assertID(scene instanceof legacyCC.Scene, 1216);
|
||||
assertID(scene, 1205);
|
||||
assertID(scene instanceof legacyCC.Scene, 1216);
|
||||
|
||||
// ensure scene initialized
|
||||
// @ts-ignore
|
||||
@@ -632,11 +633,11 @@ export class Director extends EventTarget {
|
||||
return scenes[key];
|
||||
}
|
||||
else {
|
||||
legacyCC.errorID(1206, key);
|
||||
errorID(1206, key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
legacyCC.errorID(1207, key);
|
||||
errorID(1207, key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -651,7 +652,7 @@ export class Director extends EventTarget {
|
||||
*/
|
||||
public loadScene (sceneName: string, onLaunched?: Director.OnSceneLaunched, onUnloaded?: Director.OnUnload) {
|
||||
if (this._loadingScene) {
|
||||
legacyCC.errorID(1208, sceneName, this._loadingScene);
|
||||
errorID(1208, sceneName, this._loadingScene);
|
||||
return false;
|
||||
}
|
||||
const info = this._getSceneUuid(sceneName);
|
||||
@@ -663,7 +664,7 @@ export class Director extends EventTarget {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
legacyCC.errorID(1209, sceneName);
|
||||
errorID(1209, sceneName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -720,7 +721,7 @@ export class Director extends EventTarget {
|
||||
onProgress,
|
||||
(error: null | Error, asset: SceneAsset) => {
|
||||
if (error) {
|
||||
legacyCC.errorID(1210, sceneName, error.message);
|
||||
errorID(1210, sceneName, error.message);
|
||||
}
|
||||
if (onLoaded) {
|
||||
onLoaded(error, asset);
|
||||
@@ -728,11 +729,11 @@ export class Director extends EventTarget {
|
||||
});
|
||||
}
|
||||
else {
|
||||
const error = 'Can not preload the scene "' + sceneName + '" because it is not in the build settings.';
|
||||
const err = 'Can not preload the scene "' + sceneName + '" because it is not in the build settings.';
|
||||
if (onLoaded) {
|
||||
onLoaded(new Error(error));
|
||||
onLoaded(new Error(err));
|
||||
}
|
||||
legacyCC.error('preloadScene: ' + error);
|
||||
error('preloadScene: ' + err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,13 +772,13 @@ export class Director extends EventTarget {
|
||||
|
||||
// cc.AssetLibrary.unloadAsset(uuid); // force reload
|
||||
console.time('LoadScene ' + uuid);
|
||||
legacyCC.AssetLibrary.loadAsset(uuid, (error, sceneAsset) => {
|
||||
legacyCC.AssetLibrary.loadAsset(uuid, (err, sceneAsset) => {
|
||||
console.timeEnd('LoadScene ' + uuid);
|
||||
const self = director;
|
||||
self._loadingScene = '';
|
||||
if (error) {
|
||||
error = 'Failed to load scene: ' + error;
|
||||
legacyCC.error(error);
|
||||
if (err) {
|
||||
err = 'Failed to load scene: ' + err;
|
||||
error(err);
|
||||
}
|
||||
else {
|
||||
if (sceneAsset instanceof legacyCC.SceneAsset) {
|
||||
@@ -801,12 +802,12 @@ export class Director extends EventTarget {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
error = 'The asset ' + uuid + ' is not a scene';
|
||||
legacyCC.error(error);
|
||||
err = 'The asset ' + uuid + ' is not a scene';
|
||||
error(err);
|
||||
}
|
||||
}
|
||||
if (onLaunched) {
|
||||
onLaunched(error);
|
||||
onLaunched(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -822,7 +823,7 @@ export class Director extends EventTarget {
|
||||
|
||||
this._lastUpdate = performance.now();
|
||||
if (!this._lastUpdate) {
|
||||
legacyCC.logID(1200);
|
||||
logID(1200);
|
||||
}
|
||||
|
||||
this._paused = false;
|
||||
@@ -1084,7 +1085,7 @@ export class Director extends EventTarget {
|
||||
this._root = new Root(legacyCC.game._gfxDevice);
|
||||
const rootInfo = {};
|
||||
if (!this._root.initialize(rootInfo)) {
|
||||
legacyCC.errorID(1217);
|
||||
errorID(1217);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
import {safeMeasureText} from '../utils/text-utils';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID } from '../platform/debug';
|
||||
|
||||
interface IFontLoadHandle {
|
||||
fontFamilyName;
|
||||
@@ -110,7 +111,7 @@ function nativeCheckFontLoaded (start, font, callback) {
|
||||
}
|
||||
callback(null, font);
|
||||
}, function () {
|
||||
legacyCC.warnID(4933, font);
|
||||
warnID(4933, font);
|
||||
callback(null, font);
|
||||
});
|
||||
}
|
||||
@@ -124,7 +125,7 @@ function _checkFontLoaded () {
|
||||
let fontFamily = fontLoadHandle.fontFamilyName;
|
||||
// load timeout
|
||||
if (now - fontLoadHandle.startTime > _timeout) {
|
||||
legacyCC.warnID(4933, fontFamily);
|
||||
warnID(4933, fontFamily);
|
||||
fontLoadHandle.callback(null, fontFamily);
|
||||
_loadingFonts.splice(i, 1);
|
||||
continue;
|
||||
|
||||
@@ -32,6 +32,7 @@ import {createMap} from '../utils/js';
|
||||
import { LoadingItems, IItem } from './loading-items';
|
||||
import { EDITOR } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID } from '../platform/debug';
|
||||
const ItemState = LoadingItems.ItemState;
|
||||
|
||||
export interface IPipe {
|
||||
@@ -175,12 +176,12 @@ export class Pipeline {
|
||||
insertPipe (pipe: IPipe, index: number) {
|
||||
// Must have handle and id, handle for flow, id for state flag
|
||||
if (!pipe.handle || !pipe.id || index > this._pipes.length) {
|
||||
legacyCC.warnID(4921);
|
||||
warnID(4921);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._pipes.indexOf(pipe) > 0) {
|
||||
legacyCC.warnID(4922);
|
||||
warnID(4922);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
import {createMap, getClassName, clear} from '../utils/js';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { log } from '../platform/debug';
|
||||
|
||||
let _tmpInfo: any = null;
|
||||
|
||||
@@ -54,7 +55,7 @@ function getItemDesc (item) {
|
||||
function doCheckCouldRelease (releasedKey, refOwnerItem, caches) {
|
||||
var loadedAgain = caches[releasedKey];
|
||||
if (!loadedAgain) {
|
||||
legacyCC.log(`"${releasedKey}" was released but maybe still referenced by ${getItemDesc(refOwnerItem)}`);
|
||||
log(`"${releasedKey}" was released but maybe still referenced by ${getItemDesc(refOwnerItem)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
import * as js from '../utils/js';
|
||||
import {_getClassById} from '../utils/js';
|
||||
import { getError } from '../platform/debug';
|
||||
import { getError, warnID } from '../platform/debug';
|
||||
import { LoadingItems } from './loading-items';
|
||||
import { decompressJson } from './utils';
|
||||
import { EDITOR, DEBUG, JSB } from 'internal:constants';
|
||||
@@ -265,7 +265,7 @@ export function loadUuid (item, callback) {
|
||||
if (cls) {
|
||||
return cls;
|
||||
}
|
||||
legacyCC.warnID(4903, id);
|
||||
warnID(4903, id);
|
||||
return Object;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ export function errorID (id: number, ...optionalParams: any[]) {
|
||||
}
|
||||
|
||||
const assertFormatter = getTypedFormatter('Assert');
|
||||
export function assertID (condition: boolean, id: number, ...optionalParams: any[]) {
|
||||
export function assertID (condition: any, id: number, ...optionalParams: any[]) {
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
import { EventKeyboard, EventAcceleration, EventMouse } from './events';
|
||||
import { Node } from '../../scene-graph';
|
||||
import { legacyCC } from '../../global-exports';
|
||||
import { logID, assertID } from '../debug';
|
||||
|
||||
export interface IEventListenerCreateInfo {
|
||||
event?: number;
|
||||
@@ -111,7 +112,7 @@ export class EventListener {
|
||||
* @param argObj a json object
|
||||
*/
|
||||
public static create (argObj: IEventListenerCreateInfo): EventListener {
|
||||
legacyCC.assertID(argObj && argObj.event, 1900);
|
||||
assertID(argObj && argObj.event, 1900);
|
||||
|
||||
const listenerType = argObj.event;
|
||||
delete argObj.event;
|
||||
@@ -425,7 +426,7 @@ export class TouchOneByOne extends EventListener {
|
||||
|
||||
public checkAvailable () {
|
||||
if (!this.onTouchBegan) {
|
||||
legacyCC.logID(1801);
|
||||
logID(1801);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -454,7 +455,7 @@ export class TouchAllAtOnce extends EventListener {
|
||||
public checkAvailable () {
|
||||
if (this.onTouchesBegan === null && this.onTouchesMoved === null
|
||||
&& this.onTouchesEnded === null && this.onTouchesCancelled === null) {
|
||||
legacyCC.logID(1802);
|
||||
logID(1802);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -478,7 +479,7 @@ export class Acceleration extends EventListener {
|
||||
}
|
||||
|
||||
public checkAvailable () {
|
||||
legacyCC.assertID(this._onAccelerationEvent, 1803);
|
||||
assertID(this._onAccelerationEvent, 1803);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -518,7 +519,7 @@ export class Keyboard extends EventListener {
|
||||
|
||||
public checkAvailable () {
|
||||
if (this.onKeyPressed === null && this.onKeyReleased === null) {
|
||||
legacyCC.logID(1800);
|
||||
logID(1800);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -36,6 +36,7 @@ import { EventListener, TouchOneByOne } from './event-listener';
|
||||
import { Node } from '../../scene-graph';
|
||||
import { macro } from '../macro';
|
||||
import { legacyCC } from '../../global-exports';
|
||||
import { errorID, warnID, logID, assertID } from '../../platform/debug';
|
||||
const ListenerID = EventListener.ListenerID;
|
||||
|
||||
function checkUINode (node) {
|
||||
@@ -105,7 +106,7 @@ function __getListenerID (event: Event) {
|
||||
// Touch listener is very special, it contains two kinds of listeners:
|
||||
// EventListenerTouchOneByOne and EventListenerTouchAllAtOnce.
|
||||
// return UNKNOWN instead.
|
||||
legacyCC.logID(2000);
|
||||
logID(2000);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@@ -149,7 +150,7 @@ class EventManager {
|
||||
*/
|
||||
public pauseTarget (node: Node, recursive = false) {
|
||||
if (!(node instanceof legacyCC._BaseNode)) {
|
||||
legacyCC.warnID(3506);
|
||||
warnID(3506);
|
||||
return;
|
||||
}
|
||||
const listeners = this._nodeListenersMap[node.uuid];
|
||||
@@ -182,7 +183,7 @@ class EventManager {
|
||||
*/
|
||||
public resumeTarget (node: Node, recursive = false) {
|
||||
if (!(node instanceof legacyCC._BaseNode)) {
|
||||
legacyCC.warnID(3506);
|
||||
warnID(3506);
|
||||
return;
|
||||
}
|
||||
const listeners = this._nodeListenersMap[node.uuid];
|
||||
@@ -260,17 +261,17 @@ class EventManager {
|
||||
* @returns
|
||||
*/
|
||||
public addListener (listener: EventListener, nodeOrPriority: any | number): any {
|
||||
legacyCC.assertID(listener && nodeOrPriority, 3503);
|
||||
assertID(listener && nodeOrPriority, 3503);
|
||||
if (!(legacyCC.js.isNumber(nodeOrPriority) || nodeOrPriority instanceof legacyCC._BaseNode)) {
|
||||
legacyCC.warnID(3506);
|
||||
warnID(3506);
|
||||
return;
|
||||
}
|
||||
if (!(listener instanceof legacyCC.EventListener)) {
|
||||
legacyCC.assertID(!legacyCC.js.isNumber(nodeOrPriority), 3504);
|
||||
assertID(!legacyCC.js.isNumber(nodeOrPriority), 3504);
|
||||
listener = legacyCC.EventListener.create(listener);
|
||||
} else {
|
||||
if (listener._isRegistered()) {
|
||||
legacyCC.logID(3505);
|
||||
logID(3505);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -281,7 +282,7 @@ class EventManager {
|
||||
|
||||
if (legacyCC.js.isNumber(nodeOrPriority)) {
|
||||
if (nodeOrPriority === 0) {
|
||||
legacyCC.logID(3500);
|
||||
logID(3500);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -292,7 +293,7 @@ class EventManager {
|
||||
this._addListener(listener);
|
||||
} else {
|
||||
if (!checkUINode(nodeOrPriority)) {
|
||||
legacyCC.logID(3512);
|
||||
logID(3512);
|
||||
return;
|
||||
}
|
||||
listener._setSceneGraphPriority(nodeOrPriority);
|
||||
@@ -401,7 +402,7 @@ class EventManager {
|
||||
*/
|
||||
public removeListeners (listenerType: number | any, recursive = false) {
|
||||
if (!(legacyCC.js.isNumber(listenerType) || listenerType instanceof legacyCC._BaseNode)) {
|
||||
legacyCC.warnID(3506);
|
||||
warnID(3506);
|
||||
return;
|
||||
}
|
||||
if (listenerType._id !== undefined) {
|
||||
@@ -454,7 +455,7 @@ class EventManager {
|
||||
} else if (listenerType === legacyCC.EventListener.KEYBOARD) {
|
||||
this._removeListenersForListenerID(ListenerID.KEYBOARD);
|
||||
} else {
|
||||
legacyCC.logID(3501);
|
||||
logID(3501);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,7 +513,7 @@ class EventManager {
|
||||
const found = fixedPriorityListeners.indexOf(listener);
|
||||
if (found !== -1) {
|
||||
if (listener._getSceneGraphPriority() != null) {
|
||||
legacyCC.logID(3502);
|
||||
logID(3502);
|
||||
}
|
||||
if (listener._getFixedPriority() !== fixedPriority) {
|
||||
listener._setFixedPriority(fixedPriority);
|
||||
@@ -566,7 +567,7 @@ class EventManager {
|
||||
this._updateDirtyFlagForSceneGraph();
|
||||
this._inDispatch++;
|
||||
if (!event || !event.getType) {
|
||||
legacyCC.errorID(3511);
|
||||
errorID(3511);
|
||||
return;
|
||||
}
|
||||
if (event.getType().startsWith(legacyCC.Event.TOUCH)) {
|
||||
@@ -654,7 +655,7 @@ class EventManager {
|
||||
|
||||
const node = listener._getSceneGraphPriority();
|
||||
if (node === null) {
|
||||
legacyCC.logID(3507);
|
||||
logID(3507);
|
||||
}
|
||||
|
||||
this._associateNodeAndEventListener(node, listener);
|
||||
@@ -873,7 +874,7 @@ class EventManager {
|
||||
|
||||
private _updateTouchListeners (event) {
|
||||
const locInDispatch = this._inDispatch;
|
||||
legacyCC.assertID(locInDispatch > 0, 3508);
|
||||
assertID(locInDispatch > 0, 3508);
|
||||
|
||||
if (locInDispatch > 1) {
|
||||
return;
|
||||
@@ -889,7 +890,7 @@ class EventManager {
|
||||
this._onUpdateListeners(listeners);
|
||||
}
|
||||
|
||||
legacyCC.assertID(locInDispatch === 1, 3509);
|
||||
assertID(locInDispatch === 1, 3509);
|
||||
|
||||
const locToAddedListeners = this._toAddedListeners;
|
||||
if (locToAddedListeners.length !== 0) {
|
||||
|
||||
@@ -37,6 +37,7 @@ import { EventAcceleration, EventKeyboard, EventMouse, EventTouch } from './even
|
||||
import { Touch } from './touch';
|
||||
import { JSB, RUNTIME_BASED } from 'internal:constants';
|
||||
import { legacyCC } from '../../global-exports';
|
||||
import { logID } from '../debug';
|
||||
|
||||
const TOUCH_TIMEOUT = macro.TOUCH_TIMEOUT;
|
||||
|
||||
@@ -128,7 +129,7 @@ class InputManager {
|
||||
if (index === undefined) {
|
||||
const unusedIndex = this._getUnUsedIndex();
|
||||
if (unusedIndex === -1) {
|
||||
legacyCC.logID(2300, unusedIndex);
|
||||
logID(2300, unusedIndex);
|
||||
continue;
|
||||
}
|
||||
// curTouch = this._touches[unusedIndex] = touch;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
import { EDITOR, TEST, WECHAT, ALIPAY, XIAOMI, BAIDU, COCOSPLAY, JSB, MINIGAME } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID, log, logID } from './debug';
|
||||
|
||||
// tslint:disable
|
||||
|
||||
@@ -658,7 +659,7 @@ export const sys: { [x: string]: any; } = {
|
||||
str += 'osVersion : ' + this.osVersion + '\r\n';
|
||||
str += 'platform : ' + this.platform + '\r\n';
|
||||
str += 'Using ' + (legacyCC.game.renderType === legacyCC.game.RENDER_TYPE_WEBGL ? 'WEBGL' : 'CANVAS') + ' renderer.' + '\r\n';
|
||||
legacyCC.log(str);
|
||||
log(str);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -946,7 +947,7 @@ else {
|
||||
localStorage = null;
|
||||
} catch (e) {
|
||||
const warn = function () {
|
||||
legacyCC.warnID(5200);
|
||||
warnID(5200);
|
||||
};
|
||||
sys.localStorage = {
|
||||
getItem: warn,
|
||||
@@ -1064,11 +1065,11 @@ else {
|
||||
|
||||
if (DEBUG) {
|
||||
setTimeout(function () {
|
||||
legacyCC.log('browse type: ' + sys.browserType);
|
||||
legacyCC.log('browse version: ' + version);
|
||||
legacyCC.log('MULTI_CHANNEL: ' + __audioSupport.MULTI_CHANNEL);
|
||||
legacyCC.log('WEB_AUDIO: ' + __audioSupport.WEB_AUDIO);
|
||||
legacyCC.log('AUTOPLAY: ' + __audioSupport.AUTOPLAY);
|
||||
log('browse type: ' + sys.browserType);
|
||||
log('browse version: ' + version);
|
||||
log('MULTI_CHANNEL: ' + __audioSupport.MULTI_CHANNEL);
|
||||
log('WEB_AUDIO: ' + __audioSupport.WEB_AUDIO);
|
||||
log('AUTOPLAY: ' + __audioSupport.AUTOPLAY);
|
||||
}, 0);
|
||||
}
|
||||
})();
|
||||
@@ -1086,7 +1087,7 @@ else {
|
||||
}
|
||||
} catch (error) {
|
||||
__audioSupport.WEB_AUDIO = false;
|
||||
legacyCC.logID(5201);
|
||||
logID(5201);
|
||||
}
|
||||
|
||||
const formatSupport: string[] = [];
|
||||
|
||||
@@ -36,6 +36,7 @@ import { Rect, Size, Vec2 } from '../math';
|
||||
import visibleRect from './visible-rect';
|
||||
import { EDITOR, MINIGAME, WECHAT, JSB } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { logID } from './debug';
|
||||
|
||||
class BrowserGetter {
|
||||
|
||||
@@ -576,7 +577,7 @@ export class View extends EventTarget {
|
||||
public setDesignResolutionSize (width: number, height: number, resolutionPolicy: ResolutionPolicy|number) {
|
||||
// Defensive code
|
||||
if ( !(width > 0 || height > 0) ){
|
||||
legacyCC.logID(2200);
|
||||
logID(2200);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -599,7 +600,7 @@ export class View extends EventTarget {
|
||||
}
|
||||
|
||||
if (!policy) {
|
||||
legacyCC.logID(2201);
|
||||
logID(2201);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import { CCObject } from '../data/object';
|
||||
import * as js from '../utils/js';
|
||||
import { EDITOR, DEV, TEST } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { error, errorID } from '../platform/debug';
|
||||
|
||||
// @ts-ignore
|
||||
const Destroying = CCObject.Flags.Destroying;
|
||||
@@ -41,9 +42,9 @@ export function baseNodePolyfill (BaseNode) {
|
||||
const existing = this.getComponent(ctor._disallowMultiple);
|
||||
if (existing) {
|
||||
if (existing.constructor === ctor) {
|
||||
legacyCC.errorID(3805, js.getClassName(ctor), this._name);
|
||||
errorID(3805, js.getClassName(ctor), this._name);
|
||||
} else {
|
||||
legacyCC.errorID(3806, js.getClassName(ctor), this._name, js.getClassName(existing));
|
||||
errorID(3806, js.getClassName(ctor), this._name, js.getClassName(existing));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -58,13 +59,13 @@ export function baseNodePolyfill (BaseNode) {
|
||||
*/
|
||||
BaseNode.prototype._addComponentAt = function (comp, index) {
|
||||
if (this._objFlags & Destroying) {
|
||||
return legacyCC.error('isDestroying');
|
||||
return error('isDestroying');
|
||||
}
|
||||
if (!(comp instanceof legacyCC.Component)) {
|
||||
return legacyCC.errorID(3811);
|
||||
return errorID(3811);
|
||||
}
|
||||
if (index > this._components.length) {
|
||||
return legacyCC.errorID(3812);
|
||||
return errorID(3812);
|
||||
}
|
||||
|
||||
// recheck attributes because script may changed
|
||||
|
||||
@@ -31,7 +31,7 @@ import { Component } from '../components/component';
|
||||
import { ccclass, property } from '../data/class-decorator';
|
||||
import { CCObject } from '../data/object';
|
||||
import { Event } from '../event';
|
||||
import { errorID, warnID } from '../platform/debug';
|
||||
import { errorID, warnID, error, log, assertID } from '../platform/debug';
|
||||
import { SystemEventType } from '../platform/event-manager/event-enum';
|
||||
import { ISchedulable } from '../scheduler';
|
||||
import IdGenerator from '../utils/id-generator';
|
||||
@@ -229,7 +229,7 @@ export class BaseNode extends CCObject implements ISchedulable {
|
||||
node._scene = node;
|
||||
} else {
|
||||
if (node._parent == null) {
|
||||
legacyCC.error('Node %s(%s) has not attached to a scene.', node.name, node.uuid);
|
||||
error('Node %s(%s) has not attached to a scene.', node.name, node.uuid);
|
||||
} else {
|
||||
node._scene = node._parent._scene;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ export class BaseNode extends CCObject implements ISchedulable {
|
||||
*/
|
||||
public getChildByUuid (uuid: string) {
|
||||
if (!uuid) {
|
||||
legacyCC.log('Invalid uuid');
|
||||
log('Invalid uuid');
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ export class BaseNode extends CCObject implements ISchedulable {
|
||||
*/
|
||||
public getChildByName (name: string) {
|
||||
if (!name) {
|
||||
legacyCC.log('Invalid name');
|
||||
log('Invalid name');
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -537,8 +537,8 @@ export class BaseNode extends CCObject implements ISchedulable {
|
||||
if (DEV && !(child instanceof legacyCC._BaseNode)) {
|
||||
return errorID(1634, legacyCC.js.getClassName(child));
|
||||
}
|
||||
legacyCC.assertID(child, 1606);
|
||||
legacyCC.assertID((child as this)._parent === null, 1605);
|
||||
assertID(child, 1606);
|
||||
assertID((child as this)._parent === null, 1605);
|
||||
|
||||
// invokes the parent setter
|
||||
(child as this).setParent(this);
|
||||
@@ -911,7 +911,7 @@ export class BaseNode extends CCObject implements ISchedulable {
|
||||
|
||||
public addComponent (typeOrClassName: string | Function) {
|
||||
if (EDITOR && (this._objFlags & Destroying)) {
|
||||
legacyCC.error('isDestroying');
|
||||
error('isDestroying');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import { array } from '../utils/js';
|
||||
import { tryCatchFunctor_EDITOR } from '../utils/misc';
|
||||
import { EDITOR, SUPPORT_JIT, DEV, TEST } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { error, assert } from '../platform/debug';
|
||||
const fastRemoveAt = array.fastRemoveAt;
|
||||
|
||||
// @ts-ignore
|
||||
@@ -114,7 +115,7 @@ export class LifeCycleInvoker {
|
||||
this._pos = new Iterator([]);
|
||||
|
||||
if (TEST) {
|
||||
legacyCC.assert(typeof invokeFunc === 'function', 'invokeFunc must be type function');
|
||||
assert(typeof invokeFunc === 'function', 'invokeFunc must be type function');
|
||||
}
|
||||
this._invoke = invokeFunc;
|
||||
}
|
||||
@@ -176,7 +177,7 @@ class ReusableInvoker extends LifeCycleInvoker {
|
||||
array.splice(~i, 0, comp);
|
||||
}
|
||||
else if (DEV) {
|
||||
legacyCC.error('component already added');
|
||||
error('component already added');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import { tryCatchFunctor_EDITOR } from '../utils/misc';
|
||||
import { invokeOnEnable, createInvokeImpl, createInvokeImplJit, OneOffInvoker, LifeCycleInvoker } from './component-scheduler';
|
||||
import { EDITOR, DEV, TEST, SUPPORT_JIT } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { assert, errorID } from '../platform/debug';
|
||||
|
||||
const MAX_POOL_SIZE = 4;
|
||||
|
||||
@@ -129,7 +130,7 @@ activateTasksPool.get = function getActivateTask () {
|
||||
|
||||
function _componentCorrupted (node, comp, index) {
|
||||
if (DEV) {
|
||||
legacyCC.errorID(3817, node.name, index);
|
||||
errorID(3817, node.name, index);
|
||||
console.log('Corrupted component value:', comp);
|
||||
}
|
||||
if (comp) {
|
||||
@@ -282,7 +283,7 @@ export default class NodeActivator {
|
||||
// zh:
|
||||
// 对相同节点而言,无法撤销反激活,防止反激活 - 激活 - 反激活的死循环发生。
|
||||
// 这样设计简化了一些引擎的实现,而且对调用者来说能保证反激活操作都能成功。
|
||||
legacyCC.errorID(3816, node.name);
|
||||
errorID(3816, node.name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -316,9 +317,9 @@ export default class NodeActivator {
|
||||
|
||||
protected _deactivateNodeRecursively (node) {
|
||||
if (DEV) {
|
||||
legacyCC.assert(!(node._objFlags & Deactivating), 'node should not deactivating');
|
||||
assert(!(node._objFlags & Deactivating), 'node should not deactivating');
|
||||
// ensures _activeInHierarchy is always changing when Deactivating flagged
|
||||
legacyCC.assert(node._activeInHierarchy, 'node should not deactivated');
|
||||
assert(node._activeInHierarchy, 'node should not deactivated');
|
||||
}
|
||||
node._objFlags |= Deactivating;
|
||||
node._activeInHierarchy = false;
|
||||
|
||||
@@ -38,6 +38,7 @@ import { Touch } from '../platform/event-manager/touch';
|
||||
import { BaseNode } from './base-node';
|
||||
import { Node } from './node';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { errorID } from '../platform/debug';
|
||||
|
||||
const _cachedArray = new Array<BaseNode>(16);
|
||||
let _currentHovered: BaseNode | null = null;
|
||||
@@ -699,7 +700,7 @@ export class NodeEventProcessor {
|
||||
target = undefined;
|
||||
} else { useCapture = !!useCapture; }
|
||||
if (!callback) {
|
||||
legacyCC.errorID(6800);
|
||||
errorID(6800);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
import { ccclass, property } from '../data/class-decorator';
|
||||
import { Mat4, Quat, Vec3 } from '../math';
|
||||
import { warnID } from '../platform/debug';
|
||||
import { warnID, assert } from '../platform/debug';
|
||||
import { RenderScene } from '../renderer/scene/render-scene';
|
||||
import { BaseNode } from './base-node';
|
||||
import { SceneGlobals } from './scene-globals';
|
||||
@@ -210,7 +210,7 @@ export class Scene extends BaseNode {
|
||||
protected _load () {
|
||||
if (!this._inited) {
|
||||
if (TEST) {
|
||||
legacyCC.assert(!this._activeInHierarchy, 'Should deactivate ActionManager and EventManager by default');
|
||||
assert(!this._activeInHierarchy, 'Should deactivate ActionManager and EventManager by default');
|
||||
}
|
||||
this._onBatchCreated();
|
||||
this._inited = true;
|
||||
|
||||
+20
-19
@@ -31,6 +31,7 @@ import IdGenerator from './utils/id-generator';
|
||||
import {createMap} from './utils/js';
|
||||
import System from './components/system';
|
||||
import { legacyCC } from './global-exports';
|
||||
import { errorID, warnID, logID, assertID } from './platform/debug';
|
||||
|
||||
const MAX_POOL_SIZE = 20;
|
||||
|
||||
@@ -386,7 +387,7 @@ export class Scheduler extends System {
|
||||
if (!found) {
|
||||
// @ts-ignore
|
||||
if (target.__instanceId) {
|
||||
legacyCC.warnID(1513);
|
||||
warnID(1513);
|
||||
}
|
||||
else {
|
||||
target.id = idGenerator.getNewId();
|
||||
@@ -582,11 +583,11 @@ export class Scheduler extends System {
|
||||
delay = 0;
|
||||
}
|
||||
|
||||
legacyCC.assertID(target, 1502);
|
||||
assertID(target, 1502);
|
||||
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
let element = this._hashForTimers[targetId];
|
||||
@@ -596,7 +597,7 @@ export class Scheduler extends System {
|
||||
this._arrayForTimers.push(element);
|
||||
this._hashForTimers[targetId] = element;
|
||||
} else if (element.paused !== paused) {
|
||||
legacyCC.warnID(1511);
|
||||
warnID(1511);
|
||||
}
|
||||
|
||||
let timer;
|
||||
@@ -608,7 +609,7 @@ export class Scheduler extends System {
|
||||
for (i = 0; i < element.timers.length; ++i) {
|
||||
timer = element.timers[i];
|
||||
if (timer && callback === timer._callback) {
|
||||
legacyCC.logID(1507, timer.getInterval(), interval);
|
||||
logID(1507, timer.getInterval(), interval);
|
||||
timer._interval = interval;
|
||||
return;
|
||||
}
|
||||
@@ -639,7 +640,7 @@ export class Scheduler extends System {
|
||||
public scheduleUpdate (target: ISchedulable, priority: Number, paused: Boolean) {
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
const hashElement = this._hashForUpdates[targetId];
|
||||
@@ -647,7 +648,7 @@ export class Scheduler extends System {
|
||||
// check if priority has changed
|
||||
if (hashElement.entry.priority !== priority){
|
||||
if (this._updateHashLocked){
|
||||
legacyCC.logID(1506);
|
||||
logID(1506);
|
||||
hashElement.entry.markedForDeletion = false;
|
||||
hashElement.entry.paused = paused;
|
||||
return;
|
||||
@@ -699,7 +700,7 @@ export class Scheduler extends System {
|
||||
}
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -744,7 +745,7 @@ export class Scheduler extends System {
|
||||
}
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -772,7 +773,7 @@ export class Scheduler extends System {
|
||||
}
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -883,11 +884,11 @@ export class Scheduler extends System {
|
||||
public isScheduled (callback, target:ISchedulable){
|
||||
// key, target
|
||||
// selector, target
|
||||
legacyCC.assertID(callback, 1508);
|
||||
legacyCC.assertID(target, 1509);
|
||||
assertID(callback, 1508);
|
||||
assertID(target, 1509);
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1018,10 +1019,10 @@ export class Scheduler extends System {
|
||||
* @param {Object} target
|
||||
*/
|
||||
public pauseTarget (target:ISchedulable) {
|
||||
legacyCC.assertID(target, 1503);
|
||||
assertID(target, 1503);
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1051,10 +1052,10 @@ export class Scheduler extends System {
|
||||
* @param {Object} target
|
||||
*/
|
||||
public resumeTarget (target:ISchedulable) {
|
||||
legacyCC.assertID(target, 1504);
|
||||
assertID(target, 1504);
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1079,10 +1080,10 @@ export class Scheduler extends System {
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public isTargetPaused (target:ISchedulable) {
|
||||
legacyCC.assertID(target, 1505);
|
||||
assertID(target, 1505);
|
||||
let targetId = target.uuid || target.id;
|
||||
if (!targetId) {
|
||||
legacyCC.errorID(1510);
|
||||
errorID(1510);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { logID } from '../platform/debug';
|
||||
|
||||
export {default as MutableForwardIterator} from './mutable-forward-iterator';
|
||||
|
||||
@@ -88,7 +88,7 @@ export function verifyType<T> (array: T[], type: Function) {
|
||||
if (array && array.length > 0) {
|
||||
for (const item of array) {
|
||||
if (!(item instanceof type)) {
|
||||
legacyCC.logID(1300);
|
||||
logID(1300);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { warnID } from '../platform/debug';
|
||||
import { warnID, error, errorID } from '../platform/debug';
|
||||
|
||||
import IDGenerator from './id-generator';
|
||||
import { EDITOR, DEV, TEST } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
const tempCIDGenerator = new IDGenerator('TmpCId.');
|
||||
|
||||
/**
|
||||
@@ -308,7 +307,7 @@ export function addon (object?: any, ...sources: any[]) {
|
||||
for (const source of sources) {
|
||||
if (source) {
|
||||
if (typeof source !== 'object') {
|
||||
legacyCC.errorID(5402, source);
|
||||
errorID(5402, source);
|
||||
continue;
|
||||
}
|
||||
for (const name in source) {
|
||||
@@ -330,7 +329,7 @@ export function mixin (object?: any, ...sources: any[]) {
|
||||
for (const source of sources) {
|
||||
if (source) {
|
||||
if (typeof source !== 'object') {
|
||||
legacyCC.errorID(5403, source);
|
||||
errorID(5403, source);
|
||||
continue;
|
||||
}
|
||||
for (const name in source) {
|
||||
@@ -351,15 +350,15 @@ export function mixin (object?: any, ...sources: any[]) {
|
||||
export function extend (cls: Function, base: Function) {
|
||||
if (DEV) {
|
||||
if (!base) {
|
||||
legacyCC.errorID(5404);
|
||||
errorID(5404);
|
||||
return;
|
||||
}
|
||||
if (!cls) {
|
||||
legacyCC.errorID(5405);
|
||||
errorID(5405);
|
||||
return;
|
||||
}
|
||||
if (Object.keys(cls.prototype).length > 0) {
|
||||
legacyCC.errorID(5406);
|
||||
errorID(5406);
|
||||
}
|
||||
}
|
||||
for (const p in base) { if (base.hasOwnProperty(p)) { cls[p] = base[p]; } }
|
||||
@@ -449,13 +448,13 @@ export function _setClassId (id, constructor) {
|
||||
if (id) {
|
||||
const registered = table[id];
|
||||
if (registered && registered !== constructor) {
|
||||
let error = 'A Class already exists with the same ' + key + ' : "' + id + '".';
|
||||
let err = 'A Class already exists with the same ' + key + ' : "' + id + '".';
|
||||
if (TEST) {
|
||||
error += ' (This may be caused by error of unit test.) \
|
||||
err += ' (This may be caused by error of unit test.) \
|
||||
If you dont need serialization, you can set class id to "". You can also call \
|
||||
cc.js.unregisterClass to remove the id of unused class';
|
||||
}
|
||||
legacyCC.error(error);
|
||||
error(err);
|
||||
}
|
||||
else {
|
||||
table[id] = constructor;
|
||||
@@ -478,13 +477,13 @@ function doSetClassName (id, constructor) {
|
||||
if (id) {
|
||||
const registered = table[id];
|
||||
if (registered && registered !== constructor) {
|
||||
let error = 'A Class already exists with the same ' + key + ' : "' + id + '".';
|
||||
let err = 'A Class already exists with the same ' + key + ' : "' + id + '".';
|
||||
if (TEST) {
|
||||
error += ' (This may be caused by error of unit test.) \
|
||||
err += ' (This may be caused by error of unit test.) \
|
||||
If you dont need serialization, you can set class id to "". You can also call \
|
||||
cc.js.unregisterClass to remove the id of unused class';
|
||||
}
|
||||
legacyCC.error(error);
|
||||
error(err);
|
||||
}
|
||||
else {
|
||||
table[id] = constructor;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
import { getClassName, getset } from './js';
|
||||
import { EDITOR, DEV } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { warnID } from '../platform/debug';
|
||||
|
||||
export const BUILTIN_CLASSID_RE = /^(?:cc|dragonBones|sp|ccsg)\..+/;
|
||||
|
||||
@@ -65,7 +66,7 @@ export function propertyDefine (ctor, sameNameGetSets, diffNameGetSets) {
|
||||
const clsName = (legacyCC.Class._isCCClass(ctor) && getClassName(ctor)) ||
|
||||
ctor.name ||
|
||||
'(anonymous class)';
|
||||
legacyCC.warnID(5700, propName, getter, clsName);
|
||||
warnID(5700, propName, getter, clsName);
|
||||
}
|
||||
else {
|
||||
getset(np, propName, getterFunc, np[setter]);
|
||||
|
||||
@@ -28,6 +28,7 @@ import { ccclass, property } from '../data/class-decorator';
|
||||
import { Quat } from '../math';
|
||||
import { EDITOR, SUPPORT_JIT } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { errorID } from '../platform/debug';
|
||||
|
||||
@ccclass('cc.PrefabInfo')
|
||||
export class PrefabInfo {
|
||||
@@ -88,7 +89,7 @@ export default function syncWithPrefab (node) {
|
||||
// node.name += PrefabUtils.MISSING_PREFAB_SUFFIX;
|
||||
}
|
||||
else {
|
||||
legacyCC.errorID(3701, node.name);
|
||||
errorID(3701, node.name);
|
||||
}
|
||||
node._prefab = null;
|
||||
return;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
import { value } from '../utils/js';
|
||||
import { EDITOR, TEST } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { errorID } from '../platform/debug';
|
||||
|
||||
export function BitMask<T> (obj: T): T {
|
||||
if ('__bitmask__' in obj) {
|
||||
@@ -58,7 +59,7 @@ export function BitMask<T> (obj: T): T {
|
||||
const reverseKey: string = '' + val;
|
||||
if (key !== reverseKey) {
|
||||
if ((EDITOR || TEST) && reverseKey in obj && obj[reverseKey] !== key) {
|
||||
legacyCC.errorID(7100, reverseKey);
|
||||
errorID(7100, reverseKey);
|
||||
continue;
|
||||
}
|
||||
value(obj, reverseKey, key);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
import { value } from '../utils/js';
|
||||
import { EDITOR, TEST, DEV } from 'internal:constants';
|
||||
import { legacyCC } from '../global-exports';
|
||||
import { errorID } from '../platform/debug';
|
||||
|
||||
/**
|
||||
* @en
|
||||
@@ -73,7 +74,7 @@ export function Enum<T> (obj: T): T {
|
||||
const reverseKey: string = '' + val;
|
||||
if (key !== reverseKey) {
|
||||
if ((EDITOR || TEST) && reverseKey in obj && obj[reverseKey] !== key) {
|
||||
legacyCC.errorID(7100, reverseKey);
|
||||
errorID(7100, reverseKey);
|
||||
continue;
|
||||
}
|
||||
value(obj, reverseKey, key);
|
||||
@@ -116,7 +117,7 @@ if (DEV) {
|
||||
THREE: -1,
|
||||
});
|
||||
if (_TestEnum.ZERO !== 0 || _TestEnum.ONE !== 1 || _TestEnum.THREE !== 3) {
|
||||
legacyCC.errorID(7101);
|
||||
errorID(7101);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
import * as js from '../../core/utils/js';
|
||||
import { errorID } from '../../core/platform/debug';
|
||||
import { errorID, logID, assertID } from '../../core/platform/debug';
|
||||
import { Action } from './action';
|
||||
import { Node } from '../../core';
|
||||
import { legacyCC } from '../../core/global-exports';
|
||||
@@ -218,9 +218,9 @@ export class ActionManager {
|
||||
*/
|
||||
removeActionByTag (tag: number, target: Node) {
|
||||
if (tag === legacyCC.Action.TAG_INVALID)
|
||||
legacyCC.logID(1002);
|
||||
logID(1002);
|
||||
|
||||
legacyCC.assertID(target, 1003);
|
||||
assertID(target, 1003);
|
||||
|
||||
var element = this._hashTargets[target.uuid];
|
||||
|
||||
@@ -246,7 +246,7 @@ export class ActionManager {
|
||||
*/
|
||||
getActionByTag (tag: number, target: Node): Action | null {
|
||||
if (tag === legacyCC.Action.TAG_INVALID)
|
||||
legacyCC.logID(1004);
|
||||
logID(1004);
|
||||
|
||||
var element = this._hashTargets[target.uuid];
|
||||
if (element) {
|
||||
@@ -257,7 +257,7 @@ export class ActionManager {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
legacyCC.logID(1005, tag);
|
||||
logID(1005, tag);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
import { InstanceMaterialType, UIRenderComponent } from '../../core/components/ui-base/ui-render-component';
|
||||
import { ccclass, help, executionOrder, menu, property } from '../../core/data/class-decorator';
|
||||
import { clamp, Color, Mat4, Vec2, Vec3 } from '../../core/math';
|
||||
import { view } from '../../core/platform';
|
||||
import { view, warnID } from '../../core/platform';
|
||||
import visibleRect from '../../core/platform/visible-rect';
|
||||
import { UI } from '../../core/renderer/ui/ui';
|
||||
import { Node } from '../../core/scene-graph';
|
||||
@@ -150,7 +150,7 @@ export class MaskComponent extends UIRenderComponent {
|
||||
|
||||
set inverted (value) {
|
||||
if (legacyCC.game.renderType === Game.RENDER_TYPE_CANVAS) {
|
||||
legacyCC.warnID(4202);
|
||||
warnID(4202);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import { Component } from '../../core/components';
|
||||
import { UITransformComponent } from '../../core/components/ui-base/ui-transform-component';
|
||||
import { ccclass, help, executeInEditMode, executionOrder, menu, property, requireComponent } from '../../core/data/class-decorator';
|
||||
import { Size, Vec3 } from '../../core/math';
|
||||
import { errorID } from '../../core/platform/debug';
|
||||
import { errorID, warnID } from '../../core/platform/debug';
|
||||
import { SystemEventType } from '../../core/platform/event-manager/event-enum';
|
||||
import { View } from '../../core/platform/view';
|
||||
import visibleRect from '../../core/platform/visible-rect';
|
||||
@@ -991,7 +991,7 @@ export class WidgetComponent extends Component {
|
||||
target.on(SystemEventType.TRANSFORM_CHANGED, this._targetChangedOperation, this);
|
||||
target.on(SystemEventType.SIZE_CHANGED, this._targetChangedOperation, this);
|
||||
} else {
|
||||
legacyCC.warnID(6501, this.node.name);
|
||||
warnID(6501, this.node.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import { AlignFlags, AlignMode, computeInverseTransForTarget, getReadonlyNodeSiz
|
||||
import { UITransformComponent } from '../../core/components';
|
||||
import { EDITOR, DEV } from 'internal:constants';
|
||||
import { legacyCC } from '../../core/global-exports';
|
||||
import { warnID } from '../../core/platform/debug';
|
||||
|
||||
const _tempPos = new Vec3();
|
||||
const _defaultAnchor = new Vec2();
|
||||
@@ -417,7 +418,7 @@ export const widgetManager = legacyCC._widgetManager = {
|
||||
}
|
||||
|
||||
if (!widgetParent.getComponent(UITransformComponent)) {
|
||||
legacyCC.warnID(6501, widget.node.name);
|
||||
warnID(6501, widget.node.name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user