_global.CC_PREVIEW = CC_PREVIEW; _global.CC_TEST = CC_TEST; _global.CC_RUNTIME = CC_RUNTIME; _global.CC_JSB = CC_JSB; } else {//这里定义的宏都是 bool类型 defineMacro('CC_DEV', true); //编辑器 或 预览 // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_TEST defineMacro(...
if (CC_DEBUG) { cc.log('debug'); } else { cc.log('release'); } 在构建后会只剩下 cc.log('release'); (好棒棒) 如需判断脚本是否运行于指定平台,可以用如下表达式: { "编辑器": CC_EDITOR, "编辑器 或 预览": CC_DEV, "编辑器 或 预览 或 构建调试": CC_DEBUG, "网页预览": CC_...
14type: cc.AudioClip15}16},1718onLoad() {19//enabled: Boolean, 是否每帧执行该组件的 update 方法20this.enabled =false;21//算上一半身体以完全不穿帮22this.borderLeft = (-this.node.parent.width
模块'cc' 提供了所有引擎功能的访问。模块 'cc' 的内容是动态的,其内容和 项目设置 中的功能裁剪 设置有关。 引擎日志输出 示例: ts import { log } from 'cc'; log('Hello world!'); 构建时常量 引擎模块 'cc/env' 暴露了一些构建时的 常量,这些常量代表执行环境、调试级别或平台标识等。
cc.internal = cc.internal || {};//给cc下定义全局变量internal require('./predefine');//定义全局配置变量,预定义 其中CC_DEV 等宏变量都在里面 // polyfills 基于系统 类的拓展,为了处理兼容ie等浏览器 或者新增方便的用法 require('./polyfill/string');//比如string 拓展了startsWith endsWith trimLeft...
Q: How do I define constant likeCC_DEV? A: When the custom engine is complete, open theengine/gulp/util/utils.jsscript, and have a uglify function at the bottom, where you can modify the parameters as needed. For example, in the returned object, there is anglobal_defsdictionary, and ...
名称(类型都为 boolean) 说明 DEBUG 是否处于调试模式。仅当构建时未勾选调试选项的情况下为 false,其它情况下都为 true DEV 等价于 DEBUG/EDITOR/PREVIEW 调试级别使用如: import { log } from 'cc'; import { DEV } from 'cc/env'; if (DEV) { log('I am in development mode!'); }文章...
cc.Class({ extends: cc.Slider, properties: { barSprite: {default:null, type: cc.Sprite, notify:function() {if(CC_EDITOR &&this.barSprite) {this._updateBarSprite(); } } }, enableAutoGrayEffect: {default:false, tooltip: CC_DEV&& 'i18n:COMPONENT.button.auto_gray_effect', ...
cc.RichText缺字的问题,尝试了提供单独的Demo,难以重现。应该是从池中取出的节点的某个属性为脏属性...
引擎模块'cc/env'暴露了一些构建时的常量,这些常量代表执行环境、调试级别或平台标识。 (1)、执行环境: (2)、调试级别: 调试级别使用如: import { log } from 'cc'; import { DEV } from 'cc/env'; if (DEV) { log('I am in development mode!'); ...