You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -219,7 +219,7 @@ In Cocos2d-JS v3.0 alpha, we have made a great improvement, we merged all `creat
219
219
```
220
220
var sprite = cc.Sprite.create(filename, rect);
221
221
var sprite = cc.Sprite.create(texture, rect);
222
-
var sprite = cc.Sprite.create(spriteFrameName);
222
+
var sprite = cc.Sprite.create("#" + spriteFrameName);
223
223
```
224
224
225
225
This changement affect not only cc.Sprite, but all similar classes, all classes and details about create function refactoration can be found in [this document](../../../v3.0/create-api/en.md).
@@ -229,7 +229,7 @@ As we never stop to improve our engine, in Cocos2d-JS v3.0 alpha2, we have made
229
229
```
230
230
var sprite = new cc.Sprite(filename, rect);
231
231
var sprite = new cc.Sprite(texture, rect);
232
-
var sprite = new cc.Sprite(spriteFrameName);
232
+
var sprite = new cc.Sprite("#" + spriteFrameName);
233
233
```
234
234
235
235
In the meantime, for backward compatibility, we have kept all `create` functions also, so it's totally your choice. What's more important with this improvement is that the inheritance is much easier than before. Developers can now completely ignore all `initXXX` functions, you can simply override `ctor` function and call `this._super` with correct parameters, then your object will be correctly initialized:
@@ -246,7 +246,7 @@ var Enemy = cc.Sprite.extend({
246
246
var enemy1 = new Enemy(100);
247
247
```
248
248
249
-
As you can see, there isn't a single `init` function call, very convenient to use. All cocos2d (no extension) classes have been refactored to support this style, and JSB support it too. [This document](../../../v3.0/inheritance/en) discuss the `new` constructor and the inheritance in detail.
249
+
As you can see, there isn't a single `init` function call, very convenient to use. All cocos2d and extension classes have been refactored to support this style, and JSB support it too. [This document](../../../v3.0/inheritance/en) discuss the `new` constructor and the inheritance in detail.
250
250
251
251
252
252
##8. GUI widgets
@@ -359,6 +359,8 @@ if (cc.sys.isNative) {
359
359
cc.fileUtils.fullPathForFilename(filename)
360
360
cc.fileUtils.loadFilenameLookup(filename)
361
361
cc.fileUtils.getStringFromFile(filename)
362
+
cc.fileUtils.getByteArrayFromFile(filename) // [New in beta]
363
+
cc.fileUtils.createDictionaryWithContentsOfFile(filename) // [New in beta]
cc.fileUtils.setSearchPaths(pathArray) // [New in beta]
375
+
cc.fileUtils.getSearchPaths() // [New in beta]
376
+
cc.fileUtils.setSearchResolutionsOrder(orderArray) // [New in beta]
377
+
cc.fileUtils.getSearchResolutionsOrder() // [New in beta]
371
378
```
372
379
373
-
All functions about search path configuration have been removed, because this will due to code inconsistence between Cocos2d-html5 and Cocos2d-JSB and eventually a high cost of maintainbility.
380
+
Pay attention when you use functions about search path configuration, because this will due to code inconsistence between Cocos2d-html5 and Cocos2d-JSB and eventually a high cost of maintainbility. If you really need them, we suggest you to maintain two list of resources for Web and JSB, so that you can use the same resource variable name to refer to different path.
0 commit comments