ccb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (335) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +31 -0
  4. data/bin/ccb +4 -0
  5. data/lib/ccb/builder/project_builder.rb +14 -0
  6. data/lib/ccb/builder/scene_builder.rb +9 -0
  7. data/lib/ccb/builder/templates/project/GameConfig.js.tt +21 -0
  8. data/lib/ccb/builder/templates/project/_cocos-project.json +4 -0
  9. data/lib/ccb/builder/templates/project/folder/CMakeLists.txt +295 -0
  10. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/Base64Images.js +32 -0
  11. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/CCBoot.js +2271 -0
  12. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/CCDebugger.js +336 -0
  13. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCAction.js +694 -0
  14. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionCamera.js +293 -0
  15. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionCatmullRom.js +605 -0
  16. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionEase.js +3681 -0
  17. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionInstant.js +757 -0
  18. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionInterval.js +3554 -0
  19. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionTween.js +166 -0
  20. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionGrid.js +372 -0
  21. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionGrid3D.js +1257 -0
  22. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionPageTurn3D.js +113 -0
  23. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionTiledGrid.js +1289 -0
  24. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/audio/CCAudio.js +1024 -0
  25. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNode.js +224 -0
  26. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNodeCanvasRenderCmd.js +227 -0
  27. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js +226 -0
  28. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/ZipUtils.js +82 -0
  29. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/base64.js +95 -0
  30. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/gzip.js +731 -0
  31. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/zlib.min.js +55 -0
  32. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCActionManager.js +378 -0
  33. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCCamera.js +290 -0
  34. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCConfiguration.js +294 -0
  35. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDirector.js +1019 -0
  36. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDirectorWebGL.js +329 -0
  37. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDrawingPrimitivesCanvas.js +438 -0
  38. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDrawingPrimitivesWebGL.js +464 -0
  39. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCScheduler.js +744 -0
  40. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/BaseNodesPropertyDefine.js +127 -0
  41. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNode.js +294 -0
  42. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNodeCanvasRenderCmd.js +138 -0
  43. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNodeWebGLRenderCmd.js +145 -0
  44. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNode.js +2386 -0
  45. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNodeCanvasRenderCmd.js +504 -0
  46. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNodeWebGLRenderCmd.js +254 -0
  47. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/cocoa/CCAffineTransform.js +259 -0
  48. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/cocoa/CCGeometry.js +327 -0
  49. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEvent.js +449 -0
  50. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventExtension.js +126 -0
  51. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventListener.js +519 -0
  52. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventManager.js +1025 -0
  53. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCTouch.js +175 -0
  54. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTF.js +829 -0
  55. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js +420 -0
  56. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js +101 -0
  57. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/LabelTTFPropertyDefine.js +88 -0
  58. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayer.js +642 -0
  59. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayerCanvasRenderCmd.js +434 -0
  60. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayerWebGLRenderCmd.js +248 -0
  61. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCClass.js +333 -0
  62. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCCommon.js +303 -0
  63. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCConfig.js +303 -0
  64. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCEGLView.js +1245 -0
  65. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCInputExtension.js +135 -0
  66. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCInputManager.js +616 -0
  67. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCLoaders.js +142 -0
  68. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCMacro.js +830 -0
  69. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCSAXParser.js +160 -0
  70. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCScreen.js +155 -0
  71. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypes.js +374 -0
  72. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypesPropertyDefine.js +165 -0
  73. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypesWebGL.js +689 -0
  74. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCVisibleRect.js +100 -0
  75. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/miniFramework.js +264 -0
  76. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/renderer/RendererCanvas.js +274 -0
  77. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/renderer/RendererWebGL.js +137 -0
  78. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/scenes/CCLoaderScene.js +149 -0
  79. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/scenes/CCScene.js +62 -0
  80. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCAnimation.js +477 -0
  81. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCAnimationCache.js +213 -0
  82. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCBakeSprite.js +71 -0
  83. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSprite.js +1014 -0
  84. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNode.js +676 -0
  85. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js +101 -0
  86. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js +243 -0
  87. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js +518 -0
  88. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteFrame.js +420 -0
  89. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteFrameCache.js +341 -0
  90. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js +493 -0
  91. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/SpritesPropertyDefine.js +67 -0
  92. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/CCPointExtension.js +515 -0
  93. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/CCVertex.js +170 -0
  94. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/TransformUtils.js +62 -0
  95. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTexture2D.js +455 -0
  96. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTextureAtlas.js +653 -0
  97. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTextureCache.js +371 -0
  98. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/TexturesPropertyDefine.js +221 -0
  99. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/TexturesWebGL.js +899 -0
  100. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/utils/BinaryLoader.js +151 -0
  101. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/effects/CCGrabber.js +110 -0
  102. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/effects/CCGrid.js +737 -0
  103. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/aabb.js +68 -0
  104. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/gl/mat4stack.js +59 -0
  105. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/gl/matrix.js +169 -0
  106. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/mat3.js +329 -0
  107. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/mat4.js +810 -0
  108. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/plane.js +184 -0
  109. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/quaternion.js +497 -0
  110. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/ray2.js +163 -0
  111. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/utility.js +76 -0
  112. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec2.js +107 -0
  113. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec3.js +205 -0
  114. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec4.js +158 -0
  115. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlas.js +239 -0
  116. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js +95 -0
  117. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlasWebGLRenderCmd.js +132 -0
  118. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFont.js +958 -0
  119. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFontCanvasRenderCmd.js +142 -0
  120. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFontWebGLRenderCmd.js +87 -0
  121. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/menus/CCMenu.js +600 -0
  122. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/menus/CCMenuItem.js +1422 -0
  123. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/motion-streak/CCMotionStreak.js +517 -0
  124. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/motion-streak/CCMotionStreakWebGLRenderCmd.js +66 -0
  125. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/node-grid/CCNodeGrid.js +129 -0
  126. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/node-grid/CCNodeGridWebGLRenderCmd.js +98 -0
  127. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/parallax/CCParallaxNode.js +252 -0
  128. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/parallax/CCParallaxNodeRenderCmd.js +69 -0
  129. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCPNGReader.js +330 -0
  130. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNode.js +527 -0
  131. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNodeCanvasRenderCmd.js +38 -0
  132. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNodeWebGLRenderCmd.js +74 -0
  133. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleExamples.js +1006 -0
  134. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystem.js +2294 -0
  135. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystemCanvasRenderCmd.js +217 -0
  136. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystemWebGLRenderCmd.js +402 -0
  137. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCTIFFReader.js +692 -0
  138. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNode.js +212 -0
  139. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNodeCanvasRenderCmd.js +52 -0
  140. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNodeWebGLRenderCmd.js +53 -0
  141. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSprite.js +447 -0
  142. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSpriteCanvasRenderCmd.js +93 -0
  143. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSpriteWebGLRenderCmd.js +87 -0
  144. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCActionProgressTimer.js +227 -0
  145. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimer.js +345 -0
  146. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimerCanvasRenderCmd.js +270 -0
  147. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimerWebGLRenderCmd.js +486 -0
  148. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTexture.js +395 -0
  149. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTextureCanvasRenderCmd.js +105 -0
  150. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js +367 -0
  151. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCGLProgram.js +767 -0
  152. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCGLStateCache.js +340 -0
  153. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCShaderCache.js +301 -0
  154. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCShaders.js +280 -0
  155. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNode.js +940 -0
  156. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNodeCanvasRenderCmd.js +129 -0
  157. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNodeWebGLRenderCmd.js +41 -0
  158. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/text-input/CCIMEDispatcher.js +526 -0
  159. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/text-input/CCTextFieldTTF.js +472 -0
  160. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTGAlib.js +437 -0
  161. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayer.js +914 -0
  162. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayerCanvasRenderCmd.js +232 -0
  163. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayerWebGLRenderCmd.js +67 -0
  164. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXObjectGroup.js +146 -0
  165. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXTiledMap.js +479 -0
  166. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXXMLParser.js +950 -0
  167. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransition.js +1971 -0
  168. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransitionPageTurn.js +152 -0
  169. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransitionProgress.js +458 -0
  170. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBAnimationManager.js +770 -0
  171. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBKeyframe.js +60 -0
  172. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBReader.js +1129 -0
  173. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBReaderUtil.js +61 -0
  174. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBRelativePositioning.js +90 -0
  175. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBSequence.js +114 -0
  176. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBValue.js +81 -0
  177. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCControlLoader.js +318 -0
  178. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCNodeLoader.js +905 -0
  179. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCNodeLoaderLibrary.js +101 -0
  180. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCSpriteLoader.js +544 -0
  181. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccpool/CCPool.js +146 -0
  182. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNode.js +305 -0
  183. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNodeCanvasRenderCmd.js +246 -0
  184. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNodeWebGLRenderCmd.js +159 -0
  185. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9Sprite.js +1105 -0
  186. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9SpriteCanvasRenderCmd.js +142 -0
  187. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9SpriteWebGLRenderCmd.js +129 -0
  188. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIWidget.js +2059 -0
  189. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIWidgetRenderCmd.js +100 -0
  190. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIHBox.js +80 -0
  191. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayout.js +1558 -0
  192. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutCanvasRenderCmd.js +179 -0
  193. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutComponent.js +585 -0
  194. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutManager.js +457 -0
  195. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutParameter.js +576 -0
  196. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutWebGLRenderCmd.js +240 -0
  197. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIRelativeBox.js +79 -0
  198. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIVBox.js +79 -0
  199. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/system/CocosGUI.js +62 -0
  200. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/system/UIHelper.js +164 -0
  201. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIButton.js +987 -0
  202. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UICheckBox.js +737 -0
  203. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIImageView.js +337 -0
  204. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UILoadingBar.js +432 -0
  205. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIRichText.js +579 -0
  206. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UISlider.js +762 -0
  207. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIText.js +512 -0
  208. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextAtlas.js +229 -0
  209. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextBMFont.js +216 -0
  210. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextField.js +915 -0
  211. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIListView.js +602 -0
  212. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIPageView.js +657 -0
  213. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIScrollView.js +1884 -0
  214. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/CocoStudio.js +68 -0
  215. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionFrame.js +528 -0
  216. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionManager.js +112 -0
  217. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionNode.js +417 -0
  218. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionObject.js +263 -0
  219. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmature.js +579 -0
  220. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js +190 -0
  221. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmatureWebGLRenderCmd.js +167 -0
  222. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCBone.js +711 -0
  223. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCArmatureAnimation.js +669 -0
  224. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCProcessBase.js +365 -0
  225. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCTween.js +448 -0
  226. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/datas/CCDatas.js +807 -0
  227. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDecorativeDisplay.js +118 -0
  228. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDisplayFactory.js +220 -0
  229. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDisplayManager.js +465 -0
  230. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkin.js +215 -0
  231. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkinCanvasRenderCmd.js +58 -0
  232. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkinWebGLRenderCmd.js +146 -0
  233. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/physics/CCColliderDetector.js +397 -0
  234. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCArmatureDataManager.js +325 -0
  235. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCArmatureDefine.js +45 -0
  236. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCDataReaderHelper.js +1223 -0
  237. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCSpriteFrameCacheHelper.js +68 -0
  238. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCTransformHelp.js +183 -0
  239. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCTweenFunction.js +501 -0
  240. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCUtilMath.js +69 -0
  241. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComAttribute.js +210 -0
  242. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComAudio.js +285 -0
  243. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComController.js +76 -0
  244. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComRender.js +91 -0
  245. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComponent.js +136 -0
  246. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComponentContainer.js +159 -0
  247. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/load.js +221 -0
  248. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/action-1.x.js +238 -0
  249. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/action-2.x.js +266 -0
  250. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/compatible.js +251 -0
  251. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/scene-1.x.js +262 -0
  252. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/timelineParser-1.x.js +292 -0
  253. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/timelineParser-2.x.js +1288 -0
  254. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/uiParser-1.x.js +680 -0
  255. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/ActionTimeline.js +448 -0
  256. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/Frame.js +1268 -0
  257. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/Timeline.js +321 -0
  258. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/ObjectFactory.js +99 -0
  259. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerBase.js +49 -0
  260. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerMng.js +301 -0
  261. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerObj.js +263 -0
  262. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/editbox/CCEditBox.js +716 -0
  263. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/editbox/CCdomNode.js +657 -0
  264. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControl.js +381 -0
  265. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlButton.js +688 -0
  266. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlColourPicker.js +187 -0
  267. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlHuePicker.js +218 -0
  268. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlPotentiometer.js +300 -0
  269. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSaturationBrightnessPicker.js +257 -0
  270. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSlider.js +308 -0
  271. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlStepper.js +390 -0
  272. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSwitch.js +425 -0
  273. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlUtils.js +177 -0
  274. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCInvocation.js +65 -0
  275. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCMenuPassive.js +415 -0
  276. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9Sprite.js +1099 -0
  277. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9SpriteCanvasRenderCmd.js +142 -0
  278. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9SpriteWebGLRenderCmd.js +129 -0
  279. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollView.js +827 -0
  280. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollViewCanvasRenderCmd.js +79 -0
  281. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollViewWebGLRenderCmd.js +108 -0
  282. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCSorting.js +239 -0
  283. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCTableView.js +718 -0
  284. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeleton.js +357 -0
  285. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonAnimation.js +340 -0
  286. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonCanvasRenderCmd.js +165 -0
  287. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonWebGLRenderCmd.js +165 -0
  288. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/Spine.js +2239 -0
  289. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/box2d/box2d.js +10882 -0
  290. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/chipmunk/chipmunk.js +6196 -0
  291. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/Plugin.js +254 -0
  292. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/platform/facebook.js +557 -0
  293. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/platform/facebook_sdk.js +151 -0
  294. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/socketio/socket.io.min.js +2 -0
  295. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/jsb_apis.js +618 -0
  296. data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/moduleConfig.json +453 -0
  297. data/lib/ccb/builder/templates/project/folder/project.json +42 -0
  298. data/lib/ccb/builder/templates/project/folder/res/CloseNormal.png +0 -0
  299. data/lib/ccb/builder/templates/project/folder/res/CloseSelected.png +0 -0
  300. data/lib/ccb/builder/templates/project/folder/res/HelloWorld.png +0 -0
  301. data/lib/ccb/builder/templates/project/folder/res/favicon.ico +0 -0
  302. data/lib/ccb/builder/templates/project/folder/res/gameOver/cocos2d-html5.png +0 -0
  303. data/lib/ccb/builder/templates/project/folder/res/gameOver/gameOver.png +0 -0
  304. data/lib/ccb/builder/templates/project/folder/res/mainMenu/bg.png +0 -0
  305. data/lib/ccb/builder/templates/project/folder/res/mainMenu/menu.png +0 -0
  306. data/lib/ccb/builder/templates/project/folder/res/setting/menuTitle.png +0 -0
  307. data/lib/ccb/builder/templates/project/folder/res/shared/arial-14.fnt +182 -0
  308. data/lib/ccb/builder/templates/project/folder/res/shared/arial-14.png +0 -0
  309. data/lib/ccb/builder/templates/project/folder/res/sound/music/bgMusic.mp3 +0 -0
  310. data/lib/ccb/builder/templates/project/folder/src/about/layer/ABBackgroundLayer.js +23 -0
  311. data/lib/ccb/builder/templates/project/folder/src/about/layer/ABTouchLayer.js +51 -0
  312. data/lib/ccb/builder/templates/project/folder/src/about/scene/About.js +36 -0
  313. data/lib/ccb/builder/templates/project/folder/src/config/Level.js +7 -0
  314. data/lib/ccb/builder/templates/project/folder/src/gameOver/layer/GOBackgroundLayer.js +50 -0
  315. data/lib/ccb/builder/templates/project/folder/src/gameOver/layer/GOTouchLayer.js +51 -0
  316. data/lib/ccb/builder/templates/project/folder/src/gameOver/scene/GameOver.js +38 -0
  317. data/lib/ccb/builder/templates/project/folder/src/gamePlay/classes/LevelManager.js +21 -0
  318. data/lib/ccb/builder/templates/project/folder/src/gamePlay/layer/GPBackgroundLayer.js +25 -0
  319. data/lib/ccb/builder/templates/project/folder/src/gamePlay/layer/GPTouchLayer.js +51 -0
  320. data/lib/ccb/builder/templates/project/folder/src/gamePlay/scene/GamePlay.js +44 -0
  321. data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMBackgroundLayer.js +43 -0
  322. data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMMainMenuLayer.js +38 -0
  323. data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMTouchLayer.js +96 -0
  324. data/lib/ccb/builder/templates/project/folder/src/mainMenu/scene/MainMenu.js +45 -0
  325. data/lib/ccb/builder/templates/project/folder/src/resource.js +29 -0
  326. data/lib/ccb/builder/templates/project/folder/src/setting/layer/STBackgroundLayer.js +25 -0
  327. data/lib/ccb/builder/templates/project/folder/src/setting/layer/STTouchLayer.js +89 -0
  328. data/lib/ccb/builder/templates/project/folder/src/setting/scene/Setting.js +40 -0
  329. data/lib/ccb/builder/templates/project/index.html.tt +27 -0
  330. data/lib/ccb/builder/templates/project/main.js.tt +62 -0
  331. data/lib/ccb/cli.rb +32 -0
  332. data/lib/ccb/ext/method_hooker.rb +68 -0
  333. data/lib/ccb/ext/string_extention.rb +7 -0
  334. data/lib/ccb.rb +1 -0
  335. metadata +449 -0
@@ -0,0 +1,2386 @@
1
+ /****************************************************************************
2
+ Copyright (c) 2008-2010 Ricardo Quesada
3
+ Copyright (c) 2011-2012 cocos2d-x.org
4
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
5
+
6
+ http://www.cocos2d-x.org
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ ****************************************************************************/
26
+
27
+ /**
28
+ * Default Node tag
29
+ * @constant
30
+ * @type Number
31
+ */
32
+ cc.NODE_TAG_INVALID = -1;
33
+
34
+ /**
35
+ * XXX: Yes, nodes might have a sort problem once every 15 days if the game runs at 60 FPS and each frame sprites are reordered.
36
+ */
37
+ cc.s_globalOrderOfArrival = 1;
38
+
39
+ /**
40
+ * <p>cc.Node is the root class of all node. Anything that gets drawn or contains things that get drawn is a cc.Node.<br/>
41
+ * The most popular cc.Nodes are: cc.Scene, cc.Layer, cc.Sprite, cc.Menu.</p>
42
+ *
43
+ * <p>The main features of a cc.Node are: <br/>
44
+ * - They can contain other cc.Node nodes (addChild, getChildByTag, removeChild, etc) <br/>
45
+ * - They can schedule periodic callback (schedule, unschedule, etc) <br/>
46
+ * - They can execute actions (runAction, stopAction, etc) <br/></p>
47
+ *
48
+ * <p>Some cc.Node nodes provide extra functionality for them or their children.</p>
49
+ *
50
+ * <p>Subclassing a cc.Node usually means (one/all) of: <br/>
51
+ * - overriding constructor function "ctor" to initialize resources and schedule callbacks<br/>
52
+ * - create callbacks to handle the advancement of time<br/></p>
53
+ *
54
+ * <p>Features of cc.Node: <br/>
55
+ * - position <br/>
56
+ * - scale (x, y) <br/>
57
+ * - rotation (in degrees, clockwise)<br/>
58
+ * - anchor point<br/>
59
+ * - size <br/>
60
+ * - color <br/>
61
+ * - opacity <br/>
62
+ * - visible<br/>
63
+ * - z-order<br/>
64
+ * - WebGL z position<br/></P>
65
+ *
66
+ * <p> Default values: <br/>
67
+ * - rotation: 0 <br/>
68
+ * - position: (x=0,y=0) <br/>
69
+ * - scale: (x=1,y=1) <br/>
70
+ * - contentSize: (x=0,y=0)<br/>
71
+ * - anchorPoint: (x=0,y=0)<br/>
72
+ * - color: (r=255,g=255,b=255)<br/>
73
+ * - opacity: 255</p>
74
+ *
75
+ * <p> Limitations:<br/>
76
+ * - A cc.Node is a "void" object. It doesn't have a texture <br/></P>
77
+ *
78
+ * <p>Order in transformations with grid disabled <br/>
79
+ * -# The node will be translated (position) <br/>
80
+ * -# The node will be rotated (rotation)<br/>
81
+ * -# The node will be scaled (scale) <br/>
82
+ *
83
+ * <p>Order in transformations with grid enabled<br/>
84
+ * -# The node will be translated (position)<br/>
85
+ * -# The node will be rotated (rotation) <br/>
86
+ * -# The node will be scaled (scale) <br/>
87
+ * -# The grid will capture the screen <br/>
88
+ * -# The node will be moved according to the camera values (camera) <br/>
89
+ * -# The grid will render the captured screen <br/></P>
90
+ *
91
+ * @class
92
+ * @extends cc.Class
93
+ *
94
+ * @property {Number} x - x axis position of node
95
+ * @property {Number} y - y axis position of node
96
+ * @property {Number} width - Width of node
97
+ * @property {Number} height - Height of node
98
+ * @property {Number} anchorX - Anchor point's position on x axis
99
+ * @property {Number} anchorY - Anchor point's position on y axis
100
+ * @property {Boolean} ignoreAnchor - Indicate whether ignore the anchor point property for positioning
101
+ * @property {Number} skewX - Skew x
102
+ * @property {Number} skewY - Skew y
103
+ * @property {Number} zIndex - Z order in depth which stands for the drawing order
104
+ * @property {Number} vertexZ - WebGL Z vertex of this node, z order works OK if all the nodes uses the same openGL Z vertex
105
+ * @property {Number} rotation - Rotation of node
106
+ * @property {Number} rotationX - Rotation on x axis
107
+ * @property {Number} rotationY - Rotation on y axis
108
+ * @property {Number} scale - Scale of node
109
+ * @property {Number} scaleX - Scale on x axis
110
+ * @property {Number} scaleY - Scale on y axis
111
+ * @property {Boolean} visible - Indicate whether node is visible or not
112
+ * @property {cc.Color} color - Color of node, default value is white: (255, 255, 255)
113
+ * @property {Boolean} cascadeColor - Indicate whether node's color value affect its child nodes, default value is false
114
+ * @property {Number} opacity - Opacity of node, default value is 255
115
+ * @property {Boolean} opacityModifyRGB - Indicate whether opacity affect the color value, default value is false
116
+ * @property {Boolean} cascadeOpacity - Indicate whether node's opacity value affect its child nodes, default value is false
117
+ * @property {Array} children - <@readonly> All children nodes
118
+ * @property {Number} childrenCount - <@readonly> Number of children
119
+ * @property {cc.Node} parent - Parent node
120
+ * @property {Boolean} running - <@readonly> Indicate whether node is running or not
121
+ * @property {Number} tag - Tag of node
122
+ * @property {Object} userData - Custom user data
123
+ * @property {Object} userObject - User assigned CCObject, similar to userData, but instead of holding a void* it holds an id
124
+ * @property {Number} arrivalOrder - The arrival order, indicates which children is added previously
125
+ * @property {cc.ActionManager} actionManager - The CCActionManager object that is used by all actions.
126
+ * @property {cc.Scheduler} scheduler - cc.Scheduler used to schedule all "updates" and timers.
127
+ * @property {cc.GridBase} grid - grid object that is used when applying effects
128
+ * @property {cc.GLProgram} shaderProgram - The shader program currently used for this node
129
+ * @property {Number} glServerState - The state of OpenGL server side
130
+ */
131
+ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
132
+ _localZOrder: 0, ///< Local order (relative to its siblings) used to sort the node
133
+ _globalZOrder: 0, ///< Global order used to sort the node
134
+ _vertexZ: 0.0,
135
+
136
+ _rotationX: 0,
137
+ _rotationY: 0.0,
138
+ _scaleX: 1.0,
139
+ _scaleY: 1.0,
140
+ _position: null,
141
+
142
+ _normalizedPosition:null,
143
+ _usingNormalizedPosition: false,
144
+ _normalizedPositionDirty: false,
145
+
146
+ _skewX: 0.0,
147
+ _skewY: 0.0,
148
+ // children (lazy allocs),
149
+ _children: null,
150
+ // lazy alloc,
151
+ _visible: true,
152
+ _anchorPoint: null,
153
+ _contentSize: null,
154
+ _running: false,
155
+ _parent: null,
156
+
157
+ // "whole screen" objects. like Scenes and Layers, should set _ignoreAnchorPointForPosition to true
158
+ _ignoreAnchorPointForPosition: false,
159
+ tag: cc.NODE_TAG_INVALID,
160
+ // userData is always initialized as nil
161
+ userData: null,
162
+ userObject: null,
163
+
164
+ //since 2.0 api
165
+ _reorderChildDirty: false,
166
+ _shaderProgram: null,
167
+ arrivalOrder: 0,
168
+
169
+ _actionManager: null,
170
+ _scheduler: null,
171
+ _eventDispatcher: null,
172
+
173
+ _additionalTransformDirty: false,
174
+ _additionalTransform: null,
175
+ _componentContainer: null,
176
+ _isTransitionFinished: false,
177
+
178
+ _className: "Node",
179
+ _showNode: false,
180
+ _name: "", ///<a string label, an user defined string to identify this node
181
+
182
+ _realOpacity: 255,
183
+ _realColor: null,
184
+ _cascadeColorEnabled: false,
185
+ _cascadeOpacityEnabled: false,
186
+
187
+ _renderCmd:null,
188
+
189
+ /**
190
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
191
+ * @function
192
+ */
193
+ ctor: function(){
194
+ this._initNode();
195
+ this._initRendererCmd();
196
+ },
197
+
198
+ _initNode: function () {
199
+ var _t = this;
200
+ _t._anchorPoint = cc.p(0, 0);
201
+ _t._contentSize = cc.size(0, 0);
202
+ _t._position = cc.p(0, 0);
203
+ _t._normalizedPosition = cc.p(0,0);
204
+ _t._children = [];
205
+
206
+ var director = cc.director;
207
+ _t._actionManager = director.getActionManager();
208
+ _t._scheduler = director.getScheduler();
209
+
210
+ _t._additionalTransform = cc.affineTransformMakeIdentity();
211
+ if (cc.ComponentContainer) {
212
+ _t._componentContainer = new cc.ComponentContainer(_t);
213
+ }
214
+
215
+ this._realOpacity = 255;
216
+ this._realColor = cc.color(255, 255, 255, 255);
217
+ this._cascadeColorEnabled = false;
218
+ this._cascadeOpacityEnabled = false;
219
+ },
220
+
221
+ /**
222
+ * Initializes the instance of cc.Node
223
+ * @function
224
+ * @returns {boolean} Whether the initialization was successful.
225
+ */
226
+ init: function () {
227
+ //this._initNode(); //this has been called in ctor.
228
+ return true;
229
+ },
230
+
231
+ _arrayMakeObjectsPerformSelector: function (array, callbackType) {
232
+ if (!array || array.length === 0)
233
+ return;
234
+
235
+ var i, len = array.length, node;
236
+ var nodeCallbackType = cc.Node._stateCallbackType;
237
+ switch (callbackType) {
238
+ case nodeCallbackType.onEnter:
239
+ for (i = 0; i < len; i++) {
240
+ node = array[i];
241
+ if (node)
242
+ node.onEnter();
243
+ }
244
+ break;
245
+ case nodeCallbackType.onExit:
246
+ for (i = 0; i < len; i++) {
247
+ node = array[i];
248
+ if (node)
249
+ node.onExit();
250
+ }
251
+ break;
252
+ case nodeCallbackType.onEnterTransitionDidFinish:
253
+ for (i = 0; i < len; i++) {
254
+ node = array[i];
255
+ if (node)
256
+ node.onEnterTransitionDidFinish();
257
+ }
258
+ break;
259
+ case nodeCallbackType.cleanup:
260
+ for (i = 0; i < len; i++) {
261
+ node = array[i];
262
+ if (node)
263
+ node.cleanup();
264
+ }
265
+ break;
266
+ case nodeCallbackType.updateTransform:
267
+ for (i = 0; i < len; i++) {
268
+ node = array[i];
269
+ if (node)
270
+ node.updateTransform();
271
+ }
272
+ break;
273
+ case nodeCallbackType.onExitTransitionDidStart:
274
+ for (i = 0; i < len; i++) {
275
+ node = array[i];
276
+ if (node)
277
+ node.onExitTransitionDidStart();
278
+ }
279
+ break;
280
+ case nodeCallbackType.sortAllChildren:
281
+ for (i = 0; i < len; i++) {
282
+ node = array[i];
283
+ if (node)
284
+ node.sortAllChildren();
285
+ }
286
+ break;
287
+ default :
288
+ cc.assert(0, cc._LogInfos.Node__arrayMakeObjectsPerformSelector);
289
+ break;
290
+ }
291
+ },
292
+
293
+ /**
294
+ * <p>Properties configuration function </br>
295
+ * All properties in attrs will be set to the node, </br>
296
+ * when the setter of the node is available, </br>
297
+ * the property will be set via setter function.</br>
298
+ * </p>
299
+ * @function
300
+ * @param {Object} attrs Properties to be set to node
301
+ */
302
+ attr: function (attrs) {
303
+ for (var key in attrs) {
304
+ this[key] = attrs[key];
305
+ }
306
+ },
307
+
308
+ /**
309
+ * <p>Returns the skew degrees in X </br>
310
+ * The X skew angle of the node in degrees. <br/>
311
+ * This angle describes the shear distortion in the X direction.<br/>
312
+ * Thus, it is the angle between the Y axis and the left edge of the shape </br>
313
+ * The default skewX angle is 0. Positive values distort the node in a CW direction.</br>
314
+ * </p>
315
+ * @function
316
+ * @return {Number} The X skew angle of the node in degrees.
317
+ */
318
+ getSkewX: function () {
319
+ return this._skewX;
320
+ },
321
+
322
+ /**
323
+ * <p>
324
+ * Changes the X skew angle of the node in degrees. <br/>
325
+ * <br/>
326
+ * This angle describes the shear distortion in the X direction. <br/>
327
+ * Thus, it is the angle between the Y axis and the left edge of the shape <br/>
328
+ * The default skewX angle is 0. Positive values distort the node in a CW direction.
329
+ * </p>
330
+ * @function
331
+ * @param {Number} newSkewX The X skew angle of the node in degrees.
332
+ */
333
+ setSkewX: function (newSkewX) {
334
+ this._skewX = newSkewX;
335
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
336
+ },
337
+
338
+ /**
339
+ * <p>Returns the skew degrees in Y <br/>
340
+ * The Y skew angle of the node in degrees. <br/>
341
+ * This angle describes the shear distortion in the Y direction. <br/>
342
+ * Thus, it is the angle between the X axis and the bottom edge of the shape <br/>
343
+ * The default skewY angle is 0. Positive values distort the node in a CCW direction. <br/>
344
+ * </p>
345
+ * @function
346
+ * @return {Number} The Y skew angle of the node in degrees.
347
+ */
348
+ getSkewY: function () {
349
+ return this._skewY;
350
+ },
351
+
352
+ /**
353
+ * <p>
354
+ * Changes the Y skew angle of the node in degrees. <br/>
355
+ * <br/>
356
+ * This angle describes the shear distortion in the Y direction. <br/>
357
+ * Thus, it is the angle between the X axis and the bottom edge of the shape <br/>
358
+ * The default skewY angle is 0. Positive values distort the node in a CCW direction. <br/>
359
+ * </p>
360
+ * @function
361
+ * @param {Number} newSkewY The Y skew angle of the node in degrees.
362
+ */
363
+ setSkewY: function (newSkewY) {
364
+ this._skewY = newSkewY;
365
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
366
+ },
367
+
368
+ /**
369
+ * <p> LocalZOrder is the 'key' used to sort the node relative to its siblings. <br/>
370
+ * <br/>
371
+ * The Node's parent will sort all its children based ont the LocalZOrder value. <br/>
372
+ * If two nodes have the same LocalZOrder, then the node that was added first to the children's array <br/>
373
+ * will be in front of the other node in the array. <br/>
374
+ * <br/>
375
+ * Also, the Scene Graph is traversed using the "In-Order" tree traversal algorithm ( http://en.wikipedia.org/wiki/Tree_traversal#In-order )
376
+ * <br/>
377
+ * And Nodes that have LocalZOder values < 0 are the "left" subtree <br/>
378
+ * While Nodes with LocalZOder >=0 are the "right" subtree. </p>
379
+ * @function
380
+ * @param {Number} localZOrder
381
+ */
382
+ setLocalZOrder: function (localZOrder) {
383
+ this._localZOrder = localZOrder;
384
+ if (this._parent)
385
+ this._parent.reorderChild(this, localZOrder);
386
+ cc.eventManager._setDirtyForNode(this);
387
+ },
388
+
389
+ //Helper function used by `setLocalZOrder`. Don't use it unless you know what you are doing.
390
+ _setLocalZOrder: function (localZOrder) {
391
+ this._localZOrder = localZOrder;
392
+ },
393
+
394
+ /**
395
+ * Returns the local Z order of this node.
396
+ * @function
397
+ * @returns {Number} The local (relative to its siblings) Z order.
398
+ */
399
+ getLocalZOrder: function () {
400
+ return this._localZOrder;
401
+ },
402
+
403
+ /**
404
+ * Returns z order of this node
405
+ * @function
406
+ * @return {Number}
407
+ * @deprecated since 3.0, please use getLocalZOrder instead
408
+ */
409
+ getZOrder: function () {
410
+ cc.log(cc._LogInfos.Node_getZOrder);
411
+ return this.getLocalZOrder();
412
+ },
413
+
414
+ /**
415
+ * <p>
416
+ * Sets the Z order which stands for the drawing order, and reorder this node in its parent's children array. <br/>
417
+ * <br/>
418
+ * The Z order of node is relative to its "brothers": children of the same parent. <br/>
419
+ * It's nothing to do with OpenGL's z vertex. This one only affects the draw order of nodes in cocos2d. <br/>
420
+ * The larger number it is, the later this node will be drawn in each message loop. <br/>
421
+ * Please refer to setVertexZ(float) for the difference.
422
+ * </p>
423
+ * @function
424
+ * @param {Number} z Z order of this node.
425
+ * @deprecated since 3.0, please use setLocalZOrder instead
426
+ */
427
+ setZOrder: function (z) {
428
+ cc.log(cc._LogInfos.Node_setZOrder);
429
+ this.setLocalZOrder(z);
430
+ },
431
+
432
+ /**
433
+ * <p>Defines the oder in which the nodes are renderer. <br/>
434
+ * Nodes that have a Global Z Order lower, are renderer first. <br/>
435
+ * <br/>
436
+ * In case two or more nodes have the same Global Z Order, the oder is not guaranteed. <br/>
437
+ * The only exception if the Nodes have a Global Z Order == 0. In that case, the Scene Graph order is used. <br/>
438
+ * <br/>
439
+ * By default, all nodes have a Global Z Order = 0. That means that by default, the Scene Graph order is used to render the nodes. <br/>
440
+ * <br/>
441
+ * Global Z Order is useful when you need to render nodes in an order different than the Scene Graph order. <br/>
442
+ * <br/>
443
+ * Limitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their ancestors. <br/>
444
+ * And if ClippingNode is one of the ancestors, then "global Z order" will be relative to the ClippingNode. </p>
445
+ * @function
446
+ * @param {Number} globalZOrder
447
+ */
448
+ setGlobalZOrder: function (globalZOrder) {
449
+ if (this._globalZOrder != globalZOrder) {
450
+ this._globalZOrder = globalZOrder;
451
+ cc.eventManager._setDirtyForNode(this);
452
+ }
453
+ },
454
+
455
+ /**
456
+ * Return the Node's Global Z Order.
457
+ * @function
458
+ * @returns {number} The node's global Z order
459
+ */
460
+ getGlobalZOrder: function () {
461
+ return this._globalZOrder;
462
+ },
463
+
464
+ /**
465
+ * Returns WebGL Z vertex of this node.
466
+ * @function
467
+ * @return {Number} WebGL Z vertex of this node
468
+ */
469
+ getVertexZ: function () {
470
+ return this._vertexZ;
471
+ },
472
+
473
+ /**
474
+ * <p>
475
+ * Sets the real WebGL Z vertex. <br/>
476
+ * <br/>
477
+ * Differences between openGL Z vertex and cocos2d Z order: <br/>
478
+ * - WebGL Z modifies the Z vertex, and not the Z order in the relation between parent-children <br/>
479
+ * - WebGL Z might require to set 2D projection <br/>
480
+ * - cocos2d Z order works OK if all the nodes uses the same WebGL Z vertex. eg: vertexZ = 0 <br/>
481
+ * <br/>
482
+ * @warning Use it at your own risk since it might break the cocos2d parent-children z order
483
+ * </p>
484
+ * @function
485
+ * @param {Number} Var
486
+ */
487
+ setVertexZ: function (Var) {
488
+ this._vertexZ = Var;
489
+ },
490
+
491
+ /**
492
+ * Returns the rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node clockwise.
493
+ * @function
494
+ * @return {Number} The rotation of the node in degrees.
495
+ */
496
+ getRotation: function () {
497
+ if (this._rotationX !== this._rotationY)
498
+ cc.log(cc._LogInfos.Node_getRotation);
499
+ return this._rotationX;
500
+ },
501
+
502
+ /**
503
+ * <p>
504
+ * Sets the rotation (angle) of the node in degrees. <br/>
505
+ * <br/>
506
+ * 0 is the default rotation angle. <br/>
507
+ * Positive values rotate node clockwise, and negative values for anti-clockwise.
508
+ * </p>
509
+ * @function
510
+ * @param {Number} newRotation The rotation of the node in degrees.
511
+ */
512
+ setRotation: function (newRotation) {
513
+ this._rotationX = this._rotationY = newRotation;
514
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
515
+ },
516
+
517
+ /**
518
+ * Returns the X axis rotation (angle) which represent a horizontal rotational skew of the node in degrees. <br/>
519
+ * 0 is the default rotation angle. Positive values rotate node clockwise<br/>
520
+ * (support only in WebGL rendering mode)
521
+ * @function
522
+ * @return {Number} The X rotation in degrees.
523
+ */
524
+ getRotationX: function () {
525
+ return this._rotationX;
526
+ },
527
+
528
+ /**
529
+ * <p>
530
+ * Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew. <br/>
531
+ * (support only in WebGL rendering mode) <br/>
532
+ * 0 is the default rotation angle. <br/>
533
+ * Positive values rotate node clockwise, and negative values for anti-clockwise.
534
+ * </p>
535
+ * @param {Number} rotationX The X rotation in degrees which performs a horizontal rotational skew.
536
+ */
537
+ setRotationX: function (rotationX) {
538
+ this._rotationX = rotationX;
539
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
540
+ },
541
+
542
+ /**
543
+ * Returns the Y axis rotation (angle) which represent a vertical rotational skew of the node in degrees. <br/>
544
+ * 0 is the default rotation angle. Positive values rotate node clockwise<br/>
545
+ * (support only in WebGL rendering mode)
546
+ * @function
547
+ * @return {Number} The Y rotation in degrees.
548
+ */
549
+ getRotationY: function () {
550
+ return this._rotationY;
551
+ },
552
+
553
+ /**
554
+ * <p>
555
+ * Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew. <br/>
556
+ * (support only in WebGL rendering mode) <br/>
557
+ * 0 is the default rotation angle. <br/>
558
+ * Positive values rotate node clockwise, and negative values for anti-clockwise.
559
+ * </p>
560
+ * @param rotationY The Y rotation in degrees.
561
+ */
562
+ setRotationY: function (rotationY) {
563
+ this._rotationY = rotationY;
564
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
565
+ },
566
+
567
+ /**
568
+ * Returns the scale factor of the node.
569
+ * @warning: Assertion will fail when _scaleX != _scaleY.
570
+ * @function
571
+ * @return {Number} The scale factor
572
+ */
573
+ getScale: function () {
574
+ if (this._scaleX !== this._scaleY)
575
+ cc.log(cc._LogInfos.Node_getScale);
576
+ return this._scaleX;
577
+ },
578
+
579
+ /**
580
+ * Sets the scale factor of the node. 1.0 is the default scale factor. This function can modify the X and Y scale at the same time.
581
+ * @function
582
+ * @param {Number} scale or scaleX value
583
+ * @param {Number} [scaleY=]
584
+ */
585
+ setScale: function (scale, scaleY) {
586
+ this._scaleX = scale;
587
+ this._scaleY = (scaleY || scaleY === 0) ? scaleY : scale;
588
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
589
+ },
590
+
591
+ /**
592
+ * Returns the scale factor on X axis of this node
593
+ * @function
594
+ * @return {Number} The scale factor on X axis.
595
+ */
596
+ getScaleX: function () {
597
+ return this._scaleX;
598
+ },
599
+
600
+ /**
601
+ * <p>
602
+ * Changes the scale factor on X axis of this node <br/>
603
+ * The default value is 1.0 if you haven't changed it before
604
+ * </p>
605
+ * @function
606
+ * @param {Number} newScaleX The scale factor on X axis.
607
+ */
608
+ setScaleX: function (newScaleX) {
609
+ this._scaleX = newScaleX;
610
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
611
+ },
612
+
613
+ /**
614
+ * Returns the scale factor on Y axis of this node
615
+ * @function
616
+ * @return {Number} The scale factor on Y axis.
617
+ */
618
+ getScaleY: function () {
619
+ return this._scaleY;
620
+ },
621
+
622
+ /**
623
+ * <p>
624
+ * Changes the scale factor on Y axis of this node <br/>
625
+ * The Default value is 1.0 if you haven't changed it before.
626
+ * </p>
627
+ * @function
628
+ * @param {Number} newScaleY The scale factor on Y axis.
629
+ */
630
+ setScaleY: function (newScaleY) {
631
+ this._scaleY = newScaleY;
632
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
633
+ },
634
+
635
+ /**
636
+ * <p>
637
+ * Changes the position (x,y) of the node in cocos2d coordinates.<br/>
638
+ * The original point (0,0) is at the left-bottom corner of screen.<br/>
639
+ * Usually we use cc.p(x,y) to compose CCPoint object.<br/>
640
+ * and Passing two numbers (x,y) is more efficient than passing CCPoint object.
641
+ * </p>
642
+ * @function
643
+ * @param {cc.Point|Number} newPosOrxValue The position (x,y) of the node in coordinates or the X coordinate for position
644
+ * @param {Number} [yValue] Y coordinate for position
645
+ * @example
646
+ * var size = cc.winSize;
647
+ * node.setPosition(size.width/2, size.height/2);
648
+ */
649
+ setPosition: function (newPosOrxValue, yValue) {
650
+ var locPosition = this._position;
651
+ if (yValue === undefined) {
652
+ if(locPosition.x === newPosOrxValue.x && locPosition.y === newPosOrxValue.y)
653
+ return;
654
+ locPosition.x = newPosOrxValue.x;
655
+ locPosition.y = newPosOrxValue.y;
656
+ } else {
657
+ if(locPosition.x === newPosOrxValue.x && locPosition.y === yValue)
658
+ return;
659
+ locPosition.x = newPosOrxValue;
660
+ locPosition.y = yValue;
661
+ }
662
+ this._usingNormalizedPosition = false;
663
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
664
+ },
665
+
666
+ /**
667
+ * <p>
668
+ * Sets the position (x,y) using values between 0 and 1. <br/>
669
+ * The positions in pixels is calculated like the following: <br/>
670
+ * _position = _normalizedPosition * parent.getContentSize()
671
+ * </p>
672
+ * @param {cc.Point|Number} posOrX
673
+ * @param {Number} [y]
674
+ */
675
+ setNormalizedPosition: function(posOrX, y){
676
+ var locPosition = this._normalizedPosition;
677
+ if (y === undefined) {
678
+ locPosition.x = posOrX.x;
679
+ locPosition.y = posOrX.y;
680
+ } else {
681
+ locPosition.x = posOrX;
682
+ locPosition.y = y;
683
+ }
684
+ this._normalizedPositionDirty = this._usingNormalizedPosition = true;
685
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
686
+ },
687
+
688
+ /**
689
+ * <p>Returns a copy of the position (x,y) of the node in cocos2d coordinates. (0,0) is the left-bottom corner.</p>
690
+ * @function
691
+ * @return {cc.Point} The position (x,y) of the node in OpenGL coordinates
692
+ */
693
+ getPosition: function () {
694
+ return cc.p(this._position);
695
+ },
696
+
697
+ /**
698
+ * returns the normalized position
699
+ * @returns {cc.Point}
700
+ */
701
+ getNormalizedPosition: function(){
702
+ return cc.p(this._normalizedPosition);
703
+ },
704
+
705
+ /**
706
+ * <p>Returns the x axis position of the node in cocos2d coordinates.</p>
707
+ * @function
708
+ * @return {Number}
709
+ */
710
+ getPositionX: function () {
711
+ return this._position.x;
712
+ },
713
+
714
+ /**
715
+ * <p>Sets the x axis position of the node in cocos2d coordinates.</p>
716
+ * @function
717
+ * @param {Number} x The new position in x axis
718
+ */
719
+ setPositionX: function (x) {
720
+ this._position.x = x;
721
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
722
+ },
723
+
724
+ /**
725
+ * <p>Returns the y axis position of the node in cocos2d coordinates.</p>
726
+ * @function
727
+ * @return {Number}
728
+ */
729
+ getPositionY: function () {
730
+ return this._position.y;
731
+ },
732
+
733
+ /**
734
+ * <p>Sets the y axis position of the node in cocos2d coordinates.</p>
735
+ * @function
736
+ * @param {Number} y The new position in y axis
737
+ */
738
+ setPositionY: function (y) {
739
+ this._position.y = y;
740
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
741
+ },
742
+
743
+ /**
744
+ * Returns the amount of children.
745
+ * @function
746
+ * @return {Number} The amount of children.
747
+ */
748
+ getChildrenCount: function () {
749
+ return this._children.length;
750
+ },
751
+
752
+ /**
753
+ * Returns an array of all children <br/>
754
+ * Composing a "tree" structure is a very important feature of CCNode
755
+ * @function
756
+ * @return {Array} An array of children
757
+ * @example
758
+ * //This sample code traverses all children nodes, and set their position to (0,0)
759
+ * var allChildren = parent.getChildren();
760
+ * for(var i = 0; i< allChildren.length; i++) {
761
+ * allChildren[i].setPosition(0,0);
762
+ * }
763
+ */
764
+ getChildren: function () {
765
+ return this._children;
766
+ },
767
+
768
+ /**
769
+ * Returns if the node is visible
770
+ * @function
771
+ * @see cc.Node#setVisible
772
+ * @return {Boolean} true if the node is visible, false if the node is hidden.
773
+ */
774
+ isVisible: function () {
775
+ return this._visible;
776
+ },
777
+
778
+ /**
779
+ * Sets whether the node is visible <br/>
780
+ * The default value is true
781
+ * @function
782
+ * @param {Boolean} visible Pass true to make the node visible, false to hide the node.
783
+ */
784
+ setVisible: function (visible) {
785
+ if(this._visible !== visible){
786
+ this._visible = visible;
787
+ //if(visible)
788
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
789
+ cc.renderer.childrenOrderDirty = true;
790
+ }
791
+ },
792
+
793
+ /**
794
+ * <p>Returns a copy of the anchor point.<br/>
795
+ * Anchor point is the point around which all transformations and positioning manipulations take place.<br/>
796
+ * It's like a pin in the node where it is "attached" to its parent. <br/>
797
+ * The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>
798
+ * But you can use values higher than (1,1) and lower than (0,0) too. <br/>
799
+ * The default anchor point is (0.5,0.5), so it starts at the center of the node. <br/></p>
800
+ * @function
801
+ * @return {cc.Point} The anchor point of node.
802
+ */
803
+ getAnchorPoint: function () {
804
+ return cc.p(this._anchorPoint);
805
+ },
806
+
807
+ /**
808
+ * <p>
809
+ * Sets the anchor point in percent. <br/>
810
+ * <br/>
811
+ * anchor point is the point around which all transformations and positioning manipulations take place. <br/>
812
+ * It's like a pin in the node where it is "attached" to its parent. <br/>
813
+ * The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>
814
+ * But you can use values higher than (1,1) and lower than (0,0) too. <br/>
815
+ * The default anchor point is (0.5,0.5), so it starts at the center of the node.
816
+ * </p>
817
+ * @function
818
+ * @param {cc.Point|Number} point The anchor point of node or The x axis anchor of node.
819
+ * @param {Number} [y] The y axis anchor of node.
820
+ */
821
+ setAnchorPoint: function (point, y) {
822
+ var locAnchorPoint = this._anchorPoint;
823
+ if (y === undefined) {
824
+ if ((point.x === locAnchorPoint.x) && (point.y === locAnchorPoint.y))
825
+ return;
826
+ locAnchorPoint.x = point.x;
827
+ locAnchorPoint.y = point.y;
828
+ } else {
829
+ if ((point === locAnchorPoint.x) && (y === locAnchorPoint.y))
830
+ return;
831
+ locAnchorPoint.x = point;
832
+ locAnchorPoint.y = y;
833
+ }
834
+ this._renderCmd._updateAnchorPointInPoint();
835
+ },
836
+
837
+ _getAnchorX: function () {
838
+ return this._anchorPoint.x;
839
+ },
840
+ _setAnchorX: function (x) {
841
+ if (this._anchorPoint.x === x) return;
842
+ this._anchorPoint.x = x;
843
+ this._renderCmd._updateAnchorPointInPoint();
844
+ },
845
+ _getAnchorY: function () {
846
+ return this._anchorPoint.y;
847
+ },
848
+ _setAnchorY: function (y) {
849
+ if (this._anchorPoint.y === y) return;
850
+ this._anchorPoint.y = y;
851
+ this._renderCmd._updateAnchorPointInPoint();
852
+ },
853
+
854
+ /**
855
+ * Returns a copy of the anchor point in absolute pixels. <br/>
856
+ * you can only read it. If you wish to modify it, use setAnchorPoint
857
+ * @see cc.Node#getAnchorPoint
858
+ * @function
859
+ * @return {cc.Point} The anchor point in absolute pixels.
860
+ */
861
+ getAnchorPointInPoints: function () {
862
+ return this._renderCmd.getAnchorPointInPoints();
863
+ },
864
+
865
+ _getWidth: function () {
866
+ return this._contentSize.width;
867
+ },
868
+ _setWidth: function (width) {
869
+ this._contentSize.width = width;
870
+ this._renderCmd._updateAnchorPointInPoint();
871
+ },
872
+ _getHeight: function () {
873
+ return this._contentSize.height;
874
+ },
875
+ _setHeight: function (height) {
876
+ this._contentSize.height = height;
877
+ this._renderCmd._updateAnchorPointInPoint();
878
+ },
879
+
880
+ /**
881
+ * <p>Returns a copy the untransformed size of the node. <br/>
882
+ * The contentSize remains the same no matter the node is scaled or rotated.<br/>
883
+ * All nodes has a size. Layer and Scene has the same size of the screen by default. <br/></p>
884
+ * @function
885
+ * @return {cc.Size} The untransformed size of the node.
886
+ */
887
+ getContentSize: function () {
888
+ return cc.size(this._contentSize);
889
+ },
890
+
891
+ /**
892
+ * <p>
893
+ * Sets the untransformed size of the node. <br/>
894
+ * <br/>
895
+ * The contentSize remains the same no matter the node is scaled or rotated. <br/>
896
+ * All nodes has a size. Layer and Scene has the same size of the screen.
897
+ * </p>
898
+ * @function
899
+ * @param {cc.Size|Number} size The untransformed size of the node or The untransformed size's width of the node.
900
+ * @param {Number} [height] The untransformed size's height of the node.
901
+ */
902
+ setContentSize: function (size, height) {
903
+ var locContentSize = this._contentSize;
904
+ if (height === undefined) {
905
+ if ((size.width === locContentSize.width) && (size.height === locContentSize.height))
906
+ return;
907
+ locContentSize.width = size.width;
908
+ locContentSize.height = size.height;
909
+ } else {
910
+ if ((size === locContentSize.width) && (height === locContentSize.height))
911
+ return;
912
+ locContentSize.width = size;
913
+ locContentSize.height = height;
914
+ }
915
+ this._renderCmd._updateAnchorPointInPoint();
916
+ },
917
+
918
+ /**
919
+ * <p>
920
+ * Returns whether or not the node accepts event callbacks. <br/>
921
+ * Running means the node accept event callbacks like onEnter(), onExit(), update()
922
+ * </p>
923
+ * @function
924
+ * @return {Boolean} Whether or not the node is running.
925
+ */
926
+ isRunning: function () {
927
+ return this._running;
928
+ },
929
+
930
+ /**
931
+ * Returns a reference to the parent node
932
+ * @function
933
+ * @return {cc.Node} A reference to the parent node
934
+ */
935
+ getParent: function () {
936
+ return this._parent;
937
+ },
938
+
939
+ /**
940
+ * Sets the parent node
941
+ * @param {cc.Node} parent A reference to the parent node
942
+ */
943
+ setParent: function (parent) {
944
+ this._parent = parent;
945
+ },
946
+
947
+ /**
948
+ * Returns whether the anchor point will be ignored when you position this node.<br/>
949
+ * When anchor point ignored, position will be calculated based on the origin point (0, 0) in parent's coordinates.
950
+ * @function
951
+ * @see cc.Node#ignoreAnchorPointForPosition
952
+ * @return {Boolean} true if the anchor point will be ignored when you position this node.
953
+ */
954
+ isIgnoreAnchorPointForPosition: function () {
955
+ return this._ignoreAnchorPointForPosition;
956
+ },
957
+
958
+ /**
959
+ * <p>
960
+ * Sets whether the anchor point will be ignored when you position this node. <br/>
961
+ * When anchor point ignored, position will be calculated based on the origin point (0, 0) in parent's coordinates. <br/>
962
+ * This is an internal method, only used by CCLayer and CCScene. Don't call it outside framework. <br/>
963
+ * The default value is false, while in CCLayer and CCScene are true
964
+ * </p>
965
+ * @function
966
+ * @param {Boolean} newValue true if anchor point will be ignored when you position this node
967
+ */
968
+ ignoreAnchorPointForPosition: function (newValue) {
969
+ if (newValue != this._ignoreAnchorPointForPosition) {
970
+ this._ignoreAnchorPointForPosition = newValue;
971
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
972
+ }
973
+ },
974
+
975
+ /**
976
+ * Returns a tag that is used to identify the node easily.
977
+ * @function
978
+ * @return {Number} An integer that identifies the node.
979
+ * @example
980
+ * //You can set tags to node then identify them easily.
981
+ * // set tags
982
+ * node1.setTag(TAG_PLAYER);
983
+ * node2.setTag(TAG_MONSTER);
984
+ * node3.setTag(TAG_BOSS);
985
+ * parent.addChild(node1);
986
+ * parent.addChild(node2);
987
+ * parent.addChild(node3);
988
+ * // identify by tags
989
+ * var allChildren = parent.getChildren();
990
+ * for(var i = 0; i < allChildren.length; i++){
991
+ * switch(node.getTag()) {
992
+ * case TAG_PLAYER:
993
+ * break;
994
+ * case TAG_MONSTER:
995
+ * break;
996
+ * case TAG_BOSS:
997
+ * break;
998
+ * }
999
+ * }
1000
+ */
1001
+ getTag: function () {
1002
+ return this.tag;
1003
+ },
1004
+
1005
+ /**
1006
+ * Changes the tag that is used to identify the node easily. <br/>
1007
+ * Please refer to getTag for the sample code.
1008
+ * @function
1009
+ * @see cc.Node#getTag
1010
+ * @param {Number} tag A integer that identifies the node.
1011
+ */
1012
+ setTag: function (tag) {
1013
+ this.tag = tag;
1014
+ },
1015
+
1016
+ /**
1017
+ * Changes the name that is used to identify the node easily.
1018
+ * @function
1019
+ * @param {String} name
1020
+ */
1021
+ setName: function(name){
1022
+ this._name = name;
1023
+ },
1024
+
1025
+ /**
1026
+ * Returns a string that is used to identify the node.
1027
+ * @function
1028
+ * @returns {string} A string that identifies the node.
1029
+ */
1030
+ getName: function(){
1031
+ return this._name;
1032
+ },
1033
+
1034
+ /**
1035
+ * <p>
1036
+ * Returns a custom user data pointer <br/>
1037
+ * You can set everything in UserData pointer, a data block, a structure or an object.
1038
+ * </p>
1039
+ * @function
1040
+ * @return {object} A custom user data pointer
1041
+ */
1042
+ getUserData: function () {
1043
+ return this.userData;
1044
+ },
1045
+
1046
+ /**
1047
+ * <p>
1048
+ * Sets a custom user data reference <br/>
1049
+ * You can set everything in UserData reference, a data block, a structure or an object, etc.
1050
+ * </p>
1051
+ * @function
1052
+ * @warning Don't forget to release the memory manually in JSB, especially before you change this data pointer, and before this node is autoreleased.
1053
+ * @param {object} Var A custom user data
1054
+ */
1055
+ setUserData: function (Var) {
1056
+ this.userData = Var;
1057
+ },
1058
+
1059
+ /**
1060
+ * Returns a user assigned cocos2d object. <br/>
1061
+ * Similar to userData, but instead of holding all kinds of data it can only hold a cocos2d object
1062
+ * @function
1063
+ * @return {object} A user assigned CCObject
1064
+ */
1065
+ getUserObject: function () {
1066
+ return this.userObject;
1067
+ },
1068
+
1069
+ /**
1070
+ * <p>
1071
+ * Sets a user assigned cocos2d object <br/>
1072
+ * Similar to UserData, but instead of holding all kinds of data it can only hold a cocos2d object <br/>
1073
+ * In JSB, the UserObject will be retained once in this method, and the previous UserObject (if existed) will be release. <br/>
1074
+ * The UserObject will be released in CCNode's destruction.
1075
+ * </p>
1076
+ * @param {object} newValue A user cocos2d object
1077
+ */
1078
+ setUserObject: function (newValue) {
1079
+ if (this.userObject != newValue)
1080
+ this.userObject = newValue;
1081
+ },
1082
+
1083
+
1084
+ /**
1085
+ * Returns the arrival order, indicates which children should be added previously.
1086
+ * @function
1087
+ * @return {Number} The arrival order.
1088
+ */
1089
+ getOrderOfArrival: function () {
1090
+ return this.arrivalOrder;
1091
+ },
1092
+
1093
+ /**
1094
+ * <p>
1095
+ * Sets the arrival order when this node has a same ZOrder with other children. <br/>
1096
+ * <br/>
1097
+ * A node which called addChild subsequently will take a larger arrival order, <br/>
1098
+ * If two children have the same Z order, the child with larger arrival order will be drawn later.
1099
+ * </p>
1100
+ * @function
1101
+ * @warning This method is used internally for zOrder sorting, don't change this manually
1102
+ * @param {Number} Var The arrival order.
1103
+ */
1104
+ setOrderOfArrival: function (Var) {
1105
+ this.arrivalOrder = Var;
1106
+ },
1107
+
1108
+ /**
1109
+ * <p>Returns the CCActionManager object that is used by all actions.<br/>
1110
+ * (IMPORTANT: If you set a new cc.ActionManager, then previously created actions are going to be removed.)</p>
1111
+ * @function
1112
+ * @see cc.Node#setActionManager
1113
+ * @return {cc.ActionManager} A CCActionManager object.
1114
+ */
1115
+ getActionManager: function () {
1116
+ if (!this._actionManager)
1117
+ this._actionManager = cc.director.getActionManager();
1118
+ return this._actionManager;
1119
+ },
1120
+
1121
+ /**
1122
+ * <p>Sets the cc.ActionManager object that is used by all actions. </p>
1123
+ * @function
1124
+ * @warning If you set a new CCActionManager, then previously created actions will be removed.
1125
+ * @param {cc.ActionManager} actionManager A CCActionManager object that is used by all actions.
1126
+ */
1127
+ setActionManager: function (actionManager) {
1128
+ if (this._actionManager != actionManager) {
1129
+ this.stopAllActions();
1130
+ this._actionManager = actionManager;
1131
+ }
1132
+ },
1133
+
1134
+ /**
1135
+ * <p>
1136
+ * Returns the cc.Scheduler object used to schedule all "updates" and timers.
1137
+ * </p>
1138
+ * @function
1139
+ * @return {cc.Scheduler} A CCScheduler object.
1140
+ */
1141
+ getScheduler: function () {
1142
+ if (!this._scheduler)
1143
+ this._scheduler = cc.director.getScheduler();
1144
+ return this._scheduler;
1145
+ },
1146
+
1147
+ /**
1148
+ * <p>
1149
+ * Sets a CCScheduler object that is used to schedule all "updates" and timers. <br/>
1150
+ * IMPORTANT: If you set a new cc.Scheduler, then previously created timers/update are going to be removed.
1151
+ * </p>
1152
+ * @function
1153
+ * @warning If you set a new CCScheduler, then previously created timers/update are going to be removed.
1154
+ * @param scheduler A cc.Scheduler object that is used to schedule all "update" and timers.
1155
+ */
1156
+ setScheduler: function (scheduler) {
1157
+ if (this._scheduler != scheduler) {
1158
+ this.unscheduleAllCallbacks();
1159
+ this._scheduler = scheduler;
1160
+ }
1161
+ },
1162
+
1163
+ /**
1164
+ * Returns a "local" axis aligned bounding box of the node. <br/>
1165
+ * @deprecated since v3.0, please use getBoundingBox instead
1166
+ * @return {cc.Rect}
1167
+ */
1168
+ boundingBox: function(){
1169
+ cc.log(cc._LogInfos.Node_boundingBox);
1170
+ return this.getBoundingBox();
1171
+ },
1172
+
1173
+ /**
1174
+ * Returns a "local" axis aligned bounding box of the node. <br/>
1175
+ * The returned box is relative only to its parent.
1176
+ * @function
1177
+ * @return {cc.Rect} The calculated bounding box of the node
1178
+ */
1179
+ getBoundingBox: function () {
1180
+ var rect = cc.rect(0, 0, this._contentSize.width, this._contentSize.height);
1181
+ return cc._rectApplyAffineTransformIn(rect, this.getNodeToParentTransform());
1182
+ },
1183
+
1184
+ /**
1185
+ * Stops all running actions and schedulers
1186
+ * @function
1187
+ */
1188
+ cleanup: function () {
1189
+ // actions
1190
+ this.stopAllActions();
1191
+ this.unscheduleAllCallbacks();
1192
+
1193
+ // event
1194
+ cc.eventManager.removeListeners(this);
1195
+
1196
+ // timers
1197
+ this._arrayMakeObjectsPerformSelector(this._children, cc.Node._stateCallbackType.cleanup);
1198
+ },
1199
+
1200
+ // composition: GET
1201
+ /**
1202
+ * Returns a child from the container given its tag
1203
+ * @function
1204
+ * @param {Number} aTag An identifier to find the child node.
1205
+ * @return {cc.Node} a CCNode object whose tag equals to the input parameter
1206
+ */
1207
+ getChildByTag: function (aTag) {
1208
+ var __children = this._children;
1209
+ if (__children != null) {
1210
+ for (var i = 0; i < __children.length; i++) {
1211
+ var node = __children[i];
1212
+ if (node && node.tag == aTag)
1213
+ return node;
1214
+ }
1215
+ }
1216
+ return null;
1217
+ },
1218
+
1219
+ /**
1220
+ * Returns a child from the container given its name
1221
+ * @function
1222
+ * @param {String} name A name to find the child node.
1223
+ * @return {cc.Node} a CCNode object whose name equals to the input parameter
1224
+ */
1225
+ getChildByName: function(name){
1226
+ if(!name){
1227
+ cc.log("Invalid name");
1228
+ return null;
1229
+ }
1230
+
1231
+ var locChildren = this._children;
1232
+ for(var i = 0, len = locChildren.length; i < len; i++){
1233
+ if(locChildren[i]._name == name)
1234
+ return locChildren[i];
1235
+ }
1236
+ return null;
1237
+ },
1238
+
1239
+ // composition: ADD
1240
+
1241
+ /** <p>"add" logic MUST only be in this method <br/> </p>
1242
+ *
1243
+ * <p>If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.</p>
1244
+ * @function
1245
+ * @param {cc.Node} child A child node
1246
+ * @param {Number} [localZOrder=] Z order for drawing priority. Please refer to setZOrder(int)
1247
+ * @param {Number} [tag=] A integer to identify the node easily. Please refer to setTag(int)
1248
+ */
1249
+ addChild: function (child, localZOrder, tag) {
1250
+ localZOrder = localZOrder === undefined ? child._localZOrder : localZOrder;
1251
+ var name, setTag = false;
1252
+ if(cc.isUndefined(tag)){
1253
+ tag = undefined;
1254
+ name = child._name;
1255
+ } else if(cc.isString(tag)){
1256
+ name = tag;
1257
+ tag = undefined;
1258
+ } else if(cc.isNumber(tag)){
1259
+ setTag = true;
1260
+ name = "";
1261
+ }
1262
+
1263
+ cc.assert(child, cc._LogInfos.Node_addChild_3);
1264
+ cc.assert(child._parent === null, "child already added. It can't be added again");
1265
+
1266
+ this._addChildHelper(child, localZOrder, tag, name, setTag);
1267
+ },
1268
+
1269
+ _addChildHelper: function(child, localZOrder, tag, name, setTag){
1270
+ if(!this._children)
1271
+ this._children = [];
1272
+
1273
+ this._insertChild(child, localZOrder);
1274
+ if(setTag)
1275
+ child.setTag(tag);
1276
+ else
1277
+ child.setName(name);
1278
+
1279
+ child.setParent(this);
1280
+ child.setOrderOfArrival(cc.s_globalOrderOfArrival++);
1281
+
1282
+ if( this._running ){
1283
+ child.onEnter();
1284
+ // prevent onEnterTransitionDidFinish to be called twice when a node is added in onEnter
1285
+ if (this._isTransitionFinished)
1286
+ child.onEnterTransitionDidFinish();
1287
+ }
1288
+ if (this._cascadeColorEnabled)
1289
+ child._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);
1290
+ if (this._cascadeOpacityEnabled)
1291
+ child._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty);
1292
+ },
1293
+
1294
+ // composition: REMOVE
1295
+ /**
1296
+ * Remove itself from its parent node. If cleanup is true, then also remove all actions and callbacks. <br/>
1297
+ * If the cleanup parameter is not passed, it will force a cleanup. <br/>
1298
+ * If the node orphan, then nothing happens.
1299
+ * @function
1300
+ * @param {Boolean} [cleanup=true] true if all actions and callbacks on this node should be removed, false otherwise.
1301
+ * @see cc.Node#removeFromParentAndCleanup
1302
+ */
1303
+ removeFromParent: function (cleanup) {
1304
+ if (this._parent) {
1305
+ if (cleanup == null)
1306
+ cleanup = true;
1307
+ this._parent.removeChild(this, cleanup);
1308
+ }
1309
+ },
1310
+
1311
+ /**
1312
+ * Removes this node itself from its parent node. <br/>
1313
+ * If the node orphan, then nothing happens.
1314
+ * @deprecated since v3.0, please use removeFromParent() instead
1315
+ * @param {Boolean} [cleanup=true] true if all actions and callbacks on this node should be removed, false otherwise.
1316
+ */
1317
+ removeFromParentAndCleanup: function (cleanup) {
1318
+ cc.log(cc._LogInfos.Node_removeFromParentAndCleanup);
1319
+ this.removeFromParent(cleanup);
1320
+ },
1321
+
1322
+ /** <p>Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>
1323
+ * If the cleanup parameter is not passed, it will force a cleanup. <br/>
1324
+ * <p> "remove" logic MUST only be on this method <br/>
1325
+ * If a class wants to extend the 'removeChild' behavior it only needs <br/>
1326
+ * to override this method </p>
1327
+ * @function
1328
+ * @param {cc.Node} child The child node which will be removed.
1329
+ * @param {Boolean} [cleanup=true] true if all running actions and callbacks on the child node will be cleanup, false otherwise.
1330
+ */
1331
+ removeChild: function (child, cleanup) {
1332
+ // explicit nil handling
1333
+ if (this._children.length === 0)
1334
+ return;
1335
+
1336
+ if (cleanup == null)
1337
+ cleanup = true;
1338
+ if (this._children.indexOf(child) > -1)
1339
+ this._detachChild(child, cleanup);
1340
+
1341
+ //this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.visibleDirty);
1342
+ cc.renderer.childrenOrderDirty = true;
1343
+ },
1344
+
1345
+ /**
1346
+ * Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter.
1347
+ * If the cleanup parameter is not passed, it will force a cleanup. <br/>
1348
+ * @function
1349
+ * @param {Number} tag An integer number that identifies a child node
1350
+ * @param {Boolean} [cleanup=true] true if all running actions and callbacks on the child node will be cleanup, false otherwise.
1351
+ * @see cc.Node#removeChildByTag
1352
+ */
1353
+ removeChildByTag: function (tag, cleanup) {
1354
+ if (tag === cc.NODE_TAG_INVALID)
1355
+ cc.log(cc._LogInfos.Node_removeChildByTag);
1356
+
1357
+ var child = this.getChildByTag(tag);
1358
+ if (child == null)
1359
+ cc.log(cc._LogInfos.Node_removeChildByTag_2, tag);
1360
+ else
1361
+ this.removeChild(child, cleanup);
1362
+ },
1363
+
1364
+ /**
1365
+ * Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter.
1366
+ * @param {Boolean} [cleanup=true]
1367
+ */
1368
+ removeAllChildrenWithCleanup: function (cleanup) {
1369
+ this.removeAllChildren(cleanup);
1370
+ },
1371
+
1372
+ /**
1373
+ * Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>
1374
+ * If the cleanup parameter is not passed, it will force a cleanup. <br/>
1375
+ * @function
1376
+ * @param {Boolean} [cleanup=true] true if all running actions on all children nodes should be cleanup, false otherwise.
1377
+ */
1378
+ removeAllChildren: function (cleanup) {
1379
+ // not using detachChild improves speed here
1380
+ var __children = this._children;
1381
+ if (__children != null) {
1382
+ if (cleanup == null)
1383
+ cleanup = true;
1384
+ for (var i = 0; i < __children.length; i++) {
1385
+ var node = __children[i];
1386
+ if (node) {
1387
+ // IMPORTANT:
1388
+ // -1st do onExit
1389
+ // -2nd cleanup
1390
+ if (this._running) {
1391
+ node.onExitTransitionDidStart();
1392
+ node.onExit();
1393
+ }
1394
+ if (cleanup)
1395
+ node.cleanup();
1396
+ // set parent nil at the end
1397
+ node.parent = null;
1398
+ }
1399
+ }
1400
+ this._children.length = 0;
1401
+ }
1402
+ },
1403
+
1404
+ _detachChild: function (child, doCleanup) {
1405
+ // IMPORTANT:
1406
+ // -1st do onExit
1407
+ // -2nd cleanup
1408
+ if (this._running) {
1409
+ child.onExitTransitionDidStart();
1410
+ child.onExit();
1411
+ }
1412
+
1413
+ // If you don't do cleanup, the child's actions will not get removed and the
1414
+ if (doCleanup)
1415
+ child.cleanup();
1416
+
1417
+ // set parent nil at the end
1418
+ child.parent = null;
1419
+ child._renderCmd.detachFromParent();
1420
+ cc.arrayRemoveObject(this._children, child);
1421
+ },
1422
+
1423
+ _insertChild: function (child, z) {
1424
+ cc.renderer.childrenOrderDirty = this._reorderChildDirty = true;
1425
+ this._children.push(child);
1426
+ child._setLocalZOrder(z);
1427
+ },
1428
+
1429
+ setNodeDirty: function(){
1430
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
1431
+ },
1432
+
1433
+ /** Reorders a child according to a new z value. <br/>
1434
+ * The child MUST be already added.
1435
+ * @function
1436
+ * @param {cc.Node} child An already added child node. It MUST be already added.
1437
+ * @param {Number} zOrder Z order for drawing priority. Please refer to setZOrder(int)
1438
+ */
1439
+ reorderChild: function (child, zOrder) {
1440
+ cc.assert(child, cc._LogInfos.Node_reorderChild);
1441
+ cc.renderer.childrenOrderDirty = this._reorderChildDirty = true;
1442
+ child.arrivalOrder = cc.s_globalOrderOfArrival;
1443
+ cc.s_globalOrderOfArrival++;
1444
+ child._setLocalZOrder(zOrder);
1445
+ },
1446
+
1447
+ /**
1448
+ * <p>
1449
+ * Sorts the children array once before drawing, instead of every time when a child is added or reordered. <br/>
1450
+ * This approach can improves the performance massively.
1451
+ * </p>
1452
+ * @function
1453
+ * @note Don't call this manually unless a child added needs to be removed in the same frame
1454
+ */
1455
+ sortAllChildren: function () {
1456
+ if (this._reorderChildDirty) {
1457
+ var _children = this._children;
1458
+
1459
+ // insertion sort
1460
+ var len = _children.length, i, j, tmp;
1461
+ for(i=1; i<len; i++){
1462
+ tmp = _children[i];
1463
+ j = i - 1;
1464
+
1465
+ //continue moving element downwards while zOrder is smaller or when zOrder is the same but mutatedIndex is smaller
1466
+ while(j >= 0){
1467
+ if(tmp._localZOrder < _children[j]._localZOrder){
1468
+ _children[j+1] = _children[j];
1469
+ }else if(tmp._localZOrder === _children[j]._localZOrder && tmp.arrivalOrder < _children[j].arrivalOrder){
1470
+ _children[j+1] = _children[j];
1471
+ }else{
1472
+ break;
1473
+ }
1474
+ j--;
1475
+ }
1476
+ _children[j+1] = tmp;
1477
+ }
1478
+
1479
+ //don't need to check children recursively, that's done in visit of each child
1480
+ this._reorderChildDirty = false;
1481
+ }
1482
+ },
1483
+
1484
+ /**
1485
+ * Render function using the canvas 2d context or WebGL context, internal usage only, please do not call this function
1486
+ * @function
1487
+ * @param {CanvasRenderingContext2D | WebGLRenderingContext} ctx The render context
1488
+ */
1489
+ draw: function (ctx) {
1490
+ // override me
1491
+ // Only use- this function to draw your staff.
1492
+ // DON'T draw your stuff outside this method
1493
+ },
1494
+
1495
+ // Internal use only, do not call it by yourself,
1496
+ transformAncestors: function () {
1497
+ if (this._parent != null) {
1498
+ this._parent.transformAncestors();
1499
+ this._parent.transform();
1500
+ }
1501
+ },
1502
+
1503
+ //scene managment
1504
+ /**
1505
+ * <p>
1506
+ * Event callback that is invoked every time when CCNode enters the 'stage'. <br/>
1507
+ * If the CCNode enters the 'stage' with a transition, this event is called when the transition starts. <br/>
1508
+ * During onEnter you can't access a "sister/brother" node. <br/>
1509
+ * If you override onEnter, you must call its parent's onEnter function with this._super().
1510
+ * </p>
1511
+ * @function
1512
+ */
1513
+ onEnter: function () {
1514
+ this._isTransitionFinished = false;
1515
+ this._running = true;//should be running before resumeSchedule
1516
+ this._arrayMakeObjectsPerformSelector(this._children, cc.Node._stateCallbackType.onEnter);
1517
+ this.resume();
1518
+ },
1519
+
1520
+ /**
1521
+ * <p>
1522
+ * Event callback that is invoked when the CCNode enters in the 'stage'. <br/>
1523
+ * If the CCNode enters the 'stage' with a transition, this event is called when the transition finishes. <br/>
1524
+ * If you override onEnterTransitionDidFinish, you shall call its parent's onEnterTransitionDidFinish with this._super()
1525
+ * </p>
1526
+ * @function
1527
+ */
1528
+ onEnterTransitionDidFinish: function () {
1529
+ this._isTransitionFinished = true;
1530
+ this._arrayMakeObjectsPerformSelector(this._children, cc.Node._stateCallbackType.onEnterTransitionDidFinish);
1531
+ },
1532
+
1533
+ /**
1534
+ * <p>callback that is called every time the cc.Node leaves the 'stage'. <br/>
1535
+ * If the cc.Node leaves the 'stage' with a transition, this callback is called when the transition starts. <br/>
1536
+ * If you override onExitTransitionDidStart, you shall call its parent's onExitTransitionDidStart with this._super()</p>
1537
+ * @function
1538
+ */
1539
+ onExitTransitionDidStart: function () {
1540
+ this._arrayMakeObjectsPerformSelector(this._children, cc.Node._stateCallbackType.onExitTransitionDidStart);
1541
+ },
1542
+
1543
+ /**
1544
+ * <p>
1545
+ * callback that is called every time the cc.Node leaves the 'stage'. <br/>
1546
+ * If the cc.Node leaves the 'stage' with a transition, this callback is called when the transition finishes. <br/>
1547
+ * During onExit you can't access a sibling node. <br/>
1548
+ * If you override onExit, you shall call its parent's onExit with this._super().
1549
+ * </p>
1550
+ * @function
1551
+ */
1552
+ onExit: function () {
1553
+ this._running = false;
1554
+ this.pause();
1555
+ this._arrayMakeObjectsPerformSelector(this._children, cc.Node._stateCallbackType.onExit);
1556
+ this.removeAllComponents();
1557
+ },
1558
+
1559
+ // actions
1560
+ /**
1561
+ * Executes an action, and returns the action that is executed.<br/>
1562
+ * The node becomes the action's target. Refer to cc.Action's getTarget()
1563
+ * @function
1564
+ * @warning Starting from v0.8 actions don't retain their target anymore.
1565
+ * @param {cc.Action} action
1566
+ * @return {cc.Action} An Action pointer
1567
+ */
1568
+ runAction: function (action) {
1569
+ cc.assert(action, cc._LogInfos.Node_runAction);
1570
+
1571
+ this.actionManager.addAction(action, this, !this._running);
1572
+ return action;
1573
+ },
1574
+
1575
+ /**
1576
+ * Stops and removes all actions from the running action list .
1577
+ * @function
1578
+ */
1579
+ stopAllActions: function () {
1580
+ this.actionManager && this.actionManager.removeAllActionsFromTarget(this);
1581
+ },
1582
+
1583
+ /**
1584
+ * Stops and removes an action from the running action list.
1585
+ * @function
1586
+ * @param {cc.Action} action An action object to be removed.
1587
+ */
1588
+ stopAction: function (action) {
1589
+ this.actionManager.removeAction(action);
1590
+ },
1591
+
1592
+ /**
1593
+ * Removes an action from the running action list by its tag.
1594
+ * @function
1595
+ * @param {Number} tag A tag that indicates the action to be removed.
1596
+ */
1597
+ stopActionByTag: function (tag) {
1598
+ if (tag === cc.ACTION_TAG_INVALID) {
1599
+ cc.log(cc._LogInfos.Node_stopActionByTag);
1600
+ return;
1601
+ }
1602
+ this.actionManager.removeActionByTag(tag, this);
1603
+ },
1604
+
1605
+ /**
1606
+ * Returns an action from the running action list by its tag.
1607
+ * @function
1608
+ * @see cc.Node#getTag and cc.Node#setTag
1609
+ * @param {Number} tag
1610
+ * @return {cc.Action} The action object with the given tag.
1611
+ */
1612
+ getActionByTag: function (tag) {
1613
+ if (tag === cc.ACTION_TAG_INVALID) {
1614
+ cc.log(cc._LogInfos.Node_getActionByTag);
1615
+ return null;
1616
+ }
1617
+ return this.actionManager.getActionByTag(tag, this);
1618
+ },
1619
+
1620
+ /** <p>Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).<br/>
1621
+ * Composable actions are counted as 1 action. Example:<br/>
1622
+ * If you are running 1 Sequence of 7 actions, it will return 1. <br/>
1623
+ * If you are running 7 Sequences of 2 actions, it will return 7.</p>
1624
+ * @function
1625
+ * @return {Number} The number of actions that are running plus the ones that are schedule to run
1626
+ */
1627
+ getNumberOfRunningActions: function () {
1628
+ return this.actionManager.numberOfRunningActionsInTarget(this);
1629
+ },
1630
+
1631
+ // cc.Node - Callbacks
1632
+ // timers
1633
+ /**
1634
+ * <p>schedules the "update" method. <br/>
1635
+ * It will use the order number 0. This method will be called every frame. <br/>
1636
+ * Scheduled methods with a lower order value will be called before the ones that have a higher order value.<br/>
1637
+ * Only one "update" method could be scheduled per node.</p>
1638
+ * @function
1639
+ */
1640
+ scheduleUpdate: function () {
1641
+ this.scheduleUpdateWithPriority(0);
1642
+ },
1643
+
1644
+ /**
1645
+ * <p>
1646
+ * schedules the "update" callback function with a custom priority.
1647
+ * This callback function will be called every frame.<br/>
1648
+ * Scheduled callback functions with a lower priority will be called before the ones that have a higher value.<br/>
1649
+ * Only one "update" callback function could be scheduled per node (You can't have 2 'update' callback functions).<br/>
1650
+ * </p>
1651
+ * @function
1652
+ * @param {Number} priority
1653
+ */
1654
+ scheduleUpdateWithPriority: function (priority) {
1655
+ this.scheduler.scheduleUpdateForTarget(this, priority, !this._running);
1656
+ },
1657
+
1658
+ /**
1659
+ * Unschedules the "update" method.
1660
+ * @function
1661
+ * @see cc.Node#scheduleUpdate
1662
+ */
1663
+ unscheduleUpdate: function () {
1664
+ this.scheduler.unscheduleUpdateForTarget(this);
1665
+ },
1666
+
1667
+ /**
1668
+ * <p>Schedules a custom selector. <br/>
1669
+ * If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.</p>
1670
+ * @function
1671
+ * @param {function} callback_fn A function wrapped as a selector
1672
+ * @param {Number} interval Tick interval in seconds. 0 means tick every frame. If interval = 0, it's recommended to use scheduleUpdate() instead.
1673
+ * @param {Number} repeat The selector will be executed (repeat + 1) times, you can use kCCRepeatForever for tick infinitely.
1674
+ * @param {Number} delay The amount of time that the first tick will wait before execution.
1675
+ */
1676
+ schedule: function (callback_fn, interval, repeat, delay) {
1677
+ interval = interval || 0;
1678
+
1679
+ cc.assert(callback_fn, cc._LogInfos.Node_schedule);
1680
+ cc.assert(interval >= 0, cc._LogInfos.Node_schedule_2);
1681
+
1682
+ repeat = (repeat == null) ? cc.REPEAT_FOREVER : repeat;
1683
+ delay = delay || 0;
1684
+
1685
+ this.scheduler.scheduleCallbackForTarget(this, callback_fn, interval, repeat, delay, !this._running);
1686
+ },
1687
+
1688
+ /**
1689
+ * Schedules a callback function that runs only once, with a delay of 0 or larger
1690
+ * @function
1691
+ * @see cc.Node#schedule
1692
+ * @param {function} callback_fn A function wrapped as a selector
1693
+ * @param {Number} delay The amount of time that the first tick will wait before execution.
1694
+ */
1695
+ scheduleOnce: function (callback_fn, delay) {
1696
+ this.schedule(callback_fn, 0.0, 0, delay);
1697
+ },
1698
+
1699
+ /**
1700
+ * unschedules a custom callback function.
1701
+ * @function
1702
+ * @see cc.Node#schedule
1703
+ * @param {function} callback_fn A function wrapped as a selector
1704
+ */
1705
+ unschedule: function (callback_fn) {
1706
+ if (!callback_fn)
1707
+ return;
1708
+
1709
+ this.scheduler.unscheduleCallbackForTarget(this, callback_fn);
1710
+ },
1711
+
1712
+ /**
1713
+ * <p>unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>
1714
+ * Actions are not affected by this method.</p>
1715
+ * @function
1716
+ */
1717
+ unscheduleAllCallbacks: function () {
1718
+ this.scheduler.unscheduleAllCallbacksForTarget(this);
1719
+ },
1720
+
1721
+ /**
1722
+ * Resumes all scheduled selectors and actions.<br/>
1723
+ * This method is called internally by onEnter
1724
+ * @function
1725
+ * @deprecated since v3.0, please use resume() instead
1726
+ */
1727
+ resumeSchedulerAndActions: function () {
1728
+ cc.log(cc._LogInfos.Node_resumeSchedulerAndActions);
1729
+ this.resume();
1730
+ },
1731
+
1732
+ /**
1733
+ * <p>Resumes all scheduled selectors and actions.<br/>
1734
+ * This method is called internally by onEnter</p>
1735
+ */
1736
+ resume: function () {
1737
+ this.scheduler.resumeTarget(this);
1738
+ this.actionManager && this.actionManager.resumeTarget(this);
1739
+ cc.eventManager.resumeTarget(this);
1740
+ },
1741
+
1742
+ /**
1743
+ * <p>Pauses all scheduled selectors and actions.<br/>
1744
+ * This method is called internally by onExit</p>
1745
+ * @deprecated since v3.0, please use pause instead
1746
+ * @function
1747
+ */
1748
+ pauseSchedulerAndActions: function () {
1749
+ cc.log(cc._LogInfos.Node_pauseSchedulerAndActions);
1750
+ this.pause();
1751
+ },
1752
+
1753
+ /**
1754
+ * <p>Pauses all scheduled selectors and actions.<br/>
1755
+ * This method is called internally by onExit</p>
1756
+ * @function
1757
+ */
1758
+ pause: function () {
1759
+ this.scheduler.pauseTarget(this);
1760
+ this.actionManager && this.actionManager.pauseTarget(this);
1761
+ cc.eventManager.pauseTarget(this);
1762
+ },
1763
+
1764
+ /**
1765
+ *<p>Sets the additional transform.<br/>
1766
+ * The additional transform will be concatenated at the end of getNodeToParentTransform.<br/>
1767
+ * It could be used to simulate `parent-child` relationship between two nodes (e.g. one is in BatchNode, another isn't).<br/>
1768
+ * </p>
1769
+ * @function
1770
+ * @param {cc.AffineTransform} additionalTransform The additional transform
1771
+ * @example
1772
+ * // create a batchNode
1773
+ * var batch = new cc.SpriteBatchNode("Icon-114.png");
1774
+ * this.addChild(batch);
1775
+ *
1776
+ * // create two sprites, spriteA will be added to batchNode, they are using different textures.
1777
+ * var spriteA = new cc.Sprite(batch->getTexture());
1778
+ * var spriteB = new cc.Sprite("Icon-72.png");
1779
+ *
1780
+ * batch.addChild(spriteA);
1781
+ *
1782
+ * // We can't make spriteB as spriteA's child since they use different textures. So just add it to layer.
1783
+ * // But we want to simulate `parent-child` relationship for these two node.
1784
+ * this.addChild(spriteB);
1785
+ *
1786
+ * //position
1787
+ * spriteA.setPosition(ccp(200, 200));
1788
+ *
1789
+ * // Gets the spriteA's transform.
1790
+ * var t = spriteA.getNodeToParentTransform();
1791
+ *
1792
+ * // Sets the additional transform to spriteB, spriteB's position will based on its pseudo parent i.e. spriteA.
1793
+ * spriteB.setAdditionalTransform(t);
1794
+ *
1795
+ * //scale
1796
+ * spriteA.setScale(2);
1797
+ *
1798
+ * // Gets the spriteA's transform.
1799
+ * t = spriteA.getNodeToParentTransform();
1800
+ *
1801
+ * // Sets the additional transform to spriteB, spriteB's scale will based on its pseudo parent i.e. spriteA.
1802
+ * spriteB.setAdditionalTransform(t);
1803
+ *
1804
+ * //rotation
1805
+ * spriteA.setRotation(20);
1806
+ *
1807
+ * // Gets the spriteA's transform.
1808
+ * t = spriteA.getNodeToParentTransform();
1809
+ *
1810
+ * // Sets the additional transform to spriteB, spriteB's rotation will based on its pseudo parent i.e. spriteA.
1811
+ * spriteB.setAdditionalTransform(t);
1812
+ */
1813
+ setAdditionalTransform: function (additionalTransform) {
1814
+ this._additionalTransform = additionalTransform;
1815
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
1816
+ this._additionalTransformDirty = true;
1817
+ },
1818
+
1819
+ /**
1820
+ * Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.<br/>
1821
+ * The matrix is in Pixels.
1822
+ * @function
1823
+ * @return {cc.AffineTransform}
1824
+ */
1825
+ getParentToNodeTransform: function () {
1826
+ this._renderCmd.getParentToNodeTransform();
1827
+ },
1828
+
1829
+ /**
1830
+ * @function
1831
+ * @deprecated since v3.0, please use getParentToNodeTransform instead
1832
+ */
1833
+ parentToNodeTransform: function () {
1834
+ return this.getParentToNodeTransform();
1835
+ },
1836
+
1837
+ /**
1838
+ * Returns the world affine transform matrix. The matrix is in Pixels.
1839
+ * @function
1840
+ * @return {cc.AffineTransform}
1841
+ */
1842
+ getNodeToWorldTransform: function () {
1843
+ //TODO renderCmd has a WorldTransform
1844
+ var t = this.getNodeToParentTransform();
1845
+ for (var p = this._parent; p != null; p = p.parent)
1846
+ t = cc.affineTransformConcat(t, p.getNodeToParentTransform());
1847
+ return t;
1848
+ },
1849
+
1850
+ /**
1851
+ * @function
1852
+ * @deprecated since v3.0, please use getNodeToWorldTransform instead
1853
+ */
1854
+ nodeToWorldTransform: function(){
1855
+ return this.getNodeToWorldTransform();
1856
+ },
1857
+
1858
+ /**
1859
+ * Returns the inverse world affine transform matrix. The matrix is in Pixels.
1860
+ * @function
1861
+ * @return {cc.AffineTransform}
1862
+ */
1863
+ getWorldToNodeTransform: function () {
1864
+ return cc.affineTransformInvert(this.getNodeToWorldTransform());
1865
+ },
1866
+
1867
+ /**
1868
+ * @function
1869
+ * @deprecated since v3.0, please use getWorldToNodeTransform instead
1870
+ */
1871
+ worldToNodeTransform: function () {
1872
+ return this.getWorldToNodeTransform();
1873
+ },
1874
+
1875
+ /**
1876
+ * Converts a Point to node (local) space coordinates. The result is in Points.
1877
+ * @function
1878
+ * @param {cc.Point} worldPoint
1879
+ * @return {cc.Point}
1880
+ */
1881
+ convertToNodeSpace: function (worldPoint) {
1882
+ return cc.pointApplyAffineTransform(worldPoint, this.getWorldToNodeTransform());
1883
+ },
1884
+
1885
+ /**
1886
+ * Converts a Point to world space coordinates. The result is in Points.
1887
+ * @function
1888
+ * @param {cc.Point} nodePoint
1889
+ * @return {cc.Point}
1890
+ */
1891
+ convertToWorldSpace: function (nodePoint) {
1892
+ nodePoint = nodePoint || cc.p(0,0);
1893
+ return cc.pointApplyAffineTransform(nodePoint, this.getNodeToWorldTransform());
1894
+ },
1895
+
1896
+ /**
1897
+ * Converts a Point to node (local) space coordinates. The result is in Points.<br/>
1898
+ * treating the returned/received node point as anchor relative.
1899
+ * @function
1900
+ * @param {cc.Point} worldPoint
1901
+ * @return {cc.Point}
1902
+ */
1903
+ convertToNodeSpaceAR: function (worldPoint) {
1904
+ return cc.pSub(this.convertToNodeSpace(worldPoint), this._renderCmd.getAnchorPointInPoints());
1905
+ },
1906
+
1907
+ /**
1908
+ * Converts a local Point to world space coordinates.The result is in Points.<br/>
1909
+ * treating the returned/received node point as anchor relative.
1910
+ * @function
1911
+ * @param {cc.Point} nodePoint
1912
+ * @return {cc.Point}
1913
+ */
1914
+ convertToWorldSpaceAR: function (nodePoint) {
1915
+ nodePoint = nodePoint || cc.p(0,0);
1916
+ var pt = cc.pAdd(nodePoint, this._renderCmd.getAnchorPointInPoints());
1917
+ return this.convertToWorldSpace(pt);
1918
+ },
1919
+
1920
+ _convertToWindowSpace: function (nodePoint) {
1921
+ var worldPoint = this.convertToWorldSpace(nodePoint);
1922
+ return cc.director.convertToUI(worldPoint);
1923
+ },
1924
+
1925
+ /** convenience methods which take a cc.Touch instead of cc.Point
1926
+ * @function
1927
+ * @param {cc.Touch} touch The touch object
1928
+ * @return {cc.Point}
1929
+ */
1930
+ convertTouchToNodeSpace: function (touch) {
1931
+ var point = touch.getLocation();
1932
+ return this.convertToNodeSpace(point);
1933
+ },
1934
+
1935
+ /**
1936
+ * converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
1937
+ * @function
1938
+ * @param {cc.Touch} touch The touch object
1939
+ * @return {cc.Point}
1940
+ */
1941
+ convertTouchToNodeSpaceAR: function (touch) {
1942
+ var point = cc.director.convertToGL(touch.getLocation());
1943
+ return this.convertToNodeSpaceAR(point);
1944
+ },
1945
+
1946
+ /**
1947
+ * Update will be called automatically every frame if "scheduleUpdate" is called when the node is "live".<br/>
1948
+ * The default behavior is to invoke the visit function of node's componentContainer.<br/>
1949
+ * Override me to implement your own update logic.
1950
+ * @function
1951
+ * @param {Number} dt Delta time since last update
1952
+ */
1953
+ update: function (dt) {
1954
+ if (this._componentContainer && !this._componentContainer.isEmpty())
1955
+ this._componentContainer.visit(dt);
1956
+ },
1957
+
1958
+ /**
1959
+ * <p>
1960
+ * Calls children's updateTransform() method recursively. <br/>
1961
+ * <br/>
1962
+ * This method is moved from CCSprite, so it's no longer specific to CCSprite. <br/>
1963
+ * As the result, you apply CCSpriteBatchNode's optimization on your customed CCNode. <br/>
1964
+ * e.g., batchNode->addChild(myCustomNode), while you can only addChild(sprite) before.
1965
+ * </p>
1966
+ * @function
1967
+ */
1968
+ updateTransform: function () {
1969
+ // Recursively iterate over children
1970
+ this._arrayMakeObjectsPerformSelector(this._children, cc.Node._stateCallbackType.updateTransform);
1971
+ },
1972
+
1973
+ /**
1974
+ * <p>Currently JavaScript Bindings (JSB), in some cases, needs to use retain and release. This is a bug in JSB,
1975
+ * and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB.
1976
+ * This is a hack, and should be removed once JSB fixes the retain/release bug<br/>
1977
+ * You will need to retain an object if you created an engine object and haven't added it into the scene graph during the same frame.<br/>
1978
+ * Otherwise, JSB's native autorelease pool will consider this object a useless one and release it directly,<br/>
1979
+ * when you want to use it later, a "Invalid Native Object" error will be raised.<br/>
1980
+ * The retain function can increase a reference count for the native object to avoid it being released,<br/>
1981
+ * you need to manually invoke release function when you think this object is no longer needed, otherwise, there will be memory learks.<br/>
1982
+ * retain and release function call should be paired in developer's game code.</p>
1983
+ * @function
1984
+ * @see cc.Node#release
1985
+ */
1986
+ retain: function () {
1987
+ },
1988
+ /**
1989
+ * <p>Currently JavaScript Bindings (JSB), in some cases, needs to use retain and release. This is a bug in JSB,
1990
+ * and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB.
1991
+ * This is a hack, and should be removed once JSB fixes the retain/release bug<br/>
1992
+ * You will need to retain an object if you created an engine object and haven't added it into the scene graph during the same frame.<br/>
1993
+ * Otherwise, JSB's native autorelease pool will consider this object a useless one and release it directly,<br/>
1994
+ * when you want to use it later, a "Invalid Native Object" error will be raised.<br/>
1995
+ * The retain function can increase a reference count for the native object to avoid it being released,<br/>
1996
+ * you need to manually invoke release function when you think this object is no longer needed, otherwise, there will be memory learks.<br/>
1997
+ * retain and release function call should be paired in developer's game code.</p>
1998
+ * @function
1999
+ * @see cc.Node#retain
2000
+ */
2001
+ release: function () {
2002
+ },
2003
+
2004
+ /**
2005
+ * Returns a component identified by the name given.
2006
+ * @function
2007
+ * @param {String} name The name to search for
2008
+ * @return {cc.Component} The component found
2009
+ */
2010
+ getComponent: function (name) {
2011
+ if(this._componentContainer)
2012
+ return this._componentContainer.getComponent(name);
2013
+ return null;
2014
+ },
2015
+
2016
+ /**
2017
+ * Adds a component to the node's component container.
2018
+ * @function
2019
+ * @param {cc.Component} component
2020
+ */
2021
+ addComponent: function (component) {
2022
+ if(this._componentContainer)
2023
+ this._componentContainer.add(component);
2024
+ },
2025
+
2026
+ /**
2027
+ * Removes a component identified by the given name or removes the component object given
2028
+ * @function
2029
+ * @param {String|cc.Component} component
2030
+ */
2031
+ removeComponent: function (component) {
2032
+ if(this._componentContainer)
2033
+ return this._componentContainer.remove(component);
2034
+ return false;
2035
+ },
2036
+
2037
+ /**
2038
+ * Removes all components of cc.Node, it called when cc.Node is exiting from stage.
2039
+ * @function
2040
+ */
2041
+ removeAllComponents: function () {
2042
+ if(this._componentContainer)
2043
+ this._componentContainer.removeAll();
2044
+ },
2045
+
2046
+ grid: null,
2047
+
2048
+ /**
2049
+ * Recursive method that visit its children and draw them
2050
+ * @function
2051
+ * @param {cc.Node.RenderCmd} parentCmd
2052
+ */
2053
+ visit: function(parentCmd){
2054
+ this._renderCmd.visit(parentCmd);
2055
+ },
2056
+
2057
+ /**
2058
+ * Performs view-matrix transformation based on position, scale, rotation and other attributes.
2059
+ * @function
2060
+ * @param {cc.Node.RenderCmd} parentCmd parent's render command
2061
+ * @param {boolean} recursive whether call its children's transform
2062
+ */
2063
+ transform: function(parentCmd, recursive){
2064
+ this._renderCmd.transform(parentCmd, recursive);
2065
+ },
2066
+
2067
+ /**
2068
+ * <p>Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
2069
+ * The matrix is in Pixels.</p>
2070
+ * @function
2071
+ * @return {cc.AffineTransform}
2072
+ * @deprecated since v3.0, please use getNodeToParentTransform instead
2073
+ */
2074
+ nodeToParentTransform: function(){
2075
+ return this.getNodeToParentTransform();
2076
+ },
2077
+
2078
+ /**
2079
+ * Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
2080
+ * The matrix is in Pixels.
2081
+ * @function
2082
+ * @return {cc.AffineTransform} The affine transform object
2083
+ */
2084
+ getNodeToParentTransform: function(){
2085
+ return this._renderCmd.getNodeToParentTransform();
2086
+ },
2087
+
2088
+ /**
2089
+ * Returns a camera object that lets you move the node using a gluLookAt
2090
+ * @function
2091
+ * @return {cc.Camera} A CCCamera object that lets you move the node using a gluLookAt
2092
+ * @deprecated since v3.0, no alternative function
2093
+ * @example
2094
+ * var camera = node.getCamera();
2095
+ * camera.setEye(0, 0, 415/2);
2096
+ * camera.setCenter(0, 0, 0);
2097
+ */
2098
+ getCamera: function () {
2099
+ if (!this._camera)
2100
+ this._camera = new cc.Camera();
2101
+ return this._camera;
2102
+ },
2103
+
2104
+ /**
2105
+ * <p>Returns a grid object that is used when applying effects.<br/>
2106
+ * This function have been deprecated, please use cc.NodeGrid to run grid actions</p>
2107
+ * @function
2108
+ * @return {cc.GridBase} A CCGrid object that is used when applying effects
2109
+ * @deprecated since v3.0, no alternative function
2110
+ */
2111
+ getGrid: function () {
2112
+ return this.grid;
2113
+ },
2114
+
2115
+ /**
2116
+ * <p>Changes a grid object that is used when applying effects<br/>
2117
+ * This function have been deprecated, please use cc.NodeGrid to run grid actions</p>
2118
+ * @function
2119
+ * @param {cc.GridBase} grid A CCGrid object that is used when applying effects
2120
+ * @deprecated since v3.0, no alternative function
2121
+ */
2122
+ setGrid: function (grid) {
2123
+ this.grid = grid;
2124
+ },
2125
+
2126
+ /**
2127
+ * Return the shader program currently used for this node
2128
+ * @function
2129
+ * @return {cc.GLProgram} The shader program currently used for this node
2130
+ */
2131
+ getShaderProgram: function () {
2132
+ return this._renderCmd.getShaderProgram();
2133
+ },
2134
+
2135
+ /**
2136
+ * <p>
2137
+ * Sets the shader program for this node
2138
+ *
2139
+ * Since v2.0, each rendering node must set its shader program.
2140
+ * It should be set in initialize phase.
2141
+ * </p>
2142
+ * @function
2143
+ * @param {cc.GLProgram} newShaderProgram The shader program which fetches from CCShaderCache.
2144
+ * @example
2145
+ * node.setGLProgram(cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR));
2146
+ */
2147
+ setShaderProgram: function (newShaderProgram) {
2148
+ this._renderCmd.setShaderProgram(newShaderProgram);
2149
+ },
2150
+
2151
+ /**
2152
+ * Returns the state of OpenGL server side.
2153
+ * @function
2154
+ * @return {Number} The state of OpenGL server side.
2155
+ * @deprecated since v3.0, no need anymore
2156
+ */
2157
+ getGLServerState: function () {
2158
+ return 0;
2159
+ },
2160
+
2161
+ /**
2162
+ * Sets the state of OpenGL server side.
2163
+ * @function
2164
+ * @param {Number} state The state of OpenGL server side.
2165
+ * @deprecated since v3.0, no need anymore
2166
+ */
2167
+ setGLServerState: function (state) {
2168
+ },
2169
+
2170
+ /**
2171
+ * Returns a "world" axis aligned bounding box of the node.
2172
+ * @function
2173
+ * @return {cc.Rect}
2174
+ */
2175
+ getBoundingBoxToWorld: function () {
2176
+ var rect = cc.rect(0, 0, this._contentSize.width, this._contentSize.height);
2177
+ var trans = this.getNodeToWorldTransform();
2178
+ rect = cc.rectApplyAffineTransform(rect, trans);
2179
+
2180
+ //query child's BoundingBox
2181
+ if (!this._children)
2182
+ return rect;
2183
+
2184
+ var locChildren = this._children;
2185
+ for (var i = 0; i < locChildren.length; i++) {
2186
+ var child = locChildren[i];
2187
+ if (child && child._visible) {
2188
+ var childRect = child._getBoundingBoxToCurrentNode(trans);
2189
+ if (childRect)
2190
+ rect = cc.rectUnion(rect, childRect);
2191
+ }
2192
+ }
2193
+ return rect;
2194
+ },
2195
+
2196
+ _getBoundingBoxToCurrentNode: function (parentTransform) {
2197
+ var rect = cc.rect(0, 0, this._contentSize.width, this._contentSize.height);
2198
+ var trans = (parentTransform == null) ? this.getNodeToParentTransform() : cc.affineTransformConcat(this.getNodeToParentTransform(), parentTransform);
2199
+ rect = cc.rectApplyAffineTransform(rect, trans);
2200
+
2201
+ //query child's BoundingBox
2202
+ if (!this._children)
2203
+ return rect;
2204
+
2205
+ var locChildren = this._children;
2206
+ for (var i = 0; i < locChildren.length; i++) {
2207
+ var child = locChildren[i];
2208
+ if (child && child._visible) {
2209
+ var childRect = child._getBoundingBoxToCurrentNode(trans);
2210
+ if (childRect)
2211
+ rect = cc.rectUnion(rect, childRect);
2212
+ }
2213
+ }
2214
+ return rect;
2215
+ },
2216
+
2217
+ /**
2218
+ * Returns the opacity of Node
2219
+ * @function
2220
+ * @returns {number} opacity
2221
+ */
2222
+ getOpacity: function () {
2223
+ return this._realOpacity;
2224
+ },
2225
+
2226
+ /**
2227
+ * Returns the displayed opacity of Node,
2228
+ * the difference between displayed opacity and opacity is that displayed opacity is calculated based on opacity and parent node's opacity when cascade opacity enabled.
2229
+ * @function
2230
+ * @returns {number} displayed opacity
2231
+ */
2232
+ getDisplayedOpacity: function () {
2233
+ return this._renderCmd.getDisplayedOpacity();
2234
+ },
2235
+
2236
+ /**
2237
+ * Sets the opacity of Node
2238
+ * @function
2239
+ * @param {Number} opacity
2240
+ */
2241
+ setOpacity: function (opacity) {
2242
+ this._realOpacity = opacity;
2243
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty);
2244
+ },
2245
+
2246
+ /**
2247
+ * Update displayed opacity
2248
+ * @function
2249
+ * @param {Number} parentOpacity
2250
+ */
2251
+ updateDisplayedOpacity: function (parentOpacity) {
2252
+ //TODO this API shouldn't be public.
2253
+ this._renderCmd._updateDisplayOpacity(parentOpacity);
2254
+ },
2255
+
2256
+ /**
2257
+ * Returns whether node's opacity value affect its child nodes.
2258
+ * @function
2259
+ * @returns {boolean}
2260
+ */
2261
+ isCascadeOpacityEnabled: function () {
2262
+ return this._cascadeOpacityEnabled;
2263
+ },
2264
+
2265
+ /**
2266
+ * Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
2267
+ * @function
2268
+ * @param {boolean} cascadeOpacityEnabled
2269
+ */
2270
+ setCascadeOpacityEnabled: function (cascadeOpacityEnabled) {
2271
+ if (this._cascadeOpacityEnabled === cascadeOpacityEnabled)
2272
+ return;
2273
+ this._cascadeOpacityEnabled = cascadeOpacityEnabled;
2274
+ this._renderCmd.setCascadeOpacityEnabledDirty();
2275
+ },
2276
+
2277
+ /**
2278
+ * Returns the color of Node
2279
+ * @function
2280
+ * @returns {cc.Color}
2281
+ */
2282
+ getColor: function () {
2283
+ var locRealColor = this._realColor;
2284
+ return cc.color(locRealColor.r, locRealColor.g, locRealColor.b, locRealColor.a);
2285
+ },
2286
+
2287
+ /**
2288
+ * Returns the displayed color of Node,
2289
+ * the difference between displayed color and color is that displayed color is calculated based on color and parent node's color when cascade color enabled.
2290
+ * @function
2291
+ * @returns {cc.Color}
2292
+ */
2293
+ getDisplayedColor: function () {
2294
+ return this._renderCmd.getDisplayedColor();
2295
+ },
2296
+
2297
+ /**
2298
+ * <p>Sets the color of Node.<br/>
2299
+ * When color doesn't include opacity value like cc.color(128,128,128), this function only change the color. <br/>
2300
+ * When color include opacity like cc.color(128,128,128,100), then this function will change the color and the opacity.</p>
2301
+ * @function
2302
+ * @param {cc.Color} color The new color given
2303
+ */
2304
+ setColor: function (color) {
2305
+ var locRealColor = this._realColor;
2306
+ locRealColor.r = color.r;
2307
+ locRealColor.g = color.g;
2308
+ locRealColor.b = color.b;
2309
+ this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);
2310
+ },
2311
+
2312
+ /**
2313
+ * Update the displayed color of Node
2314
+ * @function
2315
+ * @param {cc.Color} parentColor
2316
+ */
2317
+ updateDisplayedColor: function (parentColor) {
2318
+ //TODO this API shouldn't be public.
2319
+ this._renderCmd._updateDisplayColor(parentColor);
2320
+ },
2321
+
2322
+ /**
2323
+ * Returns whether node's color value affect its child nodes.
2324
+ * @function
2325
+ * @returns {boolean}
2326
+ */
2327
+ isCascadeColorEnabled: function () {
2328
+ return this._cascadeColorEnabled;
2329
+ },
2330
+
2331
+ /**
2332
+ * Enable or disable cascade color, if cascade enabled, child nodes' opacity will be the cascade value of parent color and its own color.
2333
+ * @param {boolean} cascadeColorEnabled
2334
+ */
2335
+ setCascadeColorEnabled: function (cascadeColorEnabled) {
2336
+ if (this._cascadeColorEnabled === cascadeColorEnabled)
2337
+ return;
2338
+ this._cascadeColorEnabled = cascadeColorEnabled;
2339
+ this._renderCmd.setCascadeColorEnabledDirty();
2340
+ },
2341
+
2342
+ /**
2343
+ * Set whether color should be changed with the opacity value,
2344
+ * useless in cc.Node, but this function is override in some class to have such behavior.
2345
+ * @function
2346
+ * @param {Boolean} opacityValue
2347
+ */
2348
+ setOpacityModifyRGB: function (opacityValue) {
2349
+ },
2350
+
2351
+ /**
2352
+ * Get whether color should be changed with the opacity value
2353
+ * @function
2354
+ * @return {Boolean}
2355
+ */
2356
+ isOpacityModifyRGB: function () {
2357
+ return false;
2358
+ },
2359
+
2360
+ _initRendererCmd: function(){
2361
+ this._renderCmd = cc.renderer.getRenderCmd(this);
2362
+ },
2363
+
2364
+ _createRenderCmd: function(){
2365
+ if(cc._renderType === cc._RENDER_TYPE_CANVAS)
2366
+ return new cc.Node.CanvasRenderCmd(this);
2367
+ else
2368
+ return new cc.Node.WebGLRenderCmd(this);
2369
+ }
2370
+ });
2371
+
2372
+ /**
2373
+ * Allocates and initializes a node.
2374
+ * @deprecated since v3.0, please use new construction instead.
2375
+ * @see cc.Node
2376
+ * @return {cc.Node}
2377
+ */
2378
+ cc.Node.create = function () {
2379
+ return new cc.Node();
2380
+ };
2381
+
2382
+ cc.Node._stateCallbackType = {onEnter: 1, onExit: 2, cleanup: 3, onEnterTransitionDidFinish: 4, updateTransform: 5, onExitTransitionDidStart: 6, sortAllChildren: 7};
2383
+
2384
+ cc.assert(cc.isFunction(cc._tmp.PrototypeCCNode), cc._LogInfos.MissingFile, "BaseNodesPropertyDefine.js");
2385
+ cc._tmp.PrototypeCCNode();
2386
+ delete cc._tmp.PrototypeCCNode;