1 /**************************************************************************** 2 Copyright (c) 2011-2012 cocos2d-x.org 3 Copyright (c) 2013-2014 Chukong Technologies Inc. 4 5 http://www.cocos2d-x.org 6 7 Permission is hereby granted, free of charge, to any person obtaining a copy 8 of this software and associated documentation files (the "Software"), to deal 9 in the Software without restriction, including without limitation the rights 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 copies of the Software, and to permit persons to whom the Software is 12 furnished to do so, subject to the following conditions: 13 14 The above copyright notice and this permission notice shall be included in 15 all copies or substantial portions of the Software. 16 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 THE SOFTWARE. 24 ****************************************************************************/ 25 26 /** 27 * Decorative a display node for Cocos Armature 28 * @class 29 * @extends ccs.Class 30 */ 31 ccs.DecorativeDisplay = ccs.Class.extend(/** @lends ccs.DecorativeDisplay# */{ 32 _display: null, 33 _colliderDetector: null, 34 _displayData: null, 35 36 /** 37 * Construction of ccs.DecorativeDisplay 38 */ 39 ctor:function () { 40 this._display = null; 41 this._colliderDetector = null; 42 this._displayData = null; 43 }, 44 45 /** 46 * Initializes a ccs.DecorativeDisplay 47 * @returns {boolean} 48 */ 49 init:function () { 50 return true; 51 }, 52 53 /** 54 * Sets display node to decorative 55 * @param {cc.Node} display 56 */ 57 setDisplay:function (display) { 58 this._display = display; 59 }, 60 61 /** 62 * Returns the display node 63 * @returns {cc.Node} 64 */ 65 getDisplay:function () { 66 return this._display; 67 }, 68 69 /** 70 * Sets collide detector 71 * @param {ccs.ColliderDetector} colliderDetector 72 */ 73 setColliderDetector:function (colliderDetector) { 74 this._colliderDetector = colliderDetector; 75 }, 76 77 /** 78 * Returns collide detector 79 * @returns {ccs.ColliderDetector} 80 */ 81 getColliderDetector:function () { 82 return this._colliderDetector; 83 }, 84 85 /** 86 * Sets display data 87 * @param {ccs.DisplayData} displayData 88 */ 89 setDisplayData:function (displayData) { 90 this._displayData = displayData; 91 }, 92 93 /** 94 * Returns display data 95 * @returns {ccs.DisplayData} 96 */ 97 getDisplayData:function () { 98 return this._displayData; 99 }, 100 101 release:function () { 102 this._display = null; 103 this._displayData = null; 104 this._colliderDetector = null; 105 } 106 }); 107 108 /** 109 * Allocates and initializes a decorative display. 110 * @return {ccs.DecorativeDisplay} 111 * @example 112 * // example 113 * var display = ccs.DecorativeDisplay.create(); 114 */ 115 ccs.DecorativeDisplay.create = function () { 116 var decorativeDisplay = new ccs.DecorativeDisplay(); 117 if (decorativeDisplay && decorativeDisplay.init()) 118 return decorativeDisplay; 119 return null; 120 };