1 /****************************************************************************
  2  Copyright (c) 2014 Chukong Technologies Inc.
  3 
  4  http://www.cocos2d-x.org
  5 
  6  Permission is hereby granted, free of charge, to any person obtaining a copy
  7  of this software and associated documentation files (the "Software"), to deal
  8  in the Software without restriction, including without limitation the rights
  9  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 10  copies of the Software, and to permit persons to whom the Software is
 11  furnished to do so, subject to the following conditions:
 12 
 13  The above copyright notice and this permission notice shall be included in
 14  all copies or substantial portions of the Software.
 15 
 16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 22  THE SOFTWARE.
 23  ****************************************************************************/
 24 
 25 /**
 26  * The namespace for jsb exclusive APIs, all APIs in this namespace should never be used in Web engine.
 27  * So please check whether the running environment is native or not before any usage.
 28  * @namespace
 29  * @name jsb
 30  * @example
 31  *
 32  * if(cc.sys.isNative) {
 33  *     cc.log(cc.fileUtils.fullPathForFilename("test.js"));
 34  * }
 35  */
 36 var jsb = jsb || {};
 37 
 38 /**
 39  * ATTENTION: USE jsb.fileUtils INSTEAD OF jsb.FileUtils.<br/>
 40  * jsb.fileUtils is the native file utils' singleton object,<br/>
 41  * please refer to Cocos2d-x's API to know how to use it.<br/>
 42  * Only available in JSB
 43  * @class
 44  * @name jsb.fileUtils
 45  * @extend cc.Class
 46  */
 47 jsb.fileUtils = /** @lends jsb.fileUtils# */{
 48 
 49     /**
 50      * @function fullPathForFilename
 51      * @param {String} arg0
 52      * @return {String}
 53      */
 54     fullPathForFilename : function (str)
 55     {
 56         return ;
 57     },
 58 
 59     /**
 60      * @function getStringFromFile
 61      * @param {String} arg0
 62      * @return {String}
 63      */
 64     getStringFromFile : function (str)
 65     {
 66         return ;
 67     },
 68 
 69     /**
 70      * @function removeFile
 71      * @param {String} arg0
 72      * @return {bool}
 73      */
 74     removeFile : function (str)
 75     {
 76         return false;
 77     },
 78 
 79     /**
 80      * @function isAbsolutePath
 81      * @param {String} arg0
 82      * @return {bool}
 83      */
 84     isAbsolutePath : function (str)
 85     {
 86         return false;
 87     },
 88 
 89     /**
 90      * @function renameFile
 91      * @param {String} arg0
 92      * @param {String} arg1
 93      * @param {String} arg2
 94      * @return {bool}
 95      */
 96     renameFile : function (arg0,arg1,arg2)
 97     {
 98         return false;
 99     },
100 
101     /**
102      * @function loadFilenameLookupDictionaryFromFile
103      * @param {String} arg0
104      */
105     loadFilenameLookupDictionaryFromFile : function (str)
106     {
107     },
108 
109     /**
110      * @function isPopupNotify
111      * @return {bool}
112      */
113     isPopupNotify : function ()
114     {
115         return false;
116     },
117 
118     /**
119      * @function getValueVectorFromFile
120      * @param {String} arg0
121      * @return {Array}
122      */
123     getValueVectorFromFile : function (str)
124     {
125         return new Array();
126     },
127 
128     /**
129      * @function getSearchPaths
130      * @return {Array}
131      */
132     getSearchPaths : function ()
133     {
134         return new Array();
135     },
136 
137     /**
138      * @function writeToFile
139      * @param {map_object} arg0
140      * @param {String} arg1
141      * @return {bool}
142      */
143     writeToFile : function (map, str)
144     {
145         return false;
146     },
147 
148     /**
149      * @function getValueMapFromFile
150      * @param {String} arg0
151      * @return {map_object}
152      */
153     getValueMapFromFile : function (str)
154     {
155         return map_object;
156     },
157 
158     /**
159      * @function getFileSize
160      * @param {String} arg0
161      * @return {long}
162      */
163     getFileSize : function (str)
164     {
165         return 0;
166     },
167 
168     /**
169      * @function removeDirectory
170      * @param {String} arg0
171      * @return {bool}
172      */
173     removeDirectory : function (str)
174     {
175         return false;
176     },
177 
178     /**
179      * @function setSearchPaths
180      * @param {Array} arg0
181      */
182     setSearchPaths : function (array)
183     {
184     },
185 
186     /**
187      * @function writeStringToFile
188      * @param {String} arg0
189      * @param {String} arg1
190      * @return {bool}
191      */
192     writeStringToFile : function (arg0,arg1)
193     {
194         return false;
195     },
196 
197     /**
198      * @function setSearchResolutionsOrder
199      * @param {Array} arg0
200      */
201     setSearchResolutionsOrder : function (array)
202     {
203     },
204 
205     /**
206      * @function addSearchResolutionsOrder
207      * @param {String} arg0
208      */
209     addSearchResolutionsOrder : function (str)
210     {
211     },
212 
213     /**
214      * @function addSearchPath
215      * @param {String} arg0
216      */
217     addSearchPath : function (str)
218     {
219     },
220 
221     /**
222      * @function isFileExist
223      * @param {String} arg0
224      * @return {bool}
225      */
226     isFileExist : function (str)
227     {
228         return false;
229     },
230 
231     /**
232      * @function purgeCachedEntries
233      */
234     purgeCachedEntries : function ()
235     {
236     },
237 
238     /**
239      * @function fullPathFromRelativeFile
240      * @param {String} arg0
241      * @param {String} arg1
242      * @return {String}
243      */
244     fullPathFromRelativeFile : function (arg0,arg1)
245     {
246         return ;
247     },
248 
249     /**
250      * @function isDirectoryExist
251      * @param {String} arg0
252      * @return {bool}
253      */
254     isDirectoryExist : function (str)
255     {
256         return false;
257     },
258 
259     /**
260      * @function getSearchResolutionsOrder
261      * @return {Array}
262      */
263     getSearchResolutionsOrder : function ()
264     {
265         return new Array();
266     },
267 
268     /**
269      * @function createDirectory
270      * @param {String} arg0
271      * @return {bool}
272      */
273     createDirectory : function (str)
274     {
275         return false;
276     },
277 
278     /**
279      * @function createDirectories
280      * @param {String} arg0
281      * @return {bool}
282      */
283     createDirectories : function (str)
284     {
285         return false;
286     },
287 
288     /**
289      * @function getWritablePath
290      * @return {String}
291      */
292     getWritablePath : function ()
293     {
294         return ;
295     }
296 
297 };
298 
299 /**
300  * @class
301  */
302 jsb.EventAssetsManager = cc.Class.extend(/** @lends jsb.EventAssetsManager# */{
303 
304     /**
305      * @function getAssetsManager
306      * @return {cc.AssetsManager}
307      */
308     getAssetsManager : function (
309         )
310     {
311         return cc.AssetsManager;
312     },
313 
314     /**
315      * @function getAssetId
316      * @return {String}
317      */
318     getAssetId : function (
319         )
320     {
321         return ;
322     },
323 
324     /**
325      * @function getCURLECode
326      * @return {int}
327      */
328     getCURLECode : function (
329         )
330     {
331         return 0;
332     },
333 
334     /**
335      * @function getMessage
336      * @return {String}
337      */
338     getMessage : function (
339         )
340     {
341         return ;
342     },
343 
344     /**
345      * @function getCURLMCode
346      * @return {int}
347      */
348     getCURLMCode : function (
349         )
350     {
351         return 0;
352     },
353 
354     /**
355      * @function getPercentByFile
356      * @return {float}
357      */
358     getPercentByFile : function (
359         )
360     {
361         return 0;
362     },
363 
364     /**
365      * @function getEventCode
366      * @return {number} cc.EventAssetsManager.EventCode
367      */
368     getEventCode : function (
369         )
370     {
371         return 0;
372     },
373 
374     /**
375      * @function getPercent
376      * @return {float}
377      */
378     getPercent : function (
379         )
380     {
381         return 0;
382     },
383 
384     /**
385      * @function EventAssetsManager
386      * @constructor
387      * @param {String} arg0
388      * @param {cc.AssetsManager} arg1
389      * @param {number} arg2 cc.EventAssetsManager::EventCode
390      * @param {float} arg3
391      * @param {float} arg4
392      * @param {String} arg5
393      * @param {String} arg6
394      * @param {int} arg7
395      * @param {int} arg8
396      */
397     EventAssetsManager : function (
398         arg0,
399         assetsmanager,
400         eventcode,
401         arg3,
402         arg4,
403         arg5,
404         arg6,
405         arg7,
406         arg8
407         )
408     {
409     }
410 });
411 
412 
413 /**
414  * @class
415  */
416 jsb.EventListenerAssetsManager = cc.Class.extend(/** @lends jsb.EventListenerAssetsManager# */{
417 
418     /**
419      * @function init
420      * @param {cc.AssetsManager} arg0
421      * @param {function} arg1
422      * @return {bool}
423      */
424     init : function (
425         assetsmanager,
426         func
427         )
428     {
429         return false;
430     },
431 
432     /**
433      * @function create
434      * @param {cc.AssetsManager} arg0
435      * @param {function} arg1
436      * @return {cc.EventListenerAssetsManager}
437      */
438     create : function (
439         assetsmanager,
440         func
441         )
442     {
443         return cc.EventListenerAssetsManager;
444     },
445 
446     /**
447      * @function EventListenerAssetsManager
448      * @constructor
449      */
450     EventListenerAssetsManager : function (
451         )
452     {
453     }
454 
455 });
456 
457 /**
458  * @class
459  * jsb.AssetsManager is the native AssetsManager for your game resources or scripts.
460  * please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/assets-manager/en
461  * Only available in JSB
462  */
463 jsb.AssetsManager = cc.Class.extend(/** @lends jsb.AssetsManager# */{
464 
465     /**
466      * @function getState
467      * @return {number} jsb.AssetsManager::State
468      */
469     getState : function ()
470     {
471         return 0;
472     },
473 
474     /**
475      * @function checkUpdate
476      */
477     checkUpdate : function ()
478     {
479     },
480 
481     /**
482      * @function getStoragePath
483      * @return {String}
484      */
485     getStoragePath : function ()
486     {
487         return ;
488     },
489 
490     /**
491      * @function update
492      */
493     update : function ()
494     {
495     },
496 
497     /**
498      * @function getLocalManifest
499      * @return {object} jsb.Manifest
500      */
501     getLocalManifest : function ()
502     {
503         return cc.Manifest;
504     },
505 
506     /**
507      * @function getRemoteManifest
508      * @return {jsb.Manifest}
509      */
510     getRemoteManifest : function ()
511     {
512         return cc.Manifest;
513     },
514 
515     /**
516      * @function downloadFailedAssets
517      */
518     downloadFailedAssets : function ()
519     {
520     },
521 
522     /**
523      * @function create
524      * @param {String} arg0
525      * @param {String} arg1
526      * @return {jsb.AssetsManager}
527      */
528     create : function (arg0,arg1)
529     {
530         return cc.AssetsManager;
531     },
532 
533     /**
534      * @function AssetsManager
535      * @constructor
536      * @param {String} arg0
537      * @param {String} arg1
538      */
539     ctor : function (arg0,arg1)
540     {
541     }
542 
543 });
544 
545 /**
546  * @class
547  */
548 jsb.Manifest = cc.Class.extend(/** @lends jsb.Manifest# */{
549 
550     /**
551      * @function getManifestFileUrl
552      * @return {String}
553      */
554     getManifestFileUrl : function ()
555     {
556         return ;
557     },
558 
559     /**
560      * @function isVersionLoaded
561      * @return {bool}
562      */
563     isVersionLoaded : function ()
564     {
565         return false;
566     },
567 
568     /**
569      * @function isLoaded
570      * @return {bool}
571      */
572     isLoaded : function ()
573     {
574         return false;
575     },
576 
577     /**
578      * @function getPackageUrl
579      * @return {String}
580      */
581     getPackageUrl : function ()
582     {
583         return ;
584     },
585 
586     /**
587      * @function getVersion
588      * @return {String}
589      */
590     getVersion : function ()
591     {
592         return ;
593     },
594 
595     /**
596      * @function getVersionFileUrl
597      * @return {String}
598      */
599     getVersionFileUrl : function ()
600     {
601         return ;
602     }
603 });
604 
605 /**
606  * jsb.reflection is a bridge to let you invoke Java static functions.
607  * please refer to this document to know how to use it: http://www.cocos2d-x.org/docs/manual/framework/html5/v3/reflection/en
608  * Only available on iOS/Mac/Android platform
609  * @class
610  * @name jsb.reflection
611  */
612 jsb.reflection = /** @lends jsb.reflection# */{
613     /**
614      * @function
615      */
616     callStaticMethod : function(){
617     }
618 };
619