[FIXED] [Bug Report] Version 1.0.0-rc.1

Just to put ‘all’ the bug reports in one updated topic.

About the bugs I reported before, only the following ones are remaining in V 1.0.0-rc.1 (and except the sliced sprites one, others are not important, in my opinion):

  • there is still a sliced sprites rendering issue with Firefox, but now only with the built version (the one generated when clicking play/Refresh button from Cocos Creator works fine in Firefox)
  • Close option should only close current project and return to Dashboard, not exit Cocos Creator
  • UI Kit Preview examples (menu Developer->UI Preview->ui-kit): nothing happen when clicking on ‘Preview’ or’Source’ buttons


Daniel

A quick update:
I was wrong when I said sliced sprites problem doesn’t appear anymore in Firefox when clicking play/refresh button: I just saw it again (it happened with a different scale factor than before)

So, in short:
There is still a sliced sprites rendering issue with Firefox


Daniel

I have the following error displayed in Cocos Creator Console, from time to time:

Error: ENOENT, utils/api/editor-framework not found in /Applications/CocosCreator.app/Contents/Resources/app.asar at notFoundError (ATOM_SHELL_ASAR.js:132:11)
at Object.fs.realpath (ATOM_SHELL_ASAR.js:340:14)
at readdir (/Applications/CocosCreator.app/Contents/Resources/app.asar/node_modules/firedoc/node_modules/readdirp/readdirp.js:268:6)
at Object.Firedoc.walkOne (/Applications/CocosCreator.app/Contents/Resources/app.asar/node_modules/firedoc/lib/firedoc.js:168:5)
at ReaddirpReadable.onfinish (/Applications/CocosCreator.app/Contents/Resources/app.asar/node_modules/firedoc/lib/firedoc.js:148:21)
at emitNone (events.js:67:13)
at ReaddirpReadable.emit (events.js:166:7)
at /Applications/CocosCreator.app/Contents/Resources/app.asar/node_modules/firedoc/node_modules/readable-stream/lib/_stream_readable.js:965:16
at doNTCallback0 (node.js:443:9)
at process._tickCallback (node.js:372:13)

I don’t know what it means, and it doesn’t seem too bad as Cocos Creator still continue to work, I just wanted to let you know about it.


Daniel

A few more reports on this version:

Overall, it is triply faster than v0.7, with the support of resources and plists, the editor does not hang with a big plist anymore. It’s more responsive when saving scenes and scripts.

Got the following error when trying on simulator:

Simulator .CocosCreator/simulator/mac/Simulator.app/Contents/Resources/src/project.dev.js:16:ReferenceError: navigator is not defined

Also, since we’re using API with authentication and could not find a way to add authentication headers and payload to an XMLRequest using cc.loader so we made an extension of it, could you see if it benefits to add similar codes for others, if they would need headers and payload.


cc.loader.loadTxtWithHeaders = function (url, cb, headers) {
    if (!cc._isNodeJs) {
        var xhr = cc.loader.getXMLHttpRequest(),
            errInfo = "load " + url + " failed!";
        xhr.open("GET", url, true);
        for (var key in headers) {
            xhr.setRequestHeader(key, headers[key]);
        }
        if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
            // IE-specific logic here
            xhr.setRequestHeader("Accept-Charset", "utf-8");
            xhr.onreadystatechange = function () {
                if(xhr.readyState === 4)
                    xhr.status === 200 ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null);
            };
        } else {
            if (xhr.overrideMimeType) xhr.overrideMimeType("text\/plain; charset=utf-8");
            xhr.onload = function () {
                if(xhr.readyState === 4)
                    xhr.status === 200 ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null);
            };
            xhr.onerror = function(){
                cb({status:xhr.status, errorMessage:errInfo}, null);
            };
        }
        xhr.send(null);
    } else {
        var fs = require("fs");
        fs.readFile(url, function (err, data) {
            err ? cb(err) : cb(null, data.toString());
        });
    }
};

cc.loader.loadTxtSyncWithHeaders = function (url, headers) {
    if (!cc._isNodeJs) {
        var xhr = cc.loader.getXMLHttpRequest();
        xhr.open("GET", url, false);
        for (var key in headers) {
            xhr.setRequestHeader(key, headers[key]);
        }
        if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
            // IE-specific logic here
            xhr.setRequestHeader("Accept-Charset", "utf-8");
        } else {
            if (xhr.overrideMimeType) xhr.overrideMimeType("text\/plain; charset=utf-8");
        }
        xhr.send(null);
        if (!xhr.readyState === 4 || xhr.status !== 200) {
            return null;
        }
        return xhr.responseText;
    } else {
        var fs = require("fs");
        return fs.readFileSync(url).toString();
    }
};

cc.loader.loadJsonWithHeaders = function (url, cb, headers, isSync) {
    isSync = isSync || false;
    if (isSync) {
        var text = cc.loader.loadTxtSyncWithHeaders(url, headers).replace(/^\)]}'/, '');
        cb(null, JSON.parse(text));
    } else {

        cc.loader.loadTxtWithHeaders(url, function (err, txt) {
            if (err) {
                cb(err);
            }
            else {
                try {
                    var text = txt.replace(/^\)]}'/, '');
                    var result = JSON.parse(text);
                }
                catch (e) {
                    throw new Error("parse json [" + url + "] failed : " + e);
                    return;
                }
                cb(null, result);
            }
        }, headers);
    }
};

@cocosdan @Ikknguyen thanks for the feedbacks.

This is not likely to be fixed in v1.0. We do support desktop and mobile browsers, but mobile browsers have higher priority.

I have created a discussion issue in our private issue tracker

This will be fixed in v1.0

If you want to use any DOM API like navigator, please wrap it in if (!cc.sys.isNative), in your case, I suggest you to wrap all three functions in this check. The reason is that JSB only have a JavaScript engine (Spidermonkey), it doesn’t have any layout engine like webkit. So only pure JavaScript APIs can be used cross native & web.

To check whether an API is DOM API, you can try to search the API in MDN

Many thanks @pandamicro
I also got a lot of errors “A Class already exists with the same classname” when embedding my game into an iframe, while this does not happen in debug browser. Could you please have a look?

I don’t think this is due to the fact you’r embedding your game into an iframe: I’m not and I also have those messages, with the version built by Cocos Creator.


Daniel

It’s a confirmed bug and will be solved in the next version

@pandamicro
I think this could be an improvement for the Button Component. When I click on the button and move out for the area, then move inside the area again, it does not recognize as a click. Although this movement is recognized as a TOUCH_UP event. So this causes a bug in my case when I use TOUCH_UP event in a ButtonScaler to hide the button after clicking it: the button is then hidden, but the click call is not executed.

Button Component click not regconized when mouse is moved out and then moved in.zip (220.5 KB)

I confirm that “A Class already exists with the same classname” error message doesn’t happen anymore with version 1.0.1 !


Daniel