diff --git a/CCBoot.js b/CCBoot.js index 9490bc2b77..24a0890304 100644 --- a/CCBoot.js +++ b/CCBoot.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -81,12 +82,7 @@ function _determineRenderType(config) { function _afterEngineLoaded() { cc._engineLoaded = true; - if (CC_EDITOR) { - Editor.log(cc.ENGINE_VERSION); - } - else { - console.log(cc.ENGINE_VERSION); - } + console.log('Cocos Creator v' + cc.ENGINE_VERSION); if (_engineLoadedCallback) _engineLoadedCallback(); } diff --git a/CCDebugger.js b/CCDebugger.js index ff6cd42921..dcbf1cb36e 100644 --- a/CCDebugger.js +++ b/CCDebugger.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -100,7 +101,7 @@ cc.DebugMode = Enum({ */ cc._initDebugSetting = function (mode) { // reset - cc.log = cc.warn = cc.error = cc._throw = cc.assert = function () { }; + cc.log = cc.warn = cc.error = cc.assert = function () { }; if (mode === cc.DebugMode.NONE) return; diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 14124a4cdc..6c0475d26c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -223,7 +223,7 @@ Cocos2d-JS v3.4 Beta0 @ March 19 2015 * Bug fixes: 1. Added `getSpriteFrame` to `cc.Sprite` to fix API inconsistency. - 2. Added `getObejct` to `cc.TMXObjectGroup` to fix API inconsistency. + 2. Added `getObject` to `cc.TMXObjectGroup` to fix API inconsistency. 3. Added `addImageAsync` to `cc.textureCache` to fix API inconsistency. 4. Fixed a bug of `cc.text` that its default font name is incorrect. 5. Fixed a bug of `ccui.PageView` that its `getPage` doesn't work. diff --git a/DebugInfos.js b/DebugInfos.js index bcf039bce6..27f46d7b02 100644 --- a/DebugInfos.js +++ b/DebugInfos.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + if (CC_DEBUG) { module.exports = { // Common @@ -79,6 +104,7 @@ if (CC_DEBUG) { "1509": "Argument target must be non-nullptr", //isScheduled "1510": "cc.Scheduler: Illegal target which doesn't have uuid or instanceId", "1511": "cc.Scheduler: pause state of the scheduled task doesn't match the element pause state in Scheduler, the given paused state will be ignored", + "1512": "cc.Scheduler: updateFunc parameter is deprecated in scheduleUpdate function, and will be removed in v2.0", //Node: 1600 "1600": "getZOrder is deprecated. Please use getLocalZOrder instead.", //getZOrder "1601": "setZOrder is deprecated. Please use setLocalZOrder instead.", //setZOrder @@ -256,7 +282,8 @@ if (CC_DEBUG) { "3115": "Frame Grabber: could not attach texture to framebuffer", //CCGrabber.grab "3116": "WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures", //setTexParameters "3117": "Mimpap texture only works in POT textures", //generateMipmap - "3118": "Lazy init texture with image element failed due to image loading failure: %s", + "3118": "contentSize parameter is deprecated and ignored for cc.Texture2D initWithData function", // initWithData + "3119": "Lazy init texture with image element failed due to image loading failure: %s", //RectWidth: 3300 "3300": "Rect width exceeds maximum margin: %s, max x: %s, texture width: %s", //RectWidth //RectHeight: 3400 @@ -389,6 +416,7 @@ if (CC_DEBUG) { "3818": "Failed to read or parse project.json", //_loadConfig "3819": "Warning: target element is not a DIV or CANVAS", //_initRenderer "3820": "The renderer doesn't support the renderMode %s", //_initRenderer + "3821": "Cannot change hierarchy while activating or deactivating the parent.", //Animation: 3900 "3900": "Invalid clip to add", //addClip "3901": "Invalid clip to remove", //removeClip diff --git a/README.md b/README.md index 45f2f6b14b..b35ad76025 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The framework is naturally integrated with Cocos Creator, so it's not designed t ### Prerequisite -- Install [node.js v4.2.1+](https://nodejs.org/) +- Install [node.js v8.0.0+](https://nodejs.org/) - Install [gulp-cli v3.9.0+](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md) ### Install @@ -38,7 +38,7 @@ gulp build #### Prerequisite - Install [express](http://expressjs.com/): `npm install express` - - Install gulp-qunit: `npm install gulp-qunit@1.3.0` + - Install gulp-qunit: `npm install gulp-qunit` #### Unit Test @@ -84,7 +84,7 @@ npm test * [Official site](http://cocos2d-x.org/creator) * [Download](http://cocos2d-x.org/download) -* [Documentation](http://cocos2d-x.org/docs/editors_and_tools/creator/index.html) -* [API References](http://cocos2d-x.org/docs/api-ref/creator/v1.0/) +* [Documentation](http://www.cocos2d-x.org/docs/creator/manual/en/) +* [API References](http://www.cocos2d-x.org/docs/creator/api/en/) * [Forum](http://discuss.cocos2d-x.org/c/editors-and-tools/cocos-creator) -* [Road Map](http://discuss.cocos2d-x.org/t/cocos-creator-roadmap) +* [Road Map](https://trello.com/b/JWVRRxMG/cocos-creator-roadmap) diff --git a/cocos2d/actions/CCAction.js b/cocos2d/actions/CCAction.js index de8e24fec6..487e4e3e91 100644 --- a/cocos2d/actions/CCAction.js +++ b/cocos2d/actions/CCAction.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/actions/CCActionCatmullRom.js b/cocos2d/actions/CCActionCatmullRom.js index b7c1024de7..9fd927809c 100644 --- a/cocos2d/actions/CCActionCatmullRom.js +++ b/cocos2d/actions/CCActionCatmullRom.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. Copyright (c) 2008 Radu Gruian Copyright (c) 2011 Vit Valentin diff --git a/cocos2d/actions/CCActionEase.js b/cocos2d/actions/CCActionEase.js index 81399ac8d1..07f8b20842 100644 --- a/cocos2d/actions/CCActionEase.js +++ b/cocos2d/actions/CCActionEase.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -271,7 +272,7 @@ cc.easeSineInOut = function(){ /** * !#en - * Creates the action easing obejct with the period in radians (default is 0.3).
+ * Creates the action easing object with the period in radians (default is 0.3).
* Reference easeInElastic:
* http://www.zhihu.com/question/21981571/answer/19925418 * !#zh diff --git a/cocos2d/actions/CCActionInstant.js b/cocos2d/actions/CCActionInstant.js index b90b3bb3b6..a9bc8dde79 100644 --- a/cocos2d/actions/CCActionInstant.js +++ b/cocos2d/actions/CCActionInstant.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/actions/CCActionInterval.js b/cocos2d/actions/CCActionInterval.js index d60900712c..221c05cd21 100644 --- a/cocos2d/actions/CCActionInterval.js +++ b/cocos2d/actions/CCActionInterval.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/actions/CCActionManager.js b/cocos2d/actions/CCActionManager.js index a7bf49a735..6e2e4a4576 100644 --- a/cocos2d/actions/CCActionManager.js +++ b/cocos2d/actions/CCActionManager.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/actions/index.js b/cocos2d/actions/index.js index ed6f20abc1..52557a1c17 100644 --- a/cocos2d/actions/index.js +++ b/cocos2d/actions/index.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + require('./CCActionManager'); require('./CCAction'); require('./CCActionInterval'); diff --git a/cocos2d/animation/animation-animator.js b/cocos2d/animation/animation-animator.js index 1e48cdd4f5..3d6b4ace39 100644 --- a/cocos2d/animation/animation-animator.js +++ b/cocos2d/animation/animation-animator.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var js = cc.js; var Playable = require('./playable'); var DynamicAnimCurve = require('./animation-curves').DynamicAnimCurve; diff --git a/cocos2d/animation/animation-clip.js b/cocos2d/animation/animation-clip.js index f6004d0c35..5eecfd7f08 100644 --- a/cocos2d/animation/animation-clip.js +++ b/cocos2d/animation/animation-clip.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + /** * !#en Class for animation data handling. diff --git a/cocos2d/animation/animation-curves.js b/cocos2d/animation/animation-curves.js index 2b226b209c..e883e59052 100644 --- a/cocos2d/animation/animation-curves.js +++ b/cocos2d/animation/animation-curves.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var bezierByTime = require('./bezier').bezierByTime; diff --git a/cocos2d/animation/animation-manager.js b/cocos2d/animation/animation-manager.js index 29f53ad4ff..83dbdf13bf 100644 --- a/cocos2d/animation/animation-manager.js +++ b/cocos2d/animation/animation-manager.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var js = cc.js; var AnimationManager = cc.Class({ diff --git a/cocos2d/animation/bezier.js b/cocos2d/animation/bezier.js index 0f284f1827..f5dea5176a 100644 --- a/cocos2d/animation/bezier.js +++ b/cocos2d/animation/bezier.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + //var bezier = (function () { // function B1 (t) { return (t * t * t); } // function B2 (t) { return (3 * t * t * (1 - t)); } diff --git a/cocos2d/animation/easing.js b/cocos2d/animation/easing.js index 5bd051dc68..f17aadfde4 100644 --- a/cocos2d/animation/easing.js +++ b/cocos2d/animation/easing.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var Easing = { constant: function () { return 0; }, linear: function (k) { return k; }, diff --git a/cocos2d/animation/index.js b/cocos2d/animation/index.js index d09cdd0244..224528caaa 100644 --- a/cocos2d/animation/index.js +++ b/cocos2d/animation/index.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + require('./bezier'); require('./easing'); require('./types'); diff --git a/cocos2d/animation/motion-path-helper.js b/cocos2d/animation/motion-path-helper.js index 130a3acfad..604b7f9108 100644 --- a/cocos2d/animation/motion-path-helper.js +++ b/cocos2d/animation/motion-path-helper.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var DynamicAnimCurve = require('./animation-curves').DynamicAnimCurve; var computeRatioByType = require('./animation-curves').computeRatioByType; diff --git a/cocos2d/animation/playable.js b/cocos2d/animation/playable.js index 48746f068c..77a7350f2b 100644 --- a/cocos2d/animation/playable.js +++ b/cocos2d/animation/playable.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var js = cc.js; /** diff --git a/cocos2d/animation/types.js b/cocos2d/animation/types.js index f5f4d6803c..50500b0457 100644 --- a/cocos2d/animation/types.js +++ b/cocos2d/animation/types.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var JS = cc.js; var WrapModeMask = { diff --git a/cocos2d/audio/CCAudio.js b/cocos2d/audio/CCAudio.js index 4f0192d16b..acc2b101b8 100644 --- a/cocos2d/audio/CCAudio.js +++ b/cocos2d/audio/CCAudio.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -43,6 +44,8 @@ var Audio = function (src) { this._state = Audio.State.INITIALZING; this._loaded = false; + this._isLoading = false; + this._onended = function () { this.emit('ended'); }.bind(this); @@ -88,6 +91,11 @@ Audio.State = { proto.preload = function () { var src = this._src, audio = this; + if (this._isLoading) { + return; + } + this._isLoading = true; + if (!src) { this._src = ''; this._audioType = Audio.Type.UNKNOWN; @@ -104,15 +112,15 @@ Audio.State = { } // If the resource does not exist - if (!item) { + if (!item || !item.complete) { return cc.loader.load(src, function (error) { - if (!error) { + if (!error && src === audio._src) { var item = cc.loader.getItem(src); audio.mount(item.element || item.buffer); audio.emit('load'); } }); - } else if (item.complete) { + } else { audio.mount(item.element || item.buffer); audio.emit('load'); } @@ -175,6 +183,12 @@ Audio.State = { }); }; + proto.destroy = function () { + if (CC_WECHATGAME) { + this._element.destroy(); + } + }; + proto.pause = function () { if (!this._element) return; this._unbindEnded(); @@ -266,6 +280,9 @@ Audio.State = { return this._src; }); proto.__defineSetter__('src', function (string) { + if (string !== this._src) { + this._isLoading = false; + } return this._src = string; }); @@ -282,9 +299,17 @@ var WebAudioElement = function (buffer, audio) { this._audio = audio; this._context = sys.__audioSupport.context; this._buffer = buffer; - this._volume = this._context['createGain'](); - this._volume['gain'].value = 1; - this._volume['connect'](this._context['destination']); + + this._gainObj = this._context['createGain'](); + this._volume = 1; + // https://www.chromestatus.com/features/5287995770929152 + if (this._gainObj['gain'].setTargetAtTime) { + this._gainObj['gain'].setTargetAtTime(this._volume, this._context.currentTime, 0.01); + } else { + this._gainObj['gain'].value = 1; + } + this._gainObj['connect'](this._context['destination']); + this._loop = false; // The time stamp on the audio time axis when the recording begins to play. this._startTime = -1; @@ -313,7 +338,7 @@ var WebAudioElement = function (buffer, audio) { var audio = this._context["createBufferSource"](); audio.buffer = this._buffer; - audio["connect"](this._volume); + audio["connect"](this._gainObj); audio.loop = this._loop; this._startTime = this._context.currentTime; @@ -398,9 +423,16 @@ var WebAudioElement = function (buffer, audio) { return this._loop = bool; }); - proto.__defineGetter__('volume', function () { return this._volume['gain'].value; }); + proto.__defineGetter__('volume', function () { + return this._volume; + }); proto.__defineSetter__('volume', function (num) { - this._volume['gain'].value = num; + this._volume = num; + if (this._gainObj['gain'].setTargetAtTime) { + this._gainObj['gain'].setTargetAtTime(this._volume, this._context.currentTime, 0.01); + } else { + this._volume['gain'].value = num; + } if (sys.os === sys.OS_IOS && !this.paused && this._currentSource) { // IOS must be stop webAudio this._currentSource.onended = null; diff --git a/cocos2d/audio/CCAudioEngine.js b/cocos2d/audio/CCAudioEngine.js index cae1ab56ff..7da15bb163 100644 --- a/cocos2d/audio/CCAudioEngine.js +++ b/cocos2d/audio/CCAudioEngine.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -426,6 +427,7 @@ var audioEngine = { var audio = id2audio[id]; if (audio) { audio.stop(); + audio.destroy(); delete id2audio[id]; } } @@ -440,6 +442,12 @@ var audioEngine = { */ uncacheAll: function () { this.stopAll(); + for (var id in id2audio) { + var audio = id2audio[id]; + if (audio) { + audio.destroy(); + } + } id2audio = js.createMap(true); url2id = {}; }, diff --git a/cocos2d/audio/deprecated.js b/cocos2d/audio/deprecated.js index 747f283fa5..81f360a479 100644 --- a/cocos2d/audio/deprecated.js +++ b/cocos2d/audio/deprecated.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js index a999e9696e..d3fa821bd0 100644 --- a/cocos2d/core/CCDirector.js +++ b/cocos2d/core/CCDirector.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/CCGame.js b/cocos2d/core/CCGame.js index b3c1f7ea6c..7475d4a946 100644 --- a/cocos2d/core/CCGame.js +++ b/cocos2d/core/CCGame.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -31,7 +32,7 @@ if (!(CC_EDITOR && Editor.isMainProcess)) { require('../audio/CCAudioEngine'); var renderer = require('./renderer'); -var inputManager = require('./platform/CCInputManager'); +var inputManager = CC_QQPLAY ? require('./platform/BKInputManager') : require('./platform/CCInputManager'); /** * !#en An object to boot the game. @@ -681,13 +682,19 @@ var game = { var el = this.config[game.CONFIG_KEY.id], win = window, localCanvas, localContainer, - isWeChatGame = cc.sys.platform === cc.sys.WECHAT_GAME; + isWeChatGame = cc.sys.platform === cc.sys.WECHAT_GAME, + isQQPlay = cc.sys.platform === cc.sys.QQ_PLAY; if (isWeChatGame) { this.container = localContainer = document.createElement("DIV"); this.frame = localContainer.parentNode === document.body ? document.documentElement : localContainer.parentNode; this.canvas = localCanvas = canvas; } + else if (isQQPlay) { + this.container = cc.container = document.createElement("DIV"); + this.frame = document.documentElement; + this.canvas = localCanvas = canvas; + } else { var element = (el instanceof HTMLElement) ? el : (document.querySelector(el) || document.querySelector('#' + el)); @@ -734,6 +741,8 @@ var game = { if (game.renderType === game.RENDER_TYPE_WEBGL) { var opts = { 'stencil': true, + // MSAA is causing serious performance dropdown on some browsers, + // it's temporarily desactivated until we found correct way to let user customize it. 'antialias': false, 'alpha': cc.macro.ENABLE_TRANSPARENT_CANVAS }; diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 5ac242d20e..d82dcab45b 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -1,5 +1,6 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -214,6 +215,23 @@ var _touchEndHandler = function (touch, event) { Event.EventTouch.pool.put(event); } }; +var _touchCancelHandler = function (touch, event) { + if (CC_JSB) { + event = Event.EventTouch.pool.get(event); + } + var pos = touch.getLocation(); + var node = this.owner; + + event.type = EventType.TOUCH_CANCEL; + event.touch = touch; + event.bubbles = true; + node.dispatchEvent(event); + if (CC_JSB) { + event.touch = null; + event._touches = null; + Event.EventTouch.pool.put(event); + } +}; var _mouseDownHandler = function (event) { var pos = event.getLocation(); @@ -1174,7 +1192,8 @@ var Node = cc.Class({ mask: _searchMaskInParent(this), onTouchBegan: _touchStartHandler, onTouchMoved: _touchMoveHandler, - onTouchEnded: _touchEndHandler + onTouchEnded: _touchEndHandler, + onTouchCancelled: _touchCancelHandler }); eventManager.addListener(this._touchListener, this); newAdded = true; diff --git a/cocos2d/core/CCScene.js b/cocos2d/core/CCScene.js index 6da5fdc41d..da03a5c525 100644 --- a/cocos2d/core/CCScene.js +++ b/cocos2d/core/CCScene.js @@ -1,5 +1,6 @@ /**************************************************************************** - Copyright (c) 2015 Chukong Technologies Inc. + Copyright (c) 2015-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/CCScheduler.js b/cocos2d/core/CCScheduler.js index 4388937e17..14629ee1d0 100644 --- a/cocos2d/core/CCScheduler.js +++ b/cocos2d/core/CCScheduler.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCAsset.js b/cocos2d/core/assets/CCAsset.js index dfb79825f2..39aac96e40 100644 --- a/cocos2d/core/assets/CCAsset.js +++ b/cocos2d/core/assets/CCAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCAudioClip.js b/cocos2d/core/assets/CCAudioClip.js index 68b48f23a5..f5f23332bd 100644 --- a/cocos2d/core/assets/CCAudioClip.js +++ b/cocos2d/core/assets/CCAudioClip.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCBitmapFont.js b/cocos2d/core/assets/CCBitmapFont.js index 20c2f0df02..45340968c6 100644 --- a/cocos2d/core/assets/CCBitmapFont.js +++ b/cocos2d/core/assets/CCBitmapFont.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCFont.js b/cocos2d/core/assets/CCFont.js index b8c0d747ed..bd86f4a1ec 100644 --- a/cocos2d/core/assets/CCFont.js +++ b/cocos2d/core/assets/CCFont.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCLabelAtlas.js b/cocos2d/core/assets/CCLabelAtlas.js index 08c5311916..dd4e63005b 100644 --- a/cocos2d/core/assets/CCLabelAtlas.js +++ b/cocos2d/core/assets/CCLabelAtlas.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCPrefab.js b/cocos2d/core/assets/CCPrefab.js index 30c2a897a4..4385ff6cf7 100644 --- a/cocos2d/core/assets/CCPrefab.js +++ b/cocos2d/core/assets/CCPrefab.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCRawAsset.js b/cocos2d/core/assets/CCRawAsset.js index 3d88488e78..cc95baa135 100644 --- a/cocos2d/core/assets/CCRawAsset.js +++ b/cocos2d/core/assets/CCRawAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCSceneAsset.js b/cocos2d/core/assets/CCSceneAsset.js index 783aa56502..f22c6f9fe7 100644 --- a/cocos2d/core/assets/CCSceneAsset.js +++ b/cocos2d/core/assets/CCSceneAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCScripts.js b/cocos2d/core/assets/CCScripts.js index 76876a1a1c..22f8a10e82 100644 --- a/cocos2d/core/assets/CCScripts.js +++ b/cocos2d/core/assets/CCScripts.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCSpriteAtlas.js b/cocos2d/core/assets/CCSpriteAtlas.js index 0d65529fe7..5d6949928c 100644 --- a/cocos2d/core/assets/CCSpriteAtlas.js +++ b/cocos2d/core/assets/CCSpriteAtlas.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCTTFFont.js b/cocos2d/core/assets/CCTTFFont.js index c496679846..bb6df9d60e 100644 --- a/cocos2d/core/assets/CCTTFFont.js +++ b/cocos2d/core/assets/CCTTFFont.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/CCTextAsset.js b/cocos2d/core/assets/CCTextAsset.js index 4a5627c342..b4f33cd0c0 100644 --- a/cocos2d/core/assets/CCTextAsset.js +++ b/cocos2d/core/assets/CCTextAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/assets/index.js b/cocos2d/core/assets/index.js index c26eb37368..3bfde19508 100644 --- a/cocos2d/core/assets/index.js +++ b/cocos2d/core/assets/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/base-ui/CCWidgetManager.js b/cocos2d/core/base-ui/CCWidgetManager.js index d6d6c355f3..b6334eacd8 100644 --- a/cocos2d/core/base-ui/CCWidgetManager.js +++ b/cocos2d/core/base-ui/CCWidgetManager.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -32,6 +33,12 @@ var RIGHT = 1 << 5; var HORIZONTAL = LEFT | CENTER | RIGHT; var VERTICAL = TOP | MID | BOT; +var AlignMode = cc.Enum({ + ONCE: 0, + ON_WINDOW_RESIZE: 1, + ALWAYS: 2, +}); + // returns a readonly size of the node function getReadonlyNodeSize (parent) { if (parent instanceof cc.Scene) { @@ -233,7 +240,7 @@ function visitNode (node) { } } align(node, widget); - if ((!CC_EDITOR || animationState.animatedSinceLastFrame) && widget.isAlignOnce) { + if ((!CC_EDITOR || animationState.animatedSinceLastFrame) && widget.alignMode !== AlignMode.ALWAYS) { widget.enabled = false; } else { @@ -292,7 +299,10 @@ function refreshScene () { for (i = activeWidgets.length - 1; i >= 0; i--) { widget = activeWidgets[i]; var node = widget.node; - if (widget.isAlignOnce && animationState.animatedSinceLastFrame && node.isChildOf(editingNode)) { + if (widget.alignMode !== AlignMode.ALWAYS && + animationState.animatedSinceLastFrame && + node.isChildOf(editingNode) + ) { // widget contains in activeWidgets should aligned at least once widget.enabled = false; } @@ -434,6 +444,21 @@ var widgetManager = cc._widgetManager = module.exports = { init: function (director) { director.on(cc.Director.EVENT_BEFORE_VISIT, refreshScene); + + if (CC_EDITOR && cc.engine) { + cc.engine.on('design-resolution-changed', this.onResized.bind(this)); + } + else if (!CC_JSB) { + if (cc.sys.isMobile) { + window.addEventListener('resize', this.onResized.bind(this)); + } + else { + cc.eventManager.addCustomListener('canvas-resize', this.onResized.bind(this)); + } + } + else { + cc.eventManager.addListener(this.onResized.bind(this), 1); + } }, add: function (widget) { widget.node._widget = widget; @@ -451,7 +476,28 @@ var widgetManager = cc._widgetManager = module.exports = { widget.node.off('size-changed', adjustWidgetToAllowResizingInEditor, widget); } }, - updateAlignment: updateAlignment + onResized () { + var scene = cc.director.getScene(); + if (scene) { + this.refreshWidgetOnResized(scene); + } + }, + refreshWidgetOnResized (node) { + var widget = cc.Node.isNode(node) && node.getComponent(cc.Widget); + if (widget) { + if (widget.alignMode === AlignMode.ON_WINDOW_RESIZE) { + widget.enabled = true; + } + } + + var children = node._children; + for (var i = 0; i < children.length; i++) { + var child = children[i]; + this.refreshWidgetOnResized(child); + } + }, + updateAlignment: updateAlignment, + AlignMode: AlignMode, }; if (CC_EDITOR) { diff --git a/cocos2d/core/camera/CCCamera.js b/cocos2d/core/camera/CCCamera.js index bccba8ef51..61555aef0d 100644 --- a/cocos2d/core/camera/CCCamera.js +++ b/cocos2d/core/camera/CCCamera.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/collider/CCBoxCollider.js b/cocos2d/core/collider/CCBoxCollider.js index baa52ab7e2..25a3265211 100644 --- a/cocos2d/core/collider/CCBoxCollider.js +++ b/cocos2d/core/collider/CCBoxCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/collider/CCCircleCollider.js b/cocos2d/core/collider/CCCircleCollider.js index e5264225da..54006a0c4a 100644 --- a/cocos2d/core/collider/CCCircleCollider.js +++ b/cocos2d/core/collider/CCCircleCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/collider/CCCollider.js b/cocos2d/core/collider/CCCollider.js index 7e8cfd1e91..af9eb39ac9 100644 --- a/cocos2d/core/collider/CCCollider.js +++ b/cocos2d/core/collider/CCCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/collider/CCCollisionManager.js b/cocos2d/core/collider/CCCollisionManager.js index da70194036..4b863cbab2 100644 --- a/cocos2d/core/collider/CCCollisionManager.js +++ b/cocos2d/core/collider/CCCollisionManager.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + const Contact = require('./CCContact'); const affineTrans = require('../value-types/CCAffineTransform'); const CollisionType = Contact.CollisionType; diff --git a/cocos2d/core/collider/CCContact.js b/cocos2d/core/collider/CCContact.js index 8cb1922f52..d975171836 100644 --- a/cocos2d/core/collider/CCContact.js +++ b/cocos2d/core/collider/CCContact.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var Intersection = require('./CCIntersection'); diff --git a/cocos2d/core/collider/CCIntersection.js b/cocos2d/core/collider/CCIntersection.js index 80fbb6fa6a..600077025a 100644 --- a/cocos2d/core/collider/CCIntersection.js +++ b/cocos2d/core/collider/CCIntersection.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + /** * !#en Intersection helper class * !#zh 辅助类,用于测试形状与形状是否相交 diff --git a/cocos2d/core/collider/CCPolygonCollider.js b/cocos2d/core/collider/CCPolygonCollider.js index d7b12c7337..a017c358d4 100644 --- a/cocos2d/core/collider/CCPolygonCollider.js +++ b/cocos2d/core/collider/CCPolygonCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -58,7 +59,7 @@ cc.Collider.Polygon = cc.Class({ * !#en Polygon points * !#zh 多边形顶点数组 * @property points - * @type {[Vec2]} + * @type {Vec2[]} */ points: { tooltip: CC_DEV && 'i18n:COMPONENT.physics.physics_collider.points', diff --git a/cocos2d/core/collider/index.js b/cocos2d/core/collider/index.js index e772ebee6c..98873d2ee9 100644 --- a/cocos2d/core/collider/index.js +++ b/cocos2d/core/collider/index.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + require('./CCCollisionManager'); require('./CCCollider'); diff --git a/cocos2d/core/component-scheduler.js b/cocos2d/core/component-scheduler.js index b910c23c70..6c0582bf18 100644 --- a/cocos2d/core/component-scheduler.js +++ b/cocos2d/core/component-scheduler.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCAnimation.js b/cocos2d/core/components/CCAnimation.js index f944938e53..b3bad66f75 100644 --- a/cocos2d/core/components/CCAnimation.js +++ b/cocos2d/core/components/CCAnimation.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCAudioSource.js b/cocos2d/core/components/CCAudioSource.js index a92e6505f8..536be692a2 100644 --- a/cocos2d/core/components/CCAudioSource.js +++ b/cocos2d/core/components/CCAudioSource.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCBlockInputEvents.js b/cocos2d/core/components/CCBlockInputEvents.js index a3b2e56ed3..aa236a2dbf 100644 --- a/cocos2d/core/components/CCBlockInputEvents.js +++ b/cocos2d/core/components/CCBlockInputEvents.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCButton.js b/cocos2d/core/components/CCButton.js index 6f903f8106..d16a33417c 100644 --- a/cocos2d/core/components/CCButton.js +++ b/cocos2d/core/components/CCButton.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCCanvas.js b/cocos2d/core/components/CCCanvas.js index 3744552af9..0280c5068c 100644 --- a/cocos2d/core/components/CCCanvas.js +++ b/cocos2d/core/components/CCCanvas.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCComponent.js b/cocos2d/core/components/CCComponent.js index e7887d0447..12a71ee98b 100644 --- a/cocos2d/core/components/CCComponent.js +++ b/cocos2d/core/components/CCComponent.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCComponentEventHandler.js b/cocos2d/core/components/CCComponentEventHandler.js index f4319ac9ee..9a0b2fd373 100644 --- a/cocos2d/core/components/CCComponentEventHandler.js +++ b/cocos2d/core/components/CCComponentEventHandler.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index 0ec63f45ce..e987fc4319 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCLabelOutline.js b/cocos2d/core/components/CCLabelOutline.js index ebdfb4a5ba..019ab4c176 100644 --- a/cocos2d/core/components/CCLabelOutline.js +++ b/cocos2d/core/components/CCLabelOutline.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCLayout.js b/cocos2d/core/components/CCLayout.js index 7315b320d4..5abdbe7e09 100644 --- a/cocos2d/core/components/CCLayout.js +++ b/cocos2d/core/components/CCLayout.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCMask.js b/cocos2d/core/components/CCMask.js index 1ddbb9ab04..2dc48f20c6 100644 --- a/cocos2d/core/components/CCMask.js +++ b/cocos2d/core/components/CCMask.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCPageView.js b/cocos2d/core/components/CCPageView.js index 947e9ab73b..e69919d73a 100644 --- a/cocos2d/core/components/CCPageView.js +++ b/cocos2d/core/components/CCPageView.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCPageViewIndicator.js b/cocos2d/core/components/CCPageViewIndicator.js index 1e941b638c..db34d5a6d2 100644 --- a/cocos2d/core/components/CCPageViewIndicator.js +++ b/cocos2d/core/components/CCPageViewIndicator.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCProgressBar.js b/cocos2d/core/components/CCProgressBar.js index fd9aefd381..01abf78ea3 100644 --- a/cocos2d/core/components/CCProgressBar.js +++ b/cocos2d/core/components/CCProgressBar.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCRichText.js b/cocos2d/core/components/CCRichText.js index 37252b75e4..84a2a9396a 100644 --- a/cocos2d/core/components/CCRichText.js +++ b/cocos2d/core/components/CCRichText.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCScrollBar.js b/cocos2d/core/components/CCScrollBar.js index 0dfdb247de..1884170339 100644 --- a/cocos2d/core/components/CCScrollBar.js +++ b/cocos2d/core/components/CCScrollBar.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCScrollView.js b/cocos2d/core/components/CCScrollView.js index 83268bc67d..233a30b58d 100644 --- a/cocos2d/core/components/CCScrollView.js +++ b/cocos2d/core/components/CCScrollView.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCSlider.js b/cocos2d/core/components/CCSlider.js index 674307b49e..b3da650c4c 100644 --- a/cocos2d/core/components/CCSlider.js +++ b/cocos2d/core/components/CCSlider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCSprite.js b/cocos2d/core/components/CCSprite.js index b243c8bd92..da6b9b3868 100644 --- a/cocos2d/core/components/CCSprite.js +++ b/cocos2d/core/components/CCSprite.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCStudioComponent.js b/cocos2d/core/components/CCStudioComponent.js index 90b8366bfa..4ea7a9d944 100644 --- a/cocos2d/core/components/CCStudioComponent.js +++ b/cocos2d/core/components/CCStudioComponent.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var ComponentType = cc.Enum({ NONE : 0, diff --git a/cocos2d/core/components/CCToggle.js b/cocos2d/core/components/CCToggle.js index 98449431b6..ec105ecc36 100644 --- a/cocos2d/core/components/CCToggle.js +++ b/cocos2d/core/components/CCToggle.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCToggleContainer.js b/cocos2d/core/components/CCToggleContainer.js index 8369bd65ff..c12894ff82 100644 --- a/cocos2d/core/components/CCToggleContainer.js +++ b/cocos2d/core/components/CCToggleContainer.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCToggleGroup.js b/cocos2d/core/components/CCToggleGroup.js index dafb9deca4..e5e0645173 100644 --- a/cocos2d/core/components/CCToggleGroup.js +++ b/cocos2d/core/components/CCToggleGroup.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCViewGroup.js b/cocos2d/core/components/CCViewGroup.js index 0d5430d4d3..04b7b2f79f 100644 --- a/cocos2d/core/components/CCViewGroup.js +++ b/cocos2d/core/components/CCViewGroup.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/CCWebView.js b/cocos2d/core/components/CCWebView.js index 3ae4153b00..cd7b2d3deb 100644 --- a/cocos2d/core/components/CCWebView.js +++ b/cocos2d/core/components/CCWebView.js @@ -2,16 +2,17 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/cocos2d/core/components/CCWidget.js b/cocos2d/core/components/CCWidget.js index f245e43ff0..be95904646 100644 --- a/cocos2d/core/components/CCWidget.js +++ b/cocos2d/core/components/CCWidget.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -24,6 +25,35 @@ ****************************************************************************/ var WidgetManager = require('../base-ui/CCWidgetManager'); + +/** + * !#en Enum for Widget's alignment mode, indicating when the widget should refresh. + * !#zh Widget 的对齐模式,表示 Widget 应该何时刷新。 + * @enum Widget.AlignMode + */ +/** + * !#en + * Only align once when the Widget is enabled for the first time. + * This will allow the script or animation to continue controlling the current node. + * It will only be aligned once before the end of frame when onEnable is called, + * then immediately disables the Widget. + * !#zh + * 仅在 Widget 第一次激活时对齐一次,便于脚本或动画继续控制当前节点。 + * 开启后会在 onEnable 时所在的那一帧结束前对齐一次,然后立刻禁用该 Widget。 + * @property {Number} ONCE + */ +/** + * !#en Align first from the beginning as ONCE, and then realign it every time the window is resized. + * !#zh 一开始会像 ONCE 一样对齐一次,之后每当窗口大小改变时还会重新对齐。 + * @property {Number} ON_WINDOW_RESIZE + */ +/** + * !#en Keep aligning all the way. + * !#zh 始终保持对齐。 + * @property {Number} ALWAYS + */ +var AlignMode = WidgetManager.AlignMode; + var AlignFlags = WidgetManager._AlignFlags; var TOP = AlignFlags.TOP; var MID = AlignFlags.MID; @@ -477,23 +507,25 @@ var Widget = cc.Class({ }, /** - * !#en TODO - * !#zh - * 开启后仅会在 onEnable 的当帧结束时对齐一次,然后立刻禁用当前组件。 - * 这样便于脚本或动画继续控制当前节点。 - * 注意:onEnable 时所在的那一帧仍然会进行对齐。 - * @property isAlignOnce - * @type {Boolean} - * @default false + * !#en Specifies the alignment mode of the Widget, which determines when the widget should refresh. + * !#zh 指定 Widget 的对齐模式,用于决定 Widget 应该何时刷新。 + * @property {Widget.AlignMode} alignMode + * @example + * widget.alignMode = cc.Widget.AlignMode.ON_WINDOW_RESIZE; */ - isAlignOnce: { - default: true, - tooltip: CC_DEV && 'i18n:COMPONENT.widget.align_once', - displayName: "AlignOnce" + alignMode: { + default: AlignMode.ON_WINDOW_RESIZE, + type: AlignMode, + tooltip: CC_DEV && 'i18n:COMPONENT.widget.align_mode', }, // + _wasAlignOnce: { + default: undefined, + formerlySerializedAs: 'isAlignOnce', + }, + _target: null, /** @@ -524,6 +556,18 @@ var Widget = cc.Class({ _originalHeight: 0 }, + statics: { + AlignMode: AlignMode, + }, + + onLoad: function () { + if (this._wasAlignOnce !== undefined) { + // migrate for old version + this.alignMode = this._wasAlignOnce ? AlignMode.ONCE : AlignMode.ALWAYS; + this._wasAlignOnce = undefined; + } + }, + onEnable: function () { WidgetManager.add(this); }, @@ -608,5 +652,34 @@ var Widget = cc.Class({ }, }); +/** + * !#en + * When turned on, it will only be aligned once at the end of the onEnable frame, + * then immediately disables the current component. + * This will allow the script or animation to continue controlling the current node. + * Note: It will still be aligned at the frame when onEnable is called. + * !#zh + * 开启后仅会在 onEnable 的当帧结束时对齐一次,然后立刻禁用当前组件。 + * 这样便于脚本或动画继续控制当前节点。 + * 注意:onEnable 时所在的那一帧仍然会进行对齐。 + * @property {Boolean} isAlignOnce + * @default false + * @deprecated + */ +Object.defineProperty(Widget.prototype, 'isAlignOnce', { + get () { + if (CC_DEBUG) { + cc.warn('`widget.isAlignOnce` is deprecated, use `widget.alignMode === cc.Widget.AlignMode.ONCE` instead please.'); + } + return this.alignMode === AlignMode.ONCE; + }, + set (value) { + if (CC_DEBUG) { + cc.warn('`widget.isAlignOnce` is deprecated, use `widget.alignMode = cc.Widget.AlignMode.*` instead please.'); + } + this.alignMode = value ? AlignMode.ONCE : AlignMode.ALWAYS; + } +}); + cc.Widget = module.exports = Widget; diff --git a/cocos2d/core/components/index.js b/cocos2d/core/components/index.js index e10ad7e1ec..dac7750edb 100644 --- a/cocos2d/core/components/index.js +++ b/cocos2d/core/components/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/components/missing-script.js b/cocos2d/core/components/missing-script.js index bf40f279e4..d0e43324ad 100644 --- a/cocos2d/core/components/missing-script.js +++ b/cocos2d/core/components/missing-script.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/event-manager/CCEvent.js b/cocos2d/core/event-manager/CCEvent.js index ddc311cdb3..72b67a75f0 100644 --- a/cocos2d/core/event-manager/CCEvent.js +++ b/cocos2d/core/event-manager/CCEvent.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -548,6 +549,20 @@ js.extend(EventAcceleration, cc.Event); */ var EventKeyboard = function (keyCode, isPressed, bubbles) { cc.Event.call(this, cc.Event.KEYBOARD, bubbles); + /** + * !#en + * The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key. + * This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key. + * If the key can't be identified, this value is 0. + * + * !#zh + * keyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。 + * 这通常是十进制 ASCII (RFC20) 或者 Windows 1252 代码,所对应的密钥。 + * 如果无法识别该键,则该值为 0。 + * + * @property keyCode + * @type {Number} + */ this.keyCode = keyCode; this.isPressed = isPressed; }; diff --git a/cocos2d/core/event-manager/CCEventListener.js b/cocos2d/core/event-manager/CCEventListener.js index 17e772b142..a06f6f3011 100644 --- a/cocos2d/core/event-manager/CCEventListener.js +++ b/cocos2d/core/event-manager/CCEventListener.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/event-manager/CCEventManager.js b/cocos2d/core/event-manager/CCEventManager.js index 127fd3c9c3..ce4030148c 100644 --- a/cocos2d/core/event-manager/CCEventManager.js +++ b/cocos2d/core/event-manager/CCEventManager.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -86,22 +87,23 @@ var __getListenerID = function (event) { return ""; }; -/* +/** * !#en - *

- * cc.eventManager is a singleton object which manages event listener subscriptions and event dispatching.
- *
- * The EventListener list is managed in such way so that event listeners can be added and removed
- * while events are being dispatched. - *

+ * This class has been deprecated, please use cc.systemEvent or cc.EventTarget instead. See [Listen to and launch events](../../../manual/en/scripting/events.md) for details.
+ *
+ * cc.eventManager is a singleton object which manages event listener subscriptions and event dispatching. + * The EventListener list is managed in such way so that event listeners can be added and removed + * while events are being dispatched. + * * !#zh + * 该类已废弃,请使用 cc.systemEvent 或 cc.EventTarget 代替,详见 [监听和发射事件](../../../manual/zh/scripting/events.md)。
+ *
* 事件管理器,它主要管理事件监听器注册和派发系统事件。 - * 原始设计中,它支持鼠标,触摸,键盘,陀螺仪和自定义事件。 - * 在 Creator 的设计中,鼠标,触摸和自定义事件的监听和派发请参考 http://cocos.com/docs/creator/scripting/events.html。 * * @class eventManager * @static * @example {@link utils/api/engine/docs/cocos2d/core/event-manager/CCEventManager/addListener.js} + * @deprecated */ var eventManager = { //Priority dirty flag diff --git a/cocos2d/core/event-manager/CCTouch.js b/cocos2d/core/event-manager/CCTouch.js index 817216d607..928af3e5a5 100644 --- a/cocos2d/core/event-manager/CCTouch.js +++ b/cocos2d/core/event-manager/CCTouch.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/event-manager/index.js b/cocos2d/core/event-manager/index.js index a90e2c50b5..21d36dea1d 100644 --- a/cocos2d/core/event-manager/index.js +++ b/cocos2d/core/event-manager/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/event/event-listeners.js b/cocos2d/core/event/event-listeners.js index 5fef2e354a..d238cf06dc 100644 --- a/cocos2d/core/event/event-listeners.js +++ b/cocos2d/core/event/event-listeners.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/event/event-target.js b/cocos2d/core/event/event-target.js index a8eac16381..75934a501d 100644 --- a/cocos2d/core/event/event-target.js +++ b/cocos2d/core/event/event-target.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/event/event.js b/cocos2d/core/event/event.js index 07610160e1..21fe7e4980 100644 --- a/cocos2d/core/event/event.js +++ b/cocos2d/core/event/event.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -325,7 +326,6 @@ EventCustom.prototype.getUserData = function () { */ EventCustom.prototype.getEventName = cc.Event.prototype.getType; - var MAX_POOL_SIZE = 10; var _eventPool = new js.Pool(MAX_POOL_SIZE); EventCustom.put = function (event) { diff --git a/cocos2d/core/event/index.js b/cocos2d/core/event/index.js index 1c946a8fef..25158f1a57 100644 --- a/cocos2d/core/event/index.js +++ b/cocos2d/core/event/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/event/system-event.js b/cocos2d/core/event/system-event.js index daed39c740..3a5c4f3c9c 100644 --- a/cocos2d/core/event/system-event.js +++ b/cocos2d/core/event/system-event.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/graphics/graphics.js b/cocos2d/core/graphics/graphics.js index 07d11dd8a5..8e0843c3d6 100644 --- a/cocos2d/core/graphics/graphics.js +++ b/cocos2d/core/graphics/graphics.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/graphics/helper.js b/cocos2d/core/graphics/helper.js index 0884331c59..d20b760500 100644 --- a/cocos2d/core/graphics/helper.js +++ b/cocos2d/core/graphics/helper.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + const PointFlags = require('./types').PointFlags; var PI = Math.PI; diff --git a/cocos2d/core/graphics/index.js b/cocos2d/core/graphics/index.js index be7a7c41cd..eb305138a0 100644 --- a/cocos2d/core/graphics/index.js +++ b/cocos2d/core/graphics/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/graphics/types.js b/cocos2d/core/graphics/types.js index 356de37f0e..07efb1473c 100644 --- a/cocos2d/core/graphics/types.js +++ b/cocos2d/core/graphics/types.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/index.js b/cocos2d/core/index.js index 94880b9b53..a72f3a271d 100644 --- a/cocos2d/core/index.js +++ b/cocos2d/core/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/CCLoader.js b/cocos2d/core/load-pipeline/CCLoader.js index dcf0e73ec2..624d431877 100644 --- a/cocos2d/core/load-pipeline/CCLoader.js +++ b/cocos2d/core/load-pipeline/CCLoader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -37,6 +38,8 @@ var ReleasedAssetChecker = CC_DEBUG && require('./released-asset-checker'); var resources = new AssetTable(); +var AUDIO_TYPES = ['mp3', 'ogg', 'wav', 'm4a']; + function getXMLHttpRequest () { return window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject('MSXML2.XMLHTTP'); } @@ -764,13 +767,16 @@ proto.release = function (asset) { if (item) { var removed = this.removeItem(id); asset = item.content; - // TODO: AUDIO if (cc.Class.isInstanceOf(asset, cc.Asset)) { if (asset.nativeUrl) { this.release(asset.nativeUrl); } asset.destroy(); } + else if (AUDIO_TYPES.indexOf(item.type) !== -1) { + // TODO: use asset.destroy + cc.audioEngine.uncache(item.rawUrl || item.url); + } if (CC_DEBUG && removed) { this._releasedAssetChecker_DEBUG.setReleased(item, id); } diff --git a/cocos2d/core/load-pipeline/asset-loader.js b/cocos2d/core/load-pipeline/asset-loader.js index 321e3744ef..accd13416a 100644 --- a/cocos2d/core/load-pipeline/asset-loader.js +++ b/cocos2d/core/load-pipeline/asset-loader.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2017 Chukong Technologies Inc. + Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/asset-table.js b/cocos2d/core/load-pipeline/asset-table.js index 8a42bab2f6..bb289f2f01 100644 --- a/cocos2d/core/load-pipeline/asset-table.js +++ b/cocos2d/core/load-pipeline/asset-table.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/audio-downloader.js b/cocos2d/core/load-pipeline/audio-downloader.js index 5a0a3c65da..a7479de13e 100644 --- a/cocos2d/core/load-pipeline/audio-downloader.js +++ b/cocos2d/core/load-pipeline/audio-downloader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -83,15 +84,15 @@ function loadWebAudio (item, callback) { context["decodeAudioData"](request.response, function(buffer){ //success item.buffer = buffer; - callback(null, item.url); + callback(null, item.id); }, function(){ //error - callback('decode error - ' + item.url, null); + callback('decode error - ' + item.id, null); }); }; request.onerror = function(){ - callback('request error - ' + item.url, null); + callback('request error - ' + item.id, null); }; request.send(); diff --git a/cocos2d/core/load-pipeline/auto-release-utils.js b/cocos2d/core/load-pipeline/auto-release-utils.js index 840b804a72..771ad8aeb9 100644 --- a/cocos2d/core/load-pipeline/auto-release-utils.js +++ b/cocos2d/core/load-pipeline/auto-release-utils.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2017 Chukong Technologies Inc. + Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/binary-downloader.js b/cocos2d/core/load-pipeline/binary-downloader.js index ebd3f78705..696a468210 100644 --- a/cocos2d/core/load-pipeline/binary-downloader.js +++ b/cocos2d/core/load-pipeline/binary-downloader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/downloader.js b/cocos2d/core/load-pipeline/downloader.js index 62183fd7f7..42fada3bfb 100644 --- a/cocos2d/core/load-pipeline/downloader.js +++ b/cocos2d/core/load-pipeline/downloader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/index.js b/cocos2d/core/load-pipeline/index.js index eb05db7209..b93a25525d 100644 --- a/cocos2d/core/load-pipeline/index.js +++ b/cocos2d/core/load-pipeline/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/loader.js b/cocos2d/core/load-pipeline/loader.js index c27ff52813..7dd3927d01 100644 --- a/cocos2d/core/load-pipeline/loader.js +++ b/cocos2d/core/load-pipeline/loader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -49,7 +50,7 @@ function loadJSON (item, callback) { function loadImage (item, callback) { var image = item.content; - if (sys.platform !== sys.WECHAT_GAME && !(image instanceof Image)) { + if (sys.platform !== sys.WECHAT_GAME && sys.platform !== sys.QQ_PLAY && !(image instanceof Image)) { return new Error('Image Loader: Input item doesn\'t contain Image content'); } diff --git a/cocos2d/core/load-pipeline/loading-items.js b/cocos2d/core/load-pipeline/loading-items.js index 0f6d68984f..79daa73088 100644 --- a/cocos2d/core/load-pipeline/loading-items.js +++ b/cocos2d/core/load-pipeline/loading-items.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -296,7 +297,7 @@ LoadingItems.ItemState = new cc.Enum(ItemState); * @param {Array} urlList The items array. * @param {Function} onProgress The progression callback, refer to {{#crossLink "LoadingItems.onProgress"}}{{/crossLink}} * @param {Function} onComplete The completion callback, refer to {{#crossLink "LoadingItems.onComplete"}}{{/crossLink}} - * @return {LoadingItems} The LoadingItems queue obejct + * @return {LoadingItems} The LoadingItems queue object * @example * LoadingItems.create(cc.loader, ['a.png', 'b.plist'], function (completedCount, totalCount, item) { * var progress = (100 * completedCount / totalCount).toFixed(2); @@ -358,7 +359,7 @@ LoadingItems.create = function (pipeline, urlList, onProgress, onComplete) { * @method getQueue * @static * @param {Object} item The item to query - * @return {LoadingItems} The LoadingItems queue obejct + * @return {LoadingItems} The LoadingItems queue object */ LoadingItems.getQueue = function (item) { return item.queueId ? _queues[item.queueId] : null; diff --git a/cocos2d/core/load-pipeline/md5-pipe.js b/cocos2d/core/load-pipeline/md5-pipe.js index 62d91170fc..cb3e4ba937 100644 --- a/cocos2d/core/load-pipeline/md5-pipe.js +++ b/cocos2d/core/load-pipeline/md5-pipe.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2017 Chukong Technologies Inc. + Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/pack-downloader.js b/cocos2d/core/load-pipeline/pack-downloader.js index 0dbd87ff13..2d161ce312 100644 --- a/cocos2d/core/load-pipeline/pack-downloader.js +++ b/cocos2d/core/load-pipeline/pack-downloader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/pipeline.js b/cocos2d/core/load-pipeline/pipeline.js index 5aa722576e..2b7aa55315 100644 --- a/cocos2d/core/load-pipeline/pipeline.js +++ b/cocos2d/core/load-pipeline/pipeline.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/released-asset-checker.js b/cocos2d/core/load-pipeline/released-asset-checker.js index 0bb501a8d6..6092847c27 100644 --- a/cocos2d/core/load-pipeline/released-asset-checker.js +++ b/cocos2d/core/load-pipeline/released-asset-checker.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/text-downloader.js b/cocos2d/core/load-pipeline/text-downloader.js index a37f48c196..79af076cbc 100644 --- a/cocos2d/core/load-pipeline/text-downloader.js +++ b/cocos2d/core/load-pipeline/text-downloader.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var sys = require('../platform/CCSys'); if (CC_JSB) { diff --git a/cocos2d/core/load-pipeline/unpackers.js b/cocos2d/core/load-pipeline/unpackers.js index 37259ceb44..816d113fe8 100644 --- a/cocos2d/core/load-pipeline/unpackers.js +++ b/cocos2d/core/load-pipeline/unpackers.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/load-pipeline/utils.js b/cocos2d/core/load-pipeline/utils.js index 14a721b909..35f1529fec 100644 --- a/cocos2d/core/load-pipeline/utils.js +++ b/cocos2d/core/load-pipeline/utils.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var _noCacheRex = /\?/; module.exports = { diff --git a/cocos2d/core/load-pipeline/uuid-loader.js b/cocos2d/core/load-pipeline/uuid-loader.js index 80d786d3df..56d6599ed7 100644 --- a/cocos2d/core/load-pipeline/uuid-loader.js +++ b/cocos2d/core/load-pipeline/uuid-loader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/node-activator.js b/cocos2d/core/node-activator.js index 1eaf1126a6..9f6cc82c48 100644 --- a/cocos2d/core/node-activator.js +++ b/cocos2d/core/node-activator.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/CCPhysicsContact.js b/cocos2d/core/physics/CCPhysicsContact.js index 048b9a9449..f7fd3d1f32 100644 --- a/cocos2d/core/physics/CCPhysicsContact.js +++ b/cocos2d/core/physics/CCPhysicsContact.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var PTM_RATIO = require('./CCPhysicsTypes').PTM_RATIO; var ContactType = require('./CCPhysicsTypes').ContactType; diff --git a/cocos2d/core/physics/CCPhysicsManager.js b/cocos2d/core/physics/CCPhysicsManager.js index 09bb9629d2..d5514e2dd2 100644 --- a/cocos2d/core/physics/CCPhysicsManager.js +++ b/cocos2d/core/physics/CCPhysicsManager.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -44,9 +45,6 @@ var vec2_tmp = cc.v2(); let array_tmp = []; -var FIXED_TIME_STEP = 1/60; -var MAX_ACCUMULATOR = 1/5; - /** * !#en * Physics manager uses box2d as the inner physics system, and hide most box2d implement details(creating rigidbody, synchronize rigidbody info to node). @@ -113,7 +111,31 @@ var PhysicsManager = cc.Class({ * @default 10 * @static */ - POSITION_ITERATIONS: 10 + POSITION_ITERATIONS: 10, + + /** + * !#en + * Specify the fixed time step. + * Need enabledAccumulator to make it work. + * !#zh + * 指定固定的物理更新间隔时间,需要开启 enabledAccumulator 才有效。 + * @property {Number} FIXED_TIME_STEP + * @default 1/60 + * @static + */ + FIXED_TIME_STEP: 1/60, + + /** + * !#en + * Specify the max accumulator time. + * Need enabledAccumulator to make it work. + * !#zh + * 每次可用于更新物理系统的最大时间,需要开启 enabledAccumulator 才有效。 + * @property {Number} MAX_ACCUMULATOR + * @default 1/5 + * @static + */ + MAX_ACCUMULATOR: 1/5 }, ctor: function () { @@ -136,12 +158,12 @@ var PhysicsManager = cc.Class({ /** * !#en - * If enabled accumulator, then will call step function with a fixed time step. + * If enabled accumulator, then will call step function with the fixed time step FIXED_TIME_STEP. * And if the update dt is bigger than the time step, then will call step function several times. * If disabled accumulator, then will call step function with a time step calculated with the frame rate. * !#zh - * 如果开启此选项,那么将会以一个固定的时间步来更新物理引擎,如果一个 update 的间隔时间大于这个时间步,则会对物理引擎进行多次更新。 - * 如果关闭此选项,那么将会根据设定的 frame rate 计算出一个时间步来更新物理引擎。 + * 如果开启此选项,那么将会以固定的间隔时间 FIXED_TIME_STEP 来更新物理引擎,如果一个 update 的间隔时间大于 FIXED_TIME_STEP,则会对物理引擎进行多次更新。 + * 如果关闭此选项,那么将会根据设定的 frame rate 计算出一个间隔时间来更新物理引擎。 * @property {Boolean} enabledAccumulator * @default false */ @@ -174,7 +196,10 @@ var PhysicsManager = cc.Class({ if (this.enabledAccumulator) { this._accumulator += dt; - + + var FIXED_TIME_STEP = PhysicsManager.FIXED_TIME_STEP; + var MAX_ACCUMULATOR = PhysicsManager.MAX_ACCUMULATOR; + // max accumulator time to avoid spiral of death if (this._accumulator > MAX_ACCUMULATOR) { this._accumulator = MAX_ACCUMULATOR; diff --git a/cocos2d/core/physics/CCPhysicsTypes.js b/cocos2d/core/physics/CCPhysicsTypes.js index bfe1cf38cc..38a0796e09 100644 --- a/cocos2d/core/physics/CCPhysicsTypes.js +++ b/cocos2d/core/physics/CCPhysicsTypes.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var ContactType = { BEGIN_CONTACT: 'begin-contact', diff --git a/cocos2d/core/physics/CCPolygonSeparator.js b/cocos2d/core/physics/CCPolygonSeparator.js index cbc4575ee4..4b5aae7345 100644 --- a/cocos2d/core/physics/CCPolygonSeparator.js +++ b/cocos2d/core/physics/CCPolygonSeparator.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + // http://answers.unity3d.com/questions/977416/2d-polygon-convex-decomposition-code.html /// diff --git a/cocos2d/core/physics/CCRigidBody.js b/cocos2d/core/physics/CCRigidBody.js index 71e355d417..79f8af3eb5 100644 --- a/cocos2d/core/physics/CCRigidBody.js +++ b/cocos2d/core/physics/CCRigidBody.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/collider/CCPhysicsBoxCollider.js b/cocos2d/core/physics/collider/CCPhysicsBoxCollider.js index ff150446ee..6cadd5a548 100644 --- a/cocos2d/core/physics/collider/CCPhysicsBoxCollider.js +++ b/cocos2d/core/physics/collider/CCPhysicsBoxCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/collider/CCPhysicsChainCollider.js b/cocos2d/core/physics/collider/CCPhysicsChainCollider.js index b637777e2f..0431acde6b 100644 --- a/cocos2d/core/physics/collider/CCPhysicsChainCollider.js +++ b/cocos2d/core/physics/collider/CCPhysicsChainCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -52,7 +53,7 @@ var PhysicsChainCollider = cc.Class({ * !#en Chain points * !#zh 链条顶点数组 * @property points - * @type {[Vec2]} + * @type {Vec2[]} */ points: { default: function () { diff --git a/cocos2d/core/physics/collider/CCPhysicsCircleCollider.js b/cocos2d/core/physics/collider/CCPhysicsCircleCollider.js index 226c31518a..bc064a3a8e 100644 --- a/cocos2d/core/physics/collider/CCPhysicsCircleCollider.js +++ b/cocos2d/core/physics/collider/CCPhysicsCircleCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/collider/CCPhysicsCollider.js b/cocos2d/core/physics/collider/CCPhysicsCollider.js index f35b890ff7..796a4ccee9 100644 --- a/cocos2d/core/physics/collider/CCPhysicsCollider.js +++ b/cocos2d/core/physics/collider/CCPhysicsCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/collider/CCPhysicsPolygonCollider.js b/cocos2d/core/physics/collider/CCPhysicsPolygonCollider.js index c61d6438f0..dd1dc31809 100644 --- a/cocos2d/core/physics/collider/CCPhysicsPolygonCollider.js +++ b/cocos2d/core/physics/collider/CCPhysicsPolygonCollider.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/index.js b/cocos2d/core/physics/index.js index ca0cd2902d..026c8d0f2b 100644 --- a/cocos2d/core/physics/index.js +++ b/cocos2d/core/physics/index.js @@ -1,6 +1,35 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + if (!CC_JSB) { window.b2 = require('../../../external/box2d/box2d'); + if (CC_QQPLAY) { + // can only define global variable in this way + b2 = window.b2; + } } require('./CCPhysicsManager'); diff --git a/cocos2d/core/physics/joint/CCDistanceJoint.js b/cocos2d/core/physics/joint/CCDistanceJoint.js index 33ad2bef27..ad35605226 100644 --- a/cocos2d/core/physics/joint/CCDistanceJoint.js +++ b/cocos2d/core/physics/joint/CCDistanceJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCJoint.js b/cocos2d/core/physics/joint/CCJoint.js index 848b589d0e..35e489b8e7 100644 --- a/cocos2d/core/physics/joint/CCJoint.js +++ b/cocos2d/core/physics/joint/CCJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCMotorJoint.js b/cocos2d/core/physics/joint/CCMotorJoint.js index f9ee38946e..58ab320a1f 100644 --- a/cocos2d/core/physics/joint/CCMotorJoint.js +++ b/cocos2d/core/physics/joint/CCMotorJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCMouseJoint.js b/cocos2d/core/physics/joint/CCMouseJoint.js index e9b157887a..d6c8069890 100644 --- a/cocos2d/core/physics/joint/CCMouseJoint.js +++ b/cocos2d/core/physics/joint/CCMouseJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCPrismaticJoint.js b/cocos2d/core/physics/joint/CCPrismaticJoint.js index 27cf6c29cb..0fe4867c51 100644 --- a/cocos2d/core/physics/joint/CCPrismaticJoint.js +++ b/cocos2d/core/physics/joint/CCPrismaticJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCRevoluteJoint.js b/cocos2d/core/physics/joint/CCRevoluteJoint.js index cc5670f59c..fa0a476493 100644 --- a/cocos2d/core/physics/joint/CCRevoluteJoint.js +++ b/cocos2d/core/physics/joint/CCRevoluteJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCRopeJoint.js b/cocos2d/core/physics/joint/CCRopeJoint.js index 11d7f8124e..e61c6ba424 100644 --- a/cocos2d/core/physics/joint/CCRopeJoint.js +++ b/cocos2d/core/physics/joint/CCRopeJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCWeldJoint.js b/cocos2d/core/physics/joint/CCWeldJoint.js index eec21a0431..64357a3140 100644 --- a/cocos2d/core/physics/joint/CCWeldJoint.js +++ b/cocos2d/core/physics/joint/CCWeldJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/joint/CCWheelJoint.js b/cocos2d/core/physics/joint/CCWheelJoint.js index 294641432a..203a1710e6 100644 --- a/cocos2d/core/physics/joint/CCWheelJoint.js +++ b/cocos2d/core/physics/joint/CCWheelJoint.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/physics/platform/CCPhysicsAABBQueryCallback.js b/cocos2d/core/physics/platform/CCPhysicsAABBQueryCallback.js index 06f0ac6407..85ba38e6e9 100644 --- a/cocos2d/core/physics/platform/CCPhysicsAABBQueryCallback.js +++ b/cocos2d/core/physics/platform/CCPhysicsAABBQueryCallback.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + function PhysicsAABBQueryCallback () { this._point = new b2.Vec2(); diff --git a/cocos2d/core/physics/platform/CCPhysicsContactListner.js b/cocos2d/core/physics/platform/CCPhysicsContactListner.js index 25eb50a03a..efbb13ed75 100644 --- a/cocos2d/core/physics/platform/CCPhysicsContactListner.js +++ b/cocos2d/core/physics/platform/CCPhysicsContactListner.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + function PhysicsContactListener () { this._contactFixtures = []; diff --git a/cocos2d/core/physics/platform/CCPhysicsRayCastCallback.js b/cocos2d/core/physics/platform/CCPhysicsRayCastCallback.js index 4963686e06..181925536d 100644 --- a/cocos2d/core/physics/platform/CCPhysicsRayCastCallback.js +++ b/cocos2d/core/physics/platform/CCPhysicsRayCastCallback.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + function PhysicsRayCastCallback () { this._type = 0; diff --git a/cocos2d/core/physics/utils.js b/cocos2d/core/physics/utils.js index 4405bc040c..ce1a7857f9 100644 --- a/cocos2d/core/physics/utils.js +++ b/cocos2d/core/physics/utils.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + function getWorldRotation (node) { var rot = node.rotationX; diff --git a/cocos2d/core/platform/BKInputManager.js b/cocos2d/core/platform/BKInputManager.js new file mode 100644 index 0000000000..2d451b77d5 --- /dev/null +++ b/cocos2d/core/platform/BKInputManager.js @@ -0,0 +1,430 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +if (CC_QQPLAY) { + + var js = require('../platform/js'); + var macro = require('./CCMacro'); + var sys = require('./CCSys'); + var eventManager = require('../event-manager'); + + var TOUCH_TIMEOUT = macro.TOUCH_TIMEOUT; + + /** + * This class manages all events of input. include: touch, mouse, accelerometer, keyboard + */ + var bkInputManager = { + _isRegisterEvent: false, + + _preTouchPoint: cc.p(0, 0), + + _preTouchPool: [], + _preTouchPoolPointer: 0, + + _touches: [], + _touchesIntegerDict: {}, + + _indexBitsUsed: 0, + _maxTouches: 5, + + _getUnUsedIndex: function () { + var temp = this._indexBitsUsed; + var now = cc.sys.now(); + + for (var i = 0; i < this._maxTouches; i++) { + if (!(temp & 0x00000001)) { + this._indexBitsUsed |= (1 << i); + return i; + } + else { + var touch = this._touches[i]; + if (now - touch._lastModified > TOUCH_TIMEOUT) { + this._removeUsedIndexBit(i); + delete this._touchesIntegerDict[touch.getID()]; + return i; + } + } + temp >>= 1; + } + + // all bits are used + return -1; + }, + + _removeUsedIndexBit: function (index) { + if (index < 0 || index >= this._maxTouches) + return; + + var temp = 1 << index; + temp = ~temp; + this._indexBitsUsed &= temp; + }, + + _glView: null, + + /** + * @method handleTouchesBegin + * @param {Array} touches + */ + handleTouchesBegin: function (touches) { + var selTouch, index, curTouch, touchID, + handleTouches = [], locTouchIntDict = this._touchesIntegerDict, + now = sys.now(); + for (var i = 0, len = touches.length; i < len; i++) { + selTouch = touches[i]; + touchID = selTouch.getID(); + index = locTouchIntDict[touchID]; + + if (index == null) { + var unusedIndex = this._getUnUsedIndex(); + if (unusedIndex === -1) { + cc.logID(2300, unusedIndex); + continue; + } + //curTouch = this._touches[unusedIndex] = selTouch; + curTouch = this._touches[unusedIndex] = new cc.Touch(selTouch._point.x, selTouch._point.y, selTouch.getID()); + curTouch._lastModified = now; + curTouch._setPrevPoint(selTouch._prevPoint); + locTouchIntDict[touchID] = unusedIndex; + handleTouches.push(curTouch); + } + } + if (handleTouches.length > 0) { + this._glView._convertTouchesWithScale(handleTouches); + var touchEvent = new cc.Event.EventTouch(handleTouches); + touchEvent._eventCode = cc.Event.EventTouch.BEGAN; + eventManager.dispatchEvent(touchEvent); + } + }, + + /** + * @method handleTouchesMove + * @param {Array} touches + */ + handleTouchesMove: function (touches) { + var selTouch, index, touchID, + handleTouches = [], locTouches = this._touches, + now = sys.now(); + for (var i = 0, len = touches.length; i < len; i++) { + selTouch = touches[i]; + touchID = selTouch.getID(); + index = this._touchesIntegerDict[touchID]; + + if (index == null) { + //cc.log("if the index doesn't exist, it is an error"); + continue; + } + if (locTouches[index]) { + locTouches[index]._setPoint(selTouch._point); + locTouches[index]._setPrevPoint(selTouch._prevPoint); + locTouches[index]._lastModified = now; + handleTouches.push(locTouches[index]); + } + } + if (handleTouches.length > 0) { + this._glView._convertTouchesWithScale(handleTouches); + var touchEvent = new cc.Event.EventTouch(handleTouches); + touchEvent._eventCode = cc.Event.EventTouch.MOVED; + eventManager.dispatchEvent(touchEvent); + } + }, + + /** + * @method handleTouchesEnd + * @param {Array} touches + */ + handleTouchesEnd: function (touches) { + var handleTouches = this.getSetOfTouchesEndOrCancel(touches); + if (handleTouches.length > 0) { + this._glView._convertTouchesWithScale(handleTouches); + var touchEvent = new cc.Event.EventTouch(handleTouches); + touchEvent._eventCode = cc.Event.EventTouch.ENDED; + eventManager.dispatchEvent(touchEvent); + } + }, + + /** + * @method handleTouchesCancel + * @param {Array} touches + */ + handleTouchesCancel: function (touches) { + var handleTouches = this.getSetOfTouchesEndOrCancel(touches); + if (handleTouches.length > 0) { + this._glView._convertTouchesWithScale(handleTouches); + var touchEvent = new cc.Event.EventTouch(handleTouches); + touchEvent._eventCode = cc.Event.EventTouch.CANCELLED; + eventManager.dispatchEvent(touchEvent); + } + }, + + /** + * @method getSetOfTouchesEndOrCancel + * @param {Array} touches + * @returns {Array} + */ + getSetOfTouchesEndOrCancel: function (touches) { + var selTouch, index, touchID, handleTouches = [], locTouches = this._touches, + locTouchesIntDict = this._touchesIntegerDict; + for (var i = 0, len = touches.length; i < len; i++) { + selTouch = touches[i]; + touchID = selTouch.getID(); + index = locTouchesIntDict[touchID]; + + if (index == null) { + continue; //cc.log("if the index doesn't exist, it is an error"); + } + if (locTouches[index]) { + locTouches[index]._setPoint(selTouch._point); + locTouches[index]._setPrevPoint(selTouch._prevPoint); + handleTouches.push(locTouches[index]); + this._removeUsedIndexBit(index); + delete locTouchesIntDict[touchID]; + } + } + return handleTouches; + }, + + /** + * @method getHTMLElementPosition + * @param {HTMLElement} element + * @return {Object} + */ + getHTMLElementPosition: function (element) { + var docElem = document.documentElement; + var leftOffset = window.pageXOffset - docElem.clientLeft; + var topOffset = window.pageYOffset - docElem.clientTop; + if (typeof element.getBoundingClientRect === 'function') { + var box = element.getBoundingClientRect(); + return { + left: box.left + leftOffset, + top: box.top + topOffset, + width: box.width, + height: box.height + }; + } + else { + if (element instanceof HTMLCanvasElement) { + return { + left: leftOffset, + top: topOffset, + width: element.width, + height: element.height + }; + } + else { + return { + left: leftOffset, + top: topOffset, + width: parseInt(element.style.width), + height: parseInt(element.style.height) + }; + } + } + }, + + /** + * @method getPreTouch + * @param {Touch} touch + * @return {Touch} + */ + getPreTouch: function (touch) { + var preTouch = null; + var locPreTouchPool = this._preTouchPool; + var id = touch.getID(); + for (var i = locPreTouchPool.length - 1; i >= 0; i--) { + if (locPreTouchPool[i].getID() === id) { + preTouch = locPreTouchPool[i]; + break; + } + } + if (!preTouch) + preTouch = touch; + return preTouch; + }, + + /** + * @method setPreTouch + * @param {Touch} touch + */ + setPreTouch: function (touch) { + var find = false; + var locPreTouchPool = this._preTouchPool; + var id = touch.getID(); + for (var i = locPreTouchPool.length - 1; i >= 0; i--) { + if (locPreTouchPool[i].getID() === id) { + locPreTouchPool[i] = touch; + find = true; + break; + } + } + if (!find) { + if (locPreTouchPool.length <= 50) { + locPreTouchPool.push(touch); + } + else { + locPreTouchPool[this._preTouchPoolPointer] = touch; + this._preTouchPoolPointer = (this._preTouchPoolPointer + 1) % 50; + } + } + }, + + /** + * @method getTouchByXY + * @param {Number} tx + * @param {Number} ty + * @param {Vec2} pos + * @return {Touch} + */ + getTouchByXY: function (tx, ty, pos) { + var locPreTouch = this._preTouchPoint; + var location = this._glView.convertToLocationInView(tx, ty, pos); + var touch = new cc.Touch(location.x, location.y); + touch._setPrevPoint(locPreTouch.x, locPreTouch.y); + locPreTouch.x = location.x; + locPreTouch.y = location.y; + return touch; + }, + + /** + * @method getPointByEvent + * @param {Touch} event + * @param {Vec2} pos + * @return {Vec2} + */ + getPointByEvent: function (event, pos) { + if (event.pageX != null) //not avalable in <= IE8 + return { + x: event.pageX, + y: event.pageY + }; + + pos.left -= document.body.scrollLeft; + pos.top -= document.body.scrollTop; + + return { + x: event.clientX, + y: event.clientY + }; + }, + + /** + * @method getTouchesByEvent + * @param {Touch} event + * @param {Vec2} pos + * @returns {Array} + */ + getTouchesByEvent: function (event) { + var touchArr = [], locView = this._glView; + var touch_event, touch, preLocation; + var locPreTouch = this._preTouchPoint; + var length = event.length; + for (var i = 0; i < length; i++) { + touch_event = event[i]; + if (touch_event) { + + var location = locView.convertToLocationInView(touch_event.x, touch_event.y, this._relatedPos); + location.y = cc.game.canvas.height - location.y; + if (touch_event.id != null) { + touch = new cc.Touch(location.x, location.y, touch_event.id); + //use Touch Pool + preLocation = this.getPreTouch(touch).getLocation(); + touch._setPrevPoint(preLocation.x, preLocation.y); + this.setPreTouch(touch); + } + else { + touch = new cc.Touch(location.x, location.y); + touch._setPrevPoint(locPreTouch.x, locPreTouch.y); + } + locPreTouch.x = location.x; + locPreTouch.y = location.y; + touchArr.push(touch); + } + } + return touchArr; + }, + + // bk game + detectGesture: function () { + var touchArr = BK.TouchEvent.getTouchEvent(); + if (!touchArr) { + return; + } + + var _touchBeginEvents = []; + var _touchMoveEvents = []; + var _touchEndEvents = []; + + for (var i = 0; i < touchArr.length; i++) { + var touch_event = touchArr[i]; + //touch begin + if (touchArr[i].status === 2) { + _touchBeginEvents.push(touch_event); + } + //touch moved + else if (touchArr[i].status === 3) { + _touchMoveEvents.push(touch_event); + } + //touch end + else if (touchArr[i].status === 1) { + _touchEndEvents.push(touch_event); + } + } + + if (_touchBeginEvents.length > 0) { + this.handleTouchesBegin(this.getTouchesByEvent(_touchBeginEvents)); + } + if (_touchMoveEvents.length > 0) { + this.handleTouchesMove(this.getTouchesByEvent(_touchMoveEvents)); + } + if (_touchEndEvents.length > 0) { + this.handleTouchesEnd(this.getTouchesByEvent(_touchEndEvents)); + } + + BK.TouchEvent.updateTouchStatus(); + }, + + /** + * @method registerSystemEvent + * @param {HTMLElement} element + */ + registerSystemEvent: function (element) { + this._glView = cc.view; + this._relatedPos = { + left: 0, + top: 0, + width: element.width, + height: element.height + }; + }, + + _registerKeyboardEvent: function () { + }, + + _registerAccelerometerEvent: function () { + }, + }; + + module.exports = BK.inputManager = bkInputManager; +} diff --git a/cocos2d/core/platform/CCAssetLibrary.js b/cocos2d/core/platform/CCAssetLibrary.js index bcb8acf724..e465606699 100644 --- a/cocos2d/core/platform/CCAssetLibrary.js +++ b/cocos2d/core/platform/CCAssetLibrary.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/CCClass.js b/cocos2d/core/platform/CCClass.js index cd3910146b..e4006869f7 100644 --- a/cocos2d/core/platform/CCClass.js +++ b/cocos2d/core/platform/CCClass.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/CCClassDecorator.js b/cocos2d/core/platform/CCClassDecorator.js index f97a678d42..92c0f230e2 100644 --- a/cocos2d/core/platform/CCClassDecorator.js +++ b/cocos2d/core/platform/CCClassDecorator.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/CCEnum.js b/cocos2d/core/platform/CCEnum.js index 45b4840ddb..ac35ae8427 100644 --- a/cocos2d/core/platform/CCEnum.js +++ b/cocos2d/core/platform/CCEnum.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/CCInputExtension.js b/cocos2d/core/platform/CCInputExtension.js index 6c86a0507b..a51f98f7b5 100644 --- a/cocos2d/core/platform/CCInputExtension.js +++ b/cocos2d/core/platform/CCInputExtension.js @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/platform/CCInputManager.js b/cocos2d/core/platform/CCInputManager.js index 084645df21..93e92eb5a3 100644 --- a/cocos2d/core/platform/CCInputManager.js +++ b/cocos2d/core/platform/CCInputManager.js @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/platform/CCMacro.js b/cocos2d/core/platform/CCMacro.js index 2f06f7f31f..8085b60544 100644 --- a/cocos2d/core/platform/CCMacro.js +++ b/cocos2d/core/platform/CCMacro.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/platform/CCObject.js b/cocos2d/core/platform/CCObject.js index 5ccd4d8f80..43ac522a9f 100644 --- a/cocos2d/core/platform/CCObject.js +++ b/cocos2d/core/platform/CCObject.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var js = require('./js'); var CCClass = require('./CCClass'); diff --git a/cocos2d/core/platform/CCSAXParser.js b/cocos2d/core/platform/CCSAXParser.js index 506c9fb187..cdd5d9e1fd 100644 --- a/cocos2d/core/platform/CCSAXParser.js +++ b/cocos2d/core/platform/CCSAXParser.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/platform/CCScreen.js b/cocos2d/core/platform/CCScreen.js index 8af9cc3a92..0a440f4d88 100644 --- a/cocos2d/core/platform/CCScreen.js +++ b/cocos2d/core/platform/CCScreen.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/platform/CCSys.js b/cocos2d/core/platform/CCSys.js index 94546059de..e99c90d0e2 100644 --- a/cocos2d/core/platform/CCSys.js +++ b/cocos2d/core/platform/CCSys.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -339,6 +340,12 @@ function initSys () { * @default 104 */ sys.WECHAT_GAME = 104; + /** + * @property {Number} QQ_PLAY + * @readOnly + * @default 105 + */ + sys.QQ_PLAY = 105; /** * BROWSER_TYPE_WECHAT * @property {String} BROWSER_TYPE_WECHAT @@ -353,6 +360,13 @@ function initSys () { * @default "wechatgame" */ sys.BROWSER_TYPE_WECHAT_GAME = "wechatgame"; + /** + * BROWSER_TYPE_QQ_PLAY + * @property {String} BROWSER_TYPE_QQ_PLAY + * @readOnly + * @default "qqplay" + */ + sys.BROWSER_TYPE_QQ_PLAY = "qqplay"; /** * * @property {String} BROWSER_TYPE_ANDROID @@ -497,7 +511,7 @@ function initSys () { * Is web browser ? * @property {Boolean} isBrowser */ - sys.isBrowser = typeof window === 'object' && typeof document === 'object' && !CC_WECHATGAME; + sys.isBrowser = typeof window === 'object' && typeof document === 'object' && !CC_WECHATGAME && !CC_QQPLAY; if (CC_EDITOR && Editor.isMainProcess) { sys.isMobile = false; @@ -554,7 +568,41 @@ function initSys () { WEB_AUDIO: false, DELAY_CREATE_CTX: false, format: ['.mp3'] - }; + }; + } + else if (CC_QQPLAY) { + sys.isMobile = true; + sys.platform = sys.QQ_PLAY; + sys.language = sys.LANGUAGE_UNKNOWN; + sys.os = sys.OS_UNKNOWN; + + sys.osVersion = 0; + sys.osMainVersion = 0; + sys.browserType = sys.BROWSER_TYPE_QQ_PLAY; + sys.browserVersion = 0; + + var w = 960; + var h = 640; + var ratio = 1; + + sys.windowPixelResolution = { + width: ratio * w, + height: ratio * h + }; + + sys.localStorage = window.localStorage; + + sys.capabilities = { + "canvas": false, + "opengl": true, + "webp": false + }; + sys.__audioSupport = { + ONLY_ONE: false, + WEB_AUDIO: false, + DELAY_CREATE_CTX: false, + format: ['.mp3'] + }; } else { // browser or runtime @@ -647,6 +695,8 @@ function initSys () { var browserType = browserTypes ? browserTypes[0].toLowerCase() : sys.BROWSER_TYPE_UNKNOWN; if (CC_WECHATGAME) browserType = sys.BROWSER_TYPE_WECHAT_GAME; + else if (CC_QQPLAY) + browserType = sys.BROWSER_TYPE_QQ_PLAY; else if (browserType === 'micromessenger') browserType = sys.BROWSER_TYPE_WECHAT; else if (browserType === "safari" && isAndroid) @@ -928,12 +978,78 @@ function initSys () { sys.__audioSupport = __audioSupport; } + /** + * !#en + * Network type enumeration + * !#zh + * 网络类型枚举 + * + * @enum NetworkType + */ + sys.NetworkType = { + /** + * !#en + * Network is unreachable. + * !#zh + * 网络不通 + * + * @property {Number} NONE + */ + NONE: 0, + /** + * !#en + * Network is reachable via WiFi or cable. + * !#zh + * 通过无线或者有线本地网络连接因特网 + * + * @property {Number} LAN + */ + LAN: 1, + /** + * !#en + * Network is reachable via Wireless Wide Area Network + * !#zh + * 通过蜂窝移动网络连接因特网 + * + * @property {Number} WWAN + */ + WWAN: 2 + }; + + /** + * !#en + * Get the network type of current device, return cc.sys.NetworkType.LAN if failure. + * !#zh + * 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN + * + * @method getNetworkType + * @return {NetworkType} + */ + sys.getNetworkType = function() { + // TODO: need to implement this for mobile phones. + return sys.NetworkType.LAN; + }; + + /** + * !#en + * Get the battery level of current device, return 1.0 if failure. + * !#zh + * 获取当前设备的电池电量,如果电量无法获取,默认将返回 1 + * + * @method getBatteryLevel + * @return {Number} - 0.0 ~ 1.0 + */ + sys.getBatteryLevel = function() { + // TODO: need to implement this for mobile phones. + return 1.0; + }; + /** * Forces the garbage collection, only available in JSB * @method garbageCollect */ sys.garbageCollect = function () { - // N/A in cocos2d-html5 + // N/A in web }; /** @@ -941,7 +1057,7 @@ function initSys () { * @method dumpRoot */ sys.dumpRoot = function () { - // N/A in cocos2d-html5 + // N/A in web }; /** @@ -949,7 +1065,7 @@ function initSys () { * @method restartVM */ sys.restartVM = function () { - // N/A in cocos2d-html5 + // N/A in web }; /** @@ -958,7 +1074,7 @@ function initSys () { * @param {String} jsfile */ sys.cleanScript = function (jsfile) { - // N/A in cocos2d-html5 + // N/A in web }; /** diff --git a/cocos2d/core/platform/CCView.js b/cocos2d/core/platform/CCView.js index b2a3d1fbc0..d234a866b6 100644 --- a/cocos2d/core/platform/CCView.js +++ b/cocos2d/core/platform/CCView.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -35,7 +36,7 @@ function isWeChatGame () { var __BrowserGetter = { init: function(){ - if (cc.sys.platform !== cc.sys.WECHAT_GAME) { + if (!CC_WECHATGAME && !CC_QQPLAY) { this.html = document.getElementsByTagName("html")[0]; } }, @@ -64,6 +65,10 @@ if (CC_WECHATGAME) { __BrowserGetter.adaptationType = cc.sys.BROWSER_TYPE_WECHAT_GAME; } +if (CC_QQPLAY) { + __BrowserGetter.adaptationType = cc.sys.BROWSER_TYPE_QQ_PLAY; +} + switch (__BrowserGetter.adaptationType) { case cc.sys.BROWSER_TYPE_SAFARI: __BrowserGetter.meta["minimal-ui"] = "true"; @@ -381,7 +386,7 @@ View.prototype = { }, _adjustViewportMeta: function () { - if (this._isAdjustViewPort && cc.sys.platform !== cc.sys.WECHAT_GAME) { + if (this._isAdjustViewPort && !CC_WECHATGAME && !CC_QQPLAY) { this._setViewportMeta(__BrowserGetter.meta, false); this._isAdjustViewPort = false; } @@ -801,7 +806,7 @@ View.prototype = { * @param {ResolutionPolicy|Number} resolutionPolicy The resolution policy desired */ setRealPixelResolution: function (width, height, resolutionPolicy) { - if (cc.sys.platform !== cc.sys.WECHAT_GAME) { + if (!CC_WECHATGAME && !CC_QQPLAY) { // Set viewport's width this._setViewportMeta({"width": width}, true); diff --git a/cocos2d/core/platform/CCVisibleRect.js b/cocos2d/core/platform/CCVisibleRect.js index 08cec5fa16..91ed472bb2 100644 --- a/cocos2d/core/platform/CCVisibleRect.js +++ b/cocos2d/core/platform/CCVisibleRect.js @@ -1,6 +1,7 @@ /**************************************************************************** Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/platform/attribute.js b/cocos2d/core/platform/attribute.js index c9cb6a494b..f60548fad0 100644 --- a/cocos2d/core/platform/attribute.js +++ b/cocos2d/core/platform/attribute.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/callbacks-invoker.js b/cocos2d/core/platform/callbacks-invoker.js index d49b3f313e..870dcbbd34 100644 --- a/cocos2d/core/platform/callbacks-invoker.js +++ b/cocos2d/core/platform/callbacks-invoker.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/compiler.js b/cocos2d/core/platform/compiler.js index 534f785039..f667267420 100644 --- a/cocos2d/core/platform/compiler.js +++ b/cocos2d/core/platform/compiler.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/id-generater.js b/cocos2d/core/platform/id-generater.js index cc19190977..4a7ae2f499 100644 --- a/cocos2d/core/platform/id-generater.js +++ b/cocos2d/core/platform/id-generater.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/index.js b/cocos2d/core/platform/index.js index 34c0523e28..f99e97cf87 100644 --- a/cocos2d/core/platform/index.js +++ b/cocos2d/core/platform/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/instantiate-jit.js b/cocos2d/core/platform/instantiate-jit.js index 18330e7eaa..744b5ebf59 100644 --- a/cocos2d/core/platform/instantiate-jit.js +++ b/cocos2d/core/platform/instantiate-jit.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/instantiate.js b/cocos2d/core/platform/instantiate.js index ed2a115ced..a7b4518205 100644 --- a/cocos2d/core/platform/instantiate.js +++ b/cocos2d/core/platform/instantiate.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/js.js b/cocos2d/core/platform/js.js index ebd94af8d5..2bfdcd8d20 100644 --- a/cocos2d/core/platform/js.js +++ b/cocos2d/core/platform/js.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -609,7 +610,7 @@ var REGEXP_STR = /%s/; /** * A string tool to construct a string with format string. * @method formatStr - * @param {String|any} msg - A JavaScript string containing zero or more substitution strings. + * @param {String|any} msg - A JavaScript string containing zero or more substitution strings (%s). * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. * @returns {String} * @example diff --git a/cocos2d/core/platform/preprocess-class.js b/cocos2d/core/platform/preprocess-class.js index 042f6d710c..736058779d 100644 --- a/cocos2d/core/platform/preprocess-class.js +++ b/cocos2d/core/platform/preprocess-class.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/requiring-frame.js b/cocos2d/core/platform/requiring-frame.js index dde5c05629..2dadbe1302 100644 --- a/cocos2d/core/platform/requiring-frame.js +++ b/cocos2d/core/platform/requiring-frame.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/url.js b/cocos2d/core/platform/url.js index 8a4f2a834d..3c0d0ed260 100644 --- a/cocos2d/core/platform/url.js +++ b/cocos2d/core/platform/url.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/platform/utils.js b/cocos2d/core/platform/utils.js index a88aa4bd17..0d6e1e1418 100644 --- a/cocos2d/core/platform/utils.js +++ b/cocos2d/core/platform/utils.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/predefine.js b/cocos2d/core/predefine.js index f561a9b78a..f1ab75d8c8 100644 --- a/cocos2d/core/predefine.js +++ b/cocos2d/core/predefine.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/renderer/index.js b/cocos2d/core/renderer/index.js index f739aef2d5..dc90b2efb5 100644 --- a/cocos2d/core/renderer/index.js +++ b/cocos2d/core/renderer/index.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/sprites/CCSpriteFrame.js b/cocos2d/core/sprites/CCSpriteFrame.js index fb0c7c94df..da6b19a327 100644 --- a/cocos2d/core/sprites/CCSpriteFrame.js +++ b/cocos2d/core/sprites/CCSpriteFrame.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2015 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/textures/CCTexture2D.js b/cocos2d/core/textures/CCTexture2D.js index 70c5ec0535..44c59db9b1 100644 --- a/cocos2d/core/textures/CCTexture2D.js +++ b/cocos2d/core/textures/CCTexture2D.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/textures/index.js b/cocos2d/core/textures/index.js index 7a1c40ef16..66b249335f 100644 --- a/cocos2d/core/textures/index.js +++ b/cocos2d/core/textures/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/utils/CCPath.js b/cocos2d/core/utils/CCPath.js index 33f313a29c..fd80de9f40 100644 --- a/cocos2d/core/utils/CCPath.js +++ b/cocos2d/core/utils/CCPath.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -26,6 +27,7 @@ require('../platform/CCSys'); var EXTNAME_RE = /(\.[^\.\/\?\\]*)(\?.*)?$/; +var DIRNAME_RE = /((.*)(\/|\\|\\\\))?(.*?\..*$)?/; var NORMALIZE_RE = /[^\.\/]+\/\.\.\//; /** @@ -111,7 +113,8 @@ cc.path = /** @lends cc.path# */{ * @returns {*} */ dirname: function (pathStr) { - return pathStr.replace(/((.*)(\/|\\|\\\\))?(.*?\..*$)?/, '$2'); + var temp = DIRNAME_RE.exec(pathStr); + return temp ? temp[2] : ''; }, /** diff --git a/cocos2d/core/utils/CCProfiler.js b/cocos2d/core/utils/CCProfiler.js index 46df595b31..fe755a4734 100644 --- a/cocos2d/core/utils/CCProfiler.js +++ b/cocos2d/core/utils/CCProfiler.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index 947db6ffce..a2e45ae1cc 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -32,6 +33,7 @@ var eventManager = require('../event-manager'); var Destroying = Flags.Destroying; var DontDestroy = Flags.DontDestroy; +var Deactivating = Flags.Deactivating; var CHILD_ADDED = 'child-added'; var CHILD_REMOVED = 'child-removed'; @@ -339,13 +341,18 @@ var BaseNode = cc.Class({ return; } } - // var oldParent = this._parent; + if (CC_DEBUG && oldParent && (oldParent._objFlags & Deactivating)) { + cc.errorID(3821); + } this._parent = value || null; this._onSetParent(value); if (value) { + if (CC_DEBUG && (value._objFlags & Deactivating)) { + cc.errorID(3821); + } if (!CC_JSB) { eventManager._setDirtyForNode(this); } @@ -497,6 +504,10 @@ var BaseNode = cc.Class({ if (!this._parent) { return; } + if (this._parent._objFlags & Deactivating) { + cc.errorID(3821); + return; + } var siblings = this._parent._children; index = index !== -1 ? index : siblings.length - 1; var oldIndex = siblings.indexOf(this); diff --git a/cocos2d/core/utils/binary-search.js b/cocos2d/core/utils/binary-search.js index f34d4de382..fa5b4a847a 100644 --- a/cocos2d/core/utils/binary-search.js +++ b/cocos2d/core/utils/binary-search.js @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/utils/decode-uuid.js b/cocos2d/core/utils/decode-uuid.js index b74f862a2d..13e96bacea 100644 --- a/cocos2d/core/utils/decode-uuid.js +++ b/cocos2d/core/utils/decode-uuid.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/utils/find.js b/cocos2d/core/utils/find.js index 6e59531fe9..ea42a19c2f 100644 --- a/cocos2d/core/utils/find.js +++ b/cocos2d/core/utils/find.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/utils/index.js b/cocos2d/core/utils/index.js index 2df6fc067f..86e6d99ef5 100644 --- a/cocos2d/core/utils/index.js +++ b/cocos2d/core/utils/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -24,7 +25,7 @@ ****************************************************************************/ require('./CCPath'); -if (!CC_EDITOR && !CC_JSB) { +if (!CC_EDITOR && !CC_JSB && !CC_WECHATGAME && !CC_QQPLAY) { require('./CCProfiler'); } require('./find'); diff --git a/cocos2d/core/utils/misc.js b/cocos2d/core/utils/misc.js index e1e0f75cfb..a31babe2bd 100644 --- a/cocos2d/core/utils/misc.js +++ b/cocos2d/core/utils/misc.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/utils/mutable-forward-iterator.js b/cocos2d/core/utils/mutable-forward-iterator.js index 113282e5b6..6581ee9969 100644 --- a/cocos2d/core/utils/mutable-forward-iterator.js +++ b/cocos2d/core/utils/mutable-forward-iterator.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/utils/prefab-helper.js b/cocos2d/core/utils/prefab-helper.js index b29fbcb62c..1c1efbed68 100644 --- a/cocos2d/core/utils/prefab-helper.js +++ b/cocos2d/core/utils/prefab-helper.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/value-types/CCAffineTransform.js b/cocos2d/core/value-types/CCAffineTransform.js index b05f1694da..b113fac336 100644 --- a/cocos2d/core/value-types/CCAffineTransform.js +++ b/cocos2d/core/value-types/CCAffineTransform.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -342,6 +343,19 @@ cc.affineTransformInvert = function (t) { tx: determinant * (t.c * t.ty - t.d * t.tx), ty: determinant * (t.b * t.tx - t.a * t.ty)}; }; +cc.affineTransformInvertIn = function (t) { + var a = t.a, b = t.b, c = t.c, d = t.d; + var determinant = 1 / (a * d - b * c); + var tx = t.tx, ty = t.ty; + t.a = determinant * d; + t.b = -determinant * b; + t.c = -determinant * c; + t.d = determinant * a; + t.tx = determinant * (c * ty - d * tx); + t.ty = determinant * (b * tx - a * ty); + return t; +}; + /** * !#en Put the invert transform of an AffineTransform object into the out AffineTransform object. * !#zh 求逆矩阵并存入用户传入的矩阵对象参数。 diff --git a/cocos2d/core/value-types/CCColor.js b/cocos2d/core/value-types/CCColor.js index c13af03bd2..ab40d5f5b0 100644 --- a/cocos2d/core/value-types/CCColor.js +++ b/cocos2d/core/value-types/CCColor.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/value-types/CCPointExtension.js b/cocos2d/core/value-types/CCPointExtension.js index 33be9aeefb..4ef729d2f4 100644 --- a/cocos2d/core/value-types/CCPointExtension.js +++ b/cocos2d/core/value-types/CCPointExtension.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/value-types/CCRect.js b/cocos2d/core/value-types/CCRect.js index 215d403cee..ca106afcc0 100644 --- a/cocos2d/core/value-types/CCRect.js +++ b/cocos2d/core/value-types/CCRect.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -382,8 +383,8 @@ proto.contains = function (point) { * @param {Rect} rect * @type {Boolean} * @example - * var a = new cc.Rect(0, 0, 10, 10); - * var b = new cc.Rect(0, 0, 20, 20); + * var a = new cc.Rect(0, 0, 20, 20); + * var b = new cc.Rect(0, 0, 10, 10); * a.containsRect(b);// true */ proto.containsRect = function (rect) { diff --git a/cocos2d/core/value-types/CCSize.js b/cocos2d/core/value-types/CCSize.js index 6495175fe3..1504e07a07 100644 --- a/cocos2d/core/value-types/CCSize.js +++ b/cocos2d/core/value-types/CCSize.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/value-types/CCTypes.js b/cocos2d/core/value-types/CCTypes.js index 1fa699053f..eb46b5ddb8 100644 --- a/cocos2d/core/value-types/CCTypes.js +++ b/cocos2d/core/value-types/CCTypes.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2015 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/value-types/CCTypesWebGL.js b/cocos2d/core/value-types/CCTypesWebGL.js index ffce347c06..4340a37ae0 100644 --- a/cocos2d/core/value-types/CCTypesWebGL.js +++ b/cocos2d/core/value-types/CCTypesWebGL.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/core/value-types/CCValueType.js b/cocos2d/core/value-types/CCValueType.js index 504e8dc63c..3a633003fa 100644 --- a/cocos2d/core/value-types/CCValueType.js +++ b/cocos2d/core/value-types/CCValueType.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/value-types/CCVec2.js b/cocos2d/core/value-types/CCVec2.js index 504cdf1b31..c68a0370b5 100644 --- a/cocos2d/core/value-types/CCVec2.js +++ b/cocos2d/core/value-types/CCVec2.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/core/value-types/index.js b/cocos2d/core/value-types/index.js index df2f0670de..bcf1c87a57 100644 --- a/cocos2d/core/value-types/index.js +++ b/cocos2d/core/value-types/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/deprecated.js b/cocos2d/deprecated.js index 5d65a64f2f..8b1c35a326 100644 --- a/cocos2d/deprecated.js +++ b/cocos2d/deprecated.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var js = cc.js; diff --git a/cocos2d/index.js b/cocos2d/index.js index 611dadb3ba..2f501b7e8c 100644 --- a/cocos2d/index.js +++ b/cocos2d/index.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + require('./core/CCGame'); // ensure modular-cocos2d can determine whether action module is included diff --git a/cocos2d/motion-streak/CCMotionStreak.js b/cocos2d/motion-streak/CCMotionStreak.js index c7e06ea290..0dcc51ddc9 100644 --- a/cocos2d/motion-streak/CCMotionStreak.js +++ b/cocos2d/motion-streak/CCMotionStreak.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/particle/CCPNGReader.js b/cocos2d/particle/CCPNGReader.js index 1f7f8b7834..70e4ec9f18 100644 --- a/cocos2d/particle/CCPNGReader.js +++ b/cocos2d/particle/CCPNGReader.js @@ -2,7 +2,8 @@ Copyright (c) 2011 Devon Govett Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/particle/CCParticleAsset.js b/cocos2d/particle/CCParticleAsset.js index 26a85702ab..14f1bb288d 100644 --- a/cocos2d/particle/CCParticleAsset.js +++ b/cocos2d/particle/CCParticleAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/particle/CCParticleSystem.js b/cocos2d/particle/CCParticleSystem.js index ea4136925d..f5ba5b62d5 100644 --- a/cocos2d/particle/CCParticleSystem.js +++ b/cocos2d/particle/CCParticleSystem.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/particle/CCTIFFReader.js b/cocos2d/particle/CCTIFFReader.js index 38f33dcafa..66d1a6d2b4 100644 --- a/cocos2d/particle/CCTIFFReader.js +++ b/cocos2d/particle/CCTIFFReader.js @@ -4,7 +4,8 @@ Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/tilemap/CCTMXXMLParser.js b/cocos2d/tilemap/CCTMXXMLParser.js index 77bdb23a75..2da31f7c64 100644 --- a/cocos2d/tilemap/CCTMXXMLParser.js +++ b/cocos2d/tilemap/CCTMXXMLParser.js @@ -1,7 +1,8 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/cocos2d/tilemap/CCTiledLayer.js b/cocos2d/tilemap/CCTiledLayer.js index 66197573a8..41fd5c51a4 100644 --- a/cocos2d/tilemap/CCTiledLayer.js +++ b/cocos2d/tilemap/CCTiledLayer.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/tilemap/CCTiledMap.js b/cocos2d/tilemap/CCTiledMap.js index 34e98d6de3..c291e26940 100644 --- a/cocos2d/tilemap/CCTiledMap.js +++ b/cocos2d/tilemap/CCTiledMap.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/tilemap/CCTiledMapAsset.js b/cocos2d/tilemap/CCTiledMapAsset.js index 7a8beb35a4..c4bd930817 100644 --- a/cocos2d/tilemap/CCTiledMapAsset.js +++ b/cocos2d/tilemap/CCTiledMapAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/tilemap/CCTiledObjectGroup.js b/cocos2d/tilemap/CCTiledObjectGroup.js index ceab2c4ac2..7f90375cec 100644 --- a/cocos2d/tilemap/CCTiledObjectGroup.js +++ b/cocos2d/tilemap/CCTiledObjectGroup.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/cocos2d/tilemap/editor/tiled-map.js b/cocos2d/tilemap/editor/tiled-map.js index 5d82a3235d..779a0b9f76 100644 --- a/cocos2d/tilemap/editor/tiled-map.js +++ b/cocos2d/tilemap/editor/tiled-map.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + 'use strict'; const CustomAssetMeta = Editor.metas['custom-asset']; diff --git a/extends.js b/extends.js index ff0b554e5f..f36895ddea 100644 --- a/extends.js +++ b/extends.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/extensions/anysdk/jsb_anysdk.js b/extensions/anysdk/jsb_anysdk.js index fd1f03f671..a7c73880cc 100644 --- a/extensions/anysdk/jsb_anysdk.js +++ b/extensions/anysdk/jsb_anysdk.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of Stringge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/extensions/ccpool/CCNodePool.js b/extensions/ccpool/CCNodePool.js index 3ee080e6b0..672cafdb0c 100644 --- a/extensions/ccpool/CCNodePool.js +++ b/extensions/ccpool/CCNodePool.js @@ -1,5 +1,6 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/extensions/dragonbones/ArmatureDisplay.js b/extensions/dragonbones/ArmatureDisplay.js index 288ae5a3c9..b320340b82 100644 --- a/extensions/dragonbones/ArmatureDisplay.js +++ b/extensions/dragonbones/ArmatureDisplay.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -289,9 +290,8 @@ let ArmatureDisplay = cc.Class({ // If using the getFactory in JSB. // There may be throw errors when close the application. this._factory = new dragonBones.CCFactory(); - } - else { - this._factory = dragonBones.CCFactory.getFactory(); + } else { + this._factory = dragonBones.CCFactory.getInstance(); } }, @@ -490,9 +490,10 @@ let ArmatureDisplay = cc.Class({ * !#zh * 添加 DragonBones 事件监听器。 * @method addEventListener - * @param {dragonBones.EventObject} eventType - * @param {function} listener - * @param {Object} target + * @param {String} type - A string representing the event type to listen for. + * @param {Function} listener - The callback that will be invoked when the event is dispatched. + * @param {Event} listener.event event + * @param {Object} [target] - The target (this object) to invoke the callback, can be null */ addEventListener (eventType, listener, target) { this.addDBEventListener(eventType, listener, target); @@ -504,9 +505,9 @@ let ArmatureDisplay = cc.Class({ * !#zh * 移除 DragonBones 事件监听器。 * @method removeEventListener - * @param {dragonBones.EventObject} eventType - * @param {function} listener - * @param {Object} target + * @param {String} type - A string representing the event type to listen for. + * @param {Function} [listener] + * @param {Object} [target] */ removeEventListener (eventType, listener, target) { this.removeDBEventListener(eventType, listener, target); diff --git a/extensions/dragonbones/CCFactory.js b/extensions/dragonbones/CCFactory.js index 0c50255f81..d14a8c7698 100644 --- a/extensions/dragonbones/CCFactory.js +++ b/extensions/dragonbones/CCFactory.js @@ -1,5 +1,6 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -30,7 +31,7 @@ var CCFactory = dragonBones.CCFactory = cc.Class({ statics: { _factory: null, - getFactory () { + getInstance () { if (!CCFactory._factory) { CCFactory._factory = new CCFactory(); } diff --git a/extensions/dragonbones/CCSlot.js b/extensions/dragonbones/CCSlot.js index b3c70854d3..91759a283c 100644 --- a/extensions/dragonbones/CCSlot.js +++ b/extensions/dragonbones/CCSlot.js @@ -1,5 +1,6 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/extensions/dragonbones/CCTextureData.js b/extensions/dragonbones/CCTextureData.js index f361e207e5..9fa1ddad1d 100644 --- a/extensions/dragonbones/CCTextureData.js +++ b/extensions/dragonbones/CCTextureData.js @@ -1,5 +1,6 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/extensions/dragonbones/DragonBonesAsset.js b/extensions/dragonbones/DragonBonesAsset.js index 6f463882c6..531a4da13c 100644 --- a/extensions/dragonbones/DragonBonesAsset.js +++ b/extensions/dragonbones/DragonBonesAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/extensions/dragonbones/DragonBonesAtlasAsset.js b/extensions/dragonbones/DragonBonesAtlasAsset.js index 4ca8e088b0..f88e7342ac 100644 --- a/extensions/dragonbones/DragonBonesAtlasAsset.js +++ b/extensions/dragonbones/DragonBonesAtlasAsset.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/extensions/dragonbones/editor/dragonbones-atlas-meta.js b/extensions/dragonbones/editor/dragonbones-atlas-meta.js index 6b01a1ef17..abc1f818c9 100644 --- a/extensions/dragonbones/editor/dragonbones-atlas-meta.js +++ b/extensions/dragonbones/editor/dragonbones-atlas-meta.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/extensions/dragonbones/editor/dragonbones-meta.js b/extensions/dragonbones/editor/dragonbones-meta.js index 3613e72685..c7978521ff 100644 --- a/extensions/dragonbones/editor/dragonbones-meta.js +++ b/extensions/dragonbones/editor/dragonbones-meta.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/extensions/dragonbones/index.js b/extensions/dragonbones/index.js index 9f791170a3..41229d4213 100644 --- a/extensions/dragonbones/index.js +++ b/extensions/dragonbones/index.js @@ -1,5 +1,6 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/extensions/spine/Skeleton.js b/extensions/spine/Skeleton.js index 9aad4b7bd0..e86caaecc3 100644 --- a/extensions/spine/Skeleton.js +++ b/extensions/spine/Skeleton.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/extensions/spine/editor/spine-meta.js b/extensions/spine/editor/spine-meta.js index 5e9fdb63eb..b61b2fc5b7 100644 --- a/extensions/spine/editor/spine-meta.js +++ b/extensions/spine/editor/spine-meta.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + 'use strict'; /* diff --git a/extensions/spine/index.js b/extensions/spine/index.js index fd163998d3..0aae4b710e 100644 --- a/extensions/spine/index.js +++ b/extensions/spine/index.js @@ -1,5 +1,6 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org diff --git a/gulp/tasks/engine.js b/gulp/tasks/engine.js index f0340aba9f..3dd70b941a 100644 --- a/gulp/tasks/engine.js +++ b/gulp/tasks/engine.js @@ -5,14 +5,14 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/gulp/tasks/test.js b/gulp/tasks/test.js index 29de7715c3..168cb84eb2 100644 --- a/gulp/tasks/test.js +++ b/gulp/tasks/test.js @@ -5,14 +5,14 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/gulp/util/handleErrors.js b/gulp/util/handleErrors.js index d7ec736585..62531aab57 100644 --- a/gulp/util/handleErrors.js +++ b/gulp/util/handleErrors.js @@ -5,14 +5,14 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/gulp/util/utils.js b/gulp/util/utils.js index 2fd8ac09f1..45774f5c61 100644 --- a/gulp/util/utils.js +++ b/gulp/util/utils.js @@ -1,6 +1,6 @@ const PLATFORM_MACROS = ['CC_EDITOR', 'CC_PREVIEW', 'CC_BUILD', 'CC_TEST']; -const FLAGS = ['jsb', 'wechatgame', 'debug']; +const FLAGS = ['jsb', 'wechatgame', 'qqplay', 'debug']; // generate macros for uglify's global_defs // available platforms: 'editor' | 'preview' | 'build' | 'test' @@ -36,7 +36,7 @@ exports.getMacros = function (platform, flags) { // debug macros res['CC_DEV'] = res['CC_EDITOR'] || res['CC_PREVIEW'] || res['CC_TEST']; res['CC_DEBUG'] = res['CC_DEBUG'] || res['CC_DEV']; - res['CC_SUPPORT_JIT'] = !res['CC_WECHATGAME']; + res['CC_SUPPORT_JIT'] = !(res['CC_WECHATGAME'] || res['CC_QQPLAY']); return res; }; @@ -48,41 +48,50 @@ exports.getUglifyOptions = function (platform, flags) { var optimizeForJSC = releaseMode && global_defs['CC_JSB']; if (optimizeForJSC) { return { + parse: { + bare_returns: true + }, + toplevel: false, + compress: { + global_defs: global_defs, + negate_iife: false, + sequences: false, + keep_infinity: true, // reduce jsc file size + typeofs: false, + }, output: { beautify: true, // really preserve_lines indent_level: 0, // reduce jsc file size }, - compress: { - global_defs: global_defs, - sequences: false, - keep_infinity: true, // reduce jsc file size - typeofs: false, - } + rename: false, // workaround mishoo/UglifyJS2#2821 }; } if (releaseMode) { return { + parse: { + bare_returns: true + }, + toplevel: false, compress: { global_defs: global_defs, + negate_iife: false, }, output: { ascii_only: true, - } + }, + rename: false, // workaround mishoo/UglifyJS2#2821 }; } else { return { - mangle: false, - //preserveComments: 'all', - output: { - // http://lisperator.net/uglifyjs/codegen - beautify: true, - indent_level: 2, - ascii_only: true, + parse: { + bare_returns: true }, + toplevel: false, compress: { global_defs: global_defs, + negate_iife: false, sequences: false, // join consecutive statements with the “comma operator” properties: false, // optimize property access: a["foo"] → a.foo // dead_code: true, // discard unreachable code @@ -107,7 +116,6 @@ exports.getUglifyOptions = function (platform, flags) { reduce_funcs: false, reduce_vars: false, // Improve optimization on variables assigned with and used as constant values. //warnings: true, - negate_iife: false, pure_getters: false, pure_funcs: null, drop_console: false, @@ -116,7 +124,16 @@ exports.getUglifyOptions = function (platform, flags) { keep_fnames: true, keep_infinity: true, // Pass true to prevent Infinity from being compressed into 1/0, which may cause performance issues on Chrome. side_effects: false, // drop side-effect-free statements - } + }, + mangle: false, + //preserveComments: 'all', + output: { + // http://lisperator.net/uglifyjs/codegen + beautify: true, + indent_level: 2, + ascii_only: true, + }, + rename: false, // workaround mishoo/UglifyJS2#2821 }; } }; diff --git a/gulpfile.js b/gulpfile.js index 43d8feb052..e52b2aeb02 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/index.js b/index.js index 0920b95e2e..0d627a3024 100644 --- a/index.js +++ b/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -23,117 +24,6 @@ THE SOFTWARE. ****************************************************************************/ -// MACROS - -/** - * !#zh - * 这里是一些用来判断执行环境的宏,这些宏都是全局变量,直接访问即可。
- * 在项目构建时,这些宏将会被预处理并根据构建的平台剔除不需要的代码,例如 - * - * if (CC_DEBUG) { - * cc.log('debug'); - * } - * else { - * cc.log('release'); - * } - * - * 在构建后会只剩下 - * - * cc.log('release'); - * - * (好棒棒)
- *
- * 如需判断脚本是否运行于指定平台,可以用如下表达式: - * - * { - * "编辑器": CC_EDITOR, - * "编辑器 或 预览": CC_DEV, - * "编辑器 或 预览 或 构建调试": CC_DEBUG, - * "网页预览": CC_PREVIEW && !CC_JSB, - * "模拟器预览": CC_PREVIEW && CC_JSB, - * "构建调试": CC_BUILD && CC_DEBUG, - * "构建发行": CC_BUILD && !CC_DEBUG, - * } - * - * !#en - * Here are some of the macro used to determine the execution environment, these macros are global variables, can be accessed directly.
- * When the project is built, these macros will be preprocessed and discard unreachable code based on the built platform, for example: - * - * if (CC_DEBUG) { - * cc.log('debug'); - * } - * else { - * cc.log('release'); - * } - * - * After build will become: - * - * cc.log('release'); - * - *
- * To determine whether the script is running on the specified platform, you can use the following expression: - * - * { - * "editor": CC_EDITOR, - * "editor or preview": CC_DEV, - * "editor or preview or build in debug mode": CC_DEBUG, - * "web preview": CC_PREVIEW && !CC_JSB, - * "simulator preview": CC_PREVIEW && CC_JSB, - * "build in debug mode": CC_BUILD && CC_DEBUG, - * "build in release mode": CC_BUILD && !CC_DEBUG, - * } - * - * @module GLOBAL-MACROS - */ -/** - * @property {Boolean} CC_EDITOR - Running in the editor. - */ -/** - * @property {Boolean} CC_PREVIEW - Preview in browser or simulator. - */ -/** - * @property {Boolean} CC_DEV - Running in the editor or preview. - */ -/** - * @property {Boolean} CC_DEBUG - Running in the editor or preview, or build in debug mode. - */ -/** - * @property {Boolean} CC_BUILD - Running in published project. - */ -/** - * @property {Boolean} CC_JSB - Running in native platform (mobile app, desktop app, or simulator). - */ -/** - * @property {Boolean} CC_TEST - Running in the engine's unit test. - */ -/** - * @property {Boolean} CC_WECHATGAME - Running in the Wechat's mini game. - */ - -// window may be undefined when first load engine from editor -var _global = typeof window === 'undefined' ? global : window; -function defineMacro (name, defaultValue) { - // if "global_defs" not preprocessed by uglify, just declare them globally, - // this may happened in release version's preview page. - // (use evaled code to prevent mangle by uglify) - if (typeof _global[name] === 'undefined') { - _global[name] = defaultValue; - } -} -function defined (name) { - return typeof _global[name] === 'object'; -} - -defineMacro('CC_TEST', defined('tap') || defined('QUnit')); -defineMacro('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions)); -defineMacro('CC_PREVIEW', !CC_EDITOR); -defineMacro('CC_DEV', true); // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_TEST -defineMacro('CC_DEBUG', true); // CC_DEV || Debug Build -defineMacro('CC_JSB', defined('jsb')); -defineMacro('CC_BUILD', false); -defineMacro('CC_WECHATGAME', false); -defineMacro('CC_SUPPORT_JIT', !CC_WECHATGAME); - // PREDEFINE /** @@ -144,20 +34,12 @@ defineMacro('CC_SUPPORT_JIT', !CC_WECHATGAME); * @module cc * @main cc */ -_global.cc = {}; - -if (CC_DEV) { - /** - * contains internal apis for unit tests - * @expose - */ - cc._Test = {}; -} +cc = {}; +require('./predefine'); require('./CCDebugger'); // polyfills -/* require('./polyfill/bind'); */ require('./polyfill/string'); require('./polyfill/misc'); require('./polyfill/array'); @@ -174,7 +56,7 @@ if (!(CC_EDITOR && Editor.isMainProcess)) { require('./cocos2d'); } -// LOAD EXTENDS FOR CREATOR +// LOAD EXTENDS require('./extends'); diff --git a/jsb/index.js b/jsb/index.js index 93fb4d1a44..2269feb143 100644 --- a/jsb/index.js +++ b/jsb/index.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -25,41 +26,12 @@ 'use strict'; -function defineMacro (name, defaultValue) { - // if "global_defs" not preprocessed by uglify, just declare them globally, - // this may happened in release version's preview page. - // (use evaled code to prevent mangle by uglify) - if (typeof window[name] === 'undefined') { - window[name] = defaultValue; - } -} -function defined (name) { - return typeof window[name] === 'object'; -} - -defineMacro('CC_TEST', defined('tap') || defined('QUnit')); -defineMacro('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions)); -defineMacro('CC_PREVIEW', !CC_EDITOR); -defineMacro('CC_DEV', true); // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_TEST -defineMacro('CC_DEBUG', true); // CC_DEV || Debug Build -defineMacro('CC_JSB', defined('jsb')); -defineMacro('CC_BUILD', false); -defineMacro('CC_WECHATGAME', false); -defineMacro('CC_SUPPORT_JIT', !CC_WECHATGAME); - +require('../predefine'); if (!cc.ClassManager) { cc.ClassManager = window.ClassManager; } -if (CC_DEV) { - /** - * contains internal apis for unit tests - * @expose - */ - cc._Test = {}; -} - // polyfills require('../polyfill/misc'); // str.startswith isn't supported in JavaScriptCore which is shipped with iOS8. diff --git a/jsb/jsb-action.js b/jsb/jsb-action.js index fe49f619ff..1d021716b6 100644 --- a/jsb/jsb-action.js +++ b/jsb/jsb-action.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -424,5 +425,17 @@ var actionUpdate = { for (var key in actionUpdate) { var action = cc[key]; - action.prototype.update = actionUpdate[key]; + var prototype = action.prototype; + prototype.update = actionUpdate[key]; + + // polyfill to preserve chainable binding object + prototype.speed = function (speed) { + return new cc.Speed(this, speed); + }; + prototype.repeat = function (times) { + return new cc.Repeat(this, times); + }; + prototype.repeatForever = function () { + return new cc.RepeatForever(this); + }; } \ No newline at end of file diff --git a/jsb/jsb-apis.js b/jsb/jsb-apis.js index 26c105fb71..a74db5b217 100644 --- a/jsb/jsb-apis.js +++ b/jsb/jsb-apis.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-audio.js b/jsb/jsb-audio.js index a2a7449b1c..3d943ec979 100644 --- a/jsb/jsb-audio.js +++ b/jsb/jsb-audio.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-box2d.js b/jsb/jsb-box2d.js index 8d5b76f0f8..4baa2b63e3 100644 --- a/jsb/jsb-box2d.js +++ b/jsb/jsb-box2d.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + (function () { diff --git a/jsb/jsb-director.js b/jsb/jsb-director.js index 36a33cbd77..9f9ef78e83 100644 --- a/jsb/jsb-director.js +++ b/jsb/jsb-director.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-dragonbones.js b/jsb/jsb-dragonbones.js index fe7b674712..e82597fa10 100644 --- a/jsb/jsb-dragonbones.js +++ b/jsb/jsb-dragonbones.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + var proto = dragonBones.CCArmatureDisplay.prototype; cc.js.mixin(proto, cc.EventTarget.prototype); diff --git a/jsb/jsb-editbox.js b/jsb/jsb-editbox.js index 60119e2e25..35e0e5eeae 100644 --- a/jsb/jsb-editbox.js +++ b/jsb/jsb-editbox.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-enums.js b/jsb/jsb-enums.js index d2302b7de3..99b8249bf6 100644 --- a/jsb/jsb-enums.js +++ b/jsb/jsb-enums.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-etc.js b/jsb/jsb-etc.js index 0e41aa65bd..62683d15fe 100644 --- a/jsb/jsb-etc.js +++ b/jsb/jsb-etc.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-event.js b/jsb/jsb-event.js index e806ccb3ca..8ae36f171a 100644 --- a/jsb/jsb-event.js +++ b/jsb/jsb-event.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-game.js b/jsb/jsb-game.js index 943d3e6034..5922c1d402 100644 --- a/jsb/jsb-game.js +++ b/jsb/jsb-game.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-label.js b/jsb/jsb-label.js index 50bb531805..c873bbf1e9 100644 --- a/jsb/jsb-label.js +++ b/jsb/jsb-label.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -113,7 +114,10 @@ jsbLabel.prototype.setLineHeight = function (height) { this._setLineHeight(height); } else { - cc.warnID(4013); + // Todo support setLineHeight for Native + if (40 !== height) { + cc.warnID(4013); + } } }; diff --git a/jsb/jsb-loader.js b/jsb/jsb-loader.js index 70228ddc23..259440e63d 100644 --- a/jsb/jsb-loader.js +++ b/jsb/jsb-loader.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-particle.js b/jsb/jsb-particle.js index 77f04f70e6..8cfb73f3df 100644 --- a/jsb/jsb-particle.js +++ b/jsb/jsb-particle.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-scale9sprite.js b/jsb/jsb-scale9sprite.js index 95e509a44f..8edc97ee97 100644 --- a/jsb/jsb-scale9sprite.js +++ b/jsb/jsb-scale9sprite.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-spine.js b/jsb/jsb-spine.js index 096ef41d90..32fd3d9447 100644 --- a/jsb/jsb-spine.js +++ b/jsb/jsb-spine.js @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + sp._SGSkeleton = sp.Skeleton; sp._SGSkeletonAnimation = sp.SkeletonAnimation; diff --git a/jsb/jsb-tex-sprite-frame.js b/jsb/jsb-tex-sprite-frame.js index 9e5dd332f2..2d7a88451e 100644 --- a/jsb/jsb-tex-sprite-frame.js +++ b/jsb/jsb-tex-sprite-frame.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-tiledmap.js b/jsb/jsb-tiledmap.js index acf1f911ad..dc30cc6614 100644 --- a/jsb/jsb-tiledmap.js +++ b/jsb/jsb-tiledmap.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-videoplayer.js b/jsb/jsb-videoplayer.js index ab7d40ebc3..fe9d3fe96d 100644 --- a/jsb/jsb-videoplayer.js +++ b/jsb/jsb-videoplayer.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/jsb/jsb-webview.js b/jsb/jsb-webview.js index 0065697b57..388af5e49e 100644 --- a/jsb/jsb-webview.js +++ b/jsb/jsb-webview.js @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/licenses/LICENSE b/licenses/LICENSE index 8d8c76abdb..8102192271 100644 --- a/licenses/LICENSE +++ b/licenses/LICENSE @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license + worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. - Chukong Aipu reserves all rights not expressly granted to you. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/package.json b/package.json index 92d1416749..2e1729b0f4 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "jshint-stylish": "2.1.0", "multipipe": "0.3.0", "persistify": "^1.1.1", - "uglify-es": "~3.3.3", + "require-dir": "0.3.0", + "uglify-es": "3.3.7", "vinyl": "1.1.0", "vinyl-buffer": "1.0.0", "vinyl-source-stream": "1.0.0", diff --git a/predefine.js b/predefine.js new file mode 100644 index 0000000000..c5743f3ce5 --- /dev/null +++ b/predefine.js @@ -0,0 +1,161 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +// MACROS + +/** + * !#zh + * 这里是一些用来判断执行环境的宏,这些宏都是全局变量,直接访问即可。
+ * 在项目构建时,这些宏将会被预处理并根据构建的平台剔除不需要的代码,例如 + * + * if (CC_DEBUG) { + * cc.log('debug'); + * } + * else { + * cc.log('release'); + * } + * + * 在构建后会只剩下 + * + * cc.log('release'); + * + * (好棒棒)
+ *
+ * 如需判断脚本是否运行于指定平台,可以用如下表达式: + * + * { + * "编辑器": CC_EDITOR, + * "编辑器 或 预览": CC_DEV, + * "编辑器 或 预览 或 构建调试": CC_DEBUG, + * "网页预览": CC_PREVIEW && !CC_JSB, + * "模拟器预览": CC_PREVIEW && CC_JSB, + * "构建调试": CC_BUILD && CC_DEBUG, + * "构建发行": CC_BUILD && !CC_DEBUG, + * } + * + * !#en + * Here are some of the macro used to determine the execution environment, these macros are global variables, can be accessed directly.
+ * When the project is built, these macros will be preprocessed and discard unreachable code based on the built platform, for example: + * + * if (CC_DEBUG) { + * cc.log('debug'); + * } + * else { + * cc.log('release'); + * } + * + * After build will become: + * + * cc.log('release'); + * + *
+ * To determine whether the script is running on the specified platform, you can use the following expression: + * + * { + * "editor": CC_EDITOR, + * "editor or preview": CC_DEV, + * "editor or preview or build in debug mode": CC_DEBUG, + * "web preview": CC_PREVIEW && !CC_JSB, + * "simulator preview": CC_PREVIEW && CC_JSB, + * "build in debug mode": CC_BUILD && CC_DEBUG, + * "build in release mode": CC_BUILD && !CC_DEBUG, + * } + * + * @module GLOBAL-MACROS + */ +/** + * @property {Boolean} CC_EDITOR - Running in the editor. + */ +/** + * @property {Boolean} CC_PREVIEW - Preview in browser or simulator. + */ +/** + * @property {Boolean} CC_DEV - Running in the editor or preview. + */ +/** + * @property {Boolean} CC_DEBUG - Running in the editor or preview, or build in debug mode. + */ +/** + * @property {Boolean} CC_BUILD - Running in published project. + */ +/** + * @property {Boolean} CC_JSB - Running in native platform (mobile app, desktop app, or simulator). + */ +/** + * @property {Boolean} CC_TEST - Running in the engine's unit test. + */ +/** + * @property {Boolean} CC_WECHATGAME - Running in the Wechat's mini game. + */ +/** + * @property {Boolean} CC_QQPLAY - Running in the bricks. + */ + +// window may be undefined when first load engine from editor +var _global = typeof window === 'undefined' ? global : window; +function defineMacro (name, defaultValue) { + // if "global_defs" not preprocessed by uglify, just declare them globally, + // this may happened in release version's preview page. + if (typeof _global[name] === 'undefined') { + _global[name] = defaultValue; + } +} +function defined (name) { + return typeof _global[name] === 'object'; +} + +defineMacro('CC_TEST', defined('tap') || defined('QUnit')); +defineMacro('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions)); +defineMacro('CC_PREVIEW', !CC_EDITOR); +defineMacro('CC_DEV', true); // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_TEST +defineMacro('CC_DEBUG', true); // CC_DEV || Debug Build +defineMacro('CC_JSB', defined('jsb')); +defineMacro('CC_BUILD', false); +defineMacro('CC_WECHATGAME', false); +defineMacro('CC_QQPLAY', false); +defineMacro('CC_SUPPORT_JIT', !(CC_WECHATGAME || CC_QQPLAY)); + +// + +if (CC_DEV) { + /** + * contains internal apis for unit tests + * @expose + */ + cc._Test = {}; +} + +/** + * @module cc + */ + +/** + * The current version of Cocos2d being used.
+ * Please DO NOT remove this String, it is an important flag for bug tracking.
+ * If you post a bug to forum, please attach this flag. + * @property {String} ENGINE_VERSION + */ +const engineVersion = '1.8.1'; +_global['CocosEngine'] = cc.ENGINE_VERSION = engineVersion; diff --git a/test/qunit/unit-es5/test-animation.js b/test/qunit/unit-es5/test-animation.js index 12f6573a59..51c614b27f 100644 --- a/test/qunit/unit-es5/test-animation.js +++ b/test/qunit/unit-es5/test-animation.js @@ -532,6 +532,7 @@ test('EventAnimCurve', function () { animation.play('test'); state.wrapMode = cc.WrapMode.Loop; state.repeatCount = Infinity; + manager.update(0); manager.update(1.7); calls = []; manager.update(0.3); @@ -551,6 +552,7 @@ test('EventAnimCurve', function () { animation.play('test'); state.wrapMode = cc.WrapMode.Loop; state.repeatCount = Infinity; + manager.update(0); manager.update(1.7); calls = []; manager.update(0.5); @@ -570,6 +572,7 @@ test('EventAnimCurve', function () { animation.play('test'); state.wrapMode = cc.WrapMode.Reverse; state.repeatCount = 1; + manager.update(0); calls = []; manager.update(0.1); deepEqual(calls, [], 'should triggered no events if wrapMode is Reverse'); @@ -626,6 +629,7 @@ test('EventAnimCurve', function () { animation.play('test'); state.wrapMode = cc.WrapMode.PingPong; state.repeatCount = Infinity; + manager.update(0); manager.update(1.7); calls = []; manager.update(0.5); @@ -653,6 +657,7 @@ test('EventAnimCurve', function () { animation.play('test'); state.wrapMode = cc.WrapMode.PingPongReverse; state.repeatCount = Infinity; + manager.update(0); manager.update(1.7); calls = []; manager.update(0.5); @@ -668,6 +673,7 @@ test('EventAnimCurve', function () { state.speed = -1; state.wrapMode = cc.WrapMode.Normal; state.repeatCount = Infinity; + manager.update(0); calls = []; manager.update(0.5); deepEqual(calls, [ @@ -684,6 +690,7 @@ test('EventAnimCurve', function () { state.speed = -1; state.wrapMode = cc.WrapMode.PingPongReverse; state.repeatCount = Infinity; + manager.update(0); manager.update(1.7); calls = []; manager.update(0.5); @@ -773,6 +780,7 @@ test('EventAnimCurve', function () { animation.play('test'); state.wrapMode = cc.WrapMode.PingPong; state.setTime(0); + manager.update(0); calls = []; manager.update(1); manager.update(2); @@ -794,6 +802,7 @@ test('EventAnimCurve', function () { state.wrapMode = cc.WrapMode.LoopReverse; state.setTime(0); calls = []; + manager.update(0); manager.update(2); deepEqual(calls, [ { diff --git a/test/qunit/unit-es5/test-component-scheduler.js b/test/qunit/unit-es5/test-component-scheduler.js index 96a838b146..ba3099249c 100644 --- a/test/qunit/unit-es5/test-component-scheduler.js +++ b/test/qunit/unit-es5/test-component-scheduler.js @@ -165,6 +165,117 @@ test('disable component during onEnable', function () { childComp.onEnable.once('could re-enable component'); }); +test('change hierarchy during own deactivation', function () { + var vendorError = cc.errorID; + cc.errorID = new Callback(); + + var nodes1 = createNodes({ + preNode: {}, + testNode: { + comps: cc.Component, + }, + testNode2: { + comps: cc.Component, + }, + }); + nodes1.attachToScene(); + + cc.errorID.disable('Should allow change hierarchy during own deactivation'); + + nodes1.testNodeComps[0].onDisable = function() { + this.node.parent = nodes1.preNode; + }; + nodes1.testNode.active = false; + + nodes1.testNode2Comps[0].onDisable = function() { + this.node.parent = null; + }; + nodes1.testNode2.active = false; + + expect(0); + + cc.errorID = vendorError; +}); + +test('change hierarchy during parent\'s deactivation', function () { + var vendorError = cc.errorID; + cc.errorID = new Callback().enable(); + + var nodes = createNodes({ + parent1: { + preNode: {}, + testNode1: { + comps: cc.Component, + }, + }, + parent2: { + testNode2: { + comps: cc.Component, + }, + }, + parent3: { + testNode3: { + comps: cc.Component, + }, + }, + }); + nodes.attachToScene(); + + nodes.testNode1Comps[0].onDisable = function() { + this.node.parent = nodes.preNode; + }; + nodes.parent1.active = false; + cc.errorID.once('Should report error if change child'); + + nodes.testNode2Comps[0].onDisable = function() { + this.node.parent = null; + }; + nodes.parent2.active = false; + cc.errorID.once('Should report error if detach child'); + + nodes.testNode3Comps[0].onDisable = function() { + this.node.parent.addChild(new cc.Node()); + }; + nodes.parent3.active = false; + cc.errorID.once('Should report error if add child'); + + cc.errorID = vendorError; +}); + +test('set sibling index during onDisable', function () { + var vendorError = cc.errorID; + cc.errorID = new Callback().enable(); + + var nodes = createNodes({ + parent: { + node1: { + comps: cc.Component, + }, + node: {} + }, + node2: { + comps: cc.Component, + } + }); + var node1Comp = nodes.node1Comps[0]; + var node2Comp = nodes.node2Comps[0]; + node1Comp.onDisable = function() { + this.node.setSiblingIndex(1); + }; + node2Comp.onDisable = function() { + this.node.setSiblingIndex(0); + }; + nodes.attachToScene(); + + nodes.parent.active = false; + cc.errorID.once('Should report error when setting node\'s sibling index during its parent\'s deactivation'); + + cc.errorID.disable('Should allow setting node\'s sibling index during its deactivation'); + nodes.node2.active = false; + + cc.errorID = vendorError; +}); + (function () { // Test deactivate during activating or conversely diff --git a/test/qunit/unit-es5/test-path.js b/test/qunit/unit-es5/test-path.js new file mode 100644 index 0000000000..62b9f7a21d --- /dev/null +++ b/test/qunit/unit-es5/test-path.js @@ -0,0 +1,12 @@ +module('cc.path', SetupEngine); + +test('dirname', function () { + + ok(cc.path.dirname('aa/bb/cc') === 'aa/bb', 'get success'); + ok(cc.path.dirname('aa/bb/cc.png') === 'aa/bb', 'get success'); + ok(cc.path.dirname('aa/bb/cc/') === 'aa/bb/cc', 'get success'); + ok(cc.path.dirname('aa/bb/cc.png/ee.png') === 'aa/bb/cc.png', 'get success'); + ok(cc.path.dirname('D:\\aa\\bb') === 'D:\\aa', 'get success'); + ok(cc.path.dirname('aa/bb/.github/.gitignore') === 'aa/bb/.github', 'get success'); + +});