Skip to content

Commit 069a694

Browse files
author
SeanLin
committed
Merge pull request #571 from linshun/iss103_fixeddebugsetting
Iss103 fixeddebugsetting
2 parents b21a4c5 + b9cda7e commit 069a694

File tree

5 files changed

+45
-32
lines changed

5 files changed

+45
-32
lines changed

Demo/HelloDomMenu/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var cocos2dApp = cc.Application.extend({
3030
this._super();
3131
this.startScene = scene;
3232
cc.COCOS2D_DEBUG = this.config['COCOS2D_DEBUG'];
33+
cc.initDebugSetting();
3334
cc.setup(this.config['tag']);
3435
cc.AudioEngine.getInstance().init("mp3,ogg");
3536
cc.Loader.getInstance().onloading = function () {

Demo/NativeClientDemo/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var cocos2dApp = cc.Application.extend({
3030
this._super();
3131
this.startScene = scene;
3232
cc.COCOS2D_DEBUG = this.config['COCOS2D_DEBUG'];
33+
cc.initDebugSetting();
3334
cc.setup(this.config['tag']);
3435
cc.AudioEngine.getInstance().init("mp3,ogg");
3536
cc.Loader.getInstance().onloading = function () {

HelloHTML5World/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var cocos2dApp = cc.Application.extend({
3030
this._super();
3131
this.startScene = scene;
3232
cc.COCOS2D_DEBUG = this.config['COCOS2D_DEBUG'];
33+
cc.initDebugSetting();
3334
cc.setup(this.config['tag']);
3435
cc.AudioEngine.getInstance().init("mp3,ogg");
3536
cc.Loader.getInstance().onloading = function () {

cocos2d/platform/CCCommon.js

+41-32
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ cc.clone = function (obj) {
5252
* @param {object} jsobj subclass
5353
* @param {object} klass superclass
5454
*/
55-
cc.associateWithNative = function( jsobj, superclass ) {
55+
cc.associateWithNative = function (jsobj, superclass) {
5656
};
5757

5858
/**
@@ -135,40 +135,49 @@ cc.MessageBox = function (message) {
135135
console.log(message);
136136
};
137137

138-
// cocos2d debug
139-
if (cc.COCOS2D_DEBUG == 0) {
140-
cc.log = function () {
141-
};
142-
cc.logINFO = function () {
143-
};
144-
cc.logERROR = function () {
145-
};
146-
}
147-
else if (cc.COCOS2D_DEBUG == 1) {
148-
cc.logINFO = cc.log;
149-
cc.logERROR = function () {
150-
};
151-
}
152-
else if (cc.COCOS2D_DEBUG > 1) {
153-
cc.logINFO = cc.log;
154-
cc.logERROR = cc.log;
155-
}// COCOS2D_DEBUG
156-
157-
if (cc.COCOS2D_DEBUG) {
158-
cc.Assert = function (cond, message) {
159-
if ((typeof console.assert) == "function") {
160-
console.assert(cond, message);
161-
} else {
162-
if (!cond) {
163-
if (message) {
164-
alert(message);
165-
}
138+
/**
139+
* Output Assert message.
140+
* @function
141+
* @param {Boolean} cond If cond is false, assert.
142+
* @param {String} message
143+
*/
144+
cc.Assert = function (cond, message) {
145+
if ((typeof console.assert) == "function") {
146+
console.assert(cond, message);
147+
} else {
148+
if (!cond) {
149+
if (message) {
150+
alert(message);
166151
}
167152
}
168153
}
169-
} else {
170-
cc.Assert = function () {
171-
};
154+
}
155+
156+
/**
157+
* Update Debug setting.
158+
* @function
159+
*/
160+
cc.initDebugSetting = function () {
161+
// cocos2d debug
162+
if (cc.COCOS2D_DEBUG == 0) {
163+
cc.log = function () {
164+
};
165+
cc.logINFO = function () {
166+
};
167+
cc.logERROR = function () {
168+
};
169+
cc.Assert = function () {
170+
};
171+
}
172+
else if (cc.COCOS2D_DEBUG == 1) {
173+
cc.logINFO = cc.log;
174+
cc.logERROR = function () {
175+
};
176+
}
177+
else if (cc.COCOS2D_DEBUG > 1) {
178+
cc.logINFO = cc.log;
179+
cc.logERROR = cc.log;
180+
}// COCOS2D_DEBUG
172181
}
173182

174183
// Enum the language type supportted now

template/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var cocos2dApp = cc.Application.extend({
3030
this._super();
3131
this.startScene = scene;
3232
cc.COCOS2D_DEBUG = this.config['COCOS2D_DEBUG'];
33+
cc.initDebugSetting();
3334
cc.setup(this.config['tag']);
3435
cc.AudioEngine.getInstance().init("mp3,ogg");
3536
cc.Loader.getInstance().onloading = function () {

0 commit comments

Comments
 (0)